@cobalt-ui/plugin-json
Advanced tools
Comparing version 0.3.4 to 0.4.0
# @cobalt-ui/plugin-json | ||
## 0.4.0 | ||
### Minor Changes | ||
- 07bc365: Update to Feb 2022 version of the Design Tokens format | ||
## 0.3.4 | ||
@@ -4,0 +10,0 @@ |
@@ -7,17 +7,16 @@ export default function json(options) { | ||
async build({ tokens }) { | ||
const transformedTokens = tokens.map((token) => { | ||
if (transform) { | ||
token.$value = transform(token); | ||
const $extensions = token.$extensions; | ||
for (const mode of Object.keys(($extensions && $extensions.mode) || {})) { | ||
token.$extensions.mode[mode] = transform(token, mode); | ||
} | ||
} | ||
return token; | ||
}); | ||
return [ | ||
{ | ||
filename, | ||
contents: JSON.stringify(tokens, (_, token) => { | ||
// apply transformValue() | ||
if (transform && typeof token.type == 'string') { | ||
token.value = transform(token); | ||
if (token.mode) { | ||
for (const mode of Object.keys(token.mode)) { | ||
token.mode[mode] = transform(token, mode); | ||
} | ||
} | ||
} | ||
return token; | ||
}, 2), | ||
contents: JSON.stringify(transformedTokens, undefined, 2), | ||
}, | ||
@@ -24,0 +23,0 @@ ]; |
{ | ||
"name": "@cobalt-ui/plugin-json", | ||
"description": "Generate JSON from your design tokens schema (requires @cobalt-ui/cli)", | ||
"version": "0.3.4", | ||
"version": "0.4.0", | ||
"author": { | ||
@@ -21,3 +21,3 @@ "name": "Drew Powers", | ||
"devDependencies": { | ||
"@cobalt-ui/core": "^0.4.0" | ||
"@cobalt-ui/core": "^0.6.0" | ||
}, | ||
@@ -24,0 +24,0 @@ "scripts": { |
@@ -32,21 +32,16 @@ import type { BuildResult, Plugin, Token } from '@cobalt-ui/core'; | ||
async build({ tokens }): Promise<BuildResult[]> { | ||
const transformedTokens = tokens.map((token) => { | ||
if (transform) { | ||
token.$value = transform(token); | ||
const $extensions = token.$extensions; | ||
for (const mode of Object.keys(($extensions && $extensions.mode) || {})) { | ||
(token.$extensions as any).mode[mode] = transform(token, mode); | ||
} | ||
} | ||
return token; | ||
}); | ||
return [ | ||
{ | ||
filename, | ||
contents: JSON.stringify( | ||
tokens, | ||
(_, token) => { | ||
// apply transformValue() | ||
if (transform && typeof token.type == 'string') { | ||
token.value = transform(token); | ||
if (token.mode) { | ||
for (const mode of Object.keys(token.mode)) { | ||
token.mode[mode] = transform(token, mode); | ||
} | ||
} | ||
} | ||
return token; | ||
}, | ||
2 | ||
), | ||
contents: JSON.stringify(transformedTokens, undefined, 2), | ||
}, | ||
@@ -53,0 +48,0 @@ ]; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8245
87