squash_javascript 1.0.3 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +49 -8
- data/bin/upload_source_map +10 -4
- data/lib/squash/javascript/capistrano.rb +16 -0
- data/lib/squash/javascript/patches.rb +33 -0
- data/lib/squash/javascript/railtie.rb +5 -0
- data/lib/squash/javascript/source_mapping_coffeescript_template.rb +27 -0
- data/lib/squash/javascript/source_mapping_javascript_minifier.rb +36 -0
- data/lib/squash/javascript/tasks/sourcemaps.rake +73 -0
- data/lib/squash/javascript.rb +4 -1
- data/lib/tasks/squash.cap +30 -0
- data/vendor/assets/javascripts/squash_javascript/{client.coffee → client.js.coffee} +1 -1
- data/vendor/assets/javascripts/squash_javascript/tracekit.js +1000 -996
- data/vendor/assets/javascripts/squash_javascript.min.js +24 -24
- data/vendor/assets/javascripts/squash_javascript.orig.js +1 -1
- metadata +47 -29
- data/lib/squash/javascript/source_map.rb +0 -181
@@ -1,24 +1,24 @@
|
|
1
|
-
(function(){var
|
2
|
-
a=[];for(
|
3
|
-
!1;if(this.shouldIgnoreError(
|
4
|
-
window.location.hostname;0<window.location.port.length&&(a.port=window.location.port);a.path=window.location.pathname;a.query=window.location.search;""!==window.location.hash&&(a.fragment=window.location.hash);a.user_agent=navigator.userAgent;a.screen_width=screen.width;a.screen_height=screen.height;a.window_width=window.innerWidth;a.window_height=window.innerHeight;a.color_depth=screen.colorDepth;if(
|
5
|
-
this.options.notifyPath,[["Content-Type","application/json"]],
|
6
|
-
function(){return
|
7
|
-
SquashJavascript.instance()).ignoreExceptions.apply(i
|
8
|
-
|
9
|
-
1)+"-"+
|
10
|
-
TraceKit.report=function(){function
|
11
|
-
(
|
12
|
-
TraceKit.computeStackTrace=function(){function
|
13
|
-
|
14
|
-
"\\$&")}function k(a){return e(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function
|
15
|
-
function
|
16
|
-
|
17
|
-
b.context,!1}a.stack.unshift(b);return a.partial=!0}a.incomplete=!0;return!1}function
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}try{var
|
22
|
-
{url:y[3],func:
|
23
|
-
name:a.name,message:
|
24
|
-
(function(
|
1
|
+
(function(){var g,f={}.hasOwnProperty,i=[].slice,e="undefined"!==typeof exports&&null!==exports?exports:this,k=function(){},r;r=void 0;k.instance=function(){return null!=r?r:r=new g};e.SquashJavascript=k;var e=function(){TraceKit.report.subscribe(function(c,b){return SquashJavascript.instance().report(c,b)})},n,m,v,A;e.prototype.configure=function(c){var b,d,a;this.options||(this.options={disabled:!1,notifyPath:"/api/1.0/notify",transmitTimeout:15E3,ignoredExceptionClasses:[],ignoredExceptionMessages:{}});
|
2
|
+
a=[];for(b in c)f.call(c,b)&&(d=c[b],a.push(this.options[b]=d));return a};e.prototype.notify=function(c,b){if(c instanceof Error)return c._squash_user_data=b,TraceKit.report(c);throw c;};e.prototype.report=function(c,b){var d,a,j,x,F,G,p,h,e,k,i,m;try{if(null!=(G=this.options)&&G.disabled)return!1;if(!(null!=(p=this.options)&&p.APIKey)||!(null!=(h=this.options)&&h.environment)||!(null!=(e=this.options)&&e.revision)||!(null!=(k=this.options)&&k.APIHost))return console.error("Missing required Squash configuration keys"),
|
3
|
+
!1;if(this.shouldIgnoreError(c)||!c.stack)return!1;a={};a.api_key=this.options.APIKey;a.environment=this.options.environment;a.client="javascript";a.revision=this.options.revision;a.class_name=null!=(i=c.type)?i:c.name;!c.name&&(x=c.message.match(/^(Uncaught )?(\w+): (.+)/))?(a.class_name=x[2],a.message=x[3]):a.message=c.message;null==a.class_name&&(a.class_name="Error");a.backtraces=v(c.stack);a.capture_method=c.mode;a.occurred_at=n(new Date);a.schema=window.location.protocol.replace(/:$/,"");a.host=
|
4
|
+
window.location.hostname;0<window.location.port.length&&(a.port=window.location.port);a.path=window.location.pathname;a.query=window.location.search;""!==window.location.hash&&(a.fragment=window.location.hash);a.user_agent=navigator.userAgent;a.screen_width=screen.width;a.screen_height=screen.height;a.window_width=window.innerWidth;a.window_height=window.innerHeight;a.color_depth=screen.colorDepth;if(b)for(j in m=b._squash_user_data,m)f.call(m,j)&&(F=m[j],a[j]=F);d=JSON.stringify(a);this.HTTPTransmit(this.options.APIHost+
|
5
|
+
this.options.notifyPath,[["Content-Type","application/json"]],d);return!0}catch(g){return console.error("Error while trying to notify Squash:",g.stack),console.error("-- original error:",c)}};e.prototype.addUserData=function(c,b){try{return b()}catch(d){throw null==d._squash_user_data&&(d._squash_user_data={}),A(d._squash_user_data,c),d;}};e.prototype.addingUserData=function(c,b){return function(){var d;d=1<=arguments.length?i.call(arguments,0):[];return SquashJavascript.instance().addUserData(c,
|
6
|
+
function(){return b.apply(null,d)})}};e.prototype.ignoreExceptions=function(){var c,b;b=2<=arguments.length?i.call(arguments,0,c=arguments.length-1):(c=0,[]);c=arguments[c++];try{return c()}catch(d){throw d._squash_ignored_exceptions=(d._squash_ignored_exceptions||[]).concat(b),d;}};e.prototype.ignoringExceptions=function(){var c,b,d;b=2<=arguments.length?i.call(arguments,0,d=arguments.length-1):(d=0,[]);c=arguments[d++];return function(){var a,j;a=1<=arguments.length?i.call(arguments,0):[];return(j=
|
7
|
+
SquashJavascript.instance()).ignoreExceptions.apply(j,i.call(b).concat([function(){return c.apply(null,a)}]))}};e.prototype.HTTPTransmit=function(c,b,d){var a,j,x;a=new XMLHttpRequest;a.open("POST",c,!0);a.timeout=this.options.transmitTimeout;j=0;for(x=b.length;j<x;j++)c=b[j],a.setRequestHeader(c[0],c[1]);a.send(d);return a};e.prototype.shouldIgnoreError=function(c){var b;b=this.options.ignoredExceptionClasses.concat(c._squash_ignored_exceptions||[]);return m(b,function(b){return c.name===b})?!0:
|
8
|
+
m(this.options.ignoredExceptionMessages,function(b,a){return c.name===b?m(a,function(a){return c.message.match(a)}):!1})};v=function(c){var b,d,a,j,x;b=[];j=0;for(x=c.length;j<x;j++)a=c[j],(d=a.context)&&m(d,function(a){return a&&200<a.length})&&(d=null),b.push({url:a.url,line:a.line,column:a.column,symbol:a.func,context:d,type:"js:hosted"});return[{name:"Active Thread",faulted:!0,backtrace:b}]};n=function(c){var b;b=function(c){return 10>c?"0"+c:c};return""+c.getUTCFullYear()+"-"+b(c.getUTCMonth()+
|
9
|
+
1)+"-"+b(c.getUTCDate())+"T"+b(c.getUTCHours())+":"+b(c.getUTCMinutes())+":"+b(c.getUTCSeconds())+"Z"};m=function(c,b){var d,a,j;if(c instanceof Array){a=0;for(j=c.length;a<j;a++)if(d=c[a],b(d))return!0}else for(d in c)if(f.call(c,d)&&(a=c[d],b(d,a)))return!0;return!1};A=function(c,b){var d,a,j;j=[];for(d in b)f.call(b,d)&&(a=b[d],j.push(c[d]=a));return j};g=e}).call(this);var TraceKit={};
|
10
|
+
TraceKit.report=function(){function g(e,k){var g=null,f;for(f in i)if(i.hasOwnProperty(f))try{i[f](e,k)}catch(c){g=c}if(g)throw g;}function f(n){if(k){if(e===n)return;var i=k;e=k=null;g(i,n)}var f=TraceKit.computeStackTrace(n);k=f;e=n;window.setTimeout(function(){e===n&&(e=k=null,g(f,n))},f.incomplete?2E3:0);throw n;}var i=[],e=null,k=null,r=window.onerror;window.onerror=function(n,f,i,A,c){var b=null,d=null;c&&(b=TraceKit.computeStackTrace(c));b||(k?(TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(k,f,
|
11
|
+
i,A,n),b=k,d=e,e=k=null):(b={url:f,line:i,column:A},b.func=TraceKit.computeStackTrace.guessFunctionName(b.url,b.line),b.context=TraceKit.computeStackTrace.gatherContext(b.url,b.line),b={mode:"onerror",message:n,stack:[b]}));g(b,d);return r?r.apply(this,arguments):!1};f.subscribe=function(e){i.push(e)};f.unsubscribe=function(e){for(var f=i.length-1;0<=f;--f)i[f]===e&&i.splice(f,1)};return f}();
|
12
|
+
TraceKit.computeStackTrace=function(){function g(a){if(!d.hasOwnProperty(a)){var j,c=a.split("/");if(2<c.length&&c[2]===document.domain)try{void 0===XMLHttpRequest&&(XMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(j){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(c){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(b){}throw Error("No XHR.");});var b=new XMLHttpRequest;b.open("GET",a,!1);
|
13
|
+
b.send("");j=b.responseText}catch(e){j=""}else j=[];d[a]=j.length?j.split("\n"):[]}return d[a]}function f(a,j){var c=/function ([^(]*)\(([^)]*)\)/,b=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,d="",e=g(a),h;if(!e.length)return"?";for(var f=0;10>f;++f)if(d=e[j-f]+d,void 0!==d&&((h=b.exec(d))||(h=c.exec(d))))return h[1];return"?"}function i(a,c){var b=g(a),d=[],e=!1;if(!b.length)return null;for(var c=c-1,f=c-2,h=c+2;f<h;++f)d.push(b[f]),void 0!==b[f]&&(e=!0);return e?d:null}function e(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,
|
14
|
+
"\\$&")}function k(a){return e(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function r(a,c){for(var b,d,f=0,e=c.length;f<e;++f)if((b=g(c[f])).length)if(b=b.join("\n"),d=a.exec(b))return{url:c[f],line:b.substring(0,d.index).split("\n").length,column:d.index-b.lastIndexOf("\n",d.index)-1};return null}function n(a,c,b){var c=g(c),a=RegExp("\\b"+e(a)+"\\b"),d,b=b-1;return c&&c.length>b&&(d=a.exec(c[b]))?d.index:null}
|
15
|
+
function m(a){var c=[window.location.href],b=document.getElementsByTagName("script"),a=""+a,d;for(d=0;d<b.length;++d){var f=b[d];f.src&&c.push(f.src)}(b=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(a))?(d=b[1]?"\\s+"+b[1]:"",f=b[2].split(",").join("\\s*,\\s*"),b=e(b[3]).replace(/;$/,";?").replace(/\s+/g,"\\s+"),d=RegExp("function"+d+"\\s*\\(\\s*"+f+"\\s*\\)\\s*{\\s*"+b+"\\s*}")):d=RegExp(e(a).replace(/\s+/g,"\\s+"));if(d=r(d,c))return d;if(b=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(a)){a=
|
16
|
+
b[1];b=k(b[2]);d=RegExp("on"+a+"=[\\'\"]\\s*"+b+"\\s*[\\'\"]","i");if(d=r(d,c[0]))return d;d=RegExp(b);if(d=r(d,c))return d}return null}function v(a,b,c,d,e){b={url:b,line:c,column:e};if(b.url&&b.line){a.incomplete=!1;b.func||(b.func=f(b.url,b.line));b.context||(b.context=i(b.url,b.line));if(e=/ '([^']+)' /.exec(e))b.column=n(e[1],b.url,b.line);if(0<a.stack.length&&a.stack[0].url===b.url){if(a.stack[0].line===b.line)return!1;if(!a.stack[0].line&&a.stack[0].func===b.func)return a.stack[0].line=b.line,
|
17
|
+
a.stack[0].context=b.context,!1}a.stack.unshift(b);return a.partial=!0}a.incomplete=!0;return!1}function A(a,b){for(var d=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,e=[],i={},k,h,g=arguments.callee.caller;g;g=g.caller)if(!(g===c||g===TraceKit.report)){h={url:null,func:"?",line:null,column:null};if(g.name)h.func=g.name;else if(k=d.exec(g.toString()))h.func=k[1];if(k=m(g)){h.url=k.url;h.line=k.line;"?"===h.func&&(h.func=f(h.url,h.line));var r=/ '([^']+)' /.exec(a.message||
|
18
|
+
a.description);r&&(h.column=n(r[1],k.url,k.line))}i[""+g]&&(h.recursion=!0);e.push(h)}b&&e.splice(0,b);d={mode:"callers",name:a.name,message:a.message,stack:e};v(d,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description);return d}function c(a,c){var d=null,c=void 0===c?0:+c;try{for(var e=/ line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,m=a.stacktrace.split("\n"),p=[],h,v=0,L=m.length;v<L;v+=2)if(h=e.exec(m[v])){var u={line:+h[1],column:+h[2],
|
19
|
+
func:h[3]||h[4],args:h[5]?h[5].split(","):[],url:h[6]};!u.func&&u.line&&(u.func=f(u.url,u.line));if(u.line)try{u.context=i(u.url,u.line)}catch(U){}u.context||(u.context=[m[v+1]]);p.push(u)}d=p.length?{mode:"stacktrace",name:a.name,message:a.message,stack:p}:null;if(d)return d}catch(M){if(b)throw M;}try{if(a.stack){var e=/^\s*at (?:new )?(.+) (?:\[as \S+\] )?\(((?:file|https?):.*?):(\d+)(?::(\d+))?\)\s*$/i,m=/^\s*(\S*)(?:\((.*?)\))?@((?:file|http).*?):(\d+)(?::(\d+))?\s*$/i,C=a.stack.split("\n"),p=
|
20
|
+
[],q,s,B=/^(.*) is undefined$/.exec(a.message);h=0;for(var E=C.length;h<E;++h){if(q=m.exec(C[h]))s={url:q[3],func:q[1],args:q[2]?q[2].split(","):"",line:+q[4],column:q[5]?+q[5]:null};else if(q=e.exec(C[h]))s={url:q[2],func:q[1],line:+q[3],column:q[4]?+q[4]:null};else continue;!s.func&&s.line&&(s.func=f(s.url,s.line));s.line&&(s.context=i(s.url,s.line));p.push(s)}p[0]&&(p[0].line&&!p[0].column&&B)&&(p[0].column=n(B[1],p[0].url,p[0].line));d=p.length?{mode:"stack",name:a.name,message:a.message,stack:p}:
|
21
|
+
null}else d=null;if(d)return d}catch(N){if(b)throw N;}try{var y=a.message.split("\n");if(4>y.length)d=null;else{C=/^\s*Line (\d+) of linked script ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i;q=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i;s=/^\s*Line (\d+) of function script\s*$/i;var B=[],l=document.getElementsByTagName("script"),E=[],w,t,H,z;for(t in l)l.hasOwnProperty(t)&&!l[t].src&&E.push(l[t]);t=2;for(H=y.length;t<H;t+=2){l=null;if(w=C.exec(y[t]))l=
|
22
|
+
{url:w[2],func:w[3],line:+w[1]};else if(w=q.exec(y[t])){var l={url:w[3],func:w[4]},O=+w[1],I=E[w[2]-1];if(I&&(z=g(l.url))){z=z.join("\n");var J=z.indexOf(I.innerText);0<=J&&(l.line=O+z.substring(0,J).split("\n").length)}}else if(w=s.exec(y[t])){var K=window.location.href.replace(/#.*$/,""),P=w[1],Q=RegExp(k(y[t+1]));z=r(Q,[K]);l={url:K,line:z?z.line:P,func:""}}if(l){l.func||(l.func=f(l.url,l.line));var D=i(l.url,l.line),R=D?D[Math.floor(D.length/2)]:null;l.context=D&&R.replace(/^\s*/,"")===y[t+1].replace(/^\s*/,
|
23
|
+
"")?D:[y[t+1]];B.push(l)}}d=B.length?{mode:"multiline",name:a.name,message:y[0],stack:B}:null}if(d)return d}catch(S){if(b)throw S;}try{if(d=A(a,c+1))return d}catch(T){if(b)throw T;}return{mode:"failed"}}var b=!1,d={};c.augmentStackTraceWithInitialElement=v;c.guessFunctionName=f;c.gatherContext=i;c.ofCaller=function(a){a=(void 0===a?0:+a)+1;try{0()}catch(b){return c(b,a+1)}return null};return c}();
|
24
|
+
(function(g){var f=Array.prototype.slice,i=g.setTimeout;g.setTimeout=function(){var e=f.call(arguments,0),g=e[0];e[0]=function(){try{g.apply(this,arguments)}catch(e){throw TraceKit.report(e),e;}};return i.apply(this,e)};var e=g.setInterval;g.setInterval=function(){var g=f.call(arguments,0),i=g[0];g[0]=function(){try{i.apply(this,arguments)}catch(e){throw TraceKit.report(e),e;}};return e.apply(this,g)}})(window);
|
metadata
CHANGED
@@ -1,113 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squash_javascript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
My4x
|
19
|
+
version: '3.1'
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
|
-
- -
|
24
|
+
- - '>='
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
|
26
|
+
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sprockets
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
29
41
|
- !ruby/object:Gem::Dependency
|
30
42
|
name: json
|
31
43
|
requirement: !ruby/object:Gem::Requirement
|
32
44
|
requirements:
|
33
|
-
- -
|
45
|
+
- - '>='
|
34
46
|
- !ruby/object:Gem::Version
|
35
47
|
version: '0'
|
36
48
|
type: :runtime
|
37
49
|
prerelease: false
|
38
50
|
version_requirements: !ruby/object:Gem::Requirement
|
39
51
|
requirements:
|
40
|
-
- -
|
52
|
+
- - '>='
|
41
53
|
- !ruby/object:Gem::Version
|
42
54
|
version: '0'
|
43
55
|
- !ruby/object:Gem::Dependency
|
44
56
|
name: squash_uploader
|
45
57
|
requirement: !ruby/object:Gem::Requirement
|
46
58
|
requirements:
|
47
|
-
- -
|
59
|
+
- - '>='
|
48
60
|
- !ruby/object:Gem::Version
|
49
61
|
version: '0'
|
50
62
|
type: :runtime
|
51
63
|
prerelease: false
|
52
64
|
version_requirements: !ruby/object:Gem::Requirement
|
53
65
|
requirements:
|
54
|
-
- -
|
66
|
+
- - '>='
|
55
67
|
- !ruby/object:Gem::Version
|
56
68
|
version: '0'
|
57
69
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
70
|
+
name: sourcemap
|
59
71
|
requirement: !ruby/object:Gem::Requirement
|
60
72
|
requirements:
|
61
|
-
- -
|
73
|
+
- - '>='
|
62
74
|
- !ruby/object:Gem::Version
|
63
75
|
version: '0'
|
64
|
-
type: :
|
76
|
+
type: :runtime
|
65
77
|
prerelease: false
|
66
78
|
version_requirements: !ruby/object:Gem::Requirement
|
67
79
|
requirements:
|
68
|
-
- -
|
80
|
+
- - '>='
|
69
81
|
- !ruby/object:Gem::Version
|
70
82
|
version: '0'
|
71
83
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
84
|
+
name: yard
|
73
85
|
requirement: !ruby/object:Gem::Requirement
|
74
86
|
requirements:
|
75
|
-
- -
|
87
|
+
- - '>='
|
76
88
|
- !ruby/object:Gem::Version
|
77
89
|
version: '0'
|
78
90
|
type: :development
|
79
91
|
prerelease: false
|
80
92
|
version_requirements: !ruby/object:Gem::Requirement
|
81
93
|
requirements:
|
82
|
-
- -
|
94
|
+
- - '>='
|
83
95
|
- !ruby/object:Gem::Version
|
84
96
|
version: '0'
|
85
97
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
98
|
+
name: redcarpet
|
87
99
|
requirement: !ruby/object:Gem::Requirement
|
88
100
|
requirements:
|
89
|
-
- -
|
101
|
+
- - '>='
|
90
102
|
- !ruby/object:Gem::Version
|
91
103
|
version: '0'
|
92
104
|
type: :development
|
93
105
|
prerelease: false
|
94
106
|
version_requirements: !ruby/object:Gem::Requirement
|
95
107
|
requirements:
|
96
|
-
- -
|
108
|
+
- - '>='
|
97
109
|
- !ruby/object:Gem::Version
|
98
110
|
version: '0'
|
99
111
|
- !ruby/object:Gem::Dependency
|
100
|
-
name:
|
112
|
+
name: jeweler
|
101
113
|
requirement: !ruby/object:Gem::Requirement
|
102
114
|
requirements:
|
103
|
-
- -
|
115
|
+
- - '>='
|
104
116
|
- !ruby/object:Gem::Version
|
105
117
|
version: '0'
|
106
118
|
type: :development
|
107
119
|
prerelease: false
|
108
120
|
version_requirements: !ruby/object:Gem::Requirement
|
109
121
|
requirements:
|
110
|
-
- -
|
122
|
+
- - '>='
|
111
123
|
- !ruby/object:Gem::Version
|
112
124
|
version: '0'
|
113
125
|
description: This client library records exceptions in front-end JavaScript code to
|
@@ -124,11 +136,17 @@ files:
|
|
124
136
|
- README.md
|
125
137
|
- bin/upload_source_map
|
126
138
|
- lib/squash/javascript.rb
|
139
|
+
- lib/squash/javascript/capistrano.rb
|
127
140
|
- lib/squash/javascript/engine.rb
|
128
|
-
- lib/squash/javascript/
|
141
|
+
- lib/squash/javascript/patches.rb
|
142
|
+
- lib/squash/javascript/railtie.rb
|
143
|
+
- lib/squash/javascript/source_mapping_coffeescript_template.rb
|
144
|
+
- lib/squash/javascript/source_mapping_javascript_minifier.rb
|
145
|
+
- lib/squash/javascript/tasks/sourcemaps.rake
|
146
|
+
- lib/tasks/squash.cap
|
129
147
|
- vendor/assets/javascripts/squash_javascript.min.js
|
130
148
|
- vendor/assets/javascripts/squash_javascript.orig.js
|
131
|
-
- vendor/assets/javascripts/squash_javascript/client.coffee
|
149
|
+
- vendor/assets/javascripts/squash_javascript/client.js.coffee
|
132
150
|
- vendor/assets/javascripts/squash_javascript/index.js
|
133
151
|
- vendor/assets/javascripts/squash_javascript/tracekit.js
|
134
152
|
homepage: http://github.com/SquareSquash/javascript
|
@@ -141,12 +159,12 @@ require_paths:
|
|
141
159
|
- lib
|
142
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
161
|
requirements:
|
144
|
-
- -
|
162
|
+
- - '>='
|
145
163
|
- !ruby/object:Gem::Version
|
146
164
|
version: '0'
|
147
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
166
|
requirements:
|
149
|
-
- -
|
167
|
+
- - '>='
|
150
168
|
- !ruby/object:Gem::Version
|
151
169
|
version: '0'
|
152
170
|
requirements: []
|
@@ -1,181 +0,0 @@
|
|
1
|
-
# Copyright 2013 Square Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
require 'json'
|
16
|
-
|
17
|
-
# An in-memory representation of a JavaScript source map.
|
18
|
-
|
19
|
-
class Squash::Javascript::SourceMap
|
20
|
-
# @private
|
21
|
-
VLQ_CONTINUATION_BIT = 1 << 5
|
22
|
-
|
23
|
-
# @return [Array<Squash::Javascript::SourceMap::Mapping>] The individual
|
24
|
-
# mappings in this source map.
|
25
|
-
attr_reader :mappings
|
26
|
-
|
27
|
-
# @private
|
28
|
-
def initialize(entries=[])
|
29
|
-
@mappings = entries
|
30
|
-
sort!
|
31
|
-
end
|
32
|
-
|
33
|
-
# Parses a JSON version-3 source map file and generates a SourceMap from it.
|
34
|
-
#
|
35
|
-
# @param [String] source_file A path to a source map file.
|
36
|
-
# @param [String] route The URL where the compiled JavaScript asset is
|
37
|
-
# accessed.
|
38
|
-
# @param [Hash] options Additional options.
|
39
|
-
# @option options [String] :root If set, overrides the project root specified
|
40
|
-
# in the `sourceRoot` field with this root. Absolute paths will be converted
|
41
|
-
# into project-local paths (suitable for Git-blaming) using this root.
|
42
|
-
|
43
|
-
def self.from_sourcemap(source_file, route, options={})
|
44
|
-
fields = JSON.parse(File.read(source_file))
|
45
|
-
raise "Only version 3 source maps are supported" unless fields['version'] == 3
|
46
|
-
|
47
|
-
project_root = options[:root] || fields['sourceRoot'] or raise("Must specify a project root in the source map or method options")
|
48
|
-
project_root << '/' unless project_root[-2..-1] == '/'
|
49
|
-
|
50
|
-
route = route
|
51
|
-
sources = fields['sources'].map { |source| source.sub(/^#{Regexp.escape project_root}/, '') }
|
52
|
-
names = fields['names']
|
53
|
-
|
54
|
-
mappings = fields['mappings'].split(';').map { |group| group.split ',' }
|
55
|
-
entries = Array.new
|
56
|
-
|
57
|
-
source_file_counter = 0
|
58
|
-
source_line_counter = 0
|
59
|
-
source_column_counter = 0
|
60
|
-
symbol_counter = 0
|
61
|
-
mappings.each_with_index do |group, compiled_line_number|
|
62
|
-
compiled_column_counter = 0
|
63
|
-
group.each do |segment|
|
64
|
-
values = decode64vlq(segment)
|
65
|
-
compiled_column_counter += values[0]
|
66
|
-
source_file_counter += values[1] if values[1]
|
67
|
-
source_line_counter += values[2] if values[2]
|
68
|
-
source_column_counter += values[3] if values[3]
|
69
|
-
symbol_counter += values[4] if values[4]
|
70
|
-
entries << Mapping.new(
|
71
|
-
route, compiled_line_number, compiled_column_counter,
|
72
|
-
sources[source_file_counter], source_line_counter, source_column_counter,
|
73
|
-
names[symbol_counter]
|
74
|
-
)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
return new(entries)
|
79
|
-
end
|
80
|
-
|
81
|
-
# @private
|
82
|
-
def <<(obj)
|
83
|
-
@mappings << obj
|
84
|
-
sort!
|
85
|
-
end
|
86
|
-
|
87
|
-
# Given the URL of a minified JavaScript asset, and a line and column number,
|
88
|
-
# attempts to locate the original source file and line number.
|
89
|
-
#
|
90
|
-
# @param [String] route The URL of the JavaScript file.
|
91
|
-
# @param [Fixnum] line The line number.
|
92
|
-
# @param [Fixnum] column The character number within the line.
|
93
|
-
|
94
|
-
def resolve(route, line, column)
|
95
|
-
index = 0
|
96
|
-
mapping = nil
|
97
|
-
while index < mappings.length
|
98
|
-
entry = mappings[index]
|
99
|
-
mapping = entry if entry.route == route && entry.compiled_line == line && entry.compiled_column <= column
|
100
|
-
break if entry.route > route || (entry.route == route && entry.compiled_line > line)
|
101
|
-
index += 1
|
102
|
-
end
|
103
|
-
|
104
|
-
return mapping
|
105
|
-
end
|
106
|
-
|
107
|
-
private
|
108
|
-
|
109
|
-
def sort!
|
110
|
-
@mappings.sort_by! { |m| [m.route, m.compiled_line, m.compiled_column] }
|
111
|
-
end
|
112
|
-
|
113
|
-
def self.decode64vlq(string)
|
114
|
-
bytes = string.bytes.to_a
|
115
|
-
byte_index = 0
|
116
|
-
result = []
|
117
|
-
|
118
|
-
begin
|
119
|
-
raise "Base-64 VLQ-encoded string unexpectedly terminated" if byte_index >= string.bytesize
|
120
|
-
|
121
|
-
number = 0
|
122
|
-
continuation = false
|
123
|
-
shift = 0
|
124
|
-
begin
|
125
|
-
# each character corresponds to a 6-bit word
|
126
|
-
digit = decode64(bytes[byte_index])
|
127
|
-
byte_index += 1
|
128
|
-
# the most significant bit is the continuation bit
|
129
|
-
continuation = (digit & VLQ_CONTINUATION_BIT) != 0
|
130
|
-
# the remaining bits are the number
|
131
|
-
digit = digit & (VLQ_CONTINUATION_BIT - 1)
|
132
|
-
# continuations are little-endian
|
133
|
-
number += (digit << shift)
|
134
|
-
shift += 5
|
135
|
-
end while continuation
|
136
|
-
|
137
|
-
# the LSB is the sign bit
|
138
|
-
number = (number & 1 > 0) ? -(number >> 1) : (number >> 1)
|
139
|
-
result << number
|
140
|
-
end while byte_index < string.bytesize
|
141
|
-
|
142
|
-
return result
|
143
|
-
end
|
144
|
-
|
145
|
-
def self.decode64(byte)
|
146
|
-
case byte
|
147
|
-
when 65..90 then byte - 65 # A..Z => 0..25
|
148
|
-
when 97..122 then byte - 71 # a..z => 26..51
|
149
|
-
when 48..57 then byte + 4 # 0..9 => 52..61
|
150
|
-
when 43 then 62 # + => 62
|
151
|
-
when 47 then 63 # / => 63
|
152
|
-
else raise "Invalid byte #{byte} in base-64 VLQ string"
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
class Mapping
|
157
|
-
attr_accessor :route, :compiled_line, :compiled_column, :source_file, :source_line, :source_column, :symbol
|
158
|
-
|
159
|
-
def self.from_json(obj)
|
160
|
-
new *obj
|
161
|
-
end
|
162
|
-
|
163
|
-
def initialize(route, compiled_line, compiled_column, source_file, source_line, source_column, symbol)
|
164
|
-
@route = route
|
165
|
-
@compiled_line = compiled_line
|
166
|
-
@compiled_column = compiled_column
|
167
|
-
@source_file = source_file
|
168
|
-
@source_line = source_line
|
169
|
-
@source_column = source_column
|
170
|
-
@symbol = symbol
|
171
|
-
end
|
172
|
-
|
173
|
-
def as_json(options=nil)
|
174
|
-
[route, compiled_line, compiled_column, source_file, source_line, source_column, symbol]
|
175
|
-
end
|
176
|
-
|
177
|
-
def to_json(options=nil)
|
178
|
-
as_json.to_json
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|