mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-18 13:59:04 -05:00
CR feedback / Change upper limit / Add disableSizeLimit compiler option
# Conflicts: # src/compiler/commandLineParser.ts # src/compiler/diagnosticMessages.json
This commit is contained in:
@@ -394,24 +394,38 @@ namespace ts {
|
||||
(oldOptions.target !== options.target) ||
|
||||
(oldOptions.noLib !== options.noLib) ||
|
||||
(oldOptions.jsx !== options.jsx) ||
|
||||
(oldOptions.allowJs !== options.allowJs)) {
|
||||
(oldOptions.allowJs !== options.allowJs) ||
|
||||
(oldOptions.disableSizeLimit !== options.disableSizeLimit)) {
|
||||
oldProgram = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tryReuseStructureFromOldProgram()) {
|
||||
let programSize = 0;
|
||||
for (const name of rootNames) {
|
||||
const path = toPath(name, currentDirectory, getCanonicalFileName);
|
||||
if (programSize <= maxProgramSize) {
|
||||
processRootFile(name, /*isDefaultLib*/ false);
|
||||
if (!hasTypeScriptFileExtension(name) && filesByName.get(path)) {
|
||||
programSize += filesByName.get(path).text.length;
|
||||
if (options.disableSizeLimit === true) {
|
||||
forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
|
||||
}
|
||||
else {
|
||||
let programSize = 0;
|
||||
for (const name of rootNames) {
|
||||
const path = toPath(name, currentDirectory, getCanonicalFileName);
|
||||
if (programSize <= maxProgramSize) {
|
||||
processRootFile(name, /*isDefaultLib*/ false);
|
||||
const file = filesByName.get(path);
|
||||
if (!hasTypeScriptFileExtension(name) && file && file.text) {
|
||||
programSize += file.text.length;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the program size limit was reached when processing a file, this file is
|
||||
// likely in the problematic folder than contains too many files
|
||||
const commonSourceDirectory = getCommonSourceDirectory();
|
||||
let rootLevelDirectory = path.substring(0, Math.max(commonSourceDirectory.length, path.indexOf(directorySeparator, commonSourceDirectory.length)));
|
||||
if (rootLevelDirectory[rootLevelDirectory.length - 1] !== directorySeparator) {
|
||||
rootLevelDirectory += directorySeparator;
|
||||
}
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Too_many_JavaScript_files_in_the_project_Use_an_exact_files_list_or_use_the_exclude_setting_in_project_configuration_to_limit_included_source_folders_The_likely_folder_to_exclude_is_0_To_disable_the_project_size_limit_set_the_disableSizeLimit_compiler_option_to_true, rootLevelDirectory));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Too_many_javascript_files_in_the_project_Consider_add_to_the_exclude_list_in_the_config_file));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user