1
- import { isGitIgnoredSync } from 'globby' ;
2
1
import ts from 'typescript' ;
3
2
import { DEFAULT_EXTENSIONS } from './constants.js' ;
4
3
import { IGNORED_FILE_EXTENSIONS } from './constants.js' ;
@@ -10,14 +9,10 @@ import { SourceFileManager } from './typescript/SourceFileManager.js';
10
9
import { isMaybePackageName , sanitizeSpecifier } from './util/modules.js' ;
11
10
import { dirname , extname , isInNodeModules , join } from './util/path.js' ;
12
11
import { timerify } from './util/Performance.js' ;
12
+ import type { PrincipalOptions } from './PrincipalFactory.js' ;
13
13
import type { SyncCompilers , AsyncCompilers } from './types/compilers.js' ;
14
14
import type { ExportItem , ExportItemMember } from './types/exports.js' ;
15
-
16
- type ProjectPrincipalOptions = {
17
- compilerOptions : ts . CompilerOptions ;
18
- cwd : string ;
19
- compilers : [ SyncCompilers , AsyncCompilers ] ;
20
- } ;
15
+ import type { GlobbyFilterFunction } from 'globby' ;
21
16
22
17
// These compiler options override local options
23
18
const baseCompilerOptions = {
@@ -54,7 +49,7 @@ export class ProjectPrincipal {
54
49
// We don't want to report unused exports of config/plugin entry files
55
50
skipExportsAnalysis : Set < string > = new Set ( ) ;
56
51
57
- isGitIgnored : ReturnType < typeof isGitIgnoredSync > ;
52
+ isGitIgnored : GlobbyFilterFunction ;
58
53
cwd : string ;
59
54
compilerOptions : ts . CompilerOptions ;
60
55
extensions : Set < string > ;
@@ -69,11 +64,10 @@ export class ProjectPrincipal {
69
64
program ?: ts . Program ;
70
65
} ;
71
66
72
- constructor ( { compilerOptions, cwd, compilers } : ProjectPrincipalOptions ) {
67
+ constructor ( { compilerOptions, cwd, compilers, isGitIgnored } : PrincipalOptions ) {
73
68
this . cwd = cwd ;
74
69
75
- // Provide `cwd`, otherwise defaults to process.cwd() w/ incompatible slashes in Windows
76
- this . isGitIgnored = isGitIgnoredSync ( { cwd } ) ;
70
+ this . isGitIgnored = isGitIgnored ;
77
71
78
72
this . compilerOptions = {
79
73
...compilerOptions ,
0 commit comments