How to use the source-map-resolve.resolve 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 lydell / source-map-visualize / index.js View on Github external
return callback(error)
    }

    generatedContent = generatedContent.toString()

    var content = generatedContent
    var filepath = options.generatedFilePath
    if (typeof options.sourceMapPath === 'string') {
      content = null
      filepath = options.sourceMapPath
    }
    var resolveOptions = {
      sourceRoot: options.sourceRoot
    }

    sourceMapResolve.resolve(
      content, filepath, fs.readFile, resolveOptions,
      function (error, result) {
        if (error) {
          return callback(error)
        }
        if (result === null) {
          return callback(
            new Error('No sourceMappingURL found in ' + filepath)
          )
        }
        result.generatedContent = generatedContent
        callback(null, result)
      }
    )
  })
}

source-map-resolve

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

MIT
Latest version published 4 years ago

Package Health Score

55 / 100
Full package analysis