@csszyx/unplugin 0.11.7 → 0.11.8

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.
Files changed (41) hide show
  1. package/README.md +6 -1
  2. package/dist/css-mangler.cjs +9 -6
  3. package/dist/css-mangler.mjs +9 -6
  4. package/dist/index.cjs +5 -4
  5. package/dist/index.d.cts +2 -2
  6. package/dist/index.d.mts +2 -2
  7. package/dist/index.mjs +4 -4
  8. package/dist/next-config.cjs +1 -1
  9. package/dist/next-config.mjs +1 -1
  10. package/dist/next-prebuild.cjs +5 -5
  11. package/dist/next-prebuild.mjs +5 -5
  12. package/dist/next-turbo-loader.cjs +7 -12
  13. package/dist/next-turbo-loader.mjs +7 -12
  14. package/dist/next-watcher.cjs +2 -2
  15. package/dist/next-watcher.mjs +2 -2
  16. package/dist/shared/{unplugin.D6hes1O8.cjs → unplugin.C9dMG7ye.cjs} +5 -3
  17. package/dist/shared/{unplugin.PhOFTQpB.d.cts → unplugin.CNwV3RrQ.d.cts} +18 -5
  18. package/dist/shared/{unplugin.PhOFTQpB.d.mts → unplugin.CNwV3RrQ.d.mts} +18 -5
  19. package/dist/shared/unplugin.CcA7jP1r.cjs +48 -0
  20. package/dist/shared/{unplugin.CwcOd1q3.mjs → unplugin.D-K57LNR.mjs} +6 -1
  21. package/dist/shared/{unplugin.D8vSG36M.cjs → unplugin.DVCQC5wq.cjs} +6 -0
  22. package/dist/shared/{unplugin.CZKUWN1J.cjs → unplugin.DdtOZANG.cjs} +51 -50
  23. package/dist/shared/{unplugin.Dqt1aLCX.mjs → unplugin.Dg1tGPSd.mjs} +5 -3
  24. package/dist/shared/{unplugin.Rov-j_Wm.cjs → unplugin.DmuOKVS4.cjs} +21 -0
  25. package/dist/shared/{unplugin.ByAzFdqO.cjs → unplugin.DtPQz8Kg.cjs} +1072 -754
  26. package/dist/shared/{unplugin.CtHwCYxE.mjs → unplugin.DtYxS8M8.mjs} +1071 -754
  27. package/dist/shared/{unplugin.VSslRpfN.mjs → unplugin.Rl8sIkHi.mjs} +51 -50
  28. package/dist/shared/unplugin.TtmP77BS.mjs +40 -0
  29. package/dist/shared/unplugin.nnsa7OVW.mjs +49 -0
  30. package/dist/vite.cjs +4 -4
  31. package/dist/vite.d.cts +2 -25
  32. package/dist/vite.d.mts +1 -25
  33. package/dist/vite.mjs +4 -8
  34. package/dist/webpack.cjs +4 -4
  35. package/dist/webpack.d.cts +2 -5
  36. package/dist/webpack.d.mts +1 -5
  37. package/dist/webpack.mjs +4 -8
  38. package/package.json +7 -7
  39. package/dist/shared/unplugin.B1mblcm-.mjs +0 -9
  40. package/dist/shared/unplugin.B3RHYokB.mjs +0 -29
  41. package/dist/shared/unplugin.BCwRIUs_.cjs +0 -12
package/README.md CHANGED
@@ -69,9 +69,14 @@ module.exports = {
69
69
  - **sz prop transform** -- Compiles `sz={{ }}` objects into `className` strings. Defaults to the **native Rust engine** through the optional `@csszyx/core-*` platform package; opt back into the previous oxc-parser JavaScript path with `build.parser: "oxc"`, or fall through to Babel with `build.parser: "babel"`.
70
70
  - **HTML injection** -- Injects mangle maps and checksums for SSR hydration
71
71
  - **HMR support** -- Updates styles instantly during development
72
- - **CSS mangling** -- Compresses class names (e.g., `text-center` -> `z`) in production builds
72
+ - **CSS mangling** -- Compresses owned class names (e.g., `text-center` -> `z`) while retaining names shared with source-visible `class`/`className` strings and template quasis
73
73
  - **File filters** -- Top-level `include` / `exclude` (glob or RegExp) skip large generated files before the AST budget guard fires; see [Config Overview](https://csszyx.com/config/overview#file-filters)
74
74
 
75
+ Class mangling runs in Vite, Webpack, and Rollup final-output hooks. The esbuild
76
+ adapter supports source transforms and safelist generation but disables class
77
+ mangling because esbuild does not expose a mutable final-output hook when writing
78
+ directly to disk; explicit `production.mangle: true` emits a warning.
79
+
75
80
  ## Parser selection
76
81
 
77
82
  The default parser is `rust`, which runs through the native engine in the
@@ -8,11 +8,12 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
8
8
  const postcss__default = /*#__PURE__*/_interopDefaultCompat(postcss);
9
9
  const selectorParser__default = /*#__PURE__*/_interopDefaultCompat(selectorParser);
10
10
 
11
+ const BACKSLASH = String.fromCodePoint(92);
11
12
  function unescapeTailwindClass(escapedName) {
12
13
  let result = "";
13
14
  let i = 0;
14
15
  while (i < escapedName.length) {
15
- if (escapedName[i] !== "\\") {
16
+ if (escapedName[i] !== BACKSLASH) {
16
17
  result += escapedName[i];
17
18
  i++;
18
19
  continue;
@@ -34,24 +35,26 @@ function readCssEscape(source, start) {
34
35
  next++;
35
36
  }
36
37
  if (source[next] === " ") next++;
37
- const codePoint = parseInt(hex, 16);
38
+ const codePoint = Number.parseInt(hex, 16);
38
39
  return { value: codePoint > 0 ? String.fromCodePoint(codePoint) : "", next };
39
40
  }
40
41
  function escapeLeadingClassCharacter(className, char) {
41
42
  if (/\d/.test(char)) {
42
- return `\\3${char} `;
43
+ return `${BACKSLASH}3${char} `;
43
44
  }
44
45
  if (char === "-" && className.length > 1) {
45
46
  const next = className[1];
46
47
  if (/\d/.test(next) || next === "-") {
47
- return "\\-";
48
+ return `${BACKSLASH}-`;
48
49
  }
49
50
  }
50
51
  return null;
51
52
  }
52
53
  function escapeClassCharacter(char) {
53
- if (/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/.test(char)) {
54
- return `\\${char}`;
54
+ const codePoint = char.codePointAt(0) ?? 0;
55
+ const requiresEscape = codePoint >= 33 && codePoint <= 47 && codePoint !== 45 || codePoint >= 58 && codePoint <= 64 || codePoint >= 91 && codePoint <= 94 || codePoint === 96 || codePoint >= 123 && codePoint <= 126;
56
+ if (requiresEscape) {
57
+ return `${BACKSLASH}${char}`;
55
58
  }
56
59
  return char;
57
60
  }
@@ -1,11 +1,12 @@
1
1
  import postcss from 'postcss';
2
2
  import selectorParser from 'postcss-selector-parser';
3
3
 
4
+ const BACKSLASH = String.fromCodePoint(92);
4
5
  function unescapeTailwindClass(escapedName) {
5
6
  let result = "";
6
7
  let i = 0;
7
8
  while (i < escapedName.length) {
8
- if (escapedName[i] !== "\\") {
9
+ if (escapedName[i] !== BACKSLASH) {
9
10
  result += escapedName[i];
10
11
  i++;
11
12
  continue;
@@ -27,24 +28,26 @@ function readCssEscape(source, start) {
27
28
  next++;
28
29
  }
29
30
  if (source[next] === " ") next++;
30
- const codePoint = parseInt(hex, 16);
31
+ const codePoint = Number.parseInt(hex, 16);
31
32
  return { value: codePoint > 0 ? String.fromCodePoint(codePoint) : "", next };
32
33
  }
33
34
  function escapeLeadingClassCharacter(className, char) {
34
35
  if (/\d/.test(char)) {
35
- return `\\3${char} `;
36
+ return `${BACKSLASH}3${char} `;
36
37
  }
37
38
  if (char === "-" && className.length > 1) {
38
39
  const next = className[1];
39
40
  if (/\d/.test(next) || next === "-") {
40
- return "\\-";
41
+ return `${BACKSLASH}-`;
41
42
  }
42
43
  }
43
44
  return null;
44
45
  }
45
46
  function escapeClassCharacter(char) {
46
- if (/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/.test(char)) {
47
- return `\\${char}`;
47
+ const codePoint = char.codePointAt(0) ?? 0;
48
+ const requiresEscape = codePoint >= 33 && codePoint <= 47 && codePoint !== 45 || codePoint >= 58 && codePoint <= 64 || codePoint >= 91 && codePoint <= 94 || codePoint === 96 || codePoint >= 123 && codePoint <= 126;
49
+ if (requiresEscape) {
50
+ return `${BACKSLASH}${char}`;
48
51
  }
49
52
  return char;
50
53
  }
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const cssMangler = require('./css-mangler.cjs');
6
- const unplugin = require('./shared/unplugin.ByAzFdqO.cjs');
6
+ const unplugin = require('./shared/unplugin.DtPQz8Kg.cjs');
7
7
  const types = require('@csszyx/types');
8
8
  require('postcss');
9
9
  require('postcss-selector-parser');
@@ -19,9 +19,9 @@ require('@csszyx/core/native');
19
19
  require('@csszyx/svelte-adapter');
20
20
  require('@csszyx/vue-adapter');
21
21
  require('unplugin');
22
- require('./shared/unplugin.BCwRIUs_.cjs');
23
- require('./shared/unplugin.Rov-j_Wm.cjs');
24
- require('./shared/unplugin.D8vSG36M.cjs');
22
+ require('./shared/unplugin.DmuOKVS4.cjs');
23
+ require('./shared/unplugin.DVCQC5wq.cjs');
24
+ require('./shared/unplugin.CcA7jP1r.cjs');
25
25
  require('postcss-value-parser');
26
26
 
27
27
 
@@ -61,6 +61,7 @@ exports.isPackagesSkippedSource = unplugin.isPackagesSkippedSource;
61
61
  exports.isRSCServerModule = unplugin.isRSCServerModule;
62
62
  exports.isTailwindReservedGlobalVar = unplugin.isTailwindReservedGlobalVar;
63
63
  exports.mangleCodeClassesSync = unplugin.mangleCodeClassesSync;
64
+ exports.mangleEligibleClasses = unplugin.mangleEligibleClasses;
64
65
  exports.mangleHybridHazardMessage = unplugin.mangleHybridHazardMessage;
65
66
  exports.mergeThemes = unplugin.mergeThemes;
66
67
  exports.missingTailwindEntryMessage = unplugin.missingTailwindEntryMessage;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.cjs';
2
2
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
3
- import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.PhOFTQpB.cjs';
3
+ import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.CNwV3RrQ.cjs';
4
4
  // @ts-ignore
5
5
  export = undefined;
6
- export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, Q as isCompileSourceOptedIn, T as isHardIgnoredPath, U as isMonorepoPackage, W as isPackagesSkippedSource, X as isRSCServerModule, Y as mangleCodeClassesSync, Z as mangleHybridHazardMessage, _ as mergeThemes, $ as missingTailwindEntryMessage, a0 as normalizeGlobalVarAliasesForCache, a1 as parseThemeBlocks, a2 as recordGlobalVarSourceFile, a3 as resolveCompileSourceDirs, a4 as resolveNativeCacheIdentity, a5 as rollupPlugin, a6 as scanCustomPropertyNames, a7 as shouldEmitWarning, a8 as shouldTrackGlobalVarSources, a9 as shouldWarnMissingTailwindEntry, aa as shouldWarnUnscopedMonorepo, ab as skippedSzFilesMessage, A as unplugin, ac as unscopedMonorepoMessage, ad as vitePlugin, ae as webpackPlugin } from './shared/unplugin.PhOFTQpB.cjs';
6
+ export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, Q as isCompileSourceOptedIn, T as isHardIgnoredPath, U as isMonorepoPackage, W as isPackagesSkippedSource, X as isRSCServerModule, Y as mangleCodeClassesSync, Z as mangleEligibleClasses, _ as mangleHybridHazardMessage, $ as mergeThemes, a0 as missingTailwindEntryMessage, a1 as normalizeGlobalVarAliasesForCache, a2 as parseThemeBlocks, a3 as recordGlobalVarSourceFile, a4 as resolveCompileSourceDirs, a5 as resolveNativeCacheIdentity, a6 as rollupPlugin, a7 as scanCustomPropertyNames, a8 as shouldEmitWarning, a9 as shouldTrackGlobalVarSources, aa as shouldWarnMissingTailwindEntry, ab as shouldWarnUnscopedMonorepo, ac as skippedSzFilesMessage, A as unplugin, ad as unscopedMonorepoMessage, ae as vitePlugin, af as webpackPlugin } from './shared/unplugin.CNwV3RrQ.cjs';
7
7
  import 'postcss';
8
8
  import '@csszyx/compiler';
9
9
  import 'esbuild';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
2
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
3
- import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.PhOFTQpB.mjs';
4
- export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, A as default, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, Q as isCompileSourceOptedIn, T as isHardIgnoredPath, U as isMonorepoPackage, W as isPackagesSkippedSource, X as isRSCServerModule, Y as mangleCodeClassesSync, Z as mangleHybridHazardMessage, _ as mergeThemes, $ as missingTailwindEntryMessage, a0 as normalizeGlobalVarAliasesForCache, a1 as parseThemeBlocks, a2 as recordGlobalVarSourceFile, a3 as resolveCompileSourceDirs, a4 as resolveNativeCacheIdentity, a5 as rollupPlugin, a6 as scanCustomPropertyNames, a7 as shouldEmitWarning, a8 as shouldTrackGlobalVarSources, a9 as shouldWarnMissingTailwindEntry, aa as shouldWarnUnscopedMonorepo, ab as skippedSzFilesMessage, A as unplugin, ac as unscopedMonorepoMessage, ad as vitePlugin, ae as webpackPlugin } from './shared/unplugin.PhOFTQpB.mjs';
3
+ import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.CNwV3RrQ.mjs';
4
+ export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, A as default, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, Q as isCompileSourceOptedIn, T as isHardIgnoredPath, U as isMonorepoPackage, W as isPackagesSkippedSource, X as isRSCServerModule, Y as mangleCodeClassesSync, Z as mangleEligibleClasses, _ as mangleHybridHazardMessage, $ as mergeThemes, a0 as missingTailwindEntryMessage, a1 as normalizeGlobalVarAliasesForCache, a2 as parseThemeBlocks, a3 as recordGlobalVarSourceFile, a4 as resolveCompileSourceDirs, a5 as resolveNativeCacheIdentity, a6 as rollupPlugin, a7 as scanCustomPropertyNames, a8 as shouldEmitWarning, a9 as shouldTrackGlobalVarSources, aa as shouldWarnMissingTailwindEntry, ab as shouldWarnUnscopedMonorepo, ac as skippedSzFilesMessage, A as unplugin, ad as unscopedMonorepoMessage, ae as vitePlugin, af as webpackPlugin } from './shared/unplugin.CNwV3RrQ.mjs';
5
5
  import 'postcss';
6
6
  import '@csszyx/compiler';
7
7
  import 'esbuild';
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as computeSafelistRelPath, f as createGlobalVarAliasValidationOptions, g as createGlobalVarMapAssetSource, h as createGlobalVarScanCacheKey, i as createRSCModuleRecord, j as cssHasContentScope, k as cssImportsTailwind, u as default, l as deleteRSCModuleRecord, m as esbuildPlugin, n as extractGlobalVarAliasesForManifest, o as fileMayContainSafelistableSz, p as findLocalImportSources, q as findRSCBoundaryViolation, r as findRSCGraphViolation, s as hasInjectableTailwindCandidate, t as hasTokens, v as hasUseClientDirective, w as hasUseServerDirective, x as isCompileSourceOptedIn, y as isHardIgnoredPath, z as isMonorepoPackage, A as isPackagesSkippedSource, B as isRSCServerModule, C as isTailwindReservedGlobalVar, D as mangleCodeClassesSync, E as mangleHybridHazardMessage, F as mergeThemes, G as missingTailwindEntryMessage, H as normalizeGlobalVarAliasesForCache, I as parseThemeBlocks, J as planGlobalVarAliases, K as readGlobalVarScanCache, L as recordGlobalVarSourceFile, M as resolveCompileSourceDirs, N as resolveGlobalVarScanCacheDir, O as resolveNativeCacheIdentity, P as rewriteGlobalVarCssAliases, Q as rollupPlugin, R as scanCustomPropertyNames, S as scanGlobalVarCss, T as shouldEmitWarning, U as shouldTrackGlobalVarSources, V as shouldWarnMissingTailwindEntry, W as shouldWarnUnscopedMonorepo, X as skippedSzFilesMessage, u as unplugin, Y as unscopedMonorepoMessage, Z as validateGlobalVarAliasInputs, _ as vitePlugin, $ as webpackPlugin, a0 as writeGlobalVarScanCache } from './shared/unplugin.CtHwCYxE.mjs';
2
+ export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as computeSafelistRelPath, f as createGlobalVarAliasValidationOptions, g as createGlobalVarMapAssetSource, h as createGlobalVarScanCacheKey, i as createRSCModuleRecord, j as cssHasContentScope, k as cssImportsTailwind, u as default, l as deleteRSCModuleRecord, m as esbuildPlugin, n as extractGlobalVarAliasesForManifest, o as fileMayContainSafelistableSz, p as findLocalImportSources, q as findRSCBoundaryViolation, r as findRSCGraphViolation, s as hasInjectableTailwindCandidate, t as hasTokens, v as hasUseClientDirective, w as hasUseServerDirective, x as isCompileSourceOptedIn, y as isHardIgnoredPath, z as isMonorepoPackage, A as isPackagesSkippedSource, B as isRSCServerModule, C as isTailwindReservedGlobalVar, D as mangleCodeClassesSync, E as mangleEligibleClasses, F as mangleHybridHazardMessage, G as mergeThemes, H as missingTailwindEntryMessage, I as normalizeGlobalVarAliasesForCache, J as parseThemeBlocks, K as planGlobalVarAliases, L as readGlobalVarScanCache, M as recordGlobalVarSourceFile, N as resolveCompileSourceDirs, O as resolveGlobalVarScanCacheDir, P as resolveNativeCacheIdentity, Q as rewriteGlobalVarCssAliases, R as rollupPlugin, S as scanCustomPropertyNames, T as scanGlobalVarCss, U as shouldEmitWarning, V as shouldTrackGlobalVarSources, W as shouldWarnMissingTailwindEntry, X as shouldWarnUnscopedMonorepo, Y as skippedSzFilesMessage, u as unplugin, Z as unscopedMonorepoMessage, _ as validateGlobalVarAliasInputs, $ as vitePlugin, a0 as webpackPlugin, a1 as writeGlobalVarScanCache } from './shared/unplugin.DtYxS8M8.mjs';
3
3
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
4
4
  import 'postcss';
5
5
  import 'postcss-selector-parser';
@@ -15,7 +15,7 @@ import '@csszyx/core/native';
15
15
  import '@csszyx/svelte-adapter';
16
16
  import '@csszyx/vue-adapter';
17
17
  import 'unplugin';
18
- import './shared/unplugin.B1mblcm-.mjs';
19
- import './shared/unplugin.B3RHYokB.mjs';
20
- import './shared/unplugin.CwcOd1q3.mjs';
18
+ import './shared/unplugin.nnsa7OVW.mjs';
19
+ import './shared/unplugin.D-K57LNR.mjs';
20
+ import './shared/unplugin.TtmP77BS.mjs';
21
21
  import 'postcss-value-parser';
@@ -10,7 +10,7 @@ function csszyxTurbopack(existing = {}, options = {}) {
10
10
  return {
11
11
  ...existing,
12
12
  rules: {
13
- ...existing.rules ?? {},
13
+ ...existing.rules,
14
14
  [glob]: {
15
15
  loaders: [
16
16
  {
@@ -8,7 +8,7 @@ function csszyxTurbopack(existing = {}, options = {}) {
8
8
  return {
9
9
  ...existing,
10
10
  rules: {
11
- ...existing.rules ?? {},
11
+ ...existing.rules,
12
12
  [glob]: {
13
13
  loaders: [
14
14
  {
@@ -3,11 +3,11 @@
3
3
  const node_crypto = require('node:crypto');
4
4
  const fs = require('node:fs');
5
5
  const path = require('node:path');
6
- const nextTransformMetadata = require('./shared/unplugin.CZKUWN1J.cjs');
7
- const nextWatcherCycle = require('./shared/unplugin.D6hes1O8.cjs');
8
- const transformCache = require('./shared/unplugin.D8vSG36M.cjs');
6
+ const nextTransformMetadata = require('./shared/unplugin.DdtOZANG.cjs');
7
+ const nextWatcherCycle = require('./shared/unplugin.C9dMG7ye.cjs');
8
+ const transformCache = require('./shared/unplugin.DVCQC5wq.cjs');
9
9
  require('@csszyx/compiler');
10
- require('./shared/unplugin.BCwRIUs_.cjs');
10
+ require('./shared/unplugin.CcA7jP1r.cjs');
11
11
  require('node:os');
12
12
  require('proper-lockfile');
13
13
 
@@ -143,7 +143,7 @@ function uniqueFiles(files) {
143
143
  return result;
144
144
  }
145
145
  function createShardCacheKey(context, metadata) {
146
- return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(path__namespace.relative(context.root, metadata.sourcePath).replace(/\\/g, "/")).digest("hex");
146
+ return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(transformCache.normalizePathSeparators(path__namespace.relative(context.root, metadata.sourcePath))).digest("hex");
147
147
  }
148
148
 
149
149
  exports.runNextPrebuild = runNextPrebuild;
@@ -1,11 +1,11 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import * as path from 'node:path';
4
- import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.VSslRpfN.mjs';
5
- import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.Dqt1aLCX.mjs';
6
- import { r as resolveTransformCacheDir } from './shared/unplugin.CwcOd1q3.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.Rl8sIkHi.mjs';
5
+ import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.Dg1tGPSd.mjs';
6
+ import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.D-K57LNR.mjs';
7
7
  import '@csszyx/compiler';
8
- import './shared/unplugin.B1mblcm-.mjs';
8
+ import './shared/unplugin.TtmP77BS.mjs';
9
9
  import 'node:os';
10
10
  import 'proper-lockfile';
11
11
 
@@ -126,7 +126,7 @@ function uniqueFiles(files) {
126
126
  return result;
127
127
  }
128
128
  function createShardCacheKey(context, metadata) {
129
- return createHash("sha256").update(context.identity.generation).update("\0").update(path.relative(context.root, metadata.sourcePath).replace(/\\/g, "/")).digest("hex");
129
+ return createHash("sha256").update(context.identity.generation).update("\0").update(normalizePathSeparators(path.relative(context.root, metadata.sourcePath))).digest("hex");
130
130
  }
131
131
 
132
132
  export { runNextPrebuild };
@@ -4,14 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const node_crypto = require('node:crypto');
6
6
  const path = require('node:path');
7
- const nextWatcherCycle = require('./shared/unplugin.D6hes1O8.cjs');
8
- const nextTransformMetadata = require('./shared/unplugin.CZKUWN1J.cjs');
9
- const runtimeImportScan = require('./shared/unplugin.Rov-j_Wm.cjs');
10
- const transformCache = require('./shared/unplugin.D8vSG36M.cjs');
7
+ const nextWatcherCycle = require('./shared/unplugin.C9dMG7ye.cjs');
8
+ const nextTransformMetadata = require('./shared/unplugin.DdtOZANG.cjs');
9
+ const runtimeImportScan = require('./shared/unplugin.DmuOKVS4.cjs');
10
+ const transformCache = require('./shared/unplugin.DVCQC5wq.cjs');
11
11
  require('node:fs');
12
12
  require('node:os');
13
13
  require('proper-lockfile');
14
- require('./shared/unplugin.BCwRIUs_.cjs');
14
+ require('./shared/unplugin.CcA7jP1r.cjs');
15
15
  require('@csszyx/compiler');
16
16
 
17
17
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -29,7 +29,6 @@ function _interopNamespaceCompat(e) {
29
29
 
30
30
  const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
31
31
 
32
- const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
33
32
  function injectNextRuntimeImports(code, usage) {
34
33
  const helpers = runtimeHelpersFromUsage(usage);
35
34
  if (helpers.length === 0) {
@@ -75,11 +74,7 @@ function runtimeHelpersFromUsage(usage) {
75
74
  return helpers;
76
75
  }
77
76
  function insertRuntimeImport(code, importStmt) {
78
- const directiveMatch = code.match(DIRECTIVE_PROLOGUE_PREFIX_RE);
79
- if (!directiveMatch) {
80
- return `${importStmt}${code}`;
81
- }
82
- return code.replace(directiveMatch[0], `${directiveMatch[1]}${directiveMatch[2]}${importStmt}`);
77
+ return runtimeImportScan.insertAfterUseDirective(code, importStmt);
83
78
  }
84
79
 
85
80
  function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
@@ -223,7 +218,7 @@ function hasEnabledMangleVars(config) {
223
218
  return config.mangleVars === true;
224
219
  }
225
220
  function createShardCacheKey(context, metadata) {
226
- return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(path__namespace.relative(context.root, metadata.sourcePath).replace(/\\/g, "/")).digest("hex");
221
+ return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(transformCache.normalizePathSeparators(path__namespace.relative(context.root, metadata.sourcePath))).digest("hex");
227
222
  }
228
223
 
229
224
  exports.default = nextTurboLoader;
@@ -1,16 +1,15 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import * as path from 'node:path';
3
- import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle, v as validateNextGenerationManifest, a as readNextGenerationManifest } from './shared/unplugin.Dqt1aLCX.mjs';
4
- import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.VSslRpfN.mjs';
5
- import { i as importsRuntimeHelper } from './shared/unplugin.B3RHYokB.mjs';
6
- import { r as resolveTransformCacheDir } from './shared/unplugin.CwcOd1q3.mjs';
3
+ import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle, v as validateNextGenerationManifest, a as readNextGenerationManifest } from './shared/unplugin.Dg1tGPSd.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.Rl8sIkHi.mjs';
5
+ import { i as importsRuntimeHelper, a as insertAfterUseDirective } from './shared/unplugin.nnsa7OVW.mjs';
6
+ import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.D-K57LNR.mjs';
7
7
  import 'node:fs';
8
8
  import 'node:os';
9
9
  import 'proper-lockfile';
10
- import './shared/unplugin.B1mblcm-.mjs';
10
+ import './shared/unplugin.TtmP77BS.mjs';
11
11
  import '@csszyx/compiler';
12
12
 
13
- const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
14
13
  function injectNextRuntimeImports(code, usage) {
15
14
  const helpers = runtimeHelpersFromUsage(usage);
16
15
  if (helpers.length === 0) {
@@ -56,11 +55,7 @@ function runtimeHelpersFromUsage(usage) {
56
55
  return helpers;
57
56
  }
58
57
  function insertRuntimeImport(code, importStmt) {
59
- const directiveMatch = code.match(DIRECTIVE_PROLOGUE_PREFIX_RE);
60
- if (!directiveMatch) {
61
- return `${importStmt}${code}`;
62
- }
63
- return code.replace(directiveMatch[0], `${directiveMatch[1]}${directiveMatch[2]}${importStmt}`);
58
+ return insertAfterUseDirective(code, importStmt);
64
59
  }
65
60
 
66
61
  function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
@@ -204,7 +199,7 @@ function hasEnabledMangleVars(config) {
204
199
  return config.mangleVars === true;
205
200
  }
206
201
  function createShardCacheKey(context, metadata) {
207
- return createHash("sha256").update(context.identity.generation).update("\0").update(path.relative(context.root, metadata.sourcePath).replace(/\\/g, "/")).digest("hex");
202
+ return createHash("sha256").update(context.identity.generation).update("\0").update(normalizePathSeparators(path.relative(context.root, metadata.sourcePath))).digest("hex");
208
203
  }
209
204
 
210
205
  export { nextTurboLoader as default, runNextTurboLoader };
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('node:path');
4
- const nextWatcherCycle = require('./shared/unplugin.D6hes1O8.cjs');
4
+ const nextWatcherCycle = require('./shared/unplugin.C9dMG7ye.cjs');
5
5
  require('node:fs');
6
6
  require('node:crypto');
7
7
  require('node:os');
8
8
  require('proper-lockfile');
9
- require('./shared/unplugin.BCwRIUs_.cjs');
9
+ require('./shared/unplugin.CcA7jP1r.cjs');
10
10
 
11
11
  function _interopNamespaceCompat(e) {
12
12
  if (e && typeof e === 'object' && 'default' in e) return e;
@@ -1,10 +1,10 @@
1
1
  import * as path from 'node:path';
2
- import { r as runNextWatcherCycle } from './shared/unplugin.Dqt1aLCX.mjs';
2
+ import { r as runNextWatcherCycle } from './shared/unplugin.Dg1tGPSd.mjs';
3
3
  import 'node:fs';
4
4
  import 'node:crypto';
5
5
  import 'node:os';
6
6
  import 'proper-lockfile';
7
- import './shared/unplugin.B1mblcm-.mjs';
7
+ import './shared/unplugin.TtmP77BS.mjs';
8
8
 
9
9
  class NextWatcherLoop {
10
10
  context;
@@ -5,7 +5,7 @@ const fs = require('node:fs');
5
5
  const node_crypto = require('node:crypto');
6
6
  const node_os = require('node:os');
7
7
  const lockfile = require('proper-lockfile');
8
- const htmlEscape = require('./unplugin.BCwRIUs_.cjs');
8
+ const htmlEscape = require('./unplugin.CcA7jP1r.cjs');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
11
 
@@ -253,8 +253,10 @@ function renderTailwindSourceHtml(classNames) {
253
253
  if (classNames.length === 0) {
254
254
  return "<!-- csszyx Next safelist: empty -->\n";
255
255
  }
256
- return `${classNames.map((className) => `<div class="${htmlEscape.escapeHtmlAttribute(className)}"></div>`).join("\n")}
257
- `;
256
+ const structuralHtml = classNames.map((className) => `<div class="${htmlEscape.escapeHtmlAttribute(className)}"></div>`).join("\n");
257
+ const scannerCandidates = htmlEscape.renderTailwindScannerCandidates(classNames);
258
+ return `${structuralHtml}
259
+ ${scannerCandidates}`;
258
260
  }
259
261
  function createLockMetadata(options) {
260
262
  const now = new Date(options.now ?? Date.now()).toISOString();
@@ -430,12 +430,17 @@ interface PluginState {
430
430
  /** Memoized `isMonorepoPackage(rootDir)` result; `undefined` until computed. */
431
431
  inMonorepo?: boolean;
432
432
  /**
433
- * Classes csszyx generated by lowering `sz` props the ONLY classes the
434
- * mangle map may rename. Author-written `className` values are deliberately
435
- * excluded: renaming them would break selectors an external stylesheet (or
436
- * JS that references classes by name) owns.
433
+ * Classes csszyx generated by lowering `sz` props. Final map eligibility
434
+ * subtracts authoredClasses because a class can be both generated and used
435
+ * by a raw selector consumer.
437
436
  */
438
437
  ownedClasses: Set<string>;
438
+ /**
439
+ * Classes written through author-facing class/className attributes. Any
440
+ * overlap with ownedClasses must keep its original name because bundled
441
+ * helper calls may not preserve enough context for safe string rewriting.
442
+ */
443
+ authoredClasses: Set<string>;
439
444
  /** Unresolvable-spread warnings surfaced to the build log in every mode. */
440
445
  spreadWarnings: Set<string>;
441
446
  /**
@@ -706,6 +711,14 @@ declare function isHardIgnoredPath(id: string, sourceDirs?: readonly string[]):
706
711
  * @returns true when the file should be prescanned for safelist extraction.
707
712
  */
708
713
  declare function fileMayContainSafelistableSz(content: string): boolean;
714
+ /**
715
+ * Return csszyx-owned classes that are safe to rename.
716
+ *
717
+ * @param ownedClasses Classes emitted from sz transforms.
718
+ * @param authoredClasses Classes also written in class/className source positions.
719
+ * @returns Owned classes with hybrid raw consumers removed.
720
+ */
721
+ declare function mangleEligibleClasses(ownedClasses: ReadonlySet<string>, authoredClasses: ReadonlySet<string>): string[];
709
722
  /**
710
723
  * Whether a file is workspace-package source that csszyx skipped only because it
711
724
  * lives under `/packages/` and is not under any opted-in `compileSources`
@@ -836,5 +849,5 @@ declare const rollupPlugin: (options?: PartialCsszyxConfig) => InputPluginOption
836
849
  */
837
850
  declare const esbuildPlugin: (options?: PartialCsszyxConfig) => Plugin;
838
851
 
839
- export { missingTailwindEntryMessage as $, unplugin as A, deleteRSCModuleRecord as B, esbuildPlugin as D, extractGlobalVarAliasesForManifest as E, fileMayContainSafelistableSz as F, findLocalImportSources as H, findRSCBoundaryViolation as I, findRSCGraphViolation as J, hasInjectableTailwindCandidate as K, hasTokens as L, hasUseClientDirective as N, hasUseServerDirective as O, isCompileSourceOptedIn as Q, isHardIgnoredPath as T, isMonorepoPackage as U, isPackagesSkippedSource as W, isRSCServerModule as X, mangleCodeClassesSync as Y, mangleHybridHazardMessage as Z, mergeThemes as _, normalizeGlobalVarAliasesForCache as a0, parseThemeBlocks as a1, recordGlobalVarSourceFile as a2, resolveCompileSourceDirs as a3, resolveNativeCacheIdentity as a4, rollupPlugin as a5, scanCustomPropertyNames as a6, shouldEmitWarning as a7, shouldTrackGlobalVarSources as a8, shouldWarnMissingTailwindEntry as a9, shouldWarnUnscopedMonorepo as aa, skippedSzFilesMessage as ab, unscopedMonorepoMessage as ac, vitePlugin as ad, webpackPlugin as ae, appendTailwindSourceDirective as r, assertNoRSCBoundaryViolation as s, assertNoRSCGraphViolation as t, collectMangleHybridHazards as u, computeSafelistRelPath as v, createGlobalVarMapAssetSource as w, createRSCModuleRecord as x, cssHasContentScope as y, cssImportsTailwind as z };
852
+ export { mergeThemes as $, unplugin as A, deleteRSCModuleRecord as B, esbuildPlugin as D, extractGlobalVarAliasesForManifest as E, fileMayContainSafelistableSz as F, findLocalImportSources as H, findRSCBoundaryViolation as I, findRSCGraphViolation as J, hasInjectableTailwindCandidate as K, hasTokens as L, hasUseClientDirective as N, hasUseServerDirective as O, isCompileSourceOptedIn as Q, isHardIgnoredPath as T, isMonorepoPackage as U, isPackagesSkippedSource as W, isRSCServerModule as X, mangleCodeClassesSync as Y, mangleEligibleClasses as Z, mangleHybridHazardMessage as _, missingTailwindEntryMessage as a0, normalizeGlobalVarAliasesForCache as a1, parseThemeBlocks as a2, recordGlobalVarSourceFile as a3, resolveCompileSourceDirs as a4, resolveNativeCacheIdentity as a5, rollupPlugin as a6, scanCustomPropertyNames as a7, shouldEmitWarning as a8, shouldTrackGlobalVarSources as a9, shouldWarnMissingTailwindEntry as aa, shouldWarnUnscopedMonorepo as ab, skippedSzFilesMessage as ac, unscopedMonorepoMessage as ad, vitePlugin as ae, webpackPlugin as af, appendTailwindSourceDirective as r, assertNoRSCBoundaryViolation as s, assertNoRSCGraphViolation as t, collectMangleHybridHazards as u, computeSafelistRelPath as v, createGlobalVarMapAssetSource as w, createRSCModuleRecord as x, cssHasContentScope as y, cssImportsTailwind as z };
840
853
  export type { CssVarScanResult as C, GlobalVarScanCacheKeyInput as G, MangleHybridHazards as M, PlanGlobalVarAliasesInput as P, RewriteGlobalVarCssAliasesOptions as R, ScanGlobalVarCssOptions as S, ValidateGlobalVarAliasInputsOptions as V, GlobalVarAliasPlan as a, GlobalVarCssAliasRewriteResult as b, CreateGlobalVarAliasValidationOptionsInput as c, GlobalVarAliasValidationResult as d, CssVarDefinition as e, CssVarLocation as f, CssVarReference as g, GlobalVarAliasDiagnostic as h, GlobalVarAliasDiagnosticSeverity as i, GlobalVarAliasEntry as j, GlobalVarCodeSource as k, GlobalVarCssAssetSource as l, GlobalVarCssSource as m, GlobalVarScanCacheEntry as n, ParsedTheme as o, RSCBoundaryViolation as p, RSCModuleRecord as q };
@@ -430,12 +430,17 @@ interface PluginState {
430
430
  /** Memoized `isMonorepoPackage(rootDir)` result; `undefined` until computed. */
431
431
  inMonorepo?: boolean;
432
432
  /**
433
- * Classes csszyx generated by lowering `sz` props the ONLY classes the
434
- * mangle map may rename. Author-written `className` values are deliberately
435
- * excluded: renaming them would break selectors an external stylesheet (or
436
- * JS that references classes by name) owns.
433
+ * Classes csszyx generated by lowering `sz` props. Final map eligibility
434
+ * subtracts authoredClasses because a class can be both generated and used
435
+ * by a raw selector consumer.
437
436
  */
438
437
  ownedClasses: Set<string>;
438
+ /**
439
+ * Classes written through author-facing class/className attributes. Any
440
+ * overlap with ownedClasses must keep its original name because bundled
441
+ * helper calls may not preserve enough context for safe string rewriting.
442
+ */
443
+ authoredClasses: Set<string>;
439
444
  /** Unresolvable-spread warnings surfaced to the build log in every mode. */
440
445
  spreadWarnings: Set<string>;
441
446
  /**
@@ -706,6 +711,14 @@ declare function isHardIgnoredPath(id: string, sourceDirs?: readonly string[]):
706
711
  * @returns true when the file should be prescanned for safelist extraction.
707
712
  */
708
713
  declare function fileMayContainSafelistableSz(content: string): boolean;
714
+ /**
715
+ * Return csszyx-owned classes that are safe to rename.
716
+ *
717
+ * @param ownedClasses Classes emitted from sz transforms.
718
+ * @param authoredClasses Classes also written in class/className source positions.
719
+ * @returns Owned classes with hybrid raw consumers removed.
720
+ */
721
+ declare function mangleEligibleClasses(ownedClasses: ReadonlySet<string>, authoredClasses: ReadonlySet<string>): string[];
709
722
  /**
710
723
  * Whether a file is workspace-package source that csszyx skipped only because it
711
724
  * lives under `/packages/` and is not under any opted-in `compileSources`
@@ -836,5 +849,5 @@ declare const rollupPlugin: (options?: PartialCsszyxConfig) => InputPluginOption
836
849
  */
837
850
  declare const esbuildPlugin: (options?: PartialCsszyxConfig) => Plugin;
838
851
 
839
- export { missingTailwindEntryMessage as $, unplugin as A, deleteRSCModuleRecord as B, esbuildPlugin as D, extractGlobalVarAliasesForManifest as E, fileMayContainSafelistableSz as F, findLocalImportSources as H, findRSCBoundaryViolation as I, findRSCGraphViolation as J, hasInjectableTailwindCandidate as K, hasTokens as L, hasUseClientDirective as N, hasUseServerDirective as O, isCompileSourceOptedIn as Q, isHardIgnoredPath as T, isMonorepoPackage as U, isPackagesSkippedSource as W, isRSCServerModule as X, mangleCodeClassesSync as Y, mangleHybridHazardMessage as Z, mergeThemes as _, normalizeGlobalVarAliasesForCache as a0, parseThemeBlocks as a1, recordGlobalVarSourceFile as a2, resolveCompileSourceDirs as a3, resolveNativeCacheIdentity as a4, rollupPlugin as a5, scanCustomPropertyNames as a6, shouldEmitWarning as a7, shouldTrackGlobalVarSources as a8, shouldWarnMissingTailwindEntry as a9, shouldWarnUnscopedMonorepo as aa, skippedSzFilesMessage as ab, unscopedMonorepoMessage as ac, vitePlugin as ad, webpackPlugin as ae, appendTailwindSourceDirective as r, assertNoRSCBoundaryViolation as s, assertNoRSCGraphViolation as t, collectMangleHybridHazards as u, computeSafelistRelPath as v, createGlobalVarMapAssetSource as w, createRSCModuleRecord as x, cssHasContentScope as y, cssImportsTailwind as z };
852
+ export { mergeThemes as $, unplugin as A, deleteRSCModuleRecord as B, esbuildPlugin as D, extractGlobalVarAliasesForManifest as E, fileMayContainSafelistableSz as F, findLocalImportSources as H, findRSCBoundaryViolation as I, findRSCGraphViolation as J, hasInjectableTailwindCandidate as K, hasTokens as L, hasUseClientDirective as N, hasUseServerDirective as O, isCompileSourceOptedIn as Q, isHardIgnoredPath as T, isMonorepoPackage as U, isPackagesSkippedSource as W, isRSCServerModule as X, mangleCodeClassesSync as Y, mangleEligibleClasses as Z, mangleHybridHazardMessage as _, missingTailwindEntryMessage as a0, normalizeGlobalVarAliasesForCache as a1, parseThemeBlocks as a2, recordGlobalVarSourceFile as a3, resolveCompileSourceDirs as a4, resolveNativeCacheIdentity as a5, rollupPlugin as a6, scanCustomPropertyNames as a7, shouldEmitWarning as a8, shouldTrackGlobalVarSources as a9, shouldWarnMissingTailwindEntry as aa, shouldWarnUnscopedMonorepo as ab, skippedSzFilesMessage as ac, unscopedMonorepoMessage as ad, vitePlugin as ae, webpackPlugin as af, appendTailwindSourceDirective as r, assertNoRSCBoundaryViolation as s, assertNoRSCGraphViolation as t, collectMangleHybridHazards as u, computeSafelistRelPath as v, createGlobalVarMapAssetSource as w, createRSCModuleRecord as x, cssHasContentScope as y, cssImportsTailwind as z };
840
853
  export type { CssVarScanResult as C, GlobalVarScanCacheKeyInput as G, MangleHybridHazards as M, PlanGlobalVarAliasesInput as P, RewriteGlobalVarCssAliasesOptions as R, ScanGlobalVarCssOptions as S, ValidateGlobalVarAliasInputsOptions as V, GlobalVarAliasPlan as a, GlobalVarCssAliasRewriteResult as b, CreateGlobalVarAliasValidationOptionsInput as c, GlobalVarAliasValidationResult as d, CssVarDefinition as e, CssVarLocation as f, CssVarReference as g, GlobalVarAliasDiagnostic as h, GlobalVarAliasDiagnosticSeverity as i, GlobalVarAliasEntry as j, GlobalVarCodeSource as k, GlobalVarCssAssetSource as l, GlobalVarCssSource as m, GlobalVarScanCacheEntry as n, ParsedTheme as o, RSCBoundaryViolation as p, RSCModuleRecord as q };
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ function sortStrings(values) {
4
+ return [...values].sort((a, b) => {
5
+ if (a < b) return -1;
6
+ if (a > b) return 1;
7
+ return 0;
8
+ });
9
+ }
10
+
11
+ const BACKSLASH = String.fromCodePoint(92);
12
+ function unicodeEscape(hexadecimal) {
13
+ return `${BACKSLASH}u${hexadecimal}`;
14
+ }
15
+ function replaceEveryLiteral(value, search, replacement) {
16
+ return value.split(search).join(replacement);
17
+ }
18
+ function escapeSingleQuotedString(value) {
19
+ let escaped = replaceEveryLiteral(value, BACKSLASH, BACKSLASH.repeat(2));
20
+ escaped = replaceEveryLiteral(escaped, "'", `${BACKSLASH}'`);
21
+ escaped = replaceEveryLiteral(escaped, "\r", `${BACKSLASH}r`);
22
+ return replaceEveryLiteral(escaped, "\n", `${BACKSLASH}n`);
23
+ }
24
+ function escapeDoubleQuotedString(value) {
25
+ const escaped = replaceEveryLiteral(value, BACKSLASH, BACKSLASH.repeat(2));
26
+ return replaceEveryLiteral(escaped, '"', `${BACKSLASH}"`);
27
+ }
28
+
29
+ function escapeHtmlAttribute(value) {
30
+ let escaped = replaceEveryLiteral(value, "&", "&amp;");
31
+ escaped = replaceEveryLiteral(escaped, '"', "&quot;");
32
+ escaped = replaceEveryLiteral(escaped, "<", "&lt;");
33
+ return replaceEveryLiteral(escaped, ">", "&gt;");
34
+ }
35
+ const RAW_SAFELIST_MARKER = "<!-- csszyx exact scanner candidates -->";
36
+ function renderTailwindScannerCandidates(classNames) {
37
+ return `${RAW_SAFELIST_MARKER}
38
+ ${classNames.join("\n")}
39
+ `;
40
+ }
41
+
42
+ exports.escapeDoubleQuotedString = escapeDoubleQuotedString;
43
+ exports.escapeHtmlAttribute = escapeHtmlAttribute;
44
+ exports.escapeSingleQuotedString = escapeSingleQuotedString;
45
+ exports.renderTailwindScannerCandidates = renderTailwindScannerCandidates;
46
+ exports.replaceEveryLiteral = replaceEveryLiteral;
47
+ exports.sortStrings = sortStrings;
48
+ exports.unicodeEscape = unicodeEscape;
@@ -2,6 +2,11 @@ import { createHash, randomUUID } from 'node:crypto';
2
2
  import * as fs from 'node:fs';
3
3
  import * as path from 'node:path';
4
4
 
5
+ const WINDOWS_PATH_SEPARATOR = String.fromCodePoint(92);
6
+ function normalizePathSeparators(value) {
7
+ return value.split(WINDOWS_PATH_SEPARATOR).join("/");
8
+ }
9
+
5
10
  const CACHE_SCHEMA_VERSION = 10;
6
11
  function resolveTransformCacheDir(rootDir, cacheDir) {
7
12
  return path.resolve(rootDir, cacheDir ?? ".csszyx/cache", "transform");
@@ -201,4 +206,4 @@ function evictMemoryCacheToBudget(cache, totalCodeChars, maxEntries, maxCodeChar
201
206
  return total;
202
207
  }
203
208
 
204
- export { readTransformCache as a, evictMemoryCacheToBudget as b, createTransformCacheKey as c, evictOldTransformCacheEntries as e, resolveTransformCacheDir as r, writeTransformCache as w };
209
+ export { readTransformCache as a, evictMemoryCacheToBudget as b, createTransformCacheKey as c, evictOldTransformCacheEntries as e, normalizePathSeparators as n, resolveTransformCacheDir as r, writeTransformCache as w };
@@ -19,6 +19,11 @@ function _interopNamespaceCompat(e) {
19
19
  const fs__namespace = /*#__PURE__*/_interopNamespaceCompat(fs);
20
20
  const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
21
21
 
22
+ const WINDOWS_PATH_SEPARATOR = String.fromCodePoint(92);
23
+ function normalizePathSeparators(value) {
24
+ return value.split(WINDOWS_PATH_SEPARATOR).join("/");
25
+ }
26
+
22
27
  const CACHE_SCHEMA_VERSION = 10;
23
28
  function resolveTransformCacheDir(rootDir, cacheDir) {
24
29
  return path__namespace.resolve(rootDir, cacheDir ?? ".csszyx/cache", "transform");
@@ -221,6 +226,7 @@ function evictMemoryCacheToBudget(cache, totalCodeChars, maxEntries, maxCodeChar
221
226
  exports.createTransformCacheKey = createTransformCacheKey;
222
227
  exports.evictMemoryCacheToBudget = evictMemoryCacheToBudget;
223
228
  exports.evictOldTransformCacheEntries = evictOldTransformCacheEntries;
229
+ exports.normalizePathSeparators = normalizePathSeparators;
224
230
  exports.readTransformCache = readTransformCache;
225
231
  exports.resolveTransformCacheDir = resolveTransformCacheDir;
226
232
  exports.writeTransformCache = writeTransformCache;