@alloy-js/core 0.23.0-dev.8 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/api-extractor.json +1 -8
- package/api-extractor.testing.json +19 -0
- package/dist/dev/src/binder.js +595 -0
- package/dist/dev/src/binder.js.map +1 -0
- package/dist/dev/src/code.js +181 -0
- package/dist/dev/src/code.js.map +1 -0
- package/dist/dev/src/components/AccessExpression.js +230 -0
- package/dist/dev/src/components/AccessExpression.js.map +1 -0
- package/dist/dev/src/components/AccessExpression.test.js +237 -0
- package/dist/dev/src/components/AccessExpression.test.js.map +1 -0
- package/dist/dev/src/components/AppendFile.js +246 -0
- package/dist/dev/src/components/AppendFile.js.map +1 -0
- package/dist/dev/src/components/Block.js +78 -0
- package/dist/dev/src/components/Block.js.map +1 -0
- package/dist/dev/src/components/CopyFile.js +16 -0
- package/dist/dev/src/components/CopyFile.js.map +1 -0
- package/dist/dev/src/components/Declaration.js +70 -0
- package/dist/dev/src/components/Declaration.js.map +1 -0
- package/dist/dev/src/components/For.js +40 -0
- package/dist/dev/src/components/For.js.map +1 -0
- package/dist/dev/src/components/Indent.js +37 -0
- package/dist/dev/src/components/Indent.js.map +1 -0
- package/dist/dev/src/components/List.js +29 -0
- package/dist/dev/src/components/List.js.map +1 -0
- package/dist/dev/src/components/MemberDeclaration.js +70 -0
- package/dist/dev/src/components/MemberDeclaration.js.map +1 -0
- package/dist/dev/src/components/MemberName.js +18 -0
- package/dist/dev/src/components/MemberName.js.map +1 -0
- package/dist/dev/src/components/MemberScope.js +62 -0
- package/dist/dev/src/components/MemberScope.js.map +1 -0
- package/dist/dev/src/components/Name.js +11 -0
- package/dist/dev/src/components/Name.js.map +1 -0
- package/dist/dev/src/components/Output.js +72 -0
- package/dist/dev/src/components/Output.js.map +1 -0
- package/dist/dev/src/components/Prose.js +32 -0
- package/dist/dev/src/components/Prose.js.map +1 -0
- package/dist/dev/src/components/ReferenceOrContent.js +12 -0
- package/dist/dev/src/components/ReferenceOrContent.js.map +1 -0
- package/dist/dev/src/components/Scope.js +56 -0
- package/dist/dev/src/components/Scope.js.map +1 -0
- package/dist/dev/src/components/Show.js +4 -0
- package/dist/dev/src/components/Show.js.map +1 -0
- package/dist/dev/src/components/SourceDirectory.js +41 -0
- package/dist/dev/src/components/SourceDirectory.js.map +1 -0
- package/dist/dev/src/components/SourceFile.js +52 -0
- package/dist/dev/src/components/SourceFile.js.map +1 -0
- package/dist/dev/src/components/StatementList.js +20 -0
- package/dist/dev/src/components/StatementList.js.map +1 -0
- package/dist/dev/src/components/Switch.js +42 -0
- package/dist/dev/src/components/Switch.js.map +1 -0
- package/dist/dev/src/components/TemplateFile.js +153 -0
- package/dist/dev/src/components/TemplateFile.js.map +1 -0
- package/dist/dev/src/components/UpdateFile.js +71 -0
- package/dist/dev/src/components/UpdateFile.js.map +1 -0
- package/dist/dev/src/components/Wrap.js +18 -0
- package/dist/dev/src/components/Wrap.js.map +1 -0
- package/dist/dev/src/components/index.js +25 -0
- package/dist/dev/src/components/index.js.map +1 -0
- package/dist/dev/src/components/stc/index.js +27 -0
- package/dist/dev/src/components/stc/index.js.map +1 -0
- package/dist/dev/src/components/stc/sti.js +10 -0
- package/dist/dev/src/components/stc/sti.js.map +1 -0
- package/dist/dev/src/content-slot.js +78 -0
- package/dist/dev/src/content-slot.js.map +1 -0
- package/dist/dev/src/content-slot.test.js +89 -0
- package/dist/dev/src/content-slot.test.js.map +1 -0
- package/dist/dev/src/context/assignment.js +46 -0
- package/dist/dev/src/context/assignment.js.map +1 -0
- package/dist/dev/src/context/binder.js +17 -0
- package/dist/dev/src/context/binder.js.map +1 -0
- package/dist/dev/src/context/declaration.js +3 -0
- package/dist/dev/src/context/declaration.js.map +1 -0
- package/dist/dev/src/context/format-options.js +45 -0
- package/dist/dev/src/context/format-options.js.map +1 -0
- package/dist/dev/src/context/index.js +11 -0
- package/dist/dev/src/context/index.js.map +1 -0
- package/dist/dev/src/context/member-declaration.js +11 -0
- package/dist/dev/src/context/member-declaration.js.map +1 -0
- package/dist/dev/src/context/member-scope.js +12 -0
- package/dist/dev/src/context/member-scope.js.map +1 -0
- package/dist/dev/src/context/name-policy.js +13 -0
- package/dist/dev/src/context/name-policy.js.map +1 -0
- package/dist/dev/src/context/scope.js +18 -0
- package/dist/dev/src/context/scope.js.map +1 -0
- package/dist/dev/src/context/source-directory.js +12 -0
- package/dist/dev/src/context/source-directory.js.map +1 -0
- package/dist/dev/src/context/source-file.js +3 -0
- package/dist/dev/src/context/source-file.js.map +1 -0
- package/dist/dev/src/context.js +47 -0
- package/dist/dev/src/context.js.map +1 -0
- package/dist/dev/src/debug/cli.js +164 -0
- package/dist/dev/src/debug/cli.js.map +1 -0
- package/dist/dev/src/debug/diagnostics-broadcast.test.js +100 -0
- package/dist/dev/src/debug/diagnostics-broadcast.test.js.map +1 -0
- package/dist/dev/src/debug/diagnostics.test.js +50 -0
- package/dist/dev/src/debug/diagnostics.test.js.map +1 -0
- package/dist/dev/src/debug/effects.js +293 -0
- package/dist/dev/src/debug/effects.js.map +1 -0
- package/dist/dev/src/debug/effects.test.js +280 -0
- package/dist/dev/src/debug/effects.test.js.map +1 -0
- package/dist/dev/src/debug/files.js +29 -0
- package/dist/dev/src/debug/files.js.map +1 -0
- package/dist/dev/src/debug/files.test.js +78 -0
- package/dist/dev/src/debug/files.test.js.map +1 -0
- package/dist/dev/src/debug/index.js +71 -0
- package/dist/dev/src/debug/index.js.map +1 -0
- package/dist/dev/src/debug/message-format.test.js +836 -0
- package/dist/dev/src/debug/message-format.test.js.map +1 -0
- package/dist/dev/src/debug/render-tree-orphans.test.js +365 -0
- package/dist/dev/src/debug/render-tree-orphans.test.js.map +1 -0
- package/dist/dev/src/debug/render.js +479 -0
- package/dist/dev/src/debug/render.js.map +1 -0
- package/dist/dev/src/debug/render.test.js +363 -0
- package/dist/dev/src/debug/render.test.js.map +1 -0
- package/dist/dev/src/debug/serialize.js +70 -0
- package/dist/dev/src/debug/serialize.js.map +1 -0
- package/dist/dev/src/debug/source-map.browser.js +24 -0
- package/dist/dev/src/debug/source-map.browser.js.map +1 -0
- package/dist/dev/src/debug/source-map.js +111 -0
- package/dist/dev/src/debug/source-map.js.map +1 -0
- package/dist/dev/src/debug/symbols.js +196 -0
- package/dist/dev/src/debug/symbols.js.map +1 -0
- package/dist/dev/src/debug/symbols.test.js +93 -0
- package/dist/dev/src/debug/symbols.test.js.map +1 -0
- package/dist/dev/src/debug/trace-writer.js +674 -0
- package/dist/dev/src/debug/trace-writer.js.map +1 -0
- package/dist/dev/src/debug/trace.js +460 -0
- package/dist/dev/src/debug/trace.js.map +1 -0
- package/dist/dev/src/devtools/devtools-protocol.js +2 -0
- package/dist/dev/src/devtools/devtools-protocol.js.map +1 -0
- package/dist/dev/src/devtools/devtools-server.browser.js +36 -0
- package/dist/dev/src/devtools/devtools-server.browser.js.map +1 -0
- package/dist/dev/src/devtools/devtools-server.js +458 -0
- package/dist/dev/src/devtools/devtools-server.js.map +1 -0
- package/dist/dev/src/devtools/devtools-transport.js +114 -0
- package/dist/dev/src/devtools/devtools-transport.js.map +1 -0
- package/dist/dev/src/devtools-entry.browser.js +2 -0
- package/dist/dev/src/devtools-entry.browser.js.map +1 -0
- package/dist/dev/src/devtools-entry.js +2 -0
- package/dist/dev/src/devtools-entry.js.map +1 -0
- package/dist/dev/src/diagnostics.js +97 -0
- package/dist/dev/src/diagnostics.js.map +1 -0
- package/dist/dev/src/host/alloy-host.browser.js +32 -0
- package/dist/dev/src/host/alloy-host.browser.js.map +1 -0
- package/dist/dev/src/host/alloy-host.js +144 -0
- package/dist/dev/src/host/alloy-host.js.map +1 -0
- package/dist/dev/src/host/interface.js +2 -0
- package/dist/dev/src/host/interface.js.map +1 -0
- package/dist/dev/src/host/node-host.browser.js +21 -0
- package/dist/dev/src/host/node-host.browser.js.map +1 -0
- package/dist/dev/src/host/node-host.js +20 -0
- package/dist/dev/src/host/node-host.js.map +1 -0
- package/dist/dev/src/index.browser.js +3 -0
- package/dist/dev/src/index.browser.js.map +1 -0
- package/dist/dev/src/index.js +27 -0
- package/dist/dev/src/index.js.map +1 -0
- package/dist/dev/src/inspect.browser.js +6 -0
- package/dist/dev/src/inspect.browser.js.map +1 -0
- package/dist/dev/src/inspect.js +2 -0
- package/dist/dev/src/inspect.js.map +1 -0
- package/dist/dev/src/jsx-runtime.js +17 -0
- package/dist/dev/src/jsx-runtime.js.map +1 -0
- package/dist/dev/src/library-symbol-reference.js +59 -0
- package/dist/dev/src/library-symbol-reference.js.map +1 -0
- package/dist/dev/src/name-policy.js +51 -0
- package/dist/dev/src/name-policy.js.map +1 -0
- package/dist/dev/src/pretty-string/pretty-string.js +100 -0
- package/dist/dev/src/pretty-string/pretty-string.js.map +1 -0
- package/dist/dev/src/pretty-string/pretty-string.test.js +38 -0
- package/dist/dev/src/pretty-string/pretty-string.test.js.map +1 -0
- package/dist/dev/src/print-hook.js +10 -0
- package/dist/dev/src/print-hook.js.map +1 -0
- package/dist/dev/src/props-combinators.js +109 -0
- package/dist/dev/src/props-combinators.js.map +1 -0
- package/dist/dev/src/reactive-union-set.js +213 -0
- package/dist/dev/src/reactive-union-set.js.map +1 -0
- package/dist/dev/src/reactivity.js +452 -0
- package/dist/dev/src/reactivity.js.map +1 -0
- package/dist/dev/src/refkey.js +167 -0
- package/dist/dev/src/refkey.js.map +1 -0
- package/dist/dev/src/render-stack.js +252 -0
- package/dist/dev/src/render-stack.js.map +1 -0
- package/dist/dev/src/render.js +872 -0
- package/dist/dev/src/render.js.map +1 -0
- package/dist/dev/src/resource.js +124 -0
- package/dist/dev/src/resource.js.map +1 -0
- package/dist/dev/src/runtime/component.js +41 -0
- package/dist/dev/src/runtime/component.js.map +1 -0
- package/dist/dev/src/runtime/intrinsic.js +12 -0
- package/dist/dev/src/runtime/intrinsic.js.map +1 -0
- package/dist/dev/src/scheduler.js +217 -0
- package/dist/dev/src/scheduler.js.map +1 -0
- package/dist/dev/src/stc.js +40 -0
- package/dist/dev/src/stc.js.map +1 -0
- package/dist/dev/src/sti.js +31 -0
- package/dist/dev/src/sti.js.map +1 -0
- package/dist/dev/src/symbols/basic-scope.js +21 -0
- package/dist/dev/src/symbols/basic-scope.js.map +1 -0
- package/dist/dev/src/symbols/basic-symbol.js +34 -0
- package/dist/dev/src/symbols/basic-symbol.js.map +1 -0
- package/dist/dev/src/symbols/decl.js +26 -0
- package/dist/dev/src/symbols/decl.js.map +1 -0
- package/dist/dev/src/symbols/index.js +10 -0
- package/dist/dev/src/symbols/index.js.map +1 -0
- package/dist/dev/src/symbols/output-scope.js +235 -0
- package/dist/dev/src/symbols/output-scope.js.map +1 -0
- package/dist/dev/src/symbols/output-space.js +51 -0
- package/dist/dev/src/symbols/output-space.js.map +1 -0
- package/dist/dev/src/symbols/output-symbol.js +644 -0
- package/dist/dev/src/symbols/output-symbol.js.map +1 -0
- package/dist/dev/src/symbols/symbol-flow.js +106 -0
- package/dist/dev/src/symbols/symbol-flow.js.map +1 -0
- package/dist/dev/src/symbols/symbol-slot.js +75 -0
- package/dist/dev/src/symbols/symbol-slot.js.map +1 -0
- package/dist/dev/src/symbols/symbol-slot.test.js +68 -0
- package/dist/dev/src/symbols/symbol-slot.test.js.map +1 -0
- package/dist/dev/src/symbols/symbol-table.js +103 -0
- package/dist/dev/src/symbols/symbol-table.js.map +1 -0
- package/dist/dev/src/tap.js +109 -0
- package/dist/dev/src/tap.js.map +1 -0
- package/dist/dev/src/trace.js +2 -0
- package/dist/dev/src/trace.js.map +1 -0
- package/dist/dev/src/tracer.js +180 -0
- package/dist/dev/src/tracer.js.map +1 -0
- package/dist/dev/src/utils.js +487 -0
- package/dist/dev/src/utils.js.map +1 -0
- package/dist/dev/src/write-output.js +48 -0
- package/dist/dev/src/write-output.js.map +1 -0
- package/dist/dev/test/browser-build.test.js +85 -0
- package/dist/dev/test/browser-build.test.js.map +1 -0
- package/dist/dev/test/children.test.js +44 -0
- package/dist/dev/test/children.test.js.map +1 -0
- package/dist/dev/test/components/append-file.test.js +394 -0
- package/dist/dev/test/components/append-file.test.js.map +1 -0
- package/dist/dev/test/components/block.test.js +83 -0
- package/dist/dev/test/components/block.test.js.map +1 -0
- package/dist/dev/test/components/copy-file.test.js +119 -0
- package/dist/dev/test/components/copy-file.test.js.map +1 -0
- package/dist/dev/test/components/declaration.test.js +40 -0
- package/dist/dev/test/components/declaration.test.js.map +1 -0
- package/dist/dev/test/components/list.test.js +250 -0
- package/dist/dev/test/components/list.test.js.map +1 -0
- package/dist/dev/test/components/prose.test.js +42 -0
- package/dist/dev/test/components/prose.test.js.map +1 -0
- package/dist/dev/test/components/reference-or-content.test.js +246 -0
- package/dist/dev/test/components/reference-or-content.test.js.map +1 -0
- package/dist/dev/test/components/source-file.test.js +271 -0
- package/dist/dev/test/components/source-file.test.js.map +1 -0
- package/dist/dev/test/components/template-file.test.js +200 -0
- package/dist/dev/test/components/template-file.test.js.map +1 -0
- package/dist/dev/test/components/update-file.test.js +210 -0
- package/dist/dev/test/components/update-file.test.js.map +1 -0
- package/dist/dev/test/components/wrap.test.js +48 -0
- package/dist/dev/test/components/wrap.test.js.map +1 -0
- package/dist/dev/test/control-flow/for.test.js +318 -0
- package/dist/dev/test/control-flow/for.test.js.map +1 -0
- package/dist/dev/test/control-flow/match.test.js +112 -0
- package/dist/dev/test/control-flow/match.test.js.map +1 -0
- package/dist/dev/test/control-flow/show.test.js +38 -0
- package/dist/dev/test/control-flow/show.test.js.map +1 -0
- package/dist/dev/test/lazy-isempty.test.js +121 -0
- package/dist/dev/test/lazy-isempty.test.js.map +1 -0
- package/dist/dev/test/name-policy.test.js +28 -0
- package/dist/dev/test/name-policy.test.js.map +1 -0
- package/dist/dev/test/props-with-defaults.test.js +94 -0
- package/dist/dev/test/props-with-defaults.test.js.map +1 -0
- package/dist/dev/test/reactive-union-set-disposers.test.js +98 -0
- package/dist/dev/test/reactive-union-set-disposers.test.js.map +1 -0
- package/dist/dev/test/reactive-union-set.test.js +171 -0
- package/dist/dev/test/reactive-union-set.test.js.map +1 -0
- package/dist/dev/test/reactivity/circular-reactives.test.js +62 -0
- package/dist/dev/test/reactivity/circular-reactives.test.js.map +1 -0
- package/dist/dev/test/reactivity/cleanup.test.js +96 -0
- package/dist/dev/test/reactivity/cleanup.test.js.map +1 -0
- package/dist/dev/test/reactivity/memo.test.js +17 -0
- package/dist/dev/test/reactivity/memo.test.js.map +1 -0
- package/dist/dev/test/reactivity/ref-rendering.test.js +38 -0
- package/dist/dev/test/reactivity/ref-rendering.test.js.map +1 -0
- package/dist/dev/test/reactivity/shallow-reactive.test.js +56 -0
- package/dist/dev/test/reactivity/shallow-reactive.test.js.map +1 -0
- package/dist/dev/test/reactivity/test.test.js +74 -0
- package/dist/dev/test/reactivity/test.test.js.map +1 -0
- package/dist/dev/test/reactivity/untrack.test.js +27 -0
- package/dist/dev/test/reactivity/untrack.test.js.map +1 -0
- package/dist/dev/test/refkey.test.js +36 -0
- package/dist/dev/test/refkey.test.js.map +1 -0
- package/dist/dev/test/rendering/basic.test.js +194 -0
- package/dist/dev/test/rendering/basic.test.js.map +1 -0
- package/dist/dev/test/rendering/code.test.js +64 -0
- package/dist/dev/test/rendering/code.test.js.map +1 -0
- package/dist/dev/test/rendering/formatting.test.js +797 -0
- package/dist/dev/test/rendering/formatting.test.js.map +1 -0
- package/dist/dev/test/rendering/indent.test.js +183 -0
- package/dist/dev/test/rendering/indent.test.js.map +1 -0
- package/dist/dev/test/rendering/memoization.test.js +37 -0
- package/dist/dev/test/rendering/memoization.test.js.map +1 -0
- package/dist/dev/test/rendering/print-render-stack.test.js +287 -0
- package/dist/dev/test/rendering/print-render-stack.test.js.map +1 -0
- package/dist/dev/test/rendering/refkeys.test.js +37 -0
- package/dist/dev/test/rendering/refkeys.test.js.map +1 -0
- package/dist/dev/test/scheduler-extended.test.js +96 -0
- package/dist/dev/test/scheduler-extended.test.js.map +1 -0
- package/dist/dev/test/scheduler.test.js +46 -0
- package/dist/dev/test/scheduler.test.js.map +1 -0
- package/dist/dev/test/split-props.test.js +78 -0
- package/dist/dev/test/split-props.test.js.map +1 -0
- package/dist/dev/test/stc.test.js +35 -0
- package/dist/dev/test/stc.test.js.map +1 -0
- package/dist/dev/test/symbols/deconflicted-name.test.js +120 -0
- package/dist/dev/test/symbols/deconflicted-name.test.js.map +1 -0
- package/dist/dev/test/symbols/output-scope.test.js +221 -0
- package/dist/dev/test/symbols/output-scope.test.js.map +1 -0
- package/dist/dev/test/symbols/output-symbol.test.js +202 -0
- package/dist/dev/test/symbols/output-symbol.test.js.map +1 -0
- package/dist/dev/test/symbols/resolution.test.js +487 -0
- package/dist/dev/test/symbols/resolution.test.js.map +1 -0
- package/dist/dev/test/symbols/symbol-table.test.js +15 -0
- package/dist/dev/test/symbols/symbol-table.test.js.map +1 -0
- package/dist/dev/test/symbols/utils.js +26 -0
- package/dist/dev/test/symbols/utils.js.map +1 -0
- package/dist/dev/test/utils.test.js +317 -0
- package/dist/dev/test/utils.test.js.map +1 -0
- package/dist/dev/testing/create-test-wrapper.js +130 -0
- package/dist/dev/testing/create-test-wrapper.js.map +1 -0
- package/dist/dev/testing/devtools-utils.js +162 -0
- package/dist/dev/testing/devtools-utils.js.map +1 -0
- package/dist/dev/testing/extend-expect.js +187 -0
- package/dist/dev/testing/extend-expect.js.map +1 -0
- package/dist/dev/testing/extend-expect.test.js +234 -0
- package/dist/dev/testing/extend-expect.test.js.map +1 -0
- package/dist/dev/testing/index.js +4 -0
- package/dist/dev/testing/index.js.map +1 -0
- package/dist/dev/testing/render.js +34 -0
- package/dist/dev/testing/render.js.map +1 -0
- package/dist/dev/testing/vitest.d.js +14 -0
- package/dist/dev/testing/vitest.d.js.map +1 -0
- package/dist/devtools/index.html +29 -17
- package/dist/src/binder.d.ts +107 -3
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +113 -1
- 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/Block.d.ts +12 -0
- package/dist/src/components/Block.d.ts.map +1 -1
- package/dist/src/components/Block.js +12 -0
- package/dist/src/components/Block.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 +11 -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/MemberDeclaration.d.ts +6 -6
- package/dist/src/components/MemberDeclaration.js +6 -6
- package/dist/src/components/MemberName.d.ts +6 -0
- package/dist/src/components/MemberName.d.ts.map +1 -1
- package/dist/src/components/MemberName.js +7 -0
- package/dist/src/components/MemberName.js.map +1 -1
- package/dist/src/components/MemberScope.d.ts +5 -0
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +5 -0
- package/dist/src/components/MemberScope.js.map +1 -1
- package/dist/src/components/Output.d.ts +4 -2
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.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 +6 -0
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +8 -0
- 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/SourceFile.d.ts +22 -2
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.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/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.js +2 -2
- package/dist/src/content-slot.js.map +1 -1
- package/dist/src/context/binder.d.ts +4 -0
- package/dist/src/context/binder.d.ts.map +1 -1
- package/dist/src/context/binder.js +5 -0
- package/dist/src/context/binder.js.map +1 -1
- package/dist/src/context/format-options.d.ts +14 -1
- package/dist/src/context/format-options.d.ts.map +1 -1
- package/dist/src/context/format-options.js +14 -1
- package/dist/src/context/format-options.js.map +1 -1
- package/dist/src/context/scope.d.ts +4 -0
- package/dist/src/context/scope.d.ts.map +1 -1
- package/dist/src/context/scope.js +5 -0
- package/dist/src/context/scope.js.map +1 -1
- package/dist/src/context/source-directory.d.ts +9 -0
- package/dist/src/context/source-directory.d.ts.map +1 -1
- package/dist/src/context/source-directory.js +9 -0
- package/dist/src/context/source-directory.js.map +1 -1
- package/dist/src/context.js +2 -2
- package/dist/src/context.js.map +1 -1
- package/dist/src/debug/cli.d.ts.map +1 -1
- package/dist/src/debug/cli.js +3 -2
- package/dist/src/debug/cli.js.map +1 -1
- package/dist/src/debug/diagnostics-broadcast.test.d.ts +2 -0
- package/dist/src/debug/diagnostics-broadcast.test.d.ts.map +1 -0
- package/dist/src/debug/diagnostics-broadcast.test.js +100 -0
- package/dist/src/debug/diagnostics-broadcast.test.js.map +1 -0
- package/dist/src/debug/diagnostics.test.js +3 -2
- package/dist/src/debug/diagnostics.test.js.map +1 -1
- package/dist/src/debug/effects.d.ts +16 -4
- package/dist/src/debug/effects.d.ts.map +1 -1
- package/dist/src/debug/effects.js +119 -54
- package/dist/src/debug/effects.js.map +1 -1
- package/dist/src/debug/effects.test.js +206 -36
- package/dist/src/debug/effects.test.js.map +1 -1
- package/dist/src/debug/files.d.ts.map +1 -1
- package/dist/src/debug/files.js +7 -18
- package/dist/src/debug/files.js.map +1 -1
- package/dist/src/debug/files.test.js +13 -36
- package/dist/src/debug/files.test.js.map +1 -1
- package/dist/src/debug/index.d.ts +6 -3
- package/dist/src/debug/index.d.ts.map +1 -1
- package/dist/src/debug/index.js +6 -3
- package/dist/src/debug/index.js.map +1 -1
- 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.map +1 -1
- package/dist/src/debug/render.js +91 -131
- package/dist/src/debug/render.js.map +1 -1
- package/dist/src/debug/render.test.js +91 -128
- package/dist/src/debug/render.test.js.map +1 -1
- package/dist/src/debug/source-map.browser.d.ts +16 -0
- package/dist/src/debug/source-map.browser.d.ts.map +1 -0
- package/dist/src/debug/source-map.browser.js +24 -0
- package/dist/src/debug/source-map.browser.js.map +1 -0
- package/dist/src/debug/source-map.d.ts +22 -0
- package/dist/src/debug/source-map.d.ts.map +1 -0
- package/dist/src/debug/source-map.js +111 -0
- package/dist/src/debug/source-map.js.map +1 -0
- package/dist/src/debug/symbols.d.ts +7 -0
- package/dist/src/debug/symbols.d.ts.map +1 -1
- package/dist/src/debug/symbols.js +46 -14
- package/dist/src/debug/symbols.js.map +1 -1
- package/dist/src/debug/symbols.test.js +15 -26
- package/dist/src/debug/symbols.test.js.map +1 -1
- package/dist/src/debug/trace-writer.d.ts +56 -0
- package/dist/src/debug/trace-writer.d.ts.map +1 -0
- package/dist/src/debug/trace-writer.js +674 -0
- package/dist/src/debug/trace-writer.js.map +1 -0
- package/dist/src/debug/trace.d.ts +10 -10
- package/dist/src/debug/trace.d.ts.map +1 -1
- package/dist/src/debug/trace.js +41 -24
- package/dist/src/debug/trace.js.map +1 -1
- package/dist/src/devtools/devtools-protocol.d.ts +318 -161
- package/dist/src/devtools/devtools-protocol.d.ts.map +1 -1
- package/dist/src/devtools/devtools-server.browser.d.ts +1 -5
- package/dist/src/devtools/devtools-server.browser.d.ts.map +1 -1
- package/dist/src/devtools/devtools-server.browser.js +3 -3
- package/dist/src/devtools/devtools-server.browser.js.map +1 -1
- package/dist/src/devtools/devtools-server.d.ts +5 -6
- package/dist/src/devtools/devtools-server.d.ts.map +1 -1
- package/dist/src/devtools/devtools-server.js +227 -25
- package/dist/src/devtools/devtools-server.js.map +1 -1
- package/dist/src/devtools/devtools-transport.d.ts +2 -2
- package/dist/src/devtools/devtools-transport.d.ts.map +1 -1
- package/dist/src/devtools/devtools-transport.js +2 -2
- package/dist/src/devtools/devtools-transport.js.map +1 -1
- package/dist/src/devtools-entry.browser.d.ts +1 -1
- package/dist/src/devtools-entry.browser.d.ts.map +1 -1
- package/dist/src/devtools-entry.browser.js.map +1 -1
- package/dist/src/devtools-entry.d.ts +1 -1
- package/dist/src/devtools-entry.d.ts.map +1 -1
- package/dist/src/devtools-entry.js.map +1 -1
- package/dist/src/diagnostics.d.ts +1 -1
- package/dist/src/diagnostics.d.ts.map +1 -1
- package/dist/src/diagnostics.js +27 -19
- package/dist/src/diagnostics.js.map +1 -1
- package/dist/src/host/node-host.browser.d.ts +11 -0
- package/dist/src/host/node-host.browser.d.ts.map +1 -0
- package/dist/src/host/node-host.browser.js +21 -0
- package/dist/src/host/node-host.browser.js.map +1 -0
- package/dist/src/host/node-host.d.ts +11 -0
- package/dist/src/host/node-host.d.ts.map +1 -0
- package/dist/src/host/node-host.js +20 -0
- package/dist/src/host/node-host.js.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/library-symbol-reference.d.ts +52 -0
- package/dist/src/library-symbol-reference.d.ts.map +1 -1
- package/dist/src/library-symbol-reference.js +54 -0
- package/dist/src/library-symbol-reference.js.map +1 -1
- package/dist/src/name-policy.d.ts +30 -3
- package/dist/src/name-policy.d.ts.map +1 -1
- package/dist/src/name-policy.js +27 -0
- package/dist/src/name-policy.js.map +1 -1
- package/dist/src/reactive-union-set.d.ts.map +1 -1
- package/dist/src/reactive-union-set.js +13 -3
- package/dist/src/reactive-union-set.js.map +1 -1
- package/dist/src/reactivity.d.ts +60 -6
- package/dist/src/reactivity.d.ts.map +1 -1
- package/dist/src/reactivity.js +302 -155
- package/dist/src/reactivity.js.map +1 -1
- package/dist/src/render-stack.d.ts +1 -0
- package/dist/src/render-stack.d.ts.map +1 -1
- package/dist/src/render-stack.js +8 -3
- package/dist/src/render-stack.js.map +1 -1
- package/dist/src/render.d.ts +2 -0
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +90 -34
- package/dist/src/render.js.map +1 -1
- package/dist/src/scheduler.d.ts +10 -0
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +115 -21
- package/dist/src/scheduler.js.map +1 -1
- package/dist/src/symbols/output-scope.d.ts +33 -1
- package/dist/src/symbols/output-scope.d.ts.map +1 -1
- package/dist/src/symbols/output-scope.js +36 -3
- package/dist/src/symbols/output-scope.js.map +1 -1
- package/dist/src/symbols/output-space.d.ts +12 -0
- package/dist/src/symbols/output-space.d.ts.map +1 -1
- package/dist/src/symbols/output-space.js +15 -0
- package/dist/src/symbols/output-space.js.map +1 -1
- package/dist/src/symbols/output-symbol.d.ts +128 -12
- package/dist/src/symbols/output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/output-symbol.js +160 -20
- 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 +2 -2
- 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 +7 -0
- package/dist/src/symbols/symbol-slot.js.map +1 -1
- package/dist/src/symbols/symbol-slot.test.js +18 -1
- package/dist/src/symbols/symbol-slot.test.js.map +1 -1
- package/dist/src/symbols/symbol-table.d.ts.map +1 -1
- package/dist/src/symbols/symbol-table.js +13 -3
- package/dist/src/symbols/symbol-table.js.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +12 -9
- package/dist/src/utils.js.map +1 -1
- package/dist/src/write-output.d.ts.map +1 -1
- package/dist/src/write-output.js +6 -5
- package/dist/src/write-output.js.map +1 -1
- package/dist/test/browser-build.test.js +66 -67
- package/dist/test/browser-build.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 +56 -0
- package/dist/test/reactivity/shallow-reactive.test.js.map +1 -0
- 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/test/symbols/deconflicted-name.test.d.ts +2 -0
- package/dist/test/symbols/deconflicted-name.test.d.ts.map +1 -0
- package/dist/test/symbols/deconflicted-name.test.js +120 -0
- package/dist/test/symbols/deconflicted-name.test.js.map +1 -0
- package/dist/test/symbols/output-scope.test.js +41 -0
- package/dist/test/symbols/output-scope.test.js.map +1 -1
- package/dist/testing/create-test-wrapper.d.ts +75 -2
- package/dist/testing/create-test-wrapper.d.ts.map +1 -1
- package/dist/testing/create-test-wrapper.js +55 -1
- package/dist/testing/create-test-wrapper.js.map +1 -1
- package/dist/testing/devtools-utils.d.ts +12 -3
- package/dist/testing/devtools-utils.d.ts.map +1 -1
- package/dist/testing/devtools-utils.js +26 -4
- package/dist/testing/devtools-utils.js.map +1 -1
- package/dist/testing/extend-expect.d.ts +26 -0
- package/dist/testing/extend-expect.d.ts.map +1 -1
- package/dist/testing/extend-expect.js +20 -0
- package/dist/testing/extend-expect.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/render.d.ts +9 -0
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/testing/render.js +11 -0
- package/dist/testing/render.js.map +1 -1
- package/dist/testing/vitest.d.js +12 -0
- package/dist/testing/vitest.d.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/AppendRegion.md +83 -0
- package/docs/api/components/Block.md +49 -0
- package/docs/api/components/CopyFile.md +26 -0
- package/docs/api/components/Declaration.md +85 -0
- package/docs/api/components/For.md +91 -0
- package/docs/api/components/Indent.md +40 -0
- package/docs/api/components/List.md +68 -0
- package/docs/api/components/MemberDeclaration.md +89 -0
- package/docs/api/components/MemberName.md +21 -0
- package/docs/api/components/MemberScope.md +81 -0
- package/docs/api/components/Name.md +19 -0
- package/docs/api/components/Output.md +62 -0
- package/docs/api/components/Prose.md +29 -0
- package/docs/api/components/ReferenceOrContent.md +28 -0
- package/docs/api/components/Scope.md +83 -0
- package/docs/api/components/Show.md +32 -0
- package/docs/api/components/SourceDirectory.md +28 -0
- package/docs/api/components/SourceFile.md +60 -0
- package/docs/api/components/StatementList.md +29 -0
- package/docs/api/components/Switch.md +42 -0
- package/docs/api/components/TemplateFile.md +71 -0
- package/docs/api/components/TemplateVariable.md +57 -0
- package/docs/api/components/UpdateFile.md +56 -0
- package/docs/api/components/Wrap.md +40 -0
- package/docs/api/components/createAccessExpression.md +55 -0
- package/docs/api/components/index.md +27 -0
- package/docs/api/contexts/Assignment-context.md +43 -0
- package/docs/api/contexts/Binder-context.md +22 -0
- package/docs/api/contexts/Declaration-context.md +15 -0
- package/docs/api/contexts/Member-context.md +17 -0
- package/docs/api/contexts/MemberDeclaration-context.md +24 -0
- package/docs/api/contexts/NamePolicy-context.md +18 -0
- package/docs/api/contexts/Scope-context.md +20 -0
- package/docs/api/contexts/SourceDirectory-context.md +26 -0
- package/docs/api/contexts/SourceFile-context.md +19 -0
- package/docs/api/contexts/index.md +11 -0
- package/docs/api/functions/attachDiagnosticsCollector.md +18 -0
- package/docs/api/functions/baseListPropsToMapJoinArgs.md +20 -0
- package/docs/api/functions/children.md +27 -0
- package/docs/api/functions/childrenArray.md +25 -0
- package/docs/api/functions/code.md +25 -0
- package/docs/api/functions/computed.md +18 -0
- package/docs/api/functions/createComponent.md +20 -0
- package/docs/api/functions/createContentSlot.md +33 -0
- package/docs/api/functions/createContext.md +19 -0
- package/docs/api/functions/createCustomContext.md +18 -0
- package/docs/api/functions/createDeclarationTap.md +20 -0
- package/docs/api/functions/createFileResource.md +35 -0
- package/docs/api/functions/createFormatOptionsContextFor.md +28 -0
- package/docs/api/functions/createIntrinsic.md +19 -0
- package/docs/api/functions/createMemberTap.md +20 -0
- package/docs/api/functions/createNamePolicy.md +37 -0
- package/docs/api/functions/createNamedContext.md +19 -0
- package/docs/api/functions/createOutputBinder.md +24 -0
- package/docs/api/functions/createRenderTreeHook.md +19 -0
- package/docs/api/functions/createResource.md +77 -0
- package/docs/api/functions/createScope.md +35 -0
- package/docs/api/functions/createScopeTap.md +20 -0
- package/docs/api/functions/createSourceFileTap.md +20 -0
- package/docs/api/functions/createSymbol.md +25 -0
- package/docs/api/functions/createSymbolSlot.md +19 -0
- package/docs/api/functions/createTap.md +55 -0
- package/docs/api/functions/decl.md +20 -0
- package/docs/api/functions/defaultProps.md +21 -0
- package/docs/api/functions/effect.md +26 -0
- package/docs/api/functions/emitDiagnostic.md +18 -0
- package/docs/api/functions/emitSymbol.md +18 -0
- package/docs/api/functions/ensureIsEmpty.md +20 -0
- package/docs/api/functions/findCurrentEffectId.md +19 -0
- package/docs/api/functions/findKeyedChild.md +19 -0
- package/docs/api/functions/findKeyedChildren.md +19 -0
- package/docs/api/functions/findUnkeyedChildren.md +18 -0
- package/docs/api/functions/formatReactivePropertyLabel.md +21 -0
- package/docs/api/functions/getAssignmentSymbol.md +19 -0
- package/docs/api/functions/getContext.md +17 -0
- package/docs/api/functions/getContextForRenderNode.md +18 -0
- package/docs/api/functions/getDiagnosticsForTree.md +18 -0
- package/docs/api/functions/getEffectDebugId.md +18 -0
- package/docs/api/functions/getElementCache.md +17 -0
- package/docs/api/functions/getReactiveCreationLocation.md +18 -0
- package/docs/api/functions/getSymbolCreator.md +18 -0
- package/docs/api/functions/getSymbolCreatorSymbol.md +17 -0
- package/docs/api/functions/index.md +105 -0
- package/docs/api/functions/inspectRefkey.md +18 -0
- package/docs/api/functions/instantiateTakenMembersTo.md +20 -0
- package/docs/api/functions/isComponentCreator.md +19 -0
- package/docs/api/functions/isCustomContext.md +18 -0
- package/docs/api/functions/isIntrinsicElement.md +18 -0
- package/docs/api/functions/isKeyedChild.md +18 -0
- package/docs/api/functions/isLibrarySymbolReference.md +18 -0
- package/docs/api/functions/isMemberRefkey.md +18 -0
- package/docs/api/functions/isNamekey.md +18 -0
- package/docs/api/functions/isPrintHook.md +18 -0
- package/docs/api/functions/isRefkey.md +18 -0
- package/docs/api/functions/isRefkeyable.md +18 -0
- package/docs/api/functions/isRenderableObject.md +20 -0
- package/docs/api/functions/isSymbolRefkey.md +18 -0
- package/docs/api/functions/join.md +33 -0
- package/docs/api/functions/mapJoin.md +106 -0
- package/docs/api/functions/memberRefkey.md +27 -0
- package/docs/api/functions/memo.md +29 -0
- package/docs/api/functions/mergeProps.md +64 -0
- package/docs/api/functions/moveTakenMembersTo.md +18 -0
- package/docs/api/functions/namekey.md +41 -0
- package/docs/api/functions/nextReactiveId.md +19 -0
- package/docs/api/functions/notifyContentState.md +17 -0
- package/docs/api/functions/onCleanup.md +26 -0
- package/docs/api/functions/printTree.md +31 -0
- package/docs/api/functions/reactivePropertyRefId.md +21 -0
- package/docs/api/functions/ref.md +21 -0
- package/docs/api/functions/refId.md +18 -0
- package/docs/api/functions/refkey.md +24 -0
- package/docs/api/functions/render.md +31 -0
- package/docs/api/functions/renderAsync.md +31 -0
- package/docs/api/functions/renderTree.md +18 -0
- package/docs/api/functions/reportDiagnostics.md +18 -0
- package/docs/api/functions/resetRefIdCounter.md +17 -0
- package/docs/api/functions/resolve.md +31 -0
- package/docs/api/functions/root.md +25 -0
- package/docs/api/functions/shallowReactive.md +18 -0
- package/docs/api/functions/shallowRef.md +21 -0
- package/docs/api/functions/sourceFilesForTree.md +31 -0
- package/docs/api/functions/splitProps.md +19 -0
- package/docs/api/functions/stc.md +18 -0
- package/docs/api/functions/sti.md +18 -0
- package/docs/api/functions/symbolForRefkey.md +24 -0
- package/docs/api/functions/taggedComponent.md +19 -0
- package/docs/api/functions/takeSymbols.md +18 -0
- package/docs/api/functions/text.md +19 -0
- package/docs/api/functions/toRef.md +20 -0
- package/docs/api/functions/toRefkey.md +18 -0
- package/docs/api/functions/toRefs.md +20 -0
- package/docs/api/functions/traverseOutput.md +21 -0
- package/docs/api/functions/unresolvedRefkey.md +18 -0
- package/docs/api/functions/untrack.md +18 -0
- package/docs/api/functions/useContext.md +18 -0
- package/docs/api/functions/useFormatOptions.md +18 -0
- package/docs/api/functions/useMemberContext.md +17 -0
- package/docs/api/functions/useMemberScope.md +17 -0
- package/docs/api/functions/writeOutput.md +21 -0
- package/docs/api/index.md +9 -0
- package/docs/api/testing/functions/createTestWrapper.md +70 -0
- package/docs/api/testing/functions/d.md +21 -0
- package/docs/api/testing/functions/dedent.md +18 -0
- package/docs/api/testing/functions/index.md +6 -0
- package/docs/api/testing/functions/renderToString.md +20 -0
- package/docs/api/testing/index.md +4 -0
- package/docs/api/testing/types/TestWrapper.md +10 -0
- package/docs/api/testing/types/ToRenderToOptions.md +24 -0
- package/docs/api/testing/types/index.md +4 -0
- package/docs/api/types/AlignIntrinsicElement.md +5 -0
- package/docs/api/types/AppendRegionProps.md +5 -0
- package/docs/api/types/BaseListProps.md +21 -0
- package/docs/api/types/BasePartProps.md +10 -0
- package/docs/api/types/BasicScope.md +15 -0
- package/docs/api/types/BasicSymbol.md +18 -0
- package/docs/api/types/Binder.md +18 -0
- package/docs/api/types/BinderOptions.md +7 -0
- package/docs/api/types/BrIntrinsicElement.md +5 -0
- package/docs/api/types/BreakParentIntrinsicElement.md +5 -0
- package/docs/api/types/Child.md +5 -0
- package/docs/api/types/Children.md +5 -0
- package/docs/api/types/ChildrenOptions.md +7 -0
- package/docs/api/types/CommonFormatOptions.md +8 -0
- package/docs/api/types/Component.md +8 -0
- package/docs/api/types/ComponentContext.md +11 -0
- package/docs/api/types/ComponentCreator.md +11 -0
- package/docs/api/types/ComponentDefinition.md +7 -0
- package/docs/api/types/ContentOutputFile.md +10 -0
- package/docs/api/types/ContentSlot.md +12 -0
- package/docs/api/types/Context.md +19 -0
- package/docs/api/types/ContextProviderProps.md +8 -0
- package/docs/api/types/CopyFileContext.md +8 -0
- package/docs/api/types/CopyOutputFile.md +9 -0
- package/docs/api/types/CustomContext.md +10 -0
- package/docs/api/types/CustomContextChildrenCallback.md +5 -0
- package/docs/api/types/DeclarationProps.md +5 -0
- package/docs/api/types/DedentIntrinsicElement.md +5 -0
- package/docs/api/types/DedentToRootIntrinsicElement.md +5 -0
- package/docs/api/types/Diagnostic.md +11 -0
- package/docs/api/types/DiagnosticHandle.md +7 -0
- package/docs/api/types/DiagnosticInput.md +10 -0
- package/docs/api/types/DiagnosticSeverity.md +5 -0
- package/docs/api/types/DiagnosticStackEntry.md +9 -0
- package/docs/api/types/DiagnosticsCollector.md +8 -0
- package/docs/api/types/Disposable_2.md +7 -0
- package/docs/api/types/EffectDebugOptions.md +8 -0
- package/docs/api/types/EffectOptions.md +7 -0
- package/docs/api/types/ElementCache.md +5 -0
- package/docs/api/types/ElementCacheKey.md +5 -0
- package/docs/api/types/FillIntrinsicElement.md +5 -0
- package/docs/api/types/ForCallbackArgs.md +5 -0
- package/docs/api/types/ForSupportedCollections.md +5 -0
- package/docs/api/types/GroupIntrinsicElement.md +5 -0
- package/docs/api/types/HardlineIntrinsicElement.md +5 -0
- package/docs/api/types/HbrIntrinsicElement.md +5 -0
- package/docs/api/types/IfBreakIntrinsicElement.md +5 -0
- package/docs/api/types/IndentIfBreakIntrinsicElement.md +5 -0
- package/docs/api/types/IndentIntrinsicElement.md +5 -0
- package/docs/api/types/IntrinsicElement.md +5 -0
- package/docs/api/types/IntrinsicElementBase.md +9 -0
- package/docs/api/types/IntrinsicElements.md +26 -0
- package/docs/api/types/JoinOptions.md +9 -0
- package/docs/api/types/LbrIntrinsicElement.md +5 -0
- package/docs/api/types/LibrarySymbolReference.md +13 -0
- package/docs/api/types/LineIntrinsicElement.md +5 -0
- package/docs/api/types/LineSuffixBoundaryIntrinsicElement.md +5 -0
- package/docs/api/types/LineSuffixIntrinsicElement.md +5 -0
- package/docs/api/types/LiterallineIntrinsicElement.md +5 -0
- package/docs/api/types/MakeChildrenOptional.md +7 -0
- package/docs/api/types/MarkAsRootIntrinsicElement.md +5 -0
- package/docs/api/types/MatchProps.md +9 -0
- package/docs/api/types/MemberDeclarationProps.md +5 -0
- package/docs/api/types/MemberDescriptor.md +10 -0
- package/docs/api/types/MemberRefkey.md +10 -0
- package/docs/api/types/MemberResolutionContext.md +10 -0
- package/docs/api/types/MemberResolver.md +32 -0
- package/docs/api/types/MemberScopeProps.md +5 -0
- package/docs/api/types/Metadata.md +5 -0
- package/docs/api/types/NameConflictResolver.md +27 -0
- package/docs/api/types/NamePolicy.md +8 -0
- package/docs/api/types/NamePolicyGetter.md +9 -0
- package/docs/api/types/Namekey.md +10 -0
- package/docs/api/types/NamekeyOptions.md +8 -0
- package/docs/api/types/OnReactiveSetAddCallback.md +5 -0
- package/docs/api/types/OnReactiveSetDeleteCallback.md +5 -0
- package/docs/api/types/OutputDeclarationSpace.md +13 -0
- package/docs/api/types/OutputDirectory.md +59 -0
- package/docs/api/types/OutputFile.md +5 -0
- package/docs/api/types/OutputFileBase.md +8 -0
- package/docs/api/types/OutputMemberSpace.md +13 -0
- package/docs/api/types/OutputScope.md +33 -0
- package/docs/api/types/OutputScopeOptions.md +9 -0
- package/docs/api/types/OutputSpace.md +7 -0
- package/docs/api/types/OutputSymbol.md +78 -0
- package/docs/api/types/OutputSymbolOptions.md +16 -0
- package/docs/api/types/OutputVisitor.md +10 -0
- package/docs/api/types/PrintHook.md +10 -0
- package/docs/api/types/PrintTreeOptions.md +11 -0
- package/docs/api/types/Props.md +5 -0
- package/docs/api/types/ReactiveUnionSet.md +20 -0
- package/docs/api/types/ReactiveUnionSetOptions.md +8 -0
- package/docs/api/types/Refkey.md +5 -0
- package/docs/api/types/Refkeyable.md +5 -0
- package/docs/api/types/RefkeyableObject.md +7 -0
- package/docs/api/types/RenderableObject.md +9 -0
- package/docs/api/types/RenderedTextTree.md +5 -0
- package/docs/api/types/ResolutionResult.md +39 -0
- package/docs/api/types/ResolveDeclarationByKeyOptions.md +7 -0
- package/docs/api/types/Resource.md +11 -0
- package/docs/api/types/RootOptions.md +7 -0
- package/docs/api/types/SbrIntrinsicElement.md +5 -0
- package/docs/api/types/ScopeProps.md +5 -0
- package/docs/api/types/SoftlineIntrinsicElement.md +5 -0
- package/docs/api/types/SourceLocation.md +9 -0
- package/docs/api/types/SplitProps.md +12 -0
- package/docs/api/types/StcComponentCreator.md +9 -0
- package/docs/api/types/StcSignature.md +5 -0
- package/docs/api/types/StiComponentCreator.md +9 -0
- package/docs/api/types/StiSignature.md +7 -0
- package/docs/api/types/SymbolCreator.md +15 -0
- package/docs/api/types/SymbolRefkey.md +9 -0
- package/docs/api/types/SymbolSlot.md +12 -0
- package/docs/api/types/SymbolTable.md +15 -0
- package/docs/api/types/TakeSymbolCallback.md +7 -0
- package/docs/api/types/TakeSymbolsCallback.md +7 -0
- package/docs/api/types/Tap.md +11 -0
- package/docs/api/types/TapHandler.md +9 -0
- package/docs/api/types/Tapper.md +9 -0
- package/docs/api/types/TemplateVariableProps.md +5 -0
- package/docs/api/types/index.md +122 -0
- package/docs/api/variables/FormatOptions.md +5 -0
- package/docs/api/variables/Match.md +7 -0
- package/docs/api/variables/REFKEYABLE.md +5 -0
- package/docs/api/variables/RENDERABLE.md +5 -0
- package/docs/api/variables/TO_SYMBOL.md +39 -0
- package/docs/api/variables/contextsByKey.md +5 -0
- package/docs/api/variables/index.md +11 -0
- package/docs/api/variables/intrinsicElementKey.md +5 -0
- package/docs/api/variables/matchTag.md +5 -0
- package/docs/api/variables/printHookTag.md +7 -0
- package/docs/components.md +97 -0
- package/docs/context.md +67 -0
- package/docs/control-flow.md +5 -0
- package/docs/debugging.md +105 -0
- package/docs/formatting.md +99 -0
- package/docs/guides/language-package-guide.md +593 -0
- package/docs/guides/references-and-refkeys.md +210 -0
- package/docs/guides/style-guide.md +244 -0
- package/docs/index.md +22 -0
- package/docs/reactivity.md +68 -0
- package/docs/rendering.md +41 -0
- package/docs/symbols-and-scopes.md +180 -0
- package/package.json +16 -6
- package/src/binder.ts +154 -41
- package/src/components/AccessExpression.test.tsx +132 -0
- package/src/components/AccessExpression.tsx +344 -0
- package/src/components/Block.tsx +12 -0
- package/src/components/For.tsx +14 -10
- package/src/components/List.tsx +18 -5
- package/src/components/MemberDeclaration.tsx +6 -6
- package/src/components/MemberName.tsx +6 -0
- package/src/components/MemberScope.tsx +5 -0
- package/src/components/Output.tsx +4 -1
- package/src/components/Prose.tsx +1 -1
- package/src/components/Scope.tsx +8 -0
- package/src/components/SourceDirectory.tsx +1 -2
- package/src/components/SourceFile.tsx +22 -2
- package/src/components/Switch.tsx +11 -7
- package/src/components/index.tsx +1 -0
- package/src/content-slot.tsx +2 -2
- package/src/context/binder.ts +4 -0
- package/src/context/format-options.ts +14 -1
- package/src/context/scope.ts +4 -0
- package/src/context/source-directory.ts +9 -0
- package/src/context.ts +3 -3
- package/src/debug/cli.ts +3 -2
- package/src/debug/diagnostics-broadcast.test.tsx +98 -0
- package/src/debug/diagnostics.test.tsx +3 -2
- package/src/debug/effects.test.tsx +241 -36
- package/src/debug/effects.ts +202 -64
- package/src/debug/files.test.tsx +15 -35
- package/src/debug/files.ts +11 -11
- package/src/debug/index.ts +6 -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 +96 -118
- package/src/debug/render.ts +196 -125
- package/src/debug/source-map.browser.ts +30 -0
- package/src/debug/source-map.ts +135 -0
- package/src/debug/symbols.test.tsx +19 -20
- package/src/debug/symbols.ts +107 -15
- package/src/debug/trace-writer.ts +984 -0
- package/src/debug/trace.ts +46 -32
- package/src/devtools/devtools-protocol.ts +361 -176
- package/src/devtools/devtools-server.browser.ts +4 -9
- package/src/devtools/devtools-server.ts +226 -33
- package/src/devtools/devtools-transport.ts +4 -4
- package/src/devtools-entry.browser.ts +11 -15
- package/src/devtools-entry.ts +9 -15
- package/src/diagnostics.ts +44 -22
- package/src/host/node-host.browser.ts +23 -0
- package/src/host/node-host.ts +22 -0
- package/src/index.ts +0 -1
- package/src/library-symbol-reference.ts +52 -0
- package/src/name-policy.ts +30 -3
- package/src/reactive-union-set.ts +14 -3
- package/src/reactivity.ts +354 -171
- package/src/render-stack.ts +9 -3
- package/src/render.ts +116 -38
- package/src/scheduler.ts +167 -24
- package/src/symbols/output-scope.ts +34 -3
- package/src/symbols/output-space.ts +13 -0
- package/src/symbols/output-symbol.ts +186 -24
- package/src/symbols/symbol-flow.ts +8 -2
- package/src/symbols/symbol-slot.test.tsx +28 -1
- package/src/symbols/symbol-slot.tsx +8 -0
- package/src/symbols/symbol-table.ts +13 -3
- package/src/utils.tsx +9 -8
- package/src/write-output.ts +6 -5
- package/temp/api-testing.json +673 -0
- package/temp/api.json +1333 -100
- package/test/browser-build.test.ts +71 -78
- 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 +60 -0
- package/test/scheduler-extended.test.tsx +122 -0
- package/test/scheduler.test.tsx +50 -0
- package/test/symbols/deconflicted-name.test.ts +120 -0
- package/test/symbols/output-scope.test.ts +38 -0
- package/testing/create-test-wrapper.tsx +81 -2
- package/testing/devtools-utils.ts +46 -4
- package/testing/extend-expect.ts +22 -1
- package/testing/index.ts +1 -1
- package/testing/render.ts +9 -0
- package/testing/vitest.d.ts +18 -3
- package/vitest.config.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog - @alloy-js/core
|
|
2
2
|
|
|
3
|
+
## 0.23.0
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- [#356](https://github.com/alloy-framework/alloy/pull/356) onCleanup callbacks are now untracked, which fixes cases where cleaning up some reactive context would trigger it to run again.
|
|
8
|
+
- [#395](https://github.com/alloy-framework/alloy/pull/395) Fix O(N²) overhead in `DiagnosticsCollector`. `emit()` and `dismiss()` previously re-broadcast the entire diagnostic history on every call, which dominated render time on large workloads even when debug tracing was disabled (the default). Broadcasts are now skipped when tracing is off, and the trace writer sees per-diagnostic add/remove deltas instead of duplicated inserts.
|
|
9
|
+
- [#376](https://github.com/alloy-framework/alloy/pull/376) Ensure node specific api have browser override
|
|
10
|
+
- [#379](https://github.com/alloy-framework/alloy/pull/379) Fix SymbolSlot in FunctionBase being rendered twice when a parameter has both type and default, which caused the type symbol to be overwritten and member resolution to fail. Also add an error diagnostic when a SymbolSlot is rendered more than once.
|
|
11
|
+
- [#361](https://github.com/alloy-framework/alloy/pull/361) Reduce allocation overhead: lazy Context fields (disposables, context, elementCache, isEmpty), `_lastEmpty` boolean for cheap empty-state propagation, `ensureIsEmpty()` gating, scheduler `isJobActive` check to skip stopped effects, `ReactiveUnionSet` per-item root-scope disposers, and hoisted `defaultScheduler` closure.
|
|
12
|
+
- [#396](https://github.com/alloy-framework/alloy/pull/396) Fix TypeScript import handling:
|
|
13
|
+
|
|
14
|
+
- Long `import { ... } from "..."` statements now break across multiple lines when they exceed `printWidth`, using the layout engine.
|
|
15
|
+
- Import statements generated via `ref()` into a TypeScript `<SourceFile>` are now reference-counted and torn down (symbol deleted, statement removed) when the last live reference is disposed — e.g. when a `<Show>` that referenced an external refkey toggles off. Previously the import would linger and subsequent re-renders could drift conflicting local names to `foo_3`, `foo_4`, etc.
|
|
16
|
+
- `createValueSymbol` / `createTypeSymbol` / `createTypeAndValueSymbol` now automatically delete their symbol when the component that created it unmounts. This fixes a long-standing leak where symbols declared via `<VarDeclaration>`, `<FunctionDeclaration>`, etc. survived `<Show>` unmounts.
|
|
17
|
+
|
|
18
|
+
Improve name-conflict resolution:
|
|
19
|
+
|
|
20
|
+
- `OutputSymbol` now exposes a `deconflictedName` slot separate from the user-assigned name. Name-conflict resolvers write the collision rename into this slot (the public `.name` getter returns `deconflictedName ?? userAssignedName ?? originalName`), and clear it once a collision is resolved so survivors revert to their plain name. This replaces a fragile regex-based "is this an auto-generated alias?" check that hard-coded the default resolver's `foo_N` rename scheme. Custom resolvers with any rename scheme (including Python's `foo_N_module` form) now revert correctly when one of the conflicting symbols is removed.
|
|
21
|
+
- `tsNameConflictResolver` and `pythonNameConflictResolver` have been migrated to write through `deconflictedName`.
|
|
22
|
+
- `SymbolTable` now groups conflicts by each symbol's _canonical_ name — the result of applying the symbol's name policy to its `originalName`. This means two symbols whose original names normalize to the same policy-applied name (e.g. `foo_bar` and `fooBar` under camelCase) are correctly detected as conflicting.
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
- [#362](https://github.com/alloy-framework/alloy/pull/362) Add `createAccessExpression` factory for building language-specific member/access expression components with shared call chain formatting, symbol resolution, and reactive optimization.
|
|
27
|
+
- [#356](https://github.com/alloy-framework/alloy/pull/356) Add a new diagnostics reporting interface. Diagnostics will log that an error occurred but will not stop emission. Various things that used to cause errors will now log diagnostics instead, including missing regions in AppendFile and TemplateFile. Unresolved refkeys will also produce a diagnostic.
|
|
28
|
+
- [#356](https://github.com/alloy-framework/alloy/pull/356) Add new `createScope` and `createSymbol` APIs which construct subclasses of `OutputScope` and `OutputSymbol`, respectively. These are necessary to register the created scopes and symbols with the new debugger interface.
|
|
29
|
+
- [#356](https://github.com/alloy-framework/alloy/pull/356) Added a browser-based debugger which is started when the ALLOY_DEBUG environment variable is set. The debugger shows emitted files, scopes, symbols, render nodes, effects, diagnostics, and more.
|
|
30
|
+
- [#356](https://github.com/alloy-framework/alloy/pull/356) Added options to `effect` to allow passing debug information that helps identify that effect.
|
|
31
|
+
- [#356](https://github.com/alloy-framework/alloy/pull/356) Tracing will now capture both "trigger" and "triggered-by" events (previously we only traced triggered-by (and called it trigger).
|
|
32
|
+
- [#350](https://github.com/alloy-framework/alloy/pull/350) Print richer stack traces when rendering fails.
|
|
33
|
+
- [#368](https://github.com/alloy-framework/alloy/pull/368) Ship dev sources in package for debugging. Use node's --condition="development" flag to use this build.
|
|
34
|
+
- [#366](https://github.com/alloy-framework/alloy/pull/366) Add SQLite-based trace storage for debug and devtools infrastructure, enabling structured recording of render trees, effects, reactive edges, scopes, symbols, and diagnostics during development builds.
|
|
35
|
+
|
|
36
|
+
|
|
3
37
|
## 0.22.0
|
|
4
38
|
|
|
5
39
|
### Bug Fixes
|
package/api-extractor.json
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../api-extractor.base.json"
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
"ae-wrong-input-file-type": {
|
|
7
|
-
"logLevel": "none"
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
3
|
+
"extends": "../../api-extractor.base.json"
|
|
11
4
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../api-extractor.base.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/testing/index.d.ts",
|
|
5
|
+
"docModel": {
|
|
6
|
+
"enabled": true,
|
|
7
|
+
"apiJsonFilePath": "<projectFolder>/temp/api-testing.json"
|
|
8
|
+
},
|
|
9
|
+
"messages": {
|
|
10
|
+
"extractorMessageReporting": {
|
|
11
|
+
"ae-wrong-input-file-type": {
|
|
12
|
+
"logLevel": "none"
|
|
13
|
+
},
|
|
14
|
+
"ae-forgotten-export": {
|
|
15
|
+
"logLevel": "none"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import { computed, shallowRef } from "@vue/reactivity";
|
|
2
|
+
import { useBinder } from "./context/binder.js";
|
|
3
|
+
import { useMemberContext } from "./context/member-scope.js";
|
|
4
|
+
import { useScope } from "./context/scope.js";
|
|
5
|
+
import { debug, TracePhase } from "./debug/index.js";
|
|
6
|
+
import { emitDiagnostic } from "./diagnostics.js";
|
|
7
|
+
import { effect, onCleanup } from "./reactivity.js";
|
|
8
|
+
import { inspectRefkey, isMemberRefkey, refkey, toRefkey } from "./refkey.js";
|
|
9
|
+
import { formatRefkeys, formatSymbolName } from "./tracer.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The binder tracks all output scopes and symbols. Scopes are nested containers
|
|
13
|
+
* for symbols.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
*
|
|
17
|
+
* Symbol information is reactive because in certain situations this data may
|
|
18
|
+
* change. For example, when a symbol becomes conflicted with another symbol,
|
|
19
|
+
* one of the symbol names may change. Ensure that you interact with binder
|
|
20
|
+
* values in a reactive context (i.e. within JSX/code template, or within
|
|
21
|
+
* memo/computed/etc).
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A successful resolution of a refkey.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
*
|
|
30
|
+
* Let's say we have the following scopes and symbols:
|
|
31
|
+
*
|
|
32
|
+
* ```
|
|
33
|
+
* scope: global scope
|
|
34
|
+
* ├── scope: namespace scope 1
|
|
35
|
+
* │ └── symbol: foo
|
|
36
|
+
* │ └── static members
|
|
37
|
+
* │ └── symbol: bar
|
|
38
|
+
* └── scope: namespace scope 2
|
|
39
|
+
* └── (resolve bar from here)
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* When we resolve the refkey for `bar` from within `namespace scope 2`, we will get the following
|
|
43
|
+
* resolution result:
|
|
44
|
+
*
|
|
45
|
+
* * **targetDeclaration**: symbol bar, the symbol we resolved.
|
|
46
|
+
* * **commonScope**: global scope, because this is the most specific scope that contains both the declaration and the reference.
|
|
47
|
+
* * **pathUp**: [namespace scope 2], because this is the scope between the reference and the common scope.
|
|
48
|
+
* * **pathDown**: [namespace scope 1], because this is the scope between the common scope and the declaration
|
|
49
|
+
* * **memberPath**: [bar]
|
|
50
|
+
* * **lexicalDeclaration**: foo
|
|
51
|
+
* For deeper chains (e.g., foo.bar.baz where bar and baz are member symbols, foo is not): memberPath = [bar, baz], lexicalDeclaration = foo.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Describes a member in a member access chain, tracking both the symbol
|
|
56
|
+
* and whether this specific member was accessed via a memberRefkey.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A callable interface invoked by the binder when two or more symbols in the
|
|
61
|
+
* same scope share a name. The resolver mutates symbol names to eliminate
|
|
62
|
+
* conflicts (e.g., appending `_2`, `_3`).
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* The resolver is called with the shared `name` and all symbols in the scope
|
|
66
|
+
* that have that original name. Rename a symbol by assigning to `symbol.name`.
|
|
67
|
+
* Symbols with `ignoreNameConflict: true` are excluded. The default resolver
|
|
68
|
+
* keeps the first symbol unchanged and renames subsequent ones
|
|
69
|
+
* `originalName + "_2"`, `originalName + "_3"`, etc.
|
|
70
|
+
*
|
|
71
|
+
* Assigned names pass through the active name policy before being stored;
|
|
72
|
+
* design suffixes to produce the correct final name after policy
|
|
73
|
+
* transformation, or set `ignoreNamePolicy` on the symbol after resolution.
|
|
74
|
+
*
|
|
75
|
+
* Conflict detection is keyed on `originalName`
|
|
76
|
+
* (see {@link OutputSymbol.originalName}). Symbols that differ in original
|
|
77
|
+
* name but normalize to the same policy-applied name are never detected as
|
|
78
|
+
* conflicting.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const resolver: NameConflictResolver = (name, symbols) => {
|
|
83
|
+
* for (let i = 1; i < symbols.length; i++) {
|
|
84
|
+
* symbols[i].name = symbols[i].originalName + "_" + (i + 1);
|
|
85
|
+
* }
|
|
86
|
+
* };
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The context for a member resolution. This is used to properly resolve a
|
|
92
|
+
* member in the MemberResolver.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* A callback that performs access-control filtering during member resolution.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
*
|
|
100
|
+
* When provided to {@link ResolveDeclarationByKeyOptions}, it entirely replaces
|
|
101
|
+
* the default checks (ownership assertion and `isMemberSymbol` assertion).
|
|
102
|
+
*
|
|
103
|
+
* **Contract:**
|
|
104
|
+
* - **Return `void`** to accept the member.
|
|
105
|
+
* - **Throw an error** to reject the member — the error propagates to the caller,
|
|
106
|
+
* matching the behavior of the default checks.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const resolver: MemberResolver<MyScope, MySymbol> = (owner, member, ctx) => {
|
|
111
|
+
* if (member.isPrivate && !ctx.isMemberAccess) {
|
|
112
|
+
* throw new Error(`${member.name} is not accessible here`);
|
|
113
|
+
* }
|
|
114
|
+
* };
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @see {@link MemberResolutionContext} for available context properties.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Construct a scope instance and register it with devtools. Prefer this over
|
|
122
|
+
* calling `new` directly so that debugging tools can track the scope.
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
*
|
|
126
|
+
* Inside a component, obtain the current scope with `useScope()` and pass it
|
|
127
|
+
* as the `parentScope` constructor argument so the new scope is wired into
|
|
128
|
+
* the scope tree.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```tsx
|
|
132
|
+
* function MyScope(props) {
|
|
133
|
+
* const parentScope = useScope();
|
|
134
|
+
* const scope = createScope(MyScope, "scope-name", parentScope);
|
|
135
|
+
* return <Scope value={scope}>{props.children}</Scope>;
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @param ctor - The scope subclass constructor.
|
|
140
|
+
* @param args - Positional arguments forwarded directly to the scope
|
|
141
|
+
* constructor; see {@link OutputScope} for the base-class constructor
|
|
142
|
+
* signature.
|
|
143
|
+
*/
|
|
144
|
+
export function createScope(ctor, ...args) {
|
|
145
|
+
const scope = new ctor(...args);
|
|
146
|
+
debug.symbols.registerScope(scope);
|
|
147
|
+
return scope;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Construct a symbol instance and register it with devtools. Prefer this over
|
|
152
|
+
* calling `new` directly so that debugging tools can track the symbol.
|
|
153
|
+
*
|
|
154
|
+
* @remarks
|
|
155
|
+
*
|
|
156
|
+
* Binder registration (via `useBinder()` + `notifySymbolCreated()`) happens
|
|
157
|
+
* inside the `OutputSymbol` constructor regardless of whether you use
|
|
158
|
+
* `createSymbol` or `new`. This helper only adds devtools registration.
|
|
159
|
+
*
|
|
160
|
+
* @param ctor - The symbol subclass constructor.
|
|
161
|
+
* @param args - Arguments forwarded to the constructor.
|
|
162
|
+
*/
|
|
163
|
+
export function createSymbol(ctor, ...args) {
|
|
164
|
+
const symbol = new ctor(...args);
|
|
165
|
+
debug.symbols.registerSymbol(symbol);
|
|
166
|
+
return symbol;
|
|
167
|
+
}
|
|
168
|
+
export function createOutputBinder(options = {}) {
|
|
169
|
+
const binder = {
|
|
170
|
+
resolveDeclarationByKey,
|
|
171
|
+
getSymbolForRefkey,
|
|
172
|
+
notifyScopeCreated,
|
|
173
|
+
notifySymbolCreated,
|
|
174
|
+
notifySymbolDeleted,
|
|
175
|
+
nameConflictResolver: options.nameConflictResolver
|
|
176
|
+
};
|
|
177
|
+
const knownDeclarations = new Map();
|
|
178
|
+
const waitingDeclarations = new Map();
|
|
179
|
+
const waitingSymbolNames = new Map();
|
|
180
|
+
const waitingScopeNames = new Map();
|
|
181
|
+
return binder;
|
|
182
|
+
function notifyScopeCreated(scope) {
|
|
183
|
+
if (!scope.parent || !waitingScopeNames.has(scope.parent)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const waiting = waitingScopeNames.get(scope.parent);
|
|
187
|
+
if (waiting?.has(scope.name)) {
|
|
188
|
+
const ref = waiting.get(scope.name);
|
|
189
|
+
ref.value = scope;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function notifySymbolDeleted(symbol) {
|
|
193
|
+
debug.symbols.unregisterSymbol(symbol);
|
|
194
|
+
if (!refkey) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
for (const refkey of symbol.refkeys) {
|
|
198
|
+
const resolution = waitingDeclarations.get(refkey);
|
|
199
|
+
if (!resolution) return;
|
|
200
|
+
resolution.value = undefined;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function buildResult(currentScope, targetDeclarationBase) {
|
|
204
|
+
const {
|
|
205
|
+
memberPath: targetMemberPath,
|
|
206
|
+
scopeChain: targetChain
|
|
207
|
+
} = scopeAndMemberChain(targetDeclarationBase);
|
|
208
|
+
let targetLexicalDeclaration = targetMemberPath && targetMemberPath.length > 0 ? targetMemberPath[0].ownerSymbol : targetDeclarationBase;
|
|
209
|
+
// when we are resolving from a scope which is a member scope and might have
|
|
210
|
+
// member scope parents, and any symbols in the member path are members of
|
|
211
|
+
// the member scope's owner symbol (i.e., those symbols are in scope where
|
|
212
|
+
// the reference is made), we replace the target member path with an entry
|
|
213
|
+
// on the scope chain.
|
|
214
|
+
|
|
215
|
+
// So, first we find all the owner symbols for any member scopes in scope
|
|
216
|
+
// for the reference.
|
|
217
|
+
const referenceChain = scopeChain(currentScope);
|
|
218
|
+
const inScopeSymbols = new Map();
|
|
219
|
+
for (const scope of referenceChain) {
|
|
220
|
+
if (scope.isMemberScope) {
|
|
221
|
+
inScopeSymbols.set(scope.ownerSymbol, scope);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// then if the lexical declaration symbol's members are in scope, remove the
|
|
226
|
+
// symbol from the member path and add its corresponding member scope to the
|
|
227
|
+
// target chain.
|
|
228
|
+
while (targetMemberPath.length > 0 && inScopeSymbols.has(targetLexicalDeclaration)) {
|
|
229
|
+
targetChain.push(inScopeSymbols.get(targetLexicalDeclaration));
|
|
230
|
+
targetLexicalDeclaration = targetMemberPath.shift();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Now we replace any scopes in the target chain with corresponding scopes
|
|
234
|
+
// from the reference chain.
|
|
235
|
+
for (const [index, scope] of targetChain.entries()) {
|
|
236
|
+
if (inScopeSymbols.has(scope.ownerSymbol)) {
|
|
237
|
+
targetChain[index] = inScopeSymbols.get(scope.ownerSymbol);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Next we look for member scopes in the target chain that correspond to
|
|
242
|
+
// member scopes in the reference chain. We splice the reference chain into
|
|
243
|
+
// the target chain at that point. This ensures that we establish the proper
|
|
244
|
+
// common scope and path up/down even if the reference chain has additional
|
|
245
|
+
// scopes above it (e.g. a scope for the current source file).
|
|
246
|
+
const commonMemberContainer = targetChain.findIndex(scope => scope.isMemberScope && inScopeSymbols.has(scope.ownerSymbol));
|
|
247
|
+
if (commonMemberContainer > -1) {
|
|
248
|
+
const sourceLocation = referenceChain.findIndex(scope => scope.isMemberScope && scope.ownerSymbol === targetChain[commonMemberContainer].ownerSymbol);
|
|
249
|
+
|
|
250
|
+
// source location is guaranteed to exist at this point.
|
|
251
|
+
targetChain.splice(0, commonMemberContainer + 1, ...referenceChain.slice(0, sourceLocation + 1));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Now that we have the target chain and scopes, we can determine the common
|
|
255
|
+
// scopes and paths.
|
|
256
|
+
let diffStart = 0;
|
|
257
|
+
while (targetChain[diffStart] && referenceChain[diffStart] && targetChain[diffStart] === referenceChain[diffStart]) {
|
|
258
|
+
diffStart++;
|
|
259
|
+
}
|
|
260
|
+
const pathUp = referenceChain.slice(diffStart);
|
|
261
|
+
const pathDown = targetChain.slice(diffStart);
|
|
262
|
+
const commonScope = targetChain[diffStart - 1] ?? undefined;
|
|
263
|
+
return {
|
|
264
|
+
pathUp,
|
|
265
|
+
pathDown,
|
|
266
|
+
memberPath: targetMemberPath,
|
|
267
|
+
commonScope,
|
|
268
|
+
symbol: targetDeclarationBase,
|
|
269
|
+
lexicalDeclaration: targetLexicalDeclaration,
|
|
270
|
+
fullSymbolPath: targetChain,
|
|
271
|
+
fullReferencePath: referenceChain
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Walk from the provided symbol up to the non-member symbol. This constitutes
|
|
277
|
+
* the member path. Then, walk from the first non-member symbol's scope up to
|
|
278
|
+
* the global scope. This constitutes the scope chain.
|
|
279
|
+
*/
|
|
280
|
+
function scopeAndMemberChain(symbol) {
|
|
281
|
+
const result = {
|
|
282
|
+
memberPath: [],
|
|
283
|
+
scopeChain: []
|
|
284
|
+
};
|
|
285
|
+
let currentSymbol = symbol;
|
|
286
|
+
if (currentSymbol.isMemberSymbol) {
|
|
287
|
+
result.memberPath = [];
|
|
288
|
+
while (currentSymbol.isMemberSymbol) {
|
|
289
|
+
result.memberPath.unshift(currentSymbol);
|
|
290
|
+
currentSymbol = currentSymbol.ownerSymbol;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const startScope = currentSymbol.scope;
|
|
294
|
+
result.scopeChain = scopeChain(startScope);
|
|
295
|
+
return result;
|
|
296
|
+
}
|
|
297
|
+
function scopeChain(scope) {
|
|
298
|
+
const chain = [];
|
|
299
|
+
while (scope) {
|
|
300
|
+
chain.unshift(scope);
|
|
301
|
+
scope = scope.parent;
|
|
302
|
+
}
|
|
303
|
+
return chain;
|
|
304
|
+
}
|
|
305
|
+
function getSymbolForRefkey(refkeyable) {
|
|
306
|
+
const refkey = toRefkey(refkeyable);
|
|
307
|
+
if (waitingDeclarations.has(refkey)) {
|
|
308
|
+
return waitingDeclarations.get(refkey);
|
|
309
|
+
}
|
|
310
|
+
let symbolRef;
|
|
311
|
+
if (isMemberRefkey(refkey)) {
|
|
312
|
+
const baseSymbolRef = getSymbolForRefkey(refkey.base);
|
|
313
|
+
const memberSymbolRef = getMemberSymbolFromMemberRefkey(refkey);
|
|
314
|
+
symbolRef = computed(() => {
|
|
315
|
+
// even though we don't necessarily need the base symbol to be available
|
|
316
|
+
// yet (the member symbol might already be declared on a type), we wait
|
|
317
|
+
// to resolve the member refkey until the base symbol is available.
|
|
318
|
+
const baseSymbol = baseSymbolRef.value;
|
|
319
|
+
const memberSymbol = memberSymbolRef.value;
|
|
320
|
+
if (!baseSymbol || !memberSymbol) {
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
return memberSymbol;
|
|
324
|
+
});
|
|
325
|
+
} else {
|
|
326
|
+
symbolRef = shallowRef();
|
|
327
|
+
}
|
|
328
|
+
waitingDeclarations.set(refkey, symbolRef);
|
|
329
|
+
if (knownDeclarations.has(refkey)) {
|
|
330
|
+
symbolRef.value = knownDeclarations.get(refkey);
|
|
331
|
+
}
|
|
332
|
+
return symbolRef;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* There are two ways to reference a member symbol - directly via its refkey,
|
|
337
|
+
* and via a member refkey. In the former case, we just find the member
|
|
338
|
+
* symbol, and then compute its path directly from there. In hte latter case,
|
|
339
|
+
* we need to find the base of the member expression, and then add the members
|
|
340
|
+
* from the (possibly nested) member refkey to result.
|
|
341
|
+
*/
|
|
342
|
+
function resolveDeclarationByKey(currentScope, refkey, options = {}) {
|
|
343
|
+
const resolvedSymbol = getSymbolForRefkey(refkey);
|
|
344
|
+
return computed(() => {
|
|
345
|
+
debug.trace(TracePhase.resolve.pending, () => `Resolving ${formatRefkeys(refkey)}.`);
|
|
346
|
+
const symbol = resolvedSymbol.value;
|
|
347
|
+
if (!symbol) {
|
|
348
|
+
debug.trace(TracePhase.resolve.failure, () => `No symbol for ${formatRefkeys(refkey)}.`);
|
|
349
|
+
return undefined;
|
|
350
|
+
}
|
|
351
|
+
debug.trace(TracePhase.resolve.pending, () => `${formatRefkeys(refkey)} resolved to ${formatSymbolName(symbol)}.`);
|
|
352
|
+
if (symbol.isTransient) {
|
|
353
|
+
debug.trace(TracePhase.resolve.failure, () => `Symbol ${formatSymbolName(symbol)} is transient.`);
|
|
354
|
+
return undefined;
|
|
355
|
+
}
|
|
356
|
+
const chain = scopeChain(symbol.scope);
|
|
357
|
+
if (chain.some(scope => scope.isTransient)) {
|
|
358
|
+
debug.trace(TracePhase.resolve.failure, () => `Symbol ${formatSymbolName(symbol)} is in a transient scope.`);
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
let result;
|
|
362
|
+
let memberDescriptorsFromRefkey;
|
|
363
|
+
if (isMemberRefkey(refkey)) {
|
|
364
|
+
memberDescriptorsFromRefkey = getMemberPathFromRefkey(refkey);
|
|
365
|
+
result = buildResult(currentScope, memberDescriptorsFromRefkey[0].symbol);
|
|
366
|
+
} else {
|
|
367
|
+
memberDescriptorsFromRefkey = [];
|
|
368
|
+
result = buildResult(currentScope, symbol);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// When we have member descriptors, this first entry is already part of the result due to passing it
|
|
372
|
+
// to buildResult above, so we don't need it here.
|
|
373
|
+
const newMemberPathDescriptors = memberDescriptorsFromRefkey.slice(1);
|
|
374
|
+
const allDescriptors = [...result.memberPath.map(s => ({
|
|
375
|
+
symbol: s,
|
|
376
|
+
isMemberAccess: false
|
|
377
|
+
})), ...newMemberPathDescriptors];
|
|
378
|
+
|
|
379
|
+
// update the member path and resolved symbol from our member descriptors
|
|
380
|
+
// (if we have them)
|
|
381
|
+
if (memberDescriptorsFromRefkey.length > 0) {
|
|
382
|
+
for (const descriptor of newMemberPathDescriptors) {
|
|
383
|
+
result.memberPath.push(descriptor.symbol);
|
|
384
|
+
}
|
|
385
|
+
result.symbol = memberDescriptorsFromRefkey.at(-1).symbol;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// a subcomputed here ensures we don't lose the progress above When
|
|
389
|
+
// we fail to resolve because a type isn't available yet.
|
|
390
|
+
return computed(() => {
|
|
391
|
+
// resolve each member in the member path
|
|
392
|
+
let currentBase = result.lexicalDeclaration;
|
|
393
|
+
for (const descriptor of allDescriptors) {
|
|
394
|
+
const member = descriptor.symbol;
|
|
395
|
+
if (currentBase.isTyped && !currentBase.hasTypeSymbol) {
|
|
396
|
+
debug.trace(TracePhase.resolve.pending, () => `${formatRefkeys(refkey)} needs type information from a parent type.`);
|
|
397
|
+
// waiting for type
|
|
398
|
+
return undefined;
|
|
399
|
+
}
|
|
400
|
+
resolveMember(currentBase, member, options.memberResolver, {
|
|
401
|
+
referencePath: result.fullReferencePath,
|
|
402
|
+
isMemberAccess: descriptor.isMemberAccess
|
|
403
|
+
});
|
|
404
|
+
currentBase = member;
|
|
405
|
+
}
|
|
406
|
+
debug.trace(TracePhase.resolve.success, () => `${formatRefkeys(refkey)} successfully resolved to ${formatSymbolName(symbol)}.`);
|
|
407
|
+
return result;
|
|
408
|
+
}).value;
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Extracts member descriptors from a refkey, tracking which members
|
|
414
|
+
* were accessed via memberRefkey for proper member resolution context.
|
|
415
|
+
*/
|
|
416
|
+
function getMemberPathFromRefkey(refkey) {
|
|
417
|
+
if (isMemberRefkey(refkey)) {
|
|
418
|
+
return [...getMemberPathFromRefkey(refkey.base), {
|
|
419
|
+
symbol: getMemberSymbolFromMemberRefkey(refkey).value,
|
|
420
|
+
isMemberAccess: true
|
|
421
|
+
}];
|
|
422
|
+
}
|
|
423
|
+
return [{
|
|
424
|
+
symbol: getSymbolForRefkey(refkey).value,
|
|
425
|
+
isMemberAccess: false
|
|
426
|
+
}];
|
|
427
|
+
}
|
|
428
|
+
function getMemberSymbolFromMemberRefkey(refkey) {
|
|
429
|
+
if (typeof refkey.member === "string") {
|
|
430
|
+
return computed(() => {
|
|
431
|
+
const baseSymbol = getSymbolForRefkey(refkey.base).value;
|
|
432
|
+
if (!baseSymbol) {
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
return baseSymbol.resolveMemberByName(refkey.member);
|
|
436
|
+
});
|
|
437
|
+
} else {
|
|
438
|
+
return getSymbolForRefkey(refkey.member);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function resolveMember(base, member, memberResolver, context) {
|
|
442
|
+
if (memberResolver) {
|
|
443
|
+
memberResolver(base, member, context);
|
|
444
|
+
} else {
|
|
445
|
+
// default member resolution
|
|
446
|
+
if (!member.isMemberSymbol) {
|
|
447
|
+
throw new Error(`${formatSymbolName(member)} is not a member symbol.`);
|
|
448
|
+
}
|
|
449
|
+
const memberOwner = base.hasTypeSymbol ? base.type : base.dealias();
|
|
450
|
+
if (member.ownerSymbol !== memberOwner) {
|
|
451
|
+
throw new Error(`${formatSymbolName(member)} is not a member of ${formatSymbolName(base)}.`);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function notifySymbolCreated(symbol) {
|
|
456
|
+
effect(oldRefkeys => {
|
|
457
|
+
if (symbol.refkeys) {
|
|
458
|
+
debug.trace(TracePhase.resolve.pending, () => `Notifying resolutions for ${formatRefkeys(symbol.refkeys)}.`);
|
|
459
|
+
}
|
|
460
|
+
if (oldRefkeys) {
|
|
461
|
+
for (const refkey of oldRefkeys) {
|
|
462
|
+
if (!symbol.refkeys.includes(refkey)) {
|
|
463
|
+
// remove the old refkey from the known declarations
|
|
464
|
+
knownDeclarations.delete(refkey);
|
|
465
|
+
|
|
466
|
+
// reset any waiting declarations
|
|
467
|
+
if (waitingDeclarations.has(refkey)) {
|
|
468
|
+
const signal = waitingDeclarations.get(refkey);
|
|
469
|
+
signal.value = undefined;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
for (const refkey of symbol.refkeys) {
|
|
475
|
+
// notify those waiting for this refkey
|
|
476
|
+
knownDeclarations.set(refkey, symbol);
|
|
477
|
+
if (waitingDeclarations.has(refkey)) {
|
|
478
|
+
const signal = waitingDeclarations.get(refkey);
|
|
479
|
+
signal.value = symbol;
|
|
480
|
+
}
|
|
481
|
+
const scope = symbol.scope;
|
|
482
|
+
if (!scope) {
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// notify those waiting for this symbol name
|
|
487
|
+
const waitingScope = waitingSymbolNames.get(scope);
|
|
488
|
+
if (waitingScope) {
|
|
489
|
+
const waitingName = waitingScope.get(symbol.name);
|
|
490
|
+
if (waitingName) {
|
|
491
|
+
waitingName.value = symbol;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return [...symbol.refkeys];
|
|
496
|
+
}, undefined, {
|
|
497
|
+
debug: {
|
|
498
|
+
name: "binder:notifySymbolCreated",
|
|
499
|
+
type: "binder"
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Resolve a refkey in the current scope. Returns a Ref for the resolution result.
|
|
507
|
+
* The value of the ref will be undefined if the identifier hasn't been resolved yet.
|
|
508
|
+
*
|
|
509
|
+
* @remarks
|
|
510
|
+
*
|
|
511
|
+
* This API may return a ref for undefined, but that does not mean that the symbol is
|
|
512
|
+
* not found. The symbol you're looking for may not have been declared yet. When the symbol
|
|
513
|
+
* is declared, the ref will be updated with the resolution result.
|
|
514
|
+
*/
|
|
515
|
+
export function resolve(refkey, options = {}) {
|
|
516
|
+
const scope = useScope();
|
|
517
|
+
const memberScope = useMemberContext();
|
|
518
|
+
const binder = scope?.binder ?? memberScope?.ownerSymbol.binder;
|
|
519
|
+
if (!binder) {
|
|
520
|
+
throw new Error("Can't resolve refkey without a binder");
|
|
521
|
+
}
|
|
522
|
+
const result = binder.resolveDeclarationByKey(scope, refkey, options);
|
|
523
|
+
let diagnosticHandle = null;
|
|
524
|
+
effect(() => {
|
|
525
|
+
if (result.value === undefined) {
|
|
526
|
+
// Emit diagnostic for this specific reference site
|
|
527
|
+
if (!diagnosticHandle) {
|
|
528
|
+
diagnosticHandle = emitDiagnostic({
|
|
529
|
+
severity: "warning",
|
|
530
|
+
message: `Unresolved refkey: ${inspectRefkey(refkey)}`
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
} else {
|
|
534
|
+
// Dismiss diagnostic when resolved
|
|
535
|
+
if (diagnosticHandle) {
|
|
536
|
+
diagnosticHandle.dismiss();
|
|
537
|
+
diagnosticHandle = null;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}, undefined, {
|
|
541
|
+
debug: {
|
|
542
|
+
name: `binder:resolve:${inspectRefkey(refkey)}`,
|
|
543
|
+
type: "binder"
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
onCleanup(() => {
|
|
547
|
+
if (diagnosticHandle) {
|
|
548
|
+
diagnosticHandle.dismiss();
|
|
549
|
+
diagnosticHandle = null;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
return result;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Get a ref to the symbol for the given refkey using the current binder. The
|
|
557
|
+
* value of the ref will be undefined when no symbol with that refkey has been
|
|
558
|
+
* created.
|
|
559
|
+
*
|
|
560
|
+
* @remarks
|
|
561
|
+
*
|
|
562
|
+
* This API may return a ref for undefined, but that does not mean that the symbol is
|
|
563
|
+
* not found. The symbol you're looking for may not have been declared yet. When the symbol
|
|
564
|
+
* is declared, the ref will be updated with the symbol.
|
|
565
|
+
*/
|
|
566
|
+
export function symbolForRefkey(refkey) {
|
|
567
|
+
const binder = useBinder();
|
|
568
|
+
if (!binder) {
|
|
569
|
+
throw new Error("Can't resolve refkey without a binder");
|
|
570
|
+
}
|
|
571
|
+
return binder.getSymbolForRefkey(refkey);
|
|
572
|
+
}
|
|
573
|
+
const createSymbolsSymbol = Symbol();
|
|
574
|
+
export function getSymbolCreator(creator) {
|
|
575
|
+
return creator[createSymbolsSymbol];
|
|
576
|
+
}
|
|
577
|
+
export function getSymbolCreatorSymbol() {
|
|
578
|
+
return createSymbolsSymbol;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* An object that can register symbols into a binder. Pass instances to the
|
|
583
|
+
* `externals` prop of `<Output>` to make library symbols resolvable.
|
|
584
|
+
*
|
|
585
|
+
* @remarks
|
|
586
|
+
* `SymbolCreator` is a low-level core mechanism for eager symbol registration.
|
|
587
|
+
* The recommended pattern for language packages is lazy self-registration:
|
|
588
|
+
* implement `[TO_SYMBOL]()` on descriptors to call `useBinder()`, create and
|
|
589
|
+
* cache symbols per binder via a `WeakMap`, and register them into the
|
|
590
|
+
* appropriate scope automatically. This approach does not require `externals`.
|
|
591
|
+
* See the C# package's `createLibrary()` for a reference implementation.
|
|
592
|
+
*
|
|
593
|
+
* See {@link TO_SYMBOL} and {@link REFKEYABLE}.
|
|
594
|
+
*/
|
|
595
|
+
//# sourceMappingURL=binder.js.map
|