Skip to content

Commit 9ef7553

Browse files
committed
Update LKG
1 parent b23503c commit 9ef7553

File tree

6 files changed

+241
-50
lines changed

6 files changed

+241
-50
lines changed

lib/tsc.js

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,15 +1138,18 @@ var ts;
11381138
var current = files_2[_i];
11391139
var name_3 = ts.combinePaths(path, current);
11401140
if (!ts.contains(exclude, getCanonicalPath(name_3))) {
1141-
var stat = _fs.statSync(name_3);
1142-
if (stat.isFile()) {
1143-
if (!extension || ts.fileExtensionIs(name_3, extension)) {
1144-
result.push(name_3);
1141+
try {
1142+
var stat = _fs.statSync(name_3);
1143+
if (stat.isFile()) {
1144+
if (!extension || ts.fileExtensionIs(name_3, extension)) {
1145+
result.push(name_3);
1146+
}
1147+
}
1148+
else if (stat.isDirectory()) {
1149+
directories.push(name_3);
11451150
}
11461151
}
1147-
else if (stat.isDirectory()) {
1148-
directories.push(name_3);
1149-
}
1152+
catch (e) { }
11501153
}
11511154
}
11521155
for (var _a = 0, directories_1 = directories; _a < directories_1.length; _a++) {
@@ -1924,7 +1927,8 @@ var ts;
19241927
A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." },
19251928
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
19261929
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
1927-
Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." }
1930+
Unknown_typing_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_typing_option_0_17010", message: "Unknown typing option '{0}'." },
1931+
Too_many_JavaScript_files_in_the_project_Consider_specifying_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: { code: 17012, category: ts.DiagnosticCategory.Error, key: "Too_many_JavaScript_files_in_the_project_Consider_specifying_the_exclude_setting_in_project_configur_17012", message: "Too many JavaScript files in the project. Consider specifying 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'." }
19281932
};
19291933
})(ts || (ts = {}));
19301934
var ts;
@@ -5455,6 +5459,10 @@ var ts;
54555459
return ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); });
54565460
}
54575461
ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension;
5462+
function hasTypeScriptFileExtension(fileName) {
5463+
return ts.forEach(ts.supportedTypeScriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); });
5464+
}
5465+
ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension;
54585466
function getExpandedCharCodes(input) {
54595467
var output = [];
54605468
var length = input.length;
@@ -32518,6 +32526,7 @@ var ts;
3251832526
ts.emitTime = 0;
3251932527
ts.ioReadTime = 0;
3252032528
ts.ioWriteTime = 0;
32529+
ts.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
3252132530
var emptyArray = [];
3252232531
ts.version = "1.8.9";
3252332532
function findConfigFile(searchPath, fileExists) {
@@ -32795,6 +32804,8 @@ var ts;
3279532804
var diagnosticsProducingTypeChecker;
3279632805
var noDiagnosticsTypeChecker;
3279732806
var classifiableNames;
32807+
var programSizeLimitExceeded = -1;
32808+
var programSizeForNonTsFiles = 0;
3279832809
var skipDefaultLib = options.noLib;
3279932810
var supportedExtensions = ts.getSupportedExtensions(options);
3280032811
var start = new Date().getTime();
@@ -32829,7 +32840,8 @@ var ts;
3282932840
(oldOptions.target !== options.target) ||
3283032841
(oldOptions.noLib !== options.noLib) ||
3283132842
(oldOptions.jsx !== options.jsx) ||
32832-
(oldOptions.allowJs !== options.allowJs)) {
32843+
(oldOptions.allowJs !== options.allowJs) ||
32844+
(oldOptions.disableSizeLimit !== options.disableSizeLimit)) {
3283332845
oldProgram = undefined;
3283432846
}
3283532847
}
@@ -32865,6 +32877,9 @@ var ts;
3286532877
verifyCompilerOptions();
3286632878
ts.programTime += new Date().getTime() - start;
3286732879
return program;
32880+
function exceedProgramSizeLimit() {
32881+
return !options.disableSizeLimit && programSizeForNonTsFiles === programSizeLimitExceeded;
32882+
}
3286832883
function getCommonSourceDirectory() {
3286932884
if (typeof commonSourceDirectory === "undefined") {
3287032885
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
@@ -33338,7 +33353,7 @@ var ts;
3333833353
}
3333933354
}
3334033355
}
33341-
if (diagnostic) {
33356+
if (diagnostic && !exceedProgramSizeLimit()) {
3334233357
if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) {
3334333358
fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument)));
3334433359
}
@@ -33363,6 +33378,10 @@ var ts;
3336333378
}
3336433379
return file_1;
3336533380
}
33381+
var isNonTsFile = !ts.hasTypeScriptFileExtension(fileName);
33382+
if (isNonTsFile && exceedProgramSizeLimit()) {
33383+
return undefined;
33384+
}
3336633385
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
3336733386
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
3336833387
fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
@@ -33371,6 +33390,19 @@ var ts;
3337133390
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
3337233391
}
3337333392
});
33393+
if (isNonTsFile && !options.disableSizeLimit && file && file.text) {
33394+
programSizeForNonTsFiles += file.text.length;
33395+
if (programSizeForNonTsFiles > ts.maxProgramSizeForNonTsFiles) {
33396+
var commonSourceDirectory_1 = getCommonSourceDirectory();
33397+
var rootLevelDirectory = path.substring(0, Math.max(commonSourceDirectory_1.length, path.indexOf(ts.directorySeparator, commonSourceDirectory_1.length)));
33398+
if (rootLevelDirectory[rootLevelDirectory.length - 1] !== ts.directorySeparator) {
33399+
rootLevelDirectory += ts.directorySeparator;
33400+
}
33401+
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Too_many_JavaScript_files_in_the_project_Consider_specifying_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));
33402+
programSizeForNonTsFiles = programSizeLimitExceeded;
33403+
return undefined;
33404+
}
33405+
}
3337433406
filesByName.set(path, file);
3337533407
if (file) {
3337633408
file.path = path;
@@ -33916,6 +33948,10 @@ var ts;
3391633948
name: "noCustomAsyncPromise",
3391733949
type: "boolean",
3391833950
experimental: true
33951+
},
33952+
{
33953+
name: "disableSizeLimit",
33954+
type: "boolean"
3391933955
}
3392033956
];
3392133957
var optionNameMapCache;
@@ -34098,7 +34134,7 @@ var ts;
3409834134
exclude = json["exclude"];
3409934135
}
3410034136
else {
34101-
exclude = ["node_modules"];
34137+
exclude = ["node_modules", "bower_components"];
3410234138
var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"];
3410334139
if (outDir) {
3410434140
exclude.push(outDir);

0 commit comments

Comments
 (0)