@@ -13,17 +13,15 @@ var path = require("path");
1313 * @param loaders {string[]} the absolute filenames of the loaders
1414 * @param filenames {string[]} the filenames of "contents"
1515 * @param contents {Buffer[]} read contents
16+ * @param cacheEntry {CacheEntry} the cache entry to add dependencies
1617 * @param options {object} the options of the module system
17- * @param callback {function} (err, resultingJavascriptCode )
18+ * @param callback {function} (err, arrayOfResultBuffers, allowCaching )
1819 */
1920module . exports = function ( context , request , loaders , filenames , contents , cacheEntry , options , callback ) {
2021 var loaderFunctions , cacheable = true ;
2122 if ( loaders . length === 0 ) {
2223 // if no loaders are used, the file content is the resulting code
23- var result = contents [ 0 ] . toString ( "utf-8" ) ;
24- if ( cacheEntry )
25- cacheEntry . save ( result ) ;
26- callback ( null , result ) ;
24+ callback ( null , contents , true ) ;
2725 } else {
2826 // try to load all loaders
2927 // TODO this doesn't reload the loader if it has changed
@@ -155,7 +153,7 @@ module.exports = function(context, request, loaders, filenames, contents, cacheE
155153 // ups. loader throwed an exeception
156154 if ( ! done ) {
157155 done = true ;
158- callback ( "Loader throwed exeception: " + ( typeof e === "object" && e . stack ? e . stack : e ) ) ;
156+ callback ( new Error ( "Loader throwed exeception: " + ( typeof e === "object" && e . stack ? e . stack : e ) ) ) ;
159157 } else {
160158 // loader is already "done", so we cannot use the callback function
161159 // for better debugging we print the error on the console
@@ -165,10 +163,7 @@ module.exports = function(context, request, loaders, filenames, contents, cacheE
165163 return ;
166164 }
167165 } else {
168- var result = args [ 0 ] . toString ( "utf-8" ) ;
169- if ( cacheEntry && cacheable )
170- cacheEntry . save ( result ) ;
171- callback ( null , result ) ;
166+ callback ( null , args , cacheable ) ;
172167 }
173168 }
174169}
0 commit comments