@astryxdesign/cli 0.6.5 → 0.6.6-canary.13d926e
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/CHANGELOG.md +87 -0
- package/README.md +58 -55
- package/api/build/_adapter.d.mts +55 -2
- package/api/build/_adapter.mjs +100 -10
- package/api/build/build.doc.mjs +2 -2
- package/api/build/build.test.mjs +111 -2
- package/api/build/build.type.d.mts +8 -0
- package/api/build/build.type.mjs +2 -0
- package/api/build/kit/kit.mjs +99 -22
- package/api/build/kit/rank.d.mts +32 -8
- package/api/build/kit/rank.mjs +291 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/build/kit/weights.d.mts +82 -0
- package/api/build/kit/weights.json +1 -0
- package/api/build/kit/weights.mjs +305 -0
- package/api/build/kit/weights.test.mjs +190 -0
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +603 -0
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +25 -0
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.mjs +7 -1
- package/api/docs/docOverlays.test.mjs +10 -6
- package/api/docs/docs.d.mts +6 -0
- package/api/docs/docs.depth.test.mjs +134 -0
- package/api/docs/docs.doc.mjs +31 -2
- package/api/docs/docs.mjs +46 -1
- package/api/docs/docs.test.mjs +279 -0
- package/api/docs/docs.type.d.mts +81 -4
- package/api/docs/docs.type.mjs +41 -4
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +572 -0
- package/api/docs/integrationDocs.test.mjs +337 -0
- package/api/docs/node/node.d.mts +28 -3
- package/api/docs/node/node.mjs +149 -23
- package/api/doctor/_adapter.d.mts +43 -0
- package/api/doctor/_adapter.mjs +142 -0
- package/api/doctor/doctor.d.mts +0 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +6 -123
- package/api/doctor/theme-checks.d.mts +12 -0
- package/api/doctor/theme-checks.mjs +1117 -0
- package/api/doctor/theme-checks.test.mjs +526 -0
- package/api/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.d.mts +3 -1
- package/api/gap-report/gap-report.mjs +27 -3
- package/api/gap-report/gap-report.test.mjs +106 -0
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +10 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/add-contribution.test.mjs +3 -3
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +354 -28
- package/api/integration/add-theme.test.mjs +380 -16
- package/api/integration/authoring-checks.mjs +31 -8
- package/api/integration/authoring-checks.type.d.mts +8 -0
- package/api/integration/authoring-checks.type.mjs +7 -3
- package/api/integration/integration-authoring.type.d.mts +4 -1
- package/api/integration/integration-authoring.type.mjs +6 -1
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddTheme.doc.mjs +10 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +495 -4
- package/api/integration/pack-check.test.mjs +619 -10
- package/api/integration/validate-integration.d.mts +4 -2
- package/api/integration/validate-integration.mjs +7 -2
- package/api/integration/validate-integration.test.mjs +55 -0
- package/api/integration/validate-integration.type.d.mts +5 -0
- package/api/integration/validate-integration.type.mjs +5 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/layout/expand/expand.mjs +12 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search.d.mts +39 -8
- package/api/search/search.doc.mjs +4 -4
- package/api/search/search.mjs +248 -66
- package/api/search/search.test.mjs +829 -0
- package/api/search/search.type.d.mts +6 -6
- package/api/search/search.type.mjs +5 -5
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +95 -13
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +4 -0
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +15 -8
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/show/show.mjs +17 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +6 -2
- package/api/template/template.mjs +2 -0
- package/api/template/template.type.d.mts +14 -0
- package/api/template/template.type.mjs +5 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +50 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.icon-lineage.test.mjs +117 -0
- package/api/theme/build/build.icon-preservation.test.mjs +639 -0
- package/api/theme/build/build.mjs +463 -155
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.test.mjs +220 -1
- package/api/theme/build/icon-imports.d.mts +47 -0
- package/api/theme/build/icon-imports.mjs +691 -0
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.d.mts +4 -1
- package/api/theme/themeBuild.doc.mjs +15 -4
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/run/run.mjs +20 -3
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.type.d.mts +5 -0
- package/api/upgrade/upgrade.type.mjs +2 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/transforms/next/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/next/index.mjs +14 -1
- package/assets/codemods/transforms/next/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +161 -0
- package/assets/docs/getting-started.doc.mjs +59 -15
- package/assets/docs/icons.doc.mjs +1 -0
- package/assets/docs/principles.doc.dense.mjs +2 -2
- package/assets/docs/principles.doc.mjs +2 -2
- package/assets/docs/principles.doc.zh.mjs +2 -2
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/styling.doc.mjs +2 -2
- package/assets/docs/theme.doc.dense.mjs +10 -198
- package/assets/docs/theme.doc.mjs +13 -770
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tokens.doc.mjs +4 -4
- package/assets/docs/tree/add-a-theme.doc.mjs +6 -2
- package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +6 -5
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
- package/assets/docs/tree/define-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +68 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +32 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/responsive.doc.mjs +102 -0
- package/assets/docs/tree/scaffold.doc.mjs +145 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
- package/assets/docs/tree/side-panels.doc.mjs +82 -0
- package/assets/docs/tree/structure.doc.mjs +144 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +13 -1
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/troubleshooting.doc.mjs +13 -5
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +11 -7
- package/assets/docs/use-a-theme.doc.mjs +209 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
- package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
- package/assets/templates/pages/blank/template.doc.mjs +3 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
- package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
- package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
- package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
- package/assets/templates/pages/documentation/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
- package/assets/templates/pages/editor/template.doc.mjs +9 -1
- package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
- package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
- package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
- package/assets/templates/pages/ide/template.doc.mjs +9 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
- package/assets/templates/pages/library/template.doc.mjs +15 -1
- package/assets/templates/pages/login/template.doc.mjs +10 -1
- package/assets/templates/pages/login-card/template.doc.mjs +11 -1
- package/assets/templates/pages/login-split/template.doc.mjs +10 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
- package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
- package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/settings/template.doc.mjs +3 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/table/template.doc.mjs +11 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
- package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
- package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
- package/assets/templates/pages/table-page/template.doc.mjs +20 -1
- package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
- package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +1 -0
- package/authoring/doctypes/template/parse.test.mjs +21 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +10 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/build-theme.mjs +279 -30
- package/clients/cli/commands/build.mjs +7 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +88 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +271 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/discover.mjs +29 -1
- package/clients/cli/commands/discover.no-source.test.mjs +75 -0
- package/clients/cli/commands/docs.depth.test.mjs +219 -0
- package/clients/cli/commands/docs.doc.mjs +15 -2
- package/clients/cli/commands/docs.mjs +273 -16
- package/clients/cli/commands/docs.test.mjs +382 -0
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +4 -4
- package/clients/cli/commands/doctor.test.mjs +9 -51
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/gap-report.mjs +12 -0
- package/clients/cli/commands/gap-report.test.mjs +63 -0
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +5 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration-authoring.test.mjs +12 -2
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/integration.mjs +3 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -0
- package/clients/cli/commands/layout-expand.doc.mjs +4 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
- package/clients/cli/commands/layout.doc.mjs +1 -0
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +61 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.doc.mjs +5 -4
- package/clients/cli/commands/search.mjs +30 -6
- package/clients/cli/commands/search.test.mjs +63 -17
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.mjs +70 -6
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +132 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +44 -0
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +4 -1
- package/clients/cli/lib/component-format.mjs +19 -2
- package/clients/cli/lib/manifest.mjs +44 -165
- package/clients/cli/lib/manifest.test.mjs +98 -7
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +31 -28
- package/foundation/agent-docs/agent-docs.test.mjs +1163 -0
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-adapter.d.mts +14 -0
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
- package/foundation/discovery/template-adapter.mjs +21 -1
- package/foundation/discovery/theme-discovery.d.mts +78 -5
- package/foundation/discovery/theme-discovery.mjs +143 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +18 -8
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/tree.test.mjs +649 -0
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +79 -13
- package/foundation/integrations/cli-requirement.mjs +115 -22
- package/foundation/integrations/cli-requirement.test.mjs +205 -8
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.d.mts +5 -5
- package/foundation/response/response-types.doc.mjs +50 -35
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
scopeSubComponent,
|
|
29
29
|
ComponentAmbiguityError,
|
|
30
30
|
installedComponentPackageVersion,
|
|
31
|
+
resolveComponentReplacement,
|
|
31
32
|
} from './_adapter.mjs';
|
|
32
33
|
import {componentList} from './list/list.mjs';
|
|
33
34
|
import {componentDetail} from './detail/detail.mjs';
|
|
@@ -380,6 +381,21 @@ export async function component(name, options = {}) {
|
|
|
380
381
|
// Searches that package first — critical for names that exist in both core
|
|
381
382
|
// and an external package (AppShell, Button, SideNav).
|
|
382
383
|
if (packageScope) {
|
|
384
|
+
// The package whose component replaces a Core component answers to that
|
|
385
|
+
// Core name too, as the bare name does (spec:AST-035 FR11).
|
|
386
|
+
if (
|
|
387
|
+
packageScope !== CORE_PACKAGE &&
|
|
388
|
+
!owners.some(owner => owner.package === packageScope)
|
|
389
|
+
) {
|
|
390
|
+
const replacement = await resolveComponentReplacement(
|
|
391
|
+
coreDir,
|
|
392
|
+
loadedIntegrations,
|
|
393
|
+
dirName,
|
|
394
|
+
);
|
|
395
|
+
if (replacement?.package === packageScope) {
|
|
396
|
+
return component(replacement.name, {...options, package: packageScope});
|
|
397
|
+
}
|
|
398
|
+
}
|
|
383
399
|
const scoped = classifyScope(packageScope, {
|
|
384
400
|
owners,
|
|
385
401
|
loadedIntegrations,
|
|
@@ -394,6 +410,7 @@ export async function component(name, options = {}) {
|
|
|
394
410
|
name,
|
|
395
411
|
notFoundInPackage:
|
|
396
412
|
scoped.kind === 'integration' ? packageScope : null,
|
|
413
|
+
ownerPackage: owner.package,
|
|
397
414
|
});
|
|
398
415
|
}
|
|
399
416
|
// showcase/blocks were previously dropped on the scoped path — a
|
|
@@ -404,20 +421,20 @@ export async function component(name, options = {}) {
|
|
|
404
421
|
// a showcase, so skip discovery entirely.
|
|
405
422
|
if (showcase) {
|
|
406
423
|
return scoped.kind === 'core'
|
|
407
|
-
? componentDetailShowcase(dirName, {cwd, name})
|
|
408
|
-
: componentDetailShowcase(dirName, {cwd, name, resolve: false});
|
|
424
|
+
? componentDetailShowcase(dirName, {cwd, name, ownerPackage: owner.package})
|
|
425
|
+
: componentDetailShowcase(dirName, {cwd, name, resolve: false, ownerPackage: owner.package});
|
|
409
426
|
}
|
|
410
427
|
if (blocks) {
|
|
411
|
-
return componentDetailBlocks(dirName, cwd);
|
|
428
|
+
return componentDetailBlocks(dirName, cwd, owner.package);
|
|
412
429
|
}
|
|
413
430
|
const docs = await loadComponentDoc(owner.docPath, docOpts);
|
|
414
|
-
if (props) return componentDetailProps(docs);
|
|
431
|
+
if (props) return componentDetailProps(docs, owner.package);
|
|
415
432
|
return componentDetail(docs, owner, dirName, coreDir);
|
|
416
433
|
}
|
|
417
434
|
|
|
418
435
|
// Legacy `pkg.astryx.docs` external package.
|
|
419
436
|
if (showcase) {
|
|
420
|
-
return componentDetailShowcase(dirName, {cwd, name, packageScope});
|
|
437
|
+
return componentDetailShowcase(dirName, {cwd, name, packageScope, ownerPackage: packageScope});
|
|
421
438
|
}
|
|
422
439
|
const extDocPath = resolveLegacyExternalDoc(scoped.ext, dirName);
|
|
423
440
|
if (extDocPath) {
|
|
@@ -426,13 +443,14 @@ export async function component(name, options = {}) {
|
|
|
426
443
|
return componentDetailSource(dirName, null, {
|
|
427
444
|
name,
|
|
428
445
|
notFoundInPackage: packageScope,
|
|
446
|
+
ownerPackage: scoped.ext.name,
|
|
429
447
|
});
|
|
430
448
|
}
|
|
431
449
|
if (blocks) {
|
|
432
|
-
return componentDetailBlocks(dirName, cwd);
|
|
450
|
+
return componentDetailBlocks(dirName, cwd, scoped.ext.name);
|
|
433
451
|
}
|
|
434
452
|
const docs = await loadComponentDoc(extDocPath, docOpts);
|
|
435
|
-
if (props) return componentDetailProps(docs);
|
|
453
|
+
if (props) return componentDetailProps(docs, scoped.ext.name);
|
|
436
454
|
return componentDetail(
|
|
437
455
|
docs,
|
|
438
456
|
{package: scoped.ext.name, sourcePath: null},
|
|
@@ -447,6 +465,22 @@ export async function component(name, options = {}) {
|
|
|
447
465
|
);
|
|
448
466
|
}
|
|
449
467
|
|
|
468
|
+
// ── Replaced Core component (spec:AST-035 FR11) ────────────────
|
|
469
|
+
// An active integration replacement answers to the Core name it replaces,
|
|
470
|
+
// bare or qualified by its own package (above). The original stays
|
|
471
|
+
// reachable with `--package @astryxdesign/core`.
|
|
472
|
+
const replacement = await resolveComponentReplacement(
|
|
473
|
+
coreDir,
|
|
474
|
+
loadedIntegrations,
|
|
475
|
+
dirName,
|
|
476
|
+
);
|
|
477
|
+
if (replacement) {
|
|
478
|
+
return component(replacement.name, {
|
|
479
|
+
...options,
|
|
480
|
+
package: replacement.package,
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
|
|
450
484
|
// Invalid integration metadata does not create ambiguity against a valid
|
|
451
485
|
// owner. Keep raw owners only when no doc owner is valid, so an integration-
|
|
452
486
|
// only component still exposes its source and returns ERR_INVALID_DOC for
|
|
@@ -476,14 +510,14 @@ export async function component(name, options = {}) {
|
|
|
476
510
|
) {
|
|
477
511
|
const owner = effectiveOwners[0];
|
|
478
512
|
if (source) {
|
|
479
|
-
return componentDetailSource(dirName, owner.sourcePath, {name});
|
|
513
|
+
return componentDetailSource(dirName, owner.sourcePath, {name, ownerPackage: owner.package});
|
|
480
514
|
}
|
|
481
515
|
if (showcase) {
|
|
482
516
|
// Integration components don't carry showcases — fail without scanning.
|
|
483
|
-
return componentDetailShowcase(dirName, {cwd, name, resolve: false});
|
|
517
|
+
return componentDetailShowcase(dirName, {cwd, name, resolve: false, ownerPackage: owner.package});
|
|
484
518
|
}
|
|
485
519
|
const docs = await loadComponentDoc(owner.docPath, docOpts);
|
|
486
|
-
if (props) return componentDetailProps(docs);
|
|
520
|
+
if (props) return componentDetailProps(docs, owner.package);
|
|
487
521
|
return componentDetail(docs, owner, dirName, coreDir);
|
|
488
522
|
}
|
|
489
523
|
|
|
@@ -493,11 +527,11 @@ export async function component(name, options = {}) {
|
|
|
493
527
|
return componentDetailSource(
|
|
494
528
|
dirName,
|
|
495
529
|
resolveCoreSourcePath(coreDir, dirName),
|
|
496
|
-
{name},
|
|
530
|
+
{name, ownerPackage: CORE_PACKAGE},
|
|
497
531
|
);
|
|
498
532
|
}
|
|
499
533
|
if (showcase) {
|
|
500
|
-
return componentDetailShowcase(dirName, {cwd, name});
|
|
534
|
+
return componentDetailShowcase(dirName, {cwd, name, ownerPackage: CORE_PACKAGE});
|
|
501
535
|
}
|
|
502
536
|
|
|
503
537
|
const resolved = await resolveUnscopedDoc(dirName, {coreDir, cwd, name});
|
|
@@ -505,7 +539,7 @@ export async function component(name, options = {}) {
|
|
|
505
539
|
|
|
506
540
|
// ── Blocks mode ──────────────────────────────────────────────
|
|
507
541
|
if (blocks) {
|
|
508
|
-
return componentDetailBlocks(dirName, cwd);
|
|
542
|
+
return componentDetailBlocks(dirName, cwd, resolved.resolvedOwnerPackage);
|
|
509
543
|
}
|
|
510
544
|
|
|
511
545
|
// ── Sub-component scoping ────────────────────────────────────
|
|
@@ -514,7 +548,7 @@ export async function component(name, options = {}) {
|
|
|
514
548
|
const sub = scopeSubComponent(docs, dirName, coreDir);
|
|
515
549
|
if (sub) {
|
|
516
550
|
if (props)
|
|
517
|
-
return componentDetailProps({props: sub.matchingComponent.props});
|
|
551
|
+
return componentDetailProps({props: sub.matchingComponent.props}, resolved.resolvedOwnerPackage);
|
|
518
552
|
return componentDetail(
|
|
519
553
|
sub.scoped,
|
|
520
554
|
{
|
|
@@ -526,7 +560,7 @@ export async function component(name, options = {}) {
|
|
|
526
560
|
);
|
|
527
561
|
}
|
|
528
562
|
|
|
529
|
-
if (props) return componentDetailProps(docs);
|
|
563
|
+
if (props) return componentDetailProps(docs, resolved.resolvedOwnerPackage);
|
|
530
564
|
return componentDetail(
|
|
531
565
|
docs,
|
|
532
566
|
{
|
|
@@ -199,3 +199,35 @@ describe('component dispatcher — detail and lang guards', () => {
|
|
|
199
199
|
expect(zh.type).toBe('component.detail');
|
|
200
200
|
}, SLOW);
|
|
201
201
|
});
|
|
202
|
+
|
|
203
|
+
describe('component dispatcher — detail levels on single component (text only)', () => {
|
|
204
|
+
it('--detail compact returns less text than full', async () => {
|
|
205
|
+
const full = await runCli(['component', 'Button'], cwd);
|
|
206
|
+
const compact = await runCli(['component', 'Button', '--detail', 'compact'], cwd);
|
|
207
|
+
expect(full.code).toBe(0);
|
|
208
|
+
expect(compact.code).toBe(0);
|
|
209
|
+
expect(compact.stdout.length).toBeLessThan(full.stdout.length);
|
|
210
|
+
// Compact still shows the name and import
|
|
211
|
+
expect(compact.stdout).toContain('Button');
|
|
212
|
+
expect(compact.stdout).toContain('@astryxdesign/core');
|
|
213
|
+
}, SLOW);
|
|
214
|
+
|
|
215
|
+
it('--detail brief returns less text than compact', async () => {
|
|
216
|
+
const compact = await runCli(['component', 'Button', '--detail', 'compact'], cwd);
|
|
217
|
+
const brief = await runCli(['component', 'Button', '--detail', 'brief'], cwd);
|
|
218
|
+
expect(brief.code).toBe(0);
|
|
219
|
+
expect(brief.stdout.length).toBeLessThan(compact.stdout.length);
|
|
220
|
+
expect(brief.stdout).toContain('Button');
|
|
221
|
+
}, SLOW);
|
|
222
|
+
|
|
223
|
+
it('--json --detail compact returns the same full JSON as --json (contract)', async () => {
|
|
224
|
+
const full = await runCli(['--json', 'component', 'Button'], cwd);
|
|
225
|
+
const compact = await runCli(['--json', 'component', 'Button', '--detail', 'compact'], cwd);
|
|
226
|
+
expect(full.code).toBe(0);
|
|
227
|
+
expect(compact.code).toBe(0);
|
|
228
|
+
const fullData = JSON.parse(full.stdout);
|
|
229
|
+
const compactData = JSON.parse(compact.stdout);
|
|
230
|
+
// JSON shape is identical — detail is a text-only projection
|
|
231
|
+
expect(Object.keys(compactData.data).sort()).toEqual(Object.keys(fullData.data).sort());
|
|
232
|
+
}, SLOW);
|
|
233
|
+
});
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* the depth is carried in `data.detail` and `data.components` holds the grouped
|
|
9
9
|
* map whose entry shape depends on that level:
|
|
10
10
|
* - 'names' -> ComponentListEntry[] (name + owner package + optional import)
|
|
11
|
-
* - 'compact' -> ComponentBriefEntry[] (name + 1-line description + import)
|
|
12
|
-
* - 'full' -> ComponentDoc[] (full authored doc per entry)
|
|
11
|
+
* - 'compact' -> ComponentBriefEntry[] (name + owner package + 1-line description + import)
|
|
12
|
+
* - 'full' -> ComponentDoc[] (full authored doc per entry, plus its owner package)
|
|
13
13
|
*/
|
|
14
14
|
export type ComponentListResponse = {
|
|
15
15
|
type: "component.list";
|
|
@@ -26,7 +26,9 @@ export type ComponentListData = ({
|
|
|
26
26
|
components: Record<string, ComponentBriefEntry[]>;
|
|
27
27
|
} | {
|
|
28
28
|
detail: "full";
|
|
29
|
-
components: Record<string, import("@astryxdesign/cli/authoring").ComponentDoc
|
|
29
|
+
components: Record<string, Array<import("@astryxdesign/cli/authoring").ComponentDoc & {
|
|
30
|
+
package: string;
|
|
31
|
+
}>>;
|
|
30
32
|
});
|
|
31
33
|
/**
|
|
32
34
|
* `component(string[])` always returns this type, including empty and one-item
|
|
@@ -77,6 +79,10 @@ export type ComponentListEntry = {
|
|
|
77
79
|
*/
|
|
78
80
|
export type ComponentBriefEntry = {
|
|
79
81
|
name: string;
|
|
82
|
+
/**
|
|
83
|
+
* - Owner package; '@astryxdesign/core' for a Core component.
|
|
84
|
+
*/
|
|
85
|
+
package: string;
|
|
80
86
|
description: string;
|
|
81
87
|
import: string;
|
|
82
88
|
};
|
|
@@ -85,6 +91,10 @@ export type ComponentBriefEntry = {
|
|
|
85
91
|
*/
|
|
86
92
|
export type ComponentDetailResponse = {
|
|
87
93
|
type: "component.detail";
|
|
94
|
+
/**
|
|
95
|
+
* The npm package that owns the component.
|
|
96
|
+
*/
|
|
97
|
+
package: string;
|
|
88
98
|
data: import("@astryxdesign/cli/authoring").ComponentDoc & ComponentOwnership & ComponentDetailScope;
|
|
89
99
|
};
|
|
90
100
|
/**
|
|
@@ -121,6 +131,10 @@ export type ComponentOwnership = {
|
|
|
121
131
|
*/
|
|
122
132
|
export type ComponentDetailPropsResponse = {
|
|
123
133
|
type: "component.detail.props";
|
|
134
|
+
/**
|
|
135
|
+
* The npm package that owns the component.
|
|
136
|
+
*/
|
|
137
|
+
package: string;
|
|
124
138
|
data: import("@astryxdesign/cli/authoring").ComponentPropDoc[];
|
|
125
139
|
};
|
|
126
140
|
/**
|
|
@@ -128,6 +142,10 @@ export type ComponentDetailPropsResponse = {
|
|
|
128
142
|
*/
|
|
129
143
|
export type ComponentDetailSourceResponse = {
|
|
130
144
|
type: "component.detail.source";
|
|
145
|
+
/**
|
|
146
|
+
* The npm package that owns the component.
|
|
147
|
+
*/
|
|
148
|
+
package: string;
|
|
131
149
|
data: {
|
|
132
150
|
component: string;
|
|
133
151
|
source: string;
|
|
@@ -138,6 +156,10 @@ export type ComponentDetailSourceResponse = {
|
|
|
138
156
|
*/
|
|
139
157
|
export type ComponentDetailShowcaseResponse = {
|
|
140
158
|
type: "component.detail.showcase";
|
|
159
|
+
/**
|
|
160
|
+
* The npm package that owns the component.
|
|
161
|
+
*/
|
|
162
|
+
package: string;
|
|
141
163
|
data: {
|
|
142
164
|
component: string;
|
|
143
165
|
aspectRatio: number;
|
|
@@ -149,6 +171,10 @@ export type ComponentDetailShowcaseResponse = {
|
|
|
149
171
|
*/
|
|
150
172
|
export type ComponentDetailBlocksResponse = {
|
|
151
173
|
type: "component.detail.blocks";
|
|
174
|
+
/**
|
|
175
|
+
* The npm package that owns the component.
|
|
176
|
+
*/
|
|
177
|
+
package: string;
|
|
152
178
|
data: {
|
|
153
179
|
component: string;
|
|
154
180
|
showcase: BlockEntry | null;
|
|
@@ -158,6 +184,10 @@ export type ComponentDetailBlocksResponse = {
|
|
|
158
184
|
};
|
|
159
185
|
export type BlockEntry = {
|
|
160
186
|
name: string;
|
|
187
|
+
/**
|
|
188
|
+
* The npm package that owns the block template.
|
|
189
|
+
*/
|
|
190
|
+
package: string;
|
|
161
191
|
displayName: string;
|
|
162
192
|
description: string;
|
|
163
193
|
isShowcase: boolean;
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
* the depth is carried in `data.detail` and `data.components` holds the grouped
|
|
37
37
|
* map whose entry shape depends on that level:
|
|
38
38
|
* - 'names' -> ComponentListEntry[] (name + owner package + optional import)
|
|
39
|
-
* - 'compact' -> ComponentBriefEntry[] (name + 1-line description + import)
|
|
40
|
-
* - 'full' -> ComponentDoc[] (full authored doc per entry)
|
|
39
|
+
* - 'compact' -> ComponentBriefEntry[] (name + owner package + 1-line description + import)
|
|
40
|
+
* - 'full' -> ComponentDoc[] (full authored doc per entry, plus its owner package)
|
|
41
41
|
* @typedef {object} ComponentListResponse
|
|
42
42
|
* @property {'component.list'} type
|
|
43
43
|
* @property {ComponentListData} data
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* @typedef {(
|
|
49
49
|
* | {detail: 'names'; components: Record<string, ComponentListEntry[]>}
|
|
50
50
|
* | {detail: 'compact'; components: Record<string, ComponentBriefEntry[]>}
|
|
51
|
-
* | {detail: 'full'; components: Record<string, import('@astryxdesign/cli/authoring').ComponentDoc
|
|
51
|
+
* | {detail: 'full'; components: Record<string, Array<import('@astryxdesign/cli/authoring').ComponentDoc & {package: string}>>}
|
|
52
52
|
* )} ComponentListData
|
|
53
53
|
*/
|
|
54
54
|
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
* A single entry in a `component.list` group at `detail: 'compact'`.
|
|
111
111
|
* @typedef {object} ComponentBriefEntry
|
|
112
112
|
* @property {string} name
|
|
113
|
+
* @property {string} package - Owner package; '@astryxdesign/core' for a Core component.
|
|
113
114
|
* @property {string} description
|
|
114
115
|
* @property {string} import
|
|
115
116
|
*/
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
* astryx --json component <name>
|
|
119
120
|
* @typedef {object} ComponentDetailResponse
|
|
120
121
|
* @property {'component.detail'} type
|
|
122
|
+
* @property {string} package The npm package that owns the component.
|
|
121
123
|
* @property {import('@astryxdesign/cli/authoring').ComponentDoc & ComponentOwnership & ComponentDetailScope} data
|
|
122
124
|
*/
|
|
123
125
|
|
|
@@ -142,6 +144,7 @@
|
|
|
142
144
|
* astryx --json component <name> --props
|
|
143
145
|
* @typedef {object} ComponentDetailPropsResponse
|
|
144
146
|
* @property {'component.detail.props'} type
|
|
147
|
+
* @property {string} package The npm package that owns the component.
|
|
145
148
|
* @property {import('@astryxdesign/cli/authoring').ComponentPropDoc[]} data
|
|
146
149
|
*/
|
|
147
150
|
|
|
@@ -149,6 +152,7 @@
|
|
|
149
152
|
* astryx --json component <name> --source
|
|
150
153
|
* @typedef {object} ComponentDetailSourceResponse
|
|
151
154
|
* @property {'component.detail.source'} type
|
|
155
|
+
* @property {string} package The npm package that owns the component.
|
|
152
156
|
* @property {{component: string; source: string}} data
|
|
153
157
|
*/
|
|
154
158
|
|
|
@@ -156,6 +160,7 @@
|
|
|
156
160
|
* astryx --json component <name> --showcase
|
|
157
161
|
* @typedef {object} ComponentDetailShowcaseResponse
|
|
158
162
|
* @property {'component.detail.showcase'} type
|
|
163
|
+
* @property {string} package The npm package that owns the component.
|
|
159
164
|
* @property {{component: string; aspectRatio: number; source: string}} data
|
|
160
165
|
*/
|
|
161
166
|
|
|
@@ -163,12 +168,14 @@
|
|
|
163
168
|
* astryx --json component <name> --blocks
|
|
164
169
|
* @typedef {object} ComponentDetailBlocksResponse
|
|
165
170
|
* @property {'component.detail.blocks'} type
|
|
171
|
+
* @property {string} package The npm package that owns the component.
|
|
166
172
|
* @property {{component: string; showcase: BlockEntry | null; examples: BlockEntry[]; related: BlockEntry[]}} data
|
|
167
173
|
*/
|
|
168
174
|
|
|
169
175
|
/**
|
|
170
176
|
* @typedef {object} BlockEntry
|
|
171
177
|
* @property {string} name
|
|
178
|
+
* @property {string} package The npm package that owns the block template.
|
|
172
179
|
* @property {string} displayName
|
|
173
180
|
* @property {string} description
|
|
174
181
|
* @property {boolean} isShowcase
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* and broader related blocks.
|
|
8
8
|
* @param {string} componentName
|
|
9
9
|
* @param {string} cwd - project to discover blocks from; never the process cwd
|
|
10
|
+
* @param {string} ownerPackage - the npm package that owns the component
|
|
10
11
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
|
|
11
12
|
*/
|
|
12
|
-
export function componentDetailBlocks(componentName: string, cwd: string): Promise<import("../../component.type.mjs").ComponentDetailBlocksResponse>;
|
|
13
|
+
export function componentDetailBlocks(componentName: string, cwd: string, ownerPackage: string): Promise<import("../../component.type.mjs").ComponentDetailBlocksResponse>;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import * as path from 'node:path';
|
|
12
|
-
import {findRelatedBlocks} from '../../../template/template.mjs';
|
|
12
|
+
import {findRelatedBlocks, pkgOf} from '../../../template/template.mjs';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Project a component's related blocks into the `component.detail.blocks`
|
|
@@ -17,12 +17,14 @@ import {findRelatedBlocks} from '../../../template/template.mjs';
|
|
|
17
17
|
* and broader related blocks.
|
|
18
18
|
* @param {string} componentName
|
|
19
19
|
* @param {string} cwd - project to discover blocks from; never the process cwd
|
|
20
|
+
* @param {string} ownerPackage - the npm package that owns the component
|
|
20
21
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
|
|
21
22
|
*/
|
|
22
|
-
export async function componentDetailBlocks(componentName, cwd) {
|
|
23
|
+
export async function componentDetailBlocks(componentName, cwd, ownerPackage) {
|
|
23
24
|
const allBlocks = await findRelatedBlocks(componentName, cwd);
|
|
24
25
|
const toEntry = (/** @type {any} */ b) => ({
|
|
25
26
|
name: b.dirName,
|
|
27
|
+
package: pkgOf(b),
|
|
26
28
|
displayName: b.name,
|
|
27
29
|
description: b.description,
|
|
28
30
|
isShowcase: b.isShowcase ?? false,
|
|
@@ -46,6 +48,7 @@ export async function componentDetailBlocks(componentName, cwd) {
|
|
|
46
48
|
|
|
47
49
|
return {
|
|
48
50
|
type: 'component.detail.blocks',
|
|
51
|
+
package: ownerPackage,
|
|
49
52
|
data: {
|
|
50
53
|
component: componentName,
|
|
51
54
|
showcase: showcaseBlock ? toEntry(showcaseBlock) : null,
|
|
@@ -19,5 +19,9 @@ import {withOwnership} from '../_adapter.mjs';
|
|
|
19
19
|
* @returns {import('../component.type.mjs').ComponentDetailResponse}
|
|
20
20
|
*/
|
|
21
21
|
export function componentDetail(docs, owner, componentName, coreDir) {
|
|
22
|
-
return {
|
|
22
|
+
return {
|
|
23
|
+
type: 'component.detail',
|
|
24
|
+
package: owner.package,
|
|
25
|
+
data: withOwnership(docs, owner, componentName, coreDir),
|
|
26
|
+
};
|
|
23
27
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Project a resolved doc into the `component.detail.props` envelope.
|
|
6
6
|
* @param {import('../../_adapter.mjs').LoadedComponentDoc} docs
|
|
7
|
+
* @param {string} ownerPackage - the npm package that owns the component
|
|
7
8
|
* @returns {import('../../component.type.mjs').ComponentDetailPropsResponse}
|
|
8
9
|
*/
|
|
9
|
-
export function componentDetailProps(docs: import("../../_adapter.mjs").LoadedComponentDoc): import("../../component.type.mjs").ComponentDetailPropsResponse;
|
|
10
|
+
export function componentDetailProps(docs: import("../../_adapter.mjs").LoadedComponentDoc, ownerPackage: string): import("../../component.type.mjs").ComponentDetailPropsResponse;
|
|
@@ -13,8 +13,9 @@ import {extractProps} from '../../_adapter.mjs';
|
|
|
13
13
|
/**
|
|
14
14
|
* Project a resolved doc into the `component.detail.props` envelope.
|
|
15
15
|
* @param {import('../../_adapter.mjs').LoadedComponentDoc} docs
|
|
16
|
+
* @param {string} ownerPackage - the npm package that owns the component
|
|
16
17
|
* @returns {import('../../component.type.mjs').ComponentDetailPropsResponse}
|
|
17
18
|
*/
|
|
18
|
-
export function componentDetailProps(docs) {
|
|
19
|
-
return {type: 'component.detail.props', data: extractProps(docs)};
|
|
19
|
+
export function componentDetailProps(docs, ownerPackage) {
|
|
20
|
+
return {type: 'component.detail.props', package: ownerPackage, data: extractProps(docs)};
|
|
20
21
|
}
|
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
* @param {string} ctx.name - the caller's original input, used in the error message
|
|
13
13
|
* @param {string|null} [ctx.packageScope] - scope block discovery + the error to a package
|
|
14
14
|
* @param {boolean} [ctx.resolve] - when false, skip discovery and treat as not found
|
|
15
|
+
* @param {string} ctx.ownerPackage - the npm package that owns the component
|
|
15
16
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailShowcaseResponse>}
|
|
16
17
|
*/
|
|
17
|
-
export function componentDetailShowcase(componentName: string, { cwd, name, packageScope, resolve }: {
|
|
18
|
+
export function componentDetailShowcase(componentName: string, { cwd, name, packageScope, resolve, ownerPackage }: {
|
|
18
19
|
cwd: string;
|
|
19
20
|
name: string;
|
|
20
21
|
packageScope?: string | null | undefined;
|
|
21
22
|
resolve?: boolean | undefined;
|
|
23
|
+
ownerPackage: string;
|
|
22
24
|
}): Promise<import("../../component.type.mjs").ComponentDetailShowcaseResponse>;
|
|
@@ -24,9 +24,10 @@ import {findShowcase} from '../../../template/template.mjs';
|
|
|
24
24
|
* @param {string} ctx.name - the caller's original input, used in the error message
|
|
25
25
|
* @param {string|null} [ctx.packageScope] - scope block discovery + the error to a package
|
|
26
26
|
* @param {boolean} [ctx.resolve] - when false, skip discovery and treat as not found
|
|
27
|
+
* @param {string} ctx.ownerPackage - the npm package that owns the component
|
|
27
28
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailShowcaseResponse>}
|
|
28
29
|
*/
|
|
29
|
-
export async function componentDetailShowcase(componentName, {cwd, name, packageScope = null, resolve = true}) {
|
|
30
|
+
export async function componentDetailShowcase(componentName, {cwd, name, packageScope = null, resolve = true, ownerPackage}) {
|
|
30
31
|
const match = resolve
|
|
31
32
|
? await findShowcase(componentName, cwd, packageScope ? {package: packageScope} : undefined)
|
|
32
33
|
: null;
|
|
@@ -36,6 +37,7 @@ export async function componentDetailShowcase(componentName, {cwd, name, package
|
|
|
36
37
|
}
|
|
37
38
|
return {
|
|
38
39
|
type: 'component.detail.showcase',
|
|
40
|
+
package: ownerPackage,
|
|
39
41
|
data: {
|
|
40
42
|
component: componentName,
|
|
41
43
|
aspectRatio: /** @type {number} */ (match.aspectRatio),
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
* envelope. Throws ERR_NO_SOURCE when the owner ships no source file.
|
|
7
7
|
* @param {string} componentName - bare name, echoed back as `data.component`
|
|
8
8
|
* @param {string|null} sourcePath - the resolved source path (null → not found)
|
|
9
|
-
* @param {{name: string, notFoundInPackage?: string|null}} ctx - `name` is the caller's original input; `notFoundInPackage` scopes the not-found message to a package
|
|
9
|
+
* @param {{name: string, notFoundInPackage?: string|null, ownerPackage: string}} ctx - `name` is the caller's original input; `notFoundInPackage` scopes the not-found message to a package; `ownerPackage` is the npm package that owns the component
|
|
10
10
|
* @returns {import('../../component.type.mjs').ComponentDetailSourceResponse}
|
|
11
11
|
*/
|
|
12
|
-
export function componentDetailSource(componentName: string, sourcePath: string | null, { name, notFoundInPackage }: {
|
|
12
|
+
export function componentDetailSource(componentName: string, sourcePath: string | null, { name, notFoundInPackage, ownerPackage }: {
|
|
13
13
|
name: string;
|
|
14
14
|
notFoundInPackage?: string | null;
|
|
15
|
+
ownerPackage: string;
|
|
15
16
|
}): import("../../component.type.mjs").ComponentDetailSourceResponse;
|
|
@@ -17,13 +17,17 @@ import {ERROR_CODES} from '../../../../foundation/response/error-codes.mjs';
|
|
|
17
17
|
* envelope. Throws ERR_NO_SOURCE when the owner ships no source file.
|
|
18
18
|
* @param {string} componentName - bare name, echoed back as `data.component`
|
|
19
19
|
* @param {string|null} sourcePath - the resolved source path (null → not found)
|
|
20
|
-
* @param {{name: string, notFoundInPackage?: string|null}} ctx - `name` is the caller's original input; `notFoundInPackage` scopes the not-found message to a package
|
|
20
|
+
* @param {{name: string, notFoundInPackage?: string|null, ownerPackage: string}} ctx - `name` is the caller's original input; `notFoundInPackage` scopes the not-found message to a package; `ownerPackage` is the npm package that owns the component
|
|
21
21
|
* @returns {import('../../component.type.mjs').ComponentDetailSourceResponse}
|
|
22
22
|
*/
|
|
23
|
-
export function componentDetailSource(componentName, sourcePath, {name, notFoundInPackage = null}) {
|
|
23
|
+
export function componentDetailSource(componentName, sourcePath, {name, notFoundInPackage = null, ownerPackage}) {
|
|
24
24
|
if (!sourcePath) {
|
|
25
25
|
const suffix = notFoundInPackage ? ` in package "${notFoundInPackage}"` : '';
|
|
26
26
|
throw new AstryxError(`Source for "${name}" not found${suffix}`, undefined, ERROR_CODES.ERR_NO_SOURCE);
|
|
27
27
|
}
|
|
28
|
-
return {
|
|
28
|
+
return {
|
|
29
|
+
type: 'component.detail.source',
|
|
30
|
+
package: ownerPackage,
|
|
31
|
+
data: {component: componentName, source: fs.readFileSync(sourcePath, 'utf-8')},
|
|
32
|
+
};
|
|
29
33
|
}
|