@csszyx/unplugin 0.10.7 → 0.10.9

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.
@@ -13,7 +13,7 @@ const types = require('@csszyx/types');
13
13
  const vueAdapter = require('@csszyx/vue-adapter');
14
14
  const unplugin$1 = require('unplugin');
15
15
  const cssMangler = require('../css-mangler.cjs');
16
- const htmlEscape = require('./unplugin.DoBHTRra.cjs');
16
+ const htmlEscape = require('./unplugin.BCwRIUs_.cjs');
17
17
  const node_crypto = require('node:crypto');
18
18
  const transformCache = require('./unplugin.pmTknYLy.cjs');
19
19
  const postcss = require('postcss');
@@ -165,7 +165,7 @@ function scanGlobalVarCss(css, options = {}) {
165
165
  filePath,
166
166
  definitions,
167
167
  references,
168
- registered: [...registered].sort(),
168
+ registered: htmlEscape.sortStrings(registered),
169
169
  thirdParty: isThirdPartyCssPath(filePath)
170
170
  };
171
171
  }
@@ -184,7 +184,7 @@ function extractVarReferences(value) {
184
184
  for (const match of value.matchAll(VAR_REFERENCE_RE)) {
185
185
  references.add(match[1]);
186
186
  }
187
- return [...references].sort();
187
+ return htmlEscape.sortStrings(references);
188
188
  }
189
189
  function isThirdPartyCssPath(filePath) {
190
190
  return filePath.split(/[\\/]/).includes("node_modules");
@@ -225,9 +225,9 @@ function planGlobalVarAliases(input) {
225
225
  entries.push({
226
226
  original,
227
227
  alias,
228
- scopes: [
229
- ...new Set((definitions.get(original) ?? []).map((definition) => definition.scopeId))
230
- ].sort()
228
+ scopes: htmlEscape.sortStrings(
229
+ new Set((definitions.get(original) ?? []).map((definition) => definition.scopeId))
230
+ )
231
231
  });
232
232
  }
233
233
  return {
@@ -260,7 +260,7 @@ function collectCandidates(input, definitions) {
260
260
  }
261
261
  }
262
262
  }
263
- return [...candidates].sort();
263
+ return htmlEscape.sortStrings(candidates);
264
264
  }
265
265
  function validateCandidates(candidates, definitions, reserved, aliasPrefix) {
266
266
  const diagnostics = [];
@@ -913,7 +913,7 @@ function readImportedSymbols(clause) {
913
913
  if (!trimmed || trimmed.startsWith("type ")) {
914
914
  continue;
915
915
  }
916
- const sourceName = trimmed.replace(/^type[ \t]+/, "").split(/[ \t]+as[ \t]+/)[0]?.trim();
916
+ const sourceName = trimmed.replace(/^type[ \t]+/, "").split(/(?<![ \t])[ \t]+as[ \t]+/)[0]?.trim();
917
917
  if (sourceName) {
918
918
  symbols.push(sourceName);
919
919
  }
@@ -1134,12 +1134,12 @@ function parseThemeBlocks(cssContent) {
1134
1134
  }
1135
1135
  }
1136
1136
  return {
1137
- colors: [...result.colors].sort(),
1138
- spacings: [...result.spacings].sort(),
1139
- fonts: [...result.fonts].sort(),
1140
- radii: [...result.radii].sort(),
1141
- shadows: [...result.shadows].sort(),
1142
- breakpoints: [...result.breakpoints].sort()
1137
+ colors: htmlEscape.sortStrings(result.colors),
1138
+ spacings: htmlEscape.sortStrings(result.spacings),
1139
+ fonts: htmlEscape.sortStrings(result.fonts),
1140
+ radii: htmlEscape.sortStrings(result.radii),
1141
+ shadows: htmlEscape.sortStrings(result.shadows),
1142
+ breakpoints: htmlEscape.sortStrings(result.breakpoints)
1143
1143
  };
1144
1144
  }
1145
1145
  function mergeThemes(themes) {
@@ -1162,12 +1162,12 @@ function mergeThemes(themes) {
1162
1162
  }
1163
1163
  }
1164
1164
  return {
1165
- colors: [...merged.colors].sort(),
1166
- spacings: [...merged.spacings].sort(),
1167
- fonts: [...merged.fonts].sort(),
1168
- radii: [...merged.radii].sort(),
1169
- shadows: [...merged.shadows].sort(),
1170
- breakpoints: [...merged.breakpoints].sort()
1165
+ colors: htmlEscape.sortStrings(merged.colors),
1166
+ spacings: htmlEscape.sortStrings(merged.spacings),
1167
+ fonts: htmlEscape.sortStrings(merged.fonts),
1168
+ radii: htmlEscape.sortStrings(merged.radii),
1169
+ shadows: htmlEscape.sortStrings(merged.shadows),
1170
+ breakpoints: htmlEscape.sortStrings(merged.breakpoints)
1171
1171
  };
1172
1172
  }
1173
1173
  function hasTokens(theme) {
@@ -1287,7 +1287,7 @@ function expandFilePatterns(rootDir, patterns) {
1287
1287
  }
1288
1288
  }
1289
1289
  }
1290
- return Array.from(files).sort();
1290
+ return htmlEscape.sortStrings(files);
1291
1291
  }
1292
1292
 
1293
1293
  function safeJsonForScriptTag(value, prettyPrint = false) {
@@ -1381,7 +1381,7 @@ function buildRecoveryManifest(tokens, options) {
1381
1381
  const stripped = options.production === true;
1382
1382
  const strippedDevOnlyPaths = [];
1383
1383
  const sorted = {};
1384
- const sortedKeys = [...tokens.keys()].sort();
1384
+ const sortedKeys = htmlEscape.sortStrings(tokens.keys());
1385
1385
  for (const key of sortedKeys) {
1386
1386
  const data = tokens.get(key);
1387
1387
  if (!data) {
@@ -1602,16 +1602,18 @@ const DEFAULT_VAR_MANGLE_MAP_MAX_BYTES = 100 * 1024;
1602
1602
  const GLOBAL_VAR_ALIAS_MAP_OWNER = "\0csszyx:global-var-aliases";
1603
1603
  const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
1604
1604
  const RUNTIME_HELPER_IMPORT_RE = {
1605
- _sz: /\{[^}]*\b_sz\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1606
- _szMerge: /\{[^}]*\b_szMerge\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1607
- __szColorVar: /\{[^}]*\b__szColorVar\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
1605
+ _sz: /(?:import|export)\s+\{[^{}]*\b_sz\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1606
+ _szMerge: /(?:import|export)\s+\{[^{}]*\b_szMerge\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1607
+ __szColorVar: /(?:import|export)\s+\{[^{}]*\b__szColorVar\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
1608
1608
  };
1609
1609
  let _hasWarnedTsConfig = false;
1610
1610
  let _hasWarnedTransformCacheVersion = false;
1611
1611
  let _hasWarnedNativeFallback = false;
1612
- 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.CaH_X1dP.cjs', document.baseURI).href)));
1612
+ let _hasLoggedActiveParser = false;
1613
+ const _babelFallbackFiles = /* @__PURE__ */ new Set();
1614
+ 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.CyZkpgQK.cjs', document.baseURI).href)));
1613
1615
  const PLUGIN_VERSION = findPackageVersionFromFile(
1614
- node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.CaH_X1dP.cjs', document.baseURI).href))),
1616
+ node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.CyZkpgQK.cjs', document.baseURI).href))),
1615
1617
  UNKNOWN_PACKAGE_VERSION
1616
1618
  );
1617
1619
  const COMPILER_VERSION = findPackageVersionFromModule("@csszyx/compiler", UNKNOWN_PACKAGE_VERSION);
@@ -1688,6 +1690,43 @@ function shouldWarnMissingTailwindEntry(ownedClassCount, sawTailwindEntry, sawAn
1688
1690
  function missingTailwindEntryMessage(ownedClassCount) {
1689
1691
  return `[csszyx] generated ${ownedClassCount} sz class(es) but found no CSS entry importing "tailwindcss" \u2014 those classes will produce no CSS. Import "tailwindcss" in a CSS file (csszyx auto-injects @source for the generated classes) so Tailwind emits their styles.`;
1690
1692
  }
1693
+ function collectMangleHybridHazards(mangleMap, mangledSources, externalClasses) {
1694
+ const tokenValues = new Set(Object.values(mangleMap));
1695
+ const collisions = compiler.sortStrings([...tokenValues].filter((token) => externalClasses.has(token)));
1696
+ const orphans = compiler.sortStrings(
1697
+ Object.keys(mangleMap).filter((source) => !mangledSources.has(source))
1698
+ );
1699
+ return { collisions, orphans };
1700
+ }
1701
+ function mangleHybridHazardMessage(hazards) {
1702
+ const { collisions, orphans } = hazards;
1703
+ if (collisions.length === 0 && orphans.length === 0) {
1704
+ return null;
1705
+ }
1706
+ const parts = ["[csszyx] production mangle found hybrid hazards:"];
1707
+ if (collisions.length > 0) {
1708
+ const sample = collisions.slice(0, 8).join(", ");
1709
+ parts.push(
1710
+ ` ${collisions.length} mangled token(s) collide with class names in non-csszyx CSS (e.g. ${sample}) \u2014 those tokens will cross-contaminate external ".${collisions[0]}" elements.`
1711
+ );
1712
+ }
1713
+ if (orphans.length > 0) {
1714
+ const sample = orphans.slice(0, 8).join(", ");
1715
+ parts.push(
1716
+ ` ${orphans.length} mangled class(es) have no emitted CSS rule (e.g. ${sample}) \u2014 those elements lose styling.`
1717
+ );
1718
+ }
1719
+ if (collisions.length > 0) {
1720
+ parts.push(
1721
+ " HOTFIX: pass `production: { mangle: false }` to the csszyx plugin to ship now. THEN fix it: if these short names are in your OWN CSS, rename them to something specific (e.g. `.x` \u2192 `.resize-handle-x`) \u2014 short/common names also clash on specificity with other libraries. Only for names in a third-party stylesheet you cannot edit, list them in `production.mangleExclude` instead. Run `npx @csszyx/cli scan-collisions` to find every offending name."
1722
+ );
1723
+ } else {
1724
+ parts.push(
1725
+ " Those classes are csszyx-owned but no CSS was emitted for them (e.g. a separate Tailwind plugin owns the utility CSS, or the class is not a real utility). Ensure that CSS is generated, or pass `production: { mangle: false }` to the csszyx plugin until the pipelines are reconciled."
1726
+ );
1727
+ }
1728
+ return parts.join("");
1729
+ }
1691
1730
  function cssHasContentScope(code) {
1692
1731
  const s = stripCssBlockComments(code);
1693
1732
  return /@import\s+["']tailwindcss(?:\/[^"']*)?["']\s+source\(/.test(s) || /@source\s+not\b/.test(s);
@@ -1936,7 +1975,7 @@ CSS alias plan ${actualJson} does not match source-transform alias table ${expec
1936
1975
  }
1937
1976
  function buildVarMangleMap(entriesByFile) {
1938
1977
  const next = {};
1939
- const files = [...entriesByFile.keys()].sort();
1978
+ const files = compiler.sortStrings(entriesByFile.keys());
1940
1979
  for (const file of files) {
1941
1980
  for (const [original, mangled] of entriesByFile.get(file) ?? []) {
1942
1981
  addVarMangleMapping(next, original, mangled);
@@ -1985,7 +2024,7 @@ function createEarlyGlobalVarAliasEntries(config, aliasPrefix) {
1985
2024
  if (config?.enabled !== true || !config.tokens || config.tokens.length === 0) {
1986
2025
  return [];
1987
2026
  }
1988
- const tokens = [...new Set(config.tokens)].sort();
2027
+ const tokens = compiler.sortStrings(new Set(config.tokens));
1989
2028
  return tokens.map((original, index) => [original, `${aliasPrefix}${core.encode(index)}`]);
1990
2029
  }
1991
2030
  function shouldEmitGlobalVarMapAsset(config) {
@@ -2072,7 +2111,7 @@ function collectCSSVariableMetrics(code) {
2072
2111
  }
2073
2112
  function buildCSSVariableMetrics(metricsByFile) {
2074
2113
  const total = emptyCSSVariableMetrics();
2075
- for (const file of [...metricsByFile.keys()].sort()) {
2114
+ for (const file of compiler.sortStrings(metricsByFile.keys())) {
2076
2115
  const metrics = metricsByFile.get(file);
2077
2116
  if (!metrics) {
2078
2117
  continue;
@@ -2364,7 +2403,7 @@ function mangleCodeClassesSync(code, mangleMap) {
2364
2403
  result = out + result.slice(copiedTo);
2365
2404
  }
2366
2405
  }
2367
- result = result.replace(/(?<=(?:[,(]|&&)\s*)"([^"]+)"/g, (match, inner) => {
2406
+ result = result.replace(/([,(]|&&)(\s*)"([^"]+)"/g, (match, sep, ws, inner) => {
2368
2407
  const tokens = inner.split(/\s+/).filter(Boolean);
2369
2408
  if (tokens.length === 0) {
2370
2409
  return match;
@@ -2384,7 +2423,7 @@ function mangleCodeClassesSync(code, mangleMap) {
2384
2423
  if (!changed) {
2385
2424
  return match;
2386
2425
  }
2387
- return `"${mangled.join(" ")}"`;
2426
+ return `${sep}${ws}"${mangled.join(" ")}"`;
2388
2427
  });
2389
2428
  return result;
2390
2429
  }
@@ -2413,6 +2452,7 @@ ${errors.join("\n")}`
2413
2452
  function createCsszyxPlugins(options = {}) {
2414
2453
  assertGlobalVarMangleConfig(options);
2415
2454
  let manglingEnabled = options.production?.mangle !== false;
2455
+ const mangleReserved = new Set(options.production?.mangleExclude ?? []);
2416
2456
  const astBudgetOverride = options.build?.astBudgetLimit;
2417
2457
  const cacheRequested = (options.build?.cache ?? types.DEFAULT_BUILD_CONFIG.cache) !== false;
2418
2458
  const cacheVersionsKnown = PLUGIN_VERSION !== UNKNOWN_PACKAGE_VERSION && COMPILER_VERSION !== UNKNOWN_PACKAGE_VERSION;
@@ -2450,6 +2490,11 @@ function createCsszyxPlugins(options = {}) {
2450
2490
  "[csszyx] No prebuilt native binary (@csszyx/core-*) is available for this platform, so the default `rust` parser fell back to `oxc`. Output classes are identical (parity-tested); only parse speed differs. To use the native engine, install the matching @csszyx/core-<platform> package (or do not omit optional dependencies). Set `build.parser` explicitly to silence this."
2451
2491
  );
2452
2492
  }
2493
+ if (!_hasLoggedActiveParser) {
2494
+ _hasLoggedActiveParser = true;
2495
+ const detail = parserDegraded ? "oxc (degraded from default `rust`: no native binary for this platform)" : parserMode === "rust" ? "rust (native engine)" : parserMode;
2496
+ console.warn(`[csszyx] active parser: ${detail}`);
2497
+ }
2453
2498
  let evictedCacheRoot = null;
2454
2499
  const transformMemoryCache = /* @__PURE__ */ new Map();
2455
2500
  const state = {
@@ -2591,6 +2636,12 @@ function createCsszyxPlugins(options = {}) {
2591
2636
  result.diagnostics.push(
2592
2637
  `[csszyx] oxc parser fell back to Babel for ${effectiveFilename}: ${reason}`
2593
2638
  );
2639
+ if (!_babelFallbackFiles.has(effectiveFilename)) {
2640
+ _babelFallbackFiles.add(effectiveFilename);
2641
+ console.warn(
2642
+ `[csszyx] oxc parser fell back to Babel for ${effectiveFilename}: ${reason} (${_babelFallbackFiles.size} file(s) so far). Output is still correct; this usually means the file uses a syntax the oxc lane does not yet handle.`
2643
+ );
2644
+ }
2594
2645
  return result;
2595
2646
  }
2596
2647
  }
@@ -2890,7 +2941,7 @@ function createCsszyxPlugins(options = {}) {
2890
2941
  }
2891
2942
  }
2892
2943
  function collectRuntimeStringClasses(objStr, discoveredClasses) {
2893
- const strKv = /(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
2944
+ const strKv = /\b(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
2894
2945
  for (const kv of objStr.matchAll(strKv)) {
2895
2946
  try {
2896
2947
  const val = kv[2] ?? kv[3];
@@ -2900,7 +2951,7 @@ function createCsszyxPlugins(options = {}) {
2900
2951
  }
2901
2952
  }
2902
2953
  function collectRuntimeNumberClasses(objStr, discoveredClasses) {
2903
- const numKv = /(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
2954
+ const numKv = /\b(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
2904
2955
  for (const kv of objStr.matchAll(numKv)) {
2905
2956
  try {
2906
2957
  collectTransformClasses(
@@ -2912,7 +2963,7 @@ function createCsszyxPlugins(options = {}) {
2912
2963
  }
2913
2964
  }
2914
2965
  function collectRuntimeBooleanClasses(objStr, discoveredClasses) {
2915
- const boolKv = /(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
2966
+ const boolKv = /\b(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
2916
2967
  for (const kv of objStr.matchAll(boolKv)) {
2917
2968
  try {
2918
2969
  collectTransformClasses(
@@ -2965,8 +3016,15 @@ function createCsszyxPlugins(options = {}) {
2965
3016
  function finalizeMangleMap() {
2966
3017
  const sortedClasses = Array.from(state.ownedClasses);
2967
3018
  const newMap = {};
3019
+ let tokenIndex = 0;
2968
3020
  for (let i = 0; i < sortedClasses.length; i++) {
2969
- newMap[sortedClasses[i]] = core.encode(i);
3021
+ let token = core.encode(tokenIndex);
3022
+ while (mangleReserved.has(token)) {
3023
+ tokenIndex++;
3024
+ token = core.encode(tokenIndex);
3025
+ }
3026
+ newMap[sortedClasses[i]] = token;
3027
+ tokenIndex++;
2970
3028
  }
2971
3029
  state.mangleMap = newMap;
2972
3030
  assertVarMangleMapSize(state.varMangleMap, varMangleMapMaxBytes);
@@ -3245,7 +3303,7 @@ function createCsszyxPlugins(options = {}) {
3245
3303
  }
3246
3304
  if (!state.skipWarningEmitted && state.skippedSzFiles.size > 0) {
3247
3305
  state.skipWarningEmitted = true;
3248
- emitWarning(skippedSzFilesMessage([...state.skippedSzFiles].sort()), {
3306
+ emitWarning(skippedSzFilesMessage(compiler.sortStrings(state.skippedSzFiles)), {
3249
3307
  devOnly: true
3250
3308
  });
3251
3309
  }
@@ -3386,7 +3444,9 @@ function createCsszyxPlugins(options = {}) {
3386
3444
  finalizeMangleMap();
3387
3445
  const injectedMangleMap = manglingEnabled ? state.mangleMap : {};
3388
3446
  let result = transformIndexHtml(html, injectedMangleMap, state.checksum, {
3389
- mode: options.production?.injectChecksum === false ? "script" : "script",
3447
+ // Always 'script'; the checksum itself is injected by
3448
+ // injectHydrationData regardless of this mode.
3449
+ mode: "script",
3390
3450
  minify: process.env.NODE_ENV === "production",
3391
3451
  varMangleMap: state.varMangleMap,
3392
3452
  globalVarAliasPrefix
@@ -3476,6 +3536,8 @@ function createCsszyxPlugins(options = {}) {
3476
3536
  );
3477
3537
  }
3478
3538
  }
3539
+ const mangledSources = /* @__PURE__ */ new Set();
3540
+ const externalClasses = /* @__PURE__ */ new Set();
3479
3541
  for (const file in assets) {
3480
3542
  const asset = assets[file];
3481
3543
  const source = asset.source().toString();
@@ -3491,6 +3553,12 @@ function createCsszyxPlugins(options = {}) {
3491
3553
  debug: options.development?.debug,
3492
3554
  from: file
3493
3555
  });
3556
+ for (const c of result.mangledClasses) {
3557
+ mangledSources.add(c);
3558
+ }
3559
+ for (const c of result.unmangledClasses) {
3560
+ externalClasses.add(c);
3561
+ }
3494
3562
  if (result.transformedCount > 0) {
3495
3563
  css = result.css;
3496
3564
  }
@@ -3552,6 +3620,18 @@ function createCsszyxPlugins(options = {}) {
3552
3620
  }
3553
3621
  }
3554
3622
  }
3623
+ if (manglingEnabled && !isWebpackDevMode && Object.keys(state.mangleMap).length > 0) {
3624
+ const hazardMessage = mangleHybridHazardMessage(
3625
+ collectMangleHybridHazards(
3626
+ state.mangleMap,
3627
+ mangledSources,
3628
+ externalClasses
3629
+ )
3630
+ );
3631
+ if (hazardMessage) {
3632
+ console.warn(hazardMessage);
3633
+ }
3634
+ }
3555
3635
  }
3556
3636
  );
3557
3637
  });
@@ -3608,6 +3688,8 @@ function createCsszyxPlugins(options = {}) {
3608
3688
  });
3609
3689
  }
3610
3690
  }
3691
+ const mangledSources = /* @__PURE__ */ new Set();
3692
+ const externalClasses = /* @__PURE__ */ new Set();
3611
3693
  for (const file in bundle) {
3612
3694
  const chunk = bundle[file];
3613
3695
  if (chunk.type === "asset" && chunk.fileName.endsWith(".css")) {
@@ -3623,6 +3705,12 @@ function createCsszyxPlugins(options = {}) {
3623
3705
  debug: options.development?.debug,
3624
3706
  from: file
3625
3707
  });
3708
+ for (const c of result.mangledClasses) {
3709
+ mangledSources.add(c);
3710
+ }
3711
+ for (const c of result.unmangledClasses) {
3712
+ externalClasses.add(c);
3713
+ }
3626
3714
  if (result.transformedCount > 0) {
3627
3715
  css = result.css;
3628
3716
  }
@@ -3654,6 +3742,18 @@ function createCsszyxPlugins(options = {}) {
3654
3742
  }
3655
3743
  }
3656
3744
  }
3745
+ if (manglingEnabled && Object.keys(state.mangleMap).length > 0) {
3746
+ const hazardMessage = mangleHybridHazardMessage(
3747
+ collectMangleHybridHazards(
3748
+ state.mangleMap,
3749
+ mangledSources,
3750
+ externalClasses
3751
+ )
3752
+ );
3753
+ if (hazardMessage) {
3754
+ console.warn(hazardMessage);
3755
+ }
3756
+ }
3657
3757
  }
3658
3758
  }
3659
3759
  }));
@@ -3704,6 +3804,7 @@ const esbuildPlugin = (options = {}) => {
3704
3804
  exports.appendTailwindSourceDirective = appendTailwindSourceDirective;
3705
3805
  exports.assertNoRSCBoundaryViolation = assertNoRSCBoundaryViolation;
3706
3806
  exports.assertNoRSCGraphViolation = assertNoRSCGraphViolation;
3807
+ exports.collectMangleHybridHazards = collectMangleHybridHazards;
3707
3808
  exports.computeSafelistRelPath = computeSafelistRelPath;
3708
3809
  exports.createGlobalVarAliasValidationOptions = createGlobalVarAliasValidationOptions;
3709
3810
  exports.createGlobalVarMapAssetSource = createGlobalVarMapAssetSource;
@@ -3728,6 +3829,7 @@ exports.isPackagesSkippedSource = isPackagesSkippedSource;
3728
3829
  exports.isRSCServerModule = isRSCServerModule;
3729
3830
  exports.isTailwindReservedGlobalVar = isTailwindReservedGlobalVar;
3730
3831
  exports.mangleCodeClassesSync = mangleCodeClassesSync;
3832
+ exports.mangleHybridHazardMessage = mangleHybridHazardMessage;
3731
3833
  exports.mergeThemes = mergeThemes;
3732
3834
  exports.missingTailwindEntryMessage = missingTailwindEntryMessage;
3733
3835
  exports.normalizeGlobalVarAliasesForCache = normalizeGlobalVarAliasesForCache;
@@ -2,6 +2,7 @@ import { readFileSync } from 'node:fs';
2
2
  import { ensureRustTransformAvailable, transformSourceCode, transformRust, transformOxc, transform } from '@csszyx/compiler';
3
3
  import { c as createTransformCacheKey, a as readTransformCache, w as writeTransformCache } from './unplugin.BpWUtI9U.mjs';
4
4
  import { createHash } from 'node:crypto';
5
+ import { s as sortStrings } from './unplugin.B1mblcm-.mjs';
5
6
 
6
7
  function readPackageVersion(relativePackageJson, fromUrl) {
7
8
  try {
@@ -195,8 +196,8 @@ function collectNextTransformMetadata(result, source, sourcePath) {
195
196
  return {
196
197
  sourcePath,
197
198
  sourceHash: createHash("sha256").update(source).digest("hex"),
198
- classes: [...classes].sort(),
199
- rawClassNames: [...result.rawClassNames].sort(),
199
+ classes: sortStrings(classes),
200
+ rawClassNames: sortStrings(result.rawClassNames),
200
201
  recoveryTokenCount: result.recoveryTokens.size,
201
202
  cssVariableCount: result.cssVariableMap.size
202
203
  };
@@ -232,7 +233,7 @@ function collectRuntimeStaticClasses(result, discoveredClasses) {
232
233
  }
233
234
  }
234
235
  function collectRuntimeStringClasses(objectSource, discoveredClasses) {
235
- const stringKeyValue = /(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
236
+ const stringKeyValue = /\b(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
236
237
  for (const match of objectSource.matchAll(stringKeyValue)) {
237
238
  try {
238
239
  collectTransformClasses(
@@ -244,7 +245,7 @@ function collectRuntimeStringClasses(objectSource, discoveredClasses) {
244
245
  }
245
246
  }
246
247
  function collectRuntimeNumberClasses(objectSource, discoveredClasses) {
247
- const numberKeyValue = /(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
248
+ const numberKeyValue = /\b(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
248
249
  for (const match of objectSource.matchAll(numberKeyValue)) {
249
250
  try {
250
251
  collectTransformClasses(
@@ -256,7 +257,7 @@ function collectRuntimeNumberClasses(objectSource, discoveredClasses) {
256
257
  }
257
258
  }
258
259
  function collectRuntimeBooleanClasses(objectSource, discoveredClasses) {
259
- const booleanKeyValue = /(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
260
+ const booleanKeyValue = /\b(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
260
261
  for (const match of objectSource.matchAll(booleanKeyValue)) {
261
262
  try {
262
263
  collectTransformClasses(
package/dist/vite.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const unplugin = require('./shared/unplugin.CaH_X1dP.cjs');
5
+ const unplugin = require('./shared/unplugin.CyZkpgQK.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
@@ -18,7 +18,7 @@ require('unplugin');
18
18
  require('./css-mangler.cjs');
19
19
  require('postcss');
20
20
  require('postcss-selector-parser');
21
- require('./shared/unplugin.DoBHTRra.cjs');
21
+ require('./shared/unplugin.BCwRIUs_.cjs');
22
22
  require('node:crypto');
23
23
  require('./shared/unplugin.pmTknYLy.cjs');
24
24
  require('postcss-value-parser');
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Q as vitePlugin } from './shared/unplugin.DjIGzbic.cjs';
1
+ import { W as vitePlugin } from './shared/unplugin.CK6U5gAP.cjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Q as vitePlugin } from './shared/unplugin.DjIGzbic.mjs';
1
+ import { W as vitePlugin } from './shared/unplugin.CK6U5gAP.mjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { U as vitePlugin } from './shared/unplugin.D_GIYc2p.mjs';
1
+ import { W as vitePlugin } from './shared/unplugin.BAOVOPKJ.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
@@ -14,7 +14,7 @@ import 'unplugin';
14
14
  import './css-mangler.mjs';
15
15
  import 'postcss';
16
16
  import 'postcss-selector-parser';
17
- import './shared/unplugin.3UumZ5gn.mjs';
17
+ import './shared/unplugin.B1mblcm-.mjs';
18
18
  import 'node:crypto';
19
19
  import './shared/unplugin.BpWUtI9U.mjs';
20
20
  import 'postcss-value-parser';
package/dist/webpack.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const unplugin = require('./shared/unplugin.CaH_X1dP.cjs');
5
+ const unplugin = require('./shared/unplugin.CyZkpgQK.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
@@ -18,7 +18,7 @@ require('unplugin');
18
18
  require('./css-mangler.cjs');
19
19
  require('postcss');
20
20
  require('postcss-selector-parser');
21
- require('./shared/unplugin.DoBHTRra.cjs');
21
+ require('./shared/unplugin.BCwRIUs_.cjs');
22
22
  require('node:crypto');
23
23
  require('./shared/unplugin.pmTknYLy.cjs');
24
24
  require('postcss-value-parser');
@@ -1,4 +1,4 @@
1
- import { T as webpackPlugin } from './shared/unplugin.DjIGzbic.cjs';
1
+ import { X as webpackPlugin } from './shared/unplugin.CK6U5gAP.cjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
@@ -1,4 +1,4 @@
1
- import { T as webpackPlugin } from './shared/unplugin.DjIGzbic.mjs';
1
+ import { X as webpackPlugin } from './shared/unplugin.CK6U5gAP.mjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { V as webpackPlugin } from './shared/unplugin.D_GIYc2p.mjs';
1
+ import { X as webpackPlugin } from './shared/unplugin.BAOVOPKJ.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
@@ -14,7 +14,7 @@ import 'unplugin';
14
14
  import './css-mangler.mjs';
15
15
  import 'postcss';
16
16
  import 'postcss-selector-parser';
17
- import './shared/unplugin.3UumZ5gn.mjs';
17
+ import './shared/unplugin.B1mblcm-.mjs';
18
18
  import 'node:crypto';
19
19
  import './shared/unplugin.BpWUtI9U.mjs';
20
20
  import 'postcss-value-parser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/unplugin",
3
- "version": "0.10.7",
3
+ "version": "0.10.9",
4
4
  "description": "Vite and Webpack integration for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -117,14 +117,14 @@
117
117
  "postcss-value-parser": "^4.2.0",
118
118
  "proper-lockfile": "^4.1.2",
119
119
  "unplugin": "^1.10.1",
120
- "@csszyx/compiler": "0.10.7",
121
- "@csszyx/svelte-adapter": "0.10.7",
122
- "@csszyx/core": "0.10.7",
123
- "@csszyx/vue-adapter": "0.10.7",
124
- "@csszyx/types": "0.10.7"
120
+ "@csszyx/compiler": "0.10.9",
121
+ "@csszyx/core": "0.10.9",
122
+ "@csszyx/svelte-adapter": "0.10.9",
123
+ "@csszyx/vue-adapter": "0.10.9",
124
+ "@csszyx/types": "0.10.9"
125
125
  },
126
126
  "peerDependencies": {
127
- "@csszyx/runtime": "^0.10.7"
127
+ "@csszyx/runtime": "^0.10.9"
128
128
  },
129
129
  "devDependencies": {
130
130
  "@types/node": "^20.11.0",
@@ -134,7 +134,7 @@
134
134
  "typescript": "^6.0.3",
135
135
  "unbuild": "^3.6.1",
136
136
  "vite": "^8.0.13",
137
- "vitest": "^4.1.6",
137
+ "vitest": "^4.1.9",
138
138
  "webpack": "^5.104.1"
139
139
  },
140
140
  "sideEffects": false,
@@ -1,5 +0,0 @@
1
- function escapeHtmlAttribute(value) {
2
- return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3
- }
4
-
5
- export { escapeHtmlAttribute as e };