How to use the source-map-resolve.resolveSourceMap function in source-map-resolve

To help you get started, we’ve selected a few source-map-resolve 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 walmartlabs / circus / lib / publish.js View on Github external
function processJS(file, data, callback) {
    // Preemptively kill the sourcemap published entry
    circus.published[file + '.map'] = undefined;

    if (options.sourceMap !== false) {
      SourceMapResolve.resolveSourceMap(data + '', Path.resolve(buildDir, file), Fs.readFile, function(err, sourceMap) {
        if (err) {
          return callback(err);
        }

        // Transform embedded urls using resolve
        var ast = recast.parse(data, {sourceFileName: file});

        recast.visit(ast, {
          visitLiteral: function(path) {
            // Replace literal file references
            var value = path.value.value;
            if (typeof value === 'string' && circus.published.hasOwnProperty(value)) {
              path.value.value = circus.published[value];
            }
            return path.value;
          }

source-map-resolve

Resolve the source map and/or sources for a generated file.

MIT
Latest version published 5 years ago

Package Health Score

55 / 100
Full package analysis