@weerachai06/tw-scanner 1.1.3 → 1.1.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.
Files changed (2) hide show
  1. package/dist/validator.js +3 -20
  2. package/package.json +1 -1
package/dist/validator.js CHANGED
@@ -38,26 +38,9 @@ export async function loadTailwindContext(cssFile) {
38
38
  }
39
39
  // ─── Build CSS selector for string matching ──────────────────────────────────
40
40
  function cssSelector(cls) {
41
- // Produces the escaped selector as it appears in Tailwind's CSS output
42
- return '.' + cls
43
- .replace(/\//g, '\\/')
44
- .replace(/\./g, '\\.')
45
- .replace(/:/g, '\\:')
46
- .replace(/\[/g, '\\[')
47
- .replace(/\]/g, '\\]')
48
- .replace(/\(/g, '\\(')
49
- .replace(/\)/g, '\\)')
50
- .replace(/=/g, '\\=')
51
- .replace(/>/g, '\\>')
52
- .replace(/&/g, '\\&')
53
- .replace(/~/g, '\\~')
54
- .replace(/\+/g, '\\+')
55
- .replace(/#/g, '\\#')
56
- .replace(/%/g, '\\%')
57
- .replace(/!/g, '\\!')
58
- .replace(/,/g, '\\,')
59
- .replace(/'/g, "\\'")
60
- .replace(/"/g, '\\"');
41
+ // Produces the escaped selector as it appears in Tailwind's CSS output.
42
+ // Single-pass replacement avoids any interaction between sequential replacements.
43
+ return '.' + cls.replace(/[\\/.:[\]()=>&~+#%!,'"]/g, '\\$&');
61
44
  }
62
45
  function selectorInOutput(selector, output) {
63
46
  const idx = output.indexOf(selector);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weerachai06/tw-scanner",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "AST-based Tailwind v4 class validator for React projects",
5
5
  "type": "module",
6
6
  "bin": {