@atlaskit/codemod-cli 0.13.3 → 0.14.0

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +117 -3
  3. package/dist/cjs/cli.js +70 -75
  4. package/dist/cjs/filepath.js +65 -29
  5. package/dist/cjs/index.js +3 -3
  6. package/dist/cjs/main.js +329 -167
  7. package/dist/cjs/presets/css-to-design-tokens/css-to-design-tokens.js +86 -34
  8. package/dist/cjs/presets/css-to-design-tokens/utils/legacy-colors.js +3 -3
  9. package/dist/cjs/presets/css-to-design-tokens/utils/meta.js +19 -6
  10. package/dist/cjs/presets/index.js +3 -1
  11. package/dist/cjs/presets/styled-to-emotion/styled-to-emotion.js +19 -12
  12. package/dist/cjs/presets/theme-remove-deprecated-mixins/theme-remove-deprecated-mixins.js +51 -36
  13. package/dist/cjs/presets/theme-remove-deprecated-mixins/utils/replacements.js +25 -25
  14. package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +378 -114
  15. package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +33 -18
  16. package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +1 -1
  17. package/dist/cjs/presets/theme-to-design-tokens/utils/color.js +25 -17
  18. package/dist/cjs/presets/theme-to-design-tokens/utils/css-utils.js +38 -0
  19. package/dist/cjs/presets/theme-to-design-tokens/utils/fuzzy-search.js +10 -6
  20. package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +3 -3
  21. package/dist/cjs/presets/theme-to-design-tokens/utils/named-colors.js +1 -1
  22. package/dist/cjs/presets/theme-to-design-tokens/utils/string-utils.js +26 -0
  23. package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +16 -2
  24. package/dist/cjs/sinceRef.js +69 -35
  25. package/dist/cjs/transforms.js +44 -26
  26. package/dist/cjs/types.js +27 -3
  27. package/dist/cjs/utils.js +6 -6
  28. package/dist/es2019/cli.js +4 -0
  29. package/dist/es2019/main.js +2 -0
  30. package/dist/es2019/presets/css-to-design-tokens/css-to-design-tokens.js +19 -8
  31. package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +191 -32
  32. package/dist/es2019/presets/theme-to-design-tokens/utils/ast.js +1 -1
  33. package/dist/es2019/presets/theme-to-design-tokens/utils/color.js +12 -10
  34. package/dist/es2019/presets/theme-to-design-tokens/utils/css-utils.js +31 -0
  35. package/dist/es2019/presets/theme-to-design-tokens/utils/string-utils.js +13 -0
  36. package/dist/es2019/sinceRef.js +1 -0
  37. package/dist/esm/cli.js +4 -0
  38. package/dist/esm/main.js +3 -1
  39. package/dist/esm/presets/css-to-design-tokens/css-to-design-tokens.js +23 -12
  40. package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +346 -100
  41. package/dist/esm/presets/theme-to-design-tokens/utils/ast.js +1 -1
  42. package/dist/esm/presets/theme-to-design-tokens/utils/color.js +12 -10
  43. package/dist/esm/presets/theme-to-design-tokens/utils/css-utils.js +31 -0
  44. package/dist/esm/presets/theme-to-design-tokens/utils/string-utils.js +17 -0
  45. package/dist/esm/sinceRef.js +1 -0
  46. package/dist/types/presets/css-to-design-tokens/css-to-design-tokens.d.ts +2 -1
  47. package/dist/types/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +1 -1
  48. package/dist/types/presets/theme-to-design-tokens/utils/ast.d.ts +1 -1
  49. package/dist/types/presets/theme-to-design-tokens/utils/color.d.ts +2 -1
  50. package/dist/types/presets/theme-to-design-tokens/utils/css-utils.d.ts +2 -0
  51. package/dist/types/presets/theme-to-design-tokens/utils/string-utils.d.ts +3 -0
  52. package/dist/types-ts4.5/presets/css-to-design-tokens/css-to-design-tokens.d.ts +2 -1
  53. package/dist/types-ts4.5/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +1 -1
  54. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast.d.ts +1 -1
  55. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/color.d.ts +2 -1
  56. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/css-utils.d.ts +2 -0
  57. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/string-utils.d.ts +6 -0
  58. package/package.json +2 -2
  59. package/dist/cjs/version.json +0 -4
  60. package/dist/es2019/version.json +0 -4
  61. package/dist/esm/version.json +0 -4
@@ -4,140 +4,140 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.colorReplacements = void 0;
7
- const colorReplacements = {
7
+ var colorReplacements = {
8
8
  background: {
9
- fullReplacement: `themed({ light: token('elevation.surface', N0), dark: token('elevation.surface', DN30) })`,
9
+ fullReplacement: "themed({ light: token('elevation.surface', N0), dark: token('elevation.surface', DN30) })",
10
10
  staticReplacement: 'N0',
11
11
  tokenId: 'elevation.surface',
12
12
  importSpecifiers: ['N0', 'DN30']
13
13
  },
14
14
  backgroundActive: {
15
- fullReplacement: `themed({ light: token('color.background.selected', B50), dark: token('color.background.selected', B75) })`,
15
+ fullReplacement: "themed({ light: token('color.background.selected', B50), dark: token('color.background.selected', B75) })",
16
16
  staticReplacement: 'B50',
17
17
  tokenId: 'color.background.selected',
18
18
  importSpecifiers: ['B50', 'B75']
19
19
  },
20
20
  backgroundHover: {
21
- fullReplacement: `themed({ light: token('color.background.neutral.hovered', N30), dark: token('color.background.neutral.hovered', DN70) })`,
21
+ fullReplacement: "themed({ light: token('color.background.neutral.hovered', N30), dark: token('color.background.neutral.hovered', DN70) })",
22
22
  staticReplacement: 'N30',
23
23
  tokenId: 'color.background.neutral.hovered',
24
24
  importSpecifiers: ['N30', 'DN70']
25
25
  },
26
26
  backgroundOnLayer: {
27
- fullReplacement: `themed({ light: token('elevation.surface.overlay', N0), dark: token('elevation.surface.overlay', DN50) })`,
27
+ fullReplacement: "themed({ light: token('elevation.surface.overlay', N0), dark: token('elevation.surface.overlay', DN50) })",
28
28
  staticReplacement: 'N0',
29
29
  tokenId: 'elevation.surface.overlay',
30
30
  importSpecifiers: ['N0', 'DN50']
31
31
  },
32
32
  text: {
33
- fullReplacement: `themed({ light: token('color.text', N900), dark: token('color.text', DN600) })`,
33
+ fullReplacement: "themed({ light: token('color.text', N900), dark: token('color.text', DN600) })",
34
34
  staticReplacement: 'N900',
35
35
  tokenId: 'color.text',
36
36
  importSpecifiers: ['N900', 'DN600']
37
37
  },
38
38
  textHover: {
39
- fullReplacement: `themed({ light: token('color.text', N800), dark: token('color.text', DN600) })`,
39
+ fullReplacement: "themed({ light: token('color.text', N800), dark: token('color.text', DN600) })",
40
40
  staticReplacement: 'N800',
41
41
  tokenId: 'color.text',
42
42
  importSpecifiers: ['N800', 'DN600']
43
43
  },
44
44
  textActive: {
45
- fullReplacement: `themed({ light: token('color.text.selected', B400), dark: token('color.text.selected', B400) })`,
45
+ fullReplacement: "themed({ light: token('color.text.selected', B400), dark: token('color.text.selected', B400) })",
46
46
  staticReplacement: 'B400',
47
47
  tokenId: 'color.text.selected',
48
48
  importSpecifiers: ['B400', 'B400']
49
49
  },
50
50
  subtleText: {
51
- fullReplacement: `themed({ light: token('color.text.subtlest', N200), dark: token('color.text.subtlest', DN300) })`,
51
+ fullReplacement: "themed({ light: token('color.text.subtlest', N200), dark: token('color.text.subtlest', DN300) })",
52
52
  staticReplacement: 'N200',
53
53
  tokenId: 'color.text.subtlest',
54
54
  importSpecifiers: ['N200', 'DN300']
55
55
  },
56
56
  placeholderText: {
57
- fullReplacement: `themed({ light: token('color.text.subtlest', N100), dark: token('color.text.subtlest', DN200) })`,
57
+ fullReplacement: "themed({ light: token('color.text.subtlest', N100), dark: token('color.text.subtlest', DN200) })",
58
58
  staticReplacement: 'N100',
59
59
  tokenId: 'color.text.subtlest',
60
60
  importSpecifiers: ['N100', 'DN200']
61
61
  },
62
62
  heading: {
63
- fullReplacement: `themed({ light: token('color.text', N800), dark: token('color.text', DN600) })`,
63
+ fullReplacement: "themed({ light: token('color.text', N800), dark: token('color.text', DN600) })",
64
64
  staticReplacement: 'N800',
65
65
  tokenId: 'color.text',
66
66
  importSpecifiers: ['N800', 'DN600']
67
67
  },
68
68
  subtleHeading: {
69
- fullReplacement: `themed({ light: token('color.text.subtlest', N200), dark: token('color.text.subtlest', DN300) })`,
69
+ fullReplacement: "themed({ light: token('color.text.subtlest', N200), dark: token('color.text.subtlest', DN300) })",
70
70
  staticReplacement: 'N200',
71
71
  tokenId: 'color.text.subtlest',
72
72
  importSpecifiers: ['N200', 'DN300']
73
73
  },
74
74
  codeBlock: {
75
- fullReplacement: `themed({ light: N20, dark: DN50 });`,
75
+ fullReplacement: "themed({ light: N20, dark: DN50 });",
76
76
  staticReplacement: 'N20',
77
77
  importSpecifiers: ['N20', 'DN50']
78
78
  },
79
79
  link: {
80
- fullReplacement: `themed({ light: token('color.link', B400), dark: token('color.link', B100) })`,
80
+ fullReplacement: "themed({ light: token('color.link', B400), dark: token('color.link', B100) })",
81
81
  staticReplacement: 'B400',
82
82
  tokenId: 'color.link',
83
83
  importSpecifiers: ['B400', 'B100']
84
84
  },
85
85
  linkHover: {
86
- fullReplacement: `themed({ light: token('color.link.pressed', B300), dark: token('color.link.pressed', B200) })`,
86
+ fullReplacement: "themed({ light: token('color.link.pressed', B300), dark: token('color.link.pressed', B200) })",
87
87
  staticReplacement: 'B300',
88
88
  tokenId: 'color.link.pressed',
89
89
  importSpecifiers: ['B300', 'B200']
90
90
  },
91
91
  linkActive: {
92
- fullReplacement: `themed({ light: token('color.link.pressed', B500), dark: token('color.link.pressed', B100) })`,
92
+ fullReplacement: "themed({ light: token('color.link.pressed', B500), dark: token('color.link.pressed', B100) })",
93
93
  staticReplacement: 'B500',
94
94
  tokenId: 'color.link.pressed',
95
95
  importSpecifiers: ['B500', 'B100']
96
96
  },
97
97
  linkOutline: {
98
- fullReplacement: `themed({ light: token('color.border.focused', B100), dark: token('color.border.focused', B200) })`,
98
+ fullReplacement: "themed({ light: token('color.border.focused', B100), dark: token('color.border.focused', B200) })",
99
99
  staticReplacement: 'B100',
100
100
  tokenId: 'color.border.focused',
101
101
  importSpecifiers: ['B100', 'B200']
102
102
  },
103
103
  primary: {
104
- fullReplacement: `themed({ light: token('color.background.brand.bold', B400), dark: token('color.background.brand.bold', B100) })`,
104
+ fullReplacement: "themed({ light: token('color.background.brand.bold', B400), dark: token('color.background.brand.bold', B100) })",
105
105
  staticReplacement: 'B400',
106
106
  tokenId: 'color.background.brand.bold',
107
107
  importSpecifiers: ['B400', 'B100']
108
108
  },
109
109
  blue: {
110
- fullReplacement: `themed({ light: B400, dark: B100, })`,
110
+ fullReplacement: "themed({ light: B400, dark: B100, })",
111
111
  staticReplacement: 'B400',
112
112
  importSpecifiers: ['B400', 'B100']
113
113
  },
114
114
  teal: {
115
- fullReplacement: `themed({ light: T300, dark: T200 })`,
115
+ fullReplacement: "themed({ light: T300, dark: T200 })",
116
116
  staticReplacement: 'T300',
117
117
  importSpecifiers: ['T300', 'T200']
118
118
  },
119
119
  purple: {
120
- fullReplacement: `themed({ light: P300, dark: P100 })`,
120
+ fullReplacement: "themed({ light: P300, dark: P100 })",
121
121
  staticReplacement: 'P300',
122
122
  importSpecifiers: ['P300', 'P100']
123
123
  },
124
124
  red: {
125
- fullReplacement: `R300`,
125
+ fullReplacement: "R300",
126
126
  staticReplacement: 'R300',
127
127
  importSpecifiers: ['R300']
128
128
  },
129
129
  yellow: {
130
- fullReplacement: `Y300`,
130
+ fullReplacement: "Y300",
131
131
  staticReplacement: 'Y300',
132
132
  importSpecifiers: ['Y300']
133
133
  },
134
134
  green: {
135
- fullReplacement: `G300`,
135
+ fullReplacement: "G300",
136
136
  staticReplacement: 'G300',
137
137
  importSpecifiers: ['G300']
138
138
  },
139
139
  skeleton: {
140
- fullReplacement: `token('color.skeleton', N20A)`,
140
+ fullReplacement: "token('color.skeleton', N20A)",
141
141
  staticReplacement: 'N20A',
142
142
  tokenId: 'color.skeleton',
143
143
  importSpecifiers: ['N20A']