@alloy-js/core 0.23.0-dev.1 → 0.23.0-dev.11

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 (337) hide show
  1. package/CHANGELOG.md +0 -22
  2. package/dist/devtools/index.html +80 -0
  3. package/dist/src/binder.d.ts +2 -0
  4. package/dist/src/binder.d.ts.map +1 -1
  5. package/dist/src/binder.js +60 -12
  6. package/dist/src/binder.js.map +1 -1
  7. package/dist/src/components/AccessExpression.d.ts +78 -0
  8. package/dist/src/components/AccessExpression.d.ts.map +1 -0
  9. package/dist/src/components/AccessExpression.js +218 -0
  10. package/dist/src/components/AccessExpression.js.map +1 -0
  11. package/dist/src/components/AccessExpression.test.d.ts +2 -0
  12. package/dist/src/components/AccessExpression.test.d.ts.map +1 -0
  13. package/dist/src/components/AccessExpression.test.js +137 -0
  14. package/dist/src/components/AccessExpression.test.js.map +1 -0
  15. package/dist/src/components/AppendFile.d.ts.map +1 -1
  16. package/dist/src/components/AppendFile.js +14 -3
  17. package/dist/src/components/AppendFile.js.map +1 -1
  18. package/dist/src/components/Block.js +1 -1
  19. package/dist/src/components/Block.js.map +1 -1
  20. package/dist/src/components/Declaration.d.ts.map +1 -1
  21. package/dist/src/components/Declaration.js +2 -1
  22. package/dist/src/components/Declaration.js.map +1 -1
  23. package/dist/src/components/For.d.ts.map +1 -1
  24. package/dist/src/components/For.js +1 -1
  25. package/dist/src/components/For.js.map +1 -1
  26. package/dist/src/components/List.d.ts.map +1 -1
  27. package/dist/src/components/List.js +1 -1
  28. package/dist/src/components/List.js.map +1 -1
  29. package/dist/src/components/Prose.js +2 -2
  30. package/dist/src/components/Prose.js.map +1 -1
  31. package/dist/src/components/Scope.d.ts.map +1 -1
  32. package/dist/src/components/Scope.js +6 -1
  33. package/dist/src/components/Scope.js.map +1 -1
  34. package/dist/src/components/SourceDirectory.d.ts.map +1 -1
  35. package/dist/src/components/SourceDirectory.js +1 -2
  36. package/dist/src/components/SourceDirectory.js.map +1 -1
  37. package/dist/src/components/Switch.d.ts.map +1 -1
  38. package/dist/src/components/Switch.js +1 -1
  39. package/dist/src/components/Switch.js.map +1 -1
  40. package/dist/src/components/TemplateFile.d.ts.map +1 -1
  41. package/dist/src/components/TemplateFile.js +18 -3
  42. package/dist/src/components/TemplateFile.js.map +1 -1
  43. package/dist/src/components/index.d.ts +1 -0
  44. package/dist/src/components/index.d.ts.map +1 -1
  45. package/dist/src/components/index.js +1 -0
  46. package/dist/src/components/index.js.map +1 -1
  47. package/dist/src/content-slot.d.ts.map +1 -1
  48. package/dist/src/content-slot.js +7 -6
  49. package/dist/src/content-slot.js.map +1 -1
  50. package/dist/src/context.d.ts.map +1 -1
  51. package/dist/src/context.js +10 -3
  52. package/dist/src/context.js.map +1 -1
  53. package/dist/src/debug/cli.d.ts +6 -0
  54. package/dist/src/debug/cli.d.ts.map +1 -0
  55. package/dist/src/{debug.js → debug/cli.js} +79 -82
  56. package/dist/src/debug/cli.js.map +1 -0
  57. package/dist/src/debug/diagnostics.test.d.ts +2 -0
  58. package/dist/src/debug/diagnostics.test.d.ts.map +1 -0
  59. package/dist/src/debug/diagnostics.test.js +46 -0
  60. package/dist/src/debug/diagnostics.test.js.map +1 -0
  61. package/dist/src/debug/effects.d.ts +81 -0
  62. package/dist/src/debug/effects.d.ts.map +1 -0
  63. package/dist/src/debug/effects.js +358 -0
  64. package/dist/src/debug/effects.js.map +1 -0
  65. package/dist/src/debug/effects.test.d.ts +2 -0
  66. package/dist/src/debug/effects.test.d.ts.map +1 -0
  67. package/dist/src/debug/effects.test.js +256 -0
  68. package/dist/src/debug/effects.test.js.map +1 -0
  69. package/dist/src/debug/files.d.ts +14 -0
  70. package/dist/src/debug/files.d.ts.map +1 -0
  71. package/dist/src/debug/files.js +29 -0
  72. package/dist/src/debug/files.js.map +1 -0
  73. package/dist/src/debug/files.test.d.ts +2 -0
  74. package/dist/src/debug/files.test.d.ts.map +1 -0
  75. package/dist/src/debug/files.test.js +66 -0
  76. package/dist/src/debug/files.test.js.map +1 -0
  77. package/dist/src/debug/index.d.ts +63 -0
  78. package/dist/src/debug/index.d.ts.map +1 -0
  79. package/dist/src/debug/index.js +71 -0
  80. package/dist/src/debug/index.js.map +1 -0
  81. package/dist/src/debug/message-format.test.d.ts +2 -0
  82. package/dist/src/debug/message-format.test.d.ts.map +1 -0
  83. package/dist/src/debug/message-format.test.js +700 -0
  84. package/dist/src/debug/message-format.test.js.map +1 -0
  85. package/dist/src/debug/render-tree-orphans.test.d.ts +2 -0
  86. package/dist/src/debug/render-tree-orphans.test.d.ts.map +1 -0
  87. package/dist/src/debug/render-tree-orphans.test.js +297 -0
  88. package/dist/src/debug/render-tree-orphans.test.js.map +1 -0
  89. package/dist/src/debug/render.d.ts +57 -0
  90. package/dist/src/debug/render.d.ts.map +1 -0
  91. package/dist/src/debug/render.js +472 -0
  92. package/dist/src/debug/render.js.map +1 -0
  93. package/dist/src/debug/render.test.d.ts +2 -0
  94. package/dist/src/debug/render.test.d.ts.map +1 -0
  95. package/dist/src/debug/render.test.js +291 -0
  96. package/dist/src/debug/render.test.js.map +1 -0
  97. package/dist/src/debug/serialize.d.ts +9 -0
  98. package/dist/src/debug/serialize.d.ts.map +1 -0
  99. package/dist/src/debug/serialize.js +70 -0
  100. package/dist/src/debug/serialize.js.map +1 -0
  101. package/dist/src/debug/symbols.d.ts +16 -0
  102. package/dist/src/debug/symbols.d.ts.map +1 -0
  103. package/dist/src/debug/symbols.js +196 -0
  104. package/dist/src/debug/symbols.js.map +1 -0
  105. package/dist/src/debug/symbols.test.d.ts +2 -0
  106. package/dist/src/debug/symbols.test.d.ts.map +1 -0
  107. package/dist/src/debug/symbols.test.js +93 -0
  108. package/dist/src/debug/symbols.test.js.map +1 -0
  109. package/dist/src/debug/trace-writer.d.ts +55 -0
  110. package/dist/src/debug/trace-writer.d.ts.map +1 -0
  111. package/dist/src/debug/trace-writer.js +658 -0
  112. package/dist/src/debug/trace-writer.js.map +1 -0
  113. package/dist/src/debug/trace.d.ts +342 -0
  114. package/dist/src/debug/trace.d.ts.map +1 -0
  115. package/dist/src/debug/trace.js +446 -0
  116. package/dist/src/debug/trace.js.map +1 -0
  117. package/dist/src/devtools/devtools-protocol.d.ts +389 -0
  118. package/dist/src/devtools/devtools-protocol.d.ts.map +1 -0
  119. package/dist/src/devtools/devtools-protocol.js +2 -0
  120. package/dist/src/devtools/devtools-protocol.js.map +1 -0
  121. package/dist/src/devtools/devtools-server.browser.d.ts +23 -0
  122. package/dist/src/devtools/devtools-server.browser.d.ts.map +1 -0
  123. package/dist/src/devtools/devtools-server.browser.js +33 -0
  124. package/dist/src/devtools/devtools-server.browser.js.map +1 -0
  125. package/dist/src/devtools/devtools-server.d.ts +66 -0
  126. package/dist/src/devtools/devtools-server.d.ts.map +1 -0
  127. package/dist/src/devtools/devtools-server.js +444 -0
  128. package/dist/src/devtools/devtools-server.js.map +1 -0
  129. package/dist/src/devtools/devtools-transport.d.ts +23 -0
  130. package/dist/src/devtools/devtools-transport.d.ts.map +1 -0
  131. package/dist/src/devtools/devtools-transport.js +114 -0
  132. package/dist/src/devtools/devtools-transport.js.map +1 -0
  133. package/dist/src/devtools-entry.browser.d.ts +4 -0
  134. package/dist/src/devtools-entry.browser.d.ts.map +1 -0
  135. package/dist/src/devtools-entry.browser.js +2 -0
  136. package/dist/src/devtools-entry.browser.js.map +1 -0
  137. package/dist/src/devtools-entry.d.ts +4 -0
  138. package/dist/src/devtools-entry.d.ts.map +1 -0
  139. package/dist/src/devtools-entry.js +2 -0
  140. package/dist/src/devtools-entry.js.map +1 -0
  141. package/dist/src/diagnostics.d.ts +34 -0
  142. package/dist/src/diagnostics.d.ts.map +1 -0
  143. package/dist/src/diagnostics.js +89 -0
  144. package/dist/src/diagnostics.js.map +1 -0
  145. package/dist/src/index.d.ts +3 -2
  146. package/dist/src/index.d.ts.map +1 -1
  147. package/dist/src/index.js +3 -2
  148. package/dist/src/index.js.map +1 -1
  149. package/dist/src/print-hook.d.ts +14 -0
  150. package/dist/src/print-hook.d.ts.map +1 -0
  151. package/dist/src/print-hook.js +10 -0
  152. package/dist/src/print-hook.js.map +1 -0
  153. package/dist/src/reactive-union-set.d.ts.map +1 -1
  154. package/dist/src/reactive-union-set.js +28 -3
  155. package/dist/src/reactive-union-set.js.map +1 -1
  156. package/dist/src/reactivity.d.ts +60 -7
  157. package/dist/src/reactivity.d.ts.map +1 -1
  158. package/dist/src/reactivity.js +308 -39
  159. package/dist/src/reactivity.js.map +1 -1
  160. package/dist/src/render-stack.d.ts +18 -1
  161. package/dist/src/render-stack.d.ts.map +1 -1
  162. package/dist/src/render-stack.js +61 -1
  163. package/dist/src/render-stack.js.map +1 -1
  164. package/dist/src/render.d.ts +8 -15
  165. package/dist/src/render.d.ts.map +1 -1
  166. package/dist/src/render.js +424 -109
  167. package/dist/src/render.js.map +1 -1
  168. package/dist/src/resource.d.ts.map +1 -1
  169. package/dist/src/resource.js +5 -0
  170. package/dist/src/resource.js.map +1 -1
  171. package/dist/src/scheduler.d.ts +13 -0
  172. package/dist/src/scheduler.d.ts.map +1 -1
  173. package/dist/src/scheduler.js +150 -13
  174. package/dist/src/scheduler.js.map +1 -1
  175. package/dist/src/symbols/basic-symbol.d.ts.map +1 -1
  176. package/dist/src/symbols/basic-symbol.js +6 -1
  177. package/dist/src/symbols/basic-symbol.js.map +1 -1
  178. package/dist/src/symbols/decl.d.ts.map +1 -1
  179. package/dist/src/symbols/decl.js +5 -1
  180. package/dist/src/symbols/decl.js.map +1 -1
  181. package/dist/src/symbols/output-scope.d.ts +2 -1
  182. package/dist/src/symbols/output-scope.d.ts.map +1 -1
  183. package/dist/src/symbols/output-scope.js +13 -8
  184. package/dist/src/symbols/output-scope.js.map +1 -1
  185. package/dist/src/symbols/output-symbol.d.ts +1 -0
  186. package/dist/src/symbols/output-symbol.d.ts.map +1 -1
  187. package/dist/src/symbols/output-symbol.js +25 -8
  188. package/dist/src/symbols/output-symbol.js.map +1 -1
  189. package/dist/src/symbols/symbol-flow.d.ts.map +1 -1
  190. package/dist/src/symbols/symbol-flow.js +24 -8
  191. package/dist/src/symbols/symbol-flow.js.map +1 -1
  192. package/dist/src/symbols/symbol-slot.d.ts.map +1 -1
  193. package/dist/src/symbols/symbol-slot.js +15 -0
  194. package/dist/src/symbols/symbol-slot.js.map +1 -1
  195. package/dist/src/symbols/symbol-slot.test.d.ts +2 -0
  196. package/dist/src/symbols/symbol-slot.test.d.ts.map +1 -0
  197. package/dist/src/symbols/symbol-slot.test.js +35 -0
  198. package/dist/src/symbols/symbol-slot.test.js.map +1 -0
  199. package/dist/src/symbols/symbol-table.d.ts.map +1 -1
  200. package/dist/src/symbols/symbol-table.js +6 -5
  201. package/dist/src/symbols/symbol-table.js.map +1 -1
  202. package/dist/src/trace.d.ts +2 -0
  203. package/dist/src/trace.d.ts.map +1 -0
  204. package/dist/src/trace.js +2 -0
  205. package/dist/src/trace.js.map +1 -0
  206. package/dist/src/tracer.d.ts +2 -228
  207. package/dist/src/tracer.d.ts.map +1 -1
  208. package/dist/src/tracer.js +5 -298
  209. package/dist/src/tracer.js.map +1 -1
  210. package/dist/src/utils.d.ts.map +1 -1
  211. package/dist/src/utils.js +17 -9
  212. package/dist/src/utils.js.map +1 -1
  213. package/dist/test/components/append-file.test.d.ts.map +1 -1
  214. package/dist/test/components/append-file.test.js +18 -10
  215. package/dist/test/components/append-file.test.js.map +1 -1
  216. package/dist/test/components/template-file.test.d.ts.map +1 -1
  217. package/dist/test/components/template-file.test.js +6 -4
  218. package/dist/test/components/template-file.test.js.map +1 -1
  219. package/dist/test/lazy-isempty.test.d.ts +2 -0
  220. package/dist/test/lazy-isempty.test.d.ts.map +1 -0
  221. package/dist/test/lazy-isempty.test.js +89 -0
  222. package/dist/test/lazy-isempty.test.js.map +1 -0
  223. package/dist/test/reactive-union-set-disposers.test.d.ts +2 -0
  224. package/dist/test/reactive-union-set-disposers.test.d.ts.map +1 -0
  225. package/dist/test/reactive-union-set-disposers.test.js +98 -0
  226. package/dist/test/reactive-union-set-disposers.test.js.map +1 -0
  227. package/dist/test/reactivity/shallow-reactive.test.d.ts +2 -0
  228. package/dist/test/reactivity/shallow-reactive.test.d.ts.map +1 -0
  229. package/dist/test/reactivity/shallow-reactive.test.js +52 -0
  230. package/dist/test/reactivity/shallow-reactive.test.js.map +1 -0
  231. package/dist/test/rendering/basic.test.js +3 -0
  232. package/dist/test/rendering/basic.test.js.map +1 -1
  233. package/dist/test/rendering/print-render-stack.test.d.ts.map +1 -1
  234. package/dist/test/rendering/print-render-stack.test.js +91 -98
  235. package/dist/test/rendering/print-render-stack.test.js.map +1 -1
  236. package/dist/test/scheduler-extended.test.d.ts +2 -0
  237. package/dist/test/scheduler-extended.test.d.ts.map +1 -0
  238. package/dist/test/scheduler-extended.test.js +96 -0
  239. package/dist/test/scheduler-extended.test.js.map +1 -0
  240. package/dist/test/scheduler.test.d.ts +2 -0
  241. package/dist/test/scheduler.test.d.ts.map +1 -0
  242. package/dist/test/scheduler.test.js +46 -0
  243. package/dist/test/scheduler.test.js.map +1 -0
  244. package/dist/testing/create-test-wrapper.d.ts +1 -1
  245. package/dist/testing/create-test-wrapper.d.ts.map +1 -1
  246. package/dist/testing/create-test-wrapper.js +1 -1
  247. package/dist/testing/create-test-wrapper.js.map +1 -1
  248. package/dist/testing/devtools-utils.d.ts +35 -0
  249. package/dist/testing/devtools-utils.d.ts.map +1 -0
  250. package/dist/testing/devtools-utils.js +162 -0
  251. package/dist/testing/devtools-utils.js.map +1 -0
  252. package/dist/testing/extend-expect.d.ts.map +1 -1
  253. package/dist/testing/extend-expect.js +63 -1
  254. package/dist/testing/extend-expect.js.map +1 -1
  255. package/dist/testing/render.d.ts +2 -2
  256. package/dist/testing/render.d.ts.map +1 -1
  257. package/dist/testing/render.js +2 -2
  258. package/dist/testing/render.js.map +1 -1
  259. package/dist/tsconfig.tsbuildinfo +1 -1
  260. package/package.json +21 -7
  261. package/scripts/copy-devtools-ui.mjs +26 -0
  262. package/src/binder.ts +117 -53
  263. package/src/components/AccessExpression.test.tsx +132 -0
  264. package/src/components/AccessExpression.tsx +344 -0
  265. package/src/components/AppendFile.tsx +14 -9
  266. package/src/components/Block.tsx +1 -1
  267. package/src/components/Declaration.tsx +2 -1
  268. package/src/components/For.tsx +14 -10
  269. package/src/components/List.tsx +7 -4
  270. package/src/components/Prose.tsx +1 -1
  271. package/src/components/Scope.tsx +6 -1
  272. package/src/components/SourceDirectory.tsx +1 -2
  273. package/src/components/Switch.tsx +11 -7
  274. package/src/components/TemplateFile.tsx +18 -9
  275. package/src/components/index.tsx +1 -0
  276. package/src/content-slot.tsx +7 -7
  277. package/src/context.ts +17 -6
  278. package/src/{debug.ts → debug/cli.ts} +114 -125
  279. package/src/debug/diagnostics.test.tsx +56 -0
  280. package/src/debug/effects.test.tsx +301 -0
  281. package/src/debug/effects.ts +531 -0
  282. package/src/debug/files.test.tsx +76 -0
  283. package/src/debug/files.ts +40 -0
  284. package/src/debug/index.ts +132 -0
  285. package/src/debug/message-format.test.tsx +759 -0
  286. package/src/debug/render-tree-orphans.test.tsx +344 -0
  287. package/src/debug/render.test.tsx +357 -0
  288. package/src/debug/render.ts +698 -0
  289. package/src/debug/serialize.ts +85 -0
  290. package/src/debug/symbols.test.tsx +105 -0
  291. package/src/debug/symbols.ts +322 -0
  292. package/src/debug/trace-writer.ts +969 -0
  293. package/src/debug/trace.ts +309 -0
  294. package/src/devtools/devtools-protocol.ts +497 -0
  295. package/src/devtools/devtools-server.browser.ts +62 -0
  296. package/src/devtools/devtools-server.ts +468 -0
  297. package/src/devtools/devtools-transport.ts +154 -0
  298. package/src/devtools-entry.browser.ts +48 -0
  299. package/src/devtools-entry.ts +48 -0
  300. package/src/diagnostics.ts +150 -0
  301. package/src/index.ts +2 -7
  302. package/src/print-hook.ts +22 -0
  303. package/src/reactive-union-set.ts +85 -44
  304. package/src/reactivity.ts +396 -58
  305. package/src/render-stack.ts +73 -1
  306. package/src/render.ts +544 -161
  307. package/src/resource.ts +28 -19
  308. package/src/scheduler.ts +209 -14
  309. package/src/symbols/basic-symbol.ts +6 -1
  310. package/src/symbols/decl.ts +5 -1
  311. package/src/symbols/output-scope.ts +21 -13
  312. package/src/symbols/output-symbol.ts +34 -14
  313. package/src/symbols/symbol-flow.ts +76 -39
  314. package/src/symbols/symbol-slot.test.tsx +41 -0
  315. package/src/symbols/symbol-slot.tsx +47 -20
  316. package/src/symbols/symbol-table.ts +6 -10
  317. package/src/trace.ts +1 -0
  318. package/src/tracer.ts +13 -242
  319. package/src/utils.tsx +31 -21
  320. package/temp/api.json +5700 -3015
  321. package/test/components/append-file.test.tsx +36 -29
  322. package/test/components/template-file.test.tsx +11 -11
  323. package/test/lazy-isempty.test.tsx +106 -0
  324. package/test/reactive-union-set-disposers.test.tsx +112 -0
  325. package/test/reactivity/shallow-reactive.test.tsx +56 -0
  326. package/test/rendering/basic.test.tsx +4 -0
  327. package/test/rendering/print-render-stack.test.tsx +52 -43
  328. package/test/scheduler-extended.test.tsx +122 -0
  329. package/test/scheduler.test.tsx +50 -0
  330. package/testing/create-test-wrapper.tsx +1 -1
  331. package/testing/devtools-utils.ts +245 -0
  332. package/testing/extend-expect.ts +89 -0
  333. package/testing/render.ts +2 -2
  334. package/testing/vitest.d.ts +9 -0
  335. package/dist/src/debug.d.ts +0 -14
  336. package/dist/src/debug.d.ts.map +0 -1
  337. package/dist/src/debug.js.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@alloy-js/core",
3
- "version": "0.23.0-dev.1",
3
+ "version": "0.23.0-dev.11",
4
4
  "description": "",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/alloy-framework/alloy.git"
8
+ },
5
9
  "main": "./dist/src/index.js",
6
10
  "exports": {
7
11
  ".": {
@@ -23,33 +27,43 @@
23
27
  },
24
28
  "./components": {
25
29
  "import": "./dist/src/components/index.js"
30
+ },
31
+ "./devtools": {
32
+ "types": "./dist/src/devtools-entry.d.ts",
33
+ "browser": "./dist/src/devtools-entry.browser.js",
34
+ "import": "./dist/src/devtools-entry.js"
26
35
  }
27
36
  },
28
37
  "browser": {
29
38
  "./dist/src/host/alloy-host.js": "./dist/src/host/alloy-host.browser.js",
30
39
  "./src/host/alloy-host.ts": "./src/host/alloy-host.browser.ts",
31
40
  "./dist/src/inspect.js": "./dist/src/inspect.browser.js",
32
- "./src/inspect.ts": "./src/inspect.browser.ts"
41
+ "./src/inspect.ts": "./src/inspect.browser.ts",
42
+ "./dist/src/devtools/devtools-server.js": "./dist/src/devtools/devtools-server.browser.js",
43
+ "./src/devtools/devtools-server.ts": "./src/devtools/devtools-server.browser.ts"
33
44
  },
34
45
  "keywords": [],
35
46
  "author": "brian.terlson@microsoft.com",
36
47
  "license": "MIT",
37
48
  "dependencies": {
49
+ "@types/ws": "^8.18.1",
38
50
  "@vue/reactivity": "^3.5.13",
39
- "picocolors": "^1.1.1",
40
51
  "cli-table3": "^0.6.5",
52
+ "devalue": "^5.6.2",
41
53
  "pathe": "^2.0.3",
42
- "prettier": "^3.6.2"
54
+ "picocolors": "^1.1.1",
55
+ "prettier": "^3.6.2",
56
+ "ws": "^8.19.0"
43
57
  },
44
58
  "devDependencies": {
45
- "@alloy-js/cli": "~0.22.0 || >= 0.23.0-dev.1",
46
- "@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.0",
59
+ "@alloy-js/cli": "~0.22.0 || >= 0.23.0-dev.3",
60
+ "@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.1",
47
61
  "@microsoft/api-extractor": "~7.52.8",
48
62
  "@rollup/plugin-typescript": "^12.1.2",
49
63
  "concurrently": "^9.2.0",
50
64
  "typescript": "^5.8.3",
51
65
  "vite": "^7.0.6",
52
- "vitest": "^3.2.4"
66
+ "vitest": "3.2.4"
53
67
  },
54
68
  "type": "module",
55
69
  "scripts": {
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { copyFile, mkdir } from "fs/promises";
4
+ import { dirname, join } from "path";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ const srcFile = join(__dirname, "../../devtools/dist/index.html");
11
+ const destFile = join(__dirname, "../dist/devtools/index.html");
12
+
13
+ async function copyDevtoolsUi() {
14
+ try {
15
+ await mkdir(dirname(destFile), { recursive: true });
16
+ await copyFile(srcFile, destFile);
17
+ // eslint-disable-next-line no-console
18
+ console.log("Copied devtools UI to core dist");
19
+ } catch (error) {
20
+ // eslint-disable-next-line no-console
21
+ console.error("Failed to copy devtools UI:", error);
22
+ process.exit(1);
23
+ }
24
+ }
25
+
26
+ void copyDevtoolsUi();
package/src/binder.ts CHANGED
@@ -2,8 +2,11 @@ import { computed, Ref, ShallowRef, shallowRef } from "@vue/reactivity";
2
2
  import { useBinder } from "./context/binder.js";
3
3
  import { useMemberContext } from "./context/member-scope.js";
4
4
  import { useScope } from "./context/scope.js";
5
- import { effect } from "./reactivity.js";
5
+ import { debug, TracePhase } from "./debug/index.js";
6
+ import { emitDiagnostic, type DiagnosticHandle } from "./diagnostics.js";
7
+ import { effect, onCleanup } from "./reactivity.js";
6
8
  import {
9
+ inspectRefkey,
7
10
  isMemberRefkey,
8
11
  MemberRefkey,
9
12
  refkey,
@@ -13,12 +16,7 @@ import {
13
16
  } from "./refkey.js";
14
17
  import { OutputScope } from "./symbols/output-scope.js";
15
18
  import { type OutputSymbol } from "./symbols/output-symbol.js";
16
- import {
17
- formatRefkeys,
18
- formatSymbolName,
19
- trace,
20
- TracePhase,
21
- } from "./tracer.js";
19
+ import { formatRefkeys, formatSymbolName } from "./tracer.js";
22
20
  export type Metadata = object;
23
21
 
24
22
  /**
@@ -211,6 +209,24 @@ export interface BinderOptions {
211
209
  nameConflictResolver?: NameConflictResolver;
212
210
  }
213
211
 
212
+ export function createScope<TScope extends OutputScope, Args extends unknown[]>(
213
+ ctor: new (...args: Args) => TScope,
214
+ ...args: Args
215
+ ): TScope {
216
+ const scope = new ctor(...args);
217
+ debug.symbols.registerScope(scope);
218
+ return scope;
219
+ }
220
+
221
+ export function createSymbol<
222
+ TSymbol extends OutputSymbol,
223
+ Args extends unknown[],
224
+ >(ctor: new (...args: Args) => TSymbol, ...args: Args): TSymbol {
225
+ const symbol = new ctor(...args);
226
+ debug.symbols.registerSymbol(symbol);
227
+ return symbol;
228
+ }
229
+
214
230
  export function createOutputBinder(options: BinderOptions = {}): Binder {
215
231
  const binder: Binder = {
216
232
  resolveDeclarationByKey,
@@ -247,6 +263,7 @@ export function createOutputBinder(options: BinderOptions = {}): Binder {
247
263
  }
248
264
 
249
265
  function notifySymbolDeleted(symbol: OutputSymbol) {
266
+ debug.symbols.unregisterSymbol(symbol);
250
267
  if (!refkey) {
251
268
  return;
252
269
  }
@@ -458,25 +475,25 @@ export function createOutputBinder(options: BinderOptions = {}): Binder {
458
475
  const resolvedSymbol = getSymbolForRefkey(refkey);
459
476
 
460
477
  return computed(() => {
461
- trace(
478
+ debug.trace(
462
479
  TracePhase.resolve.pending,
463
480
  () => `Resolving ${formatRefkeys(refkey)}.`,
464
481
  );
465
482
  const symbol = resolvedSymbol.value as TSymbol;
466
483
  if (!symbol) {
467
- trace(
484
+ debug.trace(
468
485
  TracePhase.resolve.failure,
469
486
  () => `No symbol for ${formatRefkeys(refkey)}.`,
470
487
  );
471
488
  return undefined;
472
489
  }
473
- trace(
490
+ debug.trace(
474
491
  TracePhase.resolve.pending,
475
492
  () =>
476
493
  `${formatRefkeys(refkey)} resolved to ${formatSymbolName(symbol)}.`,
477
494
  );
478
495
  if (symbol.isTransient) {
479
- trace(
496
+ debug.trace(
480
497
  TracePhase.resolve.failure,
481
498
  () => `Symbol ${formatSymbolName(symbol)} is transient.`,
482
499
  );
@@ -485,7 +502,7 @@ export function createOutputBinder(options: BinderOptions = {}): Binder {
485
502
 
486
503
  const chain = scopeChain(symbol.scope);
487
504
  if (chain.some((scope) => scope.isTransient)) {
488
- trace(
505
+ debug.trace(
489
506
  TracePhase.resolve.failure,
490
507
  () => `Symbol ${formatSymbolName(symbol)} is in a transient scope.`,
491
508
  );
@@ -533,7 +550,7 @@ export function createOutputBinder(options: BinderOptions = {}): Binder {
533
550
  for (const descriptor of allDescriptors) {
534
551
  const member = descriptor.symbol as TSymbol;
535
552
  if (currentBase.isTyped && !currentBase.hasTypeSymbol) {
536
- trace(
553
+ debug.trace(
537
554
  TracePhase.resolve.pending,
538
555
  () =>
539
556
  `${formatRefkeys(refkey)} needs type information from a parent type.`,
@@ -550,7 +567,7 @@ export function createOutputBinder(options: BinderOptions = {}): Binder {
550
567
  currentBase = member;
551
568
  }
552
569
 
553
- trace(
570
+ debug.trace(
554
571
  TracePhase.resolve.success,
555
572
  () =>
556
573
  `${formatRefkeys(refkey)} successfully resolved to ${formatSymbolName(symbol)}.`,
@@ -626,54 +643,63 @@ export function createOutputBinder(options: BinderOptions = {}): Binder {
626
643
  }
627
644
 
628
645
  function notifySymbolCreated(symbol: OutputSymbol): void {
629
- effect<Refkey[]>((oldRefkeys) => {
630
- if (symbol.refkeys) {
631
- trace(
632
- TracePhase.resolve.pending,
633
- () => `Notifying resolutions for ${formatRefkeys(symbol.refkeys)}.`,
634
- );
635
- }
636
-
637
- if (oldRefkeys) {
638
- for (const refkey of oldRefkeys) {
639
- if (!symbol.refkeys.includes(refkey)) {
640
- // remove the old refkey from the known declarations
641
- knownDeclarations.delete(refkey);
646
+ effect<Refkey[]>(
647
+ (oldRefkeys) => {
648
+ if (symbol.refkeys) {
649
+ debug.trace(
650
+ TracePhase.resolve.pending,
651
+ () => `Notifying resolutions for ${formatRefkeys(symbol.refkeys)}.`,
652
+ );
653
+ }
642
654
 
643
- // reset any waiting declarations
644
- if (waitingDeclarations.has(refkey)) {
645
- const signal = waitingDeclarations.get(refkey)!;
646
- signal.value = undefined;
655
+ if (oldRefkeys) {
656
+ for (const refkey of oldRefkeys) {
657
+ if (!symbol.refkeys.includes(refkey)) {
658
+ // remove the old refkey from the known declarations
659
+ knownDeclarations.delete(refkey);
660
+
661
+ // reset any waiting declarations
662
+ if (waitingDeclarations.has(refkey)) {
663
+ const signal = waitingDeclarations.get(refkey)!;
664
+ signal.value = undefined;
665
+ }
647
666
  }
648
667
  }
649
668
  }
650
- }
651
669
 
652
- for (const refkey of symbol.refkeys) {
653
- // notify those waiting for this refkey
654
- knownDeclarations.set(refkey, symbol);
655
- if (waitingDeclarations.has(refkey)) {
656
- const signal = waitingDeclarations.get(refkey)!;
657
- signal.value = symbol;
658
- }
670
+ for (const refkey of symbol.refkeys) {
671
+ // notify those waiting for this refkey
672
+ knownDeclarations.set(refkey, symbol);
673
+ if (waitingDeclarations.has(refkey)) {
674
+ const signal = waitingDeclarations.get(refkey)!;
675
+ signal.value = symbol;
676
+ }
659
677
 
660
- const scope = symbol.scope;
661
- if (!scope) {
662
- continue;
663
- }
678
+ const scope = symbol.scope;
679
+ if (!scope) {
680
+ continue;
681
+ }
664
682
 
665
- // notify those waiting for this symbol name
666
- const waitingScope = waitingSymbolNames.get(scope);
667
- if (waitingScope) {
668
- const waitingName = waitingScope.get(symbol.name);
669
- if (waitingName) {
670
- waitingName.value = symbol;
683
+ // notify those waiting for this symbol name
684
+ const waitingScope = waitingSymbolNames.get(scope);
685
+ if (waitingScope) {
686
+ const waitingName = waitingScope.get(symbol.name);
687
+ if (waitingName) {
688
+ waitingName.value = symbol;
689
+ }
671
690
  }
672
691
  }
673
- }
674
692
 
675
- return [...symbol.refkeys];
676
- });
693
+ return [...symbol.refkeys];
694
+ },
695
+ undefined,
696
+ {
697
+ debug: {
698
+ name: "binder:notifySymbolCreated",
699
+ type: "binder",
700
+ },
701
+ },
702
+ );
677
703
  }
678
704
  }
679
705
 
@@ -702,11 +728,49 @@ export function resolve<
702
728
  throw new Error("Can't resolve refkey without a binder");
703
729
  }
704
730
 
705
- return binder.resolveDeclarationByKey(
731
+ const result = binder.resolveDeclarationByKey(
706
732
  scope as TScope,
707
733
  refkey,
708
734
  options,
709
735
  ) as any;
736
+
737
+ let diagnosticHandle: DiagnosticHandle | null = null;
738
+
739
+ effect(
740
+ () => {
741
+ if (result.value === undefined) {
742
+ // Emit diagnostic for this specific reference site
743
+ if (!diagnosticHandle) {
744
+ diagnosticHandle = emitDiagnostic({
745
+ severity: "warning",
746
+ message: `Unresolved refkey: ${inspectRefkey(refkey)}`,
747
+ });
748
+ }
749
+ } else {
750
+ // Dismiss diagnostic when resolved
751
+ if (diagnosticHandle) {
752
+ diagnosticHandle.dismiss();
753
+ diagnosticHandle = null;
754
+ }
755
+ }
756
+ },
757
+ undefined,
758
+ {
759
+ debug: {
760
+ name: `binder:resolve:${inspectRefkey(refkey)}`,
761
+ type: "binder",
762
+ },
763
+ },
764
+ );
765
+
766
+ onCleanup(() => {
767
+ if (diagnosticHandle) {
768
+ diagnosticHandle.dismiss();
769
+ diagnosticHandle = null;
770
+ }
771
+ });
772
+
773
+ return result;
710
774
  }
711
775
 
712
776
  /**
@@ -0,0 +1,132 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import "../../testing/extend-expect.js";
3
+ import {
4
+ BasePartProps,
5
+ createAccessExpression,
6
+ } from "../components/AccessExpression.jsx";
7
+ import { code } from "../index.js";
8
+ import { printTree, renderTree } from "../render.js";
9
+ import { Children } from "../runtime/component.js";
10
+
11
+ interface TestPartProps extends BasePartProps {
12
+ name?: string;
13
+ args?: Children;
14
+ }
15
+
16
+ interface TestPart extends Record<string, unknown> {
17
+ name: string | undefined;
18
+ args: Children | undefined;
19
+ isFirst: boolean;
20
+ }
21
+
22
+ const { Expression, Part } = createAccessExpression<TestPartProps, TestPart>({
23
+ createDescriptor(props, symbol, first) {
24
+ return {
25
+ name: symbol?.name ?? props.name,
26
+ args: props.args,
27
+ isFirst: first,
28
+ };
29
+ },
30
+
31
+ getBase(part) {
32
+ return part.name ?? "";
33
+ },
34
+
35
+ formatPart(part, _prevPart, _inCallChain) {
36
+ if (part.args !== undefined) {
37
+ return code`.${part.name}(${part.args})`;
38
+ }
39
+ return code`.${part.name}`;
40
+ },
41
+
42
+ isCallPart(part) {
43
+ return part.args !== undefined;
44
+ },
45
+ });
46
+
47
+ describe("createAccessExpression", () => {
48
+ it("renders a single part as the base", () => {
49
+ expect(
50
+ <Expression>
51
+ <Part name="foo" />
52
+ </Expression>,
53
+ ).toRenderTo("foo");
54
+ });
55
+
56
+ it("renders multiple parts with dot access", () => {
57
+ expect(
58
+ <Expression>
59
+ <Part name="foo" />
60
+ <Part name="bar" />
61
+ <Part name="baz" />
62
+ </Expression>,
63
+ ).toRenderTo("foo.bar.baz");
64
+ });
65
+
66
+ it("renders parts with call arguments", () => {
67
+ expect(
68
+ <Expression>
69
+ <Part name="foo" />
70
+ <Part name="bar" args="x, y" />
71
+ </Expression>,
72
+ ).toRenderTo("foo.bar(x, y)");
73
+ });
74
+
75
+ it("returns empty for no parts", () => {
76
+ expect(<Expression>{false}</Expression>).toRenderTo("");
77
+ });
78
+
79
+ it("flattens nested Expression instances", () => {
80
+ const inner = (
81
+ <Expression>
82
+ <Part name="bar" />
83
+ <Part name="baz" />
84
+ </Expression>
85
+ );
86
+
87
+ expect(
88
+ <Expression>
89
+ <Part name="foo" />
90
+ {inner}
91
+ </Expression>,
92
+ ).toRenderTo("foo.bar.baz");
93
+ });
94
+
95
+ it("ignores non-Part children", () => {
96
+ expect(
97
+ <Expression>
98
+ <Part name="foo" />
99
+ {"some string"}
100
+ <Part name="bar" />
101
+ </Expression>,
102
+ ).toRenderTo("foo.bar");
103
+ });
104
+ });
105
+
106
+ describe("createAccessExpression: call chain formatting", () => {
107
+ it("uses linear format with only one call", () => {
108
+ const tree = renderTree(
109
+ <Expression>
110
+ <Part name="foo" />
111
+ <Part name="bar" args="x" />
112
+ </Expression>,
113
+ );
114
+ // Single call → linear, no grouping.
115
+ expect(printTree(tree)).toBe("foo.bar(x)");
116
+ });
117
+
118
+ it("uses call chain format with multiple calls", () => {
119
+ const tree = renderTree(
120
+ <Expression>
121
+ <Part name="foo" />
122
+ <Part name="bar" args="x" />
123
+ <Part name="baz" args="y" />
124
+ </Expression>,
125
+ );
126
+ // Multiple calls → call chain with group/indent wrapping.
127
+ const result = printTree(tree);
128
+ // Should contain both calls.
129
+ expect(result).toContain("bar(x)");
130
+ expect(result).toContain("baz(y)");
131
+ });
132
+ });