@strapi/upgrade 0.0.0-experimental.e3e48deb89bd0a1b6cc69b698696566fa7854a95 → 0.0.0-experimental.e8d8fc824d0f6a695b2a9ebaa4680ed21c3645ca

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 (96) hide show
  1. package/LICENSE +19 -4
  2. package/README.md +1 -1
  3. package/dist/cli.js +1578 -5
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.js +739 -387
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +735 -384
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/modules/codemod/codemod.d.ts +4 -2
  10. package/dist/modules/codemod/codemod.d.ts.map +1 -1
  11. package/dist/modules/codemod/types.d.ts +8 -1
  12. package/dist/modules/codemod/types.d.ts.map +1 -1
  13. package/dist/modules/codemod-repository/constants.d.ts.map +1 -1
  14. package/dist/modules/codemod-repository/repository.d.ts +6 -5
  15. package/dist/modules/codemod-repository/repository.d.ts.map +1 -1
  16. package/dist/modules/codemod-repository/types.d.ts +7 -3
  17. package/dist/modules/codemod-repository/types.d.ts.map +1 -1
  18. package/dist/modules/codemod-runner/codemod-runner.d.ts +3 -0
  19. package/dist/modules/codemod-runner/codemod-runner.d.ts.map +1 -1
  20. package/dist/modules/codemod-runner/index.d.ts +1 -0
  21. package/dist/modules/codemod-runner/index.d.ts.map +1 -1
  22. package/dist/modules/codemod-runner/types.d.ts +1 -0
  23. package/dist/modules/codemod-runner/types.d.ts.map +1 -1
  24. package/dist/modules/error/utils.d.ts +8 -0
  25. package/dist/modules/error/utils.d.ts.map +1 -1
  26. package/dist/modules/file-scanner/scanner.d.ts.map +1 -1
  27. package/dist/modules/format/formats.d.ts +6 -0
  28. package/dist/modules/format/formats.d.ts.map +1 -1
  29. package/dist/modules/project/constants.d.ts +6 -3
  30. package/dist/modules/project/constants.d.ts.map +1 -1
  31. package/dist/modules/project/index.d.ts +2 -0
  32. package/dist/modules/project/index.d.ts.map +1 -1
  33. package/dist/modules/project/project.d.ts +27 -5
  34. package/dist/modules/project/project.d.ts.map +1 -1
  35. package/dist/modules/project/types.d.ts +3 -10
  36. package/dist/modules/project/types.d.ts.map +1 -1
  37. package/dist/modules/project/utils.d.ts +6 -0
  38. package/dist/modules/project/utils.d.ts.map +1 -0
  39. package/dist/modules/report/report.d.ts.map +1 -1
  40. package/dist/modules/requirement/types.d.ts +2 -2
  41. package/dist/modules/requirement/types.d.ts.map +1 -1
  42. package/dist/modules/runner/json/transform.d.ts.map +1 -1
  43. package/dist/modules/upgrader/types.d.ts +6 -0
  44. package/dist/modules/upgrader/types.d.ts.map +1 -1
  45. package/dist/modules/upgrader/upgrader.d.ts +7 -3
  46. package/dist/modules/upgrader/upgrader.d.ts.map +1 -1
  47. package/dist/modules/version/range.d.ts +2 -0
  48. package/dist/modules/version/range.d.ts.map +1 -1
  49. package/dist/modules/version/types.d.ts +2 -1
  50. package/dist/modules/version/types.d.ts.map +1 -1
  51. package/dist/tasks/codemods/index.d.ts +2 -1
  52. package/dist/tasks/codemods/index.d.ts.map +1 -1
  53. package/dist/tasks/codemods/list-codemods.d.ts +3 -0
  54. package/dist/tasks/codemods/list-codemods.d.ts.map +1 -0
  55. package/dist/tasks/codemods/run-codemods.d.ts +3 -0
  56. package/dist/tasks/codemods/run-codemods.d.ts.map +1 -0
  57. package/dist/tasks/codemods/types.d.ts +9 -3
  58. package/dist/tasks/codemods/types.d.ts.map +1 -1
  59. package/dist/tasks/codemods/utils.d.ts +6 -0
  60. package/dist/tasks/codemods/utils.d.ts.map +1 -0
  61. package/dist/tasks/index.d.ts +1 -1
  62. package/dist/tasks/index.d.ts.map +1 -1
  63. package/dist/tasks/upgrade/prompts/index.d.ts +2 -0
  64. package/dist/tasks/upgrade/prompts/index.d.ts.map +1 -0
  65. package/dist/tasks/upgrade/prompts/latest.d.ts +9 -0
  66. package/dist/tasks/upgrade/prompts/latest.d.ts.map +1 -0
  67. package/dist/tasks/upgrade/requirements/major.d.ts.map +1 -1
  68. package/dist/tasks/upgrade/upgrade.d.ts.map +1 -1
  69. package/package.json +11 -10
  70. package/resources/codemods/5.0.0/comment-out-lifecycle-files.code.ts +63 -0
  71. package/resources/codemods/5.0.0/dependency-remove-strapi-plugin-i18n.json.ts +31 -0
  72. package/resources/codemods/5.0.0/dependency-upgrade-react-and-react-dom.json.ts +67 -0
  73. package/resources/codemods/5.0.0/dependency-upgrade-react-router-dom.json.ts +59 -0
  74. package/resources/codemods/5.0.0/dependency-upgrade-styled-components.json.ts +49 -0
  75. package/resources/codemods/5.0.0/deprecate-helper-plugin.code.ts +192 -0
  76. package/resources/codemods/5.0.0/entity-service-document-service.code.ts +437 -0
  77. package/resources/codemods/5.0.0/s3-keys-wrapped-in-credentials.code.ts +1 -1
  78. package/resources/codemods/5.0.0/sqlite3-to-better-sqlite3.json.ts +5 -3
  79. package/resources/codemods/5.0.0/strapi-public-interface.code.ts +126 -0
  80. package/resources/codemods/5.0.0/use-uid-for-config-namespace.code.ts +1 -1
  81. package/resources/codemods/5.0.0/utils-public-interface.code.ts +320 -0
  82. package/resources/codemods/5.1.0/dependency-better-sqlite3.json.ts +48 -0
  83. package/resources/examples/console.log-to-console.info.code.ts +1 -1
  84. package/resources/examples/disable-jsx-buttons.code.ts +42 -0
  85. package/resources/utils/change-import.ts +118 -0
  86. package/resources/utils/replace-jsx.ts +49 -0
  87. package/dist/_chunks/codemod-runner-B5OeSMTQ.js +0 -730
  88. package/dist/_chunks/codemod-runner-B5OeSMTQ.js.map +0 -1
  89. package/dist/_chunks/codemods-10ZKewQx.js +0 -108
  90. package/dist/_chunks/codemods-10ZKewQx.js.map +0 -1
  91. package/dist/_chunks/index-uxCwtuH1.js +0 -103
  92. package/dist/_chunks/index-uxCwtuH1.js.map +0 -1
  93. package/dist/_chunks/upgrade-A4T1OWs5.js +0 -357
  94. package/dist/_chunks/upgrade-A4T1OWs5.js.map +0 -1
  95. package/dist/tasks/codemods/codemods.d.ts +0 -3
  96. package/dist/tasks/codemods/codemods.d.ts.map +0 -1
@@ -0,0 +1,63 @@
1
+ import { Transform } from 'jscodeshift';
2
+
3
+ /**
4
+ * comments out lifecycles.js/ts files and adds a description for the reason at the top
5
+ */
6
+ const transform: Transform = (file, api) => {
7
+ const j = api.jscodeshift;
8
+ const root = j(file.source);
9
+
10
+ // check if file path follows this pattern `content-types/[content-type-name]/lifecycles`
11
+ if (/content-types\/[^/]+\/lifecycles\.(js|ts)$/.test(file.path)) {
12
+ // Get the entire source code as a string
13
+ const sourceCode = root.toSource();
14
+
15
+ // Split the source code into lines and prepend // to each line
16
+ // we are using line comments instead of block comments so we don't face issues with existing block comments
17
+ const commentedCode = sourceCode
18
+ .split('\n')
19
+ .map((line) => `// ${line}`)
20
+ .join('\n');
21
+
22
+ // Add a header comment at the top to explain why the file is commented out
23
+ const headerComment = `
24
+ /*
25
+ *
26
+ * ============================================================
27
+ * WARNING: THIS FILE HAS BEEN COMMENTED OUT
28
+ * ============================================================
29
+ *
30
+ * CONTEXT:
31
+ *
32
+ * The lifecycles.js file has been commented out to prevent unintended side effects when starting Strapi 5 for the first time after migrating to the document service.
33
+ *
34
+ * STRAPI 5 introduces a new document service that handles lifecycles differently compared to previous versions. Without migrating your lifecycles to document service middlewares, you may experience issues such as:
35
+ *
36
+ * - \`unpublish\` actions triggering \`delete\` lifecycles for every locale with a published entity, which differs from the expected behavior in v4.
37
+ * - \`discardDraft\` actions triggering both \`create\` and \`delete\` lifecycles, leading to potential confusion.
38
+ *
39
+ * MIGRATION GUIDE:
40
+ *
41
+ * For a thorough guide on migrating your lifecycles to document service middlewares, please refer to the following link:
42
+ * [Document Services Middlewares Migration Guide](https://docs.strapi.io/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service)
43
+ *
44
+ * IMPORTANT:
45
+ *
46
+ * Simply uncommenting this file without following the migration guide may result in unexpected behavior and inconsistencies. Ensure that you have completed the migration process before re-enabling this file.
47
+ *
48
+ * ============================================================
49
+ */
50
+ `;
51
+
52
+ // Combine the header comment with the commented-out code
53
+ const finalCode = `${headerComment}\n${commentedCode}`;
54
+
55
+ return finalCode;
56
+ }
57
+
58
+ return root.toSource();
59
+ };
60
+
61
+ export const parser = 'tsx';
62
+
63
+ export default transform;
@@ -0,0 +1,31 @@
1
+ import path from 'node:path';
2
+
3
+ import type { modules } from '../../../dist';
4
+
5
+ const STRAPI_I18N_DEP_NAME = '@strapi/plugin-i18n';
6
+ const STRAPI_I18N_DEP_PATH = `dependencies.${STRAPI_I18N_DEP_NAME}`;
7
+
8
+ /**
9
+ * Specifically targets the root package.json and removes the @strapi/plugin-i18n dependency.
10
+ *
11
+ * Why? The i18n plugin is now a hard dependency of @strapi/strapi and isn't needed in the package.json anymore.
12
+ */
13
+ const transform: modules.runner.json.JSONTransform = (file, params) => {
14
+ const { cwd, json } = params;
15
+
16
+ const rootPackageJsonPath = path.join(cwd, 'package.json');
17
+
18
+ if (file.path !== rootPackageJsonPath) {
19
+ return file.json;
20
+ }
21
+
22
+ const j = json(file.json);
23
+
24
+ if (j.has(STRAPI_I18N_DEP_PATH)) {
25
+ j.remove(STRAPI_I18N_DEP_PATH);
26
+ }
27
+
28
+ return j.root();
29
+ };
30
+
31
+ export default transform;
@@ -0,0 +1,67 @@
1
+ import path from 'node:path';
2
+ import semver from 'semver';
3
+
4
+ import type { modules } from '../../../dist';
5
+
6
+ const REACT_DEP_NAME = 'react';
7
+ const REACT_DEP_PATH = `dependencies.${REACT_DEP_NAME}`;
8
+
9
+ const REACT_DOM_DEP_NAME = 'react-dom';
10
+ const REACT_DOM_DEP_PATH = `dependencies.${REACT_DOM_DEP_NAME}`;
11
+
12
+ const DEP_NEW_VERSION_RANGE = '^18.0.0';
13
+
14
+ /**
15
+ * Specifically targets the root package.json and updates the react and react-dom dependency version.
16
+ *
17
+ * We first check if the react and react-dom dependency is listed in the package.json. If the dependency is
18
+ * found, we verify its version.
19
+ *
20
+ * If the detected version does not satisfy the new version range, we replace it with the new one.
21
+ *
22
+ * Conversely, if no react or react-dom dependency is listed, we add it with the new version range.
23
+ */
24
+ const transform: modules.runner.json.JSONTransform = (file, params) => {
25
+ const { cwd, json } = params;
26
+
27
+ const rootPackageJsonPath = path.join(cwd, 'package.json');
28
+
29
+ if (file.path !== rootPackageJsonPath) {
30
+ return file.json;
31
+ }
32
+
33
+ const j = json(file.json);
34
+
35
+ if (j.has(REACT_DEP_PATH) && j.has(REACT_DOM_DEP_PATH)) {
36
+ const currentReactVersion = j.get(REACT_DEP_PATH);
37
+ const currentReactDOMVersion = j.get(REACT_DOM_DEP_PATH);
38
+
39
+ // If the current version is not a string, then something is wrong, abort
40
+ if (typeof currentReactVersion !== 'string' || typeof currentReactDOMVersion !== 'string') {
41
+ return j.root();
42
+ }
43
+
44
+ const currentSatisfiesNew =
45
+ semver.satisfies(currentReactVersion, DEP_NEW_VERSION_RANGE) &&
46
+ semver.satisfies(currentReactDOMVersion, DEP_NEW_VERSION_RANGE);
47
+
48
+ // if the current version satisfies the new range, keep it as is and abort
49
+ if (currentSatisfiesNew) {
50
+ return j.root();
51
+ }
52
+
53
+ // else, update the version with the new one
54
+ j.set(REACT_DEP_PATH, DEP_NEW_VERSION_RANGE);
55
+ j.set(REACT_DOM_DEP_PATH, DEP_NEW_VERSION_RANGE);
56
+ }
57
+
58
+ // If the dependency is not listed yet, add it
59
+ else {
60
+ j.set(REACT_DEP_PATH, DEP_NEW_VERSION_RANGE);
61
+ j.set(REACT_DOM_DEP_PATH, DEP_NEW_VERSION_RANGE);
62
+ }
63
+
64
+ return j.root();
65
+ };
66
+
67
+ export default transform;
@@ -0,0 +1,59 @@
1
+ import path from 'node:path';
2
+ import semver from 'semver';
3
+
4
+ import type { modules } from '../../../dist';
5
+
6
+ const REACT_ROUTER_DEP_NAME = 'react-router-dom';
7
+ const REACT_ROUTER_DEP_PATH = `dependencies.${REACT_ROUTER_DEP_NAME}`;
8
+
9
+ const DEP_NEW_VERSION_RANGE = '^6.0.0';
10
+
11
+ /**
12
+ * Specifically targets the root package.json and updates the react-router-dom dependency version.
13
+ *
14
+ * We first check if the react-router-dom dependency is listed in the package.json. If the dependency is
15
+ * found, we verify its version.
16
+ *
17
+ * If the detected version does not satisfy the new version range, we replace it with the new one.
18
+ *
19
+ * Conversely, if no react-router-dom dependency is listed, we add it with the new version range.
20
+ */
21
+ const transform: modules.runner.json.JSONTransform = (file, params) => {
22
+ const { cwd, json } = params;
23
+
24
+ const rootPackageJsonPath = path.join(cwd, 'package.json');
25
+
26
+ if (file.path !== rootPackageJsonPath) {
27
+ return file.json;
28
+ }
29
+
30
+ const j = json(file.json);
31
+
32
+ if (j.has(REACT_ROUTER_DEP_PATH)) {
33
+ const currentVersion = j.get(REACT_ROUTER_DEP_PATH);
34
+
35
+ // If the current version is not a string, then something is wrong, abort
36
+ if (typeof currentVersion !== 'string') {
37
+ return j.root();
38
+ }
39
+
40
+ const currentSatisfiesNew = semver.satisfies(currentVersion, DEP_NEW_VERSION_RANGE);
41
+
42
+ // if the current version satisfies the new range, keep it as is and abort
43
+ if (currentSatisfiesNew) {
44
+ return j.root();
45
+ }
46
+
47
+ // else, update the version with the new one
48
+ j.set(REACT_ROUTER_DEP_PATH, DEP_NEW_VERSION_RANGE);
49
+ }
50
+
51
+ // If the dependency is not listed yet, add it
52
+ else {
53
+ j.set(REACT_ROUTER_DEP_PATH, DEP_NEW_VERSION_RANGE);
54
+ }
55
+
56
+ return j.root();
57
+ };
58
+
59
+ export default transform;
@@ -0,0 +1,49 @@
1
+ import path from 'node:path';
2
+ import semver from 'semver';
3
+
4
+ import type { modules } from '../../../dist';
5
+
6
+ const DEP_NAME = 'styled-components';
7
+ const DEP_PATH = `dependencies.${DEP_NAME}`;
8
+
9
+ const DEP_NEW_VERSION_RANGE = '^6.0.0';
10
+
11
+ const transform: modules.runner.json.JSONTransform = (file, params) => {
12
+ const { cwd, json } = params;
13
+
14
+ const rootPackageJsonPath = path.join(cwd, 'package.json');
15
+
16
+ if (file.path !== rootPackageJsonPath) {
17
+ return file.json;
18
+ }
19
+
20
+ const j = json(file.json);
21
+
22
+ if (j.has(DEP_PATH)) {
23
+ const currentVersion = j.get(DEP_PATH);
24
+
25
+ // If the current version is not a string, then something is wrong, abort
26
+ if (typeof currentVersion !== 'string') {
27
+ return j.root();
28
+ }
29
+
30
+ const currentSatisfiesNew = semver.satisfies(currentVersion, DEP_NEW_VERSION_RANGE);
31
+
32
+ // if the current version satisfies the new range, keep it as is and abort
33
+ if (currentSatisfiesNew) {
34
+ return j.root();
35
+ }
36
+
37
+ // else, update the version with the new one
38
+ j.set(DEP_PATH, DEP_NEW_VERSION_RANGE);
39
+ }
40
+
41
+ // If the dependency is not listed yet, add it
42
+ else {
43
+ j.set(DEP_PATH, DEP_NEW_VERSION_RANGE);
44
+ }
45
+
46
+ return j.root();
47
+ };
48
+
49
+ export default transform;
@@ -0,0 +1,192 @@
1
+ import type { Transform } from 'jscodeshift';
2
+ import { changeImportSpecifier } from '../../utils/change-import';
3
+ import { replaceJSXElement } from '../../utils/replace-jsx';
4
+
5
+ /**
6
+ * This codemods automates all the imports and naming changes
7
+ * for methods or components that used to be imported from '@strapi/helper-plugin'
8
+ */
9
+ const transform: Transform = (file, api) => {
10
+ const { j } = api;
11
+
12
+ const root = j.withParser('tsx')(file.source);
13
+
14
+ type Replacement = {
15
+ oldName: string;
16
+ oldDependency: string;
17
+ toReplace: boolean;
18
+ toChangeImportSpecifier: boolean;
19
+ newDependency?: string;
20
+ newName?: string;
21
+ newImport?: string;
22
+ };
23
+
24
+ const replacements: Replacement[] = [
25
+ {
26
+ oldName: 'AnErrorOccurred',
27
+ newImport: 'Page',
28
+ newName: 'Page.Error',
29
+ oldDependency: '@strapi/helper-plugin',
30
+ newDependency: '@strapi/strapi/admin',
31
+ toReplace: true,
32
+ toChangeImportSpecifier: true,
33
+ },
34
+ {
35
+ oldName: 'CheckPagePermissions',
36
+ newImport: 'Page',
37
+ newName: 'Page.Protect',
38
+ oldDependency: '@strapi/helper-plugin',
39
+ newDependency: '@strapi/strapi/admin',
40
+ toReplace: true,
41
+ toChangeImportSpecifier: true,
42
+ },
43
+ {
44
+ oldName: 'ConfirmDialog',
45
+ oldDependency: '@strapi/helper-plugin',
46
+ newDependency: '@strapi/strapi/admin',
47
+ toChangeImportSpecifier: true,
48
+ toReplace: false,
49
+ },
50
+ {
51
+ oldName: 'DateTimePicker',
52
+ oldDependency: '@strapi/helper-plugin',
53
+ newDependency: '@strapi/design-system',
54
+ toChangeImportSpecifier: true,
55
+ toReplace: false,
56
+ },
57
+ {
58
+ oldName: 'getFetchClient',
59
+ oldDependency: '@strapi/helper-plugin',
60
+ newDependency: '@strapi/strapi/admin',
61
+ toChangeImportSpecifier: true,
62
+ toReplace: false,
63
+ },
64
+ {
65
+ oldName: 'LoadingIndicatorPage',
66
+ newImport: 'Page',
67
+ newName: 'Page.Loading',
68
+ oldDependency: '@strapi/helper-plugin',
69
+ newDependency: '@strapi/strapi/admin',
70
+ toReplace: true,
71
+ toChangeImportSpecifier: true,
72
+ },
73
+ {
74
+ oldName: 'NoContent',
75
+ newImport: 'EmptyStateLayout',
76
+ newName: 'EmptyStateLayout',
77
+ oldDependency: '@strapi/helper-plugin',
78
+ newDependency: '@strapi/design-system',
79
+ toReplace: true,
80
+ toChangeImportSpecifier: true,
81
+ },
82
+ {
83
+ oldName: 'NoPermissions',
84
+ newImport: 'Page',
85
+ newName: 'Page.NoPermissions',
86
+ oldDependency: '@strapi/helper-plugin',
87
+ newDependency: '@strapi/strapi/admin',
88
+ toReplace: true,
89
+ toChangeImportSpecifier: true,
90
+ },
91
+ {
92
+ oldName: 'Status',
93
+ oldDependency: '@strapi/helper-plugin',
94
+ newDependency: '@strapi/design-system',
95
+ toChangeImportSpecifier: true,
96
+ toReplace: false,
97
+ },
98
+ {
99
+ oldName: 'translatedErrors',
100
+ oldDependency: '@strapi/helper-plugin',
101
+ newDependency: '@strapi/strapi/admin',
102
+ toChangeImportSpecifier: true,
103
+ toReplace: false,
104
+ },
105
+ {
106
+ oldName: 'useAPIErrorHandler',
107
+ oldDependency: '@strapi/helper-plugin',
108
+ newDependency: '@strapi/strapi/admin',
109
+ toChangeImportSpecifier: true,
110
+ toReplace: false,
111
+ },
112
+ {
113
+ oldName: 'useCallbackRef',
114
+ oldDependency: '@strapi/helper-plugin',
115
+ newDependency: '@strapi/design-system',
116
+ toChangeImportSpecifier: true,
117
+ toReplace: false,
118
+ },
119
+ {
120
+ oldName: 'useCollator',
121
+ oldDependency: '@strapi/helper-plugin',
122
+ newDependency: '@strapi/design-system',
123
+ toChangeImportSpecifier: true,
124
+ toReplace: false,
125
+ },
126
+ {
127
+ oldName: 'useFetchClient',
128
+ oldDependency: '@strapi/helper-plugin',
129
+ newDependency: '@strapi/strapi/admin',
130
+ toChangeImportSpecifier: true,
131
+ toReplace: false,
132
+ },
133
+ {
134
+ oldName: 'useFilter',
135
+ oldDependency: '@strapi/helper-plugin',
136
+ newDependency: '@strapi/design-system',
137
+ toChangeImportSpecifier: true,
138
+ toReplace: false,
139
+ },
140
+ {
141
+ oldName: 'useQueryParams',
142
+ oldDependency: '@strapi/helper-plugin',
143
+ newDependency: '@strapi/strapi/admin',
144
+ toChangeImportSpecifier: true,
145
+ toReplace: false,
146
+ },
147
+ {
148
+ oldName: 'useRBAC',
149
+ oldDependency: '@strapi/helper-plugin',
150
+ newDependency: '@strapi/strapi/admin',
151
+ toChangeImportSpecifier: true,
152
+ toReplace: false,
153
+ },
154
+ {
155
+ oldName: 'SearchURLQuery',
156
+ oldDependency: '@strapi/helper-plugin',
157
+ newDependency: '@strapi/strapi/admin',
158
+ toChangeImportSpecifier: true,
159
+ toReplace: false,
160
+ },
161
+ {
162
+ oldName: 'useSettingsForm',
163
+ oldDependency: '@strapi/helper-plugin',
164
+ newDependency: '@strapi/strapi/admin',
165
+ toChangeImportSpecifier: true,
166
+ toReplace: false,
167
+ },
168
+ ];
169
+
170
+ replacements.forEach((replacement) => {
171
+ if (replacement.toReplace && replacement.newName) {
172
+ replaceJSXElement(root, j, {
173
+ oldElementName: replacement.oldName,
174
+ newElementName: replacement.newName,
175
+ oldDependency: replacement.oldDependency,
176
+ });
177
+ }
178
+
179
+ if (replacement.toChangeImportSpecifier && replacement.newDependency) {
180
+ changeImportSpecifier(root, j, {
181
+ oldMethodName: replacement.oldName,
182
+ newMethodName: replacement.newImport,
183
+ oldDependency: replacement.oldDependency,
184
+ newDependency: replacement.newDependency,
185
+ });
186
+ }
187
+ });
188
+
189
+ return root.toSource();
190
+ };
191
+
192
+ export default transform;