@@ -77,8 +77,8 @@ export function parseImportParams(params: ValueParser.ValueAstNode[]) {
7777 if ( node . kind === 'separator' ) continue
7878
7979 if ( node . kind === 'word' && ! uri ) {
80- if ( ! node . value ) throw new Error ( `Unable to find uri` )
81- if ( node . value [ 0 ] !== '"' && node . value [ 0 ] !== "'" ) throw new Error ( 'Unable to find uri' )
80+ if ( ! node . value ) return null
81+ if ( node . value [ 0 ] !== '"' && node . value [ 0 ] !== "'" ) return null
8282
8383 uri = node . value . slice ( 1 , - 1 )
8484 continue
@@ -91,17 +91,18 @@ export function parseImportParams(params: ValueParser.ValueAstNode[]) {
9191 return null
9292 }
9393
94- if ( ! uri ) throw new Error ( 'Unable to find uri' )
94+ if ( ! uri ) return null
9595
9696 if (
9797 ( node . kind === 'word' || node . kind === 'function' ) &&
9898 node . value . toLowerCase ( ) === 'layer'
9999 ) {
100- if ( layer ) throw new Error ( 'Multiple layers' )
101- if ( supports )
100+ if ( layer ) return null
101+ if ( supports ) {
102102 throw new Error (
103103 '`layer(…)` in an `@import` should come before any other functions or conditions' ,
104104 )
105+ }
105106
106107 if ( 'nodes' in node ) {
107108 layer = ValueParser . toCss ( node . nodes )
@@ -113,7 +114,7 @@ export function parseImportParams(params: ValueParser.ValueAstNode[]) {
113114 }
114115
115116 if ( node . kind === 'function' && node . value . toLowerCase ( ) === 'supports' ) {
116- if ( supports ) throw new Error ( 'Multiple support conditions' )
117+ if ( supports ) return null
117118 supports = ValueParser . toCss ( node . nodes )
118119 continue
119120 }
@@ -122,7 +123,7 @@ export function parseImportParams(params: ValueParser.ValueAstNode[]) {
122123 break
123124 }
124125
125- if ( ! uri ) throw new Error ( 'Unable to find uri' )
126+ if ( ! uri ) return null
126127
127128 return { uri, layer, media, supports }
128129}
0 commit comments