@@ -55,6 +55,7 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
5555 return ;
5656
5757 var loader = this ;
58+ var importLoader = new loader . constructor ( ) ;
5859
5960 // backwards compat with fileURL for rootURL
6061 if ( loader . rootURL && loader . rootURL . substr ( 0 , 5 ) == 'file:' )
@@ -70,6 +71,7 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
7071
7172 var inputFiles = { } ;
7273 cssLoads . forEach ( function ( load ) {
74+ importLoader . builder = load . metadata . builder ;
7375 inputFiles [ path . relative ( baseURLPath , fromFileURL ( load . address ) ) ] = {
7476 source : load . metadata . style ,
7577 sourceMap : load . metadata . styleSourceMap
@@ -84,11 +86,28 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
8486
8587 var cwd = process . cwd ( ) ;
8688
89+ importLoader . translate = function ( load ) {
90+ return loader . translate . call ( this , load ) . then ( function ( ) {
91+ if ( load . metadata . style ) {
92+ inputFiles [ path . relative ( baseURLPath , fromFileURL ( load . address ) ) ] = {
93+ source : load . metadata . style ,
94+ sourceMap : load . metadata . styleSourceMap
95+ } ;
96+ }
97+ } ) ;
98+ } ;
99+
87100 var postCssPlugins = [ atImport ( {
88101 resolve : function ( fileName , dirname , opts ) {
89- if ( absUrl ( fileName ) )
90- return fileName ;
91- return path . relative ( baseURLPath , path . join ( dirname , fileName ) ) ;
102+ var resolved = fileName ;
103+ if ( ! absUrl ( fileName ) ) {
104+ fileName = path . join ( dirname , fileName ) ;
105+ resolved = path . relative ( baseURLPath , fileName ) ;
106+ }
107+
108+ return importLoader . import ( fileName , module . id ) . then ( function ( ) {
109+ return resolved ;
110+ } ) ;
92111 } ,
93112 load : function ( fileName , opts ) {
94113 if ( absUrl ( fileName ) )
0 commit comments