@@ -48,7 +48,7 @@ function getWebpackIgnoreCommentValue(index, nodes, inBetween) {
48
48
return matched && matched [ 2 ] === "true" ;
49
49
}
50
50
51
- function shouldHandleURL ( url , declaration , result , options ) {
51
+ function shouldHandleURL ( url , declaration , result , isSupportDataURLInNewURL ) {
52
52
if ( url . length === 0 ) {
53
53
result . warn ( `Unable to find uri in '${ declaration . toString ( ) } '` , {
54
54
node : declaration ,
@@ -57,7 +57,7 @@ function shouldHandleURL(url, declaration, result, options) {
57
57
return false ;
58
58
}
59
59
60
- if ( isDataUrl ( url ) && options . isSupportDataURLInNewURL ) {
60
+ if ( isDataUrl ( url ) && isSupportDataURLInNewURL ) {
61
61
try {
62
62
decodeURIComponent ( url ) ;
63
63
} catch ( ignoreError ) {
@@ -74,7 +74,7 @@ function shouldHandleURL(url, declaration, result, options) {
74
74
return true ;
75
75
}
76
76
77
- function parseDeclaration ( declaration , key , result , options ) {
77
+ function parseDeclaration ( declaration , key , result , isSupportDataURLInNewURL ) {
78
78
if ( ! needParseDeclaration . test ( declaration [ key ] ) ) {
79
79
return ;
80
80
}
@@ -141,7 +141,9 @@ function parseDeclaration(declaration, key, result, options) {
141
141
url = normalizeUrl ( url , isStringValue ) ;
142
142
143
143
// Do not traverse inside `url`
144
- if ( ! shouldHandleURL ( url , declaration , result , options ) ) {
144
+ if (
145
+ ! shouldHandleURL ( url , declaration , result , isSupportDataURLInNewURL )
146
+ ) {
145
147
// eslint-disable-next-line consistent-return
146
148
return false ;
147
149
}
@@ -197,7 +199,9 @@ function parseDeclaration(declaration, key, result, options) {
197
199
url = normalizeUrl ( url , isStringValue ) ;
198
200
199
201
// Do not traverse inside `url`
200
- if ( ! shouldHandleURL ( url , declaration , result , options ) ) {
202
+ if (
203
+ ! shouldHandleURL ( url , declaration , result , isSupportDataURLInNewURL )
204
+ ) {
201
205
// eslint-disable-next-line consistent-return
202
206
return false ;
203
207
}
@@ -240,7 +244,9 @@ function parseDeclaration(declaration, key, result, options) {
240
244
let url = normalizeUrl ( value , true ) ;
241
245
242
246
// Do not traverse inside `url`
243
- if ( ! shouldHandleURL ( url , declaration , result , options ) ) {
247
+ if (
248
+ ! shouldHandleURL ( url , declaration , result , isSupportDataURLInNewURL )
249
+ ) {
244
250
// eslint-disable-next-line consistent-return
245
251
return false ;
246
252
}
@@ -282,11 +288,12 @@ const plugin = (options = {}) => {
282
288
283
289
return {
284
290
Declaration ( declaration ) {
291
+ const { isSupportDataURLInNewURL } = options ;
285
292
const parsedURL = parseDeclaration (
286
293
declaration ,
287
294
"value" ,
288
295
result ,
289
- options
296
+ isSupportDataURLInNewURL
290
297
) ;
291
298
292
299
if ( ! parsedURL ) {
0 commit comments