@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
package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs
RENAMED
|
@@ -27,7 +27,7 @@ export const meta = {
|
|
|
27
27
|
|
|
28
28
|
const COMPONENTS = new Set(['XDSSelector', 'XDSMultiSelector']);
|
|
29
29
|
|
|
30
|
-
function isXDSCoreSource(source) {
|
|
30
|
+
function isXDSCoreSource(/** @type {any} */ source) {
|
|
31
31
|
return (
|
|
32
32
|
source === '@xds/core' ||
|
|
33
33
|
source === '@xds/core/Selector' ||
|
|
@@ -35,7 +35,7 @@ function isXDSCoreSource(source) {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function sourceCanImport(source, importedName) {
|
|
38
|
+
function sourceCanImport(/** @type {any} */ source, /** @type {any} */ importedName) {
|
|
39
39
|
if (source === '@xds/core') {
|
|
40
40
|
return COMPONENTS.has(importedName);
|
|
41
41
|
}
|
|
@@ -48,11 +48,11 @@ function sourceCanImport(source, importedName) {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
function collectSelectorNames(root, j) {
|
|
51
|
+
function collectSelectorNames(/** @type {any} */ root, /** @type {any} */ j) {
|
|
52
52
|
const localNames = new Map();
|
|
53
53
|
const namespaceNames = new Set();
|
|
54
54
|
|
|
55
|
-
root.find(j.ImportDeclaration).forEach(path => {
|
|
55
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
56
56
|
const source = path.node.source.value;
|
|
57
57
|
if (typeof source !== 'string' || !isXDSCoreSource(source)) {
|
|
58
58
|
return;
|
|
@@ -80,7 +80,7 @@ function collectSelectorNames(root, j) {
|
|
|
80
80
|
return {localNames, namespaceNames};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
function getComponentName(name, localNames, namespaceNames) {
|
|
83
|
+
function getComponentName(/** @type {any} */ name, /** @type {any} */ localNames, /** @type {any} */ namespaceNames) {
|
|
84
84
|
if (name.type === 'JSXIdentifier') {
|
|
85
85
|
return localNames.get(name.name) ?? null;
|
|
86
86
|
}
|
|
@@ -98,24 +98,24 @@ function getComponentName(name, localNames, namespaceNames) {
|
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
function isWhitespaceText(node) {
|
|
101
|
+
function isWhitespaceText(/** @type {any} */ node) {
|
|
102
102
|
return node.type === 'JSXText' && node.value.trim() === '';
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function isEmptyExpression(node) {
|
|
105
|
+
function isEmptyExpression(/** @type {any} */ node) {
|
|
106
106
|
return (
|
|
107
107
|
node.type === 'JSXExpressionContainer' &&
|
|
108
108
|
node.expression.type === 'JSXEmptyExpression'
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
function getMeaningfulChildren(children) {
|
|
112
|
+
function getMeaningfulChildren(/** @type {any} */ children) {
|
|
113
113
|
return children.filter(
|
|
114
|
-
child => !isWhitespaceText(child) && !isEmptyExpression(child),
|
|
114
|
+
(/** @type {any} */ child) => !isWhitespaceText(child) && !isEmptyExpression(child),
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
function isRenderableExpression(expression) {
|
|
118
|
+
function isRenderableExpression(/** @type {any} */ expression) {
|
|
119
119
|
return (
|
|
120
120
|
expression.type === 'ArrowFunctionExpression' ||
|
|
121
121
|
expression.type === 'FunctionExpression' ||
|
|
@@ -124,12 +124,17 @@ function isRenderableExpression(expression) {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
function getJSXAttribute(openingElement, name) {
|
|
127
|
+
function getJSXAttribute(/** @type {any} */ openingElement, /** @type {any} */ name) {
|
|
128
128
|
return openingElement.attributes.find(
|
|
129
|
-
attr => attr.type === 'JSXAttribute' && attr.name.name === name,
|
|
129
|
+
(/** @type {any} */ attr) => attr.type === 'JSXAttribute' && attr.name.name === name,
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
135
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
136
|
+
* @returns {string | null | undefined}
|
|
137
|
+
*/
|
|
133
138
|
export default function transformer(file, api) {
|
|
134
139
|
const j = api.jscodeshift;
|
|
135
140
|
const root = j(file.source);
|
|
@@ -140,7 +145,7 @@ export default function transformer(file, api) {
|
|
|
140
145
|
return undefined;
|
|
141
146
|
}
|
|
142
147
|
|
|
143
|
-
root.find(j.JSXElement).forEach(path => {
|
|
148
|
+
root.find(j.JSXElement).forEach((/** @type {any} */ path) => {
|
|
144
149
|
const componentName = getComponentName(
|
|
145
150
|
path.node.openingElement.name,
|
|
146
151
|
localNames,
|
package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs
RENAMED
|
@@ -104,11 +104,11 @@ const SECTION_VARIANTS = new Set(['section', 'transparent', 'muted']);
|
|
|
104
104
|
const DIVIDER_VARIANTS = new Set(['subtle', 'strong']);
|
|
105
105
|
const ORIENTATIONS = new Set(['horizontal', 'vertical']);
|
|
106
106
|
|
|
107
|
-
function attr(name, value) {
|
|
107
|
+
function attr(/** @type {any} */ name, /** @type {any} */ value) {
|
|
108
108
|
return `[data-${name}="${value}"]`;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function valueToAttr(component, value) {
|
|
111
|
+
function valueToAttr(/** @type {any} */ component, /** @type {any} */ value) {
|
|
112
112
|
// Numeric-prefixed classes emitted as prop-value (level-2, gap-4, cols-3).
|
|
113
113
|
let match = value.match(/^level-(\d+)$/);
|
|
114
114
|
if (match) return attr('level', match[1]);
|
|
@@ -211,8 +211,8 @@ function valueToAttr(component, value) {
|
|
|
211
211
|
|
|
212
212
|
const SELECTOR_RE = /\.((?:xds-[a-z0-9-]+))(\.(?:-?[_a-zA-Z][_a-zA-Z0-9-]*))+/g;
|
|
213
213
|
|
|
214
|
-
export function migrateThemeSelectors(source) {
|
|
215
|
-
return source.replace(SELECTOR_RE, (full, component) => {
|
|
214
|
+
export function migrateThemeSelectors(/** @type {any} */ source) {
|
|
215
|
+
return source.replace(SELECTOR_RE, (/** @type {any} */ full, /** @type {any} */ component) => {
|
|
216
216
|
const classChain = full.slice(component.length + 1);
|
|
217
217
|
const values = classChain.split('.').filter(Boolean);
|
|
218
218
|
|
|
@@ -229,6 +229,10 @@ export function migrateThemeSelectors(source) {
|
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
/**
|
|
233
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
234
|
+
* @returns {string | null | undefined}
|
|
235
|
+
*/
|
|
232
236
|
export default function transformer(file) {
|
|
233
237
|
const result = migrateThemeSelectors(file.source);
|
|
234
238
|
return result === file.source ? undefined : result;
|
|
@@ -45,13 +45,18 @@ const IDENTIFIER_RENAMES = new Map([
|
|
|
45
45
|
['XDSDateRangePickerStatusType', 'XDSDateRangeInputStatusType'],
|
|
46
46
|
]);
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
50
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
51
|
+
* @returns {string | null | undefined}
|
|
52
|
+
*/
|
|
48
53
|
export default function transformer(file, api) {
|
|
49
54
|
const j = api.jscodeshift;
|
|
50
55
|
const root = j(file.source);
|
|
51
56
|
let hasChanges = false;
|
|
52
57
|
|
|
53
58
|
// 1. Rename import/export source paths
|
|
54
|
-
root.find(j.ImportDeclaration).forEach((path) => {
|
|
59
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
55
60
|
const source = path.node.source.value;
|
|
56
61
|
const renamed = IMPORT_PATH_RENAMES.get(source);
|
|
57
62
|
if (renamed) {
|
|
@@ -60,7 +65,7 @@ export default function transformer(file, api) {
|
|
|
60
65
|
}
|
|
61
66
|
});
|
|
62
67
|
|
|
63
|
-
root.find(j.ExportNamedDeclaration).forEach((path) => {
|
|
68
|
+
root.find(j.ExportNamedDeclaration).forEach((/** @type {any} */ path) => {
|
|
64
69
|
if (path.node.source) {
|
|
65
70
|
const source = path.node.source.value;
|
|
66
71
|
const renamed = IMPORT_PATH_RENAMES.get(source);
|
|
@@ -72,7 +77,7 @@ export default function transformer(file, api) {
|
|
|
72
77
|
});
|
|
73
78
|
|
|
74
79
|
// 2. Rename all identifiers (covers imports, type refs, variable names)
|
|
75
|
-
root.find(j.Identifier).forEach((path) => {
|
|
80
|
+
root.find(j.Identifier).forEach((/** @type {any} */ path) => {
|
|
76
81
|
const renamed = IDENTIFIER_RENAMES.get(path.node.name);
|
|
77
82
|
if (renamed) {
|
|
78
83
|
path.node.name = renamed;
|
|
@@ -81,7 +86,7 @@ export default function transformer(file, api) {
|
|
|
81
86
|
});
|
|
82
87
|
|
|
83
88
|
// 3. Rename JSX element names
|
|
84
|
-
root.find(j.JSXIdentifier).forEach((path) => {
|
|
89
|
+
root.find(j.JSXIdentifier).forEach((/** @type {any} */ path) => {
|
|
85
90
|
const renamed = IDENTIFIER_RENAMES.get(path.node.name);
|
|
86
91
|
if (renamed) {
|
|
87
92
|
path.node.name = renamed;
|
|
@@ -90,7 +95,7 @@ export default function transformer(file, api) {
|
|
|
90
95
|
});
|
|
91
96
|
|
|
92
97
|
// 4. Rename string literals (covers displayName assignments)
|
|
93
|
-
root.find(j.StringLiteral).forEach((path) => {
|
|
98
|
+
root.find(j.StringLiteral).forEach((/** @type {any} */ path) => {
|
|
94
99
|
const renamed = IDENTIFIER_RENAMES.get(path.node.value);
|
|
95
100
|
if (renamed) {
|
|
96
101
|
path.node.value = renamed;
|
|
@@ -99,7 +104,7 @@ export default function transformer(file, api) {
|
|
|
99
104
|
});
|
|
100
105
|
|
|
101
106
|
// Also handle Literal nodes (parser-dependent)
|
|
102
|
-
root.find(j.Literal).forEach((path) => {
|
|
107
|
+
root.find(j.Literal).forEach((/** @type {any} */ path) => {
|
|
103
108
|
if (typeof path.node.value === 'string') {
|
|
104
109
|
const renamed = IDENTIFIER_RENAMES.get(path.node.value);
|
|
105
110
|
if (renamed) {
|
|
@@ -29,12 +29,17 @@ const IMPERATIVE_REF_COMPONENTS = new Set([
|
|
|
29
29
|
'XDSChartStreamGL',
|
|
30
30
|
]);
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
34
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
35
|
+
* @returns {string | null | undefined}
|
|
36
|
+
*/
|
|
32
37
|
export default function transformer(file, api) {
|
|
33
38
|
const j = api.jscodeshift;
|
|
34
39
|
const root = j(file.source);
|
|
35
40
|
let hasChanges = false;
|
|
36
41
|
|
|
37
|
-
root.find(j.JSXOpeningElement).forEach(path => {
|
|
42
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
38
43
|
const name = path.node.name;
|
|
39
44
|
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
40
45
|
if (componentName == null) return;
|
|
@@ -26,13 +26,18 @@ export const meta = {
|
|
|
26
26
|
|
|
27
27
|
const TARGET_COMPONENTS = new Set(['XDSChatComposer', 'XDSChatSendButton']);
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @param {import('../../../types/codemod').AstryxCodemodFile} file
|
|
31
|
+
* @param {import('../../../types/codemod').CodemodTransformApi} api
|
|
32
|
+
* @returns {string | null | undefined}
|
|
33
|
+
*/
|
|
29
34
|
export default function transformer(file, api) {
|
|
30
35
|
const j = api.jscodeshift;
|
|
31
36
|
const root = j(file.source);
|
|
32
37
|
let hasChanges = false;
|
|
33
38
|
|
|
34
39
|
// Rename JSX prop on target components only
|
|
35
|
-
root.find(j.JSXOpeningElement).forEach((path) => {
|
|
40
|
+
root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
|
|
36
41
|
const name = path.node.name;
|
|
37
42
|
const componentName = name.type === 'JSXIdentifier' ? name.name : null;
|
|
38
43
|
if (!TARGET_COMPONENTS.has(componentName)) return;
|
|
@@ -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;
|