@astryxdesign/cli 0.6.3-canary.ebaebc4 → 0.6.3-canary.ee13359
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 +114 -77
- 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 +35 -1
- package/api/build/build.type.mjs +24 -3
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.doc.mjs +13 -3
- package/api/component/component.mjs +91 -14
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +16 -5
- package/api/component/component.type.mjs +13 -5
- 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 +40 -11
- package/api/discover/discover.doc.mjs +2 -1
- package/api/docs/_adapter.d.mts +210 -34
- package/api/docs/_adapter.mjs +674 -134
- package/api/docs/detail/detail.mjs +11 -3
- package/api/docs/detail/section/section.mjs +24 -13
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/docs/docs.d.mts +5 -3
- package/api/docs/docs.doc.mjs +36 -15
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +165 -2
- package/api/docs/docs.type.mjs +101 -3
- package/api/docs/index/index.mjs +11 -3
- package/api/docs/index/index.test.mjs +1 -1
- package/api/docs/integration-tree.test.mjs +547 -0
- package/api/docs/integrationDocs.test.mjs +14 -14
- package/api/docs/list/list.mjs +28 -12
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/doctor/doctor.d.mts +54 -4
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +327 -16
- package/api/doctor/doctor.test.mjs +420 -7
- 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/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +69 -17
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +6 -1
- 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.d.mts +2 -1
- package/api/integration/add-contribution.mjs +125 -12
- package/api/integration/add-contribution.test.mjs +254 -3
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.mjs +108 -31
- package/api/integration/authoring-checks.test.mjs +171 -6
- package/api/integration/authoring-checks.type.d.mts +3 -1
- package/api/integration/authoring-checks.type.mjs +3 -1
- package/api/integration/integration-authoring.type.d.mts +2 -0
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +14 -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 +8 -1
- 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 +2 -1
- package/api/integration/integrationPackCheck.doc.mjs +2 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +7 -5
- package/api/integration/pack-check.mjs +34 -0
- package/api/integration/pack-check.test.mjs +138 -47
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- 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 +179 -26
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +3 -2
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/index.ts +2 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +3 -2
- package/api/layout/_adapter.mjs +20 -5
- 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 +28 -10
- package/api/search/search.doc.mjs +8 -2
- package/api/search/search.mjs +334 -38
- package/api/search/search.test.mjs +124 -1
- package/api/search/search.type.d.mts +13 -1
- package/api/search/search.type.mjs +4 -1
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +2 -1
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/list/list.mjs +1 -0
- package/api/template/template-integration.test.mjs +1022 -3
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.doc.mjs +30 -8
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +6 -8
- package/api/template/template.type.mjs +3 -2
- 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 +114 -37
- 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/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 +7 -2
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.mjs +8 -1
- 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 +20 -0
- 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 +6 -2
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +124 -73
- 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 +356 -59
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +8 -2
- package/api/upgrade/upgrade.type.d.mts +38 -0
- package/api/upgrade/upgrade.type.mjs +16 -0
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +8 -2
- package/assets/codemods/integration-discovery.test.mjs +15 -0
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +350 -102
- 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-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/next/index.mjs +19 -1
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- 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.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/getting-started.doc.mjs +2 -2
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +2 -2
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +4 -4
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +66 -38
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- 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/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -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/codemod/codemod.doc.mjs +1 -1
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/type.ts +15 -3
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +71 -141
- package/authoring/doctypes/_schema.mjs +29 -2
- package/authoring/doctypes/base/graph-fields.doc.mjs +8 -6
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/component/type.ts +2 -2
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/hook/type.ts +2 -2
- package/authoring/doctypes/load-contract.test.mjs +3 -2
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.d.mts +4 -2
- package/authoring/doctypes/parse.mjs +10 -5
- package/authoring/doctypes/reference/reference.doc.mjs +7 -5
- package/authoring/doctypes/reference/type.ts +12 -10
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -2
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +4 -0
- package/authoring/doctypes/template/parse.test.mjs +18 -0
- package/authoring/doctypes/template/template.doc.mjs +9 -3
- package/authoring/doctypes/template/type.ts +8 -0
- 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 +2 -1
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/identity/identity.doc.mjs +2 -2
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +7 -4
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- 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.adaptations.test.mjs +100 -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 +16 -50
- 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 +37 -49
- 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 +3 -8
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- 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 +52 -5
- 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 +4 -4
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +21 -9
- package/clients/cli/commands/docs.mjs +182 -68
- package/clients/cli/commands/docs.test.mjs +120 -16
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -3
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +15 -8
- 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 +83 -8
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +30 -25
- 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 +32 -6
- 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/integration.mjs +1 -0
- 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 +28 -9
- package/clients/cli/commands/search.test.mjs +75 -0
- package/clients/cli/commands/setup-nudge.test.mjs +6 -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 +52 -13
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/text-json-parity.test.mjs +719 -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.behavior.test.mjs +4 -3
- 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 +20 -8
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- 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/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +2 -0
- package/clients/cli/formatters/index.test.mjs +6 -0
- package/clients/cli/index.mjs +21 -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 +31 -2
- 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 +70 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/agent-docs/agent-docs.test.mjs +10 -1
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +20 -11
- package/foundation/config/project.mjs +246 -89
- package/foundation/config/project.test.mjs +270 -21
- 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 +20 -9
- 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 +119 -0
- package/foundation/discovery/cli-self-docs.mjs +490 -0
- package/foundation/discovery/cli-self-docs.test.mjs +375 -0
- package/foundation/discovery/component-discovery.d.mts +38 -0
- package/foundation/discovery/component-discovery.mjs +48 -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 +108 -10
- package/foundation/discovery/docs-discovery.mjs +191 -30
- package/foundation/discovery/docs-discovery.test.mjs +71 -32
- package/foundation/discovery/docs-output-budget.d.mts +2 -2
- package/foundation/discovery/docs-output-budget.mjs +1 -1
- package/foundation/discovery/docs-section-key.d.mts +28 -10
- package/foundation/discovery/docs-section-key.mjs +134 -33
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/discovery/template-adapter.d.mts +113 -11
- 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 +772 -82
- package/foundation/discovery/template-adapter.test.mjs +57 -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/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +278 -0
- package/foundation/doc-compiler/bundle.test.mjs +266 -0
- package/foundation/doc-compiler/compile.d.mts +220 -39
- package/foundation/doc-compiler/compile.mjs +311 -15
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +305 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +28 -1
- 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 +291 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +13 -0
- package/foundation/doc-compiler/ir.mjs +196 -12
- package/foundation/doc-compiler/lenses.d.mts +3 -2
- package/foundation/doc-compiler/lenses.mjs +2 -1
- package/foundation/doc-compiler/links.d.mts +135 -0
- package/foundation/doc-compiler/links.mjs +253 -0
- package/foundation/doc-compiler/links.test.mjs +139 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +495 -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 +127 -0
- package/foundation/doc-compiler/read.mjs +325 -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/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -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/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +109 -0
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +3 -2
- package/foundation/integrations/contribution-inventory.mjs +27 -24
- package/foundation/integrations/contribution-inventory.test.mjs +86 -27
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +51 -26
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- 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 +121 -29
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +13 -4
- package/foundation/response/error-codes.mjs +8 -2
- package/foundation/response/error-codes.test.mjs +137 -10
- 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 +22 -17
- 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 +4 -3
- package/foundation/xle/expand.test.mjs +54 -0
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +10 -9
- 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
|
@@ -4,46 +4,23 @@
|
|
|
4
4
|
* @file Codemod: Rename Avatar named sizes to Icon's abbreviated scale
|
|
5
5
|
* @see https://github.com/facebook/astryx/issues/2672
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* xsmall (24px) → sm
|
|
13
|
-
* small (36px) → md ← also the new default (was `small`)
|
|
14
|
-
* medium (48px) → lg
|
|
15
|
-
* large (128px) → xl
|
|
16
|
-
*
|
|
17
|
-
* The default size shifts from `small` to `md`, but that is the SAME 36px, so
|
|
18
|
-
* call sites that relied on the default need no change.
|
|
19
|
-
*
|
|
20
|
-
* ## Precision
|
|
21
|
-
*
|
|
22
|
-
* `small`, `medium`, and `large` are common English words that appear as
|
|
23
|
-
* unrelated string/type literals (priorities, statuses, breakpoints, …). To
|
|
24
|
-
* avoid corrupting those, the three AMBIGUOUS names are renamed ONLY in a
|
|
25
|
-
* precise context: a `size` JSX attribute on a component that resolves to an
|
|
26
|
-
* Avatar/AvatarGroup import (alias-aware).
|
|
27
|
-
*
|
|
28
|
-
* `tiny` and `xsmall` are unique to Avatar's scale, so they are additionally
|
|
29
|
-
* renamed in context-blind positions (object properties keyed `size`/`*Size`,
|
|
30
|
-
* Storybook `options` arrays, and size-typed union literals) within files that
|
|
31
|
-
* import Avatar/AvatarGroup.
|
|
7
|
+
* This transform is deliberately limited to static literals written directly
|
|
8
|
+
* in the `size` prop of an imported Avatar or AvatarGroup JSX element. It does
|
|
9
|
+
* not infer through variables, helpers, objects, types, Storybook metadata, or
|
|
10
|
+
* wrappers: missing an indirect migration is safer than rewriting another
|
|
11
|
+
* component's size vocabulary.
|
|
32
12
|
*/
|
|
33
13
|
|
|
14
|
+
import {transformProp} from '../../transform-prop.mjs';
|
|
15
|
+
|
|
34
16
|
export const meta = {
|
|
35
17
|
title: 'Rename Avatar named sizes tiny/xsmall/small/medium/large → xsm/sm/md/lg/xl',
|
|
36
18
|
description:
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'`small` to `md` (both 36px). The ambiguous names small/medium/large are ' +
|
|
40
|
-
'only renamed on Avatar/AvatarGroup `size` JSX attributes; the unique ' +
|
|
41
|
-
'names tiny/xsmall are also renamed in size-keyed props, Storybook ' +
|
|
42
|
-
'options, and union types in files importing Avatar/AvatarGroup.',
|
|
19
|
+
'Renames static sizes written directly on imported Avatar and AvatarGroup ' +
|
|
20
|
+
'JSX elements. Indirect values are left unchanged for manual migration.',
|
|
43
21
|
pr: '#2672',
|
|
44
22
|
};
|
|
45
23
|
|
|
46
|
-
/** Import sources that provide the Astryx Avatar/AvatarGroup components. */
|
|
47
24
|
const IMPORT_SOURCES = new Set([
|
|
48
25
|
'@astryxdesign/core',
|
|
49
26
|
'@astryxdesign/core/Avatar',
|
|
@@ -53,10 +30,11 @@ const IMPORT_SOURCES = new Set([
|
|
|
53
30
|
'@xds/core/AvatarGroup',
|
|
54
31
|
]);
|
|
55
32
|
|
|
56
|
-
|
|
57
|
-
|
|
33
|
+
const COMPONENT_PROPS = new Map([
|
|
34
|
+
['Avatar', new Set(['size'])],
|
|
35
|
+
['AvatarGroup', new Set(['size'])],
|
|
36
|
+
]);
|
|
58
37
|
|
|
59
|
-
/** Old → new size-name mapping. */
|
|
60
38
|
const RENAMES = new Map([
|
|
61
39
|
['tiny', 'xsm'],
|
|
62
40
|
['xsmall', 'sm'],
|
|
@@ -65,46 +43,38 @@ const RENAMES = new Map([
|
|
|
65
43
|
['large', 'xl'],
|
|
66
44
|
]);
|
|
67
45
|
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* scale; their presence in a collection proves it is an Avatar size enum.
|
|
72
|
-
*/
|
|
73
|
-
const AMBIGUOUS = new Set(['small', 'medium', 'large']);
|
|
74
|
-
|
|
75
|
-
/** Names that appear only in Avatar's scale — safe signals of Avatar sizing. */
|
|
76
|
-
const UNIQUE = new Set(['tiny', 'xsmall']);
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Rename a string-literal node if its value is an old size name.
|
|
80
|
-
* Unwraps `'small' as const`. In non-precise contexts, ambiguous names are
|
|
81
|
-
* skipped. Returns true when a rename occurred.
|
|
82
|
-
*/
|
|
83
|
-
function renameValue(/** @type {any} */ node, {precise = false} = {}) {
|
|
84
|
-
if (!node) return false;
|
|
85
|
-
const target = node.type === 'TSAsExpression' ? node.expression : node;
|
|
86
|
-
const isString =
|
|
87
|
-
target.type === 'StringLiteral' || target.type === 'Literal';
|
|
88
|
-
if (!isString || typeof target.value !== 'string') return false;
|
|
89
|
-
const replacement = RENAMES.get(target.value);
|
|
90
|
-
if (!replacement) return false;
|
|
91
|
-
if (!precise && AMBIGUOUS.has(target.value)) return false;
|
|
92
|
-
target.value = replacement;
|
|
93
|
-
if (target.raw) target.raw = undefined;
|
|
94
|
-
return true;
|
|
46
|
+
/** @param {string} name */
|
|
47
|
+
function canonicalComponentName(name) {
|
|
48
|
+
return name.startsWith('XDS') ? name.slice(3) : name;
|
|
95
49
|
}
|
|
96
50
|
|
|
97
|
-
/**
|
|
98
|
-
function
|
|
99
|
-
|
|
51
|
+
/** @param {any} node @returns {boolean} */
|
|
52
|
+
function renameStaticValue(node) {
|
|
53
|
+
if (!node) return false;
|
|
100
54
|
if (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
55
|
+
node.type === 'TSAsExpression' ||
|
|
56
|
+
node.type === 'TSSatisfiesExpression' ||
|
|
57
|
+
node.type === 'TypeCastExpression' ||
|
|
58
|
+
node.type === 'ParenthesizedExpression'
|
|
104
59
|
) {
|
|
105
|
-
return
|
|
60
|
+
return renameStaticValue(node.expression);
|
|
106
61
|
}
|
|
107
|
-
|
|
62
|
+
if (node.type === 'ConditionalExpression') {
|
|
63
|
+
const consequentChanged = renameStaticValue(node.consequent);
|
|
64
|
+
const alternateChanged = renameStaticValue(node.alternate);
|
|
65
|
+
return consequentChanged || alternateChanged;
|
|
66
|
+
}
|
|
67
|
+
if (
|
|
68
|
+
(node.type !== 'StringLiteral' && node.type !== 'Literal') ||
|
|
69
|
+
typeof node.value !== 'string'
|
|
70
|
+
) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const replacement = RENAMES.get(node.value);
|
|
74
|
+
if (!replacement) return false;
|
|
75
|
+
node.value = replacement;
|
|
76
|
+
if (node.raw) node.raw = undefined;
|
|
77
|
+
return true;
|
|
108
78
|
}
|
|
109
79
|
|
|
110
80
|
/**
|
|
@@ -117,122 +87,23 @@ export default function transformer(file, api) {
|
|
|
117
87
|
const root = j(file.source);
|
|
118
88
|
let hasChanges = false;
|
|
119
89
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
let arr = node;
|
|
138
|
-
if (arr.type === 'TSAsExpression') arr = arr.expression;
|
|
139
|
-
if (arr.type !== 'ArrayExpression') return;
|
|
140
|
-
// If the array contains a name unique to Avatar's scale (tiny/xsmall), the
|
|
141
|
-
// whole collection is unambiguously the Avatar size enum, so it is safe to
|
|
142
|
-
// rename the ambiguous members too. Otherwise stay conservative.
|
|
143
|
-
const precise = arr.elements.some((/** @type {any} */ el) => UNIQUE.has(literalString(el)));
|
|
144
|
-
for (const el of arr.elements) {
|
|
145
|
-
if (renameValue(el, {precise})) hasChanges = true;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// 1. `size` JSX attributes on target components — PRECISE (component known),
|
|
150
|
-
// so all five names, including the ambiguous ones, are renamed here.
|
|
151
|
-
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
152
|
-
const name = path.node.name;
|
|
153
|
-
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
154
|
-
if (!componentName || !targetLocals.has(componentName)) return;
|
|
155
|
-
|
|
156
|
-
for (const attr of path.node.attributes) {
|
|
157
|
-
if (attr.type !== 'JSXAttribute' || attr.name?.name !== 'size') continue;
|
|
158
|
-
const value = attr.value;
|
|
159
|
-
|
|
160
|
-
// size="small"
|
|
161
|
-
if (renameValue(value, {precise: true})) {
|
|
162
|
-
hasChanges = true;
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
if (
|
|
166
|
-
value &&
|
|
167
|
-
value.type === 'JSXExpressionContainer' &&
|
|
168
|
-
value.expression
|
|
169
|
-
) {
|
|
170
|
-
// size={'small'}
|
|
171
|
-
if (renameValue(value.expression, {precise: true})) {
|
|
172
|
-
hasChanges = true;
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
// size={cond ? 'small' : 'large'}
|
|
176
|
-
if (value.expression.type === 'ConditionalExpression') {
|
|
177
|
-
if (renameValue(value.expression.consequent, {precise: true}))
|
|
178
|
-
hasChanges = true;
|
|
179
|
-
if (renameValue(value.expression.alternate, {precise: true}))
|
|
180
|
-
hasChanges = true;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// 2. Object properties keyed `size` (or `*Size`) + Storybook `options`
|
|
187
|
-
// arrays — NON-PRECISE (the component isn't known here), so only the
|
|
188
|
-
// unique names tiny/xsmall are renamed.
|
|
189
|
-
const PropertyType = j.ObjectProperty ?? j.Property;
|
|
190
|
-
root.find(PropertyType).forEach((/** @type {any} */ path) => {
|
|
191
|
-
const key = path.node.key;
|
|
192
|
-
const keyName =
|
|
193
|
-
key.type === 'Identifier'
|
|
194
|
-
? key.name
|
|
195
|
-
: key.type === 'StringLiteral' || key.type === 'Literal'
|
|
196
|
-
? key.value
|
|
197
|
-
: null;
|
|
198
|
-
if (typeof keyName !== 'string') return;
|
|
199
|
-
|
|
200
|
-
const lower = keyName.toLowerCase();
|
|
201
|
-
if (lower !== 'size' && !lower.endsWith('size')) return;
|
|
202
|
-
|
|
203
|
-
const value = path.node.value;
|
|
204
|
-
// size: 'tiny'
|
|
205
|
-
if (renameValue(value)) {
|
|
206
|
-
hasChanges = true;
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
// size: { control: 'select', options: ['tiny', ...] }
|
|
210
|
-
if (value.type === 'ObjectExpression') {
|
|
211
|
-
const optionsProp = value.properties.find(
|
|
212
|
-
(/** @type {any} */ p) => p.key && (p.key.name === 'options' || p.key.value === 'options'),
|
|
213
|
-
);
|
|
214
|
-
if (optionsProp) renameArrayElements(optionsProp.value);
|
|
215
|
-
}
|
|
216
|
-
// size: ['tiny', 'xsmall', ...]
|
|
217
|
-
renameArrayElements(value);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
// 3. Union-type literals — NON-PRECISE, so only the unique names tiny/xsmall
|
|
221
|
-
// are renamed. This avoids corrupting unrelated unions that happen to use
|
|
222
|
-
// common words like 'medium' (e.g. a priority or breakpoint type) in a
|
|
223
|
-
// file that also imports Avatar.
|
|
224
|
-
root.find(j.TSLiteralType).forEach((/** @type {any} */ path) => {
|
|
225
|
-
if (renameValue(path.node.literal)) hasChanges = true;
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// 4. Standalone array literals whose members are exactly the Avatar size
|
|
229
|
-
// scale (identified by the presence of a unique name like tiny/xsmall) —
|
|
230
|
-
// e.g. `(['tiny', 'xsmall', 'small', 'medium', 'large'] as const).map(...)`
|
|
231
|
-
// used to render every size. The unique name proves the whole array is the
|
|
232
|
-
// Avatar enum, so its ambiguous members can be renamed safely.
|
|
233
|
-
root.find(j.ArrayExpression).forEach((/** @type {any} */ path) => {
|
|
234
|
-
renameArrayElements(path.node);
|
|
235
|
-
});
|
|
90
|
+
transformProp(
|
|
91
|
+
root,
|
|
92
|
+
j,
|
|
93
|
+
{
|
|
94
|
+
matchesImport: source => IMPORT_SOURCES.has(source),
|
|
95
|
+
components: COMPONENT_PROPS,
|
|
96
|
+
normalizeComponentName: canonicalComponentName,
|
|
97
|
+
},
|
|
98
|
+
propPath => {
|
|
99
|
+
const prop = propPath.node;
|
|
100
|
+
const value =
|
|
101
|
+
prop.value?.type === 'JSXExpressionContainer'
|
|
102
|
+
? prop.value.expression
|
|
103
|
+
: prop.value;
|
|
104
|
+
if (renameStaticValue(value)) hasChanges = true;
|
|
105
|
+
},
|
|
106
|
+
);
|
|
236
107
|
|
|
237
108
|
if (!hasChanges) return undefined;
|
|
238
109
|
return root.toSource({quote: 'single'});
|
|
@@ -220,4 +220,51 @@ function wrapper(useResizable) {
|
|
|
220
220
|
const output = await apply('rename-resizable-pixel-bounds', input);
|
|
221
221
|
expect(output).toBe(input);
|
|
222
222
|
});
|
|
223
|
+
|
|
224
|
+
it('renames bounds when useResizable comes from a namespace import', async () => {
|
|
225
|
+
const input = `import * as Astryx from '@astryxdesign/core';
|
|
226
|
+
const region = Astryx.useResizable({defaultSize: 240, minSizePx: 120, maxSizePx: 480});`;
|
|
227
|
+
const output = await apply('rename-resizable-pixel-bounds', input);
|
|
228
|
+
expect(output).toContain('minSize: 120');
|
|
229
|
+
expect(output).toContain('maxSize: 480');
|
|
230
|
+
expect(output).not.toContain('minSizePx');
|
|
231
|
+
expect(output).not.toContain('maxSizePx');
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('leaves a namespace that does not come from Astryx alone', async () => {
|
|
235
|
+
const input = `import * as Other from 'other-resizable';
|
|
236
|
+
const region = Other.useResizable({minSizePx: 120});`;
|
|
237
|
+
const output = await apply('rename-resizable-pixel-bounds', input);
|
|
238
|
+
expect(output).toContain('minSizePx: 120');
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('does not rewrite a parameter that shadows the namespace import', async () => {
|
|
242
|
+
const input = `import * as Astryx from '@astryxdesign/core';
|
|
243
|
+
function build(Astryx) {
|
|
244
|
+
return Astryx.useResizable({minSizePx: 120});
|
|
245
|
+
}`;
|
|
246
|
+
const output = await apply('rename-resizable-pixel-bounds', input);
|
|
247
|
+
expect(output).toContain('minSizePx: 120');
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it.each([
|
|
251
|
+
['as const', '{defaultSize: 240, minSizePx: 120} as const'],
|
|
252
|
+
['satisfies', '{defaultSize: 240, minSizePx: 120} satisfies object'],
|
|
253
|
+
])('renames a static configuration wrapped in %s', async (_label, config) => {
|
|
254
|
+
const input = `import {useResizable} from '@astryxdesign/core/Resizable';
|
|
255
|
+
const region = useResizable(${config});`;
|
|
256
|
+
const output = await apply('rename-resizable-pixel-bounds', input);
|
|
257
|
+
expect(output).toContain('minSize: 120');
|
|
258
|
+
expect(output).not.toContain('minSizePx');
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it('renames wrapped multi-region configurations', async () => {
|
|
262
|
+
const input = `import {useResizable} from '@astryxdesign/core';
|
|
263
|
+
const regions = useResizable({regions: {
|
|
264
|
+
nav: {defaultSize: 240, minSizePx: 120} as const,
|
|
265
|
+
} as const});`;
|
|
266
|
+
const output = await apply('rename-resizable-pixel-bounds', input);
|
|
267
|
+
expect(output).toContain('minSize: 120');
|
|
268
|
+
expect(output).not.toContain('minSizePx');
|
|
269
|
+
});
|
|
223
270
|
});
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* released conflict rule (the unified property wins when both are present).
|
|
9
9
|
* A spread or computed property can change precedence invisibly, so dynamic
|
|
10
10
|
* objects stay unchanged and receive a manual-migration TODO instead.
|
|
11
|
+
* Named and namespace imports both count, and a type-only wrapper (`as`,
|
|
12
|
+
* `satisfies`, a non-null assertion, parentheses) does not make a
|
|
13
|
+
* configuration dynamic.
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
16
|
export const meta = {
|
|
@@ -33,6 +36,26 @@ const MANUAL_MIGRATION_COMMENT =
|
|
|
33
36
|
'or computed property. Rename minSizePx/maxSizePx to minSize/maxSize ' +
|
|
34
37
|
'manually without changing property precedence. ';
|
|
35
38
|
|
|
39
|
+
const TYPE_WRAPPERS = new Set([
|
|
40
|
+
'TSAsExpression',
|
|
41
|
+
'TSSatisfiesExpression',
|
|
42
|
+
'TSTypeAssertion',
|
|
43
|
+
'TSNonNullExpression',
|
|
44
|
+
'ParenthesizedExpression',
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The expression under type-only wrappers such as `{...} as const`.
|
|
49
|
+
* @param {any} node
|
|
50
|
+
*/
|
|
51
|
+
function unwrap(node) {
|
|
52
|
+
let current = node;
|
|
53
|
+
while (current && TYPE_WRAPPERS.has(current.type)) {
|
|
54
|
+
current = current.expression;
|
|
55
|
+
}
|
|
56
|
+
return current;
|
|
57
|
+
}
|
|
58
|
+
|
|
36
59
|
/** @param {any} property */
|
|
37
60
|
function staticPropertyName(property) {
|
|
38
61
|
if (property.computed) return null;
|
|
@@ -128,6 +151,8 @@ export default function transformer(file, api) {
|
|
|
128
151
|
const root = j(file.source);
|
|
129
152
|
/** @type {Map<string, any>} */
|
|
130
153
|
const bindings = new Map();
|
|
154
|
+
/** @type {Map<string, any>} */
|
|
155
|
+
const namespaces = new Map();
|
|
131
156
|
|
|
132
157
|
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
133
158
|
if (!IMPORT_SOURCES.has(path.node.source.value)) return;
|
|
@@ -138,17 +163,40 @@ export default function transformer(file, api) {
|
|
|
138
163
|
) {
|
|
139
164
|
const local = specifier.local?.name ?? 'useResizable';
|
|
140
165
|
bindings.set(local, path.scope.lookup(local) ?? path.scope);
|
|
166
|
+
} else if (specifier.type === 'ImportNamespaceSpecifier') {
|
|
167
|
+
const local = specifier.local.name;
|
|
168
|
+
namespaces.set(local, path.scope.lookup(local) ?? path.scope);
|
|
141
169
|
}
|
|
142
170
|
}
|
|
143
171
|
});
|
|
144
|
-
if (bindings.size === 0) return undefined;
|
|
172
|
+
if (bindings.size === 0 && namespaces.size === 0) return undefined;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @param {any} callee
|
|
176
|
+
* @param {any} scope
|
|
177
|
+
*/
|
|
178
|
+
const isUseResizable = (callee, scope) => {
|
|
179
|
+
if (callee.type === 'Identifier') {
|
|
180
|
+
return (
|
|
181
|
+
bindings.has(callee.name) &&
|
|
182
|
+
scope.lookup(callee.name) === bindings.get(callee.name)
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
return (
|
|
186
|
+
callee.type === 'MemberExpression' &&
|
|
187
|
+
!callee.computed &&
|
|
188
|
+
callee.object.type === 'Identifier' &&
|
|
189
|
+
callee.property.type === 'Identifier' &&
|
|
190
|
+
callee.property.name === 'useResizable' &&
|
|
191
|
+
namespaces.has(callee.object.name) &&
|
|
192
|
+
scope.lookup(callee.object.name) === namespaces.get(callee.object.name)
|
|
193
|
+
);
|
|
194
|
+
};
|
|
145
195
|
|
|
146
196
|
let changed = false;
|
|
147
197
|
root.find(j.CallExpression).forEach((/** @type {any} */ path) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (path.scope.lookup(callee.name) !== bindings.get(callee.name)) return;
|
|
151
|
-
const config = path.node.arguments[0];
|
|
198
|
+
if (!isUseResizable(path.node.callee, path.scope)) return;
|
|
199
|
+
const config = unwrap(path.node.arguments[0]);
|
|
152
200
|
if (config?.type !== 'ObjectExpression') return;
|
|
153
201
|
|
|
154
202
|
changed = migrateObject(j, config) || changed;
|
|
@@ -158,13 +206,12 @@ export default function transformer(file, api) {
|
|
|
158
206
|
staticPropertyName(property) === 'regions',
|
|
159
207
|
);
|
|
160
208
|
if (!regions || !('value' in regions)) return;
|
|
161
|
-
const regionsObject = regions.value;
|
|
209
|
+
const regionsObject = unwrap(regions.value);
|
|
162
210
|
if (regionsObject?.type !== 'ObjectExpression') return;
|
|
163
211
|
for (const region of regionsObject.properties) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
changed = migrateObject(j, region.value) || changed;
|
|
212
|
+
const regionConfig = 'value' in region ? unwrap(region.value) : null;
|
|
213
|
+
if (regionConfig?.type !== 'ObjectExpression') continue;
|
|
214
|
+
changed = migrateObject(j, regionConfig) || changed;
|
|
168
215
|
}
|
|
169
216
|
});
|
|
170
217
|
|
|
@@ -98,11 +98,11 @@ export const docs = {
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
type: 'prose',
|
|
101
|
-
text: 'These stylesheets are cascade-layered: the reset loads in @layer reset and component styles in @layer astryx-base. If your project has existing global CSS, a legacy reset, or Tailwind, declare the layer order explicitly and assign every stylesheet to a layer deliberately: unlayered styles and later layers both override astryx-base regardless of specificity. See the Cascade Layer Safety section in
|
|
101
|
+
text: 'These stylesheets are cascade-layered: the reset loads in @layer reset and component styles in @layer astryx-base. If your project has existing global CSS, a legacy reset, or Tailwind, declare the layer order explicitly and assign every stylesheet to a layer deliberately: unlayered styles and later layers both override astryx-base regardless of specificity. See the Cascade Layer Safety section in {@link generic:migration} before building screens.',
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
type: 'prose',
|
|
105
|
-
text: 'Run
|
|
105
|
+
text: 'Run {@link generic:theme} for the full theming guide.',
|
|
106
106
|
},
|
|
107
107
|
],
|
|
108
108
|
},
|
|
@@ -39,10 +39,10 @@ export const docs = {
|
|
|
39
39
|
style: 'ordered',
|
|
40
40
|
items: [
|
|
41
41
|
'Use components for everything they cover',
|
|
42
|
-
'Page layout is frame-first: pick the shell and budget regions before writing content (see
|
|
42
|
+
'Page layout is frame-first: pick the shell and budget regions before writing content (see {@link generic:layout})',
|
|
43
43
|
'Dense data renders as rows (Table, List/Item), edge-to-edge with dividers; Card is for widgets, galleries, and settings groups',
|
|
44
|
-
'StyleX or Tailwind for custom styling; both are first-class (see
|
|
45
|
-
'Semantic tokens, not hardcoded values (see
|
|
44
|
+
'StyleX or Tailwind for custom styling; both are first-class (see {@link generic:styling})',
|
|
45
|
+
'Semantic tokens, not hardcoded values (see {@link generic:tokens})',
|
|
46
46
|
'CSS custom properties for colors, not hex values',
|
|
47
47
|
'Form inputs are controlled (value + onChange)',
|
|
48
48
|
'Use useLinkComponent() for navigation so consumers can plug in their framework router via LinkProvider',
|
|
@@ -60,7 +60,7 @@ export const docs = {
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
type: 'prose',
|
|
63
|
-
text: 'See
|
|
63
|
+
text: 'See {@link generic:styling} for the complete guide with examples.',
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
66
|
},
|
|
@@ -76,7 +76,7 @@ export const docs = {
|
|
|
76
76
|
'Hardcoded colors (#fff). Use var(--color-*) or Tailwind semantic classes (text-primary, bg-surface)',
|
|
77
77
|
'Hardcoded spacing (16px). Use spacing tokens or Tailwind spacing utilities',
|
|
78
78
|
'Hardcoded <a> elements. Use useLinkComponent() so consumers can swap in their framework router via LinkProvider',
|
|
79
|
-
'Wrapping every list item or page section in a Card. Decide the frame first; dense data renders as rows (see
|
|
79
|
+
'Wrapping every list item or page section in a Card. Decide the frame first; dense data renders as rows (see {@link generic:layout})',
|
|
80
80
|
'Badge as decoration. Reserve Badge for counts and enumerated states; use StatusDot or Token for status',
|
|
81
81
|
'Inventing props. Read component docs first',
|
|
82
82
|
],
|
|
@@ -89,7 +89,7 @@ export const docs = {
|
|
|
89
89
|
content: [
|
|
90
90
|
{
|
|
91
91
|
type: 'prose',
|
|
92
|
-
text: 'The design system provides semantic design tokens for spacing, color, radius, shadow, typography, and size. Tokens adapt to the active theme and color mode. Run
|
|
92
|
+
text: 'The design system provides semantic design tokens for spacing, color, radius, shadow, typography, and size. Tokens adapt to the active theme and color mode. Run {@link generic:tokens} for the full reference with all values.',
|
|
93
93
|
},
|
|
94
94
|
],
|
|
95
95
|
},
|
|
@@ -24,7 +24,7 @@ export const docs = {
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
type: 'prose',
|
|
27
|
-
text: 'For available token names and values, run
|
|
27
|
+
text: 'For available token names and values, run {@link generic:tokens}. Focused references are also available with {@link generic:color}, {@link generic:spacing}, {@link generic:shape}, {@link generic:typography}, {@link generic:elevation}, and {@link generic:motion}.',
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
},
|
|
@@ -455,7 +455,7 @@ function RevenueChart({data}: {data: Array<{x: string; y: number}>}) {
|
|
|
455
455
|
'Import the reset/base CSS and a theme CSS file early enough for first paint. For production SSR, prefer built themes from `astryx theme build` or published `/built` theme imports plus `theme.css`.',
|
|
456
456
|
'Choose one owner for color mode. Theme uses `data-theme="light|dark"` and `color-scheme` to resolve `light-dark()` tokens.',
|
|
457
457
|
'Map the external library\'s semantic layer to system variables by intent, not by exact naming. For example, MUI `background.paper` maps to `--color-background-surface`.',
|
|
458
|
-
'Use
|
|
458
|
+
'Use {@link generic:tokens} and focused token docs when building mappings. Keep mappings small at first: text, surface/body/card/popover, border, accent, status, spacing, radius, typography, shadow.',
|
|
459
459
|
'Use token resolver APIs only for non-CSS APIs that need resolved values.',
|
|
460
460
|
],
|
|
461
461
|
},
|
|
@@ -30,7 +30,7 @@ export const docs = {
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
type: 'prose',
|
|
33
|
-
text: 'All approaches resolve to the same design tokens, so theming and dark mode work regardless of which you choose. For external styling libraries, run
|
|
33
|
+
text: 'All approaches resolve to the same design tokens, so theming and dark mode work regardless of which you choose. For external styling libraries, run {@link generic:styling-libraries}; it covers Tailwind, StyleX, Panda, Chakra, MUI, CSS-in-JS, CSS Modules, Sass, and `useTheme()` for non-CSS processing.',
|
|
34
34
|
},
|
|
35
35
|
],
|
|
36
36
|
},
|
|
@@ -118,7 +118,7 @@ const overrides = stylex.create({
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
type: 'prose',
|
|
121
|
-
text: 'The bridge is pure CSS with zero JS. Theme changes (dark mode, custom themes) apply automatically because the utilities reference the same CSS custom properties that components use. This is the paved Tailwind path; for other styling libraries that follow the same aliasing pattern, run
|
|
121
|
+
text: 'The bridge is pure CSS with zero JS. Theme changes (dark mode, custom themes) apply automatically because the utilities reference the same CSS custom properties that components use. This is the paved Tailwind path; for other styling libraries that follow the same aliasing pattern, run {@link generic:styling-libraries}.',
|
|
122
122
|
},
|
|
123
123
|
],
|
|
124
124
|
},
|
|
@@ -263,7 +263,7 @@ const overrides = stylex.create({
|
|
|
263
263
|
},
|
|
264
264
|
{
|
|
265
265
|
type: 'prose',
|
|
266
|
-
text: 'For systematic theming, use defineTheme component overrides instead of raw CSS selectors. defineTheme keeps the higher-level `prop:value` API (`variant:primary`, `size:sm`) and handles selector generation for you. Run
|
|
266
|
+
text: 'For systematic theming, use defineTheme component overrides instead of raw CSS selectors. defineTheme keeps the higher-level `prop:value` API (`variant:primary`, `size:sm`) and handles selector generation for you. Run {@link generic:theme} for the full theming guide.',
|
|
267
267
|
},
|
|
268
268
|
],
|
|
269
269
|
},
|
|
@@ -338,7 +338,7 @@ const styles = stylex.create({
|
|
|
338
338
|
},
|
|
339
339
|
{
|
|
340
340
|
type: 'prose',
|
|
341
|
-
text: 'See
|
|
341
|
+
text: 'See {@link generic:tokens} for the full token reference (all spacing, color, radius, shadow, and typography tokens with values). See {@link generic:theme} for how to override tokens via defineTheme.',
|
|
342
342
|
},
|
|
343
343
|
],
|
|
344
344
|
},
|
|
@@ -152,7 +152,7 @@ function App() {
|
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
type: 'prose',
|
|
155
|
-
text: 'The copy is editable project source, not a reference back into node_modules.
|
|
155
|
+
text: 'The copy is editable project source, not a reference back into node_modules. The complete theme directory comes with it, including its typed `.doc.mjs`, nested token and palette modules, and receipts. A second add refuses to overwrite those files unless you pass `--overwrite`.',
|
|
156
156
|
},
|
|
157
157
|
],
|
|
158
158
|
},
|
|
@@ -391,7 +391,7 @@ const brandTheme = defineTheme({
|
|
|
391
391
|
content: [
|
|
392
392
|
{
|
|
393
393
|
type: 'prose',
|
|
394
|
-
text: 'The `components` field in defineTheme uses semantic component keys and style keys, not raw CSS selectors. Use `base` for all instances, `variant:value` or `stateName` for specific props/states, and let the theme pipeline choose the underlying selector. For raw external CSS escape hatches, prefer the data-attribute selector surface documented in
|
|
394
|
+
text: 'The `components` field in defineTheme uses semantic component keys and style keys, not raw CSS selectors. Use `base` for all instances, `variant:value` or `stateName` for specific props/states, and let the theme pipeline choose the underlying selector. For raw external CSS escape hatches, prefer the data-attribute selector surface documented in {@link generic:styling}.',
|
|
395
395
|
},
|
|
396
396
|
{
|
|
397
397
|
type: 'code',
|
|
@@ -572,7 +572,7 @@ import './themes/ocean.css';
|
|
|
572
572
|
},
|
|
573
573
|
{
|
|
574
574
|
type: 'prose',
|
|
575
|
-
text: "The build also warns when the theme names font families it does not load (webfonts like Fraunces) and prints the `<link>`/`@font-face` to add. The built CSS only sets font-family, so loading the font files stays the app's job. See
|
|
575
|
+
text: "The build also warns when the theme names font families it does not load (webfonts like Fraunces) and prints the `<link>`/`@font-face` to add. The built CSS only sets font-family, so loading the font files stays the app's job. See {@link generic:typography} for the full recipe.",
|
|
576
576
|
},
|
|
577
577
|
],
|
|
578
578
|
},
|
|
@@ -811,7 +811,7 @@ function ChartConfig() {
|
|
|
811
811
|
},
|
|
812
812
|
{
|
|
813
813
|
type: 'prose',
|
|
814
|
-
text: 'See
|
|
814
|
+
text: 'See {@link generic:styling-libraries} for styling-library interop and {@link generic:tokens} for the full token reference.',
|
|
815
815
|
},
|
|
816
816
|
],
|
|
817
817
|
},
|
|
@@ -1102,7 +1102,7 @@ export const docs = {
|
|
|
1102
1102
|
},
|
|
1103
1103
|
{
|
|
1104
1104
|
"type": "prose",
|
|
1105
|
-
"text": "See
|
|
1105
|
+
"text": "See {@link generic:styling} for how to apply tokens via xstyle, className, and compound component patterns. See {@link generic:theme} for overriding tokens with defineTheme."
|
|
1106
1106
|
}
|
|
1107
1107
|
]
|
|
1108
1108
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/api`: the programmatic API of `@astryxdesign/cli/api`.
|
|
5
|
+
*
|
|
6
|
+
* Adopts each function, schema, and enum doc whose `namespace` is `cli/api`,
|
|
7
|
+
* one generated level per kind: `cli/api/functions`, `cli/api/schemas`, and
|
|
8
|
+
* `cli/api/enums`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
12
|
+
export const docs = {
|
|
13
|
+
type: 'namespace',
|
|
14
|
+
name: 'api',
|
|
15
|
+
title: 'API',
|
|
16
|
+
summary:
|
|
17
|
+
'The programmatic API: functions, the JSON output envelope, error codes, and response types.',
|
|
18
|
+
keywords: ['api', 'functions', 'schemas', 'enums', 'json'],
|
|
19
|
+
placement: {parent: 'namespace:cli', slot: 'reference', order: 20},
|
|
20
|
+
slots: {
|
|
21
|
+
kinds: {title: 'Reference', accepts: {kinds: ['namespace']}},
|
|
22
|
+
},
|
|
23
|
+
adopts: [
|
|
24
|
+
{
|
|
25
|
+
source: {group: 'cli/api', kinds: ['function', 'schema', 'enum']},
|
|
26
|
+
into: 'kinds',
|
|
27
|
+
groupBy: 'kind',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|