Skip to content

Commit e77feb4

Browse files
fix: upgrade dependencies, ditch patches and move tinycolor2 patch (#1442)
1 parent 41bc1b0 commit e77feb4

9 files changed

+5186
-4304
lines changed

.changeset/itchy-eagles-refuse.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'style-dictionary': patch
3+
---
4+
5+
Move the tinycolor2 patch from a patch file to a 3-liner fix in our source code, so it gets correctly published and usable by consumers.

lib/common/formats.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ function stripMetaProps(tokens, options) {
158158
async function formatJS(content, ts = false) {
159159
return prettier.format(content, {
160160
parser: ts ? `typescript` : `babel`,
161-
plugins: [prettierPluginBabel, prettierPluginEstree, prettierPluginTypescript],
161+
plugins: [
162+
prettierPluginBabel,
163+
/** @type {import('prettier').Plugin} */ (prettierPluginEstree),
164+
prettierPluginTypescript,
165+
],
162166
});
163167
}
164168

lib/common/transforms.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ const camelOpts = {
4444
* @returns {boolean}
4545
*/
4646
export function isColor(token, options) {
47+
const val = options.usesDtcg ? token.$value : token.value;
48+
const type = options.usesDtcg ? token.$type : token.type;
4749
return (
48-
(options.usesDtcg ? token.$type : token.type) === 'color' &&
49-
Color(options.usesDtcg ? token.$value : token.value).isValid()
50+
type === 'color' &&
51+
Color(val).isValid() &&
52+
// exclude gradients from being color transformed
53+
['linear', 'radial', 'conic']
54+
.map((pre) => `${pre}-gradient`)
55+
.every((pre) => !`${val}`.startsWith(pre) && !`${val}`.startsWith(`repeating-${pre}`))
5056
);
5157
}
5258

0 commit comments

Comments
 (0)