@csszyx/unplugin 0.6.2 → 0.8.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/README.md +23 -1
- package/dist/css-mangler.cjs +23 -68
- package/dist/css-mangler.d.cts +2 -1
- package/dist/{css-mangler.d.ts → css-mangler.d.mts} +2 -1
- package/dist/{chunk-4M7CPGP7.js → css-mangler.mjs} +9 -27
- package/dist/index.cjs +42 -1530
- package/dist/index.d.cts +101 -2
- package/dist/index.d.mts +154 -0
- package/dist/index.mjs +12 -0
- package/dist/shared/unplugin.BNsv2szs.cjs +1753 -0
- package/dist/{chunk-JGJOUK2R.js → shared/unplugin.DCv0RtVZ.mjs} +814 -376
- package/dist/vite.cjs +15 -1363
- package/dist/vite.d.cts +2 -2
- package/dist/{vite.d.ts → vite.d.mts} +1 -1
- package/dist/vite.mjs +16 -0
- package/dist/webpack.cjs +15 -1372
- package/dist/webpack.d.cts +2 -2
- package/dist/{webpack.d.ts → webpack.d.mts} +1 -1
- package/dist/webpack.mjs +16 -0
- package/package.json +51 -27
- package/dist/css-mangler.js +0 -14
- package/dist/index.d.ts +0 -58
- package/dist/index.js +0 -35
- package/dist/vite.js +0 -10
- package/dist/webpack.js +0 -10
- /package/dist/{unplugin-DUbr5w-N.d.cts → shared/unplugin.DUbr5w-N.d.cts} +0 -0
- /package/dist/{unplugin-DUbr5w-N.d.ts → shared/unplugin.DUbr5w-N.d.mts} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import _default from './shared/unplugin.DUbr5w-N.cjs';
|
|
1
2
|
export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.cjs';
|
|
2
|
-
|
|
3
|
+
// @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';
|
|
3
6
|
import 'postcss';
|
|
4
7
|
import '@csszyx/types';
|
|
5
8
|
import 'esbuild';
|
|
@@ -7,6 +10,101 @@ import 'rollup';
|
|
|
7
10
|
import 'unplugin';
|
|
8
11
|
import 'vite';
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Direct RSC boundary violation found in a transformed module.
|
|
15
|
+
*/
|
|
16
|
+
interface RSCBoundaryViolation {
|
|
17
|
+
/** Forbidden runtime helper that crossed into an RSC server module. */
|
|
18
|
+
symbol: string;
|
|
19
|
+
/** Server module path where the import was found. */
|
|
20
|
+
path: string;
|
|
21
|
+
/** Import chain used in the fatal build error. */
|
|
22
|
+
importChain: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* RSC module metadata collected during the transform phase.
|
|
26
|
+
*/
|
|
27
|
+
interface RSCModuleRecord {
|
|
28
|
+
/** Normalized absolute module ID. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** True when this module is an RSC server module entry or has `'use server'`. */
|
|
31
|
+
isServer: boolean;
|
|
32
|
+
/** True when this module declares the client boundary. */
|
|
33
|
+
isClient: boolean;
|
|
34
|
+
/** Local modules imported by this file after path resolution. */
|
|
35
|
+
imports: string[];
|
|
36
|
+
/** Forbidden runtime imports found directly in this module. */
|
|
37
|
+
runtimeImports: Array<{
|
|
38
|
+
source: string;
|
|
39
|
+
symbols: string[];
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns true when a module starts with the top-level `'use server'`
|
|
44
|
+
* directive. Comments and blank lines before the directive are allowed, but
|
|
45
|
+
* detection stops at the first real statement.
|
|
46
|
+
*
|
|
47
|
+
* @param code module source
|
|
48
|
+
* @returns true when the module has a top-level `'use server'` directive
|
|
49
|
+
*/
|
|
50
|
+
declare function hasUseServerDirective(code: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Returns true when a module starts with the top-level `'use client'`
|
|
53
|
+
* directive.
|
|
54
|
+
*
|
|
55
|
+
* @param code module source
|
|
56
|
+
* @returns true when the module has a top-level `'use client'` directive
|
|
57
|
+
*/
|
|
58
|
+
declare function hasUseClientDirective(code: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Detects modules that should be treated as RSC server modules by csszyx.
|
|
61
|
+
*
|
|
62
|
+
* @param code module source
|
|
63
|
+
* @param id module ID/path
|
|
64
|
+
* @returns true when the module is server-side for RSC boundary purposes
|
|
65
|
+
*/
|
|
66
|
+
declare function isRSCServerModule(code: string, id: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Finds the first direct forbidden runtime helper import in an RSC server
|
|
69
|
+
* module.
|
|
70
|
+
*
|
|
71
|
+
* @param code module source
|
|
72
|
+
* @param id module ID/path
|
|
73
|
+
* @returns violation details, or null when the module is allowed
|
|
74
|
+
*/
|
|
75
|
+
declare function findRSCBoundaryViolation(code: string, id: string): RSCBoundaryViolation | null;
|
|
76
|
+
/**
|
|
77
|
+
* Builds module metadata for the RSC graph walker.
|
|
78
|
+
*
|
|
79
|
+
* @param code module source
|
|
80
|
+
* @param id module ID/path
|
|
81
|
+
* @returns graph metadata for the module
|
|
82
|
+
*/
|
|
83
|
+
declare function createRSCModuleRecord(code: string, id: string): RSCModuleRecord;
|
|
84
|
+
/**
|
|
85
|
+
* Finds forbidden runtime helper imports reachable from an RSC server module.
|
|
86
|
+
* Traversal stops at `'use client'` modules because they define a separate
|
|
87
|
+
* client module graph.
|
|
88
|
+
*
|
|
89
|
+
* @param records module graph records keyed by normalized module ID
|
|
90
|
+
* @returns first graph violation, or null when the graph is allowed
|
|
91
|
+
*/
|
|
92
|
+
declare function findRSCGraphViolation(records: Map<string, RSCModuleRecord>): RSCBoundaryViolation | null;
|
|
93
|
+
/**
|
|
94
|
+
* Throws the spec-format fatal RSC boundary error for graph-level violations.
|
|
95
|
+
*
|
|
96
|
+
* @param records module graph records keyed by normalized module ID
|
|
97
|
+
*/
|
|
98
|
+
declare function assertNoRSCGraphViolation(records: Map<string, RSCModuleRecord>): void;
|
|
99
|
+
/**
|
|
100
|
+
* Throws the spec-format fatal RSC boundary error when a server module imports
|
|
101
|
+
* a forbidden csszyx runtime helper.
|
|
102
|
+
*
|
|
103
|
+
* @param code module source
|
|
104
|
+
* @param id module ID/path
|
|
105
|
+
*/
|
|
106
|
+
declare function assertNoRSCBoundaryViolation(code: string, id: string): void;
|
|
107
|
+
|
|
10
108
|
/**
|
|
11
109
|
* Theme Scanner — parses Tailwind v4 @theme blocks from CSS files.
|
|
12
110
|
*
|
|
@@ -55,4 +153,5 @@ declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
|
|
|
55
153
|
*/
|
|
56
154
|
declare function hasTokens(theme: ParsedTheme): boolean;
|
|
57
155
|
|
|
58
|
-
export {
|
|
156
|
+
export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
|
|
157
|
+
export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
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';
|
|
3
|
+
import 'postcss';
|
|
4
|
+
import '@csszyx/types';
|
|
5
|
+
import 'esbuild';
|
|
6
|
+
import 'rollup';
|
|
7
|
+
import 'unplugin';
|
|
8
|
+
import 'vite';
|
|
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
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Theme Scanner — parses Tailwind v4 @theme blocks from CSS files.
|
|
107
|
+
*
|
|
108
|
+
* Extracts custom design tokens and categorizes them by type so the
|
|
109
|
+
* type writer can generate accurate TypeScript augmentation.
|
|
110
|
+
*
|
|
111
|
+
* Supports:
|
|
112
|
+
* - Multiple @theme blocks per file
|
|
113
|
+
* - @theme inline { } syntax (inline keyword ignored)
|
|
114
|
+
* - @theme inside @layer (two-pass strip)
|
|
115
|
+
* - --color-brand-50 shade suffixes (deduped to 'brand')
|
|
116
|
+
* - Multi-file merge via mergeThemes()
|
|
117
|
+
*/
|
|
118
|
+
/** Extracted and categorized custom tokens from @theme blocks. */
|
|
119
|
+
interface ParsedTheme {
|
|
120
|
+
/** Custom color names (from --color-*): e.g. ['brand', 'brand-dark'] */
|
|
121
|
+
colors: string[];
|
|
122
|
+
/** Custom spacing tokens (from --spacing-*): e.g. ['xl', '2xs'] */
|
|
123
|
+
spacings: string[];
|
|
124
|
+
/** Custom font families (from --font-*): e.g. ['display', 'body'] */
|
|
125
|
+
fonts: string[];
|
|
126
|
+
/** Custom border radii (from --radius-*): e.g. ['button'] */
|
|
127
|
+
radii: string[];
|
|
128
|
+
/** Custom shadows (from --shadow-*): e.g. ['card'] */
|
|
129
|
+
shadows: string[];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Parse all @theme blocks in a CSS file and extract design tokens.
|
|
133
|
+
*
|
|
134
|
+
* @param cssContent - Raw CSS file content
|
|
135
|
+
* @returns Categorized design tokens
|
|
136
|
+
*/
|
|
137
|
+
declare function parseThemeBlocks(cssContent: string): ParsedTheme;
|
|
138
|
+
/**
|
|
139
|
+
* Merge multiple ParsedTheme objects into one, deduplicating tokens.
|
|
140
|
+
*
|
|
141
|
+
* @param themes - Array of parsed themes to merge
|
|
142
|
+
* @returns Merged theme with unique tokens per category
|
|
143
|
+
*/
|
|
144
|
+
declare function mergeThemes(themes: ParsedTheme[]): ParsedTheme;
|
|
145
|
+
/**
|
|
146
|
+
* Check if a ParsedTheme has any tokens.
|
|
147
|
+
*
|
|
148
|
+
* @param theme - Parsed theme to check
|
|
149
|
+
* @returns True if at least one category has tokens
|
|
150
|
+
*/
|
|
151
|
+
declare function hasTokens(theme: ParsedTheme): boolean;
|
|
152
|
+
|
|
153
|
+
export { assertNoRSCBoundaryViolation, assertNoRSCGraphViolation, createRSCModuleRecord, findRSCBoundaryViolation, findRSCGraphViolation, hasTokens, hasUseClientDirective, hasUseServerDirective, isRSCServerModule, mergeThemes, parseThemeBlocks };
|
|
154
|
+
export type { ParsedTheme, RSCBoundaryViolation, RSCModuleRecord };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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, e as esbuildPlugin, f as findRSCBoundaryViolation, d as findRSCGraphViolation, h as hasTokens, g as hasUseClientDirective, i as hasUseServerDirective, j as isRSCServerModule, m as mangleCodeClassesSync, k as mergeThemes, p as parseThemeBlocks, r as rollupPlugin, u as unplugin, v as vitePlugin, w as webpackPlugin } from './shared/unplugin.DCv0RtVZ.mjs';
|
|
3
|
+
import 'postcss';
|
|
4
|
+
import 'postcss-selector-parser';
|
|
5
|
+
import 'node:fs';
|
|
6
|
+
import 'node:path';
|
|
7
|
+
import '@csszyx/compiler';
|
|
8
|
+
import '@csszyx/core';
|
|
9
|
+
import '@csszyx/svelte-adapter';
|
|
10
|
+
import '@csszyx/vue-adapter';
|
|
11
|
+
import 'unplugin';
|
|
12
|
+
import 'node:crypto';
|