@workday/canvas-kit-codemod 7.0.0-alpha.78-next.6 → 7.0.0-alpha.81-next.9
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removePropFromPopper.d.ts","sourceRoot":"","sources":["../../../lib/v7/removePropFromPopper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAa,MAAM,aAAa,CAAC;AAM/D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAkC7E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getImportRenameMap } from './utils/getImportRenameMap';
|
|
2
|
+
import { hasImportSpecifiers } from '../v6/utils';
|
|
3
|
+
var popupBarPackage = '@workday/canvas-kit-react/popup';
|
|
4
|
+
export default function transformer(file, api, options) {
|
|
5
|
+
var j = api.jscodeshift;
|
|
6
|
+
var root = j(file.source);
|
|
7
|
+
if (!hasImportSpecifiers(api, root, popupBarPackage, ['Popper'])) {
|
|
8
|
+
return file.source;
|
|
9
|
+
}
|
|
10
|
+
var _a = getImportRenameMap(j, root, popupBarPackage), importMap = _a.importMap, styledMap = _a.styledMap;
|
|
11
|
+
root
|
|
12
|
+
.find(j.JSXElement, function (value) {
|
|
13
|
+
return value.openingElement.name.type === 'JSXIdentifier' &&
|
|
14
|
+
(value.openingElement.name.name === importMap.Popper ||
|
|
15
|
+
value.openingElement.name.name === styledMap.Popper);
|
|
16
|
+
})
|
|
17
|
+
.forEach(function (nodePath) {
|
|
18
|
+
var attributes = nodePath.value.openingElement.attributes;
|
|
19
|
+
// Remove containerElement prop from Popper component
|
|
20
|
+
if (attributes) {
|
|
21
|
+
nodePath.value.openingElement.attributes = attributes.filter(function (item) {
|
|
22
|
+
return item.type === 'JSXAttribute' &&
|
|
23
|
+
item.name.type === 'JSXIdentifier' &&
|
|
24
|
+
['containerElement'].includes(item.name.name)
|
|
25
|
+
? false
|
|
26
|
+
: true;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return root.toSource();
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@workday/canvas-kit-codemod",
|
|
3
3
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "7.0.0-alpha.
|
|
5
|
+
"version": "7.0.0-alpha.81-next.9+5f4eca7e",
|
|
6
6
|
"description": "A collection of codemods for use on Workday Canvas Kit packages.",
|
|
7
7
|
"main": "dist/es6/index.js",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"test": "TZ=UTC jest -c ../../jest.config.js",
|
|
43
43
|
"typecheck:src": "tsc -p . --noEmit --incremental false"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "5f4eca7e47351f920cb283c1a1fa16b9ef76b6e5"
|
|
46
46
|
}
|