@@ -20,10 +20,7 @@ function getNodeFromUrlFunc(node) {
20
20
function ruleValidate ( rule , decl , result , options ) {
21
21
// https://www.w3.org/TR/css-syntax-3/#typedef-url-token
22
22
if ( rule . url . replace ( / ^ [ \s ] + | [ \s ] + $ / g, '' ) . length === 0 ) {
23
- result . warn (
24
- `Unable to find uri in '${ decl ? decl . toString ( ) : decl . value } '` ,
25
- { node : decl }
26
- ) ;
23
+ result . warn ( `Unable to find uri in '${ decl . toString ( ) } '` , { node : decl } ) ;
27
24
28
25
return false ;
29
26
}
@@ -139,13 +136,7 @@ export default postcss.plugin(pluginName, (options) => (css, result) => {
139
136
const replacementsMap = new Map ( ) ;
140
137
const urlToHelper = require . resolve ( '../runtime/getUrl.js' ) ;
141
138
142
- let parsedResults ;
143
-
144
- try {
145
- parsedResults = await walkCssAsync ( css , result , options ) ;
146
- } catch ( error ) {
147
- reject ( error ) ;
148
- }
139
+ const parsedResults = await walkCssAsync ( css , result , options ) ;
149
140
150
141
if ( parsedResults . length === 0 ) {
151
142
resolve ( ) ;
@@ -169,9 +160,7 @@ export default postcss.plugin(pluginName, (options) => (css, result) => {
169
160
// 'CSS_LOADER_GET_URL_IMPORT'
170
161
order : 2 ,
171
162
importName : '___CSS_LOADER_GET_URL_IMPORT___' ,
172
- url : options . urlHandler
173
- ? options . urlHandler ( urlToHelper )
174
- : urlToHelper ,
163
+ url : options . urlHandler ( urlToHelper ) ,
175
164
index,
176
165
} ,
177
166
} ) ;
@@ -236,9 +225,7 @@ export default postcss.plugin(pluginName, (options) => (css, result) => {
236
225
// 'CSS_LOADER_URL_IMPORT'
237
226
order : 3 ,
238
227
importName,
239
- url : options . urlHandler
240
- ? options . urlHandler ( resolvedUrl )
241
- : resolvedUrl ,
228
+ url : options . urlHandler ( resolvedUrl ) ,
242
229
index : currentIndex ,
243
230
} ,
244
231
} ) ;
0 commit comments