2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
- import { normalizeFsPath } from '@utils' ;
1
+ import { isDtsFile , normalizeFsPath } from '@utils' ;
2
2
import type { Plugin } from 'rollup' ;
3
3
4
4
import { InMemoryFileSystem } from '../sys/in-memory-fs' ;
@@ -9,7 +9,7 @@ export const fileLoadPlugin = (fs: InMemoryFileSystem): Plugin => {
9
9
10
10
load ( id ) {
11
11
const fsFilePath = normalizeFsPath ( id ) ;
12
- if ( id . endsWith ( '.d.ts' ) || id . endsWith ( '.d.mts' ) || id . endsWith ( '.d.cts' ) ) {
12
+ if ( isDtsFile ( fsFilePath ) ) {
13
13
return '' ;
14
14
}
15
15
return fs . readFile ( fsFilePath ) ;
Original file line number Diff line number Diff line change 1
- import { isString , normalizeFsPath } from '@utils' ;
1
+ import { isDtsFile , isString , normalizeFsPath } from '@utils' ;
2
2
import { basename , isAbsolute } from 'path' ;
3
3
import type { LoadResult , Plugin , TransformResult } from 'rollup' ;
4
4
import ts from 'typescript' ;
@@ -90,7 +90,7 @@ export const resolveIdWithTypeScript = (config: d.ValidatedConfig, compilerCtx:
90
90
const tsResolvedPath = tsResolved . resolvedModule . resolvedFileName ;
91
91
if (
92
92
isString ( tsResolvedPath ) &&
93
- ! ( tsResolvedPath . endsWith ( '.d.ts' ) || tsResolvedPath . endsWith ( '.d.mts' ) || tsResolvedPath . endsWith ( '.d.cts' ) )
93
+ ! isDtsFile ( tsResolvedPath )
94
94
) {
95
95
return tsResolvedPath ;
96
96
}
0 commit comments