@csszyx/unplugin 0.10.10 → 0.10.12

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.
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const cssMangler = require('./css-mangler.cjs');
6
- const unplugin = require('./shared/unplugin.Cq_8AIBn.cjs');
6
+ const unplugin = require('./shared/unplugin.CoiN0OSE.cjs');
7
7
  const types = require('@csszyx/types');
8
8
  require('postcss');
9
9
  require('postcss-selector-parser');
@@ -20,7 +20,7 @@ require('@csszyx/vue-adapter');
20
20
  require('unplugin');
21
21
  require('./shared/unplugin.BCwRIUs_.cjs');
22
22
  require('node:crypto');
23
- require('./shared/unplugin.pmTknYLy.cjs');
23
+ require('./shared/unplugin.D32Rb29j.cjs');
24
24
  require('postcss-value-parser');
25
25
 
26
26
 
@@ -66,6 +66,7 @@ exports.normalizeGlobalVarAliasesForCache = unplugin.normalizeGlobalVarAliasesFo
66
66
  exports.parseThemeBlocks = unplugin.parseThemeBlocks;
67
67
  exports.planGlobalVarAliases = unplugin.planGlobalVarAliases;
68
68
  exports.readGlobalVarScanCache = unplugin.readGlobalVarScanCache;
69
+ exports.recordGlobalVarSourceFile = unplugin.recordGlobalVarSourceFile;
69
70
  exports.resolveCompileSourceDirs = unplugin.resolveCompileSourceDirs;
70
71
  exports.resolveGlobalVarScanCacheDir = unplugin.resolveGlobalVarScanCacheDir;
71
72
  exports.resolveNativeCacheIdentity = unplugin.resolveNativeCacheIdentity;
@@ -73,6 +74,7 @@ exports.rewriteGlobalVarCssAliases = unplugin.rewriteGlobalVarCssAliases;
73
74
  exports.rollupPlugin = unplugin.rollupPlugin;
74
75
  exports.scanGlobalVarCss = unplugin.scanGlobalVarCss;
75
76
  exports.shouldEmitWarning = unplugin.shouldEmitWarning;
77
+ exports.shouldTrackGlobalVarSources = unplugin.shouldTrackGlobalVarSources;
76
78
  exports.shouldWarnMissingTailwindEntry = unplugin.shouldWarnMissingTailwindEntry;
77
79
  exports.shouldWarnUnscopedMonorepo = unplugin.shouldWarnUnscopedMonorepo;
78
80
  exports.skippedSzFilesMessage = unplugin.skippedSzFilesMessage;
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.CK6U5gAP.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.D3qsS8Pe.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 appendTailwindSourceDirective, p as collectMangleHybridHazards, q as computeSafelistRelPath, r as createGlobalVarMapAssetSource, s as cssHasContentScope, t as cssImportsTailwind, v as esbuildPlugin, w as extractGlobalVarAliasesForManifest, x as fileMayContainSafelistableSz, y as hasInjectableTailwindCandidate, z as isCompileSourceOptedIn, A as isHardIgnoredPath, B as isMonorepoPackage, D as isPackagesSkippedSource, E as mangleCodeClassesSync, F as mangleHybridHazardMessage, H as missingTailwindEntryMessage, I as normalizeGlobalVarAliasesForCache, J as resolveCompileSourceDirs, K as resolveNativeCacheIdentity, L as rollupPlugin, N as shouldEmitWarning, O as shouldWarnMissingTailwindEntry, Q as shouldWarnUnscopedMonorepo, T as skippedSzFilesMessage, u as unplugin, U as unscopedMonorepoMessage, W as vitePlugin, X as webpackPlugin } from './shared/unplugin.CK6U5gAP.cjs';
6
+ export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findRSCBoundaryViolation, I as findRSCGraphViolation, J as hasInjectableTailwindCandidate, K as hasTokens, L as hasUseClientDirective, N as hasUseServerDirective, O as isCompileSourceOptedIn, Q as isHardIgnoredPath, T as isMonorepoPackage, U as isPackagesSkippedSource, W as isRSCServerModule, X as mangleCodeClassesSync, Y as mangleHybridHazardMessage, Z as mergeThemes, _ as missingTailwindEntryMessage, $ as normalizeGlobalVarAliasesForCache, a0 as parseThemeBlocks, a1 as recordGlobalVarSourceFile, a2 as resolveCompileSourceDirs, a3 as resolveNativeCacheIdentity, a4 as rollupPlugin, a5 as shouldEmitWarning, a6 as shouldTrackGlobalVarSources, a7 as shouldWarnMissingTailwindEntry, a8 as shouldWarnUnscopedMonorepo, a9 as skippedSzFilesMessage, A as unplugin, aa as unscopedMonorepoMessage, ab as vitePlugin, ac as webpackPlugin } from './shared/unplugin.D3qsS8Pe.cjs';
7
7
  import 'postcss';
8
8
  import '@csszyx/compiler';
9
9
  import 'esbuild';
@@ -96,159 +96,4 @@ declare function validateGlobalVarAliasInputs(options: ValidateGlobalVarAliasInp
96
96
  */
97
97
  declare function createGlobalVarAliasValidationOptions(input: CreateGlobalVarAliasValidationOptionsInput): ValidateGlobalVarAliasInputsOptions;
98
98
 
99
- /**
100
- * Direct RSC boundary violation found in a transformed module.
101
- */
102
- interface RSCBoundaryViolation {
103
- /** Forbidden runtime helper that crossed into an RSC server module. */
104
- symbol: string;
105
- /** Server module path where the import was found. */
106
- path: string;
107
- /** Import chain used in the fatal build error. */
108
- importChain: string[];
109
- }
110
- /**
111
- * RSC module metadata collected during the transform phase.
112
- */
113
- interface RSCModuleRecord {
114
- /** Normalized absolute module ID. */
115
- id: string;
116
- /** True when this module is an RSC server module entry or has `'use server'`. */
117
- isServer: boolean;
118
- /** True when this module declares the client boundary. */
119
- isClient: boolean;
120
- /** Local modules imported by this file after path resolution. */
121
- imports: string[];
122
- /** Forbidden runtime imports found directly in this module. */
123
- runtimeImports: Array<{
124
- source: string;
125
- symbols: string[];
126
- }>;
127
- }
128
- /**
129
- * Returns true when a module starts with the top-level `'use server'`
130
- * directive. Comments and blank lines before the directive are allowed, but
131
- * detection stops at the first real statement.
132
- *
133
- * @param code module source
134
- * @returns true when the module has a top-level `'use server'` directive
135
- */
136
- declare function hasUseServerDirective(code: string): boolean;
137
- /**
138
- * Returns true when a module starts with the top-level `'use client'`
139
- * directive.
140
- *
141
- * @param code module source
142
- * @returns true when the module has a top-level `'use client'` directive
143
- */
144
- declare function hasUseClientDirective(code: string): boolean;
145
- /**
146
- * Detects modules that should be treated as RSC server modules by csszyx.
147
- *
148
- * @param code module source
149
- * @param id module ID/path
150
- * @returns true when the module is server-side for RSC boundary purposes
151
- */
152
- declare function isRSCServerModule(code: string, id: string): boolean;
153
- /**
154
- * Finds the first direct forbidden runtime helper import in an RSC server
155
- * module.
156
- *
157
- * @param code module source
158
- * @param id module ID/path
159
- * @returns violation details, or null when the module is allowed
160
- */
161
- declare function findRSCBoundaryViolation(code: string, id: string): RSCBoundaryViolation | null;
162
- /**
163
- * Builds module metadata for the RSC graph walker.
164
- *
165
- * @param code module source
166
- * @param id module ID/path
167
- * @returns graph metadata for the module
168
- */
169
- declare function createRSCModuleRecord(code: string, id: string): RSCModuleRecord;
170
- /**
171
- * Removes a module record after the bundler watcher reports that the file was
172
- * deleted.
173
- *
174
- * @param records module graph records keyed by normalized module ID
175
- * @param id module ID/path from the watcher event
176
- * @returns true when a stale record was removed
177
- */
178
- declare function deleteRSCModuleRecord(records: Map<string, RSCModuleRecord>, id: string): boolean;
179
- /**
180
- * Finds forbidden runtime helper imports reachable from an RSC server module.
181
- * Traversal stops at `'use client'` modules because they define a separate
182
- * client module graph.
183
- *
184
- * @param records module graph records keyed by normalized module ID
185
- * @returns first graph violation, or null when the graph is allowed
186
- */
187
- declare function findRSCGraphViolation(records: Map<string, RSCModuleRecord>): RSCBoundaryViolation | null;
188
- /**
189
- * Throws the spec-format fatal RSC boundary error for graph-level violations.
190
- *
191
- * @param records module graph records keyed by normalized module ID
192
- */
193
- declare function assertNoRSCGraphViolation(records: Map<string, RSCModuleRecord>): void;
194
- /**
195
- * Throws the spec-format fatal RSC boundary error when a server module imports
196
- * a forbidden csszyx runtime helper.
197
- *
198
- * @param code module source
199
- * @param id module ID/path
200
- */
201
- declare function assertNoRSCBoundaryViolation(code: string, id: string): void;
202
-
203
- /**
204
- * Theme Scanner — parses Tailwind v4 @theme blocks from CSS files.
205
- *
206
- * Extracts custom design tokens and categorizes them by type so the
207
- * type writer can generate accurate TypeScript augmentation.
208
- *
209
- * Supports:
210
- * - Multiple @theme blocks per file
211
- * - @theme inline { } syntax (inline keyword ignored)
212
- * - @theme inside @layer (two-pass strip)
213
- * - --color-brand-50 shade suffixes (deduped to 'brand')
214
- * - Multi-file merge via mergeThemes()
215
- */
216
- /** Extracted and categorized custom tokens from @theme blocks. */
217
- interface ParsedTheme {
218
- /** Custom color names (from --color-*): e.g. ['brand', 'brand-dark'] */
219
- colors: string[];
220
- /** Custom spacing tokens (from --spacing-*): e.g. ['xl', '2xs'] */
221
- spacings: string[];
222
- /** Custom font families (from --font-*): e.g. ['display', 'body'] */
223
- fonts: string[];
224
- /** Custom border radii (from --radius-*): e.g. ['button'] */
225
- radii: string[];
226
- /** Custom shadows (from --shadow-*): e.g. ['card'] */
227
- shadows: string[];
228
- /** Custom responsive breakpoints (from --breakpoint-*): e.g. ['tablet', '3xl'] */
229
- breakpoints: string[];
230
- }
231
- /**
232
- * Parse all @theme blocks in a CSS file and extract design tokens.
233
- *
234
- * @param cssContent - Raw CSS file content
235
- * @returns Categorized design tokens
236
- */
237
- declare function parseThemeBlocks(cssContent: string): ParsedTheme;
238
- /**
239
- * Merge multiple ParsedTheme objects into one, deduplicating tokens.
240
- *
241
- * @param themes - Array of parsed themes to merge
242
- * @returns Merged theme with unique tokens per category
243
- */
244
- declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
245
- /**
246
- * Check if a ParsedTheme has any tokens.
247
- *
248
- * @param theme - Parsed theme to check
249
- * @returns True if at least one category has tokens
250
- */
251
- declare function hasTokens(theme: ParsedTheme): boolean;
252
-
253
- export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, isTailwindReservedGlobalVar, mergeThemes, parseThemeBlocks, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
254
- export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
99
+ export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, isTailwindReservedGlobalVar, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
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.CK6U5gAP.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 appendTailwindSourceDirective, p as collectMangleHybridHazards, q as computeSafelistRelPath, r as createGlobalVarMapAssetSource, s as cssHasContentScope, t as cssImportsTailwind, u as default, v as esbuildPlugin, w as extractGlobalVarAliasesForManifest, x as fileMayContainSafelistableSz, y as hasInjectableTailwindCandidate, z as isCompileSourceOptedIn, A as isHardIgnoredPath, B as isMonorepoPackage, D as isPackagesSkippedSource, E as mangleCodeClassesSync, F as mangleHybridHazardMessage, H as missingTailwindEntryMessage, I as normalizeGlobalVarAliasesForCache, J as resolveCompileSourceDirs, K as resolveNativeCacheIdentity, L as rollupPlugin, N as shouldEmitWarning, O as shouldWarnMissingTailwindEntry, Q as shouldWarnUnscopedMonorepo, T as skippedSzFilesMessage, u as unplugin, U as unscopedMonorepoMessage, W as vitePlugin, X as webpackPlugin } from './shared/unplugin.CK6U5gAP.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.D3qsS8Pe.mjs';
4
+ export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, A as default, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findRSCBoundaryViolation, I as findRSCGraphViolation, J as hasInjectableTailwindCandidate, K as hasTokens, L as hasUseClientDirective, N as hasUseServerDirective, O as isCompileSourceOptedIn, Q as isHardIgnoredPath, T as isMonorepoPackage, U as isPackagesSkippedSource, W as isRSCServerModule, X as mangleCodeClassesSync, Y as mangleHybridHazardMessage, Z as mergeThemes, _ as missingTailwindEntryMessage, $ as normalizeGlobalVarAliasesForCache, a0 as parseThemeBlocks, a1 as recordGlobalVarSourceFile, a2 as resolveCompileSourceDirs, a3 as resolveNativeCacheIdentity, a4 as rollupPlugin, a5 as shouldEmitWarning, a6 as shouldTrackGlobalVarSources, a7 as shouldWarnMissingTailwindEntry, a8 as shouldWarnUnscopedMonorepo, a9 as skippedSzFilesMessage, A as unplugin, aa as unscopedMonorepoMessage, ab as vitePlugin, ac as webpackPlugin } from './shared/unplugin.D3qsS8Pe.mjs';
5
5
  import 'postcss';
6
6
  import '@csszyx/compiler';
7
7
  import 'esbuild';
@@ -94,159 +94,4 @@ declare function validateGlobalVarAliasInputs(options: ValidateGlobalVarAliasInp
94
94
  */
95
95
  declare function createGlobalVarAliasValidationOptions(input: CreateGlobalVarAliasValidationOptionsInput): ValidateGlobalVarAliasInputsOptions;
96
96
 
97
- /**
98
- * Direct RSC boundary violation found in a transformed module.
99
- */
100
- interface RSCBoundaryViolation {
101
- /** Forbidden runtime helper that crossed into an RSC server module. */
102
- symbol: string;
103
- /** Server module path where the import was found. */
104
- path: string;
105
- /** Import chain used in the fatal build error. */
106
- importChain: string[];
107
- }
108
- /**
109
- * RSC module metadata collected during the transform phase.
110
- */
111
- interface RSCModuleRecord {
112
- /** Normalized absolute module ID. */
113
- id: string;
114
- /** True when this module is an RSC server module entry or has `'use server'`. */
115
- isServer: boolean;
116
- /** True when this module declares the client boundary. */
117
- isClient: boolean;
118
- /** Local modules imported by this file after path resolution. */
119
- imports: string[];
120
- /** Forbidden runtime imports found directly in this module. */
121
- runtimeImports: Array<{
122
- source: string;
123
- symbols: string[];
124
- }>;
125
- }
126
- /**
127
- * Returns true when a module starts with the top-level `'use server'`
128
- * directive. Comments and blank lines before the directive are allowed, but
129
- * detection stops at the first real statement.
130
- *
131
- * @param code module source
132
- * @returns true when the module has a top-level `'use server'` directive
133
- */
134
- declare function hasUseServerDirective(code: string): boolean;
135
- /**
136
- * Returns true when a module starts with the top-level `'use client'`
137
- * directive.
138
- *
139
- * @param code module source
140
- * @returns true when the module has a top-level `'use client'` directive
141
- */
142
- declare function hasUseClientDirective(code: string): boolean;
143
- /**
144
- * Detects modules that should be treated as RSC server modules by csszyx.
145
- *
146
- * @param code module source
147
- * @param id module ID/path
148
- * @returns true when the module is server-side for RSC boundary purposes
149
- */
150
- declare function isRSCServerModule(code: string, id: string): boolean;
151
- /**
152
- * Finds the first direct forbidden runtime helper import in an RSC server
153
- * module.
154
- *
155
- * @param code module source
156
- * @param id module ID/path
157
- * @returns violation details, or null when the module is allowed
158
- */
159
- declare function findRSCBoundaryViolation(code: string, id: string): RSCBoundaryViolation | null;
160
- /**
161
- * Builds module metadata for the RSC graph walker.
162
- *
163
- * @param code module source
164
- * @param id module ID/path
165
- * @returns graph metadata for the module
166
- */
167
- declare function createRSCModuleRecord(code: string, id: string): RSCModuleRecord;
168
- /**
169
- * Removes a module record after the bundler watcher reports that the file was
170
- * deleted.
171
- *
172
- * @param records module graph records keyed by normalized module ID
173
- * @param id module ID/path from the watcher event
174
- * @returns true when a stale record was removed
175
- */
176
- declare function deleteRSCModuleRecord(records: Map<string, RSCModuleRecord>, id: string): boolean;
177
- /**
178
- * Finds forbidden runtime helper imports reachable from an RSC server module.
179
- * Traversal stops at `'use client'` modules because they define a separate
180
- * client module graph.
181
- *
182
- * @param records module graph records keyed by normalized module ID
183
- * @returns first graph violation, or null when the graph is allowed
184
- */
185
- declare function findRSCGraphViolation(records: Map<string, RSCModuleRecord>): RSCBoundaryViolation | null;
186
- /**
187
- * Throws the spec-format fatal RSC boundary error for graph-level violations.
188
- *
189
- * @param records module graph records keyed by normalized module ID
190
- */
191
- declare function assertNoRSCGraphViolation(records: Map<string, RSCModuleRecord>): void;
192
- /**
193
- * Throws the spec-format fatal RSC boundary error when a server module imports
194
- * a forbidden csszyx runtime helper.
195
- *
196
- * @param code module source
197
- * @param id module ID/path
198
- */
199
- declare function assertNoRSCBoundaryViolation(code: string, id: string): void;
200
-
201
- /**
202
- * Theme Scanner — parses Tailwind v4 @theme blocks from CSS files.
203
- *
204
- * Extracts custom design tokens and categorizes them by type so the
205
- * type writer can generate accurate TypeScript augmentation.
206
- *
207
- * Supports:
208
- * - Multiple @theme blocks per file
209
- * - @theme inline { } syntax (inline keyword ignored)
210
- * - @theme inside @layer (two-pass strip)
211
- * - --color-brand-50 shade suffixes (deduped to 'brand')
212
- * - Multi-file merge via mergeThemes()
213
- */
214
- /** Extracted and categorized custom tokens from @theme blocks. */
215
- interface ParsedTheme {
216
- /** Custom color names (from --color-*): e.g. ['brand', 'brand-dark'] */
217
- colors: string[];
218
- /** Custom spacing tokens (from --spacing-*): e.g. ['xl', '2xs'] */
219
- spacings: string[];
220
- /** Custom font families (from --font-*): e.g. ['display', 'body'] */
221
- fonts: string[];
222
- /** Custom border radii (from --radius-*): e.g. ['button'] */
223
- radii: string[];
224
- /** Custom shadows (from --shadow-*): e.g. ['card'] */
225
- shadows: string[];
226
- /** Custom responsive breakpoints (from --breakpoint-*): e.g. ['tablet', '3xl'] */
227
- breakpoints: string[];
228
- }
229
- /**
230
- * Parse all @theme blocks in a CSS file and extract design tokens.
231
- *
232
- * @param cssContent - Raw CSS file content
233
- * @returns Categorized design tokens
234
- */
235
- declare function parseThemeBlocks(cssContent: string): ParsedTheme;
236
- /**
237
- * Merge multiple ParsedTheme objects into one, deduplicating tokens.
238
- *
239
- * @param themes - Array of parsed themes to merge
240
- * @returns Merged theme with unique tokens per category
241
- */
242
- declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
243
- /**
244
- * Check if a ParsedTheme has any tokens.
245
- *
246
- * @param theme - Parsed theme to check
247
- * @returns True if at least one category has tokens
248
- */
249
- declare function hasTokens(theme: ParsedTheme): boolean;
250
-
251
- export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, isTailwindReservedGlobalVar, mergeThemes, parseThemeBlocks, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
252
- export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
97
+ export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, isTailwindReservedGlobalVar, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as computeSafelistRelPath, f as createGlobalVarAliasValidationOptions, g as createGlobalVarMapAssetSource, h as createGlobalVarScanCacheKey, i as createRSCModuleRecord, j as cssHasContentScope, k as cssImportsTailwind, u as default, l as deleteRSCModuleRecord, m as esbuildPlugin, n as extractGlobalVarAliasesForManifest, o as fileMayContainSafelistableSz, p as findRSCBoundaryViolation, q as findRSCGraphViolation, r as hasInjectableTailwindCandidate, s as hasTokens, t as hasUseClientDirective, v as hasUseServerDirective, w as isCompileSourceOptedIn, x as isHardIgnoredPath, y as isMonorepoPackage, z as isPackagesSkippedSource, A as isRSCServerModule, B as isTailwindReservedGlobalVar, C as mangleCodeClassesSync, D as mangleHybridHazardMessage, E as mergeThemes, F as missingTailwindEntryMessage, G as normalizeGlobalVarAliasesForCache, H as parseThemeBlocks, I as planGlobalVarAliases, J as readGlobalVarScanCache, K as resolveCompileSourceDirs, L as resolveGlobalVarScanCacheDir, M as resolveNativeCacheIdentity, N as rewriteGlobalVarCssAliases, O as rollupPlugin, P as scanGlobalVarCss, Q as shouldEmitWarning, R as shouldWarnMissingTailwindEntry, S as shouldWarnUnscopedMonorepo, T as skippedSzFilesMessage, u as unplugin, U as unscopedMonorepoMessage, V as validateGlobalVarAliasInputs, W as vitePlugin, X as webpackPlugin, Y as writeGlobalVarScanCache } from './shared/unplugin.Ble541_h.mjs';
2
+ export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as computeSafelistRelPath, f as createGlobalVarAliasValidationOptions, g as createGlobalVarMapAssetSource, h as createGlobalVarScanCacheKey, i as createRSCModuleRecord, j as cssHasContentScope, k as cssImportsTailwind, u as default, l as deleteRSCModuleRecord, m as esbuildPlugin, n as extractGlobalVarAliasesForManifest, o as fileMayContainSafelistableSz, p as findRSCBoundaryViolation, q as findRSCGraphViolation, r as hasInjectableTailwindCandidate, s as hasTokens, t as hasUseClientDirective, v as hasUseServerDirective, w as isCompileSourceOptedIn, x as isHardIgnoredPath, y as isMonorepoPackage, z as isPackagesSkippedSource, A as isRSCServerModule, B as isTailwindReservedGlobalVar, C as mangleCodeClassesSync, D as mangleHybridHazardMessage, E as mergeThemes, F as missingTailwindEntryMessage, G as normalizeGlobalVarAliasesForCache, H as parseThemeBlocks, I as planGlobalVarAliases, J as readGlobalVarScanCache, K as recordGlobalVarSourceFile, L as resolveCompileSourceDirs, M as resolveGlobalVarScanCacheDir, N as resolveNativeCacheIdentity, O as rewriteGlobalVarCssAliases, P as rollupPlugin, Q as scanGlobalVarCss, R as shouldEmitWarning, S as shouldTrackGlobalVarSources, T as shouldWarnMissingTailwindEntry, U as shouldWarnUnscopedMonorepo, V as skippedSzFilesMessage, u as unplugin, W as unscopedMonorepoMessage, X as validateGlobalVarAliasInputs, Y as vitePlugin, Z as webpackPlugin, _ as writeGlobalVarScanCache } from './shared/unplugin.DO7Y2Y-X.mjs';
3
3
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
4
4
  import 'postcss';
5
5
  import 'postcss-selector-parser';
@@ -16,5 +16,5 @@ import '@csszyx/vue-adapter';
16
16
  import 'unplugin';
17
17
  import './shared/unplugin.B1mblcm-.mjs';
18
18
  import 'node:crypto';
19
- import './shared/unplugin.BpWUtI9U.mjs';
19
+ import './shared/unplugin.CGqFVGlB.mjs';
20
20
  import 'postcss-value-parser';
@@ -3,9 +3,9 @@
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.BImj9Vcx.cjs');
6
+ const nextTransformMetadata = require('./shared/unplugin.Bh2aAL4a.cjs');
7
7
  const nextWatcherCycle = require('./shared/unplugin.BFN_Ueyx.cjs');
8
- const transformCache = require('./shared/unplugin.pmTknYLy.cjs');
8
+ const transformCache = require('./shared/unplugin.D32Rb29j.cjs');
9
9
  require('@csszyx/compiler');
10
10
  require('./shared/unplugin.BCwRIUs_.cjs');
11
11
  require('node:os');
@@ -1,9 +1,9 @@
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.uLmLkr10.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.B45ZkNXD.mjs';
5
5
  import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.ChwZMl_w.mjs';
6
- import { r as resolveTransformCacheDir } from './shared/unplugin.BpWUtI9U.mjs';
6
+ import { r as resolveTransformCacheDir } from './shared/unplugin.CGqFVGlB.mjs';
7
7
  import '@csszyx/compiler';
8
8
  import './shared/unplugin.B1mblcm-.mjs';
9
9
  import 'node:os';
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const node_crypto = require('node:crypto');
6
6
  const path = require('node:path');
7
7
  const nextWatcherCycle = require('./shared/unplugin.BFN_Ueyx.cjs');
8
- const nextTransformMetadata = require('./shared/unplugin.BImj9Vcx.cjs');
9
- const transformCache = require('./shared/unplugin.pmTknYLy.cjs');
8
+ const nextTransformMetadata = require('./shared/unplugin.Bh2aAL4a.cjs');
9
+ const transformCache = require('./shared/unplugin.D32Rb29j.cjs');
10
10
  require('node:fs');
11
11
  require('node:os');
12
12
  require('proper-lockfile');
@@ -1,8 +1,8 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import * as path from 'node:path';
3
3
  import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle, v as validateNextGenerationManifest, a as readNextGenerationManifest } from './shared/unplugin.ChwZMl_w.mjs';
4
- import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.uLmLkr10.mjs';
5
- import { r as resolveTransformCacheDir } from './shared/unplugin.BpWUtI9U.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.B45ZkNXD.mjs';
5
+ import { r as resolveTransformCacheDir } from './shared/unplugin.CGqFVGlB.mjs';
6
6
  import 'node:fs';
7
7
  import 'node:os';
8
8
  import 'proper-lockfile';
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { ensureRustTransformAvailable, transformSourceCode, transformRust, transformOxc, transform } from '@csszyx/compiler';
3
- import { c as createTransformCacheKey, a as readTransformCache, w as writeTransformCache } from './unplugin.BpWUtI9U.mjs';
3
+ import { c as createTransformCacheKey, a as readTransformCache, w as writeTransformCache } from './unplugin.CGqFVGlB.mjs';
4
4
  import { createHash } from 'node:crypto';
5
5
  import { s as sortStrings } from './unplugin.B1mblcm-.mjs';
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fs = require('node:fs');
4
4
  const compiler = require('@csszyx/compiler');
5
- const transformCache = require('./unplugin.pmTknYLy.cjs');
5
+ const transformCache = require('./unplugin.D32Rb29j.cjs');
6
6
  const node_crypto = require('node:crypto');
7
7
  const htmlEscape = require('./unplugin.BCwRIUs_.cjs');
8
8
 
@@ -182,5 +182,18 @@ function listJsonFiles(dir) {
182
182
  }
183
183
  return files;
184
184
  }
185
+ function evictMemoryCacheToBudget(cache, totalCodeChars, maxEntries, maxCodeChars) {
186
+ let total = totalCodeChars;
187
+ while (cache.size > maxEntries || total > maxCodeChars && cache.size > 1) {
188
+ const oldest = cache.keys().next().value;
189
+ if (oldest === void 0) {
190
+ break;
191
+ }
192
+ const evicted = cache.get(oldest);
193
+ cache.delete(oldest);
194
+ total -= evicted?.code.length ?? 0;
195
+ }
196
+ return total;
197
+ }
185
198
 
186
- export { readTransformCache as a, createTransformCacheKey as c, evictOldTransformCacheEntries as e, resolveTransformCacheDir as r, writeTransformCache as w };
199
+ export { readTransformCache as a, evictMemoryCacheToBudget as b, createTransformCacheKey as c, evictOldTransformCacheEntries as e, resolveTransformCacheDir as r, writeTransformCache as w };