@@ -7,6 +7,7 @@ namespace ts {
77 /* @internal */ export let emitTime = 0 ;
88 /* @internal */ export let ioReadTime = 0 ;
99 /* @internal */ export let ioWriteTime = 0 ;
10+ /* @internal */ export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024 ;
1011
1112 /** The version of the TypeScript compiler release */
1213
@@ -1038,10 +1039,8 @@ namespace ts {
10381039 diagnosticArgument = [ fileName , "'" + supportedExtensions . join ( "', '" ) + "'" ] ;
10391040 }
10401041 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 ] ;
10451044 }
10461045 else if ( refFile && host . getCanonicalFileName ( fileName ) === host . getCanonicalFileName ( refFile . fileName ) ) {
10471046 diagnostic = Diagnostics . A_file_cannot_have_a_reference_to_itself ;
@@ -1052,22 +1051,18 @@ namespace ts {
10521051 const nonTsFile : SourceFile = options . allowNonTsExtensions && findSourceFile ( fileName , toPath ( fileName , currentDirectory , getCanonicalFileName ) , isDefaultLib , refFile , refPos , refEnd ) ;
10531052 if ( ! nonTsFile ) {
10541053 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 ] ;
10591056 }
10601057 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 ] ;
10661061 }
10671062 }
10681063 }
10691064
1070- if ( diagnostic ) {
1065+ if ( diagnostic && ! exceedProgramSizeLimit ( ) ) {
10711066 if ( refFile !== undefined && refEnd !== undefined && refPos !== undefined ) {
10721067 fileProcessingDiagnostics . add ( createFileDiagnostic ( refFile , refPos , refEnd - refPos , diagnostic , ...diagnosticArgument ) ) ;
10731068 }
0 commit comments