File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ var resolveId = require("./lib/resolve-id")
66var loadContent = require ( "./lib/load-content" )
77var processContent = require ( "./lib/process-content" )
88var parseStatements = require ( "./lib/parse-statements" )
9- var promiseEach = require ( "promise-each" )
109
1110function AtImport ( options ) {
1211 options = assign ( {
@@ -174,20 +173,27 @@ function parseStyles(
174173) {
175174 var statements = parseStatements ( result , styles )
176175
177- return Promise . resolve ( statements ) . then ( promiseEach ( function ( stmt ) {
178- stmt . media = joinMedia ( media , stmt . media || [ ] )
176+ return Promise . resolve ( statements ) . then ( function ( stmts ) {
177+ // process each statement in series
178+ return stmts . reduce ( function ( promise , stmt ) {
179+ return promise . then ( function ( ) {
180+ stmt . media = joinMedia ( media , stmt . media || [ ] )
179181
180- // skip protocol base uri (protocol://url) or protocol-relative
181- if ( stmt . type !== "import" || / ^ (?: [ a - z ] + : ) ? \/ \/ / i. test ( stmt . uri ) ) {
182- return
183- }
184- return resolveImportId (
185- result ,
186- stmt ,
187- options ,
188- state
189- )
190- } ) ) . then ( function ( ) {
182+ // skip protocol base uri (protocol://url) or protocol-relative
183+ if ( stmt . type !== "import" || / ^ (?: [ a - z ] + : ) ? \/ \/ / i. test ( stmt . uri ) ) {
184+ return
185+ }
186+
187+ return resolveImportId (
188+ result ,
189+ stmt ,
190+ options ,
191+ state
192+ )
193+ } )
194+ } ,
195+ Promise . resolve ( ) )
196+ } ) . then ( function ( ) {
191197 var imports = [ ]
192198 var bundle = [ ]
193199
Original file line number Diff line number Diff line change 2121 "object-assign" : " ^4.0.1" ,
2222 "postcss" : " ^5.0.14" ,
2323 "postcss-value-parser" : " ^3.2.3" ,
24- "promise-each" : " ^2.2.0" ,
2524 "read-cache" : " ^1.0.0" ,
2625 "resolve" : " ^1.1.7"
2726 },
You can’t perform that action at this time.
0 commit comments