@atlaskit/menu 2.1.0 → 2.1.1
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41915](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41915) [`99b579bdc84`](https://bitbucket.org/atlassian/atlassian-frontend/commits/99b579bdc84) - Fix error in codemod
|
|
8
|
+
|
|
3
9
|
## 2.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -133,44 +133,6 @@ function convertInvalidLinkItemsToButtonItems(
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function removeLinkItemImportIfNoLinkItemsExist(
|
|
137
|
-
j: core.JSCodeshift,
|
|
138
|
-
source: ReturnType<typeof j>,
|
|
139
|
-
specifier: string,
|
|
140
|
-
) {
|
|
141
|
-
// Get all instances of LinkItem
|
|
142
|
-
const linkItemInstances = source.findJSXElements(specifier);
|
|
143
|
-
|
|
144
|
-
// if none, delete from imports
|
|
145
|
-
if (linkItemInstances.length === 0) {
|
|
146
|
-
source
|
|
147
|
-
.find(j.ImportDeclaration)
|
|
148
|
-
.filter((path) => path.node.source.value === pkg)
|
|
149
|
-
.forEach((moduleImport) => {
|
|
150
|
-
j(moduleImport).replaceWith(
|
|
151
|
-
j.importDeclaration(
|
|
152
|
-
moduleImport.node.specifiers &&
|
|
153
|
-
moduleImport.node.specifiers
|
|
154
|
-
.filter(
|
|
155
|
-
// This should be `ImportSpecifier | ImportDefaultSpecifier |
|
|
156
|
-
// ImportNamespaceSpecifier` but it still throws even though
|
|
157
|
-
// I'm filtering
|
|
158
|
-
(
|
|
159
|
-
currentSpecifier: any,
|
|
160
|
-
): currentSpecifier is ImportSpecifier =>
|
|
161
|
-
currentSpecifier?.imported,
|
|
162
|
-
)
|
|
163
|
-
.filter(
|
|
164
|
-
(currentSpecifier: ImportSpecifier) =>
|
|
165
|
-
currentSpecifier.imported.name !== specifier,
|
|
166
|
-
),
|
|
167
|
-
moduleImport.node.source,
|
|
168
|
-
),
|
|
169
|
-
);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
136
|
function hasImportDeclaration(
|
|
175
137
|
j: core.JSCodeshift,
|
|
176
138
|
source: ReturnType<typeof j>,
|
|
@@ -193,7 +155,6 @@ export default function transformer(
|
|
|
193
155
|
|
|
194
156
|
if (importSpecifier != null) {
|
|
195
157
|
convertInvalidLinkItemsToButtonItems(j, source, importSpecifier);
|
|
196
|
-
removeLinkItemImportIfNoLinkItemsExist(j, source, importSpecifier);
|
|
197
158
|
}
|
|
198
159
|
|
|
199
160
|
return source.toSource(
|
|
@@ -89,7 +89,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
89
89
|
}
|
|
90
90
|
`,
|
|
91
91
|
`
|
|
92
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
92
|
+
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
93
93
|
|
|
94
94
|
const App = () => {
|
|
95
95
|
return <ButtonItem>test</ButtonItem>;
|
|
@@ -109,7 +109,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
109
109
|
}
|
|
110
110
|
`,
|
|
111
111
|
`
|
|
112
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
112
|
+
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
113
113
|
|
|
114
114
|
const App = () => {
|
|
115
115
|
return <ButtonItem id="test">test</ButtonItem>;
|
|
@@ -135,7 +135,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
135
135
|
}
|
|
136
136
|
`,
|
|
137
137
|
`
|
|
138
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
138
|
+
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
139
139
|
|
|
140
140
|
const App = () => {
|
|
141
141
|
return <ButtonItem>test</ButtonItem>;
|
|
@@ -155,7 +155,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
155
155
|
}
|
|
156
156
|
`,
|
|
157
157
|
`
|
|
158
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
158
|
+
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
159
159
|
|
|
160
160
|
const App = () => {
|
|
161
161
|
return <ButtonItem id="test">test</ButtonItem>;
|
|
@@ -175,7 +175,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
175
175
|
}
|
|
176
176
|
`,
|
|
177
177
|
`
|
|
178
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
178
|
+
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
179
179
|
|
|
180
180
|
const App = () => {
|
|
181
181
|
return <ButtonItem>test</ButtonItem>;
|
|
@@ -201,7 +201,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
201
201
|
}
|
|
202
202
|
`,
|
|
203
203
|
`
|
|
204
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
204
|
+
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
205
205
|
|
|
206
206
|
const App = () => {
|
|
207
207
|
return <ButtonItem>test</ButtonItem>;
|
|
@@ -232,7 +232,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
232
232
|
}
|
|
233
233
|
`,
|
|
234
234
|
`
|
|
235
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
235
|
+
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
236
236
|
|
|
237
237
|
const App = () => {
|
|
238
238
|
return (
|
|
@@ -262,7 +262,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
262
262
|
}
|
|
263
263
|
`,
|
|
264
264
|
`
|
|
265
|
-
import { CustomItem, ButtonItem } from '@atlaskit/menu';
|
|
265
|
+
import { LinkItem, CustomItem, ButtonItem } from '@atlaskit/menu';
|
|
266
266
|
|
|
267
267
|
const App = () => {
|
|
268
268
|
return (
|
|
@@ -273,7 +273,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
275
|
`,
|
|
276
|
-
'Should not delete
|
|
276
|
+
'Should not delete any imports',
|
|
277
277
|
);
|
|
278
278
|
|
|
279
279
|
defineInlineTest(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "A collection of composable menu components that can be used anywhere.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
32
32
|
"@atlaskit/primitives": "^1.6.0",
|
|
33
33
|
"@atlaskit/theme": "^12.6.0",
|
|
34
|
-
"@atlaskit/tokens": "^1.
|
|
34
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"@emotion/react": "^11.7.1"
|
|
37
37
|
},
|