@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
@@ -65,7 +65,7 @@ interface GlobalVarScanCacheKeyInput {
65
65
  /** Source file mtime in milliseconds. */
66
66
  mtimeMs: number;
67
67
  }
68
- /** CSS source supplied to the Phase H validation orchestrator. */
68
+ /** CSS source supplied to the global-variable validation orchestrator. */
69
69
  interface GlobalVarCssSource {
70
70
  /** Source file path. */
71
71
  filePath: string;
@@ -74,7 +74,7 @@ interface GlobalVarCssSource {
74
74
  /** Source file mtime in milliseconds, used when cacheDir is set. */
75
75
  mtimeMs?: number;
76
76
  }
77
- /** JS/TS/JSX/TSX source supplied to the Phase H validation orchestrator. */
77
+ /** JS/TS/JSX/TSX source supplied to the global-variable validation orchestrator. */
78
78
  interface GlobalVarCodeSource {
79
79
  /** Source file path. */
80
80
  filePath: string;
@@ -101,7 +101,7 @@ type GlobalVarAliasDiagnosticSeverity = 'error';
101
101
  interface GlobalVarAliasDiagnostic {
102
102
  /** Machine-readable diagnostic code. */
103
103
  code: 'missing-definition' | 'tailwind-reserved' | 'tailwind-owned' | 'registered-property' | 'alias-collision';
104
- /** Diagnostic severity. Phase H M2 is fail-closed. */
104
+ /** Diagnostic severity. Every finding fails the build. */
105
105
  severity: GlobalVarAliasDiagnosticSeverity;
106
106
  /** Related custom-property name. */
107
107
  name: string;
@@ -141,7 +141,7 @@ interface GlobalVarAliasPlan {
141
141
  /** Planner diagnostics. */
142
142
  diagnostics: GlobalVarAliasDiagnostic[];
143
143
  }
144
- /** Input for Phase H scanner/planner/diagnostics integration. */
144
+ /** Input for the global-variable scanner/planner/diagnostics integration. */
145
145
  interface ValidateGlobalVarAliasInputsOptions {
146
146
  /** CSS sources that define or reference custom properties. */
147
147
  cssFiles: GlobalVarCssSource[];
@@ -177,7 +177,7 @@ interface CreateGlobalVarAliasValidationOptionsInput {
177
177
  /** Optional global-var scan cache directory. */
178
178
  cacheDir?: string;
179
179
  }
180
- /** Output from Phase H scanner/planner/diagnostics integration. */
180
+ /** Output from the global-variable scanner/planner/diagnostics integration. */
181
181
  interface GlobalVarAliasValidationResult {
182
182
  /** CSS scan results. */
183
183
  scans: CssVarScanResult[];
@@ -405,12 +405,21 @@ interface PluginState {
405
405
  * Drives the `@source` safelist; NOT the mangle map.
406
406
  */
407
407
  classes: Set<string>;
408
- /** Merged @theme scan result — feeds the theme-groups virtual module. */
408
+ /**
409
+ * Merged @theme scan result — the ONLY consumer is the theme-groups virtual
410
+ * module, so this is a merge-correctness input, not a typing one.
411
+ */
409
412
  parsedTheme: ParsedTheme | null;
410
413
  /**
411
- * CSS files the zero-config @theme auto-scan found tokens in (only when
412
- * `build.scanCss` is unset). Dev HMR re-scans when one of these — or any
413
- * other .css file changes, mirroring the explicit scanCss reload path.
414
+ * Tokens from the files `build.scanCss` lists, kept apart from the
415
+ * project-wide discovery so a token deleted from either source disappears
416
+ * from the merged result instead of lingering across a re-scan.
417
+ */
418
+ scanCssTheme: ParsedTheme | null;
419
+ /**
420
+ * CSS files the project-wide @theme scan found tokens in. Dev HMR re-scans
421
+ * when one of these — or any other .css file — changes, mirroring the
422
+ * explicit scanCss reload path.
414
423
  */
415
424
  autoThemeCssFiles: string[];
416
425
  /**
@@ -450,11 +459,29 @@ interface PluginState {
450
459
  /** Unresolvable-spread warnings surfaced to the build log in every mode. */
451
460
  spreadWarnings: Set<string>;
452
461
  /**
453
- * Workspace-package files under `/packages/` that contain `sz` but were
462
+ * Advisory sz fallbacks this build declined to list.
463
+ *
464
+ * Counted so the build can say the list is partial. Printing nothing is not
465
+ * the same as printing "nothing happened", and a log that names five
466
+ * fallbacks while holding three back reads as a total.
467
+ */
468
+ suppressedAdvisories: number;
469
+ /**
470
+ * Workspace-package files under `/packages/` that use csszyx but were
454
471
  * skipped by the hard-ignore (not under any `compileSources` dir). Surfaced at
455
472
  * build end so the silent no-op (skipped `sz` → no CSS) becomes visible.
456
473
  */
457
474
  skippedSzFiles: Set<string>;
475
+ /**
476
+ * The subset of {@link skippedSzFiles} that may export szv factories.
477
+ *
478
+ * Skipping one of these does more than lose a file's own CSS: it keeps the
479
+ * module out of the cross-module registry, so every importer — compiled or
480
+ * not — silently falls back to the runtime path. That is dropped csszyx
481
+ * output rather than a usage nudge, so its presence promotes the warning
482
+ * out of dev-only.
483
+ */
484
+ skippedSzvExportFiles: Set<string>;
458
485
  /** Guards the skipped-sz-files warning so it fires at most once. */
459
486
  skipWarningEmitted: boolean;
460
487
  /**
@@ -608,10 +635,10 @@ declare function collectMangleHybridHazards(mangleMap: Record<string, string>, m
608
635
  declare function mangleHybridHazardMessage(hazards: MangleHybridHazards): string | null;
609
636
  /**
610
637
  * Whether a CSS module scopes Tailwind's content detection — `source(none)` or
611
- * `source("…")` on the `@import "tailwindcss"`, or any `@source not` exclusion.
638
+ * `source("…")` on a `@import "tailwindcss"`, or any `@source not` exclusion.
612
639
  * A plain additive `@source "…"` does NOT count: it only adds a path, it does
613
- * not stop the automatic climb-to-the-workspace-root scan. Block comments are
614
- * stripped first so a commented-out directive does not count.
640
+ * not stop the automatic scan. Block comments are stripped first so a
641
+ * commented-out directive does not count.
615
642
  *
616
643
  * @param code - CSS module source.
617
644
  * @returns true when the entry scopes (or excludes from) content detection.
@@ -644,38 +671,104 @@ declare function shouldWarnUnscopedMonorepo(sawTailwindEntry: boolean, tailwindE
644
671
  /**
645
672
  * Build the unscoped-monorepo warning message: what is wrong, why it matters,
646
673
  * the exact two-line fix, the guide link, and how to silence it.
674
+ *
675
+ * Describes the detection BASE rather than promising a climb to the workspace
676
+ * root. Measured on a workspace package built through the Vite plugin, the scan
677
+ * was rooted at the Vite root: files beside the entry were scanned, the sibling
678
+ * package and the workspace root were not. Naming a worse failure than the one
679
+ * that is happening is how an advisory gets discounted — a reader who checks
680
+ * for phantom classes from sibling packages finds none and stops believing the
681
+ * rest of the message.
682
+ *
683
+ * The suggested snippet carries no CSS comment on purpose. A block comment ends
684
+ * at the first `*` followed by `/`, which any recursive glob contains, so
685
+ * inviting the reader to annotate `@source` lines invites a stylesheet that
686
+ * stops parsing where they documented it.
687
+ *
647
688
  * @returns the warning string.
648
689
  */
649
690
  declare function unscopedMonorepoMessage(): string;
650
691
  /**
651
- * Whether a csszyx build warning should be emitted. `quiet` mutes all of them;
652
- * `devOnly` additionally suppresses the warning in a production build (for usage
653
- * nudges that must not noise a host app's prod output). Pure so the gating policy
654
- * is unit-tested without the worker-based buildEnd wiring.
692
+ * Whether a diagnostic is an advisory one the class a build may hold back.
693
+ *
694
+ * Spread warnings, budget bails and `missing-css` fallbacks all describe absent
695
+ * output and print regardless. What is left says the runtime path was taken
696
+ * where a compiled one was possible: real, worth acting on, and not a failure.
697
+ *
698
+ * @param message - One raw diagnostic line as an engine emitted it.
699
+ * @returns True when the diagnostic is advisory rather than a build result.
700
+ */
701
+ declare function isAdvisoryDiagnostic(message: string): boolean;
702
+ /**
703
+ * Build the one-line disclosure that the fallback list above is partial.
704
+ *
705
+ * Four of the five `sz`-site fallback kinds never print in a production build,
706
+ * so a log can list the `szr` fallbacks it found and silently hold every
707
+ * `sz={factory()}` beside them. A consumer counting affected sites from that
708
+ * log counts a lower bound and has no way to know it — one reported a site
709
+ * count that was short by half for exactly this reason, and only caught it by
710
+ * reading sources instead.
711
+ *
712
+ * Suppression is the right default; implying zero is not. One line costs
713
+ * nothing and keeps the difference visible.
714
+ *
715
+ * @param count - Advisory fallbacks the build declined to list.
716
+ * @returns The disclosure, or null when nothing was held back.
717
+ */
718
+ declare function suppressedAdvisoryMessage(count: number): string | null;
719
+ /**
720
+ * The `quiet` option, normalized.
721
+ *
722
+ * `'all'` is the blunt setting a plain `true` selects; `'nudges'` keeps every
723
+ * report that the build produced less output than it was asked for.
724
+ */
725
+ type QuietMode = 'off' | 'nudges' | 'all';
726
+ /**
727
+ * Normalize the authored `quiet` value. Idempotent, so a already-normalized
728
+ * mode passes through unchanged.
729
+ *
730
+ * @param quiet - Authored option value, or an already-resolved mode.
731
+ * @returns The mode the gates read.
732
+ */
733
+ declare function resolveQuietMode(quiet: boolean | 'nudges' | QuietMode | undefined): QuietMode;
734
+ /**
735
+ * Whether a csszyx build warning should be emitted.
736
+ *
737
+ * `devOnly` is already this plugin's marker for "usage nudge": it suppresses
738
+ * the warning in a production build so it cannot noise a host app's output.
739
+ * `'nudges'` mutes exactly that same set, which keeps one axis instead of
740
+ * inventing a second classification for the same distinction. `true` mutes
741
+ * everything. Pure so the gating policy is unit-tested without the
742
+ * worker-based buildEnd wiring.
655
743
  *
656
- * @param quiet - The `quiet` option: mute every warning.
657
- * @param devOnly - This warning is a dev-only usage nudge.
744
+ * @param quiet - Resolved quiet mode.
745
+ * @param devOnly - This warning is a usage nudge.
658
746
  * @param isProduction - Whether this is a production build.
659
747
  * @returns true when the warning should be printed.
660
748
  */
661
- declare function shouldEmitWarning(quiet: boolean, devOnly: boolean, isProduction: boolean): boolean;
749
+ declare function shouldEmitWarning(quiet: QuietMode, devOnly: boolean, isProduction: boolean): boolean;
662
750
  /**
663
751
  * Whether a transform diagnostic describes missing CSS and may be printed.
664
752
  *
665
- * @param quiet - Whether all build warnings are muted.
753
+ * Only the blunt mode hides these. A missing-CSS diagnostic says classes never
754
+ * reached the safelist, so the styles are absent from the output — a build
755
+ * result, not a style opinion, and `'nudges'` exists so a calmer log does not
756
+ * have to cost it.
757
+ *
758
+ * @param quiet - Resolved quiet mode.
666
759
  * @param message - Compiler diagnostic to classify.
667
760
  * @returns True when the diagnostic is an unsilenced missing-CSS failure.
668
761
  */
669
- declare function shouldEmitMissingCssFallback(quiet: boolean, message: string): boolean;
762
+ declare function shouldEmitMissingCssFallback(quiet: QuietMode, message: string): boolean;
670
763
  /**
671
764
  * Emit one missing-CSS fallback through the caller's output channel.
672
765
  *
673
- * @param quiet - Whether all build warnings are muted.
766
+ * @param quiet - Resolved quiet mode.
674
767
  * @param message - Compiler diagnostic to classify and emit.
675
768
  * @param id - Bundler module identifier included in the warning.
676
769
  * @param emit - Warning output channel.
677
770
  */
678
- declare function emitMissingCssFallback(quiet: boolean, message: string, id: string, emit: (message: string) => void): void;
771
+ declare function emitMissingCssFallback(quiet: QuietMode, message: string, id: string, emit: (message: string) => void): void;
679
772
  /**
680
773
  * Resolve `compileSources` entries to absolute, realpath-resolved directories.
681
774
  * Each entry resolves like a Vite config path: relative to the project `root`
@@ -770,14 +863,46 @@ declare function allocateMangleTokens(eligibleClasses: readonly string[], forbid
770
863
  */
771
864
  declare function isPackagesSkippedSource(id: string, sourceDirs?: readonly string[]): boolean;
772
865
  /**
773
- * Build the workspace-package skip warning. Lists the skipped files that contain
774
- * `sz` so the developer can add the package directory to `compileSources`
866
+ * Build the workspace-package skip warning. Lists the skipped files that use
867
+ * csszyx so the developer can add the package directory to `compileSources`
775
868
  * instead of silently shipping no CSS for them.
776
869
  *
777
- * @param files - skipped `/packages/` file paths that contain `sz`.
870
+ * @param files - skipped `/packages/` file paths that use csszyx.
871
+ * @param szvExportFiles - the subset that may export `szv` factories, whose
872
+ * skip also costs every importer its cross-module precompile.
778
873
  * @returns the warning string.
779
874
  */
780
- declare function skippedSzFilesMessage(files: readonly string[]): string;
875
+ declare function skippedSzFilesMessage(files: readonly string[], szvExportFiles?: readonly string[]): string;
876
+ /**
877
+ * Explains a class census that grew after the mangle map was already frozen.
878
+ *
879
+ * The map is settled right after the prescan because the CSS a build ships is
880
+ * hashed while it is still being transformed. A class discovered later would be
881
+ * mangled in one artifact and not in another, so the build stops here rather
882
+ * than emitting output whose CSS, JS and HTML disagree.
883
+ *
884
+ * @param lateOwned csszyx-owned classes first seen after the freeze.
885
+ * @param lateAuthored raw author classes first seen after the freeze.
886
+ * @returns the error text.
887
+ */
888
+ declare function lateMangleCensusMessage(lateOwned: readonly string[], lateAuthored: readonly string[]): string;
889
+ /**
890
+ * Explains why a watch build does not mangle.
891
+ *
892
+ * @returns the warning text.
893
+ */
894
+ declare function watchModeMangleMessage(): string;
895
+ /**
896
+ * Explains why webpack must keep recomputing content hashes.
897
+ *
898
+ * csszyx rewrites webpack assets in `processAssets`, which is only safe
899
+ * because `optimization.realContentHash` runs later and recomputes each hash
900
+ * from the final bytes. Turning it off puts webpack back in the state this
901
+ * release fixed for Vite: same filename, different bytes.
902
+ *
903
+ * @returns the warning text.
904
+ */
905
+ declare function realContentHashDisabledMessage(): string;
781
906
  /**
782
907
  * Computes the `@source` target path for a CSS module: the location of the
783
908
  * generated safelist file relative to the CSS file, in posix form and always
@@ -807,8 +932,8 @@ declare function shouldTrackGlobalVarSources(config?: {
807
932
  enabled?: boolean;
808
933
  }): boolean;
809
934
  /**
810
- * Records source text available before bundling/minification for Phase H
811
- * global-var diagnostics.
935
+ * Records source text available before bundling/minification for global-var
936
+ * diagnostics.
812
937
  *
813
938
  * @param state Plugin state to update.
814
939
  * @param filename Source filename that owns the text.
@@ -816,7 +941,14 @@ declare function shouldTrackGlobalVarSources(config?: {
816
941
  */
817
942
  declare function recordGlobalVarSourceFile(state: Pick<PluginState, 'globalVarSourceFilesByFile'>, filename: string, code: string | null): void;
818
943
  /**
819
- * Extracts Phase H global custom-property aliases for manifest/debug tooling.
944
+ * Decides whether a module id is a stylesheet csszyx should rewrite.
945
+ *
946
+ * @param id Bundler module identifier.
947
+ * @returns True for a stylesheet whose text is destined for emitted CSS.
948
+ */
949
+ declare function isMangleableCssId(id: string): boolean;
950
+ /**
951
+ * Extracts global custom-property aliases for manifest/debug tooling.
820
952
  *
821
953
  * The legacy `varMangleMap` also carries dynamic s/c-tier CSS variables. This
822
954
  * helper keeps manifest consumers from guessing tiers by exposing only aliases
@@ -886,5 +1018,5 @@ declare const rollupPlugin: (options?: PartialCsszyxConfig) => InputPluginOption
886
1018
  */
887
1019
  declare const esbuildPlugin: (options?: PartialCsszyxConfig) => Plugin;
888
1020
 
889
- export { mangleEligibleClasses as $, cssImportsTailwind as A, unplugin as B, deleteRSCModuleRecord as D, emitMissingCssFallback as E, esbuildPlugin as F, extractGlobalVarAliasesForManifest as H, fileMayContainSafelistableSz as I, findLocalImportSources as J, findRSCBoundaryViolation as K, findRSCGraphViolation as L, hasInjectableTailwindCandidate as N, hasTokens as O, hasUseClientDirective as Q, hasUseServerDirective as T, isCompileSourceOptedIn as U, isHardIgnoredPath as W, isMonorepoPackage as X, isPackagesSkippedSource as Y, isRSCServerModule as Z, mangleCodeClassesSync as _, mangleHybridHazardMessage as a0, mergeThemes as a1, missingTailwindEntryMessage as a2, normalizeGlobalVarAliasesForCache as a3, parseThemeBlocks as a4, recordGlobalVarSourceFile as a5, resolveCompileSourceDirs as a6, resolveNativeCacheIdentity as a7, rollupPlugin as a8, scanCustomPropertyNames as a9, shouldEmitMissingCssFallback as aa, shouldEmitWarning as ab, shouldTrackGlobalVarSources as ac, shouldWarnMissingTailwindEntry as ad, shouldWarnUnscopedMonorepo as ae, skippedSzFilesMessage as af, unscopedMonorepoMessage as ag, vitePlugin as ah, webpackPlugin as ai, allocateMangleTokens as r, appendTailwindSourceDirective as s, assertNoRSCBoundaryViolation as t, assertNoRSCGraphViolation as u, collectMangleHybridHazards as v, computeSafelistRelPath as w, createGlobalVarMapAssetSource as x, createRSCModuleRecord as y, cssHasContentScope as z };
890
- 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 };
1021
+ export { isPackagesSkippedSource as $, cssImportsTailwind as A, unplugin as B, deleteRSCModuleRecord as D, emitMissingCssFallback as E, esbuildPlugin as F, extractGlobalVarAliasesForManifest as H, fileMayContainSafelistableSz as I, findLocalImportSources as J, findRSCBoundaryViolation as K, findRSCGraphViolation as L, hasInjectableTailwindCandidate as N, hasTokens as O, hasUseClientDirective as T, hasUseServerDirective as U, isAdvisoryDiagnostic as W, isCompileSourceOptedIn as X, isHardIgnoredPath as Y, isMangleableCssId as Z, isMonorepoPackage as _, isRSCServerModule as a0, lateMangleCensusMessage as a1, mangleCodeClassesSync as a2, mangleEligibleClasses as a3, mangleHybridHazardMessage as a4, mergeThemes as a5, missingTailwindEntryMessage as a6, normalizeGlobalVarAliasesForCache as a7, parseThemeBlocks as a8, realContentHashDisabledMessage as a9, recordGlobalVarSourceFile as aa, resolveCompileSourceDirs as ab, resolveNativeCacheIdentity as ac, resolveQuietMode as ad, rollupPlugin as ae, scanCustomPropertyNames as af, shouldEmitMissingCssFallback as ag, shouldEmitWarning as ah, shouldTrackGlobalVarSources as ai, shouldWarnMissingTailwindEntry as aj, shouldWarnUnscopedMonorepo as ak, skippedSzFilesMessage as al, suppressedAdvisoryMessage as am, unscopedMonorepoMessage as an, vitePlugin as ao, watchModeMangleMessage as ap, webpackPlugin as aq, allocateMangleTokens as r, appendTailwindSourceDirective as s, assertNoRSCBoundaryViolation as t, assertNoRSCGraphViolation as u, collectMangleHybridHazards as v, computeSafelistRelPath as w, createGlobalVarMapAssetSource as x, createRSCModuleRecord as y, cssHasContentScope as z };
1022
+ export type { CssVarScanResult as C, GlobalVarScanCacheKeyInput as G, MangleHybridHazards as M, PlanGlobalVarAliasesInput as P, QuietMode as Q, 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 };
@@ -65,7 +65,7 @@ interface GlobalVarScanCacheKeyInput {
65
65
  /** Source file mtime in milliseconds. */
66
66
  mtimeMs: number;
67
67
  }
68
- /** CSS source supplied to the Phase H validation orchestrator. */
68
+ /** CSS source supplied to the global-variable validation orchestrator. */
69
69
  interface GlobalVarCssSource {
70
70
  /** Source file path. */
71
71
  filePath: string;
@@ -74,7 +74,7 @@ interface GlobalVarCssSource {
74
74
  /** Source file mtime in milliseconds, used when cacheDir is set. */
75
75
  mtimeMs?: number;
76
76
  }
77
- /** JS/TS/JSX/TSX source supplied to the Phase H validation orchestrator. */
77
+ /** JS/TS/JSX/TSX source supplied to the global-variable validation orchestrator. */
78
78
  interface GlobalVarCodeSource {
79
79
  /** Source file path. */
80
80
  filePath: string;
@@ -101,7 +101,7 @@ type GlobalVarAliasDiagnosticSeverity = 'error';
101
101
  interface GlobalVarAliasDiagnostic {
102
102
  /** Machine-readable diagnostic code. */
103
103
  code: 'missing-definition' | 'tailwind-reserved' | 'tailwind-owned' | 'registered-property' | 'alias-collision';
104
- /** Diagnostic severity. Phase H M2 is fail-closed. */
104
+ /** Diagnostic severity. Every finding fails the build. */
105
105
  severity: GlobalVarAliasDiagnosticSeverity;
106
106
  /** Related custom-property name. */
107
107
  name: string;
@@ -141,7 +141,7 @@ interface GlobalVarAliasPlan {
141
141
  /** Planner diagnostics. */
142
142
  diagnostics: GlobalVarAliasDiagnostic[];
143
143
  }
144
- /** Input for Phase H scanner/planner/diagnostics integration. */
144
+ /** Input for the global-variable scanner/planner/diagnostics integration. */
145
145
  interface ValidateGlobalVarAliasInputsOptions {
146
146
  /** CSS sources that define or reference custom properties. */
147
147
  cssFiles: GlobalVarCssSource[];
@@ -177,7 +177,7 @@ interface CreateGlobalVarAliasValidationOptionsInput {
177
177
  /** Optional global-var scan cache directory. */
178
178
  cacheDir?: string;
179
179
  }
180
- /** Output from Phase H scanner/planner/diagnostics integration. */
180
+ /** Output from the global-variable scanner/planner/diagnostics integration. */
181
181
  interface GlobalVarAliasValidationResult {
182
182
  /** CSS scan results. */
183
183
  scans: CssVarScanResult[];
@@ -405,12 +405,21 @@ interface PluginState {
405
405
  * Drives the `@source` safelist; NOT the mangle map.
406
406
  */
407
407
  classes: Set<string>;
408
- /** Merged @theme scan result — feeds the theme-groups virtual module. */
408
+ /**
409
+ * Merged @theme scan result — the ONLY consumer is the theme-groups virtual
410
+ * module, so this is a merge-correctness input, not a typing one.
411
+ */
409
412
  parsedTheme: ParsedTheme | null;
410
413
  /**
411
- * CSS files the zero-config @theme auto-scan found tokens in (only when
412
- * `build.scanCss` is unset). Dev HMR re-scans when one of these — or any
413
- * other .css file changes, mirroring the explicit scanCss reload path.
414
+ * Tokens from the files `build.scanCss` lists, kept apart from the
415
+ * project-wide discovery so a token deleted from either source disappears
416
+ * from the merged result instead of lingering across a re-scan.
417
+ */
418
+ scanCssTheme: ParsedTheme | null;
419
+ /**
420
+ * CSS files the project-wide @theme scan found tokens in. Dev HMR re-scans
421
+ * when one of these — or any other .css file — changes, mirroring the
422
+ * explicit scanCss reload path.
414
423
  */
415
424
  autoThemeCssFiles: string[];
416
425
  /**
@@ -450,11 +459,29 @@ interface PluginState {
450
459
  /** Unresolvable-spread warnings surfaced to the build log in every mode. */
451
460
  spreadWarnings: Set<string>;
452
461
  /**
453
- * Workspace-package files under `/packages/` that contain `sz` but were
462
+ * Advisory sz fallbacks this build declined to list.
463
+ *
464
+ * Counted so the build can say the list is partial. Printing nothing is not
465
+ * the same as printing "nothing happened", and a log that names five
466
+ * fallbacks while holding three back reads as a total.
467
+ */
468
+ suppressedAdvisories: number;
469
+ /**
470
+ * Workspace-package files under `/packages/` that use csszyx but were
454
471
  * skipped by the hard-ignore (not under any `compileSources` dir). Surfaced at
455
472
  * build end so the silent no-op (skipped `sz` → no CSS) becomes visible.
456
473
  */
457
474
  skippedSzFiles: Set<string>;
475
+ /**
476
+ * The subset of {@link skippedSzFiles} that may export szv factories.
477
+ *
478
+ * Skipping one of these does more than lose a file's own CSS: it keeps the
479
+ * module out of the cross-module registry, so every importer — compiled or
480
+ * not — silently falls back to the runtime path. That is dropped csszyx
481
+ * output rather than a usage nudge, so its presence promotes the warning
482
+ * out of dev-only.
483
+ */
484
+ skippedSzvExportFiles: Set<string>;
458
485
  /** Guards the skipped-sz-files warning so it fires at most once. */
459
486
  skipWarningEmitted: boolean;
460
487
  /**
@@ -608,10 +635,10 @@ declare function collectMangleHybridHazards(mangleMap: Record<string, string>, m
608
635
  declare function mangleHybridHazardMessage(hazards: MangleHybridHazards): string | null;
609
636
  /**
610
637
  * Whether a CSS module scopes Tailwind's content detection — `source(none)` or
611
- * `source("…")` on the `@import "tailwindcss"`, or any `@source not` exclusion.
638
+ * `source("…")` on a `@import "tailwindcss"`, or any `@source not` exclusion.
612
639
  * A plain additive `@source "…"` does NOT count: it only adds a path, it does
613
- * not stop the automatic climb-to-the-workspace-root scan. Block comments are
614
- * stripped first so a commented-out directive does not count.
640
+ * not stop the automatic scan. Block comments are stripped first so a
641
+ * commented-out directive does not count.
615
642
  *
616
643
  * @param code - CSS module source.
617
644
  * @returns true when the entry scopes (or excludes from) content detection.
@@ -644,38 +671,104 @@ declare function shouldWarnUnscopedMonorepo(sawTailwindEntry: boolean, tailwindE
644
671
  /**
645
672
  * Build the unscoped-monorepo warning message: what is wrong, why it matters,
646
673
  * the exact two-line fix, the guide link, and how to silence it.
674
+ *
675
+ * Describes the detection BASE rather than promising a climb to the workspace
676
+ * root. Measured on a workspace package built through the Vite plugin, the scan
677
+ * was rooted at the Vite root: files beside the entry were scanned, the sibling
678
+ * package and the workspace root were not. Naming a worse failure than the one
679
+ * that is happening is how an advisory gets discounted — a reader who checks
680
+ * for phantom classes from sibling packages finds none and stops believing the
681
+ * rest of the message.
682
+ *
683
+ * The suggested snippet carries no CSS comment on purpose. A block comment ends
684
+ * at the first `*` followed by `/`, which any recursive glob contains, so
685
+ * inviting the reader to annotate `@source` lines invites a stylesheet that
686
+ * stops parsing where they documented it.
687
+ *
647
688
  * @returns the warning string.
648
689
  */
649
690
  declare function unscopedMonorepoMessage(): string;
650
691
  /**
651
- * Whether a csszyx build warning should be emitted. `quiet` mutes all of them;
652
- * `devOnly` additionally suppresses the warning in a production build (for usage
653
- * nudges that must not noise a host app's prod output). Pure so the gating policy
654
- * is unit-tested without the worker-based buildEnd wiring.
692
+ * Whether a diagnostic is an advisory one the class a build may hold back.
693
+ *
694
+ * Spread warnings, budget bails and `missing-css` fallbacks all describe absent
695
+ * output and print regardless. What is left says the runtime path was taken
696
+ * where a compiled one was possible: real, worth acting on, and not a failure.
697
+ *
698
+ * @param message - One raw diagnostic line as an engine emitted it.
699
+ * @returns True when the diagnostic is advisory rather than a build result.
700
+ */
701
+ declare function isAdvisoryDiagnostic(message: string): boolean;
702
+ /**
703
+ * Build the one-line disclosure that the fallback list above is partial.
704
+ *
705
+ * Four of the five `sz`-site fallback kinds never print in a production build,
706
+ * so a log can list the `szr` fallbacks it found and silently hold every
707
+ * `sz={factory()}` beside them. A consumer counting affected sites from that
708
+ * log counts a lower bound and has no way to know it — one reported a site
709
+ * count that was short by half for exactly this reason, and only caught it by
710
+ * reading sources instead.
711
+ *
712
+ * Suppression is the right default; implying zero is not. One line costs
713
+ * nothing and keeps the difference visible.
714
+ *
715
+ * @param count - Advisory fallbacks the build declined to list.
716
+ * @returns The disclosure, or null when nothing was held back.
717
+ */
718
+ declare function suppressedAdvisoryMessage(count: number): string | null;
719
+ /**
720
+ * The `quiet` option, normalized.
721
+ *
722
+ * `'all'` is the blunt setting a plain `true` selects; `'nudges'` keeps every
723
+ * report that the build produced less output than it was asked for.
724
+ */
725
+ type QuietMode = 'off' | 'nudges' | 'all';
726
+ /**
727
+ * Normalize the authored `quiet` value. Idempotent, so a already-normalized
728
+ * mode passes through unchanged.
729
+ *
730
+ * @param quiet - Authored option value, or an already-resolved mode.
731
+ * @returns The mode the gates read.
732
+ */
733
+ declare function resolveQuietMode(quiet: boolean | 'nudges' | QuietMode | undefined): QuietMode;
734
+ /**
735
+ * Whether a csszyx build warning should be emitted.
736
+ *
737
+ * `devOnly` is already this plugin's marker for "usage nudge": it suppresses
738
+ * the warning in a production build so it cannot noise a host app's output.
739
+ * `'nudges'` mutes exactly that same set, which keeps one axis instead of
740
+ * inventing a second classification for the same distinction. `true` mutes
741
+ * everything. Pure so the gating policy is unit-tested without the
742
+ * worker-based buildEnd wiring.
655
743
  *
656
- * @param quiet - The `quiet` option: mute every warning.
657
- * @param devOnly - This warning is a dev-only usage nudge.
744
+ * @param quiet - Resolved quiet mode.
745
+ * @param devOnly - This warning is a usage nudge.
658
746
  * @param isProduction - Whether this is a production build.
659
747
  * @returns true when the warning should be printed.
660
748
  */
661
- declare function shouldEmitWarning(quiet: boolean, devOnly: boolean, isProduction: boolean): boolean;
749
+ declare function shouldEmitWarning(quiet: QuietMode, devOnly: boolean, isProduction: boolean): boolean;
662
750
  /**
663
751
  * Whether a transform diagnostic describes missing CSS and may be printed.
664
752
  *
665
- * @param quiet - Whether all build warnings are muted.
753
+ * Only the blunt mode hides these. A missing-CSS diagnostic says classes never
754
+ * reached the safelist, so the styles are absent from the output — a build
755
+ * result, not a style opinion, and `'nudges'` exists so a calmer log does not
756
+ * have to cost it.
757
+ *
758
+ * @param quiet - Resolved quiet mode.
666
759
  * @param message - Compiler diagnostic to classify.
667
760
  * @returns True when the diagnostic is an unsilenced missing-CSS failure.
668
761
  */
669
- declare function shouldEmitMissingCssFallback(quiet: boolean, message: string): boolean;
762
+ declare function shouldEmitMissingCssFallback(quiet: QuietMode, message: string): boolean;
670
763
  /**
671
764
  * Emit one missing-CSS fallback through the caller's output channel.
672
765
  *
673
- * @param quiet - Whether all build warnings are muted.
766
+ * @param quiet - Resolved quiet mode.
674
767
  * @param message - Compiler diagnostic to classify and emit.
675
768
  * @param id - Bundler module identifier included in the warning.
676
769
  * @param emit - Warning output channel.
677
770
  */
678
- declare function emitMissingCssFallback(quiet: boolean, message: string, id: string, emit: (message: string) => void): void;
771
+ declare function emitMissingCssFallback(quiet: QuietMode, message: string, id: string, emit: (message: string) => void): void;
679
772
  /**
680
773
  * Resolve `compileSources` entries to absolute, realpath-resolved directories.
681
774
  * Each entry resolves like a Vite config path: relative to the project `root`
@@ -770,14 +863,46 @@ declare function allocateMangleTokens(eligibleClasses: readonly string[], forbid
770
863
  */
771
864
  declare function isPackagesSkippedSource(id: string, sourceDirs?: readonly string[]): boolean;
772
865
  /**
773
- * Build the workspace-package skip warning. Lists the skipped files that contain
774
- * `sz` so the developer can add the package directory to `compileSources`
866
+ * Build the workspace-package skip warning. Lists the skipped files that use
867
+ * csszyx so the developer can add the package directory to `compileSources`
775
868
  * instead of silently shipping no CSS for them.
776
869
  *
777
- * @param files - skipped `/packages/` file paths that contain `sz`.
870
+ * @param files - skipped `/packages/` file paths that use csszyx.
871
+ * @param szvExportFiles - the subset that may export `szv` factories, whose
872
+ * skip also costs every importer its cross-module precompile.
778
873
  * @returns the warning string.
779
874
  */
780
- declare function skippedSzFilesMessage(files: readonly string[]): string;
875
+ declare function skippedSzFilesMessage(files: readonly string[], szvExportFiles?: readonly string[]): string;
876
+ /**
877
+ * Explains a class census that grew after the mangle map was already frozen.
878
+ *
879
+ * The map is settled right after the prescan because the CSS a build ships is
880
+ * hashed while it is still being transformed. A class discovered later would be
881
+ * mangled in one artifact and not in another, so the build stops here rather
882
+ * than emitting output whose CSS, JS and HTML disagree.
883
+ *
884
+ * @param lateOwned csszyx-owned classes first seen after the freeze.
885
+ * @param lateAuthored raw author classes first seen after the freeze.
886
+ * @returns the error text.
887
+ */
888
+ declare function lateMangleCensusMessage(lateOwned: readonly string[], lateAuthored: readonly string[]): string;
889
+ /**
890
+ * Explains why a watch build does not mangle.
891
+ *
892
+ * @returns the warning text.
893
+ */
894
+ declare function watchModeMangleMessage(): string;
895
+ /**
896
+ * Explains why webpack must keep recomputing content hashes.
897
+ *
898
+ * csszyx rewrites webpack assets in `processAssets`, which is only safe
899
+ * because `optimization.realContentHash` runs later and recomputes each hash
900
+ * from the final bytes. Turning it off puts webpack back in the state this
901
+ * release fixed for Vite: same filename, different bytes.
902
+ *
903
+ * @returns the warning text.
904
+ */
905
+ declare function realContentHashDisabledMessage(): string;
781
906
  /**
782
907
  * Computes the `@source` target path for a CSS module: the location of the
783
908
  * generated safelist file relative to the CSS file, in posix form and always
@@ -807,8 +932,8 @@ declare function shouldTrackGlobalVarSources(config?: {
807
932
  enabled?: boolean;
808
933
  }): boolean;
809
934
  /**
810
- * Records source text available before bundling/minification for Phase H
811
- * global-var diagnostics.
935
+ * Records source text available before bundling/minification for global-var
936
+ * diagnostics.
812
937
  *
813
938
  * @param state Plugin state to update.
814
939
  * @param filename Source filename that owns the text.
@@ -816,7 +941,14 @@ declare function shouldTrackGlobalVarSources(config?: {
816
941
  */
817
942
  declare function recordGlobalVarSourceFile(state: Pick<PluginState, 'globalVarSourceFilesByFile'>, filename: string, code: string | null): void;
818
943
  /**
819
- * Extracts Phase H global custom-property aliases for manifest/debug tooling.
944
+ * Decides whether a module id is a stylesheet csszyx should rewrite.
945
+ *
946
+ * @param id Bundler module identifier.
947
+ * @returns True for a stylesheet whose text is destined for emitted CSS.
948
+ */
949
+ declare function isMangleableCssId(id: string): boolean;
950
+ /**
951
+ * Extracts global custom-property aliases for manifest/debug tooling.
820
952
  *
821
953
  * The legacy `varMangleMap` also carries dynamic s/c-tier CSS variables. This
822
954
  * helper keeps manifest consumers from guessing tiers by exposing only aliases
@@ -886,5 +1018,5 @@ declare const rollupPlugin: (options?: PartialCsszyxConfig) => InputPluginOption
886
1018
  */
887
1019
  declare const esbuildPlugin: (options?: PartialCsszyxConfig) => Plugin;
888
1020
 
889
- export { mangleEligibleClasses as $, cssImportsTailwind as A, unplugin as B, deleteRSCModuleRecord as D, emitMissingCssFallback as E, esbuildPlugin as F, extractGlobalVarAliasesForManifest as H, fileMayContainSafelistableSz as I, findLocalImportSources as J, findRSCBoundaryViolation as K, findRSCGraphViolation as L, hasInjectableTailwindCandidate as N, hasTokens as O, hasUseClientDirective as Q, hasUseServerDirective as T, isCompileSourceOptedIn as U, isHardIgnoredPath as W, isMonorepoPackage as X, isPackagesSkippedSource as Y, isRSCServerModule as Z, mangleCodeClassesSync as _, mangleHybridHazardMessage as a0, mergeThemes as a1, missingTailwindEntryMessage as a2, normalizeGlobalVarAliasesForCache as a3, parseThemeBlocks as a4, recordGlobalVarSourceFile as a5, resolveCompileSourceDirs as a6, resolveNativeCacheIdentity as a7, rollupPlugin as a8, scanCustomPropertyNames as a9, shouldEmitMissingCssFallback as aa, shouldEmitWarning as ab, shouldTrackGlobalVarSources as ac, shouldWarnMissingTailwindEntry as ad, shouldWarnUnscopedMonorepo as ae, skippedSzFilesMessage as af, unscopedMonorepoMessage as ag, vitePlugin as ah, webpackPlugin as ai, allocateMangleTokens as r, appendTailwindSourceDirective as s, assertNoRSCBoundaryViolation as t, assertNoRSCGraphViolation as u, collectMangleHybridHazards as v, computeSafelistRelPath as w, createGlobalVarMapAssetSource as x, createRSCModuleRecord as y, cssHasContentScope as z };
890
- 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 };
1021
+ export { isPackagesSkippedSource as $, cssImportsTailwind as A, unplugin as B, deleteRSCModuleRecord as D, emitMissingCssFallback as E, esbuildPlugin as F, extractGlobalVarAliasesForManifest as H, fileMayContainSafelistableSz as I, findLocalImportSources as J, findRSCBoundaryViolation as K, findRSCGraphViolation as L, hasInjectableTailwindCandidate as N, hasTokens as O, hasUseClientDirective as T, hasUseServerDirective as U, isAdvisoryDiagnostic as W, isCompileSourceOptedIn as X, isHardIgnoredPath as Y, isMangleableCssId as Z, isMonorepoPackage as _, isRSCServerModule as a0, lateMangleCensusMessage as a1, mangleCodeClassesSync as a2, mangleEligibleClasses as a3, mangleHybridHazardMessage as a4, mergeThemes as a5, missingTailwindEntryMessage as a6, normalizeGlobalVarAliasesForCache as a7, parseThemeBlocks as a8, realContentHashDisabledMessage as a9, recordGlobalVarSourceFile as aa, resolveCompileSourceDirs as ab, resolveNativeCacheIdentity as ac, resolveQuietMode as ad, rollupPlugin as ae, scanCustomPropertyNames as af, shouldEmitMissingCssFallback as ag, shouldEmitWarning as ah, shouldTrackGlobalVarSources as ai, shouldWarnMissingTailwindEntry as aj, shouldWarnUnscopedMonorepo as ak, skippedSzFilesMessage as al, suppressedAdvisoryMessage as am, unscopedMonorepoMessage as an, vitePlugin as ao, watchModeMangleMessage as ap, webpackPlugin as aq, allocateMangleTokens as r, appendTailwindSourceDirective as s, assertNoRSCBoundaryViolation as t, assertNoRSCGraphViolation as u, collectMangleHybridHazards as v, computeSafelistRelPath as w, createGlobalVarMapAssetSource as x, createRSCModuleRecord as y, cssHasContentScope as z };
1022
+ export type { CssVarScanResult as C, GlobalVarScanCacheKeyInput as G, MangleHybridHazards as M, PlanGlobalVarAliasesInput as P, QuietMode as Q, 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 };