File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -69,10 +69,19 @@ export namespace NodeLoaderHooksAPI2 {
6969 url : string ,
7070 context : { format : NodeLoaderHooksFormat | null | undefined } ,
7171 defaultLoad : NodeLoaderHooksAPI2 [ 'load' ]
72- ) => Promise < { format : NodeLoaderHooksFormat ; source : string | Buffer | undefined } > ;
72+ ) => Promise < {
73+ format : NodeLoaderHooksFormat ;
74+ source : string | Buffer | undefined ;
75+ } > ;
7376}
7477
75- export type NodeLoaderHooksFormat = 'builtin' | 'commonjs' | 'dynamic' | 'json' | 'module' | 'wasm' ;
78+ export type NodeLoaderHooksFormat =
79+ | 'builtin'
80+ | 'commonjs'
81+ | 'dynamic'
82+ | 'json'
83+ | 'module'
84+ | 'wasm' ;
7685
7786/** @internal */
7887export function registerAndCreateEsmHooks ( opts ?: RegisterOptions ) {
@@ -152,7 +161,10 @@ export function createEsmHooks(tsNodeService: Service) {
152161 url : string ,
153162 context : { format : NodeLoaderHooksFormat | null | undefined } ,
154163 defaultLoad : typeof load
155- ) : Promise < { format : NodeLoaderHooksFormat ; source : string | Buffer | undefined } > {
164+ ) : Promise < {
165+ format : NodeLoaderHooksFormat ;
166+ source : string | Buffer | undefined ;
167+ } > {
156168 // If we get a format hint from resolve() on the context then use it
157169 // otherwise call the old getFormat() hook using node's old built-in defaultGetFormat() that ships with ts-node
158170 const format =
Original file line number Diff line number Diff line change @@ -40,7 +40,11 @@ export type {
4040 TranspileOptions ,
4141 Transpiler ,
4242} from './transpilers/types' ;
43- export type { NodeLoaderHooksAPI1 , NodeLoaderHooksAPI2 , NodeLoaderHooksFormat } from './esm' ;
43+ export type {
44+ NodeLoaderHooksAPI1 ,
45+ NodeLoaderHooksAPI2 ,
46+ NodeLoaderHooksFormat ,
47+ } from './esm' ;
4448
4549/**
4650 * Does this version of node obey the package.json "type" field
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ test.suite('createEsmHooks', (test) => {
4545test . suite ( 'hooks' , ( _test ) => {
4646 const test = _test . context ( async ( t ) => {
4747 const service = t . context . tsNodeUnderTest . create ( {
48- cwd : TEST_DIR
48+ cwd : TEST_DIR ,
4949 } ) ;
5050 t . teardown ( ( ) => {
5151 resetNodeEnvironment ( ) ;
You can’t perform that action at this time.
0 commit comments