@csszyx/unplugin 0.10.6 → 0.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.CjxItfV1.cjs');
6
+ const unplugin = require('./shared/unplugin.DlGyBb8o.cjs');
7
7
  const types = require('@csszyx/types');
8
8
  require('postcss');
9
9
  require('postcss-selector-parser');
@@ -33,6 +33,7 @@ exports.unescapeTailwindClass = cssMangler.unescapeTailwindClass;
33
33
  exports.appendTailwindSourceDirective = unplugin.appendTailwindSourceDirective;
34
34
  exports.assertNoRSCBoundaryViolation = unplugin.assertNoRSCBoundaryViolation;
35
35
  exports.assertNoRSCGraphViolation = unplugin.assertNoRSCGraphViolation;
36
+ exports.collectMangleHybridHazards = unplugin.collectMangleHybridHazards;
36
37
  exports.computeSafelistRelPath = unplugin.computeSafelistRelPath;
37
38
  exports.createGlobalVarAliasValidationOptions = unplugin.createGlobalVarAliasValidationOptions;
38
39
  exports.createGlobalVarMapAssetSource = unplugin.createGlobalVarMapAssetSource;
@@ -58,6 +59,7 @@ exports.isPackagesSkippedSource = unplugin.isPackagesSkippedSource;
58
59
  exports.isRSCServerModule = unplugin.isRSCServerModule;
59
60
  exports.isTailwindReservedGlobalVar = unplugin.isTailwindReservedGlobalVar;
60
61
  exports.mangleCodeClassesSync = unplugin.mangleCodeClassesSync;
62
+ exports.mangleHybridHazardMessage = unplugin.mangleHybridHazardMessage;
61
63
  exports.mergeThemes = unplugin.mergeThemes;
62
64
  exports.missingTailwindEntryMessage = unplugin.missingTailwindEntryMessage;
63
65
  exports.normalizeGlobalVarAliasesForCache = unplugin.normalizeGlobalVarAliasesForCache;
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.DzA2Mwc7.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.CK6U5gAP.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, o as appendTailwindSourceDirective, p as computeSafelistRelPath, q as createGlobalVarMapAssetSource, r as cssHasContentScope, s as cssImportsTailwind, t as esbuildPlugin, v as extractGlobalVarAliasesForManifest, w as fileMayContainSafelistableSz, x as hasInjectableTailwindCandidate, y as isCompileSourceOptedIn, z as isHardIgnoredPath, A as isMonorepoPackage, B as isPackagesSkippedSource, D as mangleCodeClassesSync, E as missingTailwindEntryMessage, F as normalizeGlobalVarAliasesForCache, H as resolveCompileSourceDirs, I as resolveNativeCacheIdentity, J as rollupPlugin, K as shouldEmitWarning, L as shouldWarnMissingTailwindEntry, M as shouldWarnUnscopedMonorepo, N as skippedSzFilesMessage, u as unplugin, O as unscopedMonorepoMessage, Q as vitePlugin, T as webpackPlugin } from './shared/unplugin.DzA2Mwc7.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 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';
7
7
  import 'postcss';
8
8
  import '@csszyx/compiler';
9
9
  import 'esbuild';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
2
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
3
- import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.DzA2Mwc7.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, o as appendTailwindSourceDirective, p as computeSafelistRelPath, q as createGlobalVarMapAssetSource, r as cssHasContentScope, s as cssImportsTailwind, u as default, t as esbuildPlugin, v as extractGlobalVarAliasesForManifest, w as fileMayContainSafelistableSz, x as hasInjectableTailwindCandidate, y as isCompileSourceOptedIn, z as isHardIgnoredPath, A as isMonorepoPackage, B as isPackagesSkippedSource, D as mangleCodeClassesSync, E as missingTailwindEntryMessage, F as normalizeGlobalVarAliasesForCache, H as resolveCompileSourceDirs, I as resolveNativeCacheIdentity, J as rollupPlugin, K as shouldEmitWarning, L as shouldWarnMissingTailwindEntry, M as shouldWarnUnscopedMonorepo, N as skippedSzFilesMessage, u as unplugin, O as unscopedMonorepoMessage, Q as vitePlugin, T as webpackPlugin } from './shared/unplugin.DzA2Mwc7.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.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';
5
5
  import 'postcss';
6
6
  import '@csszyx/compiler';
7
7
  import 'esbuild';
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as computeSafelistRelPath, e as createGlobalVarAliasValidationOptions, f as createGlobalVarMapAssetSource, g as createGlobalVarScanCacheKey, h as createRSCModuleRecord, i as cssHasContentScope, j as cssImportsTailwind, u as default, k as deleteRSCModuleRecord, l as esbuildPlugin, m as extractGlobalVarAliasesForManifest, n as fileMayContainSafelistableSz, o as findRSCBoundaryViolation, p as findRSCGraphViolation, q as hasInjectableTailwindCandidate, r as hasTokens, s as hasUseClientDirective, t as hasUseServerDirective, v as isCompileSourceOptedIn, w as isHardIgnoredPath, x as isMonorepoPackage, y as isPackagesSkippedSource, z as isRSCServerModule, A as isTailwindReservedGlobalVar, B as mangleCodeClassesSync, C as mergeThemes, D as missingTailwindEntryMessage, E as normalizeGlobalVarAliasesForCache, F as parseThemeBlocks, G as planGlobalVarAliases, H as readGlobalVarScanCache, I as resolveCompileSourceDirs, J as resolveGlobalVarScanCacheDir, K as resolveNativeCacheIdentity, L as rewriteGlobalVarCssAliases, M as rollupPlugin, N as scanGlobalVarCss, O as shouldEmitWarning, P as shouldWarnMissingTailwindEntry, Q as shouldWarnUnscopedMonorepo, R as skippedSzFilesMessage, u as unplugin, S as unscopedMonorepoMessage, T as validateGlobalVarAliasInputs, U as vitePlugin, V as webpackPlugin, W as writeGlobalVarScanCache } from './shared/unplugin.CDjxWs9r.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.mdW7U-K4.mjs';
3
3
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
4
4
  import 'postcss';
5
5
  import 'postcss-selector-parser';
@@ -3,7 +3,7 @@
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.DWtXPCGo.cjs');
6
+ const nextTransformMetadata = require('./shared/unplugin.C3H4KqpP.cjs');
7
7
  const nextWatcherCycle = require('./shared/unplugin.Cwe-dz1f.cjs');
8
8
  const transformCache = require('./shared/unplugin.pmTknYLy.cjs');
9
9
  require('@csszyx/compiler');
@@ -1,7 +1,7 @@
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.C1N5i6Eg.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.D2_Q3rOU.mjs';
5
5
  import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.CLjhn81z.mjs';
6
6
  import { r as resolveTransformCacheDir } from './shared/unplugin.BpWUtI9U.mjs';
7
7
  import '@csszyx/compiler';
@@ -5,7 +5,7 @@ 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.Cwe-dz1f.cjs');
8
- const nextTransformMetadata = require('./shared/unplugin.DWtXPCGo.cjs');
8
+ const nextTransformMetadata = require('./shared/unplugin.C3H4KqpP.cjs');
9
9
  const transformCache = require('./shared/unplugin.pmTknYLy.cjs');
10
10
  require('node:fs');
11
11
  require('node:os');
@@ -30,9 +30,9 @@ const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
30
30
 
31
31
  const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
32
32
  const RUNTIME_HELPER_IMPORT_RE = {
33
- _sz: /\{[^}]*\b_sz\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
34
- _szMerge: /\{[^}]*\b_szMerge\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
35
- __szColorVar: /\{[^}]*\b__szColorVar\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
33
+ _sz: /(?:import|export)\s+\{[^{}]*\b_sz\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
34
+ _szMerge: /(?:import|export)\s+\{[^{}]*\b_szMerge\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
35
+ __szColorVar: /(?:import|export)\s+\{[^{}]*\b__szColorVar\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
36
36
  };
37
37
  function injectNextRuntimeImports(code, usage) {
38
38
  const helpers = runtimeHelpersFromUsage(usage);
@@ -1,7 +1,7 @@
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.CLjhn81z.mjs';
4
- import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.C1N5i6Eg.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.D2_Q3rOU.mjs';
5
5
  import { r as resolveTransformCacheDir } from './shared/unplugin.BpWUtI9U.mjs';
6
6
  import 'node:fs';
7
7
  import 'node:os';
@@ -11,9 +11,9 @@ import '@csszyx/compiler';
11
11
 
12
12
  const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
13
13
  const RUNTIME_HELPER_IMPORT_RE = {
14
- _sz: /\{[^}]*\b_sz\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
15
- _szMerge: /\{[^}]*\b_szMerge\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
16
- __szColorVar: /\{[^}]*\b__szColorVar\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
14
+ _sz: /(?:import|export)\s+\{[^{}]*\b_sz\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
15
+ _szMerge: /(?:import|export)\s+\{[^{}]*\b_szMerge\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
16
+ __szColorVar: /(?:import|export)\s+\{[^{}]*\b__szColorVar\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
17
17
  };
18
18
  function injectNextRuntimeImports(code, usage) {
19
19
  const helpers = runtimeHelpersFromUsage(usage);
@@ -234,7 +234,7 @@ function collectRuntimeStaticClasses(result, discoveredClasses) {
234
234
  }
235
235
  }
236
236
  function collectRuntimeStringClasses(objectSource, discoveredClasses) {
237
- const stringKeyValue = /(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
237
+ const stringKeyValue = /\b(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
238
238
  for (const match of objectSource.matchAll(stringKeyValue)) {
239
239
  try {
240
240
  collectTransformClasses(
@@ -246,7 +246,7 @@ function collectRuntimeStringClasses(objectSource, discoveredClasses) {
246
246
  }
247
247
  }
248
248
  function collectRuntimeNumberClasses(objectSource, discoveredClasses) {
249
- const numberKeyValue = /(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
249
+ const numberKeyValue = /\b(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
250
250
  for (const match of objectSource.matchAll(numberKeyValue)) {
251
251
  try {
252
252
  collectTransformClasses(
@@ -258,7 +258,7 @@ function collectRuntimeNumberClasses(objectSource, discoveredClasses) {
258
258
  }
259
259
  }
260
260
  function collectRuntimeBooleanClasses(objectSource, discoveredClasses) {
261
- const booleanKeyValue = /(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
261
+ const booleanKeyValue = /\b(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
262
262
  for (const match of objectSource.matchAll(booleanKeyValue)) {
263
263
  try {
264
264
  collectTransformClasses(
@@ -271,15 +271,56 @@ declare function hasInjectableTailwindCandidate(classes: Iterable<string>): bool
271
271
  *
272
272
  * @param ownedClassCount - number of csszyx-generated classes this build produced.
273
273
  * @param sawTailwindEntry - whether any processed CSS imported tailwindcss.
274
+ * @param sawAnyCss - whether ANY CSS file passed through the transform hook. When
275
+ * false, csszyx never observed the CSS pipeline (e.g. `astro check`, an early
276
+ * Astro build phase, or CSS handled outside this hook) and cannot conclude the
277
+ * entry is missing — so it stays silent rather than false-positive on a build
278
+ * that does emit valid CSS.
274
279
  * @returns true when the missing-entry warning should fire.
275
280
  */
276
- declare function shouldWarnMissingTailwindEntry(ownedClassCount: number, sawTailwindEntry: boolean): boolean;
281
+ declare function shouldWarnMissingTailwindEntry(ownedClassCount: number, sawTailwindEntry: boolean, sawAnyCss: boolean): boolean;
277
282
  /**
278
283
  * Build the missing-Tailwind-entry warning message.
279
284
  * @param ownedClassCount - number of csszyx-generated classes this build produced.
280
285
  * @returns the warning string.
281
286
  */
282
287
  declare function missingTailwindEntryMessage(ownedClassCount: number): string;
288
+ /**
289
+ * Hazards that make production mangling unsafe in a hybrid build (a separate
290
+ * Tailwind plugin owns the utility CSS and/or hand-written CSS uses literal class
291
+ * names). Computed from data `mangleCSSSync` already returns across every CSS
292
+ * asset, so it is free to surface.
293
+ */
294
+ interface MangleHybridHazards {
295
+ /**
296
+ * Mangled tokens that ALSO appear as a class name in non-csszyx CSS. The
297
+ * short token (e.g. `y` for `w-full`) then matches external `.y` elements and
298
+ * cross-contaminates their styles — the core hybrid-mangle failure.
299
+ */
300
+ collisions: string[];
301
+ /**
302
+ * Map sources csszyx mangled but whose class never appeared in any emitted
303
+ * CSS (e.g. a utility Tailwind never generated, or a malformed key). Their
304
+ * DOM class is rewritten to a token with no rule → the element loses styling.
305
+ */
306
+ orphans: string[];
307
+ }
308
+ /**
309
+ * Detect hybrid-mangle hazards from the accumulated per-asset mangle results.
310
+ *
311
+ * @param mangleMap - the full original→token map injected into the runtime.
312
+ * @param mangledSources - map keys that were actually found and renamed in some CSS asset.
313
+ * @param externalClasses - class names found in CSS that are NOT in the mangle map (non-csszyx).
314
+ * @returns the colliding tokens and orphan sources (each sorted, deduped).
315
+ */
316
+ declare function collectMangleHybridHazards(mangleMap: Record<string, string>, mangledSources: ReadonlySet<string>, externalClasses: ReadonlySet<string>): MangleHybridHazards;
317
+ /**
318
+ * Build the hybrid-mangle hazard warning, or null when there is nothing to warn.
319
+ *
320
+ * @param hazards - the detected collisions and orphans.
321
+ * @returns a warning string, or null when both lists are empty.
322
+ */
323
+ declare function mangleHybridHazardMessage(hazards: MangleHybridHazards): string | null;
283
324
  /**
284
325
  * Whether a CSS module scopes Tailwind's content detection — `source(none)` or
285
326
  * `source("…")` on the `@import "tailwindcss"`, or any `@source not` exclusion.
@@ -499,5 +540,5 @@ declare const rollupPlugin: (options?: PartialCsszyxConfig) => InputPluginOption
499
540
  */
500
541
  declare const esbuildPlugin: (options?: PartialCsszyxConfig) => Plugin;
501
542
 
502
- export { isMonorepoPackage as A, isPackagesSkippedSource as B, mangleCodeClassesSync as D, missingTailwindEntryMessage as E, normalizeGlobalVarAliasesForCache as F, resolveCompileSourceDirs as H, resolveNativeCacheIdentity as I, rollupPlugin as J, shouldEmitWarning as K, shouldWarnMissingTailwindEntry as L, shouldWarnUnscopedMonorepo as M, skippedSzFilesMessage as N, unscopedMonorepoMessage as O, vitePlugin as Q, webpackPlugin as T, appendTailwindSourceDirective as o, computeSafelistRelPath as p, createGlobalVarMapAssetSource as q, cssHasContentScope as r, cssImportsTailwind as s, esbuildPlugin as t, unplugin as u, extractGlobalVarAliasesForManifest as v, fileMayContainSafelistableSz as w, hasInjectableTailwindCandidate as x, isCompileSourceOptedIn as y, isHardIgnoredPath as z };
503
- export type { CssVarScanResult as C, GlobalVarScanCacheKeyInput as G, 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 };
543
+ export { isHardIgnoredPath as A, isMonorepoPackage as B, isPackagesSkippedSource as D, mangleCodeClassesSync as E, mangleHybridHazardMessage as F, missingTailwindEntryMessage as H, normalizeGlobalVarAliasesForCache as I, resolveCompileSourceDirs as J, resolveNativeCacheIdentity as K, rollupPlugin as L, shouldEmitWarning as N, shouldWarnMissingTailwindEntry as O, shouldWarnUnscopedMonorepo as Q, skippedSzFilesMessage as T, unscopedMonorepoMessage as U, vitePlugin as W, webpackPlugin as X, appendTailwindSourceDirective as o, collectMangleHybridHazards as p, computeSafelistRelPath as q, createGlobalVarMapAssetSource as r, cssHasContentScope as s, cssImportsTailwind as t, unplugin as u, esbuildPlugin as v, extractGlobalVarAliasesForManifest as w, fileMayContainSafelistableSz as x, hasInjectableTailwindCandidate as y, isCompileSourceOptedIn as z };
544
+ 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 };
@@ -271,15 +271,56 @@ declare function hasInjectableTailwindCandidate(classes: Iterable<string>): bool
271
271
  *
272
272
  * @param ownedClassCount - number of csszyx-generated classes this build produced.
273
273
  * @param sawTailwindEntry - whether any processed CSS imported tailwindcss.
274
+ * @param sawAnyCss - whether ANY CSS file passed through the transform hook. When
275
+ * false, csszyx never observed the CSS pipeline (e.g. `astro check`, an early
276
+ * Astro build phase, or CSS handled outside this hook) and cannot conclude the
277
+ * entry is missing — so it stays silent rather than false-positive on a build
278
+ * that does emit valid CSS.
274
279
  * @returns true when the missing-entry warning should fire.
275
280
  */
276
- declare function shouldWarnMissingTailwindEntry(ownedClassCount: number, sawTailwindEntry: boolean): boolean;
281
+ declare function shouldWarnMissingTailwindEntry(ownedClassCount: number, sawTailwindEntry: boolean, sawAnyCss: boolean): boolean;
277
282
  /**
278
283
  * Build the missing-Tailwind-entry warning message.
279
284
  * @param ownedClassCount - number of csszyx-generated classes this build produced.
280
285
  * @returns the warning string.
281
286
  */
282
287
  declare function missingTailwindEntryMessage(ownedClassCount: number): string;
288
+ /**
289
+ * Hazards that make production mangling unsafe in a hybrid build (a separate
290
+ * Tailwind plugin owns the utility CSS and/or hand-written CSS uses literal class
291
+ * names). Computed from data `mangleCSSSync` already returns across every CSS
292
+ * asset, so it is free to surface.
293
+ */
294
+ interface MangleHybridHazards {
295
+ /**
296
+ * Mangled tokens that ALSO appear as a class name in non-csszyx CSS. The
297
+ * short token (e.g. `y` for `w-full`) then matches external `.y` elements and
298
+ * cross-contaminates their styles — the core hybrid-mangle failure.
299
+ */
300
+ collisions: string[];
301
+ /**
302
+ * Map sources csszyx mangled but whose class never appeared in any emitted
303
+ * CSS (e.g. a utility Tailwind never generated, or a malformed key). Their
304
+ * DOM class is rewritten to a token with no rule → the element loses styling.
305
+ */
306
+ orphans: string[];
307
+ }
308
+ /**
309
+ * Detect hybrid-mangle hazards from the accumulated per-asset mangle results.
310
+ *
311
+ * @param mangleMap - the full original→token map injected into the runtime.
312
+ * @param mangledSources - map keys that were actually found and renamed in some CSS asset.
313
+ * @param externalClasses - class names found in CSS that are NOT in the mangle map (non-csszyx).
314
+ * @returns the colliding tokens and orphan sources (each sorted, deduped).
315
+ */
316
+ declare function collectMangleHybridHazards(mangleMap: Record<string, string>, mangledSources: ReadonlySet<string>, externalClasses: ReadonlySet<string>): MangleHybridHazards;
317
+ /**
318
+ * Build the hybrid-mangle hazard warning, or null when there is nothing to warn.
319
+ *
320
+ * @param hazards - the detected collisions and orphans.
321
+ * @returns a warning string, or null when both lists are empty.
322
+ */
323
+ declare function mangleHybridHazardMessage(hazards: MangleHybridHazards): string | null;
283
324
  /**
284
325
  * Whether a CSS module scopes Tailwind's content detection — `source(none)` or
285
326
  * `source("…")` on the `@import "tailwindcss"`, or any `@source not` exclusion.
@@ -499,5 +540,5 @@ declare const rollupPlugin: (options?: PartialCsszyxConfig) => InputPluginOption
499
540
  */
500
541
  declare const esbuildPlugin: (options?: PartialCsszyxConfig) => Plugin;
501
542
 
502
- export { isMonorepoPackage as A, isPackagesSkippedSource as B, mangleCodeClassesSync as D, missingTailwindEntryMessage as E, normalizeGlobalVarAliasesForCache as F, resolveCompileSourceDirs as H, resolveNativeCacheIdentity as I, rollupPlugin as J, shouldEmitWarning as K, shouldWarnMissingTailwindEntry as L, shouldWarnUnscopedMonorepo as M, skippedSzFilesMessage as N, unscopedMonorepoMessage as O, vitePlugin as Q, webpackPlugin as T, appendTailwindSourceDirective as o, computeSafelistRelPath as p, createGlobalVarMapAssetSource as q, cssHasContentScope as r, cssImportsTailwind as s, esbuildPlugin as t, unplugin as u, extractGlobalVarAliasesForManifest as v, fileMayContainSafelistableSz as w, hasInjectableTailwindCandidate as x, isCompileSourceOptedIn as y, isHardIgnoredPath as z };
503
- export type { CssVarScanResult as C, GlobalVarScanCacheKeyInput as G, 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 };
543
+ export { isHardIgnoredPath as A, isMonorepoPackage as B, isPackagesSkippedSource as D, mangleCodeClassesSync as E, mangleHybridHazardMessage as F, missingTailwindEntryMessage as H, normalizeGlobalVarAliasesForCache as I, resolveCompileSourceDirs as J, resolveNativeCacheIdentity as K, rollupPlugin as L, shouldEmitWarning as N, shouldWarnMissingTailwindEntry as O, shouldWarnUnscopedMonorepo as Q, skippedSzFilesMessage as T, unscopedMonorepoMessage as U, vitePlugin as W, webpackPlugin as X, appendTailwindSourceDirective as o, collectMangleHybridHazards as p, computeSafelistRelPath as q, createGlobalVarMapAssetSource as r, cssHasContentScope as s, cssImportsTailwind as t, unplugin as u, esbuildPlugin as v, extractGlobalVarAliasesForManifest as w, fileMayContainSafelistableSz as x, hasInjectableTailwindCandidate as y, isCompileSourceOptedIn as z };
544
+ 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 };
@@ -232,7 +232,7 @@ function collectRuntimeStaticClasses(result, discoveredClasses) {
232
232
  }
233
233
  }
234
234
  function collectRuntimeStringClasses(objectSource, discoveredClasses) {
235
- const stringKeyValue = /(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
235
+ const stringKeyValue = /\b(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
236
236
  for (const match of objectSource.matchAll(stringKeyValue)) {
237
237
  try {
238
238
  collectTransformClasses(
@@ -244,7 +244,7 @@ function collectRuntimeStringClasses(objectSource, discoveredClasses) {
244
244
  }
245
245
  }
246
246
  function collectRuntimeNumberClasses(objectSource, discoveredClasses) {
247
- const numberKeyValue = /(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
247
+ const numberKeyValue = /\b(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
248
248
  for (const match of objectSource.matchAll(numberKeyValue)) {
249
249
  try {
250
250
  collectTransformClasses(
@@ -256,7 +256,7 @@ function collectRuntimeNumberClasses(objectSource, discoveredClasses) {
256
256
  }
257
257
  }
258
258
  function collectRuntimeBooleanClasses(objectSource, discoveredClasses) {
259
- const booleanKeyValue = /(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
259
+ const booleanKeyValue = /\b(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
260
260
  for (const match of objectSource.matchAll(booleanKeyValue)) {
261
261
  try {
262
262
  collectTransformClasses(
@@ -913,7 +913,7 @@ function readImportedSymbols(clause) {
913
913
  if (!trimmed || trimmed.startsWith("type ")) {
914
914
  continue;
915
915
  }
916
- const sourceName = trimmed.replace(/^type[ \t]+/, "").split(/[ \t]+as[ \t]+/)[0]?.trim();
916
+ const sourceName = trimmed.replace(/^type[ \t]+/, "").split(/(?<![ \t])[ \t]+as[ \t]+/)[0]?.trim();
917
917
  if (sourceName) {
918
918
  symbols.push(sourceName);
919
919
  }
@@ -1602,16 +1602,18 @@ const DEFAULT_VAR_MANGLE_MAP_MAX_BYTES = 100 * 1024;
1602
1602
  const GLOBAL_VAR_ALIAS_MAP_OWNER = "\0csszyx:global-var-aliases";
1603
1603
  const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
1604
1604
  const RUNTIME_HELPER_IMPORT_RE = {
1605
- _sz: /\{[^}]*\b_sz\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1606
- _szMerge: /\{[^}]*\b_szMerge\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1607
- __szColorVar: /\{[^}]*\b__szColorVar\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
1605
+ _sz: /(?:import|export)\s+\{[^{}]*\b_sz\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1606
+ _szMerge: /(?:import|export)\s+\{[^{}]*\b_szMerge\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1607
+ __szColorVar: /(?:import|export)\s+\{[^{}]*\b__szColorVar\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
1608
1608
  };
1609
1609
  let _hasWarnedTsConfig = false;
1610
1610
  let _hasWarnedTransformCacheVersion = false;
1611
1611
  let _hasWarnedNativeFallback = false;
1612
- const requireFromHere = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.CjxItfV1.cjs', document.baseURI).href)));
1612
+ let _hasLoggedActiveParser = false;
1613
+ const _babelFallbackFiles = /* @__PURE__ */ new Set();
1614
+ const requireFromHere = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.DlGyBb8o.cjs', document.baseURI).href)));
1613
1615
  const PLUGIN_VERSION = findPackageVersionFromFile(
1614
- node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.CjxItfV1.cjs', document.baseURI).href))),
1616
+ node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.DlGyBb8o.cjs', document.baseURI).href))),
1615
1617
  UNKNOWN_PACKAGE_VERSION
1616
1618
  );
1617
1619
  const COMPILER_VERSION = findPackageVersionFromModule("@csszyx/compiler", UNKNOWN_PACKAGE_VERSION);
@@ -1682,12 +1684,47 @@ function hasInjectableTailwindCandidate(classes) {
1682
1684
  }
1683
1685
  return false;
1684
1686
  }
1685
- function shouldWarnMissingTailwindEntry(ownedClassCount, sawTailwindEntry) {
1686
- return ownedClassCount > 0 && !sawTailwindEntry;
1687
+ function shouldWarnMissingTailwindEntry(ownedClassCount, sawTailwindEntry, sawAnyCss) {
1688
+ return ownedClassCount > 0 && sawAnyCss && !sawTailwindEntry;
1687
1689
  }
1688
1690
  function missingTailwindEntryMessage(ownedClassCount) {
1689
1691
  return `[csszyx] generated ${ownedClassCount} sz class(es) but found no CSS entry importing "tailwindcss" \u2014 those classes will produce no CSS. Import "tailwindcss" in a CSS file (csszyx auto-injects @source for the generated classes) so Tailwind emits their styles.`;
1690
1692
  }
1693
+ function collectMangleHybridHazards(mangleMap, mangledSources, externalClasses) {
1694
+ const tokenValues = new Set(Object.values(mangleMap));
1695
+ const collisions = [...tokenValues].filter((token) => externalClasses.has(token)).sort();
1696
+ const orphans = Object.keys(mangleMap).filter((source) => !mangledSources.has(source)).sort();
1697
+ return { collisions, orphans };
1698
+ }
1699
+ function mangleHybridHazardMessage(hazards) {
1700
+ const { collisions, orphans } = hazards;
1701
+ if (collisions.length === 0 && orphans.length === 0) {
1702
+ return null;
1703
+ }
1704
+ const parts = ["[csszyx] production mangle found hybrid hazards:"];
1705
+ if (collisions.length > 0) {
1706
+ const sample = collisions.slice(0, 8).join(", ");
1707
+ parts.push(
1708
+ ` ${collisions.length} mangled token(s) collide with class names in non-csszyx CSS (e.g. ${sample}) \u2014 those tokens will cross-contaminate external ".${collisions[0]}" elements.`
1709
+ );
1710
+ }
1711
+ if (orphans.length > 0) {
1712
+ const sample = orphans.slice(0, 8).join(", ");
1713
+ parts.push(
1714
+ ` ${orphans.length} mangled class(es) have no emitted CSS rule (e.g. ${sample}) \u2014 those elements lose styling.`
1715
+ );
1716
+ }
1717
+ if (collisions.length > 0) {
1718
+ parts.push(
1719
+ " HOTFIX: pass `production: { mangle: false }` to the csszyx plugin to ship now. THEN fix it: if these short names are in your OWN CSS, rename them to something specific (e.g. `.x` \u2192 `.resize-handle-x`) \u2014 short/common names also clash on specificity with other libraries. Only for names in a third-party stylesheet you cannot edit, list them in `production.mangleExclude` instead. Run `npx @csszyx/cli scan-collisions` to find every offending name."
1720
+ );
1721
+ } else {
1722
+ parts.push(
1723
+ " Those classes are csszyx-owned but no CSS was emitted for them (e.g. a separate Tailwind plugin owns the utility CSS, or the class is not a real utility). Ensure that CSS is generated, or pass `production: { mangle: false }` to the csszyx plugin until the pipelines are reconciled."
1724
+ );
1725
+ }
1726
+ return parts.join("");
1727
+ }
1691
1728
  function cssHasContentScope(code) {
1692
1729
  const s = stripCssBlockComments(code);
1693
1730
  return /@import\s+["']tailwindcss(?:\/[^"']*)?["']\s+source\(/.test(s) || /@source\s+not\b/.test(s);
@@ -2364,7 +2401,7 @@ function mangleCodeClassesSync(code, mangleMap) {
2364
2401
  result = out + result.slice(copiedTo);
2365
2402
  }
2366
2403
  }
2367
- result = result.replace(/(?<=(?:[,(]|&&)\s*)"([^"]+)"/g, (match, inner) => {
2404
+ result = result.replace(/([,(]|&&)(\s*)"([^"]+)"/g, (match, sep, ws, inner) => {
2368
2405
  const tokens = inner.split(/\s+/).filter(Boolean);
2369
2406
  if (tokens.length === 0) {
2370
2407
  return match;
@@ -2384,7 +2421,7 @@ function mangleCodeClassesSync(code, mangleMap) {
2384
2421
  if (!changed) {
2385
2422
  return match;
2386
2423
  }
2387
- return `"${mangled.join(" ")}"`;
2424
+ return `${sep}${ws}"${mangled.join(" ")}"`;
2388
2425
  });
2389
2426
  return result;
2390
2427
  }
@@ -2412,7 +2449,8 @@ ${errors.join("\n")}`
2412
2449
  }
2413
2450
  function createCsszyxPlugins(options = {}) {
2414
2451
  assertGlobalVarMangleConfig(options);
2415
- const manglingEnabled = options.production?.mangle !== false;
2452
+ let manglingEnabled = options.production?.mangle !== false;
2453
+ const mangleReserved = new Set(options.production?.mangleExclude ?? []);
2416
2454
  const astBudgetOverride = options.build?.astBudgetLimit;
2417
2455
  const cacheRequested = (options.build?.cache ?? types.DEFAULT_BUILD_CONFIG.cache) !== false;
2418
2456
  const cacheVersionsKnown = PLUGIN_VERSION !== UNKNOWN_PACKAGE_VERSION && COMPILER_VERSION !== UNKNOWN_PACKAGE_VERSION;
@@ -2450,11 +2488,17 @@ function createCsszyxPlugins(options = {}) {
2450
2488
  "[csszyx] No prebuilt native binary (@csszyx/core-*) is available for this platform, so the default `rust` parser fell back to `oxc`. Output classes are identical (parity-tested); only parse speed differs. To use the native engine, install the matching @csszyx/core-<platform> package (or do not omit optional dependencies). Set `build.parser` explicitly to silence this."
2451
2489
  );
2452
2490
  }
2491
+ if (!_hasLoggedActiveParser) {
2492
+ _hasLoggedActiveParser = true;
2493
+ const detail = parserDegraded ? "oxc (degraded from default `rust`: no native binary for this platform)" : parserMode === "rust" ? "rust (native engine)" : parserMode;
2494
+ console.warn(`[csszyx] active parser: ${detail}`);
2495
+ }
2453
2496
  let evictedCacheRoot = null;
2454
2497
  const transformMemoryCache = /* @__PURE__ */ new Map();
2455
2498
  const state = {
2456
2499
  classes: /* @__PURE__ */ new Set(),
2457
2500
  sawTailwindEntry: false,
2501
+ sawAnyCss: false,
2458
2502
  tailwindWarningEmitted: false,
2459
2503
  tailwindEntryScoped: false,
2460
2504
  contentScopeWarningEmitted: false,
@@ -2590,6 +2634,12 @@ function createCsszyxPlugins(options = {}) {
2590
2634
  result.diagnostics.push(
2591
2635
  `[csszyx] oxc parser fell back to Babel for ${effectiveFilename}: ${reason}`
2592
2636
  );
2637
+ if (!_babelFallbackFiles.has(effectiveFilename)) {
2638
+ _babelFallbackFiles.add(effectiveFilename);
2639
+ console.warn(
2640
+ `[csszyx] oxc parser fell back to Babel for ${effectiveFilename}: ${reason} (${_babelFallbackFiles.size} file(s) so far). Output is still correct; this usually means the file uses a syntax the oxc lane does not yet handle.`
2641
+ );
2642
+ }
2593
2643
  return result;
2594
2644
  }
2595
2645
  }
@@ -2604,7 +2654,9 @@ function createCsszyxPlugins(options = {}) {
2604
2654
  astBudget: astBudgetOverride,
2605
2655
  mangleVars: options.production?.mangleVars === true,
2606
2656
  mangleVarHoistMaxDepth: options.production?.mangleVarHoistMaxDepth,
2607
- globalVarAliases: earlyGlobalVarAliasEntries.length > 0 ? earlyGlobalVarAliasEntries : void 0
2657
+ globalVarAliases: earlyGlobalVarAliasEntries.length > 0 ? earlyGlobalVarAliasEntries : void 0,
2658
+ // Render dev-mode unknown-property warnings relative to the project root.
2659
+ rootDir: state.rootDir
2608
2660
  };
2609
2661
  }
2610
2662
  function createConfiguredTransformCacheInput(source, effectiveFilename, compilerOptions) {
@@ -2887,7 +2939,7 @@ function createCsszyxPlugins(options = {}) {
2887
2939
  }
2888
2940
  }
2889
2941
  function collectRuntimeStringClasses(objStr, discoveredClasses) {
2890
- const strKv = /(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
2942
+ const strKv = /\b(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
2891
2943
  for (const kv of objStr.matchAll(strKv)) {
2892
2944
  try {
2893
2945
  const val = kv[2] ?? kv[3];
@@ -2897,7 +2949,7 @@ function createCsszyxPlugins(options = {}) {
2897
2949
  }
2898
2950
  }
2899
2951
  function collectRuntimeNumberClasses(objStr, discoveredClasses) {
2900
- const numKv = /(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
2952
+ const numKv = /\b(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
2901
2953
  for (const kv of objStr.matchAll(numKv)) {
2902
2954
  try {
2903
2955
  collectTransformClasses(
@@ -2909,7 +2961,7 @@ function createCsszyxPlugins(options = {}) {
2909
2961
  }
2910
2962
  }
2911
2963
  function collectRuntimeBooleanClasses(objStr, discoveredClasses) {
2912
- const boolKv = /(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
2964
+ const boolKv = /\b(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
2913
2965
  for (const kv of objStr.matchAll(boolKv)) {
2914
2966
  try {
2915
2967
  collectTransformClasses(
@@ -2962,8 +3014,15 @@ function createCsszyxPlugins(options = {}) {
2962
3014
  function finalizeMangleMap() {
2963
3015
  const sortedClasses = Array.from(state.ownedClasses);
2964
3016
  const newMap = {};
3017
+ let tokenIndex = 0;
2965
3018
  for (let i = 0; i < sortedClasses.length; i++) {
2966
- newMap[sortedClasses[i]] = core.encode(i);
3019
+ let token = core.encode(tokenIndex);
3020
+ while (mangleReserved.has(token)) {
3021
+ tokenIndex++;
3022
+ token = core.encode(tokenIndex);
3023
+ }
3024
+ newMap[sortedClasses[i]] = token;
3025
+ tokenIndex++;
2967
3026
  }
2968
3027
  state.mangleMap = newMap;
2969
3028
  assertVarMangleMapSize(state.varMangleMap, varMangleMapMaxBytes);
@@ -3073,6 +3132,7 @@ function createCsszyxPlugins(options = {}) {
3073
3132
  assertNoRSCBoundaryViolation(code, id);
3074
3133
  }
3075
3134
  if (/\.css(\?.*)?$/.test(id)) {
3135
+ state.sawAnyCss = true;
3076
3136
  if (cssImportsTailwind(code)) {
3077
3137
  state.sawTailwindEntry = true;
3078
3138
  if (cssHasContentScope(code)) {
@@ -3218,7 +3278,11 @@ function createCsszyxPlugins(options = {}) {
3218
3278
  buildEnd() {
3219
3279
  finalizeMangleMap();
3220
3280
  assertNoRSCGraphViolation(state.rscModules);
3221
- if (!state.tailwindWarningEmitted && shouldWarnMissingTailwindEntry(state.ownedClasses.size, state.sawTailwindEntry)) {
3281
+ if (!state.tailwindWarningEmitted && shouldWarnMissingTailwindEntry(
3282
+ state.ownedClasses.size,
3283
+ state.sawTailwindEntry,
3284
+ state.sawAnyCss
3285
+ )) {
3222
3286
  state.tailwindWarningEmitted = true;
3223
3287
  emitWarning(missingTailwindEntryMessage(state.ownedClasses.size));
3224
3288
  }
@@ -3294,6 +3358,9 @@ function createCsszyxPlugins(options = {}) {
3294
3358
  configResolved(config) {
3295
3359
  const root = config.root || process.cwd();
3296
3360
  state.rootDir = root;
3361
+ if (config.command === "serve") {
3362
+ manglingEnabled = false;
3363
+ }
3297
3364
  evictTransformCacheOnce();
3298
3365
  prescanAndWriteClasses();
3299
3366
  runThemeScan(root, options.build?.scanCss);
@@ -3373,7 +3440,8 @@ function createCsszyxPlugins(options = {}) {
3373
3440
  */
3374
3441
  handler(html) {
3375
3442
  finalizeMangleMap();
3376
- let result = transformIndexHtml(html, state.mangleMap, state.checksum, {
3443
+ const injectedMangleMap = manglingEnabled ? state.mangleMap : {};
3444
+ let result = transformIndexHtml(html, injectedMangleMap, state.checksum, {
3377
3445
  mode: options.production?.injectChecksum === false ? "script" : "script",
3378
3446
  minify: process.env.NODE_ENV === "production",
3379
3447
  varMangleMap: state.varMangleMap,
@@ -3464,6 +3532,8 @@ function createCsszyxPlugins(options = {}) {
3464
3532
  );
3465
3533
  }
3466
3534
  }
3535
+ const mangledSources = /* @__PURE__ */ new Set();
3536
+ const externalClasses = /* @__PURE__ */ new Set();
3467
3537
  for (const file in assets) {
3468
3538
  const asset = assets[file];
3469
3539
  const source = asset.source().toString();
@@ -3479,6 +3549,12 @@ function createCsszyxPlugins(options = {}) {
3479
3549
  debug: options.development?.debug,
3480
3550
  from: file
3481
3551
  });
3552
+ for (const c of result.mangledClasses) {
3553
+ mangledSources.add(c);
3554
+ }
3555
+ for (const c of result.unmangledClasses) {
3556
+ externalClasses.add(c);
3557
+ }
3482
3558
  if (result.transformedCount > 0) {
3483
3559
  css = result.css;
3484
3560
  }
@@ -3540,6 +3616,18 @@ function createCsszyxPlugins(options = {}) {
3540
3616
  }
3541
3617
  }
3542
3618
  }
3619
+ if (manglingEnabled && !isWebpackDevMode && Object.keys(state.mangleMap).length > 0) {
3620
+ const hazardMessage = mangleHybridHazardMessage(
3621
+ collectMangleHybridHazards(
3622
+ state.mangleMap,
3623
+ mangledSources,
3624
+ externalClasses
3625
+ )
3626
+ );
3627
+ if (hazardMessage) {
3628
+ console.warn(hazardMessage);
3629
+ }
3630
+ }
3543
3631
  }
3544
3632
  );
3545
3633
  });
@@ -3596,6 +3684,8 @@ function createCsszyxPlugins(options = {}) {
3596
3684
  });
3597
3685
  }
3598
3686
  }
3687
+ const mangledSources = /* @__PURE__ */ new Set();
3688
+ const externalClasses = /* @__PURE__ */ new Set();
3599
3689
  for (const file in bundle) {
3600
3690
  const chunk = bundle[file];
3601
3691
  if (chunk.type === "asset" && chunk.fileName.endsWith(".css")) {
@@ -3611,6 +3701,12 @@ function createCsszyxPlugins(options = {}) {
3611
3701
  debug: options.development?.debug,
3612
3702
  from: file
3613
3703
  });
3704
+ for (const c of result.mangledClasses) {
3705
+ mangledSources.add(c);
3706
+ }
3707
+ for (const c of result.unmangledClasses) {
3708
+ externalClasses.add(c);
3709
+ }
3614
3710
  if (result.transformedCount > 0) {
3615
3711
  css = result.css;
3616
3712
  }
@@ -3642,6 +3738,18 @@ function createCsszyxPlugins(options = {}) {
3642
3738
  }
3643
3739
  }
3644
3740
  }
3741
+ if (manglingEnabled && Object.keys(state.mangleMap).length > 0) {
3742
+ const hazardMessage = mangleHybridHazardMessage(
3743
+ collectMangleHybridHazards(
3744
+ state.mangleMap,
3745
+ mangledSources,
3746
+ externalClasses
3747
+ )
3748
+ );
3749
+ if (hazardMessage) {
3750
+ console.warn(hazardMessage);
3751
+ }
3752
+ }
3645
3753
  }
3646
3754
  }
3647
3755
  }));
@@ -3692,6 +3800,7 @@ const esbuildPlugin = (options = {}) => {
3692
3800
  exports.appendTailwindSourceDirective = appendTailwindSourceDirective;
3693
3801
  exports.assertNoRSCBoundaryViolation = assertNoRSCBoundaryViolation;
3694
3802
  exports.assertNoRSCGraphViolation = assertNoRSCGraphViolation;
3803
+ exports.collectMangleHybridHazards = collectMangleHybridHazards;
3695
3804
  exports.computeSafelistRelPath = computeSafelistRelPath;
3696
3805
  exports.createGlobalVarAliasValidationOptions = createGlobalVarAliasValidationOptions;
3697
3806
  exports.createGlobalVarMapAssetSource = createGlobalVarMapAssetSource;
@@ -3716,6 +3825,7 @@ exports.isPackagesSkippedSource = isPackagesSkippedSource;
3716
3825
  exports.isRSCServerModule = isRSCServerModule;
3717
3826
  exports.isTailwindReservedGlobalVar = isTailwindReservedGlobalVar;
3718
3827
  exports.mangleCodeClassesSync = mangleCodeClassesSync;
3828
+ exports.mangleHybridHazardMessage = mangleHybridHazardMessage;
3719
3829
  exports.mergeThemes = mergeThemes;
3720
3830
  exports.missingTailwindEntryMessage = missingTailwindEntryMessage;
3721
3831
  exports.normalizeGlobalVarAliasesForCache = normalizeGlobalVarAliasesForCache;
@@ -893,7 +893,7 @@ function readImportedSymbols(clause) {
893
893
  if (!trimmed || trimmed.startsWith("type ")) {
894
894
  continue;
895
895
  }
896
- const sourceName = trimmed.replace(/^type[ \t]+/, "").split(/[ \t]+as[ \t]+/)[0]?.trim();
896
+ const sourceName = trimmed.replace(/^type[ \t]+/, "").split(/(?<![ \t])[ \t]+as[ \t]+/)[0]?.trim();
897
897
  if (sourceName) {
898
898
  symbols.push(sourceName);
899
899
  }
@@ -1582,13 +1582,15 @@ const DEFAULT_VAR_MANGLE_MAP_MAX_BYTES = 100 * 1024;
1582
1582
  const GLOBAL_VAR_ALIAS_MAP_OWNER = "\0csszyx:global-var-aliases";
1583
1583
  const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
1584
1584
  const RUNTIME_HELPER_IMPORT_RE = {
1585
- _sz: /\{[^}]*\b_sz\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1586
- _szMerge: /\{[^}]*\b_szMerge\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1587
- __szColorVar: /\{[^}]*\b__szColorVar\b[^}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
1585
+ _sz: /(?:import|export)\s+\{[^{}]*\b_sz\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1586
+ _szMerge: /(?:import|export)\s+\{[^{}]*\b_szMerge\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
1587
+ __szColorVar: /(?:import|export)\s+\{[^{}]*\b__szColorVar\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
1588
1588
  };
1589
1589
  let _hasWarnedTsConfig = false;
1590
1590
  let _hasWarnedTransformCacheVersion = false;
1591
1591
  let _hasWarnedNativeFallback = false;
1592
+ let _hasLoggedActiveParser = false;
1593
+ const _babelFallbackFiles = /* @__PURE__ */ new Set();
1592
1594
  const requireFromHere = createRequire(import.meta.url);
1593
1595
  const PLUGIN_VERSION = findPackageVersionFromFile(
1594
1596
  fileURLToPath(import.meta.url),
@@ -1662,12 +1664,47 @@ function hasInjectableTailwindCandidate(classes) {
1662
1664
  }
1663
1665
  return false;
1664
1666
  }
1665
- function shouldWarnMissingTailwindEntry(ownedClassCount, sawTailwindEntry) {
1666
- return ownedClassCount > 0 && !sawTailwindEntry;
1667
+ function shouldWarnMissingTailwindEntry(ownedClassCount, sawTailwindEntry, sawAnyCss) {
1668
+ return ownedClassCount > 0 && sawAnyCss && !sawTailwindEntry;
1667
1669
  }
1668
1670
  function missingTailwindEntryMessage(ownedClassCount) {
1669
1671
  return `[csszyx] generated ${ownedClassCount} sz class(es) but found no CSS entry importing "tailwindcss" \u2014 those classes will produce no CSS. Import "tailwindcss" in a CSS file (csszyx auto-injects @source for the generated classes) so Tailwind emits their styles.`;
1670
1672
  }
1673
+ function collectMangleHybridHazards(mangleMap, mangledSources, externalClasses) {
1674
+ const tokenValues = new Set(Object.values(mangleMap));
1675
+ const collisions = [...tokenValues].filter((token) => externalClasses.has(token)).sort();
1676
+ const orphans = Object.keys(mangleMap).filter((source) => !mangledSources.has(source)).sort();
1677
+ return { collisions, orphans };
1678
+ }
1679
+ function mangleHybridHazardMessage(hazards) {
1680
+ const { collisions, orphans } = hazards;
1681
+ if (collisions.length === 0 && orphans.length === 0) {
1682
+ return null;
1683
+ }
1684
+ const parts = ["[csszyx] production mangle found hybrid hazards:"];
1685
+ if (collisions.length > 0) {
1686
+ const sample = collisions.slice(0, 8).join(", ");
1687
+ parts.push(
1688
+ ` ${collisions.length} mangled token(s) collide with class names in non-csszyx CSS (e.g. ${sample}) \u2014 those tokens will cross-contaminate external ".${collisions[0]}" elements.`
1689
+ );
1690
+ }
1691
+ if (orphans.length > 0) {
1692
+ const sample = orphans.slice(0, 8).join(", ");
1693
+ parts.push(
1694
+ ` ${orphans.length} mangled class(es) have no emitted CSS rule (e.g. ${sample}) \u2014 those elements lose styling.`
1695
+ );
1696
+ }
1697
+ if (collisions.length > 0) {
1698
+ parts.push(
1699
+ " HOTFIX: pass `production: { mangle: false }` to the csszyx plugin to ship now. THEN fix it: if these short names are in your OWN CSS, rename them to something specific (e.g. `.x` \u2192 `.resize-handle-x`) \u2014 short/common names also clash on specificity with other libraries. Only for names in a third-party stylesheet you cannot edit, list them in `production.mangleExclude` instead. Run `npx @csszyx/cli scan-collisions` to find every offending name."
1700
+ );
1701
+ } else {
1702
+ parts.push(
1703
+ " Those classes are csszyx-owned but no CSS was emitted for them (e.g. a separate Tailwind plugin owns the utility CSS, or the class is not a real utility). Ensure that CSS is generated, or pass `production: { mangle: false }` to the csszyx plugin until the pipelines are reconciled."
1704
+ );
1705
+ }
1706
+ return parts.join("");
1707
+ }
1671
1708
  function cssHasContentScope(code) {
1672
1709
  const s = stripCssBlockComments(code);
1673
1710
  return /@import\s+["']tailwindcss(?:\/[^"']*)?["']\s+source\(/.test(s) || /@source\s+not\b/.test(s);
@@ -2344,7 +2381,7 @@ function mangleCodeClassesSync(code, mangleMap) {
2344
2381
  result = out + result.slice(copiedTo);
2345
2382
  }
2346
2383
  }
2347
- result = result.replace(/(?<=(?:[,(]|&&)\s*)"([^"]+)"/g, (match, inner) => {
2384
+ result = result.replace(/([,(]|&&)(\s*)"([^"]+)"/g, (match, sep, ws, inner) => {
2348
2385
  const tokens = inner.split(/\s+/).filter(Boolean);
2349
2386
  if (tokens.length === 0) {
2350
2387
  return match;
@@ -2364,7 +2401,7 @@ function mangleCodeClassesSync(code, mangleMap) {
2364
2401
  if (!changed) {
2365
2402
  return match;
2366
2403
  }
2367
- return `"${mangled.join(" ")}"`;
2404
+ return `${sep}${ws}"${mangled.join(" ")}"`;
2368
2405
  });
2369
2406
  return result;
2370
2407
  }
@@ -2392,7 +2429,8 @@ ${errors.join("\n")}`
2392
2429
  }
2393
2430
  function createCsszyxPlugins(options = {}) {
2394
2431
  assertGlobalVarMangleConfig(options);
2395
- const manglingEnabled = options.production?.mangle !== false;
2432
+ let manglingEnabled = options.production?.mangle !== false;
2433
+ const mangleReserved = new Set(options.production?.mangleExclude ?? []);
2396
2434
  const astBudgetOverride = options.build?.astBudgetLimit;
2397
2435
  const cacheRequested = (options.build?.cache ?? DEFAULT_BUILD_CONFIG.cache) !== false;
2398
2436
  const cacheVersionsKnown = PLUGIN_VERSION !== UNKNOWN_PACKAGE_VERSION && COMPILER_VERSION !== UNKNOWN_PACKAGE_VERSION;
@@ -2430,11 +2468,17 @@ function createCsszyxPlugins(options = {}) {
2430
2468
  "[csszyx] No prebuilt native binary (@csszyx/core-*) is available for this platform, so the default `rust` parser fell back to `oxc`. Output classes are identical (parity-tested); only parse speed differs. To use the native engine, install the matching @csszyx/core-<platform> package (or do not omit optional dependencies). Set `build.parser` explicitly to silence this."
2431
2469
  );
2432
2470
  }
2471
+ if (!_hasLoggedActiveParser) {
2472
+ _hasLoggedActiveParser = true;
2473
+ const detail = parserDegraded ? "oxc (degraded from default `rust`: no native binary for this platform)" : parserMode === "rust" ? "rust (native engine)" : parserMode;
2474
+ console.warn(`[csszyx] active parser: ${detail}`);
2475
+ }
2433
2476
  let evictedCacheRoot = null;
2434
2477
  const transformMemoryCache = /* @__PURE__ */ new Map();
2435
2478
  const state = {
2436
2479
  classes: /* @__PURE__ */ new Set(),
2437
2480
  sawTailwindEntry: false,
2481
+ sawAnyCss: false,
2438
2482
  tailwindWarningEmitted: false,
2439
2483
  tailwindEntryScoped: false,
2440
2484
  contentScopeWarningEmitted: false,
@@ -2570,6 +2614,12 @@ function createCsszyxPlugins(options = {}) {
2570
2614
  result.diagnostics.push(
2571
2615
  `[csszyx] oxc parser fell back to Babel for ${effectiveFilename}: ${reason}`
2572
2616
  );
2617
+ if (!_babelFallbackFiles.has(effectiveFilename)) {
2618
+ _babelFallbackFiles.add(effectiveFilename);
2619
+ console.warn(
2620
+ `[csszyx] oxc parser fell back to Babel for ${effectiveFilename}: ${reason} (${_babelFallbackFiles.size} file(s) so far). Output is still correct; this usually means the file uses a syntax the oxc lane does not yet handle.`
2621
+ );
2622
+ }
2573
2623
  return result;
2574
2624
  }
2575
2625
  }
@@ -2584,7 +2634,9 @@ function createCsszyxPlugins(options = {}) {
2584
2634
  astBudget: astBudgetOverride,
2585
2635
  mangleVars: options.production?.mangleVars === true,
2586
2636
  mangleVarHoistMaxDepth: options.production?.mangleVarHoistMaxDepth,
2587
- globalVarAliases: earlyGlobalVarAliasEntries.length > 0 ? earlyGlobalVarAliasEntries : void 0
2637
+ globalVarAliases: earlyGlobalVarAliasEntries.length > 0 ? earlyGlobalVarAliasEntries : void 0,
2638
+ // Render dev-mode unknown-property warnings relative to the project root.
2639
+ rootDir: state.rootDir
2588
2640
  };
2589
2641
  }
2590
2642
  function createConfiguredTransformCacheInput(source, effectiveFilename, compilerOptions) {
@@ -2867,7 +2919,7 @@ function createCsszyxPlugins(options = {}) {
2867
2919
  }
2868
2920
  }
2869
2921
  function collectRuntimeStringClasses(objStr, discoveredClasses) {
2870
- const strKv = /(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
2922
+ const strKv = /\b(\w+)\s*:\s*(?:"([^"]*)"|'([^']*)')/g;
2871
2923
  for (const kv of objStr.matchAll(strKv)) {
2872
2924
  try {
2873
2925
  const val = kv[2] ?? kv[3];
@@ -2877,7 +2929,7 @@ function createCsszyxPlugins(options = {}) {
2877
2929
  }
2878
2930
  }
2879
2931
  function collectRuntimeNumberClasses(objStr, discoveredClasses) {
2880
- const numKv = /(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
2932
+ const numKv = /\b(\w+)\s*:\s*(-?\d+(?:\.\d+)?)\s*(?=[,}\n])/g;
2881
2933
  for (const kv of objStr.matchAll(numKv)) {
2882
2934
  try {
2883
2935
  collectTransformClasses(
@@ -2889,7 +2941,7 @@ function createCsszyxPlugins(options = {}) {
2889
2941
  }
2890
2942
  }
2891
2943
  function collectRuntimeBooleanClasses(objStr, discoveredClasses) {
2892
- const boolKv = /(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
2944
+ const boolKv = /\b(\w+)\s*:\s*(true|false)\s*(?=[,}\n])/g;
2893
2945
  for (const kv of objStr.matchAll(boolKv)) {
2894
2946
  try {
2895
2947
  collectTransformClasses(
@@ -2942,8 +2994,15 @@ function createCsszyxPlugins(options = {}) {
2942
2994
  function finalizeMangleMap() {
2943
2995
  const sortedClasses = Array.from(state.ownedClasses);
2944
2996
  const newMap = {};
2997
+ let tokenIndex = 0;
2945
2998
  for (let i = 0; i < sortedClasses.length; i++) {
2946
- newMap[sortedClasses[i]] = encode(i);
2999
+ let token = encode(tokenIndex);
3000
+ while (mangleReserved.has(token)) {
3001
+ tokenIndex++;
3002
+ token = encode(tokenIndex);
3003
+ }
3004
+ newMap[sortedClasses[i]] = token;
3005
+ tokenIndex++;
2947
3006
  }
2948
3007
  state.mangleMap = newMap;
2949
3008
  assertVarMangleMapSize(state.varMangleMap, varMangleMapMaxBytes);
@@ -3053,6 +3112,7 @@ function createCsszyxPlugins(options = {}) {
3053
3112
  assertNoRSCBoundaryViolation(code, id);
3054
3113
  }
3055
3114
  if (/\.css(\?.*)?$/.test(id)) {
3115
+ state.sawAnyCss = true;
3056
3116
  if (cssImportsTailwind(code)) {
3057
3117
  state.sawTailwindEntry = true;
3058
3118
  if (cssHasContentScope(code)) {
@@ -3198,7 +3258,11 @@ function createCsszyxPlugins(options = {}) {
3198
3258
  buildEnd() {
3199
3259
  finalizeMangleMap();
3200
3260
  assertNoRSCGraphViolation(state.rscModules);
3201
- if (!state.tailwindWarningEmitted && shouldWarnMissingTailwindEntry(state.ownedClasses.size, state.sawTailwindEntry)) {
3261
+ if (!state.tailwindWarningEmitted && shouldWarnMissingTailwindEntry(
3262
+ state.ownedClasses.size,
3263
+ state.sawTailwindEntry,
3264
+ state.sawAnyCss
3265
+ )) {
3202
3266
  state.tailwindWarningEmitted = true;
3203
3267
  emitWarning(missingTailwindEntryMessage(state.ownedClasses.size));
3204
3268
  }
@@ -3274,6 +3338,9 @@ function createCsszyxPlugins(options = {}) {
3274
3338
  configResolved(config) {
3275
3339
  const root = config.root || process.cwd();
3276
3340
  state.rootDir = root;
3341
+ if (config.command === "serve") {
3342
+ manglingEnabled = false;
3343
+ }
3277
3344
  evictTransformCacheOnce();
3278
3345
  prescanAndWriteClasses();
3279
3346
  runThemeScan(root, options.build?.scanCss);
@@ -3353,7 +3420,8 @@ function createCsszyxPlugins(options = {}) {
3353
3420
  */
3354
3421
  handler(html) {
3355
3422
  finalizeMangleMap();
3356
- let result = transformIndexHtml(html, state.mangleMap, state.checksum, {
3423
+ const injectedMangleMap = manglingEnabled ? state.mangleMap : {};
3424
+ let result = transformIndexHtml(html, injectedMangleMap, state.checksum, {
3357
3425
  mode: options.production?.injectChecksum === false ? "script" : "script",
3358
3426
  minify: process.env.NODE_ENV === "production",
3359
3427
  varMangleMap: state.varMangleMap,
@@ -3444,6 +3512,8 @@ function createCsszyxPlugins(options = {}) {
3444
3512
  );
3445
3513
  }
3446
3514
  }
3515
+ const mangledSources = /* @__PURE__ */ new Set();
3516
+ const externalClasses = /* @__PURE__ */ new Set();
3447
3517
  for (const file in assets) {
3448
3518
  const asset = assets[file];
3449
3519
  const source = asset.source().toString();
@@ -3459,6 +3529,12 @@ function createCsszyxPlugins(options = {}) {
3459
3529
  debug: options.development?.debug,
3460
3530
  from: file
3461
3531
  });
3532
+ for (const c of result.mangledClasses) {
3533
+ mangledSources.add(c);
3534
+ }
3535
+ for (const c of result.unmangledClasses) {
3536
+ externalClasses.add(c);
3537
+ }
3462
3538
  if (result.transformedCount > 0) {
3463
3539
  css = result.css;
3464
3540
  }
@@ -3520,6 +3596,18 @@ function createCsszyxPlugins(options = {}) {
3520
3596
  }
3521
3597
  }
3522
3598
  }
3599
+ if (manglingEnabled && !isWebpackDevMode && Object.keys(state.mangleMap).length > 0) {
3600
+ const hazardMessage = mangleHybridHazardMessage(
3601
+ collectMangleHybridHazards(
3602
+ state.mangleMap,
3603
+ mangledSources,
3604
+ externalClasses
3605
+ )
3606
+ );
3607
+ if (hazardMessage) {
3608
+ console.warn(hazardMessage);
3609
+ }
3610
+ }
3523
3611
  }
3524
3612
  );
3525
3613
  });
@@ -3576,6 +3664,8 @@ function createCsszyxPlugins(options = {}) {
3576
3664
  });
3577
3665
  }
3578
3666
  }
3667
+ const mangledSources = /* @__PURE__ */ new Set();
3668
+ const externalClasses = /* @__PURE__ */ new Set();
3579
3669
  for (const file in bundle) {
3580
3670
  const chunk = bundle[file];
3581
3671
  if (chunk.type === "asset" && chunk.fileName.endsWith(".css")) {
@@ -3591,6 +3681,12 @@ function createCsszyxPlugins(options = {}) {
3591
3681
  debug: options.development?.debug,
3592
3682
  from: file
3593
3683
  });
3684
+ for (const c of result.mangledClasses) {
3685
+ mangledSources.add(c);
3686
+ }
3687
+ for (const c of result.unmangledClasses) {
3688
+ externalClasses.add(c);
3689
+ }
3594
3690
  if (result.transformedCount > 0) {
3595
3691
  css = result.css;
3596
3692
  }
@@ -3622,6 +3718,18 @@ function createCsszyxPlugins(options = {}) {
3622
3718
  }
3623
3719
  }
3624
3720
  }
3721
+ if (manglingEnabled && Object.keys(state.mangleMap).length > 0) {
3722
+ const hazardMessage = mangleHybridHazardMessage(
3723
+ collectMangleHybridHazards(
3724
+ state.mangleMap,
3725
+ mangledSources,
3726
+ externalClasses
3727
+ )
3728
+ );
3729
+ if (hazardMessage) {
3730
+ console.warn(hazardMessage);
3731
+ }
3732
+ }
3625
3733
  }
3626
3734
  }
3627
3735
  }));
@@ -3669,4 +3777,4 @@ const esbuildPlugin = (options = {}) => {
3669
3777
  };
3670
3778
  };
3671
3779
 
3672
- export { isTailwindReservedGlobalVar as A, mangleCodeClassesSync as B, mergeThemes as C, missingTailwindEntryMessage as D, normalizeGlobalVarAliasesForCache as E, parseThemeBlocks as F, planGlobalVarAliases as G, readGlobalVarScanCache as H, resolveCompileSourceDirs as I, resolveGlobalVarScanCacheDir as J, resolveNativeCacheIdentity as K, rewriteGlobalVarCssAliases as L, rollupPlugin as M, scanGlobalVarCss as N, shouldEmitWarning as O, shouldWarnMissingTailwindEntry as P, shouldWarnUnscopedMonorepo as Q, skippedSzFilesMessage as R, unscopedMonorepoMessage as S, validateGlobalVarAliasInputs as T, vitePlugin as U, webpackPlugin as V, writeGlobalVarScanCache as W, appendTailwindSourceDirective as a, assertNoRSCBoundaryViolation as b, assertNoRSCGraphViolation as c, computeSafelistRelPath as d, createGlobalVarAliasValidationOptions as e, createGlobalVarMapAssetSource as f, createGlobalVarScanCacheKey as g, createRSCModuleRecord as h, cssHasContentScope as i, cssImportsTailwind as j, deleteRSCModuleRecord as k, esbuildPlugin as l, extractGlobalVarAliasesForManifest as m, fileMayContainSafelistableSz as n, findRSCBoundaryViolation as o, findRSCGraphViolation as p, hasInjectableTailwindCandidate as q, hasTokens as r, hasUseClientDirective as s, hasUseServerDirective as t, unplugin as u, isCompileSourceOptedIn as v, isHardIgnoredPath as w, isMonorepoPackage as x, isPackagesSkippedSource as y, isRSCServerModule as z };
3780
+ export { isRSCServerModule as A, isTailwindReservedGlobalVar as B, mangleCodeClassesSync as C, mangleHybridHazardMessage as D, mergeThemes as E, missingTailwindEntryMessage as F, normalizeGlobalVarAliasesForCache as G, parseThemeBlocks as H, planGlobalVarAliases as I, readGlobalVarScanCache as J, resolveCompileSourceDirs as K, resolveGlobalVarScanCacheDir as L, resolveNativeCacheIdentity as M, rewriteGlobalVarCssAliases as N, rollupPlugin as O, scanGlobalVarCss as P, shouldEmitWarning as Q, shouldWarnMissingTailwindEntry as R, shouldWarnUnscopedMonorepo as S, skippedSzFilesMessage as T, unscopedMonorepoMessage as U, validateGlobalVarAliasInputs as V, vitePlugin as W, webpackPlugin as X, writeGlobalVarScanCache as Y, appendTailwindSourceDirective as a, assertNoRSCBoundaryViolation as b, assertNoRSCGraphViolation as c, collectMangleHybridHazards as d, computeSafelistRelPath as e, createGlobalVarAliasValidationOptions as f, createGlobalVarMapAssetSource as g, createGlobalVarScanCacheKey as h, createRSCModuleRecord as i, cssHasContentScope as j, cssImportsTailwind as k, deleteRSCModuleRecord as l, esbuildPlugin as m, extractGlobalVarAliasesForManifest as n, fileMayContainSafelistableSz as o, findRSCBoundaryViolation as p, findRSCGraphViolation as q, hasInjectableTailwindCandidate as r, hasTokens as s, hasUseClientDirective as t, unplugin as u, hasUseServerDirective as v, isCompileSourceOptedIn as w, isHardIgnoredPath as x, isMonorepoPackage as y, isPackagesSkippedSource as z };
package/dist/vite.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const unplugin = require('./shared/unplugin.CjxItfV1.cjs');
5
+ const unplugin = require('./shared/unplugin.DlGyBb8o.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Q as vitePlugin } from './shared/unplugin.DzA2Mwc7.cjs';
1
+ import { W as vitePlugin } from './shared/unplugin.CK6U5gAP.cjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Q as vitePlugin } from './shared/unplugin.DzA2Mwc7.mjs';
1
+ import { W as vitePlugin } from './shared/unplugin.CK6U5gAP.mjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { U as vitePlugin } from './shared/unplugin.CDjxWs9r.mjs';
1
+ import { W as vitePlugin } from './shared/unplugin.mdW7U-K4.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
package/dist/webpack.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const unplugin = require('./shared/unplugin.CjxItfV1.cjs');
5
+ const unplugin = require('./shared/unplugin.DlGyBb8o.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
@@ -1,4 +1,4 @@
1
- import { T as webpackPlugin } from './shared/unplugin.DzA2Mwc7.cjs';
1
+ import { X as webpackPlugin } from './shared/unplugin.CK6U5gAP.cjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
@@ -1,4 +1,4 @@
1
- import { T as webpackPlugin } from './shared/unplugin.DzA2Mwc7.mjs';
1
+ import { X as webpackPlugin } from './shared/unplugin.CK6U5gAP.mjs';
2
2
  import '@csszyx/compiler';
3
3
  import '@csszyx/types';
4
4
  import 'esbuild';
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { V as webpackPlugin } from './shared/unplugin.CDjxWs9r.mjs';
1
+ import { X as webpackPlugin } from './shared/unplugin.mdW7U-K4.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/unplugin",
3
- "version": "0.10.6",
3
+ "version": "0.10.8",
4
4
  "description": "Vite and Webpack integration for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -117,14 +117,14 @@
117
117
  "postcss-value-parser": "^4.2.0",
118
118
  "proper-lockfile": "^4.1.2",
119
119
  "unplugin": "^1.10.1",
120
- "@csszyx/compiler": "0.10.6",
121
- "@csszyx/svelte-adapter": "0.10.6",
122
- "@csszyx/types": "0.10.6",
123
- "@csszyx/core": "0.10.6",
124
- "@csszyx/vue-adapter": "0.10.6"
120
+ "@csszyx/compiler": "0.10.8",
121
+ "@csszyx/core": "0.10.8",
122
+ "@csszyx/svelte-adapter": "0.10.8",
123
+ "@csszyx/types": "0.10.8",
124
+ "@csszyx/vue-adapter": "0.10.8"
125
125
  },
126
126
  "peerDependencies": {
127
- "@csszyx/runtime": "^0.10.6"
127
+ "@csszyx/runtime": "^0.10.8"
128
128
  },
129
129
  "devDependencies": {
130
130
  "@types/node": "^20.11.0",