@@ -88,7 +88,15 @@ const STANDARD_BUILTINS = [
88
88
'_asyncToGenerator' ,
89
89
] ;
90
90
91
+ let hackyCount = undefined
92
+
91
93
const mergeIntoOptions = ( options , opts ) => {
94
+ if ( opts . hackyCount !== undefined ) {
95
+ if ( hackyCount === undefined ) {
96
+ hackyCount = opts . hackyCount
97
+ }
98
+ }
99
+
92
100
opts = Object . assign ( { } , opts ) ;
93
101
const ignore = opts . ignore ;
94
102
if ( ignore ) {
@@ -104,6 +112,8 @@ const mergeIntoOptions = (options, opts) => {
104
112
Object . assign ( options , opts ) ;
105
113
} ;
106
114
115
+ let howDeepIsYourLove = 0
116
+
107
117
function processProgram ( { types : t } , programPath , programOpts ) {
108
118
const options = {
109
119
enable : isInASTExploler ( ) ,
@@ -398,6 +408,11 @@ function processProgram({ types: t }, programPath, programOpts) {
398
408
return false ;
399
409
}
400
410
411
+ howDeepIsYourLove ++
412
+ if ( howDeepIsYourLove > hackyCount ) {
413
+ return false ;
414
+ }
415
+
401
416
const globalIds = toPairs ( path . scope . globals )
402
417
. filter ( ( [ name , _ ] ) => ! options . ignore . has ( name ) )
403
418
. map ( ( [ _ , identifier ] ) => identifier ) ;
@@ -457,9 +472,6 @@ function processProgram({ types: t }, programPath, programOpts) {
457
472
} ;
458
473
459
474
function test ( path , statepath ) {
460
- if ( ! options . enable ) {
461
- return false ;
462
- }
463
475
if ( options . instrumentImports != 'query' ) return ;
464
476
465
477
const imports = path . node . body . filter ( byType ( 'ImportDeclaration' ) ) ;
0 commit comments