@workday/canvas-kit-codemod 7.0.0-alpha.100-next.25 → 7.0.0-alpha.103-next.28

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":"recategorizeIconButtons.d.ts","sourceRoot":"","sources":["../../../lib/v7/recategorizeIconButtons.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EAMR,MAAM,aAAa,CAAC;AAcrB,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAiK7E"}
1
+ {"version":3,"file":"recategorizeIconButtons.d.ts","sourceRoot":"","sources":["../../../lib/v7/recategorizeIconButtons.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EAMR,MAAM,aAAa,CAAC;AAcrB,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAoK7E"}
@@ -96,7 +96,11 @@ export default function transformer(file, api, options) {
96
96
  * Add new required imports
97
97
  */
98
98
  var buttonImports = root.find(j.ImportDeclaration, {
99
- source: { value: function (value) { return value.includes('@workday/canvas-kit-react'); } },
99
+ source: {
100
+ value: function (value) {
101
+ return value === '@workday/canvas-kit-react' || value === '@workday/canvas-kit-react/button';
102
+ },
103
+ },
100
104
  });
101
105
  if (!buttonImports.length) {
102
106
  // Add new specifiers to a new import
@@ -1 +1 @@
1
- {"version":3,"file":"renameLayoutImports.d.ts","sourceRoot":"","sources":["../../../lib/v7/renameLayoutImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAA6B,MAAM,aAAa,CAAC;AAelE,QAAA,MAAM,SAAS,EAAE,SAuFhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"renameLayoutImports.d.ts","sourceRoot":"","sources":["../../../lib/v7/renameLayoutImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAA6B,MAAM,aAAa,CAAC;AAoDlE,QAAA,MAAM,SAAS,EAAE,SAyEhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -6,6 +6,42 @@ var commonSpecifiers = [
6
6
  'useThemeRTL',
7
7
  'useThemedRing',
8
8
  ];
9
+ var layoutSpecifiers = [
10
+ 'Flex',
11
+ 'Stack',
12
+ 'StackProps',
13
+ 'HStackProps',
14
+ 'VStack',
15
+ 'VStackProps',
16
+ 'HStack',
17
+ 'Box',
18
+ 'BoxProps',
19
+ 'FlexProps',
20
+ 'ColorStyleProps',
21
+ 'StackSpacing',
22
+ 'StackDirection',
23
+ 'StackStyleProps',
24
+ 'FlexStyleProps',
25
+ 'SpaceStyleProps',
26
+ 'DepthStyleProps',
27
+ 'BorderShorthandStyleProps',
28
+ 'BorderColorStyleProps',
29
+ 'BorderRadiusStyleProps',
30
+ 'BorderLineStyleProps',
31
+ 'BorderWidthStyleProps',
32
+ 'BorderLogicalStyleProps',
33
+ 'BorderStyleProps',
34
+ 'border',
35
+ 'ColorTokens',
36
+ 'ColorStyleProps',
37
+ 'color',
38
+ 'FlexItemStyleProps',
39
+ 'flexItem',
40
+ 'PositionStandardProps',
41
+ 'PositionLogicalProps',
42
+ 'PositionStyleProps',
43
+ 'position',
44
+ ];
9
45
  // 1. Gather all import specifiers from @workday/canvas-kit-labs-react/layout
10
46
  // 2. Filter through all imports from @workday/canvas-kit-labs-react/common and gather specifiers we care about
11
47
  // 3. If there's an existing @workday/canvas-kit-react/layout add gathered specifiers to that import
@@ -15,39 +51,24 @@ var transform = function (file, api) {
15
51
  var root = j(file.source);
16
52
  var reactLayoutSpecifiers = [];
17
53
  var foundImport = [];
18
- // for each specifier in @workday/canvas-kit-labs-react/layout it pushes
19
- // the specifier to reactLayoutSpecifiers
20
- // We also push the found import to foundImport
21
- root
22
- .find(j.ImportDeclaration, { source: { value: '@workday/canvas-kit-labs-react/layout' } })
23
- .forEach(function (nodePath) {
24
- var _a;
25
- (_a = nodePath.value.specifiers) === null || _a === void 0 ? void 0 : _a.forEach(function (specifier) {
26
- var _a, _b;
27
- if (specifier.type === 'ImportSpecifier') {
28
- reactLayoutSpecifiers.push({
29
- importedName: (_a = specifier === null || specifier === void 0 ? void 0 : specifier.local) === null || _a === void 0 ? void 0 : _a.name,
30
- name: (_b = specifier === null || specifier === void 0 ? void 0 : specifier.imported) === null || _b === void 0 ? void 0 : _b.name,
31
- });
32
- }
33
- });
34
- foundImport.push(nodePath);
35
- });
36
- // We filter through @workday/canvas-kit-labs-react/common specifiers and
37
- // if it includes specifiers that we want, we push those to reactLayoutSpecifiers
38
54
  root
39
- .find(j.ImportDeclaration, { source: { value: '@workday/canvas-kit-labs-react/common' } })
55
+ .find(j.ImportDeclaration, {
56
+ source: { value: function (value) { return value.includes('@workday/canvas-kit-labs-react'); } },
57
+ })
40
58
  .forEach(function (nodePath) {
41
59
  var _a;
42
60
  nodePath.value.specifiers = (_a = nodePath.value.specifiers) === null || _a === void 0 ? void 0 : _a.filter(function (specifier) {
43
- var _a, _b;
61
+ var _a, _b, _c, _d;
44
62
  if (specifier.type === 'ImportSpecifier' &&
45
63
  !commonSpecifiers.includes(specifier.imported.name)) {
46
- reactLayoutSpecifiers.push({
47
- importedName: (_a = specifier === null || specifier === void 0 ? void 0 : specifier.local) === null || _a === void 0 ? void 0 : _a.name,
48
- name: (_b = specifier === null || specifier === void 0 ? void 0 : specifier.imported) === null || _b === void 0 ? void 0 : _b.name,
49
- });
50
- return false;
64
+ if (((_a = specifier === null || specifier === void 0 ? void 0 : specifier.local) === null || _a === void 0 ? void 0 : _a.name) !== undefined &&
65
+ layoutSpecifiers.includes((_b = specifier === null || specifier === void 0 ? void 0 : specifier.local) === null || _b === void 0 ? void 0 : _b.name)) {
66
+ reactLayoutSpecifiers.push({
67
+ importedName: (_c = specifier === null || specifier === void 0 ? void 0 : specifier.local) === null || _c === void 0 ? void 0 : _c.name,
68
+ name: (_d = specifier === null || specifier === void 0 ? void 0 : specifier.imported) === null || _d === void 0 ? void 0 : _d.name,
69
+ });
70
+ return false;
71
+ }
51
72
  }
52
73
  return true;
53
74
  });
@@ -74,7 +95,6 @@ var transform = function (file, api) {
74
95
  }
75
96
  foundImport.forEach(function (importPath) {
76
97
  var _a;
77
- // remove imports we no longer need
78
98
  if (((_a = importPath.value.specifiers) === null || _a === void 0 ? void 0 : _a.length) === 0 ||
79
99
  importPath.value.source.value === '@workday/canvas-kit-labs-react/layout') {
80
100
  importPath.prune();
@@ -1 +1 @@
1
- {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v7/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,WAAW,SAAK;;;;EAyDzF"}
1
+ {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v7/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,WAAW,SAAK;;;;EA2DzF"}
@@ -9,7 +9,9 @@ export function getImportRenameMap(j, root, packageName) {
9
9
  // imports our module
10
10
  var value = node.source.value;
11
11
  if (typeof value === 'string' &&
12
- (value.startsWith('@workday/canvas-kit-react') || value === packageName)) {
12
+ (value === '@workday/canvas-kit-react' ||
13
+ value.startsWith('@workday/canvas-kit-react/') ||
14
+ value === packageName)) {
13
15
  containsCanvasImports = true;
14
16
  (node.specifiers || []).forEach(function (specifier) {
15
17
  if (specifier.type === 'ImportSpecifier') {
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.100-next.25+911bfad3",
5
+ "version": "7.0.0-alpha.103-next.28+a55aeef9",
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": "911bfad34147c054ac08fd77845d0a0339fd3f95"
45
+ "gitHead": "a55aeef97c5138c9b1144584287afa8cac6fe17f"
46
46
  }