@workday/canvas-kit-codemod 8.4.1 → 8.4.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"softDeprecateStack.d.ts","sourceRoot":"","sources":["../../../../lib/softDeprecate/Stack/softDeprecateStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAA+C,OAAO,EAAC,MAAM,aAAa,CAAC;AAOhG,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAyM7E"}
1
+ {"version":3,"file":"softDeprecateStack.d.ts","sourceRoot":"","sources":["../../../../lib/softDeprecate/Stack/softDeprecateStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAA+C,OAAO,EAAC,MAAM,aAAa,CAAC;AAOhG,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAyN7E"}
@@ -141,6 +141,20 @@ export default function transformer(file, api, options) {
141
141
  .find(j.JSXIdentifier)
142
142
  .filter(function (path) { return path.node.name === 'shouldWrapChildren'; })
143
143
  .remove();
144
+ // Transform styled compoents
145
+ // e.g. `const StyledStack = styled(Stack)({});`
146
+ // becomes `const StyledStack = styled(Flex)({});`
147
+ root.find(j.VariableDeclarator).forEach(function (nodePath) {
148
+ var _a;
149
+ if (((_a = nodePath.value.init) === null || _a === void 0 ? void 0 : _a.type) === 'CallExpression' &&
150
+ nodePath.value.init.callee.type === 'CallExpression' &&
151
+ nodePath.value.init.callee.callee.type === 'Identifier' &&
152
+ nodePath.value.init.callee.callee.name === 'styled' &&
153
+ nodePath.value.init.callee.arguments[0].type === 'Identifier' &&
154
+ stackImportNames.includes(nodePath.value.init.callee.arguments[0].name)) {
155
+ nodePath.value.init.callee.arguments[0].name = 'Flex';
156
+ }
157
+ });
144
158
  // Transform Stack JSXElements
145
159
  // Transform `<Stack>` to `<Flex>`
146
160
  root.find(j.JSXIdentifier, { name: 'Stack' }).forEach(function (nodePath) {
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": "8.4.1",
5
+ "version": "8.4.3",
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,
@@ -43,5 +43,5 @@
43
43
  "test": "TZ=UTC jest -c ../../jest.config.js",
44
44
  "typecheck:src": "tsc -p . --noEmit --incremental false"
45
45
  },
46
- "gitHead": "21c6d900722307b30cf7aff800966b3baa72ae35"
46
+ "gitHead": "ce78dc26ff18812b14e761916153f68458bb8875"
47
47
  }