@@ -5,13 +5,15 @@ import type { NormalizedOptions } from './normalize-options';
55const SUPPORTED_MACROS = [ 'assert' , 'deprecate' , 'warn' , 'log' ] ;
66
77export default class Macros {
8- constructor ( babel : typeof Babel , options : NormalizedOptions ) {
9- this . localDebugBindings = [ ] ;
8+ private debugHelpers : NormalizedOptions [ "externalizeHelpers" ] ;
9+ private localDebugBindings : unknown [ ] = [ ] ;
10+ private builder : Builder ;
1011
11- this . debugHelpers = options . externalizeHelpers || { } ;
12+ constructor ( babel : typeof Babel , options : NormalizedOptions ) {
13+ this . debugHelpers = options . externalizeHelpers ;
1214 this . builder = new Builder ( babel . types , {
13- module : this . debugHelpers . module ,
14- global : this . debugHelpers . global ,
15+ module : this . debugHelpers ? .module ,
16+ global : this . debugHelpers ? .global ,
1517 assertPredicateIndex : options . debugTools && options . debugTools . assertPredicateIndex ,
1618 isDebug : options . debugTools . isDebug ,
1719 } ) ;
@@ -54,7 +56,7 @@ export default class Macros {
5456 }
5557
5658 _cleanImports ( ) {
57- if ( ! this . debugHelpers . module ) {
59+ if ( ! this . debugHelpers ? .module ) {
5860 if ( this . localDebugBindings . length > 0 ) {
5961 let importPath = this . localDebugBindings [ 0 ] . findParent ( ( p ) => p . isImportDeclaration ( ) ) ;
6062 if ( importPath === null ) {
0 commit comments