@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.
- package/dist/validator.js +3 -20
- 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
|
-
|
|
43
|
-
|
|
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);
|