@@ -5,13 +5,15 @@ import type { NormalizedOptions } from './normalize-options';
5
5
const SUPPORTED_MACROS = [ 'assert' , 'deprecate' , 'warn' , 'log' ] ;
6
6
7
7
export 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 ;
10
11
11
- this . debugHelpers = options . externalizeHelpers || { } ;
12
+ constructor ( babel : typeof Babel , options : NormalizedOptions ) {
13
+ this . debugHelpers = options . externalizeHelpers ;
12
14
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 ,
15
17
assertPredicateIndex : options . debugTools && options . debugTools . assertPredicateIndex ,
16
18
isDebug : options . debugTools . isDebug ,
17
19
} ) ;
@@ -54,7 +56,7 @@ export default class Macros {
54
56
}
55
57
56
58
_cleanImports ( ) {
57
- if ( ! this . debugHelpers . module ) {
59
+ if ( ! this . debugHelpers ? .module ) {
58
60
if ( this . localDebugBindings . length > 0 ) {
59
61
let importPath = this . localDebugBindings [ 0 ] . findParent ( ( p ) => p . isImportDeclaration ( ) ) ;
60
62
if ( importPath === null ) {
0 commit comments