File tree Expand file tree Collapse file tree 4 files changed +8
-20
lines changed Expand file tree Collapse file tree 4 files changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ var joinMedia = require("./lib/join-media")
55var resolveId = require ( "./lib/resolve-id" )
66var loadContent = require ( "./lib/load-content" )
77var parseStatements = require ( "./lib/parse-statements" )
8+ var promiseEach = require ( "promise-each" )
89
910function AtImport ( options ) {
1011 options = assign ( {
@@ -163,7 +164,7 @@ function parseStyles(
163164) {
164165 var statements = parseStatements ( result , styles )
165166
166- return Promise . all ( statements . map ( function ( stmt ) {
167+ return Promise . resolve ( statements ) . then ( promiseEach ( function ( stmt ) {
167168 stmt . media = joinMedia ( media , stmt . media || [ ] )
168169
169170 // skip protocol base uri (protocol://url) or protocol-relative
Original file line number Diff line number Diff line change 2222 "pkg-resolve" : " ^0.1.7" ,
2323 "postcss" : " ^5.0.14" ,
2424 "postcss-value-parser" : " ^3.2.3" ,
25+ "promise-each" : " ^2.2.0" ,
2526 "read-cache" : " ^1.0.0" ,
2627 "resolve" : " ^1.1.7"
2728 },
Original file line number Diff line number Diff line change @@ -3,27 +3,13 @@ import compareFixtures from "./helpers/compare-fixtures"
33
44test ( `should order nested imports correctly` , t => {
55 var first = true
6- var resolve = require ( "resolve " )
6+ var path = require ( "path " )
77
88 return compareFixtures ( t , "order" , {
99 path : "fixtures/imports" ,
10- resolve : ( id , base , opts ) => {
11- var resolveOpts = {
12- basedir : base ,
13- moduleDirectory : [ ] ,
14- paths : opts . path ,
15- extensions : [ ".css" ] ,
16- }
17-
18- return new Promise ( function ( res , rej ) {
19- var doResolve = ( ) => {
20- resolve ( id , resolveOpts , function ( err , path ) {
21- if ( err ) {
22- return rej ( err )
23- }
24- res ( path )
25- } )
26- }
10+ resolve : ( id ) => {
11+ return new Promise ( function ( res ) {
12+ var doResolve = ( ) => res ( path . resolve ( "fixtures/imports" , id ) )
2713
2814 if ( first ) {
2915 // Delay the first import so the second gets loaded first
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ test("should apply plugins to root", t => {
2929 } )
3030 . then ( ( ) => {
3131 t . deepEqual ( atRules , [ "import" ] )
32- t . deepEqual ( rules , [ "bar " , "foo " ] )
32+ t . deepEqual ( rules , [ "foo " , "bar " ] )
3333 } )
3434} )
3535
You can’t perform that action at this time.
0 commit comments