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 2.0.0 to 3.0.0

.github/workflows/test.yml

22

lib/index.js
'use strict'
var fs = require('fs')
var path = require('path')
var SourceMapConsumer = require('source-map').SourceMapConsumer
const fs = require('fs')
const path = require('path')
const SourceMapConsumer = require('source-map').SourceMapConsumer
var INLINE_SOURCEMAP_REGEX = /^data:application\/json[^,]+base64,/
var SOURCEMAP_REGEX = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/
var READ_FILE_OPTS = { encoding: 'utf8' }
const INLINE_SOURCEMAP_REGEX = /^data:application\/json[^,]+base64,/
const SOURCEMAP_REGEX = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/
const READ_FILE_OPTS = { encoding: 'utf8' }

@@ -18,3 +18,3 @@ module.exports = function readSourceMap (filename, cb) {

// Look for a sourcemap URL
var sourceMapUrl = resolveSourceMapUrl(sourceFile, path.dirname(filename))
const sourceMapUrl = resolveSourceMapUrl(sourceFile, path.dirname(filename))
if (!sourceMapUrl) {

@@ -56,5 +56,5 @@ return cb()

function resolveSourceMapUrl (sourceFile, sourcePath) {
var lines = sourceFile.split(/\r?\n/)
var sourceMapUrl = null
for (var i = lines.length - 1; i >= 0 && !sourceMapUrl; i--) {
const lines = sourceFile.split(/\r?\n/)
let sourceMapUrl = null
for (let i = lines.length - 1; i >= 0 && !sourceMapUrl; i--) {
sourceMapUrl = lines[i].match(SOURCEMAP_REGEX)

@@ -77,4 +77,4 @@ }

function decodeInlineMap (data) {
var rawData = data.slice(data.indexOf(',') + 1)
const rawData = data.slice(data.indexOf(',') + 1)
return Buffer.from(rawData, 'base64').toString()
}
{
"name": "load-source-map",
"version": "2.0.0",
"version": "3.0.0",
"description": "Reads a source file and extracts a sourcemap for consumption (inline or external)",
"main": "lib/index.js",
"engines": {
"node": ">= 8"
"node": ">=12"
},

@@ -29,8 +29,8 @@ "scripts": {

"dependencies": {
"source-map": "^0.7.3"
"source-map": "^0.8.0-beta.0"
},
"devDependencies": {
"nyc": "^15.1.0",
"standard": "^14.3.4",
"tape": "^5.0.1"
"standard": "^16.0.4",
"tape": "^5.5.2"
},

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

# load-source-map
[![Version npm](http://img.shields.io/npm/v/load-source-map.svg?style=flat-square)](http://browsenpm.org/package/load-source-map)[![Build Status](http://img.shields.io/travis/rexxars/load-source-map/master.svg?style=flat-square)](https://travis-ci.org/rexxars/load-source-map)[![Coverage Status](https://img.shields.io/coveralls/rexxars/load-source-map/master.svg?style=flat-square)](https://coveralls.io/github/rexxars/load-source-map)
[![Version npm](http://img.shields.io/npm/v/load-source-map.svg?style=flat-square)](http://browsenpm.org/package/load-source-map)[![Build Status](http://img.shields.io/travis/rexxars/load-source-map/main.svg?style=flat-square)](https://travis-ci.org/rexxars/load-source-map)

@@ -5,0 +5,0 @@ Given a source file location, will load any referenced (or inline) source map.

'use strict'
var path = require('path')
var test = require('tape')
var loadSourceMap = require('../')
const path = require('path')
const test = require('tape')
const loadSourceMap = require('../')
var FIXTURES_DIR = path.join(__dirname, 'fixtures')
const FIXTURES_DIR = path.join(__dirname, 'fixtures')

@@ -21,4 +21,4 @@ test('should give back undefined as result if no sourcemap is referenced', function (t) {

var generated = { line: 30, column: 13 }
var expected = { line: 15, column: 9, name: 'setState', source: '../src/example.js' }
const generated = { line: 30, column: 13 }
const 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' }
const generated = { line: 30, column: 13 }
const 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()

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