@alloy-js/core 0.23.0-dev.9 → 0.24.0-dev.1
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/Scope.d.ts +6 -0
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +6 -0
- package/dist/src/components/Scope.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/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/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 +12 -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 +213 -41
- 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 +4 -2
- package/dist/src/debug/index.d.ts.map +1 -1
- package/dist/src/debug/index.js +4 -2
- 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 +6 -5
- package/dist/src/debug/symbols.d.ts.map +1 -1
- package/dist/src/debug/symbols.js +46 -23
- 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/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/reactivity.d.ts +28 -2
- package/dist/src/reactivity.d.ts.map +1 -1
- package/dist/src/reactivity.js +154 -45
- package/dist/src/reactivity.js.map +1 -1
- package/dist/src/render-stack.d.ts.map +1 -1
- package/dist/src/render-stack.js +4 -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 +84 -30
- package/dist/src/render.js.map +1 -1
- package/dist/src/scheduler.d.ts +5 -0
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +94 -23
- 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 +34 -1
- 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 +158 -18
- package/dist/src/symbols/output-symbol.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 +11 -5
- 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/reactivity/shallow-reactive.test.js +4 -0
- package/dist/test/reactivity/shallow-reactive.test.js.map +1 -1
- 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 +15 -5
- 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/Scope.tsx +6 -0
- package/src/components/SourceFile.tsx +22 -2
- package/src/components/Switch.tsx +11 -7
- package/src/components/index.tsx +1 -0
- 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/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 +248 -36
- package/src/debug/effects.ts +198 -64
- package/src/debug/files.test.tsx +15 -35
- package/src/debug/files.ts +11 -11
- package/src/debug/index.ts +4 -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 +106 -23
- 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/library-symbol-reference.ts +52 -0
- package/src/name-policy.ts +30 -3
- package/src/reactivity.ts +179 -55
- package/src/render-stack.ts +4 -3
- package/src/render.ts +106 -30
- package/src/scheduler.ts +145 -26
- package/src/symbols/output-scope.ts +33 -1
- package/src/symbols/output-space.ts +13 -0
- package/src/symbols/output-symbol.ts +185 -22
- 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 +7 -4
- package/src/write-output.ts +6 -5
- package/temp/api-testing.json +673 -0
- package/temp/api.json +895 -73
- package/test/browser-build.test.ts +71 -78
- package/test/reactivity/shallow-reactive.test.tsx +4 -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
|
@@ -0,0 +1,872 @@
|
|
|
1
|
+
import { isRef } from "@vue/reactivity";
|
|
2
|
+
import { doc } from "prettier";
|
|
3
|
+
import prettier from "prettier/doc.js";
|
|
4
|
+
import { useContext } from "./context.js";
|
|
5
|
+
import { SourceFileContext } from "./context/source-file.js";
|
|
6
|
+
import { debug, getRenderNodeId, isDevtoolsConnected, isDevtoolsEnabled } from "./debug/index.js";
|
|
7
|
+
import { beginTransaction, closeTrace, commitTransaction, notifyDiagnosticsReport } from "./debug/trace-writer.js";
|
|
8
|
+
import { isTraceEnabled } from "./debug/trace.js";
|
|
9
|
+
import { attachDiagnosticsCollector, DiagnosticsCollector, emitDiagnostic, reportDiagnostics } from "./diagnostics.js";
|
|
10
|
+
import { isPrintHook, printHookTag } from "./print-hook.js";
|
|
11
|
+
import { effect, getContext, getElementCache, isCustomContext, onCleanup, ref, root, untrack } from "./reactivity.js";
|
|
12
|
+
import { isRefkeyable, toRefkey } from "./refkey.js";
|
|
13
|
+
import { getRenderStackSnapshot, popStack, printRenderStack, pushStack } from "./render-stack.js";
|
|
14
|
+
import { isComponentCreator, isRenderableObject, RENDERABLE } from "./runtime/component.js";
|
|
15
|
+
import { isIntrinsicElement } from "./runtime/intrinsic.js";
|
|
16
|
+
import { flushJobs, flushJobsAsync, waitForSignal } from "./scheduler.js";
|
|
17
|
+
const notifiedErrors = new WeakSet();
|
|
18
|
+
|
|
19
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
20
|
+
// Deferred file printing: mark files dirty during render, print once at end
|
|
21
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
const dirtyFiles = new Map();
|
|
24
|
+
const lastFlushTimeByFile = new Map();
|
|
25
|
+
const DEVTOOLS_FLUSH_INTERVAL_MS = 1000;
|
|
26
|
+
function flushDirtyFile(path) {
|
|
27
|
+
const entry = dirtyFiles.get(path);
|
|
28
|
+
if (!entry) return;
|
|
29
|
+
dirtyFiles.delete(path);
|
|
30
|
+
const contents = printTree(entry.renderNode, {
|
|
31
|
+
...entry.printOptions,
|
|
32
|
+
insertFinalNewLine: entry.printOptions.insertFinalNewLine ?? true,
|
|
33
|
+
noFlush: true
|
|
34
|
+
});
|
|
35
|
+
debug.files.updated({
|
|
36
|
+
path: entry.path,
|
|
37
|
+
filetype: entry.filetype,
|
|
38
|
+
contents
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function flushDirtyFiles() {
|
|
42
|
+
for (const path of [...dirtyFiles.keys()]) {
|
|
43
|
+
flushDirtyFile(path);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
let lastRenderError = null;
|
|
47
|
+
function normalizeRenderError(error) {
|
|
48
|
+
if (error instanceof Error) {
|
|
49
|
+
return {
|
|
50
|
+
name: error.name || error.constructor?.name || "Error",
|
|
51
|
+
message: error.message || "",
|
|
52
|
+
stack: error.stack
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (error && typeof error === "object") {
|
|
56
|
+
const anyError = error;
|
|
57
|
+
return {
|
|
58
|
+
name: anyError.name || "Error",
|
|
59
|
+
message: anyError.message || String(error),
|
|
60
|
+
stack: anyError.stack
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
name: "Error",
|
|
65
|
+
message: String(error)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function notifyRenderError(error) {
|
|
69
|
+
if (error && typeof error === "object") {
|
|
70
|
+
if (notifiedErrors.has(error)) return;
|
|
71
|
+
notifiedErrors.add(error);
|
|
72
|
+
}
|
|
73
|
+
if (lastRenderError) return;
|
|
74
|
+
const {
|
|
75
|
+
name,
|
|
76
|
+
message,
|
|
77
|
+
stack
|
|
78
|
+
} = normalizeRenderError(error);
|
|
79
|
+
const componentStack = getRenderStackSnapshot().map(entry => {
|
|
80
|
+
const renderNode = entry.context?.meta?.renderNode;
|
|
81
|
+
const renderNodeId = renderNode ? getRenderNodeId(renderNode) : undefined;
|
|
82
|
+
return {
|
|
83
|
+
name: entry.displayName,
|
|
84
|
+
props: entry.props,
|
|
85
|
+
renderNodeId,
|
|
86
|
+
source: entry.source
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Output to console
|
|
91
|
+
printRenderStack(error);
|
|
92
|
+
|
|
93
|
+
// Send to devtools if enabled
|
|
94
|
+
debug.render.error({
|
|
95
|
+
name,
|
|
96
|
+
message,
|
|
97
|
+
stack
|
|
98
|
+
}, componentStack);
|
|
99
|
+
|
|
100
|
+
// Store for diagnostics
|
|
101
|
+
lastRenderError = {
|
|
102
|
+
error: {
|
|
103
|
+
name,
|
|
104
|
+
message,
|
|
105
|
+
stack
|
|
106
|
+
},
|
|
107
|
+
componentStack
|
|
108
|
+
};
|
|
109
|
+
const lastEntry = componentStack.at(-1);
|
|
110
|
+
emitDiagnostic({
|
|
111
|
+
severity: "error",
|
|
112
|
+
message: `${name}: ${message}`,
|
|
113
|
+
source: lastEntry?.source
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function reportLastRenderError() {
|
|
117
|
+
// Error already reported in notifyRenderError via debug.renderError
|
|
118
|
+
lastRenderError = null;
|
|
119
|
+
}
|
|
120
|
+
const {
|
|
121
|
+
builders: {
|
|
122
|
+
align,
|
|
123
|
+
breakParent,
|
|
124
|
+
dedent,
|
|
125
|
+
dedentToRoot,
|
|
126
|
+
fill,
|
|
127
|
+
group,
|
|
128
|
+
hardline,
|
|
129
|
+
indent,
|
|
130
|
+
indentIfBreak,
|
|
131
|
+
line,
|
|
132
|
+
lineSuffix,
|
|
133
|
+
lineSuffixBoundary,
|
|
134
|
+
literalline,
|
|
135
|
+
markAsRoot,
|
|
136
|
+
softline,
|
|
137
|
+
ifBreak
|
|
138
|
+
}
|
|
139
|
+
} = prettier;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Turning components into source text involves three different trees produced
|
|
143
|
+
* sequentially:
|
|
144
|
+
*
|
|
145
|
+
* 1. Component tree, built by the nesting of components
|
|
146
|
+
* 2. Rendered text tree, produced by *rendering* the component tree
|
|
147
|
+
* 3. Document tree, produced by *printing* the rendered text tree
|
|
148
|
+
*
|
|
149
|
+
* Finally, the document tree is converted to text via `prettier`. Let's look at
|
|
150
|
+
* each of these trees and the conversions in detail.
|
|
151
|
+
*
|
|
152
|
+
* # Component tree
|
|
153
|
+
*
|
|
154
|
+
* The component tree is built by JSX or STC templates. The nodes in this tree
|
|
155
|
+
* are defined by the type `Child` and are one of the following
|
|
156
|
+
*
|
|
157
|
+
* ## Primitive values
|
|
158
|
+
*
|
|
159
|
+
* Strings in the tree are placed into the rendered text tree as-is. Numbers are
|
|
160
|
+
* converted to strings. Falsy primitive values and booleans are converted to
|
|
161
|
+
* empty strings (and may cause a line break to be ignored, see below).
|
|
162
|
+
*
|
|
163
|
+
* ## Nullary functions
|
|
164
|
+
*
|
|
165
|
+
* Nullary functions represent computed or reactive values in the component
|
|
166
|
+
* tree, such as expressions placed into a JSX template with curly brackets.
|
|
167
|
+
* Nullary functions return `Children` which are then recursively rendered.
|
|
168
|
+
* Nullary functions are invoked in an effect which will update the rendered
|
|
169
|
+
* text tree when any reactive dependencies change.
|
|
170
|
+
*
|
|
171
|
+
* ## Component creators
|
|
172
|
+
*
|
|
173
|
+
* Component creators are a special kind of nullary function which instantiate
|
|
174
|
+
* components in order to get their children which are then recursively
|
|
175
|
+
* rendered. Component creators have some special rendering behavior, such as
|
|
176
|
+
* tracking the stack of rendered components. Like other nullary functions,
|
|
177
|
+
* component creators are invoked in an effect which will update the rendered
|
|
178
|
+
* text tree when any reactive dependencies change.
|
|
179
|
+
*
|
|
180
|
+
* ## Refs
|
|
181
|
+
*
|
|
182
|
+
* Refs are wrapped in a nullary function and rendered in an effect which will
|
|
183
|
+
* update the rendered text tree when the ref's value changes. This is
|
|
184
|
+
* essentially a syntactic convenience, allowing JSX templates to contain
|
|
185
|
+
* `\{ someRef \}` instead of `\{ someRef.value \}`.
|
|
186
|
+
*
|
|
187
|
+
* ## Refkey
|
|
188
|
+
*
|
|
189
|
+
* Refkeys are replaced with a component creator for the Reference component
|
|
190
|
+
* associated with the current source file. This allows creating references by
|
|
191
|
+
* placing them directly in the component tree e.g. `{ someRefkey }`.
|
|
192
|
+
*
|
|
193
|
+
* ## CustomContext
|
|
194
|
+
*
|
|
195
|
+
* CustomContext is a special kind of component which allows rendering children
|
|
196
|
+
* within a custom reactive context. This enables components to manually manage
|
|
197
|
+
* the lifetime of their reactive contexts.
|
|
198
|
+
*
|
|
199
|
+
* ## IntrinsicElement
|
|
200
|
+
*
|
|
201
|
+
* Various intrinsic elements exist to control formatting. These elements
|
|
202
|
+
* provide Print Hooks that are called during Printing.
|
|
203
|
+
*
|
|
204
|
+
* # Rendered Text Tree
|
|
205
|
+
*
|
|
206
|
+
* This tree is a nested array structure containing the rendered output of all
|
|
207
|
+
* the components in the component tree. This structure is updated reactively
|
|
208
|
+
* when reactive dependencies change. The nodes in this tree are predominantly
|
|
209
|
+
* strings, but can also be Print Hooks.
|
|
210
|
+
*
|
|
211
|
+
* This tree is built by the `renderTree` function.
|
|
212
|
+
*
|
|
213
|
+
* # Document Tree
|
|
214
|
+
*
|
|
215
|
+
* This tree is constructed by calling `printTree` on the rendered text tree.
|
|
216
|
+
* The rendered text tree is walked and the appropriate Prettier builders are
|
|
217
|
+
* called to produce a document tree. The result is then passed to Prettier's
|
|
218
|
+
* `printDocToString` function to produce the final source text.
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
const nodesToContext = new WeakMap();
|
|
222
|
+
const diagnosticsByTree = new WeakMap();
|
|
223
|
+
export function getContextForRenderNode(node) {
|
|
224
|
+
return nodesToContext.get(node);
|
|
225
|
+
}
|
|
226
|
+
export function getDiagnosticsForTree(tree) {
|
|
227
|
+
return diagnosticsByTree.get(tree)?.getDiagnostics() ?? [];
|
|
228
|
+
}
|
|
229
|
+
function reportDiagnosticsForTree(tree) {
|
|
230
|
+
const diagnostics = diagnosticsByTree.get(tree);
|
|
231
|
+
if (!diagnostics) return;
|
|
232
|
+
const entries = diagnostics.getDiagnostics();
|
|
233
|
+
if (entries.length === 0) return;
|
|
234
|
+
reportDiagnostics(diagnostics);
|
|
235
|
+
notifyDiagnosticsReport(entries);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Re-export from print-hook.ts to maintain backwards compatibility
|
|
239
|
+
export { isPrintHook, printHookTag } from "./print-hook.js";
|
|
240
|
+
export function createRenderTreeHook(subtree, hooks) {
|
|
241
|
+
return {
|
|
242
|
+
[printHookTag]: true,
|
|
243
|
+
subtree,
|
|
244
|
+
...hooks
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Render a component tree to source directories and files. Will ensure that
|
|
250
|
+
* all non-async scheduled jobs are completed before returning. If async jobs
|
|
251
|
+
* are found, an error will be thrown. Use `renderAsync` when asynchronous
|
|
252
|
+
* jobs are expected.
|
|
253
|
+
*/
|
|
254
|
+
export function render(children, options) {
|
|
255
|
+
const tree = renderTree(children);
|
|
256
|
+
flushJobs();
|
|
257
|
+
const output = sourceFilesForTree(tree, options);
|
|
258
|
+
flushDirtyFiles();
|
|
259
|
+
reportDiagnosticsForTree(tree);
|
|
260
|
+
reportLastRenderError();
|
|
261
|
+
debug.render.complete();
|
|
262
|
+
// Only close the trace DB when devtools is NOT running. When devtools is
|
|
263
|
+
// active the DB must remain open for post-render reactive updates.
|
|
264
|
+
if (isTraceEnabled() && !isDevtoolsEnabled()) closeTrace();
|
|
265
|
+
if (isDevtoolsEnabled()) {
|
|
266
|
+
void waitForSignal();
|
|
267
|
+
}
|
|
268
|
+
return output;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Render a component tree to source directories and files. Will ensure that all
|
|
273
|
+
* scheduled jobs are completed before returning.
|
|
274
|
+
*/
|
|
275
|
+
export async function renderAsync(children, options) {
|
|
276
|
+
await debug.prepare();
|
|
277
|
+
const tree = renderTree(children);
|
|
278
|
+
// Ensure all reactive updates are flushed before printing.
|
|
279
|
+
await flushJobsAsync();
|
|
280
|
+
const output = sourceFilesForTree(tree, options);
|
|
281
|
+
flushDirtyFiles();
|
|
282
|
+
reportDiagnosticsForTree(tree);
|
|
283
|
+
reportLastRenderError();
|
|
284
|
+
debug.render.complete();
|
|
285
|
+
// Only close the trace DB when devtools is NOT running. When devtools is
|
|
286
|
+
// active the DB must remain open for post-render reactive updates.
|
|
287
|
+
if (isTraceEnabled() && !isDevtoolsEnabled()) closeTrace();
|
|
288
|
+
return output;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Convert a rendered text tree to source directories and files. Will ensure
|
|
293
|
+
* that all scheduled jobs are completed before returning.
|
|
294
|
+
*/
|
|
295
|
+
export function sourceFilesForTree(tree, options) {
|
|
296
|
+
let rootDirectory = undefined;
|
|
297
|
+
collectSourceFiles(undefined, tree);
|
|
298
|
+
if (!rootDirectory) {
|
|
299
|
+
emitDiagnostic({
|
|
300
|
+
severity: "error",
|
|
301
|
+
message: "No root directory found. Make sure you are using the output component."
|
|
302
|
+
});
|
|
303
|
+
return {
|
|
304
|
+
kind: "directory",
|
|
305
|
+
path: "",
|
|
306
|
+
contents: []
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
return rootDirectory;
|
|
310
|
+
function collectSourceFiles(currentDirectory, root) {
|
|
311
|
+
if (!Array.isArray(root)) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const context = getContextForRenderNode(root);
|
|
315
|
+
if (!context) {
|
|
316
|
+
return recurse(currentDirectory);
|
|
317
|
+
}
|
|
318
|
+
if (context.meta?.directory) {
|
|
319
|
+
const directory = {
|
|
320
|
+
kind: "directory",
|
|
321
|
+
path: context.meta?.directory.path,
|
|
322
|
+
contents: []
|
|
323
|
+
};
|
|
324
|
+
if (currentDirectory) {
|
|
325
|
+
currentDirectory.contents.push(directory);
|
|
326
|
+
} else {
|
|
327
|
+
rootDirectory = directory;
|
|
328
|
+
}
|
|
329
|
+
recurse(directory);
|
|
330
|
+
} else if (context.meta?.sourceFile) {
|
|
331
|
+
if (!currentDirectory) {
|
|
332
|
+
// This shouldn't happen if you're using the Output component.
|
|
333
|
+
throw new Error("Source file doesn't have parent directory. Make sure you have used the Output component.");
|
|
334
|
+
}
|
|
335
|
+
const sourceFile = {
|
|
336
|
+
kind: "file",
|
|
337
|
+
path: context.meta?.sourceFile.path,
|
|
338
|
+
filetype: context.meta?.sourceFile.filetype,
|
|
339
|
+
contents: printTree(root, {
|
|
340
|
+
printWidth: options?.printWidth ?? context.meta?.printOptions?.printWidth,
|
|
341
|
+
tabWidth: options?.tabWidth ?? context.meta?.printOptions?.tabWidth,
|
|
342
|
+
useTabs: options?.useTabs ?? context.meta?.printOptions?.useTabs,
|
|
343
|
+
insertFinalNewLine: options?.insertFinalNewLine ?? context.meta?.printOptions?.insertFinalNewLine ?? true
|
|
344
|
+
})
|
|
345
|
+
};
|
|
346
|
+
currentDirectory.contents.push(sourceFile);
|
|
347
|
+
} else if (context.meta?.copyFile) {
|
|
348
|
+
if (!currentDirectory) {
|
|
349
|
+
// This shouldn't happen if you're using the Output component.
|
|
350
|
+
throw new Error("Copy file doesn't have parent directory. Make sure you have used the Output component.");
|
|
351
|
+
}
|
|
352
|
+
const sourceFile = {
|
|
353
|
+
kind: "file",
|
|
354
|
+
path: context.meta?.copyFile.path,
|
|
355
|
+
sourcePath: context.meta?.copyFile.sourcePath
|
|
356
|
+
};
|
|
357
|
+
currentDirectory.contents.push(sourceFile);
|
|
358
|
+
} else {
|
|
359
|
+
recurse(currentDirectory);
|
|
360
|
+
}
|
|
361
|
+
function recurse(cwd) {
|
|
362
|
+
for (const child of root) {
|
|
363
|
+
collectSourceFiles(cwd, child);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
export function renderTree(children) {
|
|
369
|
+
const rootElem = [];
|
|
370
|
+
const diagnostics = new DiagnosticsCollector();
|
|
371
|
+
lastRenderError = null;
|
|
372
|
+
debug.effect.reset();
|
|
373
|
+
debug.symbols.reset();
|
|
374
|
+
debug.files.reset();
|
|
375
|
+
dirtyFiles.clear();
|
|
376
|
+
lastFlushTimeByFile.clear();
|
|
377
|
+
debug.render.initialize(rootElem);
|
|
378
|
+
if (isTraceEnabled()) beginTransaction();
|
|
379
|
+
try {
|
|
380
|
+
root(() => {
|
|
381
|
+
attachDiagnosticsCollector(diagnostics);
|
|
382
|
+
renderWorker(rootElem, children);
|
|
383
|
+
});
|
|
384
|
+
} catch (e) {
|
|
385
|
+
if (isTraceEnabled()) commitTransaction();
|
|
386
|
+
flushDirtyFiles();
|
|
387
|
+
notifyRenderError(e);
|
|
388
|
+
reportLastRenderError();
|
|
389
|
+
throw e;
|
|
390
|
+
}
|
|
391
|
+
if (isTraceEnabled()) commitTransaction();
|
|
392
|
+
diagnosticsByTree.set(rootElem, diagnostics);
|
|
393
|
+
return rootElem;
|
|
394
|
+
}
|
|
395
|
+
function renderWorker(node, children) {
|
|
396
|
+
if (lastRenderError) return;
|
|
397
|
+
if (!getContext()) {
|
|
398
|
+
throw new Error("Cannot render without a context. Make sure you are using the Output component.");
|
|
399
|
+
}
|
|
400
|
+
if (Array.isArray(node)) {
|
|
401
|
+
nodesToContext.set(node, getContext());
|
|
402
|
+
}
|
|
403
|
+
if (Array.isArray(children)) {
|
|
404
|
+
for (const child of children.flat(Infinity)) {
|
|
405
|
+
appendChild(node, child);
|
|
406
|
+
if (lastRenderError) break;
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
appendChild(node, children);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function contentAdded() {
|
|
413
|
+
const context = getContext();
|
|
414
|
+
context.childrenWithContent++;
|
|
415
|
+
}
|
|
416
|
+
export function notifyContentState() {
|
|
417
|
+
untrack(() => {
|
|
418
|
+
const startContext = getContext();
|
|
419
|
+
if (startContext.childrenWithContent === 0) {
|
|
420
|
+
if (startContext._lastEmpty) {
|
|
421
|
+
// it was already empty, no work to do.
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
startContext._lastEmpty = true;
|
|
425
|
+
if (startContext.isEmpty) {
|
|
426
|
+
startContext.isEmpty.value = true;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// otherwise we need to decrement the content counts up the tree.
|
|
430
|
+
let current = startContext.owner;
|
|
431
|
+
while (current) {
|
|
432
|
+
if (current.childrenWithContent === 0) {
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
current.childrenWithContent--;
|
|
436
|
+
if (current.childrenWithContent > 0) {
|
|
437
|
+
// This isn't the last content so we have no work to do
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
current._lastEmpty = true;
|
|
441
|
+
if (current.isEmpty) {
|
|
442
|
+
current.isEmpty.value = true;
|
|
443
|
+
}
|
|
444
|
+
current = current.owner;
|
|
445
|
+
}
|
|
446
|
+
} else {
|
|
447
|
+
if (!startContext._lastEmpty) {
|
|
448
|
+
// it was already non-empty, no work to do.
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
startContext._lastEmpty = false;
|
|
452
|
+
if (startContext.isEmpty) {
|
|
453
|
+
startContext.isEmpty.value = false;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// otherwise we need to increment the content counts up the tree.
|
|
457
|
+
let current = startContext.owner;
|
|
458
|
+
while (current) {
|
|
459
|
+
current.childrenWithContent++;
|
|
460
|
+
if (current.childrenWithContent > 1) {
|
|
461
|
+
// This isn't the first content so we have no work to do
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
current._lastEmpty = false;
|
|
465
|
+
if (current.isEmpty) {
|
|
466
|
+
current.isEmpty.value = false;
|
|
467
|
+
}
|
|
468
|
+
current = current.owner;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
function appendChild(node, rawChild) {
|
|
474
|
+
if (lastRenderError) return;
|
|
475
|
+
const child = normalizeChild(rawChild);
|
|
476
|
+
if (typeof child === "string") {
|
|
477
|
+
if (child !== "") {
|
|
478
|
+
contentAdded();
|
|
479
|
+
debug.render.appendTextNode(node, node.length, child);
|
|
480
|
+
}
|
|
481
|
+
node.push(child);
|
|
482
|
+
} else {
|
|
483
|
+
const cache = getElementCache();
|
|
484
|
+
if (cache.has(child)) {
|
|
485
|
+
const cachedNode = cache.get(child);
|
|
486
|
+
// recordSubtreeAdded detects cached nodes automatically and re-adds their children
|
|
487
|
+
if (isCustomContext(child)) {
|
|
488
|
+
debug.render.appendCustomContext(node, cachedNode);
|
|
489
|
+
} else {
|
|
490
|
+
debug.render.appendFragmentChild(node, cachedNode);
|
|
491
|
+
}
|
|
492
|
+
node.push(cachedNode);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
if (isCustomContext(child)) {
|
|
496
|
+
const newNode = [];
|
|
497
|
+
debug.render.appendCustomContext(node, newNode);
|
|
498
|
+
child.useCustomContext(children => {
|
|
499
|
+
renderWorker(newNode, children);
|
|
500
|
+
node.push(newNode);
|
|
501
|
+
cache.set(child, newNode);
|
|
502
|
+
notifyContentState();
|
|
503
|
+
notifyFileUpdateForNode(node);
|
|
504
|
+
});
|
|
505
|
+
} else if (isIntrinsicElement(child)) {
|
|
506
|
+
// don't need a new context here because intrinsics are never reactive
|
|
507
|
+
const intrinsic = child;
|
|
508
|
+
const newNode = [];
|
|
509
|
+
function formatHookWithChildren(command) {
|
|
510
|
+
const hook = createRenderTreeHook(newNode, {
|
|
511
|
+
print(tree, print) {
|
|
512
|
+
return command(print(tree));
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
debug.render.appendPrintHook(node, node.length, hook, intrinsic.name, newNode);
|
|
516
|
+
node.push(hook);
|
|
517
|
+
renderWorker(newNode, child.props.children);
|
|
518
|
+
notifyFileUpdateForNode(node);
|
|
519
|
+
}
|
|
520
|
+
function formatHook(command) {
|
|
521
|
+
const hook = createRenderTreeHook(newNode, {
|
|
522
|
+
print() {
|
|
523
|
+
return command;
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
debug.render.appendPrintHook(node, node.length, hook, intrinsic.name);
|
|
527
|
+
node.push(hook);
|
|
528
|
+
return hook;
|
|
529
|
+
}
|
|
530
|
+
switch (child.name) {
|
|
531
|
+
case "indent":
|
|
532
|
+
return formatHookWithChildren(indent);
|
|
533
|
+
case "indentIfBreak":
|
|
534
|
+
{
|
|
535
|
+
const hook = createRenderTreeHook(newNode, {
|
|
536
|
+
print(tree, print) {
|
|
537
|
+
return indentIfBreak(print(tree), {
|
|
538
|
+
groupId: child.props.groupId,
|
|
539
|
+
negate: child.props.negate
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
debug.render.appendPrintHook(node, node.length, hook, intrinsic.name, newNode);
|
|
544
|
+
node.push(hook);
|
|
545
|
+
}
|
|
546
|
+
renderWorker(newNode, child.props.children);
|
|
547
|
+
notifyFileUpdateForNode(node);
|
|
548
|
+
return;
|
|
549
|
+
case "fill":
|
|
550
|
+
return formatHookWithChildren(fill);
|
|
551
|
+
case "group":
|
|
552
|
+
{
|
|
553
|
+
const hook = createRenderTreeHook(newNode, {
|
|
554
|
+
print(tree, print) {
|
|
555
|
+
return group(print(tree), {
|
|
556
|
+
id: child.props.id,
|
|
557
|
+
shouldBreak: child.props.shouldBreak
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
debug.render.appendPrintHook(node, node.length, hook, intrinsic.name, newNode);
|
|
562
|
+
node.push(hook);
|
|
563
|
+
}
|
|
564
|
+
renderWorker(newNode, child.props.children);
|
|
565
|
+
notifyFileUpdateForNode(node);
|
|
566
|
+
return;
|
|
567
|
+
case "line":
|
|
568
|
+
case "br":
|
|
569
|
+
return formatHook(line);
|
|
570
|
+
case "hbr":
|
|
571
|
+
case "hardline":
|
|
572
|
+
return formatHook(hardline);
|
|
573
|
+
case "sbr":
|
|
574
|
+
case "softline":
|
|
575
|
+
return formatHook(softline);
|
|
576
|
+
case "literalline":
|
|
577
|
+
case "lbr":
|
|
578
|
+
return formatHook(literalline);
|
|
579
|
+
case "align":
|
|
580
|
+
{
|
|
581
|
+
const hook = createRenderTreeHook(newNode, {
|
|
582
|
+
print(tree, print) {
|
|
583
|
+
return align(child.props.width ?? child.props.string, print(tree));
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
debug.render.appendPrintHook(node, node.length, hook, intrinsic.name, newNode);
|
|
587
|
+
node.push(hook);
|
|
588
|
+
}
|
|
589
|
+
renderWorker(newNode, child.props.children);
|
|
590
|
+
notifyFileUpdateForNode(node);
|
|
591
|
+
return;
|
|
592
|
+
case "lineSuffix":
|
|
593
|
+
return formatHookWithChildren(lineSuffix);
|
|
594
|
+
case "lineSuffixBoundary":
|
|
595
|
+
return formatHook(lineSuffixBoundary);
|
|
596
|
+
case "breakParent":
|
|
597
|
+
return formatHook(breakParent);
|
|
598
|
+
case "dedent":
|
|
599
|
+
return formatHookWithChildren(dedent);
|
|
600
|
+
case "dedentToRoot":
|
|
601
|
+
return formatHookWithChildren(dedentToRoot);
|
|
602
|
+
case "markAsRoot":
|
|
603
|
+
return formatHookWithChildren(markAsRoot);
|
|
604
|
+
case "ifBreak":
|
|
605
|
+
{
|
|
606
|
+
const hook = createRenderTreeHook(newNode, {
|
|
607
|
+
print(tree, print) {
|
|
608
|
+
return ifBreak(print(tree[0]), print(tree[1]));
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
debug.render.appendPrintHook(node, node.length, hook, intrinsic.name, newNode);
|
|
612
|
+
node.push(hook);
|
|
613
|
+
}
|
|
614
|
+
newNode.push([], []);
|
|
615
|
+
debug.render.appendFragmentChild(newNode, newNode[0]);
|
|
616
|
+
debug.render.appendFragmentChild(newNode, newNode[1]);
|
|
617
|
+
renderWorker(newNode[0], child.props.children);
|
|
618
|
+
renderWorker(newNode[1], child.props.flatContents);
|
|
619
|
+
notifyFileUpdateForNode(node);
|
|
620
|
+
return;
|
|
621
|
+
default:
|
|
622
|
+
throw new Error("Unknown intrinsic element");
|
|
623
|
+
}
|
|
624
|
+
} else if (isComponentCreator(child)) {
|
|
625
|
+
const index = node.length;
|
|
626
|
+
const rerenderToken = isDevtoolsEnabled() ? ref(0, {
|
|
627
|
+
isInfrastructure: true
|
|
628
|
+
}) : undefined;
|
|
629
|
+
const breakNext = isDevtoolsEnabled() ? ref(false, {
|
|
630
|
+
isInfrastructure: true
|
|
631
|
+
}) : undefined;
|
|
632
|
+
// todo: remove this effect (only needed for context, not needed for anything else)
|
|
633
|
+
effect(() => {
|
|
634
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
635
|
+
rerenderToken?.value;
|
|
636
|
+
const context = getContext();
|
|
637
|
+
context.childrenWithContent = 0;
|
|
638
|
+
if (context) context.componentOwner = child;
|
|
639
|
+
const existing = node[index];
|
|
640
|
+
const componentRoot = Array.isArray(existing) ? existing : [];
|
|
641
|
+
context.meta ??= {};
|
|
642
|
+
context.meta.renderNode = componentRoot;
|
|
643
|
+
const propsSource = child.props ?? undefined;
|
|
644
|
+
const debugSession = debug.render.beginComponent({
|
|
645
|
+
parent: node,
|
|
646
|
+
index,
|
|
647
|
+
node: componentRoot,
|
|
648
|
+
component: child,
|
|
649
|
+
propsSource,
|
|
650
|
+
source: child.source,
|
|
651
|
+
isExisting: Array.isArray(existing),
|
|
652
|
+
actions: {
|
|
653
|
+
rerender: rerenderToken ? () => {
|
|
654
|
+
lastRenderError = null;
|
|
655
|
+
rerenderToken.value++;
|
|
656
|
+
} : () => {},
|
|
657
|
+
rerenderAndBreak: breakNext && rerenderToken ? () => {
|
|
658
|
+
lastRenderError = null;
|
|
659
|
+
breakNext.value = true;
|
|
660
|
+
rerenderToken.value++;
|
|
661
|
+
} : () => {}
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
if (Array.isArray(existing)) {
|
|
665
|
+
componentRoot.length = 0;
|
|
666
|
+
}
|
|
667
|
+
pushStack(child.component, child.props, child.source);
|
|
668
|
+
let renderFailed = false;
|
|
669
|
+
let childResult;
|
|
670
|
+
try {
|
|
671
|
+
childResult = untrack(() => {
|
|
672
|
+
const shouldBreak = breakNext?.value ?? false;
|
|
673
|
+
if (shouldBreak) {
|
|
674
|
+
breakNext.value = false;
|
|
675
|
+
// eslint-disable-next-line no-debugger
|
|
676
|
+
debugger;
|
|
677
|
+
}
|
|
678
|
+
return child();
|
|
679
|
+
});
|
|
680
|
+
} catch (error) {
|
|
681
|
+
notifyRenderError(error);
|
|
682
|
+
renderFailed = true;
|
|
683
|
+
throw error;
|
|
684
|
+
}
|
|
685
|
+
try {
|
|
686
|
+
if (context?.meta?.directory) {
|
|
687
|
+
debugSession.recordDirectory(context.meta.directory.path);
|
|
688
|
+
}
|
|
689
|
+
if (context?.meta?.sourceFile) {
|
|
690
|
+
context.meta.renderNode = componentRoot;
|
|
691
|
+
debugSession.recordFile(context.meta.sourceFile.path, context.meta.sourceFile.filetype);
|
|
692
|
+
context.meta.sourceFileReady = false;
|
|
693
|
+
}
|
|
694
|
+
if (!renderFailed) {
|
|
695
|
+
renderWorker(componentRoot, childResult);
|
|
696
|
+
}
|
|
697
|
+
} finally {
|
|
698
|
+
popStack();
|
|
699
|
+
}
|
|
700
|
+
if (renderFailed) {
|
|
701
|
+
node[index] = componentRoot;
|
|
702
|
+
cache.set(child, componentRoot);
|
|
703
|
+
notifyFileUpdateForNode(node);
|
|
704
|
+
notifyContentState();
|
|
705
|
+
onCleanup(() => debugSession.dispose());
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
if (context?.meta?.sourceFile) {
|
|
709
|
+
context.meta.sourceFileReady = true;
|
|
710
|
+
notifyFileUpdateForNode(componentRoot);
|
|
711
|
+
}
|
|
712
|
+
node[index] = componentRoot;
|
|
713
|
+
cache.set(child, componentRoot);
|
|
714
|
+
notifyContentState();
|
|
715
|
+
onCleanup(() => debugSession.dispose());
|
|
716
|
+
}, undefined, {
|
|
717
|
+
debug: {
|
|
718
|
+
name: `render:${child.component.name || "Anonymous"}`,
|
|
719
|
+
type: "render"
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
} else if (typeof child === "function") {
|
|
723
|
+
const index = node.length;
|
|
724
|
+
effect(() => {
|
|
725
|
+
let res;
|
|
726
|
+
let renderFailed = false;
|
|
727
|
+
try {
|
|
728
|
+
res = child();
|
|
729
|
+
while (typeof res === "function" && !isComponentCreator(res)) {
|
|
730
|
+
res = res();
|
|
731
|
+
}
|
|
732
|
+
} catch (error) {
|
|
733
|
+
notifyRenderError(error);
|
|
734
|
+
renderFailed = true;
|
|
735
|
+
throw error;
|
|
736
|
+
}
|
|
737
|
+
const context = getContext();
|
|
738
|
+
context.childrenWithContent = 0;
|
|
739
|
+
const existing = node[index];
|
|
740
|
+
const memoNode = Array.isArray(existing) ? existing : [];
|
|
741
|
+
debug.render.prepareMemoNode(node, memoNode, Array.isArray(existing));
|
|
742
|
+
if (Array.isArray(existing)) {
|
|
743
|
+
memoNode.length = 0;
|
|
744
|
+
}
|
|
745
|
+
if (!renderFailed) {
|
|
746
|
+
renderWorker(memoNode, res);
|
|
747
|
+
}
|
|
748
|
+
node[index] = memoNode;
|
|
749
|
+
cache.set(child, memoNode);
|
|
750
|
+
notifyFileUpdateForNode(node);
|
|
751
|
+
notifyContentState();
|
|
752
|
+
return memoNode;
|
|
753
|
+
}, undefined, {
|
|
754
|
+
debug: {
|
|
755
|
+
name: `render:memo:${child.name || "anonymous"}`,
|
|
756
|
+
type: "render"
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
} else {
|
|
760
|
+
throw new Error("Unexpected child type");
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
function findSourceFileContext(node) {
|
|
765
|
+
let context = getContextForRenderNode(node) ?? null;
|
|
766
|
+
while (context) {
|
|
767
|
+
if (context.meta?.sourceFile) return context;
|
|
768
|
+
context = context.owner;
|
|
769
|
+
}
|
|
770
|
+
return undefined;
|
|
771
|
+
}
|
|
772
|
+
function notifyFileUpdateForNode(node) {
|
|
773
|
+
// Only track when devtools or trace are actually enabled
|
|
774
|
+
if (!isDevtoolsEnabled() && !isTraceEnabled()) return;
|
|
775
|
+
const context = findSourceFileContext(node);
|
|
776
|
+
if (!context?.meta?.sourceFile) return;
|
|
777
|
+
if (context.meta.sourceFileReady === false) return;
|
|
778
|
+
const sourceFile = context.meta.sourceFile;
|
|
779
|
+
const renderNode = context.meta.renderNode ?? node;
|
|
780
|
+
|
|
781
|
+
// Mark this file as dirty — defer the expensive printTree to end of render
|
|
782
|
+
dirtyFiles.set(sourceFile.path, {
|
|
783
|
+
renderNode,
|
|
784
|
+
printOptions: {
|
|
785
|
+
printWidth: context.meta?.printOptions?.printWidth,
|
|
786
|
+
tabWidth: context.meta?.printOptions?.tabWidth,
|
|
787
|
+
useTabs: context.meta?.printOptions?.useTabs,
|
|
788
|
+
insertFinalNewLine: context.meta?.printOptions?.insertFinalNewLine
|
|
789
|
+
},
|
|
790
|
+
path: sourceFile.path,
|
|
791
|
+
filetype: sourceFile.filetype
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
// When a devtools client is connected, throttle file flushing to ~1s per file
|
|
795
|
+
// so the user can watch content build up during rendering.
|
|
796
|
+
if (isDevtoolsConnected()) {
|
|
797
|
+
const now = Date.now();
|
|
798
|
+
const lastFlush = lastFlushTimeByFile.get(sourceFile.path) ?? 0;
|
|
799
|
+
if (now - lastFlush >= DEVTOOLS_FLUSH_INTERVAL_MS) {
|
|
800
|
+
lastFlushTimeByFile.set(sourceFile.path, now);
|
|
801
|
+
flushDirtyFile(sourceFile.path);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
function normalizeChild(child) {
|
|
806
|
+
if (Array.isArray(child)) {
|
|
807
|
+
return child.map(normalizeChild);
|
|
808
|
+
} else if (typeof child === "string" || typeof child === "function") {
|
|
809
|
+
return child;
|
|
810
|
+
} else if (typeof child === "undefined" || child === null || typeof child === "boolean") {
|
|
811
|
+
return "";
|
|
812
|
+
} else if (isRef(child)) {
|
|
813
|
+
return () => child.value;
|
|
814
|
+
} else if (isRefkeyable(child)) {
|
|
815
|
+
const refkey = toRefkey(child);
|
|
816
|
+
return () => {
|
|
817
|
+
const sfContext = useContext(SourceFileContext);
|
|
818
|
+
if (!sfContext || !sfContext.reference) {
|
|
819
|
+
throw new Error("Can only emit references inside of source files");
|
|
820
|
+
}
|
|
821
|
+
return sfContext.reference({
|
|
822
|
+
refkey
|
|
823
|
+
});
|
|
824
|
+
};
|
|
825
|
+
} else if (isRenderableObject(child)) {
|
|
826
|
+
// For custom renderable objects, we will just normalize them to a bound function.
|
|
827
|
+
return child[RENDERABLE].bind(child);
|
|
828
|
+
} else if (isCustomContext(child)) {
|
|
829
|
+
return child;
|
|
830
|
+
} else if (isIntrinsicElement(child)) {
|
|
831
|
+
return child;
|
|
832
|
+
} else {
|
|
833
|
+
return String(child);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
const defaultPrintTreeOptions = {
|
|
837
|
+
printWidth: 80,
|
|
838
|
+
tabWidth: 2
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Convert a rendered text tree to a string. Will ensure that the scheduler is
|
|
843
|
+
* empty before printing.
|
|
844
|
+
*/
|
|
845
|
+
export function printTree(tree, options) {
|
|
846
|
+
options = {
|
|
847
|
+
...defaultPrintTreeOptions,
|
|
848
|
+
...Object.fromEntries(Object.entries(options ?? {}).filter(([_, v]) => v !== undefined))
|
|
849
|
+
};
|
|
850
|
+
if (!options.noFlush) {
|
|
851
|
+
// make sure queue is empty
|
|
852
|
+
flushJobs();
|
|
853
|
+
}
|
|
854
|
+
const d = printTreeWorker(tree);
|
|
855
|
+
const result = doc.printer.printDocToString(d, options).formatted;
|
|
856
|
+
return options.insertFinalNewLine && !result.endsWith("\n") ? `${result}\n` : result;
|
|
857
|
+
}
|
|
858
|
+
function printTreeWorker(tree) {
|
|
859
|
+
const doc = [];
|
|
860
|
+
for (const node of tree) {
|
|
861
|
+
if (typeof node === "string") {
|
|
862
|
+
const normalizedNode = node.split(/\r?\n/).flatMap((line, index, array) => index < array.length - 1 ? [line, hardline] : [line]);
|
|
863
|
+
doc.push(normalizedNode);
|
|
864
|
+
} else if (isPrintHook(node)) {
|
|
865
|
+
doc.push(node.print(node.subtree, printTreeWorker));
|
|
866
|
+
} else {
|
|
867
|
+
doc.push(printTreeWorker(node));
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return doc;
|
|
871
|
+
}
|
|
872
|
+
//# sourceMappingURL=render.js.map
|