Socket
Socket
Sign inDemoInstall

source-map-support

Package Overview
Dependencies
2
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

2

package.json
{
"name": "source-map-support",
"description": "Fixes stack traces for files with source maps",
"version": "0.1.3",
"version": "0.1.4",
"main": "./source-map-support.js",

@@ -6,0 +6,0 @@ "scripts": {

@@ -21,7 +21,18 @@ var SourceMapConsumer = require('source-map').SourceMapConsumer;

var sourceMapData = fs.readFileSync(sourceMappingURL, 'utf8');
sourceMap = new SourceMapConsumer(sourceMapData);
sourceMap = {
url: sourceMappingURL,
map: new SourceMapConsumer(sourceMapData)
};
cache[position.source] = sourceMap;
}
}
return sourceMap ? sourceMap.originalPositionFor(position) : position;
// Resolve the source URL relative to the URL of the source map
if (sourceMap) {
var originalPosition = sourceMap.map.originalPositionFor(position);
originalPosition.source = path.resolve(path.dirname(sourceMap.url), originalPosition.source);
return originalPosition;
} else {
return position;
}
}

@@ -75,3 +86,3 @@

// Code called using eval() needs special handling
var origin = frame.getEvalOrigin();
var origin = frame.isEval() && frame.getEvalOrigin();
if (origin) {

@@ -78,0 +89,0 @@ origin = mapEvalOrigin(cache, origin);

@@ -77,3 +77,3 @@ require('./source-map-support').install();

'Error: test',
' at Object.exports.test (./line1.js:1001:101)'
/^ at Object\.exports\.test \(.*\/line1\.js:1001:101\)$/
]);

@@ -90,4 +90,4 @@ });

'Error: test',
' at foo (./line2.js:1002:102)',
' at Object.exports.test (./line4.js:1004:104)'
/^ at foo \(.*\/line2\.js:1002:102\)$/,
/^ at Object\.exports\.test \(.*\/line4\.js:1004:104\)$/
]);

@@ -107,5 +107,5 @@ });

'Error: test',
' at bar (./line3.js:1003:103)',
' at foo (./line5.js:1005:105)',
' at Object.exports.test (./line7.js:1007:107)'
/^ at bar \(.*\/line3\.js:1003:103\)$/,
/^ at foo \(.*\/line5\.js:1005:105\)$/,
/^ at Object\.exports\.test \(.*\/line7\.js:1007:107\)$/
]);

@@ -119,4 +119,4 @@ });

'Error: test',
/^ at Object.eval \(eval at <anonymous> \(\.\/line1\.js:1001:101\)/,
' at Object.exports.test (./line1.js:1001:101)'
/^ at Object\.eval \(eval at <anonymous> \(.*\/line1\.js:1001:101\)/,
/^ at Object\.exports\.test \(.*\/line1\.js:1001:101\)$/
]);

@@ -130,5 +130,5 @@ });

'Error: test',
/^ at Object.eval \(eval at <anonymous> \(eval at <anonymous> \(\.\/line1\.js:1001:101\)/,
/^ at Object.eval \(eval at <anonymous> \(\.\/line1\.js:1001:101\)/,
' at Object.exports.test (./line1.js:1001:101)'
/^ at Object\.eval \(eval at <anonymous> \(eval at <anonymous> \(.*\/line1\.js:1001:101\)/,
/^ at Object\.eval \(eval at <anonymous> \(.*\/line1\.js:1001:101\)/,
/^ at Object\.exports\.test \(.*\/line1\.js:1001:101\)$/
]);

@@ -145,5 +145,5 @@ });

'Error: test',
/^ at eval \(eval at foo \(\.\/line2\.js:1002:102\)/,
' at foo (./line2.js:1002:102)',
' at Object.exports.test (./line4.js:1004:104)'
/^ at eval \(eval at foo \(.*\/line2\.js:1002:102\)/,
/^ at foo \(.*\/line2\.js:1002:102\)/,
/^ at Object\.exports\.test \(.*\/line4\.js:1004:104\)$/
]);

@@ -158,3 +158,3 @@ });

' at Object.eval (sourceURL.js:1:7)',
' at Object.exports.test (./line1.js:1001:101)'
/^ at Object\.exports\.test \(.*\/line1\.js:1001:101\)$/
]);

@@ -169,7 +169,17 @@ });

' at Object.eval (sourceURL.js:1:7)',
/^ at Object.eval \(eval at <anonymous> \(\.\/line1\.js:1001:101\)/,
' at Object.exports.test (./line1.js:1001:101)'
/^ at Object\.eval \(eval at <anonymous> \(.*\/line1\.js:1001:101\)/,
/^ at Object\.exports\.test \(.*\/line1\.js:1001:101\)$/
]);
});
it('function constructor', function() {
compareStackTrace([
'throw new Function(")");'
], [
'SyntaxError: Unexpected token )',
/^ at Object\.Function \((?:unknown source|<anonymous>)\)$/,
/^ at Object\.exports\.test \(.*\/line1\.js:1001:101\)$/,
]);
});
it('default options', function(done) {

@@ -183,7 +193,7 @@ compareStdout(done, [

], [
'./.original.js:1',
/\/.original\.js:1$/,
'this is the original code',
'^',
'Error: this is the error',
' at foo (./.original.js:1:1)'
/^ at foo \(.*\/.original\.js:1:1\)$/
]);

@@ -199,7 +209,7 @@ });

], [
'./.original.js:1',
/\/.original\.js:1$/,
'this is the original code',
'^',
'Error: this is the error',
' at foo (./.original.js:1:1)'
/^ at foo \(.*\/.original\.js:1:1\)$/
]);

@@ -219,4 +229,4 @@ });

'Error: this is the error',
' at foo (./.original.js:1:1)'
/^ at foo \(.*\/.original\.js:1:1\)$/
]);
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc