@@ -27,8 +27,15 @@ function parse(data) {
27
27
}
28
28
}
29
29
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
+
31
34
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 ) ;
32
39
return callback ( ) ;
33
40
}
34
41
@@ -59,7 +66,7 @@ function loadSourceMap(file, state, options, callback) {
59
66
}
60
67
61
68
// fix source paths and sourceContent for imported source map
62
- function fixImportedSourceMap ( file , state , options , callback ) {
69
+ function fixImportedSourceMap ( file , state , callback ) {
63
70
if ( ! state . map ) {
64
71
return callback ( ) ;
65
72
}
@@ -120,7 +127,7 @@ function fixImportedSourceMap(file, state, options, callback) {
120
127
}
121
128
}
122
129
123
- function mapsLoaded ( file , state , options , callback ) {
130
+ function mapsLoaded ( file , state , callback ) {
124
131
125
132
if ( ! state . map ) {
126
133
state . map = {
@@ -143,27 +150,14 @@ function mapsLoaded(file, state, options, callback) {
143
150
callback ( ) ;
144
151
}
145
152
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 ) {
160
154
var tasks = [
161
155
loadSourceMap ,
162
156
fixImportedSourceMap ,
163
157
mapsLoaded ,
164
158
] ;
165
159
166
- async . applyEachSeries ( tasks , file , state , options , done ) ;
160
+ async . applyEachSeries ( tasks , file , state , done ) ;
167
161
168
162
function done ( err ) {
169
163
if ( err ) {
@@ -334,7 +328,6 @@ function writeSourceMaps(file, state, options, callback) {
334
328
}
335
329
336
330
module . exports = {
337
- loadInlineMaps : loadInlineMaps ,
338
331
addSourceMaps : addSourceMaps ,
339
332
writeSourceMaps : writeSourceMaps ,
340
333
unixStylePath : unixStylePath ,
0 commit comments