@@ -58,7 +58,7 @@ export function mergeTransformers(
58
58
/* ****************************************************************************************************************** */
59
59
60
60
export function register ( ) : TSNode . RegisterOptions | undefined {
61
- const { tsNodeInstance, tsNode } = register . initialize ( ) ;
61
+ const { tsNodeInstance, tsNode } = initialize ( ) ;
62
62
63
63
const transformerConfig = getProjectTransformerConfig ( tsNodeInstance . config ) ;
64
64
if ( ! transformerConfig ) return ;
@@ -89,34 +89,30 @@ export function register(): TSNode.RegisterOptions | undefined {
89
89
return registerOptions ;
90
90
}
91
91
92
- export namespace register {
93
- export function initialize ( ) : {
94
- tsNode : typeof TSNode ;
95
- instanceSymbol : typeof REGISTER_INSTANCE ;
96
- tsNodeInstance : TSNode . Service ;
97
- } {
98
- let tsNode : typeof TSNode ;
99
- try {
100
- tsNode = require ( "ts-node" ) ;
101
- } catch {
102
- throw new Error (
103
- `Cannot resolve ts-node. Make sure ts-node is installed before using typescript-transform-paths/register` ,
104
- ) ;
105
- }
92
+ export function initialize ( ) : {
93
+ tsNode : typeof TSNode ;
94
+ instanceSymbol : typeof REGISTER_INSTANCE ;
95
+ tsNodeInstance : TSNode . Service ;
96
+ } {
97
+ let tsNode : typeof TSNode ;
98
+ try {
99
+ tsNode = require ( "ts-node" ) ;
100
+ } catch {
101
+ throw new Error (
102
+ `Cannot resolve ts-node. Make sure ts-node is installed before using typescript-transform-paths/register` ,
103
+ ) ;
104
+ }
106
105
107
- const instanceSymbol : typeof REGISTER_INSTANCE = tsNode [ "REGISTER_INSTANCE" ] ;
106
+ const instanceSymbol : typeof REGISTER_INSTANCE = tsNode [ "REGISTER_INSTANCE" ] ;
108
107
109
- let tsNodeInstance = global . process [ instanceSymbol ] ;
110
- if ( ! tsNodeInstance ) {
111
- tsNode . register ( ) ; // Register initially
112
- tsNodeInstance = global . process [ instanceSymbol ] ;
113
- }
114
- if ( ! tsNodeInstance ) throw new Error ( `Could not register ts-node instance!` ) ;
115
-
116
- return { tsNode, instanceSymbol, tsNodeInstance } ;
108
+ let tsNodeInstance = global . process [ instanceSymbol ] ;
109
+ if ( ! tsNodeInstance ) {
110
+ tsNode . register ( ) ; // Register initially
111
+ tsNodeInstance = global . process [ instanceSymbol ] ;
117
112
}
118
- }
113
+ if ( ! tsNodeInstance ) throw new Error ( `Could not register ts-node instance!` ) ;
119
114
120
- export default register ;
115
+ return { tsNode, instanceSymbol, tsNodeInstance } ;
116
+ }
121
117
122
118
// endregion
0 commit comments