@workday/canvas-kit-codemod 13.2.41 → 13.2.42

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":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAQlD,QAAA,MAAM,SAAS,EAAE,SAuFhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAYlD,QAAA,MAAM,SAAS,EAAE,SAuFhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,6 +1,10 @@
1
1
  import { addMissingImports, filterOutImports, transformObjectPropertyRecursively } from './utils';
2
2
  import { mapping } from './mapping';
3
- const canvasImportSources = ['@workday/canvas-kit-styling', '@workday/canvas-kit-react/tokens'];
3
+ const canvasImportSources = [
4
+ '@workday/canvas-kit-styling',
5
+ '@workday/canvas-kit-react/tokens',
6
+ '@workday/canvas-colors-web',
7
+ ];
4
8
  const transform = (file, api) => {
5
9
  const j = api.jscodeshift;
6
10
  const root = j(file.source);
@@ -11,7 +15,7 @@ const transform = (file, api) => {
11
15
  source: { value: (value) => canvasImportSources.includes(value) },
12
16
  })
13
17
  .forEach(nodePath => {
14
- importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
18
+ importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath, 'colors') };
15
19
  });
16
20
  if (!Object.values(importDeclaration).includes('colors')) {
17
21
  return root.toSource();
@@ -1 +1 @@
1
- {"version":3,"file":"migrateDepthTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateDepthTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAOtC,QAAA,MAAM,SAAS,EAAE,SAoKhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"migrateDepthTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateDepthTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAWtC,QAAA,MAAM,SAAS,EAAE,SAoKhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,5 +1,9 @@
1
1
  import { addMissingImports, filterOutImports } from './utils';
2
- const canvasImportSources = ['@workday/canvas-kit-styling', '@workday/canvas-kit-react/tokens'];
2
+ const canvasImportSources = [
3
+ '@workday/canvas-kit-styling',
4
+ '@workday/canvas-kit-react/tokens',
5
+ '@workday/canvas-depth-web',
6
+ ];
3
7
  const transform = (file, api) => {
4
8
  const j = api.jscodeshift;
5
9
  const root = j(file.source);
@@ -10,7 +14,7 @@ const transform = (file, api) => {
10
14
  source: { value: (value) => canvasImportSources.includes(value) },
11
15
  })
12
16
  .forEach(nodePath => {
13
- importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
17
+ importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath, 'depth') };
14
18
  });
15
19
  if (!Object.values(importDeclaration).includes('depth')) {
16
20
  return root.toSource();
@@ -1 +1 @@
1
- {"version":3,"file":"migrateOtherTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateOtherTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAC,MAAM,aAAa,CAAC;AAQpE,QAAA,MAAM,SAAS,EAAE,SA4KhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"migrateOtherTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateOtherTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAC,MAAM,aAAa,CAAC;AAYpE,QAAA,MAAM,SAAS,EAAE,SA+KhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,6 +1,10 @@
1
1
  import { addMissingImports, filterOutImports, varToMemberExpression } from './utils';
2
2
  import { mapping, systemColors } from './mapping';
3
- const canvasImportSources = ['@workday/canvas-kit-styling', '@workday/canvas-kit-react/tokens'];
3
+ const canvasImportSources = [
4
+ '@workday/canvas-kit-styling',
5
+ '@workday/canvas-kit-react/tokens',
6
+ '@workday/canvas-space-web',
7
+ ];
4
8
  const transform = (file, api) => {
5
9
  const j = api.jscodeshift;
6
10
  const root = j(file.source);
@@ -11,7 +15,10 @@ const transform = (file, api) => {
11
15
  source: { value: (value) => canvasImportSources.includes(value) },
12
16
  })
13
17
  .forEach(nodePath => {
14
- importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
18
+ importDeclaration = {
19
+ ...importDeclaration,
20
+ ...filterOutImports(nodePath, ['space', 'borderRadius']),
21
+ };
15
22
  });
16
23
  if (!Object.values(importDeclaration).some(value => value === 'space' || value === 'borderRadius')) {
17
24
  return root.toSource();
@@ -27,7 +34,7 @@ const transform = (file, api) => {
27
34
  const name = nodePath.value.callee.name;
28
35
  const stylesDeclaration = nodePath.value.arguments[0];
29
36
  const isCanvasKitStyling = importDeclaration[name] === 'createStyles' || importDeclaration[name] === 'createStencil';
30
- if (stylesDeclaration.type === 'ObjectExpression') {
37
+ if ((stylesDeclaration === null || stylesDeclaration === void 0 ? void 0 : stylesDeclaration.type) === 'ObjectExpression') {
31
38
  const transformProperty = (property) => {
32
39
  var _a;
33
40
  if (property.type === 'ObjectProperty' &&
@@ -12,7 +12,7 @@ const transform = (file, api) => {
12
12
  source: { value: (value) => canvasImportSources.includes(value) },
13
13
  })
14
14
  .forEach(nodePath => {
15
- importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
15
+ importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath, 'type') };
16
16
  });
17
17
  if (!Object.values(importDeclaration).includes('type')) {
18
18
  return root.toSource();
@@ -1,3 +1,5 @@
1
1
  import { ASTPath, ImportDeclaration } from 'jscodeshift';
2
- export declare const filterOutImports: (nodePath: ASTPath<ImportDeclaration>) => Record<string, string>;
2
+ type ImportType = 'colors' | 'depth' | 'space' | 'type' | 'borderRadius';
3
+ export declare const filterOutImports: (nodePath: ASTPath<ImportDeclaration>, type: ImportType | ImportType[]) => Record<string, string>;
4
+ export {};
3
5
  //# sourceMappingURL=filterOutImports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterOutImports.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/utils/filterOutImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,gBAAgB,aAAc,QAAQ,iBAAiB,CAAC,2BAwBpE,CAAC"}
1
+ {"version":3,"file":"filterOutImports.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/utils/filterOutImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAEvD,KAAK,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,cAAc,CAAC;AASzE,eAAO,MAAM,gBAAgB,aACjB,QAAQ,iBAAiB,CAAC,QAC9B,UAAU,GAAG,UAAU,EAAE,2BA0BhC,CAAC"}
@@ -1,14 +1,20 @@
1
- export const filterOutImports = (nodePath) => {
1
+ const canvasImportSources = [
2
+ '@workday/canvas-kit-react/tokens',
3
+ '@workday/canvas-colors-web',
4
+ '@workday/canvas-space-web',
5
+ '@workday/canvas-depth-web',
6
+ ];
7
+ export const filterOutImports = (nodePath, type) => {
2
8
  var _a, _b;
3
9
  const importName = {};
4
10
  nodePath.value.specifiers = (_a = nodePath.value.specifiers) === null || _a === void 0 ? void 0 : _a.filter(specifier => {
5
- var _a;
6
11
  if (specifier.type === 'ImportSpecifier' && specifier.local) {
7
12
  const localName = specifier.local.name.toString();
8
13
  const importedName = specifier.imported.name.toString();
9
14
  importName[localName] = importedName;
10
- return !(typeof nodePath.value.source.value === 'string' &&
11
- ((_a = nodePath.value.source.value) === null || _a === void 0 ? void 0 : _a.endsWith('tokens')));
15
+ return !(type.includes(importedName) &&
16
+ typeof nodePath.value.source.value === 'string' &&
17
+ canvasImportSources.includes(nodePath.value.source.value));
12
18
  }
13
19
  return true;
14
20
  });
@@ -1 +1 @@
1
- {"version":3,"file":"varToMemberExpression.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/utils/varToMemberExpression.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,MAAO,GAAG,SAAS,MAAM,QAQ1D,CAAC"}
1
+ {"version":3,"file":"varToMemberExpression.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/utils/varToMemberExpression.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,MAAO,GAAG,SAAS,MAAM,QAU1D,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export const varToMemberExpression = (j, value) => {
2
2
  const valuesKeys = value.split('.');
3
3
  return valuesKeys.reduce((acc, key, index) => {
4
- if (index === 0) {
4
+ if (!index) {
5
5
  return j.identifier(key);
6
6
  }
7
7
  return j.memberExpression(acc, j.identifier(key));
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": "13.2.41",
5
+ "version": "13.2.42",
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,
@@ -46,5 +46,5 @@
46
46
  "resolutions": {
47
47
  "recast": "0.20.4"
48
48
  },
49
- "gitHead": "45cc5255aa2e83d7f1257ebca7b87ee0abb96689"
49
+ "gitHead": "bdab8926d25648de2b1e821a121dc55c3c3dba9d"
50
50
  }