@atlaskit/popper 5.6.0 → 6.1.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 +370 -357
- package/__perf__/default.tsx +17 -16
- package/codemods/5.0.0-lite-mode.tsx +128 -157
- package/codemods/__tests__/update-modifier.tsx +15 -15
- package/codemods/__tests__/update-offset-prop.tsx +71 -71
- package/codemods/__tests__/update-render-props.tsx +13 -13
- package/codemods/utils/helpers.tsx +253 -263
- package/dist/types/popper.d.ts +2 -2
- package/dist/types-ts4.5/popper.d.ts +2 -2
- package/package.json +91 -95
- package/report.api.md +15 -14
- package/dist/cjs/__tests_external__/index.js +0 -12
- package/dist/cjs/__tests_external__/page-objects/base-popper.js +0 -30
- package/dist/cjs/__tests_external__/test-cases/popper.js +0 -18
- package/dist/cjs/in-product.js +0 -12
- package/dist/es2019/__tests_external__/index.js +0 -1
- package/dist/es2019/__tests_external__/page-objects/base-popper.js +0 -6
- package/dist/es2019/__tests_external__/test-cases/popper.js +0 -10
- package/dist/es2019/in-product.js +0 -1
- package/dist/esm/__tests_external__/index.js +0 -1
- package/dist/esm/__tests_external__/page-objects/base-popper.js +0 -23
- package/dist/esm/__tests_external__/test-cases/popper.js +0 -12
- package/dist/esm/in-product.js +0 -1
- package/dist/types/__tests_external__/index.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/base-popper.d.ts +0 -7
- package/dist/types/__tests_external__/test-cases/popper.d.ts +0 -2
- package/dist/types/in-product.d.ts +0 -1
- package/dist/types-ts4.5/__tests_external__/index.d.ts +0 -1
- package/dist/types-ts4.5/__tests_external__/page-objects/base-popper.d.ts +0 -5
- package/dist/types-ts4.5/__tests_external__/test-cases/popper.d.ts +0 -2
- package/dist/types-ts4.5/in-product.d.ts +0 -1
- package/in-product/package.json +0 -15
|
@@ -5,17 +5,17 @@ import transformer from '../5.0.0-lite-mode';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('Update props', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
/**
|
|
9
|
+
* It should rename outOfBoundaries and scheduleUpdate props
|
|
10
|
+
* Render Props:
|
|
11
|
+
* - `outOfBoundaries` has been replaced with `isReferenceHidden`, and is now true when the popper is hidden (i.e. by a
|
|
12
|
+
* scroll container)
|
|
13
|
+
* - `scheduleUpdate`, for async updates, has been renamed to `update`, and now returns a Promise.
|
|
14
|
+
*/
|
|
15
|
+
defineInlineTest(
|
|
16
|
+
{ default: transformer, parser: 'tsx' },
|
|
17
|
+
{},
|
|
18
|
+
`
|
|
19
19
|
import { Popper } from '@atlaskit/popper';
|
|
20
20
|
|
|
21
21
|
export default () => (
|
|
@@ -35,7 +35,7 @@ describe('Update props', () => {
|
|
|
35
35
|
</Popper>
|
|
36
36
|
)
|
|
37
37
|
`,
|
|
38
|
-
|
|
38
|
+
`
|
|
39
39
|
import { Popper } from '@atlaskit/popper';
|
|
40
40
|
|
|
41
41
|
export default () => (
|
|
@@ -55,5 +55,5 @@ describe('Update props', () => {
|
|
|
55
55
|
</Popper>
|
|
56
56
|
)
|
|
57
57
|
`,
|
|
58
|
-
|
|
58
|
+
);
|
|
59
59
|
});
|
|
@@ -1,260 +1,256 @@
|
|
|
1
|
-
import { NodePath } from 'ast-types/lib/node-path';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type NodePath } from 'ast-types/lib/node-path';
|
|
2
|
+
import {
|
|
3
|
+
type ASTPath,
|
|
4
|
+
type default as core,
|
|
5
|
+
type ImportDeclaration,
|
|
6
|
+
type JSXAttribute,
|
|
7
|
+
type JSXElement,
|
|
8
|
+
type Node,
|
|
8
9
|
} from 'jscodeshift';
|
|
9
|
-
import { Collection } from 'jscodeshift/src/Collection';
|
|
10
|
+
import { type Collection } from 'jscodeshift/src/Collection';
|
|
10
11
|
|
|
11
12
|
export type Nullable<T> = T | null;
|
|
12
13
|
|
|
13
14
|
export function hasImportDeclaration(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
j: core.JSCodeshift,
|
|
16
|
+
source: string,
|
|
17
|
+
importPath: string,
|
|
17
18
|
): boolean {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
).length > 0
|
|
25
|
-
);
|
|
19
|
+
return (
|
|
20
|
+
j(source)
|
|
21
|
+
.find(j.ImportDeclaration)
|
|
22
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === importPath).length >
|
|
23
|
+
0
|
|
24
|
+
);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export function getDefaultSpecifierName({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
j,
|
|
29
|
+
base,
|
|
30
|
+
packageName,
|
|
32
31
|
}: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
j: core.JSCodeshift;
|
|
33
|
+
base: Collection<any>;
|
|
34
|
+
packageName: string;
|
|
36
35
|
}): Nullable<string> {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const specifiers = base
|
|
37
|
+
.find(j.ImportDeclaration)
|
|
38
|
+
.filter((path) => path.node.source.value === packageName)
|
|
39
|
+
.find(j.ImportDefaultSpecifier);
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
if (!specifiers.length) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return specifiers.nodes()[0]!.local!.name;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
export function getSpecifierName({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
j,
|
|
49
|
+
base,
|
|
50
|
+
packageName,
|
|
51
|
+
component,
|
|
53
52
|
}: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
j: core.JSCodeshift;
|
|
54
|
+
base: Collection<any>;
|
|
55
|
+
packageName: string;
|
|
56
|
+
component: string;
|
|
58
57
|
}): Nullable<string> {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
const specifiers = base
|
|
59
|
+
.find(j.ImportDeclaration)
|
|
60
|
+
.filter((path) => path.node.source.value === packageName)
|
|
61
|
+
.find(j.ImportSpecifier);
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// @ts-ignore
|
|
74
|
-
return specifierNode.local.name;
|
|
63
|
+
if (!specifiers.length) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const specifierNode = specifiers.nodes().find((node) => node.imported.name === component);
|
|
67
|
+
if (!specifierNode) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
return specifierNode.local.name;
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
export function getJSXAttributesByName({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
j,
|
|
76
|
+
element,
|
|
77
|
+
attributeName,
|
|
81
78
|
}: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
j: core.JSCodeshift;
|
|
80
|
+
element: JSXElement | ASTPath<JSXElement>;
|
|
81
|
+
attributeName: string;
|
|
85
82
|
}): Collection<JSXAttribute> {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
return j(element)
|
|
84
|
+
.find(j.JSXOpeningElement)
|
|
85
|
+
.find(j.JSXAttribute)
|
|
86
|
+
.filter((attribute) => {
|
|
87
|
+
const matches = j(attribute)
|
|
88
|
+
.find(j.JSXIdentifier)
|
|
89
|
+
.filter((identifier) => identifier.value.name === attributeName);
|
|
90
|
+
return Boolean(matches.length);
|
|
91
|
+
});
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
export function hasJSXAttributesByName({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
j,
|
|
96
|
+
element,
|
|
97
|
+
attributeName,
|
|
101
98
|
}: {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
j: core.JSCodeshift;
|
|
100
|
+
element: JSXElement;
|
|
101
|
+
attributeName: string;
|
|
105
102
|
}): boolean {
|
|
106
|
-
|
|
103
|
+
return getJSXAttributesByName({ j, element, attributeName }).length > 0;
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
export function isUsingSupportedSpread({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
j,
|
|
108
|
+
base,
|
|
109
|
+
element,
|
|
113
110
|
}: {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
j: core.JSCodeshift;
|
|
112
|
+
base: Collection<any>;
|
|
113
|
+
element: NodePath<JSXElement, JSXElement>;
|
|
117
114
|
}): boolean {
|
|
118
|
-
|
|
119
|
-
j(element).find(j.JSXSpreadAttribute).length > 0;
|
|
115
|
+
const isUsingSpread: boolean = j(element).find(j.JSXSpreadAttribute).length > 0;
|
|
120
116
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
if (!isUsingSpread) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
124
120
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
return (
|
|
122
|
+
j(element)
|
|
123
|
+
.find(j.JSXSpreadAttribute)
|
|
124
|
+
.filter((spread) => {
|
|
125
|
+
const argument = spread.value.argument;
|
|
126
|
+
// in place expression is supported
|
|
127
|
+
if (argument.type === 'ObjectExpression') {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
134
130
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
131
|
+
// Supporting identifiers that point to an a local object expression
|
|
132
|
+
if (argument.type === 'Identifier') {
|
|
133
|
+
return (
|
|
134
|
+
base.find(j.VariableDeclarator).filter((declarator): boolean => {
|
|
135
|
+
return (
|
|
136
|
+
declarator.value.id.type === 'Identifier' &&
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
declarator.value.init.type === 'ObjectExpression'
|
|
139
|
+
);
|
|
140
|
+
}).length > 0
|
|
141
|
+
);
|
|
142
|
+
}
|
|
147
143
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
// We don't support anything else
|
|
145
|
+
return false;
|
|
146
|
+
}).length > 0
|
|
147
|
+
);
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
export function isUsingThroughSpread({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
j,
|
|
152
|
+
base,
|
|
153
|
+
element,
|
|
154
|
+
propName,
|
|
159
155
|
}: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
156
|
+
j: core.JSCodeshift;
|
|
157
|
+
base: Collection<any>;
|
|
158
|
+
element: NodePath<JSXElement, JSXElement>;
|
|
159
|
+
propName: string;
|
|
164
160
|
}): boolean {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
if (!isUsingSupportedSpread({ j, base, element })) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
168
164
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
165
|
+
const isUsedThroughExpression: boolean =
|
|
166
|
+
j(element)
|
|
167
|
+
.find(j.JSXSpreadAttribute)
|
|
168
|
+
.find(j.ObjectExpression)
|
|
169
|
+
.filter((item) => {
|
|
170
|
+
const match: boolean =
|
|
171
|
+
item.value.properties.filter(
|
|
172
|
+
(property) =>
|
|
173
|
+
property.type === 'ObjectProperty' &&
|
|
174
|
+
property.key.type === 'Identifier' &&
|
|
175
|
+
property.key.name === propName,
|
|
176
|
+
).length > 0;
|
|
181
177
|
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
return match;
|
|
179
|
+
}).length > 0;
|
|
184
180
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
if (isUsedThroughExpression) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
188
184
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
185
|
+
const isUsedThroughIdentifier: boolean =
|
|
186
|
+
j(element)
|
|
187
|
+
.find(j.JSXSpreadAttribute)
|
|
188
|
+
.find(j.Identifier)
|
|
189
|
+
.filter((identifier): boolean => {
|
|
190
|
+
return (
|
|
191
|
+
base
|
|
192
|
+
.find(j.VariableDeclarator)
|
|
193
|
+
.filter(
|
|
194
|
+
(declarator) =>
|
|
195
|
+
declarator.value.id.type === 'Identifier' &&
|
|
196
|
+
declarator.value.id.name === identifier.value.name,
|
|
197
|
+
)
|
|
198
|
+
.filter((declarator) => {
|
|
199
|
+
const value = declarator.value;
|
|
200
|
+
if (value.id.type !== 'Identifier') {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
207
203
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
204
|
+
if (value.id.name !== identifier.value.name) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
// @ts-ignore
|
|
208
|
+
if (value.init.type !== 'ObjectExpression') {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
215
211
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
212
|
+
const match: boolean =
|
|
213
|
+
// @ts-ignore
|
|
214
|
+
value.init.properties.filter(
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
(property) =>
|
|
217
|
+
property.type === 'ObjectProperty' &&
|
|
218
|
+
property.key.type === 'Identifier' &&
|
|
219
|
+
property.key.name === propName,
|
|
220
|
+
).length > 0;
|
|
225
221
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
222
|
+
return match;
|
|
223
|
+
}).length > 0
|
|
224
|
+
);
|
|
225
|
+
}).length > 0;
|
|
230
226
|
|
|
231
|
-
|
|
227
|
+
return isUsedThroughIdentifier;
|
|
232
228
|
}
|
|
233
229
|
|
|
234
230
|
export function isUsingProp({
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
231
|
+
j,
|
|
232
|
+
base,
|
|
233
|
+
element,
|
|
234
|
+
propName,
|
|
239
235
|
}: {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
236
|
+
j: core.JSCodeshift;
|
|
237
|
+
base: Collection<any>;
|
|
238
|
+
element: NodePath<JSXElement, JSXElement>;
|
|
239
|
+
propName: string;
|
|
244
240
|
}): boolean {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
241
|
+
return (
|
|
242
|
+
hasJSXAttributesByName({
|
|
243
|
+
j,
|
|
244
|
+
element: element.value,
|
|
245
|
+
attributeName: propName,
|
|
246
|
+
}) ||
|
|
247
|
+
isUsingThroughSpread({
|
|
248
|
+
j,
|
|
249
|
+
base,
|
|
250
|
+
element,
|
|
251
|
+
propName,
|
|
252
|
+
})
|
|
253
|
+
);
|
|
258
254
|
}
|
|
259
255
|
|
|
260
256
|
// not replacing newlines (which \s does)
|
|
@@ -262,82 +258,76 @@ const spacesAndTabs: RegExp = /[ \t]{2,}/g;
|
|
|
262
258
|
const lineStartWithSpaces: RegExp = /^[ \t]*/gm;
|
|
263
259
|
|
|
264
260
|
function clean(value: string): string {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
261
|
+
return (
|
|
262
|
+
value
|
|
263
|
+
.replace(spacesAndTabs, ' ')
|
|
264
|
+
.replace(lineStartWithSpaces, '')
|
|
265
|
+
// using .trim() to clear the any newlines before the first text and after last text
|
|
266
|
+
.trim()
|
|
267
|
+
);
|
|
272
268
|
}
|
|
273
269
|
|
|
274
270
|
export function addCommentToStartOfFile({
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
j,
|
|
272
|
+
base,
|
|
273
|
+
message,
|
|
278
274
|
}: {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
275
|
+
j: core.JSCodeshift;
|
|
276
|
+
base: Collection<Node>;
|
|
277
|
+
message: string;
|
|
282
278
|
}) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
279
|
+
addCommentBefore({
|
|
280
|
+
j,
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
target: base.find(j.Program),
|
|
283
|
+
message,
|
|
284
|
+
});
|
|
289
285
|
}
|
|
290
286
|
|
|
291
287
|
export function addCommentBefore({
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
288
|
+
j,
|
|
289
|
+
target,
|
|
290
|
+
message,
|
|
295
291
|
}: {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
292
|
+
j: core.JSCodeshift;
|
|
293
|
+
target: Collection<Node>;
|
|
294
|
+
message: string;
|
|
299
295
|
}) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
296
|
+
const content: string = ` TODO: (from codemod) ${clean(message)} `;
|
|
297
|
+
target.forEach((path) => {
|
|
298
|
+
path.value.comments = path.value.comments || [];
|
|
303
299
|
|
|
304
|
-
|
|
305
|
-
(comment) => comment.value === content,
|
|
306
|
-
);
|
|
300
|
+
const exists = path.value.comments.find((comment) => comment.value === content);
|
|
307
301
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
302
|
+
// avoiding duplicates of the same comment
|
|
303
|
+
if (exists) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
312
306
|
|
|
313
|
-
|
|
314
|
-
|
|
307
|
+
path.value.comments.push(j.commentBlock(content));
|
|
308
|
+
});
|
|
315
309
|
}
|
|
316
310
|
|
|
317
311
|
export function updateRenderProps(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
312
|
+
j: core.JSCodeshift,
|
|
313
|
+
source: Collection<any>,
|
|
314
|
+
specifier: string,
|
|
315
|
+
oldProperty: string,
|
|
316
|
+
newProperty: string,
|
|
323
317
|
) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
),
|
|
340
|
-
);
|
|
341
|
-
});
|
|
342
|
-
});
|
|
318
|
+
source.findJSXElements(specifier).forEach((element: ASTPath<JSXElement>) => {
|
|
319
|
+
j(element)
|
|
320
|
+
.find(j.ArrowFunctionExpression)
|
|
321
|
+
.find(j.ObjectPattern)
|
|
322
|
+
.find(j.ObjectProperty)
|
|
323
|
+
.filter(
|
|
324
|
+
// @ts-ignore
|
|
325
|
+
(path: ASTPath<ObjectProperty>) => path.value.key.name === oldProperty,
|
|
326
|
+
)
|
|
327
|
+
.forEach((path) => {
|
|
328
|
+
j(path).replaceWith(
|
|
329
|
+
j.property('init', j.identifier(newProperty), j.identifier(oldProperty)),
|
|
330
|
+
);
|
|
331
|
+
});
|
|
332
|
+
});
|
|
343
333
|
}
|
package/dist/types/popper.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Placement, VirtualElement } from '@popperjs/core';
|
|
3
|
-
import { PopperChildrenProps, PopperProps } from 'react-popper';
|
|
2
|
+
import { type Placement, type VirtualElement } from '@popperjs/core';
|
|
3
|
+
import { type PopperChildrenProps, type PopperProps } from 'react-popper';
|
|
4
4
|
export { placements } from '@popperjs/core';
|
|
5
5
|
export type { Placement, VirtualElement } from '@popperjs/core';
|
|
6
6
|
export type { ManagerProps, ReferenceProps, PopperProps, PopperArrowProps, PopperChildrenProps, StrictModifier, Modifier, } from 'react-popper';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Placement, VirtualElement } from '@popperjs/core';
|
|
3
|
-
import { PopperChildrenProps, PopperProps } from 'react-popper';
|
|
2
|
+
import { type Placement, type VirtualElement } from '@popperjs/core';
|
|
3
|
+
import { type PopperChildrenProps, type PopperProps } from 'react-popper';
|
|
4
4
|
export { placements } from '@popperjs/core';
|
|
5
5
|
export type { Placement, VirtualElement } from '@popperjs/core';
|
|
6
6
|
export type { ManagerProps, ReferenceProps, PopperProps, PopperArrowProps, PopperChildrenProps, StrictModifier, Modifier, } from 'react-popper';
|