@alloy-js/core 0.23.0-dev.12 → 0.23.0-dev.15
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/api-extractor.json +1 -8
- package/api-extractor.testing.json +19 -0
- package/dist/dev/src/binder.js +108 -1
- package/dist/dev/src/binder.js.map +1 -1
- package/dist/dev/src/components/Block.js +17 -5
- package/dist/dev/src/components/Block.js.map +1 -1
- package/dist/dev/src/components/List.js +1 -1
- package/dist/dev/src/components/List.js.map +1 -1
- package/dist/dev/src/components/MemberDeclaration.js +6 -6
- package/dist/dev/src/components/MemberName.js +7 -0
- package/dist/dev/src/components/MemberName.js.map +1 -1
- package/dist/dev/src/components/MemberScope.js +7 -2
- package/dist/dev/src/components/MemberScope.js.map +1 -1
- package/dist/dev/src/components/Output.js +4 -4
- package/dist/dev/src/components/Output.js.map +1 -1
- package/dist/dev/src/components/Scope.js +7 -1
- package/dist/dev/src/components/Scope.js.map +1 -1
- package/dist/dev/src/components/SourceFile.js +3 -3
- package/dist/dev/src/components/SourceFile.js.map +1 -1
- package/dist/dev/src/context/binder.js +5 -0
- package/dist/dev/src/context/binder.js.map +1 -1
- package/dist/dev/src/context/format-options.js +14 -1
- package/dist/dev/src/context/format-options.js.map +1 -1
- package/dist/dev/src/context/scope.js +5 -0
- package/dist/dev/src/context/scope.js.map +1 -1
- package/dist/dev/src/context/source-directory.js +9 -0
- package/dist/dev/src/context/source-directory.js.map +1 -1
- package/dist/dev/src/debug/cli.js +3 -2
- package/dist/dev/src/debug/cli.js.map +1 -1
- 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/trace.js +7 -6
- package/dist/dev/src/debug/trace.js.map +1 -1
- 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/library-symbol-reference.js +54 -0
- package/dist/dev/src/library-symbol-reference.js.map +1 -1
- package/dist/dev/src/name-policy.js +27 -0
- package/dist/dev/src/name-policy.js.map +1 -1
- package/dist/dev/src/reactivity.js +16 -0
- package/dist/dev/src/reactivity.js.map +1 -1
- package/dist/dev/src/render-stack.js +4 -3
- package/dist/dev/src/render-stack.js.map +1 -1
- package/dist/dev/src/render.js.map +1 -1
- package/dist/dev/src/symbols/output-scope.js +34 -1
- package/dist/dev/src/symbols/output-scope.js.map +1 -1
- package/dist/dev/src/symbols/output-space.js +15 -0
- package/dist/dev/src/symbols/output-space.js.map +1 -1
- package/dist/dev/src/symbols/output-symbol.js +81 -11
- package/dist/dev/src/symbols/output-symbol.js.map +1 -1
- package/dist/dev/src/symbols/symbol-slot.js +7 -0
- package/dist/dev/src/symbols/symbol-slot.js.map +1 -1
- package/dist/dev/src/symbols/symbol-slot.test.js +27 -2
- package/dist/dev/src/symbols/symbol-slot.test.js.map +1 -1
- package/dist/dev/src/write-output.js +6 -5
- package/dist/dev/src/write-output.js.map +1 -1
- package/dist/dev/test/browser-build.test.js +67 -68
- package/dist/dev/test/browser-build.test.js.map +1 -1
- package/dist/dev/testing/create-test-wrapper.js +59 -5
- package/dist/dev/testing/create-test-wrapper.js.map +1 -1
- package/dist/dev/testing/extend-expect.js +20 -0
- package/dist/dev/testing/extend-expect.js.map +1 -1
- package/dist/dev/testing/index.js +1 -1
- package/dist/dev/testing/index.js.map +1 -1
- package/dist/dev/testing/render.js +11 -0
- package/dist/dev/testing/render.js.map +1 -1
- package/dist/src/binder.d.ts +107 -3
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +108 -1
- package/dist/src/binder.js.map +1 -1
- 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/List.d.ts +11 -1
- package/dist/src/components/List.d.ts.map +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/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/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/trace.d.ts.map +1 -1
- package/dist/src/debug/trace.js +7 -6
- 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/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 +15 -0
- package/dist/src/reactivity.d.ts.map +1 -1
- package/dist/src/reactivity.js +16 -0
- 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.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 +93 -12
- package/dist/src/symbols/output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/output-symbol.js +81 -11
- 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/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 +67 -68
- package/dist/test/browser-build.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/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/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 +76 -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 +8 -4
- package/src/binder.ts +107 -3
- package/src/components/Block.tsx +12 -0
- package/src/components/List.tsx +11 -1
- 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/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/source-map.browser.ts +30 -0
- package/src/debug/trace.ts +7 -6
- 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 +15 -0
- package/src/render-stack.ts +4 -3
- package/src/render.ts +2 -0
- package/src/symbols/output-scope.ts +33 -1
- package/src/symbols/output-space.ts +13 -0
- package/src/symbols/output-symbol.ts +93 -12
- package/src/symbols/symbol-slot.test.tsx +28 -1
- package/src/symbols/symbol-slot.tsx +8 -0
- package/src/write-output.ts +6 -5
- package/temp/api-testing.json +673 -0
- package/temp/api.json +48 -47
- package/test/browser-build.test.ts +71 -78
- package/testing/create-test-wrapper.tsx +81 -2
- package/testing/extend-expect.ts +22 -1
- package/testing/index.ts +1 -1
- package/testing/render.ts +9 -0
- package/testing/vitest.d.ts +3 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dirname","relative","resolve","AlloyHost","traverseOutput","writeOutput","output","basePath","visitDirectory","directory","path","exists","console","log","
|
|
1
|
+
{"version":3,"names":["dirname","relative","resolve","AlloyHost","cwd","traverseOutput","writeOutput","output","basePath","visitDirectory","directory","path","exists","console","log","mkdir","visitFile","file","write","contents","source","sourcePath","target","read","stream"],"sources":["../../src/write-output.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,OAAO,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,GAAG,QAAQ,qBAAqB;AAEzC,SAASC,cAAc,QAAQ,YAAY;AAC3C;AACA;AACA;AACA;AACA,OAAO,eAAeC,WAAWA,CAC/BC,MAAuB,EACvBC,QAAgB,GAAG,EAAE,EACrB;EACA,OAAO,MAAMH,cAAc,CAACE,MAAM,E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C;QACnD,CAAC,MAAM;UACL;UACAT,OAAO,CAACC,GAAG,CAAC,MAAM,EAAEb,QAAQ,CAACG,GAAG,CAAC,CAAC,EAAEkB,MAAM,CAAC,CAAC;QAC9C;QACA,MAAMnB,SAAS,CAACY,KAAK,CAACf,OAAO,CAACsB,MAAM,CAAC,CAAC;QACtC,MAAMnB,SAAS,CAACe,KAAK,CAACI,MAAM,EAAEnB,SAAS,CAACoB,IAAI,CAACH,MAAM,CAAC,CAACI,MAAM,CAAC,CAAC,CAAC;MAChE;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,86 +1,85 @@
|
|
|
1
|
-
import { execSync } from "child_process";
|
|
2
1
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
|
3
2
|
import { join } from "path";
|
|
3
|
+
import { build } from "vite";
|
|
4
4
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const tempDir = join(__dirname, ".temp", "browser-build-test");
|
|
6
|
+
const entryFile = join(tempDir, "entry.js");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Bundles `@alloy-js/core` for the browser using Vite and returns
|
|
10
|
+
* the concatenated output code.
|
|
11
|
+
*
|
|
12
|
+
* Uses the `browser` export condition from the package exports map,
|
|
13
|
+
* which resolves to the compiled browser entry. This requires the
|
|
14
|
+
* package to be built first (the CI pipeline and `pnpm build` handle
|
|
15
|
+
* this automatically).
|
|
16
|
+
*/
|
|
17
|
+
async function bundleForBrowser() {
|
|
18
|
+
const result = await build({
|
|
19
|
+
configFile: false,
|
|
20
|
+
logLevel: "silent",
|
|
21
|
+
resolve: {
|
|
22
|
+
conditions: ["browser", "import"]
|
|
23
|
+
},
|
|
24
|
+
// Disable automatic process.env replacement so we can detect leaks
|
|
25
|
+
define: {},
|
|
26
|
+
build: {
|
|
27
|
+
write: false,
|
|
28
|
+
minify: false,
|
|
29
|
+
rollupOptions: {
|
|
30
|
+
input: entryFile,
|
|
31
|
+
output: {
|
|
32
|
+
format: "es"
|
|
33
|
+
},
|
|
34
|
+
// Disable tree-shaking so we catch process.* references in ANY
|
|
35
|
+
// code path, even if it would be removed in a production build.
|
|
36
|
+
treeshake: false,
|
|
37
|
+
external: id => {
|
|
38
|
+
// Bundle @alloy-js packages — these are what we're validating
|
|
39
|
+
if (id.startsWith("@alloy-js/")) return false;
|
|
40
|
+
// Bundle relative/absolute imports (intra-package)
|
|
41
|
+
if (id.startsWith(".") || id.startsWith("/")) return false;
|
|
42
|
+
// Externalize third-party deps (vue, pathe, picocolors, …)
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const output = Array.isArray(result) ? result[0] : result;
|
|
49
|
+
const chunks = output.output.filter(o => o.type === "chunk");
|
|
50
|
+
return chunks.map(c => c.code).join("\n");
|
|
51
|
+
}
|
|
52
|
+
describe("browser build", () => {
|
|
7
53
|
beforeAll(() => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
rmSync(testDir, {
|
|
54
|
+
if (existsSync(tempDir)) {
|
|
55
|
+
rmSync(tempDir, {
|
|
11
56
|
recursive: true,
|
|
12
57
|
force: true
|
|
13
58
|
});
|
|
14
59
|
}
|
|
15
|
-
|
|
16
|
-
// Create a temporary Vite project
|
|
17
|
-
mkdirSync(testDir, {
|
|
60
|
+
mkdirSync(tempDir, {
|
|
18
61
|
recursive: true
|
|
19
62
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
execSync("npm install vite", {
|
|
24
|
-
cwd: testDir
|
|
25
|
-
});
|
|
26
|
-
execSync("npm install ../../..", {
|
|
27
|
-
cwd: testDir
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Create a minimal Vite app
|
|
31
|
-
writeFileSync(join(testDir, "index.js"), `
|
|
32
|
-
import { writeOutput } from "@alloy-js/core";
|
|
33
|
-
console.log("Alloy-js core imported successfully!", writeOutput);
|
|
34
|
-
`);
|
|
35
|
-
writeFileSync(join(testDir, "vite.config.js"), `
|
|
36
|
-
import { defineConfig } from "vite";
|
|
37
|
-
|
|
38
|
-
export default defineConfig({
|
|
39
|
-
build: {
|
|
40
|
-
outDir: "dist",
|
|
41
|
-
target: "esnext",
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
`);
|
|
45
|
-
|
|
46
|
-
// Create an index.html file
|
|
47
|
-
writeFileSync(join(testDir, "index.html"), `
|
|
48
|
-
<!DOCTYPE html>
|
|
49
|
-
<html lang="en">
|
|
50
|
-
<head>
|
|
51
|
-
<meta charset="UTF-8">
|
|
52
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
53
|
-
<title>Vite Test</title>
|
|
54
|
-
</head>
|
|
55
|
-
<body>
|
|
56
|
-
<script type="module" src="/index.js"></script>
|
|
57
|
-
</body>
|
|
58
|
-
</html>
|
|
59
|
-
`);
|
|
60
|
-
writeFileSync(join(testDir, "package.json"), JSON.stringify({
|
|
61
|
-
type: "module",
|
|
62
|
-
scripts: {
|
|
63
|
-
build: "vite build"
|
|
64
|
-
}
|
|
65
|
-
}, null, 2));
|
|
66
|
-
}, 30_000);
|
|
67
|
-
it("Vite should build successfully", () => {
|
|
68
|
-
// Run Vite build process and wait for completion
|
|
69
|
-
expect(() => {
|
|
70
|
-
execSync("npm run build", {
|
|
71
|
-
cwd: testDir,
|
|
72
|
-
stdio: "inherit"
|
|
73
|
-
});
|
|
74
|
-
}).not.toThrow();
|
|
75
|
-
}, 10000);
|
|
63
|
+
writeFileSync(entryFile, 'export * from "@alloy-js/core";\n');
|
|
64
|
+
});
|
|
76
65
|
afterAll(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
rmSync(testDir, {
|
|
66
|
+
if (existsSync(tempDir)) {
|
|
67
|
+
rmSync(tempDir, {
|
|
80
68
|
recursive: true,
|
|
81
69
|
force: true
|
|
82
70
|
});
|
|
83
71
|
}
|
|
84
72
|
});
|
|
73
|
+
it("should bundle for browser without Node.js polyfills", async () => {
|
|
74
|
+
const code = await bundleForBrowser();
|
|
75
|
+
|
|
76
|
+
// The browser bundle must not reference the Node.js `process` global.
|
|
77
|
+
// If this fails, a file is using process.env / process.cwd / etc.
|
|
78
|
+
// without going through host/node-host.ts (or another browser-overridden module).
|
|
79
|
+
expect(code).not.toMatch(/\bprocess\./);
|
|
80
|
+
|
|
81
|
+
// Should not contain static require("node:…") calls
|
|
82
|
+
expect(code).not.toMatch(/require\(\s*["']node:/);
|
|
83
|
+
}, 30_000);
|
|
85
84
|
});
|
|
86
85
|
//# sourceMappingURL=browser-build.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["existsSync","mkdirSync","rmSync","writeFileSync","join","build","afterAll","beforeAll","describe","expect","it","tempDir","__dirname","entryFile","bundleForBrowser","result","configFile","logLevel","resolve","conditions","define","write","minify","rollupOptions","input","output","format","treeshake","external","id","startsWith","Array","isArray","chunks","filter","o","type","map","c","code","recursive","force","not","toMatch"],"sources":["../../test/browser-build.test.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,aAAa,QAAQ,IAAI;AACjE,SAASC,IAAI,QAAQ,MAAM;AAC3B,SAASC,KAAK,QAAuB,MAAM;AAC3C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAElE,MAAMC,OAAO,GAAGP,IAAI,CAACQ,SAAS,EAAE,OAAO,EAAE,oBAAoB,CAAC;AAC9D,MAAMC,SAAS,GAAGT,IAAI,CAACO,OAAO,EAAE,UAAU,CAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeG,gBAAgBA,CAAA,EAAoB;EACjD,MAAMC,MAAM,GAAG,MAAMV,KAAK,CAAC;IACzBW,UAAU,EA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IACvCrC,aAAa,CAACU,SAAS,EAAE,mCAAmC,CAAC;EAC/D,CAAC,CAAC;EAEFP,QAAQ,CAAC,MAAM;IACb,IAAIN,UAAU,CAACW,OAAO,CAAC,EAAE;MACvBT,MAAM,CAACS,OAAO,EAAE;QAAE6B,SAAS,EAAE,IAAI;QAAEC,KAAK,EAAE;MAAK,CAAC,CAAC;IACnD;EACF,CAAC,CAAC;EAEF/B,EAAE,CAAC,qDAAqD,EAAE,YAAY;IACpE,MAAM6B,IAAI,GAAG,MAAMzB,gBAAgB,CAAC,CAAC;;IAErC;IACA;IACA;IACAL,MAAM,CAAC8B,IAAI,CAAC,CAACG,GAAG,CAACC,OAAO,CAAC,aAAa,CAAC;;IAEvC;IACAlC,MAAM,CAAC8B,IAAI,CAAC,CAACG,GAAG,CAACC,OAAO,CAAC,uBAAuB,CAAC;EACnD,CAAC,EAAE,MAAM,CAAC;AACZ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,12 +1,83 @@
|
|
|
1
|
-
import { Children, Namekey, OutputSymbol } from "../src/index.js";
|
|
1
|
+
import { Children, NameConflictResolver, Namekey, NamePolicy, OutputSymbol } from "../src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Test harness returned by {@link createTestWrapper}.
|
|
4
|
+
*/
|
|
2
5
|
export interface TestWrapper {
|
|
6
|
+
/**
|
|
7
|
+
* JSX wrapper providing Output + a file-level component + language scope context.
|
|
8
|
+
* Name policy is applied only when `namePolicy`/`nameConflictResolver` are
|
|
9
|
+
* passed to {@link createTestWrapper}. Pre-declares all namekeys created by
|
|
10
|
+
* {@link TestWrapper.defkey} before rendering children.
|
|
11
|
+
*/
|
|
3
12
|
Wrapper: (props: {
|
|
4
13
|
children: Children;
|
|
5
14
|
}) => Children;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a stable `Namekey` and schedules a pre-declaration inside
|
|
17
|
+
* {@link TestWrapper.Wrapper}.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Call `defkey(name)` before rendering. `Wrapper` renders
|
|
21
|
+
* `<Declaration symbol={...} />` for this name so `<Reference>` to the
|
|
22
|
+
* returned namekey resolves without requiring an explicit `<Declaration>`
|
|
23
|
+
* in the test body.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const { Wrapper, defkey } = createTestWrapper(...);
|
|
28
|
+
* const fooKey = defkey("foo");
|
|
29
|
+
* expect(
|
|
30
|
+
* <Wrapper><MyComponent refkey={fooKey} /></Wrapper>
|
|
31
|
+
* ).toRenderTo(`foo`);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
6
34
|
defkey: (name: string) => Namekey;
|
|
7
35
|
}
|
|
8
36
|
/**
|
|
9
|
-
*
|
|
37
|
+
* Create a reusable test harness for a language package. Returns a `Wrapper`
|
|
38
|
+
* component (wraps content in `<Output>` + `<SourceFile>`) and a `defkey`
|
|
39
|
+
* helper that creates stable namekeys for pre-declaring symbols.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
*
|
|
43
|
+
* Downstream consumers import and call this from the language package's
|
|
44
|
+
* `testing/` entrypoint. The `Wrapper` automatically declares symbols
|
|
45
|
+
* created by `defkey` before rendering children, so tests can reference
|
|
46
|
+
* symbols without explicit `<Declaration>` boilerplate.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* // In your language package's testing/ entrypoint:
|
|
51
|
+
* import { FileComponent } from "./components/index.js"; // your language package's top-level file component
|
|
52
|
+
* import { createTestWrapper, type TestWrapper } from "@alloy-js/core/testing";
|
|
53
|
+
*
|
|
54
|
+
* export function createMyLangTestWrapper(): TestWrapper {
|
|
55
|
+
* return createTestWrapper({
|
|
56
|
+
* filePath: "test.ext",
|
|
57
|
+
* useScope: useMyLangScope,
|
|
58
|
+
* makeSymbol: (nk, scope) => new MyOutputSymbol(nk, scope),
|
|
59
|
+
* SourceFile: FileComponent,
|
|
60
|
+
* });
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* // Extend your language test factory to accept and forward namePolicy:
|
|
67
|
+
* export function createMyLangTestWrapper(namePolicy?: NamePolicy<string>): TestWrapper {
|
|
68
|
+
* return createTestWrapper({ ...langOpts, namePolicy });
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* // In a name-policy test:
|
|
72
|
+
* const { Wrapper } = createMyLangTestWrapper(myNamePolicy);
|
|
73
|
+
* const fooKey = namekey("foo"); // namekey(), not defkey — name policy applies
|
|
74
|
+
* // namekey() schedules no pre-declaration; the test body must declare the symbol.
|
|
75
|
+
* expect(
|
|
76
|
+
* <Wrapper>
|
|
77
|
+
* <MyDeclaration refkey={fooKey} name="foo" />
|
|
78
|
+
* </Wrapper>
|
|
79
|
+
* ).toRenderTo("FOO");
|
|
80
|
+
* ```
|
|
10
81
|
*/
|
|
11
82
|
export declare function createTestWrapper<SymbolT extends OutputSymbol, ScopeT extends {
|
|
12
83
|
spaces: any;
|
|
@@ -18,5 +89,7 @@ export declare function createTestWrapper<SymbolT extends OutputSymbol, ScopeT e
|
|
|
18
89
|
path: string;
|
|
19
90
|
children: Children;
|
|
20
91
|
}) => any;
|
|
92
|
+
namePolicy?: NamePolicy<string>;
|
|
93
|
+
nameConflictResolver?: NameConflictResolver;
|
|
21
94
|
}): TestWrapper;
|
|
22
95
|
//# sourceMappingURL=create-test-wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-test-wrapper.d.ts","sourceRoot":"","sources":["../../testing/create-test-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGR,OAAO,
|
|
1
|
+
{"version":3,"file":"create-test-wrapper.d.ts","sourceRoot":"","sources":["../../testing/create-test-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGR,oBAAoB,EACpB,OAAO,EAEP,UAAU,EAEV,YAAY,EAEb,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE,KAAK,QAAQ,CAAC;IAErD;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,SAAS,YAAY,EAC5B,MAAM,SAAS;IAAE,MAAM,EAAE,GAAG,CAAA;CAAE,EAC9B,IAAI,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACnC,UAAU,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACpD,UAAU,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,KAAK,GAAG,CAAC;IACjE,UAAU,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,GAAG,WAAW,CA6Cd"}
|
|
@@ -1,7 +1,55 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Declaration, For, namekey, Output, shallowReactive } from "../src/index.js";
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Test harness returned by {@link createTestWrapper}.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Create a reusable test harness for a language package. Returns a `Wrapper`
|
|
10
|
+
* component (wraps content in `<Output>` + `<SourceFile>`) and a `defkey`
|
|
11
|
+
* helper that creates stable namekeys for pre-declaring symbols.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
*
|
|
15
|
+
* Downstream consumers import and call this from the language package's
|
|
16
|
+
* `testing/` entrypoint. The `Wrapper` automatically declares symbols
|
|
17
|
+
* created by `defkey` before rendering children, so tests can reference
|
|
18
|
+
* symbols without explicit `<Declaration>` boilerplate.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // In your language package's testing/ entrypoint:
|
|
23
|
+
* import { FileComponent } from "./components/index.js"; // your language package's top-level file component
|
|
24
|
+
* import { createTestWrapper, type TestWrapper } from "@alloy-js/core/testing";
|
|
25
|
+
*
|
|
26
|
+
* export function createMyLangTestWrapper(): TestWrapper {
|
|
27
|
+
* return createTestWrapper({
|
|
28
|
+
* filePath: "test.ext",
|
|
29
|
+
* useScope: useMyLangScope,
|
|
30
|
+
* makeSymbol: (nk, scope) => new MyOutputSymbol(nk, scope),
|
|
31
|
+
* SourceFile: FileComponent,
|
|
32
|
+
* });
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* // Extend your language test factory to accept and forward namePolicy:
|
|
39
|
+
* export function createMyLangTestWrapper(namePolicy?: NamePolicy<string>): TestWrapper {
|
|
40
|
+
* return createTestWrapper({ ...langOpts, namePolicy });
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* // In a name-policy test:
|
|
44
|
+
* const { Wrapper } = createMyLangTestWrapper(myNamePolicy);
|
|
45
|
+
* const fooKey = namekey("foo"); // namekey(), not defkey — name policy applies
|
|
46
|
+
* // namekey() schedules no pre-declaration; the test body must declare the symbol.
|
|
47
|
+
* expect(
|
|
48
|
+
* <Wrapper>
|
|
49
|
+
* <MyDeclaration refkey={fooKey} name="foo" />
|
|
50
|
+
* </Wrapper>
|
|
51
|
+
* ).toRenderTo("FOO");
|
|
52
|
+
* ```
|
|
5
53
|
*/
|
|
6
54
|
export function createTestWrapper(opts) {
|
|
7
55
|
const seen = shallowReactive(new Map());
|
|
@@ -30,6 +78,12 @@ export function createTestWrapper(opts) {
|
|
|
30
78
|
function Wrapper(props) {
|
|
31
79
|
const SF = opts.SourceFile;
|
|
32
80
|
return _$createComponent(Output, {
|
|
81
|
+
get namePolicy() {
|
|
82
|
+
return opts.namePolicy;
|
|
83
|
+
},
|
|
84
|
+
get nameConflictResolver() {
|
|
85
|
+
return opts.nameConflictResolver;
|
|
86
|
+
},
|
|
33
87
|
get children() {
|
|
34
88
|
return _$createComponent(SF, {
|
|
35
89
|
get path() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Declaration","For","namekey","Output","shallowReactive","createTestWrapper","opts","seen","Map","created","defkey","name","existing","get","nk","ignoreNamePolicy","ignoreNameConflict","set","createSymbol","scope","useScope","Error","sym","makeSymbol","Wrapper","props","SF","SourceFile","_$createComponent","children","path","filePath","each","values","joiner","symbol","_$memo"],"sources":["../../testing/create-test-wrapper.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAEEA,WAAW,EACXC,GAAG,
|
|
1
|
+
{"version":3,"names":["Declaration","For","namekey","Output","shallowReactive","createTestWrapper","opts","seen","Map","created","defkey","name","existing","get","nk","ignoreNamePolicy","ignoreNameConflict","set","createSymbol","scope","useScope","Error","sym","makeSymbol","Wrapper","props","SF","SourceFile","_$createComponent","namePolicy","nameConflictResolver","children","path","filePath","each","values","joiner","symbol","_$memo"],"sources":["../../testing/create-test-wrapper.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAEEA,WAAW,EACXC,GAAG,EAGHC,OAAO,EAEPC,MAAM,EAENC,eAAe,QACV,iBAAiB;;AAExB;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AUA,CAAA;QAAA,OAAEvB,IAAI,CAACuB,UAAU;MAAA;MAAA,IAC3BC,oBAAoBA,CAAA;QAAA,OAAExB,IAAI,CAACwB,oBAAoB;MAAA;MAAA,IAAAC,SAAA;QAAA,OAAAH,iBAAA,CAE9CF,EAAE;UAAA,IAACM,IAAIA,CAAA;YAAA,OAAE1B,IAAI,CAAC2B,QAAQ;UAAA;UAAA,IAAAF,SAAA;YAAA,QAAAH,iBAAA,CACpB3B,GAAG;cAAA,IAACiC,IAAIA,CAAA;gBAAA,OAAE,CAAC,GAAG3B,IAAI,CAAC4B,MAAM,CAAC,CAAC,CAAC;cAAA;cAAEC,MAAM;cAAAL,QAAA,EACjCjB,EAAE,IAAAc,iBAAA,CAAM5B,WAAW;gBAAA,IAACqC,MAAMA,CAAA;kBAAA,OAAEnB,YAAY,CAACJ,EAAE,CAAC;gBAAA;cAAA;YAAI,IAAAwB,MAAA,OAEnDb,KAAK,CAACM,QAAQ;UAAA;QAAA;MAAA;IAAA;EAIvB;EAEA,OAAO;IAAEP,OAAO;IAAEd;EAAO,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -1,2 +1,28 @@
|
|
|
1
1
|
import "vitest";
|
|
2
|
+
/**
|
|
3
|
+
* Print options passed to `toRenderTo` / `toRenderToAsync`. These override
|
|
4
|
+
* the per-`SourceFile` print settings for the duration of the assertion,
|
|
5
|
+
* which is useful when forcing line-breaking with a narrow `printWidth` in
|
|
6
|
+
* tests without needing extremely long inputs.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* expect(<MyList items={["a", "b", "c"]} />).toRenderTo(
|
|
11
|
+
* `
|
|
12
|
+
* a,
|
|
13
|
+
* b,
|
|
14
|
+
* c
|
|
15
|
+
* `,
|
|
16
|
+
* { printWidth: 10 }
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export interface ToRenderToOptions {
|
|
21
|
+
/** Maximum line width before the formatter wraps output. */
|
|
22
|
+
printWidth?: number;
|
|
23
|
+
/** Number of spaces per indentation level. */
|
|
24
|
+
tabWidth?: number;
|
|
25
|
+
/** Use tab characters instead of spaces. */
|
|
26
|
+
useTabs?: boolean;
|
|
27
|
+
}
|
|
2
28
|
//# sourceMappingURL=extend-expect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend-expect.d.ts","sourceRoot":"","sources":["../../testing/extend-expect.ts"],"names":[],"mappings":"AASA,OAAO,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"extend-expect.d.ts","sourceRoot":"","sources":["../../testing/extend-expect.ts"],"names":[],"mappings":"AASA,OAAO,QAAQ,CAAC;AAKhB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -3,6 +3,26 @@ import "vitest";
|
|
|
3
3
|
import { expect } from "vitest";
|
|
4
4
|
import { flushJobs, flushJobsAsync } from "../src/scheduler.js";
|
|
5
5
|
import { dedent } from "./render.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Print options passed to `toRenderTo` / `toRenderToAsync`. These override
|
|
9
|
+
* the per-`SourceFile` print settings for the duration of the assertion,
|
|
10
|
+
* which is useful when forcing line-breaking with a narrow `printWidth` in
|
|
11
|
+
* tests without needing extremely long inputs.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* expect(<MyList items={["a", "b", "c"]} />).toRenderTo(
|
|
16
|
+
* `
|
|
17
|
+
* a,
|
|
18
|
+
* b,
|
|
19
|
+
* c
|
|
20
|
+
* `,
|
|
21
|
+
* { printWidth: 10 }
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
|
|
6
26
|
expect.extend({
|
|
7
27
|
toRenderTo(received, expectedRaw, renderOptions) {
|
|
8
28
|
const tree = renderTree(received);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getContextForRenderNode","getDiagnosticsForTree","printTree","renderTree","expect","flushJobs","flushJobsAsync","dedent","extend","toRenderTo","received","expectedRaw","renderOptions","tree","actual","getFilesFromTree","validateRender","isNot","toRenderToAsync","toHaveDiagnostics","expectedDiagnostics","diagnostics","validateDiagnostics","toHaveDiagnosticsAsync","isAsymmetricMatcher","value","$$typeof","Symbol","for","message","expected","actualStr","Object","keys","length","values","pass","dedentExpected","key","entries","every","asymmetricMatch","map","d","severity","i","actualDiag","expectedDiag","messageMatches","RegExp","test","undefined","options","files","collectSourceFiles","root","Array","isArray","context","meta","sourceFile","path","printWidth","printOptions","tabWidth","useTabs","visitChildren","child"],"sources":["../../testing/extend-expect.ts"],"sourcesContent":[null],"mappings":"AAAA,SAGEA,uBAAuB,EACvBC,qBAAqB,EACrBC,SAAS,EAETC,UAAU,QACL,gBAAgB;AACvB,OAAO,QAAQ;AACf,SAASC,MAAM,QAAQ,QAAQ;AAC/B,SAASC,SAAS,EAAEC,cAAc,QAAQ,qBAAqB;AAC/D,SAASC,MAAM,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"names":["getContextForRenderNode","getDiagnosticsForTree","printTree","renderTree","expect","flushJobs","flushJobsAsync","dedent","extend","toRenderTo","received","expectedRaw","renderOptions","tree","actual","getFilesFromTree","validateRender","isNot","toRenderToAsync","toHaveDiagnostics","expectedDiagnostics","diagnostics","validateDiagnostics","toHaveDiagnosticsAsync","isAsymmetricMatcher","value","$$typeof","Symbol","for","message","expected","actualStr","Object","keys","length","values","pass","dedentExpected","key","entries","every","asymmetricMatch","map","d","severity","i","actualDiag","expectedDiag","messageMatches","RegExp","test","undefined","options","files","collectSourceFiles","root","Array","isArray","context","meta","sourceFile","path","printWidth","printOptions","tabWidth","useTabs","visitChildren","child"],"sources":["../../testing/extend-expect.ts"],"sourcesContent":[null],"mappings":"AAAA,SAGEA,uBAAuB,EACvBC,qBAAqB,EACrBC,SAAS,EAETC,UAAU,QACL,gBAAgB;AACvB,OAAO,QAAQ;AACf,SAASC,MAAM,QAAQ,QAAQ;AAC/B,SAASC,SAAS,EAAEC,cAAc,QAAQ,qBAAqB;AAC/D,SAASC,MAAM,QAAQ,aAAa;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeAH,MAAM,CAACI,MAAM,CAAC;EACZC,UAAUA,CACRC,QAAkB,EAClBC,WAA4C,EAC5CC,aAAiC,EACjC;IACA,MAAMC,IAAI,GAAGV,UAAU,CAACO,QAAQ,CAAC;IACjCL,SAAS,CAAC,CAAC;IACX,MAAMS,MAAM,GAAGC,gBAAgB,CAACF,IAAI,EAAED,aAAa,CAAC;IAEpD,OAAOI,cAAc,CAACF,MAAM,EAAEH,WAAW,EAAE,IAAI,CAACM,KAAK,CAAC;EACxD,CAAC;EACD,MAAMC,eAAeA,CACnBR,QAAkB,EAClBC,WAA4C,EAC5CC,aAAiC,EACjC;IACA,MAAMC,IAAI,GAAGV,UAAU,CAACO,QAAQ,CAAC;IACjC,MAAMJ,cAAc,CAAC,CAAC;IACtB,MAAMQ,MAAM,GAAGC,gBAAgB,CAACF,IAAI,EAAED,aAAa,CAAC;IACpD,OAAOI,cAAc,CAACF,MAAM,EAAEH,WAAW,EAAE,IAAI,CAACM,KAAK,CAAC;EACxD,CAAC;EACDE,iBAAiBA,CACfT,QAAkB,EAClBU,mBAAyC,EACzC;IACA,MAAMP,IAAI,GAAGV,UAAU,CAACO,QAAQ,CAAC;IACjCL,SAAS,CAAC,CAAC;IACX,MAAMgB,WAAW,GAAGpB,qBAAqB,CAACY,IAAI,CAAC;IAC/C,OAAOS,mBAAmB,CAACD,WAAW,EAAED,mBAAmB,EAAE,IA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AAU;QAC/DE,QAAQ,EAAEZ,OAAO,EAAEY,QAAQ,IAAIN,OAAO,CAACC,IAAI,EAAEI,YAAY,EAAEC,QAAQ;QACnEC,OAAO,EAAEb,OAAO,EAAEa,OAAO,IAAIP,OAAO,CAACC,IAAI,EAAEI,YAAY,EAAEE;MAC3D,CAAC,CAAC;IACJ,CAAC,MAAM;MACLC,aAAa,CAAC,CAAC;IACjB;IAEA,SAASA,aAAaA,CAAA,EAAG;MACvB,KAAK,MAAMC,KAAK,IAAIZ,IAAI,EAAE;QACxBD,kBAAkB,CAACa,KAAyB,CAAC;MAC/C;IACF;EACF;AACF","ignoreList":[]}
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../testing/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../testing/index.ts"],"sourcesContent":[null],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"names":[],"sources":["../../testing/index.ts"],"sourcesContent":[null],"mappings":"AAAA;AACA,cAAc,oBAAoB;AAClC,cAAc,aAAa","ignoreList":[]}
|
package/dist/testing/render.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Children } from "../src/index.js";
|
|
2
2
|
export { printTree } from "../src/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Render a JSX element tree to a string. Convenience wrapper combining
|
|
5
|
+
* `renderTree` and `printTree`.
|
|
6
|
+
*/
|
|
3
7
|
export declare function renderToString(element: Children): string;
|
|
8
|
+
/**
|
|
9
|
+
* Dedented template literal tag. Strips leading/trailing blank lines and
|
|
10
|
+
* removes the common leading whitespace from all lines — useful for
|
|
11
|
+
* multi-line expected output in tests.
|
|
12
|
+
*/
|
|
4
13
|
export declare function d(strings: TemplateStringsArray, ...values: any[]): string;
|
|
5
14
|
export declare function dedent(str: string): string;
|
|
6
15
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../testing/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyB,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wBAAgB,cAAc,CAAC,OAAO,EAAE,QAAQ,UAE/C;AAED,wBAAgB,CAAC,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAQzE;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAe1C"}
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../testing/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyB,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,QAAQ,UAE/C;AAED;;;;GAIG;AACH,wBAAgB,CAAC,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAQzE;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAe1C"}
|
package/dist/testing/render.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { printTree, renderTree } from "../src/index.js";
|
|
2
2
|
export { printTree } from "../src/index.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Render a JSX element tree to a string. Convenience wrapper combining
|
|
6
|
+
* `renderTree` and `printTree`.
|
|
7
|
+
*/
|
|
3
8
|
export function renderToString(element) {
|
|
4
9
|
return printTree(renderTree(element));
|
|
5
10
|
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Dedented template literal tag. Strips leading/trailing blank lines and
|
|
14
|
+
* removes the common leading whitespace from all lines — useful for
|
|
15
|
+
* multi-line expected output in tests.
|
|
16
|
+
*/
|
|
6
17
|
export function d(strings, ...values) {
|
|
7
18
|
// Combine the strings and values
|
|
8
19
|
const result = strings.reduce((acc, str, i) => acc + str + (values[i] ?? ""), "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["printTree","renderTree","renderToString","element","d","strings","values","result","reduce","acc","str","i","dedent","replace","match","indent","dedented","split","map","line","startsWith","slice","length","join"],"sources":["../../testing/render.ts"],"sourcesContent":[null],"mappings":"AAAA,SAAmBA,SAAS,EAAEC,UAAU,QAAQ,iBAAiB;AAEjE,SAASD,SAAS,QAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"names":["printTree","renderTree","renderToString","element","d","strings","values","result","reduce","acc","str","i","dedent","replace","match","indent","dedented","split","map","line","startsWith","slice","length","join"],"sources":["../../testing/render.ts"],"sourcesContent":[null],"mappings":"AAAA,SAAmBA,SAAS,EAAEC,UAAU,QAAQ,iBAAiB;AAEjE,SAASD,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA;AACA,OAAO,SAASE,cAAcA,CAACC,OAAiB,EAAE;EAChD,OAAOH,SAAS,CAACC,UAAU,CAACE,OAAO,CAAC,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,CAACA,CAACC,OAA6B,EAAE,GAAGC,MAAa,EAAU;EACzE;EACA,MAAMC,MAAM,GAAGF,OAAO,CAACG,MAAM,CAC3B,CAACC,GAAG,EAAEC,GAAG,EAAEC,CAAC,KAAKF,GAAG,GAAGC,GAAG,IAAIJ,MAAM,CAACK,CAAC,CAAC,IAAI,EAAE,CAAC,EAC9C,EACF,CAAC;EAED,OAAOC,MAAM,CAACL,MAAM,CAAC;AACvB;AAEA,OAAO,SAASK,MAAMA,CAACF,GAAW,EAAU;EAC1C;EACAA,GAAG,GAAGA,GAAG,CAACG,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;;EAErC;EACA,MAAMC,KAAK,GAAGJ,GAAG,CAACI,KAAK,CAAC,SAAS,CAAC;EAClC,MAAMC,MAAM,GAAGD,KAAK,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;;EAEpC;EACA,MAAME,QAAQ,GAAGN,GAAG,CACjBO,KAAK,CAAC,IAAI,CAAC,CACXC,GAAG,CAAEC,IAAI,IAAMA,IAAI,CAACC,UAAU,CAACL,MAAM,CAAC,GAAGI,IAAI,CAACE,KAAK,CAACN,MAAM,CAACO,MAAM,CAAC,GAAGH,IAAK,CAAC,CAC3EI,IAAI,CAAC,IAAI,CAAC;EAEb,OAAOP,QAAQ;AACjB","ignoreList":[]}
|