@alloy-js/core 0.20.0-dev.6 → 0.20.0-dev.8
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/src/binder.d.ts +12 -0
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +22 -1
- package/dist/src/binder.js.map +1 -0
- package/dist/src/code.js +2 -1
- package/dist/src/code.js.map +1 -0
- package/dist/src/components/AppendFile.js +2 -1
- package/dist/src/components/AppendFile.js.map +1 -0
- package/dist/src/components/Block.js +2 -1
- package/dist/src/components/Block.js.map +1 -0
- package/dist/src/components/CopyFile.js +2 -1
- package/dist/src/components/CopyFile.js.map +1 -0
- package/dist/src/components/Declaration.js +2 -1
- package/dist/src/components/Declaration.js.map +1 -0
- package/dist/src/components/For.js +2 -1
- package/dist/src/components/For.js.map +1 -0
- package/dist/src/components/Indent.js +2 -1
- package/dist/src/components/Indent.js.map +1 -0
- package/dist/src/components/List.js +2 -1
- package/dist/src/components/List.js.map +1 -0
- package/dist/src/components/MemberDeclaration.js +2 -1
- package/dist/src/components/MemberDeclaration.js.map +1 -0
- package/dist/src/components/MemberName.js +2 -1
- package/dist/src/components/MemberName.js.map +1 -0
- package/dist/src/components/MemberScope.js +2 -1
- package/dist/src/components/MemberScope.js.map +1 -0
- package/dist/src/components/Name.js +2 -1
- package/dist/src/components/Name.js.map +1 -0
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.js +18 -13
- package/dist/src/components/Output.js.map +1 -0
- package/dist/src/components/Prose.js +2 -1
- package/dist/src/components/Prose.js.map +1 -0
- package/dist/src/components/ReferenceOrContent.js +2 -1
- package/dist/src/components/ReferenceOrContent.js.map +1 -0
- package/dist/src/components/Scope.js +2 -1
- package/dist/src/components/Scope.js.map +1 -0
- package/dist/src/components/Show.js +2 -1
- package/dist/src/components/Show.js.map +1 -0
- package/dist/src/components/SourceDirectory.js +2 -1
- package/dist/src/components/SourceDirectory.js.map +1 -0
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +5 -3
- package/dist/src/components/SourceFile.js.map +1 -0
- package/dist/src/components/StatementList.js +2 -1
- package/dist/src/components/StatementList.js.map +1 -0
- package/dist/src/components/Switch.js +2 -1
- package/dist/src/components/Switch.js.map +1 -0
- package/dist/src/components/TemplateFile.js +2 -1
- package/dist/src/components/TemplateFile.js.map +1 -0
- package/dist/src/components/UpdateFile.js +2 -1
- package/dist/src/components/UpdateFile.js.map +1 -0
- package/dist/src/components/Wrap.js +2 -1
- package/dist/src/components/Wrap.js.map +1 -0
- package/dist/src/components/index.js +2 -1
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/stc/index.js +2 -1
- package/dist/src/components/stc/index.js.map +1 -0
- package/dist/src/components/stc/sti.js +2 -1
- package/dist/src/components/stc/sti.js.map +1 -0
- package/dist/src/context/assignment.js +2 -1
- package/dist/src/context/assignment.js.map +1 -0
- package/dist/src/context/binder.js +2 -1
- package/dist/src/context/binder.js.map +1 -0
- package/dist/src/context/declaration.js +2 -1
- package/dist/src/context/declaration.js.map +1 -0
- package/dist/src/context/format-options.d.ts +21 -0
- package/dist/src/context/format-options.d.ts.map +1 -0
- package/dist/src/context/format-options.js +32 -0
- package/dist/src/context/format-options.js.map +1 -0
- package/dist/src/context/index.d.ts +1 -0
- package/dist/src/context/index.d.ts.map +1 -1
- package/dist/src/context/index.js +3 -1
- package/dist/src/context/index.js.map +1 -0
- package/dist/src/context/member-declaration.js +2 -1
- package/dist/src/context/member-declaration.js.map +1 -0
- package/dist/src/context/member-scope.js +2 -1
- package/dist/src/context/member-scope.js.map +1 -0
- package/dist/src/context/name-policy.js +2 -1
- package/dist/src/context/name-policy.js.map +1 -0
- package/dist/src/context/scope.js +2 -1
- package/dist/src/context/scope.js.map +1 -0
- package/dist/src/context/source-directory.js +2 -1
- package/dist/src/context/source-directory.js.map +1 -0
- package/dist/src/context/source-file.js +2 -1
- package/dist/src/context/source-file.js.map +1 -0
- package/dist/src/context.js +2 -1
- package/dist/src/context.js.map +1 -0
- package/dist/src/debug.js +2 -1
- package/dist/src/debug.js.map +1 -0
- package/dist/src/host/alloy-host.browser.js +2 -1
- package/dist/src/host/alloy-host.browser.js.map +1 -0
- package/dist/src/host/alloy-host.js +2 -1
- package/dist/src/host/alloy-host.js.map +1 -0
- package/dist/src/host/interface.js +2 -1
- package/dist/src/host/interface.js.map +1 -0
- package/dist/src/index.browser.js +2 -1
- package/dist/src/index.browser.js.map +1 -0
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -0
- package/dist/src/inspect.browser.js +2 -1
- package/dist/src/inspect.browser.js.map +1 -0
- package/dist/src/inspect.js +2 -1
- package/dist/src/inspect.js.map +1 -0
- package/dist/src/jsx-runtime.js +2 -1
- package/dist/src/jsx-runtime.js.map +1 -0
- package/dist/src/name-policy.js +2 -1
- package/dist/src/name-policy.js.map +1 -0
- package/dist/src/props-combinators.js +2 -1
- package/dist/src/props-combinators.js.map +1 -0
- package/dist/src/reactive-union-set.js +2 -1
- package/dist/src/reactive-union-set.js.map +1 -0
- package/dist/src/reactivity.js +2 -1
- package/dist/src/reactivity.js.map +1 -0
- package/dist/src/refkey.d.ts +1 -1
- package/dist/src/refkey.d.ts.map +1 -1
- package/dist/src/refkey.js +15 -4
- package/dist/src/refkey.js.map +1 -0
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +5 -7
- package/dist/src/render.js.map +1 -0
- package/dist/src/resource.js +2 -1
- package/dist/src/resource.js.map +1 -0
- package/dist/src/runtime/component.js +2 -1
- package/dist/src/runtime/component.js.map +1 -0
- package/dist/src/runtime/intrinsic.js +2 -1
- package/dist/src/runtime/intrinsic.js.map +1 -0
- package/dist/src/scheduler.js +2 -1
- package/dist/src/scheduler.js.map +1 -0
- package/dist/src/stc.js +2 -1
- package/dist/src/stc.js.map +1 -0
- package/dist/src/sti.js +2 -1
- package/dist/src/sti.js.map +1 -0
- package/dist/src/symbols/basic-scope.js +2 -1
- package/dist/src/symbols/basic-scope.js.map +1 -0
- package/dist/src/symbols/basic-symbol.js +2 -1
- package/dist/src/symbols/basic-symbol.js.map +1 -0
- package/dist/src/symbols/index.js +2 -1
- package/dist/src/symbols/index.js.map +1 -0
- package/dist/src/symbols/output-scope.js +2 -1
- package/dist/src/symbols/output-scope.js.map +1 -0
- package/dist/src/symbols/output-space.js +2 -1
- package/dist/src/symbols/output-space.js.map +1 -0
- package/dist/src/symbols/output-symbol.d.ts +1 -1
- package/dist/src/symbols/output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/output-symbol.js +2 -1
- package/dist/src/symbols/output-symbol.js.map +1 -0
- package/dist/src/symbols/symbol-flow.js +2 -1
- package/dist/src/symbols/symbol-flow.js.map +1 -0
- package/dist/src/symbols/symbol-slot.js +2 -1
- package/dist/src/symbols/symbol-slot.js.map +1 -0
- package/dist/src/symbols/symbol-table.js +2 -1
- package/dist/src/symbols/symbol-table.js.map +1 -0
- package/dist/src/tap.js +2 -1
- package/dist/src/tap.js.map +1 -0
- package/dist/src/tracer.js +2 -1
- package/dist/src/tracer.js.map +1 -0
- package/dist/src/utils.js +2 -1
- package/dist/src/utils.js.map +1 -0
- package/dist/src/write-output.js +2 -1
- package/dist/src/write-output.js.map +1 -0
- package/dist/test/browser-build.test.js +2 -1
- package/dist/test/browser-build.test.js.map +1 -0
- package/dist/test/children.test.js +2 -1
- package/dist/test/children.test.js.map +1 -0
- package/dist/test/components/append-file.test.js +2 -1
- package/dist/test/components/append-file.test.js.map +1 -0
- package/dist/test/components/block.test.js +2 -1
- package/dist/test/components/block.test.js.map +1 -0
- package/dist/test/components/copy-file.test.js +2 -1
- package/dist/test/components/copy-file.test.js.map +1 -0
- package/dist/test/components/declaration.test.js +2 -1
- package/dist/test/components/declaration.test.js.map +1 -0
- package/dist/test/components/list.test.js +2 -1
- package/dist/test/components/list.test.js.map +1 -0
- package/dist/test/components/prose.test.js +2 -1
- package/dist/test/components/prose.test.js.map +1 -0
- package/dist/test/components/reference-or-content.test.js +2 -1
- package/dist/test/components/reference-or-content.test.js.map +1 -0
- package/dist/test/components/source-file.test.d.ts.map +1 -1
- package/dist/test/components/source-file.test.js +89 -3
- package/dist/test/components/source-file.test.js.map +1 -0
- package/dist/test/components/template-file.test.js +2 -1
- package/dist/test/components/template-file.test.js.map +1 -0
- package/dist/test/components/update-file.test.js +2 -1
- package/dist/test/components/update-file.test.js.map +1 -0
- package/dist/test/components/wrap.test.js +2 -1
- package/dist/test/components/wrap.test.js.map +1 -0
- package/dist/test/control-flow/for.test.js +2 -1
- package/dist/test/control-flow/for.test.js.map +1 -0
- package/dist/test/control-flow/match.test.js +2 -1
- package/dist/test/control-flow/match.test.js.map +1 -0
- package/dist/test/control-flow/show.test.js +2 -1
- package/dist/test/control-flow/show.test.js.map +1 -0
- package/dist/test/name-policy.test.js +2 -1
- package/dist/test/name-policy.test.js.map +1 -0
- package/dist/test/props-with-defaults.test.js +2 -1
- package/dist/test/props-with-defaults.test.js.map +1 -0
- package/dist/test/reactive-union-set.test.js +2 -1
- package/dist/test/reactive-union-set.test.js.map +1 -0
- package/dist/test/reactivity/circular-reactives.test.js +2 -1
- package/dist/test/reactivity/circular-reactives.test.js.map +1 -0
- package/dist/test/reactivity/cleanup.test.js +2 -1
- package/dist/test/reactivity/cleanup.test.js.map +1 -0
- package/dist/test/reactivity/memo.test.js +2 -1
- package/dist/test/reactivity/memo.test.js.map +1 -0
- package/dist/test/reactivity/ref-rendering.test.js +2 -1
- package/dist/test/reactivity/ref-rendering.test.js.map +1 -0
- package/dist/test/reactivity/test.test.js +2 -1
- package/dist/test/reactivity/test.test.js.map +1 -0
- package/dist/test/reactivity/untrack.test.js +2 -1
- package/dist/test/reactivity/untrack.test.js.map +1 -0
- package/dist/test/refkey.test.js +2 -1
- package/dist/test/refkey.test.js.map +1 -0
- package/dist/test/rendering/basic.test.js +2 -1
- package/dist/test/rendering/basic.test.js.map +1 -0
- package/dist/test/rendering/code.test.js +2 -1
- package/dist/test/rendering/code.test.js.map +1 -0
- package/dist/test/rendering/formatting.test.js +2 -1
- package/dist/test/rendering/formatting.test.js.map +1 -0
- package/dist/test/rendering/indent.test.js +2 -1
- package/dist/test/rendering/indent.test.js.map +1 -0
- package/dist/test/rendering/memoization.test.js +2 -1
- package/dist/test/rendering/memoization.test.js.map +1 -0
- package/dist/test/rendering/refkeys.test.js +2 -1
- package/dist/test/rendering/refkeys.test.js.map +1 -0
- package/dist/test/split-props.test.js +2 -1
- package/dist/test/split-props.test.js.map +1 -0
- package/dist/test/stc.test.js +2 -1
- package/dist/test/stc.test.js.map +1 -0
- package/dist/test/symbols/output-scope.test.js +2 -1
- package/dist/test/symbols/output-scope.test.js.map +1 -0
- package/dist/test/symbols/output-symbol.test.js +2 -1
- package/dist/test/symbols/output-symbol.test.js.map +1 -0
- package/dist/test/symbols/resolution.test.js +2 -1
- package/dist/test/symbols/resolution.test.js.map +1 -0
- package/dist/test/symbols/symbol-table.test.js +2 -1
- package/dist/test/symbols/symbol-table.test.js.map +1 -0
- package/dist/test/symbols/utils.js +2 -1
- package/dist/test/symbols/utils.js.map +1 -0
- package/dist/test/utils.test.js +2 -1
- package/dist/test/utils.test.js.map +1 -0
- package/dist/testing/extend-expect.js +5 -6
- package/dist/testing/extend-expect.js.map +1 -0
- package/dist/testing/extend-expect.test.js +2 -1
- package/dist/testing/extend-expect.test.js.map +1 -0
- package/dist/testing/index.js +2 -1
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/render.js +2 -1
- package/dist/testing/render.js.map +1 -0
- package/dist/testing/vitest.d.js +2 -1
- package/dist/testing/vitest.d.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/binder.ts +20 -0
- package/src/components/Output.tsx +14 -14
- package/src/components/SourceFile.tsx +3 -2
- package/src/context/format-options.ts +45 -0
- package/src/context/index.ts +1 -0
- package/src/refkey.ts +21 -3
- package/src/render.ts +3 -18
- package/src/symbols/output-symbol.ts +1 -1
- package/temp/api.json +399 -25
- package/test/components/source-file.test.tsx +70 -1
- package/testing/extend-expect.ts +3 -17
package/temp/api.json
CHANGED
|
@@ -2584,6 +2584,105 @@
|
|
|
2584
2584
|
],
|
|
2585
2585
|
"name": "code"
|
|
2586
2586
|
},
|
|
2587
|
+
{
|
|
2588
|
+
"kind": "Interface",
|
|
2589
|
+
"canonicalReference": "@alloy-js/core!CommonFormatOptions:interface",
|
|
2590
|
+
"docComment": "",
|
|
2591
|
+
"excerptTokens": [
|
|
2592
|
+
{
|
|
2593
|
+
"kind": "Content",
|
|
2594
|
+
"text": "export interface CommonFormatOptions "
|
|
2595
|
+
}
|
|
2596
|
+
],
|
|
2597
|
+
"fileUrlPath": "src/context/format-options.ts",
|
|
2598
|
+
"releaseTag": "Public",
|
|
2599
|
+
"name": "CommonFormatOptions",
|
|
2600
|
+
"preserveMemberOrder": false,
|
|
2601
|
+
"members": [
|
|
2602
|
+
{
|
|
2603
|
+
"kind": "PropertySignature",
|
|
2604
|
+
"canonicalReference": "@alloy-js/core!CommonFormatOptions#printWidth:member",
|
|
2605
|
+
"docComment": "/**\n * The number of characters the printer will wrap on.\n */\n",
|
|
2606
|
+
"excerptTokens": [
|
|
2607
|
+
{
|
|
2608
|
+
"kind": "Content",
|
|
2609
|
+
"text": "printWidth?: "
|
|
2610
|
+
},
|
|
2611
|
+
{
|
|
2612
|
+
"kind": "Content",
|
|
2613
|
+
"text": "number"
|
|
2614
|
+
},
|
|
2615
|
+
{
|
|
2616
|
+
"kind": "Content",
|
|
2617
|
+
"text": ";"
|
|
2618
|
+
}
|
|
2619
|
+
],
|
|
2620
|
+
"isReadonly": false,
|
|
2621
|
+
"isOptional": true,
|
|
2622
|
+
"releaseTag": "Public",
|
|
2623
|
+
"name": "printWidth",
|
|
2624
|
+
"propertyTypeTokenRange": {
|
|
2625
|
+
"startIndex": 1,
|
|
2626
|
+
"endIndex": 2
|
|
2627
|
+
}
|
|
2628
|
+
},
|
|
2629
|
+
{
|
|
2630
|
+
"kind": "PropertySignature",
|
|
2631
|
+
"canonicalReference": "@alloy-js/core!CommonFormatOptions#tabWidth:member",
|
|
2632
|
+
"docComment": "/**\n * The number of spaces to use for indentation.\n */\n",
|
|
2633
|
+
"excerptTokens": [
|
|
2634
|
+
{
|
|
2635
|
+
"kind": "Content",
|
|
2636
|
+
"text": "tabWidth?: "
|
|
2637
|
+
},
|
|
2638
|
+
{
|
|
2639
|
+
"kind": "Content",
|
|
2640
|
+
"text": "number"
|
|
2641
|
+
},
|
|
2642
|
+
{
|
|
2643
|
+
"kind": "Content",
|
|
2644
|
+
"text": ";"
|
|
2645
|
+
}
|
|
2646
|
+
],
|
|
2647
|
+
"isReadonly": false,
|
|
2648
|
+
"isOptional": true,
|
|
2649
|
+
"releaseTag": "Public",
|
|
2650
|
+
"name": "tabWidth",
|
|
2651
|
+
"propertyTypeTokenRange": {
|
|
2652
|
+
"startIndex": 1,
|
|
2653
|
+
"endIndex": 2
|
|
2654
|
+
}
|
|
2655
|
+
},
|
|
2656
|
+
{
|
|
2657
|
+
"kind": "PropertySignature",
|
|
2658
|
+
"canonicalReference": "@alloy-js/core!CommonFormatOptions#useTabs:member",
|
|
2659
|
+
"docComment": "/**\n * Whether to use tabs instead of spaces for indentation.\n */\n",
|
|
2660
|
+
"excerptTokens": [
|
|
2661
|
+
{
|
|
2662
|
+
"kind": "Content",
|
|
2663
|
+
"text": "useTabs?: "
|
|
2664
|
+
},
|
|
2665
|
+
{
|
|
2666
|
+
"kind": "Content",
|
|
2667
|
+
"text": "boolean"
|
|
2668
|
+
},
|
|
2669
|
+
{
|
|
2670
|
+
"kind": "Content",
|
|
2671
|
+
"text": ";"
|
|
2672
|
+
}
|
|
2673
|
+
],
|
|
2674
|
+
"isReadonly": false,
|
|
2675
|
+
"isOptional": true,
|
|
2676
|
+
"releaseTag": "Public",
|
|
2677
|
+
"name": "useTabs",
|
|
2678
|
+
"propertyTypeTokenRange": {
|
|
2679
|
+
"startIndex": 1,
|
|
2680
|
+
"endIndex": 2
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
],
|
|
2684
|
+
"extendsTokenRanges": []
|
|
2685
|
+
},
|
|
2587
2686
|
{
|
|
2588
2687
|
"kind": "Interface",
|
|
2589
2688
|
"canonicalReference": "@alloy-js/core!Component:interface",
|
|
@@ -4302,6 +4401,107 @@
|
|
|
4302
4401
|
],
|
|
4303
4402
|
"name": "createFileResource"
|
|
4304
4403
|
},
|
|
4404
|
+
{
|
|
4405
|
+
"kind": "Function",
|
|
4406
|
+
"canonicalReference": "@alloy-js/core!createFormatOptionsContextFor:function(1)",
|
|
4407
|
+
"docComment": "/**\n * Create a format options context for a specific file type\n */\n",
|
|
4408
|
+
"excerptTokens": [
|
|
4409
|
+
{
|
|
4410
|
+
"kind": "Content",
|
|
4411
|
+
"text": "export declare function createFormatOptionsContextFor<T>(filetype: "
|
|
4412
|
+
},
|
|
4413
|
+
{
|
|
4414
|
+
"kind": "Content",
|
|
4415
|
+
"text": "string"
|
|
4416
|
+
},
|
|
4417
|
+
{
|
|
4418
|
+
"kind": "Content",
|
|
4419
|
+
"text": ", defaults?: "
|
|
4420
|
+
},
|
|
4421
|
+
{
|
|
4422
|
+
"kind": "Content",
|
|
4423
|
+
"text": "T"
|
|
4424
|
+
},
|
|
4425
|
+
{
|
|
4426
|
+
"kind": "Content",
|
|
4427
|
+
"text": "): "
|
|
4428
|
+
},
|
|
4429
|
+
{
|
|
4430
|
+
"kind": "Content",
|
|
4431
|
+
"text": "{\n Provider: import(\"../index.js\")."
|
|
4432
|
+
},
|
|
4433
|
+
{
|
|
4434
|
+
"kind": "Reference",
|
|
4435
|
+
"text": "ComponentDefinition",
|
|
4436
|
+
"canonicalReference": "@alloy-js/core!ComponentDefinition:interface"
|
|
4437
|
+
},
|
|
4438
|
+
{
|
|
4439
|
+
"kind": "Content",
|
|
4440
|
+
"text": "<import(\"../context.js\")."
|
|
4441
|
+
},
|
|
4442
|
+
{
|
|
4443
|
+
"kind": "Reference",
|
|
4444
|
+
"text": "ContextProviderProps",
|
|
4445
|
+
"canonicalReference": "@alloy-js/core!ContextProviderProps:interface"
|
|
4446
|
+
},
|
|
4447
|
+
{
|
|
4448
|
+
"kind": "Content",
|
|
4449
|
+
"text": "<T>>;\n useFormatOptions: (overrides?: "
|
|
4450
|
+
},
|
|
4451
|
+
{
|
|
4452
|
+
"kind": "Reference",
|
|
4453
|
+
"text": "Partial",
|
|
4454
|
+
"canonicalReference": "!Partial:type"
|
|
4455
|
+
},
|
|
4456
|
+
{
|
|
4457
|
+
"kind": "Content",
|
|
4458
|
+
"text": "<T>) => T;\n}"
|
|
4459
|
+
},
|
|
4460
|
+
{
|
|
4461
|
+
"kind": "Content",
|
|
4462
|
+
"text": ";"
|
|
4463
|
+
}
|
|
4464
|
+
],
|
|
4465
|
+
"fileUrlPath": "src/context/format-options.ts",
|
|
4466
|
+
"returnTypeTokenRange": {
|
|
4467
|
+
"startIndex": 5,
|
|
4468
|
+
"endIndex": 12
|
|
4469
|
+
},
|
|
4470
|
+
"releaseTag": "Public",
|
|
4471
|
+
"overloadIndex": 1,
|
|
4472
|
+
"parameters": [
|
|
4473
|
+
{
|
|
4474
|
+
"parameterName": "filetype",
|
|
4475
|
+
"parameterTypeTokenRange": {
|
|
4476
|
+
"startIndex": 1,
|
|
4477
|
+
"endIndex": 2
|
|
4478
|
+
},
|
|
4479
|
+
"isOptional": false
|
|
4480
|
+
},
|
|
4481
|
+
{
|
|
4482
|
+
"parameterName": "defaults",
|
|
4483
|
+
"parameterTypeTokenRange": {
|
|
4484
|
+
"startIndex": 3,
|
|
4485
|
+
"endIndex": 4
|
|
4486
|
+
},
|
|
4487
|
+
"isOptional": true
|
|
4488
|
+
}
|
|
4489
|
+
],
|
|
4490
|
+
"typeParameters": [
|
|
4491
|
+
{
|
|
4492
|
+
"typeParameterName": "T",
|
|
4493
|
+
"constraintTokenRange": {
|
|
4494
|
+
"startIndex": 0,
|
|
4495
|
+
"endIndex": 0
|
|
4496
|
+
},
|
|
4497
|
+
"defaultTypeTokenRange": {
|
|
4498
|
+
"startIndex": 0,
|
|
4499
|
+
"endIndex": 0
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
],
|
|
4503
|
+
"name": "createFormatOptionsContextFor"
|
|
4504
|
+
},
|
|
4305
4505
|
{
|
|
4306
4506
|
"kind": "Function",
|
|
4307
4507
|
"canonicalReference": "@alloy-js/core!createIntrinsic:function(1)",
|
|
@@ -6581,6 +6781,56 @@
|
|
|
6581
6781
|
"endIndex": 14
|
|
6582
6782
|
}
|
|
6583
6783
|
},
|
|
6784
|
+
{
|
|
6785
|
+
"kind": "Variable",
|
|
6786
|
+
"canonicalReference": "@alloy-js/core!FormatOptions:var",
|
|
6787
|
+
"docComment": "",
|
|
6788
|
+
"excerptTokens": [
|
|
6789
|
+
{
|
|
6790
|
+
"kind": "Content",
|
|
6791
|
+
"text": "FormatOptions: "
|
|
6792
|
+
},
|
|
6793
|
+
{
|
|
6794
|
+
"kind": "Content",
|
|
6795
|
+
"text": "import(\"../index.js\")."
|
|
6796
|
+
},
|
|
6797
|
+
{
|
|
6798
|
+
"kind": "Reference",
|
|
6799
|
+
"text": "ComponentDefinition",
|
|
6800
|
+
"canonicalReference": "@alloy-js/core!ComponentDefinition:interface"
|
|
6801
|
+
},
|
|
6802
|
+
{
|
|
6803
|
+
"kind": "Content",
|
|
6804
|
+
"text": "<import(\"../context.js\")."
|
|
6805
|
+
},
|
|
6806
|
+
{
|
|
6807
|
+
"kind": "Reference",
|
|
6808
|
+
"text": "ContextProviderProps",
|
|
6809
|
+
"canonicalReference": "@alloy-js/core!ContextProviderProps:interface"
|
|
6810
|
+
},
|
|
6811
|
+
{
|
|
6812
|
+
"kind": "Content",
|
|
6813
|
+
"text": "<"
|
|
6814
|
+
},
|
|
6815
|
+
{
|
|
6816
|
+
"kind": "Reference",
|
|
6817
|
+
"text": "CommonFormatOptions",
|
|
6818
|
+
"canonicalReference": "@alloy-js/core!CommonFormatOptions:interface"
|
|
6819
|
+
},
|
|
6820
|
+
{
|
|
6821
|
+
"kind": "Content",
|
|
6822
|
+
"text": ">>"
|
|
6823
|
+
}
|
|
6824
|
+
],
|
|
6825
|
+
"fileUrlPath": "src/context/format-options.ts",
|
|
6826
|
+
"isReadonly": true,
|
|
6827
|
+
"releaseTag": "Public",
|
|
6828
|
+
"name": "FormatOptions",
|
|
6829
|
+
"variableTypeTokenRange": {
|
|
6830
|
+
"startIndex": 1,
|
|
6831
|
+
"endIndex": 8
|
|
6832
|
+
}
|
|
6833
|
+
},
|
|
6584
6834
|
{
|
|
6585
6835
|
"kind": "Interface",
|
|
6586
6836
|
"canonicalReference": "@alloy-js/core!ForProps:interface",
|
|
@@ -10732,13 +10982,30 @@
|
|
|
10732
10982
|
},
|
|
10733
10983
|
{
|
|
10734
10984
|
"kind": "Content",
|
|
10735
|
-
"text": ",
|
|
10985
|
+
"text": ", ...members: "
|
|
10986
|
+
},
|
|
10987
|
+
{
|
|
10988
|
+
"kind": "Content",
|
|
10989
|
+
"text": "["
|
|
10736
10990
|
},
|
|
10737
10991
|
{
|
|
10738
10992
|
"kind": "Reference",
|
|
10739
10993
|
"text": "Refkey",
|
|
10740
10994
|
"canonicalReference": "@alloy-js/core!Refkey:type"
|
|
10741
10995
|
},
|
|
10996
|
+
{
|
|
10997
|
+
"kind": "Content",
|
|
10998
|
+
"text": ", ..."
|
|
10999
|
+
},
|
|
11000
|
+
{
|
|
11001
|
+
"kind": "Reference",
|
|
11002
|
+
"text": "Refkey",
|
|
11003
|
+
"canonicalReference": "@alloy-js/core!Refkey:type"
|
|
11004
|
+
},
|
|
11005
|
+
{
|
|
11006
|
+
"kind": "Content",
|
|
11007
|
+
"text": "[]]"
|
|
11008
|
+
},
|
|
10742
11009
|
{
|
|
10743
11010
|
"kind": "Content",
|
|
10744
11011
|
"text": "): "
|
|
@@ -10755,8 +11022,8 @@
|
|
|
10755
11022
|
],
|
|
10756
11023
|
"fileUrlPath": "src/refkey.ts",
|
|
10757
11024
|
"returnTypeTokenRange": {
|
|
10758
|
-
"startIndex":
|
|
10759
|
-
"endIndex":
|
|
11025
|
+
"startIndex": 9,
|
|
11026
|
+
"endIndex": 10
|
|
10760
11027
|
},
|
|
10761
11028
|
"releaseTag": "Public",
|
|
10762
11029
|
"overloadIndex": 1,
|
|
@@ -10770,10 +11037,10 @@
|
|
|
10770
11037
|
"isOptional": false
|
|
10771
11038
|
},
|
|
10772
11039
|
{
|
|
10773
|
-
"parameterName": "
|
|
11040
|
+
"parameterName": "members",
|
|
10774
11041
|
"parameterTypeTokenRange": {
|
|
10775
11042
|
"startIndex": 3,
|
|
10776
|
-
"endIndex":
|
|
11043
|
+
"endIndex": 8
|
|
10777
11044
|
},
|
|
10778
11045
|
"isOptional": false
|
|
10779
11046
|
}
|
|
@@ -15487,25 +15754,7 @@
|
|
|
15487
15754
|
},
|
|
15488
15755
|
{
|
|
15489
15756
|
"kind": "Content",
|
|
15490
|
-
"text": " | "
|
|
15491
|
-
},
|
|
15492
|
-
{
|
|
15493
|
-
"kind": "Reference",
|
|
15494
|
-
"text": "Ref",
|
|
15495
|
-
"canonicalReference": "@vue/reactivity!Ref:interface"
|
|
15496
|
-
},
|
|
15497
|
-
{
|
|
15498
|
-
"kind": "Content",
|
|
15499
|
-
"text": "<"
|
|
15500
|
-
},
|
|
15501
|
-
{
|
|
15502
|
-
"kind": "Reference",
|
|
15503
|
-
"text": "OutputSymbol",
|
|
15504
|
-
"canonicalReference": "@alloy-js/core!OutputSymbol:class"
|
|
15505
|
-
},
|
|
15506
|
-
{
|
|
15507
|
-
"kind": "Content",
|
|
15508
|
-
"text": " | undefined> | undefined"
|
|
15757
|
+
"text": " | undefined"
|
|
15509
15758
|
},
|
|
15510
15759
|
{
|
|
15511
15760
|
"kind": "Content",
|
|
@@ -15545,7 +15794,7 @@
|
|
|
15545
15794
|
"name": "type",
|
|
15546
15795
|
"propertyTypeTokenRange": {
|
|
15547
15796
|
"startIndex": 1,
|
|
15548
|
-
"endIndex":
|
|
15797
|
+
"endIndex": 3
|
|
15549
15798
|
},
|
|
15550
15799
|
"isStatic": false,
|
|
15551
15800
|
"isProtected": false,
|
|
@@ -21134,6 +21383,75 @@
|
|
|
21134
21383
|
],
|
|
21135
21384
|
"extendsTokenRanges": []
|
|
21136
21385
|
},
|
|
21386
|
+
{
|
|
21387
|
+
"kind": "Function",
|
|
21388
|
+
"canonicalReference": "@alloy-js/core!symbolForRefkey:function(1)",
|
|
21389
|
+
"docComment": "/**\n * Get a ref to the symbol for the given refkey using the current binder. The\n * value of the ref will be undefined when no symbol with that refkey has been\n * created.\n *\n * @remarks\n *\n *\n *\n * This API may return a ref for undefined, but that does not mean that the symbol is\n * not found. The symbol you're looking for may not have been declared yet. When the symbol\n * is declared, the ref will be updated with the symbol.\n */\n",
|
|
21390
|
+
"excerptTokens": [
|
|
21391
|
+
{
|
|
21392
|
+
"kind": "Content",
|
|
21393
|
+
"text": "export declare function symbolForRefkey(refkey: "
|
|
21394
|
+
},
|
|
21395
|
+
{
|
|
21396
|
+
"kind": "Reference",
|
|
21397
|
+
"text": "Refkey",
|
|
21398
|
+
"canonicalReference": "@alloy-js/core!Refkey:type"
|
|
21399
|
+
},
|
|
21400
|
+
{
|
|
21401
|
+
"kind": "Content",
|
|
21402
|
+
"text": "): "
|
|
21403
|
+
},
|
|
21404
|
+
{
|
|
21405
|
+
"kind": "Reference",
|
|
21406
|
+
"text": "Ref",
|
|
21407
|
+
"canonicalReference": "@vue/reactivity!Ref:interface"
|
|
21408
|
+
},
|
|
21409
|
+
{
|
|
21410
|
+
"kind": "Content",
|
|
21411
|
+
"text": "<"
|
|
21412
|
+
},
|
|
21413
|
+
{
|
|
21414
|
+
"kind": "Reference",
|
|
21415
|
+
"text": "OutputSymbol",
|
|
21416
|
+
"canonicalReference": "@alloy-js/core!OutputSymbol:class"
|
|
21417
|
+
},
|
|
21418
|
+
{
|
|
21419
|
+
"kind": "Content",
|
|
21420
|
+
"text": " | undefined, "
|
|
21421
|
+
},
|
|
21422
|
+
{
|
|
21423
|
+
"kind": "Reference",
|
|
21424
|
+
"text": "OutputSymbol",
|
|
21425
|
+
"canonicalReference": "@alloy-js/core!OutputSymbol:class"
|
|
21426
|
+
},
|
|
21427
|
+
{
|
|
21428
|
+
"kind": "Content",
|
|
21429
|
+
"text": " | undefined>"
|
|
21430
|
+
},
|
|
21431
|
+
{
|
|
21432
|
+
"kind": "Content",
|
|
21433
|
+
"text": ";"
|
|
21434
|
+
}
|
|
21435
|
+
],
|
|
21436
|
+
"fileUrlPath": "src/binder.ts",
|
|
21437
|
+
"returnTypeTokenRange": {
|
|
21438
|
+
"startIndex": 3,
|
|
21439
|
+
"endIndex": 9
|
|
21440
|
+
},
|
|
21441
|
+
"releaseTag": "Public",
|
|
21442
|
+
"overloadIndex": 1,
|
|
21443
|
+
"parameters": [
|
|
21444
|
+
{
|
|
21445
|
+
"parameterName": "refkey",
|
|
21446
|
+
"parameterTypeTokenRange": {
|
|
21447
|
+
"startIndex": 1,
|
|
21448
|
+
"endIndex": 2
|
|
21449
|
+
},
|
|
21450
|
+
"isOptional": false
|
|
21451
|
+
}
|
|
21452
|
+
],
|
|
21453
|
+
"name": "symbolForRefkey"
|
|
21454
|
+
},
|
|
21137
21455
|
{
|
|
21138
21456
|
"kind": "Interface",
|
|
21139
21457
|
"canonicalReference": "@alloy-js/core!SymbolRefkey:interface",
|
|
@@ -23223,6 +23541,62 @@
|
|
|
23223
23541
|
],
|
|
23224
23542
|
"name": "useContext"
|
|
23225
23543
|
},
|
|
23544
|
+
{
|
|
23545
|
+
"kind": "Function",
|
|
23546
|
+
"canonicalReference": "@alloy-js/core!useFormatOptions:function(1)",
|
|
23547
|
+
"docComment": "",
|
|
23548
|
+
"excerptTokens": [
|
|
23549
|
+
{
|
|
23550
|
+
"kind": "Content",
|
|
23551
|
+
"text": "useFormatOptions: (overrides?: "
|
|
23552
|
+
},
|
|
23553
|
+
{
|
|
23554
|
+
"kind": "Reference",
|
|
23555
|
+
"text": "Partial",
|
|
23556
|
+
"canonicalReference": "!Partial:type"
|
|
23557
|
+
},
|
|
23558
|
+
{
|
|
23559
|
+
"kind": "Content",
|
|
23560
|
+
"text": "<"
|
|
23561
|
+
},
|
|
23562
|
+
{
|
|
23563
|
+
"kind": "Reference",
|
|
23564
|
+
"text": "CommonFormatOptions",
|
|
23565
|
+
"canonicalReference": "@alloy-js/core!CommonFormatOptions:interface"
|
|
23566
|
+
},
|
|
23567
|
+
{
|
|
23568
|
+
"kind": "Content",
|
|
23569
|
+
"text": "> | undefined"
|
|
23570
|
+
},
|
|
23571
|
+
{
|
|
23572
|
+
"kind": "Content",
|
|
23573
|
+
"text": ") => "
|
|
23574
|
+
},
|
|
23575
|
+
{
|
|
23576
|
+
"kind": "Reference",
|
|
23577
|
+
"text": "CommonFormatOptions",
|
|
23578
|
+
"canonicalReference": "@alloy-js/core!CommonFormatOptions:interface"
|
|
23579
|
+
}
|
|
23580
|
+
],
|
|
23581
|
+
"fileUrlPath": "src/context/format-options.ts",
|
|
23582
|
+
"returnTypeTokenRange": {
|
|
23583
|
+
"startIndex": 6,
|
|
23584
|
+
"endIndex": 7
|
|
23585
|
+
},
|
|
23586
|
+
"releaseTag": "Public",
|
|
23587
|
+
"overloadIndex": 1,
|
|
23588
|
+
"parameters": [
|
|
23589
|
+
{
|
|
23590
|
+
"parameterName": "overrides",
|
|
23591
|
+
"parameterTypeTokenRange": {
|
|
23592
|
+
"startIndex": 1,
|
|
23593
|
+
"endIndex": 5
|
|
23594
|
+
},
|
|
23595
|
+
"isOptional": true
|
|
23596
|
+
}
|
|
23597
|
+
],
|
|
23598
|
+
"name": "useFormatOptions"
|
|
23599
|
+
},
|
|
23226
23600
|
{
|
|
23227
23601
|
"kind": "Function",
|
|
23228
23602
|
"canonicalReference": "@alloy-js/core!useMemberContext:function(1)",
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Children,
|
|
3
|
+
CommonFormatOptions,
|
|
2
4
|
computed,
|
|
3
5
|
ContentOutputFile,
|
|
6
|
+
FormatOptions,
|
|
7
|
+
Indent,
|
|
4
8
|
Output,
|
|
9
|
+
Prose,
|
|
5
10
|
render,
|
|
6
11
|
renderTree,
|
|
7
12
|
SourceFile,
|
|
8
13
|
useContext,
|
|
9
14
|
} from "@alloy-js/core";
|
|
10
|
-
import { expect, it } from "vitest";
|
|
15
|
+
import { describe, expect, it } from "vitest";
|
|
11
16
|
import { SourceDirectoryContext } from "../../src/context/source-directory.js";
|
|
12
17
|
import "../../testing/extend-expect.js";
|
|
13
18
|
import { d } from "../../testing/render.js";
|
|
@@ -71,3 +76,67 @@ it("Includes header", () => {
|
|
|
71
76
|
hello!
|
|
72
77
|
`);
|
|
73
78
|
});
|
|
79
|
+
|
|
80
|
+
describe("format options", () => {
|
|
81
|
+
function FileWithFormatOptions(props: {
|
|
82
|
+
options: CommonFormatOptions;
|
|
83
|
+
children: Children;
|
|
84
|
+
}) {
|
|
85
|
+
return (
|
|
86
|
+
<FormatOptions value={props.options}>
|
|
87
|
+
<SourceFile path="hi.txt" filetype="text">
|
|
88
|
+
{props.children}
|
|
89
|
+
</SourceFile>
|
|
90
|
+
</FormatOptions>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
it("respect tabWidth", () => {
|
|
95
|
+
expect(
|
|
96
|
+
<FileWithFormatOptions options={{ tabWidth: 5 }}>
|
|
97
|
+
hello
|
|
98
|
+
<Indent>indented 5 spaces</Indent>
|
|
99
|
+
</FileWithFormatOptions>,
|
|
100
|
+
).toRenderTo(`
|
|
101
|
+
hello
|
|
102
|
+
indented 5 spaces
|
|
103
|
+
`);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("respect useTabs", () => {
|
|
107
|
+
expect(
|
|
108
|
+
<FileWithFormatOptions options={{ useTabs: true }}>
|
|
109
|
+
hello
|
|
110
|
+
<Indent>indented with tabs</Indent>
|
|
111
|
+
</FileWithFormatOptions>,
|
|
112
|
+
).toRenderTo(`
|
|
113
|
+
hello
|
|
114
|
+
\tindented with tabs
|
|
115
|
+
`);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("respect printWidth", () => {
|
|
119
|
+
expect(
|
|
120
|
+
<FileWithFormatOptions options={{ printWidth: 10 }}>
|
|
121
|
+
<Prose>this is too long</Prose>
|
|
122
|
+
</FileWithFormatOptions>,
|
|
123
|
+
).toRenderTo(`
|
|
124
|
+
this is
|
|
125
|
+
too long
|
|
126
|
+
`);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("source file overrides take precedence", () => {
|
|
130
|
+
expect(
|
|
131
|
+
<FormatOptions value={{ tabWidth: 5 }}>
|
|
132
|
+
<SourceFile path="hi.txt" filetype="text" tabWidth={3}>
|
|
133
|
+
hello
|
|
134
|
+
<Indent>indented 3 spaces</Indent>
|
|
135
|
+
</SourceFile>
|
|
136
|
+
</FormatOptions>,
|
|
137
|
+
).toRenderTo(`
|
|
138
|
+
hello
|
|
139
|
+
indented 3 spaces
|
|
140
|
+
`);
|
|
141
|
+
});
|
|
142
|
+
});
|
package/testing/extend-expect.ts
CHANGED
|
@@ -98,12 +98,6 @@ function validateRender(
|
|
|
98
98
|
|
|
99
99
|
function getFilesFromTree(tree: RenderedTextTree, options?: ToRenderToOptions) {
|
|
100
100
|
const files: Record<string, string> = {};
|
|
101
|
-
// when passing Output, the first render tree child is the Output component.
|
|
102
|
-
const rootRenderOptions =
|
|
103
|
-
Array.isArray(tree) ?
|
|
104
|
-
(getContextForRenderNode(tree[0] as RenderedTextTree)?.meta
|
|
105
|
-
?.printOptions ?? {})
|
|
106
|
-
: {};
|
|
107
101
|
|
|
108
102
|
collectSourceFiles(tree);
|
|
109
103
|
// If we found no source files, we return the tree as a string.
|
|
@@ -121,17 +115,9 @@ function getFilesFromTree(tree: RenderedTextTree, options?: ToRenderToOptions) {
|
|
|
121
115
|
if (context?.meta?.sourceFile) {
|
|
122
116
|
files[context.meta.sourceFile.path] = printTree(root, {
|
|
123
117
|
printWidth:
|
|
124
|
-
options?.printWidth ??
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
tabWidth:
|
|
128
|
-
options?.tabWidth ??
|
|
129
|
-
context.meta?.printOptions?.tabWidth ??
|
|
130
|
-
rootRenderOptions.tabWidth,
|
|
131
|
-
useTabs:
|
|
132
|
-
options?.useTabs ??
|
|
133
|
-
context.meta?.printOptions?.useTabs ??
|
|
134
|
-
rootRenderOptions.useTabs,
|
|
118
|
+
options?.printWidth ?? context.meta?.printOptions?.printWidth,
|
|
119
|
+
tabWidth: options?.tabWidth ?? context.meta?.printOptions?.tabWidth,
|
|
120
|
+
useTabs: options?.useTabs ?? context.meta?.printOptions?.useTabs,
|
|
135
121
|
});
|
|
136
122
|
} else {
|
|
137
123
|
visitChildren();
|