@astryxdesign/cli 0.1.7 → 0.1.8-canary.07362a9
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 +40 -0
- package/README.md +115 -19
- package/{src/api → api/blog}/blog.mjs +42 -6
- package/{src/api → api/blog}/blog.test.mjs +2 -2
- package/api/build/build.mjs +92 -0
- package/api/build/build.test.mjs +92 -0
- package/{src/api → api/component}/component.mjs +49 -26
- package/{src/api → api/discover}/discover.mjs +55 -18
- package/{src/api → api/docs}/docs.mjs +47 -21
- package/{src/api → api/doctor}/doctor.mjs +13 -10
- package/{src/api → api}/error.mjs +2 -2
- package/{src/api → api/hook}/hook.mjs +11 -11
- package/{src/api → api}/index.mjs +16 -9
- package/{src/api → api/integration}/validate-integration.mjs +48 -15
- package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
- package/{src/api → api/layout}/layout.mjs +66 -17
- package/{src/api → api/layout}/layout.test.mjs +1 -1
- package/{src/api → api/search}/search.mjs +71 -12
- package/api/swizzle/swizzle.mjs +283 -0
- package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
- package/{src/api → api/template}/template-integration.test.mjs +2 -2
- package/{src/api → api/template}/template-suffix.test.mjs +3 -3
- package/{src/api → api/template}/template.mjs +96 -19
- package/{src/api → api/theme}/theme-add.mjs +35 -7
- package/{src → authoring}/codemod.mjs +6 -6
- package/{src → authoring}/config.test.mjs +1 -1
- package/{src → authoring}/doc.mjs +1 -1
- package/{src → authoring}/doc.test.mjs +1 -1
- package/{src → authoring}/template.mjs +1 -1
- package/bin/astryx.mjs +12 -10
- package/{src → cli}/commands/blog.mjs +48 -7
- package/{src → cli}/commands/build-theme.mjs +133 -115
- package/cli/commands/build.mjs +172 -0
- package/cli/commands/cli-postinstall.test.mjs +42 -0
- package/{src → cli}/commands/component/index.mjs +52 -25
- package/{src → cli}/commands/component-ownership.test.mjs +3 -3
- package/{src → cli}/commands/component-package.test.mjs +1 -1
- package/{src → cli}/commands/component-resolution.test.mjs +2 -2
- package/{src → cli}/commands/discover.mjs +23 -12
- package/{src → cli}/commands/docs.mjs +42 -10
- package/{src → cli}/commands/docs.test.mjs +1 -1
- package/{src → cli}/commands/doctor.mjs +3 -3
- package/{src → cli}/commands/doctor.test.mjs +2 -2
- package/{src → cli}/commands/ensure-core-built.mjs +3 -2
- package/{src → cli}/commands/external-showcase.test.mjs +1 -1
- package/{src → cli}/commands/hook/index.mjs +40 -17
- package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
- package/cli/commands/init.mjs +195 -0
- package/{src → cli}/commands/init.next-steps.test.mjs +1 -1
- package/cli/commands/interactive-guard.test.mjs +66 -0
- package/{src → cli}/commands/json-contract.test.mjs +2 -2
- package/{src → cli}/commands/layout.mjs +59 -19
- package/{src → cli}/commands/search.mjs +22 -15
- package/{src → cli}/commands/search.test.mjs +1 -1
- package/cli/commands/setup-nudge.test.mjs +108 -0
- package/cli/commands/swizzle.mjs +103 -0
- package/{src → cli}/commands/template.mjs +84 -53
- package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
- package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
- package/{src → cli}/commands/upgrade.mjs +291 -77
- package/cli/commands/upgrade.test.mjs +314 -0
- package/{src → cli}/commands/validate-integration.mjs +17 -37
- package/{src → cli}/index.mjs +55 -19
- package/{src/codemods → codemods}/__tests__/registry.test.mjs +1 -0
- package/{src/codemods → codemods}/ensure-jscodeshift.mjs +12 -28
- package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
- package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
- package/{src/codemods → codemods}/integration-runner.mjs +8 -3
- package/{src/codemods → codemods}/registry.mjs +4 -1
- package/{src/codemods → codemods}/run-codemod.mjs +18 -11
- package/{src/codemods → codemods}/runner.mjs +24 -14
- package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
- package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
- package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +42 -7
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +43 -0
- package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +117 -13
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +86 -15
- package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
- package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
- package/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +161 -0
- package/codemods/transforms/v0.1.8/index.mjs +19 -0
- package/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +239 -0
- package/docs/cli-integrations.doc.mjs +150 -0
- package/docs/elevation.doc.mjs +79 -1
- package/docs/getting-started.doc.mjs +9 -9
- package/docs/internationalization.doc.mjs +92 -46
- package/docs/migration.doc.mjs +18 -18
- package/docs/principles.doc.dense.mjs +1 -1
- package/docs/principles.doc.mjs +6 -6
- package/docs/principles.doc.zh.mjs +1 -1
- package/docs/styling-libraries.doc.mjs +3 -3
- package/docs/styling.doc.mjs +4 -4
- package/docs/theme.doc.dense.mjs +2 -2
- package/docs/theme.doc.mjs +7 -7
- package/docs/theme.doc.zh.mjs +1 -1
- package/docs/tokens.doc.mjs +1 -1
- package/docs/working-with-ai.doc.mjs +19 -19
- package/{src/commands → lib/agent-docs}/agent-docs.mjs +164 -29
- package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
- package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +123 -10
- package/{src/lib → lib}/cli-error.mjs +2 -2
- package/{src/lib → lib}/component-discovery.mjs +44 -2
- package/{src/lib → lib}/component-format.mjs +67 -25
- package/{src/lib → lib}/component-loader.mjs +27 -13
- package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
- package/{src/lib → lib}/error-codes.test.mjs +1 -1
- package/{src/lib → lib}/hook-discovery.mjs +14 -1
- package/{src/lib → lib}/hook-format.mjs +29 -5
- package/{src/lib → lib}/integration-warnings.mjs +2 -2
- package/{src/lib → lib}/integrations.mjs +20 -0
- package/{src/lib → lib}/integrations.test.mjs +1 -1
- package/{src/lib → lib}/json-contract.test.mjs +1 -1
- package/{src/lib → lib}/json-shim.mjs +11 -6
- package/{src/lib → lib}/json-shim.test.mjs +1 -1
- package/{src/lib → lib}/json.mjs +3 -3
- package/{src/lib → lib}/levenshtein.mjs +6 -0
- package/{src/lib → lib}/manifest.mjs +7 -5
- package/{src/lib → lib}/manifest.test.mjs +2 -2
- package/{src/lib → lib}/module-loader.mjs +1 -0
- package/{src/lib → lib}/package-scanner.mjs +47 -0
- package/{src/lib → lib}/project.mjs +48 -18
- package/{src/lib → lib}/project.test.mjs +1 -1
- package/{src/lib → lib}/resolve-theme.mjs +5 -0
- package/{src/lib → lib}/string-utils.mjs +15 -0
- package/lib/term-log.mjs +57 -0
- package/{src/lib → lib}/xle/browser.mjs +18 -8
- package/{src/lib → lib}/xle/expand.mjs +155 -22
- package/{src/lib → lib}/xle/parse.mjs +119 -13
- package/{src/lib → lib}/xle/print.mjs +54 -14
- package/{src/lib → lib}/xle/registry-core.mjs +28 -3
- package/{src/lib → lib}/xle/registry.mjs +9 -4
- package/{src/lib → lib}/xle/splice.mjs +13 -2
- package/{src/lib → lib}/xle/validate.mjs +95 -14
- package/lib/xle/xle-ast.d.ts +214 -0
- package/package.json +37 -28
- package/scripts/postinstall.mjs +74 -0
- package/templates/blocks/components/Avatar/AvatarFallbackChain.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarGroup.tsx +2 -2
- package/templates/blocks/components/Avatar/AvatarInitialsFallback.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +5 -5
- package/templates/blocks/components/Avatar/AvatarUserCard.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarWithImage.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -3
- package/templates/blocks/components/AvatarGroup/AvatarGroupShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowCustomText.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowDefault.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +3 -3
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +3 -3
- package/templates/blocks/components/Banner/BannerFloating.doc.mjs +14 -0
- package/templates/blocks/components/Banner/BannerFloating.tsx +16 -0
- package/templates/blocks/components/Button/ButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/Button/ButtonFloating.tsx +37 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.doc.mjs +14 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +23 -0
- package/templates/blocks/components/Card/CardElevations.doc.mjs +14 -0
- package/templates/blocks/components/Card/CardElevations.tsx +32 -0
- package/templates/blocks/components/Card/ClickableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/ClickableCardElevated.tsx +21 -0
- package/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/SelectableCardElevated.tsx +37 -0
- package/templates/blocks/components/Carousel/CarouselSnap.tsx +1 -1
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +14 -0
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +75 -0
- package/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx +2 -2
- package/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleGrouping.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +1 -1
- package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +5 -9
- package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -1
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -1
- package/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/IconButton/IconButtonFloating.tsx +37 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
- package/templates/blocks/components/Item/ItemWithMedia.tsx +2 -2
- package/templates/blocks/components/ListItem/ListItemWithMedia.tsx +2 -2
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +39 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.tsx +44 -0
- package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -6
- package/templates/blocks/components/Stack/StackFillItem.tsx +2 -6
- package/templates/blocks/components/TabList/TabListTabsWithActions.doc.mjs +1 -1
- package/templates/blocks/components/TabList/TabListTabsWithActions.tsx +2 -7
- package/templates/blocks/components/Table/TableRowStatusTable.doc.mjs +14 -0
- package/templates/blocks/components/Table/TableRowStatusTable.tsx +59 -0
- package/templates/blocks/components/Thumbnail/ThumbnailDisabled.tsx +6 -1
- package/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx +1 -0
- package/templates/blocks/components/Thumbnail/ThumbnailRemovable.tsx +1 -0
- package/templates/blocks/components/TypeaheadItem/TypeaheadItemShowcase.tsx +1 -1
- package/templates/pages/ai-chat/page.tsx +4 -4
- package/templates/pages/dashboard-portfolio/page.tsx +3 -11
- package/templates/pages/detail-page/page.tsx +5 -12
- package/templates/pages/documentation-design/page.tsx +1 -1
- package/templates/pages/messaging-shell/page.tsx +6 -8
- package/templates/pages/table-grouped/page.tsx +9 -14
- package/templates/pages/table-page/page.tsx +7 -9
- package/templates/pages/table-page-heatmap-status/page.tsx +5 -13
- package/{src/types → types}/api.contract.assert.ts +17 -8
- package/{src/types → types}/api.d.ts +110 -9
- package/{src/types → types}/base.d.ts +40 -4
- package/types/build.d.ts +53 -0
- package/types/codemod.d.ts +166 -0
- package/{src/types → types}/component.d.ts +1 -1
- package/{src/types → types}/discover.d.ts +1 -1
- package/{src/types → types}/docs.d.ts +1 -4
- package/{src/types → types}/hook.d.ts +1 -1
- package/{src/types → types}/index.d.ts +1 -0
- package/types/jscodeshift.d.ts +19 -0
- package/types/layout.d.ts +74 -0
- package/{src/types → types}/swizzle.d.ts +4 -0
- package/{src/types → types}/template-api.d.ts +4 -1
- package/types/theme.d.ts +53 -0
- package/types/upgrade.d.ts +108 -0
- package/utils/package-manager.mjs +178 -0
- package/utils/package-manager.test.mjs +220 -0
- package/{src/utils → utils}/path-safety.mjs +0 -18
- package/{src/utils → utils}/paths.mjs +4 -1
- package/{src/utils → utils}/update-check.mjs +5 -4
- package/{src/utils → utils}/update-check.test.mjs +3 -3
- package/docs/integration-authoring.md +0 -105
- package/src/commands/build.mjs +0 -196
- package/src/commands/init.mjs +0 -288
- package/src/commands/interactive-guard.test.mjs +0 -69
- package/src/commands/swizzle.mjs +0 -440
- package/src/commands/upgrade.test.mjs +0 -160
- package/src/types/codemod.d.ts +0 -81
- package/src/types/theme.d.ts +0 -23
- package/src/types/upgrade.d.ts +0 -64
- package/src/utils/interactive.mjs +0 -76
- package/src/utils/interactive.test.mjs +0 -70
- package/src/utils/package-manager.mjs +0 -74
- package/src/utils/package-manager.test.mjs +0 -113
- /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
- /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
- /package/{src/api → api/template}/template.test.mjs +0 -0
- /package/{src → authoring}/codemod.test.mjs +0 -0
- /package/{src → authoring}/config.mjs +0 -0
- /package/{src → authoring}/integration.mjs +0 -0
- /package/{src → authoring}/template.test.mjs +0 -0
- /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
- /package/{src → cli}/commands/component.test.mjs +0 -0
- /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
- /package/{src → cli}/commands/template.test.mjs +0 -0
- /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
- /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
- /package/{src → cli}/update-hint-commands.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
- /package/{src/lib → lib}/cli-error.test.mjs +0 -0
- /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
- /package/{src/lib → lib}/component-format.test.mjs +0 -0
- /package/{src/lib → lib}/component-loader.test.mjs +0 -0
- /package/{src/lib → lib}/config-cache.mjs +0 -0
- /package/{src/lib → lib}/config-cache.test.mjs +0 -0
- /package/{src/lib → lib}/config-schema.mjs +0 -0
- /package/{src/lib → lib}/error-codes.mjs +0 -0
- /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
- /package/{src/lib → lib}/module-loader.test.mjs +0 -0
- /package/{src/lib → lib}/node-version.mjs +0 -0
- /package/{src/lib → lib}/node-version.test.mjs +0 -0
- /package/{src/lib → lib}/parse.mjs +0 -0
- /package/{src/lib → lib}/site.mjs +0 -0
- /package/{src/lib → lib}/xle/browser.d.ts +0 -0
- /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
- /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
- /package/{src/schemas → schemas}/template-schema.mjs +0 -0
- /package/{src/types → types}/config.d.ts +0 -0
- /package/{src/types → types}/doc.d.ts +0 -0
- /package/{src/types → types}/doctor.d.ts +0 -0
- /package/{src/types → types}/error-codes.d.ts +0 -0
- /package/{src/types → types}/integration.d.ts +0 -0
- /package/{src/types → types}/manifest.d.ts +0 -0
- /package/{src/types → types}/search.d.ts +0 -0
- /package/{src/types → types}/template.d.ts +0 -0
- /package/{src/types → types}/validate-integration.d.ts +0 -0
- /package/{src/utils → utils}/github.mjs +0 -0
- /package/{src/utils → utils}/path-safety.test.mjs +0 -0
- /package/{src/utils → utils}/paths.test.mjs +0 -0
- /package/{src/utils → utils}/semver.mjs +0 -0
- /package/{src/utils → utils}/semver.test.mjs +0 -0
|
@@ -22,15 +22,22 @@ export const meta = {
|
|
|
22
22
|
pr: '#1714',
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
/** @type {Record<string, string>} */
|
|
25
26
|
const IMPORT_RENAMES = {
|
|
26
27
|
XDSChatComposerAttachments: 'XDSChatComposerDrawer',
|
|
27
28
|
XDSChatComposerAttachmentsProps: 'XDSChatComposerDrawerProps',
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
/** @type {Record<string, string>} */
|
|
30
32
|
const CSS_CLASS_RENAMES = {
|
|
31
33
|
'xds-chat-composer-attachments': 'xds-chat-composer-drawer',
|
|
32
34
|
};
|
|
33
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
38
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
39
|
+
* @returns {string | null | undefined}
|
|
40
|
+
*/
|
|
34
41
|
export default function transformer(file, api) {
|
|
35
42
|
const j = api.jscodeshift;
|
|
36
43
|
const root = j(file.source);
|
|
@@ -40,7 +47,7 @@ export default function transformer(file, api) {
|
|
|
40
47
|
const localToComponent = new Map();
|
|
41
48
|
|
|
42
49
|
// --- 1. Rename imports ---
|
|
43
|
-
root.find(j.ImportSpecifier).forEach((path) => {
|
|
50
|
+
root.find(j.ImportSpecifier).forEach((/** @type {any} */ path) => {
|
|
44
51
|
const importedName = path.node.imported.name;
|
|
45
52
|
const newName = IMPORT_RENAMES[importedName];
|
|
46
53
|
if (!newName) return;
|
|
@@ -66,7 +73,7 @@ export default function transformer(file, api) {
|
|
|
66
73
|
|
|
67
74
|
root
|
|
68
75
|
.find(j.JSXIdentifier, {name: oldName})
|
|
69
|
-
.forEach((path) => {
|
|
76
|
+
.forEach((/** @type {any} */ path) => {
|
|
70
77
|
const parent = path.parent.node;
|
|
71
78
|
if (
|
|
72
79
|
parent.type === 'JSXOpeningElement' ||
|
|
@@ -79,7 +86,7 @@ export default function transformer(file, api) {
|
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
// --- 3. Rename `attachments` prop → `drawer` on XDSChatComposer ---
|
|
82
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
89
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
83
90
|
const name = path.node.name;
|
|
84
91
|
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
85
92
|
if (componentName !== 'XDSChatComposer') return;
|
|
@@ -97,7 +104,7 @@ export default function transformer(file, api) {
|
|
|
97
104
|
});
|
|
98
105
|
|
|
99
106
|
// --- 4. Rename type references ---
|
|
100
|
-
root.find(j.TSTypeReference).forEach((path) => {
|
|
107
|
+
root.find(j.TSTypeReference).forEach((/** @type {any} */ path) => {
|
|
101
108
|
const typeName = path.node.typeName;
|
|
102
109
|
if (typeName.type === 'Identifier') {
|
|
103
110
|
const newName = IMPORT_RENAMES[typeName.name];
|
|
@@ -109,7 +116,7 @@ export default function transformer(file, api) {
|
|
|
109
116
|
});
|
|
110
117
|
|
|
111
118
|
// Also handle plain Identifier references (e.g. typeof, React.ComponentProps<typeof X>)
|
|
112
|
-
root.find(j.Identifier, {name: 'XDSChatComposerAttachments'}).forEach((path) => {
|
|
119
|
+
root.find(j.Identifier, {name: 'XDSChatComposerAttachments'}).forEach((/** @type {any} */ path) => {
|
|
113
120
|
const parent = path.parent.node;
|
|
114
121
|
if (
|
|
115
122
|
parent.type === 'ImportSpecifier' ||
|
|
@@ -122,7 +129,7 @@ export default function transformer(file, api) {
|
|
|
122
129
|
hasChanges = true;
|
|
123
130
|
});
|
|
124
131
|
|
|
125
|
-
root.find(j.Identifier, {name: 'XDSChatComposerAttachmentsProps'}).forEach((path) => {
|
|
132
|
+
root.find(j.Identifier, {name: 'XDSChatComposerAttachmentsProps'}).forEach((/** @type {any} */ path) => {
|
|
126
133
|
const parent = path.parent.node;
|
|
127
134
|
if (parent.type === 'ImportSpecifier') return;
|
|
128
135
|
path.node.name = 'XDSChatComposerDrawerProps';
|
|
@@ -130,7 +137,7 @@ export default function transformer(file, api) {
|
|
|
130
137
|
});
|
|
131
138
|
|
|
132
139
|
// --- 5. Rename CSS class strings ---
|
|
133
|
-
root.find(j.StringLiteral).forEach((path) => {
|
|
140
|
+
root.find(j.StringLiteral).forEach((/** @type {any} */ path) => {
|
|
134
141
|
for (const [oldClass, newClass] of Object.entries(CSS_CLASS_RENAMES)) {
|
|
135
142
|
if (path.node.value.includes(oldClass)) {
|
|
136
143
|
path.node.value = path.node.value.replace(
|
|
@@ -143,7 +150,7 @@ export default function transformer(file, api) {
|
|
|
143
150
|
});
|
|
144
151
|
|
|
145
152
|
// Also check template literals
|
|
146
|
-
root.find(j.TemplateLiteral).forEach((path) => {
|
|
153
|
+
root.find(j.TemplateLiteral).forEach((/** @type {any} */ path) => {
|
|
147
154
|
for (const quasi of path.node.quasis) {
|
|
148
155
|
for (const [oldClass, newClass] of Object.entries(CSS_CLASS_RENAMES)) {
|
|
149
156
|
if (quasi.value.raw.includes(oldClass)) {
|
|
@@ -24,17 +24,23 @@ export const meta = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
/** Map from old density values to new size values (null = remove prop). */
|
|
27
|
+
/** @type {Record<string, string | null>} */
|
|
27
28
|
const DENSITY_TO_SIZE = {
|
|
28
29
|
compact: 'sm',
|
|
29
30
|
default: null, // md is the default, no prop needed
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
35
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
36
|
+
* @returns {string | null | undefined}
|
|
37
|
+
*/
|
|
32
38
|
export default function transformer(file, api) {
|
|
33
39
|
const j = api.jscodeshift;
|
|
34
40
|
const root = j(file.source);
|
|
35
41
|
let hasChanges = false;
|
|
36
42
|
|
|
37
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
43
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
38
44
|
const name = path.node.name;
|
|
39
45
|
const componentName =
|
|
40
46
|
name.type === 'JSXIdentifier' ? name.name : null;
|
|
@@ -42,7 +48,7 @@ export default function transformer(file, api) {
|
|
|
42
48
|
|
|
43
49
|
const attrs = path.node.attributes;
|
|
44
50
|
const densityIdx = attrs.findIndex(
|
|
45
|
-
(a) => a.type === 'JSXAttribute' && a.name?.name === 'density',
|
|
51
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'density',
|
|
46
52
|
);
|
|
47
53
|
if (densityIdx === -1) return;
|
|
48
54
|
|
|
@@ -106,7 +112,7 @@ export default function transformer(file, api) {
|
|
|
106
112
|
if (importsToolbar) {
|
|
107
113
|
// jscodeshift uses Property (default parser) or ObjectProperty (babel/tsx parser)
|
|
108
114
|
const PropertyType = j.ObjectProperty ?? j.Property;
|
|
109
|
-
root.find(PropertyType, {key: {name: 'density'}}).forEach((path) => {
|
|
115
|
+
root.find(PropertyType, {key: {name: 'density'}}).forEach((/** @type {any} */ path) => {
|
|
110
116
|
const value = path.node.value;
|
|
111
117
|
|
|
112
118
|
// args: { density: 'compact' } → args: { size: 'sm' }
|
|
@@ -140,7 +146,7 @@ export default function transformer(file, api) {
|
|
|
140
146
|
path.node.key = j.identifier('size');
|
|
141
147
|
// Update options array if present
|
|
142
148
|
const optionsProp = value.properties.find(
|
|
143
|
-
(p) => p.key?.name === 'options',
|
|
149
|
+
(/** @type {any} */ p) => p.key?.name === 'options',
|
|
144
150
|
);
|
|
145
151
|
if (optionsProp && optionsProp.value.type === 'ArrayExpression') {
|
|
146
152
|
optionsProp.value = j.arrayExpression([
|
|
@@ -30,6 +30,7 @@ export const meta = {
|
|
|
30
30
|
* Map of old prop names → new prop names.
|
|
31
31
|
* Ordered longest-first to avoid partial matches during iteration.
|
|
32
32
|
*/
|
|
33
|
+
/** @type {Record<string, string>} */
|
|
33
34
|
const PROP_RENAMES = {
|
|
34
35
|
onPressedChangeAction: 'pressedChangeAction',
|
|
35
36
|
onScrollToTopAction: 'scrollToTopAction',
|
|
@@ -37,13 +38,18 @@ const PROP_RENAMES = {
|
|
|
37
38
|
onClickAction: 'clickAction',
|
|
38
39
|
};
|
|
39
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
43
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
44
|
+
* @returns {string | null | undefined}
|
|
45
|
+
*/
|
|
40
46
|
export default function transformer(file, api) {
|
|
41
47
|
const j = api.jscodeshift;
|
|
42
48
|
const root = j(file.source);
|
|
43
49
|
let hasChanges = false;
|
|
44
50
|
|
|
45
51
|
// --- 1. Rename JSX attributes ---
|
|
46
|
-
root.find(j.JSXAttribute).forEach((path) => {
|
|
52
|
+
root.find(j.JSXAttribute).forEach((/** @type {any} */ path) => {
|
|
47
53
|
const name = path.node.name;
|
|
48
54
|
if (name.type !== 'JSXIdentifier') return;
|
|
49
55
|
|
|
@@ -59,7 +65,7 @@ export default function transformer(file, api) {
|
|
|
59
65
|
// Must run before step 3 so the ObjectPattern keys are renamed first and tracked.
|
|
60
66
|
const renamedBindings = new Map(); // oldLocalName → newLocalName
|
|
61
67
|
|
|
62
|
-
root.find(j.ObjectPattern).forEach((path) => {
|
|
68
|
+
root.find(j.ObjectPattern).forEach((/** @type {any} */ path) => {
|
|
63
69
|
for (const prop of path.node.properties) {
|
|
64
70
|
if (prop.type !== 'ObjectProperty') continue;
|
|
65
71
|
const key = prop.key;
|
|
@@ -97,7 +103,7 @@ export default function transformer(file, api) {
|
|
|
97
103
|
// --- 3. Rename object property keys (e.g. { onChangeAction: fn }) ---
|
|
98
104
|
// Covers cases like useXDSImperativeAlertDialog({ onAction: ... })
|
|
99
105
|
// Skips ObjectProperty inside ObjectPattern (already handled in step 2).
|
|
100
|
-
root.find(j.ObjectProperty).forEach((path) => {
|
|
106
|
+
root.find(j.ObjectProperty).forEach((/** @type {any} */ path) => {
|
|
101
107
|
// Skip if inside a destructuring pattern
|
|
102
108
|
if (path.parent.node.type === 'ObjectPattern') return;
|
|
103
109
|
|
|
@@ -121,7 +127,7 @@ export default function transformer(file, api) {
|
|
|
121
127
|
|
|
122
128
|
// --- 4. Rename interface/type property signatures ---
|
|
123
129
|
// Covers: interface Props { onChangeAction?: ... } → { changeAction?: ... }
|
|
124
|
-
root.find(j.TSPropertySignature).forEach((path) => {
|
|
130
|
+
root.find(j.TSPropertySignature).forEach((/** @type {any} */ path) => {
|
|
125
131
|
const key = path.node.key;
|
|
126
132
|
if (key.type === 'Identifier') {
|
|
127
133
|
const newName = PROP_RENAMES[key.name];
|
|
@@ -136,7 +142,7 @@ export default function transformer(file, api) {
|
|
|
136
142
|
// When { onChangeAction } was renamed to { changeAction }, all references
|
|
137
143
|
// to the local variable `onChangeAction` must become `changeAction`.
|
|
138
144
|
if (renamedBindings.size > 0) {
|
|
139
|
-
root.find(j.Identifier).forEach((path) => {
|
|
145
|
+
root.find(j.Identifier).forEach((/** @type {any} */ path) => {
|
|
140
146
|
const newName = renamedBindings.get(path.node.name);
|
|
141
147
|
if (!newName) return;
|
|
142
148
|
|
|
@@ -26,6 +26,11 @@ export const meta = {
|
|
|
26
26
|
/** Components affected by this rename. */
|
|
27
27
|
const TARGET_COMPONENTS = new Set(['XDSSection', 'XDSToolbar']);
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
31
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
32
|
+
* @returns {string | null | undefined}
|
|
33
|
+
*/
|
|
29
34
|
export default function transformer(file, api) {
|
|
30
35
|
const j = api.jscodeshift;
|
|
31
36
|
const root = j(file.source);
|
|
@@ -33,12 +38,12 @@ export default function transformer(file, api) {
|
|
|
33
38
|
|
|
34
39
|
// 1. Rename JSX attribute value: variant="wash" → variant="muted"
|
|
35
40
|
// Only on XDSSection and XDSToolbar.
|
|
36
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
41
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
37
42
|
const name = path.node.name;
|
|
38
43
|
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
39
44
|
if (!componentName || !TARGET_COMPONENTS.has(componentName)) return;
|
|
40
45
|
|
|
41
|
-
path.node.attributes.forEach((attr) => {
|
|
46
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
42
47
|
if (attr.type !== 'JSXAttribute') return;
|
|
43
48
|
if (attr.name.name !== 'variant') return;
|
|
44
49
|
|
|
@@ -79,7 +84,7 @@ export default function transformer(file, api) {
|
|
|
79
84
|
|
|
80
85
|
if (importsTarget) {
|
|
81
86
|
const PropertyType = j.ObjectProperty ?? j.Property;
|
|
82
|
-
root.find(PropertyType, {key: {name: 'variant'}}).forEach((path) => {
|
|
87
|
+
root.find(PropertyType, {key: {name: 'variant'}}).forEach((/** @type {any} */ path) => {
|
|
83
88
|
const value = path.node.value;
|
|
84
89
|
|
|
85
90
|
// variant: 'wash' → variant: 'muted'
|
|
@@ -95,10 +100,10 @@ export default function transformer(file, api) {
|
|
|
95
100
|
// variant: { options: ['...', 'wash', '...'] } → replace 'wash' with 'muted'
|
|
96
101
|
if (value.type === 'ObjectExpression') {
|
|
97
102
|
const optionsProp = value.properties.find(
|
|
98
|
-
(p) => p.key && p.key.name === 'options',
|
|
103
|
+
(/** @type {any} */ p) => p.key && p.key.name === 'options',
|
|
99
104
|
);
|
|
100
105
|
if (optionsProp && optionsProp.value.type === 'ArrayExpression') {
|
|
101
|
-
optionsProp.value.elements.forEach((el) => {
|
|
106
|
+
optionsProp.value.elements.forEach((/** @type {any} */ el) => {
|
|
102
107
|
if (
|
|
103
108
|
el &&
|
|
104
109
|
(el.type === 'StringLiteral' || el.type === 'Literal') &&
|
|
@@ -117,7 +122,7 @@ export default function transformer(file, api) {
|
|
|
117
122
|
// 3. JSX text children: replace "wash" text content adjacent to target components.
|
|
118
123
|
// Covers labels like <h4>wash</h4> that describe the variant in Storybook stories.
|
|
119
124
|
if (importsTarget) {
|
|
120
|
-
root.find(j.JSXText).forEach((path) => {
|
|
125
|
+
root.find(j.JSXText).forEach((/** @type {any} */ path) => {
|
|
121
126
|
if (path.node.value.trim() === 'wash') {
|
|
122
127
|
path.node.value = path.node.value.replace('wash', 'muted');
|
|
123
128
|
if (path.node.raw) path.node.raw = path.node.raw.replace('wash', 'muted');
|
|
@@ -77,7 +77,7 @@ for (const props of COMPONENT_PROPS.values()) {
|
|
|
77
77
|
* Check if a key matches a target prop — exact or case-insensitive suffix.
|
|
78
78
|
* e.g. "dotVariant" matches because it ends with "variant".
|
|
79
79
|
*/
|
|
80
|
-
function matchesPropName(keyName) {
|
|
80
|
+
function matchesPropName(/** @type {any} */ keyName) {
|
|
81
81
|
if (TARGET_PROP_NAMES.has(keyName)) return true;
|
|
82
82
|
const lower = keyName.toLowerCase();
|
|
83
83
|
for (const prop of TARGET_PROP_NAMES) {
|
|
@@ -86,6 +86,11 @@ function matchesPropName(keyName) {
|
|
|
86
86
|
return false;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
91
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
92
|
+
* @returns {string | null | undefined}
|
|
93
|
+
*/
|
|
89
94
|
export default function transformer(file, api) {
|
|
90
95
|
const j = api.jscodeshift;
|
|
91
96
|
const root = j(file.source);
|
|
@@ -96,7 +101,7 @@ export default function transformer(file, api) {
|
|
|
96
101
|
* Unwraps TSAsExpression (e.g. 'positive' as const) to reach the literal.
|
|
97
102
|
* @returns {boolean} whether a rename occurred
|
|
98
103
|
*/
|
|
99
|
-
function renameValue(node, {precise = false} = {}) {
|
|
104
|
+
function renameValue(/** @type {any} */ node, {precise = false} = {}) {
|
|
100
105
|
if (!node) return false;
|
|
101
106
|
|
|
102
107
|
// Unwrap TSAsExpression (e.g. 'positive' as const → StringLiteral)
|
|
@@ -123,11 +128,11 @@ export default function transformer(file, api) {
|
|
|
123
128
|
/**
|
|
124
129
|
* Rename elements in an array (handles TSAsExpression wrapping).
|
|
125
130
|
*/
|
|
126
|
-
function renameArrayElements(node, {precise = false} = {}) {
|
|
131
|
+
function renameArrayElements(/** @type {any} */ node, {precise = false} = {}) {
|
|
127
132
|
let arrayNode = node;
|
|
128
133
|
if (arrayNode.type === 'TSAsExpression') arrayNode = arrayNode.expression;
|
|
129
134
|
if (arrayNode.type !== 'ArrayExpression') return;
|
|
130
|
-
arrayNode.elements.forEach((el) => {
|
|
135
|
+
arrayNode.elements.forEach((/** @type {any} */ el) => {
|
|
131
136
|
if (renameValue(el, {precise})) hasChanges = true;
|
|
132
137
|
});
|
|
133
138
|
}
|
|
@@ -139,7 +144,7 @@ export default function transformer(file, api) {
|
|
|
139
144
|
);
|
|
140
145
|
|
|
141
146
|
// 1. JSX attributes on target components
|
|
142
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
147
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
143
148
|
const name = path.node.name;
|
|
144
149
|
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
145
150
|
if (!componentName) return;
|
|
@@ -148,14 +153,14 @@ export default function transformer(file, api) {
|
|
|
148
153
|
// For non-target components, only check suffixed props if file imports targets
|
|
149
154
|
if (!isDirectTarget && !importsTarget) return;
|
|
150
155
|
|
|
151
|
-
path.node.attributes.forEach((attr) => {
|
|
156
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
152
157
|
if (attr.type !== 'JSXAttribute') return;
|
|
153
158
|
const attrName = attr.name.name;
|
|
154
159
|
|
|
155
160
|
if (isDirectTarget) {
|
|
156
161
|
// Direct targets: only their specific props
|
|
157
162
|
const targetProps = COMPONENT_PROPS.get(componentName);
|
|
158
|
-
if (!targetProps.has(attrName)) return;
|
|
163
|
+
if (!targetProps || !targetProps.has(attrName)) return;
|
|
159
164
|
} else {
|
|
160
165
|
// Non-target components: suffixed prop names only
|
|
161
166
|
// (e.g. dotVariant on ChangelogSection wrapping XDSStatusDot)
|
|
@@ -201,7 +206,7 @@ export default function transformer(file, api) {
|
|
|
201
206
|
// Handles args objects, config objects, Storybook argTypes, etc.
|
|
202
207
|
if (importsTarget) {
|
|
203
208
|
const PropertyType = j.ObjectProperty ?? j.Property;
|
|
204
|
-
root.find(PropertyType).forEach((path) => {
|
|
209
|
+
root.find(PropertyType).forEach((/** @type {any} */ path) => {
|
|
205
210
|
const key = path.node.key;
|
|
206
211
|
const keyName =
|
|
207
212
|
key.type === 'Identifier'
|
|
@@ -223,7 +228,7 @@ export default function transformer(file, api) {
|
|
|
223
228
|
// variant: { options: ['positive', 'negative', ...] }
|
|
224
229
|
if (value.type === 'ObjectExpression') {
|
|
225
230
|
const optionsProp = value.properties.find(
|
|
226
|
-
(p) => p.key && (p.key.name === 'options' || p.key.value === 'options'),
|
|
231
|
+
(/** @type {any} */ p) => p.key && (p.key.name === 'options' || p.key.value === 'options'),
|
|
227
232
|
);
|
|
228
233
|
if (optionsProp) {
|
|
229
234
|
renameArrayElements(optionsProp.value);
|
|
@@ -237,7 +242,7 @@ export default function transformer(file, api) {
|
|
|
237
242
|
|
|
238
243
|
// 3. TypeScript type references: 'positive' | 'negative' in union types
|
|
239
244
|
if (importsTarget) {
|
|
240
|
-
root.find(j.TSLiteralType).forEach((path) => {
|
|
245
|
+
root.find(j.TSLiteralType).forEach((/** @type {any} */ path) => {
|
|
241
246
|
const lit = path.node.literal;
|
|
242
247
|
if (renameValue(lit)) hasChanges = true;
|
|
243
248
|
});
|
package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs
RENAMED
|
@@ -30,24 +30,24 @@ export const meta = {
|
|
|
30
30
|
'Moves trailing content on `XDSDropdownMenuItem`, `XDSContextMenuItem`, and `XDSSelectorOption` from deprecated `children` usage to the `endContent` prop.',
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
function isWhitespaceText(node) {
|
|
33
|
+
function isWhitespaceText(/** @type {any} */ node) {
|
|
34
34
|
return node.type === 'JSXText' && node.value.trim() === '';
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function isEmptyExpression(node) {
|
|
37
|
+
function isEmptyExpression(/** @type {any} */ node) {
|
|
38
38
|
return (
|
|
39
39
|
node.type === 'JSXExpressionContainer' &&
|
|
40
40
|
node.expression.type === 'JSXEmptyExpression'
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function getMeaningfulChildren(children) {
|
|
44
|
+
function getMeaningfulChildren(/** @type {any} */ children) {
|
|
45
45
|
return children.filter(
|
|
46
|
-
child => !isWhitespaceText(child) && !isEmptyExpression(child),
|
|
46
|
+
(/** @type {any} */ child) => !isWhitespaceText(child) && !isEmptyExpression(child),
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function createEndContentValue(j, children) {
|
|
50
|
+
function createEndContentValue(/** @type {any} */ j, /** @type {any} */ children) {
|
|
51
51
|
if (children.length === 0) {
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
@@ -74,18 +74,23 @@ function createEndContentValue(j, children) {
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
function getJSXAttribute(openingElement, name) {
|
|
77
|
+
function getJSXAttribute(/** @type {any} */ openingElement, /** @type {any} */ name) {
|
|
78
78
|
return openingElement.attributes.find(
|
|
79
|
-
attr => attr.type === 'JSXAttribute' && attr.name.name === name,
|
|
79
|
+
(/** @type {any} */ attr) => attr.type === 'JSXAttribute' && attr.name.name === name,
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
85
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
86
|
+
* @returns {string | null | undefined}
|
|
87
|
+
*/
|
|
83
88
|
export default function transformer(file, api) {
|
|
84
89
|
const j = api.jscodeshift;
|
|
85
90
|
const root = j(file.source);
|
|
86
91
|
let hasChanges = false;
|
|
87
92
|
|
|
88
|
-
root.find(j.JSXElement).forEach(path => {
|
|
93
|
+
root.find(j.JSXElement).forEach((/** @type {any} */ path) => {
|
|
89
94
|
const elementName = path.node.openingElement.name;
|
|
90
95
|
if (
|
|
91
96
|
elementName.type !== 'JSXIdentifier' ||
|
package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs
RENAMED
|
@@ -27,7 +27,7 @@ export const meta = {
|
|
|
27
27
|
|
|
28
28
|
const COMPONENTS = new Set(['XDSSelector', 'XDSMultiSelector']);
|
|
29
29
|
|
|
30
|
-
function isXDSCoreSource(source) {
|
|
30
|
+
function isXDSCoreSource(/** @type {any} */ source) {
|
|
31
31
|
return (
|
|
32
32
|
source === '@xds/core' ||
|
|
33
33
|
source === '@xds/core/Selector' ||
|
|
@@ -35,7 +35,7 @@ function isXDSCoreSource(source) {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function sourceCanImport(source, importedName) {
|
|
38
|
+
function sourceCanImport(/** @type {any} */ source, /** @type {any} */ importedName) {
|
|
39
39
|
if (source === '@xds/core') {
|
|
40
40
|
return COMPONENTS.has(importedName);
|
|
41
41
|
}
|
|
@@ -48,11 +48,11 @@ function sourceCanImport(source, importedName) {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
function collectSelectorNames(root, j) {
|
|
51
|
+
function collectSelectorNames(/** @type {any} */ root, /** @type {any} */ j) {
|
|
52
52
|
const localNames = new Map();
|
|
53
53
|
const namespaceNames = new Set();
|
|
54
54
|
|
|
55
|
-
root.find(j.ImportDeclaration).forEach(path => {
|
|
55
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
56
56
|
const source = path.node.source.value;
|
|
57
57
|
if (typeof source !== 'string' || !isXDSCoreSource(source)) {
|
|
58
58
|
return;
|
|
@@ -80,7 +80,7 @@ function collectSelectorNames(root, j) {
|
|
|
80
80
|
return {localNames, namespaceNames};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
function getComponentName(name, localNames, namespaceNames) {
|
|
83
|
+
function getComponentName(/** @type {any} */ name, /** @type {any} */ localNames, /** @type {any} */ namespaceNames) {
|
|
84
84
|
if (name.type === 'JSXIdentifier') {
|
|
85
85
|
return localNames.get(name.name) ?? null;
|
|
86
86
|
}
|
|
@@ -98,24 +98,24 @@ function getComponentName(name, localNames, namespaceNames) {
|
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
function isWhitespaceText(node) {
|
|
101
|
+
function isWhitespaceText(/** @type {any} */ node) {
|
|
102
102
|
return node.type === 'JSXText' && node.value.trim() === '';
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function isEmptyExpression(node) {
|
|
105
|
+
function isEmptyExpression(/** @type {any} */ node) {
|
|
106
106
|
return (
|
|
107
107
|
node.type === 'JSXExpressionContainer' &&
|
|
108
108
|
node.expression.type === 'JSXEmptyExpression'
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
function getMeaningfulChildren(children) {
|
|
112
|
+
function getMeaningfulChildren(/** @type {any} */ children) {
|
|
113
113
|
return children.filter(
|
|
114
|
-
child => !isWhitespaceText(child) && !isEmptyExpression(child),
|
|
114
|
+
(/** @type {any} */ child) => !isWhitespaceText(child) && !isEmptyExpression(child),
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
function isRenderableExpression(expression) {
|
|
118
|
+
function isRenderableExpression(/** @type {any} */ expression) {
|
|
119
119
|
return (
|
|
120
120
|
expression.type === 'ArrowFunctionExpression' ||
|
|
121
121
|
expression.type === 'FunctionExpression' ||
|
|
@@ -124,12 +124,17 @@ function isRenderableExpression(expression) {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
function getJSXAttribute(openingElement, name) {
|
|
127
|
+
function getJSXAttribute(/** @type {any} */ openingElement, /** @type {any} */ name) {
|
|
128
128
|
return openingElement.attributes.find(
|
|
129
|
-
attr => attr.type === 'JSXAttribute' && attr.name.name === name,
|
|
129
|
+
(/** @type {any} */ attr) => attr.type === 'JSXAttribute' && attr.name.name === name,
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
135
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
136
|
+
* @returns {string | null | undefined}
|
|
137
|
+
*/
|
|
133
138
|
export default function transformer(file, api) {
|
|
134
139
|
const j = api.jscodeshift;
|
|
135
140
|
const root = j(file.source);
|
|
@@ -140,7 +145,7 @@ export default function transformer(file, api) {
|
|
|
140
145
|
return undefined;
|
|
141
146
|
}
|
|
142
147
|
|
|
143
|
-
root.find(j.JSXElement).forEach(path => {
|
|
148
|
+
root.find(j.JSXElement).forEach((/** @type {any} */ path) => {
|
|
144
149
|
const componentName = getComponentName(
|
|
145
150
|
path.node.openingElement.name,
|
|
146
151
|
localNames,
|
package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs
RENAMED
|
@@ -104,11 +104,11 @@ const SECTION_VARIANTS = new Set(['section', 'transparent', 'muted']);
|
|
|
104
104
|
const DIVIDER_VARIANTS = new Set(['subtle', 'strong']);
|
|
105
105
|
const ORIENTATIONS = new Set(['horizontal', 'vertical']);
|
|
106
106
|
|
|
107
|
-
function attr(name, value) {
|
|
107
|
+
function attr(/** @type {any} */ name, /** @type {any} */ value) {
|
|
108
108
|
return `[data-${name}="${value}"]`;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function valueToAttr(component, value) {
|
|
111
|
+
function valueToAttr(/** @type {any} */ component, /** @type {any} */ value) {
|
|
112
112
|
// Numeric-prefixed classes emitted as prop-value (level-2, gap-4, cols-3).
|
|
113
113
|
let match = value.match(/^level-(\d+)$/);
|
|
114
114
|
if (match) return attr('level', match[1]);
|
|
@@ -211,8 +211,8 @@ function valueToAttr(component, value) {
|
|
|
211
211
|
|
|
212
212
|
const SELECTOR_RE = /\.((?:xds-[a-z0-9-]+))(\.(?:-?[_a-zA-Z][_a-zA-Z0-9-]*))+/g;
|
|
213
213
|
|
|
214
|
-
export function migrateThemeSelectors(source) {
|
|
215
|
-
return source.replace(SELECTOR_RE, (full, component) => {
|
|
214
|
+
export function migrateThemeSelectors(/** @type {any} */ source) {
|
|
215
|
+
return source.replace(SELECTOR_RE, (/** @type {any} */ full, /** @type {any} */ component) => {
|
|
216
216
|
const classChain = full.slice(component.length + 1);
|
|
217
217
|
const values = classChain.split('.').filter(Boolean);
|
|
218
218
|
|
|
@@ -229,6 +229,10 @@ export function migrateThemeSelectors(source) {
|
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
/**
|
|
233
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
234
|
+
* @returns {string | null | undefined}
|
|
235
|
+
*/
|
|
232
236
|
export default function transformer(file) {
|
|
233
237
|
const result = migrateThemeSelectors(file.source);
|
|
234
238
|
return result === file.source ? undefined : result;
|
|
@@ -45,13 +45,18 @@ const IDENTIFIER_RENAMES = new Map([
|
|
|
45
45
|
['XDSDateRangePickerStatusType', 'XDSDateRangeInputStatusType'],
|
|
46
46
|
]);
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
50
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
51
|
+
* @returns {string | null | undefined}
|
|
52
|
+
*/
|
|
48
53
|
export default function transformer(file, api) {
|
|
49
54
|
const j = api.jscodeshift;
|
|
50
55
|
const root = j(file.source);
|
|
51
56
|
let hasChanges = false;
|
|
52
57
|
|
|
53
58
|
// 1. Rename import/export source paths
|
|
54
|
-
root.find(j.ImportDeclaration).forEach((path) => {
|
|
59
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
55
60
|
const source = path.node.source.value;
|
|
56
61
|
const renamed = IMPORT_PATH_RENAMES.get(source);
|
|
57
62
|
if (renamed) {
|
|
@@ -60,7 +65,7 @@ export default function transformer(file, api) {
|
|
|
60
65
|
}
|
|
61
66
|
});
|
|
62
67
|
|
|
63
|
-
root.find(j.ExportNamedDeclaration).forEach((path) => {
|
|
68
|
+
root.find(j.ExportNamedDeclaration).forEach((/** @type {any} */ path) => {
|
|
64
69
|
if (path.node.source) {
|
|
65
70
|
const source = path.node.source.value;
|
|
66
71
|
const renamed = IMPORT_PATH_RENAMES.get(source);
|
|
@@ -72,7 +77,7 @@ export default function transformer(file, api) {
|
|
|
72
77
|
});
|
|
73
78
|
|
|
74
79
|
// 2. Rename all identifiers (covers imports, type refs, variable names)
|
|
75
|
-
root.find(j.Identifier).forEach((path) => {
|
|
80
|
+
root.find(j.Identifier).forEach((/** @type {any} */ path) => {
|
|
76
81
|
const renamed = IDENTIFIER_RENAMES.get(path.node.name);
|
|
77
82
|
if (renamed) {
|
|
78
83
|
path.node.name = renamed;
|
|
@@ -81,7 +86,7 @@ export default function transformer(file, api) {
|
|
|
81
86
|
});
|
|
82
87
|
|
|
83
88
|
// 3. Rename JSX element names
|
|
84
|
-
root.find(j.JSXIdentifier).forEach((path) => {
|
|
89
|
+
root.find(j.JSXIdentifier).forEach((/** @type {any} */ path) => {
|
|
85
90
|
const renamed = IDENTIFIER_RENAMES.get(path.node.name);
|
|
86
91
|
if (renamed) {
|
|
87
92
|
path.node.name = renamed;
|
|
@@ -90,7 +95,7 @@ export default function transformer(file, api) {
|
|
|
90
95
|
});
|
|
91
96
|
|
|
92
97
|
// 4. Rename string literals (covers displayName assignments)
|
|
93
|
-
root.find(j.StringLiteral).forEach((path) => {
|
|
98
|
+
root.find(j.StringLiteral).forEach((/** @type {any} */ path) => {
|
|
94
99
|
const renamed = IDENTIFIER_RENAMES.get(path.node.value);
|
|
95
100
|
if (renamed) {
|
|
96
101
|
path.node.value = renamed;
|
|
@@ -99,7 +104,7 @@ export default function transformer(file, api) {
|
|
|
99
104
|
});
|
|
100
105
|
|
|
101
106
|
// Also handle Literal nodes (parser-dependent)
|
|
102
|
-
root.find(j.Literal).forEach((path) => {
|
|
107
|
+
root.find(j.Literal).forEach((/** @type {any} */ path) => {
|
|
103
108
|
if (typeof path.node.value === 'string') {
|
|
104
109
|
const renamed = IDENTIFIER_RENAMES.get(path.node.value);
|
|
105
110
|
if (renamed) {
|
|
@@ -29,12 +29,17 @@ const IMPERATIVE_REF_COMPONENTS = new Set([
|
|
|
29
29
|
'XDSChartStreamGL',
|
|
30
30
|
]);
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
34
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
35
|
+
* @returns {string | null | undefined}
|
|
36
|
+
*/
|
|
32
37
|
export default function transformer(file, api) {
|
|
33
38
|
const j = api.jscodeshift;
|
|
34
39
|
const root = j(file.source);
|
|
35
40
|
let hasChanges = false;
|
|
36
41
|
|
|
37
|
-
root.find(j.JSXOpeningElement).forEach(path => {
|
|
42
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
38
43
|
const name = path.node.name;
|
|
39
44
|
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
40
45
|
if (componentName == null) return;
|
|
@@ -26,13 +26,18 @@ export const meta = {
|
|
|
26
26
|
|
|
27
27
|
const TARGET_COMPONENTS = new Set(['XDSChatComposer', 'XDSChatSendButton']);
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
31
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
32
|
+
* @returns {string | null | undefined}
|
|
33
|
+
*/
|
|
29
34
|
export default function transformer(file, api) {
|
|
30
35
|
const j = api.jscodeshift;
|
|
31
36
|
const root = j(file.source);
|
|
32
37
|
let hasChanges = false;
|
|
33
38
|
|
|
34
39
|
// Rename JSX prop on target components only
|
|
35
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
40
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
36
41
|
const name = path.node.name;
|
|
37
42
|
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
38
43
|
if (!TARGET_COMPONENTS.has(componentName)) return;
|