@alloy-js/core 0.23.0-dev.11 → 0.23.0-dev.13
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/dist/dev/src/binder.js +488 -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 +66 -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 +11 -0
- package/dist/dev/src/components/MemberName.js.map +1 -0
- package/dist/dev/src/components/MemberScope.js +57 -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 +50 -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 +12 -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 +32 -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 +13 -0
- package/dist/dev/src/context/scope.js.map +1 -0
- package/dist/dev/src/context/source-directory.js +3 -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.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 +658 -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 +33 -0
- package/dist/dev/src/devtools/devtools-server.browser.js.map +1 -0
- package/dist/dev/src/devtools/devtools-server.js +444 -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 +89 -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 +5 -0
- package/dist/dev/src/library-symbol-reference.js.map +1 -0
- package/dist/dev/src/name-policy.js +24 -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 +426 -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 +202 -0
- package/dist/dev/src/symbols/output-scope.js.map +1 -0
- package/dist/dev/src/symbols/output-space.js +36 -0
- package/dist/dev/src/symbols/output-space.js.map +1 -0
- package/dist/dev/src/symbols/output-symbol.js +504 -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 +68 -0
- package/dist/dev/src/symbols/symbol-slot.js.map +1 -0
- package/dist/dev/src/symbols/symbol-slot.test.js +43 -0
- package/dist/dev/src/symbols/symbol-slot.test.js.map +1 -0
- package/dist/dev/src/symbols/symbol-table.js +93 -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 +52 -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/output-scope.test.js +180 -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 +76 -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 +167 -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 +23 -0
- package/dist/dev/testing/render.js.map +1 -0
- package/dist/dev/testing/vitest.d.js +2 -0
- package/dist/dev/testing/vitest.d.js.map +1 -0
- 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/effects.d.ts.map +1 -1
- package/dist/src/debug/effects.js +2 -67
- package/dist/src/debug/effects.js.map +1 -1
- package/dist/src/debug/render.d.ts.map +1 -1
- package/dist/src/debug/render.js +15 -8
- package/dist/src/debug/render.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/trace.d.ts.map +1 -1
- package/dist/src/debug/trace.js +19 -5
- package/dist/src/debug/trace.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/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/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/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -3
- package/src/debug/cli.ts +3 -2
- package/src/debug/effects.ts +2 -82
- package/src/debug/render.ts +25 -13
- package/src/debug/source-map.browser.ts +30 -0
- package/src/debug/source-map.ts +135 -0
- package/src/debug/trace.ts +22 -5
- package/src/host/node-host.browser.ts +23 -0
- package/src/host/node-host.ts +22 -0
- package/src/render-stack.ts +4 -3
- package/src/write-output.ts +6 -5
- package/test/browser-build.test.ts +71 -78
- package/vitest.config.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alloy-js/core",
|
|
3
|
-
"version": "0.23.0-dev.
|
|
3
|
+
"version": "0.23.0-dev.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,35 +10,45 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"browser": "./dist/src/index.browser.js",
|
|
13
|
+
"development": "./dist/dev/src/index.js",
|
|
13
14
|
"import": "./dist/src/index.js"
|
|
14
15
|
},
|
|
15
16
|
"./jsx-runtime": {
|
|
16
17
|
"types": "./dist/src/jsx-runtime.d.ts",
|
|
18
|
+
"development": "./dist/dev/src/jsx-runtime.js",
|
|
17
19
|
"import": "./dist/src/jsx-runtime.js"
|
|
18
20
|
},
|
|
19
21
|
"./testing": {
|
|
22
|
+
"development": "./dist/dev/testing/index.js",
|
|
20
23
|
"import": "./dist/testing/index.js"
|
|
21
24
|
},
|
|
22
25
|
"./testing/matchers": {
|
|
23
26
|
"types": "./testing/vitest.d.ts"
|
|
24
27
|
},
|
|
25
28
|
"./stc": {
|
|
29
|
+
"development": "./dist/dev/src/components/stc/index.js",
|
|
26
30
|
"import": "./dist/src/components/stc/index.js"
|
|
27
31
|
},
|
|
28
32
|
"./components": {
|
|
33
|
+
"development": "./dist/dev/src/components/index.js",
|
|
29
34
|
"import": "./dist/src/components/index.js"
|
|
30
35
|
},
|
|
31
36
|
"./devtools": {
|
|
32
37
|
"types": "./dist/src/devtools-entry.d.ts",
|
|
33
38
|
"browser": "./dist/src/devtools-entry.browser.js",
|
|
39
|
+
"development": "./dist/dev/src/devtools-entry.js",
|
|
34
40
|
"import": "./dist/src/devtools-entry.js"
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
"browser": {
|
|
38
44
|
"./dist/src/host/alloy-host.js": "./dist/src/host/alloy-host.browser.js",
|
|
39
45
|
"./src/host/alloy-host.ts": "./src/host/alloy-host.browser.ts",
|
|
46
|
+
"./dist/src/host/node-host.js": "./dist/src/host/node-host.browser.js",
|
|
47
|
+
"./src/host/node-host.ts": "./src/host/node-host.browser.ts",
|
|
40
48
|
"./dist/src/inspect.js": "./dist/src/inspect.browser.js",
|
|
41
49
|
"./src/inspect.ts": "./src/inspect.browser.ts",
|
|
50
|
+
"./dist/src/debug/source-map.js": "./dist/src/debug/source-map.browser.js",
|
|
51
|
+
"./src/debug/source-map.ts": "./src/debug/source-map.browser.ts",
|
|
42
52
|
"./dist/src/devtools/devtools-server.js": "./dist/src/devtools/devtools-server.browser.js",
|
|
43
53
|
"./src/devtools/devtools-server.ts": "./src/devtools/devtools-server.browser.ts"
|
|
44
54
|
},
|
|
@@ -56,7 +66,7 @@
|
|
|
56
66
|
"ws": "^8.19.0"
|
|
57
67
|
},
|
|
58
68
|
"devDependencies": {
|
|
59
|
-
"@alloy-js/cli": "~0.22.0 || >= 0.23.0-dev.
|
|
69
|
+
"@alloy-js/cli": "~0.22.0 || >= 0.23.0-dev.4",
|
|
60
70
|
"@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.1",
|
|
61
71
|
"@microsoft/api-extractor": "~7.52.8",
|
|
62
72
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
@@ -68,7 +78,7 @@
|
|
|
68
78
|
"type": "module",
|
|
69
79
|
"scripts": {
|
|
70
80
|
"generate-docs": "api-extractor run",
|
|
71
|
-
"build": "alloy build && pnpm run generate-docs",
|
|
81
|
+
"build": "alloy build --with-dev && pnpm run generate-docs",
|
|
72
82
|
"clean": "rimraf dist/ .temp/",
|
|
73
83
|
"test": "vitest run",
|
|
74
84
|
"test:watch": "vitest -w",
|
package/src/debug/cli.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Table from "cli-table3";
|
|
2
2
|
import pc from "picocolors";
|
|
3
3
|
import { contextsByKey } from "../context.js";
|
|
4
|
+
import { stdoutWrite } from "../host/node-host.js";
|
|
4
5
|
import { getContext, untrack } from "../reactivity.js";
|
|
5
6
|
import { isReactiveTarget } from "./effects.js";
|
|
6
7
|
|
|
@@ -143,7 +144,7 @@ export function debugStack() {
|
|
|
143
144
|
currentContext.componentOwner &&
|
|
144
145
|
currentContext.componentOwner.component.name !== "Provider"
|
|
145
146
|
) {
|
|
146
|
-
|
|
147
|
+
stdoutWrite(
|
|
147
148
|
style.component.name(currentContext.componentOwner.component.name) +
|
|
148
149
|
"\n",
|
|
149
150
|
);
|
|
@@ -164,7 +165,7 @@ export function debugStack() {
|
|
|
164
165
|
: pc.gray("(none)"),
|
|
165
166
|
]);
|
|
166
167
|
|
|
167
|
-
|
|
168
|
+
stdoutWrite(table.toString() + "\n\n");
|
|
168
169
|
foundContexts = [];
|
|
169
170
|
}
|
|
170
171
|
|
package/src/debug/effects.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
getReactiveCreationLocation,
|
|
5
5
|
nextReactiveId,
|
|
6
6
|
} from "../reactivity.js";
|
|
7
|
+
import { loadSourceMapSupport, resolveSourceMap } from "./source-map.js";
|
|
7
8
|
import { insertEdge, insertEffect, insertRef } from "./trace-writer.js";
|
|
8
9
|
import {
|
|
9
10
|
isDebugEnabled,
|
|
@@ -112,68 +113,6 @@ const VUE_REACTIVITY_MARKERS = [
|
|
|
112
113
|
// Fast source location capture using V8 structured CallSite API
|
|
113
114
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
114
115
|
|
|
115
|
-
// Lazily loaded findSourceMap from node:module
|
|
116
|
-
let findSourceMap:
|
|
117
|
-
| ((path: string) =>
|
|
118
|
-
| {
|
|
119
|
-
findEntry: (
|
|
120
|
-
line: number,
|
|
121
|
-
col: number,
|
|
122
|
-
) =>
|
|
123
|
-
| {
|
|
124
|
-
originalSource: string;
|
|
125
|
-
originalLine: number;
|
|
126
|
-
originalColumn: number;
|
|
127
|
-
}
|
|
128
|
-
| undefined;
|
|
129
|
-
}
|
|
130
|
-
| undefined)
|
|
131
|
-
| undefined;
|
|
132
|
-
let findSourceMapLoaded = false;
|
|
133
|
-
let realpathSync: ((path: string) => string) | undefined;
|
|
134
|
-
// Cache realpath lookups to avoid repeated fs calls
|
|
135
|
-
const realpathCache = new Map<string, string>();
|
|
136
|
-
|
|
137
|
-
function loadFindSourceMap() {
|
|
138
|
-
if (findSourceMapLoaded) return;
|
|
139
|
-
findSourceMapLoaded = true;
|
|
140
|
-
// process.getBuiltinModule works in both ESM and CJS contexts
|
|
141
|
-
try {
|
|
142
|
-
const mod = process.getBuiltinModule?.("node:module") as
|
|
143
|
-
| typeof import("node:module")
|
|
144
|
-
| undefined;
|
|
145
|
-
if (mod && typeof mod.findSourceMap === "function") {
|
|
146
|
-
findSourceMap = mod.findSourceMap as typeof findSourceMap;
|
|
147
|
-
}
|
|
148
|
-
} catch {
|
|
149
|
-
// not available
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
const fs = process.getBuiltinModule?.("node:fs") as
|
|
153
|
-
| typeof import("node:fs")
|
|
154
|
-
| undefined;
|
|
155
|
-
if (fs) {
|
|
156
|
-
realpathSync = fs.realpathSync;
|
|
157
|
-
}
|
|
158
|
-
} catch {
|
|
159
|
-
// not available
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function getRealPath(fileName: string): string {
|
|
164
|
-
if (!realpathSync) return fileName;
|
|
165
|
-
let real = realpathCache.get(fileName);
|
|
166
|
-
if (real === undefined) {
|
|
167
|
-
try {
|
|
168
|
-
real = realpathSync(fileName);
|
|
169
|
-
} catch {
|
|
170
|
-
real = fileName;
|
|
171
|
-
}
|
|
172
|
-
realpathCache.set(fileName, real);
|
|
173
|
-
}
|
|
174
|
-
return real;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
116
|
function isSkipFile(fileName: string): boolean {
|
|
178
117
|
for (const skip of STACK_SKIP) {
|
|
179
118
|
if (fileName.includes(skip)) return true;
|
|
@@ -188,25 +127,6 @@ function isVueReactivityFile(fileName: string): boolean {
|
|
|
188
127
|
return false;
|
|
189
128
|
}
|
|
190
129
|
|
|
191
|
-
function resolveSourceMap(
|
|
192
|
-
fileName: string,
|
|
193
|
-
line: number,
|
|
194
|
-
col: number,
|
|
195
|
-
): { fileName: string; line: number; col: number } {
|
|
196
|
-
if (!findSourceMap) return { fileName, line, col };
|
|
197
|
-
// pnpm uses symlinks; findSourceMap only matches the real path
|
|
198
|
-
const real = getRealPath(fileName);
|
|
199
|
-
const map = findSourceMap(real);
|
|
200
|
-
if (!map) return { fileName, line, col };
|
|
201
|
-
const entry = map.findEntry(line - 1, col - 1);
|
|
202
|
-
if (!entry) return { fileName, line, col };
|
|
203
|
-
return {
|
|
204
|
-
fileName: entry.originalSource,
|
|
205
|
-
line: entry.originalLine + 1,
|
|
206
|
-
col: entry.originalColumn + 1,
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
130
|
// V8 structured stack capture — avoids string formatting entirely
|
|
211
131
|
const structuredPrepare = (
|
|
212
132
|
_err: Error,
|
|
@@ -227,7 +147,7 @@ export function captureSourceLocation(
|
|
|
227
147
|
skipReactives = true,
|
|
228
148
|
): SourceLocation | undefined {
|
|
229
149
|
if (!isDebugEnabled()) return undefined;
|
|
230
|
-
|
|
150
|
+
loadSourceMapSupport();
|
|
231
151
|
|
|
232
152
|
const sites = captureCallSites();
|
|
233
153
|
|
package/src/debug/render.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { getContext, untrack } from "../reactivity.js";
|
|
|
17
17
|
import type { ComponentCreator } from "../runtime/component.js";
|
|
18
18
|
import { flushJobsAsync } from "../scheduler.js";
|
|
19
19
|
import { sanitizeRecord } from "./serialize.js";
|
|
20
|
+
import { resolveComponentSource } from "./source-map.js";
|
|
20
21
|
import {
|
|
21
22
|
deleteDirectory,
|
|
22
23
|
deleteOutputFile,
|
|
@@ -79,7 +80,10 @@ type TrackedNode = RenderedTextTree | PrintHook;
|
|
|
79
80
|
let nodeIds = new WeakMap<TrackedNode, number>();
|
|
80
81
|
let idToNode = new Map<number, TrackedNode>();
|
|
81
82
|
let entryIds = new WeakMap<RenderedTextTree, number[]>();
|
|
82
|
-
let nodeKinds = new WeakMap<
|
|
83
|
+
let nodeKinds = new WeakMap<
|
|
84
|
+
TrackedNode,
|
|
85
|
+
{ kind: string; name?: string; source?: RenderTreeNodeInfo["source"] }
|
|
86
|
+
>();
|
|
83
87
|
let fileNodes = new Map<number, { path: string; filetype: string }>();
|
|
84
88
|
let directoryNodes = new Map<number, { path: string }>();
|
|
85
89
|
let nodeProps = new Map<number, string | undefined>();
|
|
@@ -269,8 +273,12 @@ function recordNodeAdded(
|
|
|
269
273
|
if (info.propsSerialized !== undefined) {
|
|
270
274
|
nodeProps.set(id, info.propsSerialized);
|
|
271
275
|
}
|
|
272
|
-
// Remember the kind so cached re-adds preserve
|
|
273
|
-
nodeKinds.set(node, {
|
|
276
|
+
// Remember the kind and source so cached re-adds preserve them
|
|
277
|
+
nodeKinds.set(node, {
|
|
278
|
+
kind: info.kind,
|
|
279
|
+
name: info.name,
|
|
280
|
+
source: info.source,
|
|
281
|
+
});
|
|
274
282
|
setEntryId(parent, index, id);
|
|
275
283
|
insertRenderNode(
|
|
276
284
|
id,
|
|
@@ -297,8 +305,11 @@ function recordSubtreeAdded(
|
|
|
297
305
|
const existingId = nodeIds.get(subtree);
|
|
298
306
|
const isCached = existingId !== undefined;
|
|
299
307
|
const id = isCached ? existingId : getOrCreateNodeId(subtree);
|
|
300
|
-
//
|
|
301
|
-
nodeKinds.
|
|
308
|
+
// Merge source from previously-saved nodeKinds if the caller didn't provide one
|
|
309
|
+
const savedKind = nodeKinds.get(subtree);
|
|
310
|
+
const source = info.source ?? savedKind?.source;
|
|
311
|
+
// Remember the kind and source so cached re-adds preserve them
|
|
312
|
+
nodeKinds.set(subtree, { kind: info.kind, name: info.name, source });
|
|
302
313
|
// Track in entryIds so clearRenderTreeChildren can find and remove it
|
|
303
314
|
if (Array.isArray(parentNode)) {
|
|
304
315
|
const list = getEntryList(parentNode);
|
|
@@ -310,9 +321,9 @@ function recordSubtreeAdded(
|
|
|
310
321
|
info.kind,
|
|
311
322
|
info.name,
|
|
312
323
|
info.propsSerialized,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
324
|
+
source?.fileName,
|
|
325
|
+
source?.lineNumber,
|
|
326
|
+
source?.columnNumber,
|
|
316
327
|
null,
|
|
317
328
|
undefined,
|
|
318
329
|
);
|
|
@@ -366,7 +377,7 @@ function recordCachedSubtreeChildrenRecursively(node: RenderedTextTree) {
|
|
|
366
377
|
);
|
|
367
378
|
}
|
|
368
379
|
} else if (Array.isArray(child)) {
|
|
369
|
-
// Nested RenderedTextTree - record and recurse, preserving original kind
|
|
380
|
+
// Nested RenderedTextTree - record and recurse, preserving original kind and source
|
|
370
381
|
const id = getOrCreateNodeId(child);
|
|
371
382
|
list.push(id);
|
|
372
383
|
const savedKind = nodeKinds.get(child);
|
|
@@ -376,9 +387,9 @@ function recordCachedSubtreeChildrenRecursively(node: RenderedTextTree) {
|
|
|
376
387
|
savedKind?.kind ?? "fragment",
|
|
377
388
|
savedKind?.name,
|
|
378
389
|
undefined,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
390
|
+
savedKind?.source?.fileName,
|
|
391
|
+
savedKind?.source?.lineNumber,
|
|
392
|
+
savedKind?.source?.columnNumber,
|
|
382
393
|
null,
|
|
383
394
|
undefined,
|
|
384
395
|
);
|
|
@@ -544,6 +555,7 @@ export function beginComponent(
|
|
|
544
555
|
}
|
|
545
556
|
}
|
|
546
557
|
const propsSerialized = serializeRenderTreeProps(propsSource);
|
|
558
|
+
const resolvedSource = resolveComponentSource(source);
|
|
547
559
|
if (isExisting) {
|
|
548
560
|
clearRenderTreeChildren(node);
|
|
549
561
|
} else {
|
|
@@ -551,7 +563,7 @@ export function beginComponent(
|
|
|
551
563
|
kind: "component",
|
|
552
564
|
name: componentName,
|
|
553
565
|
propsSerialized,
|
|
554
|
-
source,
|
|
566
|
+
source: resolvedSource,
|
|
555
567
|
});
|
|
556
568
|
}
|
|
557
569
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser stub for source-map resolution.
|
|
3
|
+
*
|
|
4
|
+
* Source maps are not resolved in the browser — all functions pass through
|
|
5
|
+
* their inputs unchanged.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { SourceLocation } from "../devtools/devtools-protocol.js";
|
|
9
|
+
|
|
10
|
+
export function loadSourceMapSupport() {
|
|
11
|
+
// no-op in browser
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getRealPath(fileName: string): string {
|
|
15
|
+
return fileName;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function resolveSourceMap(
|
|
19
|
+
fileName: string,
|
|
20
|
+
line: number,
|
|
21
|
+
col: number,
|
|
22
|
+
): { fileName: string; line: number; col: number } {
|
|
23
|
+
return { fileName, line, col };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function resolveComponentSource(
|
|
27
|
+
source: SourceLocation | undefined,
|
|
28
|
+
): SourceLocation | undefined {
|
|
29
|
+
return source;
|
|
30
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared source-map resolution utilities.
|
|
3
|
+
*
|
|
4
|
+
* Used by both effect source capture (effects.ts) and component source
|
|
5
|
+
* resolution (render.ts) to convert file paths and resolve source maps.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { SourceLocation } from "../devtools/devtools-protocol.js";
|
|
9
|
+
|
|
10
|
+
// Lazily loaded findSourceMap from node:module
|
|
11
|
+
let findSourceMap:
|
|
12
|
+
| ((path: string) =>
|
|
13
|
+
| {
|
|
14
|
+
findEntry: (
|
|
15
|
+
line: number,
|
|
16
|
+
col: number,
|
|
17
|
+
) =>
|
|
18
|
+
| {
|
|
19
|
+
originalSource: string;
|
|
20
|
+
originalLine: number;
|
|
21
|
+
originalColumn: number;
|
|
22
|
+
}
|
|
23
|
+
| undefined;
|
|
24
|
+
}
|
|
25
|
+
| undefined)
|
|
26
|
+
| undefined;
|
|
27
|
+
let loaded = false;
|
|
28
|
+
let realpathSync: ((path: string) => string) | undefined;
|
|
29
|
+
let fileURLToPath: ((url: string | URL) => string) | undefined;
|
|
30
|
+
const realpathCache = new Map<string, string>();
|
|
31
|
+
|
|
32
|
+
export function loadSourceMapSupport() {
|
|
33
|
+
if (loaded) return;
|
|
34
|
+
loaded = true;
|
|
35
|
+
try {
|
|
36
|
+
const mod = process.getBuiltinModule?.("node:module") as
|
|
37
|
+
| typeof import("node:module")
|
|
38
|
+
| undefined;
|
|
39
|
+
if (mod && typeof mod.findSourceMap === "function") {
|
|
40
|
+
findSourceMap = mod.findSourceMap as typeof findSourceMap;
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
// not available
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const fs = process.getBuiltinModule?.("node:fs") as
|
|
47
|
+
| typeof import("node:fs")
|
|
48
|
+
| undefined;
|
|
49
|
+
if (fs) {
|
|
50
|
+
realpathSync = fs.realpathSync;
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
// not available
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const url = process.getBuiltinModule?.("node:url") as
|
|
57
|
+
| typeof import("node:url")
|
|
58
|
+
| undefined;
|
|
59
|
+
if (url) {
|
|
60
|
+
fileURLToPath = url.fileURLToPath;
|
|
61
|
+
}
|
|
62
|
+
} catch {
|
|
63
|
+
// not available
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function getRealPath(fileName: string): string {
|
|
68
|
+
if (!realpathSync) return fileName;
|
|
69
|
+
let real = realpathCache.get(fileName);
|
|
70
|
+
if (real === undefined) {
|
|
71
|
+
try {
|
|
72
|
+
real = realpathSync(fileName);
|
|
73
|
+
} catch {
|
|
74
|
+
real = fileName;
|
|
75
|
+
}
|
|
76
|
+
realpathCache.set(fileName, real);
|
|
77
|
+
}
|
|
78
|
+
return real;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function resolveSourceMap(
|
|
82
|
+
fileName: string,
|
|
83
|
+
line: number,
|
|
84
|
+
col: number,
|
|
85
|
+
): { fileName: string; line: number; col: number } {
|
|
86
|
+
if (!findSourceMap) return { fileName, line, col };
|
|
87
|
+
// pnpm uses symlinks; findSourceMap only matches the real path
|
|
88
|
+
const real = getRealPath(fileName);
|
|
89
|
+
const map = findSourceMap(real);
|
|
90
|
+
if (!map) return { fileName, line, col };
|
|
91
|
+
const entry = map.findEntry(line - 1, col - 1);
|
|
92
|
+
if (!entry) return { fileName, line, col };
|
|
93
|
+
return {
|
|
94
|
+
fileName: entry.originalSource,
|
|
95
|
+
line: entry.originalLine + 1,
|
|
96
|
+
col: entry.originalColumn + 1,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function stripFileUrl(path: string): string {
|
|
101
|
+
if (!path.startsWith("file://")) return path;
|
|
102
|
+
if (fileURLToPath) return fileURLToPath(path);
|
|
103
|
+
return new URL(path).pathname;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Resolve a component source location. Handles:
|
|
108
|
+
* - `file://` URLs from import.meta.url (converts to file path)
|
|
109
|
+
* - Source map resolution (maps compiled .js to original .tsx)
|
|
110
|
+
* - Plain absolute paths (legacy format, returned as-is)
|
|
111
|
+
*/
|
|
112
|
+
export function resolveComponentSource(
|
|
113
|
+
source: SourceLocation | undefined,
|
|
114
|
+
): SourceLocation | undefined {
|
|
115
|
+
if (!source?.fileName) return source;
|
|
116
|
+
loadSourceMapSupport();
|
|
117
|
+
|
|
118
|
+
const fileName = stripFileUrl(source.fileName);
|
|
119
|
+
|
|
120
|
+
if (source.lineNumber != null && source.columnNumber != null) {
|
|
121
|
+
// Resolve through source maps to get the original .tsx path
|
|
122
|
+
const resolved = resolveSourceMap(
|
|
123
|
+
fileName,
|
|
124
|
+
source.lineNumber,
|
|
125
|
+
source.columnNumber,
|
|
126
|
+
);
|
|
127
|
+
return {
|
|
128
|
+
fileName: stripFileUrl(resolved.fileName),
|
|
129
|
+
lineNumber: resolved.line,
|
|
130
|
+
columnNumber: resolved.col,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return { ...source, fileName };
|
|
135
|
+
}
|
package/src/debug/trace.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ServerToClientMessage } from "../devtools/devtools-protocol.js";
|
|
5
5
|
import { isDevtoolsEnabled } from "../devtools/devtools-server.js";
|
|
6
|
+
import { env, sourceMapsEnabled } from "../host/node-host.js";
|
|
6
7
|
import { untrack } from "../reactivity.js";
|
|
7
8
|
import { initTrace, isTraceEnabled } from "./trace-writer.js";
|
|
8
9
|
|
|
@@ -21,12 +22,12 @@ export function isDebugEnabled(): boolean {
|
|
|
21
22
|
// Environment configuration
|
|
22
23
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
23
24
|
|
|
24
|
-
const traceEnv =
|
|
25
|
+
const traceEnv = env("ALLOY_TRACE") ?? "";
|
|
25
26
|
const tracePhases = new Set<string>(
|
|
26
27
|
traceEnv === "" ? [] : traceEnv.split(",").map((t) => t.trim()),
|
|
27
28
|
);
|
|
28
29
|
|
|
29
|
-
const debuggerIdsEnv =
|
|
30
|
+
const debuggerIdsEnv = env("ALLOY_BREAK_ON_DID") ?? "";
|
|
30
31
|
const debuggerIds = new Set<number>();
|
|
31
32
|
debuggerIdsEnv.split(",").forEach((id) => {
|
|
32
33
|
const num = parseInt(id, 10);
|
|
@@ -37,9 +38,9 @@ debuggerIdsEnv.split(",").forEach((id) => {
|
|
|
37
38
|
|
|
38
39
|
/** Parse the ALLOY_BREAK_ON_DID environment variable into a set of IDs. */
|
|
39
40
|
export function parseBreakOnIds(): Set<number> {
|
|
40
|
-
const
|
|
41
|
+
const raw = env("ALLOY_BREAK_ON_DID") ?? "";
|
|
41
42
|
const ids = new Set<number>();
|
|
42
|
-
|
|
43
|
+
raw.split(",").forEach((id) => {
|
|
43
44
|
const num = parseInt(id, 10);
|
|
44
45
|
if (!isNaN(num)) {
|
|
45
46
|
ids.add(num);
|
|
@@ -65,18 +66,34 @@ if (tracePhases.size > 0) {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
// Initialize SQLite trace writer if ALLOY_DEBUG_TRACE is set
|
|
68
|
-
const traceDbEnv =
|
|
69
|
+
const traceDbEnv = env("ALLOY_DEBUG_TRACE");
|
|
69
70
|
if (traceDbEnv) {
|
|
70
71
|
const traceDbPath =
|
|
71
72
|
traceDbEnv === "1" || traceDbEnv === "true" ? "alloy-trace.db" : traceDbEnv;
|
|
72
73
|
try {
|
|
73
74
|
await initTrace(traceDbPath);
|
|
75
|
+
// eslint-disable-next-line no-console
|
|
76
|
+
console.log(` Trace database: ${traceDbPath}`);
|
|
74
77
|
} catch (e) {
|
|
75
78
|
// eslint-disable-next-line no-console
|
|
76
79
|
console.warn(`Failed to initialize trace database at ${traceDbPath}:`, e);
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
|
|
83
|
+
if (import.meta.url.includes("/dist/dev/")) {
|
|
84
|
+
// eslint-disable-next-line no-console
|
|
85
|
+
console.log("Alloy debug build loaded.");
|
|
86
|
+
if (sourceMapsEnabled()) {
|
|
87
|
+
// eslint-disable-next-line no-console
|
|
88
|
+
console.log(" Source maps enabled.");
|
|
89
|
+
} else {
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
91
|
+
console.log(
|
|
92
|
+
" Source maps disabled. Run with --enable-source-maps for better stack traces.",
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
80
97
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
81
98
|
// Trace phases
|
|
82
99
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser stub for Node.js host APIs.
|
|
3
|
+
*
|
|
4
|
+
* Replaces `node-host.ts` in browser builds so that no Node.js globals
|
|
5
|
+
* (`process`, etc.) are referenced.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export function env(_key: string): string | undefined {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function cwd(): string {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function stdoutWrite(text: string): void {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.log(text);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function sourceMapsEnabled(): boolean {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js host APIs.
|
|
3
|
+
*
|
|
4
|
+
* Provides access to Node.js-specific process APIs. In browser builds this
|
|
5
|
+
* module is replaced by `node-host.browser.ts` which returns safe defaults.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export function env(key: string): string | undefined {
|
|
9
|
+
return process.env[key];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function cwd(): string {
|
|
13
|
+
return process.cwd();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function stdoutWrite(text: string): void {
|
|
17
|
+
process.stdout.write(text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function sourceMapsEnabled(): boolean {
|
|
21
|
+
return !!(process as any).sourceMapsEnabled;
|
|
22
|
+
}
|
package/src/render-stack.ts
CHANGED
|
@@ -2,6 +2,7 @@ import pc from "picocolors";
|
|
|
2
2
|
import { contextsByKey } from "./context.js";
|
|
3
3
|
import { SourceDirectoryContext } from "./context/source-directory.js";
|
|
4
4
|
import { SourceFileContext } from "./context/source-file.js";
|
|
5
|
+
import { cwd } from "./host/node-host.js";
|
|
5
6
|
import { Context, getContext } from "./reactivity.js";
|
|
6
7
|
import { Component, Props, SourceLocation } from "./runtime/component.js";
|
|
7
8
|
|
|
@@ -125,12 +126,12 @@ function formatValue(value: unknown): string {
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
function formatSourceLocation(source: SourceLocation): string {
|
|
128
|
-
const
|
|
129
|
+
const currentCwd = cwd();
|
|
129
130
|
let filePath = source.fileName;
|
|
130
131
|
|
|
131
132
|
// Convert to relative path if under cwd
|
|
132
|
-
if (filePath.startsWith(
|
|
133
|
-
filePath = filePath.slice(
|
|
133
|
+
if (currentCwd && filePath.startsWith(currentCwd)) {
|
|
134
|
+
filePath = filePath.slice(currentCwd.length + 1); // +1 to remove leading slash
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
return `${filePath}:${source.lineNumber}:${source.columnNumber}`;
|
package/src/write-output.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dirname, relative, resolve } from "pathe";
|
|
2
2
|
import { AlloyHost } from "./host/alloy-host.js";
|
|
3
|
+
import { cwd } from "./host/node-host.js";
|
|
3
4
|
import { OutputDirectory } from "./render.js";
|
|
4
5
|
import { traverseOutput } from "./utils.js";
|
|
5
6
|
/**
|
|
@@ -17,7 +18,7 @@ export async function writeOutput(
|
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
20
|
// eslint-disable-next-line no-console
|
|
20
|
-
console.log("create", relative(
|
|
21
|
+
console.log("create", relative(cwd(), path));
|
|
21
22
|
await AlloyHost.mkdir(path);
|
|
22
23
|
},
|
|
23
24
|
async visitFile(file) {
|
|
@@ -25,10 +26,10 @@ export async function writeOutput(
|
|
|
25
26
|
const path = resolve(basePath, file.path);
|
|
26
27
|
if (await AlloyHost.exists(path)) {
|
|
27
28
|
// eslint-disable-next-line no-console
|
|
28
|
-
console.log("overwrite", relative(
|
|
29
|
+
console.log("overwrite", relative(cwd(), path));
|
|
29
30
|
} else {
|
|
30
31
|
// eslint-disable-next-line no-console
|
|
31
|
-
console.log("create", relative(
|
|
32
|
+
console.log("create", relative(cwd(), path));
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
await AlloyHost.write(path, file.contents);
|
|
@@ -38,10 +39,10 @@ export async function writeOutput(
|
|
|
38
39
|
const target = resolve(basePath, file.path);
|
|
39
40
|
if (await AlloyHost.exists(target)) {
|
|
40
41
|
// eslint-disable-next-line no-console
|
|
41
|
-
console.log("copy over", relative(
|
|
42
|
+
console.log("copy over", relative(cwd(), target));
|
|
42
43
|
} else {
|
|
43
44
|
// eslint-disable-next-line no-console
|
|
44
|
-
console.log("copy", relative(
|
|
45
|
+
console.log("copy", relative(cwd(), target));
|
|
45
46
|
}
|
|
46
47
|
await AlloyHost.mkdir(dirname(target));
|
|
47
48
|
await AlloyHost.write(target, AlloyHost.read(source).stream());
|