@@ -131,7 +131,7 @@ function parseSource(source) {
131131}
132132
133133export default ( options ) =>
134- function process ( html , result ) {
134+ function process ( html ) {
135135 let attributeList ;
136136 let maybeUrlFilter ;
137137 let root ;
@@ -180,14 +180,7 @@ export default (options) =>
180180 name = `___HTML_LOADER_IMPORT_${ imports . size } ___` ;
181181 imports . set ( key , name ) ;
182182
183- result . messages . push ( {
184- type : 'import' ,
185- value : {
186- type : 'source' ,
187- source : key ,
188- importName : name ,
189- } ,
190- } ) ;
183+ options . imports . push ( { importName : name , source : key } ) ;
191184
192185 return { key, name } ;
193186 } ;
@@ -204,15 +197,11 @@ export default (options) =>
204197 name = `___HTML_LOADER_REPLACEMENT_${ replacements . size } ___` ;
205198 replacements . set ( key , name ) ;
206199
207- result . messages . push ( {
208- type : 'replacement' ,
209- value : {
210- type : 'source' ,
211- hash,
212- importName : importItem . name ,
213- replacementName : name ,
214- unquoted,
215- } ,
200+ options . replacements . push ( {
201+ replacementName : name ,
202+ importName : importItem . name ,
203+ hash,
204+ unquoted,
216205 } ) ;
217206
218207 return { key, name } ;
@@ -257,15 +246,14 @@ export default (options) =>
257246 try {
258247 source = parseSrc ( value ) ;
259248 } catch ( error ) {
260- result . messages . push ( {
261- type : 'error' ,
262- value : new HtmlSourceError (
249+ options . errors . push (
250+ new HtmlSourceError (
263251 `Bad value for attribute "${ attribute } " on element "${ tag } ": ${ error . message } ` ,
264252 parser . startIndex ,
265253 parser . endIndex ,
266254 html
267- ) ,
268- } ) ;
255+ )
256+ ) ;
269257
270258 return ;
271259 }
@@ -294,15 +282,14 @@ export default (options) =>
294282 try {
295283 sourceSet = parseSrcset ( value ) ;
296284 } catch ( error ) {
297- result . messages . push ( {
298- type : 'error' ,
299- value : new HtmlSourceError (
285+ options . errors . push (
286+ new HtmlSourceError (
300287 `Bad value for attribute "${ attribute } " on element "${ tag } ": ${ error . message } ` ,
301288 parser . startIndex ,
302289 parser . endIndex ,
303290 html
304- ) ,
305- } ) ;
291+ )
292+ ) ;
306293
307294 return ;
308295 }
@@ -335,15 +322,14 @@ export default (options) =>
335322 try {
336323 source = parseSrc ( value ) ;
337324 } catch ( error ) {
338- result . messages . push ( {
339- type : 'error' ,
340- value : new HtmlSourceError (
325+ options . errors . push (
326+ new HtmlSourceError (
341327 `Bad value for attribute "${ attribute } " on element "${ tag } ": ${ error . message } ` ,
342328 parser . startIndex ,
343329 parser . endIndex ,
344330 html
345- ) ,
346- } ) ;
331+ )
332+ ) ;
347333
348334 return ;
349335 }
@@ -370,10 +356,7 @@ export default (options) =>
370356 this . attributesMeta = { } ;
371357 } ,
372358 onerror ( error ) {
373- result . messages . push ( {
374- type : 'error' ,
375- value : error ,
376- } ) ;
359+ options . errors . push ( error ) ;
377360 } ,
378361 } ,
379362 {
0 commit comments