Skip to content

Commit 4bb8d2d

Browse files
committedOct 22, 2016
Merge cherry-pick
1 parent 675ef67 commit 4bb8d2d

File tree

3 files changed

+33
-46
lines changed

3 files changed

+33
-46
lines changed
 

‎.travis.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
sudo: false
2-
32
language: node_js
4-
53
node_js:
6-
- 6
7-
- 4
8-
- 0.12
9-
10-
cache:
11-
directories:
12-
- node_modules
13-
14-
install:
15-
- npm i -g npm@latest
16-
- npm install
17-
4+
- stable
5+
- '0.12'
6+
- '0.10'
187
after_script:
198
- npm run coveralls
20-
219
branches:
2210
except:
2311
- /^v[0-9]/

‎README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## gulp-sourcemaps [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url]
22

3+
### Branching
4+
5+
- master: is latest currently (2.X) - node > 4.X
6+
- 1.X: is node 0.X - only issues appear to be es6
7+
8+
Preferably, we would like move on from node 0.X as much as possible as some of the dependencies are doing so as well. Meaning for features please target master for PRs. If bugs are found to be relvant to both 1.X and master then please target PRs for the 1.X branch to make git merging easier.
9+
310
### Usage
411

512
#### Write inline source maps
@@ -264,7 +271,7 @@ gulp.src(['src/test.js', 'src/testdir/test2.js'], { base: 'src' })
264271
.pipe(sourcemaps.write('../maps', {
265272
mapFile: function(mapFilePath) {
266273
// source map files are named *.map instead of *.js.map
267-
return mapFile.replace('.js.map', '.map');
274+
return mapFilePath.replace('.js.map', '.map');
268275
}
269276
}))
270277
.pipe(gulp.dest('public/scripts'));

‎src/write.js

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -148,36 +148,28 @@ function write(destPath, options) {
148148
}
149149
}
150150

151-
// add new source map file to stream
152-
var sourceMapFile = new File({
153-
cwd: file.cwd,
154-
base: file.base,
155-
path: sourceMapPath,
156-
contents: new Buffer(JSON.stringify(sourceMap)),
157-
stat: {
158-
isFile: function() {
159-
return true;
160-
},
161-
isDirectory: function() {
162-
return false;
163-
},
164-
isBlockDevice: function() {
165-
return false;
166-
},
167-
isCharacterDevice: function() {
168-
return false;
169-
},
170-
isSymbolicLink: function() {
171-
return false;
172-
},
173-
isFIFO: function() {
174-
return false;
175-
},
176-
isSocket: function() {
177-
return false;
178-
}
179-
}
180-
});
151+
var sourceMapFile;
152+
if (options.clone !== undefined) {
153+
// add new source map file to stream, clone from original to keep file.history
154+
sourceMapFile = file.clone(options.clone);
155+
} else {
156+
// add new source map file to stream
157+
sourceMapFile = new File({
158+
cwd: file.cwd,
159+
base: file.base
160+
});
161+
}
162+
sourceMapFile.path = sourceMapPath;
163+
sourceMapFile.contents = new Buffer(JSON.stringify(sourceMap));
164+
sourceMapFile.stat = {
165+
isFile: function () { return true; },
166+
isDirectory: function () { return false; },
167+
isBlockDevice: function () { return false; },
168+
isCharacterDevice: function () { return false; },
169+
isSymbolicLink: function () { return false; },
170+
isFIFO: function () { return false; },
171+
isSocket: function () { return false; }
172+
};
181173
this.push(sourceMapFile);
182174

183175
var sourceMapPathRelative = path.relative(path.dirname(file.path), sourceMapPath);

0 commit comments

Comments
 (0)