File tree 1 file changed +27
-1
lines changed
1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,30 @@ const require = createRequire(fileURLToPath(import.meta.url));
4
4
5
5
/** @type {import('./dist/esm') } */
6
6
const esm = require ( './dist/esm' ) ;
7
- export const { resolve, load, getFormat, transformSource } = esm . registerAndCreateEsmHooks ( ) ;
7
+
8
+ /** @type {ReturnType<typeof esm['registerAndCreateEsmHooks']> | undefined } */
9
+ let loader = undefined ;
10
+
11
+ export function resolve ( ...args ) {
12
+ if ( ! loader ) initialize ( ) ;
13
+ return loader . resolve . apply ( this , args ) ;
14
+ }
15
+
16
+ export function load ( ...args ) {
17
+ if ( ! loader ) initialize ( ) ;
18
+ return loader . load . apply ( this , args ) ;
19
+ }
20
+
21
+ export function getFormat ( ...args ) {
22
+ if ( ! loader ) initialize ( ) ;
23
+ return loader . getFormat . apply ( this , args ) ;
24
+ }
25
+
26
+ export function transformSource ( ...args ) {
27
+ if ( ! loader ) initialize ( ) ;
28
+ return loader . transformSource . apply ( this , args ) ;
29
+ }
30
+
31
+ export function initialize ( tsNodeOptions ) {
32
+ loader = esm . registerAndCreateEsmHooks ( tsNodeOptions ) ;
33
+ }
You can’t perform that action at this time.
0 commit comments