@alloy-js/core 0.20.0-dev.4 → 0.20.0-dev.7

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 (334) hide show
  1. package/dist/src/binder.d.ts +74 -38
  2. package/dist/src/binder.d.ts.map +1 -1
  3. package/dist/src/binder.js +235 -173
  4. package/dist/src/binder.js.map +1 -0
  5. package/dist/src/code.js +2 -1
  6. package/dist/src/code.js.map +1 -0
  7. package/dist/src/components/AppendFile.js +2 -1
  8. package/dist/src/components/AppendFile.js.map +1 -0
  9. package/dist/src/components/Block.js +2 -1
  10. package/dist/src/components/Block.js.map +1 -0
  11. package/dist/src/components/CopyFile.js +2 -1
  12. package/dist/src/components/CopyFile.js.map +1 -0
  13. package/dist/src/components/Declaration.d.ts +2 -2
  14. package/dist/src/components/Declaration.d.ts.map +1 -1
  15. package/dist/src/components/Declaration.js +10 -3
  16. package/dist/src/components/Declaration.js.map +1 -0
  17. package/dist/src/components/For.js +2 -1
  18. package/dist/src/components/For.js.map +1 -0
  19. package/dist/src/components/Indent.js +2 -1
  20. package/dist/src/components/Indent.js.map +1 -0
  21. package/dist/src/components/List.js +2 -1
  22. package/dist/src/components/List.js.map +1 -0
  23. package/dist/src/components/MemberDeclaration.d.ts +2 -2
  24. package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
  25. package/dist/src/components/MemberDeclaration.js +11 -6
  26. package/dist/src/components/MemberDeclaration.js.map +1 -0
  27. package/dist/src/components/MemberName.js +2 -1
  28. package/dist/src/components/MemberName.js.map +1 -0
  29. package/dist/src/components/MemberScope.d.ts +30 -13
  30. package/dist/src/components/MemberScope.d.ts.map +1 -1
  31. package/dist/src/components/MemberScope.js +39 -16
  32. package/dist/src/components/MemberScope.js.map +1 -0
  33. package/dist/src/components/Name.js +2 -1
  34. package/dist/src/components/Name.js.map +1 -0
  35. package/dist/src/components/Output.d.ts.map +1 -1
  36. package/dist/src/components/Output.js +4 -6
  37. package/dist/src/components/Output.js.map +1 -0
  38. package/dist/src/components/Prose.js +2 -1
  39. package/dist/src/components/Prose.js.map +1 -0
  40. package/dist/src/components/ReferenceOrContent.d.ts +1 -1
  41. package/dist/src/components/ReferenceOrContent.d.ts.map +1 -1
  42. package/dist/src/components/ReferenceOrContent.js +2 -1
  43. package/dist/src/components/ReferenceOrContent.js.map +1 -0
  44. package/dist/src/components/Scope.d.ts +5 -5
  45. package/dist/src/components/Scope.d.ts.map +1 -1
  46. package/dist/src/components/Scope.js +11 -6
  47. package/dist/src/components/Scope.js.map +1 -0
  48. package/dist/src/components/Show.js +2 -1
  49. package/dist/src/components/Show.js.map +1 -0
  50. package/dist/src/components/SourceDirectory.js +2 -1
  51. package/dist/src/components/SourceDirectory.js.map +1 -0
  52. package/dist/src/components/SourceFile.js +2 -1
  53. package/dist/src/components/SourceFile.js.map +1 -0
  54. package/dist/src/components/StatementList.js +2 -1
  55. package/dist/src/components/StatementList.js.map +1 -0
  56. package/dist/src/components/Switch.js +2 -1
  57. package/dist/src/components/Switch.js.map +1 -0
  58. package/dist/src/components/TemplateFile.js +2 -1
  59. package/dist/src/components/TemplateFile.js.map +1 -0
  60. package/dist/src/components/UpdateFile.js +2 -1
  61. package/dist/src/components/UpdateFile.js.map +1 -0
  62. package/dist/src/components/Wrap.js +2 -1
  63. package/dist/src/components/Wrap.js.map +1 -0
  64. package/dist/src/components/index.js +2 -1
  65. package/dist/src/components/index.js.map +1 -0
  66. package/dist/src/components/stc/index.js +2 -1
  67. package/dist/src/components/stc/index.js.map +1 -0
  68. package/dist/src/components/stc/sti.js +2 -1
  69. package/dist/src/components/stc/sti.js.map +1 -0
  70. package/dist/src/context/assignment.js +2 -1
  71. package/dist/src/context/assignment.js.map +1 -0
  72. package/dist/src/context/binder.js +2 -1
  73. package/dist/src/context/binder.js.map +1 -0
  74. package/dist/src/context/declaration.js +2 -1
  75. package/dist/src/context/declaration.js.map +1 -0
  76. package/dist/src/context/index.js +2 -1
  77. package/dist/src/context/index.js.map +1 -0
  78. package/dist/src/context/member-declaration.js +2 -1
  79. package/dist/src/context/member-declaration.js.map +1 -0
  80. package/dist/src/context/member-scope.d.ts +7 -8
  81. package/dist/src/context/member-scope.d.ts.map +1 -1
  82. package/dist/src/context/member-scope.js +7 -6
  83. package/dist/src/context/member-scope.js.map +1 -0
  84. package/dist/src/context/name-policy.d.ts.map +1 -1
  85. package/dist/src/context/name-policy.js +5 -1
  86. package/dist/src/context/name-policy.js.map +1 -0
  87. package/dist/src/context/scope.d.ts +1 -0
  88. package/dist/src/context/scope.d.ts.map +1 -1
  89. package/dist/src/context/scope.js +9 -1
  90. package/dist/src/context/scope.js.map +1 -0
  91. package/dist/src/context/source-directory.js +2 -1
  92. package/dist/src/context/source-directory.js.map +1 -0
  93. package/dist/src/context/source-file.js +2 -1
  94. package/dist/src/context/source-file.js.map +1 -0
  95. package/dist/src/context.js +2 -1
  96. package/dist/src/context.js.map +1 -0
  97. package/dist/src/debug.js +2 -1
  98. package/dist/src/debug.js.map +1 -0
  99. package/dist/src/host/alloy-host.browser.js +2 -1
  100. package/dist/src/host/alloy-host.browser.js.map +1 -0
  101. package/dist/src/host/alloy-host.js +2 -1
  102. package/dist/src/host/alloy-host.js.map +1 -0
  103. package/dist/src/host/interface.js +2 -1
  104. package/dist/src/host/interface.js.map +1 -0
  105. package/dist/src/index.browser.js +2 -1
  106. package/dist/src/index.browser.js.map +1 -0
  107. package/dist/src/index.js +2 -1
  108. package/dist/src/index.js.map +1 -0
  109. package/dist/src/inspect.browser.d.ts +5 -0
  110. package/dist/src/inspect.browser.d.ts.map +1 -0
  111. package/dist/src/inspect.browser.js +6 -0
  112. package/dist/src/inspect.browser.js.map +1 -0
  113. package/dist/src/inspect.d.ts +2 -0
  114. package/dist/src/inspect.d.ts.map +1 -0
  115. package/dist/src/inspect.js +2 -0
  116. package/dist/src/inspect.js.map +1 -0
  117. package/dist/src/jsx-runtime.js +2 -1
  118. package/dist/src/jsx-runtime.js.map +1 -0
  119. package/dist/src/name-policy.d.ts +11 -0
  120. package/dist/src/name-policy.d.ts.map +1 -1
  121. package/dist/src/name-policy.js +5 -1
  122. package/dist/src/name-policy.js.map +1 -0
  123. package/dist/src/props-combinators.js +2 -1
  124. package/dist/src/props-combinators.js.map +1 -0
  125. package/dist/src/reactive-union-set.d.ts.map +1 -1
  126. package/dist/src/reactive-union-set.js +14 -9
  127. package/dist/src/reactive-union-set.js.map +1 -0
  128. package/dist/src/reactivity.js +2 -1
  129. package/dist/src/reactivity.js.map +1 -0
  130. package/dist/src/refkey.d.ts +39 -3
  131. package/dist/src/refkey.d.ts.map +1 -1
  132. package/dist/src/refkey.js +65 -10
  133. package/dist/src/refkey.js.map +1 -0
  134. package/dist/src/render.js +2 -1
  135. package/dist/src/render.js.map +1 -0
  136. package/dist/src/resource.js +2 -1
  137. package/dist/src/resource.js.map +1 -0
  138. package/dist/src/runtime/component.js +2 -1
  139. package/dist/src/runtime/component.js.map +1 -0
  140. package/dist/src/runtime/intrinsic.js +2 -1
  141. package/dist/src/runtime/intrinsic.js.map +1 -0
  142. package/dist/src/scheduler.js +2 -1
  143. package/dist/src/scheduler.js.map +1 -0
  144. package/dist/src/stc.js +2 -1
  145. package/dist/src/stc.js.map +1 -0
  146. package/dist/src/sti.js +2 -1
  147. package/dist/src/sti.js.map +1 -0
  148. package/dist/src/symbols/basic-scope.d.ts +14 -0
  149. package/dist/src/symbols/basic-scope.d.ts.map +1 -0
  150. package/dist/src/symbols/basic-scope.js +21 -0
  151. package/dist/src/symbols/basic-scope.js.map +1 -0
  152. package/dist/src/symbols/basic-symbol.d.ts +19 -0
  153. package/dist/src/symbols/basic-symbol.d.ts.map +1 -0
  154. package/dist/src/symbols/basic-symbol.js +29 -0
  155. package/dist/src/symbols/basic-symbol.js.map +1 -0
  156. package/dist/src/symbols/index.d.ts +3 -1
  157. package/dist/src/symbols/index.d.ts.map +1 -1
  158. package/dist/src/symbols/index.js +5 -2
  159. package/dist/src/symbols/index.js.map +1 -0
  160. package/dist/src/symbols/output-scope.d.ts +70 -41
  161. package/dist/src/symbols/output-scope.d.ts.map +1 -1
  162. package/dist/src/symbols/output-scope.js +100 -131
  163. package/dist/src/symbols/output-scope.js.map +1 -0
  164. package/dist/src/symbols/output-space.d.ts +25 -0
  165. package/dist/src/symbols/output-space.d.ts.map +1 -0
  166. package/dist/src/symbols/output-space.js +36 -0
  167. package/dist/src/symbols/output-space.js.map +1 -0
  168. package/dist/src/symbols/output-symbol.d.ts +213 -37
  169. package/dist/src/symbols/output-symbol.d.ts.map +1 -1
  170. package/dist/src/symbols/output-symbol.js +325 -204
  171. package/dist/src/symbols/output-symbol.js.map +1 -0
  172. package/dist/src/symbols/symbol-flow.d.ts +1 -1
  173. package/dist/src/symbols/symbol-flow.d.ts.map +1 -1
  174. package/dist/src/symbols/symbol-flow.js +24 -8
  175. package/dist/src/symbols/symbol-flow.js.map +1 -0
  176. package/dist/src/symbols/symbol-slot.d.ts +27 -9
  177. package/dist/src/symbols/symbol-slot.d.ts.map +1 -1
  178. package/dist/src/symbols/symbol-slot.js +22 -5
  179. package/dist/src/symbols/symbol-slot.js.map +1 -0
  180. package/dist/src/symbols/symbol-table.d.ts +19 -8
  181. package/dist/src/symbols/symbol-table.d.ts.map +1 -1
  182. package/dist/src/symbols/symbol-table.js +67 -17
  183. package/dist/src/symbols/symbol-table.js.map +1 -0
  184. package/dist/src/tap.js +2 -1
  185. package/dist/src/tap.js.map +1 -0
  186. package/dist/src/tracer.d.ts +15 -3
  187. package/dist/src/tracer.d.ts.map +1 -1
  188. package/dist/src/tracer.js +41 -64
  189. package/dist/src/tracer.js.map +1 -0
  190. package/dist/src/utils.js +2 -1
  191. package/dist/src/utils.js.map +1 -0
  192. package/dist/src/write-output.js +2 -1
  193. package/dist/src/write-output.js.map +1 -0
  194. package/dist/test/browser-build.test.js +2 -1
  195. package/dist/test/browser-build.test.js.map +1 -0
  196. package/dist/test/children.test.js +2 -1
  197. package/dist/test/children.test.js.map +1 -0
  198. package/dist/test/components/append-file.test.js +2 -1
  199. package/dist/test/components/append-file.test.js.map +1 -0
  200. package/dist/test/components/block.test.js +2 -1
  201. package/dist/test/components/block.test.js.map +1 -0
  202. package/dist/test/components/copy-file.test.js +2 -1
  203. package/dist/test/components/copy-file.test.js.map +1 -0
  204. package/dist/test/components/declaration.test.js +11 -15
  205. package/dist/test/components/declaration.test.js.map +1 -0
  206. package/dist/test/components/list.test.js +2 -1
  207. package/dist/test/components/list.test.js.map +1 -0
  208. package/dist/test/components/prose.test.js +2 -1
  209. package/dist/test/components/prose.test.js.map +1 -0
  210. package/dist/test/components/reference-or-content.test.js +4 -3
  211. package/dist/test/components/reference-or-content.test.js.map +1 -0
  212. package/dist/test/components/source-file.test.js +2 -1
  213. package/dist/test/components/source-file.test.js.map +1 -0
  214. package/dist/test/components/template-file.test.js +2 -1
  215. package/dist/test/components/template-file.test.js.map +1 -0
  216. package/dist/test/components/update-file.test.js +2 -1
  217. package/dist/test/components/update-file.test.js.map +1 -0
  218. package/dist/test/components/wrap.test.js +2 -1
  219. package/dist/test/components/wrap.test.js.map +1 -0
  220. package/dist/test/control-flow/for.test.js +2 -1
  221. package/dist/test/control-flow/for.test.js.map +1 -0
  222. package/dist/test/control-flow/match.test.js +2 -1
  223. package/dist/test/control-flow/match.test.js.map +1 -0
  224. package/dist/test/control-flow/show.test.js +2 -1
  225. package/dist/test/control-flow/show.test.js.map +1 -0
  226. package/dist/test/name-policy.test.js +2 -1
  227. package/dist/test/name-policy.test.js.map +1 -0
  228. package/dist/test/props-with-defaults.test.js +2 -1
  229. package/dist/test/props-with-defaults.test.js.map +1 -0
  230. package/dist/test/reactive-union-set.test.js +2 -1
  231. package/dist/test/reactive-union-set.test.js.map +1 -0
  232. package/dist/test/reactivity/circular-reactives.test.js +2 -1
  233. package/dist/test/reactivity/circular-reactives.test.js.map +1 -0
  234. package/dist/test/reactivity/cleanup.test.js +2 -1
  235. package/dist/test/reactivity/cleanup.test.js.map +1 -0
  236. package/dist/test/reactivity/memo.test.js +2 -1
  237. package/dist/test/reactivity/memo.test.js.map +1 -0
  238. package/dist/test/reactivity/ref-rendering.test.js +2 -1
  239. package/dist/test/reactivity/ref-rendering.test.js.map +1 -0
  240. package/dist/test/reactivity/test.test.js +2 -1
  241. package/dist/test/reactivity/test.test.js.map +1 -0
  242. package/dist/test/reactivity/untrack.test.js +2 -1
  243. package/dist/test/reactivity/untrack.test.js.map +1 -0
  244. package/dist/test/refkey.test.js +2 -1
  245. package/dist/test/refkey.test.js.map +1 -0
  246. package/dist/test/rendering/basic.test.js +2 -1
  247. package/dist/test/rendering/basic.test.js.map +1 -0
  248. package/dist/test/rendering/code.test.js +2 -1
  249. package/dist/test/rendering/code.test.js.map +1 -0
  250. package/dist/test/rendering/formatting.test.js +2 -1
  251. package/dist/test/rendering/formatting.test.js.map +1 -0
  252. package/dist/test/rendering/indent.test.js +2 -1
  253. package/dist/test/rendering/indent.test.js.map +1 -0
  254. package/dist/test/rendering/memoization.test.js +2 -1
  255. package/dist/test/rendering/memoization.test.js.map +1 -0
  256. package/dist/test/rendering/refkeys.test.js +2 -1
  257. package/dist/test/rendering/refkeys.test.js.map +1 -0
  258. package/dist/test/split-props.test.js +2 -1
  259. package/dist/test/split-props.test.js.map +1 -0
  260. package/dist/test/stc.test.js +2 -1
  261. package/dist/test/stc.test.js.map +1 -0
  262. package/dist/test/symbols/output-scope.test.js +34 -198
  263. package/dist/test/symbols/output-scope.test.js.map +1 -0
  264. package/dist/test/symbols/output-symbol.test.js +141 -386
  265. package/dist/test/symbols/output-symbol.test.js.map +1 -0
  266. package/dist/test/symbols/resolution.test.js +433 -115
  267. package/dist/test/symbols/resolution.test.js.map +1 -0
  268. package/dist/test/symbols/symbol-table.test.d.ts +2 -0
  269. package/dist/test/symbols/symbol-table.test.d.ts.map +1 -0
  270. package/dist/test/symbols/symbol-table.test.js +15 -0
  271. package/dist/test/symbols/symbol-table.test.js.map +1 -0
  272. package/dist/test/symbols/utils.d.ts +10 -24
  273. package/dist/test/symbols/utils.d.ts.map +1 -1
  274. package/dist/test/symbols/utils.js +25 -46
  275. package/dist/test/symbols/utils.js.map +1 -0
  276. package/dist/test/utils.test.js +2 -1
  277. package/dist/test/utils.test.js.map +1 -0
  278. package/dist/testing/extend-expect.js +2 -1
  279. package/dist/testing/extend-expect.js.map +1 -0
  280. package/dist/testing/extend-expect.test.js +2 -1
  281. package/dist/testing/extend-expect.test.js.map +1 -0
  282. package/dist/testing/index.js +2 -1
  283. package/dist/testing/index.js.map +1 -0
  284. package/dist/testing/render.js +2 -1
  285. package/dist/testing/render.js.map +1 -0
  286. package/dist/testing/vitest.d.js +2 -1
  287. package/dist/testing/vitest.d.js.map +1 -0
  288. package/dist/tsconfig.tsbuildinfo +1 -1
  289. package/package.json +5 -3
  290. package/src/binder.ts +368 -273
  291. package/src/components/Declaration.tsx +13 -3
  292. package/src/components/MemberDeclaration.tsx +15 -8
  293. package/src/components/MemberScope.tsx +61 -20
  294. package/src/components/Output.tsx +0 -4
  295. package/src/components/Scope.tsx +16 -9
  296. package/src/context/member-scope.ts +10 -10
  297. package/src/context/name-policy.ts +3 -0
  298. package/src/context/scope.ts +9 -0
  299. package/src/inspect.browser.ts +6 -0
  300. package/src/inspect.ts +1 -0
  301. package/src/name-policy.ts +14 -0
  302. package/src/reactive-union-set.ts +14 -8
  303. package/src/refkey.ts +106 -14
  304. package/src/symbols/basic-scope.ts +23 -0
  305. package/src/symbols/basic-symbol.ts +32 -0
  306. package/src/symbols/index.ts +3 -1
  307. package/src/symbols/output-scope.ts +131 -170
  308. package/src/symbols/output-space.ts +49 -0
  309. package/src/symbols/output-symbol.ts +434 -258
  310. package/src/symbols/symbol-flow.ts +38 -9
  311. package/src/symbols/symbol-slot.tsx +46 -8
  312. package/src/symbols/symbol-table.ts +95 -21
  313. package/src/tracer.ts +53 -83
  314. package/temp/api.json +7009 -4461
  315. package/test/components/declaration.test.tsx +6 -19
  316. package/test/components/reference-or-content.test.tsx +2 -2
  317. package/test/symbols/output-scope.test.ts +33 -125
  318. package/test/symbols/output-symbol.test.ts +128 -348
  319. package/test/symbols/resolution.test.ts +530 -117
  320. package/test/symbols/symbol-table.test.ts +15 -0
  321. package/test/symbols/utils.ts +38 -74
  322. package/tsdoc.json +4 -0
  323. package/dist/src/slot.d.ts +0 -15
  324. package/dist/src/slot.d.ts.map +0 -1
  325. package/dist/src/slot.js +0 -50
  326. package/dist/src/symbols/flags.d.ts +0 -70
  327. package/dist/src/symbols/flags.d.ts.map +0 -1
  328. package/dist/src/symbols/flags.js +0 -72
  329. package/dist/test/components/slot.test.d.ts +0 -2
  330. package/dist/test/components/slot.test.d.ts.map +0 -1
  331. package/dist/test/components/slot.test.js +0 -134
  332. package/src/slot.ts +0 -89
  333. package/src/symbols/flags.ts +0 -82
  334. package/test/components/slot.test.tsx +0 -174
@@ -1,6 +1,5 @@
1
1
  import { Ref } from "@vue/reactivity";
2
2
  import { Refkey } from "./refkey.js";
3
- import { OutputSymbolFlags } from "./symbols/flags.js";
4
3
  import { OutputScope } from "./symbols/output-scope.js";
5
4
  import { type OutputSymbol } from "./symbols/output-symbol.js";
6
5
  export type Metadata = object;
@@ -25,28 +24,12 @@ export interface Binder {
25
24
  * @see {@link resolve} a convenience function that uses the current scope and
26
25
  * binder.
27
26
  */
28
- resolveDeclarationByKey<TScope extends OutputScope = OutputScope, TSymbol extends OutputSymbol = OutputSymbol>(currentScope: TScope | undefined, currentMemberScope: TScope | undefined, key: Refkey): Ref<ResolutionResult<TScope, TSymbol> | undefined>;
29
- getSymbolForRefkey<TSymbol extends OutputSymbol>(refkey: Refkey): Ref<TSymbol | undefined>;
30
- /**
31
- * Find a symbol with a given name in the given scope. Returns a ref
32
- * for the symbol, such that when the symbol is available, the ref value
33
- * will update.
34
- */
35
- findSymbolName<TScope extends OutputScope = OutputScope, TSymbol extends OutputSymbol = OutputSymbol>(currentScope: TScope | undefined, name: string): Ref<TSymbol | undefined>;
36
- findScopeName<TScope extends OutputScope = OutputScope>(currentScope: TScope | undefined, name: string): Ref<TScope | undefined>;
37
- /**
38
- * Resolve a fully qualified name to a symbol. Access a nested scope by name
39
- * with `::`, a nested static member with `.` and a nested instance member
40
- * with `#`.
41
- *
42
- * Per-language packages may provide their own resolveFQN function that uses
43
- * syntax more natural to that language.
44
- */
45
- resolveFQN<TScope extends OutputScope = OutputScope, TSymbol extends OutputSymbol = OutputSymbol>(fqn: string): Ref<TSymbol | TScope | undefined>;
27
+ resolveDeclarationByKey<TScope extends OutputScope = OutputScope, TSymbol extends OutputSymbol = OutputSymbol>(currentScope: TScope | undefined, key: Refkey, options?: ResolveDeclarationByKeyOptions<TScope, TSymbol>): Ref<ResolutionResult<TScope, TSymbol> | undefined>;
46
28
  /**
47
- * The global scope. This is the root scope for all symbols.
29
+ * Get a ref to the symbol associated with the given refkey. The value of the
30
+ * ref is undefined if the symbol has not been created yet.
48
31
  */
49
- globalScope: OutputScope;
32
+ getSymbolForRefkey<TSymbol extends OutputSymbol>(refkey: Refkey): Ref<TSymbol | undefined>;
50
33
  /**
51
34
  * The name conflict resolver to use for this binder.
52
35
  */
@@ -75,7 +58,7 @@ export interface Binder {
75
58
  * scope: global scope
76
59
  * ├── scope: namespace scope 1
77
60
  * │ └── symbol: foo
78
- * │ └── static member scope
61
+ * │ └── static members
79
62
  * │ └── symbol: bar
80
63
  * └── scope: namespace scope 2
81
64
  * └── (resolve bar from here)
@@ -92,11 +75,19 @@ export interface Binder {
92
75
  */
93
76
  export interface ResolutionResult<TScope extends OutputScope, TSymbol extends OutputSymbol> {
94
77
  /**
95
- * The symbol for the resolved declaration.
78
+ * The resolved symbol. May be declared in a lexical scope or be a member symbol.
79
+ */
80
+ symbol: TSymbol;
81
+ /**
82
+ * When the symbol is a member symbol, this is the symbol of the lexical
83
+ * declaration which contains this member symbol, either as one of its own
84
+ * member symbols, or as a member of one of its members.
85
+ *
86
+ * When the symbol is a non-member symbol, this is the same as `symbol`.
96
87
  */
97
- targetDeclaration: TSymbol;
88
+ lexicalDeclaration: TSymbol;
98
89
  /**
99
- * The scopes between the common scope and the reference
90
+ * The scopes between the common scope and the reference.
100
91
  */
101
92
  pathUp: TScope[];
102
93
  /**
@@ -104,18 +95,60 @@ export interface ResolutionResult<TScope extends OutputScope, TSymbol extends Ou
104
95
  */
105
96
  pathDown: TScope[];
106
97
  /**
107
- * The scope which contains both the reference and the declaration.
98
+ * The scopes from the root to scope of the lexical declaration.
99
+ */
100
+ fullSymbolPath: TScope[];
101
+ /**
102
+ * The scopes from the root to the scope of the reference.
103
+ */
104
+ fullReferencePath: TScope[];
105
+ /**
106
+ * The lexical scope which contains both the reference and the lexical
107
+ * declaration. Undefined when they do not share a common scope.
108
108
  */
109
109
  commonScope: TScope | undefined;
110
110
  /**
111
111
  * When resolving a member symbol, this is the path of symbols that lead from
112
- * the base declaration to the member symbol.
112
+ * the lexical declaration to the member symbol.
113
113
  */
114
- memberPath?: TSymbol[];
114
+ memberPath: TSymbol[];
115
+ }
116
+ /**
117
+ * Describes a member in a member access chain, tracking both the symbol
118
+ * and whether this specific member was accessed via a memberRefkey.
119
+ */
120
+ export interface MemberDescriptor {
121
+ symbol: OutputSymbol;
122
+ isMemberAccess: boolean;
115
123
  }
116
124
  export interface NameConflictResolver {
117
125
  (name: string, symbols: OutputSymbol[]): void;
118
126
  }
127
+ /**
128
+ * The context for a member resolution. This is used to properly resolve a
129
+ * member in the MemberResolver.
130
+ */
131
+ export interface MemberResolutionContext<TScope extends OutputScope> {
132
+ /**
133
+ * The scopes that the member reference occurred in.
134
+ */
135
+ referencePath: TScope[];
136
+ /**
137
+ * Whether we are using member access e.g. via `memberRefkey`.
138
+ * This is true when the member was resolved using a memberRefkey,
139
+ * which may carry additional metadata about the member access in the future.
140
+ */
141
+ isMemberAccess: boolean;
142
+ }
143
+ /**
144
+ *
145
+ */
146
+ export interface MemberResolver<TScope extends OutputScope, TSymbol extends OutputSymbol> {
147
+ (owner: TSymbol, member: TSymbol, context: MemberResolutionContext<TScope>): void;
148
+ }
149
+ export interface ResolveDeclarationByKeyOptions<TScope extends OutputScope, TSymbol extends OutputSymbol> {
150
+ memberResolver?: MemberResolver<TScope, TSymbol>;
151
+ }
119
152
  export interface BinderOptions {
120
153
  nameConflictResolver?: NameConflictResolver;
121
154
  }
@@ -130,21 +163,24 @@ export declare function createOutputBinder(options?: BinderOptions): Binder;
130
163
  * not found. The symbol you're looking for may not have been declared yet. When the symbol
131
164
  * is declared, the ref will be updated with the resolution result.
132
165
  */
133
- export declare function resolve<TScope extends OutputScope, TSymbol extends OutputSymbol>(refkey: Refkey): Ref<ResolutionResult<TScope, TSymbol>>;
166
+ export declare function resolve<TScope extends OutputScope, TSymbol extends OutputSymbol>(refkey: Refkey, options?: ResolveDeclarationByKeyOptions<TScope, TSymbol>): Ref<ResolutionResult<TScope, TSymbol>>;
167
+ /**
168
+ * Get a ref to the symbol for the given refkey using the current binder. The
169
+ * value of the ref will be undefined when no symbol with that refkey has been
170
+ * created.
171
+ *
172
+ * @remarks
173
+ *
174
+ * This API may return a ref for undefined, but that does not mean that the symbol is
175
+ * not found. The symbol you're looking for may not have been declared yet. When the symbol
176
+ * is declared, the ref will be updated with the symbol.
177
+ */
178
+ export declare function symbolForRefkey(refkey: Refkey): Ref<OutputSymbol | undefined, OutputSymbol | undefined>;
134
179
  declare const createSymbolsSymbol: unique symbol;
135
180
  export declare function getSymbolCreator(creator: SymbolCreator): SymbolCreator[typeof createSymbolsSymbol];
136
181
  export declare function getSymbolCreatorSymbol(): typeof createSymbolsSymbol;
137
182
  export interface SymbolCreator {
138
183
  [createSymbolsSymbol](binder: Binder): void;
139
184
  }
140
- /**
141
- * Use symbol flags to determine the scope in which a symbol with those flags
142
- * should be declared given the current context.
143
- *
144
- * @param flags - The symbol flags to use to determine the default scope.
145
- * @returns an {@link OutputScope} that is the default scope for the given
146
- * flags.
147
- */
148
- export declare function useDefaultScope(flags?: OutputSymbolFlags): OutputScope | undefined;
149
185
  export {};
150
186
  //# sourceMappingURL=binder.d.ts.map
@@ -1 +1 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