1
- /*! Raven.js 3.23.1 (84edddc ) | github.com/getsentry/raven-js */
1
+ /*! Raven.js 3.23.2 (72f8e05 ) | github.com/getsentry/raven-js */
2
2
3
3
/*
4
4
* Includes TraceKit
@@ -88,6 +88,8 @@ module.exports = angularPlugin;
88
88
89
89
} , { "2" :2 } ] , 2 :[ function ( _dereq_ , module , exports ) {
90
90
( function ( global ) {
91
+ var stringify = _dereq_ ( 3 ) ;
92
+
91
93
var _window =
92
94
typeof window !== 'undefined'
93
95
? window
@@ -531,6 +533,98 @@ function safeJoin(input, delimiter) {
531
533
return output . join ( delimiter ) ;
532
534
}
533
535
536
+ // Default Node.js REPL depth
537
+ var MAX_SERIALIZE_EXCEPTION_DEPTH = 3 ;
538
+ // 50kB, as 100kB is max payload size, so half sounds reasonable
539
+ var MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024 ;
540
+ var MAX_SERIALIZE_KEYS_LENGTH = 40 ;
541
+
542
+ function utf8Length ( value ) {
543
+ return ~ - encodeURI ( value ) . split ( / % ..| ./ ) . length ;
544
+ }
545
+
546
+ function jsonSize ( value ) {
547
+ return utf8Length ( JSON . stringify ( value ) ) ;
548
+ }
549
+
550
+ function serializeValue ( value ) {
551
+ var maxLength = 40 ;
552
+
553
+ if ( typeof value === 'string' ) {
554
+ return value . length <= maxLength ? value : value . substr ( 0 , maxLength - 1 ) + '\u2026' ;
555
+ } else if (
556
+ typeof value === 'number' ||
557
+ typeof value === 'boolean' ||
558
+ typeof value === 'undefined'
559
+ ) {
560
+ return value ;
561
+ }
562
+
563
+ var type = Object . prototype . toString . call ( value ) ;
564
+
565
+ // Node.js REPL notation
566
+ if ( type === '[object Object]' ) return '[Object]' ;
567
+ if ( type === '[object Array]' ) return '[Array]' ;
568
+ if ( type === '[object Function]' )
569
+ return value . name ? '[Function: ' + value . name + ']' : '[Function]' ;
570
+
571
+ return value ;
572
+ }
573
+
574
+ function serializeObject ( value , depth ) {
575
+ if ( depth === 0 ) return serializeValue ( value ) ;
576
+
577
+ if ( isPlainObject ( value ) ) {
578
+ return Object . keys ( value ) . reduce ( function ( acc , key ) {
579
+ acc [ key ] = serializeObject ( value [ key ] , depth - 1 ) ;
580
+ return acc ;
581
+ } , { } ) ;
582
+ } else if ( Array . isArray ( value ) ) {
583
+ return value . map ( function ( val ) {
584
+ return serializeObject ( val , depth - 1 ) ;
585
+ } ) ;
586
+ }
587
+
588
+ return serializeValue ( value ) ;
589
+ }
590
+
591
+ function serializeException ( ex , depth , maxSize ) {
592
+ if ( ! isPlainObject ( ex ) ) return ex ;
593
+
594
+ depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth ;
595
+ maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize ;
596
+
597
+ var serialized = serializeObject ( ex , depth ) ;
598
+
599
+ if ( jsonSize ( stringify ( serialized ) ) > maxSize ) {
600
+ return serializeException ( ex , depth - 1 ) ;
601
+ }
602
+
603
+ return serialized ;
604
+ }
605
+
606
+ function serializeKeysForMessage ( keys , maxLength ) {
607
+ if ( typeof keys === 'number' || typeof keys === 'string' ) return keys . toString ( ) ;
608
+ if ( ! Array . isArray ( keys ) ) return '' ;
609
+
610
+ keys = keys . filter ( function ( key ) {
611
+ return typeof key === 'string' ;
612
+ } ) ;
613
+ if ( keys . length === 0 ) return '[object has no keys]' ;
614
+
615
+ maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength ;
616
+ if ( keys [ 0 ] . length >= maxLength ) return keys [ 0 ] ;
617
+
618
+ for ( var usedKeys = keys . length ; usedKeys > 0 ; usedKeys -- ) {
619
+ var serialized = keys . slice ( 0 , usedKeys ) . join ( ', ' ) ;
620
+ if ( serialized . length > maxLength ) continue ;
621
+ if ( usedKeys === keys . length ) return serialized ;
622
+ return serialized + '\u2026' ;
623
+ }
624
+
625
+ return '' ;
626
+ }
627
+
534
628
module . exports = {
535
629
isObject : isObject ,
536
630
isError : isError ,
@@ -560,9 +654,87 @@ module.exports = {
560
654
isSameStacktrace : isSameStacktrace ,
561
655
parseUrl : parseUrl ,
562
656
fill : fill ,
563
- safeJoin : safeJoin
657
+ safeJoin : safeJoin ,
658
+ serializeException : serializeException ,
659
+ serializeKeysForMessage : serializeKeysForMessage
564
660
} ;
565
661
566
662
} ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
663
+ } , { "3" :3 } ] , 3 :[ function ( _dereq_ , module , exports ) {
664
+ /*
665
+ json-stringify-safe
666
+ Like JSON.stringify, but doesn't throw on circular references.
667
+
668
+ Originally forked from https://github.com/isaacs/json-stringify-safe
669
+ version 5.0.1 on 3/8/2017 and modified to handle Errors serialization
670
+ and IE8 compatibility. Tests for this are in test/vendor.
671
+
672
+ ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE
673
+ */
674
+
675
+ exports = module . exports = stringify ;
676
+ exports . getSerialize = serializer ;
677
+
678
+ function indexOf ( haystack , needle ) {
679
+ for ( var i = 0 ; i < haystack . length ; ++ i ) {
680
+ if ( haystack [ i ] === needle ) return i ;
681
+ }
682
+ return - 1 ;
683
+ }
684
+
685
+ function stringify ( obj , replacer , spaces , cycleReplacer ) {
686
+ return JSON . stringify ( obj , serializer ( replacer , cycleReplacer ) , spaces ) ;
687
+ }
688
+
689
+ // https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106
690
+ function stringifyError ( value ) {
691
+ var err = {
692
+ // These properties are implemented as magical getters and don't show up in for in
693
+ stack : value . stack ,
694
+ message : value . message ,
695
+ name : value . name
696
+ } ;
697
+
698
+ for ( var i in value ) {
699
+ if ( Object . prototype . hasOwnProperty . call ( value , i ) ) {
700
+ err [ i ] = value [ i ] ;
701
+ }
702
+ }
703
+
704
+ return err ;
705
+ }
706
+
707
+ function serializer ( replacer , cycleReplacer ) {
708
+ var stack = [ ] ;
709
+ var keys = [ ] ;
710
+
711
+ if ( cycleReplacer == null ) {
712
+ cycleReplacer = function ( key , value ) {
713
+ if ( stack [ 0 ] === value ) {
714
+ return '[Circular ~]' ;
715
+ }
716
+ return '[Circular ~.' + keys . slice ( 0 , indexOf ( stack , value ) ) . join ( '.' ) + ']' ;
717
+ } ;
718
+ }
719
+
720
+ return function ( key , value ) {
721
+ if ( stack . length > 0 ) {
722
+ var thisPos = indexOf ( stack , this ) ;
723
+ ~ thisPos ? stack . splice ( thisPos + 1 ) : stack . push ( this ) ;
724
+ ~ thisPos ? keys . splice ( thisPos , Infinity , key ) : keys . push ( key ) ;
725
+
726
+ if ( ~ indexOf ( stack , value ) ) {
727
+ value = cycleReplacer . call ( this , key , value ) ;
728
+ }
729
+ } else {
730
+ stack . push ( value ) ;
731
+ }
732
+
733
+ return replacer == null
734
+ ? value instanceof Error ? stringifyError ( value ) : value
735
+ : replacer . call ( this , key , value ) ;
736
+ } ;
737
+ }
738
+
567
739
} , { } ] } , { } , [ 1 ] ) ( 1 )
568
740
} ) ;
0 commit comments