style-dictionary 5.1.0 → 5.1.1
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.
- package/examples/advanced/assets-base64-embed/package.json +1 -1
- package/examples/advanced/create-react-app/package.json +1 -1
- package/examples/advanced/create-react-native-app/package.json +1 -1
- package/examples/advanced/custom-parser/package.json +1 -1
- package/examples/advanced/custom-transforms/package.json +1 -1
- package/examples/advanced/font-face-rules/package.json +1 -1
- package/examples/advanced/format-helpers/package.json +1 -1
- package/examples/advanced/matching-build-files/package.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
- package/examples/advanced/node-modules-as-config-and-properties/package.json +1 -1
- package/examples/advanced/npm-module/package.json +1 -1
- package/examples/advanced/referencing_aliasing/package.json +1 -1
- package/examples/advanced/s3/package.json +1 -1
- package/examples/advanced/tailwind-preset/package.json +1 -1
- package/examples/advanced/tokens-deprecation/package.json +1 -1
- package/examples/advanced/transitive-transforms/package.json +1 -1
- package/examples/advanced/variables-in-outputs/package.json +1 -1
- package/examples/advanced/yaml-tokens/package.json +1 -1
- package/lib/StyleDictionary.js +1 -1
- package/lib/common/formatHelpers/createPropertyFormatter.js +1 -1
- package/lib/common/formatHelpers/sortByReference.js +2 -0
- package/lib/utils/references/getReferences.js +2 -1
- package/package.json +1 -1
package/lib/StyleDictionary.js
CHANGED
|
@@ -67,7 +67,7 @@ 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.1.
|
|
70
|
+
static VERSION = '5.1.1';
|
|
71
71
|
|
|
72
72
|
/** @returns {Config} */
|
|
73
73
|
get options() {
|
|
@@ -49,10 +49,12 @@ export default function sortByReference(tokens, { unfilteredTokens, usesDtcg } =
|
|
|
49
49
|
// Collect references for 'a' and 'b'
|
|
50
50
|
const aRefs = getReferences(a.original[valueKey], tokens, {
|
|
51
51
|
unfilteredTokens,
|
|
52
|
+
usesDtcg,
|
|
52
53
|
warnImmediately: false,
|
|
53
54
|
});
|
|
54
55
|
const bRefs = getReferences(b.original[valueKey], tokens, {
|
|
55
56
|
unfilteredTokens,
|
|
57
|
+
usesDtcg,
|
|
56
58
|
warnImmediately: false,
|
|
57
59
|
});
|
|
58
60
|
|
|
@@ -39,7 +39,8 @@ export function getReferences(value, tokens, opts = {}, references = []) {
|
|
|
39
39
|
*/
|
|
40
40
|
function findReference(_, variable) {
|
|
41
41
|
// remove 'value' to access the whole token object
|
|
42
|
-
|
|
42
|
+
const trailingValueRegex = usesDtcg ? /\.\$value$/ : /\.value$/;
|
|
43
|
+
variable = variable.trim().replace(trailingValueRegex, '');
|
|
43
44
|
|
|
44
45
|
// Find what the value is referencing
|
|
45
46
|
const pathName = getPathFromName(variable);
|