@@ -7,6 +7,7 @@ namespace ts {
7
7
/* @internal */ export let emitTime = 0 ;
8
8
/* @internal */ export let ioReadTime = 0 ;
9
9
/* @internal */ export let ioWriteTime = 0 ;
10
+ /* @internal */ export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024 ;
10
11
11
12
/** The version of the TypeScript compiler release */
12
13
@@ -1038,10 +1039,8 @@ namespace ts {
1038
1039
diagnosticArgument = [ fileName , "'" + supportedExtensions . join ( "', '" ) + "'" ] ;
1039
1040
}
1040
1041
else if ( ! findSourceFile ( fileName , toPath ( fileName , currentDirectory , getCanonicalFileName ) , isDefaultLib , refFile , refPos , refEnd ) ) {
1041
- if ( hasTypeScriptFileExtension ( fileName ) || ! exceedProgramSizeLimit ( ) ) {
1042
- diagnostic = Diagnostics . File_0_not_found ;
1043
- diagnosticArgument = [ fileName ] ;
1044
- }
1042
+ diagnostic = Diagnostics . File_0_not_found ;
1043
+ diagnosticArgument = [ fileName ] ;
1045
1044
}
1046
1045
else if ( refFile && host . getCanonicalFileName ( fileName ) === host . getCanonicalFileName ( refFile . fileName ) ) {
1047
1046
diagnostic = Diagnostics . A_file_cannot_have_a_reference_to_itself ;
@@ -1052,22 +1051,18 @@ namespace ts {
1052
1051
const nonTsFile : SourceFile = options . allowNonTsExtensions && findSourceFile ( fileName , toPath ( fileName , currentDirectory , getCanonicalFileName ) , isDefaultLib , refFile , refPos , refEnd ) ;
1053
1052
if ( ! nonTsFile ) {
1054
1053
if ( options . allowNonTsExtensions ) {
1055
- if ( ! exceedProgramSizeLimit ( ) ) {
1056
- diagnostic = Diagnostics . File_0_not_found ;
1057
- diagnosticArgument = [ fileName ] ;
1058
- }
1054
+ diagnostic = Diagnostics . File_0_not_found ;
1055
+ diagnosticArgument = [ fileName ] ;
1059
1056
}
1060
1057
else if ( ! forEach ( supportedExtensions , extension => findSourceFile ( fileName + extension , toPath ( fileName + extension , currentDirectory , getCanonicalFileName ) , isDefaultLib , refFile , refPos , refEnd ) ) ) {
1061
- if ( ! exceedProgramSizeLimit ( ) ) {
1062
- diagnostic = Diagnostics . File_0_not_found ;
1063
- fileName += ".ts" ;
1064
- diagnosticArgument = [ fileName ] ;
1065
- }
1058
+ diagnostic = Diagnostics . File_0_not_found ;
1059
+ fileName += ".ts" ;
1060
+ diagnosticArgument = [ fileName ] ;
1066
1061
}
1067
1062
}
1068
1063
}
1069
1064
1070
- if ( diagnostic ) {
1065
+ if ( diagnostic && ! exceedProgramSizeLimit ( ) ) {
1071
1066
if ( refFile !== undefined && refEnd !== undefined && refPos !== undefined ) {
1072
1067
fileProcessingDiagnostics . add ( createFileDiagnostic ( refFile , refPos , refEnd - refPos , diagnostic , ...diagnosticArgument ) ) ;
1073
1068
}
0 commit comments