@cobalt-ui/plugin-css
Advanced tools
Comparing version 1.4.0 to 1.4.1
# @cobalt-ui/plugin-css | ||
## 1.4.1 | ||
### Patch Changes | ||
- [`adfe228`](https://github.com/drwpow/cobalt-ui/commit/adfe2280718244a3a25086e3f3b47e963993bca2) Thanks [@drwpow](https://github.com/drwpow)! - Replace micromatch with wildcard-match | ||
## 1.4.0 | ||
@@ -4,0 +10,0 @@ |
@@ -27,4 +27,3 @@ /** | ||
import { converter, formatCss } from 'culori'; | ||
import micromatch from 'micromatch'; | ||
import { encode, formatFontNames } from './util.js'; | ||
import { encode, formatFontNames, isTokenMatch } from './util.js'; | ||
const CSS_VAR_RE = /^var\(--[^)]+\)$/; | ||
@@ -141,3 +140,3 @@ const DASH_PREFIX_RE = /^-+/; | ||
for (const modeSelector of modeSelectors) { | ||
if (!token.$extensions.mode[modeSelector.mode] || (modeSelector.tokens?.length && !micromatch.isMatch(token.id, modeSelector.tokens))) { | ||
if (!token.$extensions.mode[modeSelector.mode] || (modeSelector.tokens && !isTokenMatch(token.id, modeSelector.tokens))) { | ||
continue; | ||
@@ -144,0 +143,0 @@ } |
@@ -7,1 +7,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
export declare function formatFontNames(fontNames: string[]): string; | ||
/** match token against globs */ | ||
export declare function isTokenMatch(tokenID: string, globPatterns: string[]): boolean; |
@@ -5,2 +5,3 @@ import mime from 'mime'; | ||
import svgo from 'svgo'; | ||
import wcmatch from './wildcard-match.js'; | ||
const LEADING_SLASH_RE = /^\//; | ||
@@ -25,2 +26,13 @@ const URL_PREFIX = /^\s*url\(['"]?/; | ||
} | ||
/** match token against globs */ | ||
export function isTokenMatch(tokenID, globPatterns) { | ||
let isMatch = false; | ||
for (const tokenMatch of globPatterns) { | ||
if (wcmatch(tokenMatch)(tokenID)) { | ||
isMatch = true; | ||
break; | ||
} | ||
} | ||
return isMatch; | ||
} | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "@cobalt-ui/plugin-css", | ||
"description": "Generate CSS from your design tokens schema (requires @cobalt-ui/cli)", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"author": { | ||
@@ -30,3 +30,2 @@ "name": "Drew Powers", | ||
"culori": "^3.2.0", | ||
"micromatch": "^4.0.5", | ||
"mime": "^3.0.0", | ||
@@ -38,3 +37,2 @@ "svgo": "^3.0.2" | ||
"@cobalt-ui/core": "^1.4.3", | ||
"@types/micromatch": "^4.0.2", | ||
"@types/node": "^20.5.7", | ||
@@ -41,0 +39,0 @@ "npm-run-all": "^4.1.5", |
@@ -24,4 +24,3 @@ import type { | ||
import {converter, formatCss} from 'culori'; | ||
import micromatch from 'micromatch'; | ||
import {encode, formatFontNames} from './util.js'; | ||
import {encode, formatFontNames, isTokenMatch} from './util.js'; | ||
@@ -168,5 +167,6 @@ const CSS_VAR_RE = /^var\(--[^)]+\)$/; | ||
for (const modeSelector of modeSelectors) { | ||
if (!token.$extensions.mode[modeSelector.mode] || (modeSelector.tokens?.length && !micromatch.isMatch(token.id, modeSelector.tokens))) { | ||
if (!token.$extensions.mode[modeSelector.mode] || (modeSelector.tokens && !isTokenMatch(token.id, modeSelector.tokens))) { | ||
continue; | ||
} | ||
for (const selector of modeSelector.selectors) { | ||
@@ -173,0 +173,0 @@ if (!selectors.includes(selector)) selectors.push(selector); |
@@ -5,2 +5,3 @@ import mime from 'mime'; | ||
import svgo from 'svgo'; | ||
import wcmatch from './wildcard-match.js'; | ||
@@ -29,1 +30,13 @@ const LEADING_SLASH_RE = /^\//; | ||
} | ||
/** match token against globs */ | ||
export function isTokenMatch(tokenID: string, globPatterns: string[]): boolean { | ||
let isMatch = false; | ||
for (const tokenMatch of globPatterns) { | ||
if (wcmatch(tokenMatch)(tokenID)) { | ||
isMatch = true; | ||
break; | ||
} | ||
} | ||
return isMatch; | ||
} |
Sorry, the diff of this file is not supported yet
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
126860
7
5
30
2055
- Removedmicromatch@^4.0.5
- Removedmicromatch@4.0.8(transitive)