Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let vendorHashesJson, vendorSourceListMap, vendorSource, vendorMap;
if (settings.webpackDll && dll) {
const name = `vendor_${platform}`;
const jsonPath = path.join('..', settings.dllBuildDir, `${name}_dll.json`);
config.plugins.push(new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: require(jsonPath) // eslint-disable-line import/no-dynamic-require
}));
vendorHashesJson = JSON.parse(fs.readFileSync(path.join(settings.dllBuildDir, `${name}_dll_hashes.json`)));
vendorSource = new RawSource(fs.readFileSync(path.join(settings.dllBuildDir, vendorHashesJson.name)).toString() + "\n");
vendorMap = new RawSource(fs.readFileSync(path.join(settings.dllBuildDir, vendorHashesJson.name + ".map")).toString());
if (platform !== 'web') {
const vendorAssets = JSON.parse(fs.readFileSync(path.join(settings.dllBuildDir, vendorHashesJson.name + ".assets")).toString());
config.plugins.push(new MobileAssetsPlugin(vendorAssets));
}
vendorSourceListMap = fromStringWithSourceMap(
vendorSource.source(),
JSON.parse(vendorMap.source())
);
}
let compiler = webpack(config);
compiler.plugin('after-emit', (compilation, callback) => {
if (backendFirstStart) {
if (settings.backend) {
logger.debug("Webpack dev server is waiting for backend to start...");
const { host } = url.parse(settings.backendUrl.replace('{ip}', ip.address()));
waitOn({ resources: [`tcp:${host}`] }, err => {
if (err) {
logger.error(err);
callback();
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);
}