Skip to content

Commit

Permalink
Breaking: Remove mapFile option
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jun 17, 2017
1 parent b2dee7c commit 52ff013
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function write(file, options, callback) {
var sourceMap = file.sourceMap;

// fix paths if Windows style paths
// TODO: should we be normalizing at all?
// An end-user can use @gulp-sourcemaps/map-file if they need normalization
sourceMap.file = helpers.unixStylePath(file.relative);

// TODO: should we be normalizing at all?
Expand Down
11 changes: 1 addition & 10 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,7 @@ function contentIncluded(file, state, options, callback) {
// TODO: use convert-source-map .toComment() when we upgrade and have charset support
comment = commentFormatter(file, 'data:application/json;charset=utf8;base64,' + base64Map);
} else {
var mapFile;

// A function option here would have already been resolved higher up
// TODO: need a test for this as a string
if (options.mapFile) {
// custom map file name
mapFile = options.mapFile;
} else {
mapFile = path.join(state.destPath, file.relative) + '.map';
}
var mapFile = path.join(state.destPath, file.relative) + '.map';

var sourceMapPath = path.join(file.base, mapFile);

Expand Down
16 changes: 0 additions & 16 deletions test/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,6 @@ describe('write', function() {
});
});

it.skip('should allow to rename map file', function(done) {
var file = makeFile();
sourcemaps.write(file, { path: '../maps', mapFile: function(mapFile) {
return mapFile.replace('.js.map', '.map');
}, destPath: 'dist' }, function(err, updatedFile, sourceMapFile) {
expect(updatedFile instanceof File).toExist();
expect(updatedFile).toEqual(file);
expect(String(updatedFile.contents)).toBe(sourceContent + '\n//# sourceMappingURL=../maps/helloworld.map\n');
expect(updatedFile.sourceMap.file).toBe('../dist/helloworld.js');
expect(sourceMapFile instanceof File).toExist();
expect(sourceMapFile.path).toBe(path.join(__dirname, 'maps/helloworld.map'));
expect(JSON.parse(sourceMapFile.contents)).toEqual(updatedFile.sourceMap);
done(err);
});
});

it('should create shortest path to map in file comment', function(done) {
var file = makeNestedFile();
sourcemaps.write(file, { path: 'dir1/maps' }, function(err, updatedFile) {
Expand Down

0 comments on commit 52ff013

Please sign in to comment.