File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const EXTENSION_RE = /\.(js|mjs|cjs|ts|mts|cts)$/
14
14
const NODE_VERSION = process . versions . node . split ( '.' )
15
15
const NODE_MAJOR = Number ( NODE_VERSION [ 0 ] )
16
16
const NODE_MINOR = Number ( NODE_VERSION [ 1 ] )
17
+ const HANDLED_FORMATS = new Set ( [ 'builtin' , 'module' , 'commonjs' ] )
17
18
18
19
let entrypoint
19
20
@@ -349,6 +350,10 @@ function createHook (meta) {
349
350
return each === specifier || each === result . url || ( result . url . startsWith ( 'file:' ) && each === fileURLToPath ( result . url ) )
350
351
}
351
352
353
+ if ( result . format && ! HANDLED_FORMATS . has ( result . format ) ) {
354
+ return result
355
+ }
356
+
352
357
if ( includeModules && ! includeModules . some ( match ) ) {
353
358
return result
354
359
}
Original file line number Diff line number Diff line change
1
+ export type { Debugger } from 'node:inspector'
2
+
3
+ export const foo : number = 42
4
+
5
+ export function bar ( ) : number {
6
+ return foo
7
+ }
Original file line number Diff line number Diff line change
1
+ import { strictEqual } from 'assert'
2
+
3
+ const mod = await import ( '../fixtures/something.mts' )
4
+
5
+ strictEqual ( mod . foo , 42 )
6
+ strictEqual ( typeof mod . bar , 'function' )
7
+ strictEqual ( mod . bar ( ) , 42 )
8
+ strictEqual ( Object . keys ( mod ) . length , 2 )
You can’t perform that action at this time.
0 commit comments