@csszyx/unplugin 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +7 -4
  3. package/dist/index.d.cts +2 -2
  4. package/dist/index.d.mts +2 -2
  5. package/dist/index.mjs +6 -4
  6. package/dist/jest-transform.cjs +186 -0
  7. package/dist/jest-transform.d.cts +112 -0
  8. package/dist/jest-transform.d.mts +110 -0
  9. package/dist/jest-transform.mjs +175 -0
  10. package/dist/next-prebuild.cjs +6 -5
  11. package/dist/next-prebuild.mjs +5 -4
  12. package/dist/next-turbo-loader.cjs +10 -8
  13. package/dist/next-turbo-loader.mjs +7 -5
  14. package/dist/next-watcher.cjs +3 -2
  15. package/dist/next-watcher.mjs +3 -2
  16. package/dist/shared/{unplugin.J6ue_lRJ.cjs → unplugin.2qOISpzl.cjs} +1 -114
  17. package/dist/shared/{unplugin.C-oQU1jl.mjs → unplugin.2uf-U76p.mjs} +1 -1
  18. package/dist/shared/{unplugin.Ceq-N4jI.mjs → unplugin.995yC_cN.mjs} +2 -110
  19. package/dist/shared/{unplugin.D3yBoTHP.cjs → unplugin.9zs6T4Gf.cjs} +75 -66
  20. package/dist/shared/{unplugin.PKo7wFzu.d.cts → unplugin.BO2_hyS3.d.cts} +38 -5
  21. package/dist/shared/{unplugin.DH_ij6cf.mjs → unplugin.Ba3O1r8M.mjs} +2 -6
  22. package/dist/shared/unplugin.BqKLlo1h.cjs +8 -0
  23. package/dist/shared/{unplugin.Vn9x8SBP.mjs → unplugin.C3bgc29e.mjs} +3 -2
  24. package/dist/shared/{unplugin.Dx0ngYWw.mjs → unplugin.Cs4H9z9v.mjs} +48 -40
  25. package/dist/shared/{unplugin.BLptVbUe.mjs → unplugin.DPSQP5XG.mjs} +1 -1
  26. package/dist/shared/{unplugin.DDSWQJYX.cjs → unplugin.DS6CFjim.cjs} +3 -8
  27. package/dist/shared/{unplugin.gksolKh2.cjs → unplugin.DXzIP7lP.cjs} +5 -4
  28. package/dist/shared/unplugin.DcXM9sq5.mjs +109 -0
  29. package/dist/shared/unplugin.Defu9wGh.cjs +115 -0
  30. package/dist/shared/{unplugin.Bu2rzRtv.d.mts → unplugin.DptK3pl4.d.mts} +38 -5
  31. package/dist/shared/{unplugin.BzF0V2kw.cjs → unplugin.YcnV3Izb.cjs} +6 -6
  32. package/dist/shared/{unplugin.BWnmKv07.cjs → unplugin.alhYXymJ.cjs} +1 -1
  33. package/dist/shared/unplugin.wMeicb6E.mjs +6 -0
  34. package/dist/vite.cjs +6 -4
  35. package/dist/vite.d.cts +2 -2
  36. package/dist/vite.d.mts +1 -1
  37. package/dist/vite.mjs +6 -4
  38. package/dist/webpack.cjs +6 -4
  39. package/dist/webpack.d.cts +1 -2
  40. package/dist/webpack.d.mts +1 -1
  41. package/dist/webpack.mjs +6 -4
  42. package/package.json +19 -9
package/README.md CHANGED
@@ -69,7 +69,7 @@ module.exports = {
69
69
  - **sz prop transform** -- Compiles `sz={{ }}` objects into `className` strings with ONE engine that ships as two artifacts: the **native Rust addon** (default, through the optional `@csszyx/core-*` platform package) and the same engine compiled to **WebAssembly** (shipped inside `@csszyx/core`, the automatic fallback when the native binary is absent — pin it with `build.parser: "wasm"`).
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 owned class names (e.g., `text-center` -> `z`) while retaining names shared with source-visible `class`/`className` strings and template quasis
72
+ - **CSS mangling** (opt-in) -- Renames owned class names to short tokens (e.g., `text-center` -> `z`) to hide the utility vocabulary, not to shrink the payload, 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
75
  Class mangling runs in Vite, Webpack, and Rollup final-output hooks. The esbuild
package/dist/index.cjs CHANGED
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const cssMangler = require('./css-mangler.cjs');
6
- const unplugin = require('./shared/unplugin.D3yBoTHP.cjs');
7
- const themeGroupsFile = require('./shared/unplugin.J6ue_lRJ.cjs');
6
+ const unplugin = require('./shared/unplugin.9zs6T4Gf.cjs');
7
+ const themeGroupsFile = require('./shared/unplugin.2qOISpzl.cjs');
8
8
  const types = require('@csszyx/types');
9
- const safelistSource = require('./shared/unplugin.DDSWQJYX.cjs');
9
+ const safelistSource = require('./shared/unplugin.DS6CFjim.cjs');
10
10
  require('postcss');
11
11
  require('postcss-selector-parser');
12
12
  require('node:crypto');
@@ -21,7 +21,9 @@ require('@csszyx/core/native');
21
21
  require('@csszyx/svelte-adapter');
22
22
  require('@csszyx/vue-adapter');
23
23
  require('unplugin');
24
- require('./shared/unplugin.BzF0V2kw.cjs');
24
+ require('./shared/unplugin.YcnV3Izb.cjs');
25
+ require('./shared/unplugin.BqKLlo1h.cjs');
26
+ require('./shared/unplugin.Defu9wGh.cjs');
25
27
  require('node:zlib');
26
28
  require('postcss-value-parser');
27
29
 
@@ -44,6 +46,7 @@ exports.createRSCModuleRecord = unplugin.createRSCModuleRecord;
44
46
  exports.cssHasContentScope = unplugin.cssHasContentScope;
45
47
  exports.default = unplugin.unplugin;
46
48
  exports.deleteRSCModuleRecord = unplugin.deleteRSCModuleRecord;
49
+ exports.emitKeyValueDiagnostic = unplugin.emitKeyValueDiagnostic;
47
50
  exports.emitMissingCssFallback = unplugin.emitMissingCssFallback;
48
51
  exports.esbuildPlugin = unplugin.esbuildPlugin;
49
52
  exports.extractGlobalVarAliasesForManifest = unplugin.extractGlobalVarAliasesForManifest;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { CSSManglerOptions, CSSManglerResult, ClassAttributeSelector, MangleMap, classAttributeSelectorKey, 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.PKo7wFzu.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.BO2_hyS3.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 MangleSelectorHazard, p as ParsedTheme, q as ParsedUtilities, Q as QuietMode, r as RSCBoundaryViolation, s as RSCModuleRecord, t as allocateMangleTokens, u as assertNoRSCBoundaryViolation, v as assertNoRSCGraphViolation, w as collectMangleHybridHazards, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, B as deleteRSCModuleRecord, D as emitMissingCssFallback, E as esbuildPlugin, F as extractGlobalVarAliasesForManifest, H as fileMayContainSafelistableSz, I as findLocalImportSources, J as findRSCBoundaryViolation, K as findRSCGraphViolation, L as hasInjectableTailwindCandidate, N as hasTokens, O as hasUseClientDirective, T as hasUseServerDirective, U as isAdvisoryDiagnostic, W as isCompileSourceOptedIn, X as isHardIgnoredPath, Y as isMangleableCssId, Z as isMonorepoPackage, _ as isPackagesSkippedSource, $ as isRSCServerModule, a0 as lateMangleCensusMessage, a1 as mangleCodeClassesSync, a2 as mangleEligibleClasses, a3 as mangleHybridHazardMessage, a4 as mergeThemes, a5 as missingTailwindEntryMessage, a6 as normalizeGlobalVarAliasesForCache, a7 as parseThemeBlocks, a8 as parseUtilityBlocks, a9 as realContentHashDisabledMessage, aa as recordGlobalVarSourceFile, ab as resolveCompileSourceDirs, ac as resolveNativeCacheIdentity, ad as resolveQuietMode, ae as rollupPlugin, af as scanCustomPropertyNames, ag as shouldEmitMissingCssFallback, ah as shouldEmitWarning, ai as shouldHoldAdvisories, aj as shouldTrackGlobalVarSources, ak as shouldWarnMissingTailwindEntry, al as shouldWarnUnscopedMonorepo, am as skippedSzFilesMessage, an as suppressedAdvisoryMessage, A as unplugin, ao as unscopedMonorepoMessage, ap as vitePlugin, aq as watchModeMangleMessage, ar as webpackPlugin } from './shared/unplugin.PKo7wFzu.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 MangleSelectorHazard, p as ParsedTheme, q as ParsedUtilities, Q as QuietMode, r as RSCBoundaryViolation, s as RSCModuleRecord, t as allocateMangleTokens, u as assertNoRSCBoundaryViolation, v as assertNoRSCGraphViolation, w as collectMangleHybridHazards, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, B as deleteRSCModuleRecord, D as emitKeyValueDiagnostic, E as emitMissingCssFallback, F as esbuildPlugin, H as extractGlobalVarAliasesForManifest, I as fileMayContainSafelistableSz, J as findLocalImportSources, K as findRSCBoundaryViolation, L as findRSCGraphViolation, N as hasInjectableTailwindCandidate, O as hasTokens, T as hasUseClientDirective, U as hasUseServerDirective, W as isAdvisoryDiagnostic, X as isCompileSourceOptedIn, Y as isHardIgnoredPath, Z as isMangleableCssId, _ as isMonorepoPackage, $ as isPackagesSkippedSource, a0 as isRSCServerModule, a1 as lateMangleCensusMessage, a2 as mangleCodeClassesSync, a3 as mangleEligibleClasses, a4 as mangleHybridHazardMessage, a5 as mergeThemes, a6 as missingTailwindEntryMessage, a7 as normalizeGlobalVarAliasesForCache, a8 as parseThemeBlocks, a9 as parseUtilityBlocks, aa as realContentHashDisabledMessage, ab as recordGlobalVarSourceFile, ac as resolveCompileSourceDirs, ad as resolveNativeCacheIdentity, ae as resolveQuietMode, af as rollupPlugin, ag as scanCustomPropertyNames, ah as shouldEmitMissingCssFallback, ai as shouldEmitWarning, aj as shouldHoldAdvisories, ak as shouldTrackGlobalVarSources, al as shouldWarnMissingTailwindEntry, am as shouldWarnUnscopedMonorepo, an as skippedSzFilesMessage, ao as suppressedAdvisoryMessage, A as unplugin, ap as unscopedMonorepoMessage, aq as vitePlugin, ar as watchModeMangleMessage, as as webpackPlugin } from './shared/unplugin.BO2_hyS3.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, ClassAttributeSelector, MangleMap, classAttributeSelectorKey, 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.Bu2rzRtv.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 MangleSelectorHazard, p as ParsedTheme, q as ParsedUtilities, Q as QuietMode, r as RSCBoundaryViolation, s as RSCModuleRecord, t as allocateMangleTokens, u as assertNoRSCBoundaryViolation, v as assertNoRSCGraphViolation, w as collectMangleHybridHazards, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as default, B as deleteRSCModuleRecord, D as emitMissingCssFallback, E as esbuildPlugin, F as extractGlobalVarAliasesForManifest, H as fileMayContainSafelistableSz, I as findLocalImportSources, J as findRSCBoundaryViolation, K as findRSCGraphViolation, L as hasInjectableTailwindCandidate, N as hasTokens, O as hasUseClientDirective, T as hasUseServerDirective, U as isAdvisoryDiagnostic, W as isCompileSourceOptedIn, X as isHardIgnoredPath, Y as isMangleableCssId, Z as isMonorepoPackage, _ as isPackagesSkippedSource, $ as isRSCServerModule, a0 as lateMangleCensusMessage, a1 as mangleCodeClassesSync, a2 as mangleEligibleClasses, a3 as mangleHybridHazardMessage, a4 as mergeThemes, a5 as missingTailwindEntryMessage, a6 as normalizeGlobalVarAliasesForCache, a7 as parseThemeBlocks, a8 as parseUtilityBlocks, a9 as realContentHashDisabledMessage, aa as recordGlobalVarSourceFile, ab as resolveCompileSourceDirs, ac as resolveNativeCacheIdentity, ad as resolveQuietMode, ae as rollupPlugin, af as scanCustomPropertyNames, ag as shouldEmitMissingCssFallback, ah as shouldEmitWarning, ai as shouldHoldAdvisories, aj as shouldTrackGlobalVarSources, ak as shouldWarnMissingTailwindEntry, al as shouldWarnUnscopedMonorepo, am as skippedSzFilesMessage, an as suppressedAdvisoryMessage, A as unplugin, ao as unscopedMonorepoMessage, ap as vitePlugin, aq as watchModeMangleMessage, ar as webpackPlugin } from './shared/unplugin.Bu2rzRtv.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.DptK3pl4.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 MangleSelectorHazard, p as ParsedTheme, q as ParsedUtilities, Q as QuietMode, r as RSCBoundaryViolation, s as RSCModuleRecord, t as allocateMangleTokens, u as assertNoRSCBoundaryViolation, v as assertNoRSCGraphViolation, w as collectMangleHybridHazards, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as default, B as deleteRSCModuleRecord, D as emitKeyValueDiagnostic, E as emitMissingCssFallback, F as esbuildPlugin, H as extractGlobalVarAliasesForManifest, I as fileMayContainSafelistableSz, J as findLocalImportSources, K as findRSCBoundaryViolation, L as findRSCGraphViolation, N as hasInjectableTailwindCandidate, O as hasTokens, T as hasUseClientDirective, U as hasUseServerDirective, W as isAdvisoryDiagnostic, X as isCompileSourceOptedIn, Y as isHardIgnoredPath, Z as isMangleableCssId, _ as isMonorepoPackage, $ as isPackagesSkippedSource, a0 as isRSCServerModule, a1 as lateMangleCensusMessage, a2 as mangleCodeClassesSync, a3 as mangleEligibleClasses, a4 as mangleHybridHazardMessage, a5 as mergeThemes, a6 as missingTailwindEntryMessage, a7 as normalizeGlobalVarAliasesForCache, a8 as parseThemeBlocks, a9 as parseUtilityBlocks, aa as realContentHashDisabledMessage, ab as recordGlobalVarSourceFile, ac as resolveCompileSourceDirs, ad as resolveNativeCacheIdentity, ae as resolveQuietMode, af as rollupPlugin, ag as scanCustomPropertyNames, ah as shouldEmitMissingCssFallback, ai as shouldEmitWarning, aj as shouldHoldAdvisories, ak as shouldTrackGlobalVarSources, al as shouldWarnMissingTailwindEntry, am as shouldWarnUnscopedMonorepo, an as skippedSzFilesMessage, ao as suppressedAdvisoryMessage, A as unplugin, ap as unscopedMonorepoMessage, aq as vitePlugin, ar as watchModeMangleMessage, as as webpackPlugin } from './shared/unplugin.DptK3pl4.mjs';
5
5
  import 'postcss';
6
6
  import '@csszyx/compiler';
7
7
  import 'esbuild';
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  export { classAttributeSelectorKey, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as allocateMangleTokens, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as createGlobalVarAliasValidationOptions, f as createGlobalVarMapAssetSource, g as createGlobalVarScanCacheKey, h as createRSCModuleRecord, i as cssHasContentScope, u as default, j as deleteRSCModuleRecord, k as emitMissingCssFallback, l as esbuildPlugin, m as extractGlobalVarAliasesForManifest, n as fileMayContainSafelistableSz, o as findLocalImportSources, p as findRSCBoundaryViolation, q as findRSCGraphViolation, r as hasInjectableTailwindCandidate, s as hasUseClientDirective, t as hasUseServerDirective, v as isAdvisoryDiagnostic, w as isCompileSourceOptedIn, x as isHardIgnoredPath, y as isMangleableCssId, z as isMonorepoPackage, A as isPackagesSkippedSource, B as isRSCServerModule, C as isTailwindReservedGlobalVar, D as lateMangleCensusMessage, E as mangleCodeClassesSync, F as mangleEligibleClasses, G as mangleHybridHazardMessage, H as missingTailwindEntryMessage, I as normalizeGlobalVarAliasesForCache, J as planGlobalVarAliases, K as readGlobalVarScanCache, L as realContentHashDisabledMessage, M as recordGlobalVarSourceFile, N as resolveCompileSourceDirs, O as resolveGlobalVarScanCacheDir, P as resolveNativeCacheIdentity, Q as resolveQuietMode, R as rewriteGlobalVarCssAliases, S as rollupPlugin, T as scanGlobalVarCss, U as shouldEmitMissingCssFallback, V as shouldEmitWarning, W as shouldHoldAdvisories, X as shouldTrackGlobalVarSources, Y as shouldWarnMissingTailwindEntry, Z as shouldWarnUnscopedMonorepo, _ as skippedSzFilesMessage, $ as suppressedAdvisoryMessage, u as unplugin, a0 as unscopedMonorepoMessage, a1 as validateGlobalVarAliasInputs, a2 as vitePlugin, a3 as watchModeMangleMessage, a4 as webpackPlugin, a5 as writeGlobalVarScanCache } from './shared/unplugin.Dx0ngYWw.mjs';
3
- export { h as hasTokens, m as mergeThemes, p as parseThemeBlocks, a as parseUtilityBlocks, s as scanCustomPropertyNames } from './shared/unplugin.Ceq-N4jI.mjs';
2
+ export { a as allocateMangleTokens, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as createGlobalVarAliasValidationOptions, f as createGlobalVarMapAssetSource, g as createGlobalVarScanCacheKey, h as createRSCModuleRecord, i as cssHasContentScope, u as default, j as deleteRSCModuleRecord, k as emitKeyValueDiagnostic, l as emitMissingCssFallback, m as esbuildPlugin, n as extractGlobalVarAliasesForManifest, o as fileMayContainSafelistableSz, p as findLocalImportSources, q as findRSCBoundaryViolation, r as findRSCGraphViolation, s as hasInjectableTailwindCandidate, t as hasUseClientDirective, v as hasUseServerDirective, w as isAdvisoryDiagnostic, x as isCompileSourceOptedIn, y as isHardIgnoredPath, z as isMangleableCssId, A as isMonorepoPackage, B as isPackagesSkippedSource, C as isRSCServerModule, D as isTailwindReservedGlobalVar, E as lateMangleCensusMessage, F as mangleCodeClassesSync, G as mangleEligibleClasses, H as mangleHybridHazardMessage, I as missingTailwindEntryMessage, J as normalizeGlobalVarAliasesForCache, K as planGlobalVarAliases, L as readGlobalVarScanCache, M as realContentHashDisabledMessage, N as recordGlobalVarSourceFile, O as resolveCompileSourceDirs, P as resolveGlobalVarScanCacheDir, Q as resolveNativeCacheIdentity, R as resolveQuietMode, S as rewriteGlobalVarCssAliases, T as rollupPlugin, U as scanGlobalVarCss, V as shouldEmitMissingCssFallback, W as shouldEmitWarning, X as shouldHoldAdvisories, Y as shouldTrackGlobalVarSources, Z as shouldWarnMissingTailwindEntry, _ as shouldWarnUnscopedMonorepo, $ as skippedSzFilesMessage, a0 as suppressedAdvisoryMessage, u as unplugin, a1 as unscopedMonorepoMessage, a2 as validateGlobalVarAliasInputs, a3 as vitePlugin, a4 as watchModeMangleMessage, a5 as webpackPlugin, a6 as writeGlobalVarScanCache } from './shared/unplugin.Cs4H9z9v.mjs';
3
+ export { h as hasTokens, m as mergeThemes, p as parseThemeBlocks, a as parseUtilityBlocks, s as scanCustomPropertyNames } from './shared/unplugin.995yC_cN.mjs';
4
4
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
5
- export { S as SAFELIST_FILE, a as appendTailwindSourceDirective, c as computeSafelistRelPath, b as cssImportsTailwind } from './shared/unplugin.DH_ij6cf.mjs';
5
+ export { S as SAFELIST_FILE, a as appendTailwindSourceDirective, c as computeSafelistRelPath, b as cssImportsTailwind } from './shared/unplugin.Ba3O1r8M.mjs';
6
6
  import 'postcss';
7
7
  import 'postcss-selector-parser';
8
8
  import 'node:crypto';
@@ -17,6 +17,8 @@ import '@csszyx/core/native';
17
17
  import '@csszyx/svelte-adapter';
18
18
  import '@csszyx/vue-adapter';
19
19
  import 'unplugin';
20
- import './shared/unplugin.C-oQU1jl.mjs';
20
+ import './shared/unplugin.2uf-U76p.mjs';
21
+ import './shared/unplugin.wMeicb6E.mjs';
22
+ import './shared/unplugin.DcXM9sq5.mjs';
21
23
  import 'node:zlib';
22
24
  import 'postcss-value-parser';
@@ -0,0 +1,186 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const node_crypto = require('node:crypto');
6
+ const fs = require('node:fs');
7
+ const path = require('node:path');
8
+ const compiler = require('@csszyx/compiler');
9
+ const nextRuntimeInjection = require('./shared/unplugin.Defu9wGh.cjs');
10
+ const pathNormalization = require('./shared/unplugin.BqKLlo1h.cjs');
11
+
12
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
13
+
14
+ const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
15
+ const path__default = /*#__PURE__*/_interopDefaultCompat(path);
16
+
17
+ const SETTLE_MS = 2e3;
18
+ function mtimeOf(dir) {
19
+ try {
20
+ return fs__default.statSync(dir).mtimeMs;
21
+ } catch {
22
+ return -1;
23
+ }
24
+ }
25
+ function settled(mtime) {
26
+ return Date.now() - mtime < SETTLE_MS ? -1 : mtime;
27
+ }
28
+ function writtenAt(entry) {
29
+ return typeof entry.timestamp === "string" ? entry.timestamp : "";
30
+ }
31
+ class TransformCacheIndex {
32
+ /** Directories seen, with the modification time they were last read at. */
33
+ dirs = /* @__PURE__ */ new Map();
34
+ seen = /* @__PURE__ */ new Set();
35
+ byFilename = /* @__PURE__ */ new Map();
36
+ /**
37
+ * @param root - The transform cache directory.
38
+ */
39
+ constructor(root) {
40
+ this.dirs.set(root, -1);
41
+ }
42
+ /**
43
+ * Read every entry file written since the last refresh.
44
+ */
45
+ refresh() {
46
+ const moved = [];
47
+ for (const [dir, readAt] of this.dirs) {
48
+ const mtime = mtimeOf(dir);
49
+ if (mtime !== readAt) moved.push(dir);
50
+ }
51
+ for (const dir of moved) {
52
+ this.dirs.set(dir, settled(mtimeOf(dir)));
53
+ this.readDir(dir);
54
+ }
55
+ }
56
+ /**
57
+ * Parse the entry files in one directory the index has not read yet.
58
+ *
59
+ * @param dir - The directory.
60
+ */
61
+ readDir(dir) {
62
+ let names;
63
+ try {
64
+ names = fs__default.readdirSync(dir, { withFileTypes: true });
65
+ } catch {
66
+ return;
67
+ }
68
+ for (const entry of names) {
69
+ const full = path__default.join(dir, entry.name);
70
+ if (entry.isDirectory()) {
71
+ if (!this.dirs.has(full)) {
72
+ this.dirs.set(full, settled(mtimeOf(full)));
73
+ this.readDir(full);
74
+ }
75
+ continue;
76
+ }
77
+ if (!entry.name.endsWith(".json") || this.seen.has(full)) continue;
78
+ this.seen.add(full);
79
+ this.add(full);
80
+ }
81
+ }
82
+ /**
83
+ * Parse one entry file into the index.
84
+ *
85
+ * @param file - The entry file.
86
+ */
87
+ add(file) {
88
+ let entry;
89
+ try {
90
+ entry = JSON.parse(fs__default.readFileSync(file, "utf8"));
91
+ } catch {
92
+ return;
93
+ }
94
+ if (typeof entry.filename !== "string") return;
95
+ const list = this.byFilename.get(entry.filename) ?? [];
96
+ list.push(entry);
97
+ this.byFilename.set(entry.filename, list);
98
+ }
99
+ /**
100
+ * The build output for one file, when the build saw exactly these contents.
101
+ *
102
+ * @param filename - Path of the file under test, as the plugin records it.
103
+ * @param source - Its current contents.
104
+ * @returns The matching entry's result, or null.
105
+ */
106
+ find(filename, source) {
107
+ const wanted = node_crypto.createHash("sha256").update(source).digest("hex");
108
+ const hit = this.pick(filename, wanted);
109
+ if (hit !== null) return hit;
110
+ this.refresh();
111
+ return this.pick(filename, wanted);
112
+ }
113
+ /**
114
+ * The best entry among those recorded for one file and hash.
115
+ *
116
+ * The plugin keys its cache on more than the source — the compiler that
117
+ * wrote the entry, whether variables were mangled, the cross-module
118
+ * registry — so one file and hash can have several entries. A test wants
119
+ * the output this compiler produces with readable variable names, and of
120
+ * those the newest.
121
+ *
122
+ * @param filename - Path as the plugin records it.
123
+ * @param sha256 - Hash of the current contents.
124
+ * @returns The chosen entry's result, or null when none qualifies.
125
+ */
126
+ pick(filename, sha256) {
127
+ let best = null;
128
+ for (const entry of this.byFilename.get(filename) ?? []) {
129
+ if (entry.inputSha256 !== sha256) continue;
130
+ if (entry.compilerVersion !== compiler.VERSION || entry.mangleVars === true) continue;
131
+ if (typeof entry.result?.code !== "string") continue;
132
+ if (best === null || writtenAt(entry) > writtenAt(best)) {
133
+ best = entry;
134
+ }
135
+ }
136
+ return best?.result ?? null;
137
+ }
138
+ }
139
+ function findCachedTransform(cacheRoot, filename, source) {
140
+ const index = new TransformCacheIndex(cacheRoot);
141
+ index.refresh();
142
+ const code = index.find(pathNormalization.normalizePathSeparators(filename), source)?.code;
143
+ return typeof code === "string" ? code : null;
144
+ }
145
+ const DEFAULT_EXTENSIONS = [".tsx", ".jsx", ".ts", ".js", ".mts", ".mjs"];
146
+ function reportDeadClasses(sourcePath, diagnostics) {
147
+ if (!Array.isArray(diagnostics)) return;
148
+ for (const message of diagnostics) {
149
+ if (typeof message !== "string" || compiler.szFallbackConsequenceOf(message) === "nudge") continue;
150
+ console.warn(`[csszyx] ${sourcePath}
151
+ ${message}`);
152
+ }
153
+ }
154
+ function finish(code, usage) {
155
+ return nextRuntimeInjection.injectNextRuntimeImports(code, usage).code;
156
+ }
157
+ function createTransformer(options = {}) {
158
+ const extensions = options.extensions ?? DEFAULT_EXTENSIONS;
159
+ const cacheRoot = options.cacheRoot ?? path__default.resolve(process.cwd(), ".csszyx/cache", "transform");
160
+ const index = new TransformCacheIndex(cacheRoot);
161
+ index.refresh();
162
+ const compiles = (sourcePath) => extensions.some((extension) => sourcePath.endsWith(extension));
163
+ const cached = (sourceText, sourcePath) => index.find(pathNormalization.normalizePathSeparators(sourcePath), sourceText);
164
+ return {
165
+ process(sourceText, sourcePath) {
166
+ if (!compiles(sourcePath)) return { code: sourceText };
167
+ const built = cached(sourceText, sourcePath);
168
+ if (built !== null && typeof built.code === "string") {
169
+ reportDeadClasses(sourcePath, built.diagnostics);
170
+ return { code: finish(built.code, built) };
171
+ }
172
+ const result = compiler.transformSource(sourceText, sourcePath);
173
+ reportDeadClasses(sourcePath, result.diagnostics);
174
+ return { code: result.transformed ? finish(result.code, result) : sourceText };
175
+ },
176
+ getCacheKey(sourceText, sourcePath, cacheKeyOptions) {
177
+ const built = compiles(sourcePath) ? cached(sourceText, sourcePath) : null;
178
+ return node_crypto.createHash("sha256").update(sourceText).update("\0").update(sourcePath).update("\0").update(typeof built?.code === "string" ? built.code : "").update("\0").update(cacheKeyOptions?.configString ?? "").update("\0").update(compiler.VERSION).digest("hex");
179
+ }
180
+ };
181
+ }
182
+ const transformerModule = { createTransformer };
183
+
184
+ exports.createTransformer = createTransformer;
185
+ exports.default = transformerModule;
186
+ exports.findCachedTransform = findCachedTransform;
@@ -0,0 +1,112 @@
1
+ /**
2
+ * A jest transformer that gives a test suite the classes the browser gets.
3
+ *
4
+ * Under jest the bundler plugin never runs, so a rendered component carries
5
+ * `sz` as a live prop and no `className`. Every styling assertion then reads
6
+ * the object the author typed rather than the compiled output, and the defect
7
+ * class "this `sz` compiled to nothing" is invisible to the suite, to `tsc`
8
+ * and to CI. Vitest needs none of this — the plugin in `vite.config` already
9
+ * transforms the modules a test imports — so this exists for the runners that
10
+ * cannot host a bundler plugin.
11
+ *
12
+ * Two sources answer, in order.
13
+ *
14
+ * The build's own transform cache is read first. It holds the output the
15
+ * bundler produced, which is the only output that resolves an `sz` object or
16
+ * an `szv` factory imported from another module: those come from the plugin's
17
+ * project-wide prescan, and a compiler handed one file cannot see them. An
18
+ * entry is matched on the file's path and the hash of its current contents, so
19
+ * an edit since the last build is a miss rather than a wrong answer; among the
20
+ * entries that match, only one this compiler wrote without variable mangling
21
+ * is taken, newest first.
22
+ *
23
+ * The per-file compiler answers otherwise. That is the right answer for an
24
+ * inline `sz` and for one built from a `const` in the same file; a shape it
25
+ * cannot resolve keeps the runtime path, exactly as the plugin would.
26
+ *
27
+ * Both answers are finished the way the plugin finishes them: the runtime
28
+ * helpers the compiled code calls are imported, and the diagnostics that say a
29
+ * class is dead are printed. jest applies one transformer per file, so this
30
+ * one hands back TSX; a project's own transformer chains it in front of the
31
+ * one that compiles TSX (see the testing guide).
32
+ *
33
+ * @module jest-transform
34
+ */
35
+ /**
36
+ * The build output for one file, when the build saw exactly these contents.
37
+ *
38
+ * One-shot form of the index, for a caller outside a transformer.
39
+ *
40
+ * @param cacheRoot - The transform cache directory, `.csszyx/cache/transform`.
41
+ * @param filename - Path of the file under test.
42
+ * @param source - Its current contents.
43
+ * @returns The compiled code, or null when the build has no matching entry.
44
+ */
45
+ declare function findCachedTransform(cacheRoot: string, filename: string, source: string): string | null;
46
+ /** How the transformer finds the build output and what it compiles. */
47
+ interface JestTransformOptions {
48
+ /**
49
+ * The transform cache directory. Defaults to `.csszyx/cache/transform`
50
+ * under the current working directory, which is where the plugin writes
51
+ * it and where jest runs from.
52
+ */
53
+ cacheRoot?: string;
54
+ /** Extensions this lane compiles; anything else is returned unchanged. */
55
+ extensions?: readonly string[];
56
+ }
57
+ /** The options jest hands `getCacheKey`; only the field this lane folds in. */
58
+ interface JestCacheKeyOptions {
59
+ /** jest's serialised config, which its default key includes. */
60
+ configString?: string;
61
+ }
62
+ /** The slice of jest's transformer interface this implements. */
63
+ interface JestTransformer {
64
+ /**
65
+ * Compile one file.
66
+ *
67
+ * @param sourceText - File contents.
68
+ * @param sourcePath - Absolute path of the file.
69
+ * @returns The code jest executes.
70
+ */
71
+ process(sourceText: string, sourcePath: string): {
72
+ code: string;
73
+ };
74
+ /**
75
+ * The key jest caches the output under.
76
+ *
77
+ * jest's own key covers the file and its config, and this lane's answer
78
+ * also depends on what the last build wrote for the file: a rebuild after
79
+ * a change in another module changes this file's output without changing
80
+ * this file. The build's answer is part of the key so that jest asks again.
81
+ *
82
+ * @param sourceText - File contents.
83
+ * @param sourcePath - Absolute path of the file.
84
+ * @param options - jest's cache-key options.
85
+ * @returns A hex digest.
86
+ */
87
+ getCacheKey(sourceText: string, sourcePath: string, options?: JestCacheKeyOptions): string;
88
+ }
89
+ /**
90
+ * Build the transformer jest calls for every file it loads.
91
+ *
92
+ * @param options - Cache location and which extensions to compile.
93
+ * @returns A transformer with jest's synchronous hooks.
94
+ */
95
+ declare function createTransformer(options?: JestTransformOptions): JestTransformer;
96
+ /** The module shape jest resolves a transformer by. */
97
+ interface JestTransformerFactory {
98
+ /**
99
+ * Build the transformer.
100
+ *
101
+ * @param options - Cache location and which extensions to compile.
102
+ * @returns The transformer.
103
+ */
104
+ createTransformer: (options?: JestTransformOptions) => JestTransformer;
105
+ }
106
+ /** jest resolves a transformer module by its default export. */
107
+ declare const transformerModule: JestTransformerFactory;
108
+
109
+ // @ts-ignore
110
+ export = transformerModule;
111
+ export { createTransformer, findCachedTransform };
112
+ export type { JestCacheKeyOptions, JestTransformOptions, JestTransformer };
@@ -0,0 +1,110 @@
1
+ /**
2
+ * A jest transformer that gives a test suite the classes the browser gets.
3
+ *
4
+ * Under jest the bundler plugin never runs, so a rendered component carries
5
+ * `sz` as a live prop and no `className`. Every styling assertion then reads
6
+ * the object the author typed rather than the compiled output, and the defect
7
+ * class "this `sz` compiled to nothing" is invisible to the suite, to `tsc`
8
+ * and to CI. Vitest needs none of this — the plugin in `vite.config` already
9
+ * transforms the modules a test imports — so this exists for the runners that
10
+ * cannot host a bundler plugin.
11
+ *
12
+ * Two sources answer, in order.
13
+ *
14
+ * The build's own transform cache is read first. It holds the output the
15
+ * bundler produced, which is the only output that resolves an `sz` object or
16
+ * an `szv` factory imported from another module: those come from the plugin's
17
+ * project-wide prescan, and a compiler handed one file cannot see them. An
18
+ * entry is matched on the file's path and the hash of its current contents, so
19
+ * an edit since the last build is a miss rather than a wrong answer; among the
20
+ * entries that match, only one this compiler wrote without variable mangling
21
+ * is taken, newest first.
22
+ *
23
+ * The per-file compiler answers otherwise. That is the right answer for an
24
+ * inline `sz` and for one built from a `const` in the same file; a shape it
25
+ * cannot resolve keeps the runtime path, exactly as the plugin would.
26
+ *
27
+ * Both answers are finished the way the plugin finishes them: the runtime
28
+ * helpers the compiled code calls are imported, and the diagnostics that say a
29
+ * class is dead are printed. jest applies one transformer per file, so this
30
+ * one hands back TSX; a project's own transformer chains it in front of the
31
+ * one that compiles TSX (see the testing guide).
32
+ *
33
+ * @module jest-transform
34
+ */
35
+ /**
36
+ * The build output for one file, when the build saw exactly these contents.
37
+ *
38
+ * One-shot form of the index, for a caller outside a transformer.
39
+ *
40
+ * @param cacheRoot - The transform cache directory, `.csszyx/cache/transform`.
41
+ * @param filename - Path of the file under test.
42
+ * @param source - Its current contents.
43
+ * @returns The compiled code, or null when the build has no matching entry.
44
+ */
45
+ declare function findCachedTransform(cacheRoot: string, filename: string, source: string): string | null;
46
+ /** How the transformer finds the build output and what it compiles. */
47
+ interface JestTransformOptions {
48
+ /**
49
+ * The transform cache directory. Defaults to `.csszyx/cache/transform`
50
+ * under the current working directory, which is where the plugin writes
51
+ * it and where jest runs from.
52
+ */
53
+ cacheRoot?: string;
54
+ /** Extensions this lane compiles; anything else is returned unchanged. */
55
+ extensions?: readonly string[];
56
+ }
57
+ /** The options jest hands `getCacheKey`; only the field this lane folds in. */
58
+ interface JestCacheKeyOptions {
59
+ /** jest's serialised config, which its default key includes. */
60
+ configString?: string;
61
+ }
62
+ /** The slice of jest's transformer interface this implements. */
63
+ interface JestTransformer {
64
+ /**
65
+ * Compile one file.
66
+ *
67
+ * @param sourceText - File contents.
68
+ * @param sourcePath - Absolute path of the file.
69
+ * @returns The code jest executes.
70
+ */
71
+ process(sourceText: string, sourcePath: string): {
72
+ code: string;
73
+ };
74
+ /**
75
+ * The key jest caches the output under.
76
+ *
77
+ * jest's own key covers the file and its config, and this lane's answer
78
+ * also depends on what the last build wrote for the file: a rebuild after
79
+ * a change in another module changes this file's output without changing
80
+ * this file. The build's answer is part of the key so that jest asks again.
81
+ *
82
+ * @param sourceText - File contents.
83
+ * @param sourcePath - Absolute path of the file.
84
+ * @param options - jest's cache-key options.
85
+ * @returns A hex digest.
86
+ */
87
+ getCacheKey(sourceText: string, sourcePath: string, options?: JestCacheKeyOptions): string;
88
+ }
89
+ /**
90
+ * Build the transformer jest calls for every file it loads.
91
+ *
92
+ * @param options - Cache location and which extensions to compile.
93
+ * @returns A transformer with jest's synchronous hooks.
94
+ */
95
+ declare function createTransformer(options?: JestTransformOptions): JestTransformer;
96
+ /** The module shape jest resolves a transformer by. */
97
+ interface JestTransformerFactory {
98
+ /**
99
+ * Build the transformer.
100
+ *
101
+ * @param options - Cache location and which extensions to compile.
102
+ * @returns The transformer.
103
+ */
104
+ createTransformer: (options?: JestTransformOptions) => JestTransformer;
105
+ }
106
+ /** jest resolves a transformer module by its default export. */
107
+ declare const transformerModule: JestTransformerFactory;
108
+
109
+ export { createTransformer, transformerModule as default, findCachedTransform };
110
+ export type { JestCacheKeyOptions, JestTransformOptions, JestTransformer };