File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export interface Options {
17
17
completions ?: boolean ,
18
18
} ,
19
19
//
20
- safeList ?: string [ ] ;
20
+ safeList ?: string ;
21
21
// bundle?: string;
22
22
// debug?: boolean;
23
23
// compile?: boolean;
@@ -219,6 +219,17 @@ export function windi(options: typeof OPTIONS = {}): PreprocessorGroup {
219
219
if ( OPTIONS . configPath ) {
220
220
const loadedConfig = await useConfig . load ( OPTIONS . configPath )
221
221
windiConfig = loadedConfig
222
+ if ( windiConfig . safelist ) {
223
+ if ( typeof windiConfig . safelist == 'string' ) {
224
+ OPTIONS . safeList = windiConfig . safelist
225
+ } else {
226
+ const tmpSafelist = windiConfig . safelist as ( string | string [ ] ) [ ]
227
+ // @ts -expect-error flatten on already flattened Array is fine
228
+ OPTIONS . safeList = [ ...new Set ( tmpSafelist . flat ( Infinity ) ) ] . join ( ' ' )
229
+
230
+ }
231
+ // console.log('SAFELIST', OPTIONS.safeList)
232
+ }
222
233
// OPTIONS.safeList = windiConfig.safelist
223
234
//TODO:
224
235
// if (error) useDebug.error()
@@ -276,7 +287,7 @@ export function windi(options: typeof OPTIONS = {}): PreprocessorGroup {
276
287
// TODO: MARK: SAFELIST
277
288
if ( attributes [ 'windi:safelist' ] || attributes [ 'windi:safelist:global' ] ) {
278
289
if ( OPTIONS . safeList ) {
279
- const SAFELIST = PROCESSOR . interpret ( OPTIONS . safeList . join ( ' ' ) ) . styleSheet
290
+ const SAFELIST = PROCESSOR . interpret ( OPTIONS . safeList ) . styleSheet
280
291
if ( attributes [ 'windi:safelist:global' ] ) {
281
292
SAFELIST_STYLE = globalStyleSheet ( SAFELIST ) . build ( )
282
293
} else {
You can’t perform that action at this time.
0 commit comments