style-dictionary 5.4.2 → 5.4.4

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.
@@ -12,6 +12,6 @@
12
12
  "author": "",
13
13
  "license": "Apache-2.0",
14
14
  "devDependencies": {
15
- "style-dictionary": "^5.4.2"
15
+ "style-dictionary": "^5.4.4"
16
16
  }
17
17
  }
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "devDependencies": {
14
14
  "eslint-config-react-app": "^7.0.1",
15
- "style-dictionary": "^5.4.2"
15
+ "style-dictionary": "^5.4.4"
16
16
  },
17
17
  "resolutions": {
18
18
  "immer": "8.0.1",
@@ -29,7 +29,7 @@
29
29
  "eslint-config-react-app": "^7.0.1",
30
30
  "jest": "~25.2.6",
31
31
  "react-test-renderer": "~16.13.1",
32
- "style-dictionary": "^5.4.2"
32
+ "style-dictionary": "^5.4.4"
33
33
  },
34
34
  "jest": {
35
35
  "preset": "react-native"
@@ -10,6 +10,6 @@
10
10
  "author": "",
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
13
- "style-dictionary": "^5.4.2"
13
+ "style-dictionary": "^5.4.4"
14
14
  }
15
15
  }
@@ -16,6 +16,6 @@
16
16
  "author": "",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "^5.4.2"
19
+ "style-dictionary": "^5.4.4"
20
20
  }
21
21
  }
@@ -9,6 +9,6 @@
9
9
  },
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
- "style-dictionary": "^5.4.2"
12
+ "style-dictionary": "^5.4.4"
13
13
  }
14
14
  }
@@ -11,6 +11,6 @@
11
11
  "author": "",
12
12
  "license": "Apache-2.0",
13
13
  "devDependencies": {
14
- "style-dictionary": "^5.4.2"
14
+ "style-dictionary": "^5.4.4"
15
15
  }
16
16
  }
@@ -17,6 +17,6 @@
17
17
  "author": "Kelly Harrop <kn.harrop@gmail.com>",
18
18
  "license": "Apache-2.0",
19
19
  "devDependencies": {
20
- "style-dictionary": "^5.4.2"
20
+ "style-dictionary": "^5.4.4"
21
21
  }
22
22
  }
@@ -16,6 +16,6 @@
16
16
  "author": "",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "^5.4.2"
19
+ "style-dictionary": "^5.4.4"
20
20
  }
21
21
  }
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "homepage": "https://github.com/dbanksdesign/style-dictionary-node#readme",
22
22
  "devDependencies": {
23
- "style-dictionary": "^5.4.2",
23
+ "style-dictionary": "^5.4.4",
24
24
  "tinycolor2": "^1.4.1"
25
25
  }
26
26
  }
@@ -17,6 +17,6 @@
17
17
  "author": "",
18
18
  "license": "Apache-2.0",
19
19
  "devDependencies": {
20
- "style-dictionary": "^5.4.2"
20
+ "style-dictionary": "^5.4.4"
21
21
  }
22
22
  }
@@ -16,6 +16,6 @@
16
16
  "author": "",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "^5.4.2"
19
+ "style-dictionary": "^5.4.4"
20
20
  }
21
21
  }
@@ -16,6 +16,6 @@
16
16
  "devDependencies": {
17
17
  "aws-sdk": "^2.7.21",
18
18
  "fs-extra": "^1.0.0",
19
- "style-dictionary": "^5.4.2"
19
+ "style-dictionary": "^5.4.4"
20
20
  }
21
21
  }
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
13
- "style-dictionary": "^5.4.2",
13
+ "style-dictionary": "^5.4.4",
14
14
  "tailwindcss": "^3.4.15",
15
15
  "mocha": "^10.2.0",
16
16
  "chai": "^5.1.1"
@@ -16,6 +16,6 @@
16
16
  "author": "",
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "style-dictionary": "^5.4.2"
19
+ "style-dictionary": "^5.4.4"
20
20
  }
21
21
  }
@@ -12,6 +12,6 @@
12
12
  "license": "ISC",
13
13
  "devDependencies": {
14
14
  "colorjs.io": "^0.5.2",
15
- "style-dictionary": "^5.4.2"
15
+ "style-dictionary": "^5.4.4"
16
16
  }
17
17
  }
@@ -11,6 +11,6 @@
11
11
  "author": "",
12
12
  "license": "MIT",
13
13
  "devDependencies": {
14
- "style-dictionary": "^5.4.2"
14
+ "style-dictionary": "^5.4.4"
15
15
  }
16
16
  }
@@ -10,7 +10,7 @@
10
10
  "author": "",
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
13
- "style-dictionary": "^5.4.2",
13
+ "style-dictionary": "^5.4.4",
14
14
  "yaml": "^1.10.0"
15
15
  }
16
16
  }
package/lib/Register.js CHANGED
@@ -163,11 +163,14 @@ export class Register {
163
163
  this.deleteExistingHook(target, 'transformGroups', name);
164
164
 
165
165
  // make sure to trigger the setter
166
- target.hooks = deepmerge(target.hooks, {
167
- transformGroups: {
168
- [name]: transforms,
169
- },
170
- });
166
+ target.hooks = deepmerge(
167
+ target.hooks,
168
+ /** @type {Partial<Required<Hooks>>} */ ({
169
+ transformGroups: {
170
+ [name]: transforms,
171
+ },
172
+ }),
173
+ );
171
174
  return target;
172
175
  }
173
176
 
@@ -200,11 +203,14 @@ export class Register {
200
203
  this.deleteExistingHook(target, 'formats', name);
201
204
 
202
205
  // make sure to trigger the setter
203
- target.hooks = deepmerge(target.hooks, {
204
- formats: {
205
- [name]: formatFn,
206
- },
207
- });
206
+ target.hooks = deepmerge(
207
+ target.hooks,
208
+ /** @type {Partial<Required<Hooks>>} */ ({
209
+ formats: {
210
+ [name]: formatFn,
211
+ },
212
+ }),
213
+ );
208
214
  return target;
209
215
  }
210
216
 
@@ -275,11 +281,14 @@ export class Register {
275
281
  this.deleteExistingHook(target, 'filters', name);
276
282
 
277
283
  // make sure to trigger the setter
278
- target.hooks = deepmerge(target.hooks, {
279
- filters: {
280
- [name]: filterFn,
281
- },
282
- });
284
+ target.hooks = deepmerge(
285
+ target.hooks,
286
+ /** @type {Partial<Required<Hooks>>} */ ({
287
+ filters: {
288
+ [name]: filterFn,
289
+ },
290
+ }),
291
+ );
283
292
  return target;
284
293
  }
285
294
 
@@ -314,14 +323,17 @@ export class Register {
314
323
  this.deleteExistingHook(target, 'parsers', name);
315
324
 
316
325
  // make sure to trigger the setter
317
- target.hooks = deepmerge(target.hooks, {
318
- parsers: {
319
- [name]: {
320
- pattern,
321
- parser: parserFn,
326
+ target.hooks = deepmerge(
327
+ target.hooks,
328
+ /** @type {Partial<Required<Hooks>>} */ ({
329
+ parsers: {
330
+ [name]: {
331
+ pattern,
332
+ parser: parserFn,
333
+ },
322
334
  },
323
- },
324
- });
335
+ }),
336
+ );
325
337
  return target;
326
338
  }
327
339
 
@@ -356,11 +368,14 @@ export class Register {
356
368
  this.deleteExistingHook(target, 'preprocessors', name);
357
369
 
358
370
  // make sure to trigger the setter
359
- target.hooks = deepmerge(target.hooks, {
360
- preprocessors: {
361
- [name]: preprocessor,
362
- },
363
- });
371
+ target.hooks = deepmerge(
372
+ target.hooks,
373
+ /** @type {Partial<Required<Hooks>>} */ ({
374
+ preprocessors: {
375
+ [name]: preprocessor,
376
+ },
377
+ }),
378
+ );
364
379
  return target;
365
380
  }
366
381
 
@@ -393,11 +408,14 @@ export class Register {
393
408
  this.deleteExistingHook(target, 'fileHeaders', name);
394
409
 
395
410
  // make sure to trigger the setter
396
- target.hooks = deepmerge(target.hooks, {
397
- fileHeaders: {
398
- [name]: fileHeader,
399
- },
400
- });
411
+ target.hooks = deepmerge(
412
+ target.hooks,
413
+ /** @type {Partial<Required<Hooks>>} */ ({
414
+ fileHeaders: {
415
+ [name]: fileHeader,
416
+ },
417
+ }),
418
+ );
401
419
  return target;
402
420
  }
403
421
  }
@@ -67,17 +67,17 @@ export default class StyleDictionary extends Register {
67
67
  // Placeholder is transformed on prepublish -> see scripts/inject-version.js
68
68
  // Another option might be import pkg from './package.json' with { "type": "json" } which would work in both browser and node, but support is not there yet.
69
69
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility
70
- static VERSION = '5.4.2';
70
+ static VERSION = '5.4.4';
71
71
 
72
72
  /** @returns {Config} */
73
73
  get options() {
74
74
  // merge locally registered things with options
75
75
  // so that when we extend, we include registered things
76
76
  const opts = deepmerge(
77
- {
77
+ /** @type {Partial<Config>} */ ({
78
78
  hooks: this.hooks,
79
- },
80
- this._options ?? {},
79
+ }),
80
+ /** @type {Partial<Config>} */ (this._options ?? {}),
81
81
  );
82
82
  return opts;
83
83
  }
@@ -184,18 +184,6 @@ export default class StyleDictionary extends Register {
184
184
  * @returns {Promise<StyleDictionary>}
185
185
  */
186
186
  async extend(config = this.config, opts = {}) {
187
- // by default, if extend is called it means extending the current instance
188
- // with a new instance without mutating the original
189
- if (!opts.mutateOriginal) {
190
- const newSD = new StyleDictionary(deepmerge(this.options, config), {
191
- init: false,
192
- verbosity: opts.verbosity,
193
- warnings: opts.warnings,
194
- volume: opts.volume,
195
- });
196
- return newSD.init(opts);
197
- }
198
-
199
187
  /** @type {Config} */
200
188
  let options;
201
189
  /** @type {Tokens} */
@@ -213,6 +201,18 @@ export default class StyleDictionary extends Register {
213
201
  options = config;
214
202
  }
215
203
 
204
+ // by default, if extend is called it means extending the current instance
205
+ // with a new instance without mutating the original
206
+ if (!opts.mutateOriginal) {
207
+ const newSD = new StyleDictionary(deepmerge(this.options, options), {
208
+ init: false,
209
+ verbosity: opts.verbosity,
210
+ warnings: opts.warnings,
211
+ volume: opts.volume,
212
+ });
213
+ return newSD.init(opts);
214
+ }
215
+
216
216
  this.log = {
217
217
  // our defaults
218
218
  ...this.log,
@@ -33,6 +33,10 @@ function convertToTokenObject(tokenArray) {
33
33
  const obj = /** @type {Tokens} */ ({});
34
34
  tokenArray.forEach((token) => {
35
35
  const { key } = token;
36
+ // prototype pollution guard -> move to next token if key is malicious
37
+ if (key?.includes('__proto__')) {
38
+ return;
39
+ }
36
40
  const keyArr = /** @type {string} */ (key).replace('{', '').replace('}', '').split('.');
37
41
  let slice = obj;
38
42
  keyArr.forEach((k, i, arr) => {
@@ -1 +1 @@
1
- export function deepmerge(target: Object, source: Object, dedupeArrays?: boolean): any;
1
+ export function deepmerge<T>(target: Partial<T>, source: Partial<T>, dedupeArrays?: boolean): T;
@@ -3,9 +3,11 @@ import isPlainObject from 'is-plain-obj';
3
3
 
4
4
  /**
5
5
  * Wrapper around deepmerge that merges only plain objects and arrays
6
- * @param {Object} target
7
- * @param {Object} source
6
+ * @template T
7
+ * @param {Partial<T>} target
8
+ * @param {Partial<T>} source
8
9
  * @param {boolean} [dedupeArrays]
10
+ * @returns {T}
9
11
  */
10
12
  export const deepmerge = (target, source, dedupeArrays = true) => {
11
13
  return _deepmerge(target, source, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "style-dictionary",
3
- "version": "5.4.2",
3
+ "version": "5.4.4",
4
4
  "description": "Style once, use everywhere. A build system for creating cross-platform styles.",
5
5
  "keywords": [
6
6
  "style dictionary",
@@ -112,11 +112,10 @@
112
112
  ],
113
113
  "homepage": "https://styledictionary.com",
114
114
  "overrides": {
115
- "tmp": "0.2.5",
116
115
  "lodash": "4.17.23"
117
116
  },
118
117
  "dependencies": {
119
- "@bundled-es-modules/deepmerge": "^4.3.1",
118
+ "@bundled-es-modules/deepmerge": "^4.3.2",
120
119
  "@bundled-es-modules/glob": "^13.0.6",
121
120
  "@bundled-es-modules/memfs": "^4.17.0",
122
121
  "@zip.js/zip.js": "^2.7.44",
@@ -173,7 +172,7 @@
173
172
  "starlight-links-validator": "^0.24.0",
174
173
  "typescript": "^5.7.2",
175
174
  "unist-util-visit": "^5.0.0",
176
- "uuid": "^9.0.1",
175
+ "uuid": "^14.0.0",
177
176
  "yaml": "^2.3.4"
178
177
  }
179
178
  }
@@ -1 +0,0 @@
1
- declare module '@bundled-es-modules/deepmerge';