@csszyx/unplugin 0.12.0 → 0.13.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 +8 -7
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/next-config.cjs +3 -0
- package/dist/next-config.d.cts +10 -0
- package/dist/next-config.d.mts +10 -0
- package/dist/next-config.mjs +3 -0
- package/dist/next-prebuild.cjs +12 -5
- package/dist/next-prebuild.d.cts +7 -0
- package/dist/next-prebuild.d.mts +7 -0
- package/dist/next-prebuild.mjs +12 -5
- package/dist/next-turbo-loader.cjs +29 -11
- package/dist/next-turbo-loader.d.cts +10 -0
- package/dist/next-turbo-loader.d.mts +10 -0
- package/dist/next-turbo-loader.mjs +28 -10
- package/dist/next-watcher.cjs +1 -1
- package/dist/next-watcher.mjs +1 -1
- package/dist/shared/unplugin.4du3qMst.cjs +529 -0
- package/dist/shared/unplugin.5l4RHMQh.mjs +578 -0
- package/dist/shared/unplugin.BB0iWSds.mjs +495 -0
- package/dist/shared/{unplugin.DMcbmP01.mjs → unplugin.BU0O4IkX.mjs} +4 -1
- package/dist/shared/{unplugin.BK3XVHe8.cjs → unplugin.Bf4fNbp7.cjs} +318 -532
- package/dist/shared/{unplugin.Bb5TeU9B.cjs → unplugin.CUTa6bY9.cjs} +89 -1
- package/dist/shared/{unplugin.DblMogcN.cjs → unplugin.Cji6O5jv.cjs} +4 -1
- package/dist/shared/{unplugin.DXgxFHzO.mjs → unplugin.CogPHmDs.mjs} +73 -3
- package/dist/shared/{unplugin.CtnKJhAi.d.cts → unplugin.DCT7DDG6.d.cts} +75 -30
- package/dist/shared/{unplugin.CtnKJhAi.d.mts → unplugin.DCT7DDG6.d.mts} +75 -30
- package/dist/shared/unplugin.X9a9SL_s.cjs +612 -0
- package/dist/shared/{unplugin.B9vpjOhD.mjs → unplugin.ymMe428s.mjs} +288 -499
- package/dist/vite.cjs +3 -3
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +3 -3
- package/dist/webpack.cjs +3 -3
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.mjs +3 -3
- package/package.json +9 -9
- package/dist/shared/unplugin.C2lHQFii.cjs +0 -114
- package/dist/shared/unplugin.CBMJufQ8.mjs +0 -108
- package/dist/shared/unplugin.CDqY7kmk.mjs +0 -224
- package/dist/shared/unplugin.DbZ7tCfN.cjs +0 -248
|
@@ -6,16 +6,16 @@ import * as path from 'node:path';
|
|
|
6
6
|
import { dirname } from 'node:path';
|
|
7
7
|
import { performance } from 'node:perf_hooks';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
|
-
import { scanGlobalVarUsages,
|
|
9
|
+
import { scanGlobalVarUsages, sortStrings as sortStrings$1, szFallbackConsequenceOf, ensureRustTransformAvailable, transformSourceCode, transformRust, transformOxc, ASTBudgetExceededError, transformRustBatch, transform, isRustTransformAvailable } from '@csszyx/compiler';
|
|
10
10
|
import { encode, compute_mangle_checksum } from '@csszyx/core';
|
|
11
11
|
import { getNativePackageName } from '@csszyx/core/native';
|
|
12
12
|
import { preprocess as preprocess$1 } from '@csszyx/svelte-adapter';
|
|
13
|
-
import { isTailwindReservedCustomProperty, CSSZYX_GLOBAL_ALIAS_PREFIX, isCsszyxGlobalAliasCustomProperty, DEFAULT_BUILD_CONFIG, validateGlobalVarMangleConfig } from '@csszyx/types';
|
|
13
|
+
import { isTailwindReservedCustomProperty, CSSZYX_GLOBAL_ALIAS_PREFIX, isCsszyxGlobalAliasCustomProperty, DEFAULT_IMPORTED_STATIC_SZ, DEFAULT_BUILD_CONFIG, validateGlobalVarMangleConfig } from '@csszyx/types';
|
|
14
14
|
import { preprocess } from '@csszyx/vue-adapter';
|
|
15
15
|
import { createUnplugin } from 'unplugin';
|
|
16
|
-
import { n as normalizePathSeparators, r as resolveTransformCacheDir,
|
|
16
|
+
import { n as normalizePathSeparators, c as collectSpecifierAliases, h as recordSzvRegistryFile, j as recordSzObjectRegistryFile, k as resolveCrossModuleStaticsFor, r as resolveTransformCacheDir, e as createTransformCacheKey, w as writeTransformCache, l as evictOldTransformCacheEntries, m as mayExportSzvFactories, i as importedSpecifiersIn, s as specifierBases, a as resolveProviderPathWith, f as readTransformCache, o as evictMemoryCacheToBudget, p as resolveProviderPath, g as babelFallbackReason, d as isReadableProviderFile } from './unplugin.BB0iWSds.mjs';
|
|
17
17
|
import { mangleCSSSync } from '../css-mangler.mjs';
|
|
18
|
-
import {
|
|
18
|
+
import { c as createThemeGroupsModule, e as ensureThemeGroupsFile, R as RESOLVED_VIRTUAL_MODULE_ID, b as createMangleMapModule, d as RESOLVED_VIRTUAL_CHECKSUM_ID, f as createChecksumModule, g as RESOLVED_MANGLE_RUNTIME_VIRTUAL_ID, j as createMangleRuntimeModule, k as RESOLVED_THEME_GROUPS_VIRTUAL_ID, l as isVirtualModule, r as resolveVirtualModule, p as parseThemeBlocks, m as mergeThemes, n as discoverProjectTheme, C as CHECKSUM_PLACEHOLDER, M as MANGLE_MAP_PLACEHOLDER, V as VAR_MANGLE_MAP_PLACEHOLDER, o as importsRuntimeHelper, q as findRuntimeImportClause, T as THEME_GROUPS_VIRTUAL_ID, u as THEME_GROUPS_FILE_MARKER, t as themeGroupsSpecifier, v as MANGLE_RUNTIME_VIRTUAL_ID, w as runtimeHelperGroupsFromUsage, a as insertAfterUseDirective } from './unplugin.5l4RHMQh.mjs';
|
|
19
19
|
import { s as sortStrings, a as replaceEveryLiteral, u as unicodeEscape, b as escapeDoubleQuotedString, c as escapeSingleQuotedString, e as escapeHtmlAttribute, r as renderTailwindScannerCandidates } from './unplugin.B3XoSRB8.mjs';
|
|
20
20
|
import { gzipSync } from 'node:zlib';
|
|
21
21
|
import postcss from 'postcss';
|
|
@@ -292,7 +292,7 @@ function validateCandidates(candidates, definitions, reserved, aliasPrefix) {
|
|
|
292
292
|
code: "registered-property",
|
|
293
293
|
severity: "error",
|
|
294
294
|
name,
|
|
295
|
-
message: `Registered custom property ${name}
|
|
295
|
+
message: `Registered custom property ${name} cannot be aliased: @property gives it a type and inheritance behaviour that an alias would not carry.`,
|
|
296
296
|
location: registeredDefinition
|
|
297
297
|
});
|
|
298
298
|
}
|
|
@@ -1112,237 +1112,6 @@ function maskBlockComment(code, start) {
|
|
|
1112
1112
|
return { end, value };
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
|
-
const EMPTY_THEME = {
|
|
1116
|
-
colors: [],
|
|
1117
|
-
spacings: [],
|
|
1118
|
-
fonts: [],
|
|
1119
|
-
textSizes: [],
|
|
1120
|
-
fontWeights: [],
|
|
1121
|
-
radii: [],
|
|
1122
|
-
shadows: [],
|
|
1123
|
-
breakpoints: []
|
|
1124
|
-
};
|
|
1125
|
-
function findMatchingBrace(source, openBrace) {
|
|
1126
|
-
let depth = 0;
|
|
1127
|
-
for (let index = openBrace; index < source.length; index++) {
|
|
1128
|
-
if (source[index] === "{") {
|
|
1129
|
-
depth++;
|
|
1130
|
-
} else if (source[index] === "}") {
|
|
1131
|
-
depth--;
|
|
1132
|
-
if (depth === 0) {
|
|
1133
|
-
return index;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
return -1;
|
|
1138
|
-
}
|
|
1139
|
-
function stripLayerWrappers(css) {
|
|
1140
|
-
let result = "";
|
|
1141
|
-
let i = 0;
|
|
1142
|
-
while (i < css.length) {
|
|
1143
|
-
const layerIdx = css.indexOf("@layer", i);
|
|
1144
|
-
if (layerIdx === -1) {
|
|
1145
|
-
result += css.slice(i);
|
|
1146
|
-
break;
|
|
1147
|
-
}
|
|
1148
|
-
result += css.slice(i, layerIdx);
|
|
1149
|
-
const openBrace = css.indexOf("{", layerIdx);
|
|
1150
|
-
if (openBrace === -1) {
|
|
1151
|
-
result += css.slice(layerIdx);
|
|
1152
|
-
break;
|
|
1153
|
-
}
|
|
1154
|
-
const closeBrace = findMatchingBrace(css, openBrace);
|
|
1155
|
-
if (closeBrace === -1) {
|
|
1156
|
-
result += css.slice(openBrace);
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1159
|
-
result += css.slice(openBrace + 1, closeBrace);
|
|
1160
|
-
i = closeBrace + 1;
|
|
1161
|
-
}
|
|
1162
|
-
return result;
|
|
1163
|
-
}
|
|
1164
|
-
function themePreludeStart(css, at) {
|
|
1165
|
-
const cursor = at + "@theme".length;
|
|
1166
|
-
const next = css[cursor];
|
|
1167
|
-
const validBoundary = next === "{" || next === " " || next === " " || next === "\n" || next === "\r";
|
|
1168
|
-
return validBoundary ? cursor : null;
|
|
1169
|
-
}
|
|
1170
|
-
function readThemeBlock(css, start) {
|
|
1171
|
-
for (let cursor = start; cursor < css.length; cursor++) {
|
|
1172
|
-
const character = css[cursor];
|
|
1173
|
-
if (character === "{") {
|
|
1174
|
-
const close = findMatchingBrace(css, cursor);
|
|
1175
|
-
return {
|
|
1176
|
-
body: close === -1 ? null : css.slice(cursor + 1, close),
|
|
1177
|
-
end: close === -1 ? cursor : close
|
|
1178
|
-
};
|
|
1179
|
-
}
|
|
1180
|
-
if (character === ";" || character === "}" || character === "@") {
|
|
1181
|
-
return { body: null, end: cursor };
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
return { body: null, end: css.length };
|
|
1185
|
-
}
|
|
1186
|
-
function extractThemeBlocks(css) {
|
|
1187
|
-
const blocks = [];
|
|
1188
|
-
let searchFrom = 0;
|
|
1189
|
-
for (; ; ) {
|
|
1190
|
-
const at = css.indexOf("@theme", searchFrom);
|
|
1191
|
-
if (at === -1) {
|
|
1192
|
-
break;
|
|
1193
|
-
}
|
|
1194
|
-
const preludeStart = themePreludeStart(css, at);
|
|
1195
|
-
if (preludeStart === null) {
|
|
1196
|
-
searchFrom = at + "@theme".length;
|
|
1197
|
-
continue;
|
|
1198
|
-
}
|
|
1199
|
-
const match = readThemeBlock(css, preludeStart);
|
|
1200
|
-
if (match.body !== null) blocks.push(match.body);
|
|
1201
|
-
searchFrom = Math.max(match.end, at + "@theme".length);
|
|
1202
|
-
}
|
|
1203
|
-
return blocks;
|
|
1204
|
-
}
|
|
1205
|
-
function categorizeProperty(prop) {
|
|
1206
|
-
const categoryMap = [
|
|
1207
|
-
["color-", "colors"],
|
|
1208
|
-
["spacing-", "spacings"],
|
|
1209
|
-
// `font-weight-` MUST precede `font-`: startsWith would otherwise route
|
|
1210
|
-
// `font-weight-chunky` into font FAMILIES as token "weight-chunky".
|
|
1211
|
-
["font-weight-", "fontWeights"],
|
|
1212
|
-
["font-", "fonts"],
|
|
1213
|
-
// `--text-*` defines font-size utilities (text-huge) in Tailwind v4.
|
|
1214
|
-
["text-", "textSizes"],
|
|
1215
|
-
["radius-", "radii"],
|
|
1216
|
-
["shadow-", "shadows"],
|
|
1217
|
-
["breakpoint-", "breakpoints"]
|
|
1218
|
-
];
|
|
1219
|
-
for (const [prefix, category] of categoryMap) {
|
|
1220
|
-
if (prop.startsWith(prefix)) {
|
|
1221
|
-
let token = prop.slice(prefix.length);
|
|
1222
|
-
if (category !== "breakpoints") {
|
|
1223
|
-
token = token.replace(/-\d+$/, "");
|
|
1224
|
-
}
|
|
1225
|
-
if (token) {
|
|
1226
|
-
return { category, token };
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
return null;
|
|
1231
|
-
}
|
|
1232
|
-
function parseThemeBlocks(cssContent) {
|
|
1233
|
-
const result = {
|
|
1234
|
-
colors: /* @__PURE__ */ new Set(),
|
|
1235
|
-
spacings: /* @__PURE__ */ new Set(),
|
|
1236
|
-
fonts: /* @__PURE__ */ new Set(),
|
|
1237
|
-
textSizes: /* @__PURE__ */ new Set(),
|
|
1238
|
-
fontWeights: /* @__PURE__ */ new Set(),
|
|
1239
|
-
radii: /* @__PURE__ */ new Set(),
|
|
1240
|
-
shadows: /* @__PURE__ */ new Set(),
|
|
1241
|
-
breakpoints: /* @__PURE__ */ new Set()
|
|
1242
|
-
};
|
|
1243
|
-
const stripped = stripLayerWrappers(cssContent);
|
|
1244
|
-
const blocks = extractThemeBlocks(stripped);
|
|
1245
|
-
for (const block of blocks) {
|
|
1246
|
-
for (const name of scanCustomPropertyNames(block)) {
|
|
1247
|
-
const categorized = categorizeProperty(name);
|
|
1248
|
-
if (categorized) {
|
|
1249
|
-
result[categorized.category].add(categorized.token);
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
return {
|
|
1254
|
-
colors: sortStrings(result.colors),
|
|
1255
|
-
spacings: sortStrings(result.spacings),
|
|
1256
|
-
fonts: sortStrings(result.fonts),
|
|
1257
|
-
textSizes: sortStrings(result.textSizes),
|
|
1258
|
-
fontWeights: sortStrings(result.fontWeights),
|
|
1259
|
-
radii: sortStrings(result.radii),
|
|
1260
|
-
shadows: sortStrings(result.shadows),
|
|
1261
|
-
breakpoints: sortStrings(result.breakpoints)
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
function mergeThemes(themes) {
|
|
1265
|
-
if (themes.length === 0) {
|
|
1266
|
-
return { ...EMPTY_THEME };
|
|
1267
|
-
}
|
|
1268
|
-
const merged = {
|
|
1269
|
-
colors: /* @__PURE__ */ new Set(),
|
|
1270
|
-
spacings: /* @__PURE__ */ new Set(),
|
|
1271
|
-
fonts: /* @__PURE__ */ new Set(),
|
|
1272
|
-
textSizes: /* @__PURE__ */ new Set(),
|
|
1273
|
-
fontWeights: /* @__PURE__ */ new Set(),
|
|
1274
|
-
radii: /* @__PURE__ */ new Set(),
|
|
1275
|
-
shadows: /* @__PURE__ */ new Set(),
|
|
1276
|
-
breakpoints: /* @__PURE__ */ new Set()
|
|
1277
|
-
};
|
|
1278
|
-
for (const theme of themes) {
|
|
1279
|
-
for (const cat of Object.keys(merged)) {
|
|
1280
|
-
for (const token of theme[cat]) {
|
|
1281
|
-
merged[cat].add(token);
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
return {
|
|
1286
|
-
colors: sortStrings(merged.colors),
|
|
1287
|
-
spacings: sortStrings(merged.spacings),
|
|
1288
|
-
fonts: sortStrings(merged.fonts),
|
|
1289
|
-
textSizes: sortStrings(merged.textSizes),
|
|
1290
|
-
fontWeights: sortStrings(merged.fontWeights),
|
|
1291
|
-
radii: sortStrings(merged.radii),
|
|
1292
|
-
shadows: sortStrings(merged.shadows),
|
|
1293
|
-
breakpoints: sortStrings(merged.breakpoints)
|
|
1294
|
-
};
|
|
1295
|
-
}
|
|
1296
|
-
function hasTokens(theme) {
|
|
1297
|
-
return Object.values(theme).some((arr) => arr.length > 0);
|
|
1298
|
-
}
|
|
1299
|
-
function readCustomPropertyName(block, dashes) {
|
|
1300
|
-
let end = dashes + 2;
|
|
1301
|
-
if (end >= block.length || !/[a-z]/.test(block[end])) {
|
|
1302
|
-
return null;
|
|
1303
|
-
}
|
|
1304
|
-
end++;
|
|
1305
|
-
while (end < block.length && /[a-z0-9-]/.test(block[end])) {
|
|
1306
|
-
end++;
|
|
1307
|
-
}
|
|
1308
|
-
return { name: block.slice(dashes + 2, end), end };
|
|
1309
|
-
}
|
|
1310
|
-
function findCustomPropertyDeclarationEnd(block, nameEnd) {
|
|
1311
|
-
let cursor = nameEnd;
|
|
1312
|
-
while (cursor < block.length && /\s/.test(block[cursor])) {
|
|
1313
|
-
cursor++;
|
|
1314
|
-
}
|
|
1315
|
-
if (block[cursor] === ":") {
|
|
1316
|
-
const valueStart = cursor + 1;
|
|
1317
|
-
const semicolon = block.indexOf(";", valueStart);
|
|
1318
|
-
return semicolon > valueStart ? semicolon + 1 : -1;
|
|
1319
|
-
}
|
|
1320
|
-
return block[nameEnd] === ";" ? nameEnd + 1 : -1;
|
|
1321
|
-
}
|
|
1322
|
-
function scanCustomPropertyNames(block) {
|
|
1323
|
-
const names = [];
|
|
1324
|
-
let i = 0;
|
|
1325
|
-
while (i < block.length) {
|
|
1326
|
-
const dashes = block.indexOf("--", i);
|
|
1327
|
-
if (dashes === -1) {
|
|
1328
|
-
break;
|
|
1329
|
-
}
|
|
1330
|
-
const property = readCustomPropertyName(block, dashes);
|
|
1331
|
-
if (!property) {
|
|
1332
|
-
i = dashes + 1;
|
|
1333
|
-
continue;
|
|
1334
|
-
}
|
|
1335
|
-
const matchEnd = findCustomPropertyDeclarationEnd(block, property.end);
|
|
1336
|
-
if (matchEnd === -1) {
|
|
1337
|
-
i = dashes + 1;
|
|
1338
|
-
continue;
|
|
1339
|
-
}
|
|
1340
|
-
names.push(property.name);
|
|
1341
|
-
i = matchEnd;
|
|
1342
|
-
}
|
|
1343
|
-
return names;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
1115
|
const REGEX_PREFIXES = new Set("([{:,;=!?&|+-*%^~<>/");
|
|
1347
1116
|
const REGEX_PREFIX_KEYWORDS = /* @__PURE__ */ new Set([
|
|
1348
1117
|
"await",
|
|
@@ -1712,6 +1481,78 @@ function collectAuthoredClassNames(source) {
|
|
|
1712
1481
|
return classes;
|
|
1713
1482
|
}
|
|
1714
1483
|
|
|
1484
|
+
const KNOWN_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
|
|
1485
|
+
"include",
|
|
1486
|
+
"exclude",
|
|
1487
|
+
"compileSources",
|
|
1488
|
+
"contentScopeCheck",
|
|
1489
|
+
"quiet",
|
|
1490
|
+
"mode",
|
|
1491
|
+
"development",
|
|
1492
|
+
"production",
|
|
1493
|
+
"build",
|
|
1494
|
+
"hydration"
|
|
1495
|
+
]);
|
|
1496
|
+
const RENAMED_KEYS = {
|
|
1497
|
+
// Replaced by the path-based form: package NAMES could not express a
|
|
1498
|
+
// sibling directory outside the project root, and resolving them meant
|
|
1499
|
+
// guessing at workspace layout.
|
|
1500
|
+
compilePackages: "compileSources"
|
|
1501
|
+
};
|
|
1502
|
+
function nearestKnownConfigKey(key) {
|
|
1503
|
+
const lower = key.toLowerCase();
|
|
1504
|
+
let best = null;
|
|
1505
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
1506
|
+
for (const candidate of KNOWN_TOP_LEVEL_KEYS) {
|
|
1507
|
+
const distance = editDistance(lower, candidate.toLowerCase());
|
|
1508
|
+
if (distance < bestDistance) {
|
|
1509
|
+
bestDistance = distance;
|
|
1510
|
+
best = candidate;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
return best !== null && bestDistance <= Math.max(1, Math.floor(key.length / 4)) ? best : null;
|
|
1514
|
+
}
|
|
1515
|
+
function editDistance(a, b) {
|
|
1516
|
+
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
1517
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
1518
|
+
const current = [i];
|
|
1519
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
1520
|
+
const substitution = previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1);
|
|
1521
|
+
current.push(Math.min(substitution, previous[j] + 1, current[j - 1] + 1));
|
|
1522
|
+
}
|
|
1523
|
+
previous = current;
|
|
1524
|
+
}
|
|
1525
|
+
return previous[b.length];
|
|
1526
|
+
}
|
|
1527
|
+
function findUnknownConfigKeys(options) {
|
|
1528
|
+
if (options === null || typeof options !== "object" || Array.isArray(options)) {
|
|
1529
|
+
return [];
|
|
1530
|
+
}
|
|
1531
|
+
const unknown = [];
|
|
1532
|
+
for (const key of Object.keys(options)) {
|
|
1533
|
+
if (KNOWN_TOP_LEVEL_KEYS.has(key)) continue;
|
|
1534
|
+
const renamedTo = RENAMED_KEYS[key];
|
|
1535
|
+
if (renamedTo !== void 0) {
|
|
1536
|
+
unknown.push({ key, renamedTo });
|
|
1537
|
+
continue;
|
|
1538
|
+
}
|
|
1539
|
+
const suggestion = nearestKnownConfigKey(key);
|
|
1540
|
+
unknown.push(suggestion === null ? { key } : { key, suggestion });
|
|
1541
|
+
}
|
|
1542
|
+
return unknown;
|
|
1543
|
+
}
|
|
1544
|
+
function unknownConfigKeysMessage(unknown) {
|
|
1545
|
+
const lines = unknown.map((entry) => {
|
|
1546
|
+
if (entry.renamedTo !== void 0) {
|
|
1547
|
+
return ` - \`${entry.key}\` was replaced by \`${entry.renamedTo}\``;
|
|
1548
|
+
}
|
|
1549
|
+
return entry.suggestion === void 0 ? ` - \`${entry.key}\`` : ` - \`${entry.key}\` \u2014 did you mean \`${entry.suggestion}\`?`;
|
|
1550
|
+
});
|
|
1551
|
+
return `[csszyx] ${unknown.length} plugin option(s) are not recognized and have no effect:
|
|
1552
|
+
${lines.join("\n")}
|
|
1553
|
+
An unread option is silent, so whatever you configured it for is not happening.`;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1715
1556
|
const GLOB_MAGIC_RE = /[*?[\]{}]/;
|
|
1716
1557
|
const DEFAULT_IGNORED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", ".next", ".turbo", "dist", "build"]);
|
|
1717
1558
|
function normalizeFileId(id) {
|
|
@@ -2061,41 +1902,6 @@ function isSameFileVersion(before, after) {
|
|
|
2061
1902
|
return before.dev === after.dev && before.ino === after.ino && before.size === after.size && before.mtimeNs === after.mtimeNs && before.ctimeNs === after.ctimeNs;
|
|
2062
1903
|
}
|
|
2063
1904
|
|
|
2064
|
-
function recordSzvRegistryFile(registry, filePath, content) {
|
|
2065
|
-
const key = normalizePathSeparators(filePath);
|
|
2066
|
-
const qualifies = content.includes("szv(") && content.includes("export");
|
|
2067
|
-
const entries = qualifies ? extractSzvRegistryEntries(content, filePath) : [];
|
|
2068
|
-
if (entries.length === 0) {
|
|
2069
|
-
registry.delete(key);
|
|
2070
|
-
return;
|
|
2071
|
-
}
|
|
2072
|
-
const byName = {};
|
|
2073
|
-
for (const entry of entries) {
|
|
2074
|
-
byName[entry.exportName] = entry.config;
|
|
2075
|
-
}
|
|
2076
|
-
registry.set(key, byName);
|
|
2077
|
-
}
|
|
2078
|
-
const SPECIFIER_PROBES = ["", ".ts", ".tsx", ".js", ".jsx", "/index.ts", "/index.tsx"];
|
|
2079
|
-
function resolveCrossModuleStaticsFor(registry, filename, source) {
|
|
2080
|
-
if (registry.size === 0 || !source.includes("from")) return void 0;
|
|
2081
|
-
const directory = path.dirname(filename);
|
|
2082
|
-
let resolved;
|
|
2083
|
-
for (const match of source.matchAll(/from\s*['"](\.[^'"]*)['"]/g)) {
|
|
2084
|
-
const specifier = match[1];
|
|
2085
|
-
if (resolved?.[specifier] !== void 0) continue;
|
|
2086
|
-
const base = normalizePathSeparators(path.resolve(directory, specifier));
|
|
2087
|
-
for (const probe of SPECIFIER_PROBES) {
|
|
2088
|
-
const entries = registry.get(`${base}${probe}`);
|
|
2089
|
-
if (entries !== void 0) {
|
|
2090
|
-
resolved ??= {};
|
|
2091
|
-
resolved[specifier] = entries;
|
|
2092
|
-
break;
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
return resolved;
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
1905
|
function generateThemeDts(opts) {
|
|
2100
1906
|
const { theme, sourceFiles } = opts;
|
|
2101
1907
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -2167,127 +1973,6 @@ function writeThemeDts(opts) {
|
|
|
2167
1973
|
writeFileSync(opts.outputPath, content, "utf-8");
|
|
2168
1974
|
}
|
|
2169
1975
|
|
|
2170
|
-
const VIRTUAL_MODULE_ID = "virtual:csszyx/mangle-map";
|
|
2171
|
-
const RESOLVED_VIRTUAL_MODULE_ID = `\0${VIRTUAL_MODULE_ID}`;
|
|
2172
|
-
const THEME_GROUPS_VIRTUAL_ID = "virtual:csszyx/theme-groups";
|
|
2173
|
-
const RESOLVED_THEME_GROUPS_VIRTUAL_ID = `\0${THEME_GROUPS_VIRTUAL_ID}`;
|
|
2174
|
-
const VIRTUAL_CHECKSUM_ID = "virtual:csszyx/checksum";
|
|
2175
|
-
const RESOLVED_VIRTUAL_CHECKSUM_ID = `\0${VIRTUAL_CHECKSUM_ID}`;
|
|
2176
|
-
function createMangleMapModule(mangleMap, checksum, varMangleMap = {}, cssVarMetrics = null) {
|
|
2177
|
-
return `/**
|
|
2178
|
-
* Auto-generated mangle map for csszyx.
|
|
2179
|
-
* This module is generated at build time and contains the mapping
|
|
2180
|
-
* from original class names and CSS variable names to mangled names.
|
|
2181
|
-
*
|
|
2182
|
-
* @generated
|
|
2183
|
-
*/
|
|
2184
|
-
|
|
2185
|
-
export const mangleMap = ${JSON.stringify(mangleMap, null, 2)};
|
|
2186
|
-
|
|
2187
|
-
export const varMangleMap = ${JSON.stringify(varMangleMap, null, 2)};
|
|
2188
|
-
|
|
2189
|
-
export const cssVarMetrics = ${JSON.stringify(cssVarMetrics, null, 2)};
|
|
2190
|
-
|
|
2191
|
-
export const checksum = ${JSON.stringify(checksum)};
|
|
2192
|
-
|
|
2193
|
-
export default {
|
|
2194
|
-
mangleMap,
|
|
2195
|
-
varMangleMap,
|
|
2196
|
-
cssVarMetrics,
|
|
2197
|
-
checksum,
|
|
2198
|
-
};
|
|
2199
|
-
`;
|
|
2200
|
-
}
|
|
2201
|
-
function createChecksumModule(checksum) {
|
|
2202
|
-
return `/**
|
|
2203
|
-
* Auto-generated checksum for csszyx mangle map.
|
|
2204
|
-
*
|
|
2205
|
-
* @generated
|
|
2206
|
-
*/
|
|
2207
|
-
|
|
2208
|
-
export const checksum = ${JSON.stringify(checksum)};
|
|
2209
|
-
|
|
2210
|
-
export default checksum;
|
|
2211
|
-
`;
|
|
2212
|
-
}
|
|
2213
|
-
function isVirtualModule(id) {
|
|
2214
|
-
return id === VIRTUAL_MODULE_ID || id === VIRTUAL_CHECKSUM_ID || id === THEME_GROUPS_VIRTUAL_ID || id === MANGLE_RUNTIME_VIRTUAL_ID;
|
|
2215
|
-
}
|
|
2216
|
-
function resolveVirtualModule(id) {
|
|
2217
|
-
if (id === VIRTUAL_MODULE_ID) {
|
|
2218
|
-
return RESOLVED_VIRTUAL_MODULE_ID;
|
|
2219
|
-
}
|
|
2220
|
-
if (id === VIRTUAL_CHECKSUM_ID) {
|
|
2221
|
-
return RESOLVED_VIRTUAL_CHECKSUM_ID;
|
|
2222
|
-
}
|
|
2223
|
-
if (id === THEME_GROUPS_VIRTUAL_ID) {
|
|
2224
|
-
return RESOLVED_THEME_GROUPS_VIRTUAL_ID;
|
|
2225
|
-
}
|
|
2226
|
-
if (id === MANGLE_RUNTIME_VIRTUAL_ID) {
|
|
2227
|
-
return RESOLVED_MANGLE_RUNTIME_VIRTUAL_ID;
|
|
2228
|
-
}
|
|
2229
|
-
return void 0;
|
|
2230
|
-
}
|
|
2231
|
-
const MANGLE_RUNTIME_VIRTUAL_ID = "virtual:csszyx/mangle-runtime";
|
|
2232
|
-
const RESOLVED_MANGLE_RUNTIME_VIRTUAL_ID = `\0${MANGLE_RUNTIME_VIRTUAL_ID}`;
|
|
2233
|
-
const MANGLE_MAP_PLACEHOLDER = "___CSSZYX_MANGLE_MAP___";
|
|
2234
|
-
const VAR_MANGLE_MAP_PLACEHOLDER = "___CSSZYX_VAR_MANGLE_MAP___";
|
|
2235
|
-
const CHECKSUM_PLACEHOLDER = "___CSSZYX_CHECKSUM___";
|
|
2236
|
-
function createMangleRuntimeModule(globalVarAliasPrefix) {
|
|
2237
|
-
return `/**
|
|
2238
|
-
* Auto-generated by csszyx: installs the runtime mangle map from the bundle.
|
|
2239
|
-
*
|
|
2240
|
-
* @generated
|
|
2241
|
-
*/
|
|
2242
|
-
|
|
2243
|
-
const m = ${MANGLE_MAP_PLACEHOLDER};
|
|
2244
|
-
const vm = ${VAR_MANGLE_MAP_PLACEHOLDER};
|
|
2245
|
-
const gp = ${JSON.stringify(globalVarAliasPrefix)};
|
|
2246
|
-
const checksum = "${CHECKSUM_PLACEHOLDER}";
|
|
2247
|
-
|
|
2248
|
-
if (typeof window !== 'undefined' && !window.__csszyx) {
|
|
2249
|
-
const r = {};
|
|
2250
|
-
const vr = {};
|
|
2251
|
-
for (const k in m) r[m[k]] = k;
|
|
2252
|
-
for (const vk in vm) {
|
|
2253
|
-
const vv = vm[vk];
|
|
2254
|
-
const vs = Array.isArray(vv) ? vv : [vv];
|
|
2255
|
-
for (const v of vs) (vr[v] || (vr[v] = [])).push(vk);
|
|
2256
|
-
}
|
|
2257
|
-
window.__csszyx = {
|
|
2258
|
-
mangleMap: m,
|
|
2259
|
-
varMangleMap: vm,
|
|
2260
|
-
checksum,
|
|
2261
|
-
decode: (c) => r[c],
|
|
2262
|
-
encode: (c) => m[c],
|
|
2263
|
-
decodeVar: (v) => vr[v] || [],
|
|
2264
|
-
encodeVar: (v) => vm[v],
|
|
2265
|
-
decodeGlobalVar: (v) => {
|
|
2266
|
-
const a = vr[v] || [];
|
|
2267
|
-
return v.indexOf(gp) === 0 ? a[0] : undefined;
|
|
2268
|
-
},
|
|
2269
|
-
decodeAll: (el) => (el.className || '').split(' ').map((c) => r[c] || c),
|
|
2270
|
-
};
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
export {};
|
|
2274
|
-
`;
|
|
2275
|
-
}
|
|
2276
|
-
function createThemeGroupsModule(tokens) {
|
|
2277
|
-
const payload = JSON.stringify({
|
|
2278
|
-
colors: tokens.colors,
|
|
2279
|
-
textSizes: tokens.textSizes,
|
|
2280
|
-
fontFamilies: tokens.fontFamilies,
|
|
2281
|
-
fontWeights: tokens.fontWeights
|
|
2282
|
-
});
|
|
2283
|
-
return [
|
|
2284
|
-
"// Auto-generated by csszyx from the @theme blocks in scanned CSS.",
|
|
2285
|
-
"import { registerSzcnGroups } from '@csszyx/runtime';",
|
|
2286
|
-
`registerSzcnGroups(${payload});`,
|
|
2287
|
-
"export {};"
|
|
2288
|
-
].join("\n");
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
1976
|
function registerWebpackAssetProcessor(compiler, processAssets) {
|
|
2292
1977
|
compiler.hooks.compilation.tap("csszyx:post", (compilation) => {
|
|
2293
1978
|
const stage = compiler.webpack?.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE || compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE;
|
|
@@ -2476,17 +2161,23 @@ function shouldWarnUnscopedMonorepo(sawTailwindEntry, tailwindEntryScoped, inMon
|
|
|
2476
2161
|
function unscopedMonorepoMessage() {
|
|
2477
2162
|
return '[csszyx] Tailwind content detection is UNSCOPED in a monorepo. Tailwind v4 climbs to the workspace root and scans sibling packages + docs (.md/.mdx/.txt are not ignored), which can generate phantom or broken url() classes and fail the build. Scope it in your Tailwind CSS entry:\n @import "tailwindcss" source(none);\n @source "."; /* this package, relative to the CSS file */\ncsszyx auto-injects @source for its generated classes, 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 }).';
|
|
2478
2163
|
}
|
|
2164
|
+
function resolveQuietMode(quiet) {
|
|
2165
|
+
if (quiet === true || quiet === "all") return "all";
|
|
2166
|
+
if (quiet === "nudges") return "nudges";
|
|
2167
|
+
return "off";
|
|
2168
|
+
}
|
|
2479
2169
|
function shouldEmitWarning(quiet, devOnly, isProduction) {
|
|
2480
|
-
|
|
2170
|
+
const mode = resolveQuietMode(quiet);
|
|
2171
|
+
if (mode === "all") {
|
|
2481
2172
|
return false;
|
|
2482
2173
|
}
|
|
2483
|
-
if (devOnly && isProduction) {
|
|
2174
|
+
if (devOnly && (isProduction || mode === "nudges")) {
|
|
2484
2175
|
return false;
|
|
2485
2176
|
}
|
|
2486
2177
|
return true;
|
|
2487
2178
|
}
|
|
2488
2179
|
function shouldEmitMissingCssFallback(quiet, message) {
|
|
2489
|
-
return
|
|
2180
|
+
return resolveQuietMode(quiet) !== "all" && szFallbackConsequenceOf(message) === "missing-css";
|
|
2490
2181
|
}
|
|
2491
2182
|
function emitMissingCssFallback(quiet, message, id, emit) {
|
|
2492
2183
|
if (shouldEmitMissingCssFallback(quiet, message)) emit(`[csszyx] ${id}
|
|
@@ -2596,11 +2287,13 @@ function isPackagesSkippedSource(id, sourceDirs = []) {
|
|
|
2596
2287
|
}
|
|
2597
2288
|
return !isCompileSourceOptedIn(p, sourceDirs);
|
|
2598
2289
|
}
|
|
2599
|
-
function skippedSzFilesMessage(files) {
|
|
2290
|
+
function skippedSzFilesMessage(files, szvExportFiles = []) {
|
|
2600
2291
|
const list = files.map((file) => ` - ${file}`).join("\n");
|
|
2601
|
-
|
|
2292
|
+
const registryClause = szvExportFiles.length === 0 ? "" : `
|
|
2293
|
+
${szvExportFiles.length} of them may export \`szv\` factories, so they stay out of the cross-module registry and every importer falls back to the runtime path.`;
|
|
2294
|
+
return `[csszyx] ${files.length} file(s) under packages/ use csszyx but were skipped by ignore rules:
|
|
2602
2295
|
${list}
|
|
2603
|
-
Add the package directory to \`compileSources\` (or move the file out of packages/) \u2014 otherwise their
|
|
2296
|
+
Add the package directory to \`compileSources\` (or move the file out of packages/) \u2014 otherwise their classes never reach the safelist.` + registryClause;
|
|
2604
2297
|
}
|
|
2605
2298
|
function computeSafelistRelPath(rootDir, safelistFilename, cssId) {
|
|
2606
2299
|
const safelistPath = normalizePathSeparators(path.join(rootDir, safelistFilename));
|
|
@@ -3241,12 +2934,12 @@ ${errors.join("\n")}`
|
|
|
3241
2934
|
if (config?.enabled === true) {
|
|
3242
2935
|
if (!config.tokens || config.tokens.length === 0) {
|
|
3243
2936
|
throw new Error(
|
|
3244
|
-
"[csszyx] production.mangleGlobalVars.enabled requires explicit tokens
|
|
2937
|
+
"[csszyx] production.mangleGlobalVars.enabled requires explicit tokens. Aliasing a property csszyx was not told about would rename references it cannot see."
|
|
3245
2938
|
);
|
|
3246
2939
|
}
|
|
3247
2940
|
if (config.autoPrefix !== void 0 && config.autoPrefix !== "") {
|
|
3248
2941
|
throw new Error(
|
|
3249
|
-
"[csszyx] production.mangleGlobalVars.autoPrefix
|
|
2942
|
+
"[csszyx] production.mangleGlobalVars.autoPrefix is not available: choosing tokens by prefix needs a CSS pre-scan that does not exist yet. List the tokens instead."
|
|
3250
2943
|
);
|
|
3251
2944
|
}
|
|
3252
2945
|
}
|
|
@@ -3254,8 +2947,10 @@ ${errors.join("\n")}`
|
|
|
3254
2947
|
function createCsszyxPlugins(options = {}) {
|
|
3255
2948
|
assertGlobalVarMangleConfig(options);
|
|
3256
2949
|
let manglingEnabled = options.production?.mangle === true;
|
|
3257
|
-
|
|
2950
|
+
const importedStaticSzEnabled = options.build?.importedStaticSz ?? DEFAULT_IMPORTED_STATIC_SZ;
|
|
3258
2951
|
const szvCrossModuleRegistry = /* @__PURE__ */ new Map();
|
|
2952
|
+
const szObjectProvidersExamined = /* @__PURE__ */ new Set();
|
|
2953
|
+
let specifierAliases = [];
|
|
3259
2954
|
const mangleReserved = new Set(options.production?.mangleExclude ?? []);
|
|
3260
2955
|
const mangleMapDelivery = options.production?.mangleMapDelivery ?? "both";
|
|
3261
2956
|
if (!["both", "html", "bundle"].includes(mangleMapDelivery)) {
|
|
@@ -3287,7 +2982,11 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3287
2982
|
);
|
|
3288
2983
|
}
|
|
3289
2984
|
const compileSources = options.compileSources ?? [];
|
|
3290
|
-
const quiet = options.quiet
|
|
2985
|
+
const quiet = resolveQuietMode(options.quiet);
|
|
2986
|
+
const unknownConfigKeys = findUnknownConfigKeys(options);
|
|
2987
|
+
if (unknownConfigKeys.length > 0) {
|
|
2988
|
+
emitWarning(unknownConfigKeysMessage(unknownConfigKeys));
|
|
2989
|
+
}
|
|
3291
2990
|
function emitWarning(message, opts = {}) {
|
|
3292
2991
|
if (shouldEmitWarning(quiet, opts.devOnly ?? false, process.env.NODE_ENV === "production")) {
|
|
3293
2992
|
console.warn(message);
|
|
@@ -3324,6 +3023,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3324
3023
|
const state = {
|
|
3325
3024
|
classes: /* @__PURE__ */ new Set(),
|
|
3326
3025
|
parsedTheme: null,
|
|
3026
|
+
scanCssTheme: null,
|
|
3327
3027
|
autoThemeCssFiles: [],
|
|
3328
3028
|
sawTailwindEntry: false,
|
|
3329
3029
|
sawAnyCss: false,
|
|
@@ -3332,6 +3032,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3332
3032
|
contentScopeWarningEmitted: false,
|
|
3333
3033
|
spreadWarnings: /* @__PURE__ */ new Set(),
|
|
3334
3034
|
skippedSzFiles: /* @__PURE__ */ new Set(),
|
|
3035
|
+
skippedSzvExportFiles: /* @__PURE__ */ new Set(),
|
|
3335
3036
|
skipWarningEmitted: false,
|
|
3336
3037
|
classesCapped: false,
|
|
3337
3038
|
ownedClasses: /* @__PURE__ */ new Set(),
|
|
@@ -3426,56 +3127,14 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3426
3127
|
}
|
|
3427
3128
|
}
|
|
3428
3129
|
function runAutoThemeScan(rootDir) {
|
|
3429
|
-
if (options.build?.scanCss) {
|
|
3430
|
-
return;
|
|
3431
|
-
}
|
|
3432
3130
|
refreshCompileSourceDirs();
|
|
3433
|
-
const
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
}
|
|
3441
|
-
for (const entry of entries) {
|
|
3442
|
-
if (entry.isDirectory()) {
|
|
3443
|
-
if (!IGNORE_DIRS.has(entry.name) && !entry.name.startsWith(".")) {
|
|
3444
|
-
walk(path.join(dir, entry.name));
|
|
3445
|
-
}
|
|
3446
|
-
continue;
|
|
3447
|
-
}
|
|
3448
|
-
if (entry.name.endsWith(".css")) {
|
|
3449
|
-
cssFiles.push(path.join(dir, entry.name));
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
};
|
|
3453
|
-
walk(rootDir);
|
|
3454
|
-
const normRoot = normalizeForMatch(rootDir);
|
|
3455
|
-
for (const sourceDir of compileSourceDirs) {
|
|
3456
|
-
if (sourceDir === normRoot || sourceDir.startsWith(`${normRoot}/`)) {
|
|
3457
|
-
continue;
|
|
3458
|
-
}
|
|
3459
|
-
walk(sourceDir);
|
|
3460
|
-
}
|
|
3461
|
-
const themes = [];
|
|
3462
|
-
const themeFiles = [];
|
|
3463
|
-
for (const file of cssFiles) {
|
|
3464
|
-
let content;
|
|
3465
|
-
try {
|
|
3466
|
-
content = fs.readFileSync(file, "utf-8");
|
|
3467
|
-
} catch {
|
|
3468
|
-
continue;
|
|
3469
|
-
}
|
|
3470
|
-
if (!content.includes("@theme")) {
|
|
3471
|
-
continue;
|
|
3472
|
-
}
|
|
3473
|
-
themes.push(parseThemeBlocks(content));
|
|
3474
|
-
themeFiles.push(file);
|
|
3475
|
-
}
|
|
3476
|
-
state.autoThemeCssFiles = themeFiles;
|
|
3477
|
-
if (themes.length > 0) {
|
|
3478
|
-
state.parsedTheme = mergeThemes(themes);
|
|
3131
|
+
const discovered = discoverProjectTheme(rootDir, [...compileSourceDirs]);
|
|
3132
|
+
state.autoThemeCssFiles = discovered.files;
|
|
3133
|
+
const sources = [state.scanCssTheme, discovered.theme].filter(
|
|
3134
|
+
(theme) => theme !== null
|
|
3135
|
+
);
|
|
3136
|
+
if (sources.length > 0) {
|
|
3137
|
+
state.parsedTheme = mergeThemes(sources);
|
|
3479
3138
|
}
|
|
3480
3139
|
}
|
|
3481
3140
|
function isHardIgnored(id) {
|
|
@@ -3494,10 +3153,14 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3494
3153
|
const crossModuleStatics = resolveCrossModuleStaticsFor(
|
|
3495
3154
|
szvCrossModuleRegistry,
|
|
3496
3155
|
filename,
|
|
3497
|
-
source
|
|
3156
|
+
source,
|
|
3157
|
+
specifierAliases
|
|
3498
3158
|
);
|
|
3499
|
-
if (crossModuleStatics !== void 0) {
|
|
3500
|
-
compilerOptions.crossModuleStatics = crossModuleStatics;
|
|
3159
|
+
if (crossModuleStatics.szvConfigs !== void 0) {
|
|
3160
|
+
compilerOptions.crossModuleStatics = crossModuleStatics.szvConfigs;
|
|
3161
|
+
}
|
|
3162
|
+
if (crossModuleStatics.szObjects !== void 0) {
|
|
3163
|
+
compilerOptions.crossModuleSzObjects = crossModuleStatics.szObjects;
|
|
3501
3164
|
}
|
|
3502
3165
|
const cacheRoot = resolveTransformCacheDir(state.rootDir, options.build?.cacheDir);
|
|
3503
3166
|
if (cacheEnabled) {
|
|
@@ -3614,6 +3277,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3614
3277
|
// module A's config change must miss B's cached transform, or the
|
|
3615
3278
|
// cache serves a stale table.
|
|
3616
3279
|
crossModuleStatics: compilerOptions.crossModuleStatics === void 0 ? void 0 : JSON.stringify(compilerOptions.crossModuleStatics),
|
|
3280
|
+
crossModuleSzObjects: compilerOptions.crossModuleSzObjects === void 0 ? void 0 : JSON.stringify(compilerOptions.crossModuleSzObjects),
|
|
3617
3281
|
filename: effectiveFilename,
|
|
3618
3282
|
source
|
|
3619
3283
|
};
|
|
@@ -3622,19 +3286,35 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3622
3286
|
if (parserMode !== "rust" || files.length <= 1) {
|
|
3623
3287
|
return transformPrescanSourcesIndividually(files);
|
|
3624
3288
|
}
|
|
3289
|
+
const perFile = [];
|
|
3290
|
+
const batchable = [];
|
|
3291
|
+
for (const file of files) {
|
|
3292
|
+
(hasCrossModuleStatics(file) ? perFile : batchable).push(file);
|
|
3293
|
+
}
|
|
3294
|
+
const individual = transformPrescanSourcesIndividually(perFile);
|
|
3625
3295
|
const compilerOptions = createCompilerOptions(prescanAstBudget);
|
|
3626
3296
|
const cacheRoot = resolveTransformCacheDir(state.rootDir, options.build?.cacheDir);
|
|
3627
3297
|
const results = /* @__PURE__ */ new Map();
|
|
3628
3298
|
if (cacheEnabled) evictTransformCacheOnce();
|
|
3629
3299
|
ensureRustTransformAvailable();
|
|
3630
|
-
const misses = collectRustPrescanMisses(
|
|
3631
|
-
if (misses.length
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3300
|
+
const misses = collectRustPrescanMisses(batchable, compilerOptions, cacheRoot, results);
|
|
3301
|
+
if (misses.length > 0) {
|
|
3302
|
+
try {
|
|
3303
|
+
runRustPrescanBatch(misses, compilerOptions, cacheRoot, results);
|
|
3304
|
+
} catch {
|
|
3305
|
+
runRustPrescanFallback(misses, results);
|
|
3306
|
+
}
|
|
3636
3307
|
}
|
|
3637
|
-
return orderPrescanResults(
|
|
3308
|
+
return [...individual, ...orderPrescanResults(batchable, results)];
|
|
3309
|
+
}
|
|
3310
|
+
function hasCrossModuleStatics(file) {
|
|
3311
|
+
const resolved = resolveCrossModuleStaticsFor(
|
|
3312
|
+
szvCrossModuleRegistry,
|
|
3313
|
+
file.filePath,
|
|
3314
|
+
file.content,
|
|
3315
|
+
specifierAliases
|
|
3316
|
+
);
|
|
3317
|
+
return resolved.szvConfigs !== void 0 || resolved.szObjects !== void 0;
|
|
3638
3318
|
}
|
|
3639
3319
|
function collectRustPrescanMisses(files, compilerOptions, cacheRoot, results) {
|
|
3640
3320
|
const misses = [];
|
|
@@ -3782,7 +3462,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3782
3462
|
}
|
|
3783
3463
|
}
|
|
3784
3464
|
function recordPackagesSkipIfSz(filePath) {
|
|
3785
|
-
if (!isPackagesSkippedSource(filePath, compileSourceDirs)) {
|
|
3465
|
+
if (state.skippedSzFiles.has(filePath) || !isPackagesSkippedSource(filePath, compileSourceDirs)) {
|
|
3786
3466
|
return;
|
|
3787
3467
|
}
|
|
3788
3468
|
let content;
|
|
@@ -3791,8 +3471,12 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3791
3471
|
} catch {
|
|
3792
3472
|
return;
|
|
3793
3473
|
}
|
|
3794
|
-
if (
|
|
3795
|
-
|
|
3474
|
+
if (!fileMayContainSafelistableSz(content)) {
|
|
3475
|
+
return;
|
|
3476
|
+
}
|
|
3477
|
+
state.skippedSzFiles.add(filePath);
|
|
3478
|
+
if (mayExportSzvFactories(content)) {
|
|
3479
|
+
state.skippedSzvExportFiles.add(filePath);
|
|
3796
3480
|
}
|
|
3797
3481
|
}
|
|
3798
3482
|
function processPrescanTransform(filePath, content, result, discoveredClasses, rawDiscoveredClasses) {
|
|
@@ -3823,13 +3507,73 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3823
3507
|
}
|
|
3824
3508
|
collectPrescanResult(result, filePath, discoveredClasses, rawDiscoveredClasses);
|
|
3825
3509
|
}
|
|
3510
|
+
function refreshSzvRegistryEntry(filePath, content) {
|
|
3511
|
+
if (!shouldProcessSource(filePath)) return;
|
|
3512
|
+
if (content === null) {
|
|
3513
|
+
szvCrossModuleRegistry.delete(normalizePathSeparators(filePath));
|
|
3514
|
+
return;
|
|
3515
|
+
}
|
|
3516
|
+
recordSzvRegistryFile(szvCrossModuleRegistry, filePath, content);
|
|
3517
|
+
if (importedStaticSzEnabled) {
|
|
3518
|
+
recordSzObjectRegistryFile(szvCrossModuleRegistry, filePath, content);
|
|
3519
|
+
szObjectProvidersExamined.add(normalizePathSeparators(filePath));
|
|
3520
|
+
recordProvidersDemandedBy(filePath, content);
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
function recordProvidersDemandedBy(filePath, content) {
|
|
3524
|
+
if (!fileMayContainSafelistableSz(content)) return;
|
|
3525
|
+
const directory = path.dirname(filePath);
|
|
3526
|
+
for (const specifier of importedSpecifiersIn(content)) {
|
|
3527
|
+
for (const base of specifierBases(specifier, directory, specifierAliases)) {
|
|
3528
|
+
const providerPath = resolveProviderPathWith(base, isReadableProviderFile);
|
|
3529
|
+
if (providerPath === void 0) continue;
|
|
3530
|
+
const key = normalizePathSeparators(providerPath);
|
|
3531
|
+
if (!szObjectProvidersExamined.has(key)) {
|
|
3532
|
+
szObjectProvidersExamined.add(key);
|
|
3533
|
+
readAndRecordSzObjectProvider(providerPath);
|
|
3534
|
+
}
|
|
3535
|
+
break;
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
function readAndRecordSzObjectProvider(providerPath) {
|
|
3540
|
+
let content;
|
|
3541
|
+
try {
|
|
3542
|
+
content = fs.readFileSync(providerPath, "utf-8");
|
|
3543
|
+
} catch {
|
|
3544
|
+
return;
|
|
3545
|
+
}
|
|
3546
|
+
recordSzObjectRegistryFile(szvCrossModuleRegistry, providerPath, content);
|
|
3547
|
+
}
|
|
3548
|
+
function recordDemandedSzObjectProviders(seenSourcePaths, demand) {
|
|
3549
|
+
for (const base of demand) {
|
|
3550
|
+
const providerPath = resolveProviderPath(seenSourcePaths, base);
|
|
3551
|
+
if (providerPath === void 0) continue;
|
|
3552
|
+
szObjectProvidersExamined.add(normalizePathSeparators(providerPath));
|
|
3553
|
+
readAndRecordSzObjectProvider(providerPath);
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
function refreshSzvRegistryEntryFromDisk(filePath) {
|
|
3557
|
+
if (!shouldProcessSource(filePath)) return;
|
|
3558
|
+
let content;
|
|
3559
|
+
try {
|
|
3560
|
+
content = fs.readFileSync(filePath, "utf-8");
|
|
3561
|
+
} catch {
|
|
3562
|
+
refreshSzvRegistryEntry(filePath, null);
|
|
3563
|
+
return;
|
|
3564
|
+
}
|
|
3565
|
+
refreshSzvRegistryEntry(filePath, content);
|
|
3566
|
+
}
|
|
3826
3567
|
function prescanAndWriteClasses() {
|
|
3827
3568
|
refreshCompileSourceDirs();
|
|
3828
3569
|
szvCrossModuleRegistry.clear();
|
|
3570
|
+
szObjectProvidersExamined.clear();
|
|
3829
3571
|
const prescanStarted = performance.now();
|
|
3830
3572
|
const discoveredClasses = /* @__PURE__ */ new Set();
|
|
3831
3573
|
const rawDiscoveredClasses = /* @__PURE__ */ new Set();
|
|
3832
3574
|
const prescanSources = [];
|
|
3575
|
+
const seenSourcePaths = /* @__PURE__ */ new Set();
|
|
3576
|
+
const szObjectDemand = /* @__PURE__ */ new Set();
|
|
3833
3577
|
function collectPrescanSource(filePath) {
|
|
3834
3578
|
if (!shouldProcessSource(filePath)) {
|
|
3835
3579
|
recordPackagesSkipIfSz(filePath);
|
|
@@ -3843,12 +3587,22 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3843
3587
|
}
|
|
3844
3588
|
recordAuthoredClasses(content);
|
|
3845
3589
|
recordSzvRegistryEntries(filePath, content);
|
|
3590
|
+
seenSourcePaths.add(normalizePathSeparators(filePath));
|
|
3846
3591
|
if (fileMayContainSafelistableSz(content)) {
|
|
3847
3592
|
prescanSources.push({ filePath, content });
|
|
3593
|
+
recordSzObjectDemand(filePath, content);
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
function recordSzObjectDemand(filePath, content) {
|
|
3597
|
+
if (!importedStaticSzEnabled) return;
|
|
3598
|
+
const directory = path.dirname(filePath);
|
|
3599
|
+
for (const specifier of importedSpecifiersIn(content)) {
|
|
3600
|
+
for (const base of specifierBases(specifier, directory, specifierAliases)) {
|
|
3601
|
+
szObjectDemand.add(base);
|
|
3602
|
+
}
|
|
3848
3603
|
}
|
|
3849
3604
|
}
|
|
3850
3605
|
function recordSzvRegistryEntries(filePath, content) {
|
|
3851
|
-
if (!crossModuleRegistryEnabled) return;
|
|
3852
3606
|
recordSzvRegistryFile(szvCrossModuleRegistry, filePath, content);
|
|
3853
3607
|
}
|
|
3854
3608
|
function scanDir(dir) {
|
|
@@ -3878,6 +3632,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
3878
3632
|
}
|
|
3879
3633
|
scanDir(sourceDir);
|
|
3880
3634
|
}
|
|
3635
|
+
recordDemandedSzObjectProviders(seenSourcePaths, szObjectDemand);
|
|
3881
3636
|
const prescanContentByPath = new Map(
|
|
3882
3637
|
prescanSources.map((file) => [file.filePath, file.content])
|
|
3883
3638
|
);
|
|
@@ -4103,7 +3858,7 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4103
3858
|
}
|
|
4104
3859
|
emitMissingCssFallback(quiet, message, id, console.warn);
|
|
4105
3860
|
}
|
|
4106
|
-
if (quiet || result.diagnostics.length === 0 || process.env.NODE_ENV === "production") {
|
|
3861
|
+
if (quiet !== "off" || result.diagnostics.length === 0 || process.env.NODE_ENV === "production") {
|
|
4107
3862
|
return;
|
|
4108
3863
|
}
|
|
4109
3864
|
for (const message of result.diagnostics) {
|
|
@@ -4196,10 +3951,29 @@ function createCsszyxPlugins(options = {}) {
|
|
|
4196
3951
|
`;
|
|
4197
3952
|
return insertRuntimeImport(current, importStatement);
|
|
4198
3953
|
}
|
|
3954
|
+
function themeGroupTokens() {
|
|
3955
|
+
const theme = state.parsedTheme;
|
|
3956
|
+
return {
|
|
3957
|
+
colors: theme?.colors ?? [],
|
|
3958
|
+
textSizes: theme?.textSizes ?? [],
|
|
3959
|
+
fontFamilies: theme?.fonts ?? [],
|
|
3960
|
+
fontWeights: theme?.fontWeights ?? []
|
|
3961
|
+
};
|
|
3962
|
+
}
|
|
4199
3963
|
function injectThemeGroups(code, transformedCode, id, usesSzcn) {
|
|
4200
|
-
if (!usesSzcn && !/\bszcn\s*\(/.test(code) || transformedCode.includes(THEME_GROUPS_VIRTUAL_ID) || !shouldProcessSource(id)) {
|
|
3964
|
+
if (!usesSzcn && !/\bszcn\s*\(/.test(code) || transformedCode.includes(THEME_GROUPS_VIRTUAL_ID) || transformedCode.includes(THEME_GROUPS_FILE_MARKER) || !shouldProcessSource(id)) {
|
|
4201
3965
|
return null;
|
|
4202
3966
|
}
|
|
3967
|
+
if (activeFramework === "webpack") {
|
|
3968
|
+
const groups = ensureThemeGroupsFile(
|
|
3969
|
+
state.rootDir,
|
|
3970
|
+
path.join(state.rootDir, ".csszyx")
|
|
3971
|
+
);
|
|
3972
|
+
if (groups.file === null) return null;
|
|
3973
|
+
const [from] = id.split("?");
|
|
3974
|
+
return `import '${themeGroupsSpecifier(from, groups.file)}';
|
|
3975
|
+
${transformedCode}`;
|
|
3976
|
+
}
|
|
4203
3977
|
return `import '${THEME_GROUPS_VIRTUAL_ID}';
|
|
4204
3978
|
${transformedCode}`;
|
|
4205
3979
|
}
|
|
@@ -4283,13 +4057,7 @@ ${transformedCode}`;
|
|
|
4283
4057
|
return createMangleRuntimeModule(globalVarAliasPrefix);
|
|
4284
4058
|
}
|
|
4285
4059
|
if (id === RESOLVED_THEME_GROUPS_VIRTUAL_ID) {
|
|
4286
|
-
|
|
4287
|
-
return createThemeGroupsModule({
|
|
4288
|
-
colors: theme?.colors ?? [],
|
|
4289
|
-
textSizes: theme?.textSizes ?? [],
|
|
4290
|
-
fontFamilies: theme?.fonts ?? [],
|
|
4291
|
-
fontWeights: theme?.fontWeights ?? []
|
|
4292
|
-
});
|
|
4060
|
+
return createThemeGroupsModule(themeGroupTokens());
|
|
4293
4061
|
}
|
|
4294
4062
|
return null;
|
|
4295
4063
|
},
|
|
@@ -4303,7 +4071,11 @@ ${transformedCode}`;
|
|
|
4303
4071
|
if (shouldProcessCss(id)) {
|
|
4304
4072
|
return true;
|
|
4305
4073
|
}
|
|
4306
|
-
|
|
4074
|
+
if (shouldProcessSource(id)) {
|
|
4075
|
+
return true;
|
|
4076
|
+
}
|
|
4077
|
+
recordPackagesSkipIfSz(id);
|
|
4078
|
+
return false;
|
|
4307
4079
|
},
|
|
4308
4080
|
/**
|
|
4309
4081
|
* Core transform: detects sz prop, compiles to className, injects runtime, collects classes.
|
|
@@ -4390,9 +4162,13 @@ ${transformedCode}`;
|
|
|
4390
4162
|
}
|
|
4391
4163
|
if (!state.skipWarningEmitted && state.skippedSzFiles.size > 0) {
|
|
4392
4164
|
state.skipWarningEmitted = true;
|
|
4393
|
-
emitWarning(
|
|
4394
|
-
|
|
4395
|
-
|
|
4165
|
+
emitWarning(
|
|
4166
|
+
skippedSzFilesMessage(
|
|
4167
|
+
sortStrings$1(state.skippedSzFiles),
|
|
4168
|
+
sortStrings$1(state.skippedSzvExportFiles)
|
|
4169
|
+
),
|
|
4170
|
+
{ devOnly: state.skippedSzvExportFiles.size === 0 }
|
|
4171
|
+
);
|
|
4396
4172
|
}
|
|
4397
4173
|
if (state.classesCapped) {
|
|
4398
4174
|
emitWarning(
|
|
@@ -4414,7 +4190,10 @@ ${transformedCode}`;
|
|
|
4414
4190
|
recordGlobalVarSourceFile(state, id, null);
|
|
4415
4191
|
recordFileVarMangleEntries(state, id, []);
|
|
4416
4192
|
recordFileCSSVariableMetrics(state, id, null);
|
|
4193
|
+
refreshSzvRegistryEntry(id, null);
|
|
4194
|
+
return;
|
|
4417
4195
|
}
|
|
4196
|
+
refreshSzvRegistryEntryFromDisk(id);
|
|
4418
4197
|
},
|
|
4419
4198
|
/**
|
|
4420
4199
|
* Webpack hook: pre-scans source files before compilation for Tailwind class discovery.
|
|
@@ -4422,12 +4201,13 @@ ${transformedCode}`;
|
|
|
4422
4201
|
*/
|
|
4423
4202
|
webpack(compiler) {
|
|
4424
4203
|
activeFramework = "webpack";
|
|
4204
|
+
compiler.hooks?.beforeCompile?.tap?.("csszyx:theme-groups", () => {
|
|
4205
|
+
const root = compiler.context || process.cwd();
|
|
4206
|
+
ensureThemeGroupsFile(root, path.join(root, ".csszyx"));
|
|
4207
|
+
});
|
|
4425
4208
|
if (compiler.options?.mode === "development") {
|
|
4426
4209
|
manglingEnabled = false;
|
|
4427
4210
|
}
|
|
4428
|
-
if (compiler.watchMode === true || compiler.options?.watch === true) {
|
|
4429
|
-
crossModuleRegistryEnabled = false;
|
|
4430
|
-
}
|
|
4431
4211
|
if (manglingEnabled && mangleMapDelivery !== "both") {
|
|
4432
4212
|
console.warn(
|
|
4433
4213
|
`[csszyx] production.mangleMapDelivery: '${mangleMapDelivery}' has no effect on the webpack lane \u2014 map delivery only narrows on vite/rollup builds.`
|
|
@@ -4437,11 +4217,21 @@ ${transformedCode}`;
|
|
|
4437
4217
|
announceActiveParser();
|
|
4438
4218
|
const root = compiler.context || process.cwd();
|
|
4439
4219
|
state.rootDir = root;
|
|
4220
|
+
specifierAliases = collectSpecifierAliases(
|
|
4221
|
+
root,
|
|
4222
|
+
compiler.options?.resolve?.alias
|
|
4223
|
+
);
|
|
4440
4224
|
evictTransformCacheOnce();
|
|
4441
4225
|
if (state.classes.size === 0) {
|
|
4442
4226
|
prescanAndWriteClasses();
|
|
4443
4227
|
}
|
|
4444
|
-
|
|
4228
|
+
for (const changed of compiler.modifiedFiles ?? []) {
|
|
4229
|
+
refreshSzvRegistryEntryFromDisk(changed);
|
|
4230
|
+
}
|
|
4231
|
+
for (const removed of compiler.removedFiles ?? []) {
|
|
4232
|
+
refreshSzvRegistryEntry(removed, null);
|
|
4233
|
+
}
|
|
4234
|
+
state.scanCssTheme = runThemeScan(root, options.build?.scanCss) ?? state.scanCssTheme;
|
|
4445
4235
|
runAutoThemeScan(root);
|
|
4446
4236
|
});
|
|
4447
4237
|
if (options.build?.scanCss) {
|
|
@@ -4457,10 +4247,6 @@ ${transformedCode}`;
|
|
|
4457
4247
|
/** Records the rollup lane for the mangle-runtime gate. */
|
|
4458
4248
|
buildStart() {
|
|
4459
4249
|
activeFramework = "rollup";
|
|
4460
|
-
const meta = this.meta;
|
|
4461
|
-
if (meta?.watchMode) {
|
|
4462
|
-
crossModuleRegistryEnabled = false;
|
|
4463
|
-
}
|
|
4464
4250
|
}
|
|
4465
4251
|
},
|
|
4466
4252
|
vite: {
|
|
@@ -4474,16 +4260,13 @@ ${transformedCode}`;
|
|
|
4474
4260
|
announceActiveParser();
|
|
4475
4261
|
const root = config.root || process.cwd();
|
|
4476
4262
|
state.rootDir = root;
|
|
4263
|
+
specifierAliases = collectSpecifierAliases(root, config.resolve?.alias);
|
|
4477
4264
|
if (config.command === "serve") {
|
|
4478
4265
|
manglingEnabled = false;
|
|
4479
|
-
crossModuleRegistryEnabled = false;
|
|
4480
|
-
}
|
|
4481
|
-
if (config.build?.watch) {
|
|
4482
|
-
crossModuleRegistryEnabled = false;
|
|
4483
4266
|
}
|
|
4484
4267
|
evictTransformCacheOnce();
|
|
4485
4268
|
prescanAndWriteClasses();
|
|
4486
|
-
state.
|
|
4269
|
+
state.scanCssTheme = runThemeScan(root, options.build?.scanCss) ?? state.scanCssTheme;
|
|
4487
4270
|
runAutoThemeScan(root);
|
|
4488
4271
|
},
|
|
4489
4272
|
/**
|
|
@@ -4502,15 +4285,17 @@ ${transformedCode}`;
|
|
|
4502
4285
|
ctx.server.moduleGraph.invalidateModule(themeGroupsModule);
|
|
4503
4286
|
}
|
|
4504
4287
|
};
|
|
4505
|
-
if (
|
|
4288
|
+
if (ctx.file.endsWith(".css")) {
|
|
4506
4289
|
const root = ctx.server.config.root || process.cwd();
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4290
|
+
const before = createThemeGroupsModule(themeGroupTokens());
|
|
4291
|
+
if (scanCss && matchesAnyPattern(ctx.file, scanCss, root)) {
|
|
4292
|
+
state.scanCssTheme = runThemeScan(root, scanCss) ?? state.scanCssTheme;
|
|
4510
4293
|
}
|
|
4511
|
-
|
|
4512
|
-
runAutoThemeScan(ctx.server.config.root || process.cwd());
|
|
4294
|
+
runAutoThemeScan(root);
|
|
4513
4295
|
reloadThemeGroupsModule();
|
|
4296
|
+
if (createThemeGroupsModule(themeGroupTokens()) !== before) {
|
|
4297
|
+
ctx.server.ws.send({ type: "full-reload" });
|
|
4298
|
+
}
|
|
4514
4299
|
}
|
|
4515
4300
|
if (!shouldProcessSource(ctx.file)) {
|
|
4516
4301
|
return;
|
|
@@ -4519,8 +4304,10 @@ ${transformedCode}`;
|
|
|
4519
4304
|
try {
|
|
4520
4305
|
fileContent = fs.readFileSync(ctx.file, "utf-8");
|
|
4521
4306
|
} catch {
|
|
4307
|
+
refreshSzvRegistryEntry(ctx.file, null);
|
|
4522
4308
|
return;
|
|
4523
4309
|
}
|
|
4310
|
+
refreshSzvRegistryEntry(ctx.file, fileContent);
|
|
4524
4311
|
if (!fileContent.includes("sz=") && !fileContent.includes("szs=") && !/\bsz\s*:\s*["'{]/.test(fileContent)) {
|
|
4525
4312
|
trackGlobalVarSourceFile(ctx.file, fileContent);
|
|
4526
4313
|
recordFileVarMangleEntries(state, ctx.file, []);
|
|
@@ -4755,7 +4542,9 @@ ${transformedCode}`;
|
|
|
4755
4542
|
collectRollupGlobalVarCssAssets(bundle)
|
|
4756
4543
|
);
|
|
4757
4544
|
const shouldMangle = manglingEnabled && Object.keys(state.mangleMap).length > 0;
|
|
4758
|
-
|
|
4545
|
+
if (options.build?.emitManifest === true) {
|
|
4546
|
+
emitAsset("csszyx-manifest.json", JSON.stringify(createBundleManifest(shouldMangle)));
|
|
4547
|
+
}
|
|
4759
4548
|
if (shouldEmitGlobalVarMapAsset(globalVarMangleConfig)) {
|
|
4760
4549
|
const globalVarMap = createGlobalVarMapAssetSource(
|
|
4761
4550
|
state.varMangleMap,
|
|
@@ -4856,4 +4645,4 @@ const esbuildPlugin = (options = {}) => {
|
|
|
4856
4645
|
};
|
|
4857
4646
|
};
|
|
4858
4647
|
|
|
4859
|
-
export {
|
|
4648
|
+
export { vitePlugin as $, isMonorepoPackage as A, isPackagesSkippedSource as B, isRSCServerModule as C, isTailwindReservedGlobalVar as D, mangleCodeClassesSync as E, mangleEligibleClasses as F, mangleHybridHazardMessage as G, missingTailwindEntryMessage as H, normalizeGlobalVarAliasesForCache as I, planGlobalVarAliases as J, readGlobalVarScanCache as K, recordGlobalVarSourceFile as L, resolveCompileSourceDirs as M, resolveGlobalVarScanCacheDir as N, resolveNativeCacheIdentity as O, resolveQuietMode as P, rewriteGlobalVarCssAliases as Q, rollupPlugin as R, scanGlobalVarCss as S, shouldEmitMissingCssFallback as T, shouldEmitWarning as U, shouldTrackGlobalVarSources as V, shouldWarnMissingTailwindEntry as W, shouldWarnUnscopedMonorepo as X, skippedSzFilesMessage as Y, unscopedMonorepoMessage as Z, validateGlobalVarAliasInputs as _, allocateMangleTokens as a, webpackPlugin as a0, writeGlobalVarScanCache as a1, appendTailwindSourceDirective as b, assertNoRSCBoundaryViolation as c, assertNoRSCGraphViolation as d, collectMangleHybridHazards as e, computeSafelistRelPath as f, createGlobalVarAliasValidationOptions as g, createGlobalVarMapAssetSource as h, createGlobalVarScanCacheKey as i, createRSCModuleRecord as j, cssHasContentScope as k, cssImportsTailwind as l, deleteRSCModuleRecord as m, emitMissingCssFallback as n, esbuildPlugin as o, extractGlobalVarAliasesForManifest as p, fileMayContainSafelistableSz as q, findLocalImportSources as r, findRSCBoundaryViolation as s, findRSCGraphViolation as t, unplugin as u, hasInjectableTailwindCandidate as v, hasUseClientDirective as w, hasUseServerDirective as x, isCompileSourceOptedIn as y, isHardIgnoredPath as z };
|