@csszyx/unplugin 0.15.3 → 0.17.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/README.md +1 -1
- package/dist/index.cjs +8 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +6 -4
- package/dist/jest-transform.cjs +186 -0
- package/dist/jest-transform.d.cts +112 -0
- package/dist/jest-transform.d.mts +110 -0
- package/dist/jest-transform.mjs +175 -0
- package/dist/next-prebuild.cjs +6 -5
- package/dist/next-prebuild.mjs +5 -4
- package/dist/next-turbo-loader.cjs +10 -8
- package/dist/next-turbo-loader.mjs +7 -5
- package/dist/next-watcher.cjs +3 -2
- package/dist/next-watcher.mjs +3 -2
- package/dist/shared/{unplugin.J6ue_lRJ.cjs → unplugin.2qOISpzl.cjs} +1 -114
- package/dist/shared/{unplugin.C-oQU1jl.mjs → unplugin.2uf-U76p.mjs} +1 -1
- package/dist/shared/{unplugin.Ceq-N4jI.mjs → unplugin.995yC_cN.mjs} +2 -110
- package/dist/shared/{unplugin.ZqxgHk5F.cjs → unplugin.9zs6T4Gf.cjs} +119 -92
- package/dist/shared/{unplugin.nvme_dSL.d.cts → unplugin.BO2_hyS3.d.cts} +54 -5
- package/dist/shared/{unplugin.DH_ij6cf.mjs → unplugin.Ba3O1r8M.mjs} +2 -6
- package/dist/shared/unplugin.BqKLlo1h.cjs +8 -0
- package/dist/shared/{unplugin.Vn9x8SBP.mjs → unplugin.C3bgc29e.mjs} +3 -2
- package/dist/shared/{unplugin.CPo2xrEy.mjs → unplugin.Cs4H9z9v.mjs} +91 -66
- package/dist/shared/{unplugin.BLptVbUe.mjs → unplugin.DPSQP5XG.mjs} +1 -1
- package/dist/shared/{unplugin.DDSWQJYX.cjs → unplugin.DS6CFjim.cjs} +3 -8
- package/dist/shared/{unplugin.gksolKh2.cjs → unplugin.DXzIP7lP.cjs} +5 -4
- package/dist/shared/unplugin.DcXM9sq5.mjs +109 -0
- package/dist/shared/unplugin.Defu9wGh.cjs +115 -0
- package/dist/shared/{unplugin.CInSoHdQ.d.mts → unplugin.DptK3pl4.d.mts} +54 -5
- package/dist/shared/{unplugin.BzF0V2kw.cjs → unplugin.YcnV3Izb.cjs} +6 -6
- package/dist/shared/{unplugin.BWnmKv07.cjs → unplugin.alhYXymJ.cjs} +1 -1
- package/dist/shared/unplugin.wMeicb6E.mjs +6 -0
- package/dist/vite.cjs +6 -4
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +6 -4
- package/dist/webpack.cjs +6 -4
- package/dist/webpack.d.cts +1 -2
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.mjs +6 -4
- package/package.json +19 -9
|
@@ -13,10 +13,12 @@ const svelteAdapter = require('@csszyx/svelte-adapter');
|
|
|
13
13
|
const types = require('@csszyx/types');
|
|
14
14
|
const vueAdapter = require('@csszyx/vue-adapter');
|
|
15
15
|
const unplugin$1 = require('unplugin');
|
|
16
|
-
const safelistSource = require('./unplugin.
|
|
17
|
-
const transformCache = require('./unplugin.
|
|
16
|
+
const safelistSource = require('./unplugin.DS6CFjim.cjs');
|
|
17
|
+
const transformCache = require('./unplugin.YcnV3Izb.cjs');
|
|
18
18
|
const cssMangler = require('../css-mangler.cjs');
|
|
19
|
-
const
|
|
19
|
+
const nextRuntimeInjection = require('./unplugin.Defu9wGh.cjs');
|
|
20
|
+
const pathNormalization = require('./unplugin.BqKLlo1h.cjs');
|
|
21
|
+
const themeGroupsFile = require('./unplugin.2qOISpzl.cjs');
|
|
20
22
|
const node_zlib = require('node:zlib');
|
|
21
23
|
const postcss = require('postcss');
|
|
22
24
|
const valueParser = require('postcss-value-parser');
|
|
@@ -543,8 +545,8 @@ function createRSCModuleRecord(code, id) {
|
|
|
543
545
|
}
|
|
544
546
|
function deleteRSCModuleRecord(records, id) {
|
|
545
547
|
const normalized = normalizeModuleId(id);
|
|
546
|
-
const clean =
|
|
547
|
-
const resolved =
|
|
548
|
+
const clean = pathNormalization.normalizePathSeparators(id.split("?")[0] ?? id);
|
|
549
|
+
const resolved = pathNormalization.normalizePathSeparators(path__namespace.resolve(clean));
|
|
548
550
|
pruneRSCModulePathCaches(/* @__PURE__ */ new Set([normalized, resolved, clean]));
|
|
549
551
|
let deleted = records.delete(normalized);
|
|
550
552
|
if (resolved !== normalized) {
|
|
@@ -590,7 +592,7 @@ const APP_ROUTER_ENTRIES = /* @__PURE__ */ new Set([
|
|
|
590
592
|
"route"
|
|
591
593
|
]);
|
|
592
594
|
function isNextAppRouterEntry(id) {
|
|
593
|
-
const clean =
|
|
595
|
+
const clean = pathNormalization.normalizePathSeparators(id.split("?")[0] ?? id);
|
|
594
596
|
if (!clean.includes("/app/") && !clean.startsWith("app/")) return false;
|
|
595
597
|
const basename = clean.split("/").pop() ?? "";
|
|
596
598
|
const dotIdx = basename.indexOf(".");
|
|
@@ -945,9 +947,9 @@ function normalizeModuleId(id) {
|
|
|
945
947
|
}
|
|
946
948
|
let normalized;
|
|
947
949
|
try {
|
|
948
|
-
normalized =
|
|
950
|
+
normalized = pathNormalization.normalizePathSeparators(fs__namespace.realpathSync.native(clean));
|
|
949
951
|
} catch {
|
|
950
|
-
normalized =
|
|
952
|
+
normalized = pathNormalization.normalizePathSeparators(path__namespace.resolve(clean));
|
|
951
953
|
}
|
|
952
954
|
normalizedModuleIdCache.set(clean, normalized);
|
|
953
955
|
return normalized;
|
|
@@ -993,7 +995,7 @@ function resolveLocalModule(importer, source) {
|
|
|
993
995
|
}
|
|
994
996
|
function pruneRSCModulePathCaches(moduleIds) {
|
|
995
997
|
for (const [key, value] of normalizedModuleIdCache) {
|
|
996
|
-
const normalizedKey =
|
|
998
|
+
const normalizedKey = pathNormalization.normalizePathSeparators(key);
|
|
997
999
|
if (moduleIds.has(value) || moduleIds.has(normalizedKey)) {
|
|
998
1000
|
normalizedModuleIdCache.delete(key);
|
|
999
1001
|
}
|
|
@@ -1621,10 +1623,10 @@ An unread option is silent, so whatever you configured it for is not happening.`
|
|
|
1621
1623
|
const GLOB_MAGIC_RE = /[*?[\]{}]/;
|
|
1622
1624
|
const DEFAULT_IGNORED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", ".turbo", "dist", "build"]);
|
|
1623
1625
|
function normalizeFileId(id) {
|
|
1624
|
-
return
|
|
1626
|
+
return pathNormalization.normalizePathSeparators(id.split(/[?#]/, 1)[0]);
|
|
1625
1627
|
}
|
|
1626
1628
|
function normalizeRoot(rootDir) {
|
|
1627
|
-
return
|
|
1629
|
+
return pathNormalization.normalizePathSeparators(path__namespace.resolve(rootDir));
|
|
1628
1630
|
}
|
|
1629
1631
|
function hasGlobMagic(pattern) {
|
|
1630
1632
|
return GLOB_MAGIC_RE.test(pattern);
|
|
@@ -1633,7 +1635,7 @@ function escapeRegExp(ch) {
|
|
|
1633
1635
|
return /[|\\{}()[\]^$+?.]/.test(ch) ? `\\${ch}` : ch;
|
|
1634
1636
|
}
|
|
1635
1637
|
function globToRegExp(pattern) {
|
|
1636
|
-
const normalized =
|
|
1638
|
+
const normalized = pathNormalization.normalizePathSeparators(pattern);
|
|
1637
1639
|
let out = "^";
|
|
1638
1640
|
for (let i = 0; i < normalized.length; i++) {
|
|
1639
1641
|
const ch = normalized[i];
|
|
@@ -1656,7 +1658,7 @@ function globToRegExp(pattern) {
|
|
|
1656
1658
|
function relativeToRoot(file, rootDir) {
|
|
1657
1659
|
const root = normalizeRoot(rootDir);
|
|
1658
1660
|
const normalizedFile = normalizeFileId(file);
|
|
1659
|
-
return
|
|
1661
|
+
return pathNormalization.normalizePathSeparators(path__namespace.posix.relative(root, normalizedFile));
|
|
1660
1662
|
}
|
|
1661
1663
|
function matchesPattern(id, pattern, rootDir) {
|
|
1662
1664
|
const file = normalizeFileId(id);
|
|
@@ -1665,7 +1667,7 @@ function matchesPattern(id, pattern, rootDir) {
|
|
|
1665
1667
|
pattern.lastIndex = 0;
|
|
1666
1668
|
return pattern.test(file) || pattern.test(relative);
|
|
1667
1669
|
}
|
|
1668
|
-
const normalizedPattern =
|
|
1670
|
+
const normalizedPattern = pathNormalization.normalizePathSeparators(pattern);
|
|
1669
1671
|
if (hasGlobMagic(normalizedPattern)) {
|
|
1670
1672
|
const re = globToRegExp(normalizedPattern);
|
|
1671
1673
|
return re.test(file) || re.test(relative);
|
|
@@ -1801,24 +1803,10 @@ function injectMangleMapScript(html, mangleMap, options = {}) {
|
|
|
1801
1803
|
const scriptTag = `<script id="__CSSZYX_MANGLE_MAP__" type="application/json">${safeJsonForScriptTag(checksumMap, prettyPrint)}<\/script>`;
|
|
1802
1804
|
return withScriptTag(html, scriptTag);
|
|
1803
1805
|
}
|
|
1804
|
-
function injectMangleMapAttribute(html, mangleMap, minify = false, varMangleMap = {}) {
|
|
1805
|
-
const attrName = minify ? "data-sz-m" : "data-sz-map";
|
|
1806
|
-
const jsonContent = JSON.stringify(createHydrationMangleMap(mangleMap, varMangleMap));
|
|
1807
|
-
return injectHtmlOpeningAttr(html, ` ${attrName}='${jsonContent}'`);
|
|
1808
|
-
}
|
|
1809
1806
|
function injectHydrationData(html, mangleMap, checksum, options = {}) {
|
|
1810
|
-
const {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
if (mode === "inline") {
|
|
1814
|
-
result = injectMangleMapAttribute(result, mangleMap, minify, options.varMangleMap);
|
|
1815
|
-
} else if (mode === "script") {
|
|
1816
|
-
result = injectMangleMapScript(result, mangleMap, options);
|
|
1817
|
-
} else if (mode === "both") {
|
|
1818
|
-
result = injectMangleMapAttribute(result, mangleMap, minify, options.varMangleMap);
|
|
1819
|
-
result = injectMangleMapScript(result, mangleMap, options);
|
|
1820
|
-
}
|
|
1821
|
-
return result;
|
|
1807
|
+
const { minify = false, census = true } = options;
|
|
1808
|
+
const result = injectChecksum(html, checksum, minify);
|
|
1809
|
+
return census ? injectMangleMapScript(result, mangleMap, options) : result;
|
|
1822
1810
|
}
|
|
1823
1811
|
function transformIndexHtml(html, mangleMap, checksum, options = {}) {
|
|
1824
1812
|
return injectHydrationData(html, mangleMap, checksum, options);
|
|
@@ -1932,13 +1920,25 @@ function needsRuntimeMangleRegistration(manglingEnabled, mangleMap) {
|
|
|
1932
1920
|
if (!manglingEnabled) return false;
|
|
1933
1921
|
return Object.keys(mangleMap).length > 0;
|
|
1934
1922
|
}
|
|
1923
|
+
function removedInjectChecksumMessage() {
|
|
1924
|
+
return "[csszyx] production.injectChecksum has been removed and was never read. The hydration checksum and the inert census ship on every production build, and no option turned them off \u2014 a build that set this to false still carried both. Delete the option. The census carries no class entries when production.mangle is off, and both tags are data, not script: see https://csszyx.com/docs/security/";
|
|
1925
|
+
}
|
|
1935
1926
|
function removedMangleMapDeliveryMessage() {
|
|
1936
1927
|
return "[csszyx] production.mangleMapDelivery has been removed and is ignored. The runtime mangle map is always registered from inside the JS bundle now, on every lane, so the built HTML never carries an executable inline <script> and a strict script-src 'self' policy needs no exception. Delete the option. (`window.__csszyx` is now opt-in through `production.mangleDebugGlobal`.)";
|
|
1937
1928
|
}
|
|
1938
1929
|
|
|
1930
|
+
function utilityStart(className) {
|
|
1931
|
+
let depth = 0;
|
|
1932
|
+
let start = 0;
|
|
1933
|
+
for (let index = 0; index < className.length; index += 1) {
|
|
1934
|
+
const char = className[index];
|
|
1935
|
+
if (char === "[") depth += 1;
|
|
1936
|
+
else if (char === "]") depth = Math.max(0, depth - 1);
|
|
1937
|
+
else if (char === ":" && depth === 0) start = index + 1;
|
|
1938
|
+
}
|
|
1939
|
+
return start;
|
|
1940
|
+
}
|
|
1939
1941
|
function compileManglePreserve(entries) {
|
|
1940
|
-
const exact = /* @__PURE__ */ new Set();
|
|
1941
|
-
const prefixes = [];
|
|
1942
1942
|
const list = entries ?? [];
|
|
1943
1943
|
list.forEach((entry, index) => {
|
|
1944
1944
|
if (typeof entry !== "string" || entry.length === 0) {
|
|
@@ -1951,22 +1951,34 @@ function compileManglePreserve(entries) {
|
|
|
1951
1951
|
"[csszyx] production.manglePreserve must not contain a lone `*`: it would keep every class and silently turn `production.mangle` into a no-op. Name a prefix (`bg-tag-*`) or set `production.mangle: false`."
|
|
1952
1952
|
);
|
|
1953
1953
|
}
|
|
1954
|
-
if (entry.endsWith("*")) prefixes.push(entry.slice(0, -1));
|
|
1955
|
-
else exact.add(entry);
|
|
1956
1954
|
});
|
|
1957
|
-
const
|
|
1955
|
+
const compiled = list.map((value) => ({
|
|
1956
|
+
value,
|
|
1957
|
+
prefix: value.endsWith("*") ? value.slice(0, -1) : void 0
|
|
1958
|
+
}));
|
|
1959
|
+
const keeps = (entry, className, utilityStartIndex) => entry.prefix === void 0 ? className === entry.value || className.length - utilityStartIndex === entry.value.length && className.startsWith(entry.value, utilityStartIndex) : className.startsWith(entry.prefix) || className.startsWith(entry.prefix, utilityStartIndex);
|
|
1960
|
+
const test = (className) => {
|
|
1961
|
+
if (list.length === 0) return false;
|
|
1962
|
+
const start = utilityStart(className);
|
|
1963
|
+
return compiled.some((entry) => keeps(entry, className, start));
|
|
1964
|
+
};
|
|
1958
1965
|
return {
|
|
1959
1966
|
entries: list,
|
|
1960
1967
|
test,
|
|
1961
1968
|
unmatched(census) {
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1969
|
+
if (list.length === 0) return [];
|
|
1970
|
+
const matched = list.map(() => false);
|
|
1971
|
+
let remaining = list.length;
|
|
1972
|
+
for (const className of census) {
|
|
1973
|
+
const start = utilityStart(className);
|
|
1974
|
+
for (let index = 0; index < list.length; index += 1) {
|
|
1975
|
+
if (matched[index] || !keeps(compiled[index], className, start)) continue;
|
|
1976
|
+
matched[index] = true;
|
|
1977
|
+
remaining -= 1;
|
|
1967
1978
|
}
|
|
1968
|
-
|
|
1969
|
-
}
|
|
1979
|
+
if (remaining === 0) break;
|
|
1980
|
+
}
|
|
1981
|
+
return list.filter((_, index) => !matched[index]);
|
|
1970
1982
|
}
|
|
1971
1983
|
};
|
|
1972
1984
|
}
|
|
@@ -2239,9 +2251,9 @@ let _hasWarnedTsConfig = false;
|
|
|
2239
2251
|
let _hasWarnedTransformCacheVersion = false;
|
|
2240
2252
|
let _hasWarnedNativeFallback = false;
|
|
2241
2253
|
const _loggedActiveParsers = /* @__PURE__ */ new Set();
|
|
2242
|
-
const requireFromHere = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.
|
|
2254
|
+
const requireFromHere = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.9zs6T4Gf.cjs', document.baseURI).href)));
|
|
2243
2255
|
const PLUGIN_VERSION = findPackageVersionFromFile(
|
|
2244
|
-
node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.
|
|
2256
|
+
node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.9zs6T4Gf.cjs', document.baseURI).href))),
|
|
2245
2257
|
UNKNOWN_PACKAGE_VERSION
|
|
2246
2258
|
);
|
|
2247
2259
|
const COMPILER_VERSION = findPackageVersionFromModule("@csszyx/compiler", UNKNOWN_PACKAGE_VERSION);
|
|
@@ -2373,8 +2385,9 @@ function quoteForConfig(entry) {
|
|
|
2373
2385
|
function preserveEntriesFor(hazard) {
|
|
2374
2386
|
const quote = quoteForConfig;
|
|
2375
2387
|
const { value } = hazard;
|
|
2376
|
-
|
|
2377
|
-
if (
|
|
2388
|
+
const utilities = hazard.renamed.map((name) => name.slice(utilityStart(name)));
|
|
2389
|
+
if (utilities.every((name) => name === value)) return [quote(value)];
|
|
2390
|
+
if (utilities.every((name) => name.startsWith(value))) return [quote(`${value}*`)];
|
|
2378
2391
|
return hazard.renamed.map(quote);
|
|
2379
2392
|
}
|
|
2380
2393
|
function mangleHybridHazardMessage(hazards) {
|
|
@@ -2382,49 +2395,40 @@ function mangleHybridHazardMessage(hazards) {
|
|
|
2382
2395
|
if (collisions.length === 0 && orphans.length === 0 && selectorMatches.length === 0) {
|
|
2383
2396
|
return null;
|
|
2384
2397
|
}
|
|
2398
|
+
const broken = selectorMatches.filter((hazard) => hazard.renamed.length > 0);
|
|
2399
|
+
const newlyMatched = selectorMatches.filter((hazard) => hazard.matchedTokens.length > 0);
|
|
2385
2400
|
const parts = ["[csszyx] production mangle found hybrid hazards:"];
|
|
2386
2401
|
if (collisions.length > 0) {
|
|
2387
2402
|
const sample = collisions.slice(0, 8).join(", ");
|
|
2388
2403
|
parts.push(
|
|
2389
|
-
|
|
2404
|
+
`${collisions.length} mangled token(s) collide with class names in non-csszyx CSS (e.g. ${sample}) \u2014 those tokens will cross-contaminate external ".${collisions[0]}" elements.`,
|
|
2405
|
+
"HOTFIX: pass `production: { mangle: false }` to the csszyx plugin to ship now. THEN fix it: if these short names are in your OWN CSS, rename them to something specific (e.g. `.x` \u2192 `.resize-handle-x`) \u2014 short/common names also clash on specificity with other libraries. Only for names in a third-party stylesheet you cannot edit, list them in `production.mangleExclude` instead. Run `npx @csszyx/cli scan-collisions` to find every offending name."
|
|
2390
2406
|
);
|
|
2391
2407
|
}
|
|
2392
2408
|
if (orphans.length > 0) {
|
|
2393
2409
|
const sample = orphans.slice(0, 8).join(", ");
|
|
2394
2410
|
parts.push(
|
|
2395
|
-
|
|
2411
|
+
`${orphans.length} mangled class(es) have no emitted CSS rule (e.g. ${sample}) \u2014 those elements lose styling.`,
|
|
2412
|
+
"Those classes are csszyx-owned but no CSS was emitted for them (e.g. a separate Tailwind plugin owns the utility CSS, or the class is not a real utility). Ensure that CSS is generated, or pass `production: { mangle: false }` to the csszyx plugin until the pipelines are reconciled."
|
|
2396
2413
|
);
|
|
2397
2414
|
}
|
|
2398
|
-
const broken = selectorMatches.filter((hazard) => hazard.renamed.length > 0);
|
|
2399
|
-
const newlyMatched = selectorMatches.filter((hazard) => hazard.matchedTokens.length > 0);
|
|
2400
2415
|
if (broken.length > 0) {
|
|
2401
2416
|
const sample = broken.slice(0, 3).map((hazard) => `${hazard.selector} \u2192 ${hazard.renamed.slice(0, 4).join(", ")}`).join("; ");
|
|
2417
|
+
const entries = [...new Set(broken.flatMap(preserveEntriesFor))].join(", ");
|
|
2402
2418
|
parts.push(
|
|
2403
|
-
|
|
2419
|
+
`${broken.length} attribute selector(s) match class names by text (e.g. ${sample}) \u2014 those rules stop matching once the classes are renamed, so the elements lose those styles.`,
|
|
2420
|
+
`Keep those classes readable with production.manglePreserve: [${entries}] (paste-ready), or key the rule off a data attribute, which mangling never touches. production.mangleExclude cannot help here: it reserves token names and does not keep a class from being renamed.`
|
|
2404
2421
|
);
|
|
2405
2422
|
}
|
|
2406
2423
|
if (newlyMatched.length > 0) {
|
|
2407
2424
|
const sample = newlyMatched.slice(0, 3).map((hazard) => `${hazard.selector} \u2192 ${hazard.matchedTokens.slice(0, 4).join(", ")}`).join("; ");
|
|
2425
|
+
const tokens = [...new Set(newlyMatched.flatMap((hazard) => hazard.matchedTokens))].map(quoteForConfig).join(", ");
|
|
2408
2426
|
parts.push(
|
|
2409
|
-
|
|
2427
|
+
`${newlyMatched.length} attribute selector(s) would start matching mangled tokens instead (e.g. ${sample}).`,
|
|
2428
|
+
`Reserve those token names with production.mangleExclude: [${tokens}] (paste-ready) so no class is renamed to one of them, or key the rule off a data attribute, which mangling never touches; a prefix or substring selector goes on matching other tokens, so the data attribute is the durable fix.`
|
|
2410
2429
|
);
|
|
2411
2430
|
}
|
|
2412
|
-
|
|
2413
|
-
parts.push(
|
|
2414
|
-
" HOTFIX: pass `production: { mangle: false }` to the csszyx plugin to ship now. THEN fix it: if these short names are in your OWN CSS, rename them to something specific (e.g. `.x` \u2192 `.resize-handle-x`) \u2014 short/common names also clash on specificity with other libraries. Only for names in a third-party stylesheet you cannot edit, list them in `production.mangleExclude` instead. Run `npx @csszyx/cli scan-collisions` to find every offending name."
|
|
2415
|
-
);
|
|
2416
|
-
} else if (orphans.length > 0) {
|
|
2417
|
-
parts.push(
|
|
2418
|
-
" Those classes are csszyx-owned but no CSS was emitted for them (e.g. a separate Tailwind plugin owns the utility CSS, or the class is not a real utility). Ensure that CSS is generated, or pass `production: { mangle: false }` to the csszyx plugin until the pipelines are reconciled."
|
|
2419
|
-
);
|
|
2420
|
-
}
|
|
2421
|
-
if (broken.length > 0) {
|
|
2422
|
-
const entries = [...new Set(broken.flatMap(preserveEntriesFor))].join(", ");
|
|
2423
|
-
parts.push(
|
|
2424
|
-
` Keep those classes readable with production.manglePreserve: [${entries}] (paste-ready), or key the rule off a data attribute, which mangling never touches. production.mangleExclude cannot help here: it reserves token names and does not keep a class from being renamed.`
|
|
2425
|
-
);
|
|
2426
|
-
}
|
|
2427
|
-
return parts.join("");
|
|
2431
|
+
return parts.join("\n");
|
|
2428
2432
|
}
|
|
2429
2433
|
const TAILWIND_IMPORT_SPECIFIER = /@import\s+["']tailwindcss(?:\/[^"']*)?["']/g;
|
|
2430
2434
|
const SOURCE_MODIFIER = /\bsource\(/;
|
|
@@ -2467,13 +2471,15 @@ function shouldWarnUnscopedMonorepo(sawTailwindEntry, tailwindEntryScoped, inMon
|
|
|
2467
2471
|
function unscopedMonorepoMessage() {
|
|
2468
2472
|
return '[csszyx] Tailwind content detection is UNSCOPED in a monorepo. Tailwind v4 scans every file under its detection base \u2014 .md/.mdx/.txt included \u2014 so a doc or fixture holding class-shaped strings becomes CSS, which can generate phantom or broken url() classes and fail the build. That base is as wide as the build makes it: a Vite build roots it at the Vite root, other setups at the workspace root. Scope it in your Tailwind CSS entry:\n @import "tailwindcss" source(none);\n @source ".";\nThat @source is your package, relative to the CSS file; csszyx auto-injects one for the classes it generates, so only your own templates need listing. Guide: https://csszyx.com/docs/monorepo-content-scope/\nSilence (if a broad scan is intentional): csszyx({ contentScopeCheck: false }).';
|
|
2469
2473
|
}
|
|
2474
|
+
const CLASS_NAME_PRECEDENCE_MARKER = 'takes precedence over the runtime "className"';
|
|
2475
|
+
const MANGLE_VARS_HOIST_SKIP_MARKER = "mangleVars skipped component CSS variable hoist";
|
|
2470
2476
|
function isAdvisoryDiagnostic(message) {
|
|
2471
|
-
return
|
|
2477
|
+
return compiler.szFallbackConsequenceOf(message) === "nudge" || message.includes(CLASS_NAME_PRECEDENCE_MARKER) || message.includes(MANGLE_VARS_HOIST_SKIP_MARKER);
|
|
2472
2478
|
}
|
|
2473
2479
|
function suppressedAdvisoryMessage(count) {
|
|
2474
2480
|
if (count <= 0) return null;
|
|
2475
|
-
const held = count === 1 ? "1 advisory
|
|
2476
|
-
return `[csszyx] ${held} not listed above.
|
|
2481
|
+
const held = count === 1 ? "1 advisory note" : `${count} advisory notes`;
|
|
2482
|
+
return `[csszyx] ${held} not listed above. An advisory reports something csszyx handled \u2014 a fallback at an sz prop, a className whose precedence over sz is unstated, or a variable hoist the planner declined \u2014 so the styles are there and a production build keeps the list short. A development build prints each one with its file and position.`;
|
|
2477
2483
|
}
|
|
2478
2484
|
function resolveQuietMode(quiet) {
|
|
2479
2485
|
if (quiet === true || quiet === "all") return "all";
|
|
@@ -2490,15 +2496,25 @@ function shouldEmitWarning(quiet, devOnly, isProduction) {
|
|
|
2490
2496
|
}
|
|
2491
2497
|
return true;
|
|
2492
2498
|
}
|
|
2499
|
+
function emitKeyValueDiagnostic(quiet, message, id, emit) {
|
|
2500
|
+
if (resolveQuietMode(quiet) === "all" || compiler.szFallbackConsequenceOf(message) !== void 0 || isAdvisoryDiagnostic(message)) {
|
|
2501
|
+
return;
|
|
2502
|
+
}
|
|
2503
|
+
emit(`[csszyx] ${id}
|
|
2504
|
+
${message}`);
|
|
2505
|
+
}
|
|
2493
2506
|
function shouldEmitMissingCssFallback(quiet, message) {
|
|
2494
2507
|
return resolveQuietMode(quiet) !== "all" && compiler.szFallbackConsequenceOf(message) === "missing-css";
|
|
2495
2508
|
}
|
|
2509
|
+
function shouldHoldAdvisories(quiet, serving, nodeEnv) {
|
|
2510
|
+
return quiet !== "off" || !serving && nodeEnv === "production";
|
|
2511
|
+
}
|
|
2496
2512
|
function emitMissingCssFallback(quiet, message, id, emit) {
|
|
2497
2513
|
if (shouldEmitMissingCssFallback(quiet, message)) emit(`[csszyx] ${id}
|
|
2498
2514
|
${message}`);
|
|
2499
2515
|
}
|
|
2500
2516
|
function normalizeForMatch(p) {
|
|
2501
|
-
const n =
|
|
2517
|
+
const n = pathNormalization.normalizePathSeparators(p);
|
|
2502
2518
|
return n.length > 1 && n.endsWith("/") ? n.slice(0, -1) : n;
|
|
2503
2519
|
}
|
|
2504
2520
|
function findJsxExpressionEnd(code, bodyStart) {
|
|
@@ -3039,7 +3055,7 @@ function findPackageVersionFromFile(file, fallback) {
|
|
|
3039
3055
|
}
|
|
3040
3056
|
}
|
|
3041
3057
|
function normalizeSourceFilename(filename) {
|
|
3042
|
-
return
|
|
3058
|
+
return pathNormalization.normalizePathSeparators(filename);
|
|
3043
3059
|
}
|
|
3044
3060
|
const SCRIPT_ID_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx"];
|
|
3045
3061
|
const STYLESHEET_FILE_EXTENSIONS = [
|
|
@@ -3058,7 +3074,7 @@ function matchesScriptExtension(id, extensions) {
|
|
|
3058
3074
|
return extensions.some((ext) => id.endsWith(ext) || id.includes(`${ext}?`));
|
|
3059
3075
|
}
|
|
3060
3076
|
function insertRuntimeImport(code, importStmt) {
|
|
3061
|
-
return
|
|
3077
|
+
return nextRuntimeInjection.insertAfterUseDirective(code, importStmt);
|
|
3062
3078
|
}
|
|
3063
3079
|
function scanClassExpression(source, from) {
|
|
3064
3080
|
let depth = 0;
|
|
@@ -3322,6 +3338,9 @@ ${errors.join("\n")}`
|
|
|
3322
3338
|
function createCsszyxPlugins(options = {}) {
|
|
3323
3339
|
assertGlobalVarMangleConfig(options);
|
|
3324
3340
|
let manglingEnabled = options.production?.mangle === true;
|
|
3341
|
+
const censusRequested = options.production?.hydrationCensus !== false;
|
|
3342
|
+
const censusHasContent = () => manglingEnabled && Object.keys(state.mangleMap).length > 0 || Object.keys(state.varMangleMap).length > 0;
|
|
3343
|
+
let serving = false;
|
|
3325
3344
|
const importedStaticSzEnabled = options.build?.importedStaticSz ?? types.DEFAULT_IMPORTED_STATIC_SZ;
|
|
3326
3345
|
const szvCrossModuleRegistry = /* @__PURE__ */ new Map();
|
|
3327
3346
|
const szvCrossModuleForwards = /* @__PURE__ */ new Map();
|
|
@@ -3344,6 +3363,9 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3344
3363
|
if (options.production?.mangleMapDelivery !== void 0) {
|
|
3345
3364
|
console.warn(removedMangleMapDeliveryMessage());
|
|
3346
3365
|
}
|
|
3366
|
+
if (options.production?.injectChecksum !== void 0) {
|
|
3367
|
+
console.warn(removedInjectChecksumMessage());
|
|
3368
|
+
}
|
|
3347
3369
|
const sizeAccount = createMangleSizeAccount();
|
|
3348
3370
|
const astBudgetOverride = options.build?.astBudgetLimit;
|
|
3349
3371
|
const prescanAstBudget = astBudgetOverride ?? 5e5;
|
|
@@ -3438,6 +3460,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3438
3460
|
skipWarningEmitted: false,
|
|
3439
3461
|
classesCapped: false,
|
|
3440
3462
|
ownedClasses: /* @__PURE__ */ new Set(),
|
|
3463
|
+
mangleEligible: [],
|
|
3441
3464
|
authoredClasses: /* @__PURE__ */ new Set(),
|
|
3442
3465
|
mangleMap: {},
|
|
3443
3466
|
varMangleEntriesByFile: varMangleEntries,
|
|
@@ -3917,15 +3940,15 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3917
3940
|
function refreshSzvRegistryEntry(filePath, content) {
|
|
3918
3941
|
if (!shouldProcessSource(filePath)) return;
|
|
3919
3942
|
if (content === null) {
|
|
3920
|
-
szvCrossModuleRegistry.delete(
|
|
3921
|
-
szvCrossModuleForwards.delete(
|
|
3943
|
+
szvCrossModuleRegistry.delete(pathNormalization.normalizePathSeparators(filePath));
|
|
3944
|
+
szvCrossModuleForwards.delete(pathNormalization.normalizePathSeparators(filePath));
|
|
3922
3945
|
return;
|
|
3923
3946
|
}
|
|
3924
3947
|
transformCache.recordSzvRegistryFile(szvCrossModuleRegistry, filePath, content);
|
|
3925
3948
|
transformCache.recordCrossModuleForwards(szvCrossModuleForwards, filePath, content);
|
|
3926
3949
|
if (importedStaticSzEnabled) {
|
|
3927
3950
|
transformCache.recordSzObjectRegistryFile(szvCrossModuleRegistry, filePath, content);
|
|
3928
|
-
szObjectProvidersExamined.add(
|
|
3951
|
+
szObjectProvidersExamined.add(pathNormalization.normalizePathSeparators(filePath));
|
|
3929
3952
|
recordProvidersDemandedBy(filePath, content);
|
|
3930
3953
|
}
|
|
3931
3954
|
}
|
|
@@ -3948,7 +3971,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3948
3971
|
for (const specifier of queue) {
|
|
3949
3972
|
const providerPath = transformCache.resolveProviderPathWith(specifier, transformCache.isReadableProviderFile);
|
|
3950
3973
|
if (providerPath === void 0) continue;
|
|
3951
|
-
const key =
|
|
3974
|
+
const key = pathNormalization.normalizePathSeparators(providerPath);
|
|
3952
3975
|
if (!szObjectProvidersExamined.has(key)) {
|
|
3953
3976
|
szObjectProvidersExamined.add(key);
|
|
3954
3977
|
readAndRecordSzObjectProvider(providerPath);
|
|
@@ -3972,14 +3995,14 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3972
3995
|
for (const specifier of queue) {
|
|
3973
3996
|
const providerPath = transformCache.resolveProviderPath(seenSourcePaths, specifier);
|
|
3974
3997
|
if (providerPath === void 0) continue;
|
|
3975
|
-
szObjectProvidersExamined.add(
|
|
3998
|
+
szObjectProvidersExamined.add(pathNormalization.normalizePathSeparators(providerPath));
|
|
3976
3999
|
readAndRecordSzObjectProvider(providerPath);
|
|
3977
4000
|
enqueueForwardedProviders(providerPath, queue, queued);
|
|
3978
4001
|
}
|
|
3979
4002
|
}
|
|
3980
4003
|
function enqueueForwardedProviders(providerPath, queue, queued) {
|
|
3981
4004
|
const directory = path__namespace.dirname(providerPath);
|
|
3982
|
-
for (const forward of szvCrossModuleForwards.get(
|
|
4005
|
+
for (const forward of szvCrossModuleForwards.get(pathNormalization.normalizePathSeparators(providerPath)) ?? []) {
|
|
3983
4006
|
for (const base of transformCache.specifierBases(forward.specifier, directory, specifierAliases)) {
|
|
3984
4007
|
if (queued.has(base)) continue;
|
|
3985
4008
|
queued.add(base);
|
|
@@ -4027,7 +4050,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4027
4050
|
}
|
|
4028
4051
|
recordSzvRegistryEntries(filePath, content);
|
|
4029
4052
|
transformCache.recordCrossModuleForwards(szvCrossModuleForwards, filePath, content);
|
|
4030
|
-
seenSourcePaths.add(
|
|
4053
|
+
seenSourcePaths.add(pathNormalization.normalizePathSeparators(filePath));
|
|
4031
4054
|
if (fileMayContainSafelistableSz(content)) {
|
|
4032
4055
|
prescanSources.push({ filePath, content });
|
|
4033
4056
|
recordSzObjectDemand(filePath, content);
|
|
@@ -4242,6 +4265,8 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4242
4265
|
const unmatched = manglePreserve.unmatched(state.ownedClasses);
|
|
4243
4266
|
if (unmatched.length > 0) emitWarning(manglePreserveNoMatchMessage(unmatched));
|
|
4244
4267
|
}
|
|
4268
|
+
state.mangleEligible = eligible;
|
|
4269
|
+
if (!manglingEnabled) return {};
|
|
4245
4270
|
return allocateMangleTokens(eligible, forbiddenTokens);
|
|
4246
4271
|
}
|
|
4247
4272
|
function freezeMangleMap() {
|
|
@@ -4421,7 +4446,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4421
4446
|
ctx.server.ws.send({ type: "full-reload" });
|
|
4422
4447
|
}
|
|
4423
4448
|
}
|
|
4424
|
-
if (
|
|
4449
|
+
if (pathNormalization.normalizePathSeparators(ctx.file) === pathNormalization.normalizePathSeparators(path__namespace.join(state.rootDir, SAFELIST_FILENAME))) {
|
|
4425
4450
|
return tailwindEntryModules(pass.moduleGraph());
|
|
4426
4451
|
}
|
|
4427
4452
|
if (isClientPass) discoverHotFileClasses(ctx.file, ctx.server.watcher);
|
|
@@ -4459,10 +4484,11 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4459
4484
|
continue;
|
|
4460
4485
|
}
|
|
4461
4486
|
emitMissingCssFallback(quiet, message, id, console.warn);
|
|
4487
|
+
emitKeyValueDiagnostic(quiet, message, id, console.warn);
|
|
4462
4488
|
}
|
|
4463
4489
|
const advisories = result.diagnostics.filter(isAdvisoryDiagnostic);
|
|
4464
4490
|
if (advisories.length === 0) return;
|
|
4465
|
-
if (quiet
|
|
4491
|
+
if (shouldHoldAdvisories(quiet, serving, process.env.NODE_ENV)) {
|
|
4466
4492
|
state.suppressedAdvisories += advisories.length;
|
|
4467
4493
|
return;
|
|
4468
4494
|
}
|
|
@@ -4518,14 +4544,14 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4518
4544
|
}
|
|
4519
4545
|
let transformedCode = `${code.slice(0, htmlTag.close)} ${attrName}="${themeGroupsFile.CHECKSUM_PLACEHOLDER}"${code.slice(htmlTag.close)}`;
|
|
4520
4546
|
const censusTag = `<script id="__CSSZYX_MANGLE_MAP__" type="application/json" dangerouslySetInnerHTML={{__html: \`${themeGroupsFile.CENSUS_PLACEHOLDER}\`}} />`;
|
|
4521
|
-
const bodyTag = findOpeningTag(transformedCode, "body");
|
|
4547
|
+
const bodyTag = censusRequested && censusHasContent() ? findOpeningTag(transformedCode, "body") : null;
|
|
4522
4548
|
if (bodyTag) {
|
|
4523
4549
|
transformedCode = `${transformedCode.slice(0, bodyTag.close + 1)}${censusTag}${transformedCode.slice(bodyTag.close + 1)}`;
|
|
4524
4550
|
}
|
|
4525
4551
|
return transformedCode;
|
|
4526
4552
|
}
|
|
4527
4553
|
function requiredRuntimeHelpers(output) {
|
|
4528
|
-
return
|
|
4554
|
+
return nextRuntimeInjection.runtimeHelperGroupsFromUsage(output);
|
|
4529
4555
|
}
|
|
4530
4556
|
function injectRuntimeHelpers(code, output) {
|
|
4531
4557
|
const groups = requiredRuntimeHelpers(output);
|
|
@@ -4541,9 +4567,9 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4541
4567
|
}
|
|
4542
4568
|
const imports = groups.barrel;
|
|
4543
4569
|
const hasRuntimeImport = imports.length > 0 && current.includes("@csszyx/runtime");
|
|
4544
|
-
const needed = hasRuntimeImport ? imports.filter((name) => !
|
|
4570
|
+
const needed = hasRuntimeImport ? imports.filter((name) => !nextRuntimeInjection.importsRuntimeHelper(current, name)) : imports;
|
|
4545
4571
|
if (needed.length === 0) return result;
|
|
4546
|
-
const existingImport =
|
|
4572
|
+
const existingImport = nextRuntimeInjection.findRuntimeImportClause(current);
|
|
4547
4573
|
if (existingImport) {
|
|
4548
4574
|
return current.replace(
|
|
4549
4575
|
existingImport.statement,
|
|
@@ -4881,6 +4907,7 @@ ${transformedCode}`;
|
|
|
4881
4907
|
specifierAliases = transformCache.collectSpecifierAliases(root, config.resolve?.alias);
|
|
4882
4908
|
if (config.command === "serve") {
|
|
4883
4909
|
manglingEnabled = false;
|
|
4910
|
+
serving = true;
|
|
4884
4911
|
}
|
|
4885
4912
|
if (manglingEnabled && config.build?.watch) {
|
|
4886
4913
|
manglingEnabled = false;
|
|
@@ -4974,9 +5001,7 @@ ${transformedCode}`;
|
|
|
4974
5001
|
finalizeMangleMap();
|
|
4975
5002
|
const injectedMangleMap = manglingEnabled ? state.mangleMap : {};
|
|
4976
5003
|
let result = transformIndexHtml(html, injectedMangleMap, state.checksum, {
|
|
4977
|
-
|
|
4978
|
-
// checksum attribute is injected regardless.
|
|
4979
|
-
mode: "script",
|
|
5004
|
+
census: censusRequested && censusHasContent(),
|
|
4980
5005
|
minify: process.env.NODE_ENV === "production",
|
|
4981
5006
|
varMangleMap: state.varMangleMap
|
|
4982
5007
|
});
|
|
@@ -5021,7 +5046,7 @@ ${transformedCode}`;
|
|
|
5021
5046
|
const manifest = {
|
|
5022
5047
|
version: "0.4.0",
|
|
5023
5048
|
buildId: state.checksum,
|
|
5024
|
-
classes:
|
|
5049
|
+
classes: [...state.mangleEligible]
|
|
5025
5050
|
};
|
|
5026
5051
|
if (includeMangleMap && Object.keys(state.mangleMap).length > 0) {
|
|
5027
5052
|
manifest.mangleMap = state.mangleMap;
|
|
@@ -5393,6 +5418,7 @@ exports.createGlobalVarScanCacheKey = createGlobalVarScanCacheKey;
|
|
|
5393
5418
|
exports.createRSCModuleRecord = createRSCModuleRecord;
|
|
5394
5419
|
exports.cssHasContentScope = cssHasContentScope;
|
|
5395
5420
|
exports.deleteRSCModuleRecord = deleteRSCModuleRecord;
|
|
5421
|
+
exports.emitKeyValueDiagnostic = emitKeyValueDiagnostic;
|
|
5396
5422
|
exports.emitMissingCssFallback = emitMissingCssFallback;
|
|
5397
5423
|
exports.esbuildPlugin = esbuildPlugin;
|
|
5398
5424
|
exports.extractGlobalVarAliasesForManifest = extractGlobalVarAliasesForManifest;
|
|
@@ -5430,6 +5456,7 @@ exports.rollupPlugin = rollupPlugin;
|
|
|
5430
5456
|
exports.scanGlobalVarCss = scanGlobalVarCss;
|
|
5431
5457
|
exports.shouldEmitMissingCssFallback = shouldEmitMissingCssFallback;
|
|
5432
5458
|
exports.shouldEmitWarning = shouldEmitWarning;
|
|
5459
|
+
exports.shouldHoldAdvisories = shouldHoldAdvisories;
|
|
5433
5460
|
exports.shouldTrackGlobalVarSources = shouldTrackGlobalVarSources;
|
|
5434
5461
|
exports.shouldWarnMissingTailwindEntry = shouldWarnMissingTailwindEntry;
|
|
5435
5462
|
exports.shouldWarnUnscopedMonorepo = shouldWarnUnscopedMonorepo;
|
|
@@ -523,6 +523,14 @@ interface PluginState {
|
|
|
523
523
|
* by a raw selector consumer.
|
|
524
524
|
*/
|
|
525
525
|
ownedClasses: Set<string>;
|
|
526
|
+
/**
|
|
527
|
+
* Owned classes that a mangle map WOULD carry: `ownedClasses` minus the
|
|
528
|
+
* authored ones and minus `manglePreserve`. Recorded whether or not
|
|
529
|
+
* mangling runs, because the bundle manifest lists them either way and used
|
|
530
|
+
* to read them off the map's keys — which is why the map had to be
|
|
531
|
+
* allocated on a build that never mangles.
|
|
532
|
+
*/
|
|
533
|
+
mangleEligible: string[];
|
|
526
534
|
/**
|
|
527
535
|
* Classes written through author-facing class/className attributes. Any
|
|
528
536
|
* overlap with ownedClasses must keep its original name because bundled
|
|
@@ -751,9 +759,18 @@ declare function unscopedMonorepoMessage(): string;
|
|
|
751
759
|
/**
|
|
752
760
|
* Whether a diagnostic is an advisory one — the class a build may hold back.
|
|
753
761
|
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
762
|
+
* Advisory means one thing: the styles are THERE, and the note is about how
|
|
763
|
+
* they got there. An `sz`-site nudge fallback took the runtime path where a
|
|
764
|
+
* compiled one was possible; the precedence advisory says which of two sources
|
|
765
|
+
* won. Everything else describes output that is absent or dead, and a
|
|
766
|
+
* production build has to print it.
|
|
767
|
+
*
|
|
768
|
+
* Asked positively on purpose. The predicate used to be "not one of three known
|
|
769
|
+
* kinds", which quietly made every key and value diagnostic advisory: a
|
|
770
|
+
* production build of a file with five typo'd keys printed nothing but a census
|
|
771
|
+
* calling them fallbacks, while `csszyx check` on the same tree named all six.
|
|
772
|
+
* A classifier written by exclusion cannot stay right as diagnostics are added,
|
|
773
|
+
* because a new one joins the silent side by default.
|
|
757
774
|
*
|
|
758
775
|
* @param message - One raw diagnostic line as an engine emitted it.
|
|
759
776
|
* @returns True when the diagnostic is advisory rather than a build result.
|
|
@@ -772,7 +789,7 @@ declare function isAdvisoryDiagnostic(message: string): boolean;
|
|
|
772
789
|
* Suppression is the right default; implying zero is not. One line costs
|
|
773
790
|
* nothing and keeps the difference visible.
|
|
774
791
|
*
|
|
775
|
-
* @param count - Advisory
|
|
792
|
+
* @param count - Advisory notes the build declined to list.
|
|
776
793
|
* @returns The disclosure, or null when nothing was held back.
|
|
777
794
|
*/
|
|
778
795
|
declare function suppressedAdvisoryMessage(count: number): string | null;
|
|
@@ -807,6 +824,22 @@ declare function resolveQuietMode(quiet: boolean | 'nudges' | QuietMode | undefi
|
|
|
807
824
|
* @returns true when the warning should be printed.
|
|
808
825
|
*/
|
|
809
826
|
declare function shouldEmitWarning(quiet: QuietMode, devOnly: boolean, isProduction: boolean): boolean;
|
|
827
|
+
/**
|
|
828
|
+
* Emit one key or value diagnostic — the family that says a class is dead.
|
|
829
|
+
*
|
|
830
|
+
* Its own channel because the two that existed both answer a different
|
|
831
|
+
* question: `emitMissingCssFallback` handles fallback sites, and the advisory
|
|
832
|
+
* channel handles notes about styles that ARE present. A typo'd key matched
|
|
833
|
+
* neither, so a production build dropped it on the floor while `csszyx check`
|
|
834
|
+
* on the same tree exited 1 and named it. Muted only by `quiet: true`, on the
|
|
835
|
+
* same reasoning as the missing-css channel: wrong output is not a usage nudge.
|
|
836
|
+
*
|
|
837
|
+
* @param quiet - Resolved quiet mode.
|
|
838
|
+
* @param message - Compiler diagnostic to classify and emit.
|
|
839
|
+
* @param id - Bundler module identifier included in the warning.
|
|
840
|
+
* @param emit - Warning output channel.
|
|
841
|
+
*/
|
|
842
|
+
declare function emitKeyValueDiagnostic(quiet: QuietMode, message: string, id: string, emit: (message: string) => void): void;
|
|
810
843
|
/**
|
|
811
844
|
* Whether a transform diagnostic describes missing CSS and may be printed.
|
|
812
845
|
*
|
|
@@ -820,6 +853,22 @@ declare function shouldEmitWarning(quiet: QuietMode, devOnly: boolean, isProduct
|
|
|
820
853
|
* @returns True when the diagnostic is an unsilenced missing-CSS failure.
|
|
821
854
|
*/
|
|
822
855
|
declare function shouldEmitMissingCssFallback(quiet: QuietMode, message: string): boolean;
|
|
856
|
+
/**
|
|
857
|
+
* Whether this run holds the advisory fallback list back and counts it instead.
|
|
858
|
+
*
|
|
859
|
+
* A build prints the count once the bundle closes, so holding the list back
|
|
860
|
+
* still leaves a reader a number to act on. A dev server never closes a bundle:
|
|
861
|
+
* anything held back there is held back for good, which is why serving lists
|
|
862
|
+
* its fallbacks whatever the environment says. `NODE_ENV` alone was the whole
|
|
863
|
+
* test, and a monorepo script that exports it while running a dev server turned
|
|
864
|
+
* every advisory into a number nothing would print.
|
|
865
|
+
*
|
|
866
|
+
* @param quiet - Resolved quiet mode.
|
|
867
|
+
* @param serving - Whether this is a dev server rather than a build.
|
|
868
|
+
* @param nodeEnv - `process.env.NODE_ENV` as the process sees it.
|
|
869
|
+
* @returns True when the list is withheld in favour of a count.
|
|
870
|
+
*/
|
|
871
|
+
declare function shouldHoldAdvisories(quiet: QuietMode, serving: boolean, nodeEnv: string | undefined): boolean;
|
|
823
872
|
/**
|
|
824
873
|
* Emit one missing-CSS fallback through the caller's output channel.
|
|
825
874
|
*
|
|
@@ -1063,5 +1112,5 @@ declare const rollupPlugin: (options?: PartialCsszyxConfig) => InputPluginOption
|
|
|
1063
1112
|
*/
|
|
1064
1113
|
declare const esbuildPlugin: (options?: PartialCsszyxConfig) => Plugin;
|
|
1065
1114
|
|
|
1066
|
-
export {
|
|
1115
|
+
export { isPackagesSkippedSource as $, unplugin as A, deleteRSCModuleRecord as B, emitKeyValueDiagnostic as D, emitMissingCssFallback as E, esbuildPlugin as F, extractGlobalVarAliasesForManifest as H, fileMayContainSafelistableSz as I, findLocalImportSources as J, findRSCBoundaryViolation as K, findRSCGraphViolation as L, hasInjectableTailwindCandidate as N, hasTokens as O, hasUseClientDirective as T, hasUseServerDirective as U, isAdvisoryDiagnostic as W, isCompileSourceOptedIn as X, isHardIgnoredPath as Y, isMangleableCssId as Z, isMonorepoPackage as _, isRSCServerModule as a0, lateMangleCensusMessage as a1, mangleCodeClassesSync as a2, mangleEligibleClasses as a3, mangleHybridHazardMessage as a4, mergeThemes as a5, missingTailwindEntryMessage as a6, normalizeGlobalVarAliasesForCache as a7, parseThemeBlocks as a8, parseUtilityBlocks as a9, realContentHashDisabledMessage as aa, recordGlobalVarSourceFile as ab, resolveCompileSourceDirs as ac, resolveNativeCacheIdentity as ad, resolveQuietMode as ae, rollupPlugin as af, scanCustomPropertyNames as ag, shouldEmitMissingCssFallback as ah, shouldEmitWarning as ai, shouldHoldAdvisories as aj, shouldTrackGlobalVarSources as ak, shouldWarnMissingTailwindEntry as al, shouldWarnUnscopedMonorepo as am, skippedSzFilesMessage as an, suppressedAdvisoryMessage as ao, unscopedMonorepoMessage as ap, vitePlugin as aq, watchModeMangleMessage as ar, webpackPlugin as as, allocateMangleTokens as t, assertNoRSCBoundaryViolation as u, assertNoRSCGraphViolation as v, collectMangleHybridHazards as w, createGlobalVarMapAssetSource as x, createRSCModuleRecord as y, cssHasContentScope as z };
|
|
1067
1116
|
export type { CssVarScanResult as C, GlobalVarScanCacheKeyInput as G, MangleHybridHazards as M, PlanGlobalVarAliasesInput as P, QuietMode as Q, RewriteGlobalVarCssAliasesOptions as R, ScanGlobalVarCssOptions as S, ValidateGlobalVarAliasInputsOptions as V, GlobalVarAliasPlan as a, GlobalVarCssAliasRewriteResult as b, CreateGlobalVarAliasValidationOptionsInput as c, GlobalVarAliasValidationResult as d, CssVarDefinition as e, CssVarLocation as f, CssVarReference as g, GlobalVarAliasDiagnostic as h, GlobalVarAliasDiagnosticSeverity as i, GlobalVarAliasEntry as j, GlobalVarCodeSource as k, GlobalVarCssAssetSource as l, GlobalVarCssSource as m, GlobalVarScanCacheEntry as n, MangleSelectorHazard as o, ParsedTheme as p, ParsedUtilities as q, RSCBoundaryViolation as r, RSCModuleRecord as s };
|