tailwind-a11y 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +7 -2
  2. package/package.json +15 -3
package/dist/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFileSync } from "node:fs";
3
+ import { relative, sep } from "node:path";
3
4
  import fg from "fast-glob";
4
5
  import { extractChecks, extractContrastSkips } from "./parser/extractClasses.js";
5
6
  import { checkContrast, checkContrastValueSkips } from "./rules/checkContrast.js";
@@ -42,9 +43,13 @@ async function main() {
42
43
  });
43
44
  const violations = [];
44
45
  const skips = [];
45
- for (const file of files) {
46
+ for (const absPath of files) {
47
+ // Display/report path is project-root-relative (e.g. "/src/App.tsx"),
48
+ // not the full absolute path — reading still uses the absolute path,
49
+ // which is unambiguous regardless of process.cwd() quirks.
50
+ const file = "/" + relative(process.cwd(), absPath).split(sep).join("/");
46
51
  try {
47
- const code = readFileSync(file, "utf8");
52
+ const code = readFileSync(absPath, "utf8");
48
53
  const contrastChecks = extractChecks(code, file);
49
54
  violations.push(...checkContrast(contrastChecks), ...checkTouchTargets(extractTouchTargetChecks(code, file)), ...checkFocusIndicators(extractFocusIndicatorChecks(code, file)));
50
55
  if (verbose) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-a11y",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Static analysis CLI that catches WCAG accessibility violations — color contrast, touch target size, and focus indicator removal — in Tailwind CSS class combinations before they ship.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,7 +14,9 @@
14
14
  "import": "./dist/index.js"
15
15
  }
16
16
  },
17
- "files": ["dist"],
17
+ "files": [
18
+ "dist"
19
+ ],
18
20
  "engines": {
19
21
  "node": ">=18"
20
22
  },
@@ -25,7 +27,17 @@
25
27
  "test:watch": "vitest",
26
28
  "prepublishOnly": "npm run build && npm test"
27
29
  },
28
- "keywords": ["tailwindcss", "accessibility", "a11y", "wcag", "wcag22", "contrast", "touch-target", "focus-visible", "lint"],
30
+ "keywords": [
31
+ "tailwindcss",
32
+ "accessibility",
33
+ "a11y",
34
+ "wcag",
35
+ "wcag22",
36
+ "contrast",
37
+ "touch-target",
38
+ "focus-visible",
39
+ "lint"
40
+ ],
29
41
  "author": "chamroro",
30
42
  "license": "MIT",
31
43
  "repository": {