@csszyx/unplugin 0.12.0 → 0.14.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 (46) hide show
  1. package/README.md +8 -10
  2. package/dist/index.cjs +14 -7
  3. package/dist/index.d.cts +4 -4
  4. package/dist/index.d.mts +4 -4
  5. package/dist/index.mjs +3 -3
  6. package/dist/next-config.cjs +3 -0
  7. package/dist/next-config.d.cts +13 -2
  8. package/dist/next-config.d.mts +13 -2
  9. package/dist/next-config.mjs +3 -0
  10. package/dist/next-prebuild.cjs +13 -7
  11. package/dist/next-prebuild.d.cts +8 -2
  12. package/dist/next-prebuild.d.mts +8 -2
  13. package/dist/next-prebuild.mjs +13 -7
  14. package/dist/next-turbo-loader.cjs +31 -15
  15. package/dist/next-turbo-loader.d.cts +11 -2
  16. package/dist/next-turbo-loader.d.mts +11 -2
  17. package/dist/next-turbo-loader.mjs +30 -14
  18. package/dist/next-watcher.cjs +1 -1
  19. package/dist/next-watcher.mjs +1 -1
  20. package/dist/shared/{unplugin.CXV7fOa2.d.cts → unplugin.B32Exn-K.d.cts} +2 -2
  21. package/dist/shared/{unplugin.CXV7fOa2.d.mts → unplugin.B32Exn-K.d.mts} +2 -2
  22. package/dist/shared/{unplugin.Bb5TeU9B.cjs → unplugin.BJiWWF6w.cjs} +93 -23
  23. package/dist/shared/unplugin.BKGCkMgM.cjs +523 -0
  24. package/dist/shared/{unplugin.DMcbmP01.mjs → unplugin.BU0O4IkX.mjs} +4 -1
  25. package/dist/shared/unplugin.BcsvXjIV.mjs +579 -0
  26. package/dist/shared/{unplugin.CtnKJhAi.d.cts → unplugin.BsjD3mtb.d.cts} +165 -33
  27. package/dist/shared/{unplugin.CtnKJhAi.d.mts → unplugin.BsjD3mtb.d.mts} +165 -33
  28. package/dist/shared/{unplugin.DblMogcN.cjs → unplugin.Cji6O5jv.cjs} +4 -1
  29. package/dist/shared/unplugin.CkNQjA4G.cjs +613 -0
  30. package/dist/shared/unplugin.DKcwO8O4.mjs +490 -0
  31. package/dist/shared/{unplugin.DXgxFHzO.mjs → unplugin.DjRylBC_.mjs} +77 -25
  32. package/dist/shared/{unplugin.BK3XVHe8.cjs → unplugin.ZMa9YE1H.cjs} +621 -615
  33. package/dist/shared/{unplugin.B9vpjOhD.mjs → unplugin.gR_h2DVG.mjs} +585 -582
  34. package/dist/vite.cjs +3 -3
  35. package/dist/vite.d.cts +2 -2
  36. package/dist/vite.d.mts +1 -1
  37. package/dist/vite.mjs +3 -3
  38. package/dist/webpack.cjs +3 -3
  39. package/dist/webpack.d.cts +2 -2
  40. package/dist/webpack.d.mts +1 -1
  41. package/dist/webpack.mjs +3 -3
  42. package/package.json +9 -9
  43. package/dist/shared/unplugin.C2lHQFii.cjs +0 -114
  44. package/dist/shared/unplugin.CBMJufQ8.mjs +0 -108
  45. package/dist/shared/unplugin.CDqY7kmk.mjs +0 -224
  46. package/dist/shared/unplugin.DbZ7tCfN.cjs +0 -248
package/README.md CHANGED
@@ -66,7 +66,7 @@ module.exports = {
66
66
 
67
67
  ## Features
68
68
 
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"`.
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
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
@@ -89,23 +89,21 @@ Per project:
89
89
 
90
90
  ```ts
91
91
  csszyx({
92
- build: { parser: "oxc" }, // JavaScript oxc parser, no native addon
92
+ build: { parser: "wasm" }, // the engine's WebAssembly build, no native addon
93
93
  });
94
94
  ```
95
95
 
96
96
  Per build:
97
97
 
98
98
  ```bash
99
- CSSZYX_PARSER=oxc pnpm build
99
+ CSSZYX_PARSER=wasm pnpm build
100
100
  ```
101
101
 
102
- The default `rust` path uses the native engine and shares the same
103
- `className` output shape as the JavaScript parsers. `build.parser: "oxc"`
104
- uses the previous JavaScript oxc-parser path with surgical magic-string
105
- edits to preserve source formatting outside touched ranges.
106
- `build.parser: "babel"` routes prescan, transform, and HMR discovery
107
- through the legacy Babel implementation as a final compatibility escape
108
- hatch.
102
+ The default `rust` path is the native addon; `wasm` is the same engine
103
+ compiled to WebAssembly. Both run identical output; only parse speed
104
+ differs. The former `"oxc"` and `"babel"` TypeScript lanes were removed —
105
+ a config still naming them is ignored like an invalid env value and the
106
+ build runs on the default.
109
107
 
110
108
  ## License
111
109
 
package/dist/index.cjs CHANGED
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const cssMangler = require('./css-mangler.cjs');
6
- const unplugin = require('./shared/unplugin.BK3XVHe8.cjs');
6
+ const unplugin = require('./shared/unplugin.ZMa9YE1H.cjs');
7
+ const themeGroupsFile = require('./shared/unplugin.CkNQjA4G.cjs');
7
8
  const types = require('@csszyx/types');
8
9
  require('postcss');
9
10
  require('postcss-selector-parser');
@@ -19,8 +20,7 @@ require('@csszyx/core/native');
19
20
  require('@csszyx/svelte-adapter');
20
21
  require('@csszyx/vue-adapter');
21
22
  require('unplugin');
22
- require('./shared/unplugin.DbZ7tCfN.cjs');
23
- require('./shared/unplugin.C2lHQFii.cjs');
23
+ require('./shared/unplugin.BKGCkMgM.cjs');
24
24
  require('./shared/unplugin.BkRah5Ot.cjs');
25
25
  require('node:zlib');
26
26
  require('postcss-value-parser');
@@ -54,31 +54,32 @@ exports.findLocalImportSources = unplugin.findLocalImportSources;
54
54
  exports.findRSCBoundaryViolation = unplugin.findRSCBoundaryViolation;
55
55
  exports.findRSCGraphViolation = unplugin.findRSCGraphViolation;
56
56
  exports.hasInjectableTailwindCandidate = unplugin.hasInjectableTailwindCandidate;
57
- exports.hasTokens = unplugin.hasTokens;
58
57
  exports.hasUseClientDirective = unplugin.hasUseClientDirective;
59
58
  exports.hasUseServerDirective = unplugin.hasUseServerDirective;
59
+ exports.isAdvisoryDiagnostic = unplugin.isAdvisoryDiagnostic;
60
60
  exports.isCompileSourceOptedIn = unplugin.isCompileSourceOptedIn;
61
61
  exports.isHardIgnoredPath = unplugin.isHardIgnoredPath;
62
+ exports.isMangleableCssId = unplugin.isMangleableCssId;
62
63
  exports.isMonorepoPackage = unplugin.isMonorepoPackage;
63
64
  exports.isPackagesSkippedSource = unplugin.isPackagesSkippedSource;
64
65
  exports.isRSCServerModule = unplugin.isRSCServerModule;
65
66
  exports.isTailwindReservedGlobalVar = unplugin.isTailwindReservedGlobalVar;
67
+ exports.lateMangleCensusMessage = unplugin.lateMangleCensusMessage;
66
68
  exports.mangleCodeClassesSync = unplugin.mangleCodeClassesSync;
67
69
  exports.mangleEligibleClasses = unplugin.mangleEligibleClasses;
68
70
  exports.mangleHybridHazardMessage = unplugin.mangleHybridHazardMessage;
69
- exports.mergeThemes = unplugin.mergeThemes;
70
71
  exports.missingTailwindEntryMessage = unplugin.missingTailwindEntryMessage;
71
72
  exports.normalizeGlobalVarAliasesForCache = unplugin.normalizeGlobalVarAliasesForCache;
72
- exports.parseThemeBlocks = unplugin.parseThemeBlocks;
73
73
  exports.planGlobalVarAliases = unplugin.planGlobalVarAliases;
74
74
  exports.readGlobalVarScanCache = unplugin.readGlobalVarScanCache;
75
+ exports.realContentHashDisabledMessage = unplugin.realContentHashDisabledMessage;
75
76
  exports.recordGlobalVarSourceFile = unplugin.recordGlobalVarSourceFile;
76
77
  exports.resolveCompileSourceDirs = unplugin.resolveCompileSourceDirs;
77
78
  exports.resolveGlobalVarScanCacheDir = unplugin.resolveGlobalVarScanCacheDir;
78
79
  exports.resolveNativeCacheIdentity = unplugin.resolveNativeCacheIdentity;
80
+ exports.resolveQuietMode = unplugin.resolveQuietMode;
79
81
  exports.rewriteGlobalVarCssAliases = unplugin.rewriteGlobalVarCssAliases;
80
82
  exports.rollupPlugin = unplugin.rollupPlugin;
81
- exports.scanCustomPropertyNames = unplugin.scanCustomPropertyNames;
82
83
  exports.scanGlobalVarCss = unplugin.scanGlobalVarCss;
83
84
  exports.shouldEmitMissingCssFallback = unplugin.shouldEmitMissingCssFallback;
84
85
  exports.shouldEmitWarning = unplugin.shouldEmitWarning;
@@ -86,11 +87,17 @@ exports.shouldTrackGlobalVarSources = unplugin.shouldTrackGlobalVarSources;
86
87
  exports.shouldWarnMissingTailwindEntry = unplugin.shouldWarnMissingTailwindEntry;
87
88
  exports.shouldWarnUnscopedMonorepo = unplugin.shouldWarnUnscopedMonorepo;
88
89
  exports.skippedSzFilesMessage = unplugin.skippedSzFilesMessage;
90
+ exports.suppressedAdvisoryMessage = unplugin.suppressedAdvisoryMessage;
89
91
  exports.unplugin = unplugin.unplugin;
90
92
  exports.unscopedMonorepoMessage = unplugin.unscopedMonorepoMessage;
91
93
  exports.validateGlobalVarAliasInputs = unplugin.validateGlobalVarAliasInputs;
92
94
  exports.vitePlugin = unplugin.vitePlugin;
95
+ exports.watchModeMangleMessage = unplugin.watchModeMangleMessage;
93
96
  exports.webpackPlugin = unplugin.webpackPlugin;
94
97
  exports.writeGlobalVarScanCache = unplugin.writeGlobalVarScanCache;
98
+ exports.hasTokens = themeGroupsFile.hasTokens;
99
+ exports.mergeThemes = themeGroupsFile.mergeThemes;
100
+ exports.parseThemeBlocks = themeGroupsFile.parseThemeBlocks;
101
+ exports.scanCustomPropertyNames = themeGroupsFile.scanCustomPropertyNames;
95
102
  exports.CSSZYX_GLOBAL_ALIAS_PREFIX = types.CSSZYX_GLOBAL_ALIAS_PREFIX;
96
103
  exports.TAILWIND_RESERVED_PREFIXES = types.TAILWIND_RESERVED_PREFIXES;
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.CtnKJhAi.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.BsjD3mtb.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 allocateMangleTokens, s as appendTailwindSourceDirective, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as computeSafelistRelPath, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as cssImportsTailwind, D as deleteRSCModuleRecord, 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, Q as hasUseClientDirective, T as hasUseServerDirective, U as isCompileSourceOptedIn, W as isHardIgnoredPath, X as isMonorepoPackage, Y as isPackagesSkippedSource, Z as isRSCServerModule, _ as mangleCodeClassesSync, $ as mangleEligibleClasses, a0 as mangleHybridHazardMessage, a1 as mergeThemes, a2 as missingTailwindEntryMessage, a3 as normalizeGlobalVarAliasesForCache, a4 as parseThemeBlocks, a5 as recordGlobalVarSourceFile, a6 as resolveCompileSourceDirs, a7 as resolveNativeCacheIdentity, a8 as rollupPlugin, a9 as scanCustomPropertyNames, aa as shouldEmitMissingCssFallback, ab as shouldEmitWarning, ac as shouldTrackGlobalVarSources, ad as shouldWarnMissingTailwindEntry, ae as shouldWarnUnscopedMonorepo, af as skippedSzFilesMessage, B as unplugin, ag as unscopedMonorepoMessage, ah as vitePlugin, ai as webpackPlugin } from './shared/unplugin.CtnKJhAi.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, Q as QuietMode, p as RSCBoundaryViolation, q as RSCModuleRecord, r as allocateMangleTokens, s as appendTailwindSourceDirective, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as computeSafelistRelPath, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as cssImportsTailwind, D as deleteRSCModuleRecord, 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 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 shouldTrackGlobalVarSources, aj as shouldWarnMissingTailwindEntry, ak as shouldWarnUnscopedMonorepo, al as skippedSzFilesMessage, am as suppressedAdvisoryMessage, B as unplugin, an as unscopedMonorepoMessage, ao as vitePlugin, ap as watchModeMangleMessage, aq as webpackPlugin } from './shared/unplugin.BsjD3mtb.cjs';
7
7
  import 'postcss';
8
8
  import '@csszyx/compiler';
9
9
  import 'esbuild';
@@ -15,7 +15,7 @@ import 'vite';
15
15
  * Resolves the global variable scan cache directory.
16
16
  *
17
17
  * @param cacheDir csszyx cache root.
18
- * @returns Cache directory for Phase H CSS scans.
18
+ * @returns Cache directory for global-variable CSS scans.
19
19
  */
20
20
  declare function resolveGlobalVarScanCacheDir(cacheDir: string): string;
21
21
  /**
@@ -78,7 +78,7 @@ declare function isTailwindReservedGlobalVar(name: string): boolean;
78
78
  declare function rewriteGlobalVarCssAliases(options: RewriteGlobalVarCssAliasesOptions): GlobalVarCssAliasRewriteResult;
79
79
 
80
80
  /**
81
- * Runs the Phase H pure validation pipeline without mutating build output.
81
+ * Runs the pure global-variable validation pipeline without mutating build output.
82
82
  *
83
83
  * @param options Validation input.
84
84
  * @returns CSS scans, alias plan, and JS/JSX out-of-band diagnostics.
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.CtnKJhAi.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 allocateMangleTokens, s as appendTailwindSourceDirective, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as computeSafelistRelPath, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as cssImportsTailwind, B as default, D as deleteRSCModuleRecord, 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, Q as hasUseClientDirective, T as hasUseServerDirective, U as isCompileSourceOptedIn, W as isHardIgnoredPath, X as isMonorepoPackage, Y as isPackagesSkippedSource, Z as isRSCServerModule, _ as mangleCodeClassesSync, $ as mangleEligibleClasses, a0 as mangleHybridHazardMessage, a1 as mergeThemes, a2 as missingTailwindEntryMessage, a3 as normalizeGlobalVarAliasesForCache, a4 as parseThemeBlocks, a5 as recordGlobalVarSourceFile, a6 as resolveCompileSourceDirs, a7 as resolveNativeCacheIdentity, a8 as rollupPlugin, a9 as scanCustomPropertyNames, aa as shouldEmitMissingCssFallback, ab as shouldEmitWarning, ac as shouldTrackGlobalVarSources, ad as shouldWarnMissingTailwindEntry, ae as shouldWarnUnscopedMonorepo, af as skippedSzFilesMessage, B as unplugin, ag as unscopedMonorepoMessage, ah as vitePlugin, ai as webpackPlugin } from './shared/unplugin.CtnKJhAi.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.BsjD3mtb.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, Q as QuietMode, p as RSCBoundaryViolation, q as RSCModuleRecord, r as allocateMangleTokens, s as appendTailwindSourceDirective, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as computeSafelistRelPath, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as cssImportsTailwind, B as default, D as deleteRSCModuleRecord, 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 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 shouldTrackGlobalVarSources, aj as shouldWarnMissingTailwindEntry, ak as shouldWarnUnscopedMonorepo, al as skippedSzFilesMessage, am as suppressedAdvisoryMessage, B as unplugin, an as unscopedMonorepoMessage, ao as vitePlugin, ap as watchModeMangleMessage, aq as webpackPlugin } from './shared/unplugin.BsjD3mtb.mjs';
5
5
  import 'postcss';
6
6
  import '@csszyx/compiler';
7
7
  import 'esbuild';
@@ -13,7 +13,7 @@ import 'vite';
13
13
  * Resolves the global variable scan cache directory.
14
14
  *
15
15
  * @param cacheDir csszyx cache root.
16
- * @returns Cache directory for Phase H CSS scans.
16
+ * @returns Cache directory for global-variable CSS scans.
17
17
  */
18
18
  declare function resolveGlobalVarScanCacheDir(cacheDir: string): string;
19
19
  /**
@@ -76,7 +76,7 @@ declare function isTailwindReservedGlobalVar(name: string): boolean;
76
76
  declare function rewriteGlobalVarCssAliases(options: RewriteGlobalVarCssAliasesOptions): GlobalVarCssAliasRewriteResult;
77
77
 
78
78
  /**
79
- * Runs the Phase H pure validation pipeline without mutating build output.
79
+ * Runs the pure global-variable validation pipeline without mutating build output.
80
80
  *
81
81
  * @param options Validation input.
82
82
  * @returns CSS scans, alias plan, and JS/JSX out-of-band diagnostics.
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as allocateMangleTokens, b as appendTailwindSourceDirective, c as assertNoRSCBoundaryViolation, d as assertNoRSCGraphViolation, e as collectMangleHybridHazards, f as computeSafelistRelPath, g as createGlobalVarAliasValidationOptions, h as createGlobalVarMapAssetSource, i as createGlobalVarScanCacheKey, j as createRSCModuleRecord, k as cssHasContentScope, l as cssImportsTailwind, u as default, m as deleteRSCModuleRecord, n as emitMissingCssFallback, o as esbuildPlugin, p as extractGlobalVarAliasesForManifest, q as fileMayContainSafelistableSz, r as findLocalImportSources, s as findRSCBoundaryViolation, t as findRSCGraphViolation, v as hasInjectableTailwindCandidate, w as hasTokens, x as hasUseClientDirective, y as hasUseServerDirective, z as isCompileSourceOptedIn, A as isHardIgnoredPath, B as isMonorepoPackage, C as isPackagesSkippedSource, D as isRSCServerModule, E as isTailwindReservedGlobalVar, F as mangleCodeClassesSync, G as mangleEligibleClasses, H as mangleHybridHazardMessage, I as mergeThemes, J as missingTailwindEntryMessage, K as normalizeGlobalVarAliasesForCache, L as parseThemeBlocks, M as planGlobalVarAliases, N as readGlobalVarScanCache, O as recordGlobalVarSourceFile, P as resolveCompileSourceDirs, Q as resolveGlobalVarScanCacheDir, R as resolveNativeCacheIdentity, S as rewriteGlobalVarCssAliases, T as rollupPlugin, U as scanCustomPropertyNames, V as scanGlobalVarCss, W as shouldEmitMissingCssFallback, X as shouldEmitWarning, Y as shouldTrackGlobalVarSources, Z as shouldWarnMissingTailwindEntry, _ as shouldWarnUnscopedMonorepo, $ as skippedSzFilesMessage, u as unplugin, a0 as unscopedMonorepoMessage, a1 as validateGlobalVarAliasInputs, a2 as vitePlugin, a3 as webpackPlugin, a4 as writeGlobalVarScanCache } from './shared/unplugin.B9vpjOhD.mjs';
2
+ export { a as allocateMangleTokens, b as appendTailwindSourceDirective, c as assertNoRSCBoundaryViolation, d as assertNoRSCGraphViolation, e as collectMangleHybridHazards, f as computeSafelistRelPath, g as createGlobalVarAliasValidationOptions, h as createGlobalVarMapAssetSource, i as createGlobalVarScanCacheKey, j as createRSCModuleRecord, k as cssHasContentScope, l as cssImportsTailwind, u as default, m as deleteRSCModuleRecord, n as emitMissingCssFallback, o as esbuildPlugin, p as extractGlobalVarAliasesForManifest, q as fileMayContainSafelistableSz, r as findLocalImportSources, s as findRSCBoundaryViolation, t as findRSCGraphViolation, v as hasInjectableTailwindCandidate, w as hasUseClientDirective, x as hasUseServerDirective, y as isAdvisoryDiagnostic, z as isCompileSourceOptedIn, A as isHardIgnoredPath, B as isMangleableCssId, C as isMonorepoPackage, D as isPackagesSkippedSource, E as isRSCServerModule, F as isTailwindReservedGlobalVar, G as lateMangleCensusMessage, H as mangleCodeClassesSync, I as mangleEligibleClasses, J as mangleHybridHazardMessage, K as missingTailwindEntryMessage, L as normalizeGlobalVarAliasesForCache, M as planGlobalVarAliases, N as readGlobalVarScanCache, O as realContentHashDisabledMessage, P as recordGlobalVarSourceFile, Q as resolveCompileSourceDirs, R as resolveGlobalVarScanCacheDir, S as resolveNativeCacheIdentity, T as resolveQuietMode, U as rewriteGlobalVarCssAliases, V as rollupPlugin, W as scanGlobalVarCss, X as shouldEmitMissingCssFallback, Y as shouldEmitWarning, Z as shouldTrackGlobalVarSources, _ as shouldWarnMissingTailwindEntry, $ as shouldWarnUnscopedMonorepo, a0 as skippedSzFilesMessage, a1 as suppressedAdvisoryMessage, u as unplugin, a2 as unscopedMonorepoMessage, a3 as validateGlobalVarAliasInputs, a4 as vitePlugin, a5 as watchModeMangleMessage, a6 as webpackPlugin, a7 as writeGlobalVarScanCache } from './shared/unplugin.gR_h2DVG.mjs';
3
+ export { h as hasTokens, m as mergeThemes, p as parseThemeBlocks, s as scanCustomPropertyNames } from './shared/unplugin.BcsvXjIV.mjs';
3
4
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
4
5
  import 'postcss';
5
6
  import 'postcss-selector-parser';
@@ -15,8 +16,7 @@ import '@csszyx/core/native';
15
16
  import '@csszyx/svelte-adapter';
16
17
  import '@csszyx/vue-adapter';
17
18
  import 'unplugin';
18
- import './shared/unplugin.CDqY7kmk.mjs';
19
- import './shared/unplugin.CBMJufQ8.mjs';
19
+ import './shared/unplugin.DKcwO8O4.mjs';
20
20
  import './shared/unplugin.B3XoSRB8.mjs';
21
21
  import 'node:zlib';
22
22
  import 'postcss-value-parser';
@@ -4,6 +4,9 @@ function csszyxTurbopack(existing = {}, options = {}) {
4
4
  const { glob = "*.tsx", parserMode = "rust", safelistOutputFile } = options;
5
5
  const config = options.config ?? { mangleVars: false };
6
6
  const loaderOptions = { parserMode, config };
7
+ if (options.importedStaticSz !== void 0) {
8
+ loaderOptions.importedStaticSz = options.importedStaticSz;
9
+ }
7
10
  if (safelistOutputFile !== void 0) {
8
11
  loaderOptions.safelistOutputFile = safelistOutputFile;
9
12
  }
@@ -21,8 +21,9 @@
21
21
  */
22
22
  /** Options forwarded to the csszyx Next Turbopack loader. */
23
23
  interface CsszyxTurbopackOptions {
24
- /** Parser lane for the loader. Defaults to `'rust'` (the shipped default). */
25
- parserMode?: 'rust' | 'oxc';
24
+ /** Parser lane for the loader the native addon or its wasm build.
25
+ * Defaults to `'rust'` (the shipped default). */
26
+ parserMode?: 'rust' | 'wasm';
26
27
  /**
27
28
  * Safelist HTML path Tailwind `@source` reads. Must match the
28
29
  * `csszyx next prebuild --output-file` / `csszyx next watch` path.
@@ -32,6 +33,16 @@ interface CsszyxTurbopackOptions {
32
33
  config?: Record<string, unknown>;
33
34
  /** Glob the loader applies to. Defaults to `'*.tsx'` (whole app). */
34
35
  glob?: string;
36
+ /**
37
+ * Compile a plain exported sz object into the modules that import it.
38
+ *
39
+ * On unless set. Whatever it is here, the prebuild must resolve it the
40
+ * same way — it writes the safelist for the classes the loader emits, so a
41
+ * lane that resolves more than the other emits class names with no rule.
42
+ * To turn it off, pass `false` here AND `--no-imported-static-sz` to
43
+ * `csszyx next prebuild` and `csszyx next watch`.
44
+ */
45
+ importedStaticSz?: boolean;
35
46
  }
36
47
  /** Minimal shape of a Next.js `turbopack` config block (only what we touch). */
37
48
  interface TurbopackConfig {
@@ -21,8 +21,9 @@
21
21
  */
22
22
  /** Options forwarded to the csszyx Next Turbopack loader. */
23
23
  interface CsszyxTurbopackOptions {
24
- /** Parser lane for the loader. Defaults to `'rust'` (the shipped default). */
25
- parserMode?: 'rust' | 'oxc';
24
+ /** Parser lane for the loader the native addon or its wasm build.
25
+ * Defaults to `'rust'` (the shipped default). */
26
+ parserMode?: 'rust' | 'wasm';
26
27
  /**
27
28
  * Safelist HTML path Tailwind `@source` reads. Must match the
28
29
  * `csszyx next prebuild --output-file` / `csszyx next watch` path.
@@ -32,6 +33,16 @@ interface CsszyxTurbopackOptions {
32
33
  config?: Record<string, unknown>;
33
34
  /** Glob the loader applies to. Defaults to `'*.tsx'` (whole app). */
34
35
  glob?: string;
36
+ /**
37
+ * Compile a plain exported sz object into the modules that import it.
38
+ *
39
+ * On unless set. Whatever it is here, the prebuild must resolve it the
40
+ * same way — it writes the safelist for the classes the loader emits, so a
41
+ * lane that resolves more than the other emits class names with no rule.
42
+ * To turn it off, pass `false` here AND `--no-imported-static-sz` to
43
+ * `csszyx next prebuild` and `csszyx next watch`.
44
+ */
45
+ importedStaticSz?: boolean;
35
46
  }
36
47
  /** Minimal shape of a Next.js `turbopack` config block (only what we touch). */
37
48
  interface TurbopackConfig {
@@ -2,6 +2,9 @@ function csszyxTurbopack(existing = {}, options = {}) {
2
2
  const { glob = "*.tsx", parserMode = "rust", safelistOutputFile } = options;
3
3
  const config = options.config ?? { mangleVars: false };
4
4
  const loaderOptions = { parserMode, config };
5
+ if (options.importedStaticSz !== void 0) {
6
+ loaderOptions.importedStaticSz = options.importedStaticSz;
7
+ }
5
8
  if (safelistOutputFile !== void 0) {
6
9
  loaderOptions.safelistOutputFile = safelistOutputFile;
7
10
  }
@@ -3,10 +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.Bb5TeU9B.cjs');
7
- const nextWatcherCycle = require('./shared/unplugin.DblMogcN.cjs');
8
- const transformCache = require('./shared/unplugin.DbZ7tCfN.cjs');
6
+ const nextTransformMetadata = require('./shared/unplugin.BJiWWF6w.cjs');
7
+ const nextWatcherCycle = require('./shared/unplugin.Cji6O5jv.cjs');
8
+ const transformCache = require('./shared/unplugin.BKGCkMgM.cjs');
9
9
  require('@csszyx/compiler');
10
+ require('@csszyx/types');
10
11
  require('./shared/unplugin.BkRah5Ot.cjs');
11
12
  require('node:os');
12
13
  require('proper-lockfile');
@@ -39,7 +40,7 @@ function runNextPrebuild(options) {
39
40
  cwd: options.cwd,
40
41
  cacheDir: options.cacheDir,
41
42
  safelistOutputFile: options.safelistOutputFile,
42
- config: options.config ?? {},
43
+ config: nextTransformMetadata.configWithImportedStaticSz(options.config ?? {}, options.importedStaticSz),
43
44
  env: options.env ?? process.env,
44
45
  envKeys: options.envKeys,
45
46
  nextVersion,
@@ -62,16 +63,21 @@ function runNextPrebuild(options) {
62
63
  continue;
63
64
  }
64
65
  const source = fs.readFileSync(filename, "utf8");
66
+ const crossModule = nextTransformMetadata.resolveNextCrossModule({
67
+ filename,
68
+ source,
69
+ root: context.root,
70
+ importedStaticSz: options.importedStaticSz
71
+ });
65
72
  const transform = nextTransformMetadata.transformNextSource({
66
73
  source,
67
74
  filename,
68
75
  parserMode: options.parserMode ?? "rust",
69
- compilerOptions: options.compilerOptions,
76
+ compilerOptions: nextTransformMetadata.withCrossModuleStatics(options.compilerOptions, crossModule.statics),
70
77
  cacheRoot,
71
78
  pluginVersion: csszyxVersion,
72
79
  compilerVersion,
73
- astBudget: options.astBudget,
74
- allowBabelFallback: options.allowBabelFallback
80
+ astBudget: options.astBudget
75
81
  });
76
82
  const metadata = nextTransformMetadata.collectNextTransformMetadata(transform.result, source, filename);
77
83
  transformedCount++;
@@ -1,6 +1,6 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
2
  import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.cjs';
3
- import { N as NextSourceTransformOutput, a as NextSourceParserMode } from './shared/unplugin.CXV7fOa2.cjs';
3
+ import { N as NextSourceTransformOutput, a as NextSourceParserMode } from './shared/unplugin.B32Exn-K.cjs';
4
4
  import { N as NextWatcherCycleResult } from './shared/unplugin.xeED_qwh.cjs';
5
5
 
6
6
  /** Serializable options accepted by the Next Turbopack csszyx prebuild core. */
@@ -14,6 +14,13 @@ interface NextPrebuildOptions {
14
14
  safelistOutputFile?: string;
15
15
  parserMode?: NextSourceParserMode;
16
16
  compilerOptions?: TransformSourceCodeOptions;
17
+ /**
18
+ * Whether a plain exported sz object may be compiled into its importers.
19
+ *
20
+ * Must match what the Turbopack loader is given: this pass writes the
21
+ * safelist the loader's emitted classes rely on.
22
+ */
23
+ importedStaticSz?: boolean;
17
24
  config?: JsonLike;
18
25
  env?: Record<string, string | undefined>;
19
26
  envKeys?: readonly string[];
@@ -23,7 +30,6 @@ interface NextPrebuildOptions {
23
30
  nativeVersion?: string;
24
31
  mode?: 'development' | 'production';
25
32
  astBudget?: number;
26
- allowBabelFallback?: boolean;
27
33
  allowProductionMangling?: boolean;
28
34
  writeOptions?: AtomicWriteOptions;
29
35
  createdAt?: string;
@@ -1,6 +1,6 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
2
  import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.mjs';
3
- import { N as NextSourceTransformOutput, a as NextSourceParserMode } from './shared/unplugin.CXV7fOa2.mjs';
3
+ import { N as NextSourceTransformOutput, a as NextSourceParserMode } from './shared/unplugin.B32Exn-K.mjs';
4
4
  import { N as NextWatcherCycleResult } from './shared/unplugin.CdZxp0x-.mjs';
5
5
 
6
6
  /** Serializable options accepted by the Next Turbopack csszyx prebuild core. */
@@ -14,6 +14,13 @@ interface NextPrebuildOptions {
14
14
  safelistOutputFile?: string;
15
15
  parserMode?: NextSourceParserMode;
16
16
  compilerOptions?: TransformSourceCodeOptions;
17
+ /**
18
+ * Whether a plain exported sz object may be compiled into its importers.
19
+ *
20
+ * Must match what the Turbopack loader is given: this pass writes the
21
+ * safelist the loader's emitted classes rely on.
22
+ */
23
+ importedStaticSz?: boolean;
17
24
  config?: JsonLike;
18
25
  env?: Record<string, string | undefined>;
19
26
  envKeys?: readonly string[];
@@ -23,7 +30,6 @@ interface NextPrebuildOptions {
23
30
  nativeVersion?: string;
24
31
  mode?: 'development' | 'production';
25
32
  astBudget?: number;
26
- allowBabelFallback?: boolean;
27
33
  allowProductionMangling?: boolean;
28
34
  writeOptions?: AtomicWriteOptions;
29
35
  createdAt?: string;
@@ -1,10 +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.DXgxFHzO.mjs';
5
- import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.DMcbmP01.mjs';
6
- import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.CDqY7kmk.mjs';
4
+ import { r as readPackageVersion, c as configWithImportedStaticSz, a as resolveNextCrossModule, t as transformNextSource, w as withCrossModuleStatics, b as collectNextTransformMetadata, d as createNextSafelistShardFromMetadata } from './shared/unplugin.DjRylBC_.mjs';
5
+ import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.BU0O4IkX.mjs';
6
+ import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.DKcwO8O4.mjs';
7
7
  import '@csszyx/compiler';
8
+ import '@csszyx/types';
8
9
  import './shared/unplugin.B3XoSRB8.mjs';
9
10
  import 'node:os';
10
11
  import 'proper-lockfile';
@@ -22,7 +23,7 @@ function runNextPrebuild(options) {
22
23
  cwd: options.cwd,
23
24
  cacheDir: options.cacheDir,
24
25
  safelistOutputFile: options.safelistOutputFile,
25
- config: options.config ?? {},
26
+ config: configWithImportedStaticSz(options.config ?? {}, options.importedStaticSz),
26
27
  env: options.env ?? process.env,
27
28
  envKeys: options.envKeys,
28
29
  nextVersion,
@@ -45,16 +46,21 @@ function runNextPrebuild(options) {
45
46
  continue;
46
47
  }
47
48
  const source = readFileSync(filename, "utf8");
49
+ const crossModule = resolveNextCrossModule({
50
+ filename,
51
+ source,
52
+ root: context.root,
53
+ importedStaticSz: options.importedStaticSz
54
+ });
48
55
  const transform = transformNextSource({
49
56
  source,
50
57
  filename,
51
58
  parserMode: options.parserMode ?? "rust",
52
- compilerOptions: options.compilerOptions,
59
+ compilerOptions: withCrossModuleStatics(options.compilerOptions, crossModule.statics),
53
60
  cacheRoot,
54
61
  pluginVersion: csszyxVersion,
55
62
  compilerVersion,
56
- astBudget: options.astBudget,
57
- allowBabelFallback: options.allowBabelFallback
63
+ astBudget: options.astBudget
58
64
  });
59
65
  const metadata = collectNextTransformMetadata(transform.result, source, filename);
60
66
  transformedCount++;
@@ -4,15 +4,16 @@ 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.DblMogcN.cjs');
8
- const nextTransformMetadata = require('./shared/unplugin.Bb5TeU9B.cjs');
9
- const nextRuntimeInjection = require('./shared/unplugin.C2lHQFii.cjs');
10
- const transformCache = require('./shared/unplugin.DbZ7tCfN.cjs');
7
+ const themeGroupsFile = require('./shared/unplugin.CkNQjA4G.cjs');
8
+ const nextTransformMetadata = require('./shared/unplugin.BJiWWF6w.cjs');
9
+ const nextWatcherCycle = require('./shared/unplugin.Cji6O5jv.cjs');
10
+ const transformCache = require('./shared/unplugin.BKGCkMgM.cjs');
11
11
  require('node:fs');
12
- require('node:os');
13
- require('proper-lockfile');
14
12
  require('./shared/unplugin.BkRah5Ot.cjs');
15
13
  require('@csszyx/compiler');
14
+ require('@csszyx/types');
15
+ require('node:os');
16
+ require('proper-lockfile');
16
17
 
17
18
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
18
19
  function _interopNamespaceCompat(e) {
@@ -38,7 +39,7 @@ function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
38
39
  loaderContext: loaderContext.context,
39
40
  cacheDir: options.cacheDir,
40
41
  safelistOutputFile: options.safelistOutputFile,
41
- config: options.config ?? {},
42
+ config: nextTransformMetadata.configWithImportedStaticSz(options.config ?? {}, options.importedStaticSz),
42
43
  env: options.env ?? process.env,
43
44
  envKeys: options.envKeys,
44
45
  nextVersion: options.nextVersion ?? "unknown-next",
@@ -47,34 +48,49 @@ function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
47
48
  mode: options.mode ?? normalizeMode(loaderContext.mode)
48
49
  });
49
50
  assertProductionManifestReady(context, options);
51
+ const crossModule = nextTransformMetadata.resolveNextCrossModule({
52
+ filename: loaderContext.resourcePath,
53
+ source,
54
+ root: context.root,
55
+ importedStaticSz: options.importedStaticSz
56
+ });
50
57
  const transform = nextTransformMetadata.transformNextSource({
51
58
  source,
52
59
  filename: loaderContext.resourcePath,
53
60
  parserMode: options.parserMode ?? "rust",
54
- compilerOptions: options.compilerOptions,
61
+ compilerOptions: nextTransformMetadata.withCrossModuleStatics(options.compilerOptions, crossModule.statics),
55
62
  cacheRoot: transformCache.resolveTransformCacheDir(
56
63
  context.root,
57
64
  path__namespace.relative(context.root, context.cacheDir)
58
65
  ),
59
66
  pluginVersion: options.csszyxVersion ?? nextTransformMetadata.readPackageVersion("../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next-turbo-loader.cjs', document.baseURI).href))),
60
67
  compilerVersion: options.compilerVersion ?? nextTransformMetadata.readPackageVersion("../../compiler/package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next-turbo-loader.cjs', document.baseURI).href))),
61
- astBudget: options.astBudget,
62
- allowBabelFallback: options.allowBabelFallback
68
+ astBudget: options.astBudget
63
69
  });
64
- const injected = nextRuntimeInjection.injectNextRuntimeImports(transform.result.code, transform.result);
70
+ const injected = themeGroupsFile.injectNextRuntimeImports(transform.result.code, transform.result);
71
+ const callsSzcn = transform.result.usesSzcn || /\bszcn\s*\(/.test(source);
72
+ const themeGroups = callsSzcn ? themeGroupsFile.ensureThemeGroupsFile(context.root, path__namespace.join(context.root, ".csszyx")) : { file: null, watch: [] };
73
+ for (const stylesheet of themeGroups.watch) loaderContext.addDependency?.(stylesheet);
74
+ for (const provider of nextTransformMetadata.normalizeProviderPaths(crossModule.providers)) {
75
+ loaderContext.addDependency?.(provider);
76
+ }
77
+ const code = themeGroups.file === null ? injected.code : themeGroupsFile.insertAfterUseDirective(
78
+ injected.code,
79
+ `import '${themeGroupsFile.themeGroupsSpecifier(loaderContext.resourcePath, themeGroups.file)}';
80
+ `
81
+ );
65
82
  const metadata = nextTransformMetadata.collectNextTransformMetadata(
66
83
  transform.result,
67
84
  source,
68
85
  loaderContext.resourcePath
69
86
  );
70
- let shardPath = null;
71
87
  let materialized = false;
72
88
  const shardResult = nextWatcherCycle.writeNextSafelistShard(
73
89
  context.safelist.shardsDir,
74
90
  nextTransformMetadata.createNextSafelistShardFromMetadata(metadata, createShardCacheKey(context, metadata)),
75
91
  options.writeOptions
76
92
  );
77
- shardPath = shardResult.filePath;
93
+ const shardPath = shardResult.filePath;
78
94
  if (options.materializeSafelist !== false && shardResult.changed) {
79
95
  nextWatcherCycle.runNextWatcherCycle(context, {
80
96
  writeOptions: options.writeOptions,
@@ -87,12 +103,12 @@ function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
87
103
  materialized = true;
88
104
  }
89
105
  return {
90
- code: injected.code,
106
+ code,
91
107
  context,
92
108
  transform,
93
109
  shardPath,
94
110
  materialized,
95
- dependencies: []
111
+ dependencies: themeGroups.watch
96
112
  };
97
113
  }
98
114
  function nextTurboLoader(source) {
@@ -1,6 +1,6 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
2
  import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.cjs';
3
- import { a as NextSourceParserMode, N as NextSourceTransformOutput } from './shared/unplugin.CXV7fOa2.cjs';
3
+ import { a as NextSourceParserMode, N as NextSourceTransformOutput } from './shared/unplugin.B32Exn-K.cjs';
4
4
 
5
5
  /** Serializable options accepted by the Next Turbopack csszyx loader. */
6
6
  interface NextTurboLoaderOptions {
@@ -18,10 +18,19 @@ interface NextTurboLoaderOptions {
18
18
  nativeVersion?: string;
19
19
  mode?: 'development' | 'production';
20
20
  astBudget?: number;
21
- allowBabelFallback?: boolean;
22
21
  allowProductionMangling?: boolean;
23
22
  materializeSafelist?: boolean;
24
23
  writeOptions?: AtomicWriteOptions;
24
+ /**
25
+ * Whether a plain exported sz object may be compiled into its importers.
26
+ *
27
+ * The same setting the other lanes spell `build.importedStaticSz`, on
28
+ * unless given, and `csszyx next prebuild` has to resolve it identically —
29
+ * the prebuild is what safelists the classes the loader then emits, so a
30
+ * lane that resolves more than the other would emit class names with no
31
+ * rule behind them.
32
+ */
33
+ importedStaticSz?: boolean;
25
34
  }
26
35
  /** Minimal Webpack-compatible loader context used by Turbopack. */
27
36
  interface NextTurboLoaderContext {
@@ -1,6 +1,6 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
2
  import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.mjs';
3
- import { a as NextSourceParserMode, N as NextSourceTransformOutput } from './shared/unplugin.CXV7fOa2.mjs';
3
+ import { a as NextSourceParserMode, N as NextSourceTransformOutput } from './shared/unplugin.B32Exn-K.mjs';
4
4
 
5
5
  /** Serializable options accepted by the Next Turbopack csszyx loader. */
6
6
  interface NextTurboLoaderOptions {
@@ -18,10 +18,19 @@ interface NextTurboLoaderOptions {
18
18
  nativeVersion?: string;
19
19
  mode?: 'development' | 'production';
20
20
  astBudget?: number;
21
- allowBabelFallback?: boolean;
22
21
  allowProductionMangling?: boolean;
23
22
  materializeSafelist?: boolean;
24
23
  writeOptions?: AtomicWriteOptions;
24
+ /**
25
+ * Whether a plain exported sz object may be compiled into its importers.
26
+ *
27
+ * The same setting the other lanes spell `build.importedStaticSz`, on
28
+ * unless given, and `csszyx next prebuild` has to resolve it identically —
29
+ * the prebuild is what safelists the classes the loader then emits, so a
30
+ * lane that resolves more than the other would emit class names with no
31
+ * rule behind them.
32
+ */
33
+ importedStaticSz?: boolean;
25
34
  }
26
35
  /** Minimal Webpack-compatible loader context used by Turbopack. */
27
36
  interface NextTurboLoaderContext {