@@ -27,8 +27,15 @@ function parse(data) {
2727 }
2828}
2929
30- function loadSourceMap ( file , state , options , callback ) {
30+ function loadSourceMap ( file , state , callback ) {
31+ // Try to read inline source map
32+ state . map = convert . fromSource ( state . content ) ;
33+
3134 if ( state . map ) {
35+ state . map = state . map . toObject ( ) ;
36+ // sources in map are relative to the source file
37+ state . path = path . dirname ( file . path ) ;
38+ state . content = convert . removeComments ( state . content ) ;
3239 return callback ( ) ;
3340 }
3441
@@ -59,7 +66,7 @@ function loadSourceMap(file, state, options, callback) {
5966}
6067
6168// fix source paths and sourceContent for imported source map
62- function fixImportedSourceMap ( file , state , options , callback ) {
69+ function fixImportedSourceMap ( file , state , callback ) {
6370 if ( ! state . map ) {
6471 return callback ( ) ;
6572 }
@@ -120,7 +127,7 @@ function fixImportedSourceMap(file, state, options, callback) {
120127 }
121128}
122129
123- function mapsLoaded ( file , state , options , callback ) {
130+ function mapsLoaded ( file , state , callback ) {
124131
125132 if ( ! state . map ) {
126133 state . map = {
@@ -143,27 +150,14 @@ function mapsLoaded(file, state, options, callback) {
143150 callback ( ) ;
144151}
145152
146- function loadInlineMaps ( file , state ) {
147- // Try to read inline source map
148- state . map = convert . fromSource ( state . content ) ;
149-
150- if ( state . map ) {
151- state . map = state . map . toObject ( ) ;
152- // sources in map are relative to the source file
153- state . path = path . dirname ( file . path ) ;
154- state . content = convert . removeComments ( state . content ) ;
155- }
156- }
157-
158- function addSourceMaps ( file , state , options , callback ) {
159-
153+ function addSourceMaps ( file , state , callback ) {
160154 var tasks = [
161155 loadSourceMap ,
162156 fixImportedSourceMap ,
163157 mapsLoaded ,
164158 ] ;
165159
166- async . applyEachSeries ( tasks , file , state , options , done ) ;
160+ async . applyEachSeries ( tasks , file , state , done ) ;
167161
168162 function done ( err ) {
169163 if ( err ) {
@@ -334,7 +328,6 @@ function writeSourceMaps(file, state, options, callback) {
334328}
335329
336330module . exports = {
337- loadInlineMaps : loadInlineMaps ,
338331 addSourceMaps : addSourceMaps ,
339332 writeSourceMaps : writeSourceMaps ,
340333 unixStylePath : unixStylePath ,
0 commit comments