How to use source-map-explorer - 8 common examples

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 ModusCreateOrg / gimbal / packages / plugin-source-map-explorer / src / mod.ts View on Github external
async (bundle: string): Promise => {
        try {
          // SME will complain if sourcemaps contain just one file, but we don't control that
          // in bundles generated by 3rd parties like webpack runtime or Ionic
          const explored = await explore(bundle);

          return {
            bundle,
            ...explored,
          };
        } catch {
          return false;
        }
      },
    ),
github spencermountain / unrequired / src / _get-used-old.js View on Github external
var getUsed = function(input) {
  //browserify + derequire
  var cmd = browserify + ' ' + input + ' --debug -t [ babelify ]'
  cmd += ' >> ' + output
  exec(cmd)

  srcMapExplorer(output, {
    json: true,
  }).then(files => {
    console.log(files)
    files = Object.keys(files)

    files = files.map(function(str) {
      str = path.resolve(str)
      return str
    })
    //clean it up a bit
    files = files.filter(function(str) {
      if (!str) {
        return false
      }
      if (/_prelude.js$/.test(str)) {
        return false
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);
  });
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);
  });
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);
  });
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 => {
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);
      })

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