@webto-id/variant-check 0.1.5 → 0.1.6
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/cli.js +19 -0
- package/dist/index.js +19 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1878,6 +1878,25 @@ async function compile2(source2, opts) {
|
|
|
1878
1878
|
lint.push({ level: "error", code: "tailwind", message: `Tailwind compile failed: ${e.message}` });
|
|
1879
1879
|
}
|
|
1880
1880
|
}
|
|
1881
|
+
if (!opts.skipTailwind && twCss) {
|
|
1882
|
+
const unknown = [];
|
|
1883
|
+
for (const t of classTokens) {
|
|
1884
|
+
if (!isCandidate(t)) continue;
|
|
1885
|
+
if (/^(group|peer)([/]|$)/.test(t)) continue;
|
|
1886
|
+
if (/^(js|wv)-/.test(t)) continue;
|
|
1887
|
+
if (userCss.includes(t) || script.includes(t)) continue;
|
|
1888
|
+
const cssName = "." + t.replace(/[^a-zA-Z0-9_-]/g, (ch) => "\\" + ch);
|
|
1889
|
+
const boundary = new RegExp(cssName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "(?![\\w-])");
|
|
1890
|
+
if (!boundary.test(twCss)) unknown.push(t);
|
|
1891
|
+
}
|
|
1892
|
+
if (unknown.length) {
|
|
1893
|
+
lint.push({
|
|
1894
|
+
level: "warning",
|
|
1895
|
+
code: "unknown-class",
|
|
1896
|
+
message: `class${unknown.length > 1 ? "es" : ""} '${unknown.join("', '")}' compile to no CSS: not a Tailwind utility, and neither this variant's <style> nor its <script> mentions ${unknown.length > 1 ? "them" : "it"}. Leftover from another CSS framework? Rewrite as Tailwind utilities/tokens or style it in <style>; a deliberate script hook belongs under a js- prefix`
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1881
1900
|
let css = "";
|
|
1882
1901
|
try {
|
|
1883
1902
|
css = scopeCss(twCss, ROOT_PLACEHOLDER) + (userCss.trim() ? "\n" + scopeCss(userCss, ROOT_PLACEHOLDER) : "");
|
package/dist/index.js
CHANGED
|
@@ -1875,6 +1875,25 @@ async function compile2(source, opts) {
|
|
|
1875
1875
|
lint.push({ level: "error", code: "tailwind", message: `Tailwind compile failed: ${e.message}` });
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
|
+
if (!opts.skipTailwind && twCss) {
|
|
1879
|
+
const unknown = [];
|
|
1880
|
+
for (const t of classTokens) {
|
|
1881
|
+
if (!isCandidate(t)) continue;
|
|
1882
|
+
if (/^(group|peer)([/]|$)/.test(t)) continue;
|
|
1883
|
+
if (/^(js|wv)-/.test(t)) continue;
|
|
1884
|
+
if (userCss.includes(t) || script.includes(t)) continue;
|
|
1885
|
+
const cssName = "." + t.replace(/[^a-zA-Z0-9_-]/g, (ch) => "\\" + ch);
|
|
1886
|
+
const boundary = new RegExp(cssName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "(?![\\w-])");
|
|
1887
|
+
if (!boundary.test(twCss)) unknown.push(t);
|
|
1888
|
+
}
|
|
1889
|
+
if (unknown.length) {
|
|
1890
|
+
lint.push({
|
|
1891
|
+
level: "warning",
|
|
1892
|
+
code: "unknown-class",
|
|
1893
|
+
message: `class${unknown.length > 1 ? "es" : ""} '${unknown.join("', '")}' compile to no CSS: not a Tailwind utility, and neither this variant's <style> nor its <script> mentions ${unknown.length > 1 ? "them" : "it"}. Leftover from another CSS framework? Rewrite as Tailwind utilities/tokens or style it in <style>; a deliberate script hook belongs under a js- prefix`
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1878
1897
|
let css = "";
|
|
1879
1898
|
try {
|
|
1880
1899
|
css = scopeCss(twCss, ROOT_PLACEHOLDER) + (userCss.trim() ? "\n" + scopeCss(userCss, ROOT_PLACEHOLDER) : "");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webto-id/variant-check",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Lint, compile and preview a Webto Variant Format (.astro subset) section variant with the exact compiler the webto.id marketplace uses.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|