@astryxdesign/cli 0.1.8-canary.0c4d8d7 → 0.1.8-canary.0db5dfd
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/{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 +11 -8
- 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 +125 -46
- package/{src → cli}/commands/build.mjs +33 -57
- package/{src → cli}/commands/component/index.mjs +49 -22
- 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 +17 -8
- package/{src → cli}/commands/docs.mjs +39 -7
- 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 +37 -14
- package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
- package/{src → cli}/commands/init.mjs +20 -9
- package/{src → cli}/commands/layout.mjs +58 -18
- package/{src → cli}/commands/search.mjs +19 -12
- package/{src → cli}/commands/search.test.mjs +1 -1
- package/{src → cli}/commands/setup-nudge.test.mjs +1 -1
- package/cli/commands/swizzle.mjs +103 -0
- package/{src → cli}/commands/template.mjs +73 -22
- 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 +160 -52
- package/{src → cli}/commands/upgrade.test.mjs +1 -1
- package/{src → cli}/commands/validate-integration.mjs +17 -37
- package/{src → cli}/index.mjs +17 -15
- package/{src/codemods → codemods}/ensure-jscodeshift.mjs +1 -1
- 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 +3 -1
- package/{src/codemods → codemods}/run-codemod.mjs +17 -10
- package/{src/codemods → codemods}/runner.mjs +22 -12
- 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/drop-xds-prefix-imports.mjs +19 -14
- 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 +16 -11
- 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/{src/codemods → codemods}/transforms/v0.1.8/rename-avatar-size-scale.mjs +15 -10
- package/docs/internationalization.doc.mjs +92 -46
- package/{src/commands → lib/agent-docs}/agent-docs.mjs +30 -11
- package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
- package/{src/lib → lib}/component-discovery.mjs +44 -2
- package/{src/lib → lib}/component-format.mjs +65 -24
- 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 +10 -5
- package/{src/lib → lib}/json-shim.test.mjs +1 -1
- 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/{src/lib → lib}/term-log.mjs +12 -3
- 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 +33 -26
- package/scripts/postinstall.mjs +4 -4
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +1 -1
- 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/{src/types → types}/api.contract.assert.ts +17 -8
- package/{src/types → types}/api.d.ts +106 -0
- package/{src/types → types}/base.d.ts +17 -2
- 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/types/jscodeshift.d.ts +19 -0
- package/types/layout.d.ts +74 -0
- package/types/theme.d.ts +53 -0
- package/{src/types → types}/upgrade.d.ts +8 -1
- package/{src/utils → utils}/paths.mjs +4 -1
- package/src/commands/swizzle.mjs +0 -417
- package/src/types/build.d.ts +0 -23
- package/src/types/codemod.d.ts +0 -81
- package/src/types/theme.d.ts +0 -23
- /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
- /package/{src/api → api}/error.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/cli-postinstall.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/init.next-steps.test.mjs +0 -0
- /package/{src → cli}/commands/interactive-guard.test.mjs +0 -0
- /package/{src → cli}/commands/json-contract.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__/registry.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__/drop-xds-prefix-imports.test.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__/migrate-xds-module-specifiers.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/codemods → codemods}/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.8/index.mjs +0 -0
- /package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +0 -0
- /package/{src/lib → lib}/cli-error.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}/json.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}/index.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}/swizzle.d.ts +0 -0
- /package/{src/types → types}/template-api.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}/package-manager.mjs +0 -0
- /package/{src/utils → utils}/package-manager.test.mjs +0 -0
- /package/{src/utils → utils}/path-safety.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
- /package/{src/utils → utils}/update-check.mjs +0 -0
- /package/{src/utils → utils}/update-check.test.mjs +0 -0
|
@@ -50,6 +50,11 @@ export const meta = {
|
|
|
50
50
|
pr: '#1321',
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
55
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
56
|
+
* @returns {string | null | undefined}
|
|
57
|
+
*/
|
|
53
58
|
export default function transformer(file, api) {
|
|
54
59
|
const j = api.jscodeshift;
|
|
55
60
|
const root = j(file.source);
|
|
@@ -61,7 +66,7 @@ export default function transformer(file, api) {
|
|
|
61
66
|
// Uses direct body manipulation instead of jscodeshift's insertAfter(),
|
|
62
67
|
// which has a known bug that corrupts 'use client' directives into
|
|
63
68
|
// double semicolons ('use client';;).
|
|
64
|
-
function insertAfterInBody(targetPath, newNode) {
|
|
69
|
+
function insertAfterInBody(/** @type {any} */ targetPath, /** @type {any} */ newNode) {
|
|
65
70
|
const body = root.get().node.program.body;
|
|
66
71
|
const targetIndex = body.indexOf(targetPath.node);
|
|
67
72
|
if (targetIndex !== -1) {
|
|
@@ -69,14 +74,14 @@ export default function transformer(file, api) {
|
|
|
69
74
|
} else {
|
|
70
75
|
// Fallback: insert after all imports
|
|
71
76
|
const lastImportIdx = body.findLastIndex(
|
|
72
|
-
(n) => n.type === 'ImportDeclaration',
|
|
77
|
+
(/** @type {any} */ n) => n.type === 'ImportDeclaration',
|
|
73
78
|
);
|
|
74
79
|
body.splice(lastImportIdx + 1, 0, newNode);
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
// ---- 1. JSX elements: convert icon-only XDSButton to XDSIconButton ----
|
|
79
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
84
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
80
85
|
const name = path.node.name;
|
|
81
86
|
const componentName =
|
|
82
87
|
name.type === 'JSXIdentifier' ? name.name : null;
|
|
@@ -85,13 +90,13 @@ export default function transformer(file, api) {
|
|
|
85
90
|
const attrs = path.node.attributes;
|
|
86
91
|
|
|
87
92
|
const hasIcon = attrs.some(
|
|
88
|
-
(a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
|
|
93
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
|
|
89
94
|
);
|
|
90
95
|
const hasChildren = attrs.some(
|
|
91
|
-
(a) => a.type === 'JSXAttribute' && a.name?.name === 'children',
|
|
96
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'children',
|
|
92
97
|
);
|
|
93
98
|
const hasIsIconOnly = attrs.some(
|
|
94
|
-
(a) => a.type === 'JSXAttribute' && a.name?.name === 'isIconOnly',
|
|
99
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'isIconOnly',
|
|
95
100
|
);
|
|
96
101
|
|
|
97
102
|
if (!hasIcon || hasChildren || hasIsIconOnly) return;
|
|
@@ -101,7 +106,7 @@ export default function transformer(file, api) {
|
|
|
101
106
|
const hasJSXChildren =
|
|
102
107
|
parent.type === 'JSXElement' &&
|
|
103
108
|
parent.children &&
|
|
104
|
-
parent.children.some((child) => {
|
|
109
|
+
parent.children.some((/** @type {any} */ child) => {
|
|
105
110
|
if (child.type === 'JSXText') return child.value.trim() !== '';
|
|
106
111
|
return true;
|
|
107
112
|
});
|
|
@@ -128,7 +133,7 @@ export default function transformer(file, api) {
|
|
|
128
133
|
});
|
|
129
134
|
|
|
130
135
|
// ---- 2. Remove redundant children that match label ----
|
|
131
|
-
root.find(j.JSXElement).forEach((path) => {
|
|
136
|
+
root.find(j.JSXElement).forEach((/** @type {any} */ path) => {
|
|
132
137
|
const opening = path.node.openingElement;
|
|
133
138
|
const name = opening.name;
|
|
134
139
|
const componentName =
|
|
@@ -137,13 +142,13 @@ export default function transformer(file, api) {
|
|
|
137
142
|
|
|
138
143
|
const attrs = opening.attributes;
|
|
139
144
|
const hasIcon = attrs.some(
|
|
140
|
-
(a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
|
|
145
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
|
|
141
146
|
);
|
|
142
147
|
if (!hasIcon) return;
|
|
143
148
|
|
|
144
149
|
// Get label value
|
|
145
150
|
const labelAttr = attrs.find(
|
|
146
|
-
(a) => a.type === 'JSXAttribute' && a.name?.name === 'label',
|
|
151
|
+
(/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'label',
|
|
147
152
|
);
|
|
148
153
|
if (!labelAttr || !labelAttr.value) return;
|
|
149
154
|
|
|
@@ -177,7 +182,7 @@ export default function transformer(file, api) {
|
|
|
177
182
|
});
|
|
178
183
|
|
|
179
184
|
// ---- 3. Object literals: add isIconOnly to button config objects ----
|
|
180
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
185
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
181
186
|
const name = path.node.name;
|
|
182
187
|
const componentName =
|
|
183
188
|
name.type === 'JSXIdentifier' ? name.name : null;
|
|
@@ -185,7 +190,7 @@ export default function transformer(file, api) {
|
|
|
185
190
|
|
|
186
191
|
const attrs = path.node.attributes;
|
|
187
192
|
const buttonAttr = attrs.find(
|
|
188
|
-
(a) =>
|
|
193
|
+
(/** @type {any} */ a) =>
|
|
189
194
|
a.type === 'JSXAttribute' &&
|
|
190
195
|
a.name?.name === 'button' &&
|
|
191
196
|
a.value?.type === 'JSXExpressionContainer' &&
|
|
@@ -197,13 +202,13 @@ export default function transformer(file, api) {
|
|
|
197
202
|
const props = obj.properties;
|
|
198
203
|
|
|
199
204
|
const hasIcon = props.some(
|
|
200
|
-
(p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'icon',
|
|
205
|
+
(/** @type {any} */ p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'icon',
|
|
201
206
|
);
|
|
202
207
|
const hasChildren = props.some(
|
|
203
|
-
(p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'children',
|
|
208
|
+
(/** @type {any} */ p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'children',
|
|
204
209
|
);
|
|
205
210
|
const hasIsIconOnly = props.some(
|
|
206
|
-
(p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'isIconOnly',
|
|
211
|
+
(/** @type {any} */ p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'isIconOnly',
|
|
207
212
|
);
|
|
208
213
|
|
|
209
214
|
if (hasIcon && !hasChildren && !hasIsIconOnly) {
|
|
@@ -222,7 +227,7 @@ export default function transformer(file, api) {
|
|
|
222
227
|
hasRemainingXDSButton = true;
|
|
223
228
|
});
|
|
224
229
|
// Also check for XDSButton in type annotations (e.g. typeof XDSButton)
|
|
225
|
-
root.find(j.Identifier, {name: 'XDSButton'}).forEach((path) => {
|
|
230
|
+
root.find(j.Identifier, {name: 'XDSButton'}).forEach((/** @type {any} */ path) => {
|
|
226
231
|
// Skip JSX identifiers (already counted above) and import specifiers
|
|
227
232
|
if (path.parent.node.type === 'JSXOpeningElement' ||
|
|
228
233
|
path.parent.node.type === 'JSXClosingElement' ||
|
|
@@ -232,9 +237,9 @@ export default function transformer(file, api) {
|
|
|
232
237
|
|
|
233
238
|
if (needsIconButtonImport) {
|
|
234
239
|
let alreadyImported = false;
|
|
235
|
-
root.find(j.ImportDeclaration).forEach((path) => {
|
|
240
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
236
241
|
if (path.node.specifiers.some(
|
|
237
|
-
(s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSIconButton',
|
|
242
|
+
(/** @type {any} */ s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSIconButton',
|
|
238
243
|
)) {
|
|
239
244
|
alreadyImported = true;
|
|
240
245
|
}
|
|
@@ -244,13 +249,13 @@ export default function transformer(file, api) {
|
|
|
244
249
|
// Handle @xds/core/Button import — may need splitting if it has
|
|
245
250
|
// other specifiers (type imports, other components)
|
|
246
251
|
if (!hasRemainingXDSButton) {
|
|
247
|
-
root.find(j.ImportDeclaration).forEach((path) => {
|
|
252
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
248
253
|
if (alreadyImported) return;
|
|
249
254
|
const source = path.node.source.value;
|
|
250
255
|
if (source !== '@xds/core/Button') return;
|
|
251
256
|
const specs = path.node.specifiers;
|
|
252
257
|
const btnIdx = specs.findIndex(
|
|
253
|
-
(s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSButton',
|
|
258
|
+
(/** @type {any} */ s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSButton',
|
|
254
259
|
);
|
|
255
260
|
if (btnIdx === -1) return;
|
|
256
261
|
|
|
@@ -276,7 +281,7 @@ export default function transformer(file, api) {
|
|
|
276
281
|
|
|
277
282
|
// For barrel imports, add the specifier
|
|
278
283
|
if (!alreadyImported) {
|
|
279
|
-
root.find(j.ImportDeclaration).forEach((path) => {
|
|
284
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
280
285
|
if (alreadyImported) return;
|
|
281
286
|
if (path.node.source.value === '@xds/core') {
|
|
282
287
|
path.node.specifiers.push(
|
|
@@ -296,7 +301,7 @@ export default function transformer(file, api) {
|
|
|
296
301
|
|
|
297
302
|
const xdsImports = root
|
|
298
303
|
.find(j.ImportDeclaration)
|
|
299
|
-
.filter((p) => p.node.source.value.startsWith('@xds/'));
|
|
304
|
+
.filter((/** @type {any} */ p) => p.node.source.value.startsWith('@xds/'));
|
|
300
305
|
|
|
301
306
|
if (xdsImports.length > 0) {
|
|
302
307
|
insertAfterInBody(xdsImports.at(-1), newImport);
|
|
@@ -23,6 +23,7 @@ export const meta = {
|
|
|
23
23
|
pr: '#1503',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
/** @type {Record<string, string>} */
|
|
26
27
|
const RENAMES = {
|
|
27
28
|
checkCircle: 'success',
|
|
28
29
|
xCircle: 'error',
|
|
@@ -31,13 +32,18 @@ const RENAMES = {
|
|
|
31
32
|
/** Prop names that accept XDSIconName values */
|
|
32
33
|
const ICON_PROPS = new Set(['icon', 'name', 'selectedIcon']);
|
|
33
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
37
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
38
|
+
* @returns {string | null | undefined}
|
|
39
|
+
*/
|
|
34
40
|
export default function transformer(file, api) {
|
|
35
41
|
const j = api.jscodeshift;
|
|
36
42
|
const root = j(file.source);
|
|
37
43
|
let hasChanges = false;
|
|
38
44
|
|
|
39
45
|
// Helper: rename a string literal node if it matches a deprecated name
|
|
40
|
-
function renameStringLiteral(node) {
|
|
46
|
+
function renameStringLiteral(/** @type {any} */ node) {
|
|
41
47
|
if (!node) return false;
|
|
42
48
|
if (node.type === 'StringLiteral' || node.type === 'Literal') {
|
|
43
49
|
const newName = RENAMES[node.value];
|
|
@@ -51,7 +57,8 @@ export default function transformer(file, api) {
|
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
// Helper: recursively rename deprecated icon strings inside an expression
|
|
54
|
-
|
|
60
|
+
/** @returns {boolean} */
|
|
61
|
+
function renameInExpression(/** @type {any} */ node) {
|
|
55
62
|
if (!node) return false;
|
|
56
63
|
let changed = false;
|
|
57
64
|
if (node.type === 'StringLiteral' || node.type === 'Literal') {
|
|
@@ -67,7 +74,7 @@ export default function transformer(file, api) {
|
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
// 1. JSX attributes: icon="checkCircle" or icon={cond ? 'checkCircle' : 'copy'}
|
|
70
|
-
root.find(j.JSXAttribute).forEach((path) => {
|
|
77
|
+
root.find(j.JSXAttribute).forEach((/** @type {any} */ path) => {
|
|
71
78
|
const attrName = path.node.name?.name;
|
|
72
79
|
if (!ICON_PROPS.has(attrName)) return;
|
|
73
80
|
|
|
@@ -92,7 +99,7 @@ export default function transformer(file, api) {
|
|
|
92
99
|
|
|
93
100
|
if (looksLikeIconRegistry) {
|
|
94
101
|
const PropertyType = j.ObjectProperty ?? j.Property;
|
|
95
|
-
root.find(PropertyType).forEach((path) => {
|
|
102
|
+
root.find(PropertyType).forEach((/** @type {any} */ path) => {
|
|
96
103
|
const key = path.node.key;
|
|
97
104
|
if (!key) return;
|
|
98
105
|
const keyName =
|
|
@@ -110,7 +117,7 @@ export default function transformer(file, api) {
|
|
|
110
117
|
// 3. String literals in objects with icon-related keys
|
|
111
118
|
// e.g. { label: "TestX", href: "/pages/testx", icon: "checkCircle" }
|
|
112
119
|
const PropertyType2 = j.ObjectProperty ?? j.Property;
|
|
113
|
-
root.find(PropertyType2).forEach((path) => {
|
|
120
|
+
root.find(PropertyType2).forEach((/** @type {any} */ path) => {
|
|
114
121
|
const key = path.node.key;
|
|
115
122
|
const keyName = key?.type === 'Identifier' ? key.name : key?.value;
|
|
116
123
|
if (!ICON_PROPS.has(keyName)) return;
|
|
@@ -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' ||
|