@csszyx/unplugin 0.6.0 → 0.7.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.
package/dist/index.d.cts CHANGED
@@ -7,6 +7,101 @@ import 'rollup';
7
7
  import 'unplugin';
8
8
  import 'vite';
9
9
 
10
+ /**
11
+ * Direct RSC boundary violation found in a transformed module.
12
+ */
13
+ interface RSCBoundaryViolation {
14
+ /** Forbidden runtime helper that crossed into an RSC server module. */
15
+ symbol: string;
16
+ /** Server module path where the import was found. */
17
+ path: string;
18
+ /** Import chain used in the fatal build error. */
19
+ importChain: string[];
20
+ }
21
+ /**
22
+ * RSC module metadata collected during the transform phase.
23
+ */
24
+ interface RSCModuleRecord {
25
+ /** Normalized absolute module ID. */
26
+ id: string;
27
+ /** True when this module is an RSC server module entry or has `'use server'`. */
28
+ isServer: boolean;
29
+ /** True when this module declares the client boundary. */
30
+ isClient: boolean;
31
+ /** Local modules imported by this file after path resolution. */
32
+ imports: string[];
33
+ /** Forbidden runtime imports found directly in this module. */
34
+ runtimeImports: Array<{
35
+ source: string;
36
+ symbols: string[];
37
+ }>;
38
+ }
39
+ /**
40
+ * Returns true when a module starts with the top-level `'use server'`
41
+ * directive. Comments and blank lines before the directive are allowed, but
42
+ * detection stops at the first real statement.
43
+ *
44
+ * @param code module source
45
+ * @returns true when the module has a top-level `'use server'` directive
46
+ */
47
+ declare function hasUseServerDirective(code: string): boolean;
48
+ /**
49
+ * Returns true when a module starts with the top-level `'use client'`
50
+ * directive.
51
+ *
52
+ * @param code module source
53
+ * @returns true when the module has a top-level `'use client'` directive
54
+ */
55
+ declare function hasUseClientDirective(code: string): boolean;
56
+ /**
57
+ * Detects modules that should be treated as RSC server modules by csszyx.
58
+ *
59
+ * @param code module source
60
+ * @param id module ID/path
61
+ * @returns true when the module is server-side for RSC boundary purposes
62
+ */
63
+ declare function isRSCServerModule(code: string, id: string): boolean;
64
+ /**
65
+ * Finds the first direct forbidden runtime helper import in an RSC server
66
+ * module.
67
+ *
68
+ * @param code module source
69
+ * @param id module ID/path
70
+ * @returns violation details, or null when the module is allowed
71
+ */
72
+ declare function findRSCBoundaryViolation(code: string, id: string): RSCBoundaryViolation | null;
73
+ /**
74
+ * Builds module metadata for the RSC graph walker.
75
+ *
76
+ * @param code module source
77
+ * @param id module ID/path
78
+ * @returns graph metadata for the module
79
+ */
80
+ declare function createRSCModuleRecord(code: string, id: string): RSCModuleRecord;
81
+ /**
82
+ * Finds forbidden runtime helper imports reachable from an RSC server module.
83
+ * Traversal stops at `'use client'` modules because they define a separate
84
+ * client module graph.
85
+ *
86
+ * @param records module graph records keyed by normalized module ID
87
+ * @returns first graph violation, or null when the graph is allowed
88
+ */
89
+ declare function findRSCGraphViolation(records: Map<string, RSCModuleRecord>): RSCBoundaryViolation | null;
90
+ /**
91
+ * Throws the spec-format fatal RSC boundary error for graph-level violations.
92
+ *
93
+ * @param records module graph records keyed by normalized module ID
94
+ */
95
+ declare function assertNoRSCGraphViolation(records: Map<string, RSCModuleRecord>): void;
96
+ /**
97
+ * Throws the spec-format fatal RSC boundary error when a server module imports
98
+ * a forbidden csszyx runtime helper.
99
+ *
100
+ * @param code module source
101
+ * @param id module ID/path
102
+ */
103
+ declare function assertNoRSCBoundaryViolation(code: string, id: string): void;
104
+
10
105
  /**
11
106
  * Theme Scanner — parses Tailwind v4 @theme blocks from CSS files.
12
107
  *
@@ -55,4 +150,4 @@ declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
55
150
  */
56
151
  declare function hasTokens(theme: ParsedTheme): boolean;
57
152
 
58
- export { type ParsedTheme, hasTokens, mergeThemes, parseThemeBlocks };
153
+ export { type ParsedTheme, type RSCBoundaryViolation, type RSCModuleRecord, assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,101 @@ import 'rollup';
7
7
  import 'unplugin';
8
8
  import 'vite';
9
9
 
10
+ /**
11
+ * Direct RSC boundary violation found in a transformed module.
12
+ */
13
+ interface RSCBoundaryViolation {
14
+ /** Forbidden runtime helper that crossed into an RSC server module. */
15
+ symbol: string;
16
+ /** Server module path where the import was found. */
17
+ path: string;
18
+ /** Import chain used in the fatal build error. */
19
+ importChain: string[];
20
+ }
21
+ /**
22
+ * RSC module metadata collected during the transform phase.
23
+ */
24
+ interface RSCModuleRecord {
25
+ /** Normalized absolute module ID. */
26
+ id: string;
27
+ /** True when this module is an RSC server module entry or has `'use server'`. */
28
+ isServer: boolean;
29
+ /** True when this module declares the client boundary. */
30
+ isClient: boolean;
31
+ /** Local modules imported by this file after path resolution. */
32
+ imports: string[];
33
+ /** Forbidden runtime imports found directly in this module. */
34
+ runtimeImports: Array<{
35
+ source: string;
36
+ symbols: string[];
37
+ }>;
38
+ }
39
+ /**
40
+ * Returns true when a module starts with the top-level `'use server'`
41
+ * directive. Comments and blank lines before the directive are allowed, but
42
+ * detection stops at the first real statement.
43
+ *
44
+ * @param code module source
45
+ * @returns true when the module has a top-level `'use server'` directive
46
+ */
47
+ declare function hasUseServerDirective(code: string): boolean;
48
+ /**
49
+ * Returns true when a module starts with the top-level `'use client'`
50
+ * directive.
51
+ *
52
+ * @param code module source
53
+ * @returns true when the module has a top-level `'use client'` directive
54
+ */
55
+ declare function hasUseClientDirective(code: string): boolean;
56
+ /**
57
+ * Detects modules that should be treated as RSC server modules by csszyx.
58
+ *
59
+ * @param code module source
60
+ * @param id module ID/path
61
+ * @returns true when the module is server-side for RSC boundary purposes
62
+ */
63
+ declare function isRSCServerModule(code: string, id: string): boolean;
64
+ /**
65
+ * Finds the first direct forbidden runtime helper import in an RSC server
66
+ * module.
67
+ *
68
+ * @param code module source
69
+ * @param id module ID/path
70
+ * @returns violation details, or null when the module is allowed
71
+ */
72
+ declare function findRSCBoundaryViolation(code: string, id: string): RSCBoundaryViolation | null;
73
+ /**
74
+ * Builds module metadata for the RSC graph walker.
75
+ *
76
+ * @param code module source
77
+ * @param id module ID/path
78
+ * @returns graph metadata for the module
79
+ */
80
+ declare function createRSCModuleRecord(code: string, id: string): RSCModuleRecord;
81
+ /**
82
+ * Finds forbidden runtime helper imports reachable from an RSC server module.
83
+ * Traversal stops at `'use client'` modules because they define a separate
84
+ * client module graph.
85
+ *
86
+ * @param records module graph records keyed by normalized module ID
87
+ * @returns first graph violation, or null when the graph is allowed
88
+ */
89
+ declare function findRSCGraphViolation(records: Map<string, RSCModuleRecord>): RSCBoundaryViolation | null;
90
+ /**
91
+ * Throws the spec-format fatal RSC boundary error for graph-level violations.
92
+ *
93
+ * @param records module graph records keyed by normalized module ID
94
+ */
95
+ declare function assertNoRSCGraphViolation(records: Map<string, RSCModuleRecord>): void;
96
+ /**
97
+ * Throws the spec-format fatal RSC boundary error when a server module imports
98
+ * a forbidden csszyx runtime helper.
99
+ *
100
+ * @param code module source
101
+ * @param id module ID/path
102
+ */
103
+ declare function assertNoRSCBoundaryViolation(code: string, id: string): void;
104
+
10
105
  /**
11
106
  * Theme Scanner — parses Tailwind v4 @theme blocks from CSS files.
12
107
  *
@@ -55,4 +150,4 @@ declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
55
150
  */
56
151
  declare function hasTokens(theme: ParsedTheme): boolean;
57
152
 
58
- export { type ParsedTheme, hasTokens, mergeThemes, parseThemeBlocks };
153
+ export { type ParsedTheme, type RSCBoundaryViolation, type RSCModuleRecord, assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
package/dist/index.js CHANGED
@@ -1,6 +1,14 @@
1
1
  import {
2
+ assertNoRSCBoundaryViolation,
3
+ assertNoRSCGraphViolation,
4
+ createRSCModuleRecord,
2
5
  esbuildPlugin,
6
+ findRSCBoundaryViolation,
7
+ findRSCGraphViolation,
3
8
  hasTokens,
9
+ hasUseClientDirective,
10
+ hasUseServerDirective,
11
+ isRSCServerModule,
4
12
  mangleCodeClassesSync,
5
13
  mergeThemes,
6
14
  parseThemeBlocks,
@@ -8,7 +16,7 @@ import {
8
16
  unplugin,
9
17
  vitePlugin,
10
18
  webpackPlugin
11
- } from "./chunk-HOQTC45W.js";
19
+ } from "./chunk-GXGGTRUA.js";
12
20
  import {
13
21
  createPostCSSPlugin,
14
22
  escapeCSSClassName,
@@ -17,11 +25,19 @@ import {
17
25
  unescapeTailwindClass
18
26
  } from "./chunk-4M7CPGP7.js";
19
27
  export {
28
+ assertNoRSCBoundaryViolation,
29
+ assertNoRSCGraphViolation,
20
30
  createPostCSSPlugin,
31
+ createRSCModuleRecord,
21
32
  unplugin as default,
22
33
  esbuildPlugin,
23
34
  escapeCSSClassName,
35
+ findRSCBoundaryViolation,
36
+ findRSCGraphViolation,
24
37
  hasTokens,
38
+ hasUseClientDirective,
39
+ hasUseServerDirective,
40
+ isRSCServerModule,
25
41
  mangleCSS,
26
42
  mangleCSSSync,
27
43
  mangleCodeClassesSync,