@atlaskit/codemod-utils 4.2.4 → 4.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -31
- package/LICENSE.md +6 -8
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types/utils/support.d.ts +1 -2
- package/dist/types-ts4.5/utils/index.d.ts +1 -2
- package/dist/types-ts4.5/utils/support.d.ts +1 -2
- package/package.json +65 -69
- package/report.api.md +111 -116
package/CHANGELOG.md
CHANGED
|
@@ -1,76 +1,112 @@
|
|
|
1
1
|
# @atlaskit/codemod-utils
|
|
2
2
|
|
|
3
|
+
## 4.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#127093](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127093)
|
|
8
|
+
[`1378ea7a99ce1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1378ea7a99ce1) -
|
|
9
|
+
Upgrades `jscodeshift` to handle generics properly.
|
|
10
|
+
|
|
3
11
|
## 4.2.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
6
14
|
|
|
7
|
-
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
15
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
16
|
+
[`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
|
|
17
|
+
Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
8
18
|
|
|
9
19
|
## 4.2.3
|
|
10
20
|
|
|
11
21
|
### Patch Changes
|
|
12
22
|
|
|
13
|
-
- [#34443](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34443)
|
|
23
|
+
- [#34443](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34443)
|
|
24
|
+
[`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing
|
|
25
|
+
unused dependencies and dev dependencies
|
|
14
26
|
|
|
15
27
|
## 4.2.2
|
|
16
28
|
|
|
17
29
|
### Patch Changes
|
|
18
30
|
|
|
19
|
-
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793)
|
|
31
|
+
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793)
|
|
32
|
+
[`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure
|
|
33
|
+
legacy types are published for TS 4.5-4.8
|
|
20
34
|
|
|
21
35
|
## 4.2.1
|
|
22
36
|
|
|
23
37
|
### Patch Changes
|
|
24
38
|
|
|
25
|
-
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649)
|
|
39
|
+
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649)
|
|
40
|
+
[`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade
|
|
41
|
+
Typescript from `4.5.5` to `4.9.5`
|
|
26
42
|
|
|
27
43
|
## 4.2.0
|
|
28
44
|
|
|
29
45
|
### Minor Changes
|
|
30
46
|
|
|
31
|
-
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258)
|
|
47
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258)
|
|
48
|
+
[`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip
|
|
49
|
+
minor dependency bump
|
|
32
50
|
|
|
33
51
|
## 4.1.3
|
|
34
52
|
|
|
35
53
|
### Patch Changes
|
|
36
54
|
|
|
37
|
-
- [#24874](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24874)
|
|
55
|
+
- [#24874](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24874)
|
|
56
|
+
[`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade
|
|
57
|
+
Typescript from `4.3.5` to `4.5.5`
|
|
38
58
|
|
|
39
59
|
## 4.1.2
|
|
40
60
|
|
|
41
61
|
### Patch Changes
|
|
42
62
|
|
|
43
|
-
- [#24492](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24492)
|
|
63
|
+
- [#24492](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24492)
|
|
64
|
+
[`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade
|
|
65
|
+
Typescript from `4.2.4` to `4.3.5`.
|
|
44
66
|
|
|
45
67
|
## 4.1.1
|
|
46
68
|
|
|
47
69
|
### Patch Changes
|
|
48
70
|
|
|
49
|
-
- [#23836](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/23836)
|
|
71
|
+
- [#23836](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/23836)
|
|
72
|
+
[`edc6fef0c8f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/edc6fef0c8f) - Fix
|
|
73
|
+
printf format specifier matching within `matchesStringWithFormatSpecifier` for fuzzy matching
|
|
74
|
+
interpolated placeholder values
|
|
50
75
|
|
|
51
76
|
## 4.1.0
|
|
52
77
|
|
|
53
78
|
### Minor Changes
|
|
54
79
|
|
|
55
|
-
- [#21570](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/21570)
|
|
80
|
+
- [#21570](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/21570)
|
|
81
|
+
[`e4624adcb2f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e4624adcb2f) -
|
|
82
|
+
ED-14608: Update codemod-utils to support type import entry point changes in
|
|
83
|
+
changeImportEntryPoint, remove adf-utils from repo stricter lint exclusion lists
|
|
56
84
|
|
|
57
85
|
## 4.0.2
|
|
58
86
|
|
|
59
87
|
### Patch Changes
|
|
60
88
|
|
|
61
|
-
- [#21152](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/21152)
|
|
89
|
+
- [#21152](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/21152)
|
|
90
|
+
[`9358d42eeaa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9358d42eeaa) -
|
|
91
|
+
NO-ISSUE: fixed codemod utils tryCreateImport() and addToImport() causing multiple insert in
|
|
92
|
+
certain scenarios
|
|
62
93
|
|
|
63
94
|
## 4.0.1
|
|
64
95
|
|
|
65
96
|
### Patch Changes
|
|
66
97
|
|
|
67
|
-
- [#20650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20650)
|
|
98
|
+
- [#20650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20650)
|
|
99
|
+
[`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade
|
|
100
|
+
to TypeScript 4.2.4
|
|
68
101
|
|
|
69
102
|
## 4.0.0
|
|
70
103
|
|
|
71
104
|
### Major Changes
|
|
72
105
|
|
|
73
|
-
- [#20033](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20033)
|
|
106
|
+
- [#20033](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20033)
|
|
107
|
+
[`b29ce16dad8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b29ce16dad8) -
|
|
108
|
+
[ED-14606] Move bitbucket schema, confluence schema, jira schema, and default schema from
|
|
109
|
+
@atlaskit/adf-schema to their own entry points. These new entry points are as follows
|
|
74
110
|
|
|
75
111
|
@atlaskit/adf-schema/schema-bitbucket for:
|
|
76
112
|
|
|
@@ -102,47 +138,70 @@
|
|
|
102
138
|
- getSchemaBasedOnStage
|
|
103
139
|
- defaultSchemaConfig
|
|
104
140
|
|
|
105
|
-
This change also includes codemods in @atlaskit/adf-schema to update these entry points. It also
|
|
141
|
+
This change also includes codemods in @atlaskit/adf-schema to update these entry points. It also
|
|
142
|
+
introduces a new util function "changeImportEntryPoint" to @atlaskit/codemod-utils to handle this
|
|
143
|
+
scenario.
|
|
106
144
|
|
|
107
145
|
## 3.4.0
|
|
108
146
|
|
|
109
147
|
### Minor Changes
|
|
110
148
|
|
|
111
|
-
- [#14319](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/14319)
|
|
149
|
+
- [#14319](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/14319)
|
|
150
|
+
[`cf853e39278`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf853e39278) - Adds new
|
|
151
|
+
util `hasImportDeclarationFromAnyPackageEntrypoint`. It works just like `hasImportDeclaration`,
|
|
152
|
+
but instead of searching for an import declaration that has strict equality with a supplied import
|
|
153
|
+
path (e.g. `@atlaskit/theme`), it looks for an import declaration that _starts with_ the supplied
|
|
154
|
+
import path. With that same example, it will match both `@atlaskit/theme` and
|
|
155
|
+
`@atlaskit/theme/typography` — making it easy to choose to run a codemod on a usage regardless of
|
|
156
|
+
the way in which it was imported.
|
|
112
157
|
|
|
113
158
|
## 3.3.0
|
|
114
159
|
|
|
115
160
|
### Minor Changes
|
|
116
161
|
|
|
117
|
-
- [#13864](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/13864)
|
|
162
|
+
- [#13864](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/13864)
|
|
163
|
+
[`9729143f07b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9729143f07b) - Add
|
|
164
|
+
support functions `getDynamicImportName`, `isCallExpressionCalleeImportType`,
|
|
165
|
+
`isCallExpressionArgumentStringLiteralType`, `isCallExpressionArgumentValueMatches` and
|
|
166
|
+
`addDynamicImport`.
|
|
118
167
|
|
|
119
168
|
## 3.2.2
|
|
120
169
|
|
|
121
170
|
### Patch Changes
|
|
122
171
|
|
|
123
|
-
- [#12837](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/12837)
|
|
172
|
+
- [#12837](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/12837)
|
|
173
|
+
[`dc04275805a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dc04275805a) - Update
|
|
174
|
+
types of API addCommentBefore
|
|
124
175
|
|
|
125
176
|
## 3.2.1
|
|
126
177
|
|
|
127
178
|
### Patch Changes
|
|
128
179
|
|
|
129
|
-
- [#11911](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/11911)
|
|
180
|
+
- [#11911](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/11911)
|
|
181
|
+
[`d0ef46dee01`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d0ef46dee01) - Removes
|
|
182
|
+
ts-node / cjs bundle switcher from main entrypoint of codemod-utils and updated codemod-cli
|
|
183
|
+
scripts to support
|
|
130
184
|
|
|
131
185
|
## 3.2.0
|
|
132
186
|
|
|
133
187
|
### Minor Changes
|
|
134
188
|
|
|
135
|
-
- [#10569](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/10569)
|
|
189
|
+
- [#10569](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/10569)
|
|
190
|
+
[`43412f2b0b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43412f2b0b1) - Added
|
|
191
|
+
few helper functions
|
|
136
192
|
|
|
137
193
|
### Patch Changes
|
|
138
194
|
|
|
139
|
-
- [`200ebeada19`](https://bitbucket.org/atlassian/atlassian-frontend/commits/200ebeada19) - Updated
|
|
195
|
+
- [`200ebeada19`](https://bitbucket.org/atlassian/atlassian-frontend/commits/200ebeada19) - Updated
|
|
196
|
+
codemods to handle edge cases
|
|
140
197
|
|
|
141
198
|
## 3.1.0
|
|
142
199
|
|
|
143
200
|
### Minor Changes
|
|
144
201
|
|
|
145
|
-
- [#10787](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/10787)
|
|
202
|
+
- [#10787](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/10787)
|
|
203
|
+
[`2ec9e608acc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2ec9e608acc) - Update
|
|
204
|
+
`addCommentBefore` helper method to:
|
|
146
205
|
|
|
147
206
|
- Make the message prefix optional.
|
|
148
207
|
- _The default remains as `TODO: (from codemod)` for backwards compatibility_
|
|
@@ -153,41 +212,57 @@
|
|
|
153
212
|
|
|
154
213
|
### Major Changes
|
|
155
214
|
|
|
156
|
-
- [#10179](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/10179)
|
|
215
|
+
- [#10179](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/10179)
|
|
216
|
+
[`284a374eed8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/284a374eed8) - Removed
|
|
217
|
+
`createSkipTest` & `createSkipTestTransformer` transformer from the API. This is a **breaking
|
|
218
|
+
change**!
|
|
157
219
|
|
|
158
|
-
If you rely on this transformer, you can now depend on it via a new package
|
|
220
|
+
If you rely on this transformer, you can now depend on it via a new package
|
|
221
|
+
`@af/skip-inconsistent-tests`.
|
|
159
222
|
|
|
160
223
|
## 2.2.1
|
|
161
224
|
|
|
162
225
|
### Patch Changes
|
|
163
226
|
|
|
164
|
-
- [#9756](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/9756)
|
|
165
|
-
|
|
227
|
+
- [#9756](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/9756)
|
|
228
|
+
[`1300c88e2cc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1300c88e2cc) - Add
|
|
229
|
+
shouldApplyTransform to createTransformer so there is a check before transforms are run.
|
|
230
|
+
- [`1b6bf93be84`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b6bf93be84) - Migrate
|
|
231
|
+
helper functions into codemod-utils
|
|
166
232
|
|
|
167
233
|
## 2.2.0
|
|
168
234
|
|
|
169
235
|
### Minor Changes
|
|
170
236
|
|
|
171
|
-
- [#9940](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/9940)
|
|
237
|
+
- [#9940](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/9940)
|
|
238
|
+
[`2474e09dc7f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2474e09dc7f) - Add new
|
|
239
|
+
method to create a custom Transformer for skip test
|
|
172
240
|
|
|
173
241
|
## 2.1.2
|
|
174
242
|
|
|
175
243
|
### Patch Changes
|
|
176
244
|
|
|
177
|
-
- [#9832](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/9832)
|
|
178
|
-
|
|
245
|
+
- [#9832](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/9832)
|
|
246
|
+
[`d72b572dfc2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d72b572dfc2) - bumped
|
|
247
|
+
jscodeshift@^0.11.0
|
|
248
|
+
- [`d72b572dfc2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d72b572dfc2) - bumped
|
|
249
|
+
@types/jscodeshift@^0.11.0
|
|
179
250
|
|
|
180
251
|
## 2.1.1
|
|
181
252
|
|
|
182
253
|
### Patch Changes
|
|
183
254
|
|
|
184
|
-
- [#8981](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/8981)
|
|
255
|
+
- [#8981](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/8981)
|
|
256
|
+
[`5be80507d82`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5be80507d82) - Fixed a
|
|
257
|
+
defect in move component to entry point codemod
|
|
185
258
|
|
|
186
259
|
## 2.1.0
|
|
187
260
|
|
|
188
261
|
### Minor Changes
|
|
189
262
|
|
|
190
|
-
- [#8169](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/8169)
|
|
263
|
+
- [#8169](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/8169)
|
|
264
|
+
[`7e295f4d9da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7e295f4d9da) - Added
|
|
265
|
+
more lower level helpers for writing codemod:
|
|
191
266
|
|
|
192
267
|
- getDefaultSpecifier
|
|
193
268
|
- getNamedSpecifier
|
|
@@ -204,10 +279,14 @@
|
|
|
204
279
|
|
|
205
280
|
### Patch Changes
|
|
206
281
|
|
|
207
|
-
- [#7012](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/7012)
|
|
282
|
+
- [#7012](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/7012)
|
|
283
|
+
[`ecc5b95e65`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ecc5b95e65) - ED-11440:
|
|
284
|
+
Add skipTest to codemod-utils
|
|
208
285
|
|
|
209
286
|
## 2.0.0
|
|
210
287
|
|
|
211
288
|
### Major Changes
|
|
212
289
|
|
|
213
|
-
- [#6722](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/6722)
|
|
290
|
+
- [#6722](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/6722)
|
|
291
|
+
[`f1e5c2be81`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f1e5c2be81) - ED-11335:
|
|
292
|
+
Initialise codemod-utils package
|
package/LICENSE.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Copyright 2020 Atlassian Pty Ltd
|
|
2
2
|
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
You may obtain a copy of the License at
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
4
|
+
compliance with the License. You may obtain a copy of the License at
|
|
6
5
|
|
|
7
6
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
7
|
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
limitations under the License.
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
10
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
11
|
+
License.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Collection } from 'jscodeshift/src/Collection';
|
|
1
|
+
import type { API, ASTPath, Collection, default as core, FileInfo, Options } from 'jscodeshift';
|
|
3
2
|
declare const createRemoveFuncFor: (component: string, importName: string, prop: string, predicate?: (j: core.JSCodeshift, element: ASTPath<any>) => boolean, comment?: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
4
3
|
declare const createRenameFuncFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
5
4
|
declare const createConvertFuncFor: (component: string, from: string, to: string, predicate?: ((value: any) => boolean) | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Collection } from 'jscodeshift/src/Collection';
|
|
1
|
+
import type { ASTPath, CallExpression, Collection, default as core, ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier, JSXAttribute, JSXElement, Program, VariableDeclaration, VariableDeclarator } from 'jscodeshift';
|
|
3
2
|
declare function getNamedSpecifier(j: core.JSCodeshift, source: Collection<Node>, specifier: string, importName: string): string | null;
|
|
4
3
|
declare const getDynamicImportName: (j: core.JSCodeshift, source: Collection<any>, importPath: string) => string | null;
|
|
5
4
|
declare const addDynamicImport: (j: core.JSCodeshift, target: Collection<VariableDeclaration>, name: string, packageEndpoint: string) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Collection } from 'jscodeshift/src/Collection';
|
|
1
|
+
import type { API, ASTPath, Collection, default as core, FileInfo, Options } from 'jscodeshift';
|
|
3
2
|
declare const createRemoveFuncFor: (component: string, importName: string, prop: string, predicate?: (j: core.JSCodeshift, element: ASTPath<any>) => boolean, comment?: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
4
3
|
declare const createRenameFuncFor: (component: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
5
4
|
declare const createConvertFuncFor: (component: string, from: string, to: string, predicate?: ((value: any) => boolean) | undefined) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Collection } from 'jscodeshift/src/Collection';
|
|
1
|
+
import type { ASTPath, CallExpression, Collection, default as core, ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier, JSXAttribute, JSXElement, Program, VariableDeclaration, VariableDeclarator } from 'jscodeshift';
|
|
3
2
|
declare function getNamedSpecifier(j: core.JSCodeshift, source: Collection<Node>, specifier: string, importName: string): string | null;
|
|
4
3
|
declare const getDynamicImportName: (j: core.JSCodeshift, source: Collection<any>, importPath: string) => string | null;
|
|
5
4
|
declare const addDynamicImport: (j: core.JSCodeshift, target: Collection<VariableDeclaration>, name: string, packageEndpoint: string) => void;
|
package/package.json
CHANGED
|
@@ -1,70 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
70
|
-
}
|
|
2
|
+
"name": "@atlaskit/codemod-utils",
|
|
3
|
+
"version": "4.2.5",
|
|
4
|
+
"author": "Atlassian Pty Ltd",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"description": " jscodeshift-compatible codemod utilities",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Build Infra"
|
|
12
|
+
},
|
|
13
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
14
|
+
"main": "dist/cjs/index.js",
|
|
15
|
+
"module": "dist/esm/index.js",
|
|
16
|
+
"module:es2019": "dist/es2019/index.js",
|
|
17
|
+
"types": "dist/types/index.d.ts",
|
|
18
|
+
"typesVersions": {
|
|
19
|
+
">=4.5 <4.9": {
|
|
20
|
+
"*": [
|
|
21
|
+
"dist/types-ts4.5/*",
|
|
22
|
+
"dist/types-ts4.5/index.d.ts"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"atlaskit:src": "src/index.ts",
|
|
28
|
+
"af:exports": {
|
|
29
|
+
".": "./src/index.ts"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@babel/runtime": "^7.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/jscodeshift": "^0.11.0",
|
|
36
|
+
"jscodeshift": "^0.16.1",
|
|
37
|
+
"typescript": "~5.4.2"
|
|
38
|
+
},
|
|
39
|
+
"techstack": {
|
|
40
|
+
"@atlassian/frontend": {
|
|
41
|
+
"import-structure": [
|
|
42
|
+
"atlassian-conventions"
|
|
43
|
+
],
|
|
44
|
+
"circular-dependencies": [
|
|
45
|
+
"file-and-folder-level"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"@repo/internal": {
|
|
49
|
+
"analytics": [
|
|
50
|
+
"analytics-next"
|
|
51
|
+
],
|
|
52
|
+
"design-tokens": [
|
|
53
|
+
"color"
|
|
54
|
+
],
|
|
55
|
+
"theming": [
|
|
56
|
+
"react-context"
|
|
57
|
+
],
|
|
58
|
+
"ui-components": [
|
|
59
|
+
"lite-mode"
|
|
60
|
+
],
|
|
61
|
+
"deprecation": [
|
|
62
|
+
"no-deprecated-imports"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
package/report.api.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/codemod-utils"
|
|
4
4
|
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
5
|
+
> Do not edit this file. This report is auto-generated using
|
|
6
|
+
> [API Extractor](https://api-extractor.com/).
|
|
6
7
|
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
8
|
|
|
8
9
|
### Table of contents
|
|
@@ -33,233 +34,227 @@ import { VariableDeclarator } from 'jscodeshift';
|
|
|
33
34
|
|
|
34
35
|
// @public (undocumented)
|
|
35
36
|
export function addCommentBefore(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
j: core.JSCodeshift,
|
|
38
|
+
target:
|
|
39
|
+
| Collection<CallExpression>
|
|
40
|
+
| Collection<ImportDeclaration>
|
|
41
|
+
| Collection<JSXAttribute>
|
|
42
|
+
| Collection<JSXElement>
|
|
43
|
+
| Collection<Program>
|
|
44
|
+
| Collection<VariableDeclarator>,
|
|
45
|
+
message: string,
|
|
46
|
+
commentType?: 'block' | 'line',
|
|
47
|
+
messagePrefix?: string,
|
|
47
48
|
): void;
|
|
48
49
|
|
|
49
50
|
// @public (undocumented)
|
|
50
51
|
export const addCommentToStartOfFile: ({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
j,
|
|
53
|
+
base,
|
|
54
|
+
message,
|
|
54
55
|
}: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
j: core.JSCodeshift;
|
|
57
|
+
base: Collection<Node>;
|
|
58
|
+
message: string;
|
|
58
59
|
}) => void;
|
|
59
60
|
|
|
60
61
|
// @public (undocumented)
|
|
61
62
|
export const addDynamicImport: (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
j: core.JSCodeshift,
|
|
64
|
+
target: Collection<VariableDeclaration>,
|
|
65
|
+
name: string,
|
|
66
|
+
packageEndpoint: string,
|
|
66
67
|
) => void;
|
|
67
68
|
|
|
68
69
|
// @public (undocumented)
|
|
69
70
|
export function addToImport(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
j: core.JSCodeshift,
|
|
72
|
+
base: Collection<any>,
|
|
73
|
+
importSpecifier: ImportDefaultSpecifier | ImportSpecifier,
|
|
74
|
+
packageName: string,
|
|
74
75
|
): void;
|
|
75
76
|
|
|
76
77
|
// @public (undocumented)
|
|
77
78
|
export const callExpressionArgMatchesString: (
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
arg: CallExpression['arguments'][number],
|
|
80
|
+
str: string,
|
|
80
81
|
) => boolean;
|
|
81
82
|
|
|
82
83
|
// @public (undocumented)
|
|
83
84
|
export const changeImportEntryPoint: (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
oldPackageName: string,
|
|
86
|
+
importToConvert: string,
|
|
87
|
+
newPackageName: string,
|
|
88
|
+
shouldBeTypeImport?: boolean,
|
|
88
89
|
) => (j: core.JSCodeshift, root: Collection<Node>) => void;
|
|
89
90
|
|
|
90
91
|
// @public (undocumented)
|
|
91
92
|
export const createConvertFuncFor: (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
component: string,
|
|
94
|
+
from: string,
|
|
95
|
+
to: string,
|
|
96
|
+
predicate?: ((value: any) => boolean) | undefined,
|
|
96
97
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
97
98
|
|
|
98
99
|
// @public (undocumented)
|
|
99
100
|
export const createRemoveFuncAddCommentFor: (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
component: string,
|
|
102
|
+
prop: string,
|
|
103
|
+
comment?: string,
|
|
103
104
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
104
105
|
|
|
105
106
|
// @public (undocumented)
|
|
106
107
|
export const createRemoveFuncFor: (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
component: string,
|
|
109
|
+
importName: string,
|
|
110
|
+
prop: string,
|
|
111
|
+
predicate?: (j: core.JSCodeshift, element: ASTPath<any>) => boolean,
|
|
112
|
+
comment?: string,
|
|
112
113
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
113
114
|
|
|
114
115
|
// @public (undocumented)
|
|
115
116
|
export const createRenameFuncFor: (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
component: string,
|
|
118
|
+
from: string,
|
|
119
|
+
to: string,
|
|
119
120
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
120
121
|
|
|
121
122
|
// @public (undocumented)
|
|
122
123
|
export const createRenameImportFor: (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
component: string,
|
|
125
|
+
from: string,
|
|
126
|
+
to: string,
|
|
126
127
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
127
128
|
|
|
128
129
|
// @public (undocumented)
|
|
129
130
|
export const createRenameJSXFunc: (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
packagePath: string,
|
|
132
|
+
from: string,
|
|
133
|
+
to: string,
|
|
134
|
+
fallback?: string | undefined,
|
|
134
135
|
) => (j: core.JSCodeshift, source: any) => void;
|
|
135
136
|
|
|
136
137
|
// @public (undocumented)
|
|
137
138
|
export const createTransformer: (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
| ((j: core.JSCodeshift, source: Collection<Node>) => boolean)
|
|
141
|
-
| undefined,
|
|
139
|
+
migrates: ((j: core.JSCodeshift, source: Collection<Node>) => void)[],
|
|
140
|
+
shouldApplyTransform?: ((j: core.JSCodeshift, source: Collection<Node>) => boolean) | undefined,
|
|
142
141
|
) => (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
|
|
143
142
|
|
|
144
143
|
// @public (undocumented)
|
|
145
144
|
export const doesIdentifierExist: (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
j: core.JSCodeshift,
|
|
146
|
+
base: Collection<any>,
|
|
147
|
+
name: string,
|
|
149
148
|
) => boolean;
|
|
150
149
|
|
|
151
150
|
// @public (undocumented)
|
|
152
151
|
export const elevateComponentToNewEntryPoint: (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
pkg: string,
|
|
153
|
+
toPkg: string,
|
|
154
|
+
innerElementName: string,
|
|
156
155
|
) => (j: core.JSCodeshift, root: any) => void;
|
|
157
156
|
|
|
158
157
|
// @public (undocumented)
|
|
159
158
|
export const flattenCertainChildPropsAsProp: (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
component: string,
|
|
160
|
+
propName: string,
|
|
161
|
+
childProps: string[],
|
|
163
162
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
164
163
|
|
|
165
164
|
// @public (undocumented)
|
|
166
165
|
export const getDefaultSpecifier: (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
j: core.JSCodeshift,
|
|
167
|
+
source: Collection<Node>,
|
|
168
|
+
specifier: string,
|
|
170
169
|
) => null | string;
|
|
171
170
|
|
|
172
171
|
// @public (undocumented)
|
|
173
172
|
export const getDynamicImportName: (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
j: core.JSCodeshift,
|
|
174
|
+
source: Collection<any>,
|
|
175
|
+
importPath: string,
|
|
177
176
|
) => null | string;
|
|
178
177
|
|
|
179
178
|
// @public (undocumented)
|
|
180
179
|
export const getJSXAttributesByName: (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
j: core.JSCodeshift,
|
|
181
|
+
element: ASTPath<any>,
|
|
182
|
+
attributeName: string,
|
|
184
183
|
) => Collection<JSXAttribute>;
|
|
185
184
|
|
|
186
185
|
// @public (undocumented)
|
|
187
186
|
export function getNamedSpecifier(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
j: core.JSCodeshift,
|
|
188
|
+
source: Collection<Node>,
|
|
189
|
+
specifier: string,
|
|
190
|
+
importName: string,
|
|
192
191
|
): null | string;
|
|
193
192
|
|
|
194
193
|
// @public (undocumented)
|
|
195
194
|
export function getSafeImportName({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
j,
|
|
196
|
+
base,
|
|
197
|
+
currentDefaultSpecifierName,
|
|
198
|
+
desiredName,
|
|
199
|
+
fallbackName,
|
|
201
200
|
}: {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
j: core.JSCodeshift;
|
|
202
|
+
base: Collection<any>;
|
|
203
|
+
currentDefaultSpecifierName: null | string;
|
|
204
|
+
desiredName: string;
|
|
205
|
+
fallbackName: string;
|
|
207
206
|
}): string;
|
|
208
207
|
|
|
209
208
|
// @public (undocumented)
|
|
210
209
|
export const hasImportDeclaration: (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
j: core.JSCodeshift,
|
|
211
|
+
source: Collection<Node>,
|
|
212
|
+
importPath: string,
|
|
214
213
|
) => boolean;
|
|
215
214
|
|
|
216
215
|
// @public (undocumented)
|
|
217
216
|
export const hasImportDeclarationFromAnyPackageEntrypoint: (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
j: core.JSCodeshift,
|
|
218
|
+
source: Collection<Node>,
|
|
219
|
+
packageName: string,
|
|
221
220
|
) => boolean;
|
|
222
221
|
|
|
223
222
|
// @public (undocumented)
|
|
224
223
|
export const hasJSXAttributesByName: (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
j: core.JSCodeshift,
|
|
225
|
+
element: ASTPath<any>,
|
|
226
|
+
attributeName: string,
|
|
228
227
|
) => boolean;
|
|
229
228
|
|
|
230
229
|
// @public (undocumented)
|
|
231
|
-
export function removeImport(
|
|
232
|
-
j: core.JSCodeshift,
|
|
233
|
-
base: Collection<any>,
|
|
234
|
-
packageName: string,
|
|
235
|
-
): void;
|
|
230
|
+
export function removeImport(j: core.JSCodeshift, base: Collection<any>, packageName: string): void;
|
|
236
231
|
|
|
237
232
|
// @public (undocumented)
|
|
238
233
|
export const renameNamedImportWithAliasName: (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
component: string,
|
|
235
|
+
from: string,
|
|
236
|
+
to: string,
|
|
242
237
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
243
238
|
|
|
244
239
|
// @public (undocumented)
|
|
245
240
|
export const replaceImportStatementFor: (
|
|
246
|
-
|
|
247
|
-
|
|
241
|
+
pkg: string,
|
|
242
|
+
convertMap: any,
|
|
248
243
|
) => (j: core.JSCodeshift, root: Collection<Node>) => void;
|
|
249
244
|
|
|
250
245
|
// @public (undocumented)
|
|
251
246
|
export const testMethodVariantEach: (
|
|
252
|
-
|
|
253
|
-
|
|
247
|
+
path: ASTPath<CallExpression>,
|
|
248
|
+
testMethods: Set<string>,
|
|
254
249
|
) => boolean;
|
|
255
250
|
|
|
256
251
|
// @public (undocumented)
|
|
257
252
|
export function tryCreateImport(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
253
|
+
j: core.JSCodeshift,
|
|
254
|
+
base: Collection<any>,
|
|
255
|
+
relativeToPackage: string,
|
|
256
|
+
packageName: string,
|
|
257
|
+
shouldBeTypeImport?: boolean,
|
|
263
258
|
): void;
|
|
264
259
|
|
|
265
260
|
// (No @packageDocumentation comment for this package)
|