File tree Expand file tree Collapse file tree 4 files changed +9
-8
lines changed Expand file tree Collapse file tree 4 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
var parse5 = require ( 'parse5' )
2
2
var parser = new parse5 . Parser ( null , { locationInfo : true } )
3
3
var cache = require ( 'lru-cache' ) ( 100 )
4
- var SourceNode = require ( 'source-map' ) . SourceNode
5
4
var SourceMapGenerator = require ( 'source-map' ) . SourceMapGenerator
6
5
var splitRE = / \n \r | \n | \r / g
7
6
var hash = require ( 'hash-sum' )
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ module.exports = function (css, map) {
80
80
postcss ( plugins )
81
81
. process ( css , opts )
82
82
. then ( function ( result ) {
83
- var map = JSON . parse ( result . map . toString ( ) )
83
+ var map = result . map . toJSON ( )
84
84
// ensure we give the style source a unique name
85
85
// so that Webpack doesn't get confused
86
86
map . sources [ 0 ] = query . file + '.style'
Original file line number Diff line number Diff line change 67
67
"mocha" : " ^2.2.5" ,
68
68
"node-libs-browser" : " ^0.5.3" ,
69
69
"rimraf" : " ^2.4.0" ,
70
- "source-map" : " ^0.5.1" ,
71
70
"style-loader" : " ^0.13.0" ,
72
71
"stylus-loader" : " ^1.4.0" ,
73
72
"template-html-loader" : " ^0.0.3" ,
Original file line number Diff line number Diff line change @@ -151,17 +151,20 @@ describe('vue-loader', function () {
151
151
var smc = new SourceMapConsumer ( JSON . parse ( map ) )
152
152
getFile ( 'test.build.js' , function ( code ) {
153
153
var line
154
- code . split ( '\n' ) . some ( function ( l , i ) {
154
+ var col
155
+ var lines = code . split ( '\n' )
156
+ lines . some (
D5B0
function ( l , i ) {
155
157
if ( l . indexOf ( 'Hello from Component A' ) > - 1 ) {
156
- line = i + 1
158
+ line = i
159
+ col = lines [ i - 1 ] . length
157
160
return true
158
161
}
159
162
} )
160
163
var pos = smc . originalPositionFor ( {
161
164
line : line ,
162
- column : 0
165
+ column : col
163
166
} )
164
- expect ( pos . source . indexOf ( 'webpack:///test/fixtures/ basic.vue' ) > - 1 )
167
+ expect ( pos . source . indexOf ( 'basic.vue' ) > - 1 )
165
168
expect ( pos . line ) . to . equal ( 15 )
166
169
done ( )
167
170
} )
@@ -205,7 +208,7 @@ describe('vue-loader', function () {
205
208
} ) , function ( err ) {
206
209
expect ( err ) . to . be . null
207
210
getFile ( 'test.output.css' , function ( data ) {
208
- expect ( data ) . to . contain ( 'h1 {\n color: #f00;\n}\nh2 {\n color: green;\n}' )
211
+ expect ( data ) . to . contain ( 'h1 {\n color: #f00;\n}\n\ nh2 {\n color: green;\n}' )
209
212
done ( )
210
213
} )
211
214
} )
You can’t perform that action at this time.
0 commit comments