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 11var parse5 = require ( 'parse5' )
22var parser = new parse5 . Parser ( null , { locationInfo : true } )
33var cache = require ( 'lru-cache' ) ( 100 )
4- var SourceNode = require ( 'source-map' ) . SourceNode
54var SourceMapGenerator = require ( 'source-map' ) . SourceMapGenerator
65var splitRE = / \n \r | \n | \r / g
76var hash = require ( 'hash-sum' )
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ module.exports = function (css, map) {
8080 postcss ( plugins )
8181 . process ( css , opts )
8282 . then ( function ( result ) {
83- var map = JSON . parse ( result . map . toString ( ) )
83+ var map = result . map . toJSON ( )
8484 // ensure we give the style source a unique name
8585 // so that Webpack doesn't get confused
8686 map . sources [ 0 ] = query . file + '.style'
Original file line number Diff line number Diff line change 6767 "mocha" : " ^2.2.5" ,
6868 "node-libs-browser" : " ^0.5.3" ,
6969 "rimraf" : " ^2.4.0" ,
70- "source-map" : " ^0.5.1" ,
7170 "style-loader" : " ^0.13.0" ,
7271 "stylus-loader" : " ^1.4.0" ,
7372 "template-html-loader" : " ^0.0.3" ,
Original file line number Diff line number Diff line change @@ -151,17 +151,20 @@ describe('vue-loader', function () {
151151 var smc = new SourceMapConsumer ( JSON . parse ( map ) )
152152 getFile ( 'test.build.js' , function ( code ) {
153153 var line
154- code . split ( '\n' ) . some ( function ( l , i ) {
154+ var col
155+ var lines = code . split ( '\n' )
156+ lines . some ( function ( l , i ) {
155157 if ( l . indexOf ( 'Hello from Component A' ) > - 1 ) {
156- line = i + 1
158+ line = i
159+ col = lines [ i - 1 ] . length
157160 return true
158161 }
159162 } )
160163 var pos = smc . originalPositionFor ( {
161164 line : line ,
162- column : 0
165+ column : col
163166 } )
164- expect ( pos . source . indexOf ( 'webpack:///test/fixtures/ basic.vue' ) > - 1 )
167+ expect ( pos . source . indexOf ( 'basic.vue' ) > - 1 )
165168 expect ( pos . line ) . to . equal ( 15 )
166169 done ( )
167170 } )
@@ -205,7 +208,7 @@ describe('vue-loader', function () {
205208 } ) , function ( err ) {
206209 expect ( err ) . to . be . null
207210 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}' )
209212 done ( )
210213 } )
211214 } )
You can’t perform that action at this time.
0 commit comments