oxlint-tailwindcss 1.6.0 → 1.7.0
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 +95 -21
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +95 -21
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ let node_crypto = require("node:crypto");
|
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
let node_os = require("node:os");
|
|
6
|
-
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.
|
|
6
|
+
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.js
|
|
7
7
|
/**
|
|
8
8
|
* Define a plugin.
|
|
9
9
|
*
|
|
@@ -1139,6 +1139,38 @@ var DesignSystemCache = class DesignSystemCache {
|
|
|
1139
1139
|
isKnownClass(className) {
|
|
1140
1140
|
return this.validitySet.has(this.stripProjectPrefix(className));
|
|
1141
1141
|
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Is this a NAMED group/peer marker — `group/menu-item`, `peer/menu-button`?
|
|
1144
|
+
*
|
|
1145
|
+
* A marker binds a variant to one specific ancestor or sibling, and the
|
|
1146
|
+
* consumer's compiled selector hard-codes it as a class selector:
|
|
1147
|
+
* `group-hover/menu-item:underline` emits
|
|
1148
|
+
* `:is(:where(.group\/menu-item):hover *)`. A class selector matches whole
|
|
1149
|
+
* tokens, so bare `group` does not satisfy it — the named marker is required
|
|
1150
|
+
* markup. Tailwind emits no CSS for the marker itself, which is why
|
|
1151
|
+
* `no-unknown-classes` cannot ask "does it compile?" about one.
|
|
1152
|
+
*
|
|
1153
|
+
* Derived, not listed: the base must be a precomputed class that emits ZERO
|
|
1154
|
+
* declarations, which across every fixture resolves to exactly `group` and
|
|
1155
|
+
* `peer` (2 of ~23.6k). It self-prunes if Tailwind drops the variants,
|
|
1156
|
+
* self-extends if a new CSS-less marker appears, and excludes `@container/main`
|
|
1157
|
+
* for free — that one HAS declarations. The component set is subtracted
|
|
1158
|
+
* because a class referenced only through `[class~="…"]` (`not-prose`) also has
|
|
1159
|
+
* no declarations of its own, and `not-prose/x` is not Tailwind syntax.
|
|
1160
|
+
*
|
|
1161
|
+
* The name is user-chosen and Tailwind never checks that it exists, so any
|
|
1162
|
+
* NON-EMPTY name is accepted — including the shapes only an arbitrary modifier
|
|
1163
|
+
* can reach (`group/*`, `group/a/b`, `peer//x`), which is why this splits at
|
|
1164
|
+
* the FIRST slash rather than the last one `isValid` uses. The empty name is
|
|
1165
|
+
* the one genuinely dead spelling: `group-hover/` compiles to nothing.
|
|
1166
|
+
*/
|
|
1167
|
+
isMarkerClass(className) {
|
|
1168
|
+
const bare = this.stripProjectPrefix(className);
|
|
1169
|
+
const slash = bare.indexOf("/");
|
|
1170
|
+
if (slash <= 0 || slash === bare.length - 1) return false;
|
|
1171
|
+
const base = bare.slice(0, slash);
|
|
1172
|
+
return this.validitySet.has(base) && !this.componentSet.has(base) && this.getCssDeclarations(base).length === 0;
|
|
1173
|
+
}
|
|
1142
1174
|
/** Variant names the design system reports, for suggesting a typo's neighbour. */
|
|
1143
1175
|
variantNames() {
|
|
1144
1176
|
return [...this.variantOrderMap.keys()];
|
|
@@ -1860,31 +1892,68 @@ function collectCssSources(cssPath, baseDir) {
|
|
|
1860
1892
|
return files;
|
|
1861
1893
|
}
|
|
1862
1894
|
|
|
1895
|
+
// Class names the project writes in its own CSS, read from the SELECTORS only.
|
|
1896
|
+
//
|
|
1897
|
+
// This used to scan whole files with two regexes, which harvested identifiers
|
|
1898
|
+
// from places that are not selectors at all: the URLs in Tailwind's own preflight
|
|
1899
|
+
// comments (\`developer.mozilla.org\` → \`mozilla\`, \`org\`; \`bugs.chromium.org\`;
|
|
1900
|
+
// \`-webkit-\`) and the decimals in declaration values (\`padding: 0.5rem\` →
|
|
1901
|
+
// \`5rem\`). Everything here reaches \`validitySet\`, so every project accepted
|
|
1902
|
+
// \`com\`, \`org\`, \`css\` and \`5rem\` as valid Tailwind classes.
|
|
1903
|
+
//
|
|
1904
|
+
// A selector is the text between the last \`{\`, \`}\` or \`;\` and the next \`{\`, so
|
|
1905
|
+
// scanning only what precedes a \`{\` skips declaration bodies by construction —
|
|
1906
|
+
// a declaration ends in \`;\` or \`}\` and never reaches one. Comments and strings
|
|
1907
|
+
// are stepped over. Requiring a CSS identifier start (never a digit) is the
|
|
1908
|
+
// second line of defence, for a decimal inside an at-rule prelude
|
|
1909
|
+
// (\`@media (min-width: 40.5rem)\`).
|
|
1863
1910
|
function extractComponentClasses(cssPath, baseDir) {
|
|
1864
1911
|
const files = collectCssSources(cssPath, baseDir);
|
|
1865
|
-
const result =
|
|
1912
|
+
const result = new Set();
|
|
1913
|
+
const classRe = /\\.(-?[a-zA-Z_][\\w-]*)/g;
|
|
1866
1914
|
for (const content of files) {
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1915
|
+
let prelude = '';
|
|
1916
|
+
for (let i = 0; i < content.length; i++) {
|
|
1917
|
+
const c = content[i];
|
|
1918
|
+
if (c === '/' && content[i + 1] === '*') {
|
|
1919
|
+
const end = content.indexOf('*/', i + 2);
|
|
1920
|
+
i = end === -1 ? content.length : end + 1;
|
|
1921
|
+
continue;
|
|
1922
|
+
}
|
|
1923
|
+
if (c === '"' || c === "'") {
|
|
1924
|
+
const quote = c;
|
|
1875
1925
|
i++;
|
|
1926
|
+
while (i < content.length && content[i] !== quote) {
|
|
1927
|
+
if (content[i] === '\\\\') i++;
|
|
1928
|
+
i++;
|
|
1929
|
+
}
|
|
1930
|
+
continue;
|
|
1931
|
+
}
|
|
1932
|
+
if (c === '{') {
|
|
1933
|
+
classRe.lastIndex = 0;
|
|
1934
|
+
let m;
|
|
1935
|
+
while ((m = classRe.exec(prelude)) !== null) result.add(m[1]);
|
|
1936
|
+
prelude = '';
|
|
1937
|
+
continue;
|
|
1938
|
+
}
|
|
1939
|
+
if (c === '}' || c === ';') {
|
|
1940
|
+
// A statement at-rule carries a selector even though it has no block:
|
|
1941
|
+
// \`@custom-variant sidebar-open (&:where(.sidebar-open *));\` makes that
|
|
1942
|
+
// class load-bearing exactly the way \`group\`/\`peer\` are, so it has to
|
|
1943
|
+
// stay valid. Plain declarations never start with \`@\`, so this readmits
|
|
1944
|
+
// the selector without readmitting \`padding: 0.5rem\`.
|
|
1945
|
+
if (c === ';' && prelude.trimStart().charCodeAt(0) === 64) {
|
|
1946
|
+
classRe.lastIndex = 0;
|
|
1947
|
+
let m;
|
|
1948
|
+
while ((m = classRe.exec(prelude)) !== null) result.add(m[1]);
|
|
1949
|
+
}
|
|
1950
|
+
prelude = '';
|
|
1951
|
+
continue;
|
|
1876
1952
|
}
|
|
1877
|
-
|
|
1878
|
-
const selRe = /\\.([\\w-]+)/g;
|
|
1879
|
-
let sm;
|
|
1880
|
-
while ((sm = selRe.exec(block)) !== null) result.push(sm[1]);
|
|
1953
|
+
prelude += c;
|
|
1881
1954
|
}
|
|
1882
|
-
// Scan all class selectors anywhere in the file (.class-name)
|
|
1883
|
-
const classSelRe = /\\.([a-zA-Z_][\\w-]*)/g;
|
|
1884
|
-
let cs;
|
|
1885
|
-
while ((cs = classSelRe.exec(content)) !== null) result.push(cs[1]);
|
|
1886
1955
|
}
|
|
1887
|
-
return [...
|
|
1956
|
+
return [...result];
|
|
1888
1957
|
}
|
|
1889
1958
|
|
|
1890
1959
|
${DECL_EXTRACTOR_SOURCE}
|
|
@@ -2289,11 +2358,13 @@ async function main() {
|
|
|
2289
2358
|
}
|
|
2290
2359
|
|
|
2291
2360
|
// Component classes from @layer components
|
|
2292
|
-
const
|
|
2361
|
+
const componentSet = new Set(extractComponentClasses(cssPath, base));
|
|
2293
2362
|
|
|
2294
2363
|
// Extract class names from attribute selectors [class~="..."] in CSS output.
|
|
2295
2364
|
// Plugins like @tailwindcss/typography use these for modifier classes (e.g. "not-prose")
|
|
2296
2365
|
// that don't generate their own CSS but are referenced in other classes' selectors.
|
|
2366
|
+
// Interned in a Set: typography references \`not-prose\` from ~230 selectors, and
|
|
2367
|
+
// pushing one entry per occurrence only inflated the cache artifact.
|
|
2297
2368
|
const attrClassRe = /\\[class~="([^"]+)"\\]/g;
|
|
2298
2369
|
for (let i = 0; i < cssResults.length; i++) {
|
|
2299
2370
|
if (cssResults[i]) {
|
|
@@ -2301,10 +2372,11 @@ async function main() {
|
|
|
2301
2372
|
attrClassRe.lastIndex = 0;
|
|
2302
2373
|
while ((acm = attrClassRe.exec(cssResults[i])) !== null) {
|
|
2303
2374
|
// Typography-style plugins emit \`[class~="tw:not-prose"]\` under a prefix.
|
|
2304
|
-
|
|
2375
|
+
componentSet.add(unpfx(acm[1]));
|
|
2305
2376
|
}
|
|
2306
2377
|
}
|
|
2307
2378
|
}
|
|
2379
|
+
const componentClasses = [...componentSet];
|
|
2308
2380
|
|
|
2309
2381
|
// Arbitrary equivalents: map arbitrary forms to named equivalents.
|
|
2310
2382
|
// Enumerate every dash split point so multi-segment utilities (e.g.
|
|
@@ -3609,6 +3681,7 @@ const noUnknownClasses = defineRule({
|
|
|
3609
3681
|
if (shouldIgnore(cls)) continue;
|
|
3610
3682
|
const bare = strippedUtility(cls).bare;
|
|
3611
3683
|
if (cache.isKnownClass(bare)) continue;
|
|
3684
|
+
if (cache.isMarkerClass(bare)) continue;
|
|
3612
3685
|
if (!toVerify) toVerify = [];
|
|
3613
3686
|
toVerify.push(bare);
|
|
3614
3687
|
}
|
|
@@ -3628,6 +3701,7 @@ const noUnknownClasses = defineRule({
|
|
|
3628
3701
|
}, split);
|
|
3629
3702
|
continue;
|
|
3630
3703
|
}
|
|
3704
|
+
if (cache.isMarkerClass(bare) && (!cache.prefix || variant.startsWith(`${cache.prefix}:`))) continue;
|
|
3631
3705
|
const compiles = cache.isKnownClass(bare) ? true : verified?.get(bare);
|
|
3632
3706
|
if (validity === "unknown" || compiles === false) {
|
|
3633
3707
|
const suggestionBare = findBestSuggestion(bare, cache.validClasses);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.d.ts
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region src-js/plugins/tokens.d.ts
|
|
4
4
|
/**
|
|
@@ -485,7 +485,7 @@ interface Program extends Span {
|
|
|
485
485
|
tokens: TokenType[];
|
|
486
486
|
parent: null;
|
|
487
487
|
}
|
|
488
|
-
type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference |
|
|
488
|
+
type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function$1 | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | MetaProperty | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | V8IntrinsicExpression | MemberExpression;
|
|
489
489
|
interface IdentifierName extends Span {
|
|
490
490
|
type: "Identifier";
|
|
491
491
|
decorators?: [];
|
|
@@ -2179,7 +2179,7 @@ interface Directive {
|
|
|
2179
2179
|
type: DirectiveType;
|
|
2180
2180
|
node: CommentType;
|
|
2181
2181
|
value: string;
|
|
2182
|
-
justification
|
|
2182
|
+
justification: string;
|
|
2183
2183
|
}
|
|
2184
2184
|
declare function getDisableDirectives(): {
|
|
2185
2185
|
problems: Problem[];
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.d.ts
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region src-js/plugins/tokens.d.ts
|
|
4
4
|
/**
|
|
@@ -485,7 +485,7 @@ interface Program extends Span {
|
|
|
485
485
|
tokens: TokenType[];
|
|
486
486
|
parent: null;
|
|
487
487
|
}
|
|
488
|
-
type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference |
|
|
488
|
+
type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function$1 | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | MetaProperty | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | V8IntrinsicExpression | MemberExpression;
|
|
489
489
|
interface IdentifierName extends Span {
|
|
490
490
|
type: "Identifier";
|
|
491
491
|
decorators?: [];
|
|
@@ -2179,7 +2179,7 @@ interface Directive {
|
|
|
2179
2179
|
type: DirectiveType;
|
|
2180
2180
|
node: CommentType;
|
|
2181
2181
|
value: string;
|
|
2182
|
-
justification
|
|
2182
|
+
justification: string;
|
|
2183
2183
|
}
|
|
2184
2184
|
declare function getDisableDirectives(): {
|
|
2185
2185
|
problems: Problem[];
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { tmpdir, userInfo } from "node:os";
|
|
|
7
7
|
//#region \0rolldown/runtime.js
|
|
8
8
|
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
9
9
|
//#endregion
|
|
10
|
-
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.
|
|
10
|
+
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.js
|
|
11
11
|
/**
|
|
12
12
|
* Define a plugin.
|
|
13
13
|
*
|
|
@@ -1143,6 +1143,38 @@ var DesignSystemCache = class DesignSystemCache {
|
|
|
1143
1143
|
isKnownClass(className) {
|
|
1144
1144
|
return this.validitySet.has(this.stripProjectPrefix(className));
|
|
1145
1145
|
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Is this a NAMED group/peer marker — `group/menu-item`, `peer/menu-button`?
|
|
1148
|
+
*
|
|
1149
|
+
* A marker binds a variant to one specific ancestor or sibling, and the
|
|
1150
|
+
* consumer's compiled selector hard-codes it as a class selector:
|
|
1151
|
+
* `group-hover/menu-item:underline` emits
|
|
1152
|
+
* `:is(:where(.group\/menu-item):hover *)`. A class selector matches whole
|
|
1153
|
+
* tokens, so bare `group` does not satisfy it — the named marker is required
|
|
1154
|
+
* markup. Tailwind emits no CSS for the marker itself, which is why
|
|
1155
|
+
* `no-unknown-classes` cannot ask "does it compile?" about one.
|
|
1156
|
+
*
|
|
1157
|
+
* Derived, not listed: the base must be a precomputed class that emits ZERO
|
|
1158
|
+
* declarations, which across every fixture resolves to exactly `group` and
|
|
1159
|
+
* `peer` (2 of ~23.6k). It self-prunes if Tailwind drops the variants,
|
|
1160
|
+
* self-extends if a new CSS-less marker appears, and excludes `@container/main`
|
|
1161
|
+
* for free — that one HAS declarations. The component set is subtracted
|
|
1162
|
+
* because a class referenced only through `[class~="…"]` (`not-prose`) also has
|
|
1163
|
+
* no declarations of its own, and `not-prose/x` is not Tailwind syntax.
|
|
1164
|
+
*
|
|
1165
|
+
* The name is user-chosen and Tailwind never checks that it exists, so any
|
|
1166
|
+
* NON-EMPTY name is accepted — including the shapes only an arbitrary modifier
|
|
1167
|
+
* can reach (`group/*`, `group/a/b`, `peer//x`), which is why this splits at
|
|
1168
|
+
* the FIRST slash rather than the last one `isValid` uses. The empty name is
|
|
1169
|
+
* the one genuinely dead spelling: `group-hover/` compiles to nothing.
|
|
1170
|
+
*/
|
|
1171
|
+
isMarkerClass(className) {
|
|
1172
|
+
const bare = this.stripProjectPrefix(className);
|
|
1173
|
+
const slash = bare.indexOf("/");
|
|
1174
|
+
if (slash <= 0 || slash === bare.length - 1) return false;
|
|
1175
|
+
const base = bare.slice(0, slash);
|
|
1176
|
+
return this.validitySet.has(base) && !this.componentSet.has(base) && this.getCssDeclarations(base).length === 0;
|
|
1177
|
+
}
|
|
1146
1178
|
/** Variant names the design system reports, for suggesting a typo's neighbour. */
|
|
1147
1179
|
variantNames() {
|
|
1148
1180
|
return [...this.variantOrderMap.keys()];
|
|
@@ -1864,31 +1896,68 @@ function collectCssSources(cssPath, baseDir) {
|
|
|
1864
1896
|
return files;
|
|
1865
1897
|
}
|
|
1866
1898
|
|
|
1899
|
+
// Class names the project writes in its own CSS, read from the SELECTORS only.
|
|
1900
|
+
//
|
|
1901
|
+
// This used to scan whole files with two regexes, which harvested identifiers
|
|
1902
|
+
// from places that are not selectors at all: the URLs in Tailwind's own preflight
|
|
1903
|
+
// comments (\`developer.mozilla.org\` → \`mozilla\`, \`org\`; \`bugs.chromium.org\`;
|
|
1904
|
+
// \`-webkit-\`) and the decimals in declaration values (\`padding: 0.5rem\` →
|
|
1905
|
+
// \`5rem\`). Everything here reaches \`validitySet\`, so every project accepted
|
|
1906
|
+
// \`com\`, \`org\`, \`css\` and \`5rem\` as valid Tailwind classes.
|
|
1907
|
+
//
|
|
1908
|
+
// A selector is the text between the last \`{\`, \`}\` or \`;\` and the next \`{\`, so
|
|
1909
|
+
// scanning only what precedes a \`{\` skips declaration bodies by construction —
|
|
1910
|
+
// a declaration ends in \`;\` or \`}\` and never reaches one. Comments and strings
|
|
1911
|
+
// are stepped over. Requiring a CSS identifier start (never a digit) is the
|
|
1912
|
+
// second line of defence, for a decimal inside an at-rule prelude
|
|
1913
|
+
// (\`@media (min-width: 40.5rem)\`).
|
|
1867
1914
|
function extractComponentClasses(cssPath, baseDir) {
|
|
1868
1915
|
const files = collectCssSources(cssPath, baseDir);
|
|
1869
|
-
const result =
|
|
1916
|
+
const result = new Set();
|
|
1917
|
+
const classRe = /\\.(-?[a-zA-Z_][\\w-]*)/g;
|
|
1870
1918
|
for (const content of files) {
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1919
|
+
let prelude = '';
|
|
1920
|
+
for (let i = 0; i < content.length; i++) {
|
|
1921
|
+
const c = content[i];
|
|
1922
|
+
if (c === '/' && content[i + 1] === '*') {
|
|
1923
|
+
const end = content.indexOf('*/', i + 2);
|
|
1924
|
+
i = end === -1 ? content.length : end + 1;
|
|
1925
|
+
continue;
|
|
1926
|
+
}
|
|
1927
|
+
if (c === '"' || c === "'") {
|
|
1928
|
+
const quote = c;
|
|
1879
1929
|
i++;
|
|
1930
|
+
while (i < content.length && content[i] !== quote) {
|
|
1931
|
+
if (content[i] === '\\\\') i++;
|
|
1932
|
+
i++;
|
|
1933
|
+
}
|
|
1934
|
+
continue;
|
|
1935
|
+
}
|
|
1936
|
+
if (c === '{') {
|
|
1937
|
+
classRe.lastIndex = 0;
|
|
1938
|
+
let m;
|
|
1939
|
+
while ((m = classRe.exec(prelude)) !== null) result.add(m[1]);
|
|
1940
|
+
prelude = '';
|
|
1941
|
+
continue;
|
|
1942
|
+
}
|
|
1943
|
+
if (c === '}' || c === ';') {
|
|
1944
|
+
// A statement at-rule carries a selector even though it has no block:
|
|
1945
|
+
// \`@custom-variant sidebar-open (&:where(.sidebar-open *));\` makes that
|
|
1946
|
+
// class load-bearing exactly the way \`group\`/\`peer\` are, so it has to
|
|
1947
|
+
// stay valid. Plain declarations never start with \`@\`, so this readmits
|
|
1948
|
+
// the selector without readmitting \`padding: 0.5rem\`.
|
|
1949
|
+
if (c === ';' && prelude.trimStart().charCodeAt(0) === 64) {
|
|
1950
|
+
classRe.lastIndex = 0;
|
|
1951
|
+
let m;
|
|
1952
|
+
while ((m = classRe.exec(prelude)) !== null) result.add(m[1]);
|
|
1953
|
+
}
|
|
1954
|
+
prelude = '';
|
|
1955
|
+
continue;
|
|
1880
1956
|
}
|
|
1881
|
-
|
|
1882
|
-
const selRe = /\\.([\\w-]+)/g;
|
|
1883
|
-
let sm;
|
|
1884
|
-
while ((sm = selRe.exec(block)) !== null) result.push(sm[1]);
|
|
1957
|
+
prelude += c;
|
|
1885
1958
|
}
|
|
1886
|
-
// Scan all class selectors anywhere in the file (.class-name)
|
|
1887
|
-
const classSelRe = /\\.([a-zA-Z_][\\w-]*)/g;
|
|
1888
|
-
let cs;
|
|
1889
|
-
while ((cs = classSelRe.exec(content)) !== null) result.push(cs[1]);
|
|
1890
1959
|
}
|
|
1891
|
-
return [...
|
|
1960
|
+
return [...result];
|
|
1892
1961
|
}
|
|
1893
1962
|
|
|
1894
1963
|
${DECL_EXTRACTOR_SOURCE}
|
|
@@ -2293,11 +2362,13 @@ async function main() {
|
|
|
2293
2362
|
}
|
|
2294
2363
|
|
|
2295
2364
|
// Component classes from @layer components
|
|
2296
|
-
const
|
|
2365
|
+
const componentSet = new Set(extractComponentClasses(cssPath, base));
|
|
2297
2366
|
|
|
2298
2367
|
// Extract class names from attribute selectors [class~="..."] in CSS output.
|
|
2299
2368
|
// Plugins like @tailwindcss/typography use these for modifier classes (e.g. "not-prose")
|
|
2300
2369
|
// that don't generate their own CSS but are referenced in other classes' selectors.
|
|
2370
|
+
// Interned in a Set: typography references \`not-prose\` from ~230 selectors, and
|
|
2371
|
+
// pushing one entry per occurrence only inflated the cache artifact.
|
|
2301
2372
|
const attrClassRe = /\\[class~="([^"]+)"\\]/g;
|
|
2302
2373
|
for (let i = 0; i < cssResults.length; i++) {
|
|
2303
2374
|
if (cssResults[i]) {
|
|
@@ -2305,10 +2376,11 @@ async function main() {
|
|
|
2305
2376
|
attrClassRe.lastIndex = 0;
|
|
2306
2377
|
while ((acm = attrClassRe.exec(cssResults[i])) !== null) {
|
|
2307
2378
|
// Typography-style plugins emit \`[class~="tw:not-prose"]\` under a prefix.
|
|
2308
|
-
|
|
2379
|
+
componentSet.add(unpfx(acm[1]));
|
|
2309
2380
|
}
|
|
2310
2381
|
}
|
|
2311
2382
|
}
|
|
2383
|
+
const componentClasses = [...componentSet];
|
|
2312
2384
|
|
|
2313
2385
|
// Arbitrary equivalents: map arbitrary forms to named equivalents.
|
|
2314
2386
|
// Enumerate every dash split point so multi-segment utilities (e.g.
|
|
@@ -3613,6 +3685,7 @@ const noUnknownClasses = defineRule({
|
|
|
3613
3685
|
if (shouldIgnore(cls)) continue;
|
|
3614
3686
|
const bare = strippedUtility(cls).bare;
|
|
3615
3687
|
if (cache.isKnownClass(bare)) continue;
|
|
3688
|
+
if (cache.isMarkerClass(bare)) continue;
|
|
3616
3689
|
if (!toVerify) toVerify = [];
|
|
3617
3690
|
toVerify.push(bare);
|
|
3618
3691
|
}
|
|
@@ -3632,6 +3705,7 @@ const noUnknownClasses = defineRule({
|
|
|
3632
3705
|
}, split);
|
|
3633
3706
|
continue;
|
|
3634
3707
|
}
|
|
3708
|
+
if (cache.isMarkerClass(bare) && (!cache.prefix || variant.startsWith(`${cache.prefix}:`))) continue;
|
|
3635
3709
|
const compiles = cache.isKnownClass(bare) ? true : verified?.get(bare);
|
|
3636
3710
|
if (validity === "unknown" || compiles === false) {
|
|
3637
3711
|
const suggestionBare = findBestSuggestion(bare, cache.validClasses);
|