@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.
Files changed (303) hide show
  1. package/{src/api → api/blog}/blog.mjs +42 -6
  2. package/{src/api → api/blog}/blog.test.mjs +2 -2
  3. package/api/build/build.mjs +92 -0
  4. package/api/build/build.test.mjs +92 -0
  5. package/{src/api → api/component}/component.mjs +49 -26
  6. package/{src/api → api/discover}/discover.mjs +55 -18
  7. package/{src/api → api/docs}/docs.mjs +47 -21
  8. package/{src/api → api/doctor}/doctor.mjs +11 -8
  9. package/{src/api → api/hook}/hook.mjs +11 -11
  10. package/{src/api → api}/index.mjs +16 -9
  11. package/{src/api → api/integration}/validate-integration.mjs +48 -15
  12. package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
  13. package/{src/api → api/layout}/layout.mjs +66 -17
  14. package/{src/api → api/layout}/layout.test.mjs +1 -1
  15. package/{src/api → api/search}/search.mjs +71 -12
  16. package/api/swizzle/swizzle.mjs +283 -0
  17. package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
  18. package/{src/api → api/template}/template-integration.test.mjs +2 -2
  19. package/{src/api → api/template}/template-suffix.test.mjs +3 -3
  20. package/{src/api → api/template}/template.mjs +96 -19
  21. package/{src/api → api/theme}/theme-add.mjs +35 -7
  22. package/{src → authoring}/codemod.mjs +6 -6
  23. package/{src → authoring}/config.test.mjs +1 -1
  24. package/{src → authoring}/doc.mjs +1 -1
  25. package/{src → authoring}/doc.test.mjs +1 -1
  26. package/{src → authoring}/template.mjs +1 -1
  27. package/bin/astryx.mjs +12 -10
  28. package/{src → cli}/commands/blog.mjs +48 -7
  29. package/{src → cli}/commands/build-theme.mjs +125 -46
  30. package/{src → cli}/commands/build.mjs +33 -57
  31. package/{src → cli}/commands/component/index.mjs +49 -22
  32. package/{src → cli}/commands/component-ownership.test.mjs +3 -3
  33. package/{src → cli}/commands/component-package.test.mjs +1 -1
  34. package/{src → cli}/commands/component-resolution.test.mjs +2 -2
  35. package/{src → cli}/commands/discover.mjs +17 -8
  36. package/{src → cli}/commands/docs.mjs +39 -7
  37. package/{src → cli}/commands/docs.test.mjs +1 -1
  38. package/{src → cli}/commands/doctor.mjs +3 -3
  39. package/{src → cli}/commands/doctor.test.mjs +2 -2
  40. package/{src → cli}/commands/ensure-core-built.mjs +3 -2
  41. package/{src → cli}/commands/external-showcase.test.mjs +1 -1
  42. package/{src → cli}/commands/hook/index.mjs +37 -14
  43. package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
  44. package/{src → cli}/commands/init.mjs +20 -9
  45. package/{src → cli}/commands/layout.mjs +58 -18
  46. package/{src → cli}/commands/search.mjs +19 -12
  47. package/{src → cli}/commands/search.test.mjs +1 -1
  48. package/{src → cli}/commands/setup-nudge.test.mjs +1 -1
  49. package/cli/commands/swizzle.mjs +103 -0
  50. package/{src → cli}/commands/template.mjs +73 -22
  51. package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
  52. package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
  53. package/{src → cli}/commands/upgrade.mjs +160 -52
  54. package/{src → cli}/commands/upgrade.test.mjs +1 -1
  55. package/{src → cli}/commands/validate-integration.mjs +17 -37
  56. package/{src → cli}/index.mjs +17 -15
  57. package/{src/codemods → codemods}/ensure-jscodeshift.mjs +1 -1
  58. package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
  59. package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
  60. package/{src/codemods → codemods}/integration-runner.mjs +8 -3
  61. package/{src/codemods → codemods}/registry.mjs +3 -1
  62. package/{src/codemods → codemods}/run-codemod.mjs +17 -10
  63. package/{src/codemods → codemods}/runner.mjs +22 -12
  64. package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
  65. package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
  66. package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
  67. package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
  68. package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
  69. package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
  70. package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
  71. package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
  72. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
  73. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
  74. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
  75. package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
  76. package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
  77. package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
  78. package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
  79. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
  80. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
  81. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
  82. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
  83. package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
  84. package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
  85. package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
  86. package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
  87. package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
  88. package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
  89. package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
  90. package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
  91. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
  92. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
  93. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
  94. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
  95. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
  96. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
  97. package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
  98. package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
  99. package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
  100. package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +19 -14
  101. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
  102. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
  103. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +16 -11
  104. package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
  105. package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
  106. package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
  107. package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
  108. package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
  109. package/{src/codemods → codemods}/transforms/v0.1.8/rename-avatar-size-scale.mjs +15 -10
  110. package/docs/internationalization.doc.mjs +92 -46
  111. package/{src/commands → lib/agent-docs}/agent-docs.mjs +30 -11
  112. package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
  113. package/{src/lib → lib}/component-discovery.mjs +44 -2
  114. package/{src/lib → lib}/component-format.mjs +65 -24
  115. package/{src/lib → lib}/component-loader.mjs +27 -13
  116. package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
  117. package/{src/lib → lib}/error-codes.test.mjs +1 -1
  118. package/{src/lib → lib}/hook-discovery.mjs +14 -1
  119. package/{src/lib → lib}/hook-format.mjs +29 -5
  120. package/{src/lib → lib}/integration-warnings.mjs +2 -2
  121. package/{src/lib → lib}/integrations.mjs +20 -0
  122. package/{src/lib → lib}/integrations.test.mjs +1 -1
  123. package/{src/lib → lib}/json-contract.test.mjs +1 -1
  124. package/{src/lib → lib}/json-shim.mjs +10 -5
  125. package/{src/lib → lib}/json-shim.test.mjs +1 -1
  126. package/{src/lib → lib}/levenshtein.mjs +6 -0
  127. package/{src/lib → lib}/manifest.mjs +7 -5
  128. package/{src/lib → lib}/manifest.test.mjs +2 -2
  129. package/{src/lib → lib}/module-loader.mjs +1 -0
  130. package/{src/lib → lib}/package-scanner.mjs +47 -0
  131. package/{src/lib → lib}/project.mjs +48 -18
  132. package/{src/lib → lib}/project.test.mjs +1 -1
  133. package/{src/lib → lib}/resolve-theme.mjs +5 -0
  134. package/{src/lib → lib}/string-utils.mjs +15 -0
  135. package/{src/lib → lib}/term-log.mjs +12 -3
  136. package/{src/lib → lib}/xle/browser.mjs +18 -8
  137. package/{src/lib → lib}/xle/expand.mjs +155 -22
  138. package/{src/lib → lib}/xle/parse.mjs +119 -13
  139. package/{src/lib → lib}/xle/print.mjs +54 -14
  140. package/{src/lib → lib}/xle/registry-core.mjs +28 -3
  141. package/{src/lib → lib}/xle/registry.mjs +9 -4
  142. package/{src/lib → lib}/xle/splice.mjs +13 -2
  143. package/{src/lib → lib}/xle/validate.mjs +95 -14
  144. package/lib/xle/xle-ast.d.ts +214 -0
  145. package/package.json +33 -26
  146. package/scripts/postinstall.mjs +4 -4
  147. package/templates/blocks/components/Avatar/AvatarShowcase.tsx +1 -1
  148. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
  149. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
  150. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
  151. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
  152. package/{src/types → types}/api.contract.assert.ts +17 -8
  153. package/{src/types → types}/api.d.ts +106 -0
  154. package/{src/types → types}/base.d.ts +17 -2
  155. package/types/build.d.ts +53 -0
  156. package/types/codemod.d.ts +166 -0
  157. package/{src/types → types}/component.d.ts +1 -1
  158. package/{src/types → types}/discover.d.ts +1 -1
  159. package/{src/types → types}/docs.d.ts +1 -4
  160. package/{src/types → types}/hook.d.ts +1 -1
  161. package/types/jscodeshift.d.ts +19 -0
  162. package/types/layout.d.ts +74 -0
  163. package/types/theme.d.ts +53 -0
  164. package/{src/types → types}/upgrade.d.ts +8 -1
  165. package/{src/utils → utils}/paths.mjs +4 -1
  166. package/src/commands/swizzle.mjs +0 -417
  167. package/src/types/build.d.ts +0 -23
  168. package/src/types/codemod.d.ts +0 -81
  169. package/src/types/theme.d.ts +0 -23
  170. /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
  171. /package/{src/api → api}/error.mjs +0 -0
  172. /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
  173. /package/{src/api → api/template}/template.test.mjs +0 -0
  174. /package/{src → authoring}/codemod.test.mjs +0 -0
  175. /package/{src → authoring}/config.mjs +0 -0
  176. /package/{src → authoring}/integration.mjs +0 -0
  177. /package/{src → authoring}/template.test.mjs +0 -0
  178. /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
  179. /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
  180. /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
  181. /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
  182. /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
  183. /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
  184. /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
  185. /package/{src → cli}/commands/cli-postinstall.test.mjs +0 -0
  186. /package/{src → cli}/commands/component.test.mjs +0 -0
  187. /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
  188. /package/{src → cli}/commands/init.next-steps.test.mjs +0 -0
  189. /package/{src → cli}/commands/interactive-guard.test.mjs +0 -0
  190. /package/{src → cli}/commands/json-contract.test.mjs +0 -0
  191. /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
  192. /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
  193. /package/{src → cli}/commands/template.test.mjs +0 -0
  194. /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
  195. /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
  196. /package/{src → cli}/update-hint-commands.test.mjs +0 -0
  197. /package/{src/codemods → codemods}/__tests__/registry.test.mjs +0 -0
  198. /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
  199. /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
  200. /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
  201. /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
  202. /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
  203. /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
  204. /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
  205. /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
  206. /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
  207. /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
  208. /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
  209. /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
  210. /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
  211. /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
  212. /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
  213. /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
  214. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
  215. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
  216. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
  217. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
  218. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
  219. /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
  220. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
  221. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
  222. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
  223. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
  224. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
  225. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
  226. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
  227. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
  228. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
  229. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
  230. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
  231. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
  232. /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
  233. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
  234. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
  235. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
  236. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
  237. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
  238. /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
  239. /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
  240. /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
  241. /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
  242. /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
  243. /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
  244. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +0 -0
  245. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
  246. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
  247. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +0 -0
  248. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
  249. /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
  250. /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
  251. /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
  252. /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
  253. /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
  254. /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
  255. /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
  256. /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
  257. /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
  258. /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
  259. /package/{src/codemods → codemods}/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +0 -0
  260. /package/{src/codemods → codemods}/transforms/v0.1.8/index.mjs +0 -0
  261. /package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +0 -0
  262. /package/{src/lib → lib}/cli-error.mjs +0 -0
  263. /package/{src/lib → lib}/cli-error.test.mjs +0 -0
  264. /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
  265. /package/{src/lib → lib}/component-format.test.mjs +0 -0
  266. /package/{src/lib → lib}/component-loader.test.mjs +0 -0
  267. /package/{src/lib → lib}/config-cache.mjs +0 -0
  268. /package/{src/lib → lib}/config-cache.test.mjs +0 -0
  269. /package/{src/lib → lib}/config-schema.mjs +0 -0
  270. /package/{src/lib → lib}/error-codes.mjs +0 -0
  271. /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
  272. /package/{src/lib → lib}/json.mjs +0 -0
  273. /package/{src/lib → lib}/module-loader.test.mjs +0 -0
  274. /package/{src/lib → lib}/node-version.mjs +0 -0
  275. /package/{src/lib → lib}/node-version.test.mjs +0 -0
  276. /package/{src/lib → lib}/parse.mjs +0 -0
  277. /package/{src/lib → lib}/site.mjs +0 -0
  278. /package/{src/lib → lib}/xle/browser.d.ts +0 -0
  279. /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
  280. /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
  281. /package/{src/schemas → schemas}/template-schema.mjs +0 -0
  282. /package/{src/types → types}/config.d.ts +0 -0
  283. /package/{src/types → types}/doc.d.ts +0 -0
  284. /package/{src/types → types}/doctor.d.ts +0 -0
  285. /package/{src/types → types}/error-codes.d.ts +0 -0
  286. /package/{src/types → types}/index.d.ts +0 -0
  287. /package/{src/types → types}/integration.d.ts +0 -0
  288. /package/{src/types → types}/manifest.d.ts +0 -0
  289. /package/{src/types → types}/search.d.ts +0 -0
  290. /package/{src/types → types}/swizzle.d.ts +0 -0
  291. /package/{src/types → types}/template-api.d.ts +0 -0
  292. /package/{src/types → types}/template.d.ts +0 -0
  293. /package/{src/types → types}/validate-integration.d.ts +0 -0
  294. /package/{src/utils → utils}/github.mjs +0 -0
  295. /package/{src/utils → utils}/package-manager.mjs +0 -0
  296. /package/{src/utils → utils}/package-manager.test.mjs +0 -0
  297. /package/{src/utils → utils}/path-safety.mjs +0 -0
  298. /package/{src/utils → utils}/path-safety.test.mjs +0 -0
  299. /package/{src/utils → utils}/paths.test.mjs +0 -0
  300. /package/{src/utils → utils}/semver.mjs +0 -0
  301. /package/{src/utils → utils}/semver.test.mjs +0 -0
  302. /package/{src/utils → utils}/update-check.mjs +0 -0
  303. /package/{src/utils → utils}/update-check.test.mjs +0 -0
@@ -23,24 +23,30 @@ const TITLE_PROP_COMPONENTS = new Set([
23
23
  'XDSTopNavHeading',
24
24
  ]);
25
25
 
26
+ /** @type {Record<string, string>} */
26
27
  const IMPORT_RENAMES = {
27
28
  XDSTopNavTitle: 'XDSTopNavHeading',
28
29
  XDSTopNavTitleProps: 'XDSTopNavHeadingProps',
29
30
  };
30
31
 
32
+ /**
33
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
34
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
35
+ * @returns {string | null | undefined}
36
+ */
31
37
  export default function transformer(file, api) {
32
38
  const j = api.jscodeshift;
33
39
  const root = j(file.source);
34
40
  let hasChanges = false;
35
41
 
36
42
  // 1. Rename `title` prop to `heading` on target components
37
- root.find(j.JSXOpeningElement).forEach((path) => {
43
+ root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
38
44
  const name = path.node.name;
39
45
  if (name.type !== 'JSXIdentifier' || !TITLE_PROP_COMPONENTS.has(name.name)) {
40
46
  return;
41
47
  }
42
48
 
43
- path.node.attributes.forEach((attr) => {
49
+ path.node.attributes.forEach((/** @type {any} */ attr) => {
44
50
  if (attr.type === 'JSXAttribute' && attr.name.name === 'title') {
45
51
  attr.name.name = 'heading';
46
52
  hasChanges = true;
@@ -49,13 +55,13 @@ export default function transformer(file, api) {
49
55
  });
50
56
 
51
57
  // 2. Rename <XDSTopNavTitle> to <XDSTopNavHeading> (opening and closing tags)
52
- root.find(j.JSXIdentifier, {name: 'XDSTopNavTitle'}).forEach((path) => {
58
+ root.find(j.JSXIdentifier, {name: 'XDSTopNavTitle'}).forEach((/** @type {any} */ path) => {
53
59
  path.node.name = 'XDSTopNavHeading';
54
60
  hasChanges = true;
55
61
  });
56
62
 
57
63
  // 3. Rename import specifiers: XDSTopNavTitle → XDSTopNavHeading, XDSTopNavTitleProps → XDSTopNavHeadingProps
58
- root.find(j.ImportSpecifier).forEach((path) => {
64
+ root.find(j.ImportSpecifier).forEach((/** @type {any} */ path) => {
59
65
  const imported = path.node.imported;
60
66
  if (imported.type === 'Identifier' && imported.name in IMPORT_RENAMES) {
61
67
  const oldName = imported.name;
@@ -32,6 +32,11 @@ const RENAMES = [
32
32
  },
33
33
  ];
34
34
 
35
+ /**
36
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
37
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
38
+ * @returns {string | null | undefined}
39
+ */
35
40
  export default function transformer(file, api) {
36
41
  const j = api.jscodeshift;
37
42
  const root = j(file.source);
@@ -42,8 +47,8 @@ export default function transformer(file, api) {
42
47
  .find(j.JSXOpeningElement, {
43
48
  name: {name: component},
44
49
  })
45
- .forEach((path) => {
46
- path.node.attributes.forEach((attr) => {
50
+ .forEach((/** @type {any} */ path) => {
51
+ path.node.attributes.forEach((/** @type {any} */ attr) => {
47
52
  if (attr.type === 'JSXAttribute' && attr.name.name === oldProp) {
48
53
  attr.name.name = newProp;
49
54
  hasChanges = true;
@@ -33,6 +33,11 @@ const SIMPLE_RENAMES = [
33
33
  */
34
34
  const MERGE_COMPONENTS = ['XDSHoverCard', 'XDSTooltip'];
35
35
 
36
+ /**
37
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
38
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
39
+ * @returns {string | null | undefined}
40
+ */
36
41
  export default function transformer(file, api) {
37
42
  const j = api.jscodeshift;
38
43
  const root = j(file.source);
@@ -44,8 +49,8 @@ export default function transformer(file, api) {
44
49
  .find(j.JSXOpeningElement, {
45
50
  name: {name: component},
46
51
  })
47
- .forEach((path) => {
48
- path.node.attributes.forEach((attr) => {
52
+ .forEach((/** @type {any} */ path) => {
53
+ path.node.attributes.forEach((/** @type {any} */ attr) => {
49
54
  if (attr.type === 'JSXAttribute' && attr.name.name === oldProp) {
50
55
  attr.name.name = 'onOpenChange';
51
56
  hasChanges = true;
@@ -60,13 +65,13 @@ export default function transformer(file, api) {
60
65
  .find(j.JSXOpeningElement, {
61
66
  name: {name: component},
62
67
  })
63
- .forEach((path) => {
68
+ .forEach((/** @type {any} */ path) => {
64
69
  const attrs = path.node.attributes;
65
70
  const onShowAttr = attrs.find(
66
- (a) => a.type === 'JSXAttribute' && a.name.name === 'onShow',
71
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'onShow',
67
72
  );
68
73
  const onHideAttr = attrs.find(
69
- (a) => a.type === 'JSXAttribute' && a.name.name === 'onHide',
74
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'onHide',
70
75
  );
71
76
 
72
77
  if (onShowAttr && onHideAttr) {
@@ -19,6 +19,11 @@ export const meta = {
19
19
  pr: '#706',
20
20
  };
21
21
 
22
+ /**
23
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
24
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
25
+ * @returns {string | null | undefined}
26
+ */
22
27
  export default function transformer(file, api) {
23
28
  const j = api.jscodeshift;
24
29
  const root = j(file.source);
@@ -28,7 +33,7 @@ export default function transformer(file, api) {
28
33
  .find(j.JSXElement, {
29
34
  openingElement: {name: {name: 'XDSBadge'}},
30
35
  })
31
- .forEach((path) => {
36
+ .forEach((/** @type {any} */ path) => {
32
37
  const {children} = path.node;
33
38
 
34
39
  // Skip if already self-closing or no children
@@ -36,7 +41,7 @@ export default function transformer(file, api) {
36
41
 
37
42
  // Filter out whitespace-only JSXText nodes
38
43
  const meaningful = children.filter(
39
- (c) => !(c.type === 'JSXText' && !c.value.trim()),
44
+ (/** @type {any} */ c) => !(c.type === 'JSXText' && !c.value.trim()),
40
45
  );
41
46
 
42
47
  // Only transform single-child cases
@@ -36,6 +36,11 @@ const APPSHELL_DEPRECATED_PROPS = [
36
36
  'defaultIsSideNavCollapsed',
37
37
  ];
38
38
 
39
+ /**
40
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
41
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
42
+ * @returns {string | null | undefined}
43
+ */
39
44
  export default function transformer(file, api) {
40
45
  const j = api.jscodeshift;
41
46
  const root = j(file.source);
@@ -46,16 +51,17 @@ export default function transformer(file, api) {
46
51
  .find(j.JSXOpeningElement, {
47
52
  name: {name: 'XDSSideNav'},
48
53
  })
49
- .forEach((path) => {
54
+ .forEach((/** @type {any} */ path) => {
50
55
  const attrs = path.node.attributes;
51
56
 
52
57
  // Find isCollapsible
53
58
  const isCollapsibleIdx = attrs.findIndex(
54
- (a) => a.type === 'JSXAttribute' && a.name.name === 'isCollapsible',
59
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name.name === 'isCollapsible',
55
60
  );
56
61
  if (isCollapsibleIdx === -1) return;
57
62
 
58
63
  // Collect all collapse-related props
64
+ /** @type {Record<string, any>} */
59
65
  const collapseProps = {};
60
66
  const indicesToRemove = [];
61
67
 
@@ -129,7 +135,7 @@ export default function transformer(file, api) {
129
135
  .find(j.JSXOpeningElement, {
130
136
  name: {name: 'XDSAppShell'},
131
137
  })
132
- .forEach((path) => {
138
+ .forEach((/** @type {any} */ path) => {
133
139
  const attrs = path.node.attributes;
134
140
  for (let i = attrs.length - 1; i >= 0; i--) {
135
141
  const attr = attrs[i];
@@ -22,6 +22,7 @@ export const meta = {
22
22
  'Renames --radius-inner/content/element/container/page to --radius-0/1/2/3/4.',
23
23
  };
24
24
 
25
+ /** @type {Record<string, string>} */
25
26
  const TOKEN_MAP = {
26
27
  '--radius-inner': '--radius-0',
27
28
  '--radius-content': '--radius-1',
@@ -38,17 +39,22 @@ const OLD_TOKENS_PATTERN = new RegExp(
38
39
  'g',
39
40
  );
40
41
 
41
- function replaceTokens(str) {
42
- return str.replace(OLD_TOKENS_PATTERN, (match) => TOKEN_MAP[match] || match);
42
+ function replaceTokens(/** @type {any} */ str) {
43
+ return str.replace(OLD_TOKENS_PATTERN, (/** @type {any} */ match) => TOKEN_MAP[match] || match);
43
44
  }
44
45
 
46
+ /**
47
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
48
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
49
+ * @returns {string | null | undefined}
50
+ */
45
51
  export default function transformer(file, api) {
46
52
  const j = api.jscodeshift;
47
53
  const root = j(file.source);
48
54
  let hasChanges = false;
49
55
 
50
56
  // Replace in string literals (StringLiteral or Literal with string value)
51
- const replaceInStringNode = (path) => {
57
+ const replaceInStringNode = (/** @type {any} */ path) => {
52
58
  if (typeof path.node.value !== 'string') return;
53
59
  const original = path.node.value;
54
60
  const replaced = replaceTokens(original);
@@ -59,14 +65,14 @@ export default function transformer(file, api) {
59
65
  };
60
66
 
61
67
  root.find(j.StringLiteral).forEach(replaceInStringNode);
62
- root.find(j.Literal).forEach((path) => {
68
+ root.find(j.Literal).forEach((/** @type {any} */ path) => {
63
69
  if (typeof path.node.value === 'string') {
64
70
  replaceInStringNode(path);
65
71
  }
66
72
  });
67
73
 
68
74
  // Replace in template literal quasis
69
- root.find(j.TemplateLiteral).forEach((path) => {
75
+ root.find(j.TemplateLiteral).forEach((/** @type {any} */ path) => {
70
76
  for (const quasi of path.node.quasis) {
71
77
  const original = quasi.value.raw;
72
78
  const replaced = replaceTokens(original);
@@ -34,6 +34,7 @@ export const meta = {
34
34
  'Renames --elevation-* to --shadow-base/menu/hover/dialog and --inset-shadow-border-*. Also migrates --shadow-1/2/3/4 from the brief numeric naming period.',
35
35
  };
36
36
 
37
+ /** @type {Record<string, string>} */
37
38
  const TOKEN_MAP = {
38
39
  '--elevation-input-hover-success': '--inset-shadow-border-positive',
39
40
  '--elevation-input-hover-warning': '--inset-shadow-border-warning',
@@ -49,6 +50,7 @@ const TOKEN_MAP = {
49
50
  '--shadow-4': '--shadow-dialog',
50
51
  };
51
52
 
53
+ /** @type {Record<string, string>} */
52
54
  const IDENTIFIER_MAP = {
53
55
  elevationDefaults: 'shadowDefaults',
54
56
  elevationVars: 'shadowVars',
@@ -64,16 +66,21 @@ const OLD_TOKENS_PATTERN = new RegExp(
64
66
  'g',
65
67
  );
66
68
 
67
- function replaceTokens(str) {
68
- return str.replace(OLD_TOKENS_PATTERN, (match) => TOKEN_MAP[match] || match);
69
+ function replaceTokens(/** @type {any} */ str) {
70
+ return str.replace(OLD_TOKENS_PATTERN, (/** @type {any} */ match) => TOKEN_MAP[match] || match);
69
71
  }
70
72
 
73
+ /**
74
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
75
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
76
+ * @returns {string | null | undefined}
77
+ */
71
78
  export default function transformer(file, api) {
72
79
  const j = api.jscodeshift;
73
80
  const root = j(file.source);
74
81
  let hasChanges = false;
75
82
 
76
- const replaceInStringNode = (path) => {
83
+ const replaceInStringNode = (/** @type {any} */ path) => {
77
84
  if (typeof path.node.value !== 'string') return;
78
85
  const original = path.node.value;
79
86
  const replaced = replaceTokens(original);
@@ -84,11 +91,11 @@ export default function transformer(file, api) {
84
91
  };
85
92
 
86
93
  root.find(j.StringLiteral).forEach(replaceInStringNode);
87
- root.find(j.Literal).forEach((path) => {
94
+ root.find(j.Literal).forEach((/** @type {any} */ path) => {
88
95
  if (typeof path.node.value === 'string') replaceInStringNode(path);
89
96
  });
90
97
 
91
- root.find(j.TemplateLiteral).forEach((path) => {
98
+ root.find(j.TemplateLiteral).forEach((/** @type {any} */ path) => {
92
99
  for (const quasi of path.node.quasis) {
93
100
  const originalRaw = quasi.value.raw;
94
101
  const replacedRaw = replaceTokens(originalRaw);
@@ -100,7 +107,7 @@ export default function transformer(file, api) {
100
107
  }
101
108
  });
102
109
 
103
- root.find(j.Identifier).forEach((path) => {
110
+ root.find(j.Identifier).forEach((/** @type {any} */ path) => {
104
111
  if (Object.hasOwn(IDENTIFIER_MAP, path.node.name)) {
105
112
  path.node.name = IDENTIFIER_MAP[path.node.name];
106
113
  hasChanges = true;
@@ -16,6 +16,7 @@ export const meta = {
16
16
  'Replaces semantic radius prop values (inner, content, element, container) with numeric equivalents (0, 1, 2, 3).',
17
17
  };
18
18
 
19
+ /** @type {Record<string, number>} */
19
20
  const RADIUS_MAP = {
20
21
  inner: 0,
21
22
  content: 1,
@@ -23,6 +24,11 @@ const RADIUS_MAP = {
23
24
  container: 3,
24
25
  };
25
26
 
27
+ /**
28
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
29
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
30
+ * @returns {string | null | undefined}
31
+ */
26
32
  export default function transformer(file, api) {
27
33
  const j = api.jscodeshift;
28
34
  const root = j(file.source);
@@ -32,7 +38,7 @@ export default function transformer(file, api) {
32
38
  .find(j.JSXOpeningElement, {
33
39
  name: {name: 'XDSSkeleton'},
34
40
  })
35
- .forEach((path) => {
41
+ .forEach((/** @type {any} */ path) => {
36
42
  const attrs = path.node.attributes;
37
43
  for (const attr of attrs) {
38
44
  if (attr.type !== 'JSXAttribute') continue;
@@ -66,6 +66,7 @@ export const meta = {
66
66
 
67
67
  // Ordered longest-first to prevent partial matches
68
68
  // (e.g. --color-educational-deemphasized must match before --color-educational)
69
+ /** @type {Record<string, string>} */
69
70
  const TOKEN_MAP = {
70
71
  '--color-educational-deemphasized': '--color-info-muted',
71
72
  '--color-divider-high-contrast': '--color-border-strong',
@@ -114,17 +115,22 @@ const OLD_TOKENS_PATTERN = new RegExp(
114
115
  'g',
115
116
  );
116
117
 
117
- function replaceTokens(str) {
118
- return str.replace(OLD_TOKENS_PATTERN, (match) => TOKEN_MAP[match] || match);
118
+ function replaceTokens(/** @type {any} */ str) {
119
+ return str.replace(OLD_TOKENS_PATTERN, (/** @type {any} */ match) => TOKEN_MAP[match] || match);
119
120
  }
120
121
 
122
+ /**
123
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
124
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
125
+ * @returns {string | null | undefined}
126
+ */
121
127
  export default function transformer(file, api) {
122
128
  const j = api.jscodeshift;
123
129
  const root = j(file.source);
124
130
  let hasChanges = false;
125
131
 
126
132
  // Replace in string literals (StringLiteral or Literal with string value)
127
- const replaceInStringNode = (path) => {
133
+ const replaceInStringNode = (/** @type {any} */ path) => {
128
134
  if (typeof path.node.value !== 'string') return;
129
135
  const original = path.node.value;
130
136
  const replaced = replaceTokens(original);
@@ -135,14 +141,14 @@ export default function transformer(file, api) {
135
141
  };
136
142
 
137
143
  root.find(j.StringLiteral).forEach(replaceInStringNode);
138
- root.find(j.Literal).forEach((path) => {
144
+ root.find(j.Literal).forEach((/** @type {any} */ path) => {
139
145
  if (typeof path.node.value === 'string') {
140
146
  replaceInStringNode(path);
141
147
  }
142
148
  });
143
149
 
144
150
  // Replace in template literal quasis
145
- root.find(j.TemplateLiteral).forEach((path) => {
151
+ root.find(j.TemplateLiteral).forEach((/** @type {any} */ path) => {
146
152
  for (const quasi of path.node.quasis) {
147
153
  const original = quasi.value.raw;
148
154
  const replaced = replaceTokens(original);
@@ -20,6 +20,11 @@ export const meta = {
20
20
  pr: '#814',
21
21
  };
22
22
 
23
+ /**
24
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
25
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
26
+ * @returns {string | null | undefined}
27
+ */
23
28
  export default function transformer(file, api) {
24
29
  const j = api.jscodeshift;
25
30
  const root = j(file.source);
@@ -30,8 +35,8 @@ export default function transformer(file, api) {
30
35
  .find(j.JSXOpeningElement, {
31
36
  name: {name: 'XDSBanner'},
32
37
  })
33
- .forEach((path) => {
34
- path.node.attributes.forEach((attr) => {
38
+ .forEach((/** @type {any} */ path) => {
39
+ path.node.attributes.forEach((/** @type {any} */ attr) => {
35
40
  if (attr.type === 'JSXAttribute' && attr.name.name === 'variant') {
36
41
  attr.name.name = 'container';
37
42
  hasChanges = true;
@@ -40,7 +45,7 @@ export default function transformer(file, api) {
40
45
  });
41
46
 
42
47
  // 2. Rename type references: XDSBannerVariant → XDSBannerContainer
43
- root.find(j.Identifier, {name: 'XDSBannerVariant'}).forEach((path) => {
48
+ root.find(j.Identifier, {name: 'XDSBannerVariant'}).forEach((/** @type {any} */ path) => {
44
49
  path.node.name = 'XDSBannerContainer';
45
50
  hasChanges = true;
46
51
  });
@@ -50,6 +50,7 @@ export const meta = {
50
50
  // Token string renames (CSS custom property names)
51
51
  // =============================================================================
52
52
 
53
+ /** @type {Record<string, string>} */
53
54
  const TOKEN_MAP = {
54
55
  // Color — Core Semantic
55
56
  '--color-secondary': '--color-neutral',
@@ -195,6 +196,7 @@ const TOKEN_MAP = {
195
196
  // JS identifier renames (import names, variable references)
196
197
  // =============================================================================
197
198
 
199
+ /** @type {Record<string, string>} */
198
200
  const IDENTIFIER_MAP = {
199
201
  lineHeightVars: 'typeScaleVars',
200
202
  lineHeightDefaults: 'typeScaleDefaults',
@@ -213,21 +215,26 @@ const OLD_TOKENS_PATTERN = new RegExp(
213
215
  'g',
214
216
  );
215
217
 
216
- function replaceTokens(str) {
217
- return str.replace(OLD_TOKENS_PATTERN, (match) => TOKEN_MAP[match] || match);
218
+ function replaceTokens(/** @type {any} */ str) {
219
+ return str.replace(OLD_TOKENS_PATTERN, (/** @type {any} */ match) => TOKEN_MAP[match] || match);
218
220
  }
219
221
 
220
222
  // =============================================================================
221
223
  // Transformer
222
224
  // =============================================================================
223
225
 
226
+ /**
227
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
228
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
229
+ * @returns {string | null | undefined}
230
+ */
224
231
  export default function transformer(file, api) {
225
232
  const j = api.jscodeshift;
226
233
  const root = j(file.source);
227
234
  let hasChanges = false;
228
235
 
229
236
  // --- Pass 1: Rename token strings in string literals ---
230
- const replaceInStringNode = (path) => {
237
+ const replaceInStringNode = (/** @type {any} */ path) => {
231
238
  if (typeof path.node.value !== 'string') return;
232
239
  const original = path.node.value;
233
240
  const replaced = replaceTokens(original);
@@ -238,14 +245,14 @@ export default function transformer(file, api) {
238
245
  };
239
246
 
240
247
  root.find(j.StringLiteral).forEach(replaceInStringNode);
241
- root.find(j.Literal).forEach((path) => {
248
+ root.find(j.Literal).forEach((/** @type {any} */ path) => {
242
249
  if (typeof path.node.value === 'string') {
243
250
  replaceInStringNode(path);
244
251
  }
245
252
  });
246
253
 
247
254
  // --- Pass 2: Rename token strings in template literals ---
248
- root.find(j.TemplateLiteral).forEach((path) => {
255
+ root.find(j.TemplateLiteral).forEach((/** @type {any} */ path) => {
249
256
  for (const quasi of path.node.quasis) {
250
257
  const original = quasi.value.raw;
251
258
  const replaced = replaceTokens(original);
@@ -263,7 +270,7 @@ export default function transformer(file, api) {
263
270
  // Special handling for imports: if the target name already exists as an import
264
271
  // specifier in the same declaration, remove the old specifier instead of renaming
265
272
  // it (avoids duplicate identifier declarations).
266
- root.find(j.ImportSpecifier).forEach((importPath) => {
273
+ root.find(j.ImportSpecifier).forEach((/** @type {any} */ importPath) => {
267
274
  const oldName = importPath.node.imported.name;
268
275
  if (!Object.hasOwn(IDENTIFIER_MAP, oldName)) return;
269
276
 
@@ -271,7 +278,7 @@ export default function transformer(file, api) {
271
278
  const declaration = importPath.parent.node;
272
279
  const siblings = declaration.specifiers || [];
273
280
  const targetExists = siblings.some(
274
- (s) =>
281
+ (/** @type {any} */ s) =>
275
282
  s !== importPath.node &&
276
283
  s.type === 'ImportSpecifier' &&
277
284
  s.imported.name === newName,
@@ -295,7 +302,7 @@ export default function transformer(file, api) {
295
302
  });
296
303
 
297
304
  // Rename remaining non-import identifier references
298
- root.find(j.Identifier).forEach((path) => {
305
+ root.find(j.Identifier).forEach((/** @type {any} */ path) => {
299
306
  if (!Object.hasOwn(IDENTIFIER_MAP, path.node.name)) return;
300
307
  // Skip import specifiers (already handled above)
301
308
  if (path.parent.node.type === 'ImportSpecifier') return;
@@ -23,13 +23,18 @@ export const meta = {
23
23
  pr: '#895',
24
24
  };
25
25
 
26
+ /**
27
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
28
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
29
+ * @returns {string | null | undefined}
30
+ */
26
31
  export default function transformer(file, api) {
27
32
  const j = api.jscodeshift;
28
33
  const root = j(file.source);
29
34
  let hasChanges = false;
30
35
 
31
36
  // 1. Rename JSX prop: <XDSButton endSlot={...} /> → <XDSButton endContent={...} />
32
- root.find(j.JSXAttribute, {name: {name: 'endSlot'}}).forEach((path) => {
37
+ root.find(j.JSXAttribute, {name: {name: 'endSlot'}}).forEach((/** @type {any} */ path) => {
33
38
  path.node.name.name = 'endContent';
34
39
  hasChanges = true;
35
40
  });
@@ -37,7 +42,7 @@ export default function transformer(file, api) {
37
42
  // 2. Rename in all Identifier nodes named 'endSlot' that are object keys
38
43
  // This covers both Property and ObjectProperty (parser-dependent),
39
44
  // object literals, destructuring patterns, etc.
40
- root.find(j.Identifier, {name: 'endSlot'}).forEach((path) => {
45
+ root.find(j.Identifier, {name: 'endSlot'}).forEach((/** @type {any} */ path) => {
41
46
  const parent = path.parent.node;
42
47
 
43
48
  // Object property key: { endSlot: value } or { endSlot } (shorthand)
@@ -68,7 +68,7 @@ const XDS_CORE_SOURCE = /^@xds\/core(\/.*)?$/;
68
68
  * Compute the bare (unprefixed) name for an XDS-prefixed identifier.
69
69
  * Returns null if the name is not XDS-prefixed in a renameable way.
70
70
  */
71
- function bareName(name) {
71
+ function bareName(/** @type {any} */ name) {
72
72
  if (name.startsWith('useXDS') && name.length > 'useXDS'.length) {
73
73
  return 'use' + name.slice('useXDS'.length);
74
74
  }
@@ -91,7 +91,7 @@ function bareName(name) {
91
91
  const MOCK_METHOD_NAMES = new Set(['mock', 'doMock']);
92
92
  const MOCK_OBJECT_NAMES = new Set(['vi', 'jest']);
93
93
 
94
- function isMockCallee(callee) {
94
+ function isMockCallee(/** @type {any} */ callee) {
95
95
  if (
96
96
  callee.type === 'MemberExpression' &&
97
97
  !callee.computed &&
@@ -105,7 +105,7 @@ function isMockCallee(callee) {
105
105
  return callee.type === 'Identifier' && callee.name === 'mock';
106
106
  }
107
107
 
108
- function isXdsCoreMockCall(node) {
108
+ function isXdsCoreMockCall(/** @type {any} */ node) {
109
109
  if (node.type !== 'CallExpression' || !isMockCallee(node.callee))
110
110
  return false;
111
111
  const [arg] = node.arguments;
@@ -119,7 +119,7 @@ function isXdsCoreMockCall(node) {
119
119
  // Rename XDS-prefixed object-property KEYS (not values, not nested objects)
120
120
  // within the given AST subtree. Used only on a recognized @xds/core mock
121
121
  // factory, so the scope guard lives at the call site.
122
- function renameMockFactoryKeys(node, seen, onChange) {
122
+ function renameMockFactoryKeys(/** @type {any} */ node, /** @type {any} */ seen, /** @type {any} */ onChange) {
123
123
  if (!node || typeof node !== 'object') return;
124
124
  if (Array.isArray(node)) {
125
125
  for (const child of node) renameMockFactoryKeys(child, seen, onChange);
@@ -158,6 +158,11 @@ function renameMockFactoryKeys(node, seen, onChange) {
158
158
  }
159
159
  }
160
160
 
161
+ /**
162
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
163
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
164
+ * @returns {string | null | undefined}
165
+ */
161
166
  export default function transformer(file, api) {
162
167
  const j = api.jscodeshift;
163
168
  const root = j(file.source);
@@ -176,12 +181,12 @@ export default function transformer(file, api) {
176
181
  // declaration. We gather: import locals, and top-level function/class/var
177
182
  // declaration names (the realistic collision sources for component wrappers).
178
183
  const existingBindings = new Set();
179
- root.find(j.ImportDeclaration).forEach(path => {
184
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
180
185
  for (const spec of path.node.specifiers || []) {
181
186
  if (spec.local && spec.local.name) existingBindings.add(spec.local.name);
182
187
  }
183
188
  });
184
- const collectDeclName = node => {
189
+ const collectDeclName = (/** @type {any} */ node) => {
185
190
  if (!node) return;
186
191
  if (
187
192
  (node.type === 'FunctionDeclaration' ||
@@ -195,7 +200,7 @@ export default function transformer(file, api) {
195
200
  }
196
201
  }
197
202
  };
198
- root.find(j.Program).forEach(path => {
203
+ root.find(j.Program).forEach((/** @type {any} */ path) => {
199
204
  for (const stmt of path.node.body) {
200
205
  collectDeclName(stmt);
201
206
  // Unwrap `export function X` / `export const X`.
@@ -209,11 +214,11 @@ export default function transformer(file, api) {
209
214
  });
210
215
 
211
216
  // 1. Rewrite import specifiers from @xds/core
212
- root.find(j.ImportDeclaration).forEach(path => {
217
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
213
218
  const source = path.node.source.value;
214
219
  if (typeof source !== 'string' || !XDS_CORE_SOURCE.test(source)) return;
215
220
 
216
- path.node.specifiers = (path.node.specifiers || []).map(spec => {
221
+ path.node.specifiers = (path.node.specifiers || []).map((/** @type {any} */ spec) => {
217
222
  if (spec.type !== 'ImportSpecifier') return spec; // default/namespace
218
223
  const importedName = spec.imported.name;
219
224
  const bare = bareName(importedName);
@@ -253,7 +258,7 @@ export default function transformer(file, api) {
253
258
  });
254
259
 
255
260
  // 2. Rewrite re-exports from @xds/core
256
- root.find(j.ExportNamedDeclaration).forEach(path => {
261
+ root.find(j.ExportNamedDeclaration).forEach((/** @type {any} */ path) => {
257
262
  if (!path.node.source) return;
258
263
  const source = path.node.source.value;
259
264
  if (typeof source !== 'string' || !XDS_CORE_SOURCE.test(source)) return;
@@ -279,7 +284,7 @@ export default function transformer(file, api) {
279
284
  // not a reference to an imported binding, so it must match the renamed export
280
285
  // name of the mocked module regardless of what the file imports.
281
286
  const seenMockNodes = new Set();
282
- root.find(j.CallExpression).forEach(path => {
287
+ root.find(j.CallExpression).forEach((/** @type {any} */ path) => {
283
288
  if (!isXdsCoreMockCall(path.node)) return;
284
289
  // Only walk the factory argument(s), never the module-path string.
285
290
  for (const arg of path.node.arguments.slice(1)) {
@@ -295,7 +300,7 @@ export default function transformer(file, api) {
295
300
 
296
301
  // 4. Rename references to renamed local bindings
297
302
  // Identifiers (type refs, value refs, etc.)
298
- root.find(j.Identifier).forEach(path => {
303
+ root.find(j.Identifier).forEach((/** @type {any} */ path) => {
299
304
  const newName = localRenames.get(path.node.name);
300
305
  if (!newName) return;
301
306
  // Skip object property keys like `{ XDSButton: ... }` (not a reference to
@@ -322,7 +327,7 @@ export default function transformer(file, api) {
322
327
  });
323
328
 
324
329
  // JSX element names: <XDSButton> -> <Button>
325
- root.find(j.JSXIdentifier).forEach(path => {
330
+ root.find(j.JSXIdentifier).forEach((/** @type {any} */ path) => {
326
331
  const newName = localRenames.get(path.node.name);
327
332
  if (newName) {
328
333
  path.node.name = newName;
@@ -344,7 +349,7 @@ export default function transformer(file, api) {
344
349
  // renamed binding. Renaming already-bare names is a no-op, so re-visiting a
345
350
  // node the earlier passes handled is harmless.
346
351
  const seenTypeNodes = new Set();
347
- const renameTypeReferences = node => {
352
+ const renameTypeReferences = (/** @type {any} */ node) => {
348
353
  if (!node || typeof node !== 'object') return;
349
354
  if (Array.isArray(node)) {
350
355
  for (const child of node) renameTypeReferences(child);