@astryxdesign/cli 0.6.3-canary.98a2e4e → 0.6.3-canary.9dbb6c1
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/README.md +106 -73
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.test.mjs +14 -3
- package/api/build/build.type.d.mts +36 -2
- package/api/build/build.type.mjs +25 -4
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/component.doc.mjs +13 -3
- package/api/component/component.mjs +31 -2
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +22 -11
- package/api/component/component.type.mjs +32 -24
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +4 -3
- package/api/component/list/list.d.mts +0 -5
- package/api/component/list/list.mjs +37 -9
- package/api/discover/discover.doc.mjs +2 -1
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +28 -30
- package/api/docs/_adapter.mjs +73 -135
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.d.mts +0 -15
- package/api/docs/detail/detail.mjs +14 -78
- package/api/docs/detail/section/section.mjs +22 -18
- package/api/docs/detail/section/section.test.mjs +4 -3
- package/api/docs/docs.doc.mjs +1 -0
- package/api/docs/docs.type.d.mts +4 -4
- package/api/docs/docs.type.mjs +10 -10
- package/api/docs/index/index.mjs +6 -5
- package/api/docs/list/list.mjs +3 -7
- package/api/doctor/doctor.d.mts +25 -3
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +186 -18
- package/api/doctor/doctor.test.mjs +326 -1
- package/api/gap-report/gap-report.doc.mjs +8 -4
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +69 -17
- package/api/init/init.doc.mjs +5 -0
- package/api/init/init.test.mjs +41 -1
- package/api/init/remove/remove.mjs +1 -1
- package/api/init/run/run.mjs +20 -10
- package/api/integration/add-contribution.component-names.test.mjs +120 -0
- package/api/integration/add-contribution.mjs +23 -10
- package/api/integration/add-contribution.test.mjs +121 -7
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.test.mjs +8 -4
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +8 -4
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +2 -1
- package/api/integration/integrationAddDoc.doc.mjs +1 -0
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +1 -0
- package/api/integration/integrationPackCheck.doc.mjs +1 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -0
- package/api/integration/pack-check.mjs +49 -7
- package/api/integration/pack-check.test.mjs +266 -47
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +52 -102
- package/api/integration/validate-integration.test.mjs +176 -23
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +2 -1
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +3 -2
- package/api/layout/expand/expand.mjs +7 -5
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.mjs +2 -1
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +2 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search-return-type.test.mjs +54 -0
- package/api/search/search.d.mts +2 -9
- package/api/search/search.doc.mjs +6 -1
- package/api/search/search.mjs +31 -14
- package/api/search/search.test.mjs +34 -0
- package/api/search/search.type.d.mts +1 -1
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +2 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.doc.mjs +3 -1
- package/api/template/template.type.d.mts +5 -5
- package/api/template/template.type.mjs +12 -12
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +84 -0
- package/api/theme/add/add.mjs +20 -3
- package/api/theme/add/add.staging.test.mjs +66 -0
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/build/build.mjs +133 -42
- package/api/theme/build/build.public-component-vars.test.mjs +1 -1
- package/api/theme/build/build.receipt-doc.test.mjs +111 -0
- package/api/theme/build/build.test.mjs +127 -0
- package/api/theme/build/font-warning.mjs +3 -3
- package/api/theme/build/font-warning.test.mjs +5 -2
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/palette/generate/generate.mjs +8 -3
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.d.mts +10 -13
- package/api/theme/palette/generate/generator.mjs +15 -4
- package/api/theme/palette/generate/generator.test.mjs +10 -0
- package/api/theme/template/template.mjs +11 -2
- package/api/theme/template/template.test.mjs +15 -0
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +8 -4
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +5 -1
- package/api/upgrade/_adapter.d.mts +12 -3
- package/api/upgrade/_adapter.mjs +108 -70
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +1 -0
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +3 -1
- package/api/upgrade/upgrade.type.d.mts +8 -4
- package/api/upgrade/upgrade.type.mjs +11 -10
- package/assets/codemods/integration-discovery.mjs +48 -4
- package/assets/codemods/integration-discovery.test.mjs +73 -0
- package/assets/codemods/runner.mjs +115 -5
- package/assets/codemods/term-log.mjs +32 -8
- package/assets/codemods/term-log.test.mjs +19 -1
- package/assets/codemods/transform-prop.mjs +109 -0
- package/assets/codemods/transform-prop.test.mjs +95 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +216 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
- package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
- package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
- package/assets/docs/cli-integrations.doc.mjs +26 -30
- package/assets/docs/cli.doc.mjs +15 -0
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +61 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +126 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +86 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +99 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +122 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +95 -0
- package/assets/templates/pages/table-tree/page.tsx +1704 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
- package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
- package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
- package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
- package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
- package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
- package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
- package/authoring/_shared/contract.ts +22 -0
- package/authoring/codemod/codemod.doc.mjs +7 -2
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +8 -6
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +18 -6
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +4 -4
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +121 -11
- package/authoring/doctypes/_schema.mjs +144 -13
- package/authoring/doctypes/base/graph-fields.doc.mjs +11 -4
- package/authoring/doctypes/base/type.ts +8 -4
- package/authoring/doctypes/command/command.doc.mjs +4 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +3 -3
- package/authoring/doctypes/component/component.doc.mjs +5 -2
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +3 -3
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +2 -2
- package/authoring/doctypes/function/function.doc.mjs +5 -1
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +2 -2
- package/authoring/doctypes/hook/hook.doc.mjs +4 -0
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +3 -3
- package/authoring/doctypes/legacy.d.mts +6 -6
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/load-contract.test.mjs +208 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -3
- package/authoring/doctypes/namespace/parse.d.mts +2 -2
- package/authoring/doctypes/namespace/parse.mjs +1 -1
- package/authoring/doctypes/namespace/type.ts +2 -2
- package/authoring/doctypes/parse.d.mts +22 -20
- package/authoring/doctypes/parse.mjs +16 -12
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +1 -1
- package/authoring/doctypes/reference/reference.doc.mjs +7 -3
- package/authoring/doctypes/reference/type.ts +3 -3
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +3 -4
- package/authoring/doctypes/template/parse.d.mts +92 -1
- package/authoring/doctypes/template/parse.mjs +33 -1
- package/authoring/doctypes/template/template.doc.mjs +7 -3
- package/authoring/doctypes/template/type.ts +4 -1
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +12 -11
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/gap-report/parse.d.mts +9 -9
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.mjs +3 -2
- package/authoring/identity/type.ts +10 -10
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +21 -19
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/schema.d.mts +4 -4
- package/authoring/integration/schema.mjs +3 -3
- package/authoring/integration/type.ts +4 -10
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
- package/clients/cli/commands/build-theme.mjs +5 -5
- package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
- package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
- package/clients/cli/commands/build.doc.mjs +5 -2
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +32 -47
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +40 -0
- package/clients/cli/commands/component/index.mjs +2 -7
- package/clients/cli/commands/component-package.test.mjs +46 -0
- package/clients/cli/commands/component-resolution.test.mjs +21 -0
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.test.mjs +19 -0
- package/clients/cli/commands/detail-levels.test.mjs +2 -2
- package/clients/cli/commands/discover.broken-integration.test.mjs +48 -0
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +5 -3
- package/clients/cli/commands/discover.mjs +3 -3
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
- package/clients/cli/commands/doctor-integration.test.mjs +15 -7
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +6 -16
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +17 -6
- package/clients/cli/commands/gap-report.test.mjs +72 -0
- package/clients/cli/commands/hook/index.mjs +7 -17
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
- package/clients/cli/commands/init.doc.mjs +20 -9
- package/clients/cli/commands/init.flag-help.test.mjs +153 -0
- package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
- package/clients/cli/commands/integration-add.doc.mjs +22 -6
- package/clients/cli/commands/integration-authoring.test.mjs +13 -9
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/interactive-guard.test.mjs +101 -24
- package/clients/cli/commands/json-contract.test.mjs +33 -0
- package/clients/cli/commands/layout-check.doc.mjs +15 -4
- package/clients/cli/commands/layout-expand.doc.mjs +22 -5
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +3 -3
- package/clients/cli/commands/layout.mjs +21 -9
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +7 -4
- package/clients/cli/commands/search.mjs +17 -7
- package/clients/cli/commands/search.test.mjs +75 -0
- package/clients/cli/commands/swizzle.doc.mjs +3 -2
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +29 -7
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/theme-add.doc.mjs +4 -3
- package/clients/cli/commands/theme-build.doc.mjs +8 -7
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
- package/clients/cli/commands/theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +18 -7
- package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
- package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
- package/clients/cli/index.mjs +13 -30
- package/clients/cli/latest-version-env.test.mjs +50 -0
- package/clients/cli/lib/cli-error.test.mjs +7 -0
- package/clients/cli/lib/component-format.mjs +9 -9
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +32 -6
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +97 -0
- package/clients/cli/lib/hook-format.mjs +19 -10
- package/clients/cli/lib/json-shim.mjs +38 -2
- package/clients/cli/lib/json-shim.test.mjs +83 -0
- package/clients/cli/lib/manifest.d.ts +2 -0
- package/clients/cli/lib/manifest.mjs +22 -0
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +4 -0
- package/foundation/agent-docs/agent-docs.mjs +69 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +173 -30
- package/foundation/config/project.test.mjs +129 -16
- package/foundation/discovery/authoring-self-docs.d.mts +6 -0
- package/foundation/discovery/authoring-self-docs.mjs +17 -7
- package/foundation/discovery/authoring-self-docs.test.mjs +71 -12
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +113 -0
- package/foundation/discovery/cli-self-docs.mjs +514 -0
- package/foundation/discovery/cli-self-docs.test.mjs +437 -0
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +7 -2
- package/foundation/discovery/docs-discovery.mjs +24 -14
- package/foundation/discovery/docs-discovery.test.mjs +55 -16
- package/foundation/discovery/template-adapter.d.mts +21 -5
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
- package/foundation/discovery/template-adapter.mjs +319 -65
- package/foundation/discovery/template-adapter.test.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/discovery/theming-targets.test.mjs +4 -0
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +218 -0
- package/foundation/doc-compiler/bundle.test.mjs +255 -0
- package/foundation/doc-compiler/compile.d.mts +362 -0
- package/foundation/doc-compiler/compile.mjs +511 -0
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +277 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +714 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +286 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +22 -0
- package/foundation/doc-compiler/ir.mjs +464 -0
- package/foundation/doc-compiler/lenses.d.mts +33 -0
- package/foundation/doc-compiler/lenses.mjs +127 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +492 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +126 -0
- package/foundation/doc-compiler/read.mjs +320 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -52
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +1 -1
- package/foundation/integrations/contribution-inventory.mjs +17 -20
- package/foundation/integrations/contribution-inventory.test.mjs +67 -27
- package/foundation/integrations/integrations.d.mts +3 -0
- package/foundation/integrations/integrations.mjs +11 -97
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.mjs +104 -10
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.doc.mjs +3 -4
- package/foundation/response/error-codes.mjs +2 -2
- package/foundation/response/error-codes.test.mjs +83 -0
- package/foundation/response/json-contract.test.mjs +11 -0
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +11 -11
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +3 -2
- package/foundation/xle/expand.test.mjs +54 -0
- package/package.json +9 -11
- package/assets/templates/themes/manifest.json +0 -95
- package/clients/cli/lib/update-check.mjs +0 -83
- package/clients/cli/lib/update-check.test.mjs +0 -137
- package/clients/cli/update-hint-commands.test.mjs +0 -54
package/api/docs/_adapter.d.mts
CHANGED
|
@@ -16,40 +16,37 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export function loadDocsCatalog(cwd?: string): Promise<DocsCatalog>;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* One topic, lowered for `lang`: overlaid, extensions merged, keys stamped.
|
|
20
|
+
* Memoized per catalog, so a read that references a topic twice loads it once.
|
|
21
|
+
* Every read of the catalog shares the memoized node, so it is frozen; the
|
|
22
|
+
* lenses hand readers copies.
|
|
23
|
+
* @param {DocsCatalog} catalog
|
|
24
|
+
* @param {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry} entry
|
|
25
|
+
* @param {string | null} [lang]
|
|
26
|
+
* @returns {Promise<import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode>}
|
|
22
27
|
*/
|
|
23
|
-
export function
|
|
24
|
-
lang?: string | null;
|
|
25
|
-
}): Promise<import("./docs.type.mjs").DocsDetailResponse["data"]>;
|
|
28
|
+
export function lowerTopic(catalog: DocsCatalog, entry: import("../../foundation/discovery/docs-discovery.mjs").DocsTopicEntry, lang?: string | null): Promise<import("../../foundation/doc-compiler/compile.mjs").CompiledReferenceNode>;
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* `--dense`/`--zh` (it replaces its own sections and leaves the rest
|
|
33
|
-
* translated) rather than being dropped.
|
|
34
|
-
*
|
|
35
|
-
* @param {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry} entry
|
|
36
|
-
* @param {{lang?: string|null}} [opts]
|
|
37
|
-
* @returns {Promise<import('./docs.type.mjs').DocsDetailResponse['data']>}
|
|
30
|
+
* How a token reference finds its target: the topic it names in `catalog`,
|
|
31
|
+
* lowered for the same language.
|
|
32
|
+
* @param {DocsCatalog} catalog
|
|
33
|
+
* @param {string | null} lang
|
|
34
|
+
* @returns {(topic: string) => Promise<import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode | null>}
|
|
38
35
|
*/
|
|
39
|
-
export function
|
|
40
|
-
lang?: string | null;
|
|
41
|
-
}): Promise<import("./docs.type.mjs").DocsDetailResponse["data"]>;
|
|
36
|
+
export function referenceTargets(catalog: DocsCatalog, lang: string | null): (topic: string) => Promise<import("../../foundation/doc-compiler/compile.mjs").CompiledReferenceNode | null>;
|
|
42
37
|
/**
|
|
43
|
-
*
|
|
38
|
+
* One topic, compiled for `lang`: lowered, then every token reference linked.
|
|
39
|
+
* @param {DocsCatalog} catalog
|
|
44
40
|
* @param {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry} entry
|
|
45
|
-
* @
|
|
41
|
+
* @param {string | null} [lang]
|
|
42
|
+
* @returns {Promise<import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode>}
|
|
46
43
|
*/
|
|
47
|
-
export function
|
|
44
|
+
export function compileTopic(catalog: DocsCatalog, entry: import("../../foundation/discovery/docs-discovery.mjs").DocsTopicEntry, lang?: string | null): Promise<import("../../foundation/doc-compiler/compile.mjs").CompiledReferenceNode>;
|
|
48
45
|
/**
|
|
49
46
|
* Resolve `topic` against the project's catalog (throwing `ERR_UNKNOWN_TOPIC`
|
|
50
|
-
* when unmatched)
|
|
51
|
-
* integration extension applied. Shared by the
|
|
52
|
-
*
|
|
47
|
+
* when unmatched) and lower it with any --dense/--zh overlay and any
|
|
48
|
+
* integration extension applied. Shared by the leaves so topic normalization
|
|
49
|
+
* and unknown-topic handling live in exactly one place.
|
|
53
50
|
*
|
|
54
51
|
* @param {string} topic
|
|
55
52
|
* @param {object} [options]
|
|
@@ -59,7 +56,7 @@ export function overlayLanguages(entry: import("../../foundation/discovery/docs-
|
|
|
59
56
|
* @param {string} [options.cwd]
|
|
60
57
|
* @returns {Promise<{
|
|
61
58
|
* catalog: DocsCatalog,
|
|
62
|
-
*
|
|
59
|
+
* node: import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode,
|
|
63
60
|
* lang: string | null,
|
|
64
61
|
* }>}
|
|
65
62
|
*/
|
|
@@ -70,9 +67,10 @@ export function resolveTopicDocs(topic: string, options?: {
|
|
|
70
67
|
cwd?: string | undefined;
|
|
71
68
|
}): Promise<{
|
|
72
69
|
catalog: DocsCatalog;
|
|
73
|
-
|
|
70
|
+
node: import("../../foundation/doc-compiler/compile.mjs").CompiledReferenceNode;
|
|
74
71
|
lang: string | null;
|
|
75
72
|
}>;
|
|
76
|
-
/** The localized overlays a docs read can apply. */
|
|
77
|
-
export const OVERLAY_LANGUAGES: string[];
|
|
78
73
|
import { DocsCatalog } from '../../foundation/discovery/docs-discovery.mjs';
|
|
74
|
+
import { OVERLAY_LANGUAGES } from '../../foundation/doc-compiler/read.mjs';
|
|
75
|
+
import { overlayLanguages } from '../../foundation/doc-compiler/read.mjs';
|
|
76
|
+
export { OVERLAY_LANGUAGES, overlayLanguages };
|
package/api/docs/_adapter.mjs
CHANGED
|
@@ -7,32 +7,32 @@
|
|
|
7
7
|
* packages/cli/assets/docs/{topic}.doc.mjs plus every topic the configured
|
|
8
8
|
* integrations contribute — and, when a --dense/--zh overlay is requested,
|
|
9
9
|
* the sibling {topic}.doc.dense.mjs / {topic}.doc.zh.mjs.
|
|
10
|
-
* @output Catalog access,
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @position Sits beside docs.mjs (api/docs/).
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
10
|
+
* @output Catalog access, the compiler input for a topic, and the compiled
|
|
11
|
+
* node for it: lowered (overlaid, extensions merged, keys stamped) or linked
|
|
12
|
+
* (token references resolved too), memoized per catalog.
|
|
13
|
+
* @position Sits beside docs.mjs (api/docs/). Hands topics to
|
|
14
|
+
* foundation/doc-compiler (which loads their files) and memoizes the nodes
|
|
15
|
+
* per catalog, so no leaf, doctor check or search loads, merges, or resolves
|
|
16
|
+
* docs on its own. Discovery itself lives in
|
|
17
|
+
* foundation/discovery/docs-discovery, which the catalog comes from.
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
|
-
import * as fs from 'node:fs';
|
|
20
|
-
import * as path from 'node:path';
|
|
21
|
-
import {pathToFileURL} from 'node:url';
|
|
22
20
|
import {Project} from '../../foundation/config/project.mjs';
|
|
21
|
+
import {DocsCatalog} from '../../foundation/discovery/docs-discovery.mjs';
|
|
23
22
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
withSourceTitle,
|
|
28
|
-
} from '../../foundation/discovery/docs-discovery.mjs';
|
|
23
|
+
linkReferenceTopic,
|
|
24
|
+
lowerReferenceTopic,
|
|
25
|
+
} from '../../foundation/doc-compiler/compile.mjs';
|
|
29
26
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
deepFreeze,
|
|
28
|
+
loadTopicInput,
|
|
29
|
+
OVERLAY_LANGUAGES,
|
|
30
|
+
overlayLanguages,
|
|
31
|
+
} from '../../foundation/doc-compiler/read.mjs';
|
|
33
32
|
import {AstryxError} from '../error.mjs';
|
|
34
33
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
export {OVERLAY_LANGUAGES, overlayLanguages};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* The project's topics: the built-in ones plus whatever the configured
|
|
@@ -57,140 +57,78 @@ export async function loadDocsCatalog(cwd = process.cwd()) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param {
|
|
62
|
-
* @returns {
|
|
60
|
+
* The overlay a read applies: none for the authored language.
|
|
61
|
+
* @param {string | null | undefined} lang
|
|
62
|
+
* @returns {string | null}
|
|
63
63
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const parsed = parseDoc(mod.docs ?? mod.default, path.basename(docPath));
|
|
67
|
-
if (!('sections' in parsed)) {
|
|
68
|
-
throw new Error(`${path.basename(docPath)} is not a reference document.`);
|
|
69
|
-
}
|
|
70
|
-
const problems = problemsInTopic(parsed);
|
|
71
|
-
if (problems.length > 0) {
|
|
72
|
-
throw new Error(
|
|
73
|
-
`${path.basename(docPath)} is invalid: ${problems.join('; ')}`,
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
const docs = parsed;
|
|
77
|
-
if (!lang || lang === 'en') return docs;
|
|
78
|
-
|
|
79
|
-
const translationPath = overlayPath(docPath, lang);
|
|
80
|
-
if (!fs.existsSync(translationPath)) return docs;
|
|
81
|
-
|
|
82
|
-
const translationMod = await import(pathToFileURL(translationPath).href);
|
|
83
|
-
const translation = translationMod.docsZh || translationMod.docsDense;
|
|
84
|
-
if (!translation) return docs;
|
|
85
|
-
|
|
86
|
-
// Overlays are keyed to a base section by title (`section`), not by array
|
|
87
|
-
// position. Position-keying silently grafted each overlay title onto whatever
|
|
88
|
-
// base section happened to share its index, so an overlay that omitted or
|
|
89
|
-
// reordered a section corrupted every section after it — `docs tokens --dense`
|
|
90
|
-
// printed the colour table under a "Spacing" heading (#2182). An overlay may
|
|
91
|
-
// now cover any subset of sections, in any order; sections it does not name
|
|
92
|
-
// keep their base content.
|
|
93
|
-
/** @type {Map<string, any>} */
|
|
94
|
-
const bySection = new Map();
|
|
95
|
-
for (const ts of translation.sections ?? []) {
|
|
96
|
-
if (ts?.section != null) bySection.set(ts.section, ts);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
...docs,
|
|
101
|
-
description: translation.description || docs.description,
|
|
102
|
-
sections: docs.sections.map(
|
|
103
|
-
(
|
|
104
|
-
/** @type {import('@astryxdesign/cli/authoring').ReferenceSection} */ section,
|
|
105
|
-
) => {
|
|
106
|
-
const ts = bySection.get(section.title);
|
|
107
|
-
if (!ts) return section;
|
|
108
|
-
const localized = {
|
|
109
|
-
...section,
|
|
110
|
-
title: ts.title || section.title,
|
|
111
|
-
content: section.content.map(
|
|
112
|
-
(
|
|
113
|
-
/** @type {import('@astryxdesign/cli/authoring').ReferenceContentBlock} */ block,
|
|
114
|
-
/** @type {number} */ bi,
|
|
115
|
-
) => {
|
|
116
|
-
const tb = ts.content?.[bi];
|
|
117
|
-
if (!tb) return block;
|
|
118
|
-
if (tb.type === 'prose' && block.type === 'prose')
|
|
119
|
-
return {...block, text: tb.text};
|
|
120
|
-
if (tb.type === 'list' && block.type === 'list')
|
|
121
|
-
return {...block, items: tb.items};
|
|
122
|
-
return block;
|
|
123
|
-
},
|
|
124
|
-
),
|
|
125
|
-
};
|
|
126
|
-
return withSourceTitle(localized, section.title);
|
|
127
|
-
},
|
|
128
|
-
),
|
|
129
|
-
};
|
|
64
|
+
function overlayLanguage(lang) {
|
|
65
|
+
return lang && lang !== 'en' ? lang : null;
|
|
130
66
|
}
|
|
131
67
|
|
|
68
|
+
/** @type {WeakMap<DocsCatalog, Map<string, Promise<import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode>>>} */
|
|
69
|
+
const loweredByCatalog = new WeakMap();
|
|
70
|
+
|
|
132
71
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* `--dense`/`--zh` (it replaces its own sections and leaves the rest
|
|
139
|
-
* translated) rather than being dropped.
|
|
140
|
-
*
|
|
72
|
+
* One topic, lowered for `lang`: overlaid, extensions merged, keys stamped.
|
|
73
|
+
* Memoized per catalog, so a read that references a topic twice loads it once.
|
|
74
|
+
* Every read of the catalog shares the memoized node, so it is frozen; the
|
|
75
|
+
* lenses hand readers copies.
|
|
76
|
+
* @param {DocsCatalog} catalog
|
|
141
77
|
* @param {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry} entry
|
|
142
|
-
* @param {
|
|
143
|
-
* @returns {Promise<import('
|
|
78
|
+
* @param {string | null} [lang]
|
|
79
|
+
* @returns {Promise<import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode>}
|
|
144
80
|
*/
|
|
145
|
-
export
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (problems.length > 0) {
|
|
152
|
-
throw new Error(
|
|
153
|
-
`${path.basename(extension.path)}, extending ${entry.name}, leaves two sections with one key: ${problems.join('; ')}`,
|
|
154
|
-
);
|
|
155
|
-
}
|
|
81
|
+
export function lowerTopic(catalog, entry, lang = null) {
|
|
82
|
+
const overlay = overlayLanguage(lang);
|
|
83
|
+
let cache = loweredByCatalog.get(catalog);
|
|
84
|
+
if (!cache) {
|
|
85
|
+
cache = new Map();
|
|
86
|
+
loweredByCatalog.set(catalog, cache);
|
|
156
87
|
}
|
|
157
|
-
|
|
158
|
-
|
|
88
|
+
const key = `${entry.name.toLowerCase()}\u0000${overlay ?? ''}`;
|
|
89
|
+
let lowered = cache.get(key);
|
|
90
|
+
if (!lowered) {
|
|
91
|
+
lowered = loadTopicInput(entry, overlay).then(input =>
|
|
92
|
+
deepFreeze(lowerReferenceTopic(input)),
|
|
93
|
+
);
|
|
94
|
+
cache.set(key, lowered);
|
|
95
|
+
}
|
|
96
|
+
return lowered;
|
|
159
97
|
}
|
|
160
98
|
|
|
161
|
-
/** The localized overlays a docs read can apply. */
|
|
162
|
-
export const OVERLAY_LANGUAGES = ['zh', 'dense'];
|
|
163
|
-
|
|
164
99
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* @param {
|
|
168
|
-
* @
|
|
100
|
+
* How a token reference finds its target: the topic it names in `catalog`,
|
|
101
|
+
* lowered for the same language.
|
|
102
|
+
* @param {DocsCatalog} catalog
|
|
103
|
+
* @param {string | null} lang
|
|
104
|
+
* @returns {(topic: string) => Promise<import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode | null>}
|
|
169
105
|
*/
|
|
170
|
-
function
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
106
|
+
export function referenceTargets(catalog, lang) {
|
|
107
|
+
return async topic => {
|
|
108
|
+
const target = catalog.resolve(topic);
|
|
109
|
+
return target ? lowerTopic(catalog, target, lang) : null;
|
|
110
|
+
};
|
|
175
111
|
}
|
|
176
112
|
|
|
177
113
|
/**
|
|
178
|
-
*
|
|
114
|
+
* One topic, compiled for `lang`: lowered, then every token reference linked.
|
|
115
|
+
* @param {DocsCatalog} catalog
|
|
179
116
|
* @param {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry} entry
|
|
180
|
-
* @
|
|
117
|
+
* @param {string | null} [lang]
|
|
118
|
+
* @returns {Promise<import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode>}
|
|
181
119
|
*/
|
|
182
|
-
export function
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
120
|
+
export async function compileTopic(catalog, entry, lang = null) {
|
|
121
|
+
return linkReferenceTopic(
|
|
122
|
+
await lowerTopic(catalog, entry, lang),
|
|
123
|
+
referenceTargets(catalog, lang),
|
|
186
124
|
);
|
|
187
125
|
}
|
|
188
126
|
|
|
189
127
|
/**
|
|
190
128
|
* Resolve `topic` against the project's catalog (throwing `ERR_UNKNOWN_TOPIC`
|
|
191
|
-
* when unmatched)
|
|
192
|
-
* integration extension applied. Shared by the
|
|
193
|
-
*
|
|
129
|
+
* when unmatched) and lower it with any --dense/--zh overlay and any
|
|
130
|
+
* integration extension applied. Shared by the leaves so topic normalization
|
|
131
|
+
* and unknown-topic handling live in exactly one place.
|
|
194
132
|
*
|
|
195
133
|
* @param {string} topic
|
|
196
134
|
* @param {object} [options]
|
|
@@ -200,7 +138,7 @@ export function overlayLanguages(entry) {
|
|
|
200
138
|
* @param {string} [options.cwd]
|
|
201
139
|
* @returns {Promise<{
|
|
202
140
|
* catalog: DocsCatalog,
|
|
203
|
-
*
|
|
141
|
+
* node: import('../../foundation/doc-compiler/compile.mjs').CompiledReferenceNode,
|
|
204
142
|
* lang: string | null,
|
|
205
143
|
* }>}
|
|
206
144
|
*/
|
|
@@ -221,6 +159,6 @@ export async function resolveTopicDocs(topic, options = {}) {
|
|
|
221
159
|
);
|
|
222
160
|
}
|
|
223
161
|
|
|
224
|
-
const
|
|
225
|
-
return {catalog,
|
|
162
|
+
const node = await lowerTopic(catalog, entry, effectiveLang);
|
|
163
|
+
return {catalog, node, lang: effectiveLang};
|
|
226
164
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Every shipped topic compiles to a plain-JSON node that answers every
|
|
5
|
+
* docs read exactly as the live one does, and no read can change another read
|
|
6
|
+
* of the same catalog.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {describe, expect, it} from 'vitest';
|
|
10
|
+
import {parseCompiledReferenceNode} from '../../foundation/doc-compiler/ir.mjs';
|
|
11
|
+
import {detailView, indexView} from '../../foundation/doc-compiler/lenses.mjs';
|
|
12
|
+
import {
|
|
13
|
+
compileTopic,
|
|
14
|
+
loadDocsCatalog,
|
|
15
|
+
lowerTopic,
|
|
16
|
+
overlayLanguages,
|
|
17
|
+
} from './_adapter.mjs';
|
|
18
|
+
|
|
19
|
+
const SLOW = 60_000;
|
|
20
|
+
|
|
21
|
+
describe('every shipped topic compiles to plain JSON', () => {
|
|
22
|
+
it(
|
|
23
|
+
'survives a JSON round trip with identical responses in every language',
|
|
24
|
+
async () => {
|
|
25
|
+
const catalog = await loadDocsCatalog();
|
|
26
|
+
let compiled = 0;
|
|
27
|
+
for (const entry of catalog.entries()) {
|
|
28
|
+
for (const lang of [null, ...overlayLanguages(entry)]) {
|
|
29
|
+
const lowered = await lowerTopic(catalog, entry, lang);
|
|
30
|
+
expect(parseCompiledReferenceNode(lowered)).toBe(lowered);
|
|
31
|
+
const node = await compileTopic(catalog, entry, lang);
|
|
32
|
+
expect(parseCompiledReferenceNode(node)).toBe(node);
|
|
33
|
+
const copy = parseCompiledReferenceNode(
|
|
34
|
+
JSON.parse(JSON.stringify(node)),
|
|
35
|
+
);
|
|
36
|
+
expect(JSON.stringify(detailView(copy))).toBe(
|
|
37
|
+
JSON.stringify(detailView(node)),
|
|
38
|
+
);
|
|
39
|
+
expect(JSON.stringify(indexView(copy))).toBe(
|
|
40
|
+
JSON.stringify(indexView(node)),
|
|
41
|
+
);
|
|
42
|
+
compiled += 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
expect(compiled).toBeGreaterThan(catalog.entries().length);
|
|
46
|
+
},
|
|
47
|
+
SLOW,
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('reads that share a catalog', () => {
|
|
52
|
+
it(
|
|
53
|
+
'never let one read change another',
|
|
54
|
+
async () => {
|
|
55
|
+
const catalog = await loadDocsCatalog();
|
|
56
|
+
const tokens = catalog.resolve('tokens');
|
|
57
|
+
const first = detailView(await compileTopic(catalog, tokens));
|
|
58
|
+
for (const section of first.sections) {
|
|
59
|
+
section.title = 'EDITED';
|
|
60
|
+
for (const block of section.content) {
|
|
61
|
+
if (typeof block.text === 'string') block.text = 'EDITED';
|
|
62
|
+
if (Array.isArray(block.rows)) block.rows.push(['EDITED']);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const again = detailView(await compileTopic(catalog, tokens));
|
|
66
|
+
const index = indexView(await lowerTopic(catalog, tokens));
|
|
67
|
+
const spacing = detailView(
|
|
68
|
+
await compileTopic(catalog, catalog.resolve('spacing')),
|
|
69
|
+
);
|
|
70
|
+
for (const read of [again, index, spacing]) {
|
|
71
|
+
expect(JSON.stringify(read)).not.toContain('EDITED');
|
|
72
|
+
}
|
|
73
|
+
const lowered = await lowerTopic(catalog, tokens);
|
|
74
|
+
expect(Object.isFrozen(lowered.doc.sections[0].content)).toBe(true);
|
|
75
|
+
},
|
|
76
|
+
SLOW,
|
|
77
|
+
);
|
|
78
|
+
});
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Resolve token-ref blocks by inlining the referenced section's table.
|
|
6
|
-
* This allows section docs to reference token tables without duplicating data.
|
|
7
|
-
*
|
|
8
|
-
* The reference is resolved through the catalog, so a topic may point at one
|
|
9
|
-
* an integration contributed (or replaced) rather than only at a built-in. It
|
|
10
|
-
* names the section by key or authored title, so it resolves in every language.
|
|
11
|
-
* @param {import('../docs.type.mjs').DocsDetailResponse['data']} docsData
|
|
12
|
-
* @param {import('../../../foundation/discovery/docs-discovery.mjs').DocsCatalog} catalog
|
|
13
|
-
* @param {{lang?: string | null}} [options]
|
|
14
|
-
* @returns {Promise<import('../docs.type.mjs').DocsDetailResponse['data']>}
|
|
15
|
-
*/
|
|
16
|
-
export function resolveTokenRefs(docsData: import("../docs.type.mjs").DocsDetailResponse["data"], catalog: import("../../../foundation/discovery/docs-discovery.mjs").DocsCatalog, { lang }?: {
|
|
17
|
-
lang?: string | null;
|
|
18
|
-
}): Promise<import("../docs.type.mjs").DocsDetailResponse["data"]>;
|
|
19
4
|
/**
|
|
20
5
|
* @param {string} topic
|
|
21
6
|
* @param {object} [options]
|
|
@@ -3,84 +3,17 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file docs.detail leaf — load one topic's full reference doc.
|
|
5
5
|
*
|
|
6
|
-
* @input A topic name plus optional {lang, zh, dense}. Resolves
|
|
7
|
-
*
|
|
6
|
+
* @input A topic name plus optional {lang, zh, dense, cwd}. Resolves the topic
|
|
7
|
+
* via the shared adapter and compiles it with its token references linked.
|
|
8
8
|
* @output { type: 'docs.detail', data: ReferenceDoc } — the full doc with
|
|
9
|
-
* token-refs
|
|
10
|
-
* @position Leaf under api/docs.
|
|
11
|
-
*
|
|
9
|
+
* token-refs inlined, matching `astryx --json docs <topic>`.
|
|
10
|
+
* @position Leaf under api/docs. Reads the compiled node through the detail
|
|
11
|
+
* lens; resolution, overlays and extensions happen in the compiler.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
sourceTitle,
|
|
18
|
-
withSourceTitle,
|
|
19
|
-
} from '../../../foundation/discovery/docs-section-key.mjs';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Resolve token-ref blocks by inlining the referenced section's table.
|
|
23
|
-
* This allows section docs to reference token tables without duplicating data.
|
|
24
|
-
*
|
|
25
|
-
* The reference is resolved through the catalog, so a topic may point at one
|
|
26
|
-
* an integration contributed (or replaced) rather than only at a built-in. It
|
|
27
|
-
* names the section by key or authored title, so it resolves in every language.
|
|
28
|
-
* @param {import('../docs.type.mjs').DocsDetailResponse['data']} docsData
|
|
29
|
-
* @param {import('../../../foundation/discovery/docs-discovery.mjs').DocsCatalog} catalog
|
|
30
|
-
* @param {{lang?: string | null}} [options]
|
|
31
|
-
* @returns {Promise<import('../docs.type.mjs').DocsDetailResponse['data']>}
|
|
32
|
-
*/
|
|
33
|
-
export async function resolveTokenRefs(docsData, catalog, {lang = null} = {}) {
|
|
34
|
-
const resolved = {...docsData, sections: [...docsData.sections]};
|
|
35
|
-
for (let si = 0; si < resolved.sections.length; si++) {
|
|
36
|
-
const section = resolved.sections[si];
|
|
37
|
-
/** @type {import('@astryxdesign/cli/authoring').ReferenceContentBlock[]} */
|
|
38
|
-
const newContent = [];
|
|
39
|
-
for (const block of section.content) {
|
|
40
|
-
if (block.type === 'token-ref') {
|
|
41
|
-
const refEntry = catalog.resolve(block.topic);
|
|
42
|
-
if (!refEntry) {
|
|
43
|
-
newContent.push({type: 'prose', text: `[token-ref: unknown topic "${block.topic}"]`});
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const refDocs = await loadTopicDoc(refEntry, {lang});
|
|
47
|
-
const wanted = block.section.toLowerCase();
|
|
48
|
-
const refSection = refDocs.sections.find(
|
|
49
|
-
(/** @type {import('@astryxdesign/cli/authoring').ReferenceSection} */ s) =>
|
|
50
|
-
sectionKey(s) === block.section ||
|
|
51
|
-
sourceTitle(s).toLowerCase() === wanted,
|
|
52
|
-
);
|
|
53
|
-
if (!refSection) {
|
|
54
|
-
newContent.push({type: 'prose', text: `[token-ref: section "${block.section}" not found in "${block.topic}"]`});
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
// Inline the referenced section's content blocks (tables, prose, etc.)
|
|
58
|
-
// and carry over the previewType
|
|
59
|
-
for (const refBlock of refSection.content) {
|
|
60
|
-
newContent.push(refBlock);
|
|
61
|
-
}
|
|
62
|
-
// If the referenced section has a previewType, attach it to our section
|
|
63
|
-
if (refSection.previewType && !section.previewType) {
|
|
64
|
-
resolved.sections[si] = withSourceTitle(
|
|
65
|
-
{...section, previewType: refSection.previewType, content: newContent},
|
|
66
|
-
sourceTitle(section),
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
newContent.push(block);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (resolved.sections[si] === section) {
|
|
74
|
-
resolved.sections[si] = withSourceTitle(
|
|
75
|
-
{...section, content: newContent},
|
|
76
|
-
sourceTitle(section),
|
|
77
|
-
);
|
|
78
|
-
} else {
|
|
79
|
-
resolved.sections[si].content = newContent;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return resolved;
|
|
83
|
-
}
|
|
14
|
+
import {linkReferenceTopic} from '../../../foundation/doc-compiler/compile.mjs';
|
|
15
|
+
import {detailView} from '../../../foundation/doc-compiler/lenses.mjs';
|
|
16
|
+
import {referenceTargets, resolveTopicDocs} from '../_adapter.mjs';
|
|
84
17
|
|
|
85
18
|
/**
|
|
86
19
|
* @param {string} topic
|
|
@@ -92,7 +25,10 @@ export async function resolveTokenRefs(docsData, catalog, {lang = null} = {}) {
|
|
|
92
25
|
* @returns {Promise<import('../docs.type.mjs').DocsDetailResponse>}
|
|
93
26
|
*/
|
|
94
27
|
export async function detail(topic, options = {}) {
|
|
95
|
-
const {catalog,
|
|
96
|
-
const
|
|
97
|
-
|
|
28
|
+
const {catalog, node, lang} = await resolveTopicDocs(topic, options);
|
|
29
|
+
const linked = await linkReferenceTopic(
|
|
30
|
+
node,
|
|
31
|
+
referenceTargets(catalog, lang),
|
|
32
|
+
);
|
|
33
|
+
return {type: 'docs.detail', data: detailView(linked)};
|
|
98
34
|
}
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
* @file docs.detail.section leaf — load a single section of a topic.
|
|
5
5
|
*
|
|
6
6
|
* @input A topic name, a section query, and optional {lang, zh, dense}. Resolves
|
|
7
|
-
*
|
|
8
|
-
* stable key, then by exact title, then by a title that contains
|
|
7
|
+
* the topic via the shared adapter, finds the section in its lowered compiled
|
|
8
|
+
* node by its stable key, then by exact title, then by a title that contains
|
|
9
|
+
* the query, and links only that section.
|
|
9
10
|
* @output { type: 'docs.detail.section', data: ReferenceSection } with any
|
|
10
11
|
* token-ref blocks inlined — matching `astryx --json docs <topic> <section>`.
|
|
11
12
|
* Throws ERR_UNKNOWN_SECTION when nothing matches, or when the query matches
|
|
12
13
|
* more than one section (the candidates come back as suggestions).
|
|
13
|
-
* @position Leaf nested under api/docs/detail. Shares
|
|
14
|
-
*
|
|
14
|
+
* @position Leaf nested under api/docs/detail. Shares topic resolution with the
|
|
15
|
+
* detail leaf via _adapter.mjs and reads through the compiler's lenses.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import {AstryxError} from '../../../error.mjs';
|
|
@@ -20,8 +21,12 @@ import {
|
|
|
20
21
|
findDocSection,
|
|
21
22
|
sectionKey,
|
|
22
23
|
} from '../../../../foundation/discovery/docs-section-key.mjs';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
24
|
+
import {linkReferenceSection} from '../../../../foundation/doc-compiler/compile.mjs';
|
|
25
|
+
import {
|
|
26
|
+
readerSections,
|
|
27
|
+
sectionView,
|
|
28
|
+
} from '../../../../foundation/doc-compiler/lenses.mjs';
|
|
29
|
+
import {referenceTargets, resolveTopicDocs} from '../../_adapter.mjs';
|
|
25
30
|
|
|
26
31
|
/**
|
|
27
32
|
* @param {string} topic
|
|
@@ -44,31 +49,30 @@ export async function section(topic, sectionName, options = {}) {
|
|
|
44
49
|
ERROR_CODES.ERR_UNKNOWN_SECTION,
|
|
45
50
|
);
|
|
46
51
|
}
|
|
47
|
-
const {catalog, docsData, lang} = await resolveTopicDocs(topic, options);
|
|
48
52
|
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
);
|
|
53
|
+
const {catalog, node, lang} = await resolveTopicDocs(topic, options);
|
|
54
|
+
const sections = readerSections(node);
|
|
55
|
+
const {section: match, candidates} = findDocSection(sections, sectionName);
|
|
53
56
|
if (!match) {
|
|
54
57
|
const ambiguous = candidates.length > 1;
|
|
55
58
|
throw new AstryxError(
|
|
56
59
|
ambiguous
|
|
57
60
|
? `Section "${sectionName}" matches ${candidates.length} sections in "${topic}". Read one by its key.`
|
|
58
61
|
: `Section "${sectionName}" not found in "${topic}"`,
|
|
59
|
-
(ambiguous ? candidates :
|
|
62
|
+
(ambiguous ? candidates : sections).map(s => ({
|
|
60
63
|
name: sectionKey(s),
|
|
61
64
|
reason: s.title,
|
|
62
65
|
})),
|
|
63
66
|
ERROR_CODES.ERR_UNKNOWN_SECTION,
|
|
64
67
|
);
|
|
65
68
|
}
|
|
69
|
+
|
|
66
70
|
// A section read on its own inlines its token refs, as the whole topic does;
|
|
67
|
-
// otherwise a section that is only a token-ref prints blank.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
// otherwise a section that is only a token-ref prints blank. Only this
|
|
72
|
+
// section is linked, so a broken reference elsewhere cannot fail the read.
|
|
73
|
+
const linked = await linkReferenceSection(
|
|
74
|
+
match,
|
|
75
|
+
referenceTargets(catalog, lang),
|
|
72
76
|
);
|
|
73
|
-
return {type: 'docs.detail.section', data:
|
|
77
|
+
return {type: 'docs.detail.section', data: sectionView(node, linked)};
|
|
74
78
|
}
|