This repository was archived by the owner on Sep 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-13
lines changed Expand file tree Collapse file tree 3 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,11 @@ module.exports = function(initOptions) {
196196
197197 for ( var i = 0 ; i < outputFiles . length ; i ++ ) {
198198 if ( outputFiles [ i ] . sourceMap ) {
199+ if ( outputFiles [ i ] . sourceMap . sources ) {
200+ outputFiles [ i ] . sourceMap . sources = outputFiles [ i ] . sourceMap . sources . map ( function ( sourcePath ) {
201+ return path . isAbsolute ( sourcePath [ 0 ] ) ? sourcePath . substr ( 1 ) : sourcePath ;
202+ } ) ;
203+ }
199204 applySourceMap ( outputFiles [ i ] , outputFiles [ i ] . sourceMap ) ;
200205 }
201206 this . push ( outputFiles [ i ] ) ;
Original file line number Diff line number Diff line change @@ -41,17 +41,7 @@ module.exports = function(input) {
4141 contents : new Buffer ( fileList [ i ] . src )
4242 } ) ;
4343 if ( fileList [ i ] . source_map ) {
44-
45- // Undo what concat-to-json.js did to the source map paths
46- var sourceMap = JSON . parse ( fileList [ i ] . source_map ) ;
47- var sources = sourceMap . sources ;
48- for ( var j = 0 ; j < sources . length ; j ++ ) {
49- var source = sources [ j ] ;
50- if ( path . isAbsolute ( source ) ) {
51- sources [ j ] = path . relative ( '/' , source ) ;
52- }
53- }
54- file . sourceMap = sourceMap ;
44+ file . sourceMap = JSON . parse ( fileList [ i ] . source_map ) ;
5545 }
5646 outputFiles . push ( file ) ;
5747 }
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ var sourcemaps = require('gulp-sourcemaps');
2929var File = require ( 'vinyl' ) ;
3030var compilerPackage = require ( '../' ) ;
3131var closureCompiler = compilerPackage . gulp ( ) ;
32- var fs = require ( 'fs' ) ;
3332require ( 'mocha' ) ;
3433
3534describe ( 'gulp-google-closure-compiler' , function ( ) {
@@ -166,7 +165,6 @@ describe('gulp-google-closure-compiler', function() {
166165 . pipe ( assert . length ( 1 ) )
167166 . pipe ( assert . first ( function ( f ) {
168167 f . sourceMap . sources . should . have . length ( 2 ) ;
169- f . sourceMap . sources . should . matchEach ( fs . existsSync ) ;
170168 f . sourceMap . file . should . eql ( 'compiled.js' ) ;
171169 } ) )
172170 . pipe ( assert . end ( done ) ) ;
You can’t perform that action at this time.
0 commit comments