@csszyx/unplugin 0.14.4 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +4 -3
  2. package/dist/index.cjs +8 -7
  3. package/dist/index.d.cts +70 -3
  4. package/dist/index.d.mts +70 -3
  5. package/dist/index.mjs +4 -4
  6. package/dist/next-config.d.cts +1 -2
  7. package/dist/next-config.d.mts +1 -2
  8. package/dist/next-prebuild.cjs +9 -5
  9. package/dist/next-prebuild.d.cts +4 -2
  10. package/dist/next-prebuild.d.mts +4 -2
  11. package/dist/next-prebuild.mjs +8 -4
  12. package/dist/next-turbo-loader.cjs +20 -14
  13. package/dist/next-turbo-loader.d.cts +1 -1
  14. package/dist/next-turbo-loader.d.mts +1 -1
  15. package/dist/next-turbo-loader.mjs +19 -13
  16. package/dist/next-watcher.cjs +2 -2
  17. package/dist/next-watcher.d.cts +2 -2
  18. package/dist/next-watcher.d.mts +2 -2
  19. package/dist/next-watcher.mjs +2 -2
  20. package/dist/postcss.cjs +124 -0
  21. package/dist/postcss.d.cts +42 -0
  22. package/dist/postcss.d.mts +42 -0
  23. package/dist/postcss.mjs +107 -0
  24. package/dist/shared/{unplugin.NlPvn5P4.mjs → unplugin.AGR7mihU.mjs} +2 -6
  25. package/dist/shared/{unplugin.BnRf0Tvd.mjs → unplugin.BGufkSFT.mjs} +297 -173
  26. package/dist/shared/{unplugin.BXYakiXt.d.cts → unplugin.BHfqCocB.d.cts} +53 -55
  27. package/dist/shared/{unplugin.BXYakiXt.d.mts → unplugin.BHfqCocB.d.mts} +53 -55
  28. package/dist/shared/{unplugin.RGzhYt-D.cjs → unplugin.BLbrShMZ.cjs} +344 -221
  29. package/dist/shared/{unplugin.DVbPNK3W.cjs → unplugin.BbBYWFGT.cjs} +6 -6
  30. package/dist/shared/{unplugin.BZPdvVcj.mjs → unplugin.BourSpnZ.mjs} +105 -127
  31. package/dist/shared/{unplugin.CPEWNSA0.d.cts → unplugin.C2ilavL1.d.cts} +2 -0
  32. package/dist/shared/{unplugin.CPEWNSA0.d.mts → unplugin.C2ilavL1.d.mts} +2 -0
  33. package/dist/shared/{unplugin.D8BxOOkA.cjs → unplugin.C7i0agiO.cjs} +121 -142
  34. package/dist/shared/{unplugin.CdZxp0x-.d.mts → unplugin.CXCaQ3-s.d.cts} +1 -1
  35. package/dist/shared/{unplugin.xeED_qwh.d.cts → unplugin.CbNydVwv.d.mts} +1 -1
  36. package/dist/shared/unplugin.CqJS0BbD.mjs +211 -0
  37. package/dist/shared/{unplugin.VtXstzEh.cjs → unplugin.DX3rYT4P.cjs} +6 -11
  38. package/dist/shared/{unplugin.Cji6O5jv.cjs → unplugin.Dai5wlZ3.cjs} +27 -19
  39. package/dist/shared/{unplugin.DN95k991.mjs → unplugin.Dbc26ty6.mjs} +2 -2
  40. package/dist/shared/{unplugin.BU0O4IkX.mjs → unplugin.DmCOQc-b.mjs} +22 -16
  41. package/dist/shared/unplugin.KnDCM-sr.cjs +241 -0
  42. package/dist/vite.cjs +4 -4
  43. package/dist/vite.d.cts +2 -2
  44. package/dist/vite.d.mts +1 -1
  45. package/dist/vite.mjs +4 -4
  46. package/dist/webpack.cjs +4 -4
  47. package/dist/webpack.d.cts +2 -1
  48. package/dist/webpack.d.mts +1 -1
  49. package/dist/webpack.mjs +4 -4
  50. package/package.json +19 -9
  51. package/dist/shared/unplugin.B3XoSRB8.mjs +0 -40
  52. package/dist/shared/unplugin.BkRah5Ot.cjs +0 -48
package/README.md CHANGED
@@ -81,9 +81,10 @@ directly to disk; explicit `production.mangle: true` emits a warning.
81
81
 
82
82
  The default parser is `rust`, which runs through the native engine in the
83
83
  matching optional `@csszyx/core-*` platform package. When that package is
84
- missing, csszyx fails loudly instead of silently falling back to another
85
- parser; reinstall to pick up the optional dependency for your platform, or
86
- opt into the JavaScript engine explicitly.
84
+ missing, the default falls back to the WASM engine and says so once; an
85
+ explicit `build.parser: "rust"` fails instead of falling back. Reinstall to
86
+ pick up the optional dependency for your platform, or set
87
+ `build.parser: "wasm"` to choose the WASM engine outright.
87
88
 
88
89
  Per project:
89
90
 
package/dist/index.cjs CHANGED
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const cssMangler = require('./css-mangler.cjs');
6
- const unplugin = require('./shared/unplugin.RGzhYt-D.cjs');
7
- const themeGroupsFile = require('./shared/unplugin.D8BxOOkA.cjs');
6
+ const unplugin = require('./shared/unplugin.BLbrShMZ.cjs');
7
+ const themeGroupsFile = require('./shared/unplugin.C7i0agiO.cjs');
8
8
  const types = require('@csszyx/types');
9
+ const safelistSource = require('./shared/unplugin.KnDCM-sr.cjs');
9
10
  require('postcss');
10
11
  require('postcss-selector-parser');
11
12
  require('node:crypto');
@@ -20,8 +21,7 @@ require('@csszyx/core/native');
20
21
  require('@csszyx/svelte-adapter');
21
22
  require('@csszyx/vue-adapter');
22
23
  require('unplugin');
23
- require('./shared/unplugin.VtXstzEh.cjs');
24
- require('./shared/unplugin.BkRah5Ot.cjs');
24
+ require('./shared/unplugin.DX3rYT4P.cjs');
25
25
  require('node:zlib');
26
26
  require('postcss-value-parser');
27
27
 
@@ -33,17 +33,14 @@ exports.mangleCSS = cssMangler.mangleCSS;
33
33
  exports.mangleCSSSync = cssMangler.mangleCSSSync;
34
34
  exports.unescapeTailwindClass = cssMangler.unescapeTailwindClass;
35
35
  exports.allocateMangleTokens = unplugin.allocateMangleTokens;
36
- exports.appendTailwindSourceDirective = unplugin.appendTailwindSourceDirective;
37
36
  exports.assertNoRSCBoundaryViolation = unplugin.assertNoRSCBoundaryViolation;
38
37
  exports.assertNoRSCGraphViolation = unplugin.assertNoRSCGraphViolation;
39
38
  exports.collectMangleHybridHazards = unplugin.collectMangleHybridHazards;
40
- exports.computeSafelistRelPath = unplugin.computeSafelistRelPath;
41
39
  exports.createGlobalVarAliasValidationOptions = unplugin.createGlobalVarAliasValidationOptions;
42
40
  exports.createGlobalVarMapAssetSource = unplugin.createGlobalVarMapAssetSource;
43
41
  exports.createGlobalVarScanCacheKey = unplugin.createGlobalVarScanCacheKey;
44
42
  exports.createRSCModuleRecord = unplugin.createRSCModuleRecord;
45
43
  exports.cssHasContentScope = unplugin.cssHasContentScope;
46
- exports.cssImportsTailwind = unplugin.cssImportsTailwind;
47
44
  exports.default = unplugin.unplugin;
48
45
  exports.deleteRSCModuleRecord = unplugin.deleteRSCModuleRecord;
49
46
  exports.emitMissingCssFallback = unplugin.emitMissingCssFallback;
@@ -102,3 +99,7 @@ exports.parseUtilityBlocks = themeGroupsFile.parseUtilityBlocks;
102
99
  exports.scanCustomPropertyNames = themeGroupsFile.scanCustomPropertyNames;
103
100
  exports.CSSZYX_GLOBAL_ALIAS_PREFIX = types.CSSZYX_GLOBAL_ALIAS_PREFIX;
104
101
  exports.TAILWIND_RESERVED_PREFIXES = types.TAILWIND_RESERVED_PREFIXES;
102
+ exports.SAFELIST_FILE = safelistSource.SAFELIST_FILE;
103
+ exports.appendTailwindSourceDirective = safelistSource.appendTailwindSourceDirective;
104
+ exports.computeSafelistRelPath = safelistSource.computeSafelistRelPath;
105
+ exports.cssImportsTailwind = safelistSource.cssImportsTailwind;
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.BXYakiXt.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.BHfqCocB.cjs';
4
4
  // @ts-ignore
5
5
  export = undefined;
6
- export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as ParsedUtilities, Q as QuietMode, q as RSCBoundaryViolation, r as RSCModuleRecord, s as allocateMangleTokens, t as appendTailwindSourceDirective, u as assertNoRSCBoundaryViolation, v as assertNoRSCGraphViolation, w as collectMangleHybridHazards, x as computeSafelistRelPath, y as createGlobalVarMapAssetSource, z as createRSCModuleRecord, A as cssHasContentScope, B as cssImportsTailwind, E as deleteRSCModuleRecord, F as emitMissingCssFallback, H as esbuildPlugin, I as extractGlobalVarAliasesForManifest, J as fileMayContainSafelistableSz, K as findLocalImportSources, L as findRSCBoundaryViolation, N as findRSCGraphViolation, O as hasInjectableTailwindCandidate, T as hasTokens, U as hasUseClientDirective, W as hasUseServerDirective, X as isAdvisoryDiagnostic, Y as isCompileSourceOptedIn, Z as isHardIgnoredPath, _ as isMangleableCssId, $ as isMonorepoPackage, a0 as isPackagesSkippedSource, a1 as isRSCServerModule, a2 as lateMangleCensusMessage, a3 as mangleCodeClassesSync, a4 as mangleEligibleClasses, a5 as mangleHybridHazardMessage, a6 as mergeThemes, a7 as missingTailwindEntryMessage, a8 as normalizeGlobalVarAliasesForCache, a9 as parseThemeBlocks, aa as parseUtilityBlocks, ab as realContentHashDisabledMessage, ac as recordGlobalVarSourceFile, ad as resolveCompileSourceDirs, ae as resolveNativeCacheIdentity, af as resolveQuietMode, ag as rollupPlugin, ah as scanCustomPropertyNames, ai as shouldEmitMissingCssFallback, aj as shouldEmitWarning, ak as shouldTrackGlobalVarSources, al as shouldWarnMissingTailwindEntry, am as shouldWarnUnscopedMonorepo, an as skippedSzFilesMessage, ao as suppressedAdvisoryMessage, D as unplugin, ap as unscopedMonorepoMessage, aq as vitePlugin, ar as watchModeMangleMessage, as as webpackPlugin } from './shared/unplugin.BXYakiXt.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 ParsedUtilities, Q as QuietMode, q as RSCBoundaryViolation, r as RSCModuleRecord, s as allocateMangleTokens, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, A as deleteRSCModuleRecord, B as emitMissingCssFallback, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, T as isAdvisoryDiagnostic, U as isCompileSourceOptedIn, W as isHardIgnoredPath, X as isMangleableCssId, Y as isMonorepoPackage, Z as isPackagesSkippedSource, _ as isRSCServerModule, $ as lateMangleCensusMessage, a0 as mangleCodeClassesSync, a1 as mangleEligibleClasses, a2 as mangleHybridHazardMessage, a3 as mergeThemes, a4 as missingTailwindEntryMessage, a5 as normalizeGlobalVarAliasesForCache, a6 as parseThemeBlocks, a7 as parseUtilityBlocks, a8 as realContentHashDisabledMessage, a9 as recordGlobalVarSourceFile, aa as resolveCompileSourceDirs, ab as resolveNativeCacheIdentity, ac as resolveQuietMode, ad as rollupPlugin, ae as scanCustomPropertyNames, af as shouldEmitMissingCssFallback, ag as shouldEmitWarning, ah as shouldTrackGlobalVarSources, ai as shouldWarnMissingTailwindEntry, aj as shouldWarnUnscopedMonorepo, ak as skippedSzFilesMessage, al as suppressedAdvisoryMessage, z as unplugin, am as unscopedMonorepoMessage, an as vitePlugin, ao as watchModeMangleMessage, ap as webpackPlugin } from './shared/unplugin.BHfqCocB.cjs';
7
7
  import 'postcss';
8
8
  import '@csszyx/compiler';
9
9
  import 'esbuild';
@@ -96,4 +96,71 @@ declare function validateGlobalVarAliasInputs(options: ValidateGlobalVarAliasInp
96
96
  */
97
97
  declare function createGlobalVarAliasValidationOptions(input: CreateGlobalVarAliasValidationOptionsInput): ValidateGlobalVarAliasInputsOptions;
98
98
 
99
- export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, isTailwindReservedGlobalVar, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
99
+ /**
100
+ * How a stylesheet is told to read csszyx's safelist: the `@source` directive
101
+ * Tailwind v4 needs, and the checks around adding one.
102
+ *
103
+ * Kept apart from the bundler plugin so the PostCSS entry, which runs inside
104
+ * Next's PostCSS worker, loads only this and not the whole plugin.
105
+ */
106
+ /**
107
+ * The safelist file, relative to the project root. Every producer writes it
108
+ * here by default: the Vite, Rollup and webpack plugins, `csszyx next
109
+ * prebuild` and `csszyx next watch`, and the Next Turbopack loader. It sits
110
+ * in `.csszyx/` with csszyx's other generated state, so one ignore entry
111
+ * covers all of it; Tailwind scans a file named by `@source` even inside an
112
+ * ignored dot-directory.
113
+ */
114
+ declare const SAFELIST_FILE = ".csszyx/csszyx-classes.txt";
115
+ /**
116
+ * Computes the `@source` target path for a CSS module: the location of the
117
+ * generated safelist file relative to the CSS file, in posix form and always
118
+ * `./`- or `../`-prefixed so Tailwind treats it as a relative path.
119
+ *
120
+ * This is the real-world failure surface — a wrong relative path makes Tailwind
121
+ * silently scan nothing (no error, no CSS), the same symptom as a missing
122
+ * directive — so it is extracted and unit-tested rather than left inline.
123
+ *
124
+ * @param rootDir - project root where the safelist file is written.
125
+ * @param safelistFilename - the safelist path under the root (e.g. `.csszyx/csszyx-classes.txt`).
126
+ * @param cssId - absolute path of the CSS module receiving the directive.
127
+ * @returns the posix relative path from the CSS file to the safelist file.
128
+ */
129
+ declare function computeSafelistRelPath(rootDir: string, safelistFilename: string, cssId: string): string;
130
+ /**
131
+ * Appends an `@source "<relPath>";` directive to a CSS module so Tailwind v4
132
+ * scans the csszyx-generated safelist file.
133
+ *
134
+ * `@source` is position-independent in Tailwind v4 — it can appear anywhere in
135
+ * the compiled CSS — so the directive is **appended as its own statement**
136
+ * rather than spliced next to the `@import "tailwindcss…"` line. Matching the
137
+ * import syntax is the source of a real defect: the split / manual Tailwind v4
138
+ * setup (`@import "tailwindcss/utilities.css" layer(…)` or `… source(…)`, or an
139
+ * import without a trailing `;`) does not match an import-anchored regex, so the
140
+ * injection silently no-ops and every csszyx-only class (e.g. the static
141
+ * `bg-primary/50` produced by `sz={{ bg: { color, op } }}`) gets no CSS while a
142
+ * raw `className` still works. Appending is correct for every import form.
143
+ *
144
+ * @param code - CSS module source already known to import tailwindcss.
145
+ * @param relPath - safelist path relative to this CSS file (posix, `./`-prefixed).
146
+ * @returns the code with the directive appended, or `null` if it is already
147
+ * present (idempotent — re-running the transform must not stack directives).
148
+ */
149
+ declare function appendTailwindSourceDirective(code: string, relPath: string): string | null;
150
+ /**
151
+ * Whether a CSS module actually imports the `tailwindcss` package, so the
152
+ * `@source` directive should be appended.
153
+ *
154
+ * Tighter than a substring check on purpose: block comments are stripped first
155
+ * (a commented-out `@import` must not trigger injection), and the package name
156
+ * must end at a quote or a `/` subpath so a different package whose name merely
157
+ * starts with `tailwindcss` (e.g. `tailwindcss-animate`) does not match. Import
158
+ * options after the closing quote (`layer(…)`, `source(…)`) are irrelevant — the
159
+ * match ends at the quote — so every real Tailwind v4 import form is covered.
160
+ *
161
+ * @param code - CSS module source.
162
+ * @returns true if the module imports tailwindcss (exact or a subpath).
163
+ */
164
+ declare function cssImportsTailwind(code: string): boolean;
165
+
166
+ export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, SAFELIST_FILE, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, appendTailwindSourceDirective, computeSafelistRelPath, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, cssImportsTailwind, 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.BXYakiXt.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 ParsedUtilities, Q as QuietMode, q as RSCBoundaryViolation, r as RSCModuleRecord, s as allocateMangleTokens, t as appendTailwindSourceDirective, u as assertNoRSCBoundaryViolation, v as assertNoRSCGraphViolation, w as collectMangleHybridHazards, x as computeSafelistRelPath, y as createGlobalVarMapAssetSource, z as createRSCModuleRecord, A as cssHasContentScope, B as cssImportsTailwind, D as default, E as deleteRSCModuleRecord, F as emitMissingCssFallback, H as esbuildPlugin, I as extractGlobalVarAliasesForManifest, J as fileMayContainSafelistableSz, K as findLocalImportSources, L as findRSCBoundaryViolation, N as findRSCGraphViolation, O as hasInjectableTailwindCandidate, T as hasTokens, U as hasUseClientDirective, W as hasUseServerDirective, X as isAdvisoryDiagnostic, Y as isCompileSourceOptedIn, Z as isHardIgnoredPath, _ as isMangleableCssId, $ as isMonorepoPackage, a0 as isPackagesSkippedSource, a1 as isRSCServerModule, a2 as lateMangleCensusMessage, a3 as mangleCodeClassesSync, a4 as mangleEligibleClasses, a5 as mangleHybridHazardMessage, a6 as mergeThemes, a7 as missingTailwindEntryMessage, a8 as normalizeGlobalVarAliasesForCache, a9 as parseThemeBlocks, aa as parseUtilityBlocks, ab as realContentHashDisabledMessage, ac as recordGlobalVarSourceFile, ad as resolveCompileSourceDirs, ae as resolveNativeCacheIdentity, af as resolveQuietMode, ag as rollupPlugin, ah as scanCustomPropertyNames, ai as shouldEmitMissingCssFallback, aj as shouldEmitWarning, ak as shouldTrackGlobalVarSources, al as shouldWarnMissingTailwindEntry, am as shouldWarnUnscopedMonorepo, an as skippedSzFilesMessage, ao as suppressedAdvisoryMessage, D as unplugin, ap as unscopedMonorepoMessage, aq as vitePlugin, ar as watchModeMangleMessage, as as webpackPlugin } from './shared/unplugin.BXYakiXt.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.BHfqCocB.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 ParsedUtilities, Q as QuietMode, q as RSCBoundaryViolation, r as RSCModuleRecord, s as allocateMangleTokens, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as default, A as deleteRSCModuleRecord, B as emitMissingCssFallback, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, T as isAdvisoryDiagnostic, U as isCompileSourceOptedIn, W as isHardIgnoredPath, X as isMangleableCssId, Y as isMonorepoPackage, Z as isPackagesSkippedSource, _ as isRSCServerModule, $ as lateMangleCensusMessage, a0 as mangleCodeClassesSync, a1 as mangleEligibleClasses, a2 as mangleHybridHazardMessage, a3 as mergeThemes, a4 as missingTailwindEntryMessage, a5 as normalizeGlobalVarAliasesForCache, a6 as parseThemeBlocks, a7 as parseUtilityBlocks, a8 as realContentHashDisabledMessage, a9 as recordGlobalVarSourceFile, aa as resolveCompileSourceDirs, ab as resolveNativeCacheIdentity, ac as resolveQuietMode, ad as rollupPlugin, ae as scanCustomPropertyNames, af as shouldEmitMissingCssFallback, ag as shouldEmitWarning, ah as shouldTrackGlobalVarSources, ai as shouldWarnMissingTailwindEntry, aj as shouldWarnUnscopedMonorepo, ak as skippedSzFilesMessage, al as suppressedAdvisoryMessage, z as unplugin, am as unscopedMonorepoMessage, an as vitePlugin, ao as watchModeMangleMessage, ap as webpackPlugin } from './shared/unplugin.BHfqCocB.mjs';
5
5
  import 'postcss';
6
6
  import '@csszyx/compiler';
7
7
  import 'esbuild';
@@ -94,4 +94,71 @@ declare function validateGlobalVarAliasInputs(options: ValidateGlobalVarAliasInp
94
94
  */
95
95
  declare function createGlobalVarAliasValidationOptions(input: CreateGlobalVarAliasValidationOptionsInput): ValidateGlobalVarAliasInputsOptions;
96
96
 
97
- export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, isTailwindReservedGlobalVar, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
97
+ /**
98
+ * How a stylesheet is told to read csszyx's safelist: the `@source` directive
99
+ * Tailwind v4 needs, and the checks around adding one.
100
+ *
101
+ * Kept apart from the bundler plugin so the PostCSS entry, which runs inside
102
+ * Next's PostCSS worker, loads only this and not the whole plugin.
103
+ */
104
+ /**
105
+ * The safelist file, relative to the project root. Every producer writes it
106
+ * here by default: the Vite, Rollup and webpack plugins, `csszyx next
107
+ * prebuild` and `csszyx next watch`, and the Next Turbopack loader. It sits
108
+ * in `.csszyx/` with csszyx's other generated state, so one ignore entry
109
+ * covers all of it; Tailwind scans a file named by `@source` even inside an
110
+ * ignored dot-directory.
111
+ */
112
+ declare const SAFELIST_FILE = ".csszyx/csszyx-classes.txt";
113
+ /**
114
+ * Computes the `@source` target path for a CSS module: the location of the
115
+ * generated safelist file relative to the CSS file, in posix form and always
116
+ * `./`- or `../`-prefixed so Tailwind treats it as a relative path.
117
+ *
118
+ * This is the real-world failure surface — a wrong relative path makes Tailwind
119
+ * silently scan nothing (no error, no CSS), the same symptom as a missing
120
+ * directive — so it is extracted and unit-tested rather than left inline.
121
+ *
122
+ * @param rootDir - project root where the safelist file is written.
123
+ * @param safelistFilename - the safelist path under the root (e.g. `.csszyx/csszyx-classes.txt`).
124
+ * @param cssId - absolute path of the CSS module receiving the directive.
125
+ * @returns the posix relative path from the CSS file to the safelist file.
126
+ */
127
+ declare function computeSafelistRelPath(rootDir: string, safelistFilename: string, cssId: string): string;
128
+ /**
129
+ * Appends an `@source "<relPath>";` directive to a CSS module so Tailwind v4
130
+ * scans the csszyx-generated safelist file.
131
+ *
132
+ * `@source` is position-independent in Tailwind v4 — it can appear anywhere in
133
+ * the compiled CSS — so the directive is **appended as its own statement**
134
+ * rather than spliced next to the `@import "tailwindcss…"` line. Matching the
135
+ * import syntax is the source of a real defect: the split / manual Tailwind v4
136
+ * setup (`@import "tailwindcss/utilities.css" layer(…)` or `… source(…)`, or an
137
+ * import without a trailing `;`) does not match an import-anchored regex, so the
138
+ * injection silently no-ops and every csszyx-only class (e.g. the static
139
+ * `bg-primary/50` produced by `sz={{ bg: { color, op } }}`) gets no CSS while a
140
+ * raw `className` still works. Appending is correct for every import form.
141
+ *
142
+ * @param code - CSS module source already known to import tailwindcss.
143
+ * @param relPath - safelist path relative to this CSS file (posix, `./`-prefixed).
144
+ * @returns the code with the directive appended, or `null` if it is already
145
+ * present (idempotent — re-running the transform must not stack directives).
146
+ */
147
+ declare function appendTailwindSourceDirective(code: string, relPath: string): string | null;
148
+ /**
149
+ * Whether a CSS module actually imports the `tailwindcss` package, so the
150
+ * `@source` directive should be appended.
151
+ *
152
+ * Tighter than a substring check on purpose: block comments are stripped first
153
+ * (a commented-out `@import` must not trigger injection), and the package name
154
+ * must end at a quote or a `/` subpath so a different package whose name merely
155
+ * starts with `tailwindcss` (e.g. `tailwindcss-animate`) does not match. Import
156
+ * options after the closing quote (`layer(…)`, `source(…)`) are irrelevant — the
157
+ * match ends at the quote — so every real Tailwind v4 import form is covered.
158
+ *
159
+ * @param code - CSS module source.
160
+ * @returns true if the module imports tailwindcss (exact or a subpath).
161
+ */
162
+ declare function cssImportsTailwind(code: string): boolean;
163
+
164
+ export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, SAFELIST_FILE, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, appendTailwindSourceDirective, computeSafelistRelPath, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, cssImportsTailwind, isTailwindReservedGlobalVar, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as allocateMangleTokens, b as appendTailwindSourceDirective, c as assertNoRSCBoundaryViolation, d as assertNoRSCGraphViolation, e as collectMangleHybridHazards, f as computeSafelistRelPath, g as createGlobalVarAliasValidationOptions, h as createGlobalVarMapAssetSource, i as createGlobalVarScanCacheKey, j as createRSCModuleRecord, k as cssHasContentScope, l as cssImportsTailwind, u as default, m as deleteRSCModuleRecord, n as emitMissingCssFallback, o as esbuildPlugin, p as extractGlobalVarAliasesForManifest, q as fileMayContainSafelistableSz, r as findLocalImportSources, s as findRSCBoundaryViolation, t as findRSCGraphViolation, v as hasInjectableTailwindCandidate, w as hasUseClientDirective, x as hasUseServerDirective, y as isAdvisoryDiagnostic, z as isCompileSourceOptedIn, A as isHardIgnoredPath, B as isMangleableCssId, C as isMonorepoPackage, D as isPackagesSkippedSource, E as isRSCServerModule, F as isTailwindReservedGlobalVar, G as lateMangleCensusMessage, H as mangleCodeClassesSync, I as mangleEligibleClasses, J as mangleHybridHazardMessage, K as missingTailwindEntryMessage, L as normalizeGlobalVarAliasesForCache, M as planGlobalVarAliases, N as readGlobalVarScanCache, O as realContentHashDisabledMessage, P as recordGlobalVarSourceFile, Q as resolveCompileSourceDirs, R as resolveGlobalVarScanCacheDir, S as resolveNativeCacheIdentity, T as resolveQuietMode, U as rewriteGlobalVarCssAliases, V as rollupPlugin, W as scanGlobalVarCss, X as shouldEmitMissingCssFallback, Y as shouldEmitWarning, Z as shouldTrackGlobalVarSources, _ as shouldWarnMissingTailwindEntry, $ as shouldWarnUnscopedMonorepo, a0 as skippedSzFilesMessage, a1 as suppressedAdvisoryMessage, u as unplugin, a2 as unscopedMonorepoMessage, a3 as validateGlobalVarAliasInputs, a4 as vitePlugin, a5 as watchModeMangleMessage, a6 as webpackPlugin, a7 as writeGlobalVarScanCache } from './shared/unplugin.BnRf0Tvd.mjs';
3
- export { h as hasTokens, m as mergeThemes, p as parseThemeBlocks, a as parseUtilityBlocks, s as scanCustomPropertyNames } from './shared/unplugin.BZPdvVcj.mjs';
2
+ export { a as allocateMangleTokens, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as createGlobalVarAliasValidationOptions, f as createGlobalVarMapAssetSource, g as createGlobalVarScanCacheKey, h as createRSCModuleRecord, i as cssHasContentScope, u as default, j as deleteRSCModuleRecord, k as emitMissingCssFallback, l as esbuildPlugin, m as extractGlobalVarAliasesForManifest, n as fileMayContainSafelistableSz, o as findLocalImportSources, p as findRSCBoundaryViolation, q as findRSCGraphViolation, r as hasInjectableTailwindCandidate, s as hasUseClientDirective, t as hasUseServerDirective, v as isAdvisoryDiagnostic, w as isCompileSourceOptedIn, x as isHardIgnoredPath, y as isMangleableCssId, z as isMonorepoPackage, A as isPackagesSkippedSource, B as isRSCServerModule, C as isTailwindReservedGlobalVar, D as lateMangleCensusMessage, E as mangleCodeClassesSync, F as mangleEligibleClasses, G as mangleHybridHazardMessage, H as missingTailwindEntryMessage, I as normalizeGlobalVarAliasesForCache, J as planGlobalVarAliases, K as readGlobalVarScanCache, L as realContentHashDisabledMessage, M as recordGlobalVarSourceFile, N as resolveCompileSourceDirs, O as resolveGlobalVarScanCacheDir, P as resolveNativeCacheIdentity, Q as resolveQuietMode, R as rewriteGlobalVarCssAliases, S as rollupPlugin, T as scanGlobalVarCss, U as shouldEmitMissingCssFallback, V as shouldEmitWarning, W as shouldTrackGlobalVarSources, X as shouldWarnMissingTailwindEntry, Y as shouldWarnUnscopedMonorepo, Z as skippedSzFilesMessage, _ as suppressedAdvisoryMessage, u as unplugin, $ as unscopedMonorepoMessage, a0 as validateGlobalVarAliasInputs, a1 as vitePlugin, a2 as watchModeMangleMessage, a3 as webpackPlugin, a4 as writeGlobalVarScanCache } from './shared/unplugin.BGufkSFT.mjs';
3
+ export { h as hasTokens, m as mergeThemes, p as parseThemeBlocks, a as parseUtilityBlocks, s as scanCustomPropertyNames } from './shared/unplugin.BourSpnZ.mjs';
4
4
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
5
+ export { S as SAFELIST_FILE, a as appendTailwindSourceDirective, c as computeSafelistRelPath, b as cssImportsTailwind } from './shared/unplugin.CqJS0BbD.mjs';
5
6
  import 'postcss';
6
7
  import 'postcss-selector-parser';
7
8
  import 'node:crypto';
@@ -16,7 +17,6 @@ import '@csszyx/core/native';
16
17
  import '@csszyx/svelte-adapter';
17
18
  import '@csszyx/vue-adapter';
18
19
  import 'unplugin';
19
- import './shared/unplugin.NlPvn5P4.mjs';
20
- import './shared/unplugin.B3XoSRB8.mjs';
20
+ import './shared/unplugin.AGR7mihU.mjs';
21
21
  import 'node:zlib';
22
22
  import 'postcss-value-parser';
@@ -25,7 +25,7 @@ interface CsszyxTurbopackOptions {
25
25
  * Defaults to `'rust'` (the shipped default). */
26
26
  parserMode?: 'rust' | 'wasm';
27
27
  /**
28
- * Safelist HTML path Tailwind `@source` reads. Must match the
28
+ * Safelist path Tailwind `@source` reads. Must match the
29
29
  * `csszyx next prebuild --output-file` / `csszyx next watch` path.
30
30
  */
31
31
  safelistOutputFile?: string;
@@ -64,7 +64,6 @@ interface TurbopackConfig {
64
64
  * export default {
65
65
  * turbopack: csszyxTurbopack(
66
66
  * { resolveAlias: { 'maplibre-gl': 'maplibre-gl/dist/maplibre-gl.js' } },
67
- * { safelistOutputFile: '.csszyx/next-loader-classes.html' },
68
67
  * ),
69
68
  * };
70
69
  */
@@ -25,7 +25,7 @@ interface CsszyxTurbopackOptions {
25
25
  * Defaults to `'rust'` (the shipped default). */
26
26
  parserMode?: 'rust' | 'wasm';
27
27
  /**
28
- * Safelist HTML path Tailwind `@source` reads. Must match the
28
+ * Safelist path Tailwind `@source` reads. Must match the
29
29
  * `csszyx next prebuild --output-file` / `csszyx next watch` path.
30
30
  */
31
31
  safelistOutputFile?: string;
@@ -64,7 +64,6 @@ interface TurbopackConfig {
64
64
  * export default {
65
65
  * turbopack: csszyxTurbopack(
66
66
  * { resolveAlias: { 'maplibre-gl': 'maplibre-gl/dist/maplibre-gl.js' } },
67
- * { safelistOutputFile: '.csszyx/next-loader-classes.html' },
68
67
  * ),
69
68
  * };
70
69
  */
@@ -3,12 +3,12 @@
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.DVbPNK3W.cjs');
7
- const nextWatcherCycle = require('./shared/unplugin.Cji6O5jv.cjs');
8
- const transformCache = require('./shared/unplugin.VtXstzEh.cjs');
6
+ const nextTransformMetadata = require('./shared/unplugin.BbBYWFGT.cjs');
7
+ const nextWatcherCycle = require('./shared/unplugin.Dai5wlZ3.cjs');
8
+ const safelistSource = require('./shared/unplugin.KnDCM-sr.cjs');
9
+ const transformCache = require('./shared/unplugin.DX3rYT4P.cjs');
9
10
  require('@csszyx/compiler');
10
11
  require('@csszyx/types');
11
- require('./shared/unplugin.BkRah5Ot.cjs');
12
12
  require('node:os');
13
13
  require('proper-lockfile');
14
14
 
@@ -48,6 +48,10 @@ function runNextPrebuild(options) {
48
48
  nativeVersion,
49
49
  mode: options.mode ?? "production"
50
50
  });
51
+ const postcssConfig = safelistSource.findPostcssConfigWithoutCsszyx(context.root);
52
+ if (postcssConfig !== null) {
53
+ (options.warn ?? console.warn)(safelistSource.missingPostcssPluginMessage(postcssConfig));
54
+ }
51
55
  const cacheRoot = transformCache.resolveTransformCacheDir(
52
56
  context.root,
53
57
  path__namespace.relative(context.root, context.cacheDir)
@@ -149,7 +153,7 @@ function uniqueFiles(files) {
149
153
  return result;
150
154
  }
151
155
  function createShardCacheKey(context, metadata) {
152
- return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(transformCache.normalizePathSeparators(path__namespace.relative(context.root, metadata.sourcePath))).digest("hex");
156
+ return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(safelistSource.normalizePathSeparators(path__namespace.relative(context.root, metadata.sourcePath))).digest("hex");
153
157
  }
154
158
 
155
159
  exports.runNextPrebuild = runNextPrebuild;
@@ -1,11 +1,13 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
- import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.cjs';
2
+ import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.C2ilavL1.cjs';
3
3
  import { N as NextSourceTransformOutput, a as NextSourceParserMode } from './shared/unplugin.B32Exn-K.cjs';
4
- import { N as NextWatcherCycleResult } from './shared/unplugin.xeED_qwh.cjs';
4
+ import { N as NextWatcherCycleResult } from './shared/unplugin.CXCaQ3-s.cjs';
5
5
 
6
6
  /** Serializable options accepted by the Next Turbopack csszyx prebuild core. */
7
7
  interface NextPrebuildOptions {
8
8
  files: readonly string[];
9
+ /** Receives the one-line notices a prebuild has for the maintainer; `console.warn` by default. */
10
+ warn?: (message: string) => void;
9
11
  explicitRoot?: string;
10
12
  loaderRootContext?: string;
11
13
  loaderContext?: string;
@@ -1,11 +1,13 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
- import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.mjs';
2
+ import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.C2ilavL1.mjs';
3
3
  import { N as NextSourceTransformOutput, a as NextSourceParserMode } from './shared/unplugin.B32Exn-K.mjs';
4
- import { N as NextWatcherCycleResult } from './shared/unplugin.CdZxp0x-.mjs';
4
+ import { N as NextWatcherCycleResult } from './shared/unplugin.CbNydVwv.mjs';
5
5
 
6
6
  /** Serializable options accepted by the Next Turbopack csszyx prebuild core. */
7
7
  interface NextPrebuildOptions {
8
8
  files: readonly string[];
9
+ /** Receives the one-line notices a prebuild has for the maintainer; `console.warn` by default. */
10
+ warn?: (message: string) => void;
9
11
  explicitRoot?: string;
10
12
  loaderRootContext?: string;
11
13
  loaderContext?: string;
@@ -1,12 +1,12 @@
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, c as configWithImportedStaticSz, a as resolveNextCrossModule, t as transformNextSource, w as withCrossModuleStatics, b as collectNextTransformMetadata, d as createNextSafelistShardFromMetadata } from './shared/unplugin.DN95k991.mjs';
5
- import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.BU0O4IkX.mjs';
6
- import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.NlPvn5P4.mjs';
4
+ import { r as readPackageVersion, c as configWithImportedStaticSz, a as resolveNextCrossModule, t as transformNextSource, w as withCrossModuleStatics, b as collectNextTransformMetadata, d as createNextSafelistShardFromMetadata } from './shared/unplugin.Dbc26ty6.mjs';
5
+ import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.DmCOQc-b.mjs';
6
+ import { f as findPostcssConfigWithoutCsszyx, m as missingPostcssPluginMessage, n as normalizePathSeparators } from './shared/unplugin.CqJS0BbD.mjs';
7
+ import { r as resolveTransformCacheDir } from './shared/unplugin.AGR7mihU.mjs';
7
8
  import '@csszyx/compiler';
8
9
  import '@csszyx/types';
9
- import './shared/unplugin.B3XoSRB8.mjs';
10
10
  import 'node:os';
11
11
  import 'proper-lockfile';
12
12
 
@@ -31,6 +31,10 @@ function runNextPrebuild(options) {
31
31
  nativeVersion,
32
32
  mode: options.mode ?? "production"
33
33
  });
34
+ const postcssConfig = findPostcssConfigWithoutCsszyx(context.root);
35
+ if (postcssConfig !== null) {
36
+ (options.warn ?? console.warn)(missingPostcssPluginMessage(postcssConfig));
37
+ }
34
38
  const cacheRoot = resolveTransformCacheDir(
35
39
  context.root,
36
40
  path.relative(context.root, context.cacheDir)
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const node_crypto = require('node:crypto');
6
6
  const path = require('node:path');
7
- const themeGroupsFile = require('./shared/unplugin.D8BxOOkA.cjs');
8
- const nextTransformMetadata = require('./shared/unplugin.DVbPNK3W.cjs');
9
- const nextWatcherCycle = require('./shared/unplugin.Cji6O5jv.cjs');
10
- const transformCache = require('./shared/unplugin.VtXstzEh.cjs');
7
+ const themeGroupsFile = require('./shared/unplugin.C7i0agiO.cjs');
8
+ const nextTransformMetadata = require('./shared/unplugin.BbBYWFGT.cjs');
9
+ const nextWatcherCycle = require('./shared/unplugin.Dai5wlZ3.cjs');
10
+ const safelistSource = require('./shared/unplugin.KnDCM-sr.cjs');
11
+ const transformCache = require('./shared/unplugin.DX3rYT4P.cjs');
11
12
  require('node:fs');
12
- require('./shared/unplugin.BkRah5Ot.cjs');
13
13
  require('@csszyx/compiler');
14
14
  require('@csszyx/types');
15
15
  require('node:os');
@@ -92,15 +92,21 @@ function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
92
92
  );
93
93
  const shardPath = shardResult.filePath;
94
94
  if (options.materializeSafelist !== false && shardResult.changed) {
95
- nextWatcherCycle.runNextWatcherCycle(context, {
96
- writeOptions: options.writeOptions,
97
- lockOptions: {
98
- root: context.root,
99
- mode: context.manifestExpectation.mode,
100
- command: "csszyx next turbo-loader"
95
+ try {
96
+ nextWatcherCycle.runNextWatcherCycle(context, {
97
+ writeOptions: options.writeOptions,
98
+ lockOptions: {
99
+ root: context.root,
100
+ mode: context.manifestExpectation.mode,
101
+ command: "csszyx next turbo-loader"
102
+ }
103
+ });
104
+ materialized = true;
105
+ } catch (error) {
106
+ if (!(error instanceof nextWatcherCycle.NextSafelistStateLockedError) || error.holder.command !== nextWatcherCycle.NEXT_WATCH_LOCK_COMMAND) {
107
+ throw error;
101
108
  }
102
- });
103
- materialized = true;
109
+ }
104
110
  }
105
111
  return {
106
112
  code,
@@ -186,7 +192,7 @@ function hasEnabledMangleVars(config) {
186
192
  return config.mangleVars === true;
187
193
  }
188
194
  function createShardCacheKey(context, metadata) {
189
- return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(transformCache.normalizePathSeparators(path__namespace.relative(context.root, metadata.sourcePath))).digest("hex");
195
+ return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(safelistSource.normalizePathSeparators(path__namespace.relative(context.root, metadata.sourcePath))).digest("hex");
190
196
  }
191
197
 
192
198
  exports.default = nextTurboLoader;
@@ -1,5 +1,5 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
- import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.cjs';
2
+ import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.C2ilavL1.cjs';
3
3
  import { a as NextSourceParserMode, N as NextSourceTransformOutput } from './shared/unplugin.B32Exn-K.cjs';
4
4
 
5
5
  /** Serializable options accepted by the Next Turbopack csszyx loader. */
@@ -1,5 +1,5 @@
1
1
  import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
- import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.mjs';
2
+ import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.C2ilavL1.mjs';
3
3
  import { a as NextSourceParserMode, N as NextSourceTransformOutput } from './shared/unplugin.B32Exn-K.mjs';
4
4
 
5
5
  /** Serializable options accepted by the Next Turbopack csszyx loader. */
@@ -1,11 +1,11 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import * as path from 'node:path';
3
- import { i as injectNextRuntimeImports, e as ensureThemeGroupsFile, b as insertAfterUseDirective, t as themeGroupsSpecifier } from './shared/unplugin.BZPdvVcj.mjs';
4
- import { r as readPackageVersion, c as configWithImportedStaticSz, a as resolveNextCrossModule, t as transformNextSource, w as withCrossModuleStatics, n as normalizeProviderPaths, b as collectNextTransformMetadata, d as createNextSafelistShardFromMetadata } from './shared/unplugin.DN95k991.mjs';
5
- import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle, v as validateNextGenerationManifest, a as readNextGenerationManifest } from './shared/unplugin.BU0O4IkX.mjs';
6
- import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.NlPvn5P4.mjs';
3
+ import { i as injectNextRuntimeImports, e as ensureThemeGroupsFile, b as insertAfterUseDirective, t as themeGroupsSpecifier } from './shared/unplugin.BourSpnZ.mjs';
4
+ import { r as readPackageVersion, c as configWithImportedStaticSz, a as resolveNextCrossModule, t as transformNextSource, w as withCrossModuleStatics, n as normalizeProviderPaths, b as collectNextTransformMetadata, d as createNextSafelistShardFromMetadata } from './shared/unplugin.Dbc26ty6.mjs';
5
+ import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle, N as NextSafelistStateLockedError, a as NEXT_WATCH_LOCK_COMMAND, v as validateNextGenerationManifest, b as readNextGenerationManifest } from './shared/unplugin.DmCOQc-b.mjs';
6
+ import { n as normalizePathSeparators } from './shared/unplugin.CqJS0BbD.mjs';
7
+ import { r as resolveTransformCacheDir } from './shared/unplugin.AGR7mihU.mjs';
7
8
  import 'node:fs';
8
- import './shared/unplugin.B3XoSRB8.mjs';
9
9
  import '@csszyx/compiler';
10
10
  import '@csszyx/types';
11
11
  import 'node:os';
@@ -73,15 +73,21 @@ function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
73
73
  );
74
74
  const shardPath = shardResult.filePath;
75
75
  if (options.materializeSafelist !== false && shardResult.changed) {
76
- runNextWatcherCycle(context, {
77
- writeOptions: options.writeOptions,
78
- lockOptions: {
79
- root: context.root,
80
- mode: context.manifestExpectation.mode,
81
- command: "csszyx next turbo-loader"
76
+ try {
77
+ runNextWatcherCycle(context, {
78
+ writeOptions: options.writeOptions,
79
+ lockOptions: {
80
+ root: context.root,
81
+ mode: context.manifestExpectation.mode,
82
+ command: "csszyx next turbo-loader"
83
+ }
84
+ });
85
+ materialized = true;
86
+ } catch (error) {
87
+ if (!(error instanceof NextSafelistStateLockedError) || error.holder.command !== NEXT_WATCH_LOCK_COMMAND) {
88
+ throw error;
82
89
  }
83
- });
84
- materialized = true;
90
+ }
85
91
  }
86
92
  return {
87
93
  code,
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('node:path');
4
- const nextWatcherCycle = require('./shared/unplugin.Cji6O5jv.cjs');
4
+ const nextWatcherCycle = require('./shared/unplugin.Dai5wlZ3.cjs');
5
5
  require('node:fs');
6
6
  require('node:crypto');
7
7
  require('node:os');
8
8
  require('proper-lockfile');
9
- require('./shared/unplugin.BkRah5Ot.cjs');
9
+ require('./shared/unplugin.KnDCM-sr.cjs');
10
10
 
11
11
  function _interopNamespaceCompat(e) {
12
12
  if (e && typeof e === 'object' && 'default' in e) return e;
@@ -1,5 +1,5 @@
1
- import { N as NextStateContext } from './shared/unplugin.CPEWNSA0.cjs';
2
- import { a as NextWatcherCycleOptions, N as NextWatcherCycleResult } from './shared/unplugin.xeED_qwh.cjs';
1
+ import { N as NextStateContext } from './shared/unplugin.C2ilavL1.cjs';
2
+ import { a as NextWatcherCycleOptions, N as NextWatcherCycleResult } from './shared/unplugin.CXCaQ3-s.cjs';
3
3
 
4
4
  /**
5
5
  *
@@ -1,5 +1,5 @@
1
- import { N as NextStateContext } from './shared/unplugin.CPEWNSA0.mjs';
2
- import { a as NextWatcherCycleOptions, N as NextWatcherCycleResult } from './shared/unplugin.CdZxp0x-.mjs';
1
+ import { N as NextStateContext } from './shared/unplugin.C2ilavL1.mjs';
2
+ import { a as NextWatcherCycleOptions, N as NextWatcherCycleResult } from './shared/unplugin.CbNydVwv.mjs';
3
3
 
4
4
  /**
5
5
  *
@@ -1,10 +1,10 @@
1
1
  import * as path from 'node:path';
2
- import { r as runNextWatcherCycle } from './shared/unplugin.BU0O4IkX.mjs';
2
+ import { r as runNextWatcherCycle } from './shared/unplugin.DmCOQc-b.mjs';
3
3
  import 'node:fs';
4
4
  import 'node:crypto';
5
5
  import 'node:os';
6
6
  import 'proper-lockfile';
7
- import './shared/unplugin.B3XoSRB8.mjs';
7
+ import './shared/unplugin.CqJS0BbD.mjs';
8
8
 
9
9
  class NextWatcherLoop {
10
10
  context;