mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Update LKG
This commit is contained in:
parent
7547f2f80e
commit
23184f55a6
31
lib/tsc.js
31
lib/tsc.js
@ -32804,6 +32804,7 @@ var ts;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
var classifiableNames;
|
||||
var programSizeLimitExceeded = -1;
|
||||
var programSizeForNonTsFiles = 0;
|
||||
var skipDefaultLib = options.noLib;
|
||||
var supportedExtensions = ts.getSupportedExtensions(options);
|
||||
@ -32876,6 +32877,9 @@ var ts;
|
||||
verifyCompilerOptions();
|
||||
ts.programTime += new Date().getTime() - start;
|
||||
return program;
|
||||
function exceedProgramSizeLimit() {
|
||||
return !options.disableSizeLimit && programSizeForNonTsFiles === programSizeLimitExceeded;
|
||||
}
|
||||
function getCommonSourceDirectory() {
|
||||
if (typeof commonSourceDirectory === "undefined") {
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
@ -33327,8 +33331,10 @@ var ts;
|
||||
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (ts.hasTypeScriptFileExtension(fileName) || !exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
@ -33339,13 +33345,17 @@ var ts;
|
||||
var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);
|
||||
if (!nonTsFile) {
|
||||
if (options.allowNonTsExtensions) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -33374,7 +33384,8 @@ var ts;
|
||||
}
|
||||
return file_1;
|
||||
}
|
||||
if (!options.disableSizeLimit && programSizeForNonTsFiles === -1) {
|
||||
var isNonTsFile = !ts.hasTypeScriptFileExtension(fileName);
|
||||
if (isNonTsFile && exceedProgramSizeLimit()) {
|
||||
return undefined;
|
||||
}
|
||||
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
|
||||
@ -33385,7 +33396,7 @@ var ts;
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
if (!options.disableSizeLimit && file && file.text && !ts.hasTypeScriptFileExtension(file.fileName)) {
|
||||
if (isNonTsFile && !options.disableSizeLimit && file && file.text) {
|
||||
programSizeForNonTsFiles += file.text.length;
|
||||
if (programSizeForNonTsFiles > ts.maxProgramSizeForNonTsFiles) {
|
||||
var commonSourceDirectory_1 = getCommonSourceDirectory();
|
||||
@ -33394,7 +33405,7 @@ var ts;
|
||||
rootLevelDirectory += ts.directorySeparator;
|
||||
}
|
||||
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));
|
||||
programSizeForNonTsFiles = -1;
|
||||
programSizeForNonTsFiles = programSizeLimitExceeded;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
233
lib/tsserver.js
233
lib/tsserver.js
@ -33429,6 +33429,7 @@ var ts;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
var classifiableNames;
|
||||
var programSizeLimitExceeded = -1;
|
||||
var programSizeForNonTsFiles = 0;
|
||||
var skipDefaultLib = options.noLib;
|
||||
var supportedExtensions = ts.getSupportedExtensions(options);
|
||||
@ -33501,6 +33502,9 @@ var ts;
|
||||
verifyCompilerOptions();
|
||||
ts.programTime += new Date().getTime() - start;
|
||||
return program;
|
||||
function exceedProgramSizeLimit() {
|
||||
return !options.disableSizeLimit && programSizeForNonTsFiles === programSizeLimitExceeded;
|
||||
}
|
||||
function getCommonSourceDirectory() {
|
||||
if (typeof commonSourceDirectory === "undefined") {
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
@ -33952,8 +33956,10 @@ var ts;
|
||||
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (ts.hasTypeScriptFileExtension(fileName) || !exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
@ -33964,13 +33970,17 @@ var ts;
|
||||
var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);
|
||||
if (!nonTsFile) {
|
||||
if (options.allowNonTsExtensions) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -33999,7 +34009,8 @@ var ts;
|
||||
}
|
||||
return file_1;
|
||||
}
|
||||
if (!options.disableSizeLimit && programSizeForNonTsFiles === -1) {
|
||||
var isNonTsFile = !ts.hasTypeScriptFileExtension(fileName);
|
||||
if (isNonTsFile && exceedProgramSizeLimit()) {
|
||||
return undefined;
|
||||
}
|
||||
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
|
||||
@ -34010,7 +34021,7 @@ var ts;
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
if (!options.disableSizeLimit && file && file.text && !ts.hasTypeScriptFileExtension(file.fileName)) {
|
||||
if (isNonTsFile && !options.disableSizeLimit && file && file.text) {
|
||||
programSizeForNonTsFiles += file.text.length;
|
||||
if (programSizeForNonTsFiles > ts.maxProgramSizeForNonTsFiles) {
|
||||
var commonSourceDirectory_1 = getCommonSourceDirectory();
|
||||
@ -34019,7 +34030,7 @@ var ts;
|
||||
rootLevelDirectory += ts.directorySeparator;
|
||||
}
|
||||
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));
|
||||
programSizeForNonTsFiles = -1;
|
||||
programSizeForNonTsFiles = programSizeLimitExceeded;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@ -35056,6 +35067,9 @@ var ts;
|
||||
var NavigationBar;
|
||||
(function (NavigationBar) {
|
||||
function getNavigationBarItems(sourceFile, compilerOptions) {
|
||||
if (ts.isSourceFileJavaScript(sourceFile)) {
|
||||
return getJsNavigationBarItems(sourceFile, compilerOptions);
|
||||
}
|
||||
var hasGlobalNode = false;
|
||||
return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem);
|
||||
function getIndent(node) {
|
||||
@ -35418,6 +35432,171 @@ var ts;
|
||||
}
|
||||
}
|
||||
NavigationBar.getNavigationBarItems = getNavigationBarItems;
|
||||
function getJsNavigationBarItems(sourceFile, compilerOptions) {
|
||||
var anonFnText = "<function>";
|
||||
var anonClassText = "<class>";
|
||||
var indent = 0;
|
||||
var rootName = ts.isExternalModule(sourceFile) ?
|
||||
"\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
|
||||
: "<global>";
|
||||
var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]);
|
||||
var topItem = sourceFileItem;
|
||||
ts.forEachChild(sourceFile, visitNode);
|
||||
function visitNode(node) {
|
||||
var newItem = createNavBarItem(node);
|
||||
if (newItem) {
|
||||
topItem.childItems.push(newItem);
|
||||
}
|
||||
if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) {
|
||||
var lastTop = topItem;
|
||||
indent++;
|
||||
topItem = newItem;
|
||||
ts.forEachChild(node, visitNode);
|
||||
topItem = lastTop;
|
||||
indent--;
|
||||
if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) {
|
||||
topItem.childItems.pop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(node, visitNode);
|
||||
}
|
||||
}
|
||||
function createNavBarItem(node) {
|
||||
switch (node.kind) {
|
||||
case 214:
|
||||
if (node.parent.parent
|
||||
.parent.kind !== 251) {
|
||||
return undefined;
|
||||
}
|
||||
var varDecl = node;
|
||||
if (varDecl.initializer && (varDecl.initializer.kind === 176 ||
|
||||
varDecl.initializer.kind === 177 ||
|
||||
varDecl.initializer.kind === 189)) {
|
||||
return undefined;
|
||||
}
|
||||
case 216:
|
||||
case 217:
|
||||
case 145:
|
||||
case 146:
|
||||
case 147:
|
||||
var name_34 = node.flags && (node.flags & 512) && !node.name ? "default" :
|
||||
node.kind === 145 ? "constructor" :
|
||||
ts.declarationNameToString(node.name);
|
||||
return getNavBarItem(name_34, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]);
|
||||
case 176:
|
||||
case 177:
|
||||
case 189:
|
||||
return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node);
|
||||
case 144:
|
||||
var methodDecl = node;
|
||||
return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]);
|
||||
case 230:
|
||||
return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]);
|
||||
case 226:
|
||||
if (!node.name) {
|
||||
return undefined;
|
||||
}
|
||||
case 229:
|
||||
case 227:
|
||||
case 233:
|
||||
if (node.kind === 233) {
|
||||
if (!node.parent.parent.moduleSpecifier && !node.propertyName) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var decl = node;
|
||||
if (!decl.name) {
|
||||
return undefined;
|
||||
}
|
||||
var declName = ts.declarationNameToString(decl.name);
|
||||
return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]);
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function getNavBarItem(text, kind, spans, kindModifiers) {
|
||||
if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; }
|
||||
return {
|
||||
text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false
|
||||
};
|
||||
}
|
||||
function getDefineModuleItem(node) {
|
||||
if (node.kind !== 176 && node.kind !== 177) {
|
||||
return undefined;
|
||||
}
|
||||
if (node.parent.kind !== 171) {
|
||||
return undefined;
|
||||
}
|
||||
var callExpr = node.parent;
|
||||
if (callExpr.expression.kind !== 69 || callExpr.expression.getText() !== 'define') {
|
||||
return undefined;
|
||||
}
|
||||
var defaultName = node.getSourceFile().fileName;
|
||||
if (callExpr.arguments[0].kind === 9) {
|
||||
defaultName = (callExpr.arguments[0]).text;
|
||||
}
|
||||
return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]);
|
||||
}
|
||||
function getFunctionOrClassExpressionItem(node) {
|
||||
if (node.kind !== 176 &&
|
||||
node.kind !== 177 &&
|
||||
node.kind !== 189) {
|
||||
return undefined;
|
||||
}
|
||||
var fnExpr = node;
|
||||
var fnName;
|
||||
if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) {
|
||||
fnName = ts.declarationNameToString(fnExpr.name);
|
||||
}
|
||||
else {
|
||||
if (fnExpr.parent.kind === 214) {
|
||||
fnName = ts.declarationNameToString(fnExpr.parent.name);
|
||||
}
|
||||
else if (fnExpr.parent.kind === 184 &&
|
||||
fnExpr.parent.operatorToken.kind === 56) {
|
||||
fnName = fnExpr.parent.left.getText();
|
||||
if (fnName.length > 20) {
|
||||
fnName = fnName.substring(0, 17) + "...";
|
||||
}
|
||||
}
|
||||
else if (fnExpr.parent.kind === 248 &&
|
||||
fnExpr.parent.name) {
|
||||
fnName = fnExpr.parent.name.getText();
|
||||
}
|
||||
else {
|
||||
fnName = node.kind === 189 ? anonClassText : anonFnText;
|
||||
}
|
||||
}
|
||||
var scriptKind = node.kind === 189 ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement;
|
||||
return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]);
|
||||
}
|
||||
function getNodeSpan(node) {
|
||||
return node.kind === 251
|
||||
? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())
|
||||
: ts.createTextSpanFromBounds(node.getStart(), node.getEnd());
|
||||
}
|
||||
function getScriptKindForElementKind(kind) {
|
||||
switch (kind) {
|
||||
case 214:
|
||||
return ts.ScriptElementKind.variableElement;
|
||||
case 216:
|
||||
return ts.ScriptElementKind.functionElement;
|
||||
case 217:
|
||||
return ts.ScriptElementKind.classElement;
|
||||
case 145:
|
||||
return ts.ScriptElementKind.constructorImplementationElement;
|
||||
case 146:
|
||||
return ts.ScriptElementKind.memberGetAccessorElement;
|
||||
case 147:
|
||||
return ts.ScriptElementKind.memberSetAccessorElement;
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
return sourceFileItem.childItems;
|
||||
}
|
||||
NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems;
|
||||
})(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
@ -36893,9 +37072,9 @@ var ts;
|
||||
getTypingNamesFromNodeModuleFolder(nodeModulesPath);
|
||||
}
|
||||
getTypingNamesFromSourceFileNames(fileNames);
|
||||
for (var name_34 in packageNameToTypingLocation) {
|
||||
if (ts.hasProperty(inferredTypings, name_34) && !inferredTypings[name_34]) {
|
||||
inferredTypings[name_34] = packageNameToTypingLocation[name_34];
|
||||
for (var name_35 in packageNameToTypingLocation) {
|
||||
if (ts.hasProperty(inferredTypings, name_35) && !inferredTypings[name_35]) {
|
||||
inferredTypings[name_35] = packageNameToTypingLocation[name_35];
|
||||
}
|
||||
}
|
||||
for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) {
|
||||
@ -37557,9 +37736,9 @@ var ts;
|
||||
}
|
||||
Rules.prototype.getRuleName = function (rule) {
|
||||
var o = this;
|
||||
for (var name_35 in o) {
|
||||
if (o[name_35] === rule) {
|
||||
return name_35;
|
||||
for (var name_36 in o) {
|
||||
if (o[name_36] === rule) {
|
||||
return name_36;
|
||||
}
|
||||
}
|
||||
throw new Error("Unknown rule");
|
||||
@ -41521,8 +41700,8 @@ var ts;
|
||||
if (element.getStart() <= position && position <= element.getEnd()) {
|
||||
continue;
|
||||
}
|
||||
var name_36 = element.propertyName || element.name;
|
||||
exisingImportsOrExports[name_36.text] = true;
|
||||
var name_37 = element.propertyName || element.name;
|
||||
exisingImportsOrExports[name_37.text] = true;
|
||||
}
|
||||
if (ts.isEmpty(exisingImportsOrExports)) {
|
||||
return exportsOfModule;
|
||||
@ -41614,13 +41793,13 @@ var ts;
|
||||
var entries = [];
|
||||
var target = program.getCompilerOptions().target;
|
||||
var nameTable = getNameTable(sourceFile);
|
||||
for (var name_37 in nameTable) {
|
||||
if (nameTable[name_37] === position) {
|
||||
for (var name_38 in nameTable) {
|
||||
if (nameTable[name_38] === position) {
|
||||
continue;
|
||||
}
|
||||
if (!uniqueNames[name_37]) {
|
||||
uniqueNames[name_37] = name_37;
|
||||
var displayName = getCompletionEntryDisplayName(name_37, target, true);
|
||||
if (!uniqueNames[name_38]) {
|
||||
uniqueNames[name_38] = name_38;
|
||||
var displayName = getCompletionEntryDisplayName(name_38, target, true);
|
||||
if (displayName) {
|
||||
var entry = {
|
||||
name: displayName,
|
||||
@ -43332,17 +43511,17 @@ var ts;
|
||||
if (isNameOfPropertyAssignment(node)) {
|
||||
var objectLiteral = node.parent.parent;
|
||||
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||
var name_38 = node.text;
|
||||
var name_39 = node.text;
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & 16384) {
|
||||
var unionProperty = contextualType.getProperty(name_38);
|
||||
var unionProperty = contextualType.getProperty(name_39);
|
||||
if (unionProperty) {
|
||||
return [unionProperty];
|
||||
}
|
||||
else {
|
||||
var result_6 = [];
|
||||
ts.forEach(contextualType.types, function (t) {
|
||||
var symbol = t.getProperty(name_38);
|
||||
var symbol = t.getProperty(name_39);
|
||||
if (symbol) {
|
||||
result_6.push(symbol);
|
||||
}
|
||||
@ -43351,7 +43530,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var symbol_1 = contextualType.getProperty(name_38);
|
||||
var symbol_1 = contextualType.getProperty(name_39);
|
||||
if (symbol_1) {
|
||||
return [symbol_1];
|
||||
}
|
||||
|
||||
@ -39635,6 +39635,7 @@ var ts;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
var classifiableNames;
|
||||
var programSizeLimitExceeded = -1;
|
||||
var programSizeForNonTsFiles = 0;
|
||||
var skipDefaultLib = options.noLib;
|
||||
var supportedExtensions = ts.getSupportedExtensions(options);
|
||||
@ -39719,6 +39720,9 @@ var ts;
|
||||
verifyCompilerOptions();
|
||||
ts.programTime += new Date().getTime() - start;
|
||||
return program;
|
||||
function exceedProgramSizeLimit() {
|
||||
return !options.disableSizeLimit && programSizeForNonTsFiles === programSizeLimitExceeded;
|
||||
}
|
||||
function getCommonSourceDirectory() {
|
||||
if (typeof commonSourceDirectory === "undefined") {
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
@ -40228,8 +40232,10 @@ var ts;
|
||||
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (ts.hasTypeScriptFileExtension(fileName) || !exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
@ -40240,13 +40246,17 @@ var ts;
|
||||
var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);
|
||||
if (!nonTsFile) {
|
||||
if (options.allowNonTsExtensions) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40278,7 +40288,8 @@ var ts;
|
||||
}
|
||||
return file_1;
|
||||
}
|
||||
if (!options.disableSizeLimit && programSizeForNonTsFiles === -1) {
|
||||
var isNonTsFile = !ts.hasTypeScriptFileExtension(fileName);
|
||||
if (isNonTsFile && exceedProgramSizeLimit()) {
|
||||
return undefined;
|
||||
}
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
@ -40290,7 +40301,7 @@ var ts;
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
if (!options.disableSizeLimit && file && file.text && !ts.hasTypeScriptFileExtension(file.fileName)) {
|
||||
if (isNonTsFile && !options.disableSizeLimit && file && file.text) {
|
||||
programSizeForNonTsFiles += file.text.length;
|
||||
if (programSizeForNonTsFiles > ts.maxProgramSizeForNonTsFiles) {
|
||||
// If the program size limit was reached when processing a file, this file is
|
||||
@ -40304,7 +40315,7 @@ var ts;
|
||||
rootLevelDirectory += ts.directorySeparator;
|
||||
}
|
||||
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));
|
||||
programSizeForNonTsFiles = -1;
|
||||
programSizeForNonTsFiles = programSizeLimitExceeded;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@ -41578,6 +41589,11 @@ var ts;
|
||||
var NavigationBar;
|
||||
(function (NavigationBar) {
|
||||
function getNavigationBarItems(sourceFile, compilerOptions) {
|
||||
// TODO: Handle JS files differently in 'navbar' calls for now, but ideally we should unify
|
||||
// the 'navbar' and 'navto' logic for TypeScript and JavaScript.
|
||||
if (ts.isSourceFileJavaScript(sourceFile)) {
|
||||
return getJsNavigationBarItems(sourceFile, compilerOptions);
|
||||
}
|
||||
// If the source file has any child items, then it included in the tree
|
||||
// and takes lexical ownership of all other top-level items.
|
||||
var hasGlobalNode = false;
|
||||
@ -41729,8 +41745,8 @@ var ts;
|
||||
}
|
||||
function isTopLevelFunctionDeclaration(functionDeclaration) {
|
||||
if (functionDeclaration.kind === 216 /* FunctionDeclaration */) {
|
||||
// A function declaration is 'top level' if it contains any function declarations
|
||||
// within it.
|
||||
// A function declaration is 'top level' if it contains any function declarations
|
||||
// within it.
|
||||
if (functionDeclaration.body && functionDeclaration.body.kind === 195 /* Block */) {
|
||||
// Proper function declarations can only have identifier names
|
||||
if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 216 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) {
|
||||
@ -41988,6 +42004,188 @@ var ts;
|
||||
}
|
||||
}
|
||||
NavigationBar.getNavigationBarItems = getNavigationBarItems;
|
||||
function getJsNavigationBarItems(sourceFile, compilerOptions) {
|
||||
var anonFnText = "<function>";
|
||||
var anonClassText = "<class>";
|
||||
var indent = 0;
|
||||
var rootName = ts.isExternalModule(sourceFile) ?
|
||||
"\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
|
||||
: "<global>";
|
||||
var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]);
|
||||
var topItem = sourceFileItem;
|
||||
// Walk the whole file, because we want to also find function expressions - which may be in variable initializer,
|
||||
// call arguments, expressions, etc...
|
||||
ts.forEachChild(sourceFile, visitNode);
|
||||
function visitNode(node) {
|
||||
var newItem = createNavBarItem(node);
|
||||
if (newItem) {
|
||||
topItem.childItems.push(newItem);
|
||||
}
|
||||
// Add a level if traversing into a container
|
||||
if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) {
|
||||
var lastTop = topItem;
|
||||
indent++;
|
||||
topItem = newItem;
|
||||
ts.forEachChild(node, visitNode);
|
||||
topItem = lastTop;
|
||||
indent--;
|
||||
// If the last item added was an anonymous function expression, and it had no children, discard it.
|
||||
if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) {
|
||||
topItem.childItems.pop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(node, visitNode);
|
||||
}
|
||||
}
|
||||
function createNavBarItem(node) {
|
||||
switch (node.kind) {
|
||||
case 214 /* VariableDeclaration */:
|
||||
// Only add to the navbar if at the top-level of the file
|
||||
// Note: "const" and "let" are also SyntaxKind.VariableDeclarations
|
||||
if (node.parent /*VariableDeclarationList*/.parent /*VariableStatement*/
|
||||
.parent /*SourceFile*/.kind !== 251 /* SourceFile */) {
|
||||
return undefined;
|
||||
}
|
||||
// If it is initialized with a function expression, handle it when we reach the function expression node
|
||||
var varDecl = node;
|
||||
if (varDecl.initializer && (varDecl.initializer.kind === 176 /* FunctionExpression */ ||
|
||||
varDecl.initializer.kind === 177 /* ArrowFunction */ ||
|
||||
varDecl.initializer.kind === 189 /* ClassExpression */)) {
|
||||
return undefined;
|
||||
}
|
||||
// Fall through
|
||||
case 216 /* FunctionDeclaration */:
|
||||
case 217 /* ClassDeclaration */:
|
||||
case 145 /* Constructor */:
|
||||
case 146 /* GetAccessor */:
|
||||
case 147 /* SetAccessor */:
|
||||
// "export default function().." looks just like a regular function/class declaration, except with the 'default' flag
|
||||
var name_34 = node.flags && (node.flags & 512 /* Default */) && !node.name ? "default" :
|
||||
node.kind === 145 /* Constructor */ ? "constructor" :
|
||||
ts.declarationNameToString(node.name);
|
||||
return getNavBarItem(name_34, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]);
|
||||
case 176 /* FunctionExpression */:
|
||||
case 177 /* ArrowFunction */:
|
||||
case 189 /* ClassExpression */:
|
||||
return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node);
|
||||
case 144 /* MethodDeclaration */:
|
||||
var methodDecl = node;
|
||||
return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]);
|
||||
case 230 /* ExportAssignment */:
|
||||
// e.g. "export default <expr>"
|
||||
return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]);
|
||||
case 226 /* ImportClause */:
|
||||
if (!node.name) {
|
||||
// No default import (this node is still a parent of named & namespace imports, which are handled below)
|
||||
return undefined;
|
||||
}
|
||||
// fall through
|
||||
case 229 /* ImportSpecifier */: // e.g. 'id' in: import {id} from 'mod' (in NamedImports, in ImportClause)
|
||||
case 227 /* NamespaceImport */: // e.g. '* as ns' in: import * as ns from 'mod' (in ImportClause)
|
||||
case 233 /* ExportSpecifier */:
|
||||
// Export specifiers are only interesting if they are reexports from another module, or renamed, else they are already globals
|
||||
if (node.kind === 233 /* ExportSpecifier */) {
|
||||
if (!node.parent.parent.moduleSpecifier && !node.propertyName) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var decl = node;
|
||||
if (!decl.name) {
|
||||
return undefined;
|
||||
}
|
||||
var declName = ts.declarationNameToString(decl.name);
|
||||
return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]);
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function getNavBarItem(text, kind, spans, kindModifiers) {
|
||||
if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; }
|
||||
return {
|
||||
text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false
|
||||
};
|
||||
}
|
||||
function getDefineModuleItem(node) {
|
||||
if (node.kind !== 176 /* FunctionExpression */ && node.kind !== 177 /* ArrowFunction */) {
|
||||
return undefined;
|
||||
}
|
||||
// No match if this is not a call expression to an identifier named 'define'
|
||||
if (node.parent.kind !== 171 /* CallExpression */) {
|
||||
return undefined;
|
||||
}
|
||||
var callExpr = node.parent;
|
||||
if (callExpr.expression.kind !== 69 /* Identifier */ || callExpr.expression.getText() !== 'define') {
|
||||
return undefined;
|
||||
}
|
||||
// Return a module of either the given text in the first argument, or of the source file path
|
||||
var defaultName = node.getSourceFile().fileName;
|
||||
if (callExpr.arguments[0].kind === 9 /* StringLiteral */) {
|
||||
defaultName = (callExpr.arguments[0]).text;
|
||||
}
|
||||
return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]);
|
||||
}
|
||||
function getFunctionOrClassExpressionItem(node) {
|
||||
if (node.kind !== 176 /* FunctionExpression */ &&
|
||||
node.kind !== 177 /* ArrowFunction */ &&
|
||||
node.kind !== 189 /* ClassExpression */) {
|
||||
return undefined;
|
||||
}
|
||||
var fnExpr = node;
|
||||
var fnName;
|
||||
if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) {
|
||||
// The expression has an identifier, so use that as the name
|
||||
fnName = ts.declarationNameToString(fnExpr.name);
|
||||
}
|
||||
else {
|
||||
// See if it is a var initializer. If so, use the var name.
|
||||
if (fnExpr.parent.kind === 214 /* VariableDeclaration */) {
|
||||
fnName = ts.declarationNameToString(fnExpr.parent.name);
|
||||
}
|
||||
else if (fnExpr.parent.kind === 184 /* BinaryExpression */ &&
|
||||
fnExpr.parent.operatorToken.kind === 56 /* EqualsToken */) {
|
||||
fnName = fnExpr.parent.left.getText();
|
||||
if (fnName.length > 20) {
|
||||
fnName = fnName.substring(0, 17) + "...";
|
||||
}
|
||||
}
|
||||
else if (fnExpr.parent.kind === 248 /* PropertyAssignment */ &&
|
||||
fnExpr.parent.name) {
|
||||
fnName = fnExpr.parent.name.getText();
|
||||
}
|
||||
else {
|
||||
fnName = node.kind === 189 /* ClassExpression */ ? anonClassText : anonFnText;
|
||||
}
|
||||
}
|
||||
var scriptKind = node.kind === 189 /* ClassExpression */ ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement;
|
||||
return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]);
|
||||
}
|
||||
function getNodeSpan(node) {
|
||||
return node.kind === 251 /* SourceFile */
|
||||
? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())
|
||||
: ts.createTextSpanFromBounds(node.getStart(), node.getEnd());
|
||||
}
|
||||
function getScriptKindForElementKind(kind) {
|
||||
switch (kind) {
|
||||
case 214 /* VariableDeclaration */:
|
||||
return ts.ScriptElementKind.variableElement;
|
||||
case 216 /* FunctionDeclaration */:
|
||||
return ts.ScriptElementKind.functionElement;
|
||||
case 217 /* ClassDeclaration */:
|
||||
return ts.ScriptElementKind.classElement;
|
||||
case 145 /* Constructor */:
|
||||
return ts.ScriptElementKind.constructorImplementationElement;
|
||||
case 146 /* GetAccessor */:
|
||||
return ts.ScriptElementKind.memberGetAccessorElement;
|
||||
case 147 /* SetAccessor */:
|
||||
return ts.ScriptElementKind.memberSetAccessorElement;
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
return sourceFileItem.childItems;
|
||||
}
|
||||
NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems;
|
||||
})(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
@ -43985,9 +44183,9 @@ var ts;
|
||||
}
|
||||
getTypingNamesFromSourceFileNames(fileNames);
|
||||
// Add the cached typing locations for inferred typings that are already installed
|
||||
for (var name_34 in packageNameToTypingLocation) {
|
||||
if (ts.hasProperty(inferredTypings, name_34) && !inferredTypings[name_34]) {
|
||||
inferredTypings[name_34] = packageNameToTypingLocation[name_34];
|
||||
for (var name_35 in packageNameToTypingLocation) {
|
||||
if (ts.hasProperty(inferredTypings, name_35) && !inferredTypings[name_35]) {
|
||||
inferredTypings[name_35] = packageNameToTypingLocation[name_35];
|
||||
}
|
||||
}
|
||||
// Remove typings that the user has added to the exclude list
|
||||
@ -44820,9 +45018,9 @@ var ts;
|
||||
}
|
||||
Rules.prototype.getRuleName = function (rule) {
|
||||
var o = this;
|
||||
for (var name_35 in o) {
|
||||
if (o[name_35] === rule) {
|
||||
return name_35;
|
||||
for (var name_36 in o) {
|
||||
if (o[name_36] === rule) {
|
||||
return name_36;
|
||||
}
|
||||
}
|
||||
throw new Error("Unknown rule");
|
||||
@ -49537,8 +49735,8 @@ var ts;
|
||||
if (element.getStart() <= position && position <= element.getEnd()) {
|
||||
continue;
|
||||
}
|
||||
var name_36 = element.propertyName || element.name;
|
||||
exisingImportsOrExports[name_36.text] = true;
|
||||
var name_37 = element.propertyName || element.name;
|
||||
exisingImportsOrExports[name_37.text] = true;
|
||||
}
|
||||
if (ts.isEmpty(exisingImportsOrExports)) {
|
||||
return exportsOfModule;
|
||||
@ -49655,14 +49853,14 @@ var ts;
|
||||
var entries = [];
|
||||
var target = program.getCompilerOptions().target;
|
||||
var nameTable = getNameTable(sourceFile);
|
||||
for (var name_37 in nameTable) {
|
||||
for (var name_38 in nameTable) {
|
||||
// Skip identifiers produced only from the current location
|
||||
if (nameTable[name_37] === position) {
|
||||
if (nameTable[name_38] === position) {
|
||||
continue;
|
||||
}
|
||||
if (!uniqueNames[name_37]) {
|
||||
uniqueNames[name_37] = name_37;
|
||||
var displayName = getCompletionEntryDisplayName(name_37, target, /*performCharacterChecks*/ true);
|
||||
if (!uniqueNames[name_38]) {
|
||||
uniqueNames[name_38] = name_38;
|
||||
var displayName = getCompletionEntryDisplayName(name_38, target, /*performCharacterChecks*/ true);
|
||||
if (displayName) {
|
||||
var entry = {
|
||||
name: displayName,
|
||||
@ -51614,19 +51812,19 @@ var ts;
|
||||
if (isNameOfPropertyAssignment(node)) {
|
||||
var objectLiteral = node.parent.parent;
|
||||
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||
var name_38 = node.text;
|
||||
var name_39 = node.text;
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & 16384 /* Union */) {
|
||||
// This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types)
|
||||
// if not, search the constituent types for the property
|
||||
var unionProperty = contextualType.getProperty(name_38);
|
||||
var unionProperty = contextualType.getProperty(name_39);
|
||||
if (unionProperty) {
|
||||
return [unionProperty];
|
||||
}
|
||||
else {
|
||||
var result_6 = [];
|
||||
ts.forEach(contextualType.types, function (t) {
|
||||
var symbol = t.getProperty(name_38);
|
||||
var symbol = t.getProperty(name_39);
|
||||
if (symbol) {
|
||||
result_6.push(symbol);
|
||||
}
|
||||
@ -51635,7 +51833,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var symbol_1 = contextualType.getProperty(name_38);
|
||||
var symbol_1 = contextualType.getProperty(name_39);
|
||||
if (symbol_1) {
|
||||
return [symbol_1];
|
||||
}
|
||||
|
||||
@ -39635,6 +39635,7 @@ var ts;
|
||||
var diagnosticsProducingTypeChecker;
|
||||
var noDiagnosticsTypeChecker;
|
||||
var classifiableNames;
|
||||
var programSizeLimitExceeded = -1;
|
||||
var programSizeForNonTsFiles = 0;
|
||||
var skipDefaultLib = options.noLib;
|
||||
var supportedExtensions = ts.getSupportedExtensions(options);
|
||||
@ -39719,6 +39720,9 @@ var ts;
|
||||
verifyCompilerOptions();
|
||||
ts.programTime += new Date().getTime() - start;
|
||||
return program;
|
||||
function exceedProgramSizeLimit() {
|
||||
return !options.disableSizeLimit && programSizeForNonTsFiles === programSizeLimitExceeded;
|
||||
}
|
||||
function getCommonSourceDirectory() {
|
||||
if (typeof commonSourceDirectory === "undefined") {
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
@ -40228,8 +40232,10 @@ var ts;
|
||||
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (ts.hasTypeScriptFileExtension(fileName) || !exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
@ -40240,13 +40246,17 @@ var ts;
|
||||
var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd);
|
||||
if (!nonTsFile) {
|
||||
if (options.allowNonTsExtensions) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
if (!exceedProgramSizeLimit()) {
|
||||
diagnostic = ts.Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40278,7 +40288,8 @@ var ts;
|
||||
}
|
||||
return file_1;
|
||||
}
|
||||
if (!options.disableSizeLimit && programSizeForNonTsFiles === -1) {
|
||||
var isNonTsFile = !ts.hasTypeScriptFileExtension(fileName);
|
||||
if (isNonTsFile && exceedProgramSizeLimit()) {
|
||||
return undefined;
|
||||
}
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
@ -40290,7 +40301,7 @@ var ts;
|
||||
fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
if (!options.disableSizeLimit && file && file.text && !ts.hasTypeScriptFileExtension(file.fileName)) {
|
||||
if (isNonTsFile && !options.disableSizeLimit && file && file.text) {
|
||||
programSizeForNonTsFiles += file.text.length;
|
||||
if (programSizeForNonTsFiles > ts.maxProgramSizeForNonTsFiles) {
|
||||
// If the program size limit was reached when processing a file, this file is
|
||||
@ -40304,7 +40315,7 @@ var ts;
|
||||
rootLevelDirectory += ts.directorySeparator;
|
||||
}
|
||||
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));
|
||||
programSizeForNonTsFiles = -1;
|
||||
programSizeForNonTsFiles = programSizeLimitExceeded;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@ -41578,6 +41589,11 @@ var ts;
|
||||
var NavigationBar;
|
||||
(function (NavigationBar) {
|
||||
function getNavigationBarItems(sourceFile, compilerOptions) {
|
||||
// TODO: Handle JS files differently in 'navbar' calls for now, but ideally we should unify
|
||||
// the 'navbar' and 'navto' logic for TypeScript and JavaScript.
|
||||
if (ts.isSourceFileJavaScript(sourceFile)) {
|
||||
return getJsNavigationBarItems(sourceFile, compilerOptions);
|
||||
}
|
||||
// If the source file has any child items, then it included in the tree
|
||||
// and takes lexical ownership of all other top-level items.
|
||||
var hasGlobalNode = false;
|
||||
@ -41729,8 +41745,8 @@ var ts;
|
||||
}
|
||||
function isTopLevelFunctionDeclaration(functionDeclaration) {
|
||||
if (functionDeclaration.kind === 216 /* FunctionDeclaration */) {
|
||||
// A function declaration is 'top level' if it contains any function declarations
|
||||
// within it.
|
||||
// A function declaration is 'top level' if it contains any function declarations
|
||||
// within it.
|
||||
if (functionDeclaration.body && functionDeclaration.body.kind === 195 /* Block */) {
|
||||
// Proper function declarations can only have identifier names
|
||||
if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 216 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) {
|
||||
@ -41988,6 +42004,188 @@ var ts;
|
||||
}
|
||||
}
|
||||
NavigationBar.getNavigationBarItems = getNavigationBarItems;
|
||||
function getJsNavigationBarItems(sourceFile, compilerOptions) {
|
||||
var anonFnText = "<function>";
|
||||
var anonClassText = "<class>";
|
||||
var indent = 0;
|
||||
var rootName = ts.isExternalModule(sourceFile) ?
|
||||
"\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
|
||||
: "<global>";
|
||||
var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]);
|
||||
var topItem = sourceFileItem;
|
||||
// Walk the whole file, because we want to also find function expressions - which may be in variable initializer,
|
||||
// call arguments, expressions, etc...
|
||||
ts.forEachChild(sourceFile, visitNode);
|
||||
function visitNode(node) {
|
||||
var newItem = createNavBarItem(node);
|
||||
if (newItem) {
|
||||
topItem.childItems.push(newItem);
|
||||
}
|
||||
// Add a level if traversing into a container
|
||||
if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) {
|
||||
var lastTop = topItem;
|
||||
indent++;
|
||||
topItem = newItem;
|
||||
ts.forEachChild(node, visitNode);
|
||||
topItem = lastTop;
|
||||
indent--;
|
||||
// If the last item added was an anonymous function expression, and it had no children, discard it.
|
||||
if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) {
|
||||
topItem.childItems.pop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(node, visitNode);
|
||||
}
|
||||
}
|
||||
function createNavBarItem(node) {
|
||||
switch (node.kind) {
|
||||
case 214 /* VariableDeclaration */:
|
||||
// Only add to the navbar if at the top-level of the file
|
||||
// Note: "const" and "let" are also SyntaxKind.VariableDeclarations
|
||||
if (node.parent /*VariableDeclarationList*/.parent /*VariableStatement*/
|
||||
.parent /*SourceFile*/.kind !== 251 /* SourceFile */) {
|
||||
return undefined;
|
||||
}
|
||||
// If it is initialized with a function expression, handle it when we reach the function expression node
|
||||
var varDecl = node;
|
||||
if (varDecl.initializer && (varDecl.initializer.kind === 176 /* FunctionExpression */ ||
|
||||
varDecl.initializer.kind === 177 /* ArrowFunction */ ||
|
||||
varDecl.initializer.kind === 189 /* ClassExpression */)) {
|
||||
return undefined;
|
||||
}
|
||||
// Fall through
|
||||
case 216 /* FunctionDeclaration */:
|
||||
case 217 /* ClassDeclaration */:
|
||||
case 145 /* Constructor */:
|
||||
case 146 /* GetAccessor */:
|
||||
case 147 /* SetAccessor */:
|
||||
// "export default function().." looks just like a regular function/class declaration, except with the 'default' flag
|
||||
var name_34 = node.flags && (node.flags & 512 /* Default */) && !node.name ? "default" :
|
||||
node.kind === 145 /* Constructor */ ? "constructor" :
|
||||
ts.declarationNameToString(node.name);
|
||||
return getNavBarItem(name_34, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]);
|
||||
case 176 /* FunctionExpression */:
|
||||
case 177 /* ArrowFunction */:
|
||||
case 189 /* ClassExpression */:
|
||||
return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node);
|
||||
case 144 /* MethodDeclaration */:
|
||||
var methodDecl = node;
|
||||
return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]);
|
||||
case 230 /* ExportAssignment */:
|
||||
// e.g. "export default <expr>"
|
||||
return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]);
|
||||
case 226 /* ImportClause */:
|
||||
if (!node.name) {
|
||||
// No default import (this node is still a parent of named & namespace imports, which are handled below)
|
||||
return undefined;
|
||||
}
|
||||
// fall through
|
||||
case 229 /* ImportSpecifier */: // e.g. 'id' in: import {id} from 'mod' (in NamedImports, in ImportClause)
|
||||
case 227 /* NamespaceImport */: // e.g. '* as ns' in: import * as ns from 'mod' (in ImportClause)
|
||||
case 233 /* ExportSpecifier */:
|
||||
// Export specifiers are only interesting if they are reexports from another module, or renamed, else they are already globals
|
||||
if (node.kind === 233 /* ExportSpecifier */) {
|
||||
if (!node.parent.parent.moduleSpecifier && !node.propertyName) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
var decl = node;
|
||||
if (!decl.name) {
|
||||
return undefined;
|
||||
}
|
||||
var declName = ts.declarationNameToString(decl.name);
|
||||
return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]);
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function getNavBarItem(text, kind, spans, kindModifiers) {
|
||||
if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; }
|
||||
return {
|
||||
text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false
|
||||
};
|
||||
}
|
||||
function getDefineModuleItem(node) {
|
||||
if (node.kind !== 176 /* FunctionExpression */ && node.kind !== 177 /* ArrowFunction */) {
|
||||
return undefined;
|
||||
}
|
||||
// No match if this is not a call expression to an identifier named 'define'
|
||||
if (node.parent.kind !== 171 /* CallExpression */) {
|
||||
return undefined;
|
||||
}
|
||||
var callExpr = node.parent;
|
||||
if (callExpr.expression.kind !== 69 /* Identifier */ || callExpr.expression.getText() !== 'define') {
|
||||
return undefined;
|
||||
}
|
||||
// Return a module of either the given text in the first argument, or of the source file path
|
||||
var defaultName = node.getSourceFile().fileName;
|
||||
if (callExpr.arguments[0].kind === 9 /* StringLiteral */) {
|
||||
defaultName = (callExpr.arguments[0]).text;
|
||||
}
|
||||
return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]);
|
||||
}
|
||||
function getFunctionOrClassExpressionItem(node) {
|
||||
if (node.kind !== 176 /* FunctionExpression */ &&
|
||||
node.kind !== 177 /* ArrowFunction */ &&
|
||||
node.kind !== 189 /* ClassExpression */) {
|
||||
return undefined;
|
||||
}
|
||||
var fnExpr = node;
|
||||
var fnName;
|
||||
if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) {
|
||||
// The expression has an identifier, so use that as the name
|
||||
fnName = ts.declarationNameToString(fnExpr.name);
|
||||
}
|
||||
else {
|
||||
// See if it is a var initializer. If so, use the var name.
|
||||
if (fnExpr.parent.kind === 214 /* VariableDeclaration */) {
|
||||
fnName = ts.declarationNameToString(fnExpr.parent.name);
|
||||
}
|
||||
else if (fnExpr.parent.kind === 184 /* BinaryExpression */ &&
|
||||
fnExpr.parent.operatorToken.kind === 56 /* EqualsToken */) {
|
||||
fnName = fnExpr.parent.left.getText();
|
||||
if (fnName.length > 20) {
|
||||
fnName = fnName.substring(0, 17) + "...";
|
||||
}
|
||||
}
|
||||
else if (fnExpr.parent.kind === 248 /* PropertyAssignment */ &&
|
||||
fnExpr.parent.name) {
|
||||
fnName = fnExpr.parent.name.getText();
|
||||
}
|
||||
else {
|
||||
fnName = node.kind === 189 /* ClassExpression */ ? anonClassText : anonFnText;
|
||||
}
|
||||
}
|
||||
var scriptKind = node.kind === 189 /* ClassExpression */ ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement;
|
||||
return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]);
|
||||
}
|
||||
function getNodeSpan(node) {
|
||||
return node.kind === 251 /* SourceFile */
|
||||
? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd())
|
||||
: ts.createTextSpanFromBounds(node.getStart(), node.getEnd());
|
||||
}
|
||||
function getScriptKindForElementKind(kind) {
|
||||
switch (kind) {
|
||||
case 214 /* VariableDeclaration */:
|
||||
return ts.ScriptElementKind.variableElement;
|
||||
case 216 /* FunctionDeclaration */:
|
||||
return ts.ScriptElementKind.functionElement;
|
||||
case 217 /* ClassDeclaration */:
|
||||
return ts.ScriptElementKind.classElement;
|
||||
case 145 /* Constructor */:
|
||||
return ts.ScriptElementKind.constructorImplementationElement;
|
||||
case 146 /* GetAccessor */:
|
||||
return ts.ScriptElementKind.memberGetAccessorElement;
|
||||
case 147 /* SetAccessor */:
|
||||
return ts.ScriptElementKind.memberSetAccessorElement;
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
return sourceFileItem.childItems;
|
||||
}
|
||||
NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems;
|
||||
})(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {}));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
@ -43985,9 +44183,9 @@ var ts;
|
||||
}
|
||||
getTypingNamesFromSourceFileNames(fileNames);
|
||||
// Add the cached typing locations for inferred typings that are already installed
|
||||
for (var name_34 in packageNameToTypingLocation) {
|
||||
if (ts.hasProperty(inferredTypings, name_34) && !inferredTypings[name_34]) {
|
||||
inferredTypings[name_34] = packageNameToTypingLocation[name_34];
|
||||
for (var name_35 in packageNameToTypingLocation) {
|
||||
if (ts.hasProperty(inferredTypings, name_35) && !inferredTypings[name_35]) {
|
||||
inferredTypings[name_35] = packageNameToTypingLocation[name_35];
|
||||
}
|
||||
}
|
||||
// Remove typings that the user has added to the exclude list
|
||||
@ -44820,9 +45018,9 @@ var ts;
|
||||
}
|
||||
Rules.prototype.getRuleName = function (rule) {
|
||||
var o = this;
|
||||
for (var name_35 in o) {
|
||||
if (o[name_35] === rule) {
|
||||
return name_35;
|
||||
for (var name_36 in o) {
|
||||
if (o[name_36] === rule) {
|
||||
return name_36;
|
||||
}
|
||||
}
|
||||
throw new Error("Unknown rule");
|
||||
@ -49537,8 +49735,8 @@ var ts;
|
||||
if (element.getStart() <= position && position <= element.getEnd()) {
|
||||
continue;
|
||||
}
|
||||
var name_36 = element.propertyName || element.name;
|
||||
exisingImportsOrExports[name_36.text] = true;
|
||||
var name_37 = element.propertyName || element.name;
|
||||
exisingImportsOrExports[name_37.text] = true;
|
||||
}
|
||||
if (ts.isEmpty(exisingImportsOrExports)) {
|
||||
return exportsOfModule;
|
||||
@ -49655,14 +49853,14 @@ var ts;
|
||||
var entries = [];
|
||||
var target = program.getCompilerOptions().target;
|
||||
var nameTable = getNameTable(sourceFile);
|
||||
for (var name_37 in nameTable) {
|
||||
for (var name_38 in nameTable) {
|
||||
// Skip identifiers produced only from the current location
|
||||
if (nameTable[name_37] === position) {
|
||||
if (nameTable[name_38] === position) {
|
||||
continue;
|
||||
}
|
||||
if (!uniqueNames[name_37]) {
|
||||
uniqueNames[name_37] = name_37;
|
||||
var displayName = getCompletionEntryDisplayName(name_37, target, /*performCharacterChecks*/ true);
|
||||
if (!uniqueNames[name_38]) {
|
||||
uniqueNames[name_38] = name_38;
|
||||
var displayName = getCompletionEntryDisplayName(name_38, target, /*performCharacterChecks*/ true);
|
||||
if (displayName) {
|
||||
var entry = {
|
||||
name: displayName,
|
||||
@ -51614,19 +51812,19 @@ var ts;
|
||||
if (isNameOfPropertyAssignment(node)) {
|
||||
var objectLiteral = node.parent.parent;
|
||||
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||
var name_38 = node.text;
|
||||
var name_39 = node.text;
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & 16384 /* Union */) {
|
||||
// This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types)
|
||||
// if not, search the constituent types for the property
|
||||
var unionProperty = contextualType.getProperty(name_38);
|
||||
var unionProperty = contextualType.getProperty(name_39);
|
||||
if (unionProperty) {
|
||||
return [unionProperty];
|
||||
}
|
||||
else {
|
||||
var result_6 = [];
|
||||
ts.forEach(contextualType.types, function (t) {
|
||||
var symbol = t.getProperty(name_38);
|
||||
var symbol = t.getProperty(name_39);
|
||||
if (symbol) {
|
||||
result_6.push(symbol);
|
||||
}
|
||||
@ -51635,7 +51833,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var symbol_1 = contextualType.getProperty(name_38);
|
||||
var symbol_1 = contextualType.getProperty(name_39);
|
||||
if (symbol_1) {
|
||||
return [symbol_1];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user