Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

load-source-map

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-source-map - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

19

lib/index.js

@@ -5,3 +5,2 @@ 'use strict'

var path = require('path')
var semver = require('semver')
var SourceMapConsumer = require('source-map').SourceMapConsumer

@@ -11,3 +10,3 @@

var SOURCEMAP_REGEX = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/
var READ_FILE_OPTS = semver.lt(process.version, '0.9.11') ? 'utf8' : {encoding: 'utf8'}
var READ_FILE_OPTS = { encoding: 'utf8' }

@@ -40,11 +39,15 @@ module.exports = function readSourceMap (filename, cb) {

var consumer
try {
consumer = new SourceMapConsumer(sourceMap)
(new SourceMapConsumer(sourceMap))
.then(function onConsumerReady (consumer) {
return cb(null, consumer)
}, onConsumerError)
} catch (parseErr) {
parseErr.message = 'Error parsing sourcemap for file "' + filename + '":\n' + parseErr.message
return cb(parseErr)
onConsumerError(parseErr)
}
}
return cb(null, consumer)
function onConsumerError (parseErr) {
parseErr.message = 'Error parsing sourcemap for file "' + filename + '":\n' + parseErr.message
return cb(parseErr)
}

@@ -76,3 +79,3 @@ })

var rawData = data.slice(data.indexOf(',') + 1)
return new Buffer(rawData, 'base64').toString()
return Buffer.from(rawData, 'base64').toString()
}
{
"name": "load-source-map",
"version": "1.0.0",
"version": "2.0.0",
"description": "Reads a source file and extracts a sourcemap for consumption (inline or external)",
"main": "lib/index.js",
"engines": {
"node": ">= 8"
},
"scripts": {
"test": "tape test/test.js && standard",
"prepublish": "in-publish && npm test || not-in-publish",
"prepublishOnly": "npm test",
"coverage": "nyc --reporter text --reporter lcov tape test/test.js"

@@ -26,10 +29,8 @@ },

"dependencies": {
"in-publish": "^2.0.0",
"semver": "^5.3.0",
"source-map": "^0.5.6"
"source-map": "^0.7.3"
},
"devDependencies": {
"nyc": "^10.2.0",
"standard": "^9.0.2",
"tape": "^4.6.3"
"nyc": "^15.1.0",
"standard": "^14.3.4",
"tape": "^5.0.1"
},

@@ -36,0 +37,0 @@ "standard": {

@@ -21,4 +21,4 @@ 'use strict'

var generated = {line: 30, column: 13}
var expected = {line: 15, column: 9, name: 'setState', source: '../src/example.js'}
var generated = { line: 30, column: 13 }
var expected = { line: 15, column: 9, name: 'setState', source: '../src/example.js' }
t.deepEqual(sourcemap.originalPositionFor(generated), expected, 'should have correct source mapping')

@@ -33,4 +33,4 @@ t.end()

var generated = {line: 30, column: 13}
var expected = {line: 15, column: 9, name: 'setState', source: '../src/example.js'}
var generated = { line: 30, column: 13 }
var expected = { line: 15, column: 9, name: 'setState', source: '../src/example.js' }
t.deepEqual(sourcemap.originalPositionFor(generated), expected, 'should have correct source mapping')

@@ -37,0 +37,0 @@ t.end()

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc