Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('sourcemaps should merge when concatted', function(t) {
var inMap = new SourceListMap();
inMap.add('foo\n', 'foo.js', 'foo\n');
inMap.add('bar\n', 'bar.js', 'bar\n');
var testFile = new Vinyl({
cwd: '/home/terin/broken-promises/',
base: '/home/terin/broken-promises/test',
path: '/home/terin/broken-promises/test/test1.js',
contents: Buffer.from(String(inMap))
});
testFile.sourceMap = inMap.toStringWithSourceMap({file: 'test1.js'}).map;
var outMap = new SourceListMap();
outMap.add(' ', 'foo.js', 'foo\n');
outMap.add(' ', 'bar.js', 'bar\n');
outMap = outMap.toStringWithSourceMap({file: 'test1.js'});
listMap(options) {
if (this._value === undefined) {
this._value = this._valueAsBuffer.toString("utf-8");
}
return new SourceListMap(this._value);
}
SourceMapSource.prototype.listMap = function(options) {
if(options.module === false)
return new SourceListMap(this._value, this._name, this._value);
return fromStringWithSourceMap(this._value, typeof this._sourceMap === "string" ? JSON.parse(this._sourceMap) : this._sourceMap);
};
listMap(options) {
options = options || {};
if(options.module === false)
return new SourceListMap(this._value, this._name, this._value);
return fromStringWithSourceMap(this._value, typeof this._sourceMap === "string" ? JSON.parse(this._sourceMap) : this._sourceMap);
}
listMap(options) {
return new SourceListMap(this._value, this._name, this._originalSource)
}
ConcatSource.prototype.listMap = function(options) {
var map = new SourceListMap();
this.children.forEach(function(item) {
if(typeof item === "string")
map.add(item);
else
map.add(item.listMap(options));
});
return map;
};
OriginalSource.prototype.listMap = function(options) {
return new SourceListMap(this._value, this._name, this._value)
};
listMap(options) {
return new SourceListMap(this._value);
}
listMap(options) {
options = options || {};
if(options.module === false)
return new SourceListMap(this._value, this._name, this._value);
return fromStringWithSourceMap(this._value, typeof this._sourceMap === "string" ? JSON.parse(this._sourceMap) : this._sourceMap);
}
LineToLineMappedSource.prototype.listMap = function(options) {
return new SourceListMap(this._value, this._name, this._originalSource)
};