@csszyx/unplugin 0.11.10 → 0.12.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 +7 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -3
- package/dist/next-prebuild.cjs +2 -2
- package/dist/next-prebuild.mjs +2 -2
- package/dist/next-turbo-loader.cjs +4 -52
- package/dist/next-turbo-loader.mjs +3 -51
- package/dist/shared/{unplugin.CVMbUfH5.mjs → unplugin.B9vpjOhD.mjs} +310 -52
- package/dist/shared/{unplugin.CRuVOB4Q.cjs → unplugin.BK3XVHe8.cjs} +314 -53
- package/dist/shared/{unplugin.BZq6FKn2.cjs → unplugin.Bb5TeU9B.cjs} +1 -1
- package/dist/shared/unplugin.C2lHQFii.cjs +114 -0
- package/dist/shared/unplugin.CBMJufQ8.mjs +108 -0
- package/dist/shared/{unplugin.fOnGXWgS.mjs → unplugin.CDqY7kmk.mjs} +8 -1
- package/dist/shared/{unplugin.CjCKWnoX.d.cts → unplugin.CtnKJhAi.d.cts} +32 -1
- package/dist/shared/{unplugin.CjCKWnoX.d.mts → unplugin.CtnKJhAi.d.mts} +32 -1
- package/dist/shared/{unplugin.-yLpX1Ck.mjs → unplugin.DXgxFHzO.mjs} +1 -1
- package/dist/shared/{unplugin.CKIOVNOg.cjs → unplugin.DbZ7tCfN.cjs} +8 -1
- package/dist/vite.cjs +4 -3
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +4 -3
- package/dist/webpack.cjs +4 -3
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.mjs +4 -3
- package/package.json +13 -11
- package/dist/shared/unplugin.Cnxm1DcC.cjs +0 -53
- package/dist/shared/unplugin.Lhzkcj-A.mjs +0 -49
|
@@ -13,10 +13,11 @@ 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 transformCache = require('./unplugin.
|
|
16
|
+
const transformCache = require('./unplugin.DbZ7tCfN.cjs');
|
|
17
17
|
const cssMangler = require('../css-mangler.cjs');
|
|
18
|
-
const
|
|
18
|
+
const nextRuntimeInjection = require('./unplugin.C2lHQFii.cjs');
|
|
19
19
|
const htmlEscape = require('./unplugin.BkRah5Ot.cjs');
|
|
20
|
+
const node_zlib = require('node:zlib');
|
|
20
21
|
const postcss = require('postcss');
|
|
21
22
|
const valueParser = require('postcss-value-parser');
|
|
22
23
|
|
|
@@ -1883,17 +1884,19 @@ function injectMangleMapScript(html, mangleMap, options = {}) {
|
|
|
1883
1884
|
const {
|
|
1884
1885
|
prettyPrint = false,
|
|
1885
1886
|
varMangleMap = {},
|
|
1886
|
-
globalVarAliasPrefix = types.CSSZYX_GLOBAL_ALIAS_PREFIX
|
|
1887
|
+
globalVarAliasPrefix = types.CSSZYX_GLOBAL_ALIAS_PREFIX,
|
|
1888
|
+
installRuntimeObject = true
|
|
1887
1889
|
} = options;
|
|
1888
1890
|
const checksumMap = createHydrationMangleMap(mangleMap, varMangleMap);
|
|
1889
1891
|
const jsonContent = safeJsonForScriptTag(checksumMap, prettyPrint);
|
|
1890
|
-
const classMapContent = safeJsonForScriptTag(mangleMap);
|
|
1891
1892
|
const varMapContent = safeJsonForScriptTag(varMangleMap);
|
|
1893
|
+
const reuseChecksumPayload = Object.keys(varMangleMap).length === 0;
|
|
1894
|
+
const classMapExpr = reuseChecksumPayload ? '(function(){var e=document.getElementById("__CSSZYX_MANGLE_MAP__");return e?JSON.parse(e.textContent):{}})()' : safeJsonForScriptTag(mangleMap);
|
|
1892
1895
|
const scriptTag = `<script id="__CSSZYX_MANGLE_MAP__" type="application/json">${jsonContent}<\/script>`;
|
|
1893
1896
|
const prefixContent = safeJsonForScriptTag(globalVarAliasPrefix);
|
|
1894
|
-
const debugScript = `<script>(function(){var m=${
|
|
1895
|
-
const combined = `${scriptTag}
|
|
1896
|
-
${debugScript}
|
|
1897
|
+
const debugScript = `<script>(function(){var m=${classMapExpr};var vm=${varMapContent};var gp=${prefixContent};var r={};var vr={};for(var k in m)r[m[k]]=k;for(var vk in vm){var vv=vm[vk];var vs=Array.isArray(vv)?vv:[vv];for(var vi=0;vi<vs.length;vi++)(vr[vs[vi]]||(vr[vs[vi]]=[])).push(vk)}var cs=document.documentElement.getAttribute("data-sz-checksum")||"";window.__csszyx={mangleMap:m,varMangleMap:vm,checksum:cs,decode:function(c){return r[c]},encode:function(c){return m[c]},decodeVar:function(v){return vr[v]||[]},encodeVar:function(v){return vm[v]},decodeGlobalVar:function(v){var a=vr[v]||[];return v.indexOf(gp)===0?a[0]:void 0},decodeAll:function(el){return(el.className||"").split(" ").map(function(c){return r[c]||c})}}})()<\/script>`;
|
|
1898
|
+
const combined = installRuntimeObject ? `${scriptTag}
|
|
1899
|
+
${debugScript}` : scriptTag;
|
|
1897
1900
|
if (html.includes("</head>")) {
|
|
1898
1901
|
return html.replace("</head>", `${combined}
|
|
1899
1902
|
</head>`);
|
|
@@ -1998,6 +2001,42 @@ function escapeForDoubleQuotedString(value) {
|
|
|
1998
2001
|
return htmlEscape.escapeDoubleQuotedString(value);
|
|
1999
2002
|
}
|
|
2000
2003
|
|
|
2004
|
+
function createMangleSizeAccount() {
|
|
2005
|
+
return { cssGzBefore: 0, cssGzAfter: 0, channels: /* @__PURE__ */ new Set() };
|
|
2006
|
+
}
|
|
2007
|
+
function resetMangleSizeAccount(account) {
|
|
2008
|
+
account.cssGzBefore = 0;
|
|
2009
|
+
account.cssGzAfter = 0;
|
|
2010
|
+
account.channels.clear();
|
|
2011
|
+
}
|
|
2012
|
+
function gzipBytes(text) {
|
|
2013
|
+
if (text.length === 0) return 0;
|
|
2014
|
+
return node_zlib.gzipSync(Buffer.from(text, "utf8")).length;
|
|
2015
|
+
}
|
|
2016
|
+
function recordCssPair(account, before, after) {
|
|
2017
|
+
if (before === after) {
|
|
2018
|
+
const bytes = gzipBytes(before);
|
|
2019
|
+
account.cssGzBefore += bytes;
|
|
2020
|
+
account.cssGzAfter += bytes;
|
|
2021
|
+
return;
|
|
2022
|
+
}
|
|
2023
|
+
account.cssGzBefore += gzipBytes(before);
|
|
2024
|
+
account.cssGzAfter += gzipBytes(after);
|
|
2025
|
+
}
|
|
2026
|
+
function computeMangleSizeVerdict(account, mapPayload) {
|
|
2027
|
+
const channels = htmlEscape.sortStrings(account.channels);
|
|
2028
|
+
const mapCost = gzipBytes(mapPayload) * channels.length;
|
|
2029
|
+
const cssSaving = account.cssGzBefore - account.cssGzAfter;
|
|
2030
|
+
return { mapCost, cssSaving, net: mapCost - cssSaving, channels };
|
|
2031
|
+
}
|
|
2032
|
+
function mangleSizeMessage(verdict) {
|
|
2033
|
+
if (verdict.channels.length === 0) return null;
|
|
2034
|
+
if (verdict.net <= 0) return null;
|
|
2035
|
+
const cssPart = verdict.cssSaving >= 0 ? `the mangled CSS saves ${verdict.cssSaving} B` : `the mangled CSS COSTS ${-verdict.cssSaving} B (short tokens compress worse than the names they replaced)`;
|
|
2036
|
+
const channelPart = verdict.channels.length > 1 ? `${verdict.channels.join(" + ")} (${verdict.channels.length} copies)` : verdict.channels[0];
|
|
2037
|
+
return `[csszyx] production.mangle is making this build BIGGER: +${verdict.net} B gzipped. The runtime mangle map costs ${verdict.mapCost} B via ${channelPart}, while ${cssPart}. Mangling is a name-obfuscation feature; over a compressed response it does not reduce payload, because utility class names compress far better than the map they need. If you enabled it for size, set \`production.mangle: false\`. If you enabled it to hide class names, this is the expected price and you can ignore this. Narrowing \`production.mangleMapDelivery\` removes a map copy when only one channel is needed. (Measured on CSS and the map; class shortening inside JS chunks is not counted, so the real net is slightly better than this figure.)`;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2001
2040
|
function isParserMode(value) {
|
|
2002
2041
|
return value === "rust" || value === "oxc" || value === "babel";
|
|
2003
2042
|
}
|
|
@@ -2042,6 +2081,41 @@ function isSameFileVersion(before, after) {
|
|
|
2042
2081
|
return before.dev === after.dev && before.ino === after.ino && before.size === after.size && before.mtimeNs === after.mtimeNs && before.ctimeNs === after.ctimeNs;
|
|
2043
2082
|
}
|
|
2044
2083
|
|
|
2084
|
+
function recordSzvRegistryFile(registry, filePath, content) {
|
|
2085
|
+
const key = transformCache.normalizePathSeparators(filePath);
|
|
2086
|
+
const qualifies = content.includes("szv(") && content.includes("export");
|
|
2087
|
+
const entries = qualifies ? compiler.extractSzvRegistryEntries(content, filePath) : [];
|
|
2088
|
+
if (entries.length === 0) {
|
|
2089
|
+
registry.delete(key);
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
const byName = {};
|
|
2093
|
+
for (const entry of entries) {
|
|
2094
|
+
byName[entry.exportName] = entry.config;
|
|
2095
|
+
}
|
|
2096
|
+
registry.set(key, byName);
|
|
2097
|
+
}
|
|
2098
|
+
const SPECIFIER_PROBES = ["", ".ts", ".tsx", ".js", ".jsx", "/index.ts", "/index.tsx"];
|
|
2099
|
+
function resolveCrossModuleStaticsFor(registry, filename, source) {
|
|
2100
|
+
if (registry.size === 0 || !source.includes("from")) return void 0;
|
|
2101
|
+
const directory = path__namespace.dirname(filename);
|
|
2102
|
+
let resolved;
|
|
2103
|
+
for (const match of source.matchAll(/from\s*['"](\.[^'"]*)['"]/g)) {
|
|
2104
|
+
const specifier = match[1];
|
|
2105
|
+
if (resolved?.[specifier] !== void 0) continue;
|
|
2106
|
+
const base = transformCache.normalizePathSeparators(path__namespace.resolve(directory, specifier));
|
|
2107
|
+
for (const probe of SPECIFIER_PROBES) {
|
|
2108
|
+
const entries = registry.get(`${base}${probe}`);
|
|
2109
|
+
if (entries !== void 0) {
|
|
2110
|
+
resolved ??= {};
|
|
2111
|
+
resolved[specifier] = entries;
|
|
2112
|
+
break;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
return resolved;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2045
2119
|
function generateThemeDts(opts) {
|
|
2046
2120
|
const { theme, sourceFiles } = opts;
|
|
2047
2121
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -2157,7 +2231,7 @@ export default checksum;
|
|
|
2157
2231
|
`;
|
|
2158
2232
|
}
|
|
2159
2233
|
function isVirtualModule(id) {
|
|
2160
|
-
return id === VIRTUAL_MODULE_ID || id === VIRTUAL_CHECKSUM_ID || id === THEME_GROUPS_VIRTUAL_ID;
|
|
2234
|
+
return id === VIRTUAL_MODULE_ID || id === VIRTUAL_CHECKSUM_ID || id === THEME_GROUPS_VIRTUAL_ID || id === MANGLE_RUNTIME_VIRTUAL_ID;
|
|
2161
2235
|
}
|
|
2162
2236
|
function resolveVirtualModule(id) {
|
|
2163
2237
|
if (id === VIRTUAL_MODULE_ID) {
|
|
@@ -2169,8 +2243,56 @@ function resolveVirtualModule(id) {
|
|
|
2169
2243
|
if (id === THEME_GROUPS_VIRTUAL_ID) {
|
|
2170
2244
|
return RESOLVED_THEME_GROUPS_VIRTUAL_ID;
|
|
2171
2245
|
}
|
|
2246
|
+
if (id === MANGLE_RUNTIME_VIRTUAL_ID) {
|
|
2247
|
+
return RESOLVED_MANGLE_RUNTIME_VIRTUAL_ID;
|
|
2248
|
+
}
|
|
2172
2249
|
return void 0;
|
|
2173
2250
|
}
|
|
2251
|
+
const MANGLE_RUNTIME_VIRTUAL_ID = "virtual:csszyx/mangle-runtime";
|
|
2252
|
+
const RESOLVED_MANGLE_RUNTIME_VIRTUAL_ID = `\0${MANGLE_RUNTIME_VIRTUAL_ID}`;
|
|
2253
|
+
const MANGLE_MAP_PLACEHOLDER = "___CSSZYX_MANGLE_MAP___";
|
|
2254
|
+
const VAR_MANGLE_MAP_PLACEHOLDER = "___CSSZYX_VAR_MANGLE_MAP___";
|
|
2255
|
+
const CHECKSUM_PLACEHOLDER = "___CSSZYX_CHECKSUM___";
|
|
2256
|
+
function createMangleRuntimeModule(globalVarAliasPrefix) {
|
|
2257
|
+
return `/**
|
|
2258
|
+
* Auto-generated by csszyx: installs the runtime mangle map from the bundle.
|
|
2259
|
+
*
|
|
2260
|
+
* @generated
|
|
2261
|
+
*/
|
|
2262
|
+
|
|
2263
|
+
const m = ${MANGLE_MAP_PLACEHOLDER};
|
|
2264
|
+
const vm = ${VAR_MANGLE_MAP_PLACEHOLDER};
|
|
2265
|
+
const gp = ${JSON.stringify(globalVarAliasPrefix)};
|
|
2266
|
+
const checksum = "${CHECKSUM_PLACEHOLDER}";
|
|
2267
|
+
|
|
2268
|
+
if (typeof window !== 'undefined' && !window.__csszyx) {
|
|
2269
|
+
const r = {};
|
|
2270
|
+
const vr = {};
|
|
2271
|
+
for (const k in m) r[m[k]] = k;
|
|
2272
|
+
for (const vk in vm) {
|
|
2273
|
+
const vv = vm[vk];
|
|
2274
|
+
const vs = Array.isArray(vv) ? vv : [vv];
|
|
2275
|
+
for (const v of vs) (vr[v] || (vr[v] = [])).push(vk);
|
|
2276
|
+
}
|
|
2277
|
+
window.__csszyx = {
|
|
2278
|
+
mangleMap: m,
|
|
2279
|
+
varMangleMap: vm,
|
|
2280
|
+
checksum,
|
|
2281
|
+
decode: (c) => r[c],
|
|
2282
|
+
encode: (c) => m[c],
|
|
2283
|
+
decodeVar: (v) => vr[v] || [],
|
|
2284
|
+
encodeVar: (v) => vm[v],
|
|
2285
|
+
decodeGlobalVar: (v) => {
|
|
2286
|
+
const a = vr[v] || [];
|
|
2287
|
+
return v.indexOf(gp) === 0 ? a[0] : undefined;
|
|
2288
|
+
},
|
|
2289
|
+
decodeAll: (el) => (el.className || '').split(' ').map((c) => r[c] || c),
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
export {};
|
|
2294
|
+
`;
|
|
2295
|
+
}
|
|
2174
2296
|
function createThemeGroupsModule(tokens) {
|
|
2175
2297
|
const payload = JSON.stringify({
|
|
2176
2298
|
colors: tokens.colors,
|
|
@@ -2195,9 +2317,6 @@ function registerWebpackAssetProcessor(compiler, processAssets) {
|
|
|
2195
2317
|
);
|
|
2196
2318
|
});
|
|
2197
2319
|
}
|
|
2198
|
-
const CHECKSUM_PLACEHOLDER = "___CSSZYX_CHECKSUM___";
|
|
2199
|
-
const MANGLE_MAP_PLACEHOLDER = "___CSSZYX_MANGLE_MAP___";
|
|
2200
|
-
const VAR_MANGLE_MAP_PLACEHOLDER = "___CSSZYX_VAR_MANGLE_MAP___";
|
|
2201
2320
|
const UNKNOWN_PACKAGE_VERSION = "0.0.0";
|
|
2202
2321
|
const TRANSFORM_CACHE_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
2203
2322
|
const TRANSFORM_CACHE_MAX_ENTRIES = 1e4;
|
|
@@ -2231,9 +2350,9 @@ let _hasWarnedTransformCacheVersion = false;
|
|
|
2231
2350
|
let _hasWarnedNativeFallback = false;
|
|
2232
2351
|
const _loggedActiveParsers = /* @__PURE__ */ new Set();
|
|
2233
2352
|
const _babelFallbackFiles = /* @__PURE__ */ new Set();
|
|
2234
|
-
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.
|
|
2353
|
+
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.BK3XVHe8.cjs', document.baseURI).href)));
|
|
2235
2354
|
const PLUGIN_VERSION = findPackageVersionFromFile(
|
|
2236
|
-
node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.
|
|
2355
|
+
node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.BK3XVHe8.cjs', document.baseURI).href))),
|
|
2237
2356
|
UNKNOWN_PACKAGE_VERSION
|
|
2238
2357
|
);
|
|
2239
2358
|
const COMPILER_VERSION = findPackageVersionFromModule("@csszyx/compiler", UNKNOWN_PACKAGE_VERSION);
|
|
@@ -2386,6 +2505,13 @@ function shouldEmitWarning(quiet, devOnly, isProduction) {
|
|
|
2386
2505
|
}
|
|
2387
2506
|
return true;
|
|
2388
2507
|
}
|
|
2508
|
+
function shouldEmitMissingCssFallback(quiet, message) {
|
|
2509
|
+
return !quiet && compiler.szFallbackConsequenceOf(message) === "missing-css";
|
|
2510
|
+
}
|
|
2511
|
+
function emitMissingCssFallback(quiet, message, id, emit) {
|
|
2512
|
+
if (shouldEmitMissingCssFallback(quiet, message)) emit(`[csszyx] ${id}
|
|
2513
|
+
${message}`);
|
|
2514
|
+
}
|
|
2389
2515
|
function normalizeForMatch(p) {
|
|
2390
2516
|
const n = transformCache.normalizePathSeparators(p);
|
|
2391
2517
|
return n.length > 1 && n.endsWith("/") ? n.slice(0, -1) : n;
|
|
@@ -2453,6 +2579,30 @@ function fileMayContainSafelistableSz(content) {
|
|
|
2453
2579
|
function mangleEligibleClasses(ownedClasses, authoredClasses) {
|
|
2454
2580
|
return compiler.sortStrings([...ownedClasses].filter((className) => !authoredClasses.has(className)));
|
|
2455
2581
|
}
|
|
2582
|
+
const tokenByIndex = [];
|
|
2583
|
+
function tokenAt(index) {
|
|
2584
|
+
const cached = tokenByIndex[index];
|
|
2585
|
+
if (cached !== void 0) {
|
|
2586
|
+
return cached;
|
|
2587
|
+
}
|
|
2588
|
+
const fresh = core.encode(index);
|
|
2589
|
+
tokenByIndex[index] = fresh;
|
|
2590
|
+
return fresh;
|
|
2591
|
+
}
|
|
2592
|
+
function allocateMangleTokens(eligibleClasses, forbiddenTokens) {
|
|
2593
|
+
const map = {};
|
|
2594
|
+
let tokenIndex = 0;
|
|
2595
|
+
for (const className of eligibleClasses) {
|
|
2596
|
+
let token = tokenAt(tokenIndex);
|
|
2597
|
+
while (forbiddenTokens.has(token)) {
|
|
2598
|
+
tokenIndex++;
|
|
2599
|
+
token = tokenAt(tokenIndex);
|
|
2600
|
+
}
|
|
2601
|
+
map[className] = token;
|
|
2602
|
+
tokenIndex++;
|
|
2603
|
+
}
|
|
2604
|
+
return map;
|
|
2605
|
+
}
|
|
2456
2606
|
function isPackagesSkippedSource(id, sourceDirs = []) {
|
|
2457
2607
|
const p = normalizeForMatch(id);
|
|
2458
2608
|
if (p.includes("node_modules")) {
|
|
@@ -2867,7 +3017,7 @@ function matchesScriptExtension(id, extensions) {
|
|
|
2867
3017
|
return extensions.some((ext) => id.endsWith(ext) || id.includes(`${ext}?`));
|
|
2868
3018
|
}
|
|
2869
3019
|
function insertRuntimeImport(code, importStmt) {
|
|
2870
|
-
return
|
|
3020
|
+
return nextRuntimeInjection.insertAfterUseDirective(code, importStmt);
|
|
2871
3021
|
}
|
|
2872
3022
|
function scanClassExpression(source, from) {
|
|
2873
3023
|
let depth = 0;
|
|
@@ -3123,8 +3273,19 @@ ${errors.join("\n")}`
|
|
|
3123
3273
|
}
|
|
3124
3274
|
function createCsszyxPlugins(options = {}) {
|
|
3125
3275
|
assertGlobalVarMangleConfig(options);
|
|
3126
|
-
let manglingEnabled = options.production?.mangle
|
|
3276
|
+
let manglingEnabled = options.production?.mangle === true;
|
|
3277
|
+
let crossModuleRegistryEnabled = process.env.NODE_ENV !== "development";
|
|
3278
|
+
const szvCrossModuleRegistry = /* @__PURE__ */ new Map();
|
|
3127
3279
|
const mangleReserved = new Set(options.production?.mangleExclude ?? []);
|
|
3280
|
+
const mangleMapDelivery = options.production?.mangleMapDelivery ?? "both";
|
|
3281
|
+
if (!["both", "html", "bundle"].includes(mangleMapDelivery)) {
|
|
3282
|
+
throw new Error(
|
|
3283
|
+
`[csszyx] production.mangleMapDelivery must be 'both', 'html' or 'bundle'; got ${JSON.stringify(mangleMapDelivery)}.`
|
|
3284
|
+
);
|
|
3285
|
+
}
|
|
3286
|
+
const deliverMapInHtml = mangleMapDelivery !== "bundle";
|
|
3287
|
+
const deliverMapInBundle = mangleMapDelivery !== "html";
|
|
3288
|
+
const sizeAccount = createMangleSizeAccount();
|
|
3128
3289
|
const astBudgetOverride = options.build?.astBudgetLimit;
|
|
3129
3290
|
const prescanAstBudget = astBudgetOverride ?? 5e5;
|
|
3130
3291
|
const cacheRequested = (options.build?.cache ?? types.DEFAULT_BUILD_CONFIG.cache) !== false;
|
|
@@ -3350,6 +3511,14 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3350
3511
|
function transformConfiguredSource(source, filename, astBudget) {
|
|
3351
3512
|
const compilerOptions = createCompilerOptions(astBudget);
|
|
3352
3513
|
const effectiveFilename = normalizeSourceFilename(filename);
|
|
3514
|
+
const crossModuleStatics = resolveCrossModuleStaticsFor(
|
|
3515
|
+
szvCrossModuleRegistry,
|
|
3516
|
+
filename,
|
|
3517
|
+
source
|
|
3518
|
+
);
|
|
3519
|
+
if (crossModuleStatics !== void 0) {
|
|
3520
|
+
compilerOptions.crossModuleStatics = crossModuleStatics;
|
|
3521
|
+
}
|
|
3353
3522
|
const cacheRoot = transformCache.resolveTransformCacheDir(state.rootDir, options.build?.cacheDir);
|
|
3354
3523
|
if (cacheEnabled) {
|
|
3355
3524
|
evictTransformCacheOnce();
|
|
@@ -3461,6 +3630,10 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3461
3630
|
mangleVars: compilerOptions.mangleVars,
|
|
3462
3631
|
mangleVarHoistMaxDepth: compilerOptions.mangleVarHoistMaxDepth,
|
|
3463
3632
|
globalVarAliases: normalizeGlobalVarAliasesForCache(compilerOptions.globalVarAliases),
|
|
3633
|
+
// The registry entries fed to this file are part of its identity:
|
|
3634
|
+
// module A's config change must miss B's cached transform, or the
|
|
3635
|
+
// cache serves a stale table.
|
|
3636
|
+
crossModuleStatics: compilerOptions.crossModuleStatics === void 0 ? void 0 : JSON.stringify(compilerOptions.crossModuleStatics),
|
|
3464
3637
|
filename: effectiveFilename,
|
|
3465
3638
|
source
|
|
3466
3639
|
};
|
|
@@ -3672,6 +3845,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3672
3845
|
}
|
|
3673
3846
|
function prescanAndWriteClasses() {
|
|
3674
3847
|
refreshCompileSourceDirs();
|
|
3848
|
+
szvCrossModuleRegistry.clear();
|
|
3675
3849
|
const prescanStarted = node_perf_hooks.performance.now();
|
|
3676
3850
|
const discoveredClasses = /* @__PURE__ */ new Set();
|
|
3677
3851
|
const rawDiscoveredClasses = /* @__PURE__ */ new Set();
|
|
@@ -3688,10 +3862,15 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3688
3862
|
return;
|
|
3689
3863
|
}
|
|
3690
3864
|
recordAuthoredClasses(content);
|
|
3865
|
+
recordSzvRegistryEntries(filePath, content);
|
|
3691
3866
|
if (fileMayContainSafelistableSz(content)) {
|
|
3692
3867
|
prescanSources.push({ filePath, content });
|
|
3693
3868
|
}
|
|
3694
3869
|
}
|
|
3870
|
+
function recordSzvRegistryEntries(filePath, content) {
|
|
3871
|
+
if (!crossModuleRegistryEnabled) return;
|
|
3872
|
+
recordSzvRegistryFile(szvCrossModuleRegistry, filePath, content);
|
|
3873
|
+
}
|
|
3695
3874
|
function scanDir(dir) {
|
|
3696
3875
|
let entries;
|
|
3697
3876
|
try {
|
|
@@ -3850,18 +4029,15 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3850
4029
|
}
|
|
3851
4030
|
}
|
|
3852
4031
|
function finalizeMangleMap() {
|
|
3853
|
-
const
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
tokenIndex++;
|
|
3863
|
-
}
|
|
3864
|
-
state.mangleMap = newMap;
|
|
4032
|
+
const forbiddenTokens = /* @__PURE__ */ new Set([
|
|
4033
|
+
...mangleReserved,
|
|
4034
|
+
...state.authoredClasses,
|
|
4035
|
+
...state.ownedClasses
|
|
4036
|
+
]);
|
|
4037
|
+
state.mangleMap = allocateMangleTokens(
|
|
4038
|
+
mangleEligibleClasses(state.ownedClasses, state.authoredClasses),
|
|
4039
|
+
forbiddenTokens
|
|
4040
|
+
);
|
|
3865
4041
|
assertVarMangleMapSize(state.varMangleMap, varMangleMapMaxBytes);
|
|
3866
4042
|
state.checksum = core.compute_mangle_checksum(
|
|
3867
4043
|
createHydrationMangleMap(state.mangleMap, state.varMangleMap)
|
|
@@ -3894,14 +4070,15 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3894
4070
|
if (result.includes(CHECKSUM_PLACEHOLDER)) {
|
|
3895
4071
|
result = result.split(CHECKSUM_PLACEHOLDER).join(state.checksum);
|
|
3896
4072
|
}
|
|
4073
|
+
const isEvalWrapped = result.includes("eval(") && result.includes("sourceURL=webpack");
|
|
3897
4074
|
if (result.includes(MANGLE_MAP_PLACEHOLDER)) {
|
|
3898
4075
|
const jsonMap = escapeJsonForInlineScript(JSON.stringify(state.mangleMap));
|
|
3899
|
-
const escapedMap =
|
|
4076
|
+
const escapedMap = isEvalWrapped ? escapeForDoubleQuotedString(jsonMap) : jsonMap;
|
|
3900
4077
|
result = result.split(MANGLE_MAP_PLACEHOLDER).join(escapedMap);
|
|
3901
4078
|
}
|
|
3902
4079
|
if (result.includes(VAR_MANGLE_MAP_PLACEHOLDER)) {
|
|
3903
4080
|
const jsonMap = escapeJsonForInlineScript(JSON.stringify(state.varMangleMap));
|
|
3904
|
-
const escapedMap =
|
|
4081
|
+
const escapedMap = isEvalWrapped ? escapeForDoubleQuotedString(jsonMap) : jsonMap;
|
|
3905
4082
|
result = result.split(VAR_MANGLE_MAP_PLACEHOLDER).join(escapedMap);
|
|
3906
4083
|
}
|
|
3907
4084
|
return result;
|
|
@@ -3914,6 +4091,9 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3914
4091
|
usesMerge: false,
|
|
3915
4092
|
usesSzcn: false,
|
|
3916
4093
|
usesSzPart: false,
|
|
4094
|
+
usesSzvPick: false,
|
|
4095
|
+
usesSzvPick1: false,
|
|
4096
|
+
szPartArgsProvable: true,
|
|
3917
4097
|
usesColorVar: false,
|
|
3918
4098
|
usesSpacingVar: false,
|
|
3919
4099
|
usesUnitVar: false
|
|
@@ -3934,16 +4114,20 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3934
4114
|
if (message.includes("unresolvable sz spread")) {
|
|
3935
4115
|
state.spreadWarnings.add(`${id}
|
|
3936
4116
|
${message}`);
|
|
3937
|
-
|
|
4117
|
+
continue;
|
|
4118
|
+
}
|
|
4119
|
+
if (message.includes("AST budget exceeded")) {
|
|
3938
4120
|
console.warn(`[csszyx] ${id}
|
|
3939
4121
|
${message}`);
|
|
4122
|
+
continue;
|
|
3940
4123
|
}
|
|
4124
|
+
emitMissingCssFallback(quiet, message, id, console.warn);
|
|
3941
4125
|
}
|
|
3942
4126
|
if (quiet || result.diagnostics.length === 0 || process.env.NODE_ENV === "production") {
|
|
3943
4127
|
return;
|
|
3944
4128
|
}
|
|
3945
4129
|
for (const message of result.diagnostics) {
|
|
3946
|
-
if (message.includes("unresolvable sz spread") || message.includes("AST budget exceeded")) {
|
|
4130
|
+
if (message.includes("unresolvable sz spread") || message.includes("AST budget exceeded") || compiler.szFallbackConsequenceOf(message) === "missing-css") {
|
|
3947
4131
|
continue;
|
|
3948
4132
|
}
|
|
3949
4133
|
warn(`[csszyx] ${id}
|
|
@@ -3958,6 +4142,9 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3958
4142
|
usesMerge: result.usesMerge,
|
|
3959
4143
|
usesSzcn: result.usesSzcn,
|
|
3960
4144
|
usesSzPart: result.usesSzPart,
|
|
4145
|
+
usesSzvPick: result.usesSzvPick,
|
|
4146
|
+
usesSzvPick1: result.usesSzvPick1,
|
|
4147
|
+
szPartArgsProvable: result.szPartArgsProvable,
|
|
3961
4148
|
usesColorVar: result.usesColorVar,
|
|
3962
4149
|
usesSpacingVar: result.usesSpacingVar,
|
|
3963
4150
|
usesUnitVar: result.usesUnitVar,
|
|
@@ -4000,31 +4187,34 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4000
4187
|
return transformedCode;
|
|
4001
4188
|
}
|
|
4002
4189
|
function requiredRuntimeHelpers(output) {
|
|
4003
|
-
|
|
4004
|
-
if (output.usesRuntime) helpers.push("_sz");
|
|
4005
|
-
if (output.usesMerge) helpers.push("_szMerge");
|
|
4006
|
-
if (output.usesSzcn) helpers.push("_szcn");
|
|
4007
|
-
if (output.usesSzPart) helpers.push("_szPart");
|
|
4008
|
-
if (output.usesColorVar) helpers.push("__szColorVar");
|
|
4009
|
-
if (output.usesSpacingVar) helpers.push("__szSpacingVar");
|
|
4010
|
-
if (output.usesUnitVar) helpers.push("__szUnitVar");
|
|
4011
|
-
return helpers;
|
|
4190
|
+
return nextRuntimeInjection.runtimeHelperGroupsFromUsage(output);
|
|
4012
4191
|
}
|
|
4013
4192
|
function injectRuntimeHelpers(code, output) {
|
|
4014
|
-
const
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
if (
|
|
4018
|
-
|
|
4193
|
+
const groups = requiredRuntimeHelpers(output);
|
|
4194
|
+
let result = null;
|
|
4195
|
+
let current = code;
|
|
4196
|
+
if (groups.merge.length > 0 && !current.includes("@csszyx/runtime/merge")) {
|
|
4197
|
+
current = insertRuntimeImport(
|
|
4198
|
+
current,
|
|
4199
|
+
`import { ${groups.merge.join(", ")} } from '@csszyx/runtime/merge';
|
|
4200
|
+
`
|
|
4201
|
+
);
|
|
4202
|
+
result = current;
|
|
4203
|
+
}
|
|
4204
|
+
const imports = groups.barrel;
|
|
4205
|
+
const hasRuntimeImport = imports.length > 0 && current.includes("@csszyx/runtime");
|
|
4206
|
+
const needed = hasRuntimeImport ? imports.filter((name) => !nextRuntimeInjection.importsRuntimeHelper(current, name)) : imports;
|
|
4207
|
+
if (needed.length === 0) return result;
|
|
4208
|
+
const existingImport = nextRuntimeInjection.findRuntimeImportClause(current);
|
|
4019
4209
|
if (existingImport) {
|
|
4020
|
-
return
|
|
4210
|
+
return current.replace(
|
|
4021
4211
|
existingImport.statement,
|
|
4022
4212
|
`${existingImport.prefixWithBody}, ${needed.join(", ")} } from '@csszyx/runtime'`
|
|
4023
4213
|
);
|
|
4024
4214
|
}
|
|
4025
4215
|
const importStatement = `import { ${needed.join(", ")} } from '@csszyx/runtime';
|
|
4026
4216
|
`;
|
|
4027
|
-
return insertRuntimeImport(
|
|
4217
|
+
return insertRuntimeImport(current, importStatement);
|
|
4028
4218
|
}
|
|
4029
4219
|
function injectThemeGroups(code, transformedCode, id, usesSzcn) {
|
|
4030
4220
|
if (!usesSzcn && !/\bszcn\s*\(/.test(code) || transformedCode.includes(THEME_GROUPS_VIRTUAL_ID) || !shouldProcessSource(id)) {
|
|
@@ -4032,6 +4222,18 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4032
4222
|
}
|
|
4033
4223
|
return `import '${THEME_GROUPS_VIRTUAL_ID}';
|
|
4034
4224
|
${transformedCode}`;
|
|
4225
|
+
}
|
|
4226
|
+
const MANGLE_RUNTIME_CONSUMER_RE = /from\s*['"](?:csszyx|@csszyx\/runtime)['"]/;
|
|
4227
|
+
let activeFramework;
|
|
4228
|
+
function injectMangleRuntime(transformedCode, id) {
|
|
4229
|
+
if (activeFramework !== "vite" && activeFramework !== "rollup") {
|
|
4230
|
+
return null;
|
|
4231
|
+
}
|
|
4232
|
+
if (!manglingEnabled || !deliverMapInBundle || !shouldProcessSource(id) || !MANGLE_RUNTIME_CONSUMER_RE.test(transformedCode) || transformedCode.includes(MANGLE_RUNTIME_VIRTUAL_ID)) {
|
|
4233
|
+
return null;
|
|
4234
|
+
}
|
|
4235
|
+
return insertRuntimeImport(transformedCode, `import '${MANGLE_RUNTIME_VIRTUAL_ID}';
|
|
4236
|
+
`);
|
|
4035
4237
|
}
|
|
4036
4238
|
function collectPreTransformClasses(output) {
|
|
4037
4239
|
if (!output.transformed && !output.code.includes("class=") && !output.code.includes("className=")) {
|
|
@@ -4075,7 +4277,7 @@ ${transformedCode}`;
|
|
|
4075
4277
|
* @returns true only for csszyx virtual modules
|
|
4076
4278
|
*/
|
|
4077
4279
|
loadInclude(id) {
|
|
4078
|
-
return id === RESOLVED_VIRTUAL_MODULE_ID || id === RESOLVED_VIRTUAL_CHECKSUM_ID || id === RESOLVED_THEME_GROUPS_VIRTUAL_ID;
|
|
4280
|
+
return id === RESOLVED_VIRTUAL_MODULE_ID || id === RESOLVED_VIRTUAL_CHECKSUM_ID || id === RESOLVED_THEME_GROUPS_VIRTUAL_ID || id === RESOLVED_MANGLE_RUNTIME_VIRTUAL_ID;
|
|
4079
4281
|
},
|
|
4080
4282
|
/**
|
|
4081
4283
|
* Loads virtual module content — generates mangle map or checksum module code.
|
|
@@ -4096,6 +4298,10 @@ ${transformedCode}`;
|
|
|
4096
4298
|
finalizeMangleMap();
|
|
4097
4299
|
return createChecksumModule(state.checksum);
|
|
4098
4300
|
}
|
|
4301
|
+
if (id === RESOLVED_MANGLE_RUNTIME_VIRTUAL_ID) {
|
|
4302
|
+
sizeAccount.channels.add("bundle");
|
|
4303
|
+
return createMangleRuntimeModule(globalVarAliasPrefix);
|
|
4304
|
+
}
|
|
4099
4305
|
if (id === RESOLVED_THEME_GROUPS_VIRTUAL_ID) {
|
|
4100
4306
|
const theme = state.parsedTheme;
|
|
4101
4307
|
return createThemeGroupsModule({
|
|
@@ -4141,7 +4347,12 @@ ${transformedCode}`;
|
|
|
4141
4347
|
if (matchesScriptExtension(id, [".css"])) {
|
|
4142
4348
|
return transformTailwindCssEntry(code, id);
|
|
4143
4349
|
}
|
|
4144
|
-
const hasSzProp = code.includes("sz=") || code.includes("szs=") || /\bsz\s*:\s*["'{]/.test(code) || code.includes('sz: "')
|
|
4350
|
+
const hasSzProp = code.includes("sz=") || code.includes("szs=") || /\bsz\s*:\s*["'{]/.test(code) || code.includes('sz: "') || // szr-only modules (no sz attribute) historically skipped the
|
|
4351
|
+
// compiler entirely — which also skipped the szr import
|
|
4352
|
+
// rewrite AND the szr fallback diagnostics. The substring is
|
|
4353
|
+
// deliberately loose; a false positive only costs one file
|
|
4354
|
+
// the compiler pass, which then changes nothing.
|
|
4355
|
+
code.includes("szr(");
|
|
4145
4356
|
const output = hasSzProp ? transformSzSource(code, id, (message) => this.warn(message)) : unchangedPreTransform(code);
|
|
4146
4357
|
if (!hasSzProp && shouldProcessSource(id)) {
|
|
4147
4358
|
recordFileVarMangleEntries(state, id, []);
|
|
@@ -4162,6 +4373,11 @@ ${transformedCode}`;
|
|
|
4162
4373
|
output.code = themedCode;
|
|
4163
4374
|
output.transformed = true;
|
|
4164
4375
|
}
|
|
4376
|
+
const mangleRuntimeCode = injectMangleRuntime(output.code, id);
|
|
4377
|
+
if (mangleRuntimeCode !== null) {
|
|
4378
|
+
output.code = mangleRuntimeCode;
|
|
4379
|
+
output.transformed = true;
|
|
4380
|
+
}
|
|
4165
4381
|
if (matchesScriptExtension(id, SCRIPT_ID_EXTENSIONS)) {
|
|
4166
4382
|
assertNoRSCBoundaryViolation(output.code, id);
|
|
4167
4383
|
const record = createRSCModuleRecord(output.code, id);
|
|
@@ -4225,6 +4441,18 @@ ${transformedCode}`;
|
|
|
4225
4441
|
* @param compiler - the Webpack compiler instance
|
|
4226
4442
|
*/
|
|
4227
4443
|
webpack(compiler) {
|
|
4444
|
+
activeFramework = "webpack";
|
|
4445
|
+
if (compiler.options?.mode === "development") {
|
|
4446
|
+
manglingEnabled = false;
|
|
4447
|
+
}
|
|
4448
|
+
if (compiler.watchMode === true || compiler.options?.watch === true) {
|
|
4449
|
+
crossModuleRegistryEnabled = false;
|
|
4450
|
+
}
|
|
4451
|
+
if (manglingEnabled && mangleMapDelivery !== "both") {
|
|
4452
|
+
console.warn(
|
|
4453
|
+
`[csszyx] production.mangleMapDelivery: '${mangleMapDelivery}' has no effect on the webpack lane \u2014 map delivery only narrows on vite/rollup builds.`
|
|
4454
|
+
);
|
|
4455
|
+
}
|
|
4228
4456
|
compiler.hooks.beforeCompile.tap("csszyx:prescan", () => {
|
|
4229
4457
|
announceActiveParser();
|
|
4230
4458
|
const root = compiler.context || process.cwd();
|
|
@@ -4245,6 +4473,16 @@ ${transformedCode}`;
|
|
|
4245
4473
|
});
|
|
4246
4474
|
}
|
|
4247
4475
|
},
|
|
4476
|
+
rollup: {
|
|
4477
|
+
/** Records the rollup lane for the mangle-runtime gate. */
|
|
4478
|
+
buildStart() {
|
|
4479
|
+
activeFramework = "rollup";
|
|
4480
|
+
const meta = this.meta;
|
|
4481
|
+
if (meta?.watchMode) {
|
|
4482
|
+
crossModuleRegistryEnabled = false;
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
},
|
|
4248
4486
|
vite: {
|
|
4249
4487
|
/**
|
|
4250
4488
|
* Vite hook: pre-scans source files when config is resolved.
|
|
@@ -4252,11 +4490,16 @@ ${transformedCode}`;
|
|
|
4252
4490
|
* @param config - the resolved Vite configuration object
|
|
4253
4491
|
*/
|
|
4254
4492
|
configResolved(config) {
|
|
4493
|
+
activeFramework = "vite";
|
|
4255
4494
|
announceActiveParser();
|
|
4256
4495
|
const root = config.root || process.cwd();
|
|
4257
4496
|
state.rootDir = root;
|
|
4258
4497
|
if (config.command === "serve") {
|
|
4259
4498
|
manglingEnabled = false;
|
|
4499
|
+
crossModuleRegistryEnabled = false;
|
|
4500
|
+
}
|
|
4501
|
+
if (config.build?.watch) {
|
|
4502
|
+
crossModuleRegistryEnabled = false;
|
|
4260
4503
|
}
|
|
4261
4504
|
evictTransformCacheOnce();
|
|
4262
4505
|
prescanAndWriteClasses();
|
|
@@ -4358,8 +4601,12 @@ ${transformedCode}`;
|
|
|
4358
4601
|
mode: "script",
|
|
4359
4602
|
minify: process.env.NODE_ENV === "production",
|
|
4360
4603
|
varMangleMap: state.varMangleMap,
|
|
4361
|
-
globalVarAliasPrefix
|
|
4604
|
+
globalVarAliasPrefix,
|
|
4605
|
+
installRuntimeObject: deliverMapInHtml
|
|
4362
4606
|
});
|
|
4607
|
+
if (manglingEnabled) {
|
|
4608
|
+
sizeAccount.channels.add("html");
|
|
4609
|
+
}
|
|
4363
4610
|
if (state.recoveryTokens.size > 0) {
|
|
4364
4611
|
const isProduction = process.env.NODE_ENV === "production";
|
|
4365
4612
|
const { manifest, strippedDevOnlyPaths } = buildRecoveryManifest(
|
|
@@ -4408,7 +4655,7 @@ ${transformedCode}`;
|
|
|
4408
4655
|
return manifest;
|
|
4409
4656
|
}
|
|
4410
4657
|
function rewriteOutputCss(source, file, shouldMangle, mangledSources, externalClasses) {
|
|
4411
|
-
|
|
4658
|
+
const css = rewriteCssWithValidatedGlobalVarPlan(
|
|
4412
4659
|
source,
|
|
4413
4660
|
file,
|
|
4414
4661
|
state.globalVarValidationResult
|
|
@@ -4421,8 +4668,9 @@ ${transformedCode}`;
|
|
|
4421
4668
|
});
|
|
4422
4669
|
for (const className of result.mangledClasses) mangledSources.add(className);
|
|
4423
4670
|
for (const className of result.unmangledClasses) externalClasses.add(className);
|
|
4424
|
-
|
|
4425
|
-
|
|
4671
|
+
const mangled = result.transformedCount > 0 ? result.css : css;
|
|
4672
|
+
recordCssPair(sizeAccount, css, mangled);
|
|
4673
|
+
return mangled;
|
|
4426
4674
|
} catch (error) {
|
|
4427
4675
|
if (isCssSyntaxError(error)) return css;
|
|
4428
4676
|
throw error;
|
|
@@ -4434,6 +4682,16 @@ ${transformedCode}`;
|
|
|
4434
4682
|
collectMangleHybridHazards(state.mangleMap, mangledSources, externalClasses)
|
|
4435
4683
|
);
|
|
4436
4684
|
if (message) console.warn(message);
|
|
4685
|
+
reportMangleSize();
|
|
4686
|
+
}
|
|
4687
|
+
function reportMangleSize() {
|
|
4688
|
+
const verdict = computeMangleSizeVerdict(
|
|
4689
|
+
sizeAccount,
|
|
4690
|
+
JSON.stringify(createHydrationMangleMap(state.mangleMap, state.varMangleMap))
|
|
4691
|
+
);
|
|
4692
|
+
const message = mangleSizeMessage(verdict);
|
|
4693
|
+
if (message) console.warn(message);
|
|
4694
|
+
resetMangleSizeAccount(sizeAccount);
|
|
4437
4695
|
}
|
|
4438
4696
|
function rewriteWebpackCodeAsset(file, source, shouldMangle, compilation, compiler) {
|
|
4439
4697
|
if (shouldMangle && file.endsWith(".html")) {
|
|
@@ -4618,6 +4876,7 @@ const esbuildPlugin = (options = {}) => {
|
|
|
4618
4876
|
};
|
|
4619
4877
|
};
|
|
4620
4878
|
|
|
4879
|
+
exports.allocateMangleTokens = allocateMangleTokens;
|
|
4621
4880
|
exports.appendTailwindSourceDirective = appendTailwindSourceDirective;
|
|
4622
4881
|
exports.assertNoRSCBoundaryViolation = assertNoRSCBoundaryViolation;
|
|
4623
4882
|
exports.assertNoRSCGraphViolation = assertNoRSCGraphViolation;
|
|
@@ -4630,6 +4889,7 @@ exports.createRSCModuleRecord = createRSCModuleRecord;
|
|
|
4630
4889
|
exports.cssHasContentScope = cssHasContentScope;
|
|
4631
4890
|
exports.cssImportsTailwind = cssImportsTailwind;
|
|
4632
4891
|
exports.deleteRSCModuleRecord = deleteRSCModuleRecord;
|
|
4892
|
+
exports.emitMissingCssFallback = emitMissingCssFallback;
|
|
4633
4893
|
exports.esbuildPlugin = esbuildPlugin;
|
|
4634
4894
|
exports.extractGlobalVarAliasesForManifest = extractGlobalVarAliasesForManifest;
|
|
4635
4895
|
exports.fileMayContainSafelistableSz = fileMayContainSafelistableSz;
|
|
@@ -4663,6 +4923,7 @@ exports.rewriteGlobalVarCssAliases = rewriteGlobalVarCssAliases;
|
|
|
4663
4923
|
exports.rollupPlugin = rollupPlugin;
|
|
4664
4924
|
exports.scanCustomPropertyNames = scanCustomPropertyNames;
|
|
4665
4925
|
exports.scanGlobalVarCss = scanGlobalVarCss;
|
|
4926
|
+
exports.shouldEmitMissingCssFallback = shouldEmitMissingCssFallback;
|
|
4666
4927
|
exports.shouldEmitWarning = shouldEmitWarning;
|
|
4667
4928
|
exports.shouldTrackGlobalVarSources = shouldTrackGlobalVarSources;
|
|
4668
4929
|
exports.shouldWarnMissingTailwindEntry = shouldWarnMissingTailwindEntry;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('node:fs');
|
|
4
4
|
const compiler = require('@csszyx/compiler');
|
|
5
|
-
const transformCache = require('./unplugin.
|
|
5
|
+
const transformCache = require('./unplugin.DbZ7tCfN.cjs');
|
|
6
6
|
const node_crypto = require('node:crypto');
|
|
7
7
|
const htmlEscape = require('./unplugin.BkRah5Ot.cjs');
|
|
8
8
|
|