@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.
- package/CHANGELOG.md +0 -22
- package/dist/devtools/index.html +80 -0
- package/dist/src/binder.d.ts +2 -0
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +60 -12
- package/dist/src/binder.js.map +1 -1
- package/dist/src/components/AccessExpression.d.ts +78 -0
- package/dist/src/components/AccessExpression.d.ts.map +1 -0
- package/dist/src/components/AccessExpression.js +218 -0
- package/dist/src/components/AccessExpression.js.map +1 -0
- package/dist/src/components/AccessExpression.test.d.ts +2 -0
- package/dist/src/components/AccessExpression.test.d.ts.map +1 -0
- package/dist/src/components/AccessExpression.test.js +137 -0
- package/dist/src/components/AccessExpression.test.js.map +1 -0
- package/dist/src/components/AppendFile.d.ts.map +1 -1
- package/dist/src/components/AppendFile.js +14 -3
- package/dist/src/components/AppendFile.js.map +1 -1
- package/dist/src/components/Block.js +1 -1
- package/dist/src/components/Block.js.map +1 -1
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +2 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/For.d.ts.map +1 -1
- package/dist/src/components/For.js +1 -1
- package/dist/src/components/For.js.map +1 -1
- package/dist/src/components/List.d.ts.map +1 -1
- package/dist/src/components/List.js +1 -1
- package/dist/src/components/List.js.map +1 -1
- package/dist/src/components/Prose.js +2 -2
- package/dist/src/components/Prose.js.map +1 -1
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +6 -1
- package/dist/src/components/Scope.js.map +1 -1
- package/dist/src/components/SourceDirectory.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.js +1 -2
- package/dist/src/components/SourceDirectory.js.map +1 -1
- package/dist/src/components/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch.js +1 -1
- package/dist/src/components/Switch.js.map +1 -1
- package/dist/src/components/TemplateFile.d.ts.map +1 -1
- package/dist/src/components/TemplateFile.js +18 -3
- package/dist/src/components/TemplateFile.js.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/content-slot.d.ts.map +1 -1
- package/dist/src/content-slot.js +7 -6
- package/dist/src/content-slot.js.map +1 -1
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +10 -3
- package/dist/src/context.js.map +1 -1
- package/dist/src/debug/cli.d.ts +6 -0
- package/dist/src/debug/cli.d.ts.map +1 -0
- package/dist/src/{debug.js → debug/cli.js} +79 -82
- package/dist/src/debug/cli.js.map +1 -0
- package/dist/src/debug/diagnostics.test.d.ts +2 -0
- package/dist/src/debug/diagnostics.test.d.ts.map +1 -0
- package/dist/src/debug/diagnostics.test.js +46 -0
- package/dist/src/debug/diagnostics.test.js.map +1 -0
- package/dist/src/debug/effects.d.ts +81 -0
- package/dist/src/debug/effects.d.ts.map +1 -0
- package/dist/src/debug/effects.js +358 -0
- package/dist/src/debug/effects.js.map +1 -0
- package/dist/src/debug/effects.test.d.ts +2 -0
- package/dist/src/debug/effects.test.d.ts.map +1 -0
- package/dist/src/debug/effects.test.js +256 -0
- package/dist/src/debug/effects.test.js.map +1 -0
- package/dist/src/debug/files.d.ts +14 -0
- package/dist/src/debug/files.d.ts.map +1 -0
- package/dist/src/debug/files.js +29 -0
- package/dist/src/debug/files.js.map +1 -0
- package/dist/src/debug/files.test.d.ts +2 -0
- package/dist/src/debug/files.test.d.ts.map +1 -0
- package/dist/src/debug/files.test.js +66 -0
- package/dist/src/debug/files.test.js.map +1 -0
- package/dist/src/debug/index.d.ts +63 -0
- package/dist/src/debug/index.d.ts.map +1 -0
- package/dist/src/debug/index.js +71 -0
- package/dist/src/debug/index.js.map +1 -0
- package/dist/src/debug/message-format.test.d.ts +2 -0
- package/dist/src/debug/message-format.test.d.ts.map +1 -0
- package/dist/src/debug/message-format.test.js +700 -0
- package/dist/src/debug/message-format.test.js.map +1 -0
- package/dist/src/debug/render-tree-orphans.test.d.ts +2 -0
- package/dist/src/debug/render-tree-orphans.test.d.ts.map +1 -0
- package/dist/src/debug/render-tree-orphans.test.js +297 -0
- package/dist/src/debug/render-tree-orphans.test.js.map +1 -0
- package/dist/src/debug/render.d.ts +57 -0
- package/dist/src/debug/render.d.ts.map +1 -0
- package/dist/src/debug/render.js +472 -0
- package/dist/src/debug/render.js.map +1 -0
- package/dist/src/debug/render.test.d.ts +2 -0
- package/dist/src/debug/render.test.d.ts.map +1 -0
- package/dist/src/debug/render.test.js +291 -0
- package/dist/src/debug/render.test.js.map +1 -0
- package/dist/src/debug/serialize.d.ts +9 -0
- package/dist/src/debug/serialize.d.ts.map +1 -0
- package/dist/src/debug/serialize.js +70 -0
- package/dist/src/debug/serialize.js.map +1 -0
- package/dist/src/debug/symbols.d.ts +16 -0
- package/dist/src/debug/symbols.d.ts.map +1 -0
- package/dist/src/debug/symbols.js +196 -0
- package/dist/src/debug/symbols.js.map +1 -0
- package/dist/src/debug/symbols.test.d.ts +2 -0
- package/dist/src/debug/symbols.test.d.ts.map +1 -0
- package/dist/src/debug/symbols.test.js +93 -0
- package/dist/src/debug/symbols.test.js.map +1 -0
- package/dist/src/debug/trace-writer.d.ts +55 -0
- package/dist/src/debug/trace-writer.d.ts.map +1 -0
- package/dist/src/debug/trace-writer.js +658 -0
- package/dist/src/debug/trace-writer.js.map +1 -0
- package/dist/src/debug/trace.d.ts +342 -0
- package/dist/src/debug/trace.d.ts.map +1 -0
- package/dist/src/debug/trace.js +446 -0
- package/dist/src/debug/trace.js.map +1 -0
- package/dist/src/devtools/devtools-protocol.d.ts +389 -0
- package/dist/src/devtools/devtools-protocol.d.ts.map +1 -0
- package/dist/src/devtools/devtools-protocol.js +2 -0
- package/dist/src/devtools/devtools-protocol.js.map +1 -0
- package/dist/src/devtools/devtools-server.browser.d.ts +23 -0
- package/dist/src/devtools/devtools-server.browser.d.ts.map +1 -0
- package/dist/src/devtools/devtools-server.browser.js +33 -0
- package/dist/src/devtools/devtools-server.browser.js.map +1 -0
- package/dist/src/devtools/devtools-server.d.ts +66 -0
- package/dist/src/devtools/devtools-server.d.ts.map +1 -0
- package/dist/src/devtools/devtools-server.js +444 -0
- package/dist/src/devtools/devtools-server.js.map +1 -0
- package/dist/src/devtools/devtools-transport.d.ts +23 -0
- package/dist/src/devtools/devtools-transport.d.ts.map +1 -0
- package/dist/src/devtools/devtools-transport.js +114 -0
- package/dist/src/devtools/devtools-transport.js.map +1 -0
- package/dist/src/devtools-entry.browser.d.ts +4 -0
- package/dist/src/devtools-entry.browser.d.ts.map +1 -0
- package/dist/src/devtools-entry.browser.js +2 -0
- package/dist/src/devtools-entry.browser.js.map +1 -0
- package/dist/src/devtools-entry.d.ts +4 -0
- package/dist/src/devtools-entry.d.ts.map +1 -0
- package/dist/src/devtools-entry.js +2 -0
- package/dist/src/devtools-entry.js.map +1 -0
- package/dist/src/diagnostics.d.ts +34 -0
- package/dist/src/diagnostics.d.ts.map +1 -0
- package/dist/src/diagnostics.js +89 -0
- package/dist/src/diagnostics.js.map +1 -0
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/print-hook.d.ts +14 -0
- package/dist/src/print-hook.d.ts.map +1 -0
- package/dist/src/print-hook.js +10 -0
- package/dist/src/print-hook.js.map +1 -0
- package/dist/src/reactive-union-set.d.ts.map +1 -1
- package/dist/src/reactive-union-set.js +28 -3
- package/dist/src/reactive-union-set.js.map +1 -1
- package/dist/src/reactivity.d.ts +60 -7
- package/dist/src/reactivity.d.ts.map +1 -1
- package/dist/src/reactivity.js +308 -39
- package/dist/src/reactivity.js.map +1 -1
- package/dist/src/render-stack.d.ts +18 -1
- package/dist/src/render-stack.d.ts.map +1 -1
- package/dist/src/render-stack.js +61 -1
- package/dist/src/render-stack.js.map +1 -1
- package/dist/src/render.d.ts +8 -15
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +424 -109
- package/dist/src/render.js.map +1 -1
- package/dist/src/resource.d.ts.map +1 -1
- package/dist/src/resource.js +5 -0
- package/dist/src/resource.js.map +1 -1
- package/dist/src/scheduler.d.ts +13 -0
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +150 -13
- package/dist/src/scheduler.js.map +1 -1
- package/dist/src/symbols/basic-symbol.d.ts.map +1 -1
- package/dist/src/symbols/basic-symbol.js +6 -1
- package/dist/src/symbols/basic-symbol.js.map +1 -1
- package/dist/src/symbols/decl.d.ts.map +1 -1
- package/dist/src/symbols/decl.js +5 -1
- package/dist/src/symbols/decl.js.map +1 -1
- package/dist/src/symbols/output-scope.d.ts +2 -1
- package/dist/src/symbols/output-scope.d.ts.map +1 -1
- package/dist/src/symbols/output-scope.js +13 -8
- package/dist/src/symbols/output-scope.js.map +1 -1
- package/dist/src/symbols/output-symbol.d.ts +1 -0
- package/dist/src/symbols/output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/output-symbol.js +25 -8
- package/dist/src/symbols/output-symbol.js.map +1 -1
- package/dist/src/symbols/symbol-flow.d.ts.map +1 -1
- package/dist/src/symbols/symbol-flow.js +24 -8
- package/dist/src/symbols/symbol-flow.js.map +1 -1
- package/dist/src/symbols/symbol-slot.d.ts.map +1 -1
- package/dist/src/symbols/symbol-slot.js +15 -0
- package/dist/src/symbols/symbol-slot.js.map +1 -1
- package/dist/src/symbols/symbol-slot.test.d.ts +2 -0
- package/dist/src/symbols/symbol-slot.test.d.ts.map +1 -0
- package/dist/src/symbols/symbol-slot.test.js +35 -0
- package/dist/src/symbols/symbol-slot.test.js.map +1 -0
- package/dist/src/symbols/symbol-table.d.ts.map +1 -1
- package/dist/src/symbols/symbol-table.js +6 -5
- package/dist/src/symbols/symbol-table.js.map +1 -1
- package/dist/src/trace.d.ts +2 -0
- package/dist/src/trace.d.ts.map +1 -0
- package/dist/src/trace.js +2 -0
- package/dist/src/trace.js.map +1 -0
- package/dist/src/tracer.d.ts +2 -228
- package/dist/src/tracer.d.ts.map +1 -1
- package/dist/src/tracer.js +5 -298
- package/dist/src/tracer.js.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +17 -9
- package/dist/src/utils.js.map +1 -1
- package/dist/test/components/append-file.test.d.ts.map +1 -1
- package/dist/test/components/append-file.test.js +18 -10
- package/dist/test/components/append-file.test.js.map +1 -1
- package/dist/test/components/template-file.test.d.ts.map +1 -1
- package/dist/test/components/template-file.test.js +6 -4
- package/dist/test/components/template-file.test.js.map +1 -1
- package/dist/test/lazy-isempty.test.d.ts +2 -0
- package/dist/test/lazy-isempty.test.d.ts.map +1 -0
- package/dist/test/lazy-isempty.test.js +89 -0
- package/dist/test/lazy-isempty.test.js.map +1 -0
- package/dist/test/reactive-union-set-disposers.test.d.ts +2 -0
- package/dist/test/reactive-union-set-disposers.test.d.ts.map +1 -0
- package/dist/test/reactive-union-set-disposers.test.js +98 -0
- package/dist/test/reactive-union-set-disposers.test.js.map +1 -0
- package/dist/test/reactivity/shallow-reactive.test.d.ts +2 -0
- package/dist/test/reactivity/shallow-reactive.test.d.ts.map +1 -0
- package/dist/test/reactivity/shallow-reactive.test.js +52 -0
- package/dist/test/reactivity/shallow-reactive.test.js.map +1 -0
- package/dist/test/rendering/basic.test.js +3 -0
- package/dist/test/rendering/basic.test.js.map +1 -1
- package/dist/test/rendering/print-render-stack.test.d.ts.map +1 -1
- package/dist/test/rendering/print-render-stack.test.js +91 -98
- package/dist/test/rendering/print-render-stack.test.js.map +1 -1
- package/dist/test/scheduler-extended.test.d.ts +2 -0
- package/dist/test/scheduler-extended.test.d.ts.map +1 -0
- package/dist/test/scheduler-extended.test.js +96 -0
- package/dist/test/scheduler-extended.test.js.map +1 -0
- package/dist/test/scheduler.test.d.ts +2 -0
- package/dist/test/scheduler.test.d.ts.map +1 -0
- package/dist/test/scheduler.test.js +46 -0
- package/dist/test/scheduler.test.js.map +1 -0
- package/dist/testing/create-test-wrapper.d.ts +1 -1
- package/dist/testing/create-test-wrapper.d.ts.map +1 -1
- package/dist/testing/create-test-wrapper.js +1 -1
- package/dist/testing/create-test-wrapper.js.map +1 -1
- package/dist/testing/devtools-utils.d.ts +35 -0
- package/dist/testing/devtools-utils.d.ts.map +1 -0
- package/dist/testing/devtools-utils.js +162 -0
- package/dist/testing/devtools-utils.js.map +1 -0
- package/dist/testing/extend-expect.d.ts.map +1 -1
- package/dist/testing/extend-expect.js +63 -1
- package/dist/testing/extend-expect.js.map +1 -1
- package/dist/testing/render.d.ts +2 -2
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/testing/render.js +2 -2
- package/dist/testing/render.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -7
- package/scripts/copy-devtools-ui.mjs +26 -0
- package/src/binder.ts +117 -53
- package/src/components/AccessExpression.test.tsx +132 -0
- package/src/components/AccessExpression.tsx +344 -0
- package/src/components/AppendFile.tsx +14 -9
- package/src/components/Block.tsx +1 -1
- package/src/components/Declaration.tsx +2 -1
- package/src/components/For.tsx +14 -10
- package/src/components/List.tsx +7 -4
- package/src/components/Prose.tsx +1 -1
- package/src/components/Scope.tsx +6 -1
- package/src/components/SourceDirectory.tsx +1 -2
- package/src/components/Switch.tsx +11 -7
- package/src/components/TemplateFile.tsx +18 -9
- package/src/components/index.tsx +1 -0
- package/src/content-slot.tsx +7 -7
- package/src/context.ts +17 -6
- package/src/{debug.ts → debug/cli.ts} +114 -125
- package/src/debug/diagnostics.test.tsx +56 -0
- package/src/debug/effects.test.tsx +301 -0
- package/src/debug/effects.ts +531 -0
- package/src/debug/files.test.tsx +76 -0
- package/src/debug/files.ts +40 -0
- package/src/debug/index.ts +132 -0
- package/src/debug/message-format.test.tsx +759 -0
- package/src/debug/render-tree-orphans.test.tsx +344 -0
- package/src/debug/render.test.tsx +357 -0
- package/src/debug/render.ts +698 -0
- package/src/debug/serialize.ts +85 -0
- package/src/debug/symbols.test.tsx +105 -0
- package/src/debug/symbols.ts +322 -0
- package/src/debug/trace-writer.ts +969 -0
- package/src/debug/trace.ts +309 -0
- package/src/devtools/devtools-protocol.ts +497 -0
- package/src/devtools/devtools-server.browser.ts +62 -0
- package/src/devtools/devtools-server.ts +468 -0
- package/src/devtools/devtools-transport.ts +154 -0
- package/src/devtools-entry.browser.ts +48 -0
- package/src/devtools-entry.ts +48 -0
- package/src/diagnostics.ts +150 -0
- package/src/index.ts +2 -7
- package/src/print-hook.ts +22 -0
- package/src/reactive-union-set.ts +85 -44
- package/src/reactivity.ts +396 -58
- package/src/render-stack.ts +73 -1
- package/src/render.ts +544 -161
- package/src/resource.ts +28 -19
- package/src/scheduler.ts +209 -14
- package/src/symbols/basic-symbol.ts +6 -1
- package/src/symbols/decl.ts +5 -1
- package/src/symbols/output-scope.ts +21 -13
- package/src/symbols/output-symbol.ts +34 -14
- package/src/symbols/symbol-flow.ts +76 -39
- package/src/symbols/symbol-slot.test.tsx +41 -0
- package/src/symbols/symbol-slot.tsx +47 -20
- package/src/symbols/symbol-table.ts +6 -10
- package/src/trace.ts +1 -0
- package/src/tracer.ts +13 -242
- package/src/utils.tsx +31 -21
- package/temp/api.json +5700 -3015
- package/test/components/append-file.test.tsx +36 -29
- package/test/components/template-file.test.tsx +11 -11
- package/test/lazy-isempty.test.tsx +106 -0
- package/test/reactive-union-set-disposers.test.tsx +112 -0
- package/test/reactivity/shallow-reactive.test.tsx +56 -0
- package/test/rendering/basic.test.tsx +4 -0
- package/test/rendering/print-render-stack.test.tsx +52 -43
- package/test/scheduler-extended.test.tsx +122 -0
- package/test/scheduler.test.tsx +50 -0
- package/testing/create-test-wrapper.tsx +1 -1
- package/testing/devtools-utils.ts +245 -0
- package/testing/extend-expect.ts +89 -0
- package/testing/render.ts +2 -2
- package/testing/vitest.d.ts +9 -0
- package/dist/src/debug.d.ts +0 -14
- package/dist/src/debug.d.ts.map +0 -1
- 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.
|
|
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
|
-
"
|
|
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.
|
|
46
|
-
"@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.
|
|
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": "
|
|
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 {
|
|
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[]>(
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
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
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
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
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
678
|
+
const scope = symbol.scope;
|
|
679
|
+
if (!scope) {
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
664
682
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
});
|