Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(this.files).forEach(function(file) {
var content = this.files[file];
this.map.setSourceContent(file, content);
if (this.options.inputSourcemaps !== false) {
var originalMap = sourceMapResolve.resolveSync(
content, file, fs.readFileSync);
if (originalMap) {
var map = new SourceMapConsumer(originalMap.map);
var relativeTo = originalMap.sourcesRelativeTo;
this.map.applySourceMap(map, file, urix(path.dirname(relativeTo)));
}
}
}, this);
};
private getSourceMapConsumer(filePath: string): SourceMap.SourceMapConsumer {
if (filePath in this.sourceMapConsumers) {
return this.sourceMapConsumers[filePath];
}
try {
var content = fs.readFileSync(filePath).toString();
var sourceMap = SourceMapResolve.resolveSync(content, filePath, fs.readFileSync);
var consumer = sourceMap ? new SourceMap.SourceMapConsumer(sourceMap.map) : null;
if (consumer) {
consumer['resolvePath'] = (filePath: string) => path.resolve(path.dirname(sourceMap.sourcesRelativeTo), filePath);
}
this.sourceMapConsumers[filePath] = consumer;
return consumer;
} catch (e) {
this.sourceMapConsumers[filePath] = undefined;
}
}
Object.keys(this.files).forEach(function(file) {
var content = this.files[file];
this.map.setSourceContent(file, content);
if (this.options.inputSourcemaps !== false) {
var originalMap = sourceMapResolve.resolveSync(
content, file, fs.readFileSync);
if (originalMap) {
var map = new SourceMapConsumer(originalMap.map);
var relativeTo = originalMap.sourcesRelativeTo;
this.map.applySourceMap(map, file, urix(path.dirname(relativeTo)));
}
}
}, this);
};
Object.keys(this.files).forEach(function(file) {
var originalMap = sourceMapResolve.resolveSync(
this.files[file], file, fs.readFileSync);
if (originalMap) {
originalMap = new SourceMapConsumer(originalMap.map);
this.map.applySourceMap(originalMap, file);
}
}, this);
};
Object.keys(this.files).forEach(function(file) {
var content = this.files[file];
this.map.setSourceContent(file, content);
if (this.options.inputSourcemaps !== false) {
var originalMap = sourceMapResolve.resolveSync(
content, file, fs.readFileSync);
if (originalMap) {
var map = new SourceMapConsumer(originalMap.map);
var relativeTo = originalMap.sourcesRelativeTo;
this.map.applySourceMap(map, file, urix(path.dirname(relativeTo)));
}
}
}, this);
};
SourceUtils.prototype.getSourceMapConsumer = function (filePath) {
if (filePath in this.sourceMapConsumers) {
return this.sourceMapConsumers[filePath];
}
try {
var content = fs.readFileSync(filePath).toString();
var sourceMap = SourceMapResolve.resolveSync(content, filePath, fs.readFileSync);
var consumer = sourceMap ? new SourceMap.SourceMapConsumer(sourceMap.map) : null;
if (consumer) {
consumer['resolvePath'] = function (filePath) { return path.resolve(path.dirname(sourceMap.sourcesRelativeTo), filePath); };
}
this.sourceMapConsumers[filePath] = consumer;
return consumer;
}
catch (e) {
this.sourceMapConsumers[filePath] = undefined;
}
};
SourceUtils.prototype.resolveSource = function (source) {
Object.keys(this.files).forEach(function(file) {
var content = this.files[file];
this.map.setSourceContent(file, content);
if (this.options.inputSourcemaps === true) {
var originalMap = sourceMapResolve.resolveSync(content, file, fs.readFileSync);
if (originalMap) {
var map = new SourceMap.SourceMapConsumer(originalMap.map);
var relativeTo = originalMap.sourcesRelativeTo;
this.map.applySourceMap(map, file, unixify(path.dirname(relativeTo)));
}
}
}, this);
};
SourceUtils.prototype.getSourceMapConsumer = function (filePath) {
if (filePath in this.sourceMapConsumers) {
return this.sourceMapConsumers[filePath];
}
try {
var content = fs.readFileSync(filePath).toString();
var sourceMap = SourceMapResolve.resolveSync(content, filePath, fs.readFileSync);
var consumer = sourceMap ? new SourceMap.SourceMapConsumer(sourceMap.map) : null;
if (consumer) {
consumer['resolvePath'] = function (filePath) { return path.resolve(path.dirname(sourceMap.sourcesRelativeTo), filePath); };
}
this.sourceMapConsumers[filePath] = consumer;
return consumer;
}
catch (e) {
this.sourceMapConsumers[filePath] = undefined;
}
};
SourceUtils.prototype.resolveSource = function (source) {