@@ -260,10 +260,16 @@ class CssParser extends Parser {
260260 const parseExports = ( input , pos ) => {
261261 pos = walkCssTokens . eatWhitespaceAndComments ( input , pos ) ;
262262 const cc = input . charCodeAt ( pos ) ;
263- if ( cc !== CC_LEFT_CURLY )
264- throw new Error (
265- `Unexpected ${ input [ pos ] } at ${ pos } during parsing of ':export' (expected '{')`
263+ if ( cc !== CC_LEFT_CURLY ) {
264+ this . _emitWarning (
265+ state ,
266+ `Unexpected '${ input [ pos ] } ' at ${ pos } during parsing of ':export' (expected '{')` ,
267+ locConverter ,
268+ pos ,
269+ pos
266270 ) ;
271+ return pos ;
272+ }
267273 pos ++ ;
268274 pos = walkCssTokens . eatWhitespaceAndComments ( input , pos ) ;
269275 for ( ; ; ) {
@@ -275,9 +281,14 @@ class CssParser extends Parser {
275281 [ pos , name ] = eatText ( input , pos , eatExportName ) ;
276282 if ( pos === input . length ) return pos ;
277283 if ( input . charCodeAt ( pos ) !== CC_COLON ) {
278- throw new Error (
279- `Unexpected ${ input [ pos ] } at ${ pos } during parsing of export name in ':export' (expected ':')`
284+ this . _emitWarning (
285+ state ,
286+ `Unexpected '${ input [ pos ] } ' at ${ pos } during parsing of export name in ':export' (expected ':')` ,
287+ locConverter ,
288+ start ,
289+ pos
280290 ) ;
291+ return pos ;
281292 }
282293 pos ++ ;
283294 if ( pos === input . length ) return pos ;
@@ -293,9 +304,14 @@ class CssParser extends Parser {
293304 pos = walkCssTokens . eatWhitespaceAndComments ( input , pos ) ;
294305 if ( pos === input . length ) return pos ;
295306 } else if ( cc !== CC_RIGHT_CURLY ) {
296- throw new Error (
297- `Unexpected ${ input [ pos ] } at ${ pos } during parsing of export value in ':export' (expected ';' or '}')`
307+ this . _emitWarning (
308+ state ,
309+ `Unexpected '${ input [ pos ] } ' at ${ pos } during parsing of export value in ':export' (expected ';' or '}')` ,
310+ locConverter ,
311+ start ,
312+ pos
298313 ) ;
314+ return pos ;
299315 }
300316 const dep = new CssExportDependency ( name , value ) ;
301317 const { line : sl , column : sc } = locConverter . get ( start ) ;
@@ -526,23 +542,41 @@ class CssParser extends Parser {
526542 pos = newPos ;
527543 if ( pos === input . length ) return pos ;
528544 if ( input . charCodeAt ( pos ) !== CC_LEFT_CURLY ) {
529- throw new Error (
530- `Unexpected ${ input [ pos ] } at ${ pos } during parsing of @media or @supports (expected '{')`
545+ this . _emitWarning (
546+ state ,
547+ `Unexpected ${ input [ pos ] } at ${ pos } during parsing of @media or @supports (expected '{')` ,
548+ locConverter ,
549+ start ,
550+ pos
531551 ) ;
552+ return pos ;
532553 }
533554 return pos + 1 ;
534555 }
535556 return end ;
536557 } ,
537558 semicolon : ( input , start , end ) => {
538559 switch ( mode ) {
539- case CSS_MODE_AT_IMPORT_EXPECT_URL :
540- throw new Error ( `Expected URL for @import at ${ start } ` ) ;
560+ case CSS_MODE_AT_IMPORT_EXPECT_URL : {
561+ this . _emitWarning (
562+ state ,
563+ `Expected URL for @import at ${ start } ` ,
564+ locConverter ,
565+ start ,
566+ end
567+ ) ;
568+ return end ;
569+ }
541570 case CSS_MODE_AT_IMPORT_EXPECT_LAYER_OR_SUPPORTS_OR_MEDIA : {
542571 if ( modeData . url === undefined ) {
543- throw new Error (
544- `Expected URL for @import at ${ modeData . atRuleStart } `
572+ this . _emitWarning (
573+ state ,
574+ `Expected URL for @import at ${ modeData . atRuleStart } ` ,
575+ locConverter ,
576+ modeData . atRuleStart ,
577+ modeData . lastPos
545578 ) ;
579+ return end ;
546580 }
547581 const semicolonPos = end ;
548582 const { line : sl , column : sc } = locConverter . get (
0 commit comments