css-typed-vars 0.4.3 → 0.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.
- package/README.md +1 -1
- package/dist/{chunk-CCFKX6NQ.js → chunk-6OVNVVEP.js} +1 -1
- package/dist/{chunk-Y6U2ERL3.js → chunk-J7ZV6AUQ.js} +2 -2
- package/dist/{chunk-LYWWAGNR.js → chunk-SWVHEM3S.js} +1 -1
- package/dist/cli.cjs +4 -3
- package/dist/cli.js +4 -3
- package/dist/esbuild.cjs +2 -2
- package/dist/esbuild.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/rollup.cjs +2 -2
- package/dist/rollup.js +2 -2
- package/dist/unplugin.cjs +2 -2
- package/dist/unplugin.js +2 -2
- package/dist/vite.cjs +2 -2
- package/dist/vite.js +2 -2
- package/dist/webpack.cjs +2 -2
- package/dist/webpack.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ npx css-typed-vars --input "src/**/*.css" --output src/cssVars.ts --selector ".d
|
|
|
121
121
|
|------|-------------|
|
|
122
122
|
| `--input` | Glob pattern for CSS/SCSS/Less files |
|
|
123
123
|
| `--output` | Output file. `.ts` → TypeScript, `.js` → JavaScript + `.d.ts` alongside |
|
|
124
|
-
| `--exclude` | Glob pattern for files to exclude (
|
|
124
|
+
| `--exclude` | Glob pattern for files to exclude (repeatable: `--exclude "**/a/**" --exclude "**/b/**"`) |
|
|
125
125
|
| `--prefix` | Prefix for generated keys: `--prefix theme` → `themeColorPrimary` |
|
|
126
126
|
| `--naming` | Key naming: `camelCase` (default), `snake`, `kebab` |
|
|
127
127
|
| `--selector` | Extra CSS selector to scan for variables (single value; use config file for multiple) |
|
|
@@ -46,9 +46,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
46
46
|
// src/generator.ts
|
|
47
47
|
function toKey(cssVarName, naming = "camelCase") {
|
|
48
48
|
const stripped = cssVarName.replace(/^--/, "");
|
|
49
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
50
49
|
if (naming === "kebab") return stripped;
|
|
51
|
-
|
|
50
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
51
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
52
52
|
}
|
|
53
53
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
54
54
|
if (!prefix) return key;
|
package/dist/cli.cjs
CHANGED
|
@@ -80,9 +80,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
80
80
|
// src/generator.ts
|
|
81
81
|
function toKey(cssVarName, naming = "camelCase") {
|
|
82
82
|
const stripped = cssVarName.replace(/^--/, "");
|
|
83
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
84
83
|
if (naming === "kebab") return stripped;
|
|
85
|
-
|
|
84
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
85
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
86
86
|
}
|
|
87
87
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
88
88
|
if (!prefix) return key;
|
|
@@ -201,7 +201,8 @@ async function main() {
|
|
|
201
201
|
const config = await loadConfig();
|
|
202
202
|
const input = getArg("--input") ?? config.input;
|
|
203
203
|
const output = getArg("--output") ?? config.output;
|
|
204
|
-
const
|
|
204
|
+
const excludeArgs = getArgs("--exclude");
|
|
205
|
+
const exclude = excludeArgs.length > 0 ? excludeArgs : config.exclude;
|
|
205
206
|
const prefix = getArg("--prefix") ?? config.prefix;
|
|
206
207
|
const naming = getArg("--naming") ?? config.naming;
|
|
207
208
|
const selectorArgs = getArgs("--selector");
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
generate
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-6OVNVVEP.js";
|
|
5
|
+
import "./chunk-J7ZV6AUQ.js";
|
|
6
6
|
|
|
7
7
|
// src/cli.ts
|
|
8
8
|
import { readFile } from "fs/promises";
|
|
@@ -56,7 +56,8 @@ async function main() {
|
|
|
56
56
|
const config = await loadConfig();
|
|
57
57
|
const input = getArg("--input") ?? config.input;
|
|
58
58
|
const output = getArg("--output") ?? config.output;
|
|
59
|
-
const
|
|
59
|
+
const excludeArgs = getArgs("--exclude");
|
|
60
|
+
const exclude = excludeArgs.length > 0 ? excludeArgs : config.exclude;
|
|
60
61
|
const prefix = getArg("--prefix") ?? config.prefix;
|
|
61
62
|
const naming = getArg("--naming") ?? config.naming;
|
|
62
63
|
const selectorArgs = getArgs("--selector");
|
package/dist/esbuild.cjs
CHANGED
|
@@ -82,9 +82,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
82
82
|
// src/generator.ts
|
|
83
83
|
function toKey(cssVarName, naming = "camelCase") {
|
|
84
84
|
const stripped = cssVarName.replace(/^--/, "");
|
|
85
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
86
85
|
if (naming === "kebab") return stripped;
|
|
87
|
-
|
|
86
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
87
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
88
88
|
}
|
|
89
89
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
90
90
|
if (!prefix) return key;
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -84,9 +84,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
84
84
|
// src/generator.ts
|
|
85
85
|
function toKey(cssVarName, naming = "camelCase") {
|
|
86
86
|
const stripped = cssVarName.replace(/^--/, "");
|
|
87
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
88
87
|
if (naming === "kebab") return stripped;
|
|
89
|
-
|
|
88
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
89
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
90
90
|
}
|
|
91
91
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
92
92
|
if (!prefix) return key;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6OVNVVEP.js";
|
|
4
4
|
import {
|
|
5
5
|
generateCode,
|
|
6
6
|
generateDeclaration,
|
|
7
7
|
generateJs,
|
|
8
8
|
parseVarNames,
|
|
9
9
|
scanVarNames
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-J7ZV6AUQ.js";
|
|
11
11
|
export {
|
|
12
12
|
generate,
|
|
13
13
|
generateCode,
|
package/dist/rollup.cjs
CHANGED
|
@@ -82,9 +82,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
82
82
|
// src/generator.ts
|
|
83
83
|
function toKey(cssVarName, naming = "camelCase") {
|
|
84
84
|
const stripped = cssVarName.replace(/^--/, "");
|
|
85
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
86
85
|
if (naming === "kebab") return stripped;
|
|
87
|
-
|
|
86
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
87
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
88
88
|
}
|
|
89
89
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
90
90
|
if (!prefix) return key;
|
package/dist/rollup.js
CHANGED
package/dist/unplugin.cjs
CHANGED
|
@@ -80,9 +80,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
80
80
|
// src/generator.ts
|
|
81
81
|
function toKey(cssVarName, naming = "camelCase") {
|
|
82
82
|
const stripped = cssVarName.replace(/^--/, "");
|
|
83
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
84
83
|
if (naming === "kebab") return stripped;
|
|
85
|
-
|
|
84
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
85
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
86
86
|
}
|
|
87
87
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
88
88
|
if (!prefix) return key;
|
package/dist/unplugin.js
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -82,9 +82,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
82
82
|
// src/generator.ts
|
|
83
83
|
function toKey(cssVarName, naming = "camelCase") {
|
|
84
84
|
const stripped = cssVarName.replace(/^--/, "");
|
|
85
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
86
85
|
if (naming === "kebab") return stripped;
|
|
87
|
-
|
|
86
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
87
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
88
88
|
}
|
|
89
89
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
90
90
|
if (!prefix) return key;
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -82,9 +82,9 @@ async function scanVarNames(patterns, exclude, selectors) {
|
|
|
82
82
|
// src/generator.ts
|
|
83
83
|
function toKey(cssVarName, naming = "camelCase") {
|
|
84
84
|
const stripped = cssVarName.replace(/^--/, "");
|
|
85
|
-
if (naming === "snake") return stripped.replace(/-/g, "_");
|
|
86
85
|
if (naming === "kebab") return stripped;
|
|
87
|
-
|
|
86
|
+
const key = naming === "snake" ? stripped.replace(/-/g, "_") : stripped.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
87
|
+
return /^\d/.test(key) ? `_${key}` : key;
|
|
88
88
|
}
|
|
89
89
|
function applyPrefix(key, prefix, naming = "camelCase") {
|
|
90
90
|
if (!prefix) return key;
|
package/dist/webpack.js
CHANGED