Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cobalt-ui/plugin-json

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cobalt-ui/plugin-json - npm Package Compare versions

Comparing version 0.3.4 to 0.4.0

6

CHANGELOG.md
# @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 @@

23

dist/index.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc