@openrewrite/recipes-react 0.2.9

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 (251) hide show
  1. package/dist/index.d.ts +4 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +130 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/migration/change-component-prop-value.d.ts +20 -0
  6. package/dist/migration/change-component-prop-value.d.ts.map +1 -0
  7. package/dist/migration/change-component-prop-value.js +217 -0
  8. package/dist/migration/change-component-prop-value.js.map +1 -0
  9. package/dist/react-native/view-prop-types.d.ts +8 -0
  10. package/dist/react-native/view-prop-types.d.ts.map +1 -0
  11. package/dist/react-native/view-prop-types.js +65 -0
  12. package/dist/react-native/view-prop-types.js.map +1 -0
  13. package/dist/react16/error-boundaries.d.ts +8 -0
  14. package/dist/react16/error-boundaries.d.ts.map +1 -0
  15. package/dist/react16/error-boundaries.js +42 -0
  16. package/dist/react16/error-boundaries.js.map +1 -0
  17. package/dist/react16/find-dom-node.d.ts +8 -0
  18. package/dist/react16/find-dom-node.d.ts.map +1 -0
  19. package/dist/react16/find-dom-node.js +48 -0
  20. package/dist/react16/find-dom-node.js.map +1 -0
  21. package/dist/react16/react-dom-factories.d.ts +8 -0
  22. package/dist/react16/react-dom-factories.d.ts.map +1 -0
  23. package/dist/react16/react-dom-factories.js +72 -0
  24. package/dist/react16/react-dom-factories.js.map +1 -0
  25. package/dist/react16/react-prop-types.d.ts +8 -0
  26. package/dist/react16/react-prop-types.d.ts.map +1 -0
  27. package/dist/react16/react-prop-types.js +69 -0
  28. package/dist/react16/react-prop-types.js.map +1 -0
  29. package/dist/react16/react-to-react-dom.d.ts +8 -0
  30. package/dist/react16/react-to-react-dom.d.ts.map +1 -0
  31. package/dist/react16/react-to-react-dom.js +97 -0
  32. package/dist/react16/react-to-react-dom.js.map +1 -0
  33. package/dist/react16/replace-create-factory.d.ts +8 -0
  34. package/dist/react16/replace-create-factory.d.ts.map +1 -0
  35. package/dist/react16/replace-create-factory.js +69 -0
  36. package/dist/react16/replace-create-factory.js.map +1 -0
  37. package/dist/react16/upgrade-to-react-16.d.ts +8 -0
  38. package/dist/react16/upgrade-to-react-16.d.ts.map +1 -0
  39. package/dist/react16/upgrade-to-react-16.js +41 -0
  40. package/dist/react16/upgrade-to-react-16.js.map +1 -0
  41. package/dist/react17/remove-event-persist.d.ts +8 -0
  42. package/dist/react17/remove-event-persist.d.ts.map +1 -0
  43. package/dist/react17/remove-event-persist.js +114 -0
  44. package/dist/react17/remove-event-persist.js.map +1 -0
  45. package/dist/react17/rename-unsafe-lifecycles.d.ts +8 -0
  46. package/dist/react17/rename-unsafe-lifecycles.d.ts.map +1 -0
  47. package/dist/react17/rename-unsafe-lifecycles.js +48 -0
  48. package/dist/react17/rename-unsafe-lifecycles.js.map +1 -0
  49. package/dist/react17/update-react-imports.d.ts +8 -0
  50. package/dist/react17/update-react-imports.d.ts.map +1 -0
  51. package/dist/react17/update-react-imports.js +40 -0
  52. package/dist/react17/update-react-imports.js.map +1 -0
  53. package/dist/react17/upgrade-to-react-17.d.ts +8 -0
  54. package/dist/react17/upgrade-to-react-17.d.ts.map +1 -0
  55. package/dist/react17/upgrade-to-react-17.js +37 -0
  56. package/dist/react17/upgrade-to-react-17.js.map +1 -0
  57. package/dist/react18/remove-unstable-batched-updates.d.ts +8 -0
  58. package/dist/react18/remove-unstable-batched-updates.d.ts.map +1 -0
  59. package/dist/react18/remove-unstable-batched-updates.js +170 -0
  60. package/dist/react18/remove-unstable-batched-updates.js.map +1 -0
  61. package/dist/react18/replace-reactdom-render.d.ts +8 -0
  62. package/dist/react18/replace-reactdom-render.d.ts.map +1 -0
  63. package/dist/react18/replace-reactdom-render.js +55 -0
  64. package/dist/react18/replace-reactdom-render.js.map +1 -0
  65. package/dist/react18/replace-render-callback.d.ts +8 -0
  66. package/dist/react18/replace-render-callback.d.ts.map +1 -0
  67. package/dist/react18/replace-render-callback.js +60 -0
  68. package/dist/react18/replace-render-callback.js.map +1 -0
  69. package/dist/react18/replace-unmount-component-at-node.d.ts +8 -0
  70. package/dist/react18/replace-unmount-component-at-node.d.ts.map +1 -0
  71. package/dist/react18/replace-unmount-component-at-node.js +54 -0
  72. package/dist/react18/replace-unmount-component-at-node.js.map +1 -0
  73. package/dist/react18/upgrade-to-react-18.d.ts +8 -0
  74. package/dist/react18/upgrade-to-react-18.d.ts.map +1 -0
  75. package/dist/react18/upgrade-to-react-18.js +39 -0
  76. package/dist/react18/upgrade-to-react-18.js.map +1 -0
  77. package/dist/react19/deprecated-react-types.d.ts +8 -0
  78. package/dist/react19/deprecated-react-types.d.ts.map +1 -0
  79. package/dist/react19/deprecated-react-types.js +135 -0
  80. package/dist/react19/deprecated-react-types.js.map +1 -0
  81. package/dist/react19/find-context-consumer.d.ts +9 -0
  82. package/dist/react19/find-context-consumer.d.ts.map +1 -0
  83. package/dist/react19/find-context-consumer.js +128 -0
  84. package/dist/react19/find-context-consumer.js.map +1 -0
  85. package/dist/react19/find-deprecated-reactdom-apis.d.ts +9 -0
  86. package/dist/react19/find-deprecated-reactdom-apis.d.ts.map +1 -0
  87. package/dist/react19/find-deprecated-reactdom-apis.js +132 -0
  88. package/dist/react19/find-deprecated-reactdom-apis.js.map +1 -0
  89. package/dist/react19/find-element-ref.d.ts +9 -0
  90. package/dist/react19/find-element-ref.d.ts.map +1 -0
  91. package/dist/react19/find-element-ref.js +88 -0
  92. package/dist/react19/find-element-ref.js.map +1 -0
  93. package/dist/react19/find-legacy-context-api.d.ts +9 -0
  94. package/dist/react19/find-legacy-context-api.d.ts.map +1 -0
  95. package/dist/react19/find-legacy-context-api.js +163 -0
  96. package/dist/react19/find-legacy-context-api.js.map +1 -0
  97. package/dist/react19/no-implicit-ref-callback-return.d.ts +8 -0
  98. package/dist/react19/no-implicit-ref-callback-return.d.ts.map +1 -0
  99. package/dist/react19/no-implicit-ref-callback-return.js +107 -0
  100. package/dist/react19/no-implicit-ref-callback-return.js.map +1 -0
  101. package/dist/react19/remove-context-provider.d.ts +8 -0
  102. package/dist/react19/remove-context-provider.d.ts.map +1 -0
  103. package/dist/react19/remove-context-provider.js +59 -0
  104. package/dist/react19/remove-context-provider.js.map +1 -0
  105. package/dist/react19/remove-forward-ref.d.ts +8 -0
  106. package/dist/react19/remove-forward-ref.d.ts.map +1 -0
  107. package/dist/react19/remove-forward-ref.js +73 -0
  108. package/dist/react19/remove-forward-ref.js.map +1 -0
  109. package/dist/react19/remove-prop-types.d.ts +8 -0
  110. package/dist/react19/remove-prop-types.d.ts.map +1 -0
  111. package/dist/react19/remove-prop-types.js +76 -0
  112. package/dist/react19/remove-prop-types.js.map +1 -0
  113. package/dist/react19/remove-react-fc.d.ts +8 -0
  114. package/dist/react19/remove-react-fc.d.ts.map +1 -0
  115. package/dist/react19/remove-react-fc.js +149 -0
  116. package/dist/react19/remove-react-fc.js.map +1 -0
  117. package/dist/react19/replace-act-import.d.ts +9 -0
  118. package/dist/react19/replace-act-import.d.ts.map +1 -0
  119. package/dist/react19/replace-act-import.js +34 -0
  120. package/dist/react19/replace-act-import.js.map +1 -0
  121. package/dist/react19/replace-default-props.d.ts +8 -0
  122. package/dist/react19/replace-default-props.d.ts.map +1 -0
  123. package/dist/react19/replace-default-props.js +195 -0
  124. package/dist/react19/replace-default-props.js.map +1 -0
  125. package/dist/react19/replace-react-shallow-renderer.d.ts +8 -0
  126. package/dist/react19/replace-react-shallow-renderer.d.ts.map +1 -0
  127. package/dist/react19/replace-react-shallow-renderer.js +69 -0
  128. package/dist/react19/replace-react-shallow-renderer.js.map +1 -0
  129. package/dist/react19/replace-reactdom-hydrate.d.ts +8 -0
  130. package/dist/react19/replace-reactdom-hydrate.d.ts.map +1 -0
  131. package/dist/react19/replace-reactdom-hydrate.js +55 -0
  132. package/dist/react19/replace-reactdom-hydrate.js.map +1 -0
  133. package/dist/react19/replace-string-ref.d.ts +8 -0
  134. package/dist/react19/replace-string-ref.d.ts.map +1 -0
  135. package/dist/react19/replace-string-ref.js +75 -0
  136. package/dist/react19/replace-string-ref.js.map +1 -0
  137. package/dist/react19/replace-use-form-state.d.ts +8 -0
  138. package/dist/react19/replace-use-form-state.d.ts.map +1 -0
  139. package/dist/react19/replace-use-form-state.js +54 -0
  140. package/dist/react19/replace-use-form-state.js.map +1 -0
  141. package/dist/react19/upgrade-to-react-19.d.ts +8 -0
  142. package/dist/react19/upgrade-to-react-19.d.ts.map +1 -0
  143. package/dist/react19/upgrade-to-react-19.js +59 -0
  144. package/dist/react19/upgrade-to-react-19.js.map +1 -0
  145. package/dist/react19/use-context-hook.d.ts +8 -0
  146. package/dist/react19/use-context-hook.d.ts.map +1 -0
  147. package/dist/react19/use-context-hook.js +54 -0
  148. package/dist/react19/use-context-hook.js.map +1 -0
  149. package/dist/react19/use-ref-required-initial.d.ts +8 -0
  150. package/dist/react19/use-ref-required-initial.d.ts.map +1 -0
  151. package/dist/react19/use-ref-required-initial.js +74 -0
  152. package/dist/react19/use-ref-required-initial.js.map +1 -0
  153. package/dist/refactoring/class-to-functional.d.ts +8 -0
  154. package/dist/refactoring/class-to-functional.d.ts.map +1 -0
  155. package/dist/refactoring/class-to-functional.js +205 -0
  156. package/dist/refactoring/class-to-functional.js.map +1 -0
  157. package/dist/refactoring/create-class-to-es6.d.ts +8 -0
  158. package/dist/refactoring/create-class-to-es6.d.ts.map +1 -0
  159. package/dist/refactoring/create-class-to-es6.js +289 -0
  160. package/dist/refactoring/create-class-to-es6.js.map +1 -0
  161. package/dist/refactoring/create-element-to-jsx.d.ts +8 -0
  162. package/dist/refactoring/create-element-to-jsx.d.ts.map +1 -0
  163. package/dist/refactoring/create-element-to-jsx.js +167 -0
  164. package/dist/refactoring/create-element-to-jsx.js.map +1 -0
  165. package/dist/refactoring/manual-bind-to-arrow.d.ts +8 -0
  166. package/dist/refactoring/manual-bind-to-arrow.d.ts.map +1 -0
  167. package/dist/refactoring/manual-bind-to-arrow.js +134 -0
  168. package/dist/refactoring/manual-bind-to-arrow.js.map +1 -0
  169. package/dist/refactoring/pure-render-mixin.d.ts +8 -0
  170. package/dist/refactoring/pure-render-mixin.d.ts.map +1 -0
  171. package/dist/refactoring/pure-render-mixin.js +253 -0
  172. package/dist/refactoring/pure-render-mixin.js.map +1 -0
  173. package/dist/refactoring/sort-comp.d.ts +8 -0
  174. package/dist/refactoring/sort-comp.d.ts.map +1 -0
  175. package/dist/refactoring/sort-comp.js +128 -0
  176. package/dist/refactoring/sort-comp.js.map +1 -0
  177. package/dist/search/find-hook-usage.d.ts +9 -0
  178. package/dist/search/find-hook-usage.d.ts.map +1 -0
  179. package/dist/search/find-hook-usage.js +262 -0
  180. package/dist/search/find-hook-usage.js.map +1 -0
  181. package/dist/search/find-prop-usage.d.ts +15 -0
  182. package/dist/search/find-prop-usage.d.ts.map +1 -0
  183. package/dist/search/find-prop-usage.js +177 -0
  184. package/dist/search/find-prop-usage.js.map +1 -0
  185. package/dist/search/find-react-component.d.ts +15 -0
  186. package/dist/search/find-react-component.d.ts.map +1 -0
  187. package/dist/search/find-react-component.js +260 -0
  188. package/dist/search/find-react-component.js.map +1 -0
  189. package/dist/search/find-server-rendering-usage.d.ts +9 -0
  190. package/dist/search/find-server-rendering-usage.d.ts.map +1 -0
  191. package/dist/search/find-server-rendering-usage.js +131 -0
  192. package/dist/search/find-server-rendering-usage.js.map +1 -0
  193. package/dist/simplify-object-pattern-property.d.ts +8 -0
  194. package/dist/simplify-object-pattern-property.d.ts.map +1 -0
  195. package/dist/simplify-object-pattern-property.js +59 -0
  196. package/dist/simplify-object-pattern-property.js.map +1 -0
  197. package/dist/simplify-react-imports.d.ts +8 -0
  198. package/dist/simplify-react-imports.d.ts.map +1 -0
  199. package/dist/simplify-react-imports.js +199 -0
  200. package/dist/simplify-react-imports.js.map +1 -0
  201. package/package.json +39 -0
  202. package/src/index.ts +149 -0
  203. package/src/migration/change-component-prop-value.ts +268 -0
  204. package/src/react-native/view-prop-types.ts +63 -0
  205. package/src/react16/error-boundaries.ts +46 -0
  206. package/src/react16/find-dom-node.ts +55 -0
  207. package/src/react16/react-dom-factories.ts +99 -0
  208. package/src/react16/react-prop-types.ts +71 -0
  209. package/src/react16/react-to-react-dom.ts +104 -0
  210. package/src/react16/replace-create-factory.ts +96 -0
  211. package/src/react16/upgrade-to-react-16.ts +37 -0
  212. package/src/react17/remove-event-persist.ts +121 -0
  213. package/src/react17/rename-unsafe-lifecycles.ts +57 -0
  214. package/src/react17/update-react-imports.ts +50 -0
  215. package/src/react17/upgrade-to-react-17.ts +30 -0
  216. package/src/react18/remove-unstable-batched-updates.ts +192 -0
  217. package/src/react18/replace-reactdom-render.ts +68 -0
  218. package/src/react18/replace-render-callback.ts +66 -0
  219. package/src/react18/replace-unmount-component-at-node.ts +66 -0
  220. package/src/react18/upgrade-to-react-18.ts +33 -0
  221. package/src/react19/deprecated-react-types.ts +120 -0
  222. package/src/react19/find-context-consumer.ts +127 -0
  223. package/src/react19/find-deprecated-reactdom-apis.ts +125 -0
  224. package/src/react19/find-element-ref.ts +86 -0
  225. package/src/react19/find-legacy-context-api.ts +157 -0
  226. package/src/react19/no-implicit-ref-callback-return.ts +123 -0
  227. package/src/react19/remove-context-provider.ts +87 -0
  228. package/src/react19/remove-forward-ref.ts +69 -0
  229. package/src/react19/remove-prop-types.ts +86 -0
  230. package/src/react19/remove-react-fc.ts +247 -0
  231. package/src/react19/replace-act-import.ts +36 -0
  232. package/src/react19/replace-default-props.ts +220 -0
  233. package/src/react19/replace-react-shallow-renderer.ts +75 -0
  234. package/src/react19/replace-reactdom-hydrate.ts +67 -0
  235. package/src/react19/replace-string-ref.ts +89 -0
  236. package/src/react19/replace-use-form-state.ts +66 -0
  237. package/src/react19/upgrade-to-react-19.ts +66 -0
  238. package/src/react19/use-context-hook.ts +67 -0
  239. package/src/react19/use-ref-required-initial.ts +75 -0
  240. package/src/refactoring/class-to-functional.ts +229 -0
  241. package/src/refactoring/create-class-to-es6.ts +309 -0
  242. package/src/refactoring/create-element-to-jsx.ts +200 -0
  243. package/src/refactoring/manual-bind-to-arrow.ts +139 -0
  244. package/src/refactoring/pure-render-mixin.ts +346 -0
  245. package/src/refactoring/sort-comp.ts +135 -0
  246. package/src/search/find-hook-usage.ts +226 -0
  247. package/src/search/find-prop-usage.ts +176 -0
  248. package/src/search/find-react-component.ts +254 -0
  249. package/src/search/find-server-rendering-usage.ts +120 -0
  250. package/src/simplify-object-pattern-property.ts +71 -0
  251. package/src/simplify-react-imports.ts +241 -0
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReplaceStringRef = void 0;
13
+ const rewrite_1 = require("@openrewrite/rewrite");
14
+ const javascript_1 = require("@openrewrite/rewrite/javascript");
15
+ const java_1 = require("@openrewrite/rewrite/java");
16
+ const javascript_2 = require("@openrewrite/rewrite/javascript");
17
+ class ReplaceStringRef extends rewrite_1.Recipe {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.name = "org.openrewrite.react.19.replace-string-ref";
21
+ this.displayName = "Replace string refs with callback refs";
22
+ this.description = "String refs are removed in React 19. This recipe converts them to callback refs.";
23
+ }
24
+ editor() {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return new class extends javascript_1.JavaScriptVisitor {
27
+ visitJsxAttribute(attribute, ctx) {
28
+ const _super = Object.create(null, {
29
+ visitJsxAttribute: { get: () => super.visitJsxAttribute }
30
+ });
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ let attr = yield _super.visitJsxAttribute.call(this, attribute, ctx);
33
+ if (attr.key.kind !== java_1.J.Kind.Identifier) {
34
+ return attr;
35
+ }
36
+ if (attr.key.simpleName !== 'ref') {
37
+ return attr;
38
+ }
39
+ if (!attr.value) {
40
+ return attr;
41
+ }
42
+ const valueExpr = attr.value.element;
43
+ if (valueExpr.kind !== java_1.J.Kind.Literal) {
44
+ return attr;
45
+ }
46
+ const literal = valueExpr;
47
+ if (typeof literal.value !== 'string') {
48
+ return attr;
49
+ }
50
+ const refName = literal.value;
51
+ const callbackExpr = yield (0, javascript_1.template) `(ref) => { this.refs.${(0, javascript_1.raw)(refName)} = ref; }`.apply(literal, this.cursor);
52
+ if (!callbackExpr) {
53
+ return attr;
54
+ }
55
+ const embeddedExpr = {
56
+ kind: javascript_2.JS.Kind.JsxEmbeddedExpression,
57
+ id: literal.id,
58
+ prefix: literal.prefix,
59
+ markers: literal.markers,
60
+ expression: {
61
+ kind: java_1.J.Kind.RightPadded,
62
+ element: callbackExpr,
63
+ after: literal.prefix,
64
+ markers: literal.markers
65
+ }
66
+ };
67
+ return Object.assign(Object.assign({}, attr), { value: Object.assign(Object.assign({}, attr.value), { element: embeddedExpr }) });
68
+ });
69
+ }
70
+ }();
71
+ });
72
+ }
73
+ }
74
+ exports.ReplaceStringRef = ReplaceStringRef;
75
+ //# sourceMappingURL=replace-string-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-string-ref.js","sourceRoot":"","sources":["../../src/react19/replace-string-ref.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2E;AAC3E,gEAAiF;AACjF,oDAA4C;AAC5C,gEAAwD;AAmBxD,MAAa,gBAAiB,SAAQ,gBAAM;IAA5C;;QACa,SAAI,GAAG,6CAA6C,CAAC;QACrD,gBAAW,GAAW,wCAAwC,CAAC;QAC/D,gBAAW,GAAW,kFAAkF,CAAC;IA+DtH,CAAC;IA7DS,MAAM;;YACR,OAAO,IAAI,KAAM,SA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EAAE,OAAO,CAAC,OAAO;4BACxB,UAAU,EAAE;gCACR,IAAI,EAAE,QAAC,CAAC,IAAI,CAAC,WAAW;gCACxB,OAAO,EAAE,YAAY;gCACrB,KAAK,EAAE,OAAO,CAAC,MAAM;gCACrB,OAAO,EAAE,OAAO,CAAC,OAAO;6BAC3B;yBACsB,CAAC;wBAE5B,OAAO,gCACA,IAAI,KACP,KAAK,kCACE,IAAI,CAAC,KAAK,KACb,OAAO,EAAE,YAAY,MAEJ,CAAC;oBAC9B,CAAC;iBAAA;aACJ,EAAE,CAAC;QACR,CAAC;KAAA;CACJ;AAlED,4CAkEC"}
@@ -0,0 +1,8 @@
1
+ import { ExecutionContext, Recipe, TreeVisitor } from "@openrewrite/rewrite";
2
+ export declare class ReplaceUseFormState extends Recipe {
3
+ readonly name = "org.openrewrite.react.19.replace-use-form-state";
4
+ readonly displayName: string;
5
+ readonly description: string;
6
+ editor(): Promise<TreeVisitor<any, ExecutionContext>>;
7
+ }
8
+ //# sourceMappingURL=replace-use-form-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-use-form-state.d.ts","sourceRoot":"","sources":["../../src/react19/replace-use-form-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAgC3E,qBAAa,mBAAoB,SAAQ,MAAM;IAC3C,QAAQ,CAAC,IAAI,qDAAqD;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAkD;IAC9E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA6G;IAEnI,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CA4B9D"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReplaceUseFormState = void 0;
13
+ const rewrite_1 = require("@openrewrite/rewrite");
14
+ const javascript_1 = require("@openrewrite/rewrite/javascript");
15
+ class ReplaceUseFormState extends rewrite_1.Recipe {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.name = "org.openrewrite.react.19.replace-use-form-state";
19
+ this.displayName = "Replace `useFormState` with `useActionState`";
20
+ this.description = "In React 19, `useFormState` from `react-dom` has been renamed to `useActionState` and moved to `react`.";
21
+ }
22
+ editor() {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ const reactDomOptions = {
25
+ context: ['import { useFormState } from "react-dom";'],
26
+ dependencies: { '@types/react-dom': '^18.0.0' }
27
+ };
28
+ const args = (0, javascript_1.capture)({ variadic: true });
29
+ const rule = (0, javascript_1.rewrite)(() => ({
30
+ before: (0, javascript_1.pattern) `useFormState(${args})`.configure(reactDomOptions),
31
+ after: (0, javascript_1.template) `useActionState(${args})`
32
+ }));
33
+ return new class extends javascript_1.JavaScriptVisitor {
34
+ visitMethodInvocation(method, p) {
35
+ const _super = Object.create(null, {
36
+ visitMethodInvocation: { get: () => super.visitMethodInvocation }
37
+ });
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ let m = yield _super.visitMethodInvocation.call(this, method, p);
40
+ const result = yield rule.tryOn(this.cursor, m);
41
+ if (result) {
42
+ (0, javascript_1.maybeRemoveImport)(this, "react-dom", "useFormState");
43
+ (0, javascript_1.maybeAddImport)(this, { module: "react", member: "useActionState", onlyIfReferenced: false });
44
+ return result;
45
+ }
46
+ return m;
47
+ });
48
+ }
49
+ }();
50
+ });
51
+ }
52
+ }
53
+ exports.ReplaceUseFormState = ReplaceUseFormState;
54
+ //# sourceMappingURL=replace-use-form-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-use-form-state.js","sourceRoot":"","sources":["../../src/react19/replace-use-form-state.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2E;AAC3E,gEAQyC;AAuBzC,MAAa,mBAAoB,SAAQ,gBAAM;IAA/C;;QACa,SAAI,GAAG,iDAAiD,CAAC;QACzD,gBAAW,GAAW,8CAA8C,CAAC;QACrE,gBAAW,GAAW,yGAAyG,CAAC;IA8B7I,CAAC;IA5BS,MAAM;;YACR,MAAM,eAAe,GAAG;gBACpB,OAAO,EAAE,CAAC,2CAA2C,CAAC;gBACtD,YAAY,EAAE,EAAC,kBAAkB,EAAE,SAAS,EAAC;aAChD,CAAC;YAEF,MAAM,IAAI,GAAG,IAAA,oBAAO,EAAa,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;YAEnD,MAAM,IAAI,GAAG,IAAA,oBAAO,EAAC,GAAG,EAAE,CAAC,CAAC;gBACxB,MAAM,EAAE,IAAA,oBAAO,EAAA,gBAAgB,IAAI,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC;gBACjE,KAAK,EAAE,IAAA,qBAAQ,EAAA,kBAAkB,IAAI,GAAG;aAC3C,CAAC,CAAC,CAAC;YAEJ,OAAO,IAAI,KAAM,SAAQ,8BAAmC;gBACzC,qBAAqB,CAAC,MAA0B,EAAE,CAAmB;;;;;wBAChF,IAAI,CAAC,GAAG,MAAM,OAAM,qBAAqB,YAAC,MAAM,EAAE,CAAC,CAAuB,CAAC;wBAE3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAE,CAAC,CAAC;wBACjD,IAAI,MAAM,EAAE,CAAC;4BACT,IAAA,8BAAiB,EAAC,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;4BACrD,IAAA,2BAAc,EAAC,IAAI,EAAE,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAC,CAAC,CAAC;4BAC3F,OAAO,MAAM,CAAC;wBAClB,CAAC;wBAED,OAAO,CAAC,CAAC;oBACb,CAAC;iBAAA;aACJ,EAAE,CAAC;QACR,CAAC;KAAA;CACJ;AAjCD,kDAiCC"}
@@ -0,0 +1,8 @@
1
+ import { Recipe } from "@openrewrite/rewrite";
2
+ export declare class UpgradeToReact19 extends Recipe {
3
+ readonly name = "org.openrewrite.react.migrate.upgrade-to-react-19";
4
+ readonly displayName = "Upgrade to React 19";
5
+ readonly description = "Migrate deprecated and removed APIs for React 19 compatibility. This includes removing forwardRef, updating Context.Provider usage, replacing useContext with use, and other breaking changes.";
6
+ recipeList(): Promise<Recipe[]>;
7
+ }
8
+ //# sourceMappingURL=upgrade-to-react-19.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade-to-react-19.d.ts","sourceRoot":"","sources":["../../src/react19/upgrade-to-react-19.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAyC5C,qBAAa,gBAAiB,SAAQ,MAAM;IACxC,QAAQ,CAAC,IAAI,uDAAuD;IACpE,QAAQ,CAAC,WAAW,yBAAyB;IAC7C,QAAQ,CAAC,WAAW,oMAAoM;IAElN,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAmBxC"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.UpgradeToReact19 = void 0;
13
+ const rewrite_1 = require("@openrewrite/rewrite");
14
+ const upgrade_to_react_18_1 = require("../react18/upgrade-to-react-18");
15
+ const remove_forward_ref_1 = require("./remove-forward-ref");
16
+ const remove_react_fc_1 = require("./remove-react-fc");
17
+ const replace_act_import_1 = require("./replace-act-import");
18
+ const remove_context_provider_1 = require("./remove-context-provider");
19
+ const use_context_hook_1 = require("./use-context-hook");
20
+ const replace_use_form_state_1 = require("./replace-use-form-state");
21
+ const replace_string_ref_1 = require("./replace-string-ref");
22
+ const replace_default_props_1 = require("./replace-default-props");
23
+ const replace_reactdom_hydrate_1 = require("./replace-reactdom-hydrate");
24
+ const use_ref_required_initial_1 = require("./use-ref-required-initial");
25
+ const remove_prop_types_1 = require("./remove-prop-types");
26
+ const no_implicit_ref_callback_return_1 = require("./no-implicit-ref-callback-return");
27
+ const deprecated_react_types_1 = require("./deprecated-react-types");
28
+ const replace_react_shallow_renderer_1 = require("./replace-react-shallow-renderer");
29
+ class UpgradeToReact19 extends rewrite_1.Recipe {
30
+ constructor() {
31
+ super(...arguments);
32
+ this.name = "org.openrewrite.react.migrate.upgrade-to-react-19";
33
+ this.displayName = "Upgrade to React 19";
34
+ this.description = "Migrate deprecated and removed APIs for React 19 compatibility. This includes removing forwardRef, updating Context.Provider usage, replacing useContext with use, and other breaking changes.";
35
+ }
36
+ recipeList() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ return [
39
+ new upgrade_to_react_18_1.UpgradeToReact18(),
40
+ new remove_forward_ref_1.RemoveForwardRef(),
41
+ new remove_react_fc_1.RemoveReactFC(),
42
+ new replace_act_import_1.ReplaceActImport(),
43
+ new remove_context_provider_1.RemoveContextProvider(),
44
+ new use_context_hook_1.UseContextHook(),
45
+ new replace_use_form_state_1.ReplaceUseFormState(),
46
+ new replace_string_ref_1.ReplaceStringRef(),
47
+ new replace_default_props_1.ReplaceDefaultProps(),
48
+ new replace_reactdom_hydrate_1.ReplaceReactDomHydrate(),
49
+ new use_ref_required_initial_1.UseRefRequiredInitial(),
50
+ new remove_prop_types_1.RemovePropTypes(),
51
+ new no_implicit_ref_callback_return_1.NoImplicitRefCallbackReturn(),
52
+ new deprecated_react_types_1.DeprecatedReactTypes(),
53
+ new replace_react_shallow_renderer_1.ReplaceReactShallowRenderer(),
54
+ ];
55
+ });
56
+ }
57
+ }
58
+ exports.UpgradeToReact19 = UpgradeToReact19;
59
+ //# sourceMappingURL=upgrade-to-react-19.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade-to-react-19.js","sourceRoot":"","sources":["../../src/react19/upgrade-to-react-19.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA4C;AAC5C,wEAAgE;AAChE,6DAAsD;AACtD,uDAAgD;AAChD,6DAAsD;AACtD,uEAAgE;AAChE,yDAAkD;AAClD,qEAA6D;AAC7D,6DAAsD;AACtD,mEAA4D;AAC5D,yEAAkE;AAClE,yEAAiE;AACjE,2DAAoD;AACpD,uFAA8E;AAC9E,qEAA8D;AAC9D,qFAA6E;AA0B7E,MAAa,gBAAiB,SAAQ,gBAAM;IAA5C;;QACa,SAAI,GAAG,mDAAmD,CAAC;QAC3D,gBAAW,GAAG,qBAAqB,CAAC;QACpC,gBAAW,GAAG,gMAAgM,CAAC;IAqB5N,CAAC;IAnBS,UAAU;;YACZ,OAAO;gBACH,IAAI,sCAAgB,EAAE;gBACtB,IAAI,qCAAgB,EAAE;gBACtB,IAAI,+BAAa,EAAE;gBACnB,IAAI,qCAAgB,EAAE;gBACtB,IAAI,+CAAqB,EAAE;gBAC3B,IAAI,iCAAc,EAAE;gBACpB,IAAI,4CAAmB,EAAE;gBACzB,IAAI,qCAAgB,EAAE;gBACtB,IAAI,2CAAmB,EAAE;gBACzB,IAAI,iDAAsB,EAAE;gBAC5B,IAAI,gDAAqB,EAAE;gBAC3B,IAAI,mCAAe,EAAE;gBACrB,IAAI,6DAA2B,EAAE;gBACjC,IAAI,6CAAoB,EAAE;gBAC1B,IAAI,4DAA2B,EAAE;aACpC,CAAC;QACN,CAAC;KAAA;CACJ;AAxBD,4CAwBC"}
@@ -0,0 +1,8 @@
1
+ import { ExecutionContext, Recipe, TreeVisitor } from "@openrewrite/rewrite";
2
+ export declare class UseContextHook extends Recipe {
3
+ readonly name = "org.openrewrite.react.19.use-context-hook";
4
+ readonly displayName: string;
5
+ readonly description: string;
6
+ editor(): Promise<TreeVisitor<any, ExecutionContext>>;
7
+ }
8
+ //# sourceMappingURL=use-context-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-context-hook.d.ts","sourceRoot":"","sources":["../../src/react19/use-context-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAiC3E,qBAAa,cAAe,SAAQ,MAAM;IACtC,QAAQ,CAAC,IAAI,+CAA+C;IAC5D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAqC;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAoH;IAE1I,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CA4B9D"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.UseContextHook = void 0;
13
+ const rewrite_1 = require("@openrewrite/rewrite");
14
+ const javascript_1 = require("@openrewrite/rewrite/javascript");
15
+ class UseContextHook extends rewrite_1.Recipe {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.name = "org.openrewrite.react.19.use-context-hook";
19
+ this.displayName = "Replace `useContext` with `use`";
20
+ this.description = "In React 19, `useContext` is replaced by the `use` API. This recipe updates both direct and namespace imports.";
21
+ }
22
+ editor() {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ const reactOptions = {
25
+ context: ['import { useContext } from "react";'],
26
+ dependencies: { '@types/react': '^18.0.0' }
27
+ };
28
+ const ctx = (0, javascript_1.capture)({ variadic: true });
29
+ const rule = (0, javascript_1.rewrite)(() => ({
30
+ before: (0, javascript_1.pattern) `useContext(${ctx})`.configure(reactOptions),
31
+ after: (0, javascript_1.template) `use(${ctx})`
32
+ }));
33
+ return new class extends javascript_1.JavaScriptVisitor {
34
+ visitMethodInvocation(method, p) {
35
+ const _super = Object.create(null, {
36
+ visitMethodInvocation: { get: () => super.visitMethodInvocation }
37
+ });
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ let m = yield _super.visitMethodInvocation.call(this, method, p);
40
+ const result = yield rule.tryOn(this.cursor, m);
41
+ if (result) {
42
+ (0, javascript_1.maybeRemoveImport)(this, "react", "useContext");
43
+ (0, javascript_1.maybeAddImport)(this, { module: "react", member: "use", onlyIfReferenced: false });
44
+ return result;
45
+ }
46
+ return m;
47
+ });
48
+ }
49
+ }();
50
+ });
51
+ }
52
+ }
53
+ exports.UseContextHook = UseContextHook;
54
+ //# sourceMappingURL=use-context-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-context-hook.js","sourceRoot":"","sources":["../../src/react19/use-context-hook.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2E;AAC3E,gEAQyC;AAwBzC,MAAa,cAAe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D,wCAiCC"}
@@ -0,0 +1,8 @@
1
+ import { ExecutionContext, Recipe, TreeVisitor } from "@openrewrite/rewrite";
2
+ export declare class UseRefRequiredInitial extends Recipe {
3
+ readonly name = "org.openrewrite.react.19.use-ref-required-initial";
4
+ readonly displayName: string;
5
+ readonly description: string;
6
+ editor(): Promise<TreeVisitor<any, ExecutionContext>>;
7
+ }
8
+ //# sourceMappingURL=use-ref-required-initial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-ref-required-initial.d.ts","sourceRoot":"","sources":["../../src/react19/use-ref-required-initial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAuB3E,qBAAa,qBAAsB,SAAQ,MAAM;IAC7C,QAAQ,CAAC,IAAI,uDAAuD;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA2C;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAgH;IAEtI,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CA8C9D"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.UseRefRequiredInitial = void 0;
13
+ const rewrite_1 = require("@openrewrite/rewrite");
14
+ const javascript_1 = require("@openrewrite/rewrite/javascript");
15
+ const java_1 = require("@openrewrite/rewrite/java");
16
+ const mutative_1 = require("mutative");
17
+ class UseRefRequiredInitial extends rewrite_1.Recipe {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.name = "org.openrewrite.react.19.use-ref-required-initial";
21
+ this.displayName = "Add initial value to `useRef()` calls";
22
+ this.description = "Adds `undefined` as initial argument to `useRef()` calls with no arguments. Required by `@types/react` 19.";
23
+ }
24
+ editor() {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return new class extends javascript_1.JavaScriptVisitor {
27
+ visitMethodInvocation(method, ctx) {
28
+ const _super = Object.create(null, {
29
+ visitMethodInvocation: { get: () => super.visitMethodInvocation }
30
+ });
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ var _a;
33
+ let m = yield _super.visitMethodInvocation.call(this, method, ctx);
34
+ if (m.name.simpleName !== 'useRef')
35
+ return m;
36
+ const args = m.arguments;
37
+ if (!args)
38
+ return m;
39
+ const argElements = args.elements;
40
+ if (!argElements)
41
+ return m;
42
+ if (argElements.length === 1) {
43
+ const firstArg = argElements[0];
44
+ const argNode = (_a = firstArg.element) !== null && _a !== void 0 ? _a : firstArg;
45
+ if (argNode.kind === java_1.J.Kind.Empty) {
46
+ const undefinedIdent = {
47
+ kind: java_1.J.Kind.Identifier,
48
+ id: argNode.id,
49
+ prefix: argNode.prefix,
50
+ markers: argNode.markers,
51
+ annotations: [],
52
+ simpleName: 'undefined'
53
+ };
54
+ return (0, mutative_1.create)(m, draft => {
55
+ const draftArg = draft.arguments.elements[0];
56
+ const draftArgPadded = draftArg;
57
+ if (draftArgPadded.element) {
58
+ draftArgPadded.element = undefinedIdent;
59
+ }
60
+ else {
61
+ draft.arguments.elements[0] = undefinedIdent;
62
+ }
63
+ });
64
+ }
65
+ }
66
+ return m;
67
+ });
68
+ }
69
+ }();
70
+ });
71
+ }
72
+ }
73
+ exports.UseRefRequiredInitial = UseRefRequiredInitial;
74
+ //# sourceMappingURL=use-ref-required-initial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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CACxB,WAAW,EAAE,EAAE;oCACf,UAAU,EAAE,WAAW;iCAC1B,CAAC;gCAEF,OAAO,IAAA,iBAAM,EAAC,CAAC,EAAE,KAAK,CAAC,EAAE;oCACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;oCAC9C,MAAM,cAAc,GAAG,QAAe,CAAC;oCACvC,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;wCACzB,cAAc,CAAC,OAAO,GAAG,cAAc,CAAC;oCAC5C,CAAC;yCAAM,CAAC;wCACJ,KAAK,CAAC,SAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,cAAqB,CAAC;oCACzD,CAAC;gCACL,CAAC,CAAC,CAAC;4BACP,CAAC;wBACL,CAAC;wBAED,OAAO,CAAC,CAAC;oBACb,CAAC;iBAAA;aACJ,EAAE,CAAC;QACR,CAAC;KAAA;CACJ;AAnDD,sDAmDC"}
@@ -0,0 +1,8 @@
1
+ import { ExecutionContext, Recipe, TreeVisitor } from "@openrewrite/rewrite";
2
+ export declare class ClassToFunctional extends Recipe {
3
+ readonly name = "org.openrewrite.react.refactoring.class-to-functional";
4
+ readonly displayName: string;
5
+ readonly description: string;
6
+ editor(): Promise<TreeVisitor<any, ExecutionContext>>;
7
+ }
8
+ //# sourceMappingURL=class-to-functional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-to-functional.d.ts","sourceRoot":"","sources":["../../src/refactoring/class-to-functional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AA0C3E,qBAAa,iBAAkB,SAAQ,MAAM;IACzC,QAAQ,CAAC,IAAI,2DAA2D;IACxE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAuD;IACnF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA4E;IAElG,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;CAqL9D"}
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ClassToFunctional = void 0;
13
+ const rewrite_1 = require("@openrewrite/rewrite");
14
+ const javascript_1 = require("@openrewrite/rewrite/javascript");
15
+ const java_1 = require("@openrewrite/rewrite/java");
16
+ const LIFECYCLE_METHODS = new Set([
17
+ 'componentWillMount', 'UNSAFE_componentWillMount',
18
+ 'componentDidMount', 'componentWillReceiveProps',
19
+ 'UNSAFE_componentWillReceiveProps', 'shouldComponentUpdate',
20
+ 'componentWillUpdate', 'UNSAFE_componentWillUpdate',
21
+ 'getSnapshotBeforeUpdate', 'componentDidUpdate',
22
+ 'componentDidCatch', 'componentWillUnmount',
23
+ 'getDerivedStateFromProps', 'getDerivedStateFromError',
24
+ 'getDefaultProps', 'getInitialState',
25
+ ]);
26
+ class ClassToFunctional extends rewrite_1.Recipe {
27
+ constructor() {
28
+ super(...arguments);
29
+ this.name = "org.openrewrite.react.refactoring.class-to-functional";
30
+ this.displayName = "Convert class components to functional components";
31
+ this.description = "Converts simple render-only class components to functional components.";
32
+ }
33
+ editor() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const field = (0, javascript_1.capture)();
36
+ const thisPropsFieldRule = (0, javascript_1.rewrite)(() => ({
37
+ before: (0, javascript_1.pattern) `this.props.${field}`,
38
+ after: (0, javascript_1.template) `props.${field}`
39
+ }));
40
+ const thisPropsRule = (0, javascript_1.rewrite)(() => ({
41
+ before: (0, javascript_1.pattern) `this.props`,
42
+ after: (0, javascript_1.template) `props`
43
+ }));
44
+ return new class extends javascript_1.JavaScriptVisitor {
45
+ visitClassDeclaration(classDecl, ctx) {
46
+ const _super = Object.create(null, {
47
+ visitClassDeclaration: { get: () => super.visitClassDeclaration }
48
+ });
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ let cd = yield _super.visitClassDeclaration.call(this, classDecl, ctx);
51
+ if (!this.extendsReactComponent(cd)) {
52
+ return cd;
53
+ }
54
+ const analysis = this.analyzeClassBody(cd);
55
+ if (!analysis.canConvert) {
56
+ return cd;
57
+ }
58
+ const renderMethod = analysis.renderMethod;
59
+ if (!renderMethod.body) {
60
+ return cd;
61
+ }
62
+ const transformedBody = yield this.replaceThisProps(renderMethod.body, ctx);
63
+ const className = cd.name.simpleName;
64
+ const funcDecl = yield (0, javascript_1.template) `function ${(0, javascript_1.raw)(className)}(props) {}`.apply(cd, this.cursor);
65
+ if (!funcDecl)
66
+ return cd;
67
+ const classBodyIndent = this.getIndent(renderMethod.prefix);
68
+ const adjustedBody = this.adjustIndentation(transformedBody, classBodyIndent);
69
+ const func = funcDecl;
70
+ return Object.assign(Object.assign({}, func), { body: adjustedBody });
71
+ });
72
+ }
73
+ extendsReactComponent(cd) {
74
+ if (!cd.extends)
75
+ return false;
76
+ const extendsType = cd.extends.element;
77
+ if (extendsType.kind === java_1.J.Kind.FieldAccess) {
78
+ const fa = extendsType;
79
+ const name = fa.name.element.simpleName;
80
+ if (name !== 'Component' && name !== 'PureComponent')
81
+ return false;
82
+ if (fa.target.kind !== java_1.J.Kind.Identifier)
83
+ return false;
84
+ return fa.target.simpleName === 'React';
85
+ }
86
+ if (extendsType.kind === java_1.J.Kind.Identifier) {
87
+ const name = extendsType.simpleName;
88
+ return name === 'Component' || name === 'PureComponent';
89
+ }
90
+ return false;
91
+ }
92
+ analyzeClassBody(cd) {
93
+ var _a, _b;
94
+ let renderMethod;
95
+ let hasDisqualifyingMember = false;
96
+ for (const stmt of cd.body.statements) {
97
+ const s = stmt.element;
98
+ if (!s)
99
+ continue;
100
+ if (s.kind === java_1.J.Kind.MethodDeclaration) {
101
+ const method = s;
102
+ const name = method.name.simpleName;
103
+ if (name === 'render') {
104
+ renderMethod = method;
105
+ }
106
+ else if (name === 'constructor') {
107
+ if (!this.isSimpleConstructor(method)) {
108
+ hasDisqualifyingMember = true;
109
+ }
110
+ }
111
+ else if (LIFECYCLE_METHODS.has(name)) {
112
+ hasDisqualifyingMember = true;
113
+ }
114
+ else {
115
+ const isStatic = (_a = method.modifiers) === null || _a === void 0 ? void 0 : _a.some(m => m.keyword === 'static');
116
+ if (!isStatic) {
117
+ hasDisqualifyingMember = true;
118
+ }
119
+ }
120
+ }
121
+ else if (s.kind === java_1.J.Kind.VariableDeclarations) {
122
+ const vars = s;
123
+ const isStatic = (_b = vars.modifiers) === null || _b === void 0 ? void 0 : _b.some(m => m.keyword === 'static');
124
+ if (!isStatic) {
125
+ hasDisqualifyingMember = true;
126
+ }
127
+ }
128
+ }
129
+ return {
130
+ canConvert: !!renderMethod && !hasDisqualifyingMember,
131
+ renderMethod
132
+ };
133
+ }
134
+ isSimpleConstructor(method) {
135
+ if (!method.body)
136
+ return true;
137
+ const stmts = method.body.statements;
138
+ if (stmts.length === 0)
139
+ return true;
140
+ if (stmts.length > 1)
141
+ return false;
142
+ const firstStmt = stmts[0].element;
143
+ if (!firstStmt)
144
+ return true;
145
+ if (firstStmt.kind === java_1.J.Kind.MethodInvocation) {
146
+ const call = firstStmt;
147
+ return call.name.simpleName === 'super';
148
+ }
149
+ return false;
150
+ }
151
+ replaceThisProps(body, ctx) {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ const replacer = new class extends javascript_1.JavaScriptVisitor {
154
+ visitFieldAccess(fieldAccess, ctx) {
155
+ const _super = Object.create(null, {
156
+ visitFieldAccess: { get: () => super.visitFieldAccess }
157
+ });
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ let fa = yield _super.visitFieldAccess.call(this, fieldAccess, ctx);
160
+ let result = yield thisPropsFieldRule.tryOn(this.cursor, fa);
161
+ if (result)
162
+ return result;
163
+ result = yield thisPropsRule.tryOn(this.cursor, fa);
164
+ if (result)
165
+ return result;
166
+ return fa;
167
+ });
168
+ }
169
+ }();
170
+ return yield replacer.visit(body, ctx);
171
+ });
172
+ }
173
+ getIndent(space) {
174
+ if (!space || typeof space.whitespace !== 'string')
175
+ return '';
176
+ const ws = space.whitespace;
177
+ const lastNewline = ws.lastIndexOf('\n');
178
+ if (lastNewline === -1)
179
+ return '';
180
+ return ws.substring(lastNewline + 1);
181
+ }
182
+ adjustIndentation(body, indentToRemove) {
183
+ if (!indentToRemove)
184
+ return body;
185
+ return Object.assign(Object.assign({}, body), { statements: body.statements.map(stmt => (Object.assign(Object.assign({}, stmt), { element: stmt.element ? Object.assign(Object.assign({}, stmt.element), { prefix: this.removeIndent(stmt.element.prefix, indentToRemove) }) : stmt.element }))), end: this.removeIndent(body.end, indentToRemove) });
186
+ }
187
+ removeIndent(space, indent) {
188
+ if (!space || typeof space.whitespace !== 'string')
189
+ return space;
190
+ const ws = space.whitespace;
191
+ const adjusted = ws.split('\n').map((line, i) => {
192
+ if (i === 0)
193
+ return line;
194
+ if (line.startsWith(indent))
195
+ return line.substring(indent.length);
196
+ return line;
197
+ }).join('\n');
198
+ return adjusted !== ws ? Object.assign(Object.assign({}, space), { whitespace: adjusted }) : space;
199
+ }
200
+ }();
201
+ });
202
+ }
203
+ }
204
+ exports.ClassToFunctional = ClassToFunctional;
205
+ //# sourceMappingURL=class-to-functional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-to-functional.js","sourceRoot":"","sources":["../../src/refactoring/class-to-functional.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2E;AAC3E,gEAA4G;AAC5G,oDAA4C;AAE5C,MAAM,iBAAiB,GA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