oxlint-tailwindcss 1.15.0 → 1.15.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/dist/index.cjs +43 -10
- package/dist/index.mjs +43 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4781,16 +4781,49 @@ function toPersisted(r) {
|
|
|
4781
4781
|
const WORKER_SCRIPT$2 = makeWorkerScript(`async (ds, request, env) => {
|
|
4782
4782
|
const { classes, rem } = request;
|
|
4783
4783
|
const options = rem ? { rem } : undefined;
|
|
4784
|
-
const
|
|
4784
|
+
const escapeClass = (s) => {
|
|
4785
|
+
if (s === '-') return '\\\\-';
|
|
4786
|
+
let out = '';
|
|
4787
|
+
for (let i = 0; i < s.length; i++) {
|
|
4788
|
+
const c = s.charCodeAt(i);
|
|
4789
|
+
if (c === 0) out += '\\uFFFD';
|
|
4790
|
+
else if ((c >= 1 && c <= 31) || c === 127 || (c >= 48 && c <= 57 && (i === 0 || (i === 1 && s[0] === '-')))) {
|
|
4791
|
+
out += '\\\\' + c.toString(16) + ' ';
|
|
4792
|
+
} else if (c >= 128 || c === 45 || c === 95 || (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122)) {
|
|
4793
|
+
out += s[i];
|
|
4794
|
+
} else {
|
|
4795
|
+
out += '\\\\' + s[i];
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4798
|
+
return out;
|
|
4799
|
+
};
|
|
4800
|
+
const NAME_CHAR = /[\\w\\\\-]|[^\\x00-\\x7f]/;
|
|
4785
4801
|
const rawOf = (d, cls) => {
|
|
4786
4802
|
let out;
|
|
4787
4803
|
try { out = d.candidatesToCss([cls]); } catch (e) { return null; }
|
|
4788
4804
|
return out && out[0] ? out[0] : null;
|
|
4789
4805
|
};
|
|
4790
|
-
const own = (css) =>
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4806
|
+
const own = (css, cls) => {
|
|
4807
|
+
const token = '.' + escapeClass(cls);
|
|
4808
|
+
let out = '';
|
|
4809
|
+
let i = 0;
|
|
4810
|
+
while (i < css.length) {
|
|
4811
|
+
const ch = css[i];
|
|
4812
|
+
if (ch === '"' || ch === "'") {
|
|
4813
|
+
let j = i + 1;
|
|
4814
|
+
while (j < css.length && css[j] !== ch) j += css[j] === '\\\\' ? 2 : 1;
|
|
4815
|
+
out += css.slice(i, j + 1);
|
|
4816
|
+
i = j + 1;
|
|
4817
|
+
} else if (css.startsWith(token, i) && css[i - 1] !== '\\\\' && !NAME_CHAR.test(css[i + token.length] || ' ')) {
|
|
4818
|
+
out += '.__c';
|
|
4819
|
+
i += token.length;
|
|
4820
|
+
} else {
|
|
4821
|
+
out += ch;
|
|
4822
|
+
i++;
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4825
|
+
return out.replace(/\\s+/g, ' ').trim();
|
|
4826
|
+
};
|
|
4794
4827
|
// Declarations only, selectors and at-rule preludes dropped: equal for two
|
|
4795
4828
|
// rules that set the same things on different selectors.
|
|
4796
4829
|
const declarationsOf = (css) => css.replace(/[^{};]+\\{/g, '').replace(/\\}/g, '').replace(/\\s+/g, ' ').trim();
|
|
@@ -4857,14 +4890,14 @@ const WORKER_SCRIPT$2 = makeWorkerScript(`async (ds, request, env) => {
|
|
|
4857
4890
|
if (canonical === cls) { results.push({ canonical: cls, safe: true }); continue; }
|
|
4858
4891
|
const rawA = rawOf(ds, cls);
|
|
4859
4892
|
const rawB = rawOf(ds, canonical);
|
|
4860
|
-
const a = rawA === null ? null : own(rawA);
|
|
4861
|
-
const b = rawB === null ? null : own(rawB);
|
|
4893
|
+
const a = rawA === null ? null : own(rawA, cls);
|
|
4894
|
+
const b = rawB === null ? null : own(rawB, canonical);
|
|
4862
4895
|
if (a !== null && b !== null && a === b) { results.push({ canonical, safe: true }); continue; }
|
|
4863
4896
|
if (a === null || b === null) { results.push({ canonical, safe: false }); continue; }
|
|
4864
4897
|
const ma = stripMirrors(rawA);
|
|
4865
4898
|
const mb = stripMirrors(rawB);
|
|
4866
|
-
const sa = own(ma.css);
|
|
4867
|
-
const sb = own(mb.css);
|
|
4899
|
+
const sa = own(ma.css, cls);
|
|
4900
|
+
const sb = own(mb.css, canonical);
|
|
4868
4901
|
if (sa === sb) {
|
|
4869
4902
|
// The same CSS once the mirrors are gone. It is 'variable' only when the
|
|
4870
4903
|
// canonical form ADDS mirrors and drops none; any other way to get here
|
|
@@ -4884,7 +4917,7 @@ const WORKER_SCRIPT$2 = makeWorkerScript(`async (ds, request, env) => {
|
|
|
4884
4917
|
try { stock = await env.loadStock(); } catch (e) {}
|
|
4885
4918
|
const xa = stock && rawOf(stock, cls);
|
|
4886
4919
|
const xb = stock && rawOf(stock, canonical);
|
|
4887
|
-
const same = xa && xb && own(stripMirrors(xa).css) === own(stripMirrors(xb).css);
|
|
4920
|
+
const same = xa && xb && own(stripMirrors(xa).css, cls) === own(stripMirrors(xb).css, canonical);
|
|
4888
4921
|
results.push({ canonical, safe: false, reason: same ? 'variant' : 'selector' });
|
|
4889
4922
|
}
|
|
4890
4923
|
return results;
|
package/dist/index.mjs
CHANGED
|
@@ -4784,16 +4784,49 @@ function toPersisted(r) {
|
|
|
4784
4784
|
const WORKER_SCRIPT$2 = makeWorkerScript(`async (ds, request, env) => {
|
|
4785
4785
|
const { classes, rem } = request;
|
|
4786
4786
|
const options = rem ? { rem } : undefined;
|
|
4787
|
-
const
|
|
4787
|
+
const escapeClass = (s) => {
|
|
4788
|
+
if (s === '-') return '\\\\-';
|
|
4789
|
+
let out = '';
|
|
4790
|
+
for (let i = 0; i < s.length; i++) {
|
|
4791
|
+
const c = s.charCodeAt(i);
|
|
4792
|
+
if (c === 0) out += '\\uFFFD';
|
|
4793
|
+
else if ((c >= 1 && c <= 31) || c === 127 || (c >= 48 && c <= 57 && (i === 0 || (i === 1 && s[0] === '-')))) {
|
|
4794
|
+
out += '\\\\' + c.toString(16) + ' ';
|
|
4795
|
+
} else if (c >= 128 || c === 45 || c === 95 || (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122)) {
|
|
4796
|
+
out += s[i];
|
|
4797
|
+
} else {
|
|
4798
|
+
out += '\\\\' + s[i];
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
return out;
|
|
4802
|
+
};
|
|
4803
|
+
const NAME_CHAR = /[\\w\\\\-]|[^\\x00-\\x7f]/;
|
|
4788
4804
|
const rawOf = (d, cls) => {
|
|
4789
4805
|
let out;
|
|
4790
4806
|
try { out = d.candidatesToCss([cls]); } catch (e) { return null; }
|
|
4791
4807
|
return out && out[0] ? out[0] : null;
|
|
4792
4808
|
};
|
|
4793
|
-
const own = (css) =>
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4809
|
+
const own = (css, cls) => {
|
|
4810
|
+
const token = '.' + escapeClass(cls);
|
|
4811
|
+
let out = '';
|
|
4812
|
+
let i = 0;
|
|
4813
|
+
while (i < css.length) {
|
|
4814
|
+
const ch = css[i];
|
|
4815
|
+
if (ch === '"' || ch === "'") {
|
|
4816
|
+
let j = i + 1;
|
|
4817
|
+
while (j < css.length && css[j] !== ch) j += css[j] === '\\\\' ? 2 : 1;
|
|
4818
|
+
out += css.slice(i, j + 1);
|
|
4819
|
+
i = j + 1;
|
|
4820
|
+
} else if (css.startsWith(token, i) && css[i - 1] !== '\\\\' && !NAME_CHAR.test(css[i + token.length] || ' ')) {
|
|
4821
|
+
out += '.__c';
|
|
4822
|
+
i += token.length;
|
|
4823
|
+
} else {
|
|
4824
|
+
out += ch;
|
|
4825
|
+
i++;
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4828
|
+
return out.replace(/\\s+/g, ' ').trim();
|
|
4829
|
+
};
|
|
4797
4830
|
// Declarations only, selectors and at-rule preludes dropped: equal for two
|
|
4798
4831
|
// rules that set the same things on different selectors.
|
|
4799
4832
|
const declarationsOf = (css) => css.replace(/[^{};]+\\{/g, '').replace(/\\}/g, '').replace(/\\s+/g, ' ').trim();
|
|
@@ -4860,14 +4893,14 @@ const WORKER_SCRIPT$2 = makeWorkerScript(`async (ds, request, env) => {
|
|
|
4860
4893
|
if (canonical === cls) { results.push({ canonical: cls, safe: true }); continue; }
|
|
4861
4894
|
const rawA = rawOf(ds, cls);
|
|
4862
4895
|
const rawB = rawOf(ds, canonical);
|
|
4863
|
-
const a = rawA === null ? null : own(rawA);
|
|
4864
|
-
const b = rawB === null ? null : own(rawB);
|
|
4896
|
+
const a = rawA === null ? null : own(rawA, cls);
|
|
4897
|
+
const b = rawB === null ? null : own(rawB, canonical);
|
|
4865
4898
|
if (a !== null && b !== null && a === b) { results.push({ canonical, safe: true }); continue; }
|
|
4866
4899
|
if (a === null || b === null) { results.push({ canonical, safe: false }); continue; }
|
|
4867
4900
|
const ma = stripMirrors(rawA);
|
|
4868
4901
|
const mb = stripMirrors(rawB);
|
|
4869
|
-
const sa = own(ma.css);
|
|
4870
|
-
const sb = own(mb.css);
|
|
4902
|
+
const sa = own(ma.css, cls);
|
|
4903
|
+
const sb = own(mb.css, canonical);
|
|
4871
4904
|
if (sa === sb) {
|
|
4872
4905
|
// The same CSS once the mirrors are gone. It is 'variable' only when the
|
|
4873
4906
|
// canonical form ADDS mirrors and drops none; any other way to get here
|
|
@@ -4887,7 +4920,7 @@ const WORKER_SCRIPT$2 = makeWorkerScript(`async (ds, request, env) => {
|
|
|
4887
4920
|
try { stock = await env.loadStock(); } catch (e) {}
|
|
4888
4921
|
const xa = stock && rawOf(stock, cls);
|
|
4889
4922
|
const xb = stock && rawOf(stock, canonical);
|
|
4890
|
-
const same = xa && xb && own(stripMirrors(xa).css) === own(stripMirrors(xb).css);
|
|
4923
|
+
const same = xa && xb && own(stripMirrors(xa).css, cls) === own(stripMirrors(xb).css, canonical);
|
|
4891
4924
|
results.push({ canonical, safe: false, reason: same ? 'variant' : 'selector' });
|
|
4892
4925
|
}
|
|
4893
4926
|
return results;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-tailwindcss",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "Tailwind CSS v4 lint rules for oxlint that read your design system: unknown, conflicting and deprecated classes, theme colors, class order — with autofixes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"classnames",
|