@@ -9,6 +9,8 @@ import path from 'path'
9
9
import fs from 'fs'
10
10
import { getOptions } from './options'
11
11
12
+ export { defaultMangleClassFilter } from 'tailwindcss-mangle-shared'
13
+
12
14
// cache map
13
15
const outputCachedMap = new Map <
14
16
string ,
@@ -20,7 +22,7 @@ const outputCachedMap = new Map<
20
22
> ( )
21
23
22
24
export const unplugin = createUnplugin ( ( options : Options | undefined = { } , meta ) => {
23
- const { classGenerator, getCachedClassSet, isInclude, classMapOutputOptions } = getOptions ( options )
25
+ const { classGenerator, getCachedClassSet, isInclude, classMapOutputOptions, htmlHandlerOptions , jsHandlerOptions , cssHandlerOptions } = getOptions ( options )
24
26
25
27
return {
26
28
name : pluginName ,
@@ -39,6 +41,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
39
41
const [ file , asset ] = groupedEntries . html [ i ] as [ string , OutputAsset ]
40
42
if ( isInclude ( file ) ) {
41
43
asset . source = htmlHandler ( asset . source . toString ( ) , {
44
+ ...htmlHandlerOptions ,
42
45
classGenerator,
43
46
runtimeSet
44
47
} )
@@ -50,6 +53,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
50
53
const [ file , chunk ] = groupedEntries . js [ i ] as [ string , OutputChunk ]
51
54
if ( isInclude ( file ) ) {
52
55
const code = jsHandler ( chunk . code , {
56
+ ...jsHandlerOptions ,
53
57
runtimeSet,
54
58
classGenerator
55
59
} ) . code
@@ -65,6 +69,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
65
69
const [ file , css ] = groupedEntries . css [ i ] as [ string , OutputAsset ]
66
70
if ( isInclude ( file ) ) {
67
71
css . source = cssHandler ( css . source . toString ( ) , {
72
+ ...cssHandlerOptions ,
68
73
classGenerator,
69
74
runtimeSet
70
75
} )
@@ -168,6 +173,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
168
173
const [ file , asset ] = groupedEntries . html [ i ]
169
174
if ( isInclude ( file ) ) {
170
175
const html = htmlHandler ( asset . source ( ) . toString ( ) , {
176
+ ...htmlHandlerOptions ,
171
177
classGenerator,
172
178
runtimeSet
173
179
} )
@@ -182,6 +188,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
182
188
const [ file , chunk ] = groupedEntries . js [ i ]
183
189
if ( isInclude ( file ) ) {
184
190
const code = jsHandler ( chunk . source ( ) . toString ( ) , {
191
+ ...jsHandlerOptions ,
185
192
runtimeSet,
186
193
classGenerator
187
194
} ) . code
@@ -198,6 +205,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
198
205
const [ file , css ] = groupedEntries . css [ i ]
199
206
if ( isInclude ( file ) ) {
200
207
const newCss = cssHandler ( css . source ( ) . toString ( ) , {
208
+ ...cssHandlerOptions ,
201
209
classGenerator,
202
210
runtimeSet
203
211
} )
@@ -212,6 +220,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
212
220
html . forEach ( ( asset , file ) => {
213
221
if ( isInclude ( file ) ) {
214
222
const html = htmlHandler ( ( asset as sources . Source ) . source ( ) . toString ( ) , {
223
+ ...htmlHandlerOptions ,
215
224
classGenerator,
216
225
runtimeSet
217
226
} )
@@ -226,6 +235,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
226
235
if ( isInclude ( file ) ) {
227
236
const rawCode = ( chunk as sources . Source ) . source ( ) . toString ( )
228
237
const code = jsHandler ( rawCode , {
238
+ ...jsHandlerOptions ,
229
239
runtimeSet,
230
240
classGenerator
231
241
} ) . code
@@ -241,6 +251,7 @@ export const unplugin = createUnplugin((options: Options | undefined = {}, meta)
241
251
css . forEach ( ( style , file ) => {
242
252
if ( isInclude ( file ) ) {
243
253
const newCss = cssHandler ( ( style as sources . Source ) . source ( ) . toString ( ) , {
254
+ ...cssHandlerOptions ,
244
255
classGenerator,
245
256
runtimeSet
246
257
} )
0 commit comments