@atlaskit/codemod-utils 4.1.2 → 4.2.0
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 +12 -0
- package/dist/cjs/index.js +29 -31
- package/dist/cjs/utils/index.js +185 -279
- package/dist/cjs/utils/support.js +113 -209
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/utils/index.js +12 -44
- package/dist/es2019/utils/support.js +26 -68
- package/dist/es2019/version.json +1 -1
- package/dist/esm/utils/index.js +12 -44
- package/dist/esm/utils/support.js +32 -77
- package/dist/esm/version.json +1 -1
- package/package.json +6 -3
- package/report.api.md +92 -41
package/report.api.md
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## API Report File for "@atlaskit/codemod-utils"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
12
|
+
|
|
13
|
+
### Main Entry Types
|
|
14
|
+
|
|
15
|
+
<!--SECTION START: Main Entry Types-->
|
|
6
16
|
|
|
7
17
|
```ts
|
|
8
18
|
import { API } from 'jscodeshift';
|
|
@@ -21,21 +31,23 @@ import { Program } from 'jscodeshift';
|
|
|
21
31
|
import { VariableDeclaration } from 'jscodeshift';
|
|
22
32
|
import { VariableDeclarator } from 'jscodeshift';
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
export function addCommentBefore(
|
|
25
36
|
j: core.JSCodeshift,
|
|
26
37
|
target:
|
|
27
|
-
| Collection<
|
|
38
|
+
| Collection<CallExpression>
|
|
28
39
|
| Collection<ImportDeclaration>
|
|
29
|
-
| Collection<JSXElement>
|
|
30
40
|
| Collection<JSXAttribute>
|
|
31
|
-
| Collection<
|
|
41
|
+
| Collection<JSXElement>
|
|
42
|
+
| Collection<Program>
|
|
32
43
|
| Collection<VariableDeclarator>,
|
|
33
44
|
message: string,
|
|
34
45
|
commentType?: 'block' | 'line',
|
|
35
46
|
messagePrefix?: string,
|
|
36
47
|
): void;
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
// @public (undocumented)
|
|
50
|
+
export const addCommentToStartOfFile: ({
|
|
39
51
|
j,
|
|
40
52
|
base,
|
|
41
53
|
message,
|
|
@@ -45,46 +57,53 @@ export declare const addCommentToStartOfFile: ({
|
|
|
45
57
|
message: string;
|
|
46
58
|
}) => void;
|
|
47
59
|
|
|
48
|
-
|
|
60
|
+
// @public (undocumented)
|
|
61
|
+
export const addDynamicImport: (
|
|
49
62
|
j: core.JSCodeshift,
|
|
50
63
|
target: Collection<VariableDeclaration>,
|
|
51
64
|
name: string,
|
|
52
65
|
packageEndpoint: string,
|
|
53
66
|
) => void;
|
|
54
67
|
|
|
55
|
-
|
|
68
|
+
// @public (undocumented)
|
|
69
|
+
export function addToImport(
|
|
56
70
|
j: core.JSCodeshift,
|
|
57
71
|
base: Collection<any>,
|
|
58
|
-
importSpecifier:
|
|
72
|
+
importSpecifier: ImportDefaultSpecifier | ImportSpecifier,
|
|
59
73
|
packageName: string,
|
|
60
74
|
): void;
|
|
61
75
|
|
|
62
|
-
|
|
76
|
+
// @public (undocumented)
|
|
77
|
+
export const callExpressionArgMatchesString: (
|
|
63
78
|
arg: CallExpression['arguments'][number],
|
|
64
79
|
str: string,
|
|
65
80
|
) => boolean;
|
|
66
81
|
|
|
67
|
-
|
|
82
|
+
// @public (undocumented)
|
|
83
|
+
export const changeImportEntryPoint: (
|
|
68
84
|
oldPackageName: string,
|
|
69
85
|
importToConvert: string,
|
|
70
86
|
newPackageName: string,
|
|
71
87
|
shouldBeTypeImport?: boolean | undefined,
|
|
72
88
|
) => (j: core.JSCodeshift, root: Collection<Node>) => void;
|
|
73
89
|
|
|
74
|
-
|
|
90
|
+
// @public (undocumented)
|
|
91
|
+
export const createConvertFuncFor: (
|
|
75
92
|
component: string,
|
|
76
93
|
from: string,
|
|
77
94
|
to: string,
|
|
78
95
|
predicate?: ((value: any) => boolean) | undefined,
|
|
79
96
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
80
97
|
|
|
81
|
-
|
|
98
|
+
// @public (undocumented)
|
|
99
|
+
export const createRemoveFuncAddCommentFor: (
|
|
82
100
|
component: string,
|
|
83
101
|
prop: string,
|
|
84
102
|
comment?: string | undefined,
|
|
85
103
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
86
104
|
|
|
87
|
-
|
|
105
|
+
// @public (undocumented)
|
|
106
|
+
export const createRemoveFuncFor: (
|
|
88
107
|
component: string,
|
|
89
108
|
importName: string,
|
|
90
109
|
prop: string,
|
|
@@ -92,76 +111,88 @@ export declare const createRemoveFuncFor: (
|
|
|
92
111
|
comment?: string | undefined,
|
|
93
112
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
94
113
|
|
|
95
|
-
|
|
114
|
+
// @public (undocumented)
|
|
115
|
+
export const createRenameFuncFor: (
|
|
96
116
|
component: string,
|
|
97
117
|
from: string,
|
|
98
118
|
to: string,
|
|
99
119
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
100
120
|
|
|
101
|
-
|
|
121
|
+
// @public (undocumented)
|
|
122
|
+
export const createRenameImportFor: (
|
|
102
123
|
component: string,
|
|
103
124
|
from: string,
|
|
104
125
|
to: string,
|
|
105
126
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
106
127
|
|
|
107
|
-
|
|
128
|
+
// @public (undocumented)
|
|
129
|
+
export const createRenameJSXFunc: (
|
|
108
130
|
packagePath: string,
|
|
109
131
|
from: string,
|
|
110
132
|
to: string,
|
|
111
133
|
fallback?: string | undefined,
|
|
112
134
|
) => (j: core.JSCodeshift, source: any) => void;
|
|
113
135
|
|
|
114
|
-
|
|
136
|
+
// @public (undocumented)
|
|
137
|
+
export const createTransformer: (
|
|
115
138
|
migrates: ((j: core.JSCodeshift, source: Collection<Node>) => void)[],
|
|
116
139
|
shouldApplyTransform?:
|
|
117
140
|
| ((j: core.JSCodeshift, source: Collection<Node>) => boolean)
|
|
118
141
|
| undefined,
|
|
119
142
|
) => (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
|
|
120
143
|
|
|
121
|
-
|
|
144
|
+
// @public (undocumented)
|
|
145
|
+
export const doesIdentifierExist: (
|
|
122
146
|
j: core.JSCodeshift,
|
|
123
147
|
base: Collection<any>,
|
|
124
148
|
name: string,
|
|
125
149
|
) => boolean;
|
|
126
150
|
|
|
127
|
-
|
|
151
|
+
// @public (undocumented)
|
|
152
|
+
export const elevateComponentToNewEntryPoint: (
|
|
128
153
|
pkg: string,
|
|
129
154
|
toPkg: string,
|
|
130
155
|
innerElementName: string,
|
|
131
156
|
) => (j: core.JSCodeshift, root: any) => void;
|
|
132
157
|
|
|
133
|
-
|
|
158
|
+
// @public (undocumented)
|
|
159
|
+
export const flattenCertainChildPropsAsProp: (
|
|
134
160
|
component: string,
|
|
135
161
|
propName: string,
|
|
136
162
|
childProps: string[],
|
|
137
163
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
138
164
|
|
|
139
|
-
|
|
165
|
+
// @public (undocumented)
|
|
166
|
+
export const getDefaultSpecifier: (
|
|
140
167
|
j: core.JSCodeshift,
|
|
141
168
|
source: Collection<Node>,
|
|
142
169
|
specifier: string,
|
|
143
|
-
) =>
|
|
170
|
+
) => null | string;
|
|
144
171
|
|
|
145
|
-
|
|
172
|
+
// @public (undocumented)
|
|
173
|
+
export const getDynamicImportName: (
|
|
146
174
|
j: core.JSCodeshift,
|
|
147
175
|
source: Collection<any>,
|
|
148
176
|
importPath: string,
|
|
149
|
-
) =>
|
|
177
|
+
) => null | string;
|
|
150
178
|
|
|
151
|
-
|
|
179
|
+
// @public (undocumented)
|
|
180
|
+
export const getJSXAttributesByName: (
|
|
152
181
|
j: core.JSCodeshift,
|
|
153
182
|
element: ASTPath<any>,
|
|
154
183
|
attributeName: string,
|
|
155
184
|
) => Collection<JSXAttribute>;
|
|
156
185
|
|
|
157
|
-
|
|
186
|
+
// @public (undocumented)
|
|
187
|
+
export function getNamedSpecifier(
|
|
158
188
|
j: core.JSCodeshift,
|
|
159
189
|
source: Collection<Node>,
|
|
160
190
|
specifier: string,
|
|
161
191
|
importName: string,
|
|
162
|
-
):
|
|
192
|
+
): null | string;
|
|
163
193
|
|
|
164
|
-
|
|
194
|
+
// @public (undocumented)
|
|
195
|
+
export function getSafeImportName({
|
|
165
196
|
j,
|
|
166
197
|
base,
|
|
167
198
|
currentDefaultSpecifierName,
|
|
@@ -170,52 +201,60 @@ export declare function getSafeImportName({
|
|
|
170
201
|
}: {
|
|
171
202
|
j: core.JSCodeshift;
|
|
172
203
|
base: Collection<any>;
|
|
173
|
-
currentDefaultSpecifierName:
|
|
204
|
+
currentDefaultSpecifierName: null | string;
|
|
174
205
|
desiredName: string;
|
|
175
206
|
fallbackName: string;
|
|
176
207
|
}): string;
|
|
177
208
|
|
|
178
|
-
|
|
209
|
+
// @public (undocumented)
|
|
210
|
+
export const hasImportDeclaration: (
|
|
179
211
|
j: core.JSCodeshift,
|
|
180
212
|
source: Collection<Node>,
|
|
181
213
|
importPath: string,
|
|
182
214
|
) => boolean;
|
|
183
215
|
|
|
184
|
-
|
|
216
|
+
// @public (undocumented)
|
|
217
|
+
export const hasImportDeclarationFromAnyPackageEntrypoint: (
|
|
185
218
|
j: core.JSCodeshift,
|
|
186
219
|
source: Collection<Node>,
|
|
187
220
|
packageName: string,
|
|
188
221
|
) => boolean;
|
|
189
222
|
|
|
190
|
-
|
|
223
|
+
// @public (undocumented)
|
|
224
|
+
export const hasJSXAttributesByName: (
|
|
191
225
|
j: core.JSCodeshift,
|
|
192
226
|
element: ASTPath<any>,
|
|
193
227
|
attributeName: string,
|
|
194
228
|
) => boolean;
|
|
195
229
|
|
|
196
|
-
|
|
230
|
+
// @public (undocumented)
|
|
231
|
+
export function removeImport(
|
|
197
232
|
j: core.JSCodeshift,
|
|
198
233
|
base: Collection<any>,
|
|
199
234
|
packageName: string,
|
|
200
235
|
): void;
|
|
201
236
|
|
|
202
|
-
|
|
237
|
+
// @public (undocumented)
|
|
238
|
+
export const renameNamedImportWithAliasName: (
|
|
203
239
|
component: string,
|
|
204
240
|
from: string,
|
|
205
241
|
to: string,
|
|
206
242
|
) => (j: core.JSCodeshift, source: Collection<Node>) => void;
|
|
207
243
|
|
|
208
|
-
|
|
244
|
+
// @public (undocumented)
|
|
245
|
+
export const replaceImportStatementFor: (
|
|
209
246
|
pkg: string,
|
|
210
247
|
convertMap: any,
|
|
211
248
|
) => (j: core.JSCodeshift, root: Collection<Node>) => void;
|
|
212
249
|
|
|
213
|
-
|
|
250
|
+
// @public (undocumented)
|
|
251
|
+
export const testMethodVariantEach: (
|
|
214
252
|
path: ASTPath<CallExpression>,
|
|
215
253
|
testMethods: Set<string>,
|
|
216
254
|
) => boolean;
|
|
217
255
|
|
|
218
|
-
|
|
256
|
+
// @public (undocumented)
|
|
257
|
+
export function tryCreateImport(
|
|
219
258
|
j: core.JSCodeshift,
|
|
220
259
|
base: Collection<any>,
|
|
221
260
|
relativeToPackage: string,
|
|
@@ -223,5 +262,17 @@ export declare function tryCreateImport(
|
|
|
223
262
|
shouldBeTypeImport?: boolean,
|
|
224
263
|
): void;
|
|
225
264
|
|
|
226
|
-
|
|
265
|
+
// (No @packageDocumentation comment for this package)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
<!--SECTION END: Main Entry Types-->
|
|
269
|
+
|
|
270
|
+
### Peer Dependencies
|
|
271
|
+
|
|
272
|
+
<!--SECTION START: Peer Dependencies-->
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{}
|
|
227
276
|
```
|
|
277
|
+
|
|
278
|
+
<!--SECTION END: Peer Dependencies-->
|