File tree Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 2929 name : ' @sentry/packages - build + lint + test + codecov + danger [node v12]'
3030 node_js : ' 12'
3131 script : scripts/danger.sh
32+ - name : ' @sentry/packages - build and test [node v6]'
33+ node_js : ' 6'
34+ script : scripts/test.sh
3235 - name : ' @sentry/packages - build and test [node v8]'
3336 node_js : ' 8'
3437 script : scripts/test.sh
Original file line number Diff line number Diff line change @@ -13,18 +13,24 @@ import {
1313 uuid4 ,
1414} from '@sentry/utils' ;
1515
16+ const INITIAL_TIME = Date . now ( ) ;
17+
18+ const performanceFallback : Pick < Performance , 'now' > = {
19+ now ( ) : number {
20+ return INITIAL_TIME - Date . now ( ) ;
21+ } ,
22+ } ;
23+
1624const crossPlatformPerformance : Pick < Performance , 'now' > = ( ( ) => {
1725 if ( isNodeEnv ( ) ) {
18- const { performance } = dynamicRequire ( module , 'perf_hooks' ) as { performance : Performance } ;
19- return performance ;
20- }
21- return (
22- getGlobalObject < Window > ( ) . performance || {
23- now ( ) : number {
24- return Date . now ( ) ;
25- } ,
26+ try {
27+ const perfHooks = dynamicRequire ( module , 'perf_hooks' ) as { performance : Performance } ;
28+ return perfHooks . performance ;
29+ } catch ( _ ) {
30+ return performanceFallback ;
2631 }
27- ) ;
32+ }
33+ return getGlobalObject < Window > ( ) . performance || performanceFallback ;
2834} ) ( ) ;
2935
3036// TODO: Should this be exported?
Original file line number Diff line number Diff line change 77 "author" : " Sentry" ,
88 "license" : " BSD-3-Clause" ,
99 "engines" : {
10- "node" : " >=8 "
10+ "node" : " >=6 "
1111 },
1212 "main" : " dist/index.js" ,
1313 "module" : " esm/index.js" ,
You can’t perform that action at this time.
0 commit comments