How to use the source-list-map.fromStringWithSourceMap function in source-list-map

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 sysgears / larix / packages / zen / src / executor.ts View on Github external
chunk.files.forEach(file => {
          if (file.endsWith('.bundle')) {
            if (builder.sourceMap) {
              const sourceListMap = new SourceListMap();
              sourceListMap.add(vendorSourceListMap);
              sourceListMap.add(
                fromStringWithSourceMap(
                  compilation.assets[file].source(),
                  JSON.parse(compilation.assets[file + '.map'].source())
                )
              );
              const sourceAndMap = sourceListMap.toStringWithSourceMap({ file });
              compilation.assets[file] = new RawSource(sourceAndMap.source);
              compilation.assets[file + '.map'] = new RawSource(JSON.stringify(sourceAndMap.map));
            } else {
              compilation.assets[file] = new ConcatSource(vendorSource, compilation.assets[file]);
            }
          }
        });
      });
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);
	}
github webpack / webpack-sources / lib / SourceMapSource.js View on Github external
listMap(options) {
		this._ensureValueString();
		this._ensureSourceMapObject();
		options = options || {};
		if (options.module === false)
			return new SourceListMap(
				this._valueAsString,
				this._name,
				this._valueAsString
			);

		return fromStringWithSourceMap(
			this._valueAsString,
			this._sourceMapAsObject
		);
	}
github sysgears / spinjs / src / executor.ts View on Github external
chunk.files.forEach(file => {
          if (file.endsWith('.bundle')) {
            if (builder.sourceMap) {
              const sourceListMap = new SourceListMap();
              sourceListMap.add(vendorSourceListMap);
              sourceListMap.add(
                fromStringWithSourceMap(
                  compilation.assets[file].source(),
                  JSON.parse(compilation.assets[file + '.map'].source())
                )
              );
              const sourceAndMap = sourceListMap.toStringWithSourceMap({ file });
              compilation.assets[file] = new RawSource(sourceAndMap.source);
              compilation.assets[file + '.map'] = new RawSource(JSON.stringify(sourceAndMap.map));
            } else {
              compilation.assets[file] = new ConcatSource(vendorSource, compilation.assets[file]);
            }
          }
        });
      });
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 fossasia / susper.com / 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 sysgears / larix / packages / zen / src / executor.ts View on Github external
fs.readFileSync(path.join(builder.dllBuildDir, `${name}_dll_hashes.json`)).toString()
    );
    vendorSource = new RawSource(
      fs.readFileSync(path.join(builder.dllBuildDir, vendorHashesJson.name)).toString() + '\n'
    );
    if (platform !== 'web') {
      const vendorAssets = JSON.parse(
        fs.readFileSync(path.join(builder.dllBuildDir, vendorHashesJson.name + '.assets')).toString()
      );
      config.plugins.push(new MobileAssetsPlugin(vendorAssets));
    }
    if (builder.sourceMap) {
      vendorMap = new RawSource(
        fs.readFileSync(path.join(builder.dllBuildDir, vendorHashesJson.name + '.map')).toString()
      );
      vendorSourceListMap = fromStringWithSourceMap(vendorSource.source(), JSON.parse(vendorMap.source()));
    }
  }

  const compiler = webpack(config);
  let awaitedAlready = false;

  hookAsync(compiler, 'after-emit', (compilation, callback) => {
    if (!awaitedAlready) {
      if (hasBackend || builder.waitOn) {
        let waitOnUrls;
        const backendOption = builder.backendUrl || builder.backendUrl;
        if (backendOption) {
          const { protocol, hostname, port } = url.parse(backendOption.replace('{ip}', ip.address()));
          waitOnUrls = [`tcp:${hostname}:${port || (protocol === 'https:' ? 443 : 80)}`];
        } else {
          waitOnUrls = builder.waitOn ? [].concat(builder.waitOn) : undefined;
github mzgoddard / hard-source-webpack-plugin / lib / hard-source.js View on Github external
HardSource.prototype.listMap = function(options) {
  var mapId = JSON.stringify(options);
  if (!this._cachedListMap) {
    this._cachedListMap = {};
  }
  if (!this._cachedListMap[mapId]) {
    this._cachedListMap[mapId] = fromStringWithSourceMap(
      this.cacheItem.source,
      this.map(options)
    );
  }
  return this._cachedListMap[mapId];
};
github sysgears / create-apollo-app / packages / spinjs / src / executor.ts View on Github external
chunk.files.forEach(file => {
          if (file.endsWith('.bundle')) {
            if (builder.sourceMap) {
              const sourceListMap = new SourceListMap();
              sourceListMap.add(vendorSourceListMap);
              sourceListMap.add(
                fromStringWithSourceMap(
                  compilation.assets[file].source(),
                  JSON.parse(compilation.assets[file + '.map'].source())
                )
              );
              const sourceAndMap = sourceListMap.toStringWithSourceMap({ file });
              compilation.assets[file] = new RawSource(sourceAndMap.source);
              compilation.assets[file + '.map'] = new RawSource(JSON.stringify(sourceAndMap.map));
            } else {
              compilation.assets[file] = new ConcatSource(vendorSource, compilation.assets[file]);
            }
          }
        });
      });

source-list-map

Fast line to line SourceMap generator.

MIT
Latest version published 6 years ago

Package Health Score

65 / 100
Full package analysis