@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
|
@@ -17,6 +17,11 @@ const TARGET_COMPONENTS = new Set([
|
|
|
17
17
|
'XDSStackItem',
|
|
18
18
|
]);
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
22
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
23
|
+
* @returns {string | null | undefined}
|
|
24
|
+
*/
|
|
20
25
|
export default function transformer(file, api) {
|
|
21
26
|
const j = api.jscodeshift;
|
|
22
27
|
const root = j(file.source);
|
|
@@ -24,12 +29,12 @@ export default function transformer(file, api) {
|
|
|
24
29
|
|
|
25
30
|
root
|
|
26
31
|
.find(j.JSXOpeningElement)
|
|
27
|
-
.filter((path) => {
|
|
32
|
+
.filter((/** @type {any} */ path) => {
|
|
28
33
|
const name = path.node.name;
|
|
29
34
|
return name.type === 'JSXIdentifier' && TARGET_COMPONENTS.has(name.name);
|
|
30
35
|
})
|
|
31
|
-
.forEach((path) => {
|
|
32
|
-
path.node.attributes.forEach((attr) => {
|
|
36
|
+
.forEach((/** @type {any} */ path) => {
|
|
37
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
33
38
|
if (attr.type === 'JSXAttribute' && attr.name.name === 'element') {
|
|
34
39
|
attr.name.name = 'as';
|
|
35
40
|
hasChanges = true;
|
|
@@ -15,6 +15,7 @@ export const meta = {
|
|
|
15
15
|
pr: '#945',
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
/** @type {Record<string, string>} */
|
|
18
19
|
const VARIANT_MAP = {
|
|
19
20
|
success: 'positive',
|
|
20
21
|
error: 'negative',
|
|
@@ -23,12 +24,12 @@ const VARIANT_MAP = {
|
|
|
23
24
|
neutral: 'neutral',
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
function isDotMode(path) {
|
|
27
|
+
function isDotMode(/** @type {any} */ path) {
|
|
27
28
|
const opening = path.node.openingElement;
|
|
28
29
|
|
|
29
30
|
// Dot mode is indicated by shape="dot" prop
|
|
30
31
|
const hasShapeDot = opening.attributes.some(
|
|
31
|
-
(attr) =>
|
|
32
|
+
(/** @type {any} */ attr) =>
|
|
32
33
|
attr.type === 'JSXAttribute' &&
|
|
33
34
|
attr.name.type === 'JSXIdentifier' &&
|
|
34
35
|
attr.name.name === 'shape' &&
|
|
@@ -40,7 +41,7 @@ function isDotMode(path) {
|
|
|
40
41
|
|
|
41
42
|
// If icon prop is present, leave alone
|
|
42
43
|
const hasIcon = opening.attributes.some(
|
|
43
|
-
(attr) =>
|
|
44
|
+
(/** @type {any} */ attr) =>
|
|
44
45
|
attr.type === 'JSXAttribute' &&
|
|
45
46
|
attr.name.type === 'JSXIdentifier' &&
|
|
46
47
|
attr.name.name === 'icon',
|
|
@@ -50,13 +51,18 @@ function isDotMode(path) {
|
|
|
50
51
|
return true;
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
56
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
57
|
+
* @returns {string | null | undefined}
|
|
58
|
+
*/
|
|
53
59
|
export default function transformer(file, api) {
|
|
54
60
|
const j = api.jscodeshift;
|
|
55
61
|
const root = j(file.source);
|
|
56
62
|
let hasChanges = false;
|
|
57
63
|
|
|
58
64
|
// Find all XDSBadge JSX elements
|
|
59
|
-
root.find(j.JSXElement).forEach((path) => {
|
|
65
|
+
root.find(j.JSXElement).forEach((/** @type {any} */ path) => {
|
|
60
66
|
const opening = path.node.openingElement;
|
|
61
67
|
if (
|
|
62
68
|
opening.name.type !== 'JSXIdentifier' ||
|
|
@@ -69,11 +75,12 @@ export default function transformer(file, api) {
|
|
|
69
75
|
|
|
70
76
|
// Map variant
|
|
71
77
|
const variantAttr = opening.attributes.find(
|
|
72
|
-
(attr) =>
|
|
78
|
+
(/** @type {any} */ attr) =>
|
|
73
79
|
attr.type === 'JSXAttribute' &&
|
|
74
80
|
attr.name.name === 'variant',
|
|
75
81
|
);
|
|
76
82
|
|
|
83
|
+
/** @type {string | null} */
|
|
77
84
|
let newVariantValue = 'neutral'; // default
|
|
78
85
|
if (variantAttr) {
|
|
79
86
|
if (
|
|
@@ -140,7 +147,7 @@ export default function transformer(file, api) {
|
|
|
140
147
|
if (!hasChanges) return undefined;
|
|
141
148
|
|
|
142
149
|
// Handle imports
|
|
143
|
-
const badgeImports = root.find(j.ImportDeclaration).filter((path) => {
|
|
150
|
+
const badgeImports = root.find(j.ImportDeclaration).filter((/** @type {any} */ path) => {
|
|
144
151
|
const source = path.node.source.value;
|
|
145
152
|
return (
|
|
146
153
|
typeof source === 'string' &&
|
|
@@ -165,7 +172,7 @@ export default function transformer(file, api) {
|
|
|
165
172
|
root
|
|
166
173
|
.find(j.ImportDefaultSpecifier)
|
|
167
174
|
.filter(
|
|
168
|
-
(path) => path.node.local.name === 'XDSStatusDot',
|
|
175
|
+
(/** @type {any} */ path) => path.node.local.name === 'XDSStatusDot',
|
|
169
176
|
)
|
|
170
177
|
.size() > 0;
|
|
171
178
|
|
|
@@ -176,7 +183,7 @@ export default function transformer(file, api) {
|
|
|
176
183
|
);
|
|
177
184
|
|
|
178
185
|
// Insert after the last existing xds import, or at the top
|
|
179
|
-
const xdsImports = root.find(j.ImportDeclaration).filter((path) => {
|
|
186
|
+
const xdsImports = root.find(j.ImportDeclaration).filter((/** @type {any} */ path) => {
|
|
180
187
|
const source = path.node.source.value;
|
|
181
188
|
return typeof source === 'string' && source.includes('@xds/core');
|
|
182
189
|
});
|
|
@@ -195,11 +202,11 @@ export default function transformer(file, api) {
|
|
|
195
202
|
|
|
196
203
|
// Remove XDSBadge import if no remaining usages
|
|
197
204
|
if (remainingBadgeUsages === 0) {
|
|
198
|
-
badgeImports.forEach((path) => {
|
|
205
|
+
badgeImports.forEach((/** @type {any} */ path) => {
|
|
199
206
|
const specifiers = path.node.specifiers;
|
|
200
207
|
if (!specifiers) return;
|
|
201
208
|
|
|
202
|
-
const filtered = specifiers.filter((s) => {
|
|
209
|
+
const filtered = specifiers.filter((/** @type {any} */ s) => {
|
|
203
210
|
if (
|
|
204
211
|
s.type === 'ImportSpecifier' &&
|
|
205
212
|
s.imported.type === 'Identifier' &&
|
|
@@ -23,6 +23,7 @@ export const meta = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Mapping from string token to numeric value.
|
|
25
25
|
*/
|
|
26
|
+
/** @type {Record<string, number>} */
|
|
26
27
|
const TOKEN_TO_NUMBER = {
|
|
27
28
|
space0: 0,
|
|
28
29
|
'space0.5': 0.5,
|
|
@@ -58,12 +59,17 @@ const XDS_LAYOUT_ELEMENTS = new Set([
|
|
|
58
59
|
'XDSStackItem',
|
|
59
60
|
]);
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
64
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
65
|
+
* @returns {string | null | undefined}
|
|
66
|
+
*/
|
|
61
67
|
export default function transformer(file, api) {
|
|
62
68
|
const j = api.jscodeshift;
|
|
63
69
|
const root = j(file.source);
|
|
64
70
|
let hasChanges = false;
|
|
65
71
|
|
|
66
|
-
root.find(j.JSXOpeningElement).forEach((elementPath) => {
|
|
72
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ elementPath) => {
|
|
67
73
|
const nameNode = elementPath.node.name;
|
|
68
74
|
// Only handle simple identifier element names like <XDSStack>. Skip member
|
|
69
75
|
// expressions (e.g. <Foo.Bar>) and namespaced names — they're never XDS.
|
|
@@ -29,6 +29,11 @@ const TARGET_COMPONENTS = [
|
|
|
29
29
|
'XDSLayoutPanel',
|
|
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);
|
|
@@ -39,10 +44,10 @@ export default function transformer(file, api) {
|
|
|
39
44
|
.find(j.JSXOpeningElement, {
|
|
40
45
|
name: {name: componentName},
|
|
41
46
|
})
|
|
42
|
-
.forEach((path) => {
|
|
47
|
+
.forEach((/** @type {any} */ path) => {
|
|
43
48
|
const attrs = path.node.attributes;
|
|
44
49
|
const isFullBleedIndex = attrs.findIndex(
|
|
45
|
-
(attr) =>
|
|
50
|
+
(/** @type {any} */ attr) =>
|
|
46
51
|
attr.type === 'JSXAttribute' && attr.name.name === 'isFullBleed',
|
|
47
52
|
);
|
|
48
53
|
|
|
@@ -57,7 +62,7 @@ export default function transformer(file, api) {
|
|
|
57
62
|
if (value === null) {
|
|
58
63
|
attrs.splice(isFullBleedIndex, 1);
|
|
59
64
|
const hasPadding = attrs.some(
|
|
60
|
-
(a) => a.type === 'JSXAttribute' && a.name.name === 'padding',
|
|
65
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'padding',
|
|
61
66
|
);
|
|
62
67
|
if (!hasPadding) {
|
|
63
68
|
attrs.push(
|
|
@@ -82,7 +87,7 @@ export default function transformer(file, api) {
|
|
|
82
87
|
// isFullBleed={true} → padding={0}
|
|
83
88
|
attrs.splice(isFullBleedIndex, 1);
|
|
84
89
|
const hasPadding = attrs.some(
|
|
85
|
-
(a) => a.type === 'JSXAttribute' && a.name.name === 'padding',
|
|
90
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'padding',
|
|
86
91
|
);
|
|
87
92
|
if (!hasPadding) {
|
|
88
93
|
attrs.push(
|
|
@@ -18,6 +18,11 @@ export const meta = {
|
|
|
18
18
|
pr: '#531',
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
23
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
24
|
+
* @returns {string | null | undefined}
|
|
25
|
+
*/
|
|
21
26
|
export default function transformer(file, api) {
|
|
22
27
|
const j = api.jscodeshift;
|
|
23
28
|
const root = j(file.source);
|
|
@@ -28,13 +33,13 @@ export default function transformer(file, api) {
|
|
|
28
33
|
.find(j.CallExpression, {
|
|
29
34
|
callee: {type: 'Identifier', name: 'useXDSIcon'},
|
|
30
35
|
})
|
|
31
|
-
.forEach((path) => {
|
|
36
|
+
.forEach((/** @type {any} */ path) => {
|
|
32
37
|
path.node.callee.name = 'getIcon';
|
|
33
38
|
hasChanges = true;
|
|
34
39
|
});
|
|
35
40
|
|
|
36
41
|
// 2. Update import specifiers: useXDSIcon → getIcon
|
|
37
|
-
root.find(j.ImportSpecifier).forEach((path) => {
|
|
42
|
+
root.find(j.ImportSpecifier).forEach((/** @type {any} */ path) => {
|
|
38
43
|
const imported = path.node.imported;
|
|
39
44
|
if (imported.type === 'Identifier' && imported.name === 'useXDSIcon') {
|
|
40
45
|
const oldLocal = path.node.local ? path.node.local.name : null;
|
|
@@ -48,11 +53,11 @@ export default function transformer(file, api) {
|
|
|
48
53
|
});
|
|
49
54
|
|
|
50
55
|
// 3. Remove IconRegistryContext from import specifiers
|
|
51
|
-
root.find(j.ImportDeclaration).forEach((path) => {
|
|
56
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
52
57
|
const specifiers = path.node.specifiers;
|
|
53
58
|
if (!specifiers) return;
|
|
54
59
|
|
|
55
|
-
const filtered = specifiers.filter((s) => {
|
|
60
|
+
const filtered = specifiers.filter((/** @type {any} */ s) => {
|
|
56
61
|
if (
|
|
57
62
|
s.type === 'ImportSpecifier' &&
|
|
58
63
|
s.imported.type === 'Identifier' &&
|
|
@@ -73,7 +78,7 @@ export default function transformer(file, api) {
|
|
|
73
78
|
});
|
|
74
79
|
|
|
75
80
|
// 4. Update import source: '../Icon/IconRegistry' or similar → '../Icon/globalIconRegistry'
|
|
76
|
-
root.find(j.ImportDeclaration).forEach((path) => {
|
|
81
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
77
82
|
const source = path.node.source.value;
|
|
78
83
|
if (typeof source === 'string' && source.includes('IconRegistry') && !source.includes('globalIconRegistry')) {
|
|
79
84
|
path.node.source.value = source.replace(
|
|
@@ -85,7 +90,7 @@ export default function transformer(file, api) {
|
|
|
85
90
|
});
|
|
86
91
|
|
|
87
92
|
// 5. Remove <IconRegistryContext.Provider> wrappers — replace with children
|
|
88
|
-
root.find(j.JSXElement).forEach((path) => {
|
|
93
|
+
root.find(j.JSXElement).forEach((/** @type {any} */ path) => {
|
|
89
94
|
const opening = path.node.openingElement;
|
|
90
95
|
if (
|
|
91
96
|
opening.name.type === 'JSXMemberExpression' &&
|
|
@@ -113,7 +118,7 @@ export default function transformer(file, api) {
|
|
|
113
118
|
.find(j.VariableDeclarator, {
|
|
114
119
|
init: {type: 'Identifier', name: 'IconRegistryContext'},
|
|
115
120
|
})
|
|
116
|
-
.forEach((path) => {
|
|
121
|
+
.forEach((/** @type {any} */ path) => {
|
|
117
122
|
j(path.parent).remove();
|
|
118
123
|
hasChanges = true;
|
|
119
124
|
});
|
package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs
RENAMED
|
@@ -11,6 +11,11 @@ export const meta = {
|
|
|
11
11
|
pr: '#437',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
16
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
17
|
+
* @returns {string | null | undefined}
|
|
18
|
+
*/
|
|
14
19
|
export default function transformer(file, api) {
|
|
15
20
|
const j = api.jscodeshift;
|
|
16
21
|
const root = j(file.source);
|
|
@@ -20,8 +25,8 @@ export default function transformer(file, api) {
|
|
|
20
25
|
.find(j.JSXOpeningElement, {
|
|
21
26
|
name: {name: 'XDSBanner'},
|
|
22
27
|
})
|
|
23
|
-
.forEach((path) => {
|
|
24
|
-
path.node.attributes.forEach((attr) => {
|
|
28
|
+
.forEach((/** @type {any} */ path) => {
|
|
29
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
25
30
|
if (attr.type === 'JSXAttribute' && attr.name.name === 'endButton') {
|
|
26
31
|
attr.name.name = 'endContent';
|
|
27
32
|
hasChanges = true;
|
|
@@ -25,23 +25,29 @@ const FORM_COMPONENTS = new Set([
|
|
|
25
25
|
'XDSTimeInput',
|
|
26
26
|
]);
|
|
27
27
|
|
|
28
|
+
/** @type {Record<string, string>} */
|
|
28
29
|
const PROP_RENAMES = {
|
|
29
30
|
tooltip: 'labelTooltip',
|
|
30
31
|
startIcon: 'labelIcon',
|
|
31
32
|
};
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
36
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
37
|
+
* @returns {string | null | undefined}
|
|
38
|
+
*/
|
|
33
39
|
export default function transformer(file, api) {
|
|
34
40
|
const j = api.jscodeshift;
|
|
35
41
|
const root = j(file.source);
|
|
36
42
|
let hasChanges = false;
|
|
37
43
|
|
|
38
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
44
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
39
45
|
const name = path.node.name;
|
|
40
46
|
if (name.type !== 'JSXIdentifier' || !FORM_COMPONENTS.has(name.name)) {
|
|
41
47
|
return;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
|
-
path.node.attributes.forEach((attr) => {
|
|
50
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
45
51
|
if (attr.type === 'JSXAttribute' && attr.name.name in PROP_RENAMES) {
|
|
46
52
|
attr.name.name = PROP_RENAMES[attr.name.name];
|
|
47
53
|
hasChanges = true;
|
|
@@ -14,6 +14,11 @@ export const meta = {
|
|
|
14
14
|
|
|
15
15
|
const TARGET_COMPONENTS = ['XDSDialog', 'XDSPopover'];
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
19
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
20
|
+
* @returns {string | null | undefined}
|
|
21
|
+
*/
|
|
17
22
|
export default function transformer(file, api) {
|
|
18
23
|
const j = api.jscodeshift;
|
|
19
24
|
const root = j(file.source);
|
|
@@ -24,8 +29,8 @@ export default function transformer(file, api) {
|
|
|
24
29
|
.find(j.JSXOpeningElement, {
|
|
25
30
|
name: {name: componentName},
|
|
26
31
|
})
|
|
27
|
-
.forEach((path) => {
|
|
28
|
-
path.node.attributes.forEach((attr) => {
|
|
32
|
+
.forEach((/** @type {any} */ path) => {
|
|
33
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
29
34
|
if (attr.type === 'JSXAttribute' && attr.name.name === 'isShown') {
|
|
30
35
|
attr.name.name = 'isOpen';
|
|
31
36
|
hasChanges = true;
|
|
@@ -11,6 +11,11 @@ export const meta = {
|
|
|
11
11
|
pr: '#479',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
16
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
17
|
+
* @returns {string | null | undefined}
|
|
18
|
+
*/
|
|
14
19
|
export default function transformer(file, api) {
|
|
15
20
|
const j = api.jscodeshift;
|
|
16
21
|
const root = j(file.source);
|
|
@@ -21,8 +26,8 @@ export default function transformer(file, api) {
|
|
|
21
26
|
.find(j.JSXOpeningElement, {
|
|
22
27
|
name: {name: 'XDSSelector'},
|
|
23
28
|
})
|
|
24
|
-
.forEach((path) => {
|
|
25
|
-
path.node.attributes.forEach((attr) => {
|
|
29
|
+
.forEach((/** @type {any} */ path) => {
|
|
30
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
26
31
|
if (attr.type === 'JSXAttribute' && attr.name.name === 'items') {
|
|
27
32
|
attr.name.name = 'options';
|
|
28
33
|
hasChanges = true;
|
|
@@ -26,6 +26,7 @@ const TARGET_COMPONENTS = new Set([
|
|
|
26
26
|
'XDSSideNavHeading',
|
|
27
27
|
]);
|
|
28
28
|
|
|
29
|
+
/** @type {Record<string, string>} */
|
|
29
30
|
const PROP_RENAMES = {
|
|
30
31
|
title: 'heading',
|
|
31
32
|
titleHref: 'headingHref',
|
|
@@ -35,24 +36,30 @@ const PROP_RENAMES = {
|
|
|
35
36
|
subtitleHref: 'subheadingHref',
|
|
36
37
|
};
|
|
37
38
|
|
|
39
|
+
/** @type {Record<string, string>} */
|
|
38
40
|
const IMPORT_RENAMES = {
|
|
39
41
|
XDSSideNavHeader: 'XDSSideNavHeading',
|
|
40
42
|
XDSSideNavHeaderProps: 'XDSSideNavHeadingProps',
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
47
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
48
|
+
* @returns {string | null | undefined}
|
|
49
|
+
*/
|
|
43
50
|
export default function transformer(file, api) {
|
|
44
51
|
const j = api.jscodeshift;
|
|
45
52
|
const root = j(file.source);
|
|
46
53
|
let hasChanges = false;
|
|
47
54
|
|
|
48
55
|
// 1. Rename props on target components
|
|
49
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
56
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
50
57
|
const name = path.node.name;
|
|
51
58
|
if (name.type !== 'JSXIdentifier' || !TARGET_COMPONENTS.has(name.name)) {
|
|
52
59
|
return;
|
|
53
60
|
}
|
|
54
61
|
|
|
55
|
-
path.node.attributes.forEach((attr) => {
|
|
62
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
56
63
|
if (attr.type === 'JSXAttribute' && attr.name.name in PROP_RENAMES) {
|
|
57
64
|
attr.name.name = PROP_RENAMES[attr.name.name];
|
|
58
65
|
hasChanges = true;
|
|
@@ -61,13 +68,13 @@ export default function transformer(file, api) {
|
|
|
61
68
|
});
|
|
62
69
|
|
|
63
70
|
// 2. Rename <XDSSideNavHeader> to <XDSSideNavHeading> (opening and closing tags)
|
|
64
|
-
root.find(j.JSXIdentifier, {name: 'XDSSideNavHeader'}).forEach((path) => {
|
|
71
|
+
root.find(j.JSXIdentifier, {name: 'XDSSideNavHeader'}).forEach((/** @type {any} */ path) => {
|
|
65
72
|
path.node.name = 'XDSSideNavHeading';
|
|
66
73
|
hasChanges = true;
|
|
67
74
|
});
|
|
68
75
|
|
|
69
76
|
// 3. Rename import specifiers
|
|
70
|
-
root.find(j.ImportSpecifier).forEach((path) => {
|
|
77
|
+
root.find(j.ImportSpecifier).forEach((/** @type {any} */ path) => {
|
|
71
78
|
const imported = path.node.imported;
|
|
72
79
|
if (imported.type === 'Identifier' && imported.name in IMPORT_RENAMES) {
|
|
73
80
|
const oldName = imported.name;
|
|
@@ -23,24 +23,30 @@ const TITLE_PROP_COMPONENTS = new Set([
|
|
|
23
23
|
'XDSTopNavHeading',
|
|
24
24
|
]);
|
|
25
25
|
|
|
26
|
+
/** @type {Record<string, string>} */
|
|
26
27
|
const IMPORT_RENAMES = {
|
|
27
28
|
XDSTopNavTitle: 'XDSTopNavHeading',
|
|
28
29
|
XDSTopNavTitleProps: 'XDSTopNavHeadingProps',
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
34
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
35
|
+
* @returns {string | null | undefined}
|
|
36
|
+
*/
|
|
31
37
|
export default function transformer(file, api) {
|
|
32
38
|
const j = api.jscodeshift;
|
|
33
39
|
const root = j(file.source);
|
|
34
40
|
let hasChanges = false;
|
|
35
41
|
|
|
36
42
|
// 1. Rename `title` prop to `heading` on target components
|
|
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
|
if (name.type !== 'JSXIdentifier' || !TITLE_PROP_COMPONENTS.has(name.name)) {
|
|
40
46
|
return;
|
|
41
47
|
}
|
|
42
48
|
|
|
43
|
-
path.node.attributes.forEach((attr) => {
|
|
49
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
44
50
|
if (attr.type === 'JSXAttribute' && attr.name.name === 'title') {
|
|
45
51
|
attr.name.name = 'heading';
|
|
46
52
|
hasChanges = true;
|
|
@@ -49,13 +55,13 @@ export default function transformer(file, api) {
|
|
|
49
55
|
});
|
|
50
56
|
|
|
51
57
|
// 2. Rename <XDSTopNavTitle> to <XDSTopNavHeading> (opening and closing tags)
|
|
52
|
-
root.find(j.JSXIdentifier, {name: 'XDSTopNavTitle'}).forEach((path) => {
|
|
58
|
+
root.find(j.JSXIdentifier, {name: 'XDSTopNavTitle'}).forEach((/** @type {any} */ path) => {
|
|
53
59
|
path.node.name = 'XDSTopNavHeading';
|
|
54
60
|
hasChanges = true;
|
|
55
61
|
});
|
|
56
62
|
|
|
57
63
|
// 3. Rename import specifiers: XDSTopNavTitle → XDSTopNavHeading, XDSTopNavTitleProps → XDSTopNavHeadingProps
|
|
58
|
-
root.find(j.ImportSpecifier).forEach((path) => {
|
|
64
|
+
root.find(j.ImportSpecifier).forEach((/** @type {any} */ path) => {
|
|
59
65
|
const imported = path.node.imported;
|
|
60
66
|
if (imported.type === 'Identifier' && imported.name in IMPORT_RENAMES) {
|
|
61
67
|
const oldName = imported.name;
|
|
@@ -32,6 +32,11 @@ const RENAMES = [
|
|
|
32
32
|
},
|
|
33
33
|
];
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
37
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
38
|
+
* @returns {string | null | undefined}
|
|
39
|
+
*/
|
|
35
40
|
export default function transformer(file, api) {
|
|
36
41
|
const j = api.jscodeshift;
|
|
37
42
|
const root = j(file.source);
|
|
@@ -42,8 +47,8 @@ export default function transformer(file, api) {
|
|
|
42
47
|
.find(j.JSXOpeningElement, {
|
|
43
48
|
name: {name: component},
|
|
44
49
|
})
|
|
45
|
-
.forEach((path) => {
|
|
46
|
-
path.node.attributes.forEach((attr) => {
|
|
50
|
+
.forEach((/** @type {any} */ path) => {
|
|
51
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
47
52
|
if (attr.type === 'JSXAttribute' && attr.name.name === oldProp) {
|
|
48
53
|
attr.name.name = newProp;
|
|
49
54
|
hasChanges = true;
|
|
@@ -33,6 +33,11 @@ const SIMPLE_RENAMES = [
|
|
|
33
33
|
*/
|
|
34
34
|
const MERGE_COMPONENTS = ['XDSHoverCard', 'XDSTooltip'];
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
38
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
39
|
+
* @returns {string | null | undefined}
|
|
40
|
+
*/
|
|
36
41
|
export default function transformer(file, api) {
|
|
37
42
|
const j = api.jscodeshift;
|
|
38
43
|
const root = j(file.source);
|
|
@@ -44,8 +49,8 @@ export default function transformer(file, api) {
|
|
|
44
49
|
.find(j.JSXOpeningElement, {
|
|
45
50
|
name: {name: component},
|
|
46
51
|
})
|
|
47
|
-
.forEach((path) => {
|
|
48
|
-
path.node.attributes.forEach((attr) => {
|
|
52
|
+
.forEach((/** @type {any} */ path) => {
|
|
53
|
+
path.node.attributes.forEach((/** @type {any} */ attr) => {
|
|
49
54
|
if (attr.type === 'JSXAttribute' && attr.name.name === oldProp) {
|
|
50
55
|
attr.name.name = 'onOpenChange';
|
|
51
56
|
hasChanges = true;
|
|
@@ -60,13 +65,13 @@ export default function transformer(file, api) {
|
|
|
60
65
|
.find(j.JSXOpeningElement, {
|
|
61
66
|
name: {name: component},
|
|
62
67
|
})
|
|
63
|
-
.forEach((path) => {
|
|
68
|
+
.forEach((/** @type {any} */ path) => {
|
|
64
69
|
const attrs = path.node.attributes;
|
|
65
70
|
const onShowAttr = attrs.find(
|
|
66
|
-
(a) => a.type === 'JSXAttribute' && a.name.name === 'onShow',
|
|
71
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'onShow',
|
|
67
72
|
);
|
|
68
73
|
const onHideAttr = attrs.find(
|
|
69
|
-
(a) => a.type === 'JSXAttribute' && a.name.name === 'onHide',
|
|
74
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'onHide',
|
|
70
75
|
);
|
|
71
76
|
|
|
72
77
|
if (onShowAttr && onHideAttr) {
|
|
@@ -19,6 +19,11 @@ export const meta = {
|
|
|
19
19
|
pr: '#706',
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
24
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
25
|
+
* @returns {string | null | undefined}
|
|
26
|
+
*/
|
|
22
27
|
export default function transformer(file, api) {
|
|
23
28
|
const j = api.jscodeshift;
|
|
24
29
|
const root = j(file.source);
|
|
@@ -28,7 +33,7 @@ export default function transformer(file, api) {
|
|
|
28
33
|
.find(j.JSXElement, {
|
|
29
34
|
openingElement: {name: {name: 'XDSBadge'}},
|
|
30
35
|
})
|
|
31
|
-
.forEach((path) => {
|
|
36
|
+
.forEach((/** @type {any} */ path) => {
|
|
32
37
|
const {children} = path.node;
|
|
33
38
|
|
|
34
39
|
// Skip if already self-closing or no children
|
|
@@ -36,7 +41,7 @@ export default function transformer(file, api) {
|
|
|
36
41
|
|
|
37
42
|
// Filter out whitespace-only JSXText nodes
|
|
38
43
|
const meaningful = children.filter(
|
|
39
|
-
(c) => !(c.type === 'JSXText' && !c.value.trim()),
|
|
44
|
+
(/** @type {any} */ c) => !(c.type === 'JSXText' && !c.value.trim()),
|
|
40
45
|
);
|
|
41
46
|
|
|
42
47
|
// Only transform single-child cases
|
|
@@ -36,6 +36,11 @@ const APPSHELL_DEPRECATED_PROPS = [
|
|
|
36
36
|
'defaultIsSideNavCollapsed',
|
|
37
37
|
];
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
41
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
42
|
+
* @returns {string | null | undefined}
|
|
43
|
+
*/
|
|
39
44
|
export default function transformer(file, api) {
|
|
40
45
|
const j = api.jscodeshift;
|
|
41
46
|
const root = j(file.source);
|
|
@@ -46,16 +51,17 @@ export default function transformer(file, api) {
|
|
|
46
51
|
.find(j.JSXOpeningElement, {
|
|
47
52
|
name: {name: 'XDSSideNav'},
|
|
48
53
|
})
|
|
49
|
-
.forEach((path) => {
|
|
54
|
+
.forEach((/** @type {any} */ path) => {
|
|
50
55
|
const attrs = path.node.attributes;
|
|
51
56
|
|
|
52
57
|
// Find isCollapsible
|
|
53
58
|
const isCollapsibleIdx = attrs.findIndex(
|
|
54
|
-
(a) => a.type === 'JSXAttribute' && a.name.name === 'isCollapsible',
|
|
59
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'isCollapsible',
|
|
55
60
|
);
|
|
56
61
|
if (isCollapsibleIdx === -1) return;
|
|
57
62
|
|
|
58
63
|
// Collect all collapse-related props
|
|
64
|
+
/** @type {Record<string, any>} */
|
|
59
65
|
const collapseProps = {};
|
|
60
66
|
const indicesToRemove = [];
|
|
61
67
|
|
|
@@ -129,7 +135,7 @@ export default function transformer(file, api) {
|
|
|
129
135
|
.find(j.JSXOpeningElement, {
|
|
130
136
|
name: {name: 'XDSAppShell'},
|
|
131
137
|
})
|
|
132
|
-
.forEach((path) => {
|
|
138
|
+
.forEach((/** @type {any} */ path) => {
|
|
133
139
|
const attrs = path.node.attributes;
|
|
134
140
|
for (let i = attrs.length - 1; i >= 0; i--) {
|
|
135
141
|
const attr = attrs[i];
|
|
@@ -22,6 +22,7 @@ export const meta = {
|
|
|
22
22
|
'Renames --radius-inner/content/element/container/page to --radius-0/1/2/3/4.',
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
/** @type {Record<string, string>} */
|
|
25
26
|
const TOKEN_MAP = {
|
|
26
27
|
'--radius-inner': '--radius-0',
|
|
27
28
|
'--radius-content': '--radius-1',
|
|
@@ -38,17 +39,22 @@ const OLD_TOKENS_PATTERN = new RegExp(
|
|
|
38
39
|
'g',
|
|
39
40
|
);
|
|
40
41
|
|
|
41
|
-
function replaceTokens(str) {
|
|
42
|
-
return str.replace(OLD_TOKENS_PATTERN, (match) => TOKEN_MAP[match] || match);
|
|
42
|
+
function replaceTokens(/** @type {any} */ str) {
|
|
43
|
+
return str.replace(OLD_TOKENS_PATTERN, (/** @type {any} */ match) => TOKEN_MAP[match] || match);
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
48
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
49
|
+
* @returns {string | null | undefined}
|
|
50
|
+
*/
|
|
45
51
|
export default function transformer(file, api) {
|
|
46
52
|
const j = api.jscodeshift;
|
|
47
53
|
const root = j(file.source);
|
|
48
54
|
let hasChanges = false;
|
|
49
55
|
|
|
50
56
|
// Replace in string literals (StringLiteral or Literal with string value)
|
|
51
|
-
const replaceInStringNode = (path) => {
|
|
57
|
+
const replaceInStringNode = (/** @type {any} */ path) => {
|
|
52
58
|
if (typeof path.node.value !== 'string') return;
|
|
53
59
|
const original = path.node.value;
|
|
54
60
|
const replaced = replaceTokens(original);
|
|
@@ -59,14 +65,14 @@ export default function transformer(file, api) {
|
|
|
59
65
|
};
|
|
60
66
|
|
|
61
67
|
root.find(j.StringLiteral).forEach(replaceInStringNode);
|
|
62
|
-
root.find(j.Literal).forEach((path) => {
|
|
68
|
+
root.find(j.Literal).forEach((/** @type {any} */ path) => {
|
|
63
69
|
if (typeof path.node.value === 'string') {
|
|
64
70
|
replaceInStringNode(path);
|
|
65
71
|
}
|
|
66
72
|
});
|
|
67
73
|
|
|
68
74
|
// Replace in template literal quasis
|
|
69
|
-
root.find(j.TemplateLiteral).forEach((path) => {
|
|
75
|
+
root.find(j.TemplateLiteral).forEach((/** @type {any} */ path) => {
|
|
70
76
|
for (const quasi of path.node.quasis) {
|
|
71
77
|
const original = quasi.value.raw;
|
|
72
78
|
const replaced = replaceTokens(original);
|