css-typed-vars 0.10.0 → 0.10.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/README.md CHANGED
@@ -141,7 +141,7 @@ npx css-typed-vars --input "src/**/*.css" --output src/cssVars.ts --prune-check
141
141
  | `--group` | Nest keys under an object named after each variable's first hyphen segment: `--color-primary`/`--color-secondary` → `cssVars.color.primary`/`cssVars.color.secondary`. A variable with no hyphen stays top-level. Can't be combined with `--prefix`. |
142
142
  | `--helpers` | Also emit the `CssVarRef` type and typed `getCssVar(ref, el?)`/`setCssVar(ref, value, el?)`/`withFallback(ref, fallback)` helpers — see [Usage](#usage). |
143
143
  | `--prune` | Drop generated vars with no detected `cssVars.<key>` usage. Requires `--usage <glob>` (repeatable). With `--group`, matches `cssVars.<group>.<key>` and keeps a whole group referenced as `cssVars.<group>`. |
144
- | `--prune-check` | Like `--prune`, but only reports unused vars without writing; exits 1 if any are found. Useful in CI. |
144
+ | `--prune-check` | Like `--prune`, but only reports unused vars without writing; exits 1 if any are found. Doesn't need `--output`. Useful in CI. |
145
145
  | `--lint-refs` | Report `var(--name)` references to variables not declared anywhere in the input; exits 1 if any (without a fallback) are found — see [Linting var() references](#linting-var-references) |
146
146
  | `--refs-ignore` | Name or `--prefix-*` pattern for `--lint-refs` to skip (repeatable) |
147
147
  | `--usage` | Glob of source files to scan for `cssVars` usage, for `--prune`/`--prune-check` (repeatable) |
package/dist/cli.cjs CHANGED
@@ -1125,7 +1125,10 @@ function validateTarget({ options, tag }, single) {
1125
1125
  if (!input) throw new CliError(`${tag}: --lint-refs requires --input <glob> (or "input" in the config file).`);
1126
1126
  return;
1127
1127
  }
1128
- if (!input || !output) {
1128
+ if (pruneCheckMode && !input) {
1129
+ throw new CliError(`${tag}: --prune-check requires --input <glob> (or "input" in the config file).`);
1130
+ }
1131
+ if (!input || !output && !pruneCheckMode) {
1129
1132
  throw new CliError(single ? `${USAGE}
1130
1133
  Or add a css-typed-vars.config.js file with input and output fields. Run with --help to see all options.` : `${tag}: every target needs "input" and "output".`);
1131
1134
  }
package/dist/cli.js CHANGED
@@ -229,7 +229,10 @@ function validateTarget({ options, tag }, single) {
229
229
  if (!input) throw new CliError(`${tag}: --lint-refs requires --input <glob> (or "input" in the config file).`);
230
230
  return;
231
231
  }
232
- if (!input || !output) {
232
+ if (pruneCheckMode && !input) {
233
+ throw new CliError(`${tag}: --prune-check requires --input <glob> (or "input" in the config file).`);
234
+ }
235
+ if (!input || !output && !pruneCheckMode) {
233
236
  throw new CliError(single ? `${USAGE}
234
237
  Or add a css-typed-vars.config.js file with input and output fields. Run with --help to see all options.` : `${tag}: every target needs "input" and "output".`);
235
238
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "css-typed-vars",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Generate TypeScript typed constants from CSS custom properties",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",