Skip to content

Commit 11265af

Browse files
committed
Breaking: Avoid loading sources during the write method
1 parent 956e5a3 commit 11265af

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

lib/helpers.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -214,31 +214,6 @@ function commentFormatter(extname, url) {
214214
return convert.generateMapFileComment(url, opts);
215215
}
216216

217-
function includeContent(file, state, callback) {
218-
219-
state.sourceMap.sourcesContent = state.sourceMap.sourcesContent || [];
220-
221-
function loadSources(sourcePath, idx, cb) {
222-
if (state.sourceMap.sourcesContent[idx]) {
223-
return cb();
224-
}
225-
226-
var basePath = state.sourceMap.sourceRoot || file.base;
227-
var absPath = path.resolve(basePath, sourcePath);
228-
fs.readFile(absPath, 'utf8', onRead);
229-
230-
function onRead(err, data) {
231-
if (err) {
232-
return cb();
233-
}
234-
state.sourceMap.sourcesContent[idx] = stripBom(data);
235-
cb();
236-
}
237-
}
238-
239-
async.eachOf(file.sourceMap.sources, loadSources, callback);
240-
}
241-
242217
function contentIncluded(file, state, callback) {
243218

244219
var comment;
@@ -277,7 +252,6 @@ function contentIncluded(file, state, callback) {
277252

278253
function writeSourceMaps(file, state, callback) {
279254
var tasks = [
280-
includeContent,
281255
contentIncluded
282256
];
283257

test/write.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -243,25 +243,4 @@ describe('write', function() {
243243
done(err);
244244
});
245245
});
246-
247-
it('should fetch missing sourceContent', function(done) {
248-
var file = makeFile();
249-
delete file.sourceMap.sourcesContent;
250-
sourcemaps.write(file, function(err, updatedFile) {
251-
expect(updatedFile.sourceMap.sourcesContent).toNotBe(undefined);
252-
expect(updatedFile.sourceMap.sourcesContent).toEqual([sourceContent]);
253-
done(err);
254-
});
255-
});
256-
257-
it('should not throw when unable to fetch missing sourceContent', function(done) {
258-
var file = makeFile();
259-
file.sourceMap.sources[0] += '.invalid';
260-
delete file.sourceMap.sourcesContent;
261-
sourcemaps.write(file, function(err, updatedFile) {
262-
expect(updatedFile.sourceMap.sourcesContent).toNotBe(undefined);
263-
expect(updatedFile.sourceMap.sourcesContent).toEqual([]);
264-
done(err);
265-
});
266-
});
267246
});

0 commit comments

Comments
 (0)