How to use the combine-source-map.removeComments function in combine-source-map

To help you get started, we’ve selected a few combine-source-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 jamesshore / automatopia / node_modules / browserify / node_modules / insert-module-globals / index.js View on Github external
);
      wrappedSource = '(function (' + names.join(',') + '){\n'
        + src + '\n}).call(this,' + values.join(',') + ')';
    }

    // Generate source maps if wanted. Including the right offset for
    // the wrapped source.
    if (!opts.debug) {
        return wrappedSource;
    }
    var sourceFile = path.relative(opts.basedir, file)
        .replace(/\\/g, '/');
    var sourceMap = combineSourceMap.create().addFile(
        { sourceFile: sourceFile, source: src},
        { line: 1 });
    return combineSourceMap.removeComments(wrappedSource) + "\n"
        + sourceMap.comment();
}
github jamesshore / lets_code_javascript / node_modules / browserify / node_modules / insert-module-globals / index.js View on Github external
);
      wrappedSource = '(function (' + names.join(',') + '){\n'
        + src + '\n}).call(this,' + values.join(',') + ')';
    }

    // Generate source maps if wanted. Including the right offset for
    // the wrapped source.
    if (!opts.debug) {
        return wrappedSource;
    }
    var sourceFile = path.relative(opts.basedir, file)
        .replace(/\\/g, '/');
    var sourceMap = combineSourceMap.create().addFile(
        { sourceFile: sourceFile, source: src},
        { line: 1 });
    return combineSourceMap.removeComments(wrappedSource) + "\n"
        + sourceMap.comment();
}
github MiguelCastillo / bit-bundler / test / spec / bundler / chunkedBundleBuilder.js View on Github external
it("then the bundler generates the correct result", function() {
      var expected = (
`require=_bb$iter=(${BUNDLE_MODULE_LOADER})({
${wrapModule(input, 1, {"./X": 2})},
${wrapModule(dep1, 2)}
},[1]);

`);

      expect(combineSourceMap.removeComments(result)).to.equal(expected);
    });
  });
github browserify / browser-pack / index.js View on Github external
function wrapSimple(src) {
    return 'function(require,module,exports){\n'
        + combineSourceMap.removeComments(src)
        + '\n}';
}
github monounity / karma-typescript / src / bundler / source-map.ts View on Github external
public removeSourceMapComment(queued: Queued): string {
        return queued.emitOutput.sourceMapText ?
            combineSourceMap.removeComments(queued.emitOutput.outputText) :
            queued.emitOutput.outputText;
    }
github arian / partition-bundle / index.js View on Github external
function wrapModule(row, deps) {
  return new Buffer([
    '\nloadjs.d("',
    row.id,
    '",function(require,module,exports){\n',
    combineSourceMap.removeComments(row.source),
    '\n},{',
    deps,
    '});\n'
  ].join(''));
}
github monounity / karma-typescript / dist / bundler / source-map.js View on Github external
map = convertSourceMap.fromJSON(mapJson);
            }
            else {
                map = convertSourceMap.fromComment(commentMatch[0]);
            }
            if (!map.getProperty("sourcesContent")) {
                var sourcesContent_1 = [];
                map.getProperty("sources").forEach(function (source) {
                    var sourceFilename = path.join(dirname_1, source);
                    var sourceContent = fs.readFileSync(sourceFilename, "utf-8");
                    sourcesContent_1.push(sourceContent);
                });
                map.addProperty("sourcesContent", sourcesContent_1);
            }
            this.cleanupSources(map);
            bundleItem.source = combineSourceMap.removeComments(bundleItem.source) + map.toComment();
        }
    };
    SourceMap.prototype.cleanupSources = function (map) {
github bokeh / bokeh / bokehjs / make / linker.ts View on Github external
const mod = modules.get(file)!
        mod.rewrite_deps(module_map)
        mod.transform()

        bundled.push(mod)

        const id = module_map.get(file)!
        if (!mod.is_external)
          exported.set(mod.canonical, id)

        const start = wrap(id, "")
        sources += start
        line += newlines(start)

        const source_with_sourcemap = mod.source
        const source = combine.removeComments(source_with_sourcemap)
        sources += source
        sourcemap.addFile({source: source_with_sourcemap, sourceFile: file}, {line})
        line += newlines(source)

        const end = `${last ? "" : ","}\n`
        sources += end
        line += newlines(end)
      }

      const aliases = JSON.stringify(to_obj(exported))
      const entry_id = module_map.get(entry)!
      const parent_require = this.builtins ? `typeof "require" !== "undefined" && require` : "null"
      sources += `${suffix}, ${aliases}, ${entry_id}, ${parent_require});\n})\n`

      const obj = convert.fromBase64(sourcemap.base64()).toObject()
      return new Bundle(sources, obj, exported, bundled)

combine-source-map

Add source maps of multiple files, offset them and then combine them into one source map

MIT
Latest version published 8 years ago

Package Health Score

71 / 100
Full package analysis