How to use the source-map-explorer.adjustSourcePaths function in source-map-explorer

To help you get started, we’ve selected a few source-map-explorer 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 Hypercubed / Project-Chi / gulp / tasks / jspm.js View on Github external
return throughObj((file, encoding, callback) => {
    gutil.log(`Generating treemap for ${gutil.colors.magenta(file.relative)}`);

    if (typeof loadSourceMap !== 'undefined') {
      const data = loadSourceMap(file.path, `${file.path}.map`);
      const sizes = computeGeneratedFileSizes(data.mapConsumer, data.jsData);
      const asizes = adjustSourcePaths(sizes, true, '', '');
      const tsv = 'Source\tSize\n' + Object.keys(asizes).map(k => `${k}\t${asizes[k]}`).join('\n');

      file.contents = new Buffer(tsv);
      file.path = gutil.replaceExtension(file.path, '.tsv');
      return callback(null, file);
    }

    gutil.log('Running source-map-explorer in shell');
    execa.stdout('source-map-explorer', ['--tsv', file.path, `${file.path}.map`])
      .then(result => {
        file.contents = new Buffer(result);
        file.path = gutil.replaceExtension(file.path, '.tsv');
        callback(null, file);
      })
      .catch(err => {
        console.error(err); // eslint-disable-line no-console
github Kopano-dev / konnect / scripts / js-license-ranger.js View on Github external
files.forEach((f) => {
    console.error('> processing', f);
    const data = sourcemapExplorer.loadSourceMap(f, `${f}.map`);
    const sizes = sourcemapExplorer.computeGeneratedFileSizes(data.mapConsumer, data.jsData);

    const files = sourcemapExplorer.adjustSourcePaths(sizes.files, false);
    updateThirdPartyModules(modules, files);
  });

source-map-explorer

Analyze and debug space usage through source maps

Apache-2.0
Latest version published 2 years ago

Package Health Score

69 / 100
Full package analysis