diff --git a/.eslintrc.json b/.eslintrc.json index 7b7c1f52589..5dd81f7d7ee 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,6 +14,7 @@ ], "rules": { "sort-imports": ["error", { + "ignoreCase": true, "ignoreDeclarationSort": true, "allowSeparatedGroups": true }], diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 60172033a77..64fbdbce0e5 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,5 +1,9 @@ import { + __String, AccessExpression, + addRelatedInfo, + append, + appendIfUnique, ArrayBindingElement, ArrayLiteralExpression, ArrowFunction, @@ -19,129 +23,57 @@ import { CallExpression, CaseBlock, CaseClause, + cast, CatchClause, ClassLikeDeclaration, ClassStaticBlockDeclaration, CompilerOptions, + concatenate, ConditionalExpression, ConditionalTypeNode, - Debug, - Declaration, - DeleteExpression, - DestructuringAssignment, - DiagnosticCategory, - DiagnosticMessage, - DiagnosticRelatedInformation, - DiagnosticWithLocation, - Diagnostics, - DoStatement, - DynamicNamedDeclaration, - ElementAccessChain, - ElementAccessExpression, - EntityNameExpression, - EnumDeclaration, - ExportAssignment, - ExportDeclaration, - ExportSpecifier, - Expression, - ExpressionStatement, - FlowFlags, - FlowLabel, - FlowNode, - FlowReduceLabel, - ForInOrOfStatement, - ForStatement, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, - Identifier, - IfStatement, - ImportClause, - InternalSymbolName, - JSDocCallbackTag, - JSDocClassTag, - JSDocEnumTag, - JSDocFunctionType, - JSDocParameterTag, - JSDocPropertyLikeTag, - JSDocSignature, - JSDocTypeLiteral, - JSDocTypedefTag, - JsxAttribute, - JsxAttributes, - LabeledStatement, - LiteralLikeElementAccessExpression, - MappedTypeNode, - MethodDeclaration, - ModifierFlags, - ModuleBlock, - ModuleDeclaration, - Mutable, - NamespaceExportDeclaration, - Node, - NodeArray, - NodeFlags, - NonNullChain, - NonNullExpression, - NumericLiteral, - ObjectLiteralExpression, - OptionalChain, - ParameterDeclaration, - ParenthesizedExpression, - Pattern, - PatternAmbientModule, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrivateIdentifier, - PropertyAccessChain, - PropertyAccessExpression, - PropertyDeclaration, - PropertySignature, - ReturnStatement, - ScriptTarget, - SetAccessorDeclaration, - ShorthandPropertyAssignment, - SignatureDeclaration, - SourceFile, - SpreadElement, - Statement, - StringLiteral, - SwitchStatement, - Symbol, - SymbolFlags, - SymbolTable, - SyntaxKind, - TextRange, - ThrowStatement, - TokenFlags, - TracingNode, - TryStatement, - TypeLiteralNode, - TypeOfExpression, - TypeParameterDeclaration, - VariableDeclaration, - WhileStatement, - WithStatement, - __String, - addRelatedInfo, - append, - appendIfUnique, - cast, - concatenate, contains, createBinaryExpressionTrampoline, createDiagnosticForNodeInSourceFile, createFileDiagnostic, createQueue, createSymbolTable, + Debug, + Declaration, declarationNameToString, + DeleteExpression, + DestructuringAssignment, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticRelatedInformation, + Diagnostics, + DiagnosticWithLocation, + DoStatement, + DynamicNamedDeclaration, + ElementAccessChain, + ElementAccessExpression, + EntityNameExpression, + EnumDeclaration, escapeLeadingUnderscores, every, + ExportAssignment, exportAssignmentIsAlias, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, findAncestor, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, forEach, forEachChild, + ForInOrOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, getAssignedExpandoInitializer, getAssignmentDeclarationKind, getAssignmentDeclarationPropertyAccessKind, @@ -175,7 +107,11 @@ import { hasDynamicName, hasJSDocNodes, hasSyntacticModifier, + Identifier, idText, + IfStatement, + ImportClause, + InternalSymbolName, isAliasableExpression, isAmbientModule, isAssignmentExpression, @@ -204,8 +140,8 @@ import { isEnumDeclaration, isExportAssignment, isExportDeclaration, - isExportSpecifier, isExportsIdentifier, + isExportSpecifier, isExpression, isExpressionOfOptionalChainRoot, isExternalModule, @@ -272,28 +208,92 @@ import { isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, + JSDocCallbackTag, + JSDocClassTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTypedefTag, + JSDocTypeLiteral, + JsxAttribute, + JsxAttributes, + LabeledStatement, length, + LiteralLikeElementAccessExpression, + MappedTypeNode, + MethodDeclaration, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + Mutable, + NamespaceExportDeclaration, + Node, + NodeArray, + NodeFlags, nodeHasName, nodeIsMissing, nodeIsPresent, + NonNullChain, + NonNullExpression, + NumericLiteral, objectAllocator, + ObjectLiteralExpression, + OptionalChain, + ParameterDeclaration, + ParenthesizedExpression, + Pattern, + PatternAmbientModule, perfLogger, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAccessChain, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, removeFileExtension, + ReturnStatement, + ScriptTarget, + SetAccessorDeclaration, setParent, setParentRecursive, setValueDeclaration, + ShorthandPropertyAssignment, shouldPreserveConstEnums, + SignatureDeclaration, skipParentheses, sliceAfter, some, + SourceFile, + SpreadElement, + Statement, + StringLiteral, + SwitchStatement, + Symbol, + SymbolFlags, symbolName, + SymbolTable, + SyntaxKind, + TextRange, + ThrowStatement, + TokenFlags, tokenToString, tracing, + TracingNode, tryCast, tryParsePattern, + TryStatement, + TypeLiteralNode, + TypeOfExpression, + TypeParameterDeclaration, unescapeLeadingUnderscores, unreachableCodeIsError, unusedLabelIsError, + VariableDeclaration, + WhileStatement, + WithStatement, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 313e1298f31..6002189104f 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1,16 +1,29 @@ import * as ts from "./_namespaces/ts"; import { + addRange, AffectedFileResult, - BuildInfo, + arrayFrom, + arrayToMap, BuilderProgram, BuilderProgramHost, BuilderState, + BuildInfo, BundleBuildInfo, CancellationToken, CommandLineOption, + compareStringsCaseSensitive, + compareValues, CompilerHost, CompilerOptions, + compilerOptionsAffectDeclarationPath, + compilerOptionsAffectEmit, + compilerOptionsAffectSemanticDiagnostics, CompilerOptionsValue, + concatenate, + convertToOptionsWithAbsolutePaths, + createBuildInfo, + createGetCanonicalFileName, + createProgram, CustomTransformers, Debug, Diagnostic, @@ -21,31 +34,6 @@ import { EmitAndSemanticDiagnosticsBuilderProgram, EmitOnly, EmitResult, - GetCanonicalFileName, - HostForComputeHash, - Path, - Program, - ProjectReference, - ReadBuildProgramHost, - ReadonlyCollection, - SemanticDiagnosticsBuilderProgram, - SourceFile, - SourceMapEmitResult, - WriteFileCallback, - WriteFileCallbackData, - addRange, - arrayFrom, - arrayToMap, - compareStringsCaseSensitive, - compareValues, - compilerOptionsAffectDeclarationPath, - compilerOptionsAffectEmit, - compilerOptionsAffectSemanticDiagnostics, - concatenate, - convertToOptionsWithAbsolutePaths, - createBuildInfo, - createGetCanonicalFileName, - createProgram, emitSkippedWithNoDiagnostics, emptyArray, ensurePathIsNonModuleName, @@ -54,6 +42,7 @@ import { forEachEntry, forEachKey, generateDjb2Hash, + GetCanonicalFileName, getDirectoryPath, getEmitDeclarations, getNormalizedAbsolutePath, @@ -62,6 +51,7 @@ import { getRelativePathFromDirectory, getTsBuildInfoEmitOutputFilePath, handleNoEmitOptions, + HostForComputeHash, isArray, isDeclarationFileName, isJsonSourceFile, @@ -73,13 +63,23 @@ import { noop, notImplemented, outFile, + Path, + Program, + ProjectReference, + ReadBuildProgramHost, + ReadonlyCollection, returnFalse, returnUndefined, + SemanticDiagnosticsBuilderProgram, skipTypeChecking, some, + SourceFile, sourceFileMayBeEmitted, + SourceMapEmitResult, toPath, tryAddToSet, + WriteFileCallback, + WriteFileCallbackData, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/builderPublic.ts b/src/compiler/builderPublic.ts index 0e155a0f2be..e664960e4d5 100644 --- a/src/compiler/builderPublic.ts +++ b/src/compiler/builderPublic.ts @@ -3,19 +3,19 @@ import { CancellationToken, CompilerHost, CompilerOptions, + createBuilderProgram, + createRedirectedBuilderProgram, CustomTransformers, Diagnostic, DiagnosticWithLocation, EmitResult, + getBuilderCreationParameters, Program, ProjectReference, ReusableBuilderProgramState, SavedBuildProgramEmitState, SourceFile, WriteFileCallback, - createBuilderProgram, - createRedirectedBuilderProgram, - getBuilderCreationParameters, } from "./_namespaces/ts"; export type AffectedFileResult = { result: T; affected: SourceFile | Program; } | undefined; diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 57abd590d56..8ae0d6295ca 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -1,27 +1,17 @@ import { + arrayFrom, CancellationToken, + computeSignatureWithDiagnostics, + createGetCanonicalFileName, CustomTransformers, Debug, EmitOutput, + emptyArray, ExportedModulesFromDeclarationEmit, GetCanonicalFileName, - HostForComputeHash, - ModuleDeclaration, - ModuleKind, - OutputFile, - Path, - Program, - ResolutionMode, - SourceFile, - StringLiteralLike, - Symbol, - TypeChecker, - arrayFrom, - computeSignatureWithDiagnostics, - createGetCanonicalFileName, - emptyArray, getDirectoryPath, getSourceFileOfNode, + HostForComputeHash, isDeclarationFileName, isExternalOrCommonJsModule, isGlobalScopeAugmentation, @@ -30,9 +20,19 @@ import { isStringLiteral, mapDefined, mapDefinedIterator, + ModuleDeclaration, + ModuleKind, outFile, + OutputFile, + Path, + Program, + ResolutionMode, some, + SourceFile, + StringLiteralLike, + Symbol, toPath, + TypeChecker, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c988063e2a4..de5ba77eb20 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,14 +1,26 @@ import * as ts from "./_namespaces/ts"; import { + __String, AccessExpression, AccessFlags, AccessorDeclaration, + addRange, + addRelatedInfo, + addSyntheticLeadingComment, AllAccessorDeclarations, + and, AnonymousType, AnyImportOrReExport, AnyImportSyntax, + append, + appendIfUnique, ArrayBindingPattern, + arrayFrom, + arrayIsHomogeneous, ArrayLiteralExpression, + arrayOf, + arraysEqual, + arrayToMultiMap, ArrayTypeNode, ArrowFunction, AssertionExpression, @@ -21,11 +33,13 @@ import { BigIntLiteralType, BinaryExpression, BinaryOperatorToken, + binarySearch, BindableObjectDefinePropertyCall, BindingElement, BindingElementGrandparent, BindingName, BindingPattern, + bindSourceFile, Block, BreakOrContinueStatement, CallChain, @@ -33,9 +47,17 @@ import { CallLikeExpression, CallSignatureDeclaration, CancellationToken, + canHaveDecorators, + canHaveExportModifier, + canHaveIllegalDecorators, + canHaveIllegalModifiers, + canHaveModifiers, + cartesianProduct, CaseBlock, CaseClause, CaseOrDefaultClause, + cast, + chainDiagnosticMessages, CharacterCodes, CheckFlags, ClassDeclaration, @@ -43,387 +65,26 @@ import { ClassExpression, ClassLikeDeclaration, ClassStaticBlockDeclaration, - Comparison, - CompilerOptions, - ComputedPropertyName, - ConditionalExpression, - ConditionalRoot, - ConditionalType, - ConditionalTypeNode, - ConstructSignatureDeclaration, - ConstructorDeclaration, - ConstructorTypeNode, - ContextFlags, - Debug, - Declaration, - DeclarationName, - DeclarationStatement, - DeclarationWithTypeParameterChildren, - DeclarationWithTypeParameters, - Decorator, - DefaultClause, - DeferredTypeReference, - DeleteExpression, - Diagnostic, - DiagnosticCategory, - DiagnosticMessage, - DiagnosticMessageChain, - DiagnosticRelatedInformation, - DiagnosticWithLocation, - Diagnostics, - DoStatement, - DynamicNamedDeclaration, - ElementAccessChain, - ElementAccessExpression, - ElementFlags, - EmitFlags, - EmitHint, - EmitResolver, - EmitTextWriter, - EntityName, - EntityNameExpression, - EntityNameOrEntityNameExpression, - EnumDeclaration, - EnumMember, - EvolvingArrayType, - ExclamationToken, - ExportAssignment, - ExportDeclaration, - ExportSpecifier, - Expression, - ExpressionStatement, - ExpressionWithTypeArguments, - Extension, - ExternalEmitHelpers, - FlowArrayMutation, - FlowAssignment, - FlowCall, - FlowCondition, - FlowFlags, - FlowLabel, - FlowNode, - FlowReduceLabel, - FlowStart, - FlowSwitchClause, - FlowType, - ForInOrOfStatement, - ForInStatement, - ForOfStatement, - ForStatement, - FreshObjectLiteralType, - FreshableIntrinsicType, - FreshableType, - FunctionDeclaration, - FunctionExpression, - FunctionFlags, - FunctionLikeDeclaration, - FunctionTypeNode, - GenericType, - GetAccessorDeclaration, - HasDecorators, - HasExpressionInitializer, - HasIllegalDecorators, - HasIllegalModifiers, - HasInitializer, - HasModifiers, - HeritageClause, - Identifier, - IdentifierTypePredicate, - IfStatement, - ImportCall, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportOrExportSpecifier, - ImportSpecifier, - ImportTypeAssertionContainer, - ImportTypeNode, - ImportsNotUsedAsValues, - IncompleteType, - IndexInfo, - IndexKind, - IndexSignatureDeclaration, - IndexType, - IndexedAccessType, - IndexedAccessTypeNode, - InferTypeNode, - InferenceContext, - InferenceFlags, - InferenceInfo, - InferencePriority, - InstantiableType, - InstantiationExpressionType, - InterfaceDeclaration, - InterfaceType, - InterfaceTypeWithDeclaredMembers, - InternalSymbolName, - IntersectionType, - IntersectionTypeNode, - IntrinsicType, - IterableOrIteratorType, - IterationTypes, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocComment, - JSDocContainer, - JSDocEnumTag, - JSDocFunctionType, - JSDocImplementsTag, - JSDocLink, - JSDocLinkCode, - JSDocLinkPlain, - JSDocMemberName, - JSDocNullableType, - JSDocOptionalType, - JSDocParameterTag, - JSDocPrivateTag, - JSDocPropertyLikeTag, - JSDocPropertyTag, - JSDocProtectedTag, - JSDocPublicTag, - JSDocSignature, - JSDocTemplateTag, - JSDocTypeExpression, - JSDocTypeReferencingNode, - JSDocTypeTag, - JSDocTypedefTag, - JSDocVariadicType, - JsxAttribute, - JsxAttributeLike, - JsxAttributes, - JsxChild, - JsxClosingElement, - JsxElement, - JsxEmit, - JsxExpression, - JsxFlags, - JsxFragment, - JsxOpeningElement, - JsxOpeningFragment, - JsxOpeningLikeElement, - JsxReferenceKind, - JsxSelfClosingElement, - JsxSpreadAttribute, - JsxTagNameExpression, - KeywordTypeNode, - LabeledStatement, - LateBoundBinaryExpressionDeclaration, - LateBoundDeclaration, - LateBoundName, - LateVisibilityPaintedStatement, - LeftHandSideExpression, - LiteralExpression, - LiteralType, - LiteralTypeNode, - MappedSymbol, - MappedType, - MappedTypeNode, - MatchingKeys, - MemberName, - MemberOverrideStatus, - MetaProperty, - MethodDeclaration, - MethodSignature, - MinusToken, - Modifier, - ModifierFlags, - ModuleBlock, - ModuleDeclaration, - ModuleInstanceState, - ModuleKind, - ModuleResolutionKind, - NamedDeclaration, - NamedExports, - NamedImportsOrExports, - NamedTupleMember, - NamespaceDeclaration, - NamespaceExport, - NamespaceExportDeclaration, - NamespaceImport, - NewExpression, - Node, - NodeArray, - NodeBuilderFlags, - NodeCheckFlags, - NodeFlags, - NodeLinks, - NodeWithTypeArguments, - NonNullChain, - NonNullExpression, - NumberLiteralType, - NumericLiteral, - ObjectBindingPattern, - ObjectFlags, - ObjectFlagsType, - ObjectLiteralElementLike, - ObjectLiteralExpression, - ObjectType, - OptionalChain, - OptionalTypeNode, - OuterExpressionKinds, - ParameterDeclaration, - ParameterPropertyDeclaration, - ParenthesizedExpression, - ParenthesizedTypeNode, - Path, - PatternAmbientModule, - PlusToken, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrivateIdentifier, - Program, - PromiseOrAwaitableType, - PropertyAccessChain, - PropertyAccessEntityNameExpression, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertyName, - PropertySignature, - PseudoBigInt, - QualifiedName, - QuestionToken, - ReadonlyKeyword, - RelationComparisonResult, - ResolutionMode, - ResolvedModuleFull, - ResolvedType, - RestTypeNode, - ReturnStatement, - ReverseMappedSymbol, - ReverseMappedType, - SatisfiesExpression, - ScriptKind, - ScriptTarget, - SetAccessorDeclaration, - ShorthandPropertyAssignment, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureKind, - SourceFile, - SpreadAssignment, - SpreadElement, - Statement, - StringLiteral, - StringLiteralLike, - StringLiteralType, - StringMappingType, - StructuredType, - SubstitutionType, - SuperCall, - SwitchStatement, - Symbol, - SymbolAccessibility, - SymbolAccessibilityResult, - SymbolFlags, - SymbolFormatFlags, - SymbolId, - SymbolLinks, - SymbolTable, - SymbolTracker, - SymbolVisibilityResult, - SyntaxKind, - SyntheticDefaultModuleType, - SyntheticExpression, - TaggedTemplateExpression, - TemplateExpression, - TemplateLiteralType, - TemplateLiteralTypeNode, - Ternary, - TextSpan, - ThisExpression, - ThisTypeNode, - ThrowStatement, - TokenFlags, - TracingNode, - TransientSymbol, - TryStatement, - TupleType, - TupleTypeNode, - TupleTypeReference, - Type, - TypeAliasDeclaration, - TypeAssertion, - TypeChecker, - TypeCheckerHost, - TypeComparer, - TypeElement, - TypeFlags, - TypeFormatFlags, - TypeId, - TypeLiteralNode, - TypeMapKind, - TypeMapper, - TypeNode, - TypeNodeSyntaxKind, - TypeOfExpression, - TypeOnlyAliasDeclaration, - TypeOnlyCompatibleAliasDeclaration, - TypeOperatorNode, - TypeParameter, - TypeParameterDeclaration, - TypePredicate, - TypePredicateKind, - TypePredicateNode, - TypeQueryNode, - TypeReference, - TypeReferenceNode, - TypeReferenceSerializationKind, - TypeReferenceType, - TypeVariable, - UnaryExpression, - UnderscoreEscapedMap, - UnionOrIntersectionType, - UnionOrIntersectionTypeNode, - UnionReduction, - UnionType, - UnionTypeNode, - UniqueESSymbolType, - VariableDeclaration, - VariableDeclarationList, - VariableLikeDeclaration, - VariableStatement, - VarianceFlags, - VisitResult, - Visitor, - VoidExpression, - WhileStatement, - WideningContext, - WithStatement, - YieldExpression, - __String, - addRange, - addRelatedInfo, - addSyntheticLeadingComment, - and, - append, - appendIfUnique, - arrayFrom, - arrayIsHomogeneous, - arrayOf, - arrayToMultiMap, - arraysEqual, - binarySearch, - bindSourceFile, - canHaveDecorators, - canHaveExportModifier, - canHaveIllegalDecorators, - canHaveIllegalModifiers, - canHaveModifiers, - cartesianProduct, - cast, - chainDiagnosticMessages, clear, combinePaths, compareDiagnostics, comparePaths, compareValues, + Comparison, + CompilerOptions, + ComputedPropertyName, concatenate, concatenateDiagnosticMessageChains, + ConditionalExpression, + ConditionalRoot, + ConditionalType, + ConditionalTypeNode, + ConstructorDeclaration, + ConstructorTypeNode, + ConstructSignatureDeclaration, contains, containsParseError, + ContextFlags, copyEntries, countWhere, createBinaryExpressionTrampoline, @@ -444,18 +105,59 @@ import { createSymbolTable, createTextWriter, createUnderscoreEscapedMultiMap, + Debug, + Declaration, + DeclarationName, declarationNameToString, + DeclarationStatement, + DeclarationWithTypeParameterChildren, + DeclarationWithTypeParameters, + Decorator, deduplicate, + DefaultClause, defaultMaximumTruncationLength, + DeferredTypeReference, + DeleteExpression, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + Diagnostics, + DiagnosticWithLocation, + DoStatement, + DynamicNamedDeclaration, + ElementAccessChain, + ElementAccessExpression, + ElementFlags, + EmitFlags, + EmitHint, + EmitResolver, + EmitTextWriter, emptyArray, endsWith, + EntityName, + EntityNameExpression, + EntityNameOrEntityNameExpression, entityNameToString, + EnumDeclaration, + EnumMember, equateValues, escapeLeadingUnderscores, escapeString, every, + EvolvingArrayType, + ExclamationToken, + ExportAssignment, exportAssignmentIsAlias, + ExportDeclaration, + ExportSpecifier, + Expression, expressionResultIsUnused, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalEmitHelpers, externalHelpersModuleNameText, factory, fileExtensionIs, @@ -473,6 +175,17 @@ import { firstOrUndefined, flatMap, flatten, + FlowArrayMutation, + FlowAssignment, + FlowCall, + FlowCondition, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, + FlowStart, + FlowSwitchClause, + FlowType, forEach, forEachChild, forEachChildRecursively, @@ -482,7 +195,21 @@ import { forEachKey, forEachReturnStatement, forEachYieldExpression, + ForInOrOfStatement, + ForInStatement, formatMessage, + ForOfStatement, + ForStatement, + FreshableIntrinsicType, + FreshableType, + FreshObjectLiteralType, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + FunctionTypeNode, + GenericType, + GetAccessorDeclaration, getAliasDeclarationFromName, getAllAccessorDeclarations, getAllowSyntheticDefaultImports, @@ -505,7 +232,6 @@ import { getDeclarationsOfKind, getDeclaredExpandoInitializer, getDirectoryPath, - getESModuleInterop, getEffectiveBaseTypeNode, getEffectiveConstraintOfTypeParameter, getEffectiveContainerForJSDocTemplateTag, @@ -527,6 +253,7 @@ import { getEntries, getErrorSpanForNode, getEscapedTextOfIdentifierOrLiteral, + getESModuleInterop, getExpandoInitializer, getExportAssignmentExpression, getExternalModuleImportEqualsDeclarationExpression, @@ -570,8 +297,8 @@ import { getNonAugmentationDeclaration, getNormalizedAbsolutePath, getObjectFlags, - getOrUpdate, getOriginalNode, + getOrUpdate, getOwnKeys, getParameterSymbolFromJSDoc, getParseTreeNode, @@ -611,15 +338,21 @@ import { hasAmbientModifier, hasContextSensitiveParameters, hasDecorators, + HasDecorators, hasDynamicName, hasEffectiveModifier, hasEffectiveModifiers, hasEffectiveReadonlyModifier, + HasExpressionInitializer, hasExtension, + HasIllegalDecorators, + HasIllegalModifiers, hasInitializer, + HasInitializer, hasJSDocNodes, hasJSDocParameterTags, hasJsonModuleEmitEnabled, + HasModifiers, hasOnlyExpressionInitializer, hasOverrideModifier, hasPossibleExternalModuleReference, @@ -629,9 +362,43 @@ import { hasStaticModifier, hasSyntacticModifier, hasSyntacticModifiers, + HeritageClause, + Identifier, + IdentifierTypePredicate, idText, + IfStatement, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportsNotUsedAsValues, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IncompleteType, + IndexedAccessType, + IndexedAccessTypeNode, + IndexInfo, + IndexKind, indexOfNode, + IndexSignatureDeclaration, + IndexType, indicesOf, + InferenceContext, + InferenceFlags, + InferenceInfo, + InferencePriority, + InferTypeNode, + InstantiableType, + InstantiationExpressionType, + InterfaceDeclaration, + InterfaceType, + InterfaceTypeWithDeclaredMembers, + InternalSymbolName, + IntersectionType, + IntersectionTypeNode, + IntrinsicType, introducesArgumentsExoticObject, isAccessExpression, isAccessor, @@ -673,13 +440,13 @@ import { isClassLike, isClassStaticBlockDeclaration, isCommaSequence, - isCommonJsExportPropertyAssignment, isCommonJsExportedExpression, + isCommonJsExportPropertyAssignment, isComputedNonLiteralName, isComputedPropertyName, - isConstTypeReference, isConstructorDeclaration, isConstructorTypeNode, + isConstTypeReference, isDeclaration, isDeclarationName, isDeclarationReadonly, @@ -698,8 +465,8 @@ import { isExclusivelyTypeOnlyImportOrExport, isExportAssignment, isExportDeclaration, - isExportSpecifier, isExportsIdentifier, + isExportSpecifier, isExpression, isExpressionNode, isExpressionOfOptionalChainRoot, @@ -745,15 +512,15 @@ import { isImportOrExportSpecifier, isImportSpecifier, isImportTypeNode, + isIndexedAccessTypeNode, isInExpressionContext, + isInfinityOrNaNString, isInJSDoc, isInJSFile, isInJsonFile, - isInTopLevelContext, - isIndexedAccessTypeNode, - isInfinityOrNaNString, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, + isInTopLevelContext, isIntrinsicJsxName, isIterationStatement, isJSDocAllType, @@ -776,13 +543,12 @@ import { isJSDocTemplateTag, isJSDocTypeAlias, isJSDocTypeAssertion, + isJSDocTypedefTag, isJSDocTypeExpression, isJSDocTypeLiteral, isJSDocTypeTag, - isJSDocTypedefTag, isJSDocUnknownType, isJSDocVariadicType, - isJSXTagName, isJsonSourceFile, isJsxAttribute, isJsxAttributeLike, @@ -793,6 +559,7 @@ import { isJsxOpeningLikeElement, isJsxSelfClosingElement, isJsxSpreadAttribute, + isJSXTagName, isKnownSymbol, isLateVisibilityPaintedStatement, isLeftHandSideExpression, @@ -888,9 +655,9 @@ import { isTemplateSpan, isThisContainerOrFunctionBlock, isThisIdentifier, - isThisInTypeQuery, isThisInitializedDeclaration, isThisInitializedObjectBindingExpression, + isThisInTypeQuery, isThisProperty, isThisTypeParameter, isTransientSymbol, @@ -915,59 +682,196 @@ import { isValueSignatureDeclaration, isVarConst, isVariableDeclaration, - isVariableDeclarationInVariableStatement, isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableDeclarationInVariableStatement, isVariableDeclarationList, isVariableLike, isVariableLikeOrAccessor, isVariableStatement, isWriteAccess, isWriteOnlyAccess, + IterableOrIteratorType, + IterationTypes, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocContainer, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNullableType, + JSDocOptionalType, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocSignature, + JSDocTemplateTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeReferencingNode, + JSDocTypeTag, + JSDocVariadicType, + JsxAttribute, + JsxAttributeLike, + JsxAttributes, + JsxChild, + JsxClosingElement, + JsxElement, + JsxEmit, + JsxExpression, + JsxFlags, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxReferenceKind, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + KeywordTypeNode, + LabeledStatement, last, lastOrUndefined, + LateBoundBinaryExpressionDeclaration, + LateBoundDeclaration, + LateBoundName, + LateVisibilityPaintedStatement, + LeftHandSideExpression, length, + LiteralExpression, + LiteralType, + LiteralTypeNode, mangleScopedPackageName, map, mapDefined, + MappedSymbol, + MappedType, + MappedTypeNode, + MatchingKeys, maybeBind, + MemberName, + MemberOverrideStatus, memoize, + MetaProperty, + MethodDeclaration, + MethodSignature, minAndMax, - modifierToFlag, + MinusToken, + Modifier, + ModifierFlags, modifiersToFlags, + modifierToFlag, + ModuleBlock, + ModuleDeclaration, + ModuleInstanceState, + ModuleKind, + ModuleResolutionKind, + NamedDeclaration, + NamedExports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceDeclaration, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, needsScopeMarker, - noTruncationMaximumTruncationLength, + NewExpression, + Node, + NodeArray, + NodeBuilderFlags, nodeCanBeDecorated, + NodeCheckFlags, + NodeFlags, nodeHasName, nodeIsDecorated, nodeIsMissing, nodeIsPresent, nodeIsSynthesized, + NodeLinks, nodeStartsNewLexicalEnvironment, + NodeWithTypeArguments, + NonNullChain, + NonNullExpression, not, + noTruncationMaximumTruncationLength, nullTransformationContext, + NumberLiteralType, + NumericLiteral, objectAllocator, + ObjectBindingPattern, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ObjectType, + OptionalChain, + OptionalTypeNode, or, orderedRemoveItemAt, + OuterExpressionKinds, outFile, + ParameterDeclaration, parameterIsThisKeyword, + ParameterPropertyDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, parseIsolatedEntityName, parseNodeFactory, parsePseudoBigInt, + Path, pathIsRelative, + PatternAmbientModule, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PromiseOrAwaitableType, + PropertyAccessChain, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + PseudoBigInt, pseudoBigIntToString, pushIfUnique, + QualifiedName, + QuestionToken, rangeEquals, rangeOfNode, rangeOfTypeParameters, + ReadonlyKeyword, reduceLeft, + RelationComparisonResult, relativeComplement, removeExtension, removePrefix, replaceElement, resolutionExtensionIsTSOrJson, + ResolutionMode, + ResolvedModuleFull, + ResolvedType, resolveTripleslashReference, resolvingEmptyArray, + RestTypeNode, + ReturnStatement, + ReverseMappedSymbol, + ReverseMappedType, sameMap, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, setCommentRange, setEmitFlags, setNodeFlags, @@ -977,23 +881,65 @@ import { setTextRange, setTextRangePosEnd, setValueDeclaration, + ShorthandPropertyAssignment, shouldPreserveConstEnums, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, singleElementArray, skipOuterExpressions, skipParentheses, skipTrivia, skipTypeChecking, some, + SourceFile, + SpreadAssignment, + SpreadElement, startsWith, + Statement, stringContains, + StringLiteral, + StringLiteralLike, + StringLiteralType, + StringMappingType, stripQuotes, + StructuredType, + SubstitutionType, sum, + SuperCall, + SwitchStatement, + Symbol, + SymbolAccessibility, + SymbolAccessibilityResult, + SymbolFlags, + SymbolFormatFlags, + SymbolId, + SymbolLinks, symbolName, + SymbolTable, + SymbolTracker, + SymbolVisibilityResult, + SyntaxKind, + SyntheticDefaultModuleType, + SyntheticExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralType, + TemplateLiteralTypeNode, + Ternary, textRangeContainsPositionInclusive, + TextSpan, textSpanContainsPosition, textSpanEnd, + ThisExpression, + ThisTypeNode, + ThrowStatement, + TokenFlags, tokenToString, tracing, + TracingNode, + TransientSymbol, tryAddToSet, tryCast, tryExtractTSExtension, @@ -1001,15 +947,69 @@ import { tryGetExtensionFromPath, tryGetModuleSpecifierFromDeclaration, tryGetPropertyAccessOrIdentifierToString, + TryStatement, + TupleType, + TupleTypeNode, + TupleTypeReference, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeCheckerHost, + TypeComparer, + TypeElement, + TypeFlags, + TypeFormatFlags, + TypeId, + TypeLiteralNode, + TypeMapKind, + TypeMapper, + TypeNode, + TypeNodeSyntaxKind, + TypeOfExpression, + TypeOnlyAliasDeclaration, + TypeOnlyCompatibleAliasDeclaration, + TypeOperatorNode, + TypeParameter, + TypeParameterDeclaration, + TypePredicate, + TypePredicateKind, + TypePredicateNode, + TypeQueryNode, + TypeReference, + TypeReferenceNode, + TypeReferenceSerializationKind, + TypeReferenceType, + TypeVariable, + UnaryExpression, + UnderscoreEscapedMap, unescapeLeadingUnderscores, + UnionOrIntersectionType, + UnionOrIntersectionTypeNode, + UnionReduction, + UnionType, + UnionTypeNode, + UniqueESSymbolType, usingSingleLineStringWriter, + VariableDeclaration, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, + VarianceFlags, visitEachChild, visitNode, visitNodes, + Visitor, + VisitResult, + VoidExpression, walkUpBindingElementsAndPatterns, walkUpParenthesizedExpressions, walkUpParenthesizedTypes, walkUpParenthesizedTypesAndGetParentAndChild, + WhileStatement, + WideningContext, + WithStatement, + YieldExpression, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers"; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 55db718e997..b62fb3b638f 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,69 +1,39 @@ import { AlternateModeDiagnostics, + append, + arrayFrom, ArrayLiteralExpression, + arrayToMap, + assign, BuildOptions, + changeExtension, CharacterCodes, + combinePaths, CommandLineOption, CommandLineOptionOfCustomType, CommandLineOptionOfListType, CompilerOptions, CompilerOptionsValue, ConfigFileSpecs, - Debug, - Diagnostic, - DiagnosticMessage, - Diagnostics, - DidYouMeanOptionsDiagnostics, - Expression, - Extension, - FileExtensionInfo, - ImportsNotUsedAsValues, - JsonSourceFile, - JsxEmit, - MapLike, - ModuleDetectionKind, - ModuleKind, - ModuleResolutionKind, - NewLineKind, - Node, - NodeArray, - NumericLiteral, - ObjectLiteralExpression, - ParseConfigHost, - ParsedCommandLine, - Path, - PollingWatchKind, - PrefixUnaryExpression, - ProjectReference, - PropertyName, - Push, - ScriptTarget, - StringLiteral, - SyntaxKind, - TsConfigOnlyOption, - TsConfigSourceFile, - TypeAcquisition, - WatchDirectoryFlags, - WatchDirectoryKind, - WatchFileKind, - WatchOptions, - append, - arrayFrom, - arrayToMap, - assign, - changeExtension, - combinePaths, containsPath, convertToRelativePath, createCompilerDiagnostic, createDiagnosticForNodeInSourceFile, createGetCanonicalFileName, + Debug, + Diagnostic, + DiagnosticMessage, + Diagnostics, + DidYouMeanOptionsDiagnostics, directorySeparator, emptyArray, endsWith, ensureTrailingDirectorySeparator, every, + Expression, extend, + Extension, + FileExtensionInfo, fileExtensionIs, fileExtensionIsOneOf, filter, @@ -92,6 +62,7 @@ import { getTsConfigPropArrayElementValue, hasExtension, hasProperty, + ImportsNotUsedAsValues, isArray, isArrayLiteralExpression, isComputedNonLiteralName, @@ -101,23 +72,52 @@ import { isString, isStringDoubleQuoted, isStringLiteral, + JsonSourceFile, + JsxEmit, length, map, mapDefined, mapIterator, + MapLike, + ModuleDetectionKind, + ModuleKind, + ModuleResolutionKind, + NewLineKind, + Node, + NodeArray, nodeModuleNameResolver, normalizePath, normalizeSlashes, + NumericLiteral, + ObjectLiteralExpression, + ParseConfigHost, + ParsedCommandLine, parseJsonText, + Path, + PollingWatchKind, + PrefixUnaryExpression, + ProjectReference, + PropertyName, + Push, removeTrailingDirectorySeparator, returnTrue, + ScriptTarget, startsWith, + StringLiteral, + SyntaxKind, sys, toFileNameLowerCase, toPath, tracing, trimString, + TsConfigOnlyOption, + TsConfigSourceFile, + TypeAcquisition, unescapeLeadingUnderscores, + WatchDirectoryFlags, + WatchDirectoryKind, + WatchFileKind, + WatchOptions, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d256371dbbf..3961e094cde 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,9 +1,11 @@ import { + __String, CharacterCodes, Comparer, Comparison, Debug, EqualityComparer, + isWhiteSpaceLike, MapLike, Push, Queue, @@ -11,8 +13,6 @@ import { SortedReadonlyArray, TextSpan, UnderscoreEscapedMap, - __String, - isWhiteSpaceLike, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index f0eb1166c60..9bd8471f531 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -4,39 +4,14 @@ import { AssertionLevel, BigIntLiteralType, CheckMode, + compareValues, EmitFlags, + every, FlowFlags, FlowLabel, FlowNode, FlowNodeBase, FlowSwitchClause, - IntrinsicType, - LiteralType, - MatchingKeys, - ModifierFlags, - Node, - NodeArray, - NodeFlags, - ObjectFlags, - ObjectType, - RelationComparisonResult, - Signature, - SignatureCheckMode, - SignatureFlags, - SnippetKind, - SortedReadonlyArray, - Symbol, - SymbolFlags, - SyntaxKind, - TransformFlags, - Type, - TypeFacts, - TypeFlags, - TypeMapKind, - TypeMapper, - VarianceFlags, - compareValues, - every, getEffectiveModifierFlagsNoCache, getEmitFlags, getOwnKeys, @@ -45,21 +20,22 @@ import { getSourceTextOfNodeFromSourceFile, hasProperty, idText, + IntrinsicType, isArrayTypeNode, isBigIntLiteral, isCallSignatureDeclaration, isConditionalTypeNode, - isConstructSignatureDeclaration, isConstructorDeclaration, isConstructorTypeNode, + isConstructSignatureDeclaration, isDefaultClause, isFunctionTypeNode, isGeneratedIdentifier, isGetAccessorDeclaration, isIdentifier, isImportTypeNode, - isIndexSignatureDeclaration, isIndexedAccessTypeNode, + isIndexSignatureDeclaration, isInferTypeNode, isIntersectionTypeNode, isLiteralTypeNode, @@ -83,13 +59,37 @@ import { isTypeQueryNode, isTypeReferenceNode, isUnionTypeNode, + LiteralType, map, + MatchingKeys, + ModifierFlags, + Node, + NodeArray, + NodeFlags, nodeIsSynthesized, noop, objectAllocator, + ObjectFlags, + ObjectType, + RelationComparisonResult, + Signature, + SignatureCheckMode, + SignatureFlags, + SnippetKind, + SortedReadonlyArray, stableSort, + Symbol, + SymbolFlags, symbolName, + SyntaxKind, + TransformFlags, + Type, + TypeFacts, + TypeFlags, + TypeMapKind, + TypeMapper, unescapeLeadingUnderscores, + VarianceFlags, zipWith, } from "./_namespaces/ts"; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index daaa68073ea..c438fab6ced 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3,12 +3,14 @@ import { AccessorDeclaration, ArrayBindingPattern, ArrayLiteralExpression, + arrayToMap, ArrayTypeNode, ArrowFunction, AsExpression, AssertClause, AssertEntry, AwaitExpression, + base64encode, BigIntLiteral, BinaryExpression, BinaryOperatorToken, @@ -29,23 +31,41 @@ import { CaseBlock, CaseClause, CaseOrDefaultClause, + cast, CatchClause, + changeExtension, CharacterCodes, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, + clone, + combinePaths, CommaListExpression, CommentRange, + compareEmitHelpers, + comparePaths, Comparison, CompilerHost, CompilerOptions, + computeCommonSourceDirectoryOfFilenames, ComputedPropertyName, + computeLineStarts, + computeSignature, ConditionalExpression, ConditionalTypeNode, - ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, + ConstructSignatureDeclaration, + contains, ContinueStatement, + createBinaryExpressionTrampoline, + createDiagnosticCollection, + createGetCanonicalFileName, + createInputFilesWithFileTexts, + createMultiMap, + createPrependNodes, + createSourceMapGenerator, + createTextWriter, CustomTransformers, Debug, DebuggerStatement, @@ -53,21 +73,32 @@ import { Decorator, DefaultClause, DeleteExpression, + directorySeparator, DoStatement, DotToken, ElementAccessExpression, + emitDetachedComments, EmitFileNames, EmitFlags, EmitHint, EmitHost, + emitNewLineBeforeLeadingCommentOfPosition, EmitOnly, EmitResolver, EmitResult, EmitTextWriter, EmitTransformers, + emptyArray, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, EntityName, EnumDeclaration, EnumMember, + escapeJsxAttributeString, + escapeLeadingUnderscores, + escapeNonAsciiString, + escapeString, + every, ExportAssignment, ExportDeclaration, ExportSpecifier, @@ -76,9 +107,21 @@ import { ExpressionWithTypeArguments, Extension, ExternalModuleReference, + factory, + fileExtensionIs, + fileExtensionIsOneOf, FileReference, + filter, + findIndex, + firstOrUndefined, + forEach, + forEachChild, + forEachLeadingCommentRange, + forEachTrailingCommentRange, ForInOrOfStatement, ForInStatement, + formatGeneratedName, + formatGeneratedNamePart, ForOfStatement, ForStatement, FunctionDeclaration, @@ -89,217 +132,9 @@ import { GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, - GetCanonicalFileName, - GetLiteralTextFlags, - HeritageClause, - Identifier, - IfStatement, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportOrExportSpecifier, - ImportSpecifier, - ImportTypeNode, - IndexSignatureDeclaration, - IndexedAccessTypeNode, - InferTypeNode, - InterfaceDeclaration, - IntersectionTypeNode, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocComment, - JSDocEnumTag, - JSDocFunctionType, - JSDocImplementsTag, - JSDocNameReference, - JSDocNonNullableType, - JSDocNullableType, - JSDocOptionalType, - JSDocPropertyLikeTag, - JSDocReturnTag, - JSDocSeeTag, - JSDocSignature, - JSDocTag, - JSDocTemplateTag, - JSDocThisTag, - JSDocTypeExpression, - JSDocTypeLiteral, - JSDocTypeTag, - JSDocTypedefTag, - JSDocVariadicType, - JsxAttribute, - JsxAttributes, - JsxClosingElement, - JsxClosingFragment, - JsxElement, - JsxEmit, - JsxExpression, - JsxFragment, - JsxOpeningElement, - JsxOpeningFragment, - JsxSelfClosingElement, - JsxSpreadAttribute, - JsxTagNameExpression, - JsxText, - LabeledStatement, - LateBoundDeclaration, - ListFormat, - LiteralExpression, - LiteralLikeNode, - LiteralTypeNode, - MappedTypeNode, - MetaProperty, - MethodDeclaration, - MethodSignature, - Modifier, - ModifierLike, - ModuleBlock, - ModuleDeclaration, - ModuleKind, - ModuleReference, - NamedDeclaration, - NamedExports, - NamedImports, - NamedImportsOrExports, - NamedTupleMember, - NamespaceExport, - NamespaceExportDeclaration, - NamespaceImport, - NewExpression, - Node, - NodeArray, - NodeFlags, - NonNullExpression, - NumericLiteral, - ObjectBindingPattern, - ObjectLiteralExpression, - OptionalTypeNode, - OutputFile, - ParameterDeclaration, - ParenthesizedExpression, - ParenthesizedTypeNode, - ParsedCommandLine, - PartiallyEmittedExpression, - Placeholder, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrintHandlers, - Printer, - PrinterOptions, - PrivateIdentifier, - ProgramBuildInfo, - ProgramBundleEmitBuildInfo, - ProjectReference, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertySignature, - QualifiedName, - RestTypeNode, - ReturnStatement, - SatisfiesExpression, - ScriptTarget, - ShorthandPropertyAssignment, - SignatureDeclaration, - SnippetElement, - SnippetKind, - SourceFile, - SourceFilePrologueDirective, - SourceFilePrologueInfo, - SourceMapEmitResult, - SourceMapGenerator, - SourceMapSource, - SpreadAssignment, - SpreadElement, - Statement, - StringLiteral, - SwitchStatement, - Symbol, - SymbolFlags, - SyntaxKind, - SynthesizedComment, - TabStop, - TaggedTemplateExpression, - TemplateExpression, - TemplateLiteralTypeNode, - TemplateLiteralTypeSpan, - TemplateSpan, - TextRange, - ThrowStatement, - TransformationResult, - TryStatement, - TupleTypeNode, - TypeAliasDeclaration, - TypeAssertion, - TypeLiteralNode, - TypeNode, - TypeOfExpression, - TypeOperatorNode, - TypeParameterDeclaration, - TypePredicateNode, - TypeQueryNode, - TypeReferenceNode, - UnionTypeNode, - UnparsedNode, - UnparsedPrepend, - UnparsedPrologue, - UnparsedSource, - UnparsedSyntheticReference, - UnparsedTextLike, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, - VoidExpression, - WhileStatement, - WithStatement, - WriteFileCallbackData, - YieldExpression, - arrayToMap, - base64encode, - cast, - changeExtension, - clone, - combinePaths, - compareEmitHelpers, - comparePaths, - computeCommonSourceDirectoryOfFilenames, - computeLineStarts, - computeSignature, - contains, - createBinaryExpressionTrampoline, - createDiagnosticCollection, - createGetCanonicalFileName, - createInputFilesWithFileTexts, - createMultiMap, - createPrependNodes, - createSourceMapGenerator, - createTextWriter, - directorySeparator, - emitDetachedComments, - emitNewLineBeforeLeadingCommentOfPosition, - emptyArray, - ensurePathIsNonModuleName, - ensureTrailingDirectorySeparator, - escapeJsxAttributeString, - escapeLeadingUnderscores, - escapeNonAsciiString, - escapeString, - every, - factory, - fileExtensionIs, - fileExtensionIsOneOf, - filter, - findIndex, - firstOrUndefined, - forEach, - forEachChild, - forEachLeadingCommentRange, - forEachTrailingCommentRange, - formatGeneratedName, - formatGeneratedNamePart, getAreDeclarationMapsEnabled, getBaseFileName, + GetCanonicalFileName, getCommentRange, getConstantValue, getContainingNodeArray, @@ -314,11 +149,12 @@ import { getExternalModuleName, getLeadingCommentRanges, getLineAndCharacterOfPosition, - getLineStarts, getLinesBetweenPositionAndNextNonWhitespaceCharacter, getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, getLinesBetweenRangeEndAndRangeStart, + getLineStarts, getLiteralText, + GetLiteralTextFlags, getNewLineCharacter, getNodeForGeneratedName, getNodeId, @@ -346,7 +182,21 @@ import { getTypeNode, guessIndentation, hasRecordedExternalHelpers, + HeritageClause, + Identifier, idText, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IndexedAccessTypeNode, + IndexSignatureDeclaration, + InferTypeNode, + InterfaceDeclaration, + IntersectionTypeNode, isAccessExpression, isArray, isArrowFunction, @@ -366,8 +216,8 @@ import { isGeneratedIdentifier, isGeneratedPrivateIdentifier, isIdentifier, - isInJsonFile, isIncrementalCompilation, + isInJsonFile, isInternalDeclaration, isJSDocLikeText, isJsonSourceFile, @@ -398,21 +248,112 @@ import { isUnparsedSource, isVarConst, isVariableStatement, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocNameReference, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocPropertyLikeTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocVariadicType, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxEmit, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxText, + LabeledStatement, last, lastOrUndefined, + LateBoundDeclaration, length, + ListFormat, + LiteralExpression, + LiteralLikeNode, + LiteralTypeNode, makeIdentifierFromModuleName, + MappedTypeNode, maybeBind, memoize, + MetaProperty, + MethodDeclaration, + MethodSignature, + Modifier, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleReference, + NamedDeclaration, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFlags, + nodeIsSynthesized, noEmitNotification, noEmitSubstitution, - nodeIsSynthesized, + NonNullExpression, normalizePath, normalizeSlashes, notImplemented, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralExpression, + OptionalTypeNode, outFile, + OutputFile, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + ParsedCommandLine, + PartiallyEmittedExpression, + Placeholder, positionIsSynthesized, positionsAreOnSameLine, + PostfixUnaryExpression, + PrefixUnaryExpression, + Printer, + PrinterOptions, + PrintHandlers, + PrivateIdentifier, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProjectReference, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + QualifiedName, rangeEndIsOnSameLineAsRangeStart, rangeEndPositionsAreOnSameLine, rangeIsOnSingleLine, @@ -420,28 +361,87 @@ import { readJsonOrUndefined, removeFileExtension, resolvePath, + RestTypeNode, returnFalse, + ReturnStatement, returnUndefined, + SatisfiesExpression, + ScriptTarget, setEachParent, setOriginalNode, setParent, setTextRange, setTextRangePosEnd, setTextRangePosWidth, + ShorthandPropertyAssignment, + SignatureDeclaration, singleOrUndefined, skipPartiallyEmittedExpressions, skipTrivia, + SnippetElement, + SnippetKind, some, + SourceFile, + SourceFilePrologueDirective, + SourceFilePrologueInfo, + SourceMapEmitResult, + SourceMapGenerator, + SourceMapSource, + SpreadAssignment, + SpreadElement, stableSort, + Statement, stringContains, + StringLiteral, supportedJSExtensionsFlat, + SwitchStatement, + Symbol, + SymbolFlags, + SyntaxKind, + SynthesizedComment, sys, + TabStop, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateSpan, + TextRange, + ThrowStatement, tokenToString, tracing, + TransformationResult, transformNodes, tryParseRawSourceMap, + TryStatement, + TupleTypeNode, + TypeAliasDeclaration, + TypeAssertion, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionTypeNode, + UnparsedNode, + UnparsedPrepend, + UnparsedPrologue, + UnparsedSource, + UnparsedSyntheticReference, + UnparsedTextLike, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VoidExpression, + WhileStatement, + WithStatement, writeCommentRange, writeFile, + WriteFileCallbackData, + YieldExpression, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/factory/baseNodeFactory.ts b/src/compiler/factory/baseNodeFactory.ts index 600de9bb0df..019d3b9e274 100644 --- a/src/compiler/factory/baseNodeFactory.ts +++ b/src/compiler/factory/baseNodeFactory.ts @@ -1,7 +1,7 @@ import { Node, - SyntaxKind, objectAllocator, + SyntaxKind, } from "../_namespaces/ts"; /** diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index 63b764018c4..faa93c77be8 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -1,8 +1,12 @@ import { + __String, ArrayLiteralExpression, + arrayToMap, BindingOrAssignmentElement, Block, + compareValues, Comparison, + createExpressionFromEntityName, Debug, EmitFlags, EmitHelper, @@ -12,26 +16,22 @@ import { Expression, FunctionExpression, GeneratedIdentifierFlags, - Identifier, - PrivateIdentifierKind, - ScriptTarget, - SyntaxKind, - TextRange, - TransformationContext, - UnscopedEmitHelper, - __String, - arrayToMap, - compareValues, - createExpressionFromEntityName, getEmitFlags, getEmitScriptTarget, getPropertyNameOfBindingOrAssignmentElement, + Identifier, isCallExpression, isComputedPropertyName, isIdentifier, memoize, + PrivateIdentifierKind, + ScriptTarget, setEmitFlags, setTextRange, + SyntaxKind, + TextRange, + TransformationContext, + UnscopedEmitHelper, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/factory/emitNode.ts b/src/compiler/factory/emitNode.ts index 2bb7140bc60..1fa3027f660 100644 --- a/src/compiler/factory/emitNode.ts +++ b/src/compiler/factory/emitNode.ts @@ -1,24 +1,24 @@ import { AccessExpression, + append, + appendIfUnique, Debug, EmitFlags, EmitHelper, EmitNode, + getParseTreeNode, + getSourceFileOfNode, + isParseTreeNode, Node, + orderedRemoveItem, SnippetElement, + some, SourceFile, SourceMapRange, SyntaxKind, SynthesizedComment, TextRange, TypeNode, - append, - appendIfUnique, - getParseTreeNode, - getSourceFileOfNode, - isParseTreeNode, - orderedRemoveItem, - some, } from "../_namespaces/ts"; /** diff --git a/src/compiler/factory/nodeConverters.ts b/src/compiler/factory/nodeConverters.ts index 66c8170f03e..e506391a78b 100644 --- a/src/compiler/factory/nodeConverters.ts +++ b/src/compiler/factory/nodeConverters.ts @@ -5,16 +5,11 @@ import { BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, Block, + cast, ConciseBody, Debug, Expression, FunctionDeclaration, - NodeConverters, - NodeFactory, - ObjectBindingOrAssignmentElement, - ObjectBindingOrAssignmentPattern, - SyntaxKind, - cast, getStartsOnNewLine, isArrayBindingPattern, isArrayLiteralExpression, @@ -27,10 +22,15 @@ import { isObjectLiteralElementLike, isObjectLiteralExpression, map, + NodeConverters, + NodeFactory, notImplemented, + ObjectBindingOrAssignmentElement, + ObjectBindingOrAssignmentPattern, setOriginalNode, setStartsOnNewLine, setTextRange, + SyntaxKind, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 19bef1d352b..4e872d7babb 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1,4 +1,7 @@ import { + addRange, + append, + appendIfUnique, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, @@ -34,9 +37,11 @@ import { CallChain, CallExpression, CallSignatureDeclaration, + canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, + cast, CatchClause, ClassDeclaration, ClassElement, @@ -51,10 +56,14 @@ import { ConciseBody, ConditionalExpression, ConditionalTypeNode, - ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, + ConstructSignatureDeclaration, ContinueStatement, + createBaseNodeFactory, + createNodeConverters, + createParenthesizerRules, + createScanner, Debug, DebuggerStatement, Declaration, @@ -68,6 +77,7 @@ import { ElementAccessExpression, EmitFlags, EmitNode, + emptyArray, EmptyStatement, EndOfDeclarationMarker, EndOfFileToken, @@ -75,6 +85,8 @@ import { EnumDeclaration, EnumMember, EqualsGreaterThanToken, + escapeLeadingUnderscores, + every, ExclamationToken, ExportAssignment, ExportDeclaration, @@ -85,8 +97,11 @@ import { ExternalModuleReference, FalseLiteral, FileReference, - ForInStatement, + findUseStrictPrologue, + forEach, ForInitializer, + ForInStatement, + formatGeneratedName, ForOfStatement, ForStatement, FunctionDeclaration, @@ -97,256 +112,6 @@ import { GeneratedIdentifierFlags, GeneratedNamePart, GetAccessorDeclaration, - HasModifiers, - HeritageClause, - Identifier, - IfStatement, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportSpecifier, - ImportTypeAssertionContainer, - ImportTypeNode, - IndexSignatureDeclaration, - IndexedAccessTypeNode, - InferTypeNode, - InputFiles, - InterfaceDeclaration, - IntersectionTypeNode, - JSDoc, - JSDocAllType, - JSDocAugmentsTag, - JSDocAuthorTag, - JSDocCallbackTag, - JSDocClassTag, - JSDocComment, - JSDocDeprecatedTag, - JSDocEnumTag, - JSDocFunctionType, - JSDocImplementsTag, - JSDocLink, - JSDocLinkCode, - JSDocLinkPlain, - JSDocMemberName, - JSDocNameReference, - JSDocNamepathType, - JSDocNamespaceDeclaration, - JSDocNonNullableType, - JSDocNullableType, - JSDocOptionalType, - JSDocOverrideTag, - JSDocParameterTag, - JSDocPrivateTag, - JSDocPropertyLikeTag, - JSDocPropertyTag, - JSDocProtectedTag, - JSDocPublicTag, - JSDocReadonlyTag, - JSDocReturnTag, - JSDocSeeTag, - JSDocSignature, - JSDocTag, - JSDocTemplateTag, - JSDocText, - JSDocThisTag, - JSDocType, - JSDocTypeExpression, - JSDocTypeLiteral, - JSDocTypeTag, - JSDocTypedefTag, - JSDocUnknownTag, - JSDocUnknownType, - JSDocVariadicType, - JsxAttribute, - JsxAttributeLike, - JsxAttributeValue, - JsxAttributes, - JsxChild, - JsxClosingElement, - JsxClosingFragment, - JsxElement, - JsxExpression, - JsxFragment, - JsxOpeningElement, - JsxOpeningFragment, - JsxSelfClosingElement, - JsxSpreadAttribute, - JsxTagNameExpression, - JsxText, - KeywordSyntaxKind, - KeywordToken, - KeywordTypeNode, - KeywordTypeSyntaxKind, - LabeledStatement, - LanguageVariant, - LeftHandSideExpression, - LiteralToken, - LiteralTypeNode, - MappedTypeNode, - MergeDeclarationMarker, - MetaProperty, - MethodDeclaration, - MethodSignature, - MinusToken, - MissingDeclaration, - Modifier, - ModifierFlags, - ModifierLike, - ModifierSyntaxKind, - ModifierToken, - ModuleBlock, - ModuleBody, - ModuleDeclaration, - ModuleKind, - ModuleName, - ModuleReference, - Mutable, - MutableNodeArray, - NamedDeclaration, - NamedExportBindings, - NamedExports, - NamedImportBindings, - NamedImports, - NamedTupleMember, - NamespaceExport, - NamespaceExportDeclaration, - NamespaceImport, - NewExpression, - NoSubstitutionTemplateLiteral, - Node, - NodeArray, - NodeFactory, - NodeFlags, - NonNullChain, - NonNullExpression, - NotEmittedStatement, - NullLiteral, - NumericLiteral, - ObjectBindingPattern, - ObjectLiteralElementLike, - ObjectLiteralExpression, - OmittedExpression, - OptionalTypeNode, - OuterExpression, - OuterExpressionKinds, - ParameterDeclaration, - ParenthesizedExpression, - ParenthesizedTypeNode, - PartiallyEmittedExpression, - PlusToken, - PostfixUnaryExpression, - PostfixUnaryOperator, - PrefixUnaryExpression, - PrefixUnaryOperator, - PrimaryExpression, - PrivateIdentifier, - PrologueDirective, - PropertyAccessChain, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertyDescriptorAttributes, - PropertyName, - PropertyNameLiteral, - PropertySignature, - PseudoBigInt, - PunctuationSyntaxKind, - PunctuationToken, - Push, - QualifiedName, - QuestionDotToken, - QuestionToken, - ReadonlyKeyword, - RegularExpressionLiteral, - RestTypeNode, - ReturnStatement, - SatisfiesExpression, - Scanner, - ScriptTarget, - SemicolonClassElement, - SetAccessorDeclaration, - ShorthandPropertyAssignment, - SignatureDeclarationBase, - SourceFile, - SourceMapSource, - SpreadAssignment, - SpreadElement, - Statement, - StringLiteral, - StringLiteralLike, - SuperExpression, - SwitchStatement, - SyntaxKind, - SyntaxList, - SyntheticExpression, - SyntheticReferenceExpression, - TaggedTemplateExpression, - TemplateExpression, - TemplateHead, - TemplateLiteral, - TemplateLiteralLikeNode, - TemplateLiteralToken, - TemplateLiteralTypeNode, - TemplateLiteralTypeSpan, - TemplateMiddle, - TemplateSpan, - TemplateTail, - TextRange, - ThisExpression, - ThisTypeNode, - ThrowStatement, - Token, - TokenFlags, - TransformFlags, - TrueLiteral, - TryStatement, - TupleTypeNode, - Type, - TypeAliasDeclaration, - TypeAssertion, - TypeElement, - TypeLiteralNode, - TypeNode, - TypeOfExpression, - TypeOfTag, - TypeOperatorNode, - TypeParameterDeclaration, - TypePredicateNode, - TypeQueryNode, - TypeReferenceNode, - UnionOrIntersectionTypeNode, - UnionTypeNode, - UnparsedNode, - UnparsedPrepend, - UnparsedPrologue, - UnparsedSource, - UnparsedSourceText, - UnparsedSyntheticReference, - UnparsedTextLike, - UnscopedEmitHelper, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, - VisitResult, - VoidExpression, - WhileStatement, - WithStatement, - YieldExpression, - addRange, - append, - appendIfUnique, - canHaveModifiers, - cast, - createBaseNodeFactory, - createNodeConverters, - createParenthesizerRules, - createScanner, - emptyArray, - escapeLeadingUnderscores, - every, - findUseStrictPrologue, - forEach, - formatGeneratedName, getAllUnscopedEmitHelpers, getBuildInfo, getCommentRange, @@ -362,10 +127,26 @@ import { getTargetOfBindingOrAssignmentElement, getTextOfIdentifierOrLiteral, hasInvalidEscape, + HasModifiers, hasProperty, hasStaticModifier, hasSyntacticModifier, + HeritageClause, + Identifier, idText, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IndexedAccessTypeNode, + IndexSignatureDeclaration, + InferTypeNode, + InputFiles, + InterfaceDeclaration, + IntersectionTypeNode, isArray, isArrayLiteralExpression, isArrowFunction, @@ -438,34 +219,253 @@ import { isTypeParameterDeclaration, isVariableDeclaration, isVariableStatement, + JSDoc, + JSDocAllType, + JSDocAugmentsTag, + JSDocAuthorTag, + JSDocCallbackTag, + JSDocClassTag, + JSDocComment, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNamepathType, + JSDocNameReference, + JSDocNamespaceDeclaration, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocText, + JSDocThisTag, + JSDocType, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocUnknownTag, + JSDocUnknownType, + JSDocVariadicType, + JsxAttribute, + JsxAttributeLike, + JsxAttributes, + JsxAttributeValue, + JsxChild, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxText, + KeywordSyntaxKind, + KeywordToken, + KeywordTypeNode, + KeywordTypeSyntaxKind, + LabeledStatement, + LanguageVariant, lastOrUndefined, + LeftHandSideExpression, + LiteralToken, + LiteralTypeNode, map, + MappedTypeNode, memoize, memoizeOne, + MergeDeclarationMarker, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + MissingDeclaration, + Modifier, + ModifierFlags, + ModifierLike, modifiersToFlags, + ModifierSyntaxKind, + ModifierToken, + ModuleBlock, + ModuleBody, + ModuleDeclaration, + ModuleKind, + ModuleName, + ModuleReference, + Mutable, + MutableNodeArray, + NamedDeclaration, + NamedExportBindings, + NamedExports, + NamedImportBindings, + NamedImports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFactory, + NodeFlags, nodeIsSynthesized, + NonNullChain, + NonNullExpression, + NoSubstitutionTemplateLiteral, + NotEmittedStatement, + NullLiteral, nullNodeConverters, nullParenthesizerRules, + NumericLiteral, objectAllocator, + ObjectBindingPattern, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OmittedExpression, + OptionalTypeNode, + OuterExpression, + OuterExpressionKinds, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, parseNodeFactory, + PartiallyEmittedExpression, + PlusToken, + PostfixUnaryExpression, + PostfixUnaryOperator, + PrefixUnaryExpression, + PrefixUnaryOperator, + PrimaryExpression, + PrivateIdentifier, + PrologueDirective, + PropertyAccessChain, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyDescriptorAttributes, + PropertyName, + PropertyNameLiteral, + PropertySignature, + PseudoBigInt, pseudoBigIntToString, + PunctuationSyntaxKind, + PunctuationToken, + Push, + QualifiedName, + QuestionDotToken, + QuestionToken, + ReadonlyKeyword, reduceLeft, + RegularExpressionLiteral, + RestTypeNode, + ReturnStatement, returnTrue, sameFlatMap, + SatisfiesExpression, + Scanner, + ScriptTarget, + SemicolonClassElement, + SetAccessorDeclaration, setEachParent, setEmitFlags, setParent, setTextRange, setTextRangePosEnd, setTextRangePosWidth, + ShorthandPropertyAssignment, + SignatureDeclarationBase, singleOrUndefined, skipOuterExpressions, skipParentheses, some, + SourceFile, + SourceMapSource, + SpreadAssignment, + SpreadElement, startOnNewLine, startsWith, + Statement, + StringLiteral, + StringLiteralLike, stringToToken, + SuperExpression, + SwitchStatement, + SyntaxKind, + SyntaxList, + SyntheticExpression, + SyntheticReferenceExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateHead, + TemplateLiteral, + TemplateLiteralLikeNode, + TemplateLiteralToken, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateMiddle, + TemplateSpan, + TemplateTail, + TextRange, + ThisExpression, + ThisTypeNode, + ThrowStatement, + Token, + TokenFlags, + TransformFlags, + TrueLiteral, + TryStatement, + TupleTypeNode, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeElement, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOfTag, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionOrIntersectionTypeNode, + UnionTypeNode, + UnparsedNode, + UnparsedPrepend, + UnparsedPrologue, + UnparsedSource, + UnparsedSourceText, + UnparsedSyntheticReference, + UnparsedTextLike, + UnscopedEmitHelper, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, visitNode, + VisitResult, + VoidExpression, + WhileStatement, + WithStatement, + YieldExpression, } from "../_namespaces/ts"; let nextAutoGenerateId = 0; diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 800751735be..14e296610c5 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -32,9 +32,9 @@ import { ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, - ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, + ConstructSignatureDeclaration, ContinueStatement, DebuggerStatement, Decorator, @@ -73,8 +73,8 @@ import { ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexSignatureDeclaration, IndexedAccessTypeNode, + IndexSignatureDeclaration, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, @@ -92,8 +92,8 @@ import { JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, - JSDocNameReference, JSDocNamepathType, + JSDocNameReference, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, @@ -109,10 +109,10 @@ import { JSDocSignature, JSDocTemplateTag, JSDocThisTag, + JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, - JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, @@ -146,9 +146,9 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, - NoSubstitutionTemplateLiteral, Node, NonNullExpression, + NoSubstitutionTemplateLiteral, NotEmittedStatement, NumericLiteral, ObjectBindingPattern, diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index c1c0f96a8d4..119ad2953a1 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -2,22 +2,11 @@ import { Associativity, BinaryExpression, BinaryOperator, + cast, + compareValues, Comparison, ConciseBody, Expression, - LeftHandSideExpression, - NamedTupleMember, - NewExpression, - NodeArray, - NodeFactory, - OperatorPrecedence, - OuterExpressionKinds, - ParenthesizerRules, - SyntaxKind, - TypeNode, - UnaryExpression, - cast, - compareValues, getExpressionAssociativity, getExpressionPrecedence, getLeftmostExpression, @@ -44,10 +33,21 @@ import { isUnaryExpression, isUnionTypeNode, last, + LeftHandSideExpression, + NamedTupleMember, + NewExpression, + NodeArray, + NodeFactory, + OperatorPrecedence, + OuterExpressionKinds, + ParenthesizerRules, sameMap, setTextRange, skipPartiallyEmittedExpressions, some, + SyntaxKind, + TypeNode, + UnaryExpression, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index c6e2c43bfbe..190bd6e7cb8 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1,5 +1,6 @@ import { AccessorDeclaration, + addEmitFlags, AdditiveOperator, AdditiveOperatorOrHigher, AssertionLevel, @@ -17,6 +18,7 @@ import { BooleanLiteral, CharacterCodes, CommaListExpression, + compareStringsCaseSensitive, CompilerOptions, Debug, Declaration, @@ -32,81 +34,20 @@ import { ExportDeclaration, Expression, ExpressionStatement, + externalHelpersModuleNameText, + first, + firstOrUndefined, ForInitializer, GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, GetAccessorDeclaration, - HasIllegalDecorators, - HasIllegalModifiers, - HasIllegalType, - HasIllegalTypeParameters, - Identifier, - ImportCall, - ImportDeclaration, - ImportEqualsDeclaration, - JSDocNamespaceBody, - JSDocTypeAssertion, - JsxOpeningFragment, - JsxOpeningLikeElement, - LeftHandSideExpression, - LiteralExpression, - LogicalOperator, - LogicalOperatorOrHigher, - MemberExpression, - MethodDeclaration, - MinusToken, - ModifiersArray, - ModuleKind, - ModuleName, - MultiplicativeOperator, - MultiplicativeOperatorOrHigher, - Mutable, - NamedImportBindings, - Node, - NodeArray, - NodeFactory, - NullLiteral, - NumericLiteral, - ObjectLiteralElementLike, - ObjectLiteralExpression, - OuterExpression, - OuterExpressionKinds, - PlusToken, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrivateIdentifier, - PropertyAssignment, - PropertyDeclaration, - PropertyName, - QuestionToken, - ReadonlyKeyword, - RelationalOperator, - RelationalOperatorOrHigher, - SetAccessorDeclaration, - ShiftOperator, - ShiftOperatorOrHigher, - ShorthandPropertyAssignment, - SourceFile, - Statement, - StringLiteral, - SyntaxKind, - TextRange, - ThisTypeNode, - Token, - TypeNode, - TypeParameterDeclaration, - addEmitFlags, - compareStringsCaseSensitive, - externalHelpersModuleNameText, - first, - firstOrUndefined, getAllAccessorDeclarations, - getESModuleInterop, getEmitFlags, getEmitHelpers, getEmitModuleKind, + getESModuleInterop, getExternalModuleName, getExternalModuleNameFromPath, getJSDocType, @@ -117,7 +58,15 @@ import { getOriginalNode, getParseTreeNode, getSourceTextOfNodeFromSourceFile, + HasIllegalDecorators, + HasIllegalModifiers, + HasIllegalType, + HasIllegalTypeParameters, + Identifier, idText, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, isAssignmentExpression, isAssignmentOperator, isBlock, @@ -156,16 +105,67 @@ import { isTypeNode, isTypeParameterDeclaration, isVariableDeclarationList, + JSDocNamespaceBody, + JSDocTypeAssertion, + JsxOpeningFragment, + JsxOpeningLikeElement, + LeftHandSideExpression, + LiteralExpression, + LogicalOperator, + LogicalOperatorOrHigher, map, + MemberExpression, + MethodDeclaration, + MinusToken, + ModifiersArray, + ModuleKind, + ModuleName, + MultiplicativeOperator, + MultiplicativeOperatorOrHigher, + Mutable, + NamedImportBindings, + Node, + NodeArray, + NodeFactory, + NullLiteral, + NumericLiteral, + ObjectLiteralElementLike, + ObjectLiteralExpression, or, + OuterExpression, + OuterExpressionKinds, outFile, parseNodeFactory, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAssignment, + PropertyDeclaration, + PropertyName, pushIfUnique, + QuestionToken, + ReadonlyKeyword, + RelationalOperator, + RelationalOperatorOrHigher, + SetAccessorDeclaration, setOriginalNode, setParent, setStartsOnNewLine, setTextRange, + ShiftOperator, + ShiftOperatorOrHigher, + ShorthandPropertyAssignment, some, + SourceFile, + Statement, + StringLiteral, + SyntaxKind, + TextRange, + ThisTypeNode, + Token, + TypeNode, + TypeParameterDeclaration, } from "../_namespaces/ts"; // Compound nodes diff --git a/src/compiler/factory/utilitiesPublic.ts b/src/compiler/factory/utilitiesPublic.ts index 66b71eaa6a0..8afd72574c0 100644 --- a/src/compiler/factory/utilitiesPublic.ts +++ b/src/compiler/factory/utilitiesPublic.ts @@ -2,9 +2,9 @@ import { HasDecorators, HasModifiers, Node, + setTextRangePosEnd, SyntaxKind, TextRange, - setTextRangePosEnd, } from "../_namespaces/ts"; export function setTextRange(range: T, location: TextRange | undefined): T { diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 57acdf388a9..5177f1d5a57 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,61 +1,42 @@ import { + append, + appendIfUnique, + arrayFrom, + changeAnyExtension, CharacterCodes, + combinePaths, + comparePaths, Comparison, CompilerOptions, + contains, + containsPath, + createCompilerDiagnostic, Debug, Diagnostic, DiagnosticMessage, DiagnosticReporter, Diagnostics, - Extension, - FileReference, - GetCanonicalFileName, - GetEffectiveTypeRootsHost, - MapLike, - MatchingKeys, - ModuleKind, - ModuleResolutionHost, - ModuleResolutionKind, - PackageId, - ParsedCommandLine, - Path, - Pattern, - Push, - ResolutionMode, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, - SourceFile, - StringLiteralLike, - Version, - VersionRange, - append, - appendIfUnique, - arrayFrom, - changeAnyExtension, - combinePaths, - comparePaths, - contains, - containsPath, - createCompilerDiagnostic, directoryProbablyExists, directorySeparator, emptyArray, endsWith, ensureTrailingDirectorySeparator, every, + Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, + FileReference, filter, firstDefined, forEach, forEachAncestorDirectory, formatMessage, getBaseFileName, + GetCanonicalFileName, getCommonSourceDirectory, getDirectoryPath, + GetEffectiveTypeRootsHost, getEmitModuleKind, getEmitModuleResolutionKind, getModeForUsageLocation, @@ -78,25 +59,42 @@ import { isStringLiteralLike, lastOrUndefined, length, - matchPatternOrExact, + MapLike, matchedText, + MatchingKeys, + matchPatternOrExact, + ModuleKind, + ModuleResolutionHost, + ModuleResolutionKind, noop, noopPush, normalizePath, normalizeSlashes, optionsHaveModuleResolutionChanges, + PackageId, packageIdToString, + ParsedCommandLine, + Path, pathIsRelative, + Pattern, patternText, perfLogger, + Push, readJson, removeExtension, removeFileExtension, removePrefix, + ResolutionMode, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, some, sort, + SourceFile, startsWith, stringContains, + StringLiteralLike, supportedDeclarationExtensions, supportedTSImplementationExtensions, toFileNameLowerCase, @@ -105,7 +103,9 @@ import { tryGetExtensionFromPath, tryParsePatterns, version, + Version, versionMajorMinor, + VersionRange, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 5f583ed5bfe..84031881431 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -1,60 +1,37 @@ import { - AmbientModuleDeclaration, - CharacterCodes, - Comparison, - CompilerOptions, - Debug, - ExportAssignment, - Extension, - FileIncludeKind, - GetCanonicalFileName, - Identifier, - JsxEmit, - MapLike, - ModuleDeclaration, - ModuleKind, - ModulePath, - ModuleResolutionHost, - ModuleResolutionKind, - ModuleSpecifierCache, - ModuleSpecifierOptions, - ModuleSpecifierResolutionHost, - NodeFlags, - NodeModulePathParts, - Path, - PropertyAccessExpression, - ResolutionMode, - ScriptKind, - SourceFile, - StringLiteral, - Symbol, - SymbolFlags, - TypeChecker, - UserPreferences, __String, allKeysStartWithDot, + AmbientModuleDeclaration, append, arrayFrom, + CharacterCodes, combinePaths, compareBooleans, compareNumberOfDirectorySeparators, comparePaths, + Comparison, + CompilerOptions, containsIgnoredPath, containsPath, createGetCanonicalFileName, + Debug, directorySeparator, emptyArray, endsWith, ensurePathIsNonModuleName, ensureTrailingDirectorySeparator, every, + ExportAssignment, + Extension, extensionFromPath, fileExtensionIsOneOf, + FileIncludeKind, firstDefined, flatMap, flatten, forEach, forEachAncestorDirectory, + GetCanonicalFileName, getDirectoryPath, getEmitModuleResolutionKind, getImpliedNodeFormatForFile, @@ -74,6 +51,7 @@ import { hasJSFileExtension, hasTSFileExtension, hostGetCanonicalFileName, + Identifier, isAmbientModule, isApplicableVersionedTypesKey, isExternalModuleAugmentation, @@ -84,24 +62,46 @@ import { isRootedDiskPath, isSourceFile, isString, + JsxEmit, map, mapDefined, + MapLike, matchPatternOrExact, min, + ModuleDeclaration, + ModuleKind, + ModulePath, + ModuleResolutionHost, + ModuleResolutionKind, + ModuleSpecifierCache, + ModuleSpecifierOptions, + ModuleSpecifierResolutionHost, + NodeFlags, + NodeModulePathParts, normalizePath, + Path, pathContainsNodeModules, pathIsBareSpecifier, pathIsRelative, + PropertyAccessExpression, removeFileExtension, removeSuffix, + ResolutionMode, resolvePath, + ScriptKind, some, + SourceFile, startsWith, startsWithDirectory, stringContains, + StringLiteral, + Symbol, + SymbolFlags, toPath, tryGetExtensionFromPath, tryParsePatterns, + TypeChecker, + UserPreferences, } from "./_namespaces/ts"; // Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers. diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 392467212a7..f1f8bd002e8 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,7 +1,10 @@ import * as ts from "./_namespaces/ts"; import { AccessorDeclaration, + addRange, + addRelatedInfo, AmdDependency, + append, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, @@ -12,6 +15,7 @@ import { AssertEntry, AssertionLevel, AsteriskToken, + attachFileToDiagnostics, AwaitExpression, BaseNodeFactory, BinaryExpression, @@ -25,6 +29,7 @@ import { BreakStatement, CallExpression, CallSignatureDeclaration, + canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, @@ -38,26 +43,38 @@ import { ClassStaticBlockDeclaration, CommaListExpression, CommentDirective, + commentPragmas, CommentRange, ComputedPropertyName, + concatenate, ConditionalExpression, ConditionalTypeNode, - ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, + ConstructSignatureDeclaration, + containsParseError, ContinueStatement, + convertToObjectWorker, + createDetachedDiagnostic, + createNodeFactory, + createScanner, + createTextChangeRange, + createTextSpanFromBounds, Debug, Decorator, DefaultClause, DeleteExpression, Diagnostic, DiagnosticMessage, - DiagnosticWithDetachedLocation, Diagnostics, + DiagnosticWithDetachedLocation, DoStatement, DotDotDotToken, ElementAccessExpression, + emptyArray, + emptyMap, EndOfFileToken, + ensureScriptKind, EntityName, EnumDeclaration, EnumMember, @@ -69,7 +86,10 @@ import { ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, + fileExtensionIsOneOf, FileReference, + findIndex, + forEach, ForEachChildNodes, ForInOrOfStatement, ForInStatement, @@ -80,10 +100,20 @@ import { FunctionOrConstructorTypeNode, FunctionTypeNode, GetAccessorDeclaration, + getBinaryOperatorPrecedence, + getFullWidth, + getJSDocCommentRanges, + getLanguageVariant, + getLastChild, + getLeadingCommentRanges, + getSpellingSuggestion, + getTextOfNodeFromSourceText, HasJSDoc, + hasJSDocNodes, HasModifiers, HeritageClause, Identifier, + idText, IfStatement, ImportClause, ImportDeclaration, @@ -92,11 +122,42 @@ import { ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexSignatureDeclaration, IndexedAccessTypeNode, + IndexSignatureDeclaration, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, + isArray, + isAssignmentOperator, + isAsyncModifier, + isClassMemberModifier, + isExportAssignment, + isExportDeclaration, + isExportModifier, + isExpressionWithTypeArguments, + isExternalModuleReference, + isFunctionTypeNode, + isIdentifierText, + isImportDeclaration, + isImportEqualsDeclaration, + isJSDocFunctionType, + isJSDocNullableType, + isJSDocReturnTag, + isJSDocTypeTag, + isJsxOpeningElement, + isJsxOpeningFragment, + isKeyword, + isLeftHandSideExpression, + isLiteralKind, + isMetaProperty, + isModifierKind, + isNonNullExpression, + isPrivateIdentifier, + isSetAccessorDeclaration, + isStringOrNumericLiteralLike, + isTaggedTemplateExpression, + isTemplateLiteralKind, + isTypeReferenceNode, IterationStatement, JSDoc, JSDocAllType, @@ -135,10 +196,10 @@ import { JSDocTemplateTag, JSDocText, JSDocThisTag, + JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, - JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, @@ -146,8 +207,8 @@ import { JsonObjectExpressionStatement, JsonSourceFile, JsxAttribute, - JsxAttributeValue, JsxAttributes, + JsxAttributeValue, JsxChild, JsxClosingElement, JsxClosingFragment, @@ -165,10 +226,13 @@ import { JsxTokenSyntaxKind, LabeledStatement, LanguageVariant, + lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralLikeNode, LiteralTypeNode, + map, + mapDefined, MappedTypeNode, MemberExpression, MetaProperty, @@ -180,6 +244,7 @@ import { ModifierFlags, ModifierLike, ModifiersArray, + modifiersToFlags, ModuleBlock, ModuleDeclaration, ModuleKind, @@ -194,14 +259,19 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, - NoSubstitutionTemplateLiteral, Node, NodeArray, NodeFactoryFlags, NodeFlags, + nodeIsMissing, + nodeIsPresent, NonNullExpression, + noop, + normalizePath, + NoSubstitutionTemplateLiteral, NullLiteral, NumericLiteral, + objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -212,6 +282,7 @@ import { ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, + perfLogger, PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, @@ -243,12 +314,22 @@ import { ScriptKind, ScriptTarget, SetAccessorDeclaration, + setParent, + setParentRecursive, + setTextRange, + setTextRangePos, + setTextRangePosEnd, + setTextRangePosWidth, ShorthandPropertyAssignment, + skipTrivia, + some, SourceFile, SpreadAssignment, SpreadElement, + startsWith, Statement, StringLiteral, + supportedDeclarationExtensions, SwitchStatement, SyntaxKind, TaggedTemplateExpression, @@ -261,13 +342,23 @@ import { TemplateSpan, TemplateTail, TextChangeRange, + textChangeRangeIsUnchanged, + textChangeRangeNewSpan, TextRange, + textSpanEnd, + textToKeywordObj, ThisExpression, ThisTypeNode, ThrowStatement, + toArray, Token, TokenFlags, + tokenIsIdentifierOrKeyword, + tokenIsIdentifierOrKeywordOrGreaterThan, + tokenToString, + tracing, TransformFlags, + trimString, TryStatement, TupleTypeNode, TypeAliasDeclaration, @@ -292,97 +383,6 @@ import { WhileStatement, WithStatement, YieldExpression, - addRange, - addRelatedInfo, - append, - attachFileToDiagnostics, - canHaveModifiers, - commentPragmas, - concatenate, - containsParseError, - convertToObjectWorker, - createDetachedDiagnostic, - createNodeFactory, - createScanner, - createTextChangeRange, - createTextSpanFromBounds, - emptyArray, - emptyMap, - ensureScriptKind, - fileExtensionIsOneOf, - findIndex, - forEach, - getBinaryOperatorPrecedence, - getFullWidth, - getJSDocCommentRanges, - getLanguageVariant, - getLastChild, - getLeadingCommentRanges, - getSpellingSuggestion, - getTextOfNodeFromSourceText, - hasJSDocNodes, - idText, - isArray, - isAssignmentOperator, - isAsyncModifier, - isClassMemberModifier, - isExportAssignment, - isExportDeclaration, - isExportModifier, - isExpressionWithTypeArguments, - isExternalModuleReference, - isFunctionTypeNode, - isIdentifierText, - isImportDeclaration, - isImportEqualsDeclaration, - isJSDocFunctionType, - isJSDocNullableType, - isJSDocReturnTag, - isJSDocTypeTag, - isJsxOpeningElement, - isJsxOpeningFragment, - isKeyword, - isLeftHandSideExpression, - isLiteralKind, - isMetaProperty, - isModifierKind, - isNonNullExpression, - isPrivateIdentifier, - isSetAccessorDeclaration, - isStringOrNumericLiteralLike, - isTaggedTemplateExpression, - isTemplateLiteralKind, - isTypeReferenceNode, - lastOrUndefined, - map, - mapDefined, - modifiersToFlags, - nodeIsMissing, - nodeIsPresent, - noop, - normalizePath, - objectAllocator, - perfLogger, - setParent, - setParentRecursive, - setTextRange, - setTextRangePos, - setTextRangePosEnd, - setTextRangePosWidth, - skipTrivia, - some, - startsWith, - supportedDeclarationExtensions, - textChangeRangeIsUnchanged, - textChangeRangeNewSpan, - textSpanEnd, - textToKeywordObj, - toArray, - tokenIsIdentifierOrKeyword, - tokenIsIdentifierOrKeywordOrGreaterThan, - tokenToString, - tracing, - trimString, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/path.ts b/src/compiler/path.ts index e87e30aa4c3..b963c9e0cc9 100644 --- a/src/compiler/path.ts +++ b/src/compiler/path.ts @@ -1,18 +1,18 @@ import { CharacterCodes, - Comparison, - Debug, - GetCanonicalFileName, - Path, compareStringsCaseInsensitive, compareStringsCaseSensitive, compareValues, + Comparison, + Debug, endsWith, equateStringsCaseInsensitive, equateStringsCaseSensitive, + GetCanonicalFileName, getStringComparer, identity, lastOrUndefined, + Path, some, startsWith, stringContains, diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index 1076eb2705b..166163784ab 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -1,10 +1,10 @@ import { Debug, + noop, Performance, PerformanceHooks, - System, - noop, sys, + System, timestamp, tryGetNativePerformanceHooks, } from "./_namespaces/ts"; diff --git a/src/compiler/performanceCore.ts b/src/compiler/performanceCore.ts index e124311b376..9e20bddb694 100644 --- a/src/compiler/performanceCore.ts +++ b/src/compiler/performanceCore.ts @@ -1,7 +1,7 @@ import { + isNodeLikeSystem, Version, VersionRange, - isNodeLikeSystem, } from "./_namespaces/ts"; // The following definitions provide the minimum compatible support for the Web Performance User Timings API diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e2f470d144d..f1f67c0e87e 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,123 +1,30 @@ import * as ts from "./_namespaces/ts"; import { - AsExpression, - AssertClause, - BuilderProgram, - CancellationToken, - CommentDirective, - CommentDirectivesMap, - Comparison, - CompilerHost, - CompilerOptions, - CreateProgramOptions, - CreateSourceFileOptions, - CustomTransformers, - Debug, - DeclarationWithTypeParameterChildren, - Diagnostic, - DiagnosticCategory, - DiagnosticMessage, - DiagnosticMessageChain, - DiagnosticReporter, - DiagnosticWithLocation, - Diagnostics, - DirectoryStructureHost, - EmitFlags, - EmitHost, - EmitOnly, - EmitResult, - ExportAssignment, - ExportDeclaration, - Extension, - FileIncludeKind, - FileIncludeReason, - FilePreprocessingDiagnostics, - FilePreprocessingDiagnosticsKind, - FileReference, - FunctionLikeDeclaration, - GetCanonicalFileName, - HasChangedAutomaticTypeDirectiveNames, - HasInvalidatedResolutions, - HeritageClause, - Identifier, - ImportClause, - ImportDeclaration, - ImportOrExportSpecifier, - InputFiles, - JsonSourceFile, - JsxEmit, - MethodDeclaration, - ModifierFlags, - ModifierLike, - ModuleBlock, - ModuleDeclaration, - ModuleKind, - ModuleResolutionCache, - ModuleResolutionHost, - ModuleResolutionInfo, - ModuleResolutionKind, - Mutable, - Node, - NodeArray, - NodeFlags, - NodeWithTypeArguments, - ObjectLiteralExpression, - OperationCanceledException, - PackageId, - PackageJsonInfoCache, - ParameterDeclaration, - ParseConfigFileHost, - ParsedCommandLine, - Path, - Program, - ProgramHost, - ProjectReference, - ProjectReferenceFile, - PropertyDeclaration, - ReferencedFile, - ResolutionMode, - ResolvedConfigFileName, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - SatisfiesExpression, - ScriptKind, - ScriptTarget, - SortedReadonlyArray, - SourceFile, - SourceOfProjectReferenceRedirect, - Statement, - StringLiteral, - StringLiteralLike, - StructureIsReused, - SymlinkCache, - SyntaxKind, - TsConfigSourceFile, - TypeChecker, - TypeReferenceDirectiveResolutionCache, - TypeReferenceDirectiveResolutionInfo, - UnparsedSource, - VariableDeclaration, - VariableStatement, - WriteFileCallback, - WriteFileCallbackData, __String, addEmitFlags, addRange, append, arrayFrom, arrayIsEqualTo, + AsExpression, + AssertClause, + BuilderProgram, + CancellationToken, canHaveModifiers, chainDiagnosticMessages, changeExtension, - changesAffectModuleResolution, changesAffectingProgramStructure, + changesAffectModuleResolution, clone, combinePaths, + CommentDirective, + CommentDirectivesMap, compareDataObjects, comparePaths, compareValues, + Comparison, + CompilerHost, + CompilerOptions, computeLineAndCharacterOfPosition, concatenate, contains, @@ -137,24 +44,49 @@ import { createModeAwareCache, createModuleResolutionCache, createMultiMap, + CreateProgramOptions, createSourceFile, + CreateSourceFileOptions, createSymlinkCache, createTypeChecker, createTypeReferenceDirectiveResolutionCache, + CustomTransformers, + Debug, + DeclarationWithTypeParameterChildren, + Diagnostic, + DiagnosticCategory, diagnosticCategoryName, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticReporter, + Diagnostics, + DiagnosticWithLocation, directorySeparator, + DirectoryStructureHost, emitFiles, + EmitFlags, + EmitHost, + EmitOnly, + EmitResult, emptyArray, ensureTrailingDirectorySeparator, equateStringsCaseInsensitive, equateStringsCaseSensitive, explainIfFileIsRedirectAndImpliedFormat, + ExportAssignment, + ExportDeclaration, + Extension, extensionFromPath, externalHelpersModuleNameText, factory, fileExtensionIs, fileExtensionIsOneOf, + FileIncludeKind, + FileIncludeReason, fileIncludeReasonToDiagnostics, + FilePreprocessingDiagnostics, + FilePreprocessingDiagnosticsKind, + FileReference, filter, find, firstDefined, @@ -168,9 +100,11 @@ import { forEachEmittedFile, forEachEntry, forEachKey, + FunctionLikeDeclaration, getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, getBaseFileName, + GetCanonicalFileName, getCommonSourceDirectoryOfConfig, getDefaultLibFileName, getDirectoryPath, @@ -214,15 +148,23 @@ import { getTsConfigObjectLiteralExpression, getTsConfigPropArray, getTsConfigPropArrayElementValue, + HasChangedAutomaticTypeDirectiveNames, hasChangesInResolutions, hasExtension, + HasInvalidatedResolutions, hasJSDocNodes, hasJSFileExtension, hasJsonModuleEmitEnabled, hasProperty, hasSyntacticModifier, hasZeroOrOneAsteriskCharacter, + HeritageClause, + Identifier, identity, + ImportClause, + ImportDeclaration, + ImportOrExportSpecifier, + InputFiles, inverseJsxOptionMap, isAmbientModule, isAnyImportOrReExport, @@ -241,8 +183,8 @@ import { isImportEqualsDeclaration, isImportSpecifier, isImportTypeNode, - isInJSFile, isIncrementalCompilation, + isInJSFile, isLiteralImportTypeNode, isModifier, isModuleDeclaration, @@ -255,6 +197,8 @@ import { isStringLiteral, isStringLiteralLike, isTraceEnabled, + JsonSourceFile, + JsxEmit, length, libMap, libs, @@ -262,32 +206,70 @@ import { mapDefinedIterator, maybeBind, memoize, + MethodDeclaration, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, moduleResolutionIsEqualTo, - noTransformers, + ModuleResolutionKind, + Mutable, + Node, + NodeArray, + NodeFlags, nodeModulesPathPart, + NodeWithTypeArguments, noop, normalizePath, notImplementedResolver, + noTransformers, + ObjectLiteralExpression, + OperationCanceledException, optionsHaveChanges, outFile, + PackageId, packageIdToPackageName, packageIdToString, + PackageJsonInfoCache, padLeft, + ParameterDeclaration, + ParseConfigFileHost, + ParsedCommandLine, parseIsolatedEntityName, parseJsonSourceFileConfigFileContent, + Path, pathIsAbsolute, pathIsRelative, + Program, + ProgramHost, + ProjectReference, + ProjectReferenceFile, projectReferenceIsEqualTo, + PropertyDeclaration, + ReferencedFile, removeFileExtension, removePrefix, removeSuffix, resolutionExtensionIsTSOrJson, + ResolutionMode, resolveConfigFileProjectName, + ResolvedConfigFileName, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, resolveModuleName, resolveModuleNameFromCache, resolveTypeReferenceDirective, returnFalse, returnUndefined, + SatisfiesExpression, + ScriptKind, + ScriptTarget, setParent, setParentRecursive, setResolvedModule, @@ -296,12 +278,21 @@ import { skipTypeChecking, some, sortAndDeduplicateDiagnostics, + SortedReadonlyArray, + SourceFile, sourceFileAffectingCompilerOptions, sourceFileMayBeEmitted, + SourceOfProjectReferenceRedirect, stableSort, startsWith, + Statement, stringContains, + StringLiteral, + StringLiteralLike, + StructureIsReused, supportedJSExtensionsFlat, + SymlinkCache, + SyntaxKind, sys, targetOptionDeclaration, toFileNameLowerCase, @@ -309,8 +300,17 @@ import { trace, tracing, trimStringEnd, + TsConfigSourceFile, + TypeChecker, typeDirectiveIsEqualTo, + TypeReferenceDirectiveResolutionCache, + TypeReferenceDirectiveResolutionInfo, + UnparsedSource, + VariableDeclaration, + VariableStatement, walkUpParenthesizedExpressions, + WriteFileCallback, + WriteFileCallbackData, writeFileEnsuringDirectories, zipToModeAwareCache, } from "./_namespaces/ts"; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 1f72a2c3367..f63ecc8773f 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,54 +1,35 @@ import * as ts from "./_namespaces/ts"; import { - CacheWithRedirects, - CachedDirectoryStructureHost, - CharacterCodes, - CompilerOptions, - Debug, - Diagnostics, - DirectoryWatcherCallback, - Extension, - FileReference, - FileWatcher, - FileWatcherCallback, - GetCanonicalFileName, - HasInvalidatedResolutions, - MinimalResolutionCacheHost, - ModeAwareCache, - ModuleResolutionCache, - ModuleResolutionHost, - ModuleResolutionInfo, - PackageId, - Path, - PerModuleNameCache, - Program, - ResolutionMode, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, - SourceFile, - TypeReferenceDirectiveResolutionInfo, - WatchDirectoryFlags, arrayToMap, + CachedDirectoryStructureHost, + CacheWithRedirects, + CharacterCodes, clearMap, closeFileWatcher, closeFileWatcherOf, + CompilerOptions, contains, createCacheWithRedirects, createModeAwareCache, createModuleResolutionCache, createMultiMap, createTypeReferenceDirectiveResolutionCache, + Debug, + Diagnostics, directorySeparator, + DirectoryWatcherCallback, emptyArray, emptyIterator, endsWith, + Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, + FileReference, + FileWatcher, + FileWatcherCallback, firstDefinedIterator, + GetCanonicalFileName, getDirectoryPath, getEffectiveTypeRoots, getModeForFileReference, @@ -57,6 +38,7 @@ import { getNormalizedAbsolutePath, getResolutionName, getRootLength, + HasInvalidatedResolutions, ignoredPaths, inferredTypesContainingFile, isEmittedFileOfProgram, @@ -70,21 +52,39 @@ import { length, loadModuleFromGlobalCache, memoize, + MinimalResolutionCacheHost, + ModeAwareCache, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, mutateMap, noopFileWatcher, normalizePath, + PackageId, packageIdToString, parseNodeModuleFromPath, + Path, pathContainsNodeModules, + PerModuleNameCache, + Program, removeSuffix, removeTrailingDirectorySeparator, resolutionExtensionIsTSOrJson, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, returnTrue, some, + SourceFile, startsWith, stringContains, trace, + TypeReferenceDirectiveResolutionInfo, unorderedRemoveItem, + WatchDirectoryFlags, } from "./_namespaces/ts"; /** diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index eec80e9eede..bdb2fe6ef23 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1,30 +1,30 @@ import { + append, + arraysEqual, + binarySearch, CharacterCodes, CommentDirective, CommentDirectiveType, CommentKind, CommentRange, + compareValues, Debug, DiagnosticMessage, Diagnostics, + getEntries, + identity, JSDocSyntaxKind, JsxTokenSyntaxKind, KeywordSyntaxKind, LanguageVariant, LineAndCharacter, MapLike, + parsePseudoBigInt, + positionIsSynthesized, ScriptTarget, SourceFileLike, SyntaxKind, TokenFlags, - append, - arraysEqual, - binarySearch, - compareValues, - getEntries, - identity, - parsePseudoBigInt, - positionIsSynthesized, trimStringStart, } from "./_namespaces/ts"; diff --git a/src/compiler/semver.ts b/src/compiler/semver.ts index 77f34773275..b9c5864c0c0 100644 --- a/src/compiler/semver.ts +++ b/src/compiler/semver.ts @@ -1,8 +1,8 @@ import { - Comparison, - Debug, compareStringsCaseSensitive, compareValues, + Comparison, + Debug, emptyArray, every, isArray, diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 0ee96bf209f..baf87fdd594 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -1,18 +1,14 @@ import { + arrayFrom, + binarySearchKey, CharacterCodes, + combinePaths, + compareValues, Debug, DocumentPosition, DocumentPositionMapper, DocumentPositionMapperHost, EmitHost, - LineAndCharacter, - RawSourceMap, - SortedReadonlyArray, - SourceMapGenerator, - arrayFrom, - binarySearchKey, - combinePaths, - compareValues, emptyArray, every, getDirectoryPath, @@ -22,8 +18,12 @@ import { identity, isArray, isString, + LineAndCharacter, + RawSourceMap, some, sortAndDeduplicate, + SortedReadonlyArray, + SourceMapGenerator, trimStringEnd, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/symbolWalker.ts b/src/compiler/symbolWalker.ts index 70fd4b0d75b..591e19c8eb6 100644 --- a/src/compiler/symbolWalker.ts +++ b/src/compiler/symbolWalker.ts @@ -1,8 +1,12 @@ import { + clear, EntityNameOrEntityNameExpression, + forEach, + getOwnValues, + getSymbolId, Identifier, - IndexType, IndexedAccessType, + IndexType, InterfaceType, MappedType, Node, @@ -20,10 +24,6 @@ import { TypeQueryNode, TypeReference, UnionOrIntersectionType, - clear, - forEach, - getOwnValues, - getSymbolId, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index ab28c7e572c..ba707330ffe 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,26 +1,20 @@ import { AssertionLevel, - Comparison, - Debug, - FileSystemEntries, - Path, - PollingWatchKind, - RequireResult, - WatchDirectoryKind, - WatchFileKind, - WatchOptions, closeFileWatcher, closeFileWatcherOf, combinePaths, + Comparison, contains, containsPath, createGetCanonicalFileName, createMultiMap, + Debug, directorySeparator, emptyArray, emptyFileSystemEntries, endsWith, enumerateInsertsAndDeletes, + FileSystemEntries, getDirectoryPath, getFallbackOptions, getNormalizedAbsolutePath, @@ -31,20 +25,26 @@ import { isNodeLikeSystem, isString, mapDefined, - matchFiles, matchesExclude, + matchFiles, memoize, noop, normalizePath, normalizeSlashes, orderedRemoveItem, + Path, perfLogger, + PollingWatchKind, + RequireResult, resolveJSModule, some, startsWith, stringContains, timestamp, unorderedRemoveItem, + WatchDirectoryKind, + WatchFileKind, + WatchOptions, writeFileEnsuringDirectories, } from "./_namespaces/ts"; diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index 6626294c00b..4f091195827 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -1,9 +1,12 @@ import { + combinePaths, ConditionalType, Debug, EvolvingArrayType, - IndexType, + getLineAndCharacterOfPosition, + getSourceFileOfNode, IndexedAccessType, + IndexType, IntersectionType, LineAndCharacter, Node, @@ -11,15 +14,12 @@ import { Path, ReverseMappedType, SubstitutionType, + timestamp, Type, TypeFlags, TypeReference, - UnionType, - combinePaths, - getLineAndCharacterOfPosition, - getSourceFileOfNode, - timestamp, unescapeLeadingUnderscores, + UnionType, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index eda2672939c..456a23a0655 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,11 +1,16 @@ import { + addRange, + append, Bundle, + chainBundle, CompilerOptions, + createEmitHelperFactory, CustomTransformer, CustomTransformerFactory, CustomTransformers, Debug, DiagnosticWithLocation, + disposeEmitNodes, EmitFlags, EmitHelper, EmitHint, @@ -13,48 +18,42 @@ import { EmitOnly, EmitResolver, EmitTransformers, - FunctionDeclaration, - Identifier, - LexicalEnvironmentFlags, - ModuleKind, - Node, - NodeFactory, - NodeFlags, - ScriptTarget, - SourceFile, - Statement, - SyntaxKind, - TransformationContext, - TransformationResult, - Transformer, - TransformerFactory, - VariableDeclaration, - addRange, - append, - chainBundle, - createEmitHelperFactory, - disposeEmitNodes, emptyArray, factory, + FunctionDeclaration, getEmitFlags, getEmitModuleKind, getEmitScriptTarget, getJSXTransformEnabled, getParseTreeNode, getSourceFileOfNode, + Identifier, isBundle, isSourceFile, + LexicalEnvironmentFlags, map, memoize, + ModuleKind, + Node, + NodeFactory, + NodeFlags, noop, notImplemented, returnUndefined, + ScriptTarget, setEmitFlags, some, + SourceFile, + Statement, + SyntaxKind, tracing, + TransformationContext, + TransformationResult, transformClassFields, transformDeclarations, transformECMAScriptModule, + Transformer, + TransformerFactory, transformES2015, transformES2016, transformES2017, @@ -71,6 +70,7 @@ import { transformNodeModule, transformSystemModule, transformTypeScript, + VariableDeclaration, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 4a150992b04..239a7e12545 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -1,5 +1,10 @@ import { + __String, AccessorDeclaration, + addEmitFlags, + addEmitHelpers, + addRange, + append, AssignmentOperator, AssignmentPattern, AutoAccessorPropertyDeclaration, @@ -7,72 +12,37 @@ import { BindingOrAssignmentElement, Bundle, CallExpression, + chainBundle, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, + classOrConstructorParameterIsDecorated, ClassStaticBlockDeclaration, + compact, ComputedPropertyName, ConstructorDeclaration, + createAccessorPropertyBackingField, + createAccessorPropertyGetRedirector, + createAccessorPropertySetRedirector, + createMemberAccessForPropertyName, Debug, ElementAccessExpression, EmitFlags, EmitHint, + expandPreOrPostfixIncrementOrDecrementExpression, Expression, ExpressionStatement, ExpressionWithTypeArguments, + factory, + filter, + findSuperStatementIndex, ForStatement, GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, GetAccessorDeclaration, - Identifier, - InKeyword, - LeftHandSideExpression, - MethodDeclaration, - Modifier, - ModifierFlags, - Node, - NodeCheckFlags, - ObjectLiteralElementLike, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrivateIdentifier, - PrivateIdentifierPropertyAccessExpression, - PrivateIdentifierPropertyDeclaration, - PropertyAccessExpression, - PropertyDeclaration, - PropertyName, - ScriptTarget, - SetAccessorDeclaration, - SourceFile, - Statement, - SuperProperty, - SyntaxKind, - TaggedTemplateExpression, - ThisExpression, - TransformFlags, - TransformationContext, - UnderscoreEscapedMap, - VariableStatement, - VisitResult, - __String, - addEmitFlags, - addEmitHelpers, - addRange, - append, - chainBundle, - classOrConstructorParameterIsDecorated, - compact, - createAccessorPropertyBackingField, - createAccessorPropertyGetRedirector, - createAccessorPropertySetRedirector, - createMemberAccessForPropertyName, - expandPreOrPostfixIncrementOrDecrementExpression, - factory, - filter, - findSuperStatementIndex, getCommentRange, getEffectiveBaseTypeNode, getEmitFlags, @@ -93,6 +63,8 @@ import { hasDecorators, hasStaticModifier, hasSyntacticModifier, + Identifier, + InKeyword, isAccessorModifier, isArrayLiteralExpression, isArrowFunction, @@ -145,10 +117,27 @@ import { isSuperProperty, isTemplateLiteral, isThisProperty, + LeftHandSideExpression, map, + MethodDeclaration, + Modifier, + ModifierFlags, moveRangePastModifiers, moveRangePos, + Node, + NodeCheckFlags, nodeIsSynthesized, + ObjectLiteralElementLike, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PrivateIdentifierPropertyAccessExpression, + PrivateIdentifierPropertyDeclaration, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + ScriptTarget, + SetAccessorDeclaration, setCommentRange, setEmitFlags, setOriginalNode, @@ -160,9 +149,19 @@ import { skipParentheses, skipPartiallyEmittedExpressions, some, + SourceFile, startOnNewLine, + Statement, + SuperProperty, + SyntaxKind, + TaggedTemplateExpression, + ThisExpression, + TransformationContext, + TransformFlags, tryGetTextOfPropertyName, + UnderscoreEscapedMap, unescapeLeadingUnderscores, + VariableStatement, visitArray, visitEachChild, visitFunctionBody, @@ -170,6 +169,7 @@ import { visitNode, visitNodes, visitParameterList, + VisitResult, } from "../_namespaces/ts"; const enum ClassPropertySubstitutionFlags { diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 665c2ecded6..a150c920465 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,95 +1,27 @@ import { AccessorDeclaration, + addRelatedInfo, AllAccessorDeclarations, AnyImportSyntax, + append, ArrayBindingElement, + arrayFrom, AssertClause, BindingElement, BindingName, BindingPattern, Bundle, CallSignatureDeclaration, - ClassDeclaration, - CommentRange, - ConditionalTypeNode, - ConstructSignatureDeclaration, - ConstructorDeclaration, - ConstructorTypeNode, - Debug, - Declaration, - DeclarationDiagnosticProducing, - DeclarationName, - DiagnosticWithLocation, - Diagnostics, - EmitFlags, - EmitHost, - EmitResolver, - EntityNameOrEntityNameExpression, - EnumDeclaration, - ExportAssignment, - ExportDeclaration, - ExpressionWithTypeArguments, - FileReference, - FunctionDeclaration, - FunctionTypeNode, - GeneratedIdentifierFlags, - GetAccessorDeclaration, - GetSymbolAccessibilityDiagnostic, - HasModifiers, - HeritageClause, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - ImportTypeNode, - IndexSignatureDeclaration, - InterfaceDeclaration, - LateBoundDeclaration, - LateVisibilityPaintedStatement, - MethodDeclaration, - MethodSignature, - Modifier, - ModifierFlags, - ModuleBody, - ModuleDeclaration, - NamedDeclaration, - NamespaceDeclaration, - Node, - NodeArray, - NodeBuilderFlags, - NodeFlags, - NodeId, - OmittedExpression, - ParameterDeclaration, - PropertyDeclaration, - PropertySignature, - ResolutionMode, - SetAccessorDeclaration, - SignatureDeclaration, - SourceFile, - Statement, - StringLiteral, - Symbol, - SymbolAccessibility, - SymbolAccessibilityResult, - SymbolFlags, - SymbolTracker, - SyntaxKind, - TransformationContext, - TypeAliasDeclaration, - TypeNode, - TypeParameterDeclaration, - TypeReferenceNode, - UnparsedSource, - VariableDeclaration, - VariableStatement, - VisitResult, - addRelatedInfo, - append, - arrayFrom, canHaveModifiers, canProduceDiagnostics, + ClassDeclaration, + CommentRange, compact, concatenate, + ConditionalTypeNode, + ConstructorDeclaration, + ConstructorTypeNode, + ConstructSignatureDeclaration, contains, createDiagnosticForNode, createEmptyExports, @@ -97,13 +29,32 @@ import { createGetSymbolAccessibilityDiagnosticForNodeName, createSymbolTable, createUnparsedSourceFile, + Debug, + Declaration, + DeclarationDiagnosticProducing, + DeclarationName, declarationNameToString, + Diagnostics, + DiagnosticWithLocation, + EmitFlags, + EmitHost, + EmitResolver, emptyArray, + EntityNameOrEntityNameExpression, + EnumDeclaration, + ExportAssignment, + ExportDeclaration, + ExpressionWithTypeArguments, factory, + FileReference, filter, flatMap, flatten, forEach, + FunctionDeclaration, + FunctionTypeNode, + GeneratedIdentifierFlags, + GetAccessorDeclaration, getCommentRange, getDirectoryPath, getEffectiveBaseTypeNode, @@ -123,6 +74,7 @@ import { getResolvedExternalModuleName, getSetAccessorValueParameter, getSourceFileOfNode, + GetSymbolAccessibilityDiagnostic, getTextOfNode, getThisParameter, getTrailingCommentRanges, @@ -130,7 +82,15 @@ import { hasEffectiveModifier, hasExtension, hasJSDocNodes, + HasModifiers, hasSyntacticModifier, + HeritageClause, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportTypeNode, + IndexSignatureDeclaration, + InterfaceDeclaration, isAnyImportSyntax, isArray, isBindingPattern, @@ -181,35 +141,75 @@ import { isTypeQueryNode, isUnparsedSource, last, + LateBoundDeclaration, + LateVisibilityPaintedStatement, length, map, mapDefined, + MethodDeclaration, + MethodSignature, + Modifier, + ModifierFlags, + ModuleBody, + ModuleDeclaration, + NamedDeclaration, + NamespaceDeclaration, needsScopeMarker, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + NodeId, normalizeSlashes, + OmittedExpression, orderedRemoveItem, + ParameterDeclaration, parseNodeFactory, pathContainsNodeModules, pathIsRelative, + PropertyDeclaration, + PropertySignature, pushIfUnique, removeAllComments, + ResolutionMode, + SetAccessorDeclaration, setCommentRange, setEmitFlags, setOriginalNode, setParent, setTextRange, + SignatureDeclaration, skipTrivia, some, + SourceFile, startsWith, + Statement, stringContains, + StringLiteral, + Symbol, + SymbolAccessibility, + SymbolAccessibilityResult, + SymbolFlags, + SymbolTracker, + SyntaxKind, toFileNameLowerCase, toPath, + TransformationContext, transformNodes, tryCast, + TypeAliasDeclaration, + TypeNode, + TypeParameterDeclaration, + TypeReferenceNode, unescapeLeadingUnderscores, + UnparsedSource, + VariableDeclaration, + VariableStatement, visitArray, visitEachChild, visitNode, visitNodes, + VisitResult, } from "../_namespaces/ts"; import * as moduleSpecifiers from "../_namespaces/ts.moduleSpecifiers"; diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index ca62ec25c82..021a3721230 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -1,8 +1,8 @@ import { BindingElement, CallSignatureDeclaration, - ConstructSignatureDeclaration, ConstructorDeclaration, + ConstructSignatureDeclaration, Debug, Declaration, DeclarationName, @@ -11,8 +11,34 @@ import { ExpressionWithTypeArguments, FunctionDeclaration, GetAccessorDeclaration, + getNameOfDeclaration, + hasSyntacticModifier, ImportEqualsDeclaration, IndexSignatureDeclaration, + isBindingElement, + isCallSignatureDeclaration, + isClassDeclaration, + isConstructorDeclaration, + isConstructSignatureDeclaration, + isExpressionWithTypeArguments, + isFunctionDeclaration, + isGetAccessor, + isHeritageClause, + isImportEqualsDeclaration, + isIndexSignatureDeclaration, + isJSDocTypeAlias, + isMethodDeclaration, + isMethodSignature, + isParameter, + isParameterPropertyDeclaration, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertySignature, + isSetAccessor, + isStatic, + isTypeAliasDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, JSDocCallbackTag, JSDocEnumTag, JSDocTypedefTag, @@ -33,32 +59,6 @@ import { TypeAliasDeclaration, TypeParameterDeclaration, VariableDeclaration, - getNameOfDeclaration, - hasSyntacticModifier, - isBindingElement, - isCallSignatureDeclaration, - isClassDeclaration, - isConstructSignatureDeclaration, - isConstructorDeclaration, - isExpressionWithTypeArguments, - isFunctionDeclaration, - isGetAccessor, - isHeritageClause, - isImportEqualsDeclaration, - isIndexSignatureDeclaration, - isJSDocTypeAlias, - isMethodDeclaration, - isMethodSignature, - isParameter, - isParameterPropertyDeclaration, - isPropertyAccessExpression, - isPropertyDeclaration, - isPropertySignature, - isSetAccessor, - isStatic, - isTypeAliasDeclaration, - isTypeParameterDeclaration, - isVariableDeclaration, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index 0f3044b6346..2effd35cfc6 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -1,4 +1,7 @@ import { + __String, + addRange, + append, ArrayBindingElement, ArrayBindingOrAssignmentPattern, BindingElement, @@ -9,23 +12,8 @@ import { Debug, DestructuringAssignment, ElementAccessExpression, - Expression, - Identifier, - LeftHandSideExpression, - Node, - NodeFactory, - ObjectBindingOrAssignmentPattern, - ParameterDeclaration, - PropertyName, - TextRange, - TransformFlags, - TransformationContext, - VariableDeclaration, - VisitResult, - __String, - addRange, - append, every, + Expression, factory, forEach, getElementsOfBindingOrAssignmentPattern, @@ -33,6 +21,7 @@ import { getPropertyNameOfBindingOrAssignmentElement, getRestIndicatorOfBindingOrAssignmentElement, getTargetOfBindingOrAssignmentElement, + Identifier, idText, isArrayBindingElement, isArrayBindingOrAssignmentPattern, @@ -54,12 +43,23 @@ import { isStringOrNumericLiteralLike, isVariableDeclaration, last, + LeftHandSideExpression, map, + Node, + NodeFactory, nodeIsSynthesized, + ObjectBindingOrAssignmentPattern, + ParameterDeclaration, + PropertyName, setTextRange, some, + TextRange, + TransformationContext, + TransformFlags, tryGetPropertyNameOfBindingOrAssignmentElement, + VariableDeclaration, visitNode, + VisitResult, } from "../_namespaces/ts"; interface FlattenContext { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index f36deb1aa58..ab5ea56408a 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1,6 +1,12 @@ import { + __String, AccessorDeclaration, + addEmitHelpers, + addRange, + addSyntheticLeadingComment, AllAccessorDeclarations, + append, + arrayIsEqualTo, ArrayLiteralExpression, ArrowFunction, BinaryExpression, @@ -12,22 +18,38 @@ import { CallExpression, CaseBlock, CaseClause, + cast, CatchClause, + chainBundle, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, CommaListExpression, ComputedPropertyName, + concatenate, ConstructorDeclaration, + createExpressionForPropertyName, + createMemberAccessForPropertyName, + createRange, + createTokenRange, Debug, Declaration, DoStatement, + elementAt, EmitFlags, EmitHint, + emptyArray, Expression, ExpressionStatement, ExpressionWithTypeArguments, + filter, + first, + firstOrUndefined, + flatMap, + flatten, + flattenDestructuringAssignment, + flattenDestructuringBinding, FlattenLevel, ForInStatement, ForOfStatement, @@ -37,73 +59,6 @@ import { FunctionExpression, FunctionLikeDeclaration, GeneratedIdentifierFlags, - Identifier, - IfStatement, - IterationStatement, - LabeledStatement, - LeftHandSideExpression, - LiteralExpression, - MetaProperty, - MethodDeclaration, - ModifierFlags, - NamedDeclaration, - NewExpression, - Node, - NodeArray, - NodeCheckFlags, - NodeFlags, - NumericLiteral, - ObjectLiteralElementLike, - ObjectLiteralExpression, - ParameterDeclaration, - ParenthesizedExpression, - PrimaryExpression, - ProcessLevel, - PropertyAssignment, - ReturnStatement, - SemicolonClassElement, - ShorthandPropertyAssignment, - SourceFile, - SpreadElement, - Statement, - StringLiteral, - SwitchStatement, - SyntaxKind, - TaggedTemplateExpression, - TemplateExpression, - TextRange, - TokenFlags, - TransformFlags, - TransformationContext, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, - VisitResult, - VoidExpression, - WhileStatement, - YieldExpression, - __String, - addEmitHelpers, - addRange, - addSyntheticLeadingComment, - append, - arrayIsEqualTo, - cast, - chainBundle, - concatenate, - createExpressionForPropertyName, - createMemberAccessForPropertyName, - createRange, - createTokenRange, - elementAt, - emptyArray, - filter, - first, - firstOrUndefined, - flatMap, - flatten, - flattenDestructuringAssignment, - flattenDestructuringBinding, getAllAccessorDeclarations, getClassExtendsHeritageElement, getCombinedNodeFlags, @@ -119,7 +74,9 @@ import { getUseDefineForClassFields, hasStaticModifier, hasSyntacticModifier, + Identifier, idText, + IfStatement, insertStatementAfterCustomPrologue, insertStatementsAfterCustomPrologue, insertStatementsAfterStandardPrologue, @@ -171,15 +128,38 @@ import { isVariableDeclarationList, isVariableStatement, isWithStatement, + IterationStatement, + LabeledStatement, last, lastOrUndefined, + LeftHandSideExpression, + LiteralExpression, map, + MetaProperty, + MethodDeclaration, + ModifierFlags, moveRangeEnd, moveRangePos, moveSyntheticComments, + NamedDeclaration, + NewExpression, + Node, + NodeArray, + NodeCheckFlags, + NodeFlags, nodeIsSynthesized, + NumericLiteral, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, + ParenthesizedExpression, + PrimaryExpression, + ProcessLevel, processTaggedTemplateExpression, + PropertyAssignment, rangeEndIsOnSameLineAsRangeStart, + ReturnStatement, + SemicolonClassElement, setCommentRange, setEmitFlags, setOriginalNode, @@ -189,21 +169,41 @@ import { setTextRangeEnd, setTextRangePos, setTokenSourceMapRange, + ShorthandPropertyAssignment, singleOrMany, singleOrUndefined, skipOuterExpressions, skipTrivia, some, + SourceFile, spanMap, + SpreadElement, startOnNewLine, + Statement, + StringLiteral, + SwitchStatement, + SyntaxKind, + TaggedTemplateExpression, takeWhile, + TemplateExpression, + TextRange, + TokenFlags, + TransformationContext, + TransformFlags, tryCast, unescapeLeadingUnderscores, unwrapInnermostStatementOfLabel, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, visitEachChild, visitNode, visitNodes, visitParameterList, + VisitResult, + VoidExpression, + WhileStatement, + YieldExpression, } from "../_namespaces/ts"; const enum ES2015SubstitutionFlags { diff --git a/src/compiler/transformers/es2016.ts b/src/compiler/transformers/es2016.ts index ce6353ff8b0..33df5b94f0d 100644 --- a/src/compiler/transformers/es2016.ts +++ b/src/compiler/transformers/es2016.ts @@ -1,20 +1,20 @@ import { BinaryExpression, Bundle, - Expression, - Node, - SourceFile, - SyntaxKind, - TransformFlags, - TransformationContext, - VisitResult, chainBundle, + Expression, isElementAccessExpression, isExpression, isPropertyAccessExpression, + Node, setTextRange, + SourceFile, + SyntaxKind, + TransformationContext, + TransformFlags, visitEachChild, visitNode, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index e38bcab3393..4c7a90fa694 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -1,13 +1,20 @@ import { + __String, AccessorDeclaration, + addEmitHelper, + addEmitHelpers, + advancedAsyncSuperHelper, ArrowFunction, + asyncSuperHelper, AwaitExpression, BindingElement, Block, Bundle, CallExpression, CatchClause, + chainBundle, ClassDeclaration, + concatenate, ConciseBody, ConstructorDeclaration, Debug, @@ -16,8 +23,9 @@ import { EmitHint, EmitResolver, Expression, - ForInStatement, + forEach, ForInitializer, + ForInStatement, ForOfStatement, ForStatement, FunctionBody, @@ -27,37 +35,6 @@ import { FunctionLikeDeclaration, GeneratedIdentifierFlags, GetAccessorDeclaration, - LeftHandSideExpression, - MethodDeclaration, - Node, - NodeCheckFlags, - NodeFactory, - NodeFlags, - ParameterDeclaration, - PropertyAccessExpression, - PropertyAssignment, - ScriptTarget, - SetAccessorDeclaration, - SourceFile, - Statement, - SyntaxKind, - TextRange, - TransformFlags, - TransformationContext, - TypeNode, - TypeReferenceSerializationKind, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, - VisitResult, - __String, - addEmitHelper, - addEmitHelpers, - advancedAsyncSuperHelper, - asyncSuperHelper, - chainBundle, - concatenate, - forEach, getEmitScriptTarget, getEntityNameFromTypeNode, getFunctionFlags, @@ -82,19 +59,42 @@ import { isSuperProperty, isToken, isVariableDeclarationList, + LeftHandSideExpression, map, + MethodDeclaration, + Node, + NodeCheckFlags, + NodeFactory, + NodeFlags, + ParameterDeclaration, + PropertyAccessExpression, + PropertyAssignment, + ScriptTarget, + SetAccessorDeclaration, setEmitFlags, setOriginalNode, setSourceMapRange, setTextRange, some, + SourceFile, + Statement, + SyntaxKind, + TextRange, + TransformationContext, + TransformFlags, + TypeNode, + TypeReferenceSerializationKind, unescapeLeadingUnderscores, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, visitEachChild, visitFunctionBody, visitIterationBody, visitNode, visitNodes, visitParameterList, + VisitResult, } from "../_namespaces/ts"; type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration; diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index f3144fc4ee9..296cfaeae2f 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -1,20 +1,34 @@ import { + __String, AccessorDeclaration, + addEmitFlags, + addEmitHelper, + addEmitHelpers, + addRange, + advancedAsyncSuperHelper, + append, ArrowFunction, + asyncSuperHelper, AwaitExpression, BinaryExpression, Bundle, CallExpression, CatchClause, + chainBundle, CommaListExpression, + concatenate, ConciseBody, ConstructorDeclaration, + createForOfBindingStatement, + createSuperAccessVariableStatement, Debug, ElementAccessExpression, EmitFlags, EmitHint, Expression, ExpressionStatement, + flattenDestructuringAssignment, + flattenDestructuringBinding, FlattenLevel, ForInitializer, ForOfStatement, @@ -26,55 +40,11 @@ import { FunctionLikeDeclaration, GeneratedIdentifierFlags, GetAccessorDeclaration, - Identifier, - LabeledStatement, - LeftHandSideExpression, - MethodDeclaration, - ModifierFlags, - Node, - NodeCheckFlags, - NodeFlags, - ObjectLiteralElementLike, - ObjectLiteralExpression, - ParameterDeclaration, - ParenthesizedExpression, - ProcessLevel, - PropertyAccessExpression, - ReturnStatement, - ScriptTarget, - SetAccessorDeclaration, - SignatureDeclaration, - SourceFile, - Statement, - SyntaxKind, - TaggedTemplateExpression, - TextRange, - Token, - TransformFlags, - TransformationContext, - VariableDeclaration, - VariableStatement, - VisitResult, - VoidExpression, - YieldExpression, - __String, - addEmitFlags, - addEmitHelper, - addEmitHelpers, - addRange, - advancedAsyncSuperHelper, - append, - asyncSuperHelper, - chainBundle, - concatenate, - createForOfBindingStatement, - createSuperAccessVariableStatement, - flattenDestructuringAssignment, - flattenDestructuringBinding, getEmitScriptTarget, getFunctionFlags, getNodeId, hasSyntacticModifier, + Identifier, insertStatementsAfterStandardPrologue, isAssignmentPattern, isBindingPattern, @@ -95,21 +65,51 @@ import { isSuperProperty, isToken, isVariableDeclarationList, + LabeledStatement, + LeftHandSideExpression, + MethodDeclaration, + ModifierFlags, + Node, + NodeCheckFlags, + NodeFlags, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, + ParenthesizedExpression, + ProcessLevel, processTaggedTemplateExpression, + PropertyAccessExpression, + ReturnStatement, + ScriptTarget, + SetAccessorDeclaration, setEmitFlags, setOriginalNode, setSourceMapRange, setTextRange, + SignatureDeclaration, skipParentheses, some, + SourceFile, startOnNewLine, + Statement, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + Token, + TransformationContext, + TransformFlags, unwrapInnermostStatementOfLabel, + VariableDeclaration, + VariableStatement, visitEachChild, visitIterationBody, visitLexicalEnvironment, visitNode, visitNodes, visitParameterList, + VisitResult, + VoidExpression, + YieldExpression, } from "../_namespaces/ts"; const enum ESNextSubstitutionFlags { diff --git a/src/compiler/transformers/es2019.ts b/src/compiler/transformers/es2019.ts index 921c13c4be8..0bd2be45422 100644 --- a/src/compiler/transformers/es2019.ts +++ b/src/compiler/transformers/es2019.ts @@ -1,16 +1,16 @@ import { Bundle, CatchClause, + chainBundle, + isBlock, Node, SourceFile, SyntaxKind, - TransformFlags, TransformationContext, - VisitResult, - chainBundle, - isBlock, + TransformFlags, visitEachChild, visitNode, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2020.ts b/src/compiler/transformers/es2020.ts index dae72e5bef7..b030dca03ce 100644 --- a/src/compiler/transformers/es2020.ts +++ b/src/compiler/transformers/es2020.ts @@ -1,24 +1,15 @@ import { AccessExpression, + addEmitFlags, BinaryExpression, Bundle, CallExpression, + cast, + chainBundle, Debug, DeleteExpression, EmitFlags, Expression, - Node, - OptionalChain, - OuterExpressionKinds, - ParenthesizedExpression, - SourceFile, - SyntaxKind, - TransformFlags, - TransformationContext, - VisitResult, - addEmitFlags, - cast, - chainBundle, isCallChain, isExpression, isGeneratedIdentifier, @@ -29,13 +20,22 @@ import { isSimpleCopiableExpression, isSyntheticReference, isTaggedTemplateExpression, + Node, + OptionalChain, + OuterExpressionKinds, + ParenthesizedExpression, setOriginalNode, setTextRange, skipParentheses, skipPartiallyEmittedExpressions, + SourceFile, + SyntaxKind, + TransformationContext, + TransformFlags, visitEachChild, visitNode, visitNodes, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2021.ts b/src/compiler/transformers/es2021.ts index 903adf52ea4..c521cf00bc7 100644 --- a/src/compiler/transformers/es2021.ts +++ b/src/compiler/transformers/es2021.ts @@ -2,14 +2,6 @@ import { AssignmentExpression, BinaryExpression, Bundle, - LogicalOrCoalescingAssignmentOperator, - Node, - SourceFile, - SyntaxKind, - Token, - TransformFlags, - TransformationContext, - VisitResult, chainBundle, getNonAssignmentOperatorForCompoundAssignment, isAccessExpression, @@ -18,9 +10,17 @@ import { isLogicalOrCoalescingAssignmentExpression, isPropertyAccessExpression, isSimpleCopiableExpression, + LogicalOrCoalescingAssignmentOperator, + Node, skipParentheses, + SourceFile, + SyntaxKind, + Token, + TransformationContext, + TransformFlags, visitEachChild, visitNode, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts index d4f04641852..199cfa58232 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -1,28 +1,28 @@ import { Bundle, + chainBundle, EmitHint, Expression, - Identifier, - JsxClosingElement, - JsxEmit, - JsxOpeningElement, - JsxSelfClosingElement, - Node, - PropertyAccessExpression, - PropertyAssignment, - SourceFile, - SyntaxKind, - TransformationContext, - chainBundle, getOriginalNodeId, + Identifier, idText, isIdentifier, isPrivateIdentifier, isPropertyAccessExpression, isPropertyAssignment, + JsxClosingElement, + JsxEmit, + JsxOpeningElement, + JsxSelfClosingElement, + Node, nodeIsSynthesized, + PropertyAccessExpression, + PropertyAssignment, setTextRange, + SourceFile, stringToToken, + SyntaxKind, + TransformationContext, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index bf56eec9b07..730958dae1e 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -1,12 +1,12 @@ import { Bundle, + chainBundle, Node, SourceFile, - TransformFlags, TransformationContext, - VisitResult, - chainBundle, + TransformFlags, visitEachChild, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index c8265d760f6..86abe24d056 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -1,5 +1,7 @@ import { AccessorDeclaration, + addEmitHelpers, + addSyntheticTrailingComment, ArrayLiteralExpression, Associativity, BinaryExpression, @@ -8,9 +10,11 @@ import { Bundle, CallExpression, CaseClause, + chainBundle, CommaListExpression, ConditionalExpression, ContinueStatement, + createExpressionForObjectLiteralElementLike, Debug, DoStatement, ElementAccessExpression, @@ -18,46 +22,11 @@ import { EmitHint, Expression, ExpressionStatement, + forEach, ForInStatement, ForStatement, FunctionDeclaration, FunctionExpression, - Identifier, - IfStatement, - InitializedVariableDeclaration, - LabeledStatement, - LeftHandSideExpression, - LiteralExpression, - Mutable, - NewExpression, - Node, - NodeArray, - NumericLiteral, - ObjectLiteralElementLike, - ObjectLiteralExpression, - PropertyAccessExpression, - ReturnStatement, - SourceFile, - Statement, - SwitchStatement, - SyntaxKind, - TextRange, - ThrowStatement, - TransformFlags, - TransformationContext, - TryStatement, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, - VisitResult, - WhileStatement, - WithStatement, - YieldExpression, - addEmitHelpers, - addSyntheticTrailingComment, - chainBundle, - createExpressionForObjectLiteralElementLike, - forEach, getEmitFlags, getEmitScriptTarget, getExpressionAssociativity, @@ -65,7 +34,10 @@ import { getNonAssignmentOperatorForCompoundAssignment, getOriginalNode, getOriginalNodeId, + Identifier, idText, + IfStatement, + InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, isBinaryExpression, isBlock, @@ -80,21 +52,49 @@ import { isObjectLiteralElementLike, isStatement, isVariableDeclarationList, + LabeledStatement, lastOrUndefined, + LeftHandSideExpression, + LiteralExpression, map, + Mutable, + NewExpression, + Node, + NodeArray, + NumericLiteral, + ObjectLiteralElementLike, + ObjectLiteralExpression, + PropertyAccessExpression, reduceLeft, + ReturnStatement, setCommentRange, setEmitFlags, setOriginalNode, setParent, setSourceMapRange, setTextRange, + SourceFile, startOnNewLine, + Statement, + SwitchStatement, + SyntaxKind, + TextRange, + ThrowStatement, + TransformationContext, + TransformFlags, + TryStatement, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, visitEachChild, visitIterationBody, visitNode, visitNodes, visitParameterList, + VisitResult, + WhileStatement, + WithStatement, + YieldExpression, } from "../_namespaces/ts"; // Transforms generator functions into a compatible ES5 representation with similar runtime diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 34797c4d5ce..2dab57966ee 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -1,47 +1,19 @@ import { - Bundle, - Debug, - Expression, - GeneratedIdentifierFlags, - Identifier, - ImportSpecifier, - JsxAttribute, - JsxAttributeValue, - JsxChild, - JsxElement, - JsxEmit, - JsxExpression, - JsxFragment, - JsxOpeningFragment, - JsxOpeningLikeElement, - JsxSelfClosingElement, - JsxSpreadAttribute, - JsxText, - Node, - NodeFlags, - PropertyAssignment, - ScriptTarget, - SourceFile, - SpreadAssignment, - Statement, - StringLiteral, - SyntaxKind, - TextRange, - TransformFlags, - TransformationContext, - VariableDeclaration, - VisitResult, addEmitHelpers, arrayFrom, + Bundle, chainBundle, createExpressionForJsxElement, createExpressionForJsxFragment, createExpressionFromEntityName, createJsxFactoryExpression, + Debug, emptyArray, + Expression, filter, find, flatten, + GeneratedIdentifierFlags, getEmitScriptTarget, getEntries, getJSXImplicitImportBase, @@ -49,7 +21,9 @@ import { getLineAndCharacterOfPosition, getOriginalNode, getSemanticJsxChildren, + Identifier, idText, + ImportSpecifier, insertStatementAfterCustomPrologue, isExpression, isExternalModule, @@ -65,17 +39,43 @@ import { isSourceFile, isStringDoubleQuoted, isWhiteSpaceSingleLine, + JsxAttribute, + JsxAttributeValue, + JsxChild, + JsxElement, + JsxEmit, + JsxExpression, + JsxFragment, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxText, length, map, mapDefined, + Node, + NodeFlags, + PropertyAssignment, + ScriptTarget, setParentRecursive, setTextRange, singleOrUndefined, + SourceFile, spanMap, + SpreadAssignment, startOnNewLine, + Statement, + StringLiteral, + SyntaxKind, + TextRange, + TransformationContext, + TransformFlags, utf16EncodeAsString, + VariableDeclaration, visitEachChild, visitNode, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index 40515d2f505..976e0705e73 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -1,44 +1,27 @@ import { + addEmitHelpers, + addRange, AllDecorators, + append, Bundle, + canHaveDecorators, + chainBundle, + childIsDecorated, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, + classOrConstructorParameterIsDecorated, ConstructorDeclaration, Decorator, + elideNodes, EmitFlags, EmitHint, EnumMember, Expression, - GetAccessorDeclaration, - Identifier, - MethodDeclaration, - ModifierFlags, - Node, - NodeArray, - NodeCheckFlags, - NodeFlags, - ParameterDeclaration, - PropertyDeclaration, - ScriptTarget, - SetAccessorDeclaration, - SourceFile, - Statement, - SyntaxKind, - TransformFlags, - TransformationContext, - VisitResult, - addEmitHelpers, - addRange, - append, - canHaveDecorators, - chainBundle, - childIsDecorated, - classOrConstructorParameterIsDecorated, - elideNodes, filter, flatMap, + GetAccessorDeclaration, getAllDecoratorsOfClass, getAllDecoratorsOfClassElement, getEmitFlags, @@ -47,6 +30,7 @@ import { hasAccessorModifier, hasDecorators, hasSyntacticModifier, + Identifier, idText, isBindingName, isBlock, @@ -65,8 +49,18 @@ import { isSimpleInlineableExpression, isStatic, map, + MethodDeclaration, + ModifierFlags, moveRangePastModifiers, + Node, + NodeArray, + NodeCheckFlags, + NodeFlags, nodeOrChildIsDecorated, + ParameterDeclaration, + PropertyDeclaration, + ScriptTarget, + SetAccessorDeclaration, setCommentRange, setEmitFlags, setOriginalNode, @@ -74,9 +68,15 @@ import { setTextRange, singleOrMany, some, + SourceFile, + Statement, + SyntaxKind, + TransformationContext, + TransformFlags, visitEachChild, visitNode, visitNodes, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/esnextAnd2015.ts b/src/compiler/transformers/module/esnextAnd2015.ts index 312c70d3bba..c6d065a77b8 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -1,5 +1,10 @@ import { + addRange, + append, Bundle, + chainBundle, + createEmptyExports, + createExternalHelpersImportDeclarationIfNeeded, Debug, EmitFlags, EmitHint, @@ -7,31 +12,15 @@ import { ExportDeclaration, Expression, GeneratedIdentifierFlags, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - ModifierFlags, - ModuleKind, - Node, - NodeFlags, - ScriptTarget, - SourceFile, - Statement, - SyntaxKind, - TransformationContext, - VariableStatement, - VisitResult, - addRange, - append, - chainBundle, - createEmptyExports, - createExternalHelpersImportDeclarationIfNeeded, getEmitFlags, getEmitModuleKind, getEmitScriptTarget, getExternalModuleNameLiteral, hasSyntacticModifier, + Identifier, idText, + ImportDeclaration, + ImportEqualsDeclaration, insertStatementsAfterCustomPrologue, isExportNamespaceAsDefaultDeclaration, isExternalModule, @@ -41,12 +30,23 @@ import { isNamespaceExport, isSourceFile, isStatement, + ModifierFlags, + ModuleKind, + Node, + NodeFlags, + ScriptTarget, setOriginalNode, setTextRange, singleOrMany, some, + SourceFile, + Statement, + SyntaxKind, + TransformationContext, + VariableStatement, visitEachChild, visitNodes, + VisitResult, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 706b1f857f8..adedbd12817 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,71 +1,41 @@ import { + addEmitFlags, + addEmitHelper, + addEmitHelpers, + addRange, + append, ArrowFunction, BinaryExpression, BindingElement, Bundle, CallExpression, + chainBundle, ClassDeclaration, + collectExternalModuleInfo, Debug, Declaration, DestructuringAssignment, EmitFlags, EmitHelper, EmitHint, + emptyArray, EndOfDeclarationMarker, ExportAssignment, ExportDeclaration, Expression, ExpressionStatement, ExternalModuleInfo, + firstOrUndefined, + flattenDestructuringAssignment, FlattenLevel, ForStatement, FunctionDeclaration, FunctionExpression, GeneratedIdentifierFlags, - Identifier, - ImportCall, - ImportDeclaration, - ImportEqualsDeclaration, - InitializedVariableDeclaration, - MergeDeclarationMarker, - Modifier, - ModifierFlags, - ModuleKind, - Node, - NodeArray, - NodeFlags, - ObjectLiteralElementLike, - ParameterDeclaration, - ParenthesizedExpression, - PartiallyEmittedExpression, - PostfixUnaryExpression, - PrefixUnaryExpression, - ScriptTarget, - ShorthandPropertyAssignment, - SourceFile, - Statement, - SyntaxKind, - TaggedTemplateExpression, - TextRange, - TransformFlags, - TransformationContext, - VariableDeclaration, - VariableStatement, - VisitResult, - addEmitFlags, - addEmitHelper, - addEmitHelpers, - addRange, - append, - chainBundle, - collectExternalModuleInfo, - emptyArray, - firstOrUndefined, - flattenDestructuringAssignment, - getESModuleInterop, getEmitFlags, getEmitModuleKind, getEmitScriptTarget, + getESModuleInterop, getExportNeedsImportStarHelper, getExternalHelpersModuleName, getExternalModuleNameLiteral, @@ -79,7 +49,12 @@ import { getTextOfIdentifierOrLiteral, hasJsonModuleEmitEnabled, hasSyntacticModifier, + Identifier, idText, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, + InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, isArrowFunction, @@ -120,19 +95,44 @@ import { isStringLiteral, length, mapDefined, + MergeDeclarationMarker, + Modifier, + ModifierFlags, + ModuleKind, + Node, + NodeArray, + NodeFlags, + ObjectLiteralElementLike, outFile, + ParameterDeclaration, + ParenthesizedExpression, + PartiallyEmittedExpression, + PostfixUnaryExpression, + PrefixUnaryExpression, reduceLeft, removeAllComments, + ScriptTarget, setEmitFlags, setOriginalNode, setTextRange, + ShorthandPropertyAssignment, singleOrMany, + SourceFile, startOnNewLine, + Statement, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + TransformationContext, + TransformFlags, tryGetModuleNameFromFile, + VariableDeclaration, + VariableStatement, visitEachChild, visitIterationBody, visitNode, visitNodes, + VisitResult, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/node.ts b/src/compiler/transformers/module/node.ts index a0f6a89ad8c..576c15fe659 100644 --- a/src/compiler/transformers/module/node.ts +++ b/src/compiler/transformers/module/node.ts @@ -2,13 +2,13 @@ import { Bundle, Debug, EmitHint, + isSourceFile, + map, ModuleKind, Node, SourceFile, SyntaxKind, TransformationContext, - isSourceFile, - map, transformECMAScriptModule, transformModule, } from "../../_namespaces/ts"; diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index c1af3e9cc98..c7738323823 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,4 +1,6 @@ import { + addRange, + append, BinaryExpression, BindingElement, Block, @@ -7,7 +9,9 @@ import { CaseClause, CaseOrDefaultClause, CatchClause, + chainBundle, ClassDeclaration, + collectExternalModuleInfo, Debug, Declaration, DefaultClause, @@ -21,51 +25,15 @@ import { Expression, ExpressionStatement, ExternalModuleInfo, + firstOrUndefined, + flattenDestructuringAssignment, FlattenLevel, - ForInStatement, + forEach, ForInitializer, + ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, - Identifier, - ImportCall, - ImportDeclaration, - ImportEqualsDeclaration, - LabeledStatement, - MergeDeclarationMarker, - MetaProperty, - ModifierFlags, - Node, - NodeFlags, - ObjectLiteralElementLike, - ParenthesizedExpression, - PartiallyEmittedExpression, - PostfixUnaryExpression, - PrefixUnaryExpression, - PropertyAssignment, - ShorthandPropertyAssignment, - SourceFile, - Statement, - StringLiteral, - SwitchStatement, - SyntaxKind, - TextRange, - TransformFlags, - TransformationContext, - TryStatement, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, - VisitResult, - WhileStatement, - WithStatement, - addRange, - append, - chainBundle, - collectExternalModuleInfo, - firstOrUndefined, - flattenDestructuringAssignment, - forEach, getEmitFlags, getExternalHelpersModuleName, getExternalModuleNameLiteral, @@ -76,7 +44,11 @@ import { getStrictOptionValue, getTextOfIdentifierOrLiteral, hasSyntacticModifier, + Identifier, idText, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, isAssignmentExpression, @@ -114,20 +86,48 @@ import { isStatement, isStringLiteral, isVariableDeclarationList, + LabeledStatement, map, + MergeDeclarationMarker, + MetaProperty, + ModifierFlags, moveEmitHelpers, + Node, + NodeFlags, + ObjectLiteralElementLike, outFile, + ParenthesizedExpression, + PartiallyEmittedExpression, + PostfixUnaryExpression, + PrefixUnaryExpression, + PropertyAssignment, setCommentRange, setEmitFlags, setTextRange, + ShorthandPropertyAssignment, singleOrMany, some, + SourceFile, startOnNewLine, + Statement, + StringLiteral, + SwitchStatement, + SyntaxKind, + TextRange, + TransformationContext, + TransformFlags, tryGetModuleNameFromFile, + TryStatement, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, visitEachChild, visitIterationBody, visitNode, visitNodes, + VisitResult, + WhileStatement, + WithStatement, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/taggedTemplate.ts b/src/compiler/transformers/taggedTemplate.ts index dd0f9ef96db..041e0adf84a 100644 --- a/src/compiler/transformers/taggedTemplate.ts +++ b/src/compiler/transformers/taggedTemplate.ts @@ -2,8 +2,15 @@ import { CallExpression, Debug, Expression, + factory, + getSourceTextOfNodeFromSourceFile, + hasInvalidEscape, Identifier, + isExpression, + isExternalModule, + isNoSubstitutionTemplateLiteral, NoSubstitutionTemplateLiteral, + setTextRange, SourceFile, SyntaxKind, TaggedTemplateExpression, @@ -12,16 +19,9 @@ import { TemplateMiddle, TemplateTail, TransformationContext, - Visitor, - factory, - getSourceTextOfNodeFromSourceFile, - hasInvalidEscape, - isExpression, - isExternalModule, - isNoSubstitutionTemplateLiteral, - setTextRange, visitEachChild, visitNode, + Visitor, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 3d4400dc384..1b27a345ce6 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1,21 +1,36 @@ import { + __String, AccessorDeclaration, + addEmitFlags, + addEmitHelpers, + addRange, + addSyntheticTrailingComment, AllDecorators, + append, ArrowFunction, AssertionExpression, Block, Bundle, CallExpression, CaseBlock, + childIsDecorated, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, + classOrConstructorParameterIsDecorated, + concatenate, ConstructorDeclaration, + createExpressionFromEntityName, + createRange, + createRuntimeTypeSerializer, + createTokenRange, + createUnparsedSourceFile, Debug, Declaration, Decorator, ElementAccessExpression, + elideNodes, EmitFlags, EmitHint, EntityName, @@ -26,80 +41,16 @@ import { ExportSpecifier, Expression, ExpressionWithTypeArguments, - FlattenLevel, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, - HeritageClause, - Identifier, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportSpecifier, - ImportsNotUsedAsValues, - InitializedVariableDeclaration, - JsxOpeningElement, - JsxSelfClosingElement, - LeftHandSideExpression, - MethodDeclaration, - ModifierFlags, - ModifierLike, - ModuleBlock, - ModuleDeclaration, - ModuleKind, - NamedExportBindings, - NamedExports, - NamedImportBindings, - NamespaceExport, - NewExpression, - Node, - NodeFlags, - NonNullExpression, - ObjectLiteralElementLike, - ObjectLiteralExpression, - OuterExpressionKinds, - ParameterDeclaration, - ParameterPropertyDeclaration, - ParenthesizedExpression, - PropertyAccessExpression, - PropertyDeclaration, - PropertyName, - SatisfiesExpression, - ScriptTarget, - SetAccessorDeclaration, - ShorthandPropertyAssignment, - SourceFile, - Statement, - SyntaxKind, - TaggedTemplateExpression, - TextRange, - TransformFlags, - TransformationContext, - UnderscoreEscapedMap, - VariableDeclaration, - VariableStatement, - VisitResult, - __String, - addEmitFlags, - addEmitHelpers, - addRange, - addSyntheticTrailingComment, - append, - childIsDecorated, - classOrConstructorParameterIsDecorated, - concatenate, - createExpressionFromEntityName, - createRange, - createRuntimeTypeSerializer, - createTokenRange, - createUnparsedSourceFile, - elideNodes, filter, findSuperStatementIndex, firstOrUndefined, flatMap, flattenDestructuringAssignment, + FlattenLevel, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, getAllDecoratorsOfClass, getAllDecoratorsOfClassElement, getEffectiveBaseTypeNode, @@ -116,7 +67,15 @@ import { hasDecorators, hasStaticModifier, hasSyntacticModifier, + HeritageClause, + Identifier, idText, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportsNotUsedAsValues, + ImportSpecifier, + InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, isAccessExpression, isArray, @@ -160,16 +119,45 @@ import { isSimpleInlineableExpression, isSourceFile, isStatement, + JsxOpeningElement, + JsxSelfClosingElement, lastOrUndefined, + LeftHandSideExpression, map, mapDefined, + MethodDeclaration, + ModifierFlags, + ModifierLike, modifierToFlag, + ModuleBlock, + ModuleDeclaration, + ModuleKind, moveRangePastDecorators, moveRangePastModifiers, moveRangePos, + NamedExportBindings, + NamedExports, + NamedImportBindings, + NamespaceExport, + NewExpression, + Node, + NodeFlags, nodeIsMissing, + NonNullExpression, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OuterExpressionKinds, + ParameterDeclaration, parameterIsThisKeyword, + ParameterPropertyDeclaration, + ParenthesizedExpression, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, removeAllComments, + SatisfiesExpression, + ScriptTarget, + SetAccessorDeclaration, setCommentRange, setConstantValue, setEmitFlags, @@ -183,13 +171,24 @@ import { setTextRangePos, setTextRangePosEnd, setTypeNode, + ShorthandPropertyAssignment, shouldPreserveConstEnums, singleOrMany, skipOuterExpressions, skipPartiallyEmittedExpressions, skipTrivia, some, + SourceFile, startOnNewLine, + Statement, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + TransformationContext, + TransformFlags, + UnderscoreEscapedMap, + VariableDeclaration, + VariableStatement, visitArray, visitEachChild, visitFunctionBody, @@ -197,6 +196,7 @@ import { visitNode, visitNodes, visitParameterList, + VisitResult, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/typeSerializer.ts b/src/compiler/transformers/typeSerializer.ts index 37e757a7d43..ca773490be0 100644 --- a/src/compiler/transformers/typeSerializer.ts +++ b/src/compiler/transformers/typeSerializer.ts @@ -11,35 +11,9 @@ import { Debug, EntityName, Expression, - FunctionLikeDeclaration, - Identifier, - JSDocNonNullableType, - JSDocNullableType, - JSDocOptionalType, - LiteralTypeNode, - MethodDeclaration, - ModuleBlock, - Node, - NumericLiteral, - ParameterDeclaration, - PrefixUnaryExpression, - PropertyAccessEntityNameExpression, - PropertyDeclaration, - QualifiedName, - ScriptTarget, - SignatureDeclaration, - SourceFile, - SyntaxKind, - TransformationContext, - TypeNode, - TypeOperatorNode, - TypePredicateNode, - TypeReferenceNode, - TypeReferenceSerializationKind, - UnionOrIntersectionTypeNode, - VoidExpression, factory, findAncestor, + FunctionLikeDeclaration, getAllAccessorDeclarations, getEffectiveReturnTypeNode, getEmitScriptTarget, @@ -48,6 +22,7 @@ import { getRestParameterElementType, getSetAccessorTypeAnnotationNode, getStrictOptionValue, + Identifier, isAsyncFunction, isBinaryExpression, isClassLike, @@ -63,11 +38,36 @@ import { isStringLiteral, isTypeOfExpression, isVoidExpression, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + LiteralTypeNode, + MethodDeclaration, + ModuleBlock, + Node, nodeIsPresent, + NumericLiteral, + ParameterDeclaration, parseNodeFactory, + PrefixUnaryExpression, + PropertyAccessEntityNameExpression, + PropertyDeclaration, + QualifiedName, + ScriptTarget, setParent, setTextRange, + SignatureDeclaration, skipTypeParentheses, + SourceFile, + SyntaxKind, + TransformationContext, + TypeNode, + TypeOperatorNode, + TypePredicateNode, + TypeReferenceNode, + TypeReferenceSerializationKind, + UnionOrIntersectionTypeNode, + VoidExpression, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index 8705633a4cb..90ef9bffb7f 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -1,9 +1,11 @@ import { AccessorDeclaration, AllDecorators, + append, BinaryOperator, BindingElement, Bundle, + cast, ClassDeclaration, ClassElement, ClassExpression, @@ -12,43 +14,17 @@ import { CompilerOptions, CompoundAssignmentOperator, CoreTransformationContext, + createExternalHelpersImportDeclarationIfNeeded, + createMultiMap, Decorator, EmitResolver, ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, + filter, FunctionDeclaration, FunctionLikeDeclaration, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - ImportSpecifier, - InitializedPropertyDeclaration, - InternalSymbolName, - LogicalOperatorOrHigher, - MethodDeclaration, - ModifierFlags, - NamedImportBindings, - NamespaceExport, - Node, - NodeArray, - PrivateIdentifierAccessorDeclaration, - PrivateIdentifierAutoAccessorPropertyDeclaration, - PrivateIdentifierMethodDeclaration, - PropertyDeclaration, - SourceFile, - Statement, - SuperCall, - SyntaxKind, - TransformationContext, - VariableDeclaration, - VariableStatement, - append, - cast, - createExternalHelpersImportDeclarationIfNeeded, - createMultiMap, - filter, getAllAccessorDeclarations, getDecorators, getFirstConstructorWithBody, @@ -58,7 +34,13 @@ import { hasDecorators, hasStaticModifier, hasSyntacticModifier, + Identifier, idText, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + InitializedPropertyDeclaration, + InternalSymbolName, isAutoAccessorPropertyDeclaration, isBindingPattern, isClassStaticBlockDeclaration, @@ -76,10 +58,28 @@ import { isStatic, isStringLiteralLike, isSuperCall, + LogicalOperatorOrHigher, map, + MethodDeclaration, + ModifierFlags, + NamedImportBindings, + NamespaceExport, + Node, + NodeArray, parameterIsThisKeyword, + PrivateIdentifierAccessorDeclaration, + PrivateIdentifierAutoAccessorPropertyDeclaration, + PrivateIdentifierMethodDeclaration, + PropertyDeclaration, skipParentheses, some, + SourceFile, + Statement, + SuperCall, + SyntaxKind, + TransformationContext, + VariableDeclaration, + VariableStatement, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index c192abeb6cc..dedf7e47299 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1,8 +1,8 @@ import { - Extension, - ResolvedConfigFileName, combinePaths, + Extension, fileExtensionIs, + ResolvedConfigFileName, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 394bbceb8f0..6eb8ed8862c 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -1,68 +1,21 @@ import * as ts from "./_namespaces/ts"; import { AffectedFileResult, - BuildInfo, - BuilderProgram, - CancellationToken, - CompilerHost, - CompilerOptions, - CompilerOptionsValue, - ConfigFileProgramReloadLevel, - CreateProgram, - CustomTransformers, - Debug, - Diagnostic, - DiagnosticCollection, - DiagnosticMessage, - DiagnosticReporter, - Diagnostics, - EmitAndSemanticDiagnosticsBuilderProgram, - EmitResult, - ExitStatus, - ExtendedConfigCacheEntry, - FileWatcher, - FileWatcherCallback, - ForegroundColorEscapeSequences, - GetCanonicalFileName, - ModuleResolutionCache, - OutputFile, - ParseConfigFileHost, - ParsedCommandLine, - Path, - PollingInterval, - Program, - ProgramBuildInfo, - ProgramBundleEmitBuildInfo, - ProgramHost, - ProgramMultiFileEmitBuildInfo, - ReadBuildProgramHost, - ResolutionMode, - ResolvedConfigFileName, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - SemanticDiagnosticsBuilderProgram, - SharedExtendedConfigFileWatcher, - SourceFile, - Status, - System, - TypeReferenceDirectiveResolutionCache, - UpToDateStatus, - UpToDateStatusType, - WatchFactory, - WatchHost, - WatchOptions, - WatchStatusReporter, - WatchType, - WildcardDirectoryWatcher, - WriteFileCallback, arrayToMap, assertType, + BuilderProgram, + BuildInfo, + CancellationToken, canJsonReportNoInputFiles, changeCompilerHostLikeToUseCache, clearMap, closeFileWatcher, closeFileWatcherOf, commonOptionsWithBuild, + CompilerHost, + CompilerOptions, + CompilerOptionsValue, + ConfigFileProgramReloadLevel, convertToRelativePath, copyProperties, createCompilerDiagnostic, @@ -71,19 +24,35 @@ import { createDiagnosticReporter, createGetCanonicalFileName, createModuleResolutionCache, + CreateProgram, createProgramHost, createTypeReferenceDirectiveResolutionCache, createWatchFactory, createWatchHost, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCollection, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + EmitAndSemanticDiagnosticsBuilderProgram, emitFilesAndReportErrors, + EmitResult, emitUsingBuildInfo, emptyArray, + ExitStatus, + ExtendedConfigCacheEntry, + FileWatcher, + FileWatcherCallback, findIndex, flattenDiagnosticMessageText, forEach, + ForegroundColorEscapeSequences, formatColorAndReset, getAllProjectOutputs, getBuildInfoFileVersionMap, + GetCanonicalFileName, getConfigFileParsingDiagnostics, getDirectoryPath, getEntries, @@ -110,27 +79,58 @@ import { map, maybeBind, missingFileModifiedTime, + ModuleResolutionCache, mutateMap, mutateMapSkippingNewValues, noop, outFile, + OutputFile, + ParseConfigFileHost, parseConfigHostFromCompilerHostLike, + ParsedCommandLine, + Path, + PollingInterval, + Program, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProgramHost, + ProgramMultiFileEmitBuildInfo, readBuilderProgram, + ReadBuildProgramHost, + ResolutionMode, resolveConfigFileProjectName, + ResolvedConfigFileName, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, resolveModuleName, resolvePath, resolveProjectReferencePath, resolveTypeReferenceDirective, returnUndefined, + SemanticDiagnosticsBuilderProgram, setGetSourceFileAsHashVersioned, + SharedExtendedConfigFileWatcher, some, + SourceFile, + Status, sys, + System, + TypeReferenceDirectiveResolutionCache, unorderedRemoveItem, updateErrorForNoInputFiles, updateSharedExtendedConfigFileWatcher, updateWatchingWildcardDirectories, + UpToDateStatus, + UpToDateStatusType, version, + WatchFactory, + WatchHost, + WatchOptions, + WatchStatusReporter, + WatchType, + WildcardDirectoryWatcher, writeFile, + WriteFileCallback, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f026b086585..8de47c34843 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,21 +1,28 @@ import { + __String, AccessExpression, AccessorDeclaration, + addRange, + affectsDeclarationPathOptionDeclarations, + affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, AnyImportOrBareOrAccessedRequire, AnyImportOrReExport, AnyImportSyntax, AnyValidImportOrReExport, + arrayFrom, ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AssertionExpression, + assertType, AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, BinaryExpression, + binarySearch, BindableObjectDefinePropertyCall, BindableStaticAccessExpression, BindableStaticElementAccessExpression, @@ -27,27 +34,46 @@ import { BundleFileTextLike, CallExpression, CallLikeExpression, + canHaveDecorators, + canHaveIllegalDecorators, + canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, CatchClause, + changeAnyExtension, CharacterCodes, CheckFlags, ClassDeclaration, ClassElement, ClassLikeDeclaration, ClassStaticBlockDeclaration, + combinePaths, CommaListExpression, CommandLineOption, CommentDirective, - CommentDirectiveType, CommentDirectivesMap, + CommentDirectiveType, CommentRange, + compareStringsCaseSensitive, + compareValues, Comparison, CompilerOptions, ComputedPropertyName, + computeLineAndCharacterOfPosition, + computeLineOfPosition, + computeLineStarts, + concatenate, ConditionalExpression, ConstructorDeclaration, + contains, + containsPath, + createGetCanonicalFileName, + createModeAwareCache, + createMultiMap, + createScanner, + createTextSpan, + createTextSpanFromBounds, Debug, Declaration, DeclarationName, @@ -61,9 +87,10 @@ import { DiagnosticMessage, DiagnosticMessageChain, DiagnosticRelatedInformation, + Diagnostics, DiagnosticWithDetachedLocation, DiagnosticWithLocation, - Diagnostics, + directorySeparator, DoStatement, DynamicNamedBinaryExpression, DynamicNamedDeclaration, @@ -72,12 +99,19 @@ import { EmitHost, EmitResolver, EmitTextWriter, + emptyArray, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, EntityName, EntityNameExpression, EntityNameOrEntityNameExpression, EnumDeclaration, EqualityComparer, + equalOwnProperties, EqualsToken, + equateValues, + escapeLeadingUnderscores, + every, ExportAssignment, ExportDeclaration, ExportSpecifier, @@ -86,234 +120,12 @@ import { ExpressionWithTypeArguments, Extension, ExternalModuleReference, - FileExtensionInfo, - FileReference, - FileWatcher, - ForInOrOfStatement, - ForInStatement, - ForOfStatement, - ForStatement, - FunctionBody, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, - GetCanonicalFileName, - HasExpressionInitializer, - HasInitializer, - HasJSDoc, - HasModifiers, - HasType, - HasTypeArguments, - HeritageClause, - Identifier, - IdentifierTypePredicate, - IfStatement, - ImportCall, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportMetaProperty, - ImportSpecifier, - ImportTypeNode, - IndexInfo, - InitializedVariableDeclaration, - InterfaceDeclaration, - JSDoc, - JSDocCallbackTag, - JSDocEnumTag, - JSDocMemberName, - JSDocParameterTag, - JSDocPropertyLikeTag, - JSDocSignature, - JSDocTag, - JSDocTemplateTag, - JSDocTypedefTag, - JsonSourceFile, - JsxChild, - JsxElement, - JsxEmit, - JsxFragment, - JsxOpeningElement, - JsxOpeningLikeElement, - JsxSelfClosingElement, - JsxTagNameExpression, - KeywordSyntaxKind, - LabeledStatement, - LanguageVariant, - LateVisibilityPaintedStatement, - LiteralImportTypeNode, - LiteralLikeElementAccessExpression, - LiteralLikeNode, - LogicalOrCoalescingAssignmentOperator, - MapLike, - MemberName, - MethodDeclaration, - ModeAwareCache, - ModifierFlags, - ModifierLike, - ModuleBlock, - ModuleDeclaration, - ModuleDetectionKind, - ModuleKind, - ModuleResolutionKind, - MultiMap, - NamedDeclaration, - NamedExports, - NamedImports, - NamedImportsOrExports, - NamespaceExport, - NamespaceImport, - NewExpression, - NewLineKind, - NoSubstitutionTemplateLiteral, - Node, - NodeArray, - NodeFlags, - NonNullExpression, - NumericLiteral, - ObjectFlags, - ObjectFlagsType, - ObjectLiteralElement, - ObjectLiteralExpression, - ObjectLiteralExpressionBase, - ObjectTypeDeclaration, - OuterExpressionKinds, - PackageId, - ParameterDeclaration, - ParenthesizedExpression, - ParenthesizedTypeNode, - PartiallyEmittedExpression, - Path, - Pattern, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrintHandlers, - PrinterOptions, - PrivateIdentifier, - ProjectReference, - PrologueDirective, - PropertyAccessEntityNameExpression, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertyName, - PropertyNameLiteral, - PseudoBigInt, - QualifiedName, - ReadonlyCollection, - ReadonlyTextRange, - RequireOrImportCall, - RequireVariableStatement, - ResolutionMode, - ResolvedModuleFull, - ResolvedTypeReferenceDirective, - ReturnStatement, - SatisfiesExpression, - ScriptKind, - ScriptTarget, - SetAccessorDeclaration, - ShorthandPropertyAssignment, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureKind, - SortedArray, - SourceFile, - SourceFileLike, - SourceFileMayBeEmittedHost, - SourceMapSource, - Statement, - StringLiteral, - StringLiteralLike, - SuperCall, - SuperExpression, - SuperProperty, - SwitchStatement, - Symbol, - SymbolFlags, - SymbolTable, - SyntaxKind, - SyntaxList, - TaggedTemplateExpression, - TemplateLiteral, - TemplateLiteralLikeNode, - TemplateLiteralTypeSpan, - TemplateSpan, - TextRange, - TextSpan, - ThisTypePredicate, - Token, - TokenFlags, - TransformFlags, - TransientSymbol, - TriviaSyntaxKind, - TryStatement, - TsConfigSourceFile, - TupleTypeNode, - Type, - TypeAliasDeclaration, - TypeAssertion, - TypeChecker, - TypeElement, - TypeFlags, - TypeLiteralNode, - TypeNode, - TypeNodeSyntaxKind, - TypeParameter, - TypeParameterDeclaration, - TypePredicate, - TypePredicateKind, - TypeReferenceNode, - UnionOrIntersectionTypeNode, - ValidImportTypeNode, - VariableDeclaration, - VariableDeclarationInitializedTo, - VariableDeclarationList, - VariableLikeDeclaration, - VariableStatement, - WhileStatement, - WithStatement, - WriteFileCallback, - WriteFileCallbackData, - YieldExpression, - __String, - addRange, - affectsDeclarationPathOptionDeclarations, - affectsEmitOptionDeclarations, - arrayFrom, - assertType, - binarySearch, - canHaveDecorators, - canHaveIllegalDecorators, - canHaveModifiers, - changeAnyExtension, - combinePaths, - compareStringsCaseSensitive, - compareValues, - computeLineAndCharacterOfPosition, - computeLineOfPosition, - computeLineStarts, - concatenate, - contains, - containsPath, - createGetCanonicalFileName, - createModeAwareCache, - createMultiMap, - createScanner, - createTextSpan, - createTextSpanFromBounds, - directorySeparator, - emptyArray, - ensurePathIsNonModuleName, - ensureTrailingDirectorySeparator, - equalOwnProperties, - equateValues, - escapeLeadingUnderscores, - every, factory, + FileExtensionInfo, fileExtensionIs, fileExtensionIsOneOf, + FileReference, + FileWatcher, filter, find, findAncestor, @@ -329,7 +141,17 @@ import { forEachAncestorDirectory, forEachChild, forEachChildRecursively, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, getBaseFileName, + GetCanonicalFileName, getCombinedModifierFlags, getCombinedNodeFlags, getDirectoryPath, @@ -352,8 +174,8 @@ import { getJSDocTypeTag, getLeadingCommentRanges, getLineAndCharacterOfPosition, - getLineStarts, getLinesBetweenPositions, + getLineStarts, getNameOfDeclaration, getNormalizedAbsolutePath, getNormalizedPathComponents, @@ -368,15 +190,35 @@ import { getStringComparer, getSymbolId, getTrailingCommentRanges, + HasExpressionInitializer, hasExtension, hasInitializer, + HasInitializer, + HasJSDoc, hasJSDocNodes, + HasModifiers, hasProperty, - idText, + HasType, + HasTypeArguments, + HeritageClause, + Identifier, + IdentifierTypePredicate, identity, + idText, + IfStatement, ignoredPaths, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportMetaProperty, + ImportSpecifier, + ImportTypeNode, + IndexInfo, indexOfAnyCharCode, + InitializedVariableDeclaration, insertSorted, + InterfaceDeclaration, isAccessor, isAnyDirectorySeparator, isArray, @@ -480,41 +322,199 @@ import { isVoidExpression, isWhiteSpaceLike, isWhiteSpaceSingleLine, + JSDoc, + JSDocCallbackTag, + JSDocEnumTag, + JSDocMemberName, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocTypedefTag, + JsonSourceFile, + JsxChild, + JsxElement, + JsxEmit, + JsxFragment, + JsxOpeningElement, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxTagNameExpression, + KeywordSyntaxKind, + LabeledStatement, + LanguageVariant, last, lastOrUndefined, + LateVisibilityPaintedStatement, length, + LiteralImportTypeNode, + LiteralLikeElementAccessExpression, + LiteralLikeNode, + LogicalOrCoalescingAssignmentOperator, map, mapDefined, + MapLike, + MemberName, + MethodDeclaration, + ModeAwareCache, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleDetectionKind, + ModuleKind, + ModuleResolutionKind, moduleResolutionOptionDeclarations, + MultiMap, + NamedDeclaration, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamespaceExport, + NamespaceImport, + NewExpression, + NewLineKind, + Node, + NodeArray, + NodeFlags, nodeModulesPathPart, + NonNullExpression, noop, normalizePath, + NoSubstitutionTemplateLiteral, + NumericLiteral, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElement, + ObjectLiteralExpression, + ObjectLiteralExpressionBase, + ObjectTypeDeclaration, optionsAffectingProgramStructure, or, + OuterExpressionKinds, + PackageId, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, parseConfigFileTextToJson, + PartiallyEmittedExpression, + Path, pathIsRelative, + Pattern, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrinterOptions, + PrintHandlers, + PrivateIdentifier, + ProjectReference, + PrologueDirective, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertyNameLiteral, + PseudoBigInt, + QualifiedName, + ReadonlyCollection, + ReadonlyTextRange, removeTrailingDirectorySeparator, + RequireOrImportCall, + RequireVariableStatement, + ResolutionMode, + ResolvedModuleFull, + ResolvedTypeReferenceDirective, + ReturnStatement, + SatisfiesExpression, + ScriptKind, + ScriptTarget, semanticDiagnosticsOptionDeclarations, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, singleElementArray, singleOrUndefined, skipOuterExpressions, skipTrivia, some, sort, + SortedArray, + SourceFile, + SourceFileLike, + SourceFileMayBeEmittedHost, + SourceMapSource, startsWith, startsWithUseStrict, + Statement, stringContains, + StringLiteral, + StringLiteralLike, stringToToken, + SuperCall, + SuperExpression, + SuperProperty, + SwitchStatement, + Symbol, + SymbolFlags, + SymbolTable, + SyntaxKind, + SyntaxList, sys, - toPath, + TaggedTemplateExpression, + TemplateLiteral, + TemplateLiteralLikeNode, + TemplateLiteralTypeSpan, + TemplateSpan, + TextRange, + TextSpan, + ThisTypePredicate, + Token, + TokenFlags, tokenToString, + toPath, tracing, + TransformFlags, + TransientSymbol, trimString, trimStringStart, + TriviaSyntaxKind, tryCast, tryRemovePrefix, + TryStatement, + TsConfigSourceFile, + TupleTypeNode, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeNodeSyntaxKind, + TypeParameter, + TypeParameterDeclaration, + TypePredicate, + TypePredicateKind, + TypeReferenceNode, unescapeLeadingUnderscores, + UnionOrIntersectionTypeNode, + ValidImportTypeNode, + VariableDeclaration, + VariableDeclarationInitializedTo, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, version, + WhileStatement, + WithStatement, + WriteFileCallback, + WriteFileCallbackData, + YieldExpression, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 9ff1b4f72aa..e6c0c5a0560 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1,4 +1,5 @@ import { + __String, AccessExpression, AccessorDeclaration, ArrayBindingElement, @@ -22,15 +23,20 @@ import { CallChain, CallExpression, CallLikeExpression, + canHaveIllegalTypeParameters, CaseOrDefaultClause, CharacterCodes, ClassElement, ClassLikeDeclaration, ClassStaticBlockDeclaration, + combinePaths, + compareDiagnostics, CompilerOptions, ConciseBody, ConstructorDeclaration, ConstructorTypeNode, + contains, + createCompilerDiagnostic, Debug, Declaration, DeclarationName, @@ -41,14 +47,20 @@ import { Diagnostics, ElementAccessChain, ElementAccessExpression, + emptyArray, EntityName, + entityNameToString, EnumDeclaration, + every, ExportAssignment, ExportSpecifier, Expression, FileReference, - ForInOrOfStatement, + filter, + find, + flatMap, ForInitializer, + ForInOrOfStatement, FunctionBody, FunctionLikeDeclaration, FunctionTypeNode, @@ -56,129 +68,6 @@ import { GeneratedIdentifierFlags, GeneratedPrivateIdentifier, GetAccessorDeclaration, - HasDecorators, - HasExpressionInitializer, - HasInitializer, - HasJSDoc, - HasModifiers, - HasType, - Identifier, - ImportClause, - ImportEqualsDeclaration, - ImportOrExportSpecifier, - ImportSpecifier, - ImportTypeNode, - IterationStatement, - JSDocAugmentsTag, - JSDocClassTag, - JSDocComment, - JSDocContainer, - JSDocDeprecatedTag, - JSDocEnumTag, - JSDocImplementsTag, - JSDocLink, - JSDocLinkCode, - JSDocLinkPlain, - JSDocNamespaceBody, - JSDocOverrideTag, - JSDocParameterTag, - JSDocPrivateTag, - JSDocPropertyLikeTag, - JSDocProtectedTag, - JSDocPublicTag, - JSDocReadonlyTag, - JSDocReturnTag, - JSDocSignature, - JSDocTag, - JSDocTemplateTag, - JSDocThisTag, - JSDocTypeTag, - JSDocTypedefTag, - JsxAttributeLike, - JsxChild, - JsxExpression, - JsxOpeningLikeElement, - JsxTagNameExpression, - LabeledStatement, - LeftHandSideExpression, - LiteralExpression, - LiteralToken, - MemberName, - MethodDeclaration, - Modifier, - ModifierFlags, - ModifierLike, - ModuleBody, - ModuleDeclaration, - ModuleReference, - NamedDeclaration, - NamedExportBindings, - NamedImportBindings, - NamespaceBody, - NamespaceImport, - NewExpression, - Node, - NodeArray, - NodeFlags, - NonNullChain, - NotEmittedStatement, - ObjectBindingOrAssignmentElement, - ObjectBindingOrAssignmentPattern, - ObjectLiteralElement, - ObjectLiteralElementLike, - OptionalChain, - OptionalChainRoot, - OuterExpressionKinds, - ParameterDeclaration, - PartiallyEmittedExpression, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrivateClassElementDeclaration, - PrivateIdentifier, - PrivateIdentifierPropertyAccessExpression, - PropertyAccessChain, - PropertyAccessExpression, - PropertyDeclaration, - PropertyName, - Push, - QualifiedName, - ScriptTarget, - SetAccessorDeclaration, - SignatureDeclaration, - SortedReadonlyArray, - Statement, - StringLiteral, - StringLiteralLike, - Symbol, - SyntaxKind, - TemplateLiteral, - TemplateLiteralToken, - TemplateMiddle, - TemplateTail, - TextChangeRange, - TextRange, - TextSpan, - TypeElement, - TypeNode, - TypeOnlyAliasDeclaration, - TypeParameterDeclaration, - TypeReferenceType, - UnaryExpression, - UnparsedNode, - UnparsedTextLike, - VariableDeclaration, - __String, - canHaveIllegalTypeParameters, - combinePaths, - compareDiagnostics, - contains, - createCompilerDiagnostic, - emptyArray, - entityNameToString, - every, - filter, - find, - flatMap, getAssignmentDeclarationKind, getDirectoryPath, getEffectiveModifierFlags, @@ -189,8 +78,20 @@ import { getJSDocTypeParameterDeclarations, hasAccessorModifier, hasDecorators, + HasDecorators, + HasExpressionInitializer, + HasInitializer, + HasJSDoc, + HasModifiers, hasProperty, hasSyntacticModifier, + HasType, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, isAccessExpression, isAmbientModule, isAnyImportOrReExport, @@ -254,15 +155,114 @@ import { isVariableDeclarationList, isVariableStatement, isWhiteSpaceLike, + IterationStatement, + JSDocAugmentsTag, + JSDocClassTag, + JSDocComment, + JSDocContainer, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocNamespaceBody, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeTag, + JsxAttributeLike, + JsxChild, + JsxExpression, + JsxOpeningLikeElement, + JsxTagNameExpression, + LabeledStatement, lastOrUndefined, + LeftHandSideExpression, + LiteralExpression, + LiteralToken, + MemberName, + MethodDeclaration, + Modifier, + ModifierFlags, + ModifierLike, modifierToFlag, + ModuleBody, + ModuleDeclaration, + ModuleReference, + NamedDeclaration, + NamedExportBindings, + NamedImportBindings, + NamespaceBody, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFlags, + NonNullChain, normalizePath, + NotEmittedStatement, + ObjectBindingOrAssignmentElement, + ObjectBindingOrAssignmentPattern, + ObjectLiteralElement, + ObjectLiteralElementLike, + OptionalChain, + OptionalChainRoot, + OuterExpressionKinds, + ParameterDeclaration, + PartiallyEmittedExpression, pathIsRelative, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateClassElementDeclaration, + PrivateIdentifier, + PrivateIdentifierPropertyAccessExpression, + PropertyAccessChain, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + Push, + QualifiedName, + ScriptTarget, + SetAccessorDeclaration, setLocalizedDiagnosticMessages, setUILocale, + SignatureDeclaration, skipOuterExpressions, some, sortAndDeduplicate, + SortedReadonlyArray, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SyntaxKind, + TemplateLiteral, + TemplateLiteralToken, + TemplateMiddle, + TemplateTail, + TextChangeRange, + TextRange, + TextSpan, + TypeElement, + TypeNode, + TypeOnlyAliasDeclaration, + TypeParameterDeclaration, + TypeReferenceType, + UnaryExpression, + UnparsedNode, + UnparsedTextLike, + VariableDeclaration, } from "./_namespaces/ts"; export function isExternalModuleNameRelative(moduleName: string): boolean { diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 0ed6462e145..af0fd6e4db0 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -3,23 +3,11 @@ import { Debug, EmitFlags, Expression, - FunctionBody, - Identifier, - LexicalEnvironmentFlags, - Node, - NodeArray, - NodeVisitor, - NodesVisitor, - ParameterDeclaration, - ScriptTarget, - Statement, - SyntaxKind, - TransformationContext, - VisitEachChildNodes, - Visitor, factory, + FunctionBody, getEmitFlags, getEmitScriptTarget, + Identifier, isArray, isArrayBindingElement, isAssertClause, @@ -96,11 +84,23 @@ import { isTypeParameterDeclaration, isVariableDeclaration, isVariableDeclarationList, + LexicalEnvironmentFlags, + Node, + NodeArray, + NodesVisitor, + NodeVisitor, + ParameterDeclaration, + ScriptTarget, setEmitFlags, setTextRange, setTextRangePosEnd, singleOrUndefined, some, + Statement, + SyntaxKind, + TransformationContext, + VisitEachChildNodes, + Visitor, } from "./_namespaces/ts"; /** diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 78af4166e94..16bd5f3e8dd 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -1,10 +1,24 @@ import { + addRange, BuilderProgram, CancellationToken, + chainDiagnosticMessages, CharacterCodes, + combinePaths, CompilerHost, CompilerOptions, + contains, + convertToRelativePath, + copyProperties, + countWhere, + createCompilerDiagnostic, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createGetSourceFile, + createIncrementalCompilerHost, + createIncrementalProgram, CreateProgram, + createWriteFileMeasuringIO, CustomTransformers, Debug, Diagnostic, @@ -16,62 +30,26 @@ import { DirectoryStructureHost, EmitAndSemanticDiagnosticsBuilderProgram, EmitResult, + emptyArray, + endsWith, ExitStatus, ExtendedConfigCacheEntry, Extension, + externalHelpersModuleNameText, FileExtensionInfo, + fileExtensionIs, FileIncludeKind, FileIncludeReason, FileWatcher, - ForegroundColorEscapeSequences, - FormatDiagnosticsHost, - HasCurrentDirectory, - ModuleKind, - ParseConfigFileHost, - ParsedCommandLine, - Program, - ProgramHost, - ProjectReference, - ReportEmitErrorSummary, - ReportFileInError, - SortedReadonlyArray, - SourceFile, - System, - WatchCompilerHost, - WatchCompilerHostOfConfigFile, - WatchCompilerHostOfFilesAndCompilerOptions, - WatchFactory, - WatchFactoryHost, - WatchHost, - WatchLogLevel, - WatchOptions, - WatchStatusReporter, - WriteFileCallback, - addRange, - chainDiagnosticMessages, - combinePaths, - contains, - convertToRelativePath, - copyProperties, - countWhere, - createCompilerDiagnostic, - createEmitAndSemanticDiagnosticsBuilderProgram, - createGetCanonicalFileName, - createGetSourceFile, - createIncrementalCompilerHost, - createIncrementalProgram, - createWriteFileMeasuringIO, - emptyArray, - endsWith, - externalHelpersModuleNameText, - fileExtensionIs, filter, find, flattenDiagnosticMessageText, forEach, forEachEntry, + ForegroundColorEscapeSequences, formatColorAndReset, formatDiagnostic, + FormatDiagnosticsHost, formatDiagnosticsWithColorAndContext, generateDjb2Hash, getDefaultLibFileName, @@ -86,25 +64,47 @@ import { getRegexFromPattern, getRelativePathFromDirectory, getWatchFactory, + HasCurrentDirectory, isExternalOrCommonJsModule, isLineBreak, - isReferenceFileLocation, isReferencedFile, + isReferenceFileLocation, isString, last, maybeBind, memoize, + ModuleKind, noop, normalizePath, outFile, packageIdToString, + ParseConfigFileHost, + ParsedCommandLine, pathIsAbsolute, + Program, + ProgramHost, + ProjectReference, + ReportEmitErrorSummary, + ReportFileInError, sortAndDeduplicateDiagnostics, + SortedReadonlyArray, + SourceFile, sourceMapCommentRegExp, sourceMapCommentRegExpDontCareLineStart, sys, + System, targetOptionDeclaration, + WatchCompilerHost, + WatchCompilerHostOfConfigFile, + WatchCompilerHostOfFilesAndCompilerOptions, + WatchFactory, + WatchFactoryHost, + WatchHost, + WatchLogLevel, + WatchOptions, + WatchStatusReporter, whitespaceOrMapCommentRegExp, + WriteFileCallback, } from "./_namespaces/ts"; const sysFormatDiagnosticsHost: FormatDiagnosticsHost | undefined = sys ? { diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index 7a673bdb89e..6810e326085 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -1,12 +1,31 @@ import * as ts from "./_namespaces/ts"; import { - BuildInfo, BuilderProgram, + BuildInfo, + canJsonReportNoInputFiles, + changeCompilerHostLikeToUseCache, + changesAffectModuleResolution, + cleanExtendedConfigCache, + clearMap, + clearSharedExtendedConfigFileWatcher, + closeFileWatcher, + closeFileWatcherOf, CompilerHost, CompilerOptions, ConfigFileDiagnosticsReporter, ConfigFileProgramReloadLevel, + createBuilderProgramUsingProgramBuildInfo, + createCachedDirectoryStructureHost, + createCompilerDiagnostic, + createCompilerHostFromProgramHost, + createCompilerHostWorker, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createResolutionCache, CreateSourceFileOptions, + createWatchCompilerHostOfConfigFile, + createWatchCompilerHostOfFilesAndCompilerOptions, + createWatchFactory, Debug, Diagnostic, DiagnosticMessage, @@ -21,48 +40,6 @@ import { FileWatcher, FileWatcherCallback, FileWatcherEventKind, - HasInvalidatedResolutions, - MapLike, - ModuleResolutionCache, - ModuleResolutionInfo, - ParsedCommandLine, - Path, - PollingInterval, - ProjectReference, - ResolutionCacheHost, - ResolutionMode, - ResolvedModule, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ScriptTarget, - SharedExtendedConfigFileWatcher, - SourceFile, - System, - TypeReferenceDirectiveResolutionInfo, - WatchDirectoryFlags, - WatchOptions, - WatchType, - WatchTypeRegistry, - WildcardDirectoryWatcher, - canJsonReportNoInputFiles, - changeCompilerHostLikeToUseCache, - changesAffectModuleResolution, - cleanExtendedConfigCache, - clearMap, - clearSharedExtendedConfigFileWatcher, - closeFileWatcher, - closeFileWatcherOf, - createBuilderProgramUsingProgramBuildInfo, - createCachedDirectoryStructureHost, - createCompilerDiagnostic, - createCompilerHostFromProgramHost, - createCompilerHostWorker, - createEmitAndSemanticDiagnosticsBuilderProgram, - createGetCanonicalFileName, - createResolutionCache, - createWatchCompilerHostOfConfigFile, - createWatchCompilerHostOfFilesAndCompilerOptions, - createWatchFactory, getBuildInfo, getConfigFileParsingDiagnostics, getDirectoryPath, @@ -72,24 +49,47 @@ import { getNormalizedAbsolutePath, getParsedCommandLineOfConfigFile, getTsBuildInfoEmitOutputFilePath, + HasInvalidatedResolutions, isArray, isIgnoredFileFromWildCardWatching, isProgramUptoDate, + MapLike, maybeBind, + ModuleResolutionCache, + ModuleResolutionInfo, noop, noopFileWatcher, parseConfigHostFromCompilerHostLike, + ParsedCommandLine, + Path, perfLogger, + PollingInterval, + ProjectReference, + ResolutionCacheHost, + ResolutionMode, + ResolvedModule, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, returnFalse, returnTrue, + ScriptTarget, setGetSourceFileAsHashVersioned, + SharedExtendedConfigFileWatcher, + SourceFile, sys, + System, toPath, + TypeReferenceDirectiveResolutionInfo, updateErrorForNoInputFiles, updateMissingFilePathsWatch, updateSharedExtendedConfigFileWatcher, updateWatchingWildcardDirectories, version, + WatchDirectoryFlags, + WatchOptions, + WatchType, + WatchTypeRegistry, + WildcardDirectoryWatcher, } from "./_namespaces/ts"; export interface ReadBuildProgramHost { diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index ac62a2d612d..62d6ffee460 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -1,33 +1,25 @@ import * as ts from "./_namespaces/ts"; import { + arrayToMap, + binarySearch, BuilderProgram, + closeFileWatcher, + compareStringsCaseSensitive, CompilerOptions, + createGetCanonicalFileName, Debug, DirectoryWatcherCallback, + emptyArray, + emptyFileSystemEntries, + ensureTrailingDirectorySeparator, ExtendedConfigCacheEntry, Extension, FileExtensionInfo, + fileExtensionIsOneOf, FileSystemEntries, FileWatcher, FileWatcherCallback, FileWatcherEventKind, - Path, - PollingInterval, - Program, - SortedArray, - SortedReadonlyArray, - WatchDirectoryFlags, - WatchFileKind, - WatchOptions, - arrayToMap, - binarySearch, - closeFileWatcher, - compareStringsCaseSensitive, - createGetCanonicalFileName, - emptyArray, - emptyFileSystemEntries, - ensureTrailingDirectorySeparator, - fileExtensionIsOneOf, find, getBaseFileName, getDirectoryPath, @@ -40,19 +32,27 @@ import { isExcludedFile, isSupportedSourceFileName, map, - matchFiles, matchesExclude, + matchFiles, mutateMap, noop, normalizePath, outFile, + Path, + PollingInterval, + Program, removeFileExtension, removeIgnoredPath, returnNoopFileWatcher, returnTrue, setSysLog, + SortedArray, + SortedReadonlyArray, supportedJSExtensionsFlat, timestamp, + WatchDirectoryFlags, + WatchFileKind, + WatchOptions, } from "./_namespaces/ts"; /** diff --git a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts index aa235dc1cc9..caca5fc9143 100644 --- a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts +++ b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts @@ -21,11 +21,13 @@ import { ExportDeclaration, Expression, ExpressionWithTypeArguments, + factory, GeneratedIdentifierFlags, HeritageClause, Identifier, ImportClause, IndexSignatureDeclaration, + isNodeKind, JSDocParameterTag, JSDocTypeExpression, MethodSignature, @@ -33,11 +35,12 @@ import { Mutable, NamedExportBindings, NamedImportBindings, - NoSubstitutionTemplateLiteral, Node, NodeArray, + NoSubstitutionTemplateLiteral, NumericLiteral, ParameterDeclaration, + parseBaseNodeFactory, PostfixUnaryExpression, PrefixUnaryExpression, PrimaryExpression, @@ -45,6 +48,9 @@ import { PropertySignature, PseudoBigInt, QuestionToken, + setParent, + setTextRange, + setTextRangePosEnd, StringLiteral, SyntaxKind, TaggedTemplateExpression, @@ -57,12 +63,6 @@ import { TypePredicateNode, VariableDeclaration, YieldExpression, - factory, - isNodeKind, - parseBaseNodeFactory, - setParent, - setTextRange, - setTextRangePosEnd, } from "../_namespaces/ts"; import { deprecate } from "../deprecate"; diff --git a/src/deprecatedCompat/4.2/abstractConstructorTypes.ts b/src/deprecatedCompat/4.2/abstractConstructorTypes.ts index 6cca2901447..5de292fb9bc 100644 --- a/src/deprecatedCompat/4.2/abstractConstructorTypes.ts +++ b/src/deprecatedCompat/4.2/abstractConstructorTypes.ts @@ -1,14 +1,14 @@ import { + addNodeFactoryPatcher, + buildOverload, ConstructorTypeNode, + factory, Modifier, NodeArray, NodeFactory, ParameterDeclaration, TypeNode, TypeParameterDeclaration, - addNodeFactoryPatcher, - buildOverload, - factory, } from "../_namespaces/ts"; // DEPRECATION: Overloads for createConstructorTypeNode/updateConstructorTypeNode that do not accept 'modifiers' diff --git a/src/deprecatedCompat/4.2/renamedNodeTests.ts b/src/deprecatedCompat/4.2/renamedNodeTests.ts index 014aab74d75..78a0f155f53 100644 --- a/src/deprecatedCompat/4.2/renamedNodeTests.ts +++ b/src/deprecatedCompat/4.2/renamedNodeTests.ts @@ -1,7 +1,7 @@ import { + isMemberName, MemberName, Node, - isMemberName, } from "../_namespaces/ts"; import { deprecate } from "../deprecate"; diff --git a/src/deprecatedCompat/4.6/importTypeAssertions.ts b/src/deprecatedCompat/4.6/importTypeAssertions.ts index 9464b3d24e9..738eb2327d1 100644 --- a/src/deprecatedCompat/4.6/importTypeAssertions.ts +++ b/src/deprecatedCompat/4.6/importTypeAssertions.ts @@ -1,15 +1,15 @@ import { - EntityName, - ImportTypeAssertionContainer, - ImportTypeNode, - NodeFactory, - TypeNode, addNodeFactoryPatcher, buildOverload, + EntityName, factory, + ImportTypeAssertionContainer, + ImportTypeNode, isArray, isEntityName, isImportTypeAssertionContainer, + NodeFactory, + TypeNode, } from "../_namespaces/ts"; // DEPRECATION: Overloads to createImportTypeNode/updateImportTypeNode that do not accept `assertions` diff --git a/src/deprecatedCompat/4.7/typeParameterModifiers.ts b/src/deprecatedCompat/4.7/typeParameterModifiers.ts index 6f501f791d4..97f35beba41 100644 --- a/src/deprecatedCompat/4.7/typeParameterModifiers.ts +++ b/src/deprecatedCompat/4.7/typeParameterModifiers.ts @@ -1,13 +1,13 @@ import { + addNodeFactoryPatcher, + buildOverload, + factory, Identifier, + isArray, Modifier, NodeFactory, TypeNode, TypeParameterDeclaration, - addNodeFactoryPatcher, - buildOverload, - factory, - isArray, } from "../_namespaces/ts"; // DEPRECATION: Overloads to createTypeParameter/updateTypeParameter that does not accept `modifiers` diff --git a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts index a86a327bef8..d23969ccda6 100644 --- a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts +++ b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts @@ -1,22 +1,27 @@ import { + addNodeFactoryPatcher, AssertClause, AsteriskToken, BindingName, Block, + buildOverload, ClassDeclaration, ClassElement, ClassExpression, ClassStaticBlockDeclaration, + concatenate, ConstructorDeclaration, Decorator, DeprecationOptions, DotDotDotToken, EnumDeclaration, EnumMember, + every, ExclamationToken, ExportAssignment, ExportDeclaration, Expression, + factory, FunctionDeclaration, GetAccessorDeclaration, HeritageClause, @@ -26,30 +31,6 @@ import { ImportEqualsDeclaration, IndexSignatureDeclaration, InterfaceDeclaration, - MethodDeclaration, - Modifier, - ModifierLike, - ModuleBody, - ModuleDeclaration, - ModuleName, - ModuleReference, - NamedExportBindings, - NodeFactory, - NodeFlags, - ParameterDeclaration, - PropertyDeclaration, - PropertyName, - QuestionToken, - SetAccessorDeclaration, - TypeAliasDeclaration, - TypeElement, - TypeNode, - TypeParameterDeclaration, - addNodeFactoryPatcher, - buildOverload, - concatenate, - every, - factory, isArray, isAssertClause, isAsteriskToken, @@ -74,7 +55,26 @@ import { isTypeElement, isTypeNode, isTypeParameterDeclaration, + MethodDeclaration, + Modifier, + ModifierLike, + ModuleBody, + ModuleDeclaration, + ModuleName, + ModuleReference, + NamedExportBindings, + NodeFactory, + NodeFlags, + ParameterDeclaration, + PropertyDeclaration, + PropertyName, + QuestionToken, + SetAccessorDeclaration, some, + TypeAliasDeclaration, + TypeElement, + TypeNode, + TypeParameterDeclaration, } from "../_namespaces/ts"; // DEPRECATION: Deprecate passing `decorators` separate from `modifiers` diff --git a/src/deprecatedCompat/deprecate.ts b/src/deprecatedCompat/deprecate.ts index 860fde1b654..c56abe2df1e 100644 --- a/src/deprecatedCompat/deprecate.ts +++ b/src/deprecatedCompat/deprecate.ts @@ -1,10 +1,10 @@ import { Debug, DeprecationOptions, - Version, formatStringFromArgs, noop, version, + Version, } from "./_namespaces/ts"; export let enableDeprecationWarnings = true; diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index 641a78b8e61..8682631b078 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -1,7 +1,7 @@ import { + hasProperty, UnionToIntersection, Version, - hasProperty, } from "./_namespaces/ts"; import { deprecate } from "./deprecate"; diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 8d9b465d80b..58bd58cb021 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -1,35 +1,15 @@ import * as ts from "./_namespaces/ts"; import { - BuildOptions, - BuilderProgram, - CharacterCodes, - CommandLineOption, - CompilerOptions, - CreateProgram, - CreateProgramOptions, - Debug, - Diagnostic, - DiagnosticMessage, - DiagnosticReporter, - Diagnostics, - EmitAndSemanticDiagnosticsBuilderProgram, - ExitStatus, - ExtendedConfigCacheEntry, - Extension, - ParsedCommandLine, - Program, - ReportEmitErrorSummary, - SolutionBuilder, - SolutionBuilderHostBase, - SourceFile, - System, - WatchCompilerHost, - WatchOptions, arrayFrom, + BuilderProgram, + BuildOptions, buildOpts, changeCompilerHostLikeToUseCache, + CharacterCodes, combinePaths, + CommandLineOption, compareStringsCaseInsensitive, + CompilerOptions, contains, convertToOptionsWithAbsolutePaths, convertToTSConfig, @@ -40,6 +20,8 @@ import { createGetCanonicalFileName, createIncrementalCompilerHost, createProgram, + CreateProgram, + CreateProgramOptions, createSolutionBuilder, createSolutionBuilderHost, createSolutionBuilderWithWatch, @@ -47,8 +29,17 @@ import { createWatchCompilerHostOfConfigFile, createWatchCompilerHostOfFilesAndCompilerOptions, createWatchProgram, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, dumpTracingLegend, + EmitAndSemanticDiagnosticsBuilderProgram, emitFilesAndReportErrorsAndGetExitStatus, + ExitStatus, + ExtendedConfigCacheEntry, + Extension, fileExtensionIs, fileExtensionIsOneOf, filter, @@ -75,18 +66,27 @@ import { parseBuildCommand, parseCommandLine, parseConfigFileWithSystem, + ParsedCommandLine, + Program, reduceLeftIterator, + ReportEmitErrorSummary, + SolutionBuilder, + SolutionBuilderHostBase, sort, - startTracing, + SourceFile, startsWith, + startTracing, stringContains, supportedJSExtensionsFlat, supportedTSExtensionsFlat, sys, + System, toPath, tracing, validateLocaleAndSetLanguage, version, + WatchCompilerHost, + WatchOptions, } from "./_namespaces/ts"; import * as performance from "../compiler/_namespaces/ts.performance"; diff --git a/src/harness/client.ts b/src/harness/client.ts index 852372aea49..cfc1c6f1557 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -10,6 +10,11 @@ import { CompletionEntry, CompletionEntryDetails, CompletionInfo, + computeLineAndCharacterOfPosition, + computeLineStarts, + computePositionOfLineAndCharacter, + createQueue, + createTextSpanFromBounds, Debug, DefinitionInfo, DefinitionInfoAndBoundSpan, @@ -22,25 +27,32 @@ import { EditorOptions, EmitOutput, FileTextChanges, + firstDefined, FormatCodeOptions, FormatCodeSettings, + getSnapshotText, + identity, ImplementationLocation, InlayHint, InlayHintKind, + isString, JSDocTagInfo, LanguageService, LanguageServiceHost, + map, + mapOneOrMany, NavigateToItem, NavigationBarItem, NavigationTree, + notImplemented, OrganizeImportsArgs, OutliningSpan, PatternMatchKind, Program, QuickInfo, RefactorEditInfo, - ReferenceEntry, ReferencedSymbol, + ReferenceEntry, RenameInfo, RenameInfoFailure, RenameInfoSuccess, @@ -53,24 +65,12 @@ import { Symbol, TextChange, TextInsertion, + textPart, TextRange, TextSpan, TodoComment, TodoCommentDescriptor, UserPreferences, - computeLineAndCharacterOfPosition, - computeLineStarts, - computePositionOfLineAndCharacter, - createQueue, - createTextSpanFromBounds, - firstDefined, - getSnapshotText, - identity, - isString, - map, - mapOneOrMany, - notImplemented, - textPart, } from "./_namespaces/ts"; import { CommandNames, diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 69777db105b..e3e67e1909d 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -1,16 +1,12 @@ import { CharacterCodes, - CompilerOptions, - Debug, - Extension, - MapLike, - Path, - TypeAcquisition, - Version, combinePaths, compareStringsCaseSensitive, + CompilerOptions, + Debug, deduplicate, equateStringsCaseSensitive, + Extension, fileExtensionIs, flatMap, forEach, @@ -23,11 +19,15 @@ import { getProperty, hasJSFileExtension, mapDefined, + MapLike, normalizePath, + Path, readConfigFile, removeFileExtension, removeMinAndVersionNumbers, some, + TypeAcquisition, + Version, versionMajorMinor, } from "./_namespaces/ts"; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 4004c82e98f..6b27c3296bc 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1,104 +1,57 @@ import { ActionInvalidate, ActionSet, + asNormalizedPath, AutoImportProviderProject, BeginEnablePluginResult, BeginInstallTypes, ConfiguredProject, + countEachFileTypes, + createPackageJsonCache, + emptyArray, EndInstallTypes, Errors, ExternalProject, - ITypingsInstaller, + getBaseConfigFileName, + hasNoTypeScriptSource, InferredProject, InvalidateCachedTypings, - LogLevel, + isConfiguredProject, + isDynamicFileName, + isInferredProject, + isInferredProjectName, + ITypingsInstaller, Logger, + LogLevel, + makeAutoImportProviderProjectName, + makeAuxiliaryProjectName, + makeInferredProjectName, Msg, NormalizedPath, + normalizedPathToPath, + nullTypingsInstaller, PackageInstalledResponse, PackageJsonCache, Project, ProjectFilesWithTSDiagnostics, ProjectKind, ProjectOptions, + protocol, ScriptInfo, ScriptInfoVersion, ServerHost, Session, SetTypings, ThrottledOperations, - TypingsCache, - asNormalizedPath, - countEachFileTypes, - createPackageJsonCache, - emptyArray, - getBaseConfigFileName, - hasNoTypeScriptSource, - isConfiguredProject, - isDynamicFileName, - isInferredProject, - isInferredProjectName, - makeAutoImportProviderProjectName, - makeAuxiliaryProjectName, - makeInferredProjectName, - normalizedPathToPath, - nullTypingsInstaller, - protocol, toNormalizedPath, + TypingsCache, } from "./_namespaces/ts.server"; import { - AssertionLevel, - CachedDirectoryStructureHost, - CommandLineOption, - CompilerOptions, - CompletionInfo, - ConfigFileProgramReloadLevel, - Debug, - Diagnostic, - DirectoryStructureHost, - DocumentPosition, - DocumentPositionMapper, - DocumentRegistry, - DocumentRegistryBucketKeyWithMode, - ExtendedConfigCacheEntry, - FileExtensionInfo, - FileWatcher, - FileWatcherEventKind, - FormatCodeSettings, - HostCancellationToken, - IncompleteCompletionsCache, - IndentStyle, - LanguageServiceMode, - MultiMap, - PackageJsonAutoImportPreference, - ParsedCommandLine, - Path, - PerformanceEvent, - PluginImport, - PollingInterval, - ProjectPackageJsonInfo, - ProjectReference, - ReadMapFile, - ReadonlyCollection, - ResolvedProjectReference, - ScriptKind, - SharedExtendedConfigFileWatcher, - SourceFile, - SourceFileLike, - Ternary, - TextChange, - TsConfigSourceFile, - TypeAcquisition, - UserPreferences, - WatchDirectoryFlags, - WatchFactory, - WatchLogLevel, - WatchOptions, - WatchType, - WildcardDirectoryWatcher, addToSeen, arrayFrom, arrayToMap, + AssertionLevel, + CachedDirectoryStructureHost, canJsonReportNoInputFiles, canWatchDirectoryOrFile, cleanExtendedConfigCache, @@ -106,6 +59,10 @@ import { clearSharedExtendedConfigFileWatcher, closeFileWatcherOf, combinePaths, + CommandLineOption, + CompilerOptions, + CompletionInfo, + ConfigFileProgramReloadLevel, contains, containsPath, convertCompilerOptionsForTelemetry, @@ -115,10 +72,21 @@ import { createDocumentRegistryInternal, createGetCanonicalFileName, createMultiMap, + Debug, + Diagnostic, directorySeparator, + DirectoryStructureHost, + DocumentPosition, + DocumentPositionMapper, + DocumentRegistry, + DocumentRegistryBucketKeyWithMode, emptyOptions, ensureTrailingDirectorySeparator, + ExtendedConfigCacheEntry, + FileExtensionInfo, fileExtensionIs, + FileWatcher, + FileWatcherEventKind, find, flatMap, forEach, @@ -126,6 +94,7 @@ import { forEachEntry, forEachKey, forEachResolvedProjectReference, + FormatCodeSettings, getAnyExtensionFromPath, getBaseFileName, getDefaultFormatCodeSettings, @@ -140,7 +109,10 @@ import { hasExtension, hasProperty, hasTSFileExtension, + HostCancellationToken, identity, + IncompleteCompletionsCache, + IndentStyle, isArray, isIgnoredFileFromWildCardWatching, isInsideNodeModules, @@ -148,37 +120,65 @@ import { isNodeModulesDirectory, isRootedDiskPath, isString, + LanguageServiceMode, length, map, mapDefinedEntries, mapDefinedIterator, missingFileModifiedTime, + MultiMap, noop, normalizePath, normalizeSlashes, optionDeclarations, optionsForWatch, + PackageJsonAutoImportPreference, + ParsedCommandLine, parseJsonSourceFileConfigFileContent, parseJsonText, parsePackageName, + Path, + PerformanceEvent, + PluginImport, + PollingInterval, + ProjectPackageJsonInfo, + ProjectReference, + ReadMapFile, + ReadonlyCollection, removeFileExtension, removeIgnoredPath, removeMinAndVersionNumbers, + ResolvedProjectReference, resolveProjectReferencePath, returnNoopFileWatcher, returnTrue, + ScriptKind, + SharedExtendedConfigFileWatcher, some, + SourceFile, + SourceFileLike, startsWith, + Ternary, + TextChange, toFileNameLowerCase, toPath, tracing, tryAddToSet, tryReadFile, + TsConfigSourceFile, + TypeAcquisition, typeAcquisitionDeclarations, unorderedRemoveItem, updateSharedExtendedConfigFileWatcher, updateWatchingWildcardDirectories, + UserPreferences, version, + WatchDirectoryFlags, + WatchFactory, + WatchLogLevel, + WatchOptions, + WatchType, + WildcardDirectoryWatcher, } from "./_namespaces/ts"; export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; diff --git a/src/server/moduleSpecifierCache.ts b/src/server/moduleSpecifierCache.ts index c54a68b354d..2f2142a5bb0 100644 --- a/src/server/moduleSpecifierCache.ts +++ b/src/server/moduleSpecifierCache.ts @@ -4,10 +4,10 @@ import { ModulePath, ModuleSpecifierCache, ModuleSpecifierOptions, + nodeModulesPathPart, Path, ResolvedModuleSpecifierInfo, UserPreferences, - nodeModulesPathPart, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/server/packageJsonCache.ts b/src/server/packageJsonCache.ts index 2f2f0be3305..d1c12c65d9b 100644 --- a/src/server/packageJsonCache.ts +++ b/src/server/packageJsonCache.ts @@ -1,12 +1,12 @@ import { + combinePaths, + createPackageJsonInfo, Debug, + forEachAncestorDirectory, + getDirectoryPath, Path, ProjectPackageJsonInfo, Ternary, - combinePaths, - createPackageJsonInfo, - forEachAncestorDirectory, - getDirectoryPath, tryFileExists, } from "./_namespaces/ts"; import { ProjectService } from "./_namespaces/ts.server"; diff --git a/src/server/project.ts b/src/server/project.ts index 8c8748fe5bd..dcce4777002 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,105 +1,65 @@ import * as ts from "./_namespaces/ts"; import { + asNormalizedPath, + createModuleSpecifierCache, + emptyArray, Errors, FileStats, + forEachResolvedProjectReferenceProject, LogLevel, ModuleImportResult, Msg, NormalizedPath, + projectContainsInfoDirectly, ProjectOptions, ProjectReferenceProjectLoadKind, ProjectService, + protocol, ScriptInfo, ServerHost, Session, - TypingsCache, - asNormalizedPath, - createModuleSpecifierCache, - emptyArray, - forEachResolvedProjectReferenceProject, - projectContainsInfoDirectly, - protocol, toNormalizedPath, + TypingsCache, updateProjectIfDirty, } from "./_namespaces/ts.server"; import { - ApplyCodeActionCommandResult, - BuilderState, - CachedDirectoryStructureHost, - CompilerHost, - CompilerOptions, - ConfigFileProgramReloadLevel, - Debug, - Diagnostic, - DirectoryStructureHost, - DirectoryWatcherCallback, - DocumentPositionMapper, - DocumentRegistry, - ExportInfoMap, - Extension, - FileReference, - FileWatcher, - FileWatcherCallback, - FileWatcherEventKind, - GetCanonicalFileName, - HasInvalidatedResolutions, - HostCancellationToken, - IScriptSnapshot, - InstallPackageOptions, - JsTyping, - LanguageService, - LanguageServiceHost, - LanguageServiceMode, - ModuleResolutionCache, - ModuleResolutionHost, - ModuleResolutionInfo, - PackageJsonAutoImportPreference, - PackageJsonInfo, - ParsedCommandLine, - Path, - PerformanceEvent, - PluginImport, - PollingInterval, - Program, - ProjectPackageJsonInfo, - ProjectReference, - ResolutionCache, - ResolutionMode, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ScriptKind, - SortedReadonlyArray, - SourceFile, - SourceMapper, - StructureIsReused, - SymlinkCache, - ThrottledCancellationToken, - TypeAcquisition, - TypeReferenceDirectiveResolutionInfo, - WatchDirectoryFlags, - WatchOptions, - WatchType, addRange, append, + ApplyCodeActionCommandResult, arrayFrom, arrayToMap, + BuilderState, + CachedDirectoryStructureHost, changesAffectModuleResolution, clearMap, cloneCompilerOptions, closeFileWatcher, closeFileWatcherOf, combinePaths, + CompilerHost, + CompilerOptions, concatenate, + ConfigFileProgramReloadLevel, createCacheableExportInfoMap, createLanguageService, createResolutionCache, createSymlinkCache, + Debug, + Diagnostic, + DirectoryStructureHost, + DirectoryWatcherCallback, + DocumentPositionMapper, + DocumentRegistry, enumerateInsertsAndDeletes, every, explainFiles, + ExportInfoMap, + Extension, fileExtensionIs, + FileReference, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, filter, firstDefined, flatMap, @@ -109,6 +69,7 @@ import { generateDjb2Hash, getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, + GetCanonicalFileName, getDeclarationEmitOutputFilePathWorker, getDefaultCompilerOptions, getDefaultLibFileName, @@ -120,36 +81,75 @@ import { getNormalizedAbsolutePath, getOrUpdate, getStringComparer, + HasInvalidatedResolutions, + HostCancellationToken, inferredTypesContainingFile, + InstallPackageOptions, + IScriptSnapshot, isDeclarationFileName, isExternalModuleNameRelative, isInsideNodeModules, + JsTyping, + LanguageService, + LanguageServiceHost, + LanguageServiceMode, map, mapDefined, maybeBind, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, noop, noopFileWatcher, normalizePath, normalizeSlashes, orderedRemoveItem, outFile, + PackageJsonAutoImportPreference, + PackageJsonInfo, + ParsedCommandLine, parsePackageName, + Path, perfLogger, + PerformanceEvent, + PluginImport, + PollingInterval, + Program, + ProjectPackageJsonInfo, + ProjectReference, removeFileExtension, + ResolutionCache, resolutionExtensionIsTSOrJson, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, resolvePackageNameToPackageJson, returnFalse, returnTrue, + ScriptKind, some, sort, sortAndDeduplicate, + SortedReadonlyArray, + SourceFile, + SourceMapper, startsWith, stripQuotes, + StructureIsReused, + SymlinkCache, + ThrottledCancellationToken, timestamp, toPath, tracing, + TypeAcquisition, + TypeReferenceDirectiveResolutionInfo, updateErrorForNoInputFiles, updateMissingFilePathsWatch, + WatchDirectoryFlags, + WatchOptions, + WatchType, } from "./_namespaces/ts"; export enum ProjectKind { diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index f21e316baac..9c1371f2d9f 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -4,32 +4,18 @@ import { Errors, ExternalProject, InferredProject, - NormalizedPath, - Project, - ProjectKind, - ScriptVersionCache, - ServerHost, isConfiguredProject, isExternalProject, isInferredProject, maxFileSize, + NormalizedPath, + Project, + ProjectKind, protocol, + ScriptVersionCache, + ServerHost, } from "./_namespaces/ts.server"; import { - Debug, - DocumentPositionMapper, - DocumentRegistryBucketKeyWithMode, - FileWatcher, - FileWatcherEventKind, - FormatCodeSettings, - IScriptSnapshot, - LineInfo, - Path, - ScriptKind, - ScriptSnapshot, - SourceFile, - SourceFileLike, - TextSpan, assign, clear, closeFileWatcherOf, @@ -38,18 +24,32 @@ import { computePositionOfLineAndCharacter, contains, createTextSpanFromBounds, + Debug, directorySeparator, + DocumentPositionMapper, + DocumentRegistryBucketKeyWithMode, emptyOptions, + FileWatcher, + FileWatcherEventKind, forEach, + FormatCodeSettings, getBaseFileName, getDefaultFormatCodeSettings, getLineInfo, getScriptKindFromFileName, getSnapshotText, hasTSFileExtension, + IScriptSnapshot, isString, + LineInfo, + Path, + ScriptKind, + ScriptSnapshot, some, + SourceFile, + SourceFileLike, stringContains, + TextSpan, unorderedRemoveItem, } from "./_namespaces/ts"; diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index d73d8508643..a4acf98f551 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -1,12 +1,12 @@ import { - Debug, - IScriptSnapshot, - TextChangeRange, - TextSpan, collapseTextChangeRangesAcrossMultipleVersions, computeLineStarts, createTextChangeRange, createTextSpan, + Debug, + IScriptSnapshot, + TextChangeRange, + TextSpan, unchangedTextChangeRange, } from "./_namespaces/ts"; import { diff --git a/src/server/session.ts b/src/server/session.ts index d3893f37495..ceb15519eb4 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1,7 +1,11 @@ import { + arrayFrom, + arrayIterator, + arrayReverseIterator, CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, + cast, CodeAction, CodeActionCommand, CodeFixAction, @@ -12,64 +16,6 @@ import { CompletionEntryDetails, CompletionInfo, CompletionTriggerKind, - Debug, - DefinitionInfo, - DefinitionInfoAndBoundSpan, - Diagnostic, - DiagnosticRelatedInformation, - DocumentHighlights, - DocumentPosition, - DocumentSpan, - EmitOutput, - FileTextChanges, - FindAllReferences, - FormatCodeSettings, - GoToDefinition, - HostCancellationToken, - ImplementationLocation, - ImportSpecifier, - JSDocLinkDisplayPart, - JSDocTagInfo, - LanguageServiceMode, - LineAndCharacter, - ModuleResolutionKind, - MultiMap, - NavigateToItem, - NavigationBarItem, - NavigationTree, - OperationCanceledException, - OrganizeImportsMode, - OutliningSpan, - Path, - PerformanceEvent, - PossibleProgramFileInfo, - Program, - QuickInfo, - RefactorEditInfo, - ReferenceEntry, - ReferencedSymbol, - ReferencedSymbolDefinitionInfo, - ReferencedSymbolEntry, - RenameInfo, - RenameLocation, - ScriptKind, - SelectionRange, - SemanticClassificationFormat, - SignatureHelpItem, - SignatureHelpItems, - SourceFile, - SymbolDisplayPart, - SyntaxKind, - TextChange, - TextInsertion, - TextRange, - TextSpan, - UserPreferences, - WithMetadata, - arrayFrom, - arrayIterator, - arrayReverseIterator, - cast, computeLineAndCharacterOfPosition, computeLineStarts, concatenate, @@ -77,20 +23,32 @@ import { createSet, createTextSpan, createTextSpanFromBounds, + Debug, decodedTextSpanIntersectsWith, deduplicate, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + Diagnostic, diagnosticCategoryName, + DiagnosticRelatedInformation, displayPartsToString, + DocumentHighlights, + DocumentPosition, + DocumentSpan, documentSpansEqual, + EmitOutput, equateValues, + FileTextChanges, filter, find, + FindAllReferences, first, firstOrUndefined, flatMap, flatMapToMutable, flattenDiagnosticMessageText, forEachNameInAccessChainWalkingLeft, + FormatCodeSettings, formatting, getDeclarationFromName, getDeclarationOfKind, @@ -110,45 +68,96 @@ import { getTemporaryModuleResolutionState, getTextOfIdentifierOrLiteral, getTouchingPropertyName, + GoToDefinition, + HostCancellationToken, identity, + ImplementationLocation, + ImportSpecifier, isAccessExpression, isArray, isDeclarationFileName, isIdentifier, isString, isStringLiteralLike, + JSDocLinkDisplayPart, + JSDocTagInfo, + LanguageServiceMode, + LineAndCharacter, map, mapDefined, mapDefinedIterator, mapIterator, mapOneOrMany, memoize, + ModuleResolutionKind, + MultiMap, + NavigateToItem, + NavigationBarItem, + NavigationTree, nodeModulesPathPart, normalizePath, + OperationCanceledException, + OrganizeImportsMode, outFile, + OutliningSpan, + Path, perfLogger, + PerformanceEvent, + PossibleProgramFileInfo, + Program, + QuickInfo, + RefactorEditInfo, + ReferencedSymbol, + ReferencedSymbolDefinitionInfo, + ReferencedSymbolEntry, + ReferenceEntry, removeFileExtension, + RenameInfo, + RenameLocation, + ScriptKind, + SelectionRange, + SemanticClassificationFormat, + SignatureHelpItem, + SignatureHelpItems, singleIterator, some, + SourceFile, startsWith, stringContains, + SymbolDisplayPart, + SyntaxKind, + TextChange, + TextInsertion, + TextRange, + TextSpan, textSpanEnd, toArray, toFileNameLowerCase, tracing, unmangleScopedPackageName, + UserPreferences, version, + WithMetadata, } from "./_namespaces/ts"; import { ConfigFileDiagEvent, ConfiguredProject, + convertFormatOptions, + convertScriptKindName, + convertUserPreferences, EmitResult, + emptyArray, Errors, GcTimer, + indent, + isConfigFile, + isConfiguredProject, + isExternalProject, + isInferredProject, ITypingsInstaller, LargeFileReferencedEvent, - LogLevel, Logger, + LogLevel, Msg, NormalizedPath, Project, @@ -162,19 +171,10 @@ import { ProjectServiceEventHandler, ProjectServiceOptions, ProjectsUpdatedInBackgroundEvent, + protocol, ScriptInfo, ScriptInfoOrConfig, ServerHost, - convertFormatOptions, - convertScriptKindName, - convertUserPreferences, - emptyArray, - indent, - isConfigFile, - isConfiguredProject, - isExternalProject, - isInferredProject, - protocol, stringifyIndented, toNormalizedPath, updateProjectIfDirty, diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index 65c707bb929..42c91be6047 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -1,21 +1,21 @@ import { ApplyCodeActionCommandResult, - CompilerOptions, - InstallPackageOptions, - Path, - SortedReadonlyArray, - TypeAcquisition, arrayIsEqualTo, + CompilerOptions, getAllowJSCompilerOption, + InstallPackageOptions, noop, notImplemented, + Path, returnFalse, sort, + SortedReadonlyArray, + TypeAcquisition, } from "./_namespaces/ts"; import { + emptyArray, Project, ProjectService, - emptyArray, } from "./_namespaces/ts.server"; export interface InstallPackageOptionsWithProject extends InstallPackageOptions { diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 2ba220593a3..9c8a45c1715 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,14 +1,14 @@ import { - Comparer, - SortedArray, binarySearch, + Comparer, getBaseFileName, identity, perfLogger, + SortedArray, } from "./_namespaces/ts"; import { - LogLevel, Logger, + LogLevel, NormalizedPath, ServerHost, } from "./_namespaces/ts.server"; diff --git a/src/server/utilitiesPublic.ts b/src/server/utilitiesPublic.ts index e2621359f41..e071e87dfba 100644 --- a/src/server/utilitiesPublic.ts +++ b/src/server/utilitiesPublic.ts @@ -1,11 +1,11 @@ import { + getNormalizedAbsolutePath, + isRootedDiskPath, + normalizePath, Path, SortedArray, SortedReadonlyArray, TypeAcquisition, - getNormalizedAbsolutePath, - isRootedDiskPath, - normalizePath, } from "./_namespaces/ts"; import { DiscoverTypings, diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index cd08b00b51a..f06f85142b8 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -4,10 +4,12 @@ import { BindingPattern, Block, BreakOrContinueStatement, + canHaveDecorators, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, + createTextSpanFromBounds, Debug, DestructuringPattern, DoStatement, @@ -16,15 +18,32 @@ import { ExportDeclaration, Expression, ExpressionStatement, + findLast, + findNextToken, + findPrecedingToken, + forEach, ForInStatement, ForOfStatement, ForStatement, FunctionLikeDeclaration, + getModuleInstanceState, + getTokenAtPosition, HasDecorators, + hasOnlyExpressionInitializer, + hasSyntacticModifier, IfStatement, ImportDeclaration, ImportEqualsDeclaration, + isArrayLiteralOrObjectLiteralDestructuringPattern, + isAssignmentOperator, + isBindingPattern, + isDecorator, + isExpressionNode, + isFunctionBlock, + isFunctionLike, + isVariableDeclarationList, LabeledStatement, + lastOrUndefined, ModifierFlags, ModuleDeclaration, ModuleInstanceState, @@ -38,6 +57,7 @@ import { PropertyDeclaration, PropertySignature, ReturnStatement, + skipTrivia, SourceFile, SwitchStatement, SyntaxKind, @@ -50,26 +70,6 @@ import { VariableStatement, WhileStatement, WithStatement, - canHaveDecorators, - createTextSpanFromBounds, - findLast, - findNextToken, - findPrecedingToken, - forEach, - getModuleInstanceState, - getTokenAtPosition, - hasOnlyExpressionInitializer, - hasSyntacticModifier, - isArrayLiteralOrObjectLiteralDestructuringPattern, - isAssignmentOperator, - isBindingPattern, - isDecorator, - isExpressionNode, - isFunctionBlock, - isFunctionLike, - isVariableDeclarationList, - lastOrUndefined, - skipTrivia, } from "./_namespaces/ts"; /** diff --git a/src/services/callHierarchy.ts b/src/services/callHierarchy.ts index 4784490883c..fc4280802ee 100644 --- a/src/services/callHierarchy.ts +++ b/src/services/callHierarchy.ts @@ -1,5 +1,6 @@ import { AccessExpression, + append, ArrowFunction, AsExpression, CallExpression, @@ -7,53 +8,30 @@ import { CallHierarchyItem, CallHierarchyOutgoingCall, CancellationToken, + canHaveModifiers, ClassDeclaration, ClassExpression, ClassLikeDeclaration, ClassStaticBlockDeclaration, - Debug, - Decorator, - ElementAccessExpression, - EmitHint, - FindAllReferences, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, - Identifier, - JsxOpeningLikeElement, - MethodDeclaration, - ModifierFlags, - ModuleDeclaration, - NewExpression, - Node, - NodeFlags, - ParameterDeclaration, - Program, - PropertyAccessExpression, - SatisfiesExpression, - SetAccessorDeclaration, - SourceFile, - SymbolFlags, - SyntaxKind, - TaggedTemplateExpression, - TextRange, - TextSpan, - TypeAssertion, - TypeChecker, - VariableDeclaration, - append, - canHaveModifiers, compareStringsCaseSensitive, createPrinter, createTextRangeFromNode, createTextSpanFromBounds, createTextSpanFromRange, + Debug, + Decorator, + ElementAccessExpression, + EmitHint, filter, find, + FindAllReferences, findAncestor, forEach, forEachChild, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, getAssignedName, getClassExtendsHeritageElement, getCombinedNodeFlags, @@ -64,6 +42,7 @@ import { getNodeModifiers, group, hasSyntacticModifier, + Identifier, idText, indicesOf, isAccessExpression, @@ -100,10 +79,31 @@ import { isTaggedTemplateExpression, isTaggedTemplateTag, isVariableDeclaration, + JsxOpeningLikeElement, map, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, moveRangePastModifiers, + NewExpression, + Node, + NodeFlags, + ParameterDeclaration, + Program, + PropertyAccessExpression, + SatisfiesExpression, + SetAccessorDeclaration, skipTrivia, + SourceFile, + SymbolFlags, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + TextSpan, + TypeAssertion, + TypeChecker, usingSingleLineStringWriter, + VariableDeclaration, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/classifier.ts b/src/services/classifier.ts index cd62000d549..40a37c99a62 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -1,62 +1,29 @@ import { + __String, + arrayToNumericMap, CancellationToken, CharacterCodes, ClassDeclaration, ClassificationInfo, ClassificationResult, + Classifications, ClassificationType, ClassificationTypeNames, - Classifications, ClassifiedSpan, Classifier, - Debug, - EndOfLineState, - EnumDeclaration, - HasJSDoc, - InterfaceDeclaration, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocEnumTag, - JSDocImplementsTag, - JSDocParameterTag, - JSDocPropertyTag, - JSDocReturnTag, - JSDocSeeTag, - JSDocTemplateTag, - JSDocThisTag, - JSDocTypeTag, - JSDocTypedefTag, - JsxAttribute, - JsxClosingElement, - JsxOpeningElement, - JsxSelfClosingElement, - ModuleDeclaration, - ModuleInstanceState, - Node, - ParameterDeclaration, - Push, - Scanner, - ScriptTarget, - SemanticMeaning, - SourceFile, - Symbol, - SymbolFlags, - SyntaxKind, - TextSpan, - TokenClass, - TypeChecker, - TypeParameterDeclaration, - __String, - arrayToNumericMap, commentPragmas, couldStartTrivia, createScanner, createTextSpan, + Debug, decodedTextSpanIntersectsWith, + EndOfLineState, + EnumDeclaration, getMeaningFromLocation, getModuleInstanceState, getTypeArgumentOrTypeParameterList, + HasJSDoc, + InterfaceDeclaration, isAccessibilityModifier, isConstTypeReference, isIdentifier, @@ -69,12 +36,45 @@ import { isThisIdentifier, isToken, isTrivia, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocEnumTag, + JSDocImplementsTag, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeTag, + JsxAttribute, + JsxClosingElement, + JsxOpeningElement, + JsxSelfClosingElement, lastOrUndefined, + ModuleDeclaration, + ModuleInstanceState, + Node, nodeIsMissing, + ParameterDeclaration, parseIsolatedJSDocComment, + Push, + Scanner, + ScriptTarget, + SemanticMeaning, setParent, some, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + TextSpan, textSpanIntersectsWith, + TokenClass, + TypeChecker, + TypeParameterDeclaration, } from "./_namespaces/ts"; /** The classifier is used for syntactic highlighting in editors via the TSServer */ diff --git a/src/services/classifier2020.ts b/src/services/classifier2020.ts index a2b50559124..96e246a85db 100644 --- a/src/services/classifier2020.ts +++ b/src/services/classifier2020.ts @@ -3,25 +3,10 @@ import { CancellationToken, Classifications, ClassifiedSpan2020, + createTextSpan, Debug, Declaration, EndOfLineState, - ModifierFlags, - NamedDeclaration, - Node, - NodeFlags, - ParameterDeclaration, - Program, - SemanticMeaning, - SourceFile, - Symbol, - SymbolFlags, - SyntaxKind, - TextSpan, - Type, - TypeChecker, - VariableDeclaration, - createTextSpan, forEachChild, getCombinedModifierFlags, getCombinedNodeFlags, @@ -42,7 +27,22 @@ import { isQualifiedName, isSourceFile, isVariableDeclaration, + ModifierFlags, + NamedDeclaration, + Node, + NodeFlags, + ParameterDeclaration, + Program, + SemanticMeaning, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + TextSpan, textSpanIntersectsWith, + Type, + TypeChecker, + VariableDeclaration, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/codeFixProvider.ts b/src/services/codeFixProvider.ts index 7c37ddee959..0d6ab81face 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -1,4 +1,6 @@ import { + arrayFrom, + cast, CodeActionCommand, CodeFixAction, CodeFixAllContext, @@ -6,22 +8,20 @@ import { CodeFixContextBase, CodeFixRegistration, CombinedCodeActions, - Debug, - Diagnostic, - DiagnosticAndArguments, - DiagnosticWithLocation, - FileTextChanges, - Push, - TextChange, - arrayFrom, - cast, computeSuggestionDiagnostics, contains, createMultiMap, + Debug, + Diagnostic, + DiagnosticAndArguments, diagnosticToString, + DiagnosticWithLocation, + FileTextChanges, flatMap, isString, map, + Push, + TextChange, textChanges, } from "./_namespaces/ts"; diff --git a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts index 2702dd72cab..0360e9d117a 100644 --- a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts +++ b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts @@ -1,16 +1,16 @@ import { AsExpression, Diagnostics, - SourceFile, - SyntaxKind, - TypeAssertion, factory, findAncestor, getTokenAtPosition, isAsExpression, isInJSFile, isTypeAssertionExpression, + SourceFile, + SyntaxKind, textChanges, + TypeAssertion, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/addMissingAsync.ts b/src/services/codefixes/addMissingAsync.ts index 909e2b68c0d..bb0510a90d0 100644 --- a/src/services/codefixes/addMissingAsync.ts +++ b/src/services/codefixes/addMissingAsync.ts @@ -2,19 +2,15 @@ import { ArrowFunction, CodeFixAllContext, CodeFixContext, + createTextSpanFromNode, Diagnostic, Diagnostics, - FileTextChanges, - FunctionDeclaration, - FunctionExpression, - MethodDeclaration, - ModifierFlags, - SourceFile, - TextSpan, - createTextSpanFromNode, factory, + FileTextChanges, find, findAncestor, + FunctionDeclaration, + FunctionExpression, getNodeId, getSyntacticModifierFlags, getSynthesizedDeepClone, @@ -24,8 +20,12 @@ import { isFunctionExpression, isMethodDeclaration, isNumber, + MethodDeclaration, + ModifierFlags, some, + SourceFile, textChanges, + TextSpan, textSpanEnd, textSpansEqual, } from "../_namespaces/ts"; diff --git a/src/services/codefixes/addMissingAwait.ts b/src/services/codefixes/addMissingAwait.ts index a71854c682d..d93138a1dbe 100644 --- a/src/services/codefixes/addMissingAwait.ts +++ b/src/services/codefixes/addMissingAwait.ts @@ -2,26 +2,15 @@ import { CancellationToken, CodeFixAllContext, CodeFixContext, + compact, + contains, Diagnostic, Diagnostics, Expression, - FileTextChanges, - FindAllReferences, - Identifier, - ModifierFlags, - Node, - NodeFlags, - Program, - SourceFile, - Symbol, - SyntaxKind, - TextSpan, - TypeChecker, - TypeFlags, - compact, - contains, factory, + FileTextChanges, find, + FindAllReferences, findAncestor, findPrecedingToken, forEach, @@ -29,6 +18,7 @@ import { getFixableErrorSpanExpression, getSymbolId, hasSyntacticModifier, + Identifier, isArrowFunction, isBinaryExpression, isBlock, @@ -38,12 +28,22 @@ import { isNumber, isPropertyAccessExpression, isVariableDeclaration, + ModifierFlags, + Node, + NodeFlags, positionIsASICandidate, + Program, some, + SourceFile, + Symbol, + SyntaxKind, textChanges, + TextSpan, textSpansEqual, tryAddToSet, tryCast, + TypeChecker, + TypeFlags, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/addMissingConst.ts b/src/services/codefixes/addMissingConst.ts index bc443c21eb3..8a848c2616f 100644 --- a/src/services/codefixes/addMissingConst.ts +++ b/src/services/codefixes/addMissingConst.ts @@ -1,12 +1,7 @@ import { Diagnostics, - Expression, - Node, - Program, - SourceFile, - SyntaxKind, - TypeChecker, every, + Expression, findAncestor, getTokenAtPosition, isArrayLiteralExpression, @@ -15,8 +10,13 @@ import { isExpressionStatement, isForInOrOfStatement, isIdentifier, + Node, + Program, + SourceFile, + SyntaxKind, textChanges, tryAddToSet, + TypeChecker, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/addMissingDeclareProperty.ts b/src/services/codefixes/addMissingDeclareProperty.ts index 1b73fc93980..c46c353b37f 100644 --- a/src/services/codefixes/addMissingDeclareProperty.ts +++ b/src/services/codefixes/addMissingDeclareProperty.ts @@ -1,10 +1,10 @@ import { Diagnostics, + getTokenAtPosition, + isIdentifier, Node, SourceFile, SyntaxKind, - getTokenAtPosition, - isIdentifier, textChanges, tryAddToSet, } from "../_namespaces/ts"; diff --git a/src/services/codefixes/addMissingInvocationForDecorator.ts b/src/services/codefixes/addMissingInvocationForDecorator.ts index 81f696963e1..330757c9fa7 100644 --- a/src/services/codefixes/addMissingInvocationForDecorator.ts +++ b/src/services/codefixes/addMissingInvocationForDecorator.ts @@ -1,11 +1,11 @@ import { Debug, Diagnostics, - SourceFile, factory, findAncestor, getTokenAtPosition, isDecorator, + SourceFile, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/addNameToNamelessParameter.ts b/src/services/codefixes/addNameToNamelessParameter.ts index afb0cbca3f5..dc36931d792 100644 --- a/src/services/codefixes/addNameToNamelessParameter.ts +++ b/src/services/codefixes/addNameToNamelessParameter.ts @@ -1,11 +1,11 @@ import { Debug, Diagnostics, - Identifier, - SourceFile, factory, getTokenAtPosition, + Identifier, isParameter, + SourceFile, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/addOptionalPropertyUndefined.ts b/src/services/codefixes/addOptionalPropertyUndefined.ts index 13445ee79cf..7664bea35be 100644 --- a/src/services/codefixes/addOptionalPropertyUndefined.ts +++ b/src/services/codefixes/addOptionalPropertyUndefined.ts @@ -1,19 +1,10 @@ import { Diagnostics, - Identifier, - Node, - PropertyAccessExpression, - SignatureDeclaration, - SourceFile, - Symbol, - SyntaxKind, - TextSpan, - TypeChecker, - UnionTypeNode, emptyArray, factory, getFixableErrorSpanExpression, getSourceFileOfNode, + Identifier, isBinaryExpression, isCallExpression, isExpression, @@ -25,7 +16,16 @@ import { isPropertySignature, isShorthandPropertyAssignment, isVariableDeclaration, + Node, + PropertyAccessExpression, + SignatureDeclaration, + SourceFile, + Symbol, + SyntaxKind, textChanges, + TextSpan, + TypeChecker, + UnionTypeNode, } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts index 847dfd53fbe..292c609bc72 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -2,26 +2,11 @@ import { Debug, Diagnostics, EmitFlags, - FunctionLikeDeclaration, - JSDocFunctionType, - JSDocNonNullableType, - JSDocNullableType, - JSDocOptionalType, - JSDocTypeLiteral, - JSDocVariadicType, - Node, - ParameterDeclaration, - PropertyDeclaration, - PropertySignature, - SourceFile, - SyntaxKind, - TypeNode, - TypeReferenceNode, - VariableDeclaration, emptyArray, factory, findChildOfKind, first, + FunctionLikeDeclaration, getJSDocReturnType, getJSDocType, getJSDocTypeParameterDeclarations, @@ -32,12 +17,27 @@ import { isJSDocIndexSignature, isOptionalJSDocPropertyLikeTag, isParameter, + JSDocFunctionType, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocTypeLiteral, + JSDocVariadicType, last, map, + Node, nullTransformationContext, + ParameterDeclaration, + PropertyDeclaration, + PropertySignature, setEmitFlags, + SourceFile, + SyntaxKind, textChanges, tryCast, + TypeNode, + TypeReferenceNode, + VariableDeclaration, visitEachChild, visitNode, visitNodes, diff --git a/src/services/codefixes/convertConstToLet.ts b/src/services/codefixes/convertConstToLet.ts index df499530c1a..d9817ab8250 100644 --- a/src/services/codefixes/convertConstToLet.ts +++ b/src/services/codefixes/convertConstToLet.ts @@ -1,17 +1,17 @@ import { - Diagnostics, - Program, - SourceFile, - Symbol, - SyntaxKind, - Token, addToSeen, + Diagnostics, factory, findChildOfKind, getSymbolId, getTokenAtPosition, isVariableDeclarationList, + Program, + SourceFile, + Symbol, + SyntaxKind, textChanges, + Token, tryCast, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts index 631d7474047..b2af8a230fe 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -1,38 +1,24 @@ import { + __String, AccessExpression, ArrowFunction, BinaryExpression, Block, + canHaveModifiers, ClassDeclaration, ClassElement, CodeFixContext, CompilerOptions, - Diagnostics, - Expression, - FunctionDeclaration, - FunctionExpression, - Modifier, - Node, - ObjectLiteralElementLike, - ObjectLiteralExpression, - PropertyAccessExpression, - PropertyName, - QuotePreference, - SourceFile, - Symbol, - SymbolFlags, - SyntaxKind, - TypeChecker, - UserPreferences, - VariableDeclaration, - __String, - canHaveModifiers, concatenate, copyLeadingComments, + Diagnostics, every, + Expression, factory, filter, forEach, + FunctionDeclaration, + FunctionExpression, getEmitScriptTarget, getNameOfDeclaration, getQuotePreference, @@ -57,9 +43,23 @@ import { isStringLiteralLike, isVariableDeclaration, isVariableDeclarationList, + Modifier, + Node, + ObjectLiteralElementLike, + ObjectLiteralExpression, + PropertyAccessExpression, + PropertyName, + QuotePreference, some, + SourceFile, + Symbol, + SymbolFlags, symbolName, + SyntaxKind, textChanges, + TypeChecker, + UserPreferences, + VariableDeclaration, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/convertLiteralTypeToMappedType.ts b/src/services/codefixes/convertLiteralTypeToMappedType.ts index 487277eba10..1e68d28758d 100644 --- a/src/services/codefixes/convertLiteralTypeToMappedType.ts +++ b/src/services/codefixes/convertLiteralTypeToMappedType.ts @@ -1,15 +1,15 @@ import { - Diagnostics, - SourceFile, - TypeLiteralNode, - TypeNode, cast, + Diagnostics, factory, getTokenAtPosition, isIdentifier, isPropertySignature, isTypeLiteralNode, + SourceFile, textChanges, + TypeLiteralNode, + TypeNode, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/convertToAsyncFunction.ts b/src/services/codefixes/convertToAsyncFunction.ts index 9417618ceaf..999dab6f413 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -5,43 +5,25 @@ import { BindingPattern, Block, CallExpression, - CodeFixContext, - Debug, - Diagnostics, - Expression, - FunctionExpression, - FunctionLikeDeclaration, - GeneratedIdentifierFlags, - Identifier, - Node, - NodeFlags, - ObjectFlags, - PropertyAccessExpression, - ReturnStatement, - Signature, - SignatureKind, - SourceFile, - Statement, - Symbol, - SyntaxKind, - TryStatement, - Type, - TypeChecker, - TypeNode, - TypeReference, - UnionReduction, canBeConvertedToAsync, + CodeFixContext, concatenate, createMultiMap, + Debug, + Diagnostics, elementAt, emptyArray, every, + Expression, factory, firstOrUndefined, flatMap, forEach, forEachChild, forEachReturnStatement, + FunctionExpression, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, getContainingFunction, getNodeId, getObjectFlags, @@ -51,6 +33,7 @@ import { getSynthesizedDeepCloneWithReplacements, getTokenAtPosition, hasPropertyAccessExpressionWithName, + Identifier, idText, isBindingElement, isBlock, @@ -71,11 +54,28 @@ import { isVariableDeclaration, lastOrUndefined, moveRangePastModifiers, - returnTrue, + Node, + NodeFlags, + ObjectFlags, + PropertyAccessExpression, returnsPromise, + ReturnStatement, + returnTrue, + Signature, + SignatureKind, skipTrivia, + SourceFile, + Statement, + Symbol, + SyntaxKind, textChanges, tryCast, + TryStatement, + Type, + TypeChecker, + TypeNode, + TypeReference, + UnionReduction, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/convertToEsModule.ts b/src/services/codefixes/convertToEsModule.ts index 6b75fafa79b..959b9ea4538 100644 --- a/src/services/codefixes/convertToEsModule.ts +++ b/src/services/codefixes/convertToEsModule.ts @@ -4,63 +4,45 @@ import { registerCodeFix, } from "../_namespaces/ts.codefix"; import { + __String, + arrayFrom, ArrowFunction, BinaryExpression, BindingElement, BindingName, ClassDeclaration, ClassExpression, - Debug, - Diagnostics, - ExportDeclaration, - ExportSpecifier, - Expression, - ExpressionStatement, - FunctionDeclaration, - FunctionExpression, - Identifier, - ImportDeclaration, - ImportSpecifier, - InternalSymbolName, - MethodDeclaration, - Modifier, - Node, - NodeArray, - NodeFlags, - ObjectLiteralElementLike, - ObjectLiteralExpression, - PropertyAccessExpression, - QuotePreference, - ReadonlyCollection, - ScriptTarget, - SourceFile, - Statement, - StringLiteralLike, - SymbolFlags, - SyntaxKind, - TypeChecker, - VariableStatement, - __String, - arrayFrom, concatenate, copyEntries, createMultiMap, createRange, + Debug, + Diagnostics, emptyMap, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, factory, filter, findChildOfKind, flatMap, forEach, + FunctionDeclaration, + FunctionExpression, getEmitScriptTarget, getModeForUsageLocation, getQuotePreference, getResolvedModule, getSynthesizedDeepClone, - getSynthesizedDeepCloneWithReplacements, getSynthesizedDeepClones, getSynthesizedDeepClonesWithReplacements, + getSynthesizedDeepCloneWithReplacements, + Identifier, + ImportDeclaration, importFromModuleSpecifier, + ImportSpecifier, + InternalSymbolName, isArray, isArrowFunction, isBinaryExpression, @@ -77,9 +59,27 @@ import { map, mapAllOrFail, mapIterator, + MethodDeclaration, + Modifier, + Node, + NodeArray, + NodeFlags, + ObjectLiteralElementLike, + ObjectLiteralExpression, + PropertyAccessExpression, + QuotePreference, rangeContainsRange, + ReadonlyCollection, + ScriptTarget, some, + SourceFile, + Statement, + StringLiteralLike, + SymbolFlags, + SyntaxKind, textChanges, + TypeChecker, + VariableStatement, } from "../_namespaces/ts"; registerCodeFix({ diff --git a/src/services/codefixes/convertToMappedObjectType.ts b/src/services/codefixes/convertToMappedObjectType.ts index ed80aef7764..1a3b8498a49 100644 --- a/src/services/codefixes/convertToMappedObjectType.ts +++ b/src/services/codefixes/convertToMappedObjectType.ts @@ -1,13 +1,6 @@ import { - Diagnostics, - IndexSignatureDeclaration, - InterfaceDeclaration, - SourceFile, - SyntaxKind, - TypeAliasDeclaration, - TypeLiteralNode, - TypeNode, cast, + Diagnostics, emptyArray, factory, first, @@ -15,12 +8,19 @@ import { getTokenAtPosition, hasEffectiveReadonlyModifier, idText, + IndexSignatureDeclaration, + InterfaceDeclaration, isIdentifier, isIndexSignatureDeclaration, isInterfaceDeclaration, isTypeAliasDeclaration, + SourceFile, + SyntaxKind, textChanges, tryCast, + TypeAliasDeclaration, + TypeLiteralNode, + TypeNode, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index c8fbc5fce3e..f6dfc027596 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -1,13 +1,10 @@ import { - CodeFixContextBase, - Diagnostics, - ExportSpecifier, - SourceFile, - SyntaxKind, - TextSpan, addToSeen, + CodeFixContextBase, contains, createTextSpanFromNode, + Diagnostics, + ExportSpecifier, factory, filter, findDiagnosticForNode, @@ -15,7 +12,10 @@ import { getNodeId, getTokenAtPosition, isExportSpecifier, + SourceFile, + SyntaxKind, textChanges, + TextSpan, tryCast, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/convertToTypeOnlyImport.ts b/src/services/codefixes/convertToTypeOnlyImport.ts index d58e559a329..b4f5bda36ca 100644 --- a/src/services/codefixes/convertToTypeOnlyImport.ts +++ b/src/services/codefixes/convertToTypeOnlyImport.ts @@ -1,13 +1,13 @@ import { CodeFixContextBase, Diagnostics, - ImportDeclaration, - SourceFile, - TextSpan, factory, getTokenAtPosition, + ImportDeclaration, isImportDeclaration, + SourceFile, textChanges, + TextSpan, tryCast, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts index b2f1d20aed1..466a8a9bcd7 100644 --- a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts +++ b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts @@ -1,14 +1,14 @@ import { Debug, Diagnostics, - Identifier, - QualifiedName, - SourceFile, factory, findAncestor, getTokenAtPosition, + Identifier, isIdentifier, isQualifiedName, + QualifiedName, + SourceFile, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/disableJsDiagnostics.ts b/src/services/codefixes/disableJsDiagnostics.ts index e9187463faa..96202931ae0 100644 --- a/src/services/codefixes/disableJsDiagnostics.ts +++ b/src/services/codefixes/disableJsDiagnostics.ts @@ -1,16 +1,16 @@ import { CodeFixAction, - DiagnosticCategory, - Diagnostics, - SourceFile, createTextChange, createTextSpan, createTextSpanFromBounds, + DiagnosticCategory, + Diagnostics, getLineAndCharacterOfPosition, getNewLineOrDefaultFromHost, isCheckJsEnabledForFile, isInJSFile, mapDefined, + SourceFile, textChanges, tryAddToSet, } from "../_namespaces/ts"; diff --git a/src/services/codefixes/fixAddMissingConstraint.ts b/src/services/codefixes/fixAddMissingConstraint.ts index e2e2048cb2d..c5b2bd35737 100644 --- a/src/services/codefixes/fixAddMissingConstraint.ts +++ b/src/services/codefixes/fixAddMissingConstraint.ts @@ -1,17 +1,8 @@ import { - DiagnosticMessageChain, - Diagnostics, - LanguageServiceHost, - Node, - Program, - SourceFile, - TextSpan, - Type, - TypeChecker, - TypeParameterDeclaration, - UserPreferences, addToSeen, createTextSpan, + DiagnosticMessageChain, + Diagnostics, factory, find, flattenDiagnosticMessageText, @@ -24,7 +15,16 @@ import { isString, isTypeNode, isTypeParameterDeclaration, + LanguageServiceHost, + Node, + Program, + SourceFile, textChanges, + TextSpan, + Type, + TypeChecker, + TypeParameterDeclaration, + UserPreferences, } from "../_namespaces/ts"; import { createCodeFixAction, diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index 98f64093528..490d65171be 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -1,4 +1,7 @@ import { + __String, + addToSeen, + arrayFrom, BigIntLiteralType, BinaryExpression, CallExpression, @@ -7,49 +10,13 @@ import { CodeFixAction, CodeFixContext, CodeFixContextBase, - Debug, - Diagnostics, - EnumDeclaration, - Expression, - FunctionExpression, - Identifier, - InterfaceDeclaration, - JsxOpeningLikeElement, - LanguageVariant, - MethodDeclaration, - ModifierFlags, - ModuleDeclaration, - Node, - NodeBuilderFlags, - NumberLiteralType, - ObjectFlags, - ObjectLiteralExpression, - PrivateIdentifier, - Program, - PropertyDeclaration, - QuotePreference, - ReturnStatement, - ScriptTarget, - Signature, - SignatureKind, - SourceFile, - StringLiteralType, - Symbol, - SymbolFlags, - SyntaxKind, - Type, - TypeChecker, - TypeFlags, - TypeLiteralNode, - TypeNode, - TypeReference, - UnionType, - __String, - addToSeen, - arrayFrom, concatenate, createPropertyNameNodeForIdentifierOrLiteral, + Debug, + Diagnostics, emptyArray, + EnumDeclaration, + Expression, factory, filter, find, @@ -57,6 +24,7 @@ import { findIndex, firstDefined, firstOrUndefined, + FunctionExpression, getCheckFlags, getClassLikeDeclarationOfSymbol, getEmitScriptTarget, @@ -69,7 +37,9 @@ import { getTokenAtPosition, hasAbstractModifier, hasInitializer, + Identifier, idText, + InterfaceDeclaration, isCallExpression, isClassLike, isComputedPropertyName, @@ -98,20 +68,49 @@ import { isSourceFileJS, isTransientSymbol, isTypeLiteralNode, + JsxOpeningLikeElement, + LanguageVariant, length, map, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, + Node, + NodeBuilderFlags, + NumberLiteralType, + ObjectFlags, + ObjectLiteralExpression, or, + PrivateIdentifier, + Program, + PropertyDeclaration, + QuotePreference, + ReturnStatement, + ScriptTarget, setParent, + Signature, + SignatureKind, singleElementArray, singleOrUndefined, skipConstraint, some, + SourceFile, startsWithUnderscore, + StringLiteralType, + Symbol, + SymbolFlags, + SyntaxKind, textChanges, tryCast, + Type, + TypeChecker, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeReference, + UnionType, } from "../_namespaces/ts"; import { - ImportAdder, createCodeFixAction, createCodeFixActionWithoutFixAll, createCombinedCodeActions, @@ -121,6 +120,7 @@ import { createStubbedBody, eachDiagnostic, getAllSupers, + ImportAdder, registerCodeFix, } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts index d21da714a0e..32b17b39233 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -1,13 +1,13 @@ import { - Diagnostics, - Node, - SourceFile, - TextSpan, cast, + Diagnostics, factory, getTokenAtPosition, isCallExpression, + Node, + SourceFile, textChanges, + TextSpan, textSpanEnd, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts index cfcb1abcae7..1fa7b06bede 100644 --- a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -1,11 +1,11 @@ import { Debug, Diagnostics, + factory, + getTokenAtPosition, ImportTypeNode, SourceFile, SyntaxKind, - factory, - getTokenAtPosition, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixAddVoidToPromise.ts b/src/services/codefixes/fixAddVoidToPromise.ts index e2e6c363057..4abb3cdedda 100644 --- a/src/services/codefixes/fixAddVoidToPromise.ts +++ b/src/services/codefixes/fixAddVoidToPromise.ts @@ -1,13 +1,6 @@ import { CodeFixAllContext, Diagnostics, - NewExpression, - ParameterDeclaration, - Program, - SourceFile, - SyntaxKind, - TextSpan, - TypeFlags, factory, getJSDocTypeTag, getTokenAtPosition, @@ -21,9 +14,16 @@ import { isParenthesizedTypeNode, isTypeReferenceNode, isUnionTypeNode, + NewExpression, + ParameterDeclaration, + Program, skipTrivia, some, + SourceFile, + SyntaxKind, textChanges, + TextSpan, + TypeFlags, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts index f8283609be9..f12ba12e3f0 100644 --- a/src/services/codefixes/fixAwaitInSyncFunction.ts +++ b/src/services/codefixes/fixAwaitInSyncFunction.ts @@ -1,24 +1,24 @@ import { + addToSeen, ArrowFunction, Diagnostics, - FunctionDeclaration, - FunctionExpression, - MethodDeclaration, - Node, - SourceFile, - SyntaxKind, - TypeNode, - addToSeen, factory, findChildOfKind, first, + FunctionDeclaration, + FunctionExpression, getContainingFunction, getEntityNameFromTypeNode, getNodeId, getTokenAtPosition, isFunctionTypeNode, isVariableDeclaration, + MethodDeclaration, + Node, + SourceFile, + SyntaxKind, textChanges, + TypeNode, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixCannotFindModule.ts b/src/services/codefixes/fixCannotFindModule.ts index d49b9feeb93..d128045f7f0 100644 --- a/src/services/codefixes/fixCannotFindModule.ts +++ b/src/services/codefixes/fixCannotFindModule.ts @@ -1,15 +1,15 @@ import { Debug, Diagnostics, - InstallPackageAction, - JsTyping, - LanguageServiceHost, - SourceFile, getTokenAtPosition, getTypesPackageName, + InstallPackageAction, isExternalModuleNameRelative, isStringLiteral, + JsTyping, + LanguageServiceHost, parsePackageName, + SourceFile, tryCast, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index f5a009c00e5..ac9d7af0994 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -1,28 +1,28 @@ import { + addToSeen, + cast, ClassElement, ClassLikeDeclaration, Diagnostics, - ModifierFlags, - SourceFile, - Symbol, - UserPreferences, - addToSeen, - cast, first, getEffectiveBaseTypeNode, getNodeId, getSyntacticModifierFlags, getTokenAtPosition, isClassLike, + ModifierFlags, + SourceFile, + Symbol, textChanges, + UserPreferences, } from "../_namespaces/ts"; import { - TypeConstructionContext, codeFixAll, createCodeFixAction, createImportAdder, createMissingMemberNodes, registerCodeFix, + TypeConstructionContext, } from "../_namespaces/ts.codefix"; const errorCodes = [ diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index cba4f1eba28..f91c49c9bec 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -1,22 +1,13 @@ import { + addToSeen, + and, ClassElement, ClassLikeDeclaration, CodeFixAction, + createSymbolTable, Debug, Diagnostics, ExpressionWithTypeArguments, - IndexKind, - InterfaceDeclaration, - InterfaceType, - ModifierFlags, - SourceFile, - Symbol, - SymbolTable, - TypeChecker, - UserPreferences, - addToSeen, - and, - createSymbolTable, find, getContainingClass, getEffectiveBaseTypeNode, @@ -24,18 +15,27 @@ import { getEffectiveModifierFlags, getNodeId, getTokenAtPosition, + IndexKind, + InterfaceDeclaration, + InterfaceType, isConstructorDeclaration, mapDefined, + ModifierFlags, + SourceFile, + Symbol, + SymbolTable, textChanges, + TypeChecker, + UserPreferences, } from "../_namespaces/ts"; import { - TypeConstructionContext, codeFixAll, createCodeFixAction, createImportAdder, createMissingMemberNodes, getNoopSymbolTrackerWithResolver, registerCodeFix, + TypeConstructionContext, } from "../_namespaces/ts.codefix"; const errorCodes = [ diff --git a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts index 0cb3b108715..02276f8d7a4 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -1,12 +1,9 @@ import { + addToSeen, CallExpression, ConstructorDeclaration, Diagnostics, ExpressionStatement, - Node, - SourceFile, - SyntaxKind, - addToSeen, forEachChild, getContainingFunction, getNodeId, @@ -15,6 +12,9 @@ import { isFunctionLike, isPropertyAccessExpression, isSuperCall, + Node, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts index 9b46c41d685..feee99da0d0 100644 --- a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts +++ b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts @@ -2,11 +2,11 @@ import { ConstructorDeclaration, Debug, Diagnostics, - SourceFile, emptyArray, factory, getTokenAtPosition, isConstructorDeclaration, + SourceFile, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixEnableExperimentalDecorators.ts b/src/services/codefixes/fixEnableExperimentalDecorators.ts index 281afd5ebeb..271c9b96911 100644 --- a/src/services/codefixes/fixEnableExperimentalDecorators.ts +++ b/src/services/codefixes/fixEnableExperimentalDecorators.ts @@ -1,8 +1,8 @@ import { Diagnostics, - TsConfigSourceFile, factory, textChanges, + TsConfigSourceFile, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixEnableJsxFlag.ts b/src/services/codefixes/fixEnableJsxFlag.ts index 2dab4970f1f..4870e021120 100644 --- a/src/services/codefixes/fixEnableJsxFlag.ts +++ b/src/services/codefixes/fixEnableJsxFlag.ts @@ -1,8 +1,8 @@ import { Diagnostics, - TsConfigSourceFile, factory, textChanges, + TsConfigSourceFile, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixExpectedComma.ts b/src/services/codefixes/fixExpectedComma.ts index 7fcb9311e7d..ed571ab4433 100644 --- a/src/services/codefixes/fixExpectedComma.ts +++ b/src/services/codefixes/fixExpectedComma.ts @@ -1,12 +1,12 @@ import { Diagnostics, - Node, - SourceFile, - SyntaxKind, factory, getTokenAtPosition, isArrayLiteralExpression, isObjectLiteralExpression, + Node, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index f7eeff43a6a..7beffebd599 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -1,13 +1,13 @@ import { Diagnostics, - HeritageClause, - Node, - SourceFile, - SyntaxKind, factory, getContainingClass, getTokenAtPosition, + HeritageClause, isWhiteSpaceSingleLine, + Node, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixForgottenThisPropertyAccess.ts b/src/services/codefixes/fixForgottenThisPropertyAccess.ts index a90d8493642..ae8d0cd294f 100644 --- a/src/services/codefixes/fixForgottenThisPropertyAccess.ts +++ b/src/services/codefixes/fixForgottenThisPropertyAccess.ts @@ -1,13 +1,13 @@ import { Diagnostics, - Identifier, - PrivateIdentifier, - SourceFile, factory, getContainingClass, getTokenAtPosition, + Identifier, isIdentifier, isPrivateIdentifier, + PrivateIdentifier, + SourceFile, suppressLeadingAndTrailingTrivia, textChanges, } from "../_namespaces/ts"; diff --git a/src/services/codefixes/fixImplicitThis.ts b/src/services/codefixes/fixImplicitThis.ts index 6d392fbed16..cd288e531df 100644 --- a/src/services/codefixes/fixImplicitThis.ts +++ b/src/services/codefixes/fixImplicitThis.ts @@ -3,12 +3,9 @@ import { Debug, DiagnosticAndArguments, Diagnostics, - FindAllReferences, - SourceFile, - SyntaxKind, - TypeChecker, emptyArray, factory, + FindAllReferences, findChildOfKind, getThisContainer, getTokenAtPosition, @@ -16,7 +13,10 @@ import { isFunctionExpression, isSourceFile, isThis, + SourceFile, + SyntaxKind, textChanges, + TypeChecker, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixImportNonExportedMember.ts b/src/services/codefixes/fixImportNonExportedMember.ts index 24749a9f1e2..ba1ec81fc94 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -1,14 +1,8 @@ import { + canHaveExportModifier, Declaration, Diagnostics, ExportDeclaration, - Identifier, - Node, - Program, - SourceFile, - Symbol, - VariableStatement, - canHaveExportModifier, factory, find, findAncestor, @@ -16,6 +10,7 @@ import { firstOrUndefined, getResolvedModule, getTokenAtPosition, + Identifier, isExportDeclaration, isIdentifier, isImportDeclaration, @@ -27,8 +22,13 @@ import { isVariableStatement, length, map, + Node, + Program, + SourceFile, + Symbol, textChanges, tryCast, + VariableStatement, } from "../_namespaces/ts"; import { createCodeFixAction, diff --git a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts index 38081bd81ec..f7e8345b217 100644 --- a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts +++ b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts @@ -1,14 +1,14 @@ import { Diagnostics, + factory, + findAncestor, + getTokenAtPosition, NamedTupleMember, OptionalTypeNode, ParenthesizedTypeNode, RestTypeNode, SourceFile, SyntaxKind, - factory, - findAncestor, - getTokenAtPosition, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index 544b37d9f85..698a7397878 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -1,17 +1,9 @@ import { + addRange, CallExpression, CodeFixAction, CodeFixContext, Diagnostics, - ImportDeclaration, - ModuleKind, - NamespaceImport, - NewExpression, - Node, - SourceFile, - SyntaxKind, - TransientSymbol, - addRange, factory, findAncestor, getEmitModuleKind, @@ -19,11 +11,19 @@ import { getQuotePreference, getSourceFileOfNode, getTokenAtPosition, + ImportDeclaration, isExpression, isImportCall, isNamedDeclaration, makeImport, + ModuleKind, + NamespaceImport, + NewExpression, + Node, + SourceFile, + SyntaxKind, textChanges, + TransientSymbol, } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index d5b5a0ffd4f..3c53a5da26b 100644 --- a/src/services/codefixes/fixInvalidJsxCharacters.ts +++ b/src/services/codefixes/fixInvalidJsxCharacters.ts @@ -1,10 +1,10 @@ import { Diagnostics, - SourceFile, - UserPreferences, hasProperty, quote, + SourceFile, textChanges, + UserPreferences, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts index a5cb3e2b795..0a5442600d8 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -5,8 +5,10 @@ import { ConstructSignatureDeclaration, DiagnosticMessage, Diagnostics, + findAncestor, FunctionDeclaration, GetAccessorDeclaration, + getTokenAtPosition, IndexSignatureDeclaration, MappedTypeNode, MethodDeclaration, @@ -18,6 +20,7 @@ import { SetAccessorDeclaration, SourceFile, SyntaxKind, + textChanges, Type, TypeAliasDeclaration, TypeAssertion, @@ -25,9 +28,6 @@ import { TypeFlags, TypeNode, VariableDeclaration, - findAncestor, - getTokenAtPosition, - textChanges, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixMissingCallParentheses.ts b/src/services/codefixes/fixMissingCallParentheses.ts index 06cceb0968d..4fcc89c87fc 100644 --- a/src/services/codefixes/fixMissingCallParentheses.ts +++ b/src/services/codefixes/fixMissingCallParentheses.ts @@ -1,12 +1,12 @@ import { Diagnostics, + getTokenAtPosition, Identifier, + isIdentifier, + isPropertyAccessExpression, PrivateIdentifier, PropertyAccessExpression, SourceFile, - getTokenAtPosition, - isIdentifier, - isPropertyAccessExpression, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 323c6e3d067..3769fa3619e 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -8,12 +8,12 @@ import { CodeFixAction, Diagnostics, Expression, - ModuleKind, - ScriptTarget, factory, getEmitModuleKind, getEmitScriptTarget, getTsConfigObjectLiteralExpression, + ModuleKind, + ScriptTarget, textChanges, } from "../_namespaces/ts"; diff --git a/src/services/codefixes/fixNaNEquality.ts b/src/services/codefixes/fixNaNEquality.ts index 3a84eedb2a5..cf86a7ef2d5 100644 --- a/src/services/codefixes/fixNaNEquality.ts +++ b/src/services/codefixes/fixNaNEquality.ts @@ -1,19 +1,19 @@ import { BinaryExpression, + createTextSpan, DiagnosticMessageChain, Diagnostics, Expression, - Program, - SourceFile, - SyntaxKind, - TextSpan, - createTextSpan, factory, find, flattenDiagnosticMessageText, isBinaryExpression, isExpression, + Program, + SourceFile, + SyntaxKind, textChanges, + TextSpan, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts index adaeaf39c76..7a351260329 100644 --- a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts +++ b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts @@ -1,16 +1,16 @@ import { - Diagnostics, - PropertyAccessExpression, - QuotePreference, - SourceFile, - UserPreferences, cast, + Diagnostics, factory, getQuotePreference, getTokenAtPosition, isPropertyAccessChain, isPropertyAccessExpression, + PropertyAccessExpression, + QuotePreference, + SourceFile, textChanges, + UserPreferences, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index 46ab91a1186..f76a8420e06 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -5,19 +5,12 @@ import { Debug, DiagnosticMessage, Diagnostics, - GetAccessorDeclaration, - MethodDeclaration, - Node, - ParameterPropertyDeclaration, - PropertyDeclaration, - SetAccessorDeclaration, - SourceFile, - SyntaxKind, emptyArray, factory, find, findAncestor, findLast, + GetAccessorDeclaration, getTokenAtPosition, isAbstractModifier, isAccessibilityModifier, @@ -28,8 +21,15 @@ import { isParameterPropertyDeclaration, isSourceFileJS, isStaticModifier, + MethodDeclaration, + Node, not, + ParameterPropertyDeclaration, + PropertyDeclaration, + SetAccessorDeclaration, skipTrivia, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixPropertyAssignment.ts b/src/services/codefixes/fixPropertyAssignment.ts index e57879b5899..2f1ef5a1980 100644 --- a/src/services/codefixes/fixPropertyAssignment.ts +++ b/src/services/codefixes/fixPropertyAssignment.ts @@ -1,12 +1,12 @@ import { + cast, Diagnostics, Expression, - ShorthandPropertyAssignment, - SourceFile, - cast, factory, getTokenAtPosition, isShorthandPropertyAssignment, + ShorthandPropertyAssignment, + SourceFile, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixPropertyOverrideAccessor.ts b/src/services/codefixes/fixPropertyOverrideAccessor.ts index 5116f291cfd..954a90ba6f3 100644 --- a/src/services/codefixes/fixPropertyOverrideAccessor.ts +++ b/src/services/codefixes/fixPropertyOverrideAccessor.ts @@ -3,13 +3,13 @@ import { CodeFixContext, Debug, Diagnostics, - SourceFile, getSourceFileOfNode, getTextOfPropertyName, getTokenAtPosition, isAccessor, isClassLike, singleOrUndefined, + SourceFile, unescapeLeadingUnderscores, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts index 464800e46e9..a7071d6e143 100644 --- a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts +++ b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts @@ -1,15 +1,15 @@ import { Diagnostics, - SourceFile, - Type, - TypeChecker, - TypeNode, factory, findAncestor, getTokenAtPosition, isFunctionLikeDeclaration, isInJSFile, + SourceFile, textChanges, + Type, + TypeChecker, + TypeNode, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index 5be6d9b4234..8e3574aa60c 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -2,16 +2,6 @@ import { CodeFixContextBase, Debug, Diagnostics, - ImportDeclaration, - ModifierFlags, - Node, - NodeFlags, - ScriptTarget, - SemanticMeaning, - SourceFile, - Symbol, - SymbolFlags, - SyntaxKind, factory, findAncestor, getEffectiveBaseTypeNode, @@ -22,6 +12,7 @@ import { getTextOfNode, getTokenAtPosition, hasSyntacticModifier, + ImportDeclaration, isBinaryExpression, isClassElement, isClassLike, @@ -37,7 +28,16 @@ import { isPropertyAccessExpression, isQualifiedName, isStringLiteralLike, + ModifierFlags, + Node, + NodeFlags, + ScriptTarget, + SemanticMeaning, + SourceFile, + Symbol, + SymbolFlags, symbolName, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixStrictClassInitialization.ts b/src/services/codefixes/fixStrictClassInitialization.ts index e84a766a25e..fa78042e082 100644 --- a/src/services/codefixes/fixStrictClassInitialization.ts +++ b/src/services/codefixes/fixStrictClassInitialization.ts @@ -1,19 +1,11 @@ import { + append, BigIntLiteralType, CodeFixAction, CodeFixContext, Debug, Diagnostics, Expression, - ModifierFlags, - PropertyDeclaration, - SourceFile, - SyntaxKind, - Type, - TypeChecker, - TypeFlags, - TypeNode, - append, factory, firstDefined, getClassLikeDeclarationOfSymbol, @@ -25,8 +17,16 @@ import { isInJSFile, isPropertyDeclaration, isUnionTypeNode, + ModifierFlags, + PropertyDeclaration, + SourceFile, suppressLeadingAndTrailingTrivia, + SyntaxKind, textChanges, + Type, + TypeChecker, + TypeFlags, + TypeNode, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixUnmatchedParameter.ts b/src/services/codefixes/fixUnmatchedParameter.ts index 9cd1c5abbc2..bdb4bbbb28d 100644 --- a/src/services/codefixes/fixUnmatchedParameter.ts +++ b/src/services/codefixes/fixUnmatchedParameter.ts @@ -1,23 +1,23 @@ import { + __String, + append, CodeFixAction, CodeFixContext, Diagnostics, - Identifier, - JSDocParameterTag, - JSDocTag, - SignatureDeclaration, - SourceFile, - __String, - append, factory, firstDefined, getHostSignatureFromJSDoc, getJSDocTags, getTokenAtPosition, + Identifier, isIdentifier, isJSDocParameterTag, + JSDocParameterTag, + JSDocTag, length, map, + SignatureDeclaration, + SourceFile, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixUnreachableCode.ts b/src/services/codefixes/fixUnreachableCode.ts index 6287923a313..17afabda71a 100644 --- a/src/services/codefixes/fixUnreachableCode.ts +++ b/src/services/codefixes/fixUnreachableCode.ts @@ -1,17 +1,17 @@ import { Debug, Diagnostics, - IfStatement, - SourceFile, - SyntaxKind, emptyArray, factory, findAncestor, first, getTokenAtPosition, + IfStatement, isBlock, isStatement, sliceAfter, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts index 960a4d8cb90..ec5b5e6e3ca 100644 --- a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts +++ b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts @@ -1,26 +1,26 @@ import { + append, CodeFixAction, Diagnostics, - ImportClause, - ImportEqualsDeclaration, - ImportSpecifier, - Node, - Program, - SourceFile, - SymbolFlags, - SyntaxKind, - append, emptyArray, find, forEachImportClauseDeclaration, getTokenAtPosition, + ImportClause, + ImportEqualsDeclaration, + ImportSpecifier, isIdentifier, isImportClause, isImportEqualsDeclaration, isImportSpecifier, + Node, or, + Program, refactor, skipAlias, + SourceFile, + SymbolFlags, + SyntaxKind, textChanges, tryCast, } from "../_namespaces/ts"; diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index e16d098c709..e9b0f2fc7ed 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -1,31 +1,22 @@ import { ArrayBindingPattern, CancellationToken, + cast, CodeFixAction, Debug, DiagnosticAndArguments, DiagnosticMessage, Diagnostics, + factory, FileTextChanges, FindAllReferences, - FunctionLikeDeclaration, - Identifier, - ImportDeclaration, - Node, - ObjectBindingPattern, - ParameterDeclaration, - Program, - SourceFile, - SyntaxKind, - TypeChecker, - VariableDeclaration, - VariableDeclarationList, - cast, - factory, first, forEach, + FunctionLikeDeclaration, getJSDocParameterTags, getTokenAtPosition, + Identifier, + ImportDeclaration, isArrayBindingPattern, isBinaryExpression, isCallExpression, @@ -48,9 +39,18 @@ import { isSuperKeyword, isVariableDeclarationList, map, + Node, + ObjectBindingPattern, + ParameterDeclaration, + Program, showModuleSpecifier, + SourceFile, + SyntaxKind, textChanges, tryCast, + TypeChecker, + VariableDeclaration, + VariableDeclarationList, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/fixUnusedLabel.ts b/src/services/codefixes/fixUnusedLabel.ts index ed32e3d7d2f..88e6aed5d41 100644 --- a/src/services/codefixes/fixUnusedLabel.ts +++ b/src/services/codefixes/fixUnusedLabel.ts @@ -1,13 +1,13 @@ import { - Diagnostics, - SourceFile, - SyntaxKind, cast, + Diagnostics, findChildOfKind, getTokenAtPosition, isLabeledStatement, positionsAreOnSameLine, skipTrivia, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index 1c68baaade8..96bee0d7f45 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -1,30 +1,14 @@ import { AccessorDeclaration, + canHaveDecorators, + cast, ClassLikeDeclaration, + concatenate, ConstructorDeclaration, DeclarationName, Diagnostics, - FileTextChanges, - Identifier, - InterfaceDeclaration, - ModifierFlags, - ModifierLike, - Node, - ObjectLiteralExpression, - ParameterPropertyDeclaration, - Program, - PropertyAssignment, - PropertyDeclaration, - SourceFile, - StringLiteral, - SymbolFlags, - SyntaxKind, - TypeChecker, - TypeNode, - canHaveDecorators, - cast, - concatenate, factory, + FileTextChanges, find, findAncestor, getClassExtendsHeritageElement, @@ -37,6 +21,8 @@ import { getUniqueName, hasEffectiveReadonlyModifier, hasStaticModifier, + Identifier, + InterfaceDeclaration, isClassLike, isElementAccessExpression, isFunctionLike, @@ -49,11 +35,25 @@ import { isStringLiteral, isUnionTypeNode, isWriteAccess, + ModifierFlags, + ModifierLike, + Node, nodeOverlapsWithStartEnd, + ObjectLiteralExpression, + ParameterPropertyDeclaration, + Program, + PropertyAssignment, + PropertyDeclaration, refactor, + SourceFile, startsWithUnderscore, + StringLiteral, suppressLeadingAndTrailingTrivia, + SymbolFlags, + SyntaxKind, textChanges, + TypeChecker, + TypeNode, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 9fcec04c920..1bc5bbb658c 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -1,5 +1,7 @@ import { AccessorDeclaration, + append, + arrayFrom, ArrowFunction, Block, CallExpression, @@ -8,55 +10,15 @@ import { CodeFixContextBase, Debug, Diagnostics, + emptyArray, EntityName, Expression, - FunctionDeclaration, - FunctionExpression, - GetAccessorDeclaration, - Identifier, - IntersectionType, - LanguageServiceHost, - MethodDeclaration, - MethodSignature, - Modifier, - ModifierFlags, - Node, - NodeArray, - NodeBuilderFlags, - NodeFlags, - ObjectFlags, - ObjectLiteralExpression, - ObjectType, - ParameterDeclaration, - Program, - PropertyAssignment, - PropertyDeclaration, - PropertyName, - QuotePreference, - ScriptTarget, - SetAccessorDeclaration, - Signature, - SignatureDeclaration, - SourceFile, - Symbol, - SymbolFlags, - SymbolTracker, - SyntaxKind, - TextSpan, - TsConfigSourceFile, - Type, - TypeChecker, - TypeFlags, - TypeNode, - TypeParameterDeclaration, - UnionType, - UserPreferences, - append, - arrayFrom, - emptyArray, factory, find, flatMap, + FunctionDeclaration, + FunctionExpression, + GetAccessorDeclaration, getAllAccessorDeclarations, getEffectiveModifierFlags, getEmitScriptTarget, @@ -69,7 +31,9 @@ import { getSynthesizedDeepClone, getTokenAtPosition, getTsConfigObjectLiteralExpression, + Identifier, idText, + IntersectionType, isArrowFunction, isAutoAccessorPropertyDeclaration, isFunctionDeclaration, @@ -86,16 +50,52 @@ import { isSetAccessorDeclaration, isStringLiteral, isYieldExpression, + LanguageServiceHost, length, map, + MethodDeclaration, + MethodSignature, + Modifier, + ModifierFlags, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, nullTransformationContext, + ObjectFlags, + ObjectLiteralExpression, + ObjectType, + ParameterDeclaration, + Program, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + QuotePreference, sameMap, + ScriptTarget, + SetAccessorDeclaration, setTextRange, + Signature, + SignatureDeclaration, signatureHasRestParameter, some, + SourceFile, + Symbol, + SymbolFlags, + SymbolTracker, + SyntaxKind, textChanges, + TextSpan, textSpanEnd, tryCast, + TsConfigSourceFile, + Type, + TypeChecker, + TypeFlags, + TypeNode, + TypeParameterDeclaration, + UnionType, + UserPreferences, visitEachChild, visitNode, } from "../_namespaces/ts"; diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 233a148f889..2f0c9073754 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -2,62 +2,29 @@ import { AnyImportOrRequire, AnyImportOrRequireStatement, AnyImportSyntax, + arrayFrom, CancellationToken, + cast, CodeAction, CodeFixAction, CodeFixContextBase, - Comparison, - CompilerOptions, - Debug, - DiagnosticAndArguments, - DiagnosticWithLocation, - Diagnostics, - ExportKind, - Identifier, - ImportClause, - ImportEqualsDeclaration, - ImportKind, - ImportsNotUsedAsValues, - InternalSymbolName, - LanguageServiceHost, - ModuleKind, - ModuleResolutionKind, - MultiMap, - Mutable, - NamedImports, - Node, - NodeFlags, - ObjectBindingPattern, - OrganizeImports, - PackageJsonImportFilter, - Path, - Program, - QuotePreference, - RequireVariableStatement, - ScriptTarget, - SemanticMeaning, - SourceFile, - StringLiteral, - Symbol, - SymbolExportInfo, - SymbolFlags, - SymbolId, - SyntaxKind, - TypeChecker, - TypeOnlyAliasDeclaration, - UserPreferences, - arrayFrom, - cast, combine, compareBooleans, compareNumberOfDirectorySeparators, compareValues, + Comparison, + CompilerOptions, createModuleSpecifierResolutionHost, createMultiMap, createPackageJsonImportFilter, + Debug, + DiagnosticAndArguments, + Diagnostics, + DiagnosticWithLocation, emptyArray, escapeLeadingUnderscores, every, + ExportKind, factory, first, firstDefined, @@ -85,21 +52,27 @@ import { getTypeKeywordOfTypeOnlyImport, getUniqueSymbolId, hostGetCanonicalFileName, + Identifier, + ImportClause, + ImportEqualsDeclaration, importFromModuleSpecifier, + ImportKind, + ImportsNotUsedAsValues, insertImports, + InternalSymbolName, isExternalModule, isExternalModuleReference, isIdentifier, isIdentifierPart, isIdentifierStart, - isImportEqualsDeclaration, isImportableFile, + isImportEqualsDeclaration, isInJSFile, isIntrinsicJsxName, - isJSXTagName, isJsxClosingElement, isJsxOpeningFragment, isJsxOpeningLikeElement, + isJSXTagName, isNamedImports, isNamespaceImport, isSourceFileJS, @@ -111,30 +84,57 @@ import { isValidTypeOnlyAliasUseSite, isVariableDeclarationInitializedToRequire, jsxModeNeedsExplicitImport, + LanguageServiceHost, last, makeImport, makeStringLiteral, mapDefined, memoizeOne, + ModuleKind, + ModuleResolutionKind, moduleResolutionUsesNodeModules, moduleSpecifiers, + MultiMap, + Mutable, + NamedImports, + Node, + NodeFlags, nodeIsMissing, + ObjectBindingPattern, + OrganizeImports, + PackageJsonImportFilter, + Path, pathContainsNodeModules, pathIsBareSpecifier, + Program, + QuotePreference, removeFileExtension, removeSuffix, + RequireVariableStatement, + ScriptTarget, + SemanticMeaning, shouldUseUriStyleNodeCoreModules, single, skipAlias, some, sort, + SourceFile, stableSort, startsWith, + StringLiteral, stripQuotes, + Symbol, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, textChanges, toPath, tryCast, tryGetModuleSpecifierFromDeclaration, + TypeChecker, + TypeOnlyAliasDeclaration, + UserPreferences, } from "../_namespaces/ts"; import { createCodeFixAction, diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index d9604716d1b..7be223f9a83 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -1,63 +1,24 @@ import { + __String, AnonymousType, BinaryExpression, CallExpression, CancellationToken, CaseOrDefaultClause, + cast, + createMultiMap, + createSymbolTable, Debug, Declaration, DiagnosticMessage, Diagnostics, ElementAccessExpression, EmitFlags, - Expression, - FindAllReferences, - Identifier, - IndexKind, - LanguageServiceHost, - NewExpression, - Node, - NodeSeenTracker, - ObjectFlags, - ParameterDeclaration, - PrefixUnaryExpression, - PrivateIdentifier, - Program, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertyName, - PropertySignature, - ScriptTarget, - SetAccessorDeclaration, - ShorthandPropertyAssignment, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureKind, - SourceFile, - Symbol, - SymbolFlags, - SymbolLinks, - SyntaxKind, - Token, - TransientSymbol, - Type, - TypeFlags, - TypeNode, - TypeReference, - UnderscoreEscapedMap, - UnionOrIntersectionType, - UnionReduction, - UserPreferences, - VariableDeclaration, - __String, - cast, - createMultiMap, - createSymbolTable, emptyArray, escapeLeadingUnderscores, + Expression, factory, + FindAllReferences, findChildOfKind, first, firstOrUndefined, @@ -73,6 +34,8 @@ import { getTextOfNode, getTokenAtPosition, getTypeNodeIfAccessible, + Identifier, + IndexKind, isArrowFunction, isAssignmentExpression, isCallExpression, @@ -92,23 +55,60 @@ import { isSetAccessorDeclaration, isVariableDeclaration, isVariableStatement, + LanguageServiceHost, last, length, map, mapDefined, mapEntries, + NewExpression, + Node, nodeSeenTracker, + NodeSeenTracker, + ObjectFlags, + ParameterDeclaration, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, returnTrue, + ScriptTarget, + SetAccessorDeclaration, setEmitFlags, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, singleOrUndefined, + SourceFile, + Symbol, + SymbolFlags, + SymbolLinks, + SyntaxKind, textChanges, + Token, + TransientSymbol, tryCast, + Type, + TypeFlags, + TypeNode, + TypeReference, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionReduction, + UserPreferences, + VariableDeclaration, } from "../_namespaces/ts"; import { - ImportAdder, codeFixAll, createCodeFixAction, createImportAdder, + ImportAdder, registerCodeFix, tryGetAutoImportableReferenceFromTypeNode, } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/removeUnnecessaryAwait.ts b/src/services/codefixes/removeUnnecessaryAwait.ts index 0c6b2a243a9..521c8e9dc08 100644 --- a/src/services/codefixes/removeUnnecessaryAwait.ts +++ b/src/services/codefixes/removeUnnecessaryAwait.ts @@ -1,17 +1,17 @@ import { AwaitKeywordToken, Diagnostics, - Node, - SourceFile, - SyntaxKind, - TextSpan, findPrecedingToken, getLeftmostExpression, getTokenAtPosition, isAwaitExpression, isIdentifier, isParenthesizedExpression, + Node, + SourceFile, + SyntaxKind, textChanges, + TextSpan, tryCast, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts index 45cabbb7134..0667683d1ff 100644 --- a/src/services/codefixes/requireInTs.ts +++ b/src/services/codefixes/requireInTs.ts @@ -1,26 +1,26 @@ import { + cast, Debug, Diagnostics, - Identifier, - ImportSpecifier, - NamedImports, - ObjectBindingPattern, - Program, - SourceFile, - StringLiteralLike, - VariableStatement, - cast, factory, first, getAllowSyntheticDefaultImports, getTokenAtPosition, + Identifier, + ImportSpecifier, isIdentifier, isObjectBindingPattern, isRequireCall, isVariableDeclaration, isVariableStatement, + NamedImports, + ObjectBindingPattern, + Program, + SourceFile, + StringLiteralLike, textChanges, tryCast, + VariableStatement, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/returnValueCorrect.ts b/src/services/codefixes/returnValueCorrect.ts index b56d81e7ad2..b6930f0b7ef 100644 --- a/src/services/codefixes/returnValueCorrect.ts +++ b/src/services/codefixes/returnValueCorrect.ts @@ -1,28 +1,19 @@ import { + append, ArrowFunction, CodeFixContext, + copyComments, + createSymbolTable, Debug, Diagnostics, Expression, - FunctionLikeDeclaration, - Identifier, - ModifierFlags, - Node, - SourceFile, - Statement, - SymbolFlags, - SyntaxKind, - Type, - TypeChecker, - VariableLikeDeclaration, - append, - copyComments, - createSymbolTable, factory, findAncestor, first, + FunctionLikeDeclaration, getTokenAtPosition, hasSyntacticModifier, + Identifier, isArrowFunction, isBlock, isCallExpression, @@ -34,11 +25,20 @@ import { isLabeledStatement, isVariableLike, length, + ModifierFlags, needsParentheses, + Node, probablyUsesSemicolons, rangeContainsRange, + SourceFile, + Statement, suppressLeadingAndTrailingTrivia, + SymbolFlags, + SyntaxKind, textChanges, + Type, + TypeChecker, + VariableLikeDeclaration, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/splitTypeOnlyImport.ts b/src/services/codefixes/splitTypeOnlyImport.ts index 5bca880f21e..6af08a70ebf 100644 --- a/src/services/codefixes/splitTypeOnlyImport.ts +++ b/src/services/codefixes/splitTypeOnlyImport.ts @@ -2,14 +2,14 @@ import { CodeFixContextBase, Debug, Diagnostics, - ImportDeclaration, - SourceFile, - TextSpan, factory, findAncestor, getTokenAtPosition, + ImportDeclaration, isImportDeclaration, + SourceFile, textChanges, + TextSpan, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/useBigintLiteral.ts b/src/services/codefixes/useBigintLiteral.ts index 093e3ce400e..4492e176b5c 100644 --- a/src/services/codefixes/useBigintLiteral.ts +++ b/src/services/codefixes/useBigintLiteral.ts @@ -1,11 +1,11 @@ import { Diagnostics, - SourceFile, - TextSpan, factory, getTokenAtPosition, isNumericLiteral, + SourceFile, textChanges, + TextSpan, tryCast, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/useDefaultImport.ts b/src/services/codefixes/useDefaultImport.ts index 4219714e0d7..75f72964530 100644 --- a/src/services/codefixes/useDefaultImport.ts +++ b/src/services/codefixes/useDefaultImport.ts @@ -2,17 +2,17 @@ import { AnyImportSyntax, Diagnostics, Expression, - Identifier, - SourceFile, - UserPreferences, getQuotePreference, getTokenAtPosition, + Identifier, isExternalModuleReference, isIdentifier, isImportEqualsDeclaration, isNamespaceImport, makeImport, + SourceFile, textChanges, + UserPreferences, } from "../_namespaces/ts"; import { codeFixAll, diff --git a/src/services/codefixes/wrapJsxInFragment.ts b/src/services/codefixes/wrapJsxInFragment.ts index bc488d5e080..78122a0840c 100644 --- a/src/services/codefixes/wrapJsxInFragment.ts +++ b/src/services/codefixes/wrapJsxInFragment.ts @@ -1,15 +1,15 @@ import { BinaryExpression, Diagnostics, - JsxChild, - Node, - SourceFile, - SyntaxKind, factory, getTokenAtPosition, isBinaryExpression, isJsxChild, + JsxChild, + Node, nodeIsMissing, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/completions.ts b/src/services/completions.ts index 4a0e1097cb1..11afb4c8c0a 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,12 +1,21 @@ import { + __String, + addToSeen, + append, BinaryExpression, BreakOrContinueStatement, CancellationToken, + cast, CharacterCodes, ClassElement, CodeAction, + codefix, + compareNumberOfDirectorySeparators, + compareStringsCaseSensitiveUI, + compareTextSpans, Comparison, CompilerOptions, + compilerOptionsIndicateEsModules, CompletionEntry, CompletionEntryData, CompletionEntryDataAutoImport, @@ -16,113 +25,11 @@ import { CompletionEntryLabelDetails, CompletionInfo, CompletionInfoFlags, - CompletionTriggerKind, CompletionsTriggerCharacter, + CompletionTriggerKind, + concatenate, ConstructorDeclaration, ContextFlags, - Debug, - Declaration, - Diagnostics, - EmitHint, - EmitTextWriter, - ExportKind, - Expression, - FunctionLikeDeclaration, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - ImportKind, - ImportOrExportSpecifier, - ImportSpecifier, - ImportTypeNode, - IncompleteCompletionsCache, - InternalSymbolName, - JSDocParameterTag, - JSDocPropertyTag, - JSDocReturnTag, - JSDocTag, - JSDocTagInfo, - JSDocTemplateTag, - JSDocTypeExpression, - JSDocTypeTag, - JSDocTypedefTag, - JsDoc, - JsTyping, - JsxAttribute, - JsxAttributes, - JsxClosingElement, - JsxElement, - JsxOpeningLikeElement, - JsxSpreadAttribute, - LanguageServiceHost, - LanguageVariant, - ListFormat, - MemberOverrideStatus, - MethodDeclaration, - ModifierFlags, - ModifierSyntaxKind, - ModuleDeclaration, - ModuleReference, - NamedImportBindings, - Node, - NodeArray, - NodeBuilderFlags, - NodeFlags, - ObjectBindingPattern, - ObjectLiteralExpression, - ObjectType, - ObjectTypeDeclaration, - PrinterOptions, - Program, - PropertyAccessExpression, - PropertyDeclaration, - PropertyName, - PseudoBigInt, - QualifiedName, - QuotePreference, - ScriptElementKind, - ScriptElementKindModifier, - ScriptTarget, - SemanticMeaning, - SignatureHelp, - SignatureKind, - SnippetKind, - SortedArray, - SourceFile, - SpreadAssignment, - Symbol, - SymbolDisplay, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolExportInfo, - SymbolFlags, - SymbolId, - SyntaxKind, - TextChange, - TextRange, - TextSpan, - Token, - TokenSyntaxKind, - Type, - TypeChecker, - TypeElement, - TypeFlags, - TypeLiteralNode, - TypeOnlyAliasDeclaration, - UnionReduction, - UnionType, - UserPreferences, - VariableDeclaration, - __String, - addToSeen, - append, - cast, - codefix, - compareNumberOfDirectorySeparators, - compareStringsCaseSensitiveUI, - compareTextSpans, - compilerOptionsIndicateEsModules, - concatenate, createModuleSpecifierResolutionHost, createPackageJsonImportFilter, createPrinter, @@ -131,10 +38,17 @@ import { createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, + Debug, + Declaration, + Diagnostics, diagnosticToString, displayPart, + EmitHint, + EmitTextWriter, escapeSnippetText, every, + ExportKind, + Expression, factory, filter, find, @@ -145,6 +59,7 @@ import { firstDefined, flatMap, formatting, + FunctionLikeDeclaration, getAllSuperTypeNodes, getAncestor, getCombinedLocalAndExportSymbolFlags, @@ -183,7 +98,16 @@ import { hasEffectiveModifier, hasInitializer, hasType, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportKind, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IncompleteCompletionsCache, insertSorted, + InternalSymbolName, isAbstractConstructorSymbol, isArrowFunction, isAssertionExpression, @@ -220,16 +144,16 @@ import { isFunctionTypeNode, isIdentifier, isIdentifierText, + isImportableFile, isImportDeclaration, isImportEqualsDeclaration, isImportKeyword, isImportSpecifier, - isImportableFile, isInComment, + isInitializedProperty, isInJSFile, isInRightSideOfInternalImportEqualsDeclaration, isInString, - isInitializedProperty, isIntersectionTypeNode, isJSDoc, isJSDocParameterTag, @@ -291,45 +215,121 @@ import { isValidTypeOnlyAliasUseSite, isVariableDeclaration, isVariableLike, + JsDoc, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeTag, + JsTyping, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxElement, + JsxOpeningLikeElement, + JsxSpreadAttribute, + LanguageServiceHost, + LanguageVariant, last, lastOrUndefined, length, + ListFormat, mapDefined, maybeBind, + MemberOverrideStatus, memoize, memoizeOne, - modifierToFlag, + MethodDeclaration, + ModifierFlags, modifiersToFlags, + ModifierSyntaxKind, + modifierToFlag, + ModuleDeclaration, + ModuleReference, moduleResolutionRespectsExports, + NamedImportBindings, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, nodeIsMissing, + ObjectBindingPattern, + ObjectLiteralExpression, + ObjectType, + ObjectTypeDeclaration, or, positionBelongsToNode, positionIsASICandidate, positionsAreOnSameLine, + PrinterOptions, probablyUsesSemicolons, + Program, programContainsModules, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + PseudoBigInt, pseudoBigIntToString, + QualifiedName, quote, + QuotePreference, rangeContainsPosition, rangeContainsPositionExclusive, rangeIsOnSingleLine, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + SemanticMeaning, setSnippetElement, shouldUseUriStyleNodeCoreModules, + SignatureHelp, + SignatureKind, singleElementArray, skipAlias, + SnippetKind, some, + SortedArray, + SourceFile, + SpreadAssignment, stableSort, startsWith, stringToToken, stripQuotes, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + TextChange, textChanges, textPart, + TextRange, + TextSpan, timestamp, + Token, + TokenSyntaxKind, tokenToString, tryCast, tryGetImportFromModuleSpecifier, + Type, + TypeChecker, + TypeElement, + TypeFlags, typeHasCallOrConstructSignatures, + TypeLiteralNode, + TypeOnlyAliasDeclaration, unescapeLeadingUnderscores, + UnionReduction, + UnionType, + UserPreferences, + VariableDeclaration, walkUpParenthesizedExpressions, } from "./_namespaces/ts"; import { StringCompletions } from "./_namespaces/ts.Completions"; diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index dce36fc5704..c3bb005234d 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -1,51 +1,35 @@ import { + __String, + arrayFrom, + arrayToMultiMap, Block, BreakOrContinueStatement, CancellationToken, CaseClause, - ConstructorDeclaration, - Debug, - DefaultClause, - FindAllReferences, - FunctionDeclaration, - FunctionLikeDeclaration, - HighlightSpan, - HighlightSpanKind, - IfStatement, - IterationStatement, - MethodDeclaration, - Modifier, - ModifierFlags, - ModuleBlock, - Node, - ObjectLiteralExpression, - ObjectTypeDeclaration, - Program, - Push, - ReturnStatement, - SourceFile, - SwitchStatement, - SyntaxKind, - ThrowStatement, - TryStatement, - __String, - arrayFrom, - arrayToMultiMap, cast, concatenate, + ConstructorDeclaration, contains, createGetCanonicalFileName, createTextSpanFromBounds, createTextSpanFromNode, + Debug, + DefaultClause, find, + FindAllReferences, findAncestor, findChildOfKind, findModifier, forEach, forEachChild, forEachReturnStatement, + FunctionDeclaration, + FunctionLikeDeclaration, getContainingFunction, getTouchingPropertyName, + HighlightSpan, + HighlightSpanKind, + IfStatement, isAccessor, isAwaitExpression, isBlock, @@ -75,10 +59,26 @@ import { isVariableStatement, isWhiteSpaceSingleLine, isYieldExpression, + IterationStatement, mapDefined, + MethodDeclaration, + Modifier, + ModifierFlags, modifierToFlag, + ModuleBlock, + Node, + ObjectLiteralExpression, + ObjectTypeDeclaration, + Program, + Push, + ReturnStatement, + SourceFile, + SwitchStatement, + SyntaxKind, + ThrowStatement, toArray, toPath, + TryStatement, } from "./_namespaces/ts"; export interface DocumentHighlights { diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index f06edbcf414..27faadad16b 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -1,17 +1,10 @@ import { - CompilerOptions, - CreateSourceFileOptions, - Debug, - IScriptSnapshot, - MinimalResolutionCacheHost, - Path, - ResolutionMode, - ScriptKind, - ScriptTarget, - SourceFile, arrayFrom, + CompilerOptions, createGetCanonicalFileName, createLanguageServiceSourceFile, + CreateSourceFileOptions, + Debug, ensureScriptKind, firstDefinedIterator, forEachEntry, @@ -23,8 +16,15 @@ import { hasProperty, identity, isArray, + IScriptSnapshot, isDeclarationFileName, map, + MinimalResolutionCacheHost, + Path, + ResolutionMode, + ScriptKind, + ScriptTarget, + SourceFile, sourceFileAffectingCompilerOptions, toPath, tracing, diff --git a/src/services/exportInfoMap.ts b/src/services/exportInfoMap.ts index 56fd00c2ae7..ffd9501b5db 100644 --- a/src/services/exportInfoMap.ts +++ b/src/services/exportInfoMap.ts @@ -1,32 +1,19 @@ import { - CancellationToken, - CompilerOptions, - Debug, - GetCanonicalFileName, - InternalSymbolName, - LanguageServiceHost, - ModuleSpecifierCache, - ModuleSpecifierResolutionHost, - PackageJsonImportFilter, - Path, - Program, - SourceFile, - Statement, - Symbol, - SymbolFlags, - TypeChecker, - UserPreferences, __String, addToSeen, arrayIsEqualTo, + CancellationToken, + CompilerOptions, consumesNodeCoreModules, createMultiMap, + Debug, emptyArray, findIndex, firstDefined, forEachAncestorDirectory, forEachEntry, getBaseFileName, + GetCanonicalFileName, getDirectoryPath, getLocalSymbolForExportDefault, getNameForExportedSymbol, @@ -38,6 +25,7 @@ import { getSymbolId, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, + InternalSymbolName, isExportAssignment, isExportSpecifier, isExternalModuleNameRelative, @@ -47,18 +35,30 @@ import { isKnownSymbol, isNonGlobalAmbientModule, isPrivateIdentifierSymbol, + LanguageServiceHost, mapDefined, + ModuleSpecifierCache, + ModuleSpecifierResolutionHost, moduleSpecifiers, nodeModulesPathPart, + PackageJsonImportFilter, + Path, + Program, skipAlias, skipOuterExpressions, + SourceFile, startsWith, + Statement, stringContains, stripQuotes, + Symbol, + SymbolFlags, timestamp, tryCast, + TypeChecker, unescapeLeadingUnderscores, unmangleScopedPackageName, + UserPreferences, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index a0d9c1088c5..6e9a5570306 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,89 +1,35 @@ import { + __String, + addToSeen, + append, AssignmentDeclarationKind, BinaryExpression, BindingElement, Block, CallExpression, CancellationToken, + cast, CheckFlags, ClassLikeDeclaration, - ConstructorDeclaration, - Debug, - Declaration, - DocumentSpan, - ExportSpecifier, - Expression, - FileIncludeReason, - FileReference, - ForInOrOfStatement, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, - GoToDefinition, - HighlightSpan, - HighlightSpanKind, - Identifier, - ImplementationLocation, - InterfaceDeclaration, - InternalSymbolName, - JSDocTag, - MethodDeclaration, - ModifierFlags, - ModuleDeclaration, - MultiMap, - NamedDeclaration, - Node, - NodeFlags, - NumericLiteral, - ParameterDeclaration, - ParenthesizedExpression, - Path, - PrivateIdentifier, - Program, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - Push, - ReferenceEntry, - ReferencedSymbol, - ReferencedSymbolDefinitionInfo, - ReferencedSymbolEntry, - RenameLocation, - ScriptElementKind, - ScriptTarget, - SemanticMeaning, - SetAccessorDeclaration, - SignatureDeclaration, - SourceFile, - Statement, - StringLiteral, - StringLiteralLike, - Symbol, - SymbolDisplay, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolFlags, - SymbolId, - SyntaxKind, - TextSpan, - TypeChecker, - VariableDeclaration, - __String, - addToSeen, - append, - cast, climbPastPropertyAccess, compareValues, + ConstructorDeclaration, contains, createQueue, createTextSpan, createTextSpanFromBounds, createTextSpanFromRange, + Debug, + Declaration, displayPart, + DocumentSpan, emptyArray, emptyOptions, escapeLeadingUnderscores, + ExportSpecifier, + Expression, + FileIncludeReason, + FileReference, filter, find, findAncestor, @@ -95,6 +41,11 @@ import { flatMap, forEachChild, forEachReturnStatement, + ForInOrOfStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, getAdjustedReferenceLocation, getAdjustedRenameLocation, getAllSuperTypeNodes, @@ -126,10 +77,17 @@ import { getTextOfNode, getThisContainer, getTouchingPropertyName, + GoToDefinition, hasEffectiveModifier, hasInitializer, hasSyntacticModifier, hasType, + HighlightSpan, + HighlightSpanKind, + Identifier, + ImplementationLocation, + InterfaceDeclaration, + InternalSymbolName, isAccessExpression, isArrayLiteralOrObjectLiteralDestructuringPattern, isAssertionExpression, @@ -174,8 +132,8 @@ import { isJsxOpeningElement, isJsxSelfClosingElement, isJumpStatementTarget, - isLabelOfLabeledStatement, isLabeledStatement, + isLabelOfLabeledStatement, isLiteralComputedPropertyDeclarationName, isLiteralNameOfPropertyDeclarationOrIndexAccess, isLiteralTypeNode, @@ -196,8 +154,8 @@ import { isPrivateIdentifierClassElementDeclaration, isPropertyAccessExpression, isQualifiedName, - isReferenceFileLocation, isReferencedFile, + isReferenceFileLocation, isRightSideOfPropertyAccess, isShorthandPropertyAssignment, isSourceFile, @@ -220,33 +178,75 @@ import { isVariableStatement, isVoidExpression, isWriteAccess, + JSDocTag, map, mapDefined, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, + MultiMap, + NamedDeclaration, + Node, + NodeFlags, nodeSeenTracker, + NumericLiteral, + ParameterDeclaration, + ParenthesizedExpression, + Path, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, punctuationPart, + Push, rangeIsOnSingleLine, + ReferencedSymbol, + ReferencedSymbolDefinitionInfo, + ReferencedSymbolEntry, + ReferenceEntry, + RenameLocation, + ScriptElementKind, + ScriptTarget, + SemanticMeaning, + SetAccessorDeclaration, + SignatureDeclaration, skipAlias, some, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, stripQuotes, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolId, symbolName, + SyntaxKind, textPart, + TextSpan, tokenToString, tryAddToSet, tryCast, tryGetClassExtendingExpressionWithTypeArguments, tryGetImportFromModuleSpecifier, + TypeChecker, + VariableDeclaration, } from "./_namespaces/ts"; import { + createImportTracker, ExportInfo, ExportKind, - ImportExport, - ImportTracker, - ImportsResult, - ModuleReference, - createImportTracker, findModuleReferences, getExportInfo, getImportOrExportSymbol, + ImportExport, + ImportsResult, + ImportTracker, + ModuleReference, } from "./_namespaces/ts.FindAllReferences"; /** @internal */ diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 2223105546f..ae84a63ecfb 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -1,40 +1,26 @@ import { Block, CallExpression, + canHaveModifiers, CatchClause, CharacterCodes, ClassDeclaration, CommentRange, + concatenate, + createTextChangeFromStartLength, Debug, Declaration, Diagnostic, EditorSettings, - FormatCodeSettings, - FormattingHost, - FunctionDeclaration, - InterfaceDeclaration, - LanguageVariant, - LineAndCharacter, - MethodDeclaration, - ModuleDeclaration, - Node, - NodeArray, - SourceFile, - SourceFileLike, - SyntaxKind, - TextChange, - TextRange, - TriviaSyntaxKind, - TypeReferenceNode, - canHaveModifiers, - concatenate, - createTextChangeFromStartLength, find, findAncestor, findIndex, findPrecedingToken, forEachChild, forEachRight, + FormatCodeSettings, + FormattingHost, + FunctionDeclaration, getEndLinePosition, getLeadingCommentRangesOfNode, getLineStartPositionForPosition, @@ -45,6 +31,7 @@ import { getTokenAtPosition, getTrailingCommentRanges, hasDecorators, + InterfaceDeclaration, isComment, isDecorator, isJSDoc, @@ -54,7 +41,13 @@ import { isStringOrRegularExpressionOrTemplateLiteral, isToken, isWhiteSpaceSingleLine, + LanguageVariant, last, + LineAndCharacter, + MethodDeclaration, + ModuleDeclaration, + Node, + NodeArray, nodeIsMissing, nodeIsSynthesized, rangeContainsPositionExclusive, @@ -62,19 +55,26 @@ import { rangeContainsStartEnd, rangeOverlapsWithStartEnd, repeatString, + SourceFile, + SourceFileLike, startEndContainsRange, startEndOverlapsWithStartEnd, + SyntaxKind, + TextChange, + TextRange, + TriviaSyntaxKind, + TypeReferenceNode, } from "../_namespaces/ts"; import { FormattingContext, FormattingRequestKind, FormattingScanner, + getFormattingScanner, Rule, RuleAction, RuleFlags, RulesMap, SmartIndenter, - getFormattingScanner, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 4c90a6f312c..511246c7d89 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -1,11 +1,11 @@ import { TextRangeWithKind } from "../_namespaces/ts.formatting"; import { Debug, + findChildOfKind, FormatCodeSettings, Node, SourceFileLike, SyntaxKind, - findChildOfKind, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 7ddb731cf3a..5d29e814ce8 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -1,25 +1,25 @@ import { - Debug, - LanguageVariant, - Node, - NodeArray, - ScriptTarget, - SyntaxKind, append, createScanner, + Debug, isJsxAttribute, isJsxElement, isJsxText, isKeyword, isToken, isTrivia, + LanguageVariant, last, + Node, + NodeArray, + ScriptTarget, + SyntaxKind, } from "../_namespaces/ts"; import { + createTextRangeWithKind, TextRangeWithKind, TextRangeWithTriviaKind, TokenInfo, - createTextRangeWithKind, } from "../_namespaces/ts.formatting"; const standardScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.Standard); diff --git a/src/services/formatting/rule.ts b/src/services/formatting/rule.ts index 6242025b63b..b474c67969f 100644 --- a/src/services/formatting/rule.ts +++ b/src/services/formatting/rule.ts @@ -1,7 +1,7 @@ import { FormattingContext } from "../_namespaces/ts.formatting"; import { - SyntaxKind, emptyArray, + SyntaxKind, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 74d6240b6aa..fc7a3a0b28a 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -1,4 +1,5 @@ import { + anyContext, ContextPredicate, FormattingContext, FormattingRequestKind, @@ -7,18 +8,13 @@ import { RuleFlags, TextRangeWithKind, TokenRange, - anyContext, } from "../_namespaces/ts.formatting"; import { BinaryExpression, - FormatCodeSettings, - Node, - SemicolonPreference, - SyntaxKind, - YieldExpression, contains, findAncestor, findNextToken, + FormatCodeSettings, hasDecorators, hasProperty, isArray, @@ -29,8 +25,12 @@ import { isPropertyDeclaration, isPropertySignature, isTrivia, + Node, positionIsASICandidate, + SemicolonPreference, + SyntaxKind, typeKeywords, + YieldExpression, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 70257f02417..8970be77c18 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -1,18 +1,18 @@ import { Debug, + every, FormatCodeSettings, FormattingHost, SyntaxKind, - every, } from "../_namespaces/ts"; import { + anyContext, FormatContext, FormattingContext, + getAllRules, Rule, RuleAction, RuleSpec, - anyContext, - getAllRules, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 948bf0fb0e3..b48051e8a65 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -6,40 +6,24 @@ import { ClassDeclaration, ClassExpression, CommentRange, + contains, Debug, EditorSettings, - FormatCodeSettings, - GetAccessorDeclaration, - IfStatement, - ImportClause, - IndentStyle, - InterfaceDeclaration, - JSDocTemplateTag, - LineAndCharacter, - NamedImportsOrExports, - Node, - NodeArray, - ObjectBindingPattern, - ObjectLiteralExpression, - SignatureDeclaration, - SourceFile, - SourceFileLike, - SyntaxKind, - TextRange, - TypeAliasDeclaration, - TypeLiteralNode, - TypeReferenceNode, - VariableDeclarationList, - contains, find, findChildOfKind, findListItemInfo, findNextToken, findPrecedingToken, + FormatCodeSettings, + GetAccessorDeclaration, getLineAndCharacterOfPosition, getLineStartPositionForPosition, getStartPositionOfLine, getTokenAtPosition, + IfStatement, + ImportClause, + IndentStyle, + InterfaceDeclaration, isCallExpression, isCallOrNewExpression, isConditionalExpression, @@ -48,14 +32,30 @@ import { isStringOrRegularExpressionOrTemplateLiteral, isWhiteSpaceLike, isWhiteSpaceSingleLine, + JSDocTemplateTag, + LineAndCharacter, + NamedImportsOrExports, + Node, + NodeArray, + ObjectBindingPattern, + ObjectLiteralExpression, positionBelongsToNode, rangeContainsRange, rangeContainsStartEnd, + SignatureDeclaration, skipTrivia, + SourceFile, + SourceFileLike, + SyntaxKind, + TextRange, + TypeAliasDeclaration, + TypeLiteralNode, + TypeReferenceNode, + VariableDeclarationList, } from "../_namespaces/ts"; import { - TextRangeWithKind, getRangeOfEnclosingComment, + TextRangeWithKind, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index e8371e232b7..e8c7f4c2bd1 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -1,32 +1,19 @@ import { - Debug, - Expression, - FileTextChanges, - GetCanonicalFileName, - LanguageServiceHost, - ModuleResolutionHost, - Path, - Program, - PropertyAssignment, - ResolvedModuleWithFailedLookupLocations, - SourceFile, - SourceFileLike, - SourceMapper, - StringLiteralLike, - Symbol, - TextRange, - UserPreferences, combinePaths, createGetCanonicalFileName, createModuleSpecifierResolutionHost, createRange, + Debug, emptyArray, endsWith, ensurePathIsNonModuleName, + Expression, factory, + FileTextChanges, find, forEach, formatting, + GetCanonicalFileName, getDirectoryPath, getFileMatcherPatterns, getModeForUsageLocation, @@ -42,14 +29,27 @@ import { isPropertyAssignment, isSourceFile, isStringLiteral, + LanguageServiceHost, last, mapDefined, + ModuleResolutionHost, moduleSpecifiers, normalizePath, + Path, pathIsRelative, + Program, + PropertyAssignment, + ResolvedModuleWithFailedLookupLocations, resolveModuleName, + SourceFile, + SourceFileLike, + SourceMapper, + StringLiteralLike, + Symbol, textChanges, + TextRange, tryRemoveDirectoryPrefix, + UserPreferences, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 39fb28caa0f..47be1d6781c 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -3,41 +3,26 @@ import { AssignmentExpression, AssignmentOperatorToken, CallLikeExpression, - Debug, - Declaration, - DefinitionInfo, - DefinitionInfoAndBoundSpan, - FileReference, - FindAllReferences, - FunctionLikeDeclaration, - ModifierFlags, - Node, - NodeFlags, - Program, - ScriptElementKind, - SignatureDeclaration, - SourceFile, - Symbol, - SymbolDisplay, - SymbolFlags, - SyntaxKind, - TextSpan, - Type, - TypeChecker, - TypeFlags, concatenate, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, + Debug, + Declaration, + DefinitionInfo, + DefinitionInfoAndBoundSpan, emptyArray, every, + FileReference, filter, find, + FindAllReferences, findAncestor, first, flatMap, forEach, + FunctionLikeDeclaration, getAssignmentDeclarationKind, getContainingObjectLiteralElement, getDirectoryPath, @@ -86,15 +71,30 @@ import { last, map, mapDefined, + ModifierFlags, moveRangePastModifiers, + Node, + NodeFlags, + Program, resolvePath, + ScriptElementKind, + SignatureDeclaration, skipAlias, skipParentheses, skipTrivia, some, + SourceFile, + Symbol, + SymbolDisplay, + SymbolFlags, + SyntaxKind, textRangeContainsPositionInclusive, + TextSpan, tryCast, tryGetModuleSpecifierFromDeclaration, + Type, + TypeChecker, + TypeFlags, unescapeLeadingUnderscores, } from "./_namespaces/ts"; diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index 5c0a1d6e6f5..0cca4a93f91 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -1,41 +1,17 @@ import { + __String, AnyImportOrReExport, AssignmentDeclarationKind, BinaryExpression, BindingElement, CallExpression, CancellationToken, + canHaveModifiers, + cast, Debug, ExportAssignment, ExportDeclaration, FileReference, - Identifier, - ImportCall, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportSpecifier, - InternalSymbolName, - ModifierFlags, - ModuleBlock, - ModuleDeclaration, - NamedImportsOrExports, - NamespaceImport, - Node, - Program, - SourceFile, - Statement, - StringLiteral, - StringLiteralLike, - Symbol, - SymbolFlags, - SyntaxKind, - TypeChecker, - ValidImportTypeNode, - VariableDeclaration, - __String, - canHaveModifiers, - cast, findAncestor, forEach, getAssignmentDeclarationKind, @@ -44,7 +20,14 @@ import { getSourceFileOfNode, getSymbolId, hasSyntacticModifier, + Identifier, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, importFromModuleSpecifier, + ImportSpecifier, + InternalSymbolName, isAccessExpression, isBinaryExpression, isBindingElement, @@ -72,10 +55,27 @@ import { isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + NamedImportsOrExports, + NamespaceImport, + Node, nodeSeenTracker, + Program, some, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, symbolEscapedNameNoDefault, + SymbolFlags, symbolName, + SyntaxKind, + TypeChecker, + ValidImportTypeNode, + VariableDeclaration, walkUpBindingElementsAndPatterns, } from "./_namespaces/ts"; diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index 3af19b6c9e7..45bb04e6e13 100644 --- a/src/services/inlayHints.ts +++ b/src/services/inlayHints.ts @@ -1,44 +1,28 @@ import { + __String, ArrowFunction, CallExpression, + createPrinter, Debug, EmitHint, EnumMember, + equateStringsCaseInsensitive, Expression, + findChildOfKind, + forEachChild, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, - Identifier, - InlayHint, - InlayHintKind, - InlayHintsContext, - MethodDeclaration, - NewExpression, - Node, - NodeBuilderFlags, - ParameterDeclaration, - PrefixUnaryExpression, - PrinterOptions, - PropertyDeclaration, - Signature, - Symbol, - SymbolFlags, - SyntaxKind, - Type, - TypeFormatFlags, - UserPreferences, - VariableDeclaration, - __String, - createPrinter, - equateStringsCaseInsensitive, - findChildOfKind, - forEachChild, getEffectiveReturnTypeNode, getEffectiveTypeAnnotationNode, getLanguageVariant, getLeadingCommentRanges, hasContextSensitiveParameters, + Identifier, + InlayHint, + InlayHintKind, + InlayHintsContext, isArrowFunction, isAssertionExpression, isBindingPattern, @@ -63,11 +47,27 @@ import { isTypeNode, isVarConst, isVariableDeclaration, + MethodDeclaration, + NewExpression, + Node, + NodeBuilderFlags, + ParameterDeclaration, + PrefixUnaryExpression, + PrinterOptions, + PropertyDeclaration, + Signature, skipParentheses, some, + Symbol, + SymbolFlags, + SyntaxKind, textSpanIntersectsWith, + Type, + TypeFormatFlags, unescapeLeadingUnderscores, + UserPreferences, usingSingleLineStringWriter, + VariableDeclaration, } from "./_namespaces/ts"; const maxHintsLength = 30; diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index fa2335f0197..45e9d80f673 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,50 +1,20 @@ import { + arraysEqual, ArrowFunction, AssignmentDeclarationKind, BinaryExpression, + buildLinkParts, ClassExpression, CompletionEntry, CompletionEntryDetails, Completions, ConstructorDeclaration, + contains, Declaration, DocCommentTemplateOptions, + emptyArray, Expression, ExpressionStatement, - FunctionDeclaration, - FunctionExpression, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocComment, - JSDocImplementsTag, - JSDocParameterTag, - JSDocPropertyTag, - JSDocSeeTag, - JSDocTag, - JSDocTagInfo, - JSDocTemplateTag, - JSDocTypeTag, - JSDocTypedefTag, - MethodDeclaration, - MethodSignature, - Node, - ParameterDeclaration, - ParenthesizedExpression, - PropertyAssignment, - PropertyDeclaration, - PropertySignature, - ScriptElementKind, - SourceFile, - SymbolDisplayPart, - SyntaxKind, - TextInsertion, - TypeChecker, - VariableStatement, - arraysEqual, - buildLinkParts, - contains, - emptyArray, find, findAncestor, flatMap, @@ -53,6 +23,8 @@ import { forEachAncestor, forEachReturnStatement, forEachUnique, + FunctionDeclaration, + FunctionExpression, getAssignmentDeclarationKind, getJSDocCommentsAndTags, getJSDocTags, @@ -73,19 +45,47 @@ import { isJSDoc, isJSDocParameterTag, isWhiteSpaceSingleLine, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocImplementsTag, + JSDocParameterTag, + JSDocPropertyTag, + JSDocSeeTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypedefTag, + JSDocTypeTag, lastOrUndefined, length, lineBreakPart, map, mapDefined, + MethodDeclaration, + MethodSignature, + Node, + ParameterDeclaration, parameterNamePart, + ParenthesizedExpression, + PropertyAssignment, + PropertyDeclaration, propertyNamePart, + PropertySignature, punctuationPart, + ScriptElementKind, + SourceFile, spacePart, startsWith, + SymbolDisplayPart, + SyntaxKind, + TextInsertion, textPart, typeAliasNamePart, + TypeChecker, typeParameterNamePart, + VariableStatement, } from "./_namespaces/ts"; const jsDocTagNames = [ diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index d9bb97eb9d9..aa57b808e9f 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -1,32 +1,32 @@ import { CancellationToken, - Declaration, - Expression, - Identifier, - ImportClause, - ImportEqualsDeclaration, - ImportSpecifier, - NavigateToItem, - Node, - PatternMatchKind, - PatternMatcher, - Push, - ScriptElementKind, - SourceFile, - SyntaxKind, - TypeChecker, compareStringsCaseSensitiveUI, compareValues, createPatternMatcher, createTextSpanFromNode, + Declaration, emptyArray, + Expression, getContainerNode, getNameOfDeclaration, getNodeKind, getNodeModifiers, getTextOfIdentifierOrLiteral, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportSpecifier, isPropertyAccessExpression, isPropertyNameLiteral, + NavigateToItem, + Node, + PatternMatcher, + PatternMatchKind, + Push, + ScriptElementKind, + SourceFile, + SyntaxKind, + TypeChecker, } from "./_namespaces/ts"; interface RawNavigateToItem { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index ef79aa8f4ff..132ff59e990 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -11,51 +11,30 @@ import { ClassElement, ClassExpression, ClassLikeDeclaration, - ConstructorDeclaration, - Debug, - Declaration, - DeclarationName, - EntityNameExpression, - EnumDeclaration, - EnumMember, - ExportAssignment, - Expression, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - Identifier, - ImportClause, - InterfaceDeclaration, - InternalSymbolName, - ModifierFlags, - ModuleDeclaration, - NavigationBarItem, - NavigationTree, - Node, - NodeFlags, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertyNameLiteral, - ShorthandPropertyAssignment, - SourceFile, - SpreadAssignment, - SyntaxKind, - TextSpan, - TypeElement, - VariableDeclaration, compareStringsCaseSensitiveUI, compareValues, concatenate, + ConstructorDeclaration, contains, createTextSpanFromNode, createTextSpanFromRange, + Debug, + Declaration, + DeclarationName, declarationNameToString, + EntityNameExpression, + EnumDeclaration, + EnumMember, escapeString, + ExportAssignment, + Expression, factory, filterMutate, forEach, forEachChild, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, getAssignmentDeclarationKind, getBaseFileName, getElementOrPropertyAccessName, @@ -70,7 +49,11 @@ import { getTextOfNode, hasDynamicName, hasJSDocNodes, + Identifier, idText, + ImportClause, + InterfaceDeclaration, + InternalSymbolName, isAmbientModule, isArrowFunction, isBinaryExpression, @@ -104,10 +87,27 @@ import { lastOrUndefined, map, mapDefined, + ModifierFlags, + ModuleDeclaration, + NavigationBarItem, + NavigationTree, + Node, + NodeFlags, normalizePath, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyNameLiteral, removeFileExtension, setTextRange, + ShorthandPropertyAssignment, + SourceFile, + SpreadAssignment, + SyntaxKind, + TextSpan, + TypeElement, unescapeLeadingUnderscores, + VariableDeclaration, } from "./_namespaces/ts"; /** diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 22a40608dca..77874bf6e6d 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -1,40 +1,28 @@ import { AnyImportOrRequireStatement, - Comparison, - ExportDeclaration, - ExportSpecifier, - Expression, - FileTextChanges, - FindAllReferences, - Identifier, - ImportDeclaration, - ImportOrExportSpecifier, - ImportSpecifier, - LanguageServiceHost, - NamedImportBindings, - NamedImports, - NamespaceImport, - OrganizeImportsMode, - Program, - Scanner, - SortedReadonlyArray, - SourceFile, - SyntaxKind, - TransformFlags, - UserPreferences, arrayIsSorted, binarySearch, compareBooleans, compareStringsCaseInsensitive, compareValues, + Comparison, createScanner, emptyArray, + ExportDeclaration, + ExportSpecifier, + Expression, factory, + FileTextChanges, + FindAllReferences, flatMap, formatting, getNewLineOrDefaultFromHost, group, + Identifier, identity, + ImportDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, isAmbientModule, isExportDeclaration, isExternalModuleNameRelative, @@ -47,13 +35,25 @@ import { isStringLiteral, isStringLiteralLike, jsxModeNeedsExplicitImport, + LanguageServiceHost, length, map, + NamedImportBindings, + NamedImports, + NamespaceImport, + OrganizeImportsMode, + Program, + Scanner, some, + SortedReadonlyArray, + SourceFile, stableSort, suppressLeadingTrivia, + SyntaxKind, textChanges, + TransformFlags, tryCast, + UserPreferences, } from "./_namespaces/ts"; /** diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index b7933b52970..47ac841287c 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -4,28 +4,11 @@ import { CallExpression, CancellationToken, CaseClause, - Debug, - DefaultClause, - JsxAttributes, - JsxElement, - JsxFragment, - JsxOpeningLikeElement, - NoSubstitutionTemplateLiteral, - Node, - NodeArray, - OutliningSpan, - OutliningSpanKind, - ParenthesizedExpression, - Push, - SignatureDeclaration, - SourceFile, - SyntaxKind, - TemplateExpression, - TextSpan, - TryStatement, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, + Debug, + DefaultClause, findChildOfKind, getLeadingCommentRanges, isAnyImportSyntax, @@ -49,10 +32,27 @@ import { isReturnStatement, isTupleTypeNode, isVariableStatement, + JsxAttributes, + JsxElement, + JsxFragment, + JsxOpeningLikeElement, + Node, + NodeArray, + NoSubstitutionTemplateLiteral, + OutliningSpan, + OutliningSpanKind, + ParenthesizedExpression, positionsAreOnSameLine, + Push, + SignatureDeclaration, + SourceFile, startsWith, + SyntaxKind, + TemplateExpression, + TextSpan, trimString, trimStringStart, + TryStatement, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index 4e4004a774d..b021f959c6a 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -1,15 +1,15 @@ import { CharacterCodes, - Comparison, - ScriptTarget, - TextSpan, compareBooleans, compareValues, + Comparison, createTextSpan, isUnicodeIdentifierStart, last, min, + ScriptTarget, startsWith, + TextSpan, } from "./_namespaces/ts"; // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. diff --git a/src/services/preProcess.ts b/src/services/preProcess.ts index af3194a0199..084a99595cc 100644 --- a/src/services/preProcess.ts +++ b/src/services/preProcess.ts @@ -1,16 +1,16 @@ import { FileReference, - PragmaContext, - PreProcessedFileInfo, - ScriptTarget, - SyntaxKind, isKeyword, lastOrUndefined, length, noop, + PragmaContext, + PreProcessedFileInfo, processCommentPragmas, processPragmasIntoFields, scanner, + ScriptTarget, + SyntaxKind, } from "./_namespaces/ts"; export function preProcessFile(sourceText: string, readImportFiles = true, detectJavaScriptImports = false): PreProcessedFileInfo { diff --git a/src/services/refactorProvider.ts b/src/services/refactorProvider.ts index fc9ad1abc6e..611c846c21c 100644 --- a/src/services/refactorProvider.ts +++ b/src/services/refactorProvider.ts @@ -1,10 +1,10 @@ import { ApplicableRefactorInfo, + arrayFrom, + flatMapIterator, Refactor, RefactorContext, RefactorEditInfo, - arrayFrom, - flatMapIterator, } from "./_namespaces/ts"; import { refactorKindBeginsWith } from "./_namespaces/ts.refactor"; diff --git a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts index c7f9f753025..25aabb5d07b 100644 --- a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts +++ b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts @@ -2,18 +2,13 @@ import { ApplicableRefactorInfo, ArrowFunction, ConciseBody, - Debug, - Diagnostics, - Expression, - RefactorContext, - RefactorEditInfo, - ReturnStatement, - SourceFile, - SyntaxKind, copyLeadingComments, copyTrailingAsLeadingComments, copyTrailingComments, + Debug, + Diagnostics, emptyArray, + Expression, factory, first, getContainingFunction, @@ -25,11 +20,16 @@ import { isReturnStatement, needsParentheses, rangeContainsRange, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { - RefactorErrorInfo, isRefactorErrorInfo, + RefactorErrorInfo, refactorKindBeginsWith, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts index f3938e27171..f631f1387e2 100644 --- a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts +++ b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts @@ -3,37 +3,23 @@ import { ArrowFunction, Block, ConciseBody, - Debug, - Diagnostics, - FileTextChanges, - FindAllReferences, - FunctionExpression, - Identifier, - ModifierFlags, - Node, - Program, - RefactorActionInfo, - RefactorContext, - RefactorEditInfo, - ReturnStatement, - SourceFile, - Statement, - SyntaxKind, - TypeChecker, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, copyComments, copyTrailingAsLeadingComments, + Debug, + Diagnostics, emptyArray, factory, + FileTextChanges, + FindAllReferences, first, forEachChild, + FunctionExpression, getCombinedModifierFlags, getContainingFunction, getEffectiveModifierFlags, getLocaleSpecificMessage, getTokenAtPosition, + Identifier, isArrowFunction, isClassLike, isExpression, @@ -47,10 +33,24 @@ import { isVariableDeclarationList, isVariableStatement, length, + ModifierFlags, + Node, + Program, rangeContainsRange, + RefactorActionInfo, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + Statement, suppressLeadingAndTrailingTrivia, suppressLeadingTrivia, + SyntaxKind, textChanges, + TypeChecker, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, } from "../_namespaces/ts"; import { refactorKindBeginsWith, diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index 4ee420179c2..689460c9ee2 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -4,41 +4,26 @@ import { ClassDeclaration, Debug, Diagnostics, + emptyArray, EnumDeclaration, ExportAssignment, ExportSpecifier, + factory, FindAllReferences, + findModifier, + first, FunctionDeclaration, + getLocaleSpecificMessage, + getParentNodeInSpan, + getRefactorContextSpan, + getSyntacticModifierFlags, + getTokenAtPosition, Identifier, ImportClause, ImportSpecifier, ImportTypeNode, InterfaceDeclaration, InternalSymbolName, - ModifierFlags, - NamespaceDeclaration, - Node, - NodeFlags, - Program, - PropertyAccessExpression, - QuotePreference, - RefactorContext, - RefactorEditInfo, - SourceFile, - Symbol, - SyntaxKind, - TypeAliasDeclaration, - TypeChecker, - VariableStatement, - emptyArray, - factory, - findModifier, - first, - getLocaleSpecificMessage, - getParentNodeInSpan, - getRefactorContextSpan, - getSyntacticModifierFlags, - getTokenAtPosition, isAmbientModule, isExportAssignment, isExternalModuleAugmentation, @@ -47,12 +32,27 @@ import { isSourceFile, isStringLiteral, makeImport, + ModifierFlags, + NamespaceDeclaration, + Node, + NodeFlags, + Program, + PropertyAccessExpression, + QuotePreference, quotePreferenceFromString, + RefactorContext, + RefactorEditInfo, + SourceFile, + Symbol, + SyntaxKind, textChanges, + TypeAliasDeclaration, + TypeChecker, + VariableStatement, } from "../_namespaces/ts"; import { - RefactorErrorInfo, isRefactorErrorInfo, + RefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertImport.ts b/src/services/refactors/convertImport.ts index 69923c53466..a7d0d0d5312 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -1,31 +1,13 @@ import { ApplicableRefactorInfo, - Debug, - Diagnostics, - Expression, - FindAllReferences, - Identifier, - ImportClause, - ImportDeclaration, - ImportKind, - ImportSpecifier, - NamedImports, - NamespaceImport, - Program, - PropertyAccessExpression, - QualifiedName, - RefactorContext, - RefactorEditInfo, - ScriptTarget, - SourceFile, - Symbol, - SymbolFlags, - SyntaxKind, - TypeChecker, arrayFrom, codefix, + Debug, + Diagnostics, emptyArray, + Expression, factory, + FindAllReferences, findAncestor, findNextToken, getAllowSyntheticDefaultImports, @@ -35,18 +17,36 @@ import { getRefactorContextSpan, getTokenAtPosition, getUniqueName, + Identifier, + ImportClause, + ImportDeclaration, + ImportKind, + ImportSpecifier, isExportSpecifier, isImportDeclaration, isPropertyAccessExpression, isPropertyAccessOrQualifiedName, isShorthandPropertyAssignment, isStringLiteral, + NamedImports, + NamespaceImport, + Program, + PropertyAccessExpression, + QualifiedName, + RefactorContext, + RefactorEditInfo, + ScriptTarget, some, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, textChanges, + TypeChecker, } from "../_namespaces/ts"; import { - RefactorErrorInfo, isRefactorErrorInfo, + RefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertOverloadListToSingleSignature.ts b/src/services/refactors/convertOverloadListToSingleSignature.ts index f58b06d5e53..c0ad2970a61 100644 --- a/src/services/refactors/convertOverloadListToSingleSignature.ts +++ b/src/services/refactors/convertOverloadListToSingleSignature.ts @@ -1,29 +1,17 @@ import { ApplicableRefactorInfo, CallSignatureDeclaration, - ConstructSignatureDeclaration, ConstructorDeclaration, + ConstructSignatureDeclaration, Debug, Diagnostics, - EmitFlags, - FunctionDeclaration, - MethodDeclaration, - MethodSignature, - NamedTupleMember, - Node, - NodeArray, - ParameterDeclaration, - Program, - RefactorContext, - RefactorEditInfo, - SourceFile, - SyntaxKind, - TupleTypeNode, displayPartsToString, + EmitFlags, emptyArray, every, factory, findAncestor, + FunctionDeclaration, getSourceFileOfNode, getSyntheticLeadingComments, getTokenAtPosition, @@ -32,12 +20,24 @@ import { length, map, mapDefined, + MethodDeclaration, + MethodSignature, + NamedTupleMember, + Node, + NodeArray, + ParameterDeclaration, + Program, rangeContainsPosition, + RefactorContext, + RefactorEditInfo, setEmitFlags, setSyntheticLeadingComments, setTextRange, some, + SourceFile, + SyntaxKind, textChanges, + TupleTypeNode, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertParamsToDestructuredObject.ts b/src/services/refactors/convertParamsToDestructuredObject.ts index c7cf380b53e..a86e190d2d8 100644 --- a/src/services/refactors/convertParamsToDestructuredObject.ts +++ b/src/services/refactors/convertParamsToDestructuredObject.ts @@ -1,4 +1,5 @@ import { + addEmitFlags, ApplicableRefactorInfo, ArrowFunction, BindingElement, @@ -7,57 +8,30 @@ import { CheckFlags, ClassDeclaration, ClassExpression, + compareValues, ConstructorDeclaration, + contains, + copyComments, Debug, + deduplicate, Diagnostics, ElementAccessExpression, EmitFlags, - Expression, - FindAllReferences, - FunctionBody, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - Identifier, - LanguageServiceHost, - MethodDeclaration, - MethodSignature, - Modifier, - NewExpression, - Node, - NodeArray, - ObjectLiteralElementLike, - ObjectLiteralExpression, - ParameterDeclaration, - Program, - PropertyAccessExpression, - PropertyAssignment, - PropertySignature, - RefactorContext, - RefactorEditInfo, - SemanticMeaning, - ShorthandPropertyAssignment, - SourceFile, - Symbol, - SyntaxKind, - TypeChecker, - TypeLiteralNode, - TypeNode, - VariableDeclaration, - addEmitFlags, - compareValues, - contains, - copyComments, - deduplicate, emptyArray, equateValues, every, + Expression, factory, + FindAllReferences, findAncestor, findChildOfKind, findModifier, first, flatMap, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, getCheckFlags, getContainingFunctionDeclaration, getContainingObjectLiteralElement, @@ -69,6 +43,7 @@ import { getTextOfIdentifierOrLiteral, getTouchingToken, getTypeNodeIfAccessible, + Identifier, isCallOrNewExpression, isClassDeclaration, isConstructorDeclaration, @@ -96,13 +71,38 @@ import { isTypeLiteralNode, isVarConst, isVariableDeclaration, + LanguageServiceHost, last, map, + MethodDeclaration, + MethodSignature, + Modifier, + NewExpression, + Node, + NodeArray, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertySignature, rangeContainsRange, + RefactorContext, + RefactorEditInfo, + SemanticMeaning, + ShorthandPropertyAssignment, sortAndDeduplicate, + SourceFile, suppressLeadingAndTrailingTrivia, + Symbol, + SyntaxKind, textChanges, tryCast, + TypeChecker, + TypeLiteralNode, + TypeNode, + VariableDeclaration, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertStringOrTemplateLiteral.ts b/src/services/refactors/convertStringOrTemplateLiteral.ts index 73eb5a1a1d8..712308df7be 100644 --- a/src/services/refactors/convertStringOrTemplateLiteral.ts +++ b/src/services/refactors/convertStringOrTemplateLiteral.ts @@ -2,23 +2,12 @@ import { ApplicableRefactorInfo, BinaryExpression, BinaryOperator, - Debug, - Diagnostics, - Expression, - Node, - ParenthesizedExpression, - RefactorContext, - RefactorEditInfo, - SourceFile, - SyntaxKind, - TemplateHead, - TemplateMiddle, - TemplateSpan, - TemplateTail, - Token, copyTrailingAsLeadingComments, copyTrailingComments, + Debug, + Diagnostics, emptyArray, + Expression, factory, findAncestor, getLocaleSpecificMessage, @@ -34,7 +23,18 @@ import { isTemplateHead, isTemplateMiddle, map, + Node, + ParenthesizedExpression, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, + TemplateHead, + TemplateMiddle, + TemplateSpan, + TemplateTail, textChanges, + Token, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertToOptionalChainExpression.ts b/src/services/refactors/convertToOptionalChainExpression.ts index 4cc566753ad..a86777e97dd 100644 --- a/src/services/refactors/convertToOptionalChainExpression.ts +++ b/src/services/refactors/convertToOptionalChainExpression.ts @@ -3,30 +3,20 @@ import { BinaryExpression, CallExpression, ConditionalExpression, + createTextSpanFromBounds, Debug, Diagnostics, ElementAccessExpression, + emptyArray, Expression, ExpressionStatement, - Identifier, - Node, - PropertyAccessExpression, - RefactorContext, - RefactorEditInfo, - ReturnStatement, - SourceFile, - SyntaxKind, - TextSpan, - TypeChecker, - VariableStatement, - createTextSpanFromBounds, - emptyArray, factory, findTokenOnLeftOfPosition, getLocaleSpecificMessage, getRefactorContextSpan, getSingleVariableOfVariableStatement, getTokenAtPosition, + Identifier, isBinaryExpression, isCallExpression, isConditionalExpression, @@ -38,12 +28,22 @@ import { isReturnStatement, isStringOrNumericLiteralLike, isVariableStatement, + Node, + PropertyAccessExpression, + RefactorContext, + RefactorEditInfo, + ReturnStatement, skipParentheses, + SourceFile, + SyntaxKind, textChanges, + TextSpan, + TypeChecker, + VariableStatement, } from "../_namespaces/ts"; import { - RefactorErrorInfo, isRefactorErrorInfo, + RefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 605cd5449fe..276804acf15 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1,15 +1,26 @@ import { + __String, ANONYMOUS, ApplicableRefactorInfo, + arrayFrom, + assertType, BindingElement, Block, BlockLike, BreakStatement, CancellationToken, + canHaveModifiers, CharacterCodes, ClassElement, ClassLikeDeclaration, + codefix, + compareProperties, + compareStringsCaseSensitive, + compareValues, + contains, ContinueStatement, + createDiagnosticForNode, + createFileDiagnostic, Debug, Declaration, Diagnostic, @@ -17,60 +28,10 @@ import { DiagnosticMessage, Diagnostics, EmitFlags, + emptyArray, EntityName, Expression, ExpressionStatement, - FunctionDeclaration, - FunctionLikeDeclaration, - Identifier, - LabeledStatement, - MethodDeclaration, - Modifier, - ModifierFlags, - ModuleBlock, - NamedDeclaration, - Node, - NodeBuilderFlags, - NodeFlags, - ObjectLiteralElementLike, - ParameterDeclaration, - PropertyAccessExpression, - RefactorActionInfo, - RefactorContext, - RefactorEditInfo, - ShorthandPropertyAssignment, - SignatureKind, - SourceFile, - Statement, - StringLiteral, - Symbol, - SymbolFlags, - SyntaxKind, - TextRange, - TextSpan, - TryStatement, - Type, - TypeChecker, - TypeElement, - TypeFlags, - TypeLiteralNode, - TypeNode, - TypeParameter, - TypeParameterDeclaration, - VariableDeclaration, - VisitResult, - __String, - arrayFrom, - assertType, - canHaveModifiers, - codefix, - compareProperties, - compareStringsCaseSensitive, - compareValues, - contains, - createDiagnosticForNode, - createFileDiagnostic, - emptyArray, factory, find, findAncestor, @@ -80,6 +41,8 @@ import { firstOrUndefined, forEachChild, formatStringFromArgs, + FunctionDeclaration, + FunctionLikeDeclaration, getContainingClass, getContainingFunction, getEffectiveTypeParameterDeclarations, @@ -97,6 +60,7 @@ import { getUniqueName, hasEffectiveModifier, hasSyntacticModifier, + Identifier, isArray, isArrowFunction, isAssignmentExpression, @@ -144,20 +108,56 @@ import { isVariableDeclaration, isVariableDeclarationList, isVariableStatement, + LabeledStatement, last, map, + MethodDeclaration, + Modifier, + ModifierFlags, + ModuleBlock, + NamedDeclaration, + Node, + NodeBuilderFlags, + NodeFlags, nullTransformationContext, + ObjectLiteralElementLike, + ParameterDeclaration, positionIsSynthesized, + PropertyAccessExpression, rangeContainsStartEnd, + RefactorActionInfo, + RefactorContext, + RefactorEditInfo, setEmitFlags, + ShorthandPropertyAssignment, + SignatureKind, singleOrUndefined, skipParentheses, + SourceFile, + Statement, + StringLiteral, suppressLeadingAndTrailingTrivia, + Symbol, + SymbolFlags, + SyntaxKind, textChanges, + TextRange, + TextSpan, textSpanEnd, + TryStatement, + Type, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeParameter, + TypeParameterDeclaration, + VariableDeclaration, visitEachChild, visitNode, visitNodes, + VisitResult, } from "../_namespaces/ts"; import { refactorKindBeginsWith, diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index 8df87debd15..5172c5020d8 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -1,27 +1,14 @@ import { - ApplicableRefactorInfo, - Debug, - Diagnostics, - EmitFlags, - JSDocTag, - JSDocTemplateTag, - Node, - RefactorContext, - RefactorEditInfo, - SourceFile, - Statement, - SymbolFlags, - TextRange, - TypeChecker, - TypeElement, - TypeNode, - TypeParameterDeclaration, addRange, addToSeen, append, + ApplicableRefactorInfo, cast, concatenate, createTextRangeFromSpan, + Debug, + Diagnostics, + EmitFlags, emptyArray, factory, findAncestor, @@ -54,17 +41,30 @@ import { isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, + JSDocTag, + JSDocTemplateTag, + Node, nodeOverlapsWithStartEnd, pushIfUnique, rangeContainsStartEnd, + RefactorContext, + RefactorEditInfo, setEmitFlags, setTextRange, skipTrivia, + SourceFile, + Statement, + SymbolFlags, textChanges, + TextRange, + TypeChecker, + TypeElement, + TypeNode, + TypeParameterDeclaration, } from "../_namespaces/ts"; import { - RefactorErrorInfo, isRefactorErrorInfo, + RefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index 58c8796cc08..2982cacd8af 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -1,13 +1,13 @@ import { ApplicableRefactorInfo, + codefix, Debug, Diagnostics, - RefactorContext, - codefix, emptyArray, getRenameLocation, isIdentifier, isParameter, + RefactorContext, } from "../_namespaces/ts"; import { isRefactorErrorInfo, diff --git a/src/services/refactors/inferFunctionReturnType.ts b/src/services/refactors/inferFunctionReturnType.ts index 7a31be79c60..ccce34a8a14 100644 --- a/src/services/refactors/inferFunctionReturnType.ts +++ b/src/services/refactors/inferFunctionReturnType.ts @@ -2,8 +2,19 @@ import { ApplicableRefactorInfo, ArrowFunction, Diagnostics, + emptyArray, + factory, + findAncestor, + findChildOfKind, + first, FunctionDeclaration, FunctionExpression, + getLocaleSpecificMessage, + getTokenAtPosition, + isArrowFunction, + isBlock, + isInJSFile, + mapDefined, MethodDeclaration, Node, NodeBuilderFlags, @@ -11,25 +22,14 @@ import { RefactorEditInfo, SourceFile, SyntaxKind, + textChanges, Type, TypeChecker, TypeNode, - emptyArray, - factory, - findAncestor, - findChildOfKind, - first, - getLocaleSpecificMessage, - getTokenAtPosition, - isArrowFunction, - isBlock, - isInJSFile, - mapDefined, - textChanges, } from "../_namespaces/ts"; import { - RefactorErrorInfo, isRefactorErrorInfo, + RefactorErrorInfo, refactorKindBeginsWith, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 20e8dceafb3..937c31edadd 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -1,81 +1,45 @@ import { AnyImportOrRequireStatement, + append, ApplicableRefactorInfo, AssignmentDeclarationKind, BinaryExpression, BindingElement, BindingName, CallExpression, - ClassDeclaration, - Debug, - Declaration, - DeclarationStatement, - Diagnostics, - EnumDeclaration, - Expression, - ExpressionStatement, - ExternalModuleReference, - FindAllReferences, - FunctionDeclaration, - GetCanonicalFileName, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - InterfaceDeclaration, - InternalSymbolName, - LanguageServiceHost, - ModifierFlags, - ModifierLike, - ModuleDeclaration, - NamedImportBindings, - Node, - NodeFlags, - ObjectBindingElementWithoutPropertyName, - Program, - PropertyAccessExpression, - PropertyAssignment, - QuotePreference, - RefactorContext, - RefactorEditInfo, - RequireOrImportCall, - RequireVariableStatement, - ScriptTarget, - SourceFile, - Statement, - StringLiteralLike, - Symbol, - SymbolFlags, - SyntaxKind, - TransformFlags, - TypeAliasDeclaration, - TypeChecker, - TypeNode, - UserPreferences, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, - append, canHaveDecorators, canHaveModifiers, cast, + ClassDeclaration, codefix, combinePaths, concatenate, contains, copyEntries, createTextRangeFromSpan, + Debug, + Declaration, + DeclarationStatement, + Diagnostics, emptyArray, ensurePathIsNonModuleName, + EnumDeclaration, escapeLeadingUnderscores, + Expression, + ExpressionStatement, extensionFromPath, + ExternalModuleReference, factory, find, + FindAllReferences, findIndex, firstDefined, flatMap, forEachEntry, + FunctionDeclaration, getAssignmentDeclarationKind, getBaseFileName, + GetCanonicalFileName, getDecorators, getDirectoryPath, getLocaleSpecificMessage, @@ -89,7 +53,12 @@ import { getUniqueName, hasSyntacticModifier, hostGetCanonicalFileName, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, insertImports, + InterfaceDeclaration, + InternalSymbolName, isArrayLiteralExpression, isBinaryExpression, isBindingElement, @@ -112,20 +81,51 @@ import { isVariableDeclaration, isVariableDeclarationList, isVariableStatement, + LanguageServiceHost, last, length, makeImportIfNecessary, mapDefined, + ModifierFlags, + ModifierLike, + ModuleDeclaration, + NamedImportBindings, + Node, + NodeFlags, nodeSeenTracker, normalizePath, + ObjectBindingElementWithoutPropertyName, + Program, + PropertyAccessExpression, + PropertyAssignment, + QuotePreference, rangeContainsRange, + RefactorContext, + RefactorEditInfo, removeFileExtension, + RequireOrImportCall, + RequireVariableStatement, + ScriptTarget, skipAlias, some, + SourceFile, + Statement, + StringLiteralLike, + Symbol, + SymbolFlags, symbolNameNoDefault, + SyntaxKind, takeWhile, textChanges, + TransformFlags, tryCast, + TypeAliasDeclaration, + TypeChecker, + TypeNode, + UserPreferences, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/rename.ts b/src/services/rename.ts index e23873907e5..52ee0b8a3f5 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -1,32 +1,12 @@ import { + compareStringsCaseSensitive, Comparison, + createTextSpan, DiagnosticMessage, Diagnostics, - Extension, - ImportSpecifier, - Node, - NumericLiteral, - Path, - Program, - RenameInfo, - RenameInfoFailure, - RenameInfoSuccess, - ScriptElementKind, - ScriptElementKindModifier, - SourceFile, - StringLiteralLike, - Symbol, - SymbolDisplay, - SymbolFlags, - SyntaxKind, - TypeChecker, - TypeFlags, - UnionType, - UserPreferences, - compareStringsCaseSensitive, - createTextSpan, endsWith, every, + Extension, fileExtensionIs, find, getAdjustedRenameLocation, @@ -36,6 +16,7 @@ import { getTextOfIdentifierOrLiteral, getTextOfNode, getTouchingPropertyName, + ImportSpecifier, isExternalModuleNameRelative, isIdentifier, isImportOrExportSpecifierName, @@ -46,11 +27,30 @@ import { isSourceFile, isStringLiteralLike, isStringOrNumericLiteralLike, + Node, + NumericLiteral, + Path, + Program, removeFileExtension, + RenameInfo, + RenameInfoFailure, + RenameInfoSuccess, + ScriptElementKind, + ScriptElementKindModifier, some, + SourceFile, + StringLiteralLike, stripQuotes, + Symbol, + SymbolDisplay, + SymbolFlags, + SyntaxKind, tryGetImportFromModuleSpecifier, tryRemoveSuffix, + TypeChecker, + TypeFlags, + UnionType, + UserPreferences, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/services.ts b/src/services/services.ts index 48d2b98804c..41b3c78172a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,6 +2,7 @@ import * as ts from "./_namespaces/ts"; import * as NavigateTo from "./_namespaces/ts.NavigateTo"; import * as NavigationBar from "./_namespaces/ts.NavigationBar"; import { + __String, ApplicableRefactorInfo, ApplyCodeActionCommandResult, AssignmentDeclarationKind, @@ -13,29 +14,46 @@ import { CallHierarchyItem, CallHierarchyOutgoingCall, CancellationToken, + changeCompilerHostLikeToUseCache, CharacterCodes, CheckJsDirective, Classifications, ClassifiedSpan, ClassifiedSpan2020, + classifier, CodeActionCommand, + codefix, CodeFixAction, CombinedCodeActions, CombinedCodeFixScope, + combinePaths, + compareValues, CompilerHost, CompilerOptions, CompletionEntryData, CompletionEntryDetails, CompletionInfo, Completions, + computePositionOfLineAndCharacter, + computeSuggestionDiagnostics, + createDocumentRegistry, + createGetCanonicalFileName, + createMultiMap, + createProgram, CreateProgramOptions, + createSourceFile, CreateSourceFileOptions, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, Debug, Declaration, + deduplicate, DefinitionInfo, DefinitionInfoAndBoundSpan, Diagnostic, DiagnosticWithLocation, + directoryProbablyExists, DocCommentTemplateOptions, DocumentHighlights, DocumentRegistry, @@ -44,165 +62,17 @@ import { EditorSettings, ElementAccessExpression, EmitTextWriter, + emptyArray, + emptyOptions, EndOfFileToken, EntityName, + equateValues, ExportDeclaration, FileReference, FileTextChanges, - FindAllReferences, - FormatCodeOptions, - FormatCodeSettings, - FunctionLikeDeclaration, - GeneratedIdentifierFlags, - GetCompletionsAtPositionOptions, - GoToDefinition, - HasInvalidatedResolutions, - HighlightSpanKind, - HostCancellationToken, - IScriptSnapshot, - Identifier, - ImplementationLocation, - ImportDeclaration, - IndexKind, - IndexType, - InlayHint, - InlayHints, - InlayHintsContext, - InterfaceType, - IntersectionType, - JSDoc, - JSDocContainer, - JSDocTagInfo, - JsDoc, - JsonSourceFile, - JsxAttributes, - JsxClosingTagInfo, - JsxElement, - JsxEmit, - JsxFragment, - LanguageService, - LanguageServiceHost, - LanguageServiceMode, - LanguageVariant, - LineAndCharacter, - LiteralType, - MapLike, - ModeAwareCache, - ModifierFlags, - ModuleDeclaration, - NavigateToItem, - NavigationBarItem, - NavigationTree, - Node, - NodeArray, - NodeFlags, - NumberLiteralType, - NumericLiteral, - ObjectAllocator, - ObjectFlags, - ObjectLiteralElement, - ObjectLiteralExpression, - OperationCanceledException, - OrganizeImports, - OrganizeImportsArgs, - OrganizeImportsMode, - OutliningElementsCollector, - OutliningSpan, - ParseConfigFileHost, - ParsedCommandLine, - Path, - PossibleProgramFileInfo, - PragmaMap, - PrivateIdentifier, - Program, - PropertyName, - Push, - QuickInfo, - RefactorContext, - RefactorEditInfo, - RefactorTriggerReason, - ReferenceEntry, - ReferencedSymbol, - Rename, - RenameInfo, - RenameInfoOptions, - RenameLocation, - ResolvedModuleFull, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ScriptElementKind, - ScriptElementKindModifier, - ScriptKind, - ScriptTarget, - SelectionRange, - SemanticClassificationFormat, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureHelp, - SignatureHelpItems, - SignatureHelpItemsOptions, - SignatureKind, - SmartSelectionRange, - SortedArray, - SourceFile, - SourceFileLike, - SourceMapSource, - Statement, - StringLiteral, - StringLiteralLike, - StringLiteralType, - Symbol, - SymbolDisplay, - SymbolDisplayPart, - SymbolFlags, - SyntaxKind, - SyntaxList, - TextChange, - TextChangeRange, - TextInsertion, - TextRange, - TextSpan, - TodoComment, - TodoCommentDescriptor, - Token, - TransformFlags, - TransientSymbol, - Type, - TypeChecker, - TypeFlags, - TypeNode, - TypeParameter, - TypePredicate, - TypeReference, - UnderscoreEscapedMap, - UnionOrIntersectionType, - UnionType, - UserPreferences, - VariableDeclaration, - __String, - changeCompilerHostLikeToUseCache, - classifier, - codefix, - combinePaths, - compareValues, - computePositionOfLineAndCharacter, - computeSuggestionDiagnostics, - createDocumentRegistry, - createGetCanonicalFileName, - createMultiMap, - createProgram, - createSourceFile, - createTextSpanFromBounds, - createTextSpanFromNode, - createTextSpanFromRange, - deduplicate, - directoryProbablyExists, - emptyArray, - emptyOptions, - equateValues, filter, find, + FindAllReferences, findChildOfKind, findPrecedingToken, first, @@ -211,10 +81,15 @@ import { flatMap, forEach, forEachChild, + FormatCodeOptions, + FormatCodeSettings, formatting, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, getAdjustedRenameLocation, getAllSuperTypeNodes, getAssignmentDeclarationKind, + GetCompletionsAtPositionOptions, getContainerNode, getDefaultLibFileName, getDirectoryPath, @@ -241,28 +116,43 @@ import { getTokenPosOfNode, getTouchingPropertyName, getTouchingToken, + GoToDefinition, + HasInvalidatedResolutions, hasJSDocNodes, hasProperty, hasStaticModifier, hasSyntacticModifier, + HighlightSpanKind, + HostCancellationToken, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, - idText, + Identifier, identity, + idText, + ImplementationLocation, + ImportDeclaration, + IndexKind, + IndexType, + InlayHint, + InlayHints, + InlayHintsContext, insertSorted, + InterfaceType, + IntersectionType, isArray, isBindingPattern, isComputedPropertyName, isConstTypeReference, + IScriptSnapshot, isDeclarationName, isGetAccessor, isIdentifier, isImportMeta, isInComment, - isInString, - isInTemplateString, isInsideJsxElement, isInsideJsxElementOrAttribute, + isInString, + isInTemplateString, isIntrinsicJsxName, isJSDocCommentContainingNode, isJsxAttributes, @@ -274,9 +164,9 @@ import { isJsxText, isLabelName, isLiteralComputedPropertyDeclarationName, - isNameOfModuleDeclaration, isNamedExports, isNamedTupleMember, + isNameOfModuleDeclaration, isNewExpression, isNodeKind, isObjectLiteralElement, @@ -292,32 +182,142 @@ import { isTagName, isTextWhiteSpaceLike, isThisTypeParameter, + JsDoc, + JSDoc, + JSDocContainer, + JSDocTagInfo, + JsonSourceFile, + JsxAttributes, + JsxClosingTagInfo, + JsxElement, + JsxEmit, + JsxFragment, + LanguageService, + LanguageServiceHost, + LanguageServiceMode, + LanguageVariant, lastOrUndefined, length, + LineAndCharacter, lineBreakPart, + LiteralType, map, mapDefined, + MapLike, mapOneOrMany, maybeBind, maybeSetLocalizedDiagnosticMessages, + ModeAwareCache, + ModifierFlags, + ModuleDeclaration, + NavigateToItem, + NavigationBarItem, + NavigationTree, + Node, + NodeArray, + NodeFlags, noop, normalizePath, + NumberLiteralType, + NumericLiteral, + ObjectAllocator, + ObjectFlags, + ObjectLiteralElement, + ObjectLiteralExpression, + OperationCanceledException, + OrganizeImports, + OrganizeImportsArgs, + OrganizeImportsMode, + OutliningElementsCollector, + OutliningSpan, + ParseConfigFileHost, + ParsedCommandLine, parseJsonSourceFileConfigFileContent, + Path, positionIsSynthesized, + PossibleProgramFileInfo, + PragmaMap, + PrivateIdentifier, + Program, + PropertyName, + Push, + QuickInfo, refactor, + RefactorContext, + RefactorEditInfo, + RefactorTriggerReason, + ReferencedSymbol, + ReferenceEntry, + Rename, + RenameInfo, + RenameInfoOptions, + RenameLocation, + ResolvedModuleFull, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, returnFalse, scanner, + ScriptElementKind, + ScriptElementKindModifier, + ScriptKind, + ScriptTarget, + SelectionRange, + SemanticClassificationFormat, setObjectAllocator, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureHelp, + SignatureHelpItems, + SignatureHelpItemsOptions, + SignatureKind, singleElementArray, + SmartSelectionRange, + SortedArray, + SourceFile, + SourceFileLike, + SourceMapSource, + Statement, stringContains, + StringLiteral, + StringLiteralLike, + StringLiteralType, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolFlags, symbolName, + SyntaxKind, + SyntaxList, tagNamesAreEquivalent, + TextChange, + TextChangeRange, + TextInsertion, + TextRange, + TextSpan, textSpanEnd, timestamp, + TodoComment, + TodoCommentDescriptor, + Token, toPath, tracing, + TransformFlags, + TransientSymbol, + Type, + TypeChecker, + TypeFlags, + TypeNode, + TypeParameter, + TypePredicate, + TypeReference, typeToDisplayParts, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionType, updateSourceFile, + UserPreferences, + VariableDeclaration, } from "./_namespaces/ts"; /** The version of the language service API */ diff --git a/src/services/shims.ts b/src/services/shims.ts index ee748bcf30a..64b1fe0f624 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1,70 +1,70 @@ import { Classifications, Classifier, + clear, CompilerOptions, CompletionEntryData, - Diagnostic, - DocCommentTemplateOptions, - DocumentRegistry, - EditorOptions, - EmitOutput, - EndOfLineState, - Extension, - FileReference, - FormatCodeOptions, - FormatCodeSettings, - GetCompletionsAtPositionOptions, - HostCancellationToken, - IScriptSnapshot, - JsTyping, - LanguageService, - LanguageServiceHost, - MapLike, - ModuleResolutionHost, - OperationCanceledException, - ParseConfigHost, - ResolvedModuleFull, - ResolvedTypeReferenceDirective, - ScriptKind, - SemanticClassificationFormat, - SignatureHelpItemsOptions, - TextChangeRange, - TextRange, - TextSpan, - ThrottledCancellationToken, - TypeAcquisition, - UserPreferences, - clear, createClassifier, createDocumentRegistry, createGetCanonicalFileName, createLanguageService, createTextChangeRange, createTextSpan, + Diagnostic, diagnosticCategoryName, + DocCommentTemplateOptions, + DocumentRegistry, + EditorOptions, + EmitOutput, emptyOptions, + EndOfLineState, + Extension, extensionFromPath, + FileReference, filter, flattenDiagnosticMessageText, + FormatCodeOptions, + FormatCodeSettings, getAutomaticTypeDirectiveNames, + GetCompletionsAtPositionOptions, getDefaultCompilerOptions, getDirectoryPath, getFileMatcherPatterns, getNewLineOrDefaultFromHost, getProperty, getSnapshotText, + HostCancellationToken, + IScriptSnapshot, isString, + JsTyping, + LanguageService, + LanguageServiceHost, map, + MapLike, + ModuleResolutionHost, normalizeSlashes, + OperationCanceledException, + ParseConfigHost, parseJsonSourceFileConfigFileContent, parseJsonText, preProcessFile, + ResolvedModuleFull, + ResolvedTypeReferenceDirective, resolveModuleName, resolveTypeReferenceDirective, + ScriptKind, + SemanticClassificationFormat, servicesVersion, + SignatureHelpItemsOptions, + TextChangeRange, + TextRange, + TextSpan, + ThrottledCancellationToken, timestamp, toFileNameLowerCase, toPath, + TypeAcquisition, + UserPreferences, } from "./_namespaces/ts"; // diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 9b7ed534cd8..1ca1b0ae6dd 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -4,42 +4,16 @@ import { CallLikeExpression, CancellationToken, CheckFlags, - Debug, - EmitHint, - Expression, - FunctionExpression, - Identifier, - InternalSymbolName, - ListFormat, - Node, - NodeBuilderFlags, - ParameterDeclaration, - ParenthesizedExpression, - Printer, - Program, - Signature, - SignatureHelpItem, - SignatureHelpItems, - SignatureHelpParameter, - SignatureHelpTriggerReason, - SourceFile, - Symbol, - SymbolDisplayPart, - SyntaxKind, - TaggedTemplateExpression, - TemplateExpression, - TextSpan, - TransientSymbol, - Type, - TypeChecker, - TypeParameter, contains, countWhere, createPrinter, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, + Debug, + EmitHint, emptyArray, + Expression, factory, findContainingList, findIndex, @@ -48,18 +22,21 @@ import { first, firstDefined, flatMapToMutable, + FunctionExpression, getInvokedExpression, getPossibleGenericSignatures, getPossibleTypeArgumentsInfo, + Identifier, identity, + InternalSymbolName, isBinaryExpression, isBlock, isCallOrNewExpression, isFunctionTypeNode, isIdentifier, isInComment, - isInString, isInsideTemplateLiteral, + isInString, isJsxOpeningLikeElement, isMethodDeclaration, isNoSubstitutionTemplateLiteral, @@ -73,13 +50,36 @@ import { isTemplateTail, last, lastOrUndefined, + ListFormat, map, mapToDisplayParts, + Node, + NodeBuilderFlags, + ParameterDeclaration, + ParenthesizedExpression, + Printer, + Program, punctuationPart, rangeContainsRange, + Signature, + SignatureHelpItem, + SignatureHelpItems, + SignatureHelpParameter, + SignatureHelpTriggerReason, skipTrivia, + SourceFile, spacePart, + Symbol, + SymbolDisplayPart, symbolToDisplayParts, + SyntaxKind, + TaggedTemplateExpression, + TemplateExpression, + TextSpan, + TransientSymbol, + Type, + TypeChecker, + TypeParameter, } from "./_namespaces/ts"; const enum InvocationKind { Call, TypeArgs, Contextual } diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index 670fe269afd..0e67fba79a3 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -1,14 +1,9 @@ import { CharacterCodes, - Debug, - Node, - SelectionRange, - SourceFile, - SyntaxKind, - SyntaxList, compact, contains, createTextSpanFromBounds, + Debug, findIndex, first, getTokenPosOfNode, @@ -39,11 +34,16 @@ import { isVariableDeclarationList, isVariableStatement, last, + Node, or, parseNodeFactory, positionsAreOnSameLine, + SelectionRange, setTextRangePosEnd, singleOrUndefined, + SourceFile, + SyntaxKind, + SyntaxList, textSpanIntersectsWithPosition, textSpansEqual, } from "./_namespaces/ts"; diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index 02a1cb4b275..e77fe30e4ac 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -1,17 +1,13 @@ import * as ts from "./_namespaces/ts"; import { - DocumentPosition, - DocumentPositionMapper, - DocumentPositionMapperHost, - Extension, - LineAndCharacter, - LineInfo, - Program, - SourceFileLike, base64decode, computeLineAndCharacterOfPosition, createDocumentPositionMapper, createGetCanonicalFileName, + DocumentPosition, + DocumentPositionMapper, + DocumentPositionMapperHost, + Extension, getDeclarationEmitOutputFilePathWorker, getDirectoryPath, getLineInfo, @@ -20,8 +16,12 @@ import { identitySourceMapConsumer, isDeclarationFileName, isString, + LineAndCharacter, + LineInfo, outFile, + Program, removeFileExtension, + SourceFileLike, sys, tryGetSourceMappingURL, tryParseRawSourceMap, diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 456fe19e6a3..c319ad3b8e9 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -1,66 +1,36 @@ import { - CallLikeExpression, - CancellationToken, - CharacterCodes, - Comparison, - CompilerOptions, - CompletionEntry, - CompletionEntryDetails, - CompletionInfo, - ContextFlags, - Debug, - ElementAccessExpression, - Extension, - IndexedAccessTypeNode, - JsxAttribute, - LanguageServiceHost, - LiteralExpression, - LiteralTypeNode, - MapLike, - ModuleKind, - ModuleResolutionKind, - Node, - ObjectLiteralExpression, - Path, - Program, - PropertyAssignment, - ResolutionMode, - ScriptElementKind, - ScriptElementKindModifier, - ScriptTarget, - Signature, - SignatureHelp, - SourceFile, - StringLiteralLike, - StringLiteralType, - Symbol, - SyntaxKind, - TextSpan, - Type, - TypeChecker, - TypeFlags, - UnionTypeNode, - UserPreferences, addToSeen, altDirectorySeparator, arrayFrom, + CallLikeExpression, + CancellationToken, changeExtension, + CharacterCodes, combinePaths, comparePaths, comparePatternKeys, compareStringsCaseSensitive, compareValues, + Comparison, + CompilerOptions, + CompletionEntry, + CompletionEntryDetails, + CompletionInfo, contains, containsPath, + ContextFlags, createSortedArray, createTextSpan, createTextSpanFromStringLiteralLikeContent, + Debug, deduplicate, directorySeparator, + ElementAccessExpression, emptyArray, endsWith, ensureTrailingDirectorySeparator, equateStringsCaseSensitive, + Extension, fileExtensionIsOneOf, filter, find, @@ -90,6 +60,7 @@ import { hasProperty, hasTrailingDirectorySeparator, hostGetCanonicalFileName, + IndexedAccessTypeNode, isApplicableVersionedTypesKey, isArray, isCallExpression, @@ -110,25 +81,49 @@ import { isStringLiteralLike, isTypeReferenceNode, isUrl, + JsxAttribute, + LanguageServiceHost, length, + LiteralExpression, + LiteralTypeNode, mapDefined, + MapLike, + ModuleKind, + ModuleResolutionKind, moduleSpecifiers, + Node, normalizePath, normalizeSlashes, + ObjectLiteralExpression, + Path, + Program, + PropertyAssignment, rangeContainsPosition, readJson, removeFileExtension, removePrefix, removeTrailingDirectorySeparator, + ResolutionMode, resolvePath, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + Signature, signatureHasRestParameter, + SignatureHelp, singleElementArray, skipConstraint, skipParentheses, + SourceFile, startsWith, stringContains, + StringLiteralLike, + StringLiteralType, stripQuotes, + Symbol, + SyntaxKind, textPart, + TextSpan, tryAndIgnoreErrors, tryDirectoryExists, tryFileExists, @@ -138,18 +133,23 @@ import { tryReadDirectory, tryRemoveDirectoryPrefix, tryRemovePrefix, + Type, + TypeChecker, + TypeFlags, + UnionTypeNode, unmangleScopedPackageName, + UserPreferences, walkUpParenthesizedExpressions, walkUpParenthesizedTypes, } from "./_namespaces/ts"; import { CompletionKind, - Log, - SortText, createCompletionDetails, createCompletionDetailsForSymbol, getCompletionEntriesFromSymbols, getPropertiesForObjectExpression, + Log, + SortText, } from "./_namespaces/ts.Completions"; interface NameAndKindSet { diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index e7ee92edc2a..3c242e58076 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -1,38 +1,25 @@ import { + addRange, AnyValidImportOrReExport, ArrowFunction, AssignmentDeclarationKind, Block, CallExpression, CancellationToken, - DiagnosticWithLocation, + codefix, + compilerOptionsIndicateEsModules, + createDiagnosticForNode, Diagnostics, + DiagnosticWithLocation, Expression, ExpressionStatement, Extension, + fileExtensionIsOneOf, + forEachReturnStatement, FunctionDeclaration, FunctionExpression, FunctionFlags, FunctionLikeDeclaration, - Identifier, - MethodDeclaration, - ModuleKind, - Node, - NodeFlags, - Program, - PropertyAccessExpression, - Push, - ReturnStatement, - SourceFile, - SyntaxKind, - TypeChecker, - VariableStatement, - addRange, - codefix, - compilerOptionsIndicateEsModules, - createDiagnosticForNode, - fileExtensionIsOneOf, - forEachReturnStatement, getAllowSyntheticDefaultImports, getAssignmentDeclarationKind, getFunctionFlags, @@ -40,6 +27,7 @@ import { getResolvedModule, hasInitializer, hasPropertyAccessExpressionWithName, + Identifier, importFromModuleSpecifier, isAsyncFunction, isBinaryExpression, @@ -55,9 +43,21 @@ import { isStringLiteral, isVariableDeclaration, isVariableStatement, + MethodDeclaration, + ModuleKind, + Node, + NodeFlags, + Program, programContainsEsModules, + PropertyAccessExpression, + Push, + ReturnStatement, skipAlias, some, + SourceFile, + SyntaxKind, + TypeChecker, + VariableStatement, } from "./_namespaces/ts"; const visitedNestedConvertibleFunctions = new Map(); diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index ce6be17232d..fff0b69e39e 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -1,56 +1,22 @@ import { + addRange, + arrayFrom, BinaryExpression, CallExpression, CheckFlags, - Debug, - EmitHint, - EnumMember, - ExportAssignment, - GetAccessorDeclaration, - ImportEqualsDeclaration, - JSDocTagInfo, - JsxOpeningLikeElement, - ListFormat, - ModifierFlags, - ModuleDeclaration, - NewExpression, - Node, - NodeBuilderFlags, - ObjectFlags, - Printer, - PropertyAccessExpression, - PropertyDeclaration, - ScriptElementKind, - ScriptElementKindModifier, - SemanticMeaning, - SetAccessorDeclaration, - Signature, - SignatureDeclaration, - SignatureFlags, - SourceFile, - Symbol, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolFlags, - SymbolFormatFlags, - SyntaxKind, - TaggedTemplateExpression, - TransientSymbol, - Type, - TypeChecker, - TypeFormatFlags, - TypeParameter, - VariableDeclaration, - addRange, - arrayFrom, contains, createPrinter, + Debug, displayPart, + EmitHint, emptyArray, + EnumMember, + ExportAssignment, find, first, firstDefined, forEach, + GetAccessorDeclaration, getCombinedLocalAndExportSymbolFlags, getDeclarationOfKind, getExternalModuleImportEqualsDeclarationExpression, @@ -65,6 +31,7 @@ import { getTextOfNode, hasSyntacticModifier, idText, + ImportEqualsDeclaration, isArrowFunction, isBindingElement, isCallExpression, @@ -93,19 +60,52 @@ import { isTaggedTemplateExpression, isThisInTypeQuery, isVarConst, + JSDocTagInfo, + JsxOpeningLikeElement, keywordPart, length, lineBreakPart, + ListFormat, mapToDisplayParts, + ModifierFlags, + ModuleDeclaration, + NewExpression, + Node, + NodeBuilderFlags, + ObjectFlags, operatorPart, + Printer, + PropertyAccessExpression, + PropertyDeclaration, punctuationPart, + ScriptElementKind, + ScriptElementKindModifier, + SemanticMeaning, + SetAccessorDeclaration, + Signature, + SignatureDeclaration, + SignatureFlags, signatureToDisplayParts, some, + SourceFile, spacePart, + Symbol, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolFormatFlags, symbolToDisplayParts, + SyntaxKind, + TaggedTemplateExpression, textOrKeywordPart, textPart, + TransientSymbol, + Type, + TypeChecker, + TypeFormatFlags, + TypeParameter, typeToDisplayParts, + VariableDeclaration, } from "./_namespaces/ts"; const symbolDisplayNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope; diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index acd409803c5..98a35af0fe3 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -1,4 +1,5 @@ import { + addToSeen, ArrowFunction, BindingElement, CharacterCodes, @@ -6,63 +7,8 @@ import { ClassExpression, ClassLikeDeclaration, CommentRange, - ConstructorDeclaration, - Debug, - DeclarationStatement, - EmitHint, - EmitTextWriter, - Expression, - FileTextChanges, - FunctionDeclaration, - FunctionExpression, - HasJSDoc, - ImportClause, - ImportSpecifier, - InterfaceDeclaration, - JSDoc, - JSDocComment, - JSDocParameterTag, - JSDocReturnTag, - JSDocTag, - JSDocTypeTag, - LanguageServiceHost, - MethodSignature, - Modifier, - NamedImportBindings, - NamedImports, - NamespaceImport, - Node, - NodeArray, - NodeFactoryFlags, - ObjectLiteralElementLike, - ObjectLiteralExpression, - ParameterDeclaration, - PrintHandlers, - PrologueDirective, - PropertyAssignment, - PropertyDeclaration, - PropertySignature, - ScriptKind, - ScriptTarget, - SignatureDeclaration, - SourceFile, - SourceFileLike, - Statement, - Symbol, - SyntaxKind, - TextChange, - TextRange, - Token, - TransformationContext, - TypeLiteralNode, - TypeNode, - TypeParameterDeclaration, - UserPreferences, - VariableDeclaration, - VariableStatement, - Visitor, - addToSeen, concatenate, + ConstructorDeclaration, contains, createNodeFactory, createPrinter, @@ -73,8 +19,14 @@ import { createTextSpan, createTextSpanFromRange, createTextWriter, + Debug, + DeclarationStatement, + EmitHint, + EmitTextWriter, endsWith, + Expression, factory, + FileTextChanges, filter, find, findChildOfKind, @@ -86,6 +38,8 @@ import { flatMap, flatMapToMutable, formatting, + FunctionDeclaration, + FunctionExpression, getAncestor, getFirstNonSpaceCharacterPosition, getFormatCodeSettingsForWriting, @@ -105,8 +59,12 @@ import { getTouchingToken, getTrailingCommentRanges, group, + HasJSDoc, hasJSDocNodes, + ImportClause, + ImportSpecifier, indexOfNode, + InterfaceDeclaration, intersperse, isAnyImportSyntax, isArray, @@ -145,28 +103,70 @@ import { isVariableDeclaration, isWhiteSpaceLike, isWhiteSpaceSingleLine, + JSDoc, + JSDocComment, + JSDocParameterTag, + JSDocReturnTag, + JSDocTag, + JSDocTypeTag, + LanguageServiceHost, last, lastOrUndefined, length, mapDefined, + MethodSignature, + Modifier, + NamedImportBindings, + NamedImports, + NamespaceImport, + Node, + NodeArray, + NodeFactoryFlags, nodeIsSynthesized, nullTransformationContext, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, positionsAreOnSameLine, + PrintHandlers, + PrologueDirective, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, rangeContainsPosition, rangeContainsRangeExclusive, rangeOfNode, rangeOfTypeParameters, rangeStartPositionsAreOnSameLine, removeSuffix, + ScriptKind, + ScriptTarget, setTextRangePosEnd, + SignatureDeclaration, singleOrUndefined, skipTrivia, + SourceFile, + SourceFileLike, stableSort, + Statement, stringContainsAt, + Symbol, + SyntaxKind, + TextChange, + TextRange, textSpanEnd, + Token, tokenToString, + TransformationContext, + TypeLiteralNode, + TypeNode, + TypeParameterDeclaration, + UserPreferences, + VariableDeclaration, + VariableStatement, visitEachChild, visitNodes, + Visitor, } from "./_namespaces/ts"; /** diff --git a/src/services/transform.ts b/src/services/transform.ts index 91622afcae8..9c6f96408d4 100644 --- a/src/services/transform.ts +++ b/src/services/transform.ts @@ -1,13 +1,13 @@ import { CompilerOptions, - DiagnosticWithLocation, - Node, - TransformationResult, - TransformerFactory, concatenate, + DiagnosticWithLocation, factory, fixupCompilerOptions, isArray, + Node, + TransformationResult, + TransformerFactory, transformNodes, } from "./_namespaces/ts"; diff --git a/src/services/transpile.ts b/src/services/transpile.ts index 83b0b4eb9d4..7329f788aa1 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -1,16 +1,15 @@ import { + addRange, + cloneCompilerOptions, CommandLineOptionOfCustomType, CompilerHost, CompilerOptions, - CustomTransformers, - Debug, - Diagnostic, - MapLike, - addRange, - cloneCompilerOptions, createCompilerDiagnosticForInvalidCustomType, createProgram, createSourceFile, + CustomTransformers, + Debug, + Diagnostic, fileExtensionIs, filter, forEachEntry, @@ -22,6 +21,7 @@ import { getSetExternalModuleIndicator, hasProperty, isString, + MapLike, normalizePath, optionDeclarations, parseCustomTypeOption, diff --git a/src/services/types.ts b/src/services/types.ts index 93ae3736813..ee6c8a22ba4 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -34,11 +34,11 @@ import { Symbol, SymlinkCache, TextChangeRange, + textChanges, TextRange, TextSpan, TypeReferenceDirectiveResolutionInfo, UserPreferences, - textChanges, } from "./_namespaces/ts"; declare module "../compiler/types" { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index c80e49a5a79..a5e151ac7ab 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1,161 +1,66 @@ import { - AnyImportOrRequireStatement, - AssignmentDeclarationKind, - BinaryExpression, - BindingElement, - BreakOrContinueStatement, - CallExpression, - CaseClause, - CatchClause, - CharacterCodes, - ClassDeclaration, - ClassExpression, - CommentKind, - CommentRange, - Comparison, - CompilerOptions, - ConditionalExpression, - Debug, - Declaration, - Decorator, - DeleteExpression, - Diagnostic, - DiagnosticMessage, - DiagnosticWithLocation, - DisplayPartsSymbolWriter, - DoStatement, - DocumentPosition, - DocumentSpan, - ElementAccessExpression, - EmitFlags, - EmitHint, - EndOfFileToken, - EqualityOperator, - ExportAssignment, - ExportDeclaration, - Expression, - ExpressionStatement, - FileTextChanges, - ForOfStatement, - FormatCodeSettings, - FormattingHost, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - HeritageClause, - IScriptSnapshot, - Identifier, - IfStatement, - ImportClause, - ImportDeclaration, - ImportSpecifier, - ImportTypeNode, - IndexSignatureDeclaration, - InternalSymbolName, - IterationStatement, - JSDocLink, - JSDocLinkCode, - JSDocLinkDisplayPart, - JSDocLinkPlain, - JSDocTypedefTag, - JsTyping, - JsxEmit, - JsxOpeningLikeElement, - LabeledStatement, - LanguageServiceHost, - LiteralExpression, - Modifier, - ModifierFlags, - ModuleDeclaration, - ModuleInstanceState, - ModuleResolutionKind, - ModuleSpecifierResolutionHost, - Mutable, - NewExpression, - NewLineKind, - NoSubstitutionTemplateLiteral, - Node, - NodeArray, - NodeBuilderFlags, - NodeFlags, - NumericLiteral, - OrganizeImports, - PackageJsonDependencyGroup, - PrefixUnaryExpression, - Program, - ProjectPackageJsonInfo, - PropertyAccessExpression, - PropertyAssignment, - PropertyName, - QualifiedName, - RefactorContext, - Scanner, - ScriptElementKind, - ScriptElementKindModifier, - ScriptKind, - ScriptTarget, - SemicolonPreference, - Signature, - SignatureDeclaration, - SourceFile, - SourceFileLike, - SourceMapper, - SpreadElement, - StringLiteral, - StringLiteralLike, - Symbol, - SymbolAccessibility, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolFlags, - SymbolFormatFlags, - SymbolTracker, - SyntaxKind, - SyntaxList, - TaggedTemplateExpression, - TemplateExpression, - TemplateLiteralToken, - TemplateSpan, - TextChange, - TextRange, - TextSpan, - Token, - TransientSymbol, - Type, - TypeChecker, - TypeFormatFlags, - TypeNode, - TypeOfExpression, - TypeQueryNode, - UserPreferences, - VariableDeclaration, - VoidExpression, - YieldExpression, __String, addEmitFlags, addSyntheticLeadingComment, addSyntheticTrailingComment, + AnyImportOrRequireStatement, assertType, + AssignmentDeclarationKind, + BinaryExpression, binarySearchKey, + BindingElement, + BreakOrContinueStatement, + CallExpression, canHaveModifiers, + CaseClause, cast, + CatchClause, + CharacterCodes, + ClassDeclaration, + ClassExpression, clone, codefix, combinePaths, + CommentKind, + CommentRange, compareTextSpans, compareValues, + Comparison, + CompilerOptions, + ConditionalExpression, contains, createPrinter, createRange, createScanner, createTextSpan, createTextSpanFromBounds, + Debug, + Declaration, + Decorator, defaultMaximumTruncationLength, + DeleteExpression, + Diagnostic, + DiagnosticMessage, + DiagnosticWithLocation, directoryProbablyExists, + DisplayPartsSymbolWriter, + DocumentPosition, + DocumentSpan, + DoStatement, + ElementAccessExpression, + EmitFlags, + EmitHint, emptyArray, + EndOfFileToken, ensureScriptKind, + EqualityOperator, escapeString, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, factory, + FileTextChanges, filter, find, findAncestor, @@ -167,8 +72,14 @@ import { forEachChild, forEachLeadingCommentRange, forEachTrailingCommentRange, + FormatCodeSettings, formatStringFromArgs, formatting, + FormattingHost, + ForOfStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, getAssignmentDeclarationKind, getCombinedNodeFlagsAlwaysIncludeJSDoc, getDirectoryPath, @@ -193,10 +104,19 @@ import { getTextOfNode, getTypesPackageName, hasSyntacticModifier, - idText, + HeritageClause, + Identifier, identifierIsThisKeyword, identity, + idText, + IfStatement, + ImportClause, + ImportDeclaration, + ImportSpecifier, + ImportTypeNode, indexOfNode, + IndexSignatureDeclaration, + InternalSymbolName, isAmbientModule, isAnyImportSyntax, isArray, @@ -213,6 +133,7 @@ import { isClassExpression, isClassStaticBlockDeclaration, isConditionalTypeNode, + IScriptSnapshot, isDeclaration, isDeclarationName, isDecorator, @@ -245,8 +166,8 @@ import { isImportEqualsDeclaration, isImportOrExportSpecifier, isImportSpecifier, - isInJSFile, isInferTypeNode, + isInJSFile, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, isJSDoc, @@ -317,40 +238,119 @@ import { isWhiteSpaceLike, isWhiteSpaceSingleLine, isYieldExpression, + IterationStatement, + JSDocLink, + JSDocLinkCode, + JSDocLinkDisplayPart, + JSDocLinkPlain, + JSDocTypedefTag, + JsTyping, + JsxEmit, + JsxOpeningLikeElement, + LabeledStatement, + LanguageServiceHost, last, lastOrUndefined, + LiteralExpression, map, maybeBind, + Modifier, + ModifierFlags, + ModuleDeclaration, + ModuleInstanceState, + ModuleResolutionKind, + ModuleSpecifierResolutionHost, moduleSpecifiers, + Mutable, + NewExpression, + NewLineKind, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, nodeIsMissing, nodeIsPresent, nodeIsSynthesized, noop, normalizePath, + NoSubstitutionTemplateLiteral, notImplemented, nullTransformationContext, + NumericLiteral, or, + OrganizeImports, + PackageJsonDependencyGroup, pathIsRelative, + PrefixUnaryExpression, + Program, + ProjectPackageJsonInfo, + PropertyAccessExpression, + PropertyAssignment, + PropertyName, + QualifiedName, + RefactorContext, + Scanner, + ScriptElementKind, + ScriptElementKindModifier, + ScriptKind, + ScriptTarget, + SemicolonPreference, setConfigFileInOptions, setOriginalNode, setTextRange, + Signature, + SignatureDeclaration, singleOrUndefined, skipAlias, skipOuterExpressions, some, + SourceFile, + SourceFileLike, + SourceMapper, + SpreadElement, stableSort, startsWith, stringContains, + StringLiteral, + StringLiteralLike, stringToToken, stripQuotes, + Symbol, + SymbolAccessibility, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolFormatFlags, + SymbolTracker, + SyntaxKind, + SyntaxList, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralToken, + TemplateSpan, + TextChange, textChanges, + TextRange, + TextSpan, textSpanContainsPosition, textSpanContainsTextSpan, textSpanEnd, + Token, tokenToString, + TransientSymbol, tryCast, + Type, + TypeChecker, + TypeFormatFlags, + TypeNode, + TypeOfExpression, + TypeQueryNode, unescapeLeadingUnderscores, + UserPreferences, + VariableDeclaration, visitEachChild, + VoidExpression, + YieldExpression, } from "./_namespaces/ts"; // These utilities are common to multiple language service features. diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index 7fd649070de..bad01ecd0bb 100644 --- a/src/testRunner/compilerRunner.ts +++ b/src/testRunner/compilerRunner.ts @@ -7,12 +7,12 @@ import { Compiler, FileBasedTest, FileBasedTestConfiguration, + getFileBasedTestConfigurationDescription, + getFileBasedTestConfigurations, IO, RunnerBase, TestCaseParser, TestRunnerKind, - getFileBasedTestConfigurationDescription, - getFileBasedTestConfigurations, } from "./_namespaces/Harness"; export const enum CompilerTestType { diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index b7baa33cfea..ece03273f89 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -6,9 +6,9 @@ import * as ts from "./_namespaces/ts"; import { Baseline, IO, + isWorker, RunnerBase, TestRunnerKind, - isWorker, } from "./_namespaces/Harness"; interface ExecResult { diff --git a/src/testRunner/parallel/host.ts b/src/testRunner/parallel/host.ts index 9643d642cc7..7ff6ca57011 100644 --- a/src/testRunner/parallel/host.ts +++ b/src/testRunner/parallel/host.ts @@ -1,28 +1,28 @@ import * as Utils from "../_namespaces/Utils"; import * as ts from "../_namespaces/ts"; import { - IO, - TestConfig, - TestRunnerKind, configOption, globalTimeout, + IO, keepFailed, lightMode, noColors, - runUnitTests, runners, + runUnitTests, stackTraceLimit, taskConfigsFolder, + TestConfig, + TestRunnerKind, workerCount, } from "../_namespaces/Harness"; import { ErrorInfo, ParallelClientMessage, ParallelHostMessage, + shimNoopTestInterface, Task, TaskTimeout, TestInfo, - shimNoopTestInterface, } from "../_namespaces/Harness.Parallel"; export function start() { diff --git a/src/testRunner/parallel/worker.ts b/src/testRunner/parallel/worker.ts index d4c490ddf8e..ff5be509880 100644 --- a/src/testRunner/parallel/worker.ts +++ b/src/testRunner/parallel/worker.ts @@ -3,16 +3,16 @@ import { ParallelClientMessage, ParallelHostMessage, RunnerTask, + shimNoopTestInterface, Task, TaskResult, TestInfo, UnitTestTask, - shimNoopTestInterface, } from "../_namespaces/Harness.Parallel"; import { - RunnerBase, createRunner, globalTimeout, + RunnerBase, runUnitTests, } from "../_namespaces/Harness"; diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index 60511d4f100..65af002657a 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -13,12 +13,12 @@ import { IO, Parallel, RunnerBase, - Test262BaselineRunner, - TestRunnerKind, - UserCodeRunner, setLightMode, setShardId, setShards, + Test262BaselineRunner, + TestRunnerKind, + UserCodeRunner, } from "./_namespaces/Harness"; /* eslint-disable prefer-const */ diff --git a/src/testRunner/unittests/builder.ts b/src/testRunner/unittests/builder.ts index 5bdac7a0e22..2c965e45323 100644 --- a/src/testRunner/unittests/builder.ts +++ b/src/testRunner/unittests/builder.ts @@ -1,9 +1,9 @@ import * as ts from "../_namespaces/ts"; import { NamedSourceText, + newProgram, ProgramWithSourceTexts, SourceText, - newProgram, updateProgram, updateProgramText, } from "./helpers"; diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index 705d6f70861..c349968c89c 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -1,21 +1,21 @@ import * as ts from "../_namespaces/ts"; import { - NamedSourceText, - ProgramWithSourceTexts, - SourceText, - TestCompilerHost, checkResolvedModulesCache, checkResolvedTypeDirectivesCache, createResolvedModule, createTestCompilerHost, + NamedSourceText, newLine, newProgram, + ProgramWithSourceTexts, + SourceText, + TestCompilerHost, updateProgram, updateProgramText, } from "./helpers"; import { - File, createWatchedSystem, + File, libFile, } from "./virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index 848b17f3db9..d677b34885f 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createProjectService } from "../tsserver/helpers"; import { diff --git a/src/testRunner/unittests/services/languageService.ts b/src/testRunner/unittests/services/languageService.ts index 94efcaba3c8..fa865d423b9 100644 --- a/src/testRunner/unittests/services/languageService.ts +++ b/src/testRunner/unittests/services/languageService.ts @@ -2,8 +2,8 @@ import { expect } from "chai"; import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 332d69675de..8188d9a2cfd 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createProjectService } from "../tsserver/helpers"; import { newLineCharacter } from "./extract/helpers"; diff --git a/src/testRunner/unittests/tsbuild/commandLine.ts b/src/testRunner/unittests/tsbuild/commandLine.ts index fc009e2cbc2..9374c38dd5a 100644 --- a/src/testRunner/unittests/tsbuild/commandLine.ts +++ b/src/testRunner/unittests/tsbuild/commandLine.ts @@ -1,12 +1,12 @@ import * as ts from "../../_namespaces/ts"; import { - TestTscEdit, appendText, compilerOptionsToConfigJson, loadProjectFromFiles, noChangeRun, noChangeWithExportsDiscrepancyRun, replaceText, + TestTscEdit, verifyTscWithEdits, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index fa5710d334b..44c49398d59 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -2,9 +2,6 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; import { - TestTscEdit, - TscCompileSystem, - VerifyTscWithEditsInput, addRest, addShebang, addSpread, @@ -21,9 +18,12 @@ import { removeRest, replaceText, testTscCompileLike, + TestTscEdit, + TscCompileSystem, verifyTsc, verifyTscCompileLike, verifyTscWithEdits, + VerifyTscWithEditsInput, } from "../tsc/helpers"; describe("unittests:: tsbuild:: outFile::", () => { diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index ef4a563f542..10ecd276fd1 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -1,12 +1,12 @@ import * as ts from "../../_namespaces/ts"; import * as fakes from "../../_namespaces/fakes"; import { - TestTscEdit, - TscCompileSystem, - VerifyTscWithEditsInput, loadProjectFromFiles, noChangeRun, + TestTscEdit, + TscCompileSystem, verifyTscWithEdits, + VerifyTscWithEditsInput, } from "../tsc/helpers"; describe("unittests:: tsbuild - output file paths", () => { diff --git a/src/testRunner/unittests/tsbuild/publicApi.ts b/src/testRunner/unittests/tsbuild/publicApi.ts index bb236257c76..ae548a0e51e 100644 --- a/src/testRunner/unittests/tsbuild/publicApi.ts +++ b/src/testRunner/unittests/tsbuild/publicApi.ts @@ -2,11 +2,11 @@ import * as ts from "../../_namespaces/ts"; import * as fakes from "../../_namespaces/fakes"; import * as vfs from "../../_namespaces/vfs"; import { - TscCompileSystem, baselinePrograms, commandLineCallbacks, loadProjectFromFiles, toPathWithSystem, + TscCompileSystem, verifyTscBaseline, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 336c1a0f364..08d54561380 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -3,16 +3,14 @@ import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; import * as Harness from "../../_namespaces/Harness"; import { - File, - TestServerHost, changeToHostTrackingWrittenFiles, createWatchedSystem, + File, getTsBuildProjectFilePath, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { - TestTscEdit, - TscCompileSystem, appendText, createSolutionBuilderHostForBaseline, libContent, @@ -23,6 +21,8 @@ import { prependText, replaceText, testTscCompileLike, + TestTscEdit, + TscCompileSystem, verifyTsc, verifyTscCompileLike, verifyTscWithEdits, diff --git a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts index 7d66eaa425f..5275bba2e11 100644 --- a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts @@ -1,7 +1,7 @@ import { - TestServerHost, createWatchedSystem, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "../tscWatch/helpers"; import { dedent } from "../../_namespaces/Utils"; diff --git a/src/testRunner/unittests/tsbuildWatch/demo.ts b/src/testRunner/unittests/tsbuildWatch/demo.ts index 0bcfdf92cf3..cb87c76fbc6 100644 --- a/src/testRunner/unittests/tsbuildWatch/demo.ts +++ b/src/testRunner/unittests/tsbuildWatch/demo.ts @@ -1,6 +1,6 @@ import { - File, createWatchedSystem, + File, getTsBuildProjectFile, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index 310846c2651..0c34385b46b 100644 --- a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts +++ b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts @@ -1,20 +1,20 @@ import * as ts from "../../_namespaces/ts"; import { - File, - TestServerHost, createWatchedSystem, + File, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { - TscWatchCompileChange, commonFile1, commonFile2, createBaseline, createSolutionBuilderWithWatchHostForBaseline, noopChange, runWatchBaseline, + TscWatchCompileChange, verifyTscWatch, } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts index 076f56752f0..d78e632d111 100644 --- a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts +++ b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts @@ -1,12 +1,12 @@ import * as ts from "../../_namespaces/ts"; import { - File, createWatchedSystem, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - TscWatchCompileChange, noopChange, + TscWatchCompileChange, verifyTscWatch, } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/publicApi.ts b/src/testRunner/unittests/tsbuildWatch/publicApi.ts index 6606990897a..e7ec70725a6 100644 --- a/src/testRunner/unittests/tsbuildWatch/publicApi.ts +++ b/src/testRunner/unittests/tsbuildWatch/publicApi.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createWatchedSystem, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index d42f37ee554..2858099f538 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -1,9 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { - File, - TestServerHost, createWatchedSystem, + File, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { createBaseline, diff --git a/src/testRunner/unittests/tsc/cancellationToken.ts b/src/testRunner/unittests/tsc/cancellationToken.ts index df418d16e02..e084adbe72c 100644 --- a/src/testRunner/unittests/tsc/cancellationToken.ts +++ b/src/testRunner/unittests/tsc/cancellationToken.ts @@ -2,13 +2,13 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import * as Harness from "../../_namespaces/Harness"; import { - File, createWatchedSystem, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - CommandLineProgram, baselineBuildInfo, + CommandLineProgram, } from "../tsc/helpers"; import { applyChange, diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index 15ac493ec99..b1739dcd8af 100644 --- a/src/testRunner/unittests/tsc/declarationEmit.ts +++ b/src/testRunner/unittests/tsc/declarationEmit.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - FileOrFolderOrSymLink, createWatchedSystem, + FileOrFolderOrSymLink, isSymLink, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index fc3cdda1277..302334dea4c 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -4,8 +4,8 @@ import * as vfs from "../../_namespaces/vfs"; import * as vpath from "../../_namespaces/vpath"; import * as Harness from "../../_namespaces/Harness"; import { - TestServerHost, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; export type TscCompileSystem = fakes.System & { diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 96ddac44558..d41f9339472 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -2,7 +2,6 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import * as vfs from "../../_namespaces/vfs"; import { - TestTscEdit, appendText, compilerOptionsToConfigJson, libContent, @@ -13,6 +12,7 @@ import { noChangeWithExportsDiscrepancyRun, prependText, replaceText, + TestTscEdit, verifyTsc, verifyTscWithEdits, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index b1c86fcd571..79d42a00ce4 100644 --- a/src/testRunner/unittests/tscWatch/consoleClearing.ts +++ b/src/testRunner/unittests/tscWatch/consoleClearing.ts @@ -1,14 +1,14 @@ import * as ts from "../../_namespaces/ts"; import { - File, createWatchedSystem, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - TscWatchCompileChange, createBaseline, createWatchCompilerHostOfConfigFileForBaseline, runWatchBaseline, + TscWatchCompileChange, verifyTscWatch, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/emit.ts b/src/testRunner/unittests/tscWatch/emit.ts index 4f037949d8b..afd3f34b71c 100644 --- a/src/testRunner/unittests/tscWatch/emit.ts +++ b/src/testRunner/unittests/tscWatch/emit.ts @@ -1,9 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { - File, - TestServerHost, createWatchedSystem, + File, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { TscWatchCompileChange, diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 197f5e2f2f6..2262dda00cc 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -1,6 +1,6 @@ import { - File, createWatchedSystem, + File, getTsBuildProjectFile, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 67fa32f75c8..7beecd9cdd2 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -1,10 +1,10 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - File, - SymLink, createWatchedSystem, + File, libFile, + SymLink, } from "../virtualFileSystemWithWatch"; import { TscWatchCompileChange, diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index a8051822d0c..914d8898069 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -2,20 +2,20 @@ import * as ts from "../../_namespaces/ts"; import { patchHostForBuildInfoReadWrite } from "../../_namespaces/fakes"; import { Baseline } from "../../_namespaces/Harness"; import { + changeToHostTrackingWrittenFiles, + createWatchedSystem, File, FileOrFolderOrSymLink, FileOrFolderOrSymLinkMap, TestServerHost, TestServerHostCreationParameters, TestServerHostTrackingWrittenFiles, - changeToHostTrackingWrittenFiles, - createWatchedSystem, } from "../virtualFileSystemWithWatch"; import { - CommandLineCallbacks, - CommandLineProgram, baselinePrograms, commandLineCallbacks, + CommandLineCallbacks, + CommandLineProgram, createSolutionBuilderHostForBaseline, generateSourceMapBaselineFiles, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index 49db873e21f..9823c67dbdb 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -1,19 +1,19 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { - File, - TestServerHost, createWatchedSystem, + File, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { CommandLineProgram, libContent, } from "../tsc/helpers"; import { - SystemSnap, applyChange, createBaseline, + SystemSnap, verifyTscWatch, watchBaseline, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 77b5384fe3f..4a198b652f5 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - File, createWatchedSystem, + File, libFile, } from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts index a0c79260450..dfed47e0814 100644 --- a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts +++ b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts @@ -1,7 +1,7 @@ import * as Utils from "../../_namespaces/Utils"; import { - File, createWatchedSystem, + File, libFile, } from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index db5e2408ca2..ff58abc4c85 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -1,20 +1,20 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { + createWatchedSystem, File, + libFile, SymLink, TestServerHost, - createWatchedSystem, - libFile, } from "../virtualFileSystemWithWatch"; import { - TscWatchCompileChange, commonFile1, commonFile2, createBaseline, createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, noopChange, runWatchBaseline, + TscWatchCompileChange, verifyTscWatch, watchBaseline, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts index dc3dea59d19..7321dc807dc 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -1,9 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { - TestServerHost, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { createSolutionBuilder, diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index f6aba5b8537..e25a5eefacc 100644 --- a/src/testRunner/unittests/tscWatch/resolutionCache.ts +++ b/src/testRunner/unittests/tscWatch/resolutionCache.ts @@ -1,10 +1,10 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - File, - SymLink, createWatchedSystem, + File, libFile, + SymLink, } from "../virtualFileSystemWithWatch"; import { createBaseline, diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index 21a4dbecb5e..4aa07594fea 100644 --- a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts +++ b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts @@ -1,11 +1,11 @@ import * as ts from "../../_namespaces/ts"; import { + createWatchedSystem, File, FileOrFolderOrSymLink, - SymLink, - createWatchedSystem, getTsBuildProjectFile, libFile, + SymLink, } from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; import { diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index 40de351fbd6..102bbd7746b 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -1,10 +1,10 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { - File, - TestServerHostTrackingWrittenFiles, createWatchedSystem, + File, libFile, + TestServerHostTrackingWrittenFiles, } from "../virtualFileSystemWithWatch"; import { applyChange, diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index abacbeb6cb4..32a271b5e71 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -1,12 +1,12 @@ import * as ts from "../../_namespaces/ts"; import { + createWatchedSystem, File, + libFile, SymLink, TestServerHost, Tsc_WatchDirectory, Tsc_WatchFile, - createWatchedSystem, - libFile, } from "../virtualFileSystemWithWatch"; import { commonFile1, diff --git a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts index b11d28f640e..d7eed858ebe 100644 --- a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts +++ b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { @@ -9,8 +9,8 @@ import { commonFile2, } from "../tscWatch/helpers"; import { - TestSession, createSession, + TestSession, } from "./helpers"; describe("unittests:: tsserver:: applyChangesToOpenFiles", () => { diff --git a/src/testRunner/unittests/tsserver/autoImportProvider.ts b/src/testRunner/unittests/tsserver/autoImportProvider.ts index 5eaa1ffedb7..5fdd48039fe 100644 --- a/src/testRunner/unittests/tsserver/autoImportProvider.ts +++ b/src/testRunner/unittests/tsserver/autoImportProvider.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { checkNumberOfConfiguredProjects, diff --git a/src/testRunner/unittests/tsserver/auxiliaryProject.ts b/src/testRunner/unittests/tsserver/auxiliaryProject.ts index b55f0f72fbe..94b062a2c7f 100644 --- a/src/testRunner/unittests/tsserver/auxiliaryProject.ts +++ b/src/testRunner/unittests/tsserver/auxiliaryProject.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { checkNumberOfInferredProjects, diff --git a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts index fa999ffdd46..01b947479a2 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -1,19 +1,19 @@ import * as ts from "../../_namespaces/ts"; import { + createServerHost, File, + libFile, SymLink, TestServerHost, - createServerHost, - libFile, } from "../virtualFileSystemWithWatch"; import { - Logger, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, createLoggerWithInMemoryLogs, createProjectService, createSession, + Logger, makeSessionRequest, openFilesForSession, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/cancellationToken.ts b/src/testRunner/unittests/tsserver/cancellationToken.ts index 72be1530141..c1fddf77332 100644 --- a/src/testRunner/unittests/tsserver/cancellationToken.ts +++ b/src/testRunner/unittests/tsserver/cancellationToken.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import { createServerHost } from "../virtualFileSystemWithWatch"; import { - TestServerCancellationToken, createSession, + TestServerCancellationToken, } from "./helpers"; describe("unittests:: tsserver:: cancellationToken", () => { diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index a5d3948a4e8..97aa6aa01f4 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -1,12 +1,10 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - TestSession, - TestTypingsInstaller, baselineTsserverLogs, checkNumberOfProjects, checkProjectRootFiles, @@ -15,6 +13,8 @@ import { makeSessionRequest, openFilesForSession, protocolTextSpanFromSubstring, + TestSession, + TestTypingsInstaller, toExternalFiles, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 6a6d5386159..cc4883f4dc9 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -1,16 +1,16 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - TestTypingsInstaller, checkNumberOfProjects, checkProjectActualFiles, createSession, executeSessionRequest, openFilesForSession, + TestTypingsInstaller, } from "./helpers"; describe("unittests:: tsserver:: completions", () => { diff --git a/src/testRunner/unittests/tsserver/completionsIncomplete.ts b/src/testRunner/unittests/tsserver/completionsIncomplete.ts index 8055317a566..d834c5c83d7 100644 --- a/src/testRunner/unittests/tsserver/completionsIncomplete.ts +++ b/src/testRunner/unittests/tsserver/completionsIncomplete.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/configFileSearch.ts b/src/testRunner/unittests/tsserver/configFileSearch.ts index 739c07e2ade..4e3d46204f7 100644 --- a/src/testRunner/unittests/tsserver/configFileSearch.ts +++ b/src/testRunner/unittests/tsserver/configFileSearch.ts @@ -1,6 +1,6 @@ import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index c176c061e0d..aeeba6f8a19 100644 --- a/src/testRunner/unittests/tsserver/configuredProjects.ts +++ b/src/testRunner/unittests/tsserver/configuredProjects.ts @@ -1,9 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { - File, - SymLink, createServerHost, + File, libFile, + SymLink, } from "../virtualFileSystemWithWatch"; import { commonFile1, diff --git a/src/testRunner/unittests/tsserver/declarationFileMaps.ts b/src/testRunner/unittests/tsserver/declarationFileMaps.ts index 20072766770..269eeaa9610 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -1,15 +1,14 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { - DocumentSpanFromSubstring, - TestSession, checkNumberOfProjects, checkProjectActualFiles, closeFilesForSession, createSession, + DocumentSpanFromSubstring, executeSessionRequest, makeReferenceItem, openFilesForSession, @@ -19,6 +18,7 @@ import { protocolLocationFromSubstring, protocolRenameSpanFromSubstring, protocolTextSpanFromSubstring, + TestSession, textSpanFromSubstring, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/documentRegistry.ts b/src/testRunner/unittests/tsserver/documentRegistry.ts index c93b84a67a1..6452515db8c 100644 --- a/src/testRunner/unittests/tsserver/documentRegistry.ts +++ b/src/testRunner/unittests/tsserver/documentRegistry.ts @@ -1,13 +1,13 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - TestProjectService, checkProjectActualFiles, createProjectService, + TestProjectService, } from "./helpers"; describe("unittests:: tsserver:: document registry in project service", () => { diff --git a/src/testRunner/unittests/tsserver/duplicatePackages.ts b/src/testRunner/unittests/tsserver/duplicatePackages.ts index 7af85c3f9d6..28b6c72606b 100644 --- a/src/testRunner/unittests/tsserver/duplicatePackages.ts +++ b/src/testRunner/unittests/tsserver/duplicatePackages.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index 6551422911f..ec3f62c82c4 100644 --- a/src/testRunner/unittests/tsserver/dynamicFiles.ts +++ b/src/testRunner/unittests/tsserver/dynamicFiles.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts index c775e8a104e..b2584532979 100644 --- a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts +++ b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts @@ -1,7 +1,7 @@ import * as ts from "../../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts index 67f56833399..9c6bd0d664e 100644 --- a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts +++ b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts @@ -1,7 +1,7 @@ import * as ts from "../../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/events/projectLoading.ts b/src/testRunner/unittests/tsserver/events/projectLoading.ts index 92f7e47b7fc..739a29a503e 100644 --- a/src/testRunner/unittests/tsserver/events/projectLoading.ts +++ b/src/testRunner/unittests/tsserver/events/projectLoading.ts @@ -1,17 +1,17 @@ import * as ts from "../../../_namespaces/ts"; import { - File, - TestServerHost, createServerHost, + File, libFile, + TestServerHost, } from "../../virtualFileSystemWithWatch"; import { - TestSession, checkNumberOfProjects, createSessionWithDefaultEventHandler, createSessionWithEventTracking, openFilesForSession, protocolLocationFromSubstring, + TestSession, toExternalFiles, } from "../helpers"; diff --git a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts index 48457ff976d..8acf0e1c6b2 100644 --- a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts +++ b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts @@ -1,18 +1,18 @@ import * as ts from "../../../_namespaces/ts"; import { - File, - TestServerHost, createServerHost, + File, libFile, + TestServerHost, } from "../../virtualFileSystemWithWatch"; import { - Logger, - TestSession, baselineTsserverLogs, createHasErrorMessageLogger, createLoggerWithInMemoryLogs, createSessionWithDefaultEventHandler, createSessionWithEventTracking, + Logger, + TestSession, } from "../helpers"; describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { diff --git a/src/testRunner/unittests/tsserver/exportMapCache.ts b/src/testRunner/unittests/tsserver/exportMapCache.ts index 7d75decb752..93a5b517af8 100644 --- a/src/testRunner/unittests/tsserver/exportMapCache.ts +++ b/src/testRunner/unittests/tsserver/exportMapCache.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { configuredProjectAt, diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index c9e948efbeb..5d6919dc336 100644 --- a/src/testRunner/unittests/tsserver/externalProjects.ts +++ b/src/testRunner/unittests/tsserver/externalProjects.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts index 1c0411cb425..c505181c490 100644 --- a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts index c87e565b363..eb0182bea63 100644 --- a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts +++ b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts index 8f2baf82484..917b50ce6ee 100644 --- a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts +++ b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createProjectService, diff --git a/src/testRunner/unittests/tsserver/getExportReferences.ts b/src/testRunner/unittests/tsserver/getExportReferences.ts index 8d9051824d5..5d19e907507 100644 --- a/src/testRunner/unittests/tsserver/getExportReferences.ts +++ b/src/testRunner/unittests/tsserver/getExportReferences.ts @@ -1,13 +1,13 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { - MakeReferenceItem, createSession, executeSessionRequest, makeReferenceItem, + MakeReferenceItem, openFilesForSession, protocolFileLocationFromSubstring, protocolLocationFromSubstring, diff --git a/src/testRunner/unittests/tsserver/getFileReferences.ts b/src/testRunner/unittests/tsserver/getFileReferences.ts index 40cd8a791fa..c6ade3fb6e2 100644 --- a/src/testRunner/unittests/tsserver/getFileReferences.ts +++ b/src/testRunner/unittests/tsserver/getFileReferences.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 603fe35174d..6fa7aa172e4 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -2,14 +2,14 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import * as Utils from "../../_namespaces/Utils"; import { - File, - FileOrFolderOrSymLink, - TestServerHost, - TestServerHostTrackingWrittenFiles, changeToHostTrackingWrittenFiles, checkArray, createServerHost, + File, + FileOrFolderOrSymLink, libFile, + TestServerHost, + TestServerHostTrackingWrittenFiles, } from "../virtualFileSystemWithWatch"; import { ensureErrorFreeBuild } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index 5a69bc6e9f1..11fded416f6 100644 --- a/src/testRunner/unittests/tsserver/inferredProjects.ts +++ b/src/testRunner/unittests/tsserver/inferredProjects.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { commonFile1 } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsserver/inlayHints.ts b/src/testRunner/unittests/tsserver/inlayHints.ts index 8fb57296754..c113207329b 100644 --- a/src/testRunner/unittests/tsserver/inlayHints.ts +++ b/src/testRunner/unittests/tsserver/inlayHints.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { @@ -9,8 +9,8 @@ import { commonFile2, } from "../tscWatch/helpers"; import { - TestSession, createSession, + TestSession, } from "./helpers"; describe("unittests:: tsserver:: inlayHints", () => { diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 050d3cc9336..5fcf7726abf 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts index f65581a7255..f163dbbbfd7 100644 --- a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts +++ b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/metadataInResponse.ts b/src/testRunner/unittests/tsserver/metadataInResponse.ts index e79227946d2..5a2d5dc3795 100644 --- a/src/testRunner/unittests/tsserver/metadataInResponse.ts +++ b/src/testRunner/unittests/tsserver/metadataInResponse.ts @@ -1,15 +1,15 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { + createServerHost, File, TestServerHost, - createServerHost, } from "../virtualFileSystemWithWatch"; import { - TestSession, createSession, mapOutputToJson, openFilesForSession, + TestSession, } from "./helpers"; describe("unittests:: tsserver:: with metadata in response", () => { diff --git a/src/testRunner/unittests/tsserver/moduleResolution.ts b/src/testRunner/unittests/tsserver/moduleResolution.ts index 73d712ff87d..c83d202d469 100644 --- a/src/testRunner/unittests/tsserver/moduleResolution.ts +++ b/src/testRunner/unittests/tsserver/moduleResolution.ts @@ -1,7 +1,7 @@ import * as Utils from "../../_namespaces/Utils"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts index b149c7bd6ff..5da6c3123de 100644 --- a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts +++ b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts @@ -1,17 +1,17 @@ import * as ts from "../../_namespaces/ts"; import { + createServerHost, File, SymLink, TestServerHost, - createServerHost, } from "../virtualFileSystemWithWatch"; import { - Logger, baselineTsserverLogs, configuredProjectAt, createLoggerWithInMemoryLogs, createSession, executeSessionRequest, + Logger, openFilesForSession, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/navTo.ts b/src/testRunner/unittests/tsserver/navTo.ts index 951287c0df7..6414d2441d5 100644 --- a/src/testRunner/unittests/tsserver/navTo.ts +++ b/src/testRunner/unittests/tsserver/navTo.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/occurences.ts b/src/testRunner/unittests/tsserver/occurences.ts index 7e6c9daeb36..c7d6b12a684 100644 --- a/src/testRunner/unittests/tsserver/occurences.ts +++ b/src/testRunner/unittests/tsserver/occurences.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 190cddc49f2..9933afd8ad0 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/packageJsonInfo.ts b/src/testRunner/unittests/tsserver/packageJsonInfo.ts index 393c5a24ba0..b122bd7b893 100644 --- a/src/testRunner/unittests/tsserver/packageJsonInfo.ts +++ b/src/testRunner/unittests/tsserver/packageJsonInfo.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { configuredProjectAt, diff --git a/src/testRunner/unittests/tsserver/partialSemanticServer.ts b/src/testRunner/unittests/tsserver/partialSemanticServer.ts index bc09ece98fc..81304941d8a 100644 --- a/src/testRunner/unittests/tsserver/partialSemanticServer.ts +++ b/src/testRunner/unittests/tsserver/partialSemanticServer.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/plugins.ts b/src/testRunner/unittests/tsserver/plugins.ts index ae4c598b4b6..6db0fb3509f 100644 --- a/src/testRunner/unittests/tsserver/plugins.ts +++ b/src/testRunner/unittests/tsserver/plugins.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 7cc11e9bb11..10613e0e76b 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import { + createServerHost, File, Folder, - createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index c1dafa9ad79..b8de4f6d65c 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { ensureErrorFreeBuild } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index 4846ca15430..4734b18c473 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -13,12 +13,12 @@ import { verifyGetErrRequest, } from "./helpers"; import { - File, - SymLink, createServerHost, + File, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, + SymLink, } from "../virtualFileSystemWithWatch"; import { solutionBuildWithBaseline } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts index 650527ea95a..400c21cd0a5 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -1,18 +1,18 @@ import * as ts from "../../_namespaces/ts"; import { - File, - TestServerHost, createServerHost, + File, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { - TestSession, baselineTsserverLogs, closeFilesForSession, createHostWithSolutionBuild, createLoggerWithInMemoryLogs, createSession, openFilesForSession, + TestSession, } from "./helpers"; describe("unittests:: tsserver:: with project references and tsbuild source map", () => { diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 681c7933158..6e6e3539d7d 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/projectsWithReferences.ts b/src/testRunner/unittests/tsserver/projectsWithReferences.ts index ada75410a17..a1f780dcc8c 100644 --- a/src/testRunner/unittests/tsserver/projectsWithReferences.ts +++ b/src/testRunner/unittests/tsserver/projectsWithReferences.ts @@ -1,6 +1,6 @@ import { - File, createServerHost, + File, getTsBuildProjectFile, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tsserver/refactors.ts b/src/testRunner/unittests/tsserver/refactors.ts index b10d7c178af..86504b90255 100644 --- a/src/testRunner/unittests/tsserver/refactors.ts +++ b/src/testRunner/unittests/tsserver/refactors.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/reloadProjects.ts b/src/testRunner/unittests/tsserver/reloadProjects.ts index d22928bcc80..d65eee7ac41 100644 --- a/src/testRunner/unittests/tsserver/reloadProjects.ts +++ b/src/testRunner/unittests/tsserver/reloadProjects.ts @@ -1,15 +1,15 @@ import * as ts from "../../_namespaces/ts"; import { - File, - TestServerHost, createServerHost, + File, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { - TestProjectService, checkNumberOfProjects, checkProjectActualFiles, createProjectService, + TestProjectService, } from "./helpers"; describe("unittests:: tsserver:: reloadProjects", () => { diff --git a/src/testRunner/unittests/tsserver/rename.ts b/src/testRunner/unittests/tsserver/rename.ts index 05e2dade62e..72e8bfedf71 100644 --- a/src/testRunner/unittests/tsserver/rename.ts +++ b/src/testRunner/unittests/tsserver/rename.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 7a53291ddf8..b9290fe96ad 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -1,12 +1,11 @@ import * as ts from "../../_namespaces/ts"; import { - File, - TestServerHost, createServerHost, + File, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { - TestTypingsInstaller, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, @@ -16,6 +15,7 @@ import { createSession, makeSessionRequest, openFilesForSession, + TestTypingsInstaller, toExternalFiles, verifyGetErrRequest, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/smartSelection.ts b/src/testRunner/unittests/tsserver/smartSelection.ts index 07210c6da3e..99ed4ead47e 100644 --- a/src/testRunner/unittests/tsserver/smartSelection.ts +++ b/src/testRunner/unittests/tsserver/smartSelection.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/symLinks.ts b/src/testRunner/unittests/tsserver/symLinks.ts index 121399ac4fc..e6e7a0e9938 100644 --- a/src/testRunner/unittests/tsserver/symLinks.ts +++ b/src/testRunner/unittests/tsserver/symLinks.ts @@ -1,10 +1,10 @@ import * as ts from "../../_namespaces/ts"; import { + createServerHost, File, + libFile, SymLink, TestServerHost, - createServerHost, - libFile, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/symlinkCache.ts b/src/testRunner/unittests/tsserver/symlinkCache.ts index 7bc56c7e5a2..f93933499ce 100644 --- a/src/testRunner/unittests/tsserver/symlinkCache.ts +++ b/src/testRunner/unittests/tsserver/symlinkCache.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import { + createServerHost, File, SymLink, - createServerHost, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/syntacticServer.ts b/src/testRunner/unittests/tsserver/syntacticServer.ts index 620f40130d7..f20963c5317 100644 --- a/src/testRunner/unittests/tsserver/syntacticServer.ts +++ b/src/testRunner/unittests/tsserver/syntacticServer.ts @@ -1,11 +1,10 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - TestSession, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, @@ -14,6 +13,7 @@ import { createSession, openFilesForSession, protocolFileLocationFromSubstring, + TestSession, } from "./helpers"; describe("unittests:: tsserver:: Semantic operations on Syntax server", () => { diff --git a/src/testRunner/unittests/tsserver/syntaxOperations.ts b/src/testRunner/unittests/tsserver/syntaxOperations.ts index 450f8f04d98..9257ac4400e 100644 --- a/src/testRunner/unittests/tsserver/syntaxOperations.ts +++ b/src/testRunner/unittests/tsserver/syntaxOperations.ts @@ -1,14 +1,14 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { - TestSession, checkNumberOfProjects, checkProjectActualFiles, createSession, + TestSession, } from "./helpers"; describe("unittests:: tsserver:: syntax operations", () => { diff --git a/src/testRunner/unittests/tsserver/telemetry.ts b/src/testRunner/unittests/tsserver/telemetry.ts index 3efc9bdd213..a741c851736 100644 --- a/src/testRunner/unittests/tsserver/telemetry.ts +++ b/src/testRunner/unittests/tsserver/telemetry.ts @@ -1,9 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { File } from "../virtualFileSystemWithWatch"; import { - TestServerEventManager, checkNumberOfProjects, fileStats, + TestServerEventManager, toExternalFiles, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/typeAquisition.ts b/src/testRunner/unittests/tsserver/typeAquisition.ts index ec5ffbcafd8..6750433c9f9 100644 --- a/src/testRunner/unittests/tsserver/typeAquisition.ts +++ b/src/testRunner/unittests/tsserver/typeAquisition.ts @@ -1,10 +1,10 @@ import { createServerHost } from "../virtualFileSystemWithWatch"; import * as ts from "../../_namespaces/ts"; import { - TestTypingsInstaller, checkProjectActualFiles, configuredProjectAt, createProjectService, + TestTypingsInstaller, toExternalFile, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts index abc1fb87c1d..a0db3ccd3f5 100644 --- a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts +++ b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - File, createServerHost, + File, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts index 84f259ba944..651e0889e1a 100644 --- a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts +++ b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts @@ -1,6 +1,6 @@ import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index 231ebfe7b80..6c016e79cdb 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -1,12 +1,11 @@ import * as ts from "../../_namespaces/ts"; import { - File, - TestServerHost, createServerHost, + File, libFile, + TestServerHost, } from "../virtualFileSystemWithWatch"; import { - TestTypingsInstaller, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, @@ -16,6 +15,7 @@ import { createSession, createTypesRegistry, customTypesMap, + TestTypingsInstaller, toExternalFile, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 19f69437009..de6fbde92e5 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -1,23 +1,23 @@ import * as ts from "../../_namespaces/ts"; import { - File, - Tsc_WatchDirectory, createServerHost, + File, libFile, + Tsc_WatchDirectory, } from "../virtualFileSystemWithWatch"; import { commonFile1, commonFile2, } from "../tscWatch/helpers"; import { - Logger, - TestSession, baselineTsserverLogs, createLoggerWithInMemoryLogs, createProjectService, createSession, + Logger, openFilesForSession, protocolFileLocationFromSubstring, + TestSession, toExternalFiles, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/webServer.ts b/src/testRunner/unittests/tsserver/webServer.ts index 9b4d8b77cd9..25de36c1ff4 100644 --- a/src/testRunner/unittests/tsserver/webServer.ts +++ b/src/testRunner/unittests/tsserver/webServer.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - File, createServerHost, + File, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 7b09c8740fd..04d1c3745f3 100644 --- a/src/testRunner/unittests/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/virtualFileSystemWithWatch.ts @@ -1,21 +1,5 @@ import * as Harness from "../_namespaces/Harness"; import { - Debug, - FileSystemEntryKind, - FileWatcher, - FileWatcherCallback, - FileWatcherEventKind, - FormatDiagnosticsHost, - FsWatchCallback, - FsWatchWorkerWatcher, - HostWatchDirectory, - HostWatchFile, - ModuleResolutionHost, - MultiMap, - Path, - PollingInterval, - RequireResult, - SortedArray, arrayFrom, arrayToMap, clear, @@ -25,15 +9,25 @@ import { createGetCanonicalFileName, createMultiMap, createSystemWatchFunctions, + Debug, directorySeparator, + FileSystemEntryKind, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, filterMutate, forEach, + FormatDiagnosticsHost, + FsWatchCallback, + FsWatchWorkerWatcher, generateDjb2Hash, getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, getRelativePathToDirectoryOrUrl, hasProperty, + HostWatchDirectory, + HostWatchFile, identity, insertSorted, isArray, @@ -41,9 +35,15 @@ import { isString, mapDefined, matchFiles, + ModuleResolutionHost, + MultiMap, noop, patchWriteFileEnsuringDirectory, + Path, + PollingInterval, + RequireResult, server, + SortedArray, sys, toPath, } from "../_namespaces/ts"; diff --git a/src/tsserver/common.ts b/src/tsserver/common.ts index c272252d63f..f62f1316de1 100644 --- a/src/tsserver/common.ts +++ b/src/tsserver/common.ts @@ -1,6 +1,6 @@ import { - LogLevel, Logger, + LogLevel, ServerCancellationToken, StartSessionOptions, } from "./_namespaces/ts.server"; diff --git a/src/tsserver/nodeServer.ts b/src/tsserver/nodeServer.ts index c80669e1136..bcf2e0128dd 100644 --- a/src/tsserver/nodeServer.ts +++ b/src/tsserver/nodeServer.ts @@ -7,75 +7,75 @@ import { Arguments, BaseLogger, BeginInstallTypes, + createInstallTypingsRequest, EndInstallTypes, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, EventTypesRegistry, - ITypingsInstaller, + findArgument, + formatMessage, + getLogLevel, + hasArgument, + indent, InitializationFailedResponse, InstallPackageOptionsWithProject, InstallPackageRequest, InvalidateCachedTypings, - LogLevel, + ITypingsInstaller, Logger, + LogLevel, ModuleImportResult, Msg, + nullCancellationToken, + nullTypingsInstaller, PackageInstalledResponse, Project, ProjectService, + protocol, ServerCancellationToken, ServerHost, Session, SetTypings, StartInput, StartSessionOptions, - TypesRegistryResponse, - TypingInstallerRequestUnion, - createInstallTypingsRequest, - findArgument, - formatMessage, - getLogLevel, - hasArgument, - indent, - nullCancellationToken, - nullTypingsInstaller, - protocol, stringifyIndented, toEvent, + TypesRegistryResponse, + TypingInstallerRequestUnion, } from "./_namespaces/ts.server"; import { ApplyCodeActionCommandResult, - CharacterCodes, - Debug, - DirectoryWatcherCallback, - FileWatcher, - JsTyping, - LanguageServiceMode, - MapLike, - SortedReadonlyArray, - TypeAcquisition, - WatchOptions, assertType, + CharacterCodes, combinePaths, createQueue, + Debug, directorySeparator, + DirectoryWatcherCallback, + FileWatcher, getDirectoryPath, getEntries, getNodeMajorVersion, getRootLength, + JsTyping, + LanguageServiceMode, + MapLike, noop, noopFileWatcher, normalizePath, normalizeSlashes, resolveJSModule, + SortedReadonlyArray, startTracing, stripQuotes, sys, toFileNameLowerCase, tracing, + TypeAcquisition, validateLocaleAndSetLanguage, versionMajorMinor, + WatchOptions, } from "./_namespaces/ts"; interface LogOptions { diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index 37571343824..c95b6b420d1 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -1,11 +1,11 @@ import { - Msg, - StartInput, emptyArray, findArgument, hasArgument, initializeNodeSystem, initializeWebSystem, + Msg, + StartInput, } from "./_namespaces/ts.server"; import { Debug, diff --git a/src/tsserver/webServer.ts b/src/tsserver/webServer.ts index bc9d36195ac..d3ad989f200 100644 --- a/src/tsserver/webServer.ts +++ b/src/tsserver/webServer.ts @@ -3,17 +3,17 @@ import * as ts from "./_namespaces/ts"; import * as server from "./_namespaces/ts.server"; import { + findArgument, + getLogLevel, Logger, MainProcessLogger, Msg, + nullCancellationToken, ServerCancellationToken, ServerHost, StartInput, StartSessionOptions, WebHost, - findArgument, - getLogLevel, - nullCancellationToken, } from "./_namespaces/ts.server"; import { Debug, diff --git a/src/typingsInstaller/nodeTypingsInstaller.ts b/src/typingsInstaller/nodeTypingsInstaller.ts index 68774b3c5f4..0d8d0eb5d61 100644 --- a/src/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/typingsInstaller/nodeTypingsInstaller.ts @@ -2,33 +2,33 @@ import * as fs from "fs"; import * as path from "path"; import { + installNpmPackages, Log, RequestCompletedAction, TypingsInstaller, - installNpmPackages, } from "./_namespaces/ts.server.typingsInstaller"; import { ActionPackageInstalled, Arguments, EventTypesRegistry, + findArgument, + hasArgument, InitializationFailedResponse, InstallTypingHost, + nowString, PackageInstalledResponse, TypesRegistryResponse, TypingInstallerRequestUnion, TypingInstallerResponseUnion, - findArgument, - hasArgument, - nowString, } from "./_namespaces/ts.server"; import { - Debug, - MapLike, combinePaths, createGetCanonicalFileName, + Debug, forEachAncestorDirectory, getDirectoryPath, getEntries, + MapLike, normalizePath, normalizeSlashes, stringContains, diff --git a/src/typingsInstallerCore/typingsInstaller.ts b/src/typingsInstallerCore/typingsInstaller.ts index d0e249d9960..81c6ec68a10 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -1,39 +1,39 @@ import { + clearMap, + closeFileWatcher, + combinePaths, + compareStringsCaseInsensitive, Comparison, + containsPath, + copyEntries, + createGetCanonicalFileName, + directorySeparator, Extension, + fileExtensionIs, FileWatcher, + getBaseFileName, GetCanonicalFileName, + getDirectoryPath, + getProperty, + getWatchFactory, + hasProperty, JsTyping, + mangleScopedPackageName, + mapDefined, MapLike, ModuleResolutionKind, + noop, Path, PollingInterval, + resolveModuleName, + version, Version, + versionMajorMinor, WatchDirectoryFlags, WatchFactory, WatchFactoryHost, WatchLogLevel, WatchOptions, - clearMap, - closeFileWatcher, - combinePaths, - compareStringsCaseInsensitive, - containsPath, - copyEntries, - createGetCanonicalFileName, - directorySeparator, - fileExtensionIs, - getBaseFileName, - getDirectoryPath, - getProperty, - getWatchFactory, - hasProperty, - mangleScopedPackageName, - mapDefined, - noop, - resolveModuleName, - version, - versionMajorMinor, } from "./_namespaces/ts"; import { ActionInvalidate, diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index ca3be411e44..f5cc041c7b6 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -2,22 +2,22 @@ /// import { - LogLevel, + indent, Logger, + LogLevel, ModuleImportResult, Msg, + nowString, + nullTypingsInstaller, + protocol, ServerCancellationToken, ServerHost, Session, SessionOptions, - indent, - nowString, - nullTypingsInstaller, - protocol, } from "./_namespaces/ts.server"; import { - Debug, combinePaths, + Debug, directorySeparator, ensureTrailingDirectorySeparator, getDirectoryPath,