@astryxdesign/cli 0.6.6 → 0.6.7-canary.7ec9564
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 +129 -0
- package/README.md +84 -82
- package/api/build/_adapter.d.mts +20 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.test.mjs +1 -1
- package/api/build/build.type.d.mts +12 -0
- package/api/build/build.type.mjs +3 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +13 -1
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +615 -0
- package/api/component/component.doc.mjs +5 -2
- 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 +73 -1
- package/api/docs/compiled-topics.test.mjs +1 -1
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.d.mts +44 -0
- package/api/docs/detail/section/section.mjs +171 -14
- package/api/docs/detail/section/section.test.mjs +4 -4
- package/api/docs/docOverlays.test.mjs +38 -23
- package/api/docs/docs.depth.test.mjs +2 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.mjs +13 -16
- package/api/docs/docs.test.mjs +9 -10
- package/api/docs/docs.type.d.mts +43 -3
- package/api/docs/docs.type.mjs +23 -3
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +26 -26
- package/api/docs/integrationDocs.test.mjs +8 -7
- package/api/docs/namespace-section.test.mjs +260 -0
- package/api/docs/node/node.mjs +3 -0
- package/api/docs/token-tables.test.mjs +93 -0
- package/api/doctor/_adapter.d.mts +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +6 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +144 -150
- package/api/doctor/doctor.test.mjs +104 -0
- package/api/doctor/theme-checks.d.mts +24 -0
- package/api/doctor/theme-checks.mjs +1231 -0
- package/api/doctor/theme-checks.test.mjs +667 -0
- package/api/gap-report/gap-report.doc.mjs +2 -1
- package/api/gap-report/gap-report.mjs +15 -1
- 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.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 +11 -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-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +16 -2
- package/api/integration/add-theme.test.mjs +66 -15
- package/api/integration/authoring-checks.mjs +21 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- 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 +483 -1
- package/api/integration/pack-check.test.mjs +568 -8
- package/api/integration/validate-integration.mjs +20 -4
- package/api/integration/validate-integration.test.mjs +73 -0
- package/api/layout/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +1 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/search/search.d.mts +47 -3
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.domain-priority.test.mjs +261 -0
- package/api/search/search.mjs +247 -43
- package/api/search/search.test.mjs +5 -1
- package/api/search/search.type.d.mts +3 -3
- package/api/search/search.type.mjs +2 -2
- 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 +29 -10
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +5 -2
- 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 +14 -1
- package/api/template/show/show.mjs +2 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +15 -0
- package/api/template/template.type.mjs +6 -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 +96 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.mjs +286 -118
- package/api/theme/build/build.test.mjs +30 -0
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- 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.mjs +1 -1
- 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/upgrade.type.d.mts +4 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
- package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +166 -0
- package/assets/docs/getting-started.doc.mjs +61 -17
- package/assets/docs/principles.doc.dense.mjs +4 -4
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/principles.doc.zh.mjs +4 -4
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/theme.doc.dense.mjs +10 -198
- package/assets/docs/theme.doc.mjs +13 -771
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +5 -4
- package/assets/docs/tree/component-migration.doc.mjs +107 -0
- package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/font-setup.doc.mjs +122 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
- package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
- package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
- package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
- package/assets/docs/tree/internationalization.doc.mjs +29 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +55 -0
- package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
- package/assets/docs/tree/migration-verification.doc.mjs +67 -0
- package/assets/docs/tree/migration.doc.mjs +28 -0
- package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
- package/assets/docs/tree/other-libraries.doc.mjs +218 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/responsive.doc.mjs +98 -0
- package/assets/docs/tree/scaffold.doc.mjs +140 -0
- package/assets/docs/tree/side-panels.doc.mjs +81 -0
- package/assets/docs/tree/structure.doc.mjs +140 -0
- package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
- package/assets/docs/tree/styling-basics.doc.mjs +181 -0
- package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
- package/assets/docs/tree/styling.doc.mjs +29 -0
- package/assets/docs/tree/tailwind.doc.mjs +65 -0
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
- package/assets/docs/tree/tokens-border.doc.mjs +46 -0
- package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-color.doc.mjs +438 -0
- package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-data.doc.mjs +323 -0
- package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
- package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
- package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
- package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
- package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
- package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
- package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.mjs +54 -0
- package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
- package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
- package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
- package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
- package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
- package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
- package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens.doc.mjs +28 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +4 -0
- package/assets/docs/tree/type-scale.doc.mjs +147 -0
- package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
- package/assets/docs/tree/typography.doc.mjs +29 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +4 -1
- package/assets/docs/use-a-theme.doc.mjs +212 -0
- package/assets/templates/pages/incident-console/page.tsx +1 -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/theme.template.ts +4 -3
- 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/type.ts +1 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +3 -3
- package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
- package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
- package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
- package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +338 -45
- package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
- package/clients/cli/commands/build.mjs +8 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +91 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/docs.doc.mjs +2 -1
- package/clients/cli/commands/docs.mjs +63 -23
- package/clients/cli/commands/docs.test.mjs +17 -15
- 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.test.mjs +59 -52
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/layout-check.doc.mjs +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +2 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +2 -0
- package/clients/cli/commands/layout.mjs +40 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.test.mjs +10 -4
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
- package/clients/cli/commands/template.mjs +56 -5
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-build.doc.mjs +3 -1
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
- 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.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +29 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- 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 +48 -30
- package/foundation/agent-docs/agent-docs.test.mjs +47 -34
- 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/project.test.mjs +1 -1
- 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-discovery.test.mjs +1 -1
- 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-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- package/foundation/discovery/theme-discovery.d.mts +72 -5
- package/foundation/discovery/theme-discovery.mjs +134 -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/bundle.mjs +52 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
- package/foundation/doc-compiler/tree.d.mts +10 -0
- package/foundation/doc-compiler/tree.mjs +22 -0
- package/foundation/doc-compiler/tree.test.mjs +3 -2
- package/foundation/env/package-manager.d.mts +31 -8
- package/foundation/env/package-manager.mjs +120 -13
- package/foundation/env/package-manager.test.mjs +174 -1
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +22 -0
- package/foundation/integrations/cli-requirement.mjs +31 -0
- package/foundation/integrations/cli-requirement.test.mjs +70 -0
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/integrations/validate-contributions.d.mts +16 -0
- package/foundation/integrations/validate-contributions.mjs +56 -8
- 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.mjs +41 -26
- 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
- package/assets/docs/styling-libraries.doc.mjs +0 -469
- package/assets/docs/styling.doc.mjs +0 -412
- package/assets/docs/tokens.doc.dense.mjs +0 -15
- package/assets/docs/tokens.doc.mjs +0 -1491
- package/assets/docs/tokens.doc.zh.mjs +0 -15
- package/assets/docs/typography.doc.mjs +0 -286
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Integration component replacement (spec:AST-035 FR10–FR15).
|
|
5
|
+
*
|
|
6
|
+
* @input Core's component catalog and the loaded integrations, in precedence
|
|
7
|
+
* order (configured, then autolinked, then the package being authored).
|
|
8
|
+
* @output The active replacement for each replaced Core component, and the
|
|
9
|
+
* findings Doctor reports.
|
|
10
|
+
* @position foundation/discovery — the one place component replacement is
|
|
11
|
+
* decided. Component detail, list, search, swizzle, gap-report routing,
|
|
12
|
+
* Project, and `doctor integration components` read the result instead of
|
|
13
|
+
* deciding it again.
|
|
14
|
+
*
|
|
15
|
+
* A component opts in by setting `replaces` in its own doc. The replacement
|
|
16
|
+
* applies only when the component's package also declares a
|
|
17
|
+
* `@astryxdesign/cli` peer range that starts at COMPONENT_REPLACES_CLI: a
|
|
18
|
+
* package published for an earlier CLI keeps the behavior it shipped with,
|
|
19
|
+
* and every finding about it is a warning.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import * as fs from 'node:fs';
|
|
23
|
+
import * as path from 'node:path';
|
|
24
|
+
import {
|
|
25
|
+
discoverComponents,
|
|
26
|
+
discoverValidIntegrationComponents,
|
|
27
|
+
} from './component-discovery.mjs';
|
|
28
|
+
import {
|
|
29
|
+
CLI_PACKAGE,
|
|
30
|
+
COMPONENT_REPLACES_CLI,
|
|
31
|
+
componentReplacesCliProblem,
|
|
32
|
+
} from '../integrations/cli-requirement.mjs';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {import('../integrations/integrations.mjs').LoadedIntegration} LoadedIntegration
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* One Doctor finding about a component replacement.
|
|
40
|
+
* @typedef {object} ComponentReplacementFinding
|
|
41
|
+
* @property {string} package the package that declares the replacement
|
|
42
|
+
* @property {string} component the declaring component's own name
|
|
43
|
+
* @property {'missing_component_replacement_target' | 'invalid_component_replacement' | 'ambiguous_component_replacement' | 'inactive_component_replacement' | 'shadowed_component_name'} code
|
|
44
|
+
* @property {'warning' | 'error'} severity
|
|
45
|
+
* @property {string} message
|
|
46
|
+
* @property {boolean} optedIn whether the finding is about a package that
|
|
47
|
+
* declares the CLI floor. Project issues and the everyday-command nudge
|
|
48
|
+
* carry only these; a package without the floor is reported to its author
|
|
49
|
+
* through `doctor integration components` and the pack check alone.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The integration component that answers to a Core component's name.
|
|
54
|
+
* @typedef {object} ActiveComponentReplacement
|
|
55
|
+
* @property {string} target the replaced Core component's name
|
|
56
|
+
* @property {string} name the replacement's own name
|
|
57
|
+
* @property {string} package
|
|
58
|
+
* @property {string} docPath
|
|
59
|
+
* @property {string|null} sourcePath
|
|
60
|
+
* @property {string|undefined} issuesUrl
|
|
61
|
+
* @property {LoadedIntegration} integration
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {object} ComponentReplacements
|
|
66
|
+
* @property {ActiveComponentReplacement[]} active in Core catalog order
|
|
67
|
+
* @property {ComponentReplacementFinding[]} findings
|
|
68
|
+
* @property {(name: unknown) => ActiveComponentReplacement | undefined} forTarget
|
|
69
|
+
* the active replacement for a Core component name, matched exactly, as
|
|
70
|
+
* Core component lookups are
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @typedef {object} Declaration
|
|
75
|
+
* @property {string} name
|
|
76
|
+
* @property {string} package
|
|
77
|
+
* @property {string} docPath
|
|
78
|
+
* @property {string|null} sourcePath
|
|
79
|
+
* @property {string|undefined} issuesUrl
|
|
80
|
+
* @property {unknown} replaces
|
|
81
|
+
* @property {LoadedIntegration} integration
|
|
82
|
+
* @property {boolean} autolinked
|
|
83
|
+
* @property {boolean} optedIn
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/** @param {string} value @returns {string} */
|
|
87
|
+
const keyOf = value => value.toLowerCase();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The package.json beside an integration, or an empty object when it cannot
|
|
91
|
+
* be read: a package with no readable manifest declares no CLI range.
|
|
92
|
+
* @param {LoadedIntegration} integration
|
|
93
|
+
* @returns {any}
|
|
94
|
+
*/
|
|
95
|
+
function packageJsonOf(integration) {
|
|
96
|
+
const dir = integration.__packageDir;
|
|
97
|
+
if (typeof dir !== 'string') return {};
|
|
98
|
+
try {
|
|
99
|
+
return JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
|
|
100
|
+
} catch {
|
|
101
|
+
return {};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Whether a package's declared CLI range turns its component replacements on.
|
|
107
|
+
* @param {any} pkg package.json
|
|
108
|
+
* @returns {boolean}
|
|
109
|
+
*/
|
|
110
|
+
export function componentReplacementsEnabled(pkg) {
|
|
111
|
+
return componentReplacesCliProblem(pkg) == null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The sentence a finding about a package without the floor ends with.
|
|
116
|
+
* @param {string} name
|
|
117
|
+
* @param {string} target
|
|
118
|
+
* @returns {string}
|
|
119
|
+
*/
|
|
120
|
+
function inactiveTail(name, target) {
|
|
121
|
+
const until =
|
|
122
|
+
name === target
|
|
123
|
+
? `Until then the bare name "${name}" stays ambiguous between Core and this package; select either one with --package.`
|
|
124
|
+
: `Until then "${name}" keeps its own name and "${target}" stays Core.`;
|
|
125
|
+
return (
|
|
126
|
+
`This CLI applies the replacement only when the package declares "${CLI_PACKAGE}": ">=${COMPONENT_REPLACES_CLI}" ` +
|
|
127
|
+
`in peerDependencies (optional in peerDependenciesMeta). ${until}`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Decide every component replacement for one project.
|
|
133
|
+
*
|
|
134
|
+
* Each integration's valid components are read once. A declaration on a
|
|
135
|
+
* package without the CLI floor never applies, and its findings are warnings.
|
|
136
|
+
* For packages with the floor: a missing Core target, an invalid value, a
|
|
137
|
+
* component named after a different Core component, or two declarations for
|
|
138
|
+
* one target in one package are errors, and an invalid declaration never
|
|
139
|
+
* replaces Core. When several packages validly replace one target, an
|
|
140
|
+
* explicitly configured package beats an autolinked one, and among the
|
|
141
|
+
* remaining contenders the later package wins with a warning.
|
|
142
|
+
*
|
|
143
|
+
* @param {string|null} coreDir
|
|
144
|
+
* @param {readonly LoadedIntegration[]} loadedIntegrations
|
|
145
|
+
* @returns {Promise<ComponentReplacements>}
|
|
146
|
+
*/
|
|
147
|
+
export async function resolveComponentReplacements(
|
|
148
|
+
coreDir,
|
|
149
|
+
loadedIntegrations,
|
|
150
|
+
) {
|
|
151
|
+
/** @type {ComponentReplacementFinding[]} */
|
|
152
|
+
const findings = [];
|
|
153
|
+
/** @type {Map<string, ActiveComponentReplacement>} */
|
|
154
|
+
const byTarget = new Map();
|
|
155
|
+
const result = {
|
|
156
|
+
/** @type {ActiveComponentReplacement[]} */
|
|
157
|
+
active: [],
|
|
158
|
+
findings,
|
|
159
|
+
/** @param {unknown} name */
|
|
160
|
+
forTarget: name =>
|
|
161
|
+
typeof name === 'string' ? byTarget.get(name) : undefined,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/** @type {Declaration[]} */
|
|
165
|
+
const declarations = [];
|
|
166
|
+
/** @type {Array<{name: string, package: string}>} */
|
|
167
|
+
const nativeComponents = [];
|
|
168
|
+
for (const integration of loadedIntegrations) {
|
|
169
|
+
if (
|
|
170
|
+
integration == null ||
|
|
171
|
+
integration.__loadError ||
|
|
172
|
+
!integration.components
|
|
173
|
+
) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
/** @type {Awaited<ReturnType<typeof discoverValidIntegrationComponents>>['components']} */
|
|
177
|
+
let components;
|
|
178
|
+
try {
|
|
179
|
+
// Every valid component, with the `replaces` its loaded doc sets: a
|
|
180
|
+
// doc may spread, re-export, compute, or build the field, so only the
|
|
181
|
+
// loaded value says whether it declares a replacement.
|
|
182
|
+
({components} = await discoverValidIntegrationComponents(integration));
|
|
183
|
+
} catch {
|
|
184
|
+
// Project and Doctor report a component root that cannot be read.
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
/** @type {boolean | null} */
|
|
188
|
+
let optedIn = null;
|
|
189
|
+
for (const record of components) {
|
|
190
|
+
if (record.replaces === undefined) {
|
|
191
|
+
nativeComponents.push({name: record.name, package: record.package});
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
optedIn ??= componentReplacementsEnabled(packageJsonOf(integration));
|
|
195
|
+
declarations.push({
|
|
196
|
+
name: record.name,
|
|
197
|
+
package: record.package,
|
|
198
|
+
docPath: record.docPath,
|
|
199
|
+
sourcePath: record.sourcePath,
|
|
200
|
+
issuesUrl: record.issuesUrl,
|
|
201
|
+
replaces: record.replaces,
|
|
202
|
+
integration,
|
|
203
|
+
autolinked: integration.__autolinked === true,
|
|
204
|
+
optedIn,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (declarations.length === 0) return result;
|
|
209
|
+
|
|
210
|
+
/** @type {string[]} */
|
|
211
|
+
let coreNames = [];
|
|
212
|
+
if (coreDir) {
|
|
213
|
+
try {
|
|
214
|
+
coreNames = Object.values(discoverComponents(coreDir)).flat();
|
|
215
|
+
} catch {
|
|
216
|
+
coreNames = [];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/** @type {Map<string, string>} */
|
|
220
|
+
const coreByKey = new Map(coreNames.map(name => [keyOf(name), name]));
|
|
221
|
+
const coreSet = new Set(coreNames);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @param {Declaration} declaration
|
|
225
|
+
* @param {ComponentReplacementFinding['code']} code
|
|
226
|
+
* @param {string} message
|
|
227
|
+
*/
|
|
228
|
+
const report = (declaration, code, message) => {
|
|
229
|
+
findings.push({
|
|
230
|
+
package: declaration.package,
|
|
231
|
+
component: declaration.name,
|
|
232
|
+
code,
|
|
233
|
+
severity: declaration.optedIn ? 'error' : 'warning',
|
|
234
|
+
message,
|
|
235
|
+
optedIn: declaration.optedIn,
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Valid declarations per canonical Core target, in precedence order.
|
|
241
|
+
* @type {Map<string, Declaration[]>}
|
|
242
|
+
*/
|
|
243
|
+
const validByTarget = new Map();
|
|
244
|
+
/** @type {Set<string>} targets an opted-in error makes invalid */
|
|
245
|
+
const invalidTargets = new Set();
|
|
246
|
+
/** @type {Map<string, Declaration[]>} errors per target, for precedence */
|
|
247
|
+
const failedByTarget = new Map();
|
|
248
|
+
|
|
249
|
+
for (const declaration of declarations) {
|
|
250
|
+
const {name, replaces} = declaration;
|
|
251
|
+
const shown = typeof replaces === 'string' ? replaces : String(replaces);
|
|
252
|
+
if (!declaration.optedIn) {
|
|
253
|
+
findings.push({
|
|
254
|
+
package: declaration.package,
|
|
255
|
+
component: name,
|
|
256
|
+
code: 'inactive_component_replacement',
|
|
257
|
+
severity: 'warning',
|
|
258
|
+
message: `Component "${name}" sets \`replaces: ${JSON.stringify(shown)}\`. ${inactiveTail(name, shown)}`,
|
|
259
|
+
optedIn: false,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (typeof replaces !== 'string' || replaces.trim() === '') {
|
|
263
|
+
report(
|
|
264
|
+
declaration,
|
|
265
|
+
'invalid_component_replacement',
|
|
266
|
+
`Component "${name}" sets \`replaces\` to ${JSON.stringify(replaces) ?? String(replaces)}. Set it to the exact name of one Core component, such as "SideNav".`,
|
|
267
|
+
);
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (!coreSet.has(replaces)) {
|
|
271
|
+
const differentCase = coreByKey.get(keyOf(replaces));
|
|
272
|
+
report(
|
|
273
|
+
declaration,
|
|
274
|
+
'missing_component_replacement_target',
|
|
275
|
+
differentCase
|
|
276
|
+
? `Component "${name}" replaces "${replaces}", which is not a Core component name. Core names it "${differentCase}".`
|
|
277
|
+
: `Component "${name}" replaces "${replaces}", which is not a Core component. Run \`astryx component --list\` for Core component names.`,
|
|
278
|
+
);
|
|
279
|
+
if (declaration.optedIn) {
|
|
280
|
+
const key = differentCase ?? replaces;
|
|
281
|
+
const failed = failedByTarget.get(key) ?? [];
|
|
282
|
+
failed.push(declaration);
|
|
283
|
+
failedByTarget.set(key, failed);
|
|
284
|
+
}
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const ownCore = coreSet.has(name) ? name : null;
|
|
288
|
+
if (ownCore != null && ownCore !== replaces) {
|
|
289
|
+
report(
|
|
290
|
+
declaration,
|
|
291
|
+
'invalid_component_replacement',
|
|
292
|
+
`Component "${name}" replaces "${replaces}", but its own name is the Core component "${ownCore}". Rename it, or replace "${ownCore}" instead.`,
|
|
293
|
+
);
|
|
294
|
+
if (declaration.optedIn) {
|
|
295
|
+
const failed = failedByTarget.get(replaces) ?? [];
|
|
296
|
+
failed.push(declaration);
|
|
297
|
+
failedByTarget.set(replaces, failed);
|
|
298
|
+
}
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
const valid = validByTarget.get(replaces) ?? [];
|
|
302
|
+
valid.push(declaration);
|
|
303
|
+
validByTarget.set(replaces, valid);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Two components in one package replacing one target: neither applies. A
|
|
307
|
+
// package without the floor gets the same finding, as a warning.
|
|
308
|
+
for (const [target, valid] of validByTarget) {
|
|
309
|
+
/** @type {Map<string, Declaration[]>} */
|
|
310
|
+
const byPackage = new Map();
|
|
311
|
+
for (const declaration of valid) {
|
|
312
|
+
const group = byPackage.get(declaration.package) ?? [];
|
|
313
|
+
group.push(declaration);
|
|
314
|
+
byPackage.set(declaration.package, group);
|
|
315
|
+
}
|
|
316
|
+
for (const [pkg, group] of byPackage) {
|
|
317
|
+
if (group.length < 2) continue;
|
|
318
|
+
const names = group
|
|
319
|
+
.map(declaration => `"${declaration.name}"`)
|
|
320
|
+
.join(', ');
|
|
321
|
+
for (const declaration of group) {
|
|
322
|
+
report(
|
|
323
|
+
declaration,
|
|
324
|
+
'ambiguous_component_replacement',
|
|
325
|
+
`${pkg} declares ${group.length} components as replacements for Core component "${target}" (${names}). One package declares at most one replacement for a Core component.`,
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
if (group[0].optedIn) {
|
|
329
|
+
const failed = failedByTarget.get(target) ?? [];
|
|
330
|
+
failed.push(...group);
|
|
331
|
+
failedByTarget.set(target, failed);
|
|
332
|
+
}
|
|
333
|
+
validByTarget.set(
|
|
334
|
+
target,
|
|
335
|
+
(validByTarget.get(target) ?? []).filter(d => d.package !== pkg),
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Only declarations from packages with the floor contend for a target.
|
|
341
|
+
/** @param {string} target */
|
|
342
|
+
const contendersFor = target =>
|
|
343
|
+
(validByTarget.get(target) ?? []).filter(
|
|
344
|
+
declaration => declaration.optedIn,
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
for (const [target, failed] of failedByTarget) {
|
|
348
|
+
const valid = contendersFor(target);
|
|
349
|
+
const hasExplicitIntent =
|
|
350
|
+
valid.some(declaration => !declaration.autolinked) ||
|
|
351
|
+
failed.some(declaration => !declaration.autolinked);
|
|
352
|
+
// An invalid autolinked declaration never disables explicit intent.
|
|
353
|
+
if (
|
|
354
|
+
failed.some(declaration => !hasExplicitIntent || !declaration.autolinked)
|
|
355
|
+
) {
|
|
356
|
+
invalidTargets.add(target);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
for (const target of coreNames) {
|
|
361
|
+
const valid = contendersFor(target);
|
|
362
|
+
if (valid.length === 0 || invalidTargets.has(target)) continue;
|
|
363
|
+
const hasExplicitIntent = valid.some(
|
|
364
|
+
declaration => !declaration.autolinked,
|
|
365
|
+
);
|
|
366
|
+
const contenders = hasExplicitIntent
|
|
367
|
+
? valid.filter(declaration => !declaration.autolinked)
|
|
368
|
+
: valid;
|
|
369
|
+
const winner = contenders[contenders.length - 1];
|
|
370
|
+
if (valid.length > 1) {
|
|
371
|
+
const packages = valid.map(declaration => declaration.package).join(', ');
|
|
372
|
+
const reason =
|
|
373
|
+
hasExplicitIntent && valid.some(declaration => declaration.autolinked)
|
|
374
|
+
? `${winner.package} is explicitly configured, so it wins over autolinked integrations.`
|
|
375
|
+
: hasExplicitIntent
|
|
376
|
+
? `${winner.package} is configured later, so it wins.`
|
|
377
|
+
: `${winner.package} is listed later in package.json dependencies, so it wins. Add the intended package to astryx.config integrations to make precedence explicit.`;
|
|
378
|
+
findings.push({
|
|
379
|
+
package: winner.package,
|
|
380
|
+
component: winner.name,
|
|
381
|
+
code: 'ambiguous_component_replacement',
|
|
382
|
+
severity: 'warning',
|
|
383
|
+
message: `Core component "${target}" is replaced by ${packages}. ${reason}`,
|
|
384
|
+
optedIn: true,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
const active = {
|
|
388
|
+
target,
|
|
389
|
+
name: winner.name,
|
|
390
|
+
package: winner.package,
|
|
391
|
+
docPath: winner.docPath,
|
|
392
|
+
sourcePath: winner.sourcePath,
|
|
393
|
+
issuesUrl: winner.issuesUrl,
|
|
394
|
+
integration: winner.integration,
|
|
395
|
+
};
|
|
396
|
+
byTarget.set(target, active);
|
|
397
|
+
result.active.push(active);
|
|
398
|
+
|
|
399
|
+
// An integration component named after the target, from another
|
|
400
|
+
// package, is no longer what the bare name selects.
|
|
401
|
+
for (const native of nativeComponents) {
|
|
402
|
+
if (native.package === winner.package || native.name !== target) {
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
findings.push({
|
|
406
|
+
package: native.package,
|
|
407
|
+
component: native.name,
|
|
408
|
+
code: 'shadowed_component_name',
|
|
409
|
+
severity: 'warning',
|
|
410
|
+
message: `Component "${native.name}" from ${native.package} is shadowed by "${winner.name}" from ${winner.package}, which replaces Core "${target}". Select it with --package ${native.package}.`,
|
|
411
|
+
optedIn: true,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return result;
|
|
417
|
+
}
|