@csszyx/unplugin 0.9.0 → 0.9.1

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 (43) hide show
  1. package/dist/index.cjs +19 -2
  2. package/dist/index.d.cts +91 -5
  3. package/dist/index.d.mts +90 -3
  4. package/dist/index.mjs +4 -2
  5. package/dist/next-prebuild.cjs +148 -0
  6. package/dist/next-prebuild.d.cts +66 -0
  7. package/dist/next-prebuild.d.mts +66 -0
  8. package/dist/next-prebuild.mjs +131 -0
  9. package/dist/next-turbo-loader.cjs +210 -0
  10. package/dist/next-turbo-loader.d.cts +68 -0
  11. package/dist/next-turbo-loader.d.mts +66 -0
  12. package/dist/next-turbo-loader.mjs +190 -0
  13. package/dist/next-watcher.cjs +237 -0
  14. package/dist/next-watcher.d.cts +106 -0
  15. package/dist/next-watcher.d.mts +106 -0
  16. package/dist/next-watcher.mjs +219 -0
  17. package/dist/shared/unplugin.8er8o6rn.mjs +276 -0
  18. package/dist/shared/unplugin.B_U4rZvG.cjs +281 -0
  19. package/dist/shared/{unplugin.BEOG6ePC.mjs → unplugin.BbtspS8t.mjs} +1436 -324
  20. package/dist/shared/unplugin.BceVw1eW.mjs +184 -0
  21. package/dist/shared/unplugin.BtQzlC2C.mjs +567 -0
  22. package/dist/shared/{unplugin.CL0F6RZa.cjs → unplugin.CFp386gH.cjs} +1456 -327
  23. package/dist/shared/unplugin.CPEWNSA0.d.cts +77 -0
  24. package/dist/shared/unplugin.CPEWNSA0.d.mts +77 -0
  25. package/dist/shared/unplugin.CScQRdTp.d.cts +15 -0
  26. package/dist/shared/unplugin.CScQRdTp.d.mts +15 -0
  27. package/dist/shared/unplugin.CdZxp0x-.d.mts +16 -0
  28. package/dist/shared/unplugin.DLrBgECN.d.cts +282 -0
  29. package/dist/shared/unplugin.DLrBgECN.d.mts +282 -0
  30. package/dist/shared/unplugin.DUxdYaSG.cjs +205 -0
  31. package/dist/shared/unplugin.s62yJbu1.cjs +591 -0
  32. package/dist/shared/unplugin.xeED_qwh.d.cts +16 -0
  33. package/dist/vite.cjs +3 -1
  34. package/dist/vite.d.cts +2 -1
  35. package/dist/vite.d.mts +2 -1
  36. package/dist/vite.mjs +3 -1
  37. package/dist/webpack.cjs +3 -1
  38. package/dist/webpack.d.cts +2 -1
  39. package/dist/webpack.d.mts +2 -1
  40. package/dist/webpack.mjs +3 -1
  41. package/package.json +41 -8
  42. package/dist/shared/unplugin.DUbr5w-N.d.cts +0 -49
  43. package/dist/shared/unplugin.DUbr5w-N.d.mts +0 -49
package/dist/index.cjs CHANGED
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const cssMangler = require('./css-mangler.cjs');
6
- const unplugin = require('./shared/unplugin.CL0F6RZa.cjs');
6
+ const unplugin = require('./shared/unplugin.CFp386gH.cjs');
7
+ const types = require('@csszyx/types');
7
8
  require('postcss');
8
9
  require('postcss-selector-parser');
9
10
  require('node:fs');
@@ -14,10 +15,11 @@ require('node:url');
14
15
  require('@csszyx/compiler');
15
16
  require('@csszyx/core');
16
17
  require('@csszyx/svelte-adapter');
17
- require('@csszyx/types');
18
18
  require('@csszyx/vue-adapter');
19
19
  require('unplugin');
20
20
  require('node:crypto');
21
+ require('./shared/unplugin.DUxdYaSG.cjs');
22
+ require('postcss-value-parser');
21
23
 
22
24
 
23
25
 
@@ -28,20 +30,35 @@ exports.mangleCSSSync = cssMangler.mangleCSSSync;
28
30
  exports.unescapeTailwindClass = cssMangler.unescapeTailwindClass;
29
31
  exports.assertNoRSCBoundaryViolation = unplugin.assertNoRSCBoundaryViolation;
30
32
  exports.assertNoRSCGraphViolation = unplugin.assertNoRSCGraphViolation;
33
+ exports.createGlobalVarAliasValidationOptions = unplugin.createGlobalVarAliasValidationOptions;
34
+ exports.createGlobalVarMapAssetSource = unplugin.createGlobalVarMapAssetSource;
35
+ exports.createGlobalVarScanCacheKey = unplugin.createGlobalVarScanCacheKey;
31
36
  exports.createRSCModuleRecord = unplugin.createRSCModuleRecord;
32
37
  exports.default = unplugin.unplugin;
33
38
  exports.deleteRSCModuleRecord = unplugin.deleteRSCModuleRecord;
34
39
  exports.esbuildPlugin = unplugin.esbuildPlugin;
40
+ exports.extractGlobalVarAliasesForManifest = unplugin.extractGlobalVarAliasesForManifest;
35
41
  exports.findRSCBoundaryViolation = unplugin.findRSCBoundaryViolation;
36
42
  exports.findRSCGraphViolation = unplugin.findRSCGraphViolation;
37
43
  exports.hasTokens = unplugin.hasTokens;
38
44
  exports.hasUseClientDirective = unplugin.hasUseClientDirective;
39
45
  exports.hasUseServerDirective = unplugin.hasUseServerDirective;
40
46
  exports.isRSCServerModule = unplugin.isRSCServerModule;
47
+ exports.isTailwindReservedGlobalVar = unplugin.isTailwindReservedGlobalVar;
41
48
  exports.mangleCodeClassesSync = unplugin.mangleCodeClassesSync;
42
49
  exports.mergeThemes = unplugin.mergeThemes;
50
+ exports.normalizeGlobalVarAliasesForCache = unplugin.normalizeGlobalVarAliasesForCache;
43
51
  exports.parseThemeBlocks = unplugin.parseThemeBlocks;
52
+ exports.planGlobalVarAliases = unplugin.planGlobalVarAliases;
53
+ exports.readGlobalVarScanCache = unplugin.readGlobalVarScanCache;
54
+ exports.resolveGlobalVarScanCacheDir = unplugin.resolveGlobalVarScanCacheDir;
55
+ exports.rewriteGlobalVarCssAliases = unplugin.rewriteGlobalVarCssAliases;
44
56
  exports.rollupPlugin = unplugin.rollupPlugin;
57
+ exports.scanGlobalVarCss = unplugin.scanGlobalVarCss;
45
58
  exports.unplugin = unplugin.unplugin;
59
+ exports.validateGlobalVarAliasInputs = unplugin.validateGlobalVarAliasInputs;
46
60
  exports.vitePlugin = unplugin.vitePlugin;
47
61
  exports.webpackPlugin = unplugin.webpackPlugin;
62
+ exports.writeGlobalVarScanCache = unplugin.writeGlobalVarScanCache;
63
+ exports.CSSZYX_GLOBAL_ALIAS_PREFIX = types.CSSZYX_GLOBAL_ALIAS_PREFIX;
64
+ exports.TAILWIND_RESERVED_PREFIXES = types.TAILWIND_RESERVED_PREFIXES;
package/dist/index.d.cts CHANGED
@@ -1,15 +1,101 @@
1
- import _default from './shared/unplugin.DUbr5w-N.cjs';
2
1
  export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.cjs';
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.DLrBgECN.cjs';
3
4
  // @ts-ignore
4
- export = _default;
5
- export { e as esbuildPlugin, m as mangleCodeClassesSync, r as rollupPlugin, u as unplugin, v as vitePlugin, w as webpackPlugin } from './shared/unplugin.DUbr5w-N.cjs';
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 createGlobalVarMapAssetSource, p as esbuildPlugin, q as extractGlobalVarAliasesForManifest, r as mangleCodeClassesSync, s as normalizeGlobalVarAliasesForCache, t as rollupPlugin, u as unplugin, v as vitePlugin, w as webpackPlugin } from './shared/unplugin.DLrBgECN.cjs';
6
7
  import 'postcss';
7
- import '@csszyx/types';
8
+ import '@csszyx/compiler';
8
9
  import 'esbuild';
9
10
  import 'rollup';
10
11
  import 'unplugin';
11
12
  import 'vite';
12
13
 
14
+ /**
15
+ * Resolves the global variable scan cache directory.
16
+ *
17
+ * @param cacheDir csszyx cache root.
18
+ * @returns Cache directory for Phase H CSS scans.
19
+ */
20
+ declare function resolveGlobalVarScanCacheDir(cacheDir: string): string;
21
+ /**
22
+ * Creates a cache key from file path, mtime, and content hash.
23
+ *
24
+ * @param input Cache key input.
25
+ * @returns Stable SHA-256 cache key.
26
+ */
27
+ declare function createGlobalVarScanCacheKey(input: GlobalVarScanCacheKeyInput): string;
28
+ /**
29
+ * Reads a cached global variable scan result when the key matches.
30
+ *
31
+ * @param cacheDir Global variable scan cache directory.
32
+ * @param key Expected cache key.
33
+ * @returns Cached scan result, or null on miss/corruption.
34
+ */
35
+ declare function readGlobalVarScanCache(cacheDir: string, key: string): CssVarScanResult | null;
36
+ /**
37
+ * Writes a global variable scan result cache entry.
38
+ *
39
+ * @param cacheDir Global variable scan cache directory.
40
+ * @param key Cache key.
41
+ * @param result Scan result to cache.
42
+ */
43
+ declare function writeGlobalVarScanCache(cacheDir: string, key: string, result: CssVarScanResult): void;
44
+
45
+ /**
46
+ * Scans one CSS source for custom-property definitions and var() references.
47
+ *
48
+ * @param css CSS source text.
49
+ * @param options Scan options.
50
+ * @returns Definitions, references, registrations, and ownership metadata.
51
+ */
52
+ declare function scanGlobalVarCss(css: string, options?: ScanGlobalVarCssOptions): CssVarScanResult;
53
+
54
+ /**
55
+ * Plans deterministic global aliases for explicit app-owned tokens.
56
+ *
57
+ * @param input Planner input.
58
+ * @returns Alias plan or fail-closed diagnostics.
59
+ */
60
+ declare function planGlobalVarAliases(input: PlanGlobalVarAliasesInput): GlobalVarAliasPlan;
61
+ /**
62
+ * Checks if a custom-property name is reserved by Tailwind v4.
63
+ *
64
+ * @param name Custom-property name.
65
+ * @returns true when the name is Tailwind-owned by namespace.
66
+ */
67
+ declare function isTailwindReservedGlobalVar(name: string): boolean;
68
+
69
+ /**
70
+ * Rewrites one CSS source with a validated global variable alias plan.
71
+ *
72
+ * This is intentionally pure M5 plumbing. It does not integrate with build
73
+ * hooks yet; callers must provide a fail-closed plan from `planGlobalVarAliases`.
74
+ *
75
+ * @param options Rewrite options.
76
+ * @returns Rewritten CSS and rewrite counters.
77
+ */
78
+ declare function rewriteGlobalVarCssAliases(options: RewriteGlobalVarCssAliasesOptions): GlobalVarCssAliasRewriteResult;
79
+
80
+ /**
81
+ * Runs the Phase H pure validation pipeline without mutating build output.
82
+ *
83
+ * @param options Validation input.
84
+ * @returns CSS scans, alias plan, and JS/JSX out-of-band diagnostics.
85
+ */
86
+ declare function validateGlobalVarAliasInputs(options: ValidateGlobalVarAliasInputsOptions): GlobalVarAliasValidationResult;
87
+ /**
88
+ * Builds validation options from bundler CSS assets and observed source files.
89
+ *
90
+ * This keeps production hook wiring deterministic: the same normalized CSS asset
91
+ * inventory can feed fail-closed validation before any CSS/TSX rewrite mutates
92
+ * output.
93
+ *
94
+ * @param input Bundler output and user global-var alias config fields.
95
+ * @returns Normalized validation options.
96
+ */
97
+ declare function createGlobalVarAliasValidationOptions(input: CreateGlobalVarAliasValidationOptionsInput): ValidateGlobalVarAliasInputsOptions;
98
+
13
99
  /**
14
100
  * Direct RSC boundary violation found in a transformed module.
15
101
  */
@@ -162,5 +248,5 @@ declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
162
248
  */
163
249
  declare function hasTokens(theme: ParsedTheme): boolean;
164
250
 
165
- export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
251
+ export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, isTailwindReservedGlobalVar, mergeThemes, parseThemeBlocks, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
166
252
  export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
package/dist/index.d.mts CHANGED
@@ -1,12 +1,99 @@
1
1
  export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { u as default, e as esbuildPlugin, m as mangleCodeClassesSync, r as rollupPlugin, u as unplugin, v as vitePlugin, w as webpackPlugin } from './shared/unplugin.DUbr5w-N.mjs';
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.DLrBgECN.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 createGlobalVarMapAssetSource, u as default, p as esbuildPlugin, q as extractGlobalVarAliasesForManifest, r as mangleCodeClassesSync, s as normalizeGlobalVarAliasesForCache, t as rollupPlugin, u as unplugin, v as vitePlugin, w as webpackPlugin } from './shared/unplugin.DLrBgECN.mjs';
3
5
  import 'postcss';
4
- import '@csszyx/types';
6
+ import '@csszyx/compiler';
5
7
  import 'esbuild';
6
8
  import 'rollup';
7
9
  import 'unplugin';
8
10
  import 'vite';
9
11
 
12
+ /**
13
+ * Resolves the global variable scan cache directory.
14
+ *
15
+ * @param cacheDir csszyx cache root.
16
+ * @returns Cache directory for Phase H CSS scans.
17
+ */
18
+ declare function resolveGlobalVarScanCacheDir(cacheDir: string): string;
19
+ /**
20
+ * Creates a cache key from file path, mtime, and content hash.
21
+ *
22
+ * @param input Cache key input.
23
+ * @returns Stable SHA-256 cache key.
24
+ */
25
+ declare function createGlobalVarScanCacheKey(input: GlobalVarScanCacheKeyInput): string;
26
+ /**
27
+ * Reads a cached global variable scan result when the key matches.
28
+ *
29
+ * @param cacheDir Global variable scan cache directory.
30
+ * @param key Expected cache key.
31
+ * @returns Cached scan result, or null on miss/corruption.
32
+ */
33
+ declare function readGlobalVarScanCache(cacheDir: string, key: string): CssVarScanResult | null;
34
+ /**
35
+ * Writes a global variable scan result cache entry.
36
+ *
37
+ * @param cacheDir Global variable scan cache directory.
38
+ * @param key Cache key.
39
+ * @param result Scan result to cache.
40
+ */
41
+ declare function writeGlobalVarScanCache(cacheDir: string, key: string, result: CssVarScanResult): void;
42
+
43
+ /**
44
+ * Scans one CSS source for custom-property definitions and var() references.
45
+ *
46
+ * @param css CSS source text.
47
+ * @param options Scan options.
48
+ * @returns Definitions, references, registrations, and ownership metadata.
49
+ */
50
+ declare function scanGlobalVarCss(css: string, options?: ScanGlobalVarCssOptions): CssVarScanResult;
51
+
52
+ /**
53
+ * Plans deterministic global aliases for explicit app-owned tokens.
54
+ *
55
+ * @param input Planner input.
56
+ * @returns Alias plan or fail-closed diagnostics.
57
+ */
58
+ declare function planGlobalVarAliases(input: PlanGlobalVarAliasesInput): GlobalVarAliasPlan;
59
+ /**
60
+ * Checks if a custom-property name is reserved by Tailwind v4.
61
+ *
62
+ * @param name Custom-property name.
63
+ * @returns true when the name is Tailwind-owned by namespace.
64
+ */
65
+ declare function isTailwindReservedGlobalVar(name: string): boolean;
66
+
67
+ /**
68
+ * Rewrites one CSS source with a validated global variable alias plan.
69
+ *
70
+ * This is intentionally pure M5 plumbing. It does not integrate with build
71
+ * hooks yet; callers must provide a fail-closed plan from `planGlobalVarAliases`.
72
+ *
73
+ * @param options Rewrite options.
74
+ * @returns Rewritten CSS and rewrite counters.
75
+ */
76
+ declare function rewriteGlobalVarCssAliases(options: RewriteGlobalVarCssAliasesOptions): GlobalVarCssAliasRewriteResult;
77
+
78
+ /**
79
+ * Runs the Phase H pure validation pipeline without mutating build output.
80
+ *
81
+ * @param options Validation input.
82
+ * @returns CSS scans, alias plan, and JS/JSX out-of-band diagnostics.
83
+ */
84
+ declare function validateGlobalVarAliasInputs(options: ValidateGlobalVarAliasInputsOptions): GlobalVarAliasValidationResult;
85
+ /**
86
+ * Builds validation options from bundler CSS assets and observed source files.
87
+ *
88
+ * This keeps production hook wiring deterministic: the same normalized CSS asset
89
+ * inventory can feed fail-closed validation before any CSS/TSX rewrite mutates
90
+ * output.
91
+ *
92
+ * @param input Bundler output and user global-var alias config fields.
93
+ * @returns Normalized validation options.
94
+ */
95
+ declare function createGlobalVarAliasValidationOptions(input: CreateGlobalVarAliasValidationOptionsInput): ValidateGlobalVarAliasInputsOptions;
96
+
10
97
  /**
11
98
  * Direct RSC boundary violation found in a transformed module.
12
99
  */
@@ -159,5 +246,5 @@ declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
159
246
  */
160
247
  declare function hasTokens(theme: ParsedTheme): boolean;
161
248
 
162
- export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
249
+ export { CreateGlobalVarAliasValidationOptionsInput, CssVarScanResult, GlobalVarAliasPlan, GlobalVarAliasValidationResult, GlobalVarCssAliasRewriteResult, GlobalVarScanCacheKeyInput, PlanGlobalVarAliasesInput, RewriteGlobalVarCssAliasesOptions, ScanGlobalVarCssOptions, ValidateGlobalVarAliasInputsOptions, assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createGlobalVarAliasValidationOptions, createGlobalVarScanCacheKey, createRSCModuleRecord, deleteRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, isTailwindReservedGlobalVar, mergeThemes, parseThemeBlocks, planGlobalVarAliases, readGlobalVarScanCache, resolveGlobalVarScanCacheDir, rewriteGlobalVarCssAliases, scanGlobalVarCss, validateGlobalVarAliasInputs, writeGlobalVarScanCache };
163
250
  export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as assertNoRSCBoundaryViolation, b as assertNoRSCGraphViolation, c as createRSCModuleRecord, u as default, d as deleteRSCModuleRecord, e as esbuildPlugin, f as findRSCBoundaryViolation, g as findRSCGraphViolation, h as hasTokens, i as hasUseClientDirective, j as hasUseServerDirective, k as isRSCServerModule, m as mangleCodeClassesSync, l as mergeThemes, p as parseThemeBlocks, r as rollupPlugin, u as unplugin, v as vitePlugin, w as webpackPlugin } from './shared/unplugin.BEOG6ePC.mjs';
2
+ export { a as assertNoRSCBoundaryViolation, b as assertNoRSCGraphViolation, c as createGlobalVarAliasValidationOptions, d as createGlobalVarMapAssetSource, e as createGlobalVarScanCacheKey, f as createRSCModuleRecord, u as default, g as deleteRSCModuleRecord, h as esbuildPlugin, i as extractGlobalVarAliasesForManifest, j as findRSCBoundaryViolation, k as findRSCGraphViolation, l as hasTokens, m as hasUseClientDirective, n as hasUseServerDirective, o as isRSCServerModule, p as isTailwindReservedGlobalVar, q as mangleCodeClassesSync, r as mergeThemes, s as normalizeGlobalVarAliasesForCache, t as parseThemeBlocks, v as planGlobalVarAliases, w as readGlobalVarScanCache, x as resolveGlobalVarScanCacheDir, y as rewriteGlobalVarCssAliases, z as rollupPlugin, A as scanGlobalVarCss, u as unplugin, B as validateGlobalVarAliasInputs, C as vitePlugin, D as webpackPlugin, E as writeGlobalVarScanCache } from './shared/unplugin.BbtspS8t.mjs';
3
+ export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
3
4
  import 'postcss';
4
5
  import 'postcss-selector-parser';
5
6
  import 'node:fs';
@@ -10,7 +11,8 @@ import 'node:url';
10
11
  import '@csszyx/compiler';
11
12
  import '@csszyx/core';
12
13
  import '@csszyx/svelte-adapter';
13
- import '@csszyx/types';
14
14
  import '@csszyx/vue-adapter';
15
15
  import 'unplugin';
16
16
  import 'node:crypto';
17
+ import './shared/unplugin.BceVw1eW.mjs';
18
+ import 'postcss-value-parser';
@@ -0,0 +1,148 @@
1
+ 'use strict';
2
+
3
+ const node_crypto = require('node:crypto');
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+ const nextTransformMetadata = require('./shared/unplugin.B_U4rZvG.cjs');
7
+ const nextWatcherCycle = require('./shared/unplugin.s62yJbu1.cjs');
8
+ const transformCache = require('./shared/unplugin.DUxdYaSG.cjs');
9
+ require('@csszyx/compiler');
10
+ require('node:os');
11
+ require('proper-lockfile');
12
+
13
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
14
+ function _interopNamespaceCompat(e) {
15
+ if (e && typeof e === 'object' && 'default' in e) return e;
16
+ const n = Object.create(null);
17
+ if (e) {
18
+ for (const k in e) {
19
+ n[k] = e[k];
20
+ }
21
+ }
22
+ n.default = e;
23
+ return n;
24
+ }
25
+
26
+ const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
27
+
28
+ function runNextPrebuild(options) {
29
+ assertProductionManglingBoundary(options);
30
+ const csszyxVersion = options.csszyxVersion ?? nextTransformMetadata.readPackageVersion("../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next-prebuild.cjs', document.baseURI).href)));
31
+ const compilerVersion = options.compilerVersion ?? nextTransformMetadata.readPackageVersion("../../compiler/package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next-prebuild.cjs', document.baseURI).href)));
32
+ const nativeVersion = options.nativeVersion ?? compilerVersion;
33
+ const nextVersion = options.nextVersion ?? "unknown-next";
34
+ const context = nextWatcherCycle.createNextStateContext({
35
+ explicitRoot: options.explicitRoot,
36
+ loaderRootContext: options.loaderRootContext,
37
+ loaderContext: options.loaderContext,
38
+ cwd: options.cwd,
39
+ cacheDir: options.cacheDir,
40
+ safelistOutputFile: options.safelistOutputFile,
41
+ config: options.config ?? {},
42
+ env: options.env ?? process.env,
43
+ envKeys: options.envKeys,
44
+ nextVersion,
45
+ csszyxVersion,
46
+ nativeVersion,
47
+ mode: options.mode ?? "production"
48
+ });
49
+ const cacheRoot = transformCache.resolveTransformCacheDir(
50
+ context.root,
51
+ path__namespace.relative(context.root, context.cacheDir)
52
+ );
53
+ const files = [];
54
+ let scannedCount = 0;
55
+ let transformedCount = 0;
56
+ let skippedMissingCount = 0;
57
+ for (const filename of uniqueFiles(options.files)) {
58
+ scannedCount++;
59
+ if (!fs.existsSync(filename)) {
60
+ skippedMissingCount++;
61
+ continue;
62
+ }
63
+ const source = fs.readFileSync(filename, "utf8");
64
+ const transform = nextTransformMetadata.transformNextSource({
65
+ source,
66
+ filename,
67
+ parserMode: options.parserMode ?? "rust",
68
+ compilerOptions: options.compilerOptions,
69
+ cacheRoot,
70
+ pluginVersion: csszyxVersion,
71
+ compilerVersion,
72
+ astBudget: options.astBudget,
73
+ allowBabelFallback: options.allowBabelFallback
74
+ });
75
+ const metadata = nextTransformMetadata.collectNextTransformMetadata(transform.result, source, filename);
76
+ transformedCount++;
77
+ const shardResult = nextWatcherCycle.writeNextSafelistShard(
78
+ context.safelist.shardsDir,
79
+ nextTransformMetadata.createNextSafelistShardFromMetadata(metadata, createShardCacheKey(context, metadata)),
80
+ options.writeOptions
81
+ );
82
+ files.push({
83
+ filename,
84
+ shardPath: shardResult.filePath,
85
+ classCount: metadata.classes.length,
86
+ cacheStatus: transform.cacheStatus,
87
+ producer: transform.producer
88
+ });
89
+ }
90
+ const cycle = nextWatcherCycle.runNextWatcherCycle(context, {
91
+ writeOptions: options.writeOptions,
92
+ lockOptions: {
93
+ root: context.root,
94
+ mode: context.manifestExpectation.mode,
95
+ command: "csszyx next prebuild"
96
+ },
97
+ createdAt: options.createdAt
98
+ });
99
+ return {
100
+ context,
101
+ scannedCount,
102
+ transformedCount,
103
+ skippedMissingCount,
104
+ classCount: cycle.materialize.classCount,
105
+ sourceCount: cycle.materialize.sourceCount,
106
+ manifestPath: context.manifestPath,
107
+ safelistOutputPath: context.safelist.outputPath,
108
+ files,
109
+ cycle
110
+ };
111
+ }
112
+ function assertProductionManglingBoundary(options) {
113
+ if (options.allowProductionMangling) {
114
+ return;
115
+ }
116
+ if ((options.mode ?? "production") !== "production") {
117
+ return;
118
+ }
119
+ if (options.compilerOptions?.mangleVars === true || hasEnabledMangleVars(options.config)) {
120
+ throw new Error(
121
+ "[csszyx] Next prebuild does not support production CSS variable mangling. Use Next Webpack mode for full csszyx parity."
122
+ );
123
+ }
124
+ }
125
+ function hasEnabledMangleVars(config) {
126
+ if (config === null || typeof config !== "object" || Array.isArray(config)) {
127
+ return false;
128
+ }
129
+ return config.mangleVars === true;
130
+ }
131
+ function uniqueFiles(files) {
132
+ const seen = /* @__PURE__ */ new Set();
133
+ const result = [];
134
+ for (const file of files) {
135
+ const resolved = path__namespace.resolve(file);
136
+ if (seen.has(resolved)) {
137
+ continue;
138
+ }
139
+ seen.add(resolved);
140
+ result.push(resolved);
141
+ }
142
+ return result;
143
+ }
144
+ function createShardCacheKey(context, metadata) {
145
+ return node_crypto.createHash("sha256").update(context.identity.generation).update("\0").update(path__namespace.relative(context.root, metadata.sourcePath).replace(/\\/g, "/")).digest("hex");
146
+ }
147
+
148
+ exports.runNextPrebuild = runNextPrebuild;
@@ -0,0 +1,66 @@
1
+ import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
+ import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.cjs';
3
+ import { a as NextSourceTransformOutput, N as NextSourceParserMode } from './shared/unplugin.CScQRdTp.cjs';
4
+ import { N as NextWatcherCycleResult } from './shared/unplugin.xeED_qwh.cjs';
5
+
6
+ /** Serializable options accepted by the Next Turbopack csszyx prebuild core. */
7
+ interface NextPrebuildOptions {
8
+ files: readonly string[];
9
+ explicitRoot?: string;
10
+ loaderRootContext?: string;
11
+ loaderContext?: string;
12
+ cwd?: string;
13
+ cacheDir?: string;
14
+ safelistOutputFile?: string;
15
+ parserMode?: NextSourceParserMode;
16
+ compilerOptions?: TransformSourceCodeOptions;
17
+ config?: JsonLike;
18
+ env?: Record<string, string | undefined>;
19
+ envKeys?: readonly string[];
20
+ nextVersion?: string;
21
+ csszyxVersion?: string;
22
+ compilerVersion?: string;
23
+ nativeVersion?: string;
24
+ mode?: 'development' | 'production';
25
+ astBudget?: number;
26
+ allowBabelFallback?: boolean;
27
+ allowProductionMangling?: boolean;
28
+ writeOptions?: AtomicWriteOptions;
29
+ createdAt?: string;
30
+ }
31
+ /** Per-file result captured by one prebuild pass. */
32
+ interface NextPrebuildFileResult {
33
+ filename: string;
34
+ shardPath: string | null;
35
+ classCount: number;
36
+ cacheStatus: NextSourceTransformOutput['cacheStatus'];
37
+ producer: NextSourceTransformOutput['producer'];
38
+ }
39
+ /** Aggregated result returned by `runNextPrebuild`. */
40
+ interface NextPrebuildResult {
41
+ context: NextStateContext;
42
+ scannedCount: number;
43
+ transformedCount: number;
44
+ skippedMissingCount: number;
45
+ classCount: number;
46
+ sourceCount: number;
47
+ manifestPath: string;
48
+ safelistOutputPath: string;
49
+ files: NextPrebuildFileResult[];
50
+ cycle: NextWatcherCycleResult;
51
+ }
52
+ /**
53
+ * Run one synchronous Next Turbopack csszyx prebuild pass.
54
+ *
55
+ * The prebuild walks an explicit file list, reuses the same state, transform,
56
+ * metadata, shard, and materialization contract as the loader, and finalizes
57
+ * the canonical Tailwind safelist plus a completed generation manifest. It
58
+ * intentionally does not own glob/chokidar dependencies or a CLI surface yet.
59
+ *
60
+ * @param options Prebuild input options.
61
+ * @returns Summary covering scanned/transformed counts and materialization paths.
62
+ */
63
+ declare function runNextPrebuild(options: NextPrebuildOptions): NextPrebuildResult;
64
+
65
+ export { runNextPrebuild };
66
+ export type { NextPrebuildFileResult, NextPrebuildOptions, NextPrebuildResult };
@@ -0,0 +1,66 @@
1
+ import { TransformSourceCodeOptions } from '@csszyx/compiler';
2
+ import { J as JsonLike, A as AtomicWriteOptions, N as NextStateContext } from './shared/unplugin.CPEWNSA0.mjs';
3
+ import { a as NextSourceTransformOutput, N as NextSourceParserMode } from './shared/unplugin.CScQRdTp.mjs';
4
+ import { N as NextWatcherCycleResult } from './shared/unplugin.CdZxp0x-.mjs';
5
+
6
+ /** Serializable options accepted by the Next Turbopack csszyx prebuild core. */
7
+ interface NextPrebuildOptions {
8
+ files: readonly string[];
9
+ explicitRoot?: string;
10
+ loaderRootContext?: string;
11
+ loaderContext?: string;
12
+ cwd?: string;
13
+ cacheDir?: string;
14
+ safelistOutputFile?: string;
15
+ parserMode?: NextSourceParserMode;
16
+ compilerOptions?: TransformSourceCodeOptions;
17
+ config?: JsonLike;
18
+ env?: Record<string, string | undefined>;
19
+ envKeys?: readonly string[];
20
+ nextVersion?: string;
21
+ csszyxVersion?: string;
22
+ compilerVersion?: string;
23
+ nativeVersion?: string;
24
+ mode?: 'development' | 'production';
25
+ astBudget?: number;
26
+ allowBabelFallback?: boolean;
27
+ allowProductionMangling?: boolean;
28
+ writeOptions?: AtomicWriteOptions;
29
+ createdAt?: string;
30
+ }
31
+ /** Per-file result captured by one prebuild pass. */
32
+ interface NextPrebuildFileResult {
33
+ filename: string;
34
+ shardPath: string | null;
35
+ classCount: number;
36
+ cacheStatus: NextSourceTransformOutput['cacheStatus'];
37
+ producer: NextSourceTransformOutput['producer'];
38
+ }
39
+ /** Aggregated result returned by `runNextPrebuild`. */
40
+ interface NextPrebuildResult {
41
+ context: NextStateContext;
42
+ scannedCount: number;
43
+ transformedCount: number;
44
+ skippedMissingCount: number;
45
+ classCount: number;
46
+ sourceCount: number;
47
+ manifestPath: string;
48
+ safelistOutputPath: string;
49
+ files: NextPrebuildFileResult[];
50
+ cycle: NextWatcherCycleResult;
51
+ }
52
+ /**
53
+ * Run one synchronous Next Turbopack csszyx prebuild pass.
54
+ *
55
+ * The prebuild walks an explicit file list, reuses the same state, transform,
56
+ * metadata, shard, and materialization contract as the loader, and finalizes
57
+ * the canonical Tailwind safelist plus a completed generation manifest. It
58
+ * intentionally does not own glob/chokidar dependencies or a CLI surface yet.
59
+ *
60
+ * @param options Prebuild input options.
61
+ * @returns Summary covering scanned/transformed counts and materialization paths.
62
+ */
63
+ declare function runNextPrebuild(options: NextPrebuildOptions): NextPrebuildResult;
64
+
65
+ export { runNextPrebuild };
66
+ export type { NextPrebuildFileResult, NextPrebuildOptions, NextPrebuildResult };