@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
|
@@ -1,245 +1,76 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file Component doc loader
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {pathToFileURL} from 'node:url';
|
|
8
|
-
import {importUserModule} from '../fs/module-loader.mjs';
|
|
9
|
-
import {parseDoc} from '../../authoring/doctypes/parse.mjs';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Load a component doc through the shared load/validation boundary.
|
|
13
|
-
*
|
|
14
|
-
* This is the typed counterpart to {@link loadDocs}: it loads `.doc.ts` via
|
|
15
|
-
* jiti (and `.doc.mjs`/`.doc.js` via native import) and validates via
|
|
16
|
-
* `parseDoc`, which accepts BOTH formats, so this loader reads whichever the
|
|
17
|
-
* file uses:
|
|
18
|
-
* - NEW: a stamped default export (`export default {type: 'component', ...}`
|
|
19
|
-
* / `'function'` / `'generic'`) — the same single-export convention the
|
|
20
|
-
* other authoring parsers use for config/integration/template. These carry
|
|
21
|
-
* a stamped `type` and validate against the matching per-kind parser.
|
|
22
|
-
* - OLD: the legacy loose `export const docs = {...}` (no `type`), validated
|
|
23
|
-
* against the permissive legacy union.
|
|
24
|
-
* The default export wins when both are present. Throws a readable
|
|
25
|
-
* `formatZodError`-style message on failure. Translations (`docsZh`/
|
|
26
|
-
* `docsDense`) are merged exactly as {@link loadDocs} does so callers see
|
|
27
|
-
* identical output.
|
|
4
|
+
* @file Component and hook doc loader.
|
|
28
5
|
*
|
|
29
|
-
* @
|
|
30
|
-
*
|
|
31
|
-
* @
|
|
6
|
+
* @input A component or hook `.doc.{ts,mjs,js}` path and the reading language
|
|
7
|
+
* (`lang`, or the legacy `zh`/`dense` flags).
|
|
8
|
+
* @output The module's own doc, with its translation laid over it for `lang`.
|
|
9
|
+
* @position The loaders every component and hook reader calls. Both read
|
|
10
|
+
* through the doc compiler (foundation/doc-compiler/read.mjs), which lowers
|
|
11
|
+
* the doc on every read. The two differ only in how strict they are:
|
|
12
|
+
* {@link loadComponentDoc} reports a doc that fails its kind's parser, and
|
|
13
|
+
* {@link loadDocs}, which has never checked docs, still reads one.
|
|
32
14
|
*/
|
|
33
|
-
export async function loadComponentDoc(
|
|
34
|
-
docPath,
|
|
35
|
-
{zh = false, dense = false, lang} = {},
|
|
36
|
-
) {
|
|
37
|
-
const mod = await importUserModule(docPath);
|
|
38
|
-
/** @type {any} */
|
|
39
|
-
const authored = mod?.default ?? mod?.docs;
|
|
40
|
-
|
|
41
|
-
parseDoc(authored, docPath);
|
|
42
|
-
const docs = authored;
|
|
43
15
|
|
|
44
|
-
|
|
45
|
-
if (!locale) return docs;
|
|
16
|
+
import {readDocView} from '../doc-compiler/read.mjs';
|
|
46
17
|
|
|
47
|
-
|
|
48
|
-
locale === 'zh' ? 'docsZh' : locale === 'dense' ? 'docsDense' : null;
|
|
49
|
-
if (!translationKey || !mod[translationKey]) return docs;
|
|
50
|
-
|
|
51
|
-
/** @type {any} */
|
|
52
|
-
const translation = mod[translationKey];
|
|
53
|
-
if (translation.props || translation.components?.some((/** @type {any} */ c) => c.props)) {
|
|
54
|
-
return overlayComponentDoc(docs, translation);
|
|
55
|
-
}
|
|
56
|
-
return mergeTranslation(docs, translation);
|
|
57
|
-
}
|
|
18
|
+
export {mergeTranslation} from '../doc-compiler/overlays.mjs';
|
|
58
19
|
|
|
59
20
|
/**
|
|
60
|
-
* @
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
21
|
+
* @typedef {object} LoadDocOptions
|
|
22
|
+
* @property {boolean} [zh] legacy flag for `lang: 'zh'`
|
|
23
|
+
* @property {boolean} [dense] legacy flag for `lang: 'dense'`
|
|
24
|
+
* @property {string | null} [lang] wins over the legacy flags
|
|
25
|
+
* @property {'components' | 'hooks'} [root] which root reads the doc
|
|
26
|
+
* (default: components)
|
|
63
27
|
*/
|
|
64
|
-
export function mergeTranslation(docs, translation) {
|
|
65
|
-
if (!translation) return docs;
|
|
66
|
-
|
|
67
|
-
/** @type {any} */
|
|
68
|
-
const merged = {...docs};
|
|
69
|
-
|
|
70
|
-
// Merge prose into usage
|
|
71
|
-
if (merged.usage) {
|
|
72
|
-
merged.usage = {...merged.usage};
|
|
73
|
-
if (translation.usage?.description) merged.usage.description = translation.usage.description;
|
|
74
|
-
else if (translation.description) merged.usage.description = translation.description;
|
|
75
|
-
if (translation.usage?.bestPractices) merged.usage.bestPractices = translation.usage.bestPractices;
|
|
76
|
-
if (translation.usage?.accessibility) merged.usage.accessibility = translation.usage.accessibility;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Legacy top-level fields (for docsZh that are full ComponentDoc clones)
|
|
80
|
-
if (translation.description && !merged.usage) merged.description = translation.description;
|
|
81
|
-
|
|
82
|
-
// Merge prop descriptions for single-component docs
|
|
83
|
-
if (translation.propDescriptions && merged.props) {
|
|
84
|
-
merged.props = merged.props.map((/** @type {any} */ prop) => {
|
|
85
|
-
const desc = translation.propDescriptions[prop.name];
|
|
86
|
-
return desc != null ? {...prop, description: desc} : prop;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Merge hook param descriptions (HookTranslationDoc). Params are an array of
|
|
91
|
-
// {name, type, description, required}; override description by name where the
|
|
92
|
-
// translation has an entry. Names may include dots (e.g. 'options.isActive');
|
|
93
|
-
// the lookup is keyed by the exact param name.
|
|
94
|
-
if (translation.paramDescriptions && merged.params) {
|
|
95
|
-
merged.params = merged.params.map((/** @type {any} */ param) => {
|
|
96
|
-
const desc = translation.paramDescriptions[param.name];
|
|
97
|
-
return desc != null ? {...param, description: desc} : param;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Merge hook return descriptions (HookTranslationDoc). Returns are an array
|
|
102
|
-
// of {name, type, description}; override description by name where present.
|
|
103
|
-
if (translation.returnDescriptions && merged.returns) {
|
|
104
|
-
merged.returns = merged.returns.map((/** @type {any} */ ret) => {
|
|
105
|
-
const desc = translation.returnDescriptions[ret.name];
|
|
106
|
-
return desc != null ? {...ret, description: desc} : ret;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Merge sub-component translations
|
|
111
|
-
if (translation.components && merged.components) {
|
|
112
|
-
merged.components = merged.components.map((/** @type {any} */ comp, /** @type {any} */ i) => {
|
|
113
|
-
const trans = translation.components.find((/** @type {any} */ t) => t.name === comp.name)
|
|
114
|
-
|| translation.components[i];
|
|
115
|
-
if (!trans) return comp;
|
|
116
|
-
|
|
117
|
-
const mergedComp = {...comp};
|
|
118
|
-
if (trans.description) mergedComp.description = trans.description;
|
|
119
|
-
if (trans.propDescriptions && comp.props) {
|
|
120
|
-
mergedComp.props = comp.props.map((/** @type {any} */ prop) => {
|
|
121
|
-
const desc = trans.propDescriptions[prop.name];
|
|
122
|
-
return desc != null ? {...prop, description: desc} : prop;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return mergedComp;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return merged;
|
|
130
|
-
}
|
|
131
28
|
|
|
132
29
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* Translations are merged onto the base docs, keeping structure intact.
|
|
137
|
-
* @param {string} readmePath
|
|
138
|
-
* @param {{zh?: boolean, dense?: boolean, lang?: string}} [opts]
|
|
139
|
-
* @returns {Promise<any>}
|
|
30
|
+
* The overlay a read applies: `lang`, else the legacy flags.
|
|
31
|
+
* @param {LoadDocOptions} opts
|
|
32
|
+
* @returns {string | null}
|
|
140
33
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
// Support both the new stamped default export (`export default {type: 'component', …}`)
|
|
144
|
-
// and the legacy named export (`export const docs = {…}`). Default wins when both
|
|
145
|
-
// are present, matching loadComponentDoc's precedence.
|
|
146
|
-
const docs = mod?.default ?? mod.docs;
|
|
147
|
-
|
|
148
|
-
// Resolve which translation to use (--lang takes priority over legacy flags)
|
|
149
|
-
const locale = lang || (dense ? 'dense' : zh ? 'zh' : null);
|
|
150
|
-
if (!locale) return docs;
|
|
151
|
-
|
|
152
|
-
const translationKey = locale === 'zh' ? 'docsZh' : locale === 'dense' ? 'docsDense' : null;
|
|
153
|
-
if (!translationKey || !mod[translationKey]) return docs;
|
|
154
|
-
|
|
155
|
-
const translation = mod[translationKey];
|
|
156
|
-
|
|
157
|
-
// A full ComponentDoc-shaped translation (legacy docsZh shape) used to be
|
|
158
|
-
// returned wholesale. That made it a REPLACEMENT, not an overlay: any prop
|
|
159
|
-
// the translation had not caught up with simply ceased to exist —
|
|
160
|
-
// `component Button --zh` silently omitted `isInterruptible` and
|
|
161
|
-
// `isIconOnly`. A reader of the translated docs cannot discover a prop that
|
|
162
|
-
// is not there. Overlay it instead, so an untranslated prop falls back to
|
|
163
|
-
// its English entry. (Same principle as the reference-doc overlays, #2182.)
|
|
164
|
-
if (translation.props || translation.components?.some((/** @type {any} */ c) => c.props)) {
|
|
165
|
-
return overlayComponentDoc(docs, translation);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Otherwise it's a ComponentTranslationDoc — merge it onto docs
|
|
169
|
-
return mergeTranslation(docs, translation);
|
|
34
|
+
function localeOf({zh = false, dense = false, lang} = {}) {
|
|
35
|
+
return lang || (dense ? 'dense' : zh ? 'zh' : null);
|
|
170
36
|
}
|
|
171
37
|
|
|
172
38
|
/**
|
|
173
|
-
*
|
|
39
|
+
* Load a component or hook doc and check it against its kind's parser.
|
|
174
40
|
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
41
|
+
* Reads `.doc.ts` through jiti and `.doc.mjs`/`.doc.js` natively. Both formats
|
|
42
|
+
* load: a stamped default export (`export default {type: 'component', ...}`)
|
|
43
|
+
* checked against its kind, and the legacy `export const docs = {...}` checked
|
|
44
|
+
* against the permissive legacy union. The default export wins when both are
|
|
45
|
+
* present. Throws the parser's readable message when the doc fails.
|
|
179
46
|
*
|
|
180
|
-
* @param {
|
|
181
|
-
* @param {
|
|
182
|
-
* @returns {any}
|
|
47
|
+
* @param {string} docPath absolute path to a `.doc.{ts,mjs,js}` file
|
|
48
|
+
* @param {LoadDocOptions} [opts]
|
|
49
|
+
* @returns {Promise<any>} the checked (and optionally translated) doc
|
|
183
50
|
*/
|
|
184
|
-
function
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const byName = new Map((tProps ?? []).map((/** @type {any} */ p) => [p.name, p]));
|
|
192
|
-
return baseProps.map((/** @type {any} */ prop) => {
|
|
193
|
-
const t = byName.get(prop.name);
|
|
194
|
-
// Take the translated text, but never let it drop the prop's contract
|
|
195
|
-
// (type/default/required stay authoritative from the English doc).
|
|
196
|
-
return t ? {...prop, ...t, name: prop.name, type: prop.type} : prop;
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
/** Preserve canonical structured guidance added after legacy full-doc translations,
|
|
201
|
-
* without changing established translated prose behavior.
|
|
202
|
-
* @param {any} baseUsage
|
|
203
|
-
* @param {any} translatedUsage
|
|
204
|
-
*/
|
|
205
|
-
const mergeUsage = (baseUsage, translatedUsage) => {
|
|
206
|
-
if (!translatedUsage) return baseUsage;
|
|
207
|
-
return {
|
|
208
|
-
...translatedUsage,
|
|
209
|
-
...(translatedUsage.accessibility === undefined &&
|
|
210
|
-
baseUsage?.accessibility !== undefined
|
|
211
|
-
? {accessibility: baseUsage.accessibility}
|
|
212
|
-
: null),
|
|
213
|
-
...(translatedUsage.accessibilityThemeCoverage === undefined &&
|
|
214
|
-
baseUsage?.accessibilityThemeCoverage !== undefined
|
|
215
|
-
? {accessibilityThemeCoverage: baseUsage.accessibilityThemeCoverage}
|
|
216
|
-
: null),
|
|
217
|
-
...(translatedUsage.anatomy === undefined && baseUsage?.anatomy !== undefined
|
|
218
|
-
? {anatomy: baseUsage.anatomy}
|
|
219
|
-
: null),
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const merged = {...docs, ...translation, usage: mergeUsage(docs.usage, translation.usage)};
|
|
224
|
-
|
|
225
|
-
merged.props = overlayProps(docs.props, translation.props);
|
|
226
|
-
|
|
227
|
-
if (docs.components) {
|
|
228
|
-
const tByName = new Map(
|
|
229
|
-
(translation.components ?? []).map((/** @type {any} */ c) => [c.name, c]),
|
|
230
|
-
);
|
|
231
|
-
merged.components = docs.components.map((/** @type {any} */ base) => {
|
|
232
|
-
const t = tByName.get(base.name);
|
|
233
|
-
if (!t) return base;
|
|
234
|
-
return {...base, ...t, usage: mergeUsage(base.usage, t.usage), props: overlayProps(base.props, t.props)};
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return merged;
|
|
51
|
+
export async function loadComponentDoc(docPath, opts = {}) {
|
|
52
|
+
return readDocView(docPath, {
|
|
53
|
+
root: opts.root ?? 'components',
|
|
54
|
+
lang: localeOf(opts),
|
|
55
|
+
label: docPath,
|
|
56
|
+
strict: true,
|
|
57
|
+
});
|
|
239
58
|
}
|
|
240
59
|
|
|
241
60
|
/**
|
|
242
|
-
*
|
|
243
|
-
* and
|
|
244
|
-
*
|
|
61
|
+
* Load a component or hook doc without checking it. Supports `lang` ('zh' for
|
|
62
|
+
* Chinese, 'dense' for compressed) and the legacy `zh`/`dense` flags; the
|
|
63
|
+
* translation is laid over the doc, keeping its structure. A file that exports
|
|
64
|
+
* no doc reads as `undefined`.
|
|
65
|
+
* @param {string} readmePath
|
|
66
|
+
* @param {LoadDocOptions} [opts]
|
|
67
|
+
* @returns {Promise<any>}
|
|
245
68
|
*/
|
|
69
|
+
export async function loadDocs(readmePath, opts = {}) {
|
|
70
|
+
return readDocView(readmePath, {
|
|
71
|
+
root: opts.root ?? 'components',
|
|
72
|
+
lang: localeOf(opts),
|
|
73
|
+
label: readmePath,
|
|
74
|
+
loader: 'native',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -74,8 +74,9 @@ export function discoverIntegrationDocs(integration: {
|
|
|
74
74
|
/**
|
|
75
75
|
* Merge an extension onto a base topic: a section with a stable `id` replaces
|
|
76
76
|
* the base section with the same `id`; legacy sections without IDs fall back to
|
|
77
|
-
* title matching. A section with no match is appended
|
|
78
|
-
*
|
|
77
|
+
* title matching. A section with no match is appended. The title and
|
|
78
|
+
* description stay the base topic's: an extension adds to a topic, it never
|
|
79
|
+
* renames it. A topic that `replaces` another is the one that renames.
|
|
79
80
|
*
|
|
80
81
|
* Keyed by section TITLE rather than by position, the way the localization
|
|
81
82
|
* overlays are — position keying grafts an overlay onto whichever section
|
|
@@ -94,6 +95,10 @@ export { withSourceTitle };
|
|
|
94
95
|
* unlike component discovery, whose built-ins belong to core.
|
|
95
96
|
*/
|
|
96
97
|
export const BUILTIN_DOCS_PACKAGE: import("../../authoring/index.js").ProviderId;
|
|
98
|
+
/** Blocks that are valid authoring but require the compiled graph renderer. */
|
|
99
|
+
export const GRAPH_BLOCK_TYPES: Set<string>;
|
|
100
|
+
/** Doc fields only the docs graph reads; a topic that sets one fails to load. */
|
|
101
|
+
export const GRAPH_ONLY_FIELDS: string[];
|
|
97
102
|
/**
|
|
98
103
|
* Every topic a project can read, and the relationships between them.
|
|
99
104
|
*
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
import * as fs from 'node:fs';
|
|
33
33
|
import * as path from 'node:path';
|
|
34
34
|
import {CLI_ROOT} from '../fs/paths.mjs';
|
|
35
|
-
import {
|
|
35
|
+
import {importDocModule} from '../doc-compiler/import.mjs';
|
|
36
36
|
import {CLI_PROVIDER_ID} from '../identity/providers.mjs';
|
|
37
|
-
import {
|
|
37
|
+
import {parseReadableDoc} from '../doc-compiler/parse-readable.mjs';
|
|
38
38
|
import {
|
|
39
39
|
sectionKey,
|
|
40
40
|
sectionKeyProblems,
|
|
@@ -117,7 +117,7 @@ export function discoverBuiltinTopics() {
|
|
|
117
117
|
* @returns {Promise<unknown>} the authored doc value
|
|
118
118
|
*/
|
|
119
119
|
export async function loadTopicModule(file) {
|
|
120
|
-
const mod = await
|
|
120
|
+
const mod = await importDocModule(file);
|
|
121
121
|
const doc = mod?.docs ?? mod?.default;
|
|
122
122
|
if (doc == null) {
|
|
123
123
|
throw new Error(
|
|
@@ -138,7 +138,14 @@ const BLOCK_FIELDS = {
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
/** Blocks that are valid authoring but require the compiled graph renderer. */
|
|
141
|
-
const GRAPH_BLOCK_TYPES = new Set([
|
|
141
|
+
export const GRAPH_BLOCK_TYPES = new Set([
|
|
142
|
+
'workflow',
|
|
143
|
+
'collection',
|
|
144
|
+
'reference',
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
/** Doc fields only the docs graph reads; a topic that sets one fails to load. */
|
|
148
|
+
export const GRAPH_ONLY_FIELDS = ['placement', 'aliases', 'audience'];
|
|
142
149
|
|
|
143
150
|
/**
|
|
144
151
|
* Fields a block kind may carry but does not need. Kept per kind rather than
|
|
@@ -176,6 +183,13 @@ const SECTION_FIELDS = ['id', 'title', 'category', 'content', 'previewType'];
|
|
|
176
183
|
* @returns {string[]} problems, each already pointed at a place in the doc
|
|
177
184
|
*/
|
|
178
185
|
export function problemsInTopic(doc) {
|
|
186
|
+
// A namespace doc is valid authoring that only the docs graph reads. Said
|
|
187
|
+
// plainly, instead of as the topic fields it does not have.
|
|
188
|
+
if (doc?.type === 'namespace') {
|
|
189
|
+
return [
|
|
190
|
+
`"${doc.name}" is a namespace doc. Only the docs graph reads namespace docs, and it is not built yet; remove this file from the docs directory.`,
|
|
191
|
+
];
|
|
192
|
+
}
|
|
179
193
|
/** @type {string[]} */
|
|
180
194
|
const problems = [];
|
|
181
195
|
for (const field of ['name', 'title', 'description']) {
|
|
@@ -188,7 +202,7 @@ export function problemsInTopic(doc) {
|
|
|
188
202
|
`name: "${doc.name}" is not URL-safe. A topic name is its CLI argument and its docsite path, so it may hold only letters, digits, "_" and "-".`,
|
|
189
203
|
);
|
|
190
204
|
}
|
|
191
|
-
for (const field of
|
|
205
|
+
for (const field of GRAPH_ONLY_FIELDS) {
|
|
192
206
|
if (doc?.[field] != null) {
|
|
193
207
|
problems.push(
|
|
194
208
|
`${field}: requires the compiled graph reader and is not supported by legacy topic readers`,
|
|
@@ -349,7 +363,7 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
349
363
|
for (const file of files) {
|
|
350
364
|
let doc;
|
|
351
365
|
try {
|
|
352
|
-
doc =
|
|
366
|
+
doc = parseReadableDoc(await loadTopicModule(file), path.basename(file));
|
|
353
367
|
} catch (err) {
|
|
354
368
|
errors.push(
|
|
355
369
|
new Error(
|
|
@@ -409,8 +423,9 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
409
423
|
/**
|
|
410
424
|
* Merge an extension onto a base topic: a section with a stable `id` replaces
|
|
411
425
|
* the base section with the same `id`; legacy sections without IDs fall back to
|
|
412
|
-
* title matching. A section with no match is appended
|
|
413
|
-
*
|
|
426
|
+
* title matching. A section with no match is appended. The title and
|
|
427
|
+
* description stay the base topic's: an extension adds to a topic, it never
|
|
428
|
+
* renames it. A topic that `replaces` another is the one that renames.
|
|
414
429
|
*
|
|
415
430
|
* Keyed by section TITLE rather than by position, the way the localization
|
|
416
431
|
* overlays are — position keying grafts an overlay onto whichever section
|
|
@@ -437,12 +452,7 @@ export function mergeTopic(base, overlay) {
|
|
|
437
452
|
: section;
|
|
438
453
|
}
|
|
439
454
|
}
|
|
440
|
-
return {
|
|
441
|
-
...base,
|
|
442
|
-
title: overlay.title || base.title,
|
|
443
|
-
description: overlay.description || base.description,
|
|
444
|
-
sections,
|
|
445
|
-
};
|
|
455
|
+
return {...base, sections};
|
|
446
456
|
}
|
|
447
457
|
|
|
448
458
|
/**
|
|
@@ -182,6 +182,26 @@ describe('discoverIntegrationDocs', () => {
|
|
|
182
182
|
expect(records).toEqual([]);
|
|
183
183
|
expect(errors[0].message).toContain('requires the compiled graph renderer');
|
|
184
184
|
});
|
|
185
|
+
|
|
186
|
+
it('names a namespace doc instead of listing topic fields it lacks', async () => {
|
|
187
|
+
const {records, errors} = await discoverIntegrationDocs(
|
|
188
|
+
integration('@acme/namespace', {
|
|
189
|
+
'guides.doc.mjs': {
|
|
190
|
+
type: 'namespace',
|
|
191
|
+
name: 'guides',
|
|
192
|
+
title: 'Guides',
|
|
193
|
+
summary: 'Every guide.',
|
|
194
|
+
slots: {guides: {title: 'Guides', accepts: {kinds: ['generic']}}},
|
|
195
|
+
},
|
|
196
|
+
}),
|
|
197
|
+
);
|
|
198
|
+
expect(records).toEqual([]);
|
|
199
|
+
expect(errors).toHaveLength(1);
|
|
200
|
+
expect(errors[0].message).toContain(
|
|
201
|
+
'"guides" is a namespace doc. Only the docs graph reads namespace docs',
|
|
202
|
+
);
|
|
203
|
+
expect(errors[0].message).not.toContain('sections:');
|
|
204
|
+
});
|
|
185
205
|
});
|
|
186
206
|
|
|
187
207
|
describe('problemsInTopic', () => {
|
|
@@ -485,11 +505,14 @@ describe('mergeTopic', () => {
|
|
|
485
505
|
]);
|
|
486
506
|
});
|
|
487
507
|
|
|
488
|
-
it('
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
'
|
|
492
|
-
|
|
508
|
+
it('keeps the base title and description: an extension never renames a topic', () => {
|
|
509
|
+
const merged = mergeTopic(base, {
|
|
510
|
+
title: 'Acme theme notes',
|
|
511
|
+
description: 'Our additions.',
|
|
512
|
+
sections: [],
|
|
513
|
+
});
|
|
514
|
+
expect(merged.title).toBe('Theme');
|
|
515
|
+
expect(merged.description).toBe('Theming.');
|
|
493
516
|
});
|
|
494
517
|
});
|
|
495
518
|
|
|
@@ -500,7 +523,10 @@ describe('problemsInTopic section keys', () => {
|
|
|
500
523
|
name: 'keys',
|
|
501
524
|
title: 'Keys',
|
|
502
525
|
description: 'Section keys.',
|
|
503
|
-
sections: sections.map(s => ({
|
|
526
|
+
sections: sections.map(s => ({
|
|
527
|
+
content: [{type: 'prose', text: 'x'}],
|
|
528
|
+
...s,
|
|
529
|
+
})),
|
|
504
530
|
});
|
|
505
531
|
|
|
506
532
|
it('rejects two sections that derive the same key', () => {
|
|
@@ -512,18 +538,18 @@ describe('problemsInTopic section keys', () => {
|
|
|
512
538
|
});
|
|
513
539
|
|
|
514
540
|
it('rejects an unsafe id', () => {
|
|
515
|
-
expect(
|
|
516
|
-
[
|
|
517
|
-
);
|
|
541
|
+
expect(
|
|
542
|
+
problemsInTopic(doc([{id: 'Quick Start', title: 'Quick Start'}])),
|
|
543
|
+
).toEqual([expect.stringContaining('is not a stable key')]);
|
|
518
544
|
});
|
|
519
545
|
|
|
520
546
|
it('rejects a title no key derives from, unless it has an id', () => {
|
|
521
547
|
expect(problemsInTopic(doc([{title: '亮/暗模式'}]))).toEqual([
|
|
522
548
|
expect.stringContaining('Give the section an id'),
|
|
523
549
|
]);
|
|
524
|
-
expect(
|
|
525
|
-
[],
|
|
526
|
-
);
|
|
550
|
+
expect(
|
|
551
|
+
problemsInTopic(doc([{id: 'light-dark', title: '亮/暗模式'}])),
|
|
552
|
+
).toEqual([]);
|
|
527
553
|
});
|
|
528
554
|
});
|
|
529
555
|
|
|
@@ -535,12 +561,17 @@ describe('mergeTopic by section key', () => {
|
|
|
535
561
|
{title: 'Light/Dark Mode', content: [{type: 'prose', text: 'base'}]},
|
|
536
562
|
],
|
|
537
563
|
};
|
|
538
|
-
const titles = doc =>
|
|
564
|
+
const titles = doc =>
|
|
565
|
+
doc.sections.map(s => [s.id ?? null, s.title, s.content[0].text]);
|
|
539
566
|
|
|
540
567
|
it('replaces the section whose derived key an extension id names', () => {
|
|
541
568
|
const merged = mergeTopic(base, {
|
|
542
569
|
sections: [
|
|
543
|
-
{
|
|
570
|
+
{
|
|
571
|
+
id: 'quick-start',
|
|
572
|
+
title: 'Quick Start with Acme',
|
|
573
|
+
content: [{type: 'prose', text: 'acme'}],
|
|
574
|
+
},
|
|
544
575
|
],
|
|
545
576
|
});
|
|
546
577
|
expect(titles(merged)).toEqual([
|
|
@@ -551,7 +582,9 @@ describe('mergeTopic by section key', () => {
|
|
|
551
582
|
|
|
552
583
|
it('replaces the section a title variant derives the same key as', () => {
|
|
553
584
|
const merged = mergeTopic(base, {
|
|
554
|
-
sections: [
|
|
585
|
+
sections: [
|
|
586
|
+
{title: 'Light-Dark Mode', content: [{type: 'prose', text: 'acme'}]},
|
|
587
|
+
],
|
|
555
588
|
});
|
|
556
589
|
expect(titles(merged)).toEqual([
|
|
557
590
|
[null, 'Quick Start', 'base'],
|
|
@@ -561,7 +594,13 @@ describe('mergeTopic by section key', () => {
|
|
|
561
594
|
|
|
562
595
|
it('prefers the key over a legacy title for an extension with an id', () => {
|
|
563
596
|
const merged = mergeTopic(base, {
|
|
564
|
-
sections: [
|
|
597
|
+
sections: [
|
|
598
|
+
{
|
|
599
|
+
id: 'light-dark-mode',
|
|
600
|
+
title: 'Quick Start',
|
|
601
|
+
content: [{type: 'prose', text: 'acme'}],
|
|
602
|
+
},
|
|
603
|
+
],
|
|
565
604
|
});
|
|
566
605
|
expect(titles(merged)).toEqual([
|
|
567
606
|
[null, 'Quick Start', 'base'],
|
|
@@ -11,11 +11,20 @@ export function pkgOf(t: {
|
|
|
11
11
|
package?: string;
|
|
12
12
|
}): string;
|
|
13
13
|
/**
|
|
14
|
-
* Replace
|
|
15
|
-
* render with zero setup. Images get a self-contained data
|
|
16
|
-
* (which have no equivalent inline placeholder — see
|
|
17
|
-
* stripped to an empty src instead of being
|
|
18
|
-
* Builders drop in their own media either way.
|
|
14
|
+
* Replace each Astryx template fixture reference with a placeholder so
|
|
15
|
+
* scaffolded pages render with zero setup. Images get a self-contained data
|
|
16
|
+
* URI; videos (which have no equivalent inline placeholder — see
|
|
17
|
+
* VIDEO_EXTENSIONS) are stripped to an empty src instead of being
|
|
18
|
+
* mis-replaced with image data. Builders drop in their own media either way.
|
|
19
|
+
*
|
|
20
|
+
* A reference is a URL token that resolves to a root-relative path under
|
|
21
|
+
* FIXTURE_SEGMENT. It is replaced whole, query and fragment included, and
|
|
22
|
+
* classified by the suffix of its last path segment. A reference that cannot
|
|
23
|
+
* be replaced safely throws with its path rather than being guessed at or
|
|
24
|
+
* left behind. Prose is left as written: in text (JSX text, a word inside a
|
|
25
|
+
* longer string) trailing punctuation is not part of a path and a path with
|
|
26
|
+
* no suffix, such as the bare directory, is a mention; inside a comment
|
|
27
|
+
* nothing throws.
|
|
19
28
|
*
|
|
20
29
|
* @param {string} source - Template source code.
|
|
21
30
|
* @returns {string} Source with demo asset references replaced.
|
|
@@ -28,6 +37,13 @@ export function stripTemplateAssetRefs(source: string): string;
|
|
|
28
37
|
* @returns {string[]}
|
|
29
38
|
*/
|
|
30
39
|
export function listTemplates(): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the template-spec file for a core page directory: the first existing
|
|
42
|
+
* metadata file in {@link ALL_TEMPLATE_SUFFIXES} precedence, or null.
|
|
43
|
+
* @param {string} dirPath
|
|
44
|
+
* @returns {string | null}
|
|
45
|
+
*/
|
|
46
|
+
export function findPageDocFile(dirPath: string): string | null;
|
|
31
47
|
/**
|
|
32
48
|
* Discover only the templates built into @astryxdesign/core. Integration
|
|
33
49
|
* authoring checks use this narrower surface so a broken project config or a
|