How to use source-list-map - 10 common examples

To help you get started, we’ve selected a few source-list-map examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sysgears / apollo-universal-starter-kit / tools / webpack.run.js View on Github external
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();
github terinjokes / gulp-uglify / test / sourcemap.js View on Github external
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'});
github webpack / webpack-sources / lib / RawSource.js View on Github external
listMap(options) {
		if (this._value === undefined) {
			this._value = this._valueAsBuffer.toString("utf-8");
		}
		return new SourceListMap(this._value);
	}
github webpack / core / lib / SourceMapSource.js View on Github external
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);
};
github myFace-KYC / Identity_Verification / node_modules / webpack-sources / lib / SourceMapSource.js View on Github external
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);
	}
github webpack / webpack-sources / lib / LineToLineMappedSource.js View on Github external
listMap(options) {
		return new SourceListMap(this._value, this._name, this._originalSource)
	}
github webpack / core / lib / ConcatSource.js View on Github external
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;
};
github webpack / core / lib / OriginalSource.js View on Github external
OriginalSource.prototype.listMap = function(options) {
	return new SourceListMap(this._value, this._name, this._value)
};
github makuga01 / dnsFookup / FE / node_modules / webpack-sources / lib / SourceMapSource.js View on Github external
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);
	}

source-list-map

Fast line to line SourceMap generator.

MIT
Latest version published 6 years ago

Package Health Score

65 / 100
Full package analysis