Socket
Socket
Sign inDemoInstall

source-map-support

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

source-map-support - npm Package Compare versions

Comparing version 0.2.10 to 0.3.0

.travis.yml

18

amd-test/browser-source-map-support.js

@@ -81,10 +81,10 @@ /*

G=m;if(-1===r){m=g(m,p);if("require"===m)return B(c,e,h,p);if("exports"===m)return e;if("module"===m)return h;if(b.hasOwnProperty(m))return b[m];if(a[m])return l.apply(null,a[m]),b[m];if(c)return c(G);throw Error("No module with ID: "+m);}G=m.substring(0,r);m=m.substring(r+1,m.length);r=E(c,e,h,G,p);m=r.normalize?r.normalize(m,d(p)):g(m,p);b[m]||r.load(m,B(c,e,h,p),k(m),{});return b[m]};c.require=function(c){if(b[c])return b[c];if(a[c])return l.apply(null,a[c]),b[c]};c.amd={};return c}}).call(this,
h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,path:7}],18:[function(h,r,m){(function(e,p){function r(){return"undefined"!==typeof window&&"function"===typeof XMLHttpRequest}function A(a){if(a in F)return F[a];try{if(r()){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);var c=4===b.readyState?
b.responseText:null}else c=y.readFileSync(a,"utf8")}catch(d){c=null}return F[a]=c}function g(a,b){if(!a)return b;var c=w.dirname(a),d=/^\w+:\/\/[^\/]*/.exec(c),d=d?d[0]:"";return d+w.resolve(c.slice(d.length),b)}function d(a){var b;a:{if(r()&&(b=new XMLHttpRequest,b.open("GET",a,!1),b.send(null),b=b.getResponseHeader("SourceMap")||b.getResponseHeader("X-SourceMap")))break a;b=A(a);b=(b=/\/\/[#@]\s*sourceMappingURL=(.*)\s*$/m.exec(b))?b[1]:null}if(!b)return null;"data:application/json;base64,"==b.slice(0,
29).toLowerCase()?(a=(new p(b.slice(29),"base64")).toString(),b=null):(b=g(a,b),a=A(b,"utf8"));return a?{url:b,map:a}:null}function k(a){var b=C[a.source];if(!b){var c=d(a.source);c?(b=C[a.source]={url:c.url,map:new E(c.map)},b.map.sourcesContent&&b.map.sources.forEach(function(a,c){var d=b.map.sourcesContent[c];if(d){var e=g(b.url,a);F[e]=d}})):b=C[a.source]={url:null,map:null}}return b&&b.map&&(c=b.map.originalPositionFor(a),null!==c.source)?(c.source=g(b.url,c.source),c):a}function l(a){var b=
/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(a);return b?(a=k({source:b[2],line:b[3],column:b[4]-1}),"eval at "+b[1]+" ("+a.source+":"+a.line+":"+(a.column+1)+")"):(b=/^eval at ([^(]+) \((.+)\)$/.exec(a))?"eval at "+b[1]+" ("+l(b[2])+")":a}function c(){var a,b="";this.isNative()?b="native":(a=this.getScriptNameOrSourceURL(),!a&&this.isEval()&&(b=this.getEvalOrigin(),b+=", "),b=a?b+a:b+"<anonymous>",a=this.getLineNumber(),null!=a&&(b+=":"+a,(a=this.getColumnNumber())&&(b+=":"+a)));a="";var c=this.getFunctionName(),
d=!0,e=this.isConstructor();if(this.isToplevel()||e)e?a+="new "+(c||"<anonymous>"):c?a+=c:(a+=b,d=!1);else{var e=this.getTypeName(),g=this.getMethodName();c?(e&&0!=c.indexOf(e)&&(a+=e+"."),a+=c,g&&c.indexOf("."+g)!=c.length-g.length-1&&(a+=" [as "+g+"]")):a+=e+"."+(g||"<anonymous>")}d&&(a+=" ("+b+")");return a}function a(a){var b={};Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(function(c){b[c]=/^(?:is|get)/.test(c)?function(){return a[c].call(a)}:a[c]});b.toString=c;return b}function b(b){var c=
b.getFileName()||b.getScriptNameOrSourceURL();if(c){var d=k({source:c,line:b.getLineNumber(),column:b.getColumnNumber()-1});b=a(b);b.getFileName=function(){return d.source};b.getLineNumber=function(){return d.line};b.getColumnNumber=function(){return d.column+1};b.getScriptNameOrSourceURL=function(){return d.source};return b}var e=b.isEval()&&b.getEvalOrigin();e&&(e=l(e),b=a(b),b.getEvalOrigin=function(){return e});return b}function z(a,c){t&&(F={},C={});return a+c.map(function(a){return"\n at "+
b(a)}).join("")}function D(a){var b=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(a.stack);if(b){a=b[1];var c=+b[2],b=+b[3],d=F[a];!d&&y.existsSync(a)&&(d=y.readFileSync(a,"utf8"));if(d&&(d=d.split(/(?:\r\n|\r|\n)/)[c-1]))return"\n"+a+":"+c+"\n"+d+"\n"+Array(b).join(" ")+"^"}return null}function B(a){if(a&&a.stack){var b=D(a);null!==b&&console.log(b);console.log(a.stack)}else console.log("Uncaught exception:",a);e.exit(1)}var E=h("source-map").SourceMapConsumer,w=h("path"),y=h("fs"),H=!1,t=!1,F={},C=
{};m.wrapCallSite=b;m.getErrorSource=D;m.mapSourcePosition=k;m.retrieveSourceMap=d;m.install=function(a){if(!H){H=!0;Error.prepareStackTrace=z;a=a||{};var b="handleUncaughtExceptions"in a?a.handleUncaughtExceptions:!0;t="emptyCacheBetweenOperations"in a?a.emptyCacheBetweenOperations:!1;a.retrieveFile&&(A=a.retrieveFile);a.retrieveSourceMap&&(d=a.retrieveSourceMap);if(b&&!r())e.on("uncaughtException",B)}}}).call(this,h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),
h("buffer").Buffer)},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,buffer:3,fs:2,path:7,"source-map":8}]},{},[1]);return K});
h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,path:7}],18:[function(h,r,m){(function(e,p){function r(){return"undefined"!==typeof window&&"function"===typeof XMLHttpRequest}function A(a){if(a in F)return F[a];try{if(r()){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);var c=null;4===
b.readyState&&200===b.status&&(c=b.responseText)}else c=y.readFileSync(a,"utf8")}catch(d){c=null}return F[a]=c}function g(a,b){if(!a)return b;var c=w.dirname(a),d=/^\w+:\/\/[^\/]*/.exec(c),d=d?d[0]:"";return d+w.resolve(c.slice(d.length),b)}function d(a){var b;a:{var c;if(r()&&(c=new XMLHttpRequest,c.open("GET",a,!1),c.send(null),c=c.getResponseHeader("SourceMap")||c.getResponseHeader("X-SourceMap"))){b=c;break a}c=A(a);for(var d=/\/\/[#@]\s*sourceMappingURL=([^'"]+)\s*$/mg,e;e=d.exec(c);)b=e;b=b?
b[1]:null}if(!b)return null;"data:application/json;base64,"==b.slice(0,29).toLowerCase()?(a=(new p(b.slice(29),"base64")).toString(),b=null):(b=g(a,b),a=A(b));return a?{url:b,map:a}:null}function k(a){var b=C[a.source];if(!b){var c=d(a.source);c?(b=C[a.source]={url:c.url,map:new E(c.map)},b.map.sourcesContent&&b.map.sources.forEach(function(a,c){var d=b.map.sourcesContent[c];if(d){var e=g(b.url,a);F[e]=d}})):b=C[a.source]={url:null,map:null}}return b&&b.map&&(c=b.map.originalPositionFor(a),null!==
c.source)?(c.source=g(b.url,c.source),c):a}function l(a){var b=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(a);return b?(a=k({source:b[2],line:b[3],column:b[4]-1}),"eval at "+b[1]+" ("+a.source+":"+a.line+":"+(a.column+1)+")"):(b=/^eval at ([^(]+) \((.+)\)$/.exec(a))?"eval at "+b[1]+" ("+l(b[2])+")":a}function c(){var a,b="";this.isNative()?b="native":(a=this.getScriptNameOrSourceURL(),!a&&this.isEval()&&(b=this.getEvalOrigin(),b+=", "),b=a?b+a:b+"<anonymous>",a=this.getLineNumber(),null!=a&&(b+=
":"+a,(a=this.getColumnNumber())&&(b+=":"+a)));a="";var c=this.getFunctionName(),d=!0,e=this.isConstructor();if(this.isToplevel()||e)e?a+="new "+(c||"<anonymous>"):c?a+=c:(a+=b,d=!1);else{var e=this.getTypeName(),g=this.getMethodName();c?(e&&0!=c.indexOf(e)&&(a+=e+"."),a+=c,g&&c.indexOf("."+g)!=c.length-g.length-1&&(a+=" [as "+g+"]")):a+=e+"."+(g||"<anonymous>")}d&&(a+=" ("+b+")");return a}function a(a){var b={};Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(function(c){b[c]=/^(?:is|get)/.test(c)?
function(){return a[c].call(a)}:a[c]});b.toString=c;return b}function b(b,c){var d=b.getFileName()||b.getScriptNameOrSourceURL();if(d){var e=b.getLineNumber(),g=b.getColumnNumber()-1;c&&1===e&&(g-=63);var h=k({source:d,line:e,column:g});b=a(b);b.getFileName=function(){return h.source};b.getLineNumber=function(){return h.line};b.getColumnNumber=function(){return h.column+1};b.getScriptNameOrSourceURL=function(){return h.source};return b}var m=b.isEval()&&b.getEvalOrigin();m&&(m=l(m),b=a(b),b.getEvalOrigin=
function(){return m});return b}function z(a,c){t&&(F={},C={});var d=!r()&&c.length&&"module.js"===c[c.length-1].getFileName();return a+c.map(function(a){return"\n at "+b(a,d)}).join("")}function D(a){var b=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(a.stack);if(b){a=b[1];var c=+b[2],b=+b[3],d=F[a];!d&&y.existsSync(a)&&(d=y.readFileSync(a,"utf8"));if(d&&(d=d.split(/(?:\r\n|\r|\n)/)[c-1]))return a+":"+c+"\n"+d+"\n"+Array(b).join(" ")+"^"}return null}function B(a){if(a&&a.stack){var b=D(a);null!==
b&&(console.error(),console.error(b));console.error(a.stack)}else console.error("Uncaught exception:",a);e.exit(1)}var E=h("source-map").SourceMapConsumer,w=h("path"),y=h("fs"),H=!1,t=!1,F={},C={};m.wrapCallSite=b;m.getErrorSource=D;m.mapSourcePosition=k;m.retrieveSourceMap=d;m.install=function(a){if(!H){H=!0;Error.prepareStackTrace=z;a=a||{};var b="handleUncaughtExceptions"in a?a.handleUncaughtExceptions:!0;t="emptyCacheBetweenOperations"in a?a.emptyCacheBetweenOperations:!1;a.retrieveFile&&(A=a.retrieveFile);
a.retrieveSourceMap&&(d=a.retrieveSourceMap);if(b&&!r())e.on("uncaughtException",B)}}}).call(this,h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),h("buffer").Buffer)},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,buffer:3,fs:2,path:7,"source-map":8}]},{},[1]);return K});

@@ -81,10 +81,10 @@ /*

G=m;if(-1===r){m=g(m,p);if("require"===m)return B(c,e,h,p);if("exports"===m)return e;if("module"===m)return h;if(b.hasOwnProperty(m))return b[m];if(a[m])return l.apply(null,a[m]),b[m];if(c)return c(G);throw Error("No module with ID: "+m);}G=m.substring(0,r);m=m.substring(r+1,m.length);r=E(c,e,h,G,p);m=r.normalize?r.normalize(m,d(p)):g(m,p);b[m]||r.load(m,B(c,e,h,p),k(m),{});return b[m]};c.require=function(c){if(b[c])return b[c];if(a[c])return l.apply(null,a[c]),b[c]};c.amd={};return c}}).call(this,
h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,path:7}],18:[function(h,r,m){(function(e,p){function r(){return"undefined"!==typeof window&&"function"===typeof XMLHttpRequest}function A(a){if(a in F)return F[a];try{if(r()){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);var c=4===b.readyState?
b.responseText:null}else c=y.readFileSync(a,"utf8")}catch(d){c=null}return F[a]=c}function g(a,b){if(!a)return b;var c=w.dirname(a),d=/^\w+:\/\/[^\/]*/.exec(c),d=d?d[0]:"";return d+w.resolve(c.slice(d.length),b)}function d(a){var b;a:{if(r()&&(b=new XMLHttpRequest,b.open("GET",a,!1),b.send(null),b=b.getResponseHeader("SourceMap")||b.getResponseHeader("X-SourceMap")))break a;b=A(a);b=(b=/\/\/[#@]\s*sourceMappingURL=(.*)\s*$/m.exec(b))?b[1]:null}if(!b)return null;"data:application/json;base64,"==b.slice(0,
29).toLowerCase()?(a=(new p(b.slice(29),"base64")).toString(),b=null):(b=g(a,b),a=A(b,"utf8"));return a?{url:b,map:a}:null}function k(a){var b=C[a.source];if(!b){var c=d(a.source);c?(b=C[a.source]={url:c.url,map:new E(c.map)},b.map.sourcesContent&&b.map.sources.forEach(function(a,c){var d=b.map.sourcesContent[c];if(d){var e=g(b.url,a);F[e]=d}})):b=C[a.source]={url:null,map:null}}return b&&b.map&&(c=b.map.originalPositionFor(a),null!==c.source)?(c.source=g(b.url,c.source),c):a}function l(a){var b=
/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(a);return b?(a=k({source:b[2],line:b[3],column:b[4]-1}),"eval at "+b[1]+" ("+a.source+":"+a.line+":"+(a.column+1)+")"):(b=/^eval at ([^(]+) \((.+)\)$/.exec(a))?"eval at "+b[1]+" ("+l(b[2])+")":a}function c(){var a,b="";this.isNative()?b="native":(a=this.getScriptNameOrSourceURL(),!a&&this.isEval()&&(b=this.getEvalOrigin(),b+=", "),b=a?b+a:b+"<anonymous>",a=this.getLineNumber(),null!=a&&(b+=":"+a,(a=this.getColumnNumber())&&(b+=":"+a)));a="";var c=this.getFunctionName(),
d=!0,e=this.isConstructor();if(this.isToplevel()||e)e?a+="new "+(c||"<anonymous>"):c?a+=c:(a+=b,d=!1);else{var e=this.getTypeName(),g=this.getMethodName();c?(e&&0!=c.indexOf(e)&&(a+=e+"."),a+=c,g&&c.indexOf("."+g)!=c.length-g.length-1&&(a+=" [as "+g+"]")):a+=e+"."+(g||"<anonymous>")}d&&(a+=" ("+b+")");return a}function a(a){var b={};Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(function(c){b[c]=/^(?:is|get)/.test(c)?function(){return a[c].call(a)}:a[c]});b.toString=c;return b}function b(b){var c=
b.getFileName()||b.getScriptNameOrSourceURL();if(c){var d=k({source:c,line:b.getLineNumber(),column:b.getColumnNumber()-1});b=a(b);b.getFileName=function(){return d.source};b.getLineNumber=function(){return d.line};b.getColumnNumber=function(){return d.column+1};b.getScriptNameOrSourceURL=function(){return d.source};return b}var e=b.isEval()&&b.getEvalOrigin();e&&(e=l(e),b=a(b),b.getEvalOrigin=function(){return e});return b}function z(a,c){t&&(F={},C={});return a+c.map(function(a){return"\n at "+
b(a)}).join("")}function D(a){var b=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(a.stack);if(b){a=b[1];var c=+b[2],b=+b[3],d=F[a];!d&&y.existsSync(a)&&(d=y.readFileSync(a,"utf8"));if(d&&(d=d.split(/(?:\r\n|\r|\n)/)[c-1]))return"\n"+a+":"+c+"\n"+d+"\n"+Array(b).join(" ")+"^"}return null}function B(a){if(a&&a.stack){var b=D(a);null!==b&&console.log(b);console.log(a.stack)}else console.log("Uncaught exception:",a);e.exit(1)}var E=h("source-map").SourceMapConsumer,w=h("path"),y=h("fs"),H=!1,t=!1,F={},C=
{};m.wrapCallSite=b;m.getErrorSource=D;m.mapSourcePosition=k;m.retrieveSourceMap=d;m.install=function(a){if(!H){H=!0;Error.prepareStackTrace=z;a=a||{};var b="handleUncaughtExceptions"in a?a.handleUncaughtExceptions:!0;t="emptyCacheBetweenOperations"in a?a.emptyCacheBetweenOperations:!1;a.retrieveFile&&(A=a.retrieveFile);a.retrieveSourceMap&&(d=a.retrieveSourceMap);if(b&&!r())e.on("uncaughtException",B)}}}).call(this,h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),
h("buffer").Buffer)},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,buffer:3,fs:2,path:7,"source-map":8}]},{},[1]);return K});
h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,path:7}],18:[function(h,r,m){(function(e,p){function r(){return"undefined"!==typeof window&&"function"===typeof XMLHttpRequest}function A(a){if(a in F)return F[a];try{if(r()){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);var c=null;4===
b.readyState&&200===b.status&&(c=b.responseText)}else c=y.readFileSync(a,"utf8")}catch(d){c=null}return F[a]=c}function g(a,b){if(!a)return b;var c=w.dirname(a),d=/^\w+:\/\/[^\/]*/.exec(c),d=d?d[0]:"";return d+w.resolve(c.slice(d.length),b)}function d(a){var b;a:{var c;if(r()&&(c=new XMLHttpRequest,c.open("GET",a,!1),c.send(null),c=c.getResponseHeader("SourceMap")||c.getResponseHeader("X-SourceMap"))){b=c;break a}c=A(a);for(var d=/\/\/[#@]\s*sourceMappingURL=([^'"]+)\s*$/mg,e;e=d.exec(c);)b=e;b=b?
b[1]:null}if(!b)return null;"data:application/json;base64,"==b.slice(0,29).toLowerCase()?(a=(new p(b.slice(29),"base64")).toString(),b=null):(b=g(a,b),a=A(b));return a?{url:b,map:a}:null}function k(a){var b=C[a.source];if(!b){var c=d(a.source);c?(b=C[a.source]={url:c.url,map:new E(c.map)},b.map.sourcesContent&&b.map.sources.forEach(function(a,c){var d=b.map.sourcesContent[c];if(d){var e=g(b.url,a);F[e]=d}})):b=C[a.source]={url:null,map:null}}return b&&b.map&&(c=b.map.originalPositionFor(a),null!==
c.source)?(c.source=g(b.url,c.source),c):a}function l(a){var b=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(a);return b?(a=k({source:b[2],line:b[3],column:b[4]-1}),"eval at "+b[1]+" ("+a.source+":"+a.line+":"+(a.column+1)+")"):(b=/^eval at ([^(]+) \((.+)\)$/.exec(a))?"eval at "+b[1]+" ("+l(b[2])+")":a}function c(){var a,b="";this.isNative()?b="native":(a=this.getScriptNameOrSourceURL(),!a&&this.isEval()&&(b=this.getEvalOrigin(),b+=", "),b=a?b+a:b+"<anonymous>",a=this.getLineNumber(),null!=a&&(b+=
":"+a,(a=this.getColumnNumber())&&(b+=":"+a)));a="";var c=this.getFunctionName(),d=!0,e=this.isConstructor();if(this.isToplevel()||e)e?a+="new "+(c||"<anonymous>"):c?a+=c:(a+=b,d=!1);else{var e=this.getTypeName(),g=this.getMethodName();c?(e&&0!=c.indexOf(e)&&(a+=e+"."),a+=c,g&&c.indexOf("."+g)!=c.length-g.length-1&&(a+=" [as "+g+"]")):a+=e+"."+(g||"<anonymous>")}d&&(a+=" ("+b+")");return a}function a(a){var b={};Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(function(c){b[c]=/^(?:is|get)/.test(c)?
function(){return a[c].call(a)}:a[c]});b.toString=c;return b}function b(b,c){var d=b.getFileName()||b.getScriptNameOrSourceURL();if(d){var e=b.getLineNumber(),g=b.getColumnNumber()-1;c&&1===e&&(g-=63);var h=k({source:d,line:e,column:g});b=a(b);b.getFileName=function(){return h.source};b.getLineNumber=function(){return h.line};b.getColumnNumber=function(){return h.column+1};b.getScriptNameOrSourceURL=function(){return h.source};return b}var m=b.isEval()&&b.getEvalOrigin();m&&(m=l(m),b=a(b),b.getEvalOrigin=
function(){return m});return b}function z(a,c){t&&(F={},C={});var d=!r()&&c.length&&"module.js"===c[c.length-1].getFileName();return a+c.map(function(a){return"\n at "+b(a,d)}).join("")}function D(a){var b=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(a.stack);if(b){a=b[1];var c=+b[2],b=+b[3],d=F[a];!d&&y.existsSync(a)&&(d=y.readFileSync(a,"utf8"));if(d&&(d=d.split(/(?:\r\n|\r|\n)/)[c-1]))return a+":"+c+"\n"+d+"\n"+Array(b).join(" ")+"^"}return null}function B(a){if(a&&a.stack){var b=D(a);null!==
b&&(console.error(),console.error(b));console.error(a.stack)}else console.error("Uncaught exception:",a);e.exit(1)}var E=h("source-map").SourceMapConsumer,w=h("path"),y=h("fs"),H=!1,t=!1,F={},C={};m.wrapCallSite=b;m.getErrorSource=D;m.mapSourcePosition=k;m.retrieveSourceMap=d;m.install=function(a){if(!H){H=!0;Error.prepareStackTrace=z;a=a||{};var b="handleUncaughtExceptions"in a?a.handleUncaughtExceptions:!0;t="emptyCacheBetweenOperations"in a?a.emptyCacheBetweenOperations:!1;a.retrieveFile&&(A=a.retrieveFile);
a.retrieveSourceMap&&(d=a.retrieveSourceMap);if(b&&!r())e.on("uncaughtException",B)}}}).call(this,h("node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),h("buffer").Buffer)},{"node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,buffer:3,fs:2,path:7,"source-map":8}]},{},[1]);return K});
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var querystring = require('querystring');
var child_process = require('child_process');
var browserify = path.join('node_modules', '.bin', 'browserify');
var coffee = path.join('node_modules', '.bin', 'coffee');
function run(command, callback) {

@@ -14,3 +18,3 @@ console.log(command);

fs.writeFileSync('.temp.js', 'sourceMapSupport = require("./source-map-support");');
run('node_modules/browserify/bin/cmd.js .temp.js', function(error, stdout) {
run(browserify + ' .temp.js', function(error, stdout) {
if (error) throw error;

@@ -48,3 +52,3 @@

// Build the AMD test
run('node_modules/coffee-script/bin/coffee --map --compile amd-test/script.coffee', function(error) {
run(coffee + ' --map --compile amd-test/script.coffee', function(error) {
if (error) throw error;

@@ -54,5 +58,5 @@ });

// Build the browserify test
run('node_modules/coffee-script/bin/coffee --map --compile browserify-test/script.coffee', function(error) {
run(coffee + ' --map --compile browserify-test/script.coffee', function(error) {
if (error) throw error;
run('node_modules/browserify/bin/cmd.js --debug browserify-test/script.js > browserify-test/compiled.js', function(error) {
run(browserify + ' --debug browserify-test/script.js > browserify-test/compiled.js', function(error) {
if (error) throw error;

@@ -63,3 +67,3 @@ })

// Build the browser test
run('node_modules/coffee-script/bin/coffee --map --compile browser-test/script.coffee', function(error) {
run(coffee + ' --map --compile browser-test/script.coffee', function(error) {
if (error) throw error;

@@ -69,3 +73,3 @@ });

// Build the header test
run('node_modules/coffee-script/bin/coffee --map --compile header-test/script.coffee', function(error) {
run(coffee + ' --map --compile header-test/script.coffee', function(error) {
if (error) throw error;

@@ -72,0 +76,0 @@ var contents = fs.readFileSync('header-test/script.js', 'utf8');

{
"name": "source-map-support",
"description": "Fixes stack traces for files with source maps",
"version": "0.2.10",
"version": "0.3.0",
"main": "./source-map-support.js",
"scripts": {
"test": "node_modules/mocha/bin/mocha"
"build": "node build.js",
"test": "mocha"
},

@@ -24,7 +25,3 @@ "dependencies": {

},
"licenses": [
{
"type": "MIT"
}
]
"license": "MIT"
}
# Source Map Support
[![Build Status](https://travis-ci.org/evanw/node-source-map-support.svg?branch=master)](https://travis-ci.org/evanw/node-source-map-support)

@@ -11,9 +12,31 @@ This module provides source map support for stack traces in node via the [V8 stack trace API](http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process.

Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, insert the following two lines at the top of your compiled code:
Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, insert the following line at the top of your compiled code:
//# sourceMappingURL=path/to/source.map
require('source-map-support').install();
And place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):
//# sourceMappingURL=path/to/source.map
If multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be
respected (e.g. if a file mentions the comment in code, or went through multiple transpilers).
The path should either be absolute or relative to the compiled file.
It is also possible to to install the source map support directly by
requiring the `register` module which can be handy with ES6:
```javascript
import 'source-map-support/register'
// Instead of:
import sourceMapSupport from 'source-map-support'
sourceMapSupport.install()
```
It is also very useful with Mocha:
```
mocha --require source-map-support/register tests/
```
#### Browser support

@@ -68,6 +91,7 @@

//# sourceMappingURL=compiled.js.map
require('source-map-support').install();
throw new Error('test'); // This is the compiled code
// The next line defines the sourceMapping.
//# sourceMappingURL=compiled.js.map

@@ -165,4 +189,13 @@ compiled.js.map:

## Tests
This repo contains both automated tests for node and manual tests for the browser. The automated tests can be run using mocha (type `mocha` in the root directory). To run the manual tests:
* Build the tests using `build.js`
* Visit `amd-test`, `browser-test`, and `browserify-test` using the HTTP protocol (`python -m SimpleHTTPServer` can be used on OS X)
* The test `browserify-test` currently isn't working due to a bug with browserify. See pull request #66 for details.
* For `header-test`, run `server.js` inside that directory and visit http://127.0.0.1:1337/
## License
This code is available under the [MIT license](http://opensource.org/licenses/MIT).

@@ -32,3 +32,6 @@ var SourceMapConsumer = require('source-map').SourceMapConsumer;

xhr.send(null);
var contents = xhr.readyState === 4 ? xhr.responseText : null;
var contents = null
if (xhr.readyState === 4 && xhr.status === 200) {
contents = xhr.responseText
}
}

@@ -76,5 +79,9 @@

fileData = retrieveFile(source);
var match = /\/\/[#@]\s*sourceMappingURL=(.*)\s*$/m.exec(fileData);
if (!match) return null;
return match[1];
var re = /\/\/[#@]\s*sourceMappingURL=([^'"]+)\s*$/mg;
// Keep executing the search to find the *last* sourceMappingURL to avoid
// picking up sourceMappingURLs from comments, strings, etc.
var lastMatch, match;
while (match = re.exec(fileData)) lastMatch = match;
if (!lastMatch) return null;
return lastMatch[1];
};

@@ -101,3 +108,3 @@

sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
sourceMapData = retrieveFile(sourceMappingURL, 'utf8');
sourceMapData = retrieveFile(sourceMappingURL);
}

@@ -267,3 +274,3 @@

function wrapCallSite(frame) {
function wrapCallSite(frame, fromModule) {
// Most call sites will return the source file from getFileName(), but code

@@ -274,6 +281,15 @@ // passed to eval() ending in "//# sourceURL=..." will return the source file

if (source) {
var line = frame.getLineNumber();
var column = frame.getColumnNumber() - 1;
// Fix position in Node where some (internal) code is prepended.
// See https://github.com/evanw/node-source-map-support/issues/36
if (fromModule && line === 1) {
column -= 63;
}
var position = mapSourcePosition({
source: source,
line: frame.getLineNumber(),
column: frame.getColumnNumber() - 1
line: line,
column: column
});

@@ -308,4 +324,11 @@ frame = cloneCallSite(frame);

}
var fromModule =
!isInBrowser() &&
stack.length &&
stack[stack.length - 1].getFileName() === 'module.js'
;
return error + stack.map(function(frame) {
return '\n at ' + wrapCallSite(frame);
return '\n at ' + wrapCallSite(frame, fromModule);
}).join('');

@@ -334,3 +357,3 @@ }

if (code) {
return '\n' + source + ':' + line + '\n' + code + '\n' +
return source + ':' + line + '\n' + code + '\n' +
new Array(column).join(' ') + '^';

@@ -346,7 +369,10 @@ }

if (!error || !error.stack) {
console.log('Uncaught exception:', error);
console.error('Uncaught exception:', error);
} else {
var source = getErrorSource(error);
if (source !== null) console.log(source);
console.log(error.stack);
if (source !== null) {
console.error();
console.error(source);
}
console.error(error.stack);
}

@@ -353,0 +379,0 @@ process.exit(1);

@@ -221,3 +221,3 @@ require('./source-map-support').install({

'SyntaxError: Unexpected token )',
/^ at Object\.Function \((?:unknown source|<anonymous>)\)$/,
/^ at (?:Object\.)?Function \((?:unknown source|<anonymous>|native)\)$/,
/^ at Object\.exports\.test \(.*\/line1\.js:1001:101\)$/,

@@ -254,2 +254,12 @@ ]);

it('finds the last sourceMappingURL', function() {
compareStackTrace(createMultiLineSourceMapWithSourcesContent(), [
'//# sourceMappingURL=missing.map.js', // NB: compareStackTrace adds another source mapping.
'throw new Error("test");'
], [
'Error: test',
/^ at Object\.exports\.test \(.*\/original.js:1002:5\)$/
]);
});
it('default options', function(done) {

@@ -340,4 +350,3 @@ compareStdout(done, createSingleLineSourceMap(), [

], [
'SRC:',
/\/.original.js:1$/,
/^SRC:.*\/.original.js:1$/,
'this is the original code',

@@ -344,0 +353,0 @@ '^'

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