diff --git a/.eslintrc.json b/.eslintrc.json index 7b7c1f525891c..5dd81f7d7eed2 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 60172033a77aa..64fbdbce0e572 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, + contains, + createBinaryExpressionTrampoline, + createDiagnosticForNodeInSourceFile, + createFileDiagnostic, + createQueue, + createSymbolTable, Debug, Declaration, + declarationNameToString, DeleteExpression, DestructuringAssignment, DiagnosticCategory, DiagnosticMessage, DiagnosticRelatedInformation, - DiagnosticWithLocation, 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, - 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, - declarationNameToString, - escapeLeadingUnderscores, - every, - exportAssignmentIsAlias, - findAncestor, - forEach, - forEachChild, 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 313e1298f3108..6002189104f9b 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 0e155a0f2be9b..e664960e4d59e 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 57abd590d56c9..8ae0d6295ca8d 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 c988063e2a4df..de5ba77eb2097 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,25 +65,57 @@ import { ClassExpression, ClassLikeDeclaration, ClassStaticBlockDeclaration, + clear, + combinePaths, + compareDiagnostics, + comparePaths, + compareValues, Comparison, CompilerOptions, ComputedPropertyName, + concatenate, + concatenateDiagnosticMessageChains, ConditionalExpression, ConditionalRoot, ConditionalType, ConditionalTypeNode, - ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, + ConstructSignatureDeclaration, + contains, + containsParseError, ContextFlags, + copyEntries, + countWhere, + createBinaryExpressionTrampoline, + createCompilerDiagnostic, + createDiagnosticCollection, + createDiagnosticForFileFromMessageChain, + createDiagnosticForNode, + createDiagnosticForNodeArray, + createDiagnosticForNodeFromMessageChain, + createDiagnosticMessageChainFromDiagnostic, + createEmptyExports, + createFileDiagnostic, + createGetCanonicalFileName, + createGetSymbolWalker, + createPrinter, + createPropertyNameNodeForIdentifierOrLiteral, + createScanner, + createSymbolTable, + createTextWriter, + createUnderscoreEscapedMultiMap, Debug, Declaration, DeclarationName, + declarationNameToString, DeclarationStatement, DeclarationWithTypeParameterChildren, DeclarationWithTypeParameters, Decorator, + deduplicate, DefaultClause, + defaultMaximumTruncationLength, DeferredTypeReference, DeleteExpression, Diagnostic, @@ -69,8 +123,8 @@ import { DiagnosticMessage, DiagnosticMessageChain, DiagnosticRelatedInformation, - DiagnosticWithLocation, Diagnostics, + DiagnosticWithLocation, DoStatement, DynamicNamedDeclaration, ElementAccessChain, @@ -80,382 +134,30 @@ import { 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, - 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, - concatenate, - concatenateDiagnosticMessageChains, - contains, - containsParseError, - copyEntries, - countWhere, - createBinaryExpressionTrampoline, - createCompilerDiagnostic, - createDiagnosticCollection, - createDiagnosticForFileFromMessageChain, - createDiagnosticForNode, - createDiagnosticForNodeArray, - createDiagnosticForNodeFromMessageChain, - createDiagnosticMessageChainFromDiagnostic, - createEmptyExports, - createFileDiagnostic, - createGetCanonicalFileName, - createGetSymbolWalker, - createPrinter, - createPropertyNameNodeForIdentifierOrLiteral, - createScanner, - createSymbolTable, - createTextWriter, - createUnderscoreEscapedMultiMap, - declarationNameToString, - deduplicate, - defaultMaximumTruncationLength, - emptyArray, - endsWith, - entityNameToString, - equateValues, - escapeLeadingUnderscores, - escapeString, - every, - exportAssignmentIsAlias, - expressionResultIsUnused, 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 55db718e997a2..b62fb3b638ff1 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 d256371dbbf16..3961e094cde6b 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 f0eb1166c6026..9bd8471f531b5 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 daaa68073ea77..c438fab6ced3d 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,10 +132,59 @@ import { GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, + getAreDeclarationMapsEnabled, + getBaseFileName, GetCanonicalFileName, + getCommentRange, + getConstantValue, + getContainingNodeArray, + getDeclarationEmitExtensionForPath, + getDeclarationEmitOutputFilePath, + getDirectoryPath, + getEmitDeclarations, + getEmitFlags, + getEmitHelpers, + getEmitModuleKind, + getExternalHelpersModuleName, + getExternalModuleName, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLinesBetweenPositionAndNextNonWhitespaceCharacter, + getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, + getLinesBetweenRangeEndAndRangeStart, + getLineStarts, + getLiteralText, GetLiteralTextFlags, + getNewLineCharacter, + getNodeForGeneratedName, + getNodeId, + getNormalizedAbsolutePath, + getOriginalNode, + getOwnEmitOutputFilePath, + getParseTreeNode, + getRelativePathFromDirectory, + getRelativePathToDirectoryOrUrl, + getRootLength, + getShebang, + getSnippetElement, + getSourceFileOfNode, + getSourceFilePathInNewDir, + getSourceFilesToEmit, + getSourceMapRange, + getSourceTextOfNodeFromSourceFile, + getStartsOnNewLine, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTextOfJSDocComment, + getTrailingCommentRanges, + getTrailingSemicolonDeferringWriter, + getTransformers, + getTypeNode, + guessIndentation, + hasRecordedExternalHelpers, HeritageClause, Identifier, + idText, IfStatement, ImportClause, ImportDeclaration, @@ -100,11 +192,62 @@ import { ImportOrExportSpecifier, ImportSpecifier, ImportTypeNode, - IndexSignatureDeclaration, IndexedAccessTypeNode, + IndexSignatureDeclaration, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, + isAccessExpression, + isArray, + isArrowFunction, + isBinaryExpression, + isBindingPattern, + isBlock, + isBundle, + isBundleFileTextLike, + isDeclaration, + isDeclarationFileName, + isDecorator, + isEmptyStatement, + isExportAssignment, + isExportSpecifier, + isExpression, + isFunctionLike, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isIdentifier, + isIncrementalCompilation, + isInJsonFile, + isInternalDeclaration, + isJSDocLikeText, + isJsonSourceFile, + isJsxClosingElement, + isJsxOpeningElement, + isKeyword, + isLet, + isLiteralExpression, + isMemberName, + isModifier, + isModuleDeclaration, + isNodeDescendantOf, + isNumericLiteral, + isParenthesizedExpression, + isPartiallyEmittedExpression, + isPinnedComment, + isPrivateIdentifier, + isPrologueDirective, + isRecognizedTripleSlashComment, + isSourceFile, + isSourceFileNotJson, + isStringLiteral, + isTemplateLiteralKind, + isTokenKind, + isTypeParameterDeclaration, + isUnparsedNode, + isUnparsedPrepend, + isUnparsedSource, + isVarConst, + isVariableStatement, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, @@ -123,10 +266,10 @@ import { JSDocTag, JSDocTemplateTag, JSDocThisTag, + JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, - JSDocTypedefTag, JSDocVariadicType, JsxAttribute, JsxAttributes, @@ -143,12 +286,18 @@ import { JsxTagNameExpression, JsxText, LabeledStatement, + last, + lastOrUndefined, LateBoundDeclaration, + length, ListFormat, LiteralExpression, LiteralLikeNode, LiteralTypeNode, + makeIdentifierFromModuleName, MappedTypeNode, + maybeBind, + memoize, MetaProperty, MethodDeclaration, MethodSignature, @@ -170,11 +319,18 @@ import { Node, NodeArray, NodeFlags, + nodeIsSynthesized, + noEmitNotification, + noEmitSubstitution, NonNullExpression, + normalizePath, + normalizeSlashes, + notImplemented, NumericLiteral, ObjectBindingPattern, ObjectLiteralExpression, OptionalTypeNode, + outFile, OutputFile, ParameterDeclaration, ParenthesizedExpression, @@ -182,11 +338,13 @@ import { ParsedCommandLine, PartiallyEmittedExpression, Placeholder, + positionIsSynthesized, + positionsAreOnSameLine, PostfixUnaryExpression, PrefixUnaryExpression, - PrintHandlers, Printer, PrinterOptions, + PrintHandlers, PrivateIdentifier, ProgramBuildInfo, ProgramBundleEmitBuildInfo, @@ -196,14 +354,33 @@ import { PropertyDeclaration, PropertySignature, QualifiedName, + rangeEndIsOnSameLineAsRangeStart, + rangeEndPositionsAreOnSameLine, + rangeIsOnSingleLine, + rangeStartPositionsAreOnSameLine, + 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, @@ -212,13 +389,17 @@ import { SourceMapSource, SpreadAssignment, SpreadElement, + stableSort, Statement, + stringContains, StringLiteral, + supportedJSExtensionsFlat, SwitchStatement, Symbol, SymbolFlags, SyntaxKind, SynthesizedComment, + sys, TabStop, TaggedTemplateExpression, TemplateExpression, @@ -227,7 +408,11 @@ import { TemplateSpan, TextRange, ThrowStatement, + tokenToString, + tracing, TransformationResult, + transformNodes, + tryParseRawSourceMap, TryStatement, TupleTypeNode, TypeAliasDeclaration, @@ -253,195 +438,10 @@ import { 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, - getCommentRange, - getConstantValue, - getContainingNodeArray, - getDeclarationEmitExtensionForPath, - getDeclarationEmitOutputFilePath, - getDirectoryPath, - getEmitDeclarations, - getEmitFlags, - getEmitHelpers, - getEmitModuleKind, - getExternalHelpersModuleName, - getExternalModuleName, - getLeadingCommentRanges, - getLineAndCharacterOfPosition, - getLineStarts, - getLinesBetweenPositionAndNextNonWhitespaceCharacter, - getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, - getLinesBetweenRangeEndAndRangeStart, - getLiteralText, - getNewLineCharacter, - getNodeForGeneratedName, - getNodeId, - getNormalizedAbsolutePath, - getOriginalNode, - getOwnEmitOutputFilePath, - getParseTreeNode, - getRelativePathFromDirectory, - getRelativePathToDirectoryOrUrl, - getRootLength, - getShebang, - getSnippetElement, - getSourceFileOfNode, - getSourceFilePathInNewDir, - getSourceFilesToEmit, - getSourceMapRange, - getSourceTextOfNodeFromSourceFile, - getStartsOnNewLine, - getSyntheticLeadingComments, - getSyntheticTrailingComments, - getTextOfJSDocComment, - getTrailingCommentRanges, - getTrailingSemicolonDeferringWriter, - getTransformers, - getTypeNode, - guessIndentation, - hasRecordedExternalHelpers, - idText, - isAccessExpression, - isArray, - isArrowFunction, - isBinaryExpression, - isBindingPattern, - isBlock, - isBundle, - isBundleFileTextLike, - isDeclaration, - isDeclarationFileName, - isDecorator, - isEmptyStatement, - isExportAssignment, - isExportSpecifier, - isExpression, - isFunctionLike, - isGeneratedIdentifier, - isGeneratedPrivateIdentifier, - isIdentifier, - isInJsonFile, - isIncrementalCompilation, - isInternalDeclaration, - isJSDocLikeText, - isJsonSourceFile, - isJsxClosingElement, - isJsxOpeningElement, - isKeyword, - isLet, - isLiteralExpression, - isMemberName, - isModifier, - isModuleDeclaration, - isNodeDescendantOf, - isNumericLiteral, - isParenthesizedExpression, - isPartiallyEmittedExpression, - isPinnedComment, - isPrivateIdentifier, - isPrologueDirective, - isRecognizedTripleSlashComment, - isSourceFile, - isSourceFileNotJson, - isStringLiteral, - isTemplateLiteralKind, - isTokenKind, - isTypeParameterDeclaration, - isUnparsedNode, - isUnparsedPrepend, - isUnparsedSource, - isVarConst, - isVariableStatement, - last, - lastOrUndefined, - length, - makeIdentifierFromModuleName, - maybeBind, - memoize, - noEmitNotification, - noEmitSubstitution, - nodeIsSynthesized, - normalizePath, - normalizeSlashes, - notImplemented, - outFile, - positionIsSynthesized, - positionsAreOnSameLine, - rangeEndIsOnSameLineAsRangeStart, - rangeEndPositionsAreOnSameLine, - rangeIsOnSingleLine, - rangeStartPositionsAreOnSameLine, - readJsonOrUndefined, - removeFileExtension, - resolvePath, - returnFalse, - returnUndefined, - setEachParent, - setOriginalNode, - setParent, - setTextRange, - setTextRangePosEnd, - setTextRangePosWidth, - singleOrUndefined, - skipPartiallyEmittedExpressions, - skipTrivia, - some, - stableSort, - stringContains, - supportedJSExtensionsFlat, - sys, - tokenToString, - tracing, - transformNodes, - tryParseRawSourceMap, 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 600de9bb0dff7..019d3b9e27477 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 63b764018c495..faa93c77be83a 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 2bb7140bc60d9..1fa3027f660b4 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 66c8170f03e9f..e506391a78b78 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 19bef1d352b62..4e872d7babb73 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,9 +112,28 @@ import { GeneratedIdentifierFlags, GeneratedNamePart, GetAccessorDeclaration, + getAllUnscopedEmitHelpers, + getBuildInfo, + getCommentRange, + getElementsOfBindingOrAssignmentPattern, + getEmitFlags, + getJSDocTypeAliasName, + getLineAndCharacterOfPosition, + getNameOfDeclaration, + getNodeId, + getSourceMapRange, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTargetOfBindingOrAssignmentElement, + getTextOfIdentifierOrLiteral, + hasInvalidEscape, HasModifiers, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, HeritageClause, Identifier, + idText, IfStatement, ImportClause, ImportDeclaration, @@ -107,12 +141,84 @@ import { ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexSignatureDeclaration, IndexedAccessTypeNode, + IndexSignatureDeclaration, InferTypeNode, InputFiles, InterfaceDeclaration, IntersectionTypeNode, + isArray, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentPattern, + isBinaryExpression, + isCallChain, + isClassDeclaration, + isClassExpression, + isCommaListExpression, + isCommaToken, + isComputedPropertyName, + isConstructorDeclaration, + isConstructorTypeNode, + isCustomPrologue, + isElementAccessChain, + isElementAccessExpression, + isEnumDeclaration, + isExclamationToken, + isExportAssignment, + isExportDeclaration, + isExternalModuleReference, + isFunctionDeclaration, + isFunctionExpression, + isGeneratedIdentifier, + isGetAccessorDeclaration, + isHoistedFunction, + isHoistedVariableStatement, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isLabeledStatement, + isLocalName, + isLogicalOrCoalescingAssignmentOperator, + isMemberName, + isMethodDeclaration, + isMethodSignature, + isModuleDeclaration, + isNamedDeclaration, + isNodeArray, + isNodeKind, + isNonNullChain, + isNotEmittedStatement, + isObjectLiteralExpression, + isOmittedExpression, + isOuterExpression, + isParameter, + isParenthesizedExpression, + isParseTreeNode, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAccessChain, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertyName, + isPropertySignature, + isQuestionToken, + isSetAccessorDeclaration, + isSourceFile, + isStatement, + isStatementOrBlock, + isString, + isStringLiteral, + isSuperKeyword, + isSuperProperty, + isThisIdentifier, + isTypeAliasDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, + isVariableStatement, JSDoc, JSDocAllType, JSDocAugmentsTag, @@ -128,8 +234,8 @@ import { JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, - JSDocNameReference, JSDocNamepathType, + JSDocNameReference, JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, @@ -150,17 +256,17 @@ import { JSDocText, JSDocThisTag, JSDocType, + JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, - JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, JsxAttribute, JsxAttributeLike, - JsxAttributeValue, JsxAttributes, + JsxAttributeValue, JsxChild, JsxClosingElement, JsxClosingFragment, @@ -179,10 +285,14 @@ import { KeywordTypeSyntaxKind, LabeledStatement, LanguageVariant, + lastOrUndefined, LeftHandSideExpression, LiteralToken, LiteralTypeNode, + map, MappedTypeNode, + memoize, + memoizeOne, MergeDeclarationMarker, MetaProperty, MethodDeclaration, @@ -192,6 +302,7 @@ import { Modifier, ModifierFlags, ModifierLike, + modifiersToFlags, ModifierSyntaxKind, ModifierToken, ModuleBlock, @@ -212,16 +323,20 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, - NoSubstitutionTemplateLiteral, Node, NodeArray, NodeFactory, NodeFlags, + nodeIsSynthesized, NonNullChain, NonNullExpression, + NoSubstitutionTemplateLiteral, NotEmittedStatement, NullLiteral, + nullNodeConverters, + nullParenthesizerRules, NumericLiteral, + objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -232,6 +347,7 @@ import { ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, + parseNodeFactory, PartiallyEmittedExpression, PlusToken, PostfixUnaryExpression, @@ -250,6 +366,7 @@ import { PropertyNameLiteral, PropertySignature, PseudoBigInt, + pseudoBigIntToString, PunctuationSyntaxKind, PunctuationToken, Push, @@ -257,23 +374,39 @@ import { 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, @@ -327,145 +460,12 @@ import { VariableDeclaration, VariableDeclarationList, VariableStatement, + visitNode, VisitResult, VoidExpression, WhileStatement, WithStatement, YieldExpression, - addRange, - append, - appendIfUnique, - canHaveModifiers, - cast, - createBaseNodeFactory, - createNodeConverters, - createParenthesizerRules, - createScanner, - emptyArray, - escapeLeadingUnderscores, - every, - findUseStrictPrologue, - forEach, - formatGeneratedName, - getAllUnscopedEmitHelpers, - getBuildInfo, - getCommentRange, - getElementsOfBindingOrAssignmentPattern, - getEmitFlags, - getJSDocTypeAliasName, - getLineAndCharacterOfPosition, - getNameOfDeclaration, - getNodeId, - getSourceMapRange, - getSyntheticLeadingComments, - getSyntheticTrailingComments, - getTargetOfBindingOrAssignmentElement, - getTextOfIdentifierOrLiteral, - hasInvalidEscape, - hasProperty, - hasStaticModifier, - hasSyntacticModifier, - idText, - isArray, - isArrayLiteralExpression, - isArrowFunction, - isAssignmentPattern, - isBinaryExpression, - isCallChain, - isClassDeclaration, - isClassExpression, - isCommaListExpression, - isCommaToken, - isComputedPropertyName, - isConstructorDeclaration, - isConstructorTypeNode, - isCustomPrologue, - isElementAccessChain, - isElementAccessExpression, - isEnumDeclaration, - isExclamationToken, - isExportAssignment, - isExportDeclaration, - isExternalModuleReference, - isFunctionDeclaration, - isFunctionExpression, - isGeneratedIdentifier, - isGetAccessorDeclaration, - isHoistedFunction, - isHoistedVariableStatement, - isIdentifier, - isImportDeclaration, - isImportEqualsDeclaration, - isImportKeyword, - isIndexSignatureDeclaration, - isInterfaceDeclaration, - isLabeledStatement, - isLocalName, - isLogicalOrCoalescingAssignmentOperator, - isMemberName, - isMethodDeclaration, - isMethodSignature, - isModuleDeclaration, - isNamedDeclaration, - isNodeArray, - isNodeKind, - isNonNullChain, - isNotEmittedStatement, - isObjectLiteralExpression, - isOmittedExpression, - isOuterExpression, - isParameter, - isParenthesizedExpression, - isParseTreeNode, - isPrivateIdentifier, - isPrologueDirective, - isPropertyAccessChain, - isPropertyAccessExpression, - isPropertyDeclaration, - isPropertyName, - isPropertySignature, - isQuestionToken, - isSetAccessorDeclaration, - isSourceFile, - isStatement, - isStatementOrBlock, - isString, - isStringLiteral, - isSuperKeyword, - isSuperProperty, - isThisIdentifier, - isTypeAliasDeclaration, - isTypeParameterDeclaration, - isVariableDeclaration, - isVariableStatement, - lastOrUndefined, - map, - memoize, - memoizeOne, - modifiersToFlags, - nodeIsSynthesized, - nullNodeConverters, - nullParenthesizerRules, - objectAllocator, - parseNodeFactory, - pseudoBigIntToString, - reduceLeft, - returnTrue, - sameFlatMap, - setEachParent, - setEmitFlags, - setParent, - setTextRange, - setTextRangePosEnd, - setTextRangePosWidth, - singleOrUndefined, - skipOuterExpressions, - skipParentheses, - some, - startOnNewLine, - startsWith, - stringToToken, - visitNode, } from "../_namespaces/ts"; let nextAutoGenerateId = 0; diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 800751735be96..14e296610c54f 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 c1c0f96a8d4fd..119ad2953a195 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 c6e2c43bfbe4a..190bd6e7cb8b0 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 66b71eaa6a0b9..8afd72574c0fb 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 57acdf388a970..5177f1d5a57ab 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,61 +1,42 @@ import { - CharacterCodes, - Comparison, - CompilerOptions, - 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, + CharacterCodes, combinePaths, comparePaths, + Comparison, + CompilerOptions, contains, containsPath, createCompilerDiagnostic, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, 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 5f583ed5bfe4f..84031881431b0 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 392467212a7ff..f1f8bd002e875 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 e87e30aa4c3c2..b963c9e0cc929 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 1076eb2705baa..166163784abee 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 e124311b376f8..9e20bddb69480 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 e2f470d144dbc..f1f67c0e87e5f 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 1f72a2c3367e5..f63ecc8773fb7 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,54 +1,35 @@ import * as ts from "./_namespaces/ts"; import { - CacheWithRedirects, + arrayToMap, CachedDirectoryStructureHost, + CacheWithRedirects, 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, 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 eec80e9eede43..bdb2fe6ef239e 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 77f3477327541..b9c5864c0c042 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 0ee96bf209fd5..baf87fdd594c6 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 70fd4b0d75b2f..591e19c8eb647 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 ab28c7e572c93..ba707330ffeee 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 6626294c00bc7..4f091195827a8 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 eda2672939caa..456a23a065577 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 4a150992b040b..239a7e125453d 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 665c2ecded638..a150c9204659e 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,109 +1,60 @@ import { AccessorDeclaration, + addRelatedInfo, AllAccessorDeclarations, AnyImportSyntax, + append, ArrayBindingElement, + arrayFrom, AssertClause, BindingElement, BindingName, BindingPattern, Bundle, CallSignatureDeclaration, + canHaveModifiers, + canProduceDiagnostics, ClassDeclaration, CommentRange, + compact, + concatenate, ConditionalTypeNode, - ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, + ConstructSignatureDeclaration, + contains, + createDiagnosticForNode, + createEmptyExports, + createGetSymbolAccessibilityDiagnosticForNode, + createGetSymbolAccessibilityDiagnosticForNodeName, + createSymbolTable, + createUnparsedSourceFile, Debug, Declaration, DeclarationDiagnosticProducing, DeclarationName, - DiagnosticWithLocation, + declarationNameToString, Diagnostics, + DiagnosticWithLocation, EmitFlags, EmitHost, EmitResolver, + emptyArray, 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, - compact, - concatenate, - contains, - createDiagnosticForNode, - createEmptyExports, - createGetSymbolAccessibilityDiagnosticForNode, - createGetSymbolAccessibilityDiagnosticForNodeName, - createSymbolTable, - createUnparsedSourceFile, - declarationNameToString, - emptyArray, 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 ca62ec25c82c6..021a372123072 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,35 +11,15 @@ import { ExpressionWithTypeArguments, FunctionDeclaration, GetAccessorDeclaration, - ImportEqualsDeclaration, - IndexSignatureDeclaration, - JSDocCallbackTag, - JSDocEnumTag, - JSDocTypedefTag, - MethodDeclaration, - MethodSignature, - ModifierFlags, - NamedDeclaration, - Node, - ParameterDeclaration, - PropertyAccessExpression, - PropertyDeclaration, - PropertySignature, - QualifiedName, - SetAccessorDeclaration, - SymbolAccessibility, - SymbolAccessibilityResult, - SyntaxKind, - TypeAliasDeclaration, - TypeParameterDeclaration, - VariableDeclaration, getNameOfDeclaration, hasSyntacticModifier, + ImportEqualsDeclaration, + IndexSignatureDeclaration, isBindingElement, isCallSignatureDeclaration, isClassDeclaration, - isConstructSignatureDeclaration, isConstructorDeclaration, + isConstructSignatureDeclaration, isExpressionWithTypeArguments, isFunctionDeclaration, isGetAccessor, @@ -59,6 +39,26 @@ import { isTypeAliasDeclaration, isTypeParameterDeclaration, isVariableDeclaration, + JSDocCallbackTag, + JSDocEnumTag, + JSDocTypedefTag, + MethodDeclaration, + MethodSignature, + ModifierFlags, + NamedDeclaration, + Node, + ParameterDeclaration, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + QualifiedName, + SetAccessorDeclaration, + SymbolAccessibility, + SymbolAccessibilityResult, + SyntaxKind, + TypeAliasDeclaration, + TypeParameterDeclaration, + VariableDeclaration, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index 0f3044b63462b..2effd35cfc65f 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 f36deb1aa5809..ab5ea56408a4c 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 ce6353ff8b0f0..33df5b94f0d0b 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 e38bcab33932d..4c7a90fa6944e 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 f3144fc4ee9eb..296cfaeae2fca 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 921c13c4be80f..0bd2be45422a4 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 dae72e5bef773..b030dca03ce5c 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 903adf52ea469..c521cf00bc7f0 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 d4f046418529f..199cfa582327e 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -1,28 +1,28 @@ import { Bundle, + chainBundle, EmitHint, Expression, + getOriginalNodeId, Identifier, + idText, + isIdentifier, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, JsxClosingElement, JsxEmit, JsxOpeningElement, JsxSelfClosingElement, Node, + nodeIsSynthesized, PropertyAccessExpression, PropertyAssignment, + setTextRange, SourceFile, + stringToToken, SyntaxKind, TransformationContext, - chainBundle, - getOriginalNodeId, - idText, - isIdentifier, - isPrivateIdentifier, - isPropertyAccessExpression, - isPropertyAssignment, - nodeIsSynthesized, - setTextRange, - stringToToken, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index bf56eec9b073b..730958dae1e00 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 c8265d760f6ea..86abe24d056d0 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 34797c4d5ce23..2dab57966eef6 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 40515d2f50555..976e0705e730b 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 312c70d3bba79..c6d065a77b88f 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 706b1f857f84c..adedbd1281714 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 a0f6a89ad8caa..576c15fe6597e 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 c1af3e9cc98ee..c773832382369 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 dd0f9ef96db50..041e0adf84acb 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 3d4400dc38445..1b27a345ce67b 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 37e757a7d4332..ca773490be011 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 8705633a4cb18..90ef9bffb7f9d 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 c192abeb6cc0b..dedf7e4729945 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 394bbceb8f07f..6eb8ed8862c3c 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 f026b086585a3..8de47c348430e 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 9ff1b4f72aaaf..e6c0c5a05602a 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,11 +68,23 @@ import { GeneratedIdentifierFlags, GeneratedPrivateIdentifier, GetAccessorDeclaration, + getAssignmentDeclarationKind, + getDirectoryPath, + getEffectiveModifierFlags, + getEffectiveModifierFlagsAlwaysIncludeJSDoc, + getElementOrPropertyAccessArgumentExpressionOrName, + getEmitScriptTarget, + getJSDocCommentsAndTags, + getJSDocTypeParameterDeclarations, + hasAccessorModifier, + hasDecorators, HasDecorators, HasExpressionInitializer, HasInitializer, HasJSDoc, HasModifiers, + hasProperty, + hasSyntacticModifier, HasType, Identifier, ImportClause, @@ -68,6 +92,69 @@ import { ImportOrExportSpecifier, ImportSpecifier, ImportTypeNode, + isAccessExpression, + isAmbientModule, + isAnyImportOrReExport, + isArrowFunction, + isBinaryExpression, + isBindableStaticElementAccessExpression, + isBindingElement, + isBlock, + isCallExpression, + isCallSignatureDeclaration, + isClassExpression, + isClassStaticBlockDeclaration, + isDecorator, + isElementAccessExpression, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isFunctionBlock, + isFunctionExpression, + isFunctionTypeNode, + isIdentifier, + isImportSpecifier, + isInJSFile, + isJSDoc, + isJSDocAugmentsTag, + isJSDocClassTag, + isJSDocDeprecatedTag, + isJSDocEnumTag, + isJSDocFunctionType, + isJSDocImplementsTag, + isJSDocOverrideTag, + isJSDocParameterTag, + isJSDocPrivateTag, + isJSDocProtectedTag, + isJSDocPublicTag, + isJSDocReadonlyTag, + isJSDocReturnTag, + isJSDocSignature, + isJSDocTemplateTag, + isJSDocThisTag, + isJSDocTypeAlias, + isJSDocTypeLiteral, + isJSDocTypeTag, + isModuleBlock, + isNonNullExpression, + isNotEmittedStatement, + isOmittedExpression, + isParameter, + isPartiallyEmittedExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isRootedDiskPath, + isSourceFile, + isStringLiteral, + isTypeLiteralNode, + isTypeNodeKind, + isTypeReferenceNode, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + isWhiteSpaceLike, IterationStatement, JSDocAugmentsTag, JSDocClassTag, @@ -92,14 +179,15 @@ import { JSDocTag, JSDocTemplateTag, JSDocThisTag, - JSDocTypeTag, JSDocTypedefTag, + JSDocTypeTag, JsxAttributeLike, JsxChild, JsxExpression, JsxOpeningLikeElement, JsxTagNameExpression, LabeledStatement, + lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralToken, @@ -108,6 +196,7 @@ import { Modifier, ModifierFlags, ModifierLike, + modifierToFlag, ModuleBody, ModuleDeclaration, ModuleReference, @@ -121,6 +210,7 @@ import { NodeArray, NodeFlags, NonNullChain, + normalizePath, NotEmittedStatement, ObjectBindingOrAssignmentElement, ObjectBindingOrAssignmentPattern, @@ -131,6 +221,7 @@ import { OuterExpressionKinds, ParameterDeclaration, PartiallyEmittedExpression, + pathIsRelative, PostfixUnaryExpression, PrefixUnaryExpression, PrivateClassElementDeclaration, @@ -144,7 +235,12 @@ import { QualifiedName, ScriptTarget, SetAccessorDeclaration, + setLocalizedDiagnosticMessages, + setUILocale, SignatureDeclaration, + skipOuterExpressions, + some, + sortAndDeduplicate, SortedReadonlyArray, Statement, StringLiteral, @@ -167,102 +263,6 @@ import { UnparsedNode, UnparsedTextLike, VariableDeclaration, - __String, - canHaveIllegalTypeParameters, - combinePaths, - compareDiagnostics, - contains, - createCompilerDiagnostic, - emptyArray, - entityNameToString, - every, - filter, - find, - flatMap, - getAssignmentDeclarationKind, - getDirectoryPath, - getEffectiveModifierFlags, - getEffectiveModifierFlagsAlwaysIncludeJSDoc, - getElementOrPropertyAccessArgumentExpressionOrName, - getEmitScriptTarget, - getJSDocCommentsAndTags, - getJSDocTypeParameterDeclarations, - hasAccessorModifier, - hasDecorators, - hasProperty, - hasSyntacticModifier, - isAccessExpression, - isAmbientModule, - isAnyImportOrReExport, - isArrowFunction, - isBinaryExpression, - isBindableStaticElementAccessExpression, - isBindingElement, - isBlock, - isCallExpression, - isCallSignatureDeclaration, - isClassExpression, - isClassStaticBlockDeclaration, - isDecorator, - isElementAccessExpression, - isExportAssignment, - isExportDeclaration, - isExportSpecifier, - isFunctionBlock, - isFunctionExpression, - isFunctionTypeNode, - isIdentifier, - isImportSpecifier, - isInJSFile, - isJSDoc, - isJSDocAugmentsTag, - isJSDocClassTag, - isJSDocDeprecatedTag, - isJSDocEnumTag, - isJSDocFunctionType, - isJSDocImplementsTag, - isJSDocOverrideTag, - isJSDocParameterTag, - isJSDocPrivateTag, - isJSDocProtectedTag, - isJSDocPublicTag, - isJSDocReadonlyTag, - isJSDocReturnTag, - isJSDocSignature, - isJSDocTemplateTag, - isJSDocThisTag, - isJSDocTypeAlias, - isJSDocTypeLiteral, - isJSDocTypeTag, - isModuleBlock, - isNonNullExpression, - isNotEmittedStatement, - isOmittedExpression, - isParameter, - isPartiallyEmittedExpression, - isPrivateIdentifier, - isPropertyAccessExpression, - isPropertyAssignment, - isPropertyDeclaration, - isRootedDiskPath, - isSourceFile, - isStringLiteral, - isTypeLiteralNode, - isTypeNodeKind, - isTypeReferenceNode, - isVariableDeclaration, - isVariableDeclarationList, - isVariableStatement, - isWhiteSpaceLike, - lastOrUndefined, - modifierToFlag, - normalizePath, - pathIsRelative, - setLocalizedDiagnosticMessages, - setUILocale, - skipOuterExpressions, - some, - sortAndDeduplicate, } from "./_namespaces/ts"; export function isExternalModuleNameRelative(moduleName: string): boolean { diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 0ed6462e14508..af0fd6e4db0ae 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 78af4166e9478..16bd5f3e8dd4c 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 7a673bdb89efc..6810e32608551 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -1,49 +1,7 @@ import * as ts from "./_namespaces/ts"; import { - BuildInfo, BuilderProgram, - CompilerHost, - CompilerOptions, - ConfigFileDiagnosticsReporter, - ConfigFileProgramReloadLevel, - CreateSourceFileOptions, - Debug, - Diagnostic, - DiagnosticMessage, - DiagnosticReporter, - Diagnostics, - DirectoryStructureHost, - DirectoryWatcherCallback, - EmitAndSemanticDiagnosticsBuilderProgram, - ExtendedConfigCacheEntry, - FileExtensionInfo, - FileReference, - 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, + BuildInfo, canJsonReportNoInputFiles, changeCompilerHostLikeToUseCache, changesAffectModuleResolution, @@ -52,6 +10,10 @@ import { clearSharedExtendedConfigFileWatcher, closeFileWatcher, closeFileWatcherOf, + CompilerHost, + CompilerOptions, + ConfigFileDiagnosticsReporter, + ConfigFileProgramReloadLevel, createBuilderProgramUsingProgramBuildInfo, createCachedDirectoryStructureHost, createCompilerDiagnostic, @@ -60,9 +22,24 @@ import { createEmitAndSemanticDiagnosticsBuilderProgram, createGetCanonicalFileName, createResolutionCache, + CreateSourceFileOptions, createWatchCompilerHostOfConfigFile, createWatchCompilerHostOfFilesAndCompilerOptions, createWatchFactory, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + DirectoryStructureHost, + DirectoryWatcherCallback, + EmitAndSemanticDiagnosticsBuilderProgram, + ExtendedConfigCacheEntry, + FileExtensionInfo, + FileReference, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, 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 ac62a2d612d06..62d6ffee46091 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 aa235dc1cc988..caca5fc914394 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 6cca290144766..5de292fb9bce3 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 014aab74d75b3..78a0f155f53d1 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 9464b3d24e9e0..738eb2327d1b4 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 6f501f791d492..97f35beba4150 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 a86a327bef8b0..d23969ccda6be 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 860fde1b65474..c56abe2df1ef2 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 641a78b8e611c..8682631b07830 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 8d9b465d80b3b..58bd58cb02150 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 852372aea4930..cfc1c6f1557fa 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 69777db105bf8..e3e67e1909dc6 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 4004c82e98f1a..6b27c3296bcbb 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 c54a68b354da1..2f2142a5bb0fe 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 2f2f0be330559..d1c12c65d9bfb 100644 --- a/src/server/packageJsonCache.ts +++ b/src/server/packageJsonCache.ts @@ -1,12 +1,12 @@ import { - Debug, - Path, - ProjectPackageJsonInfo, - Ternary, combinePaths, createPackageJsonInfo, + Debug, forEachAncestorDirectory, getDirectoryPath, + Path, + ProjectPackageJsonInfo, + Ternary, tryFileExists, } from "./_namespaces/ts"; import { ProjectService } from "./_namespaces/ts.server"; diff --git a/src/server/project.ts b/src/server/project.ts index 8c8748fe5bdc3..dcce4777002b2 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 f21e316baacc2..9c1371f2d9f57 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 d73d8508643af..a4acf98f5516b 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 d3893f37495c0..ceb15519eb435 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 65c707bb929ef..42c91be6047d1 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 2ba220593a309..9c8a45c17159c 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 e2621359f41b2..e071e87dfbac2 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 cd08b00b51aaf..f06f85142b862 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 4784490883c2b..fc4280802ee6d 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 cd62000d549b8..40a37c99a6297 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -1,19 +1,41 @@ import { + __String, + arrayToNumericMap, CancellationToken, CharacterCodes, ClassDeclaration, ClassificationInfo, ClassificationResult, + Classifications, ClassificationType, ClassificationTypeNames, - Classifications, ClassifiedSpan, Classifier, + commentPragmas, + couldStartTrivia, + createScanner, + createTextSpan, Debug, + decodedTextSpanIntersectsWith, EndOfLineState, EnumDeclaration, + getMeaningFromLocation, + getModuleInstanceState, + getTypeArgumentOrTypeParameterList, HasJSDoc, InterfaceDeclaration, + isAccessibilityModifier, + isConstTypeReference, + isIdentifier, + isJSDoc, + isKeyword, + isLineBreak, + isModuleDeclaration, + isPunctuation, + isTemplateLiteralKind, + isThisIdentifier, + isToken, + isTrivia, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, @@ -25,56 +47,34 @@ import { JSDocSeeTag, JSDocTemplateTag, JSDocThisTag, - JSDocTypeTag, 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, - __String, - arrayToNumericMap, - commentPragmas, - couldStartTrivia, - createScanner, - createTextSpan, - decodedTextSpanIntersectsWith, - getMeaningFromLocation, - getModuleInstanceState, - getTypeArgumentOrTypeParameterList, - isAccessibilityModifier, - isConstTypeReference, - isIdentifier, - isJSDoc, - isKeyword, - isLineBreak, - isModuleDeclaration, - isPunctuation, - isTemplateLiteralKind, - isThisIdentifier, - isToken, - isTrivia, - lastOrUndefined, - nodeIsMissing, - parseIsolatedJSDocComment, - setParent, - some, - textSpanIntersectsWith, } 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 a2b505591249f..96e246a85db80 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 7c37ddee959d8..0d6ab81face1a 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, + computeSuggestionDiagnostics, + contains, + createMultiMap, Debug, Diagnostic, DiagnosticAndArguments, + diagnosticToString, DiagnosticWithLocation, FileTextChanges, - Push, - TextChange, - arrayFrom, - cast, - computeSuggestionDiagnostics, - contains, - createMultiMap, - diagnosticToString, flatMap, isString, map, + Push, + TextChange, textChanges, } from "./_namespaces/ts"; diff --git a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts index 2702dd72cab0a..0360e9d117a52 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 909e2b68c0d57..bb0510a90d0ad 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 a71854c682daa..d93138a1dbea8 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 bc443c21eb34c..8a848c2616f80 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 1b73fc93980bd..c46c353b37f3e 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 81f696963e11f..330757c9fa76f 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 afb0cbca3f5a1..dc36931d79237 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 13445ee79cf99..7664bea35be10 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 847dfd53fbec1..292c609bc720c 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 df499530c1a91..d9817ab8250b2 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 631d747404715..b2af8a230febc 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 487277eba10fa..1e68d28758d1c 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 9417618ceaf08..999dab6f413e5 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 6b75fafa79be3..959b9ea4538ad 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, + concatenate, + copyEntries, + createMultiMap, + createRange, Debug, Diagnostics, + emptyMap, 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, - emptyMap, 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 ed80aef7764da..1a3b8498a49f5 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 c8fbc5fce3e39..f6dfc027596d2 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 d58e559a3292d..b4f5bda36cafa 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 b2f1d20aed13b..466a8a9bcd719 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 e9187463faacb..96202931ae090 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 e2e2048cb2d99..c5b2bd3573789 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 98f640935287b..490d65171be2f 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, + concatenate, + createPropertyNameNodeForIdentifierOrLiteral, Debug, Diagnostics, + emptyArray, 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, - emptyArray, 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 d21da714a0e39..32b17b39233d8 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 cfcb1abcae757..1fa7b06bedef0 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 e2e6c36305797..4abb3cdedda2d 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 f8283609be9d4..f12ba12e3f0fc 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 d49b9feeb9316..d128045f7f075 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 f5a009c00e55d..ac9d7af09944d 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 cba4f1eba2854..f91c49c9bece9 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 0cb3b1087158d..02276f8d7a482 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 9b46c41d685de..feee99da0d0cf 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 281afd5ebeb1f..271c9b969118c 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 2dab4970f1f68..4870e021120f7 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 7fcb9311e7de9..ed571ab443352 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 f7eeff43a6a25..7beffebd59986 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 a90d84936425f..ae8d0cd294f0b 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 6d392fbed1628..cd288e531df8c 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 24749a9f1e28c..ba1ec81fc945f 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 38081bd81ecc9..f7e8345b217f0 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 544b37d9f853c..698a7397878b1 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 d5b5a0ffd4f9b..3c53a5da26b5e 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 a5cb3e2b79533..0a5442600d8c4 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 06cceb0968d57..4fcc89c87fcc0 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 323c6e3d0679a..3769fa3619ef1 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 3a84eedb2a59e..cf86a7ef2d53d 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 adaeaf39c7694..7a35126032924 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 46ab91a11866f..f76a8420e0699 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 e57879b5899cd..2f1ef5a198044 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 5116f291cfdbb..954a90ba6f34a 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 464800e46e95f..a7071d6e143f4 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 5be6d9b423404..8e3574aa60cde 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 e84a766a25e20..fa78042e08217 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 9cd1c5abbc299..bdb4bbbb28df0 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 6287923a313b5..17afabda71a93 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 960a4d8cb9022..ec5b5e6e3ca90 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 e16d098c709a2..e9b0f2fc7ed12 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 ed32e3d7d2faf..88e6aed5d41a6 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 1c68baaade8fd..96bee0d7f458b 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 9fcec04c92033..1bc5bbb658c27 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 233a148f889b6..2f0c90737549a 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 d9604716d1b6f..7be223f9a8332 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 0c6b2a243a98c..521c8e9dc08b2 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 45cabbb7134d2..0667683d1ffd0 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 b56d81e7ad2d7..b6930f0b7efba 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 5bca880f21e30..6af08a70ebff6 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 093e3ce400e5a..4492e176b5c57 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 4219714e0d7e4..75f72964530b6 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 bc488d5e0802c..78122a0840c62 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 4a0e1097cb1cd..11afb4c8c0ab9 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 dce36fc57044c..c3bb005234dca 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 f06edbcf41433..27faadad16b08 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 56fd00c2ae786..ffd9501b5db25 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 a0d9c1088c562..6e9a5570306be 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 2223105546fa7..ae84a63ecfbcc 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 4c90a6f312c4f..511246c7d899f 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 7ddb731cf3a26..5d29e814ce807 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 6242025b63b23..b474c67969f6c 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 74d6240b6aa7f..fc7a3a0b28a74 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 70257f02417ca..8970be77c18a5 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 948bf0fb0e3fe..b48051e8a651d 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -6,14 +6,32 @@ import { ClassDeclaration, ClassExpression, CommentRange, + contains, Debug, EditorSettings, + find, + findChildOfKind, + findListItemInfo, + findNextToken, + findPrecedingToken, FormatCodeSettings, GetAccessorDeclaration, + getLineAndCharacterOfPosition, + getLineStartPositionForPosition, + getStartPositionOfLine, + getTokenAtPosition, IfStatement, ImportClause, IndentStyle, InterfaceDeclaration, + isCallExpression, + isCallOrNewExpression, + isConditionalExpression, + isDeclaration, + isStatementButNotDeclaration, + isStringOrRegularExpressionOrTemplateLiteral, + isWhiteSpaceLike, + isWhiteSpaceSingleLine, JSDocTemplateTag, LineAndCharacter, NamedImportsOrExports, @@ -21,7 +39,11 @@ import { NodeArray, ObjectBindingPattern, ObjectLiteralExpression, + positionBelongsToNode, + rangeContainsRange, + rangeContainsStartEnd, SignatureDeclaration, + skipTrivia, SourceFile, SourceFileLike, SyntaxKind, @@ -30,32 +52,10 @@ import { TypeLiteralNode, TypeReferenceNode, VariableDeclarationList, - contains, - find, - findChildOfKind, - findListItemInfo, - findNextToken, - findPrecedingToken, - getLineAndCharacterOfPosition, - getLineStartPositionForPosition, - getStartPositionOfLine, - getTokenAtPosition, - isCallExpression, - isCallOrNewExpression, - isConditionalExpression, - isDeclaration, - isStatementButNotDeclaration, - isStringOrRegularExpressionOrTemplateLiteral, - isWhiteSpaceLike, - isWhiteSpaceSingleLine, - positionBelongsToNode, - rangeContainsRange, - rangeContainsStartEnd, - skipTrivia, } 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 e8371e232b7d7..e8c7f4c2bd140 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 39fb28caa0ff4..47be1d6781c4f 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 5c0a1d6e6f588..0cca4a93f915b 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 3af19b6c9e731..45bb04e6e1329 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 fa2335f019790..45e9d80f673a1 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 d9bb97eb9d9eb..aa57b808e9f99 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -1,32 +1,32 @@ import { CancellationToken, + compareStringsCaseSensitiveUI, + compareValues, + createPatternMatcher, + createTextSpanFromNode, Declaration, + emptyArray, Expression, + getContainerNode, + getNameOfDeclaration, + getNodeKind, + getNodeModifiers, + getTextOfIdentifierOrLiteral, Identifier, ImportClause, ImportEqualsDeclaration, ImportSpecifier, + isPropertyAccessExpression, + isPropertyNameLiteral, NavigateToItem, Node, - PatternMatchKind, PatternMatcher, + PatternMatchKind, Push, ScriptElementKind, SourceFile, SyntaxKind, TypeChecker, - compareStringsCaseSensitiveUI, - compareValues, - createPatternMatcher, - createTextSpanFromNode, - emptyArray, - getContainerNode, - getNameOfDeclaration, - getNodeKind, - getNodeModifiers, - getTextOfIdentifierOrLiteral, - isPropertyAccessExpression, - isPropertyNameLiteral, } from "./_namespaces/ts"; interface RawNavigateToItem { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index ef79aa8f4ff3d..132ff59e9909b 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -11,51 +11,30 @@ import { ClassElement, ClassExpression, ClassLikeDeclaration, + compareStringsCaseSensitiveUI, + compareValues, + concatenate, ConstructorDeclaration, + contains, + createTextSpanFromNode, + createTextSpanFromRange, Debug, Declaration, DeclarationName, + declarationNameToString, EntityNameExpression, EnumDeclaration, EnumMember, + escapeString, 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, - contains, - createTextSpanFromNode, - createTextSpanFromRange, - declarationNameToString, - escapeString, 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 22a40608dca4c..77874bf6e6d35 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 b7933b52970ec..47ac841287c54 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 4e4004a774d9c..b021f959c6a34 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 af3194a019961..084a99595cc5b 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 fc9ad1abc6ea0..611c846c21c99 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 c7f9f753025c4..25aabb5d07b84 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 f3938e271716e..f631f1387e221 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 4ee420179c265..689460c9ee2dd 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -4,17 +4,34 @@ import { ClassDeclaration, Debug, Diagnostics, + emptyArray, EnumDeclaration, ExportAssignment, ExportSpecifier, + factory, FindAllReferences, + findModifier, + first, FunctionDeclaration, + getLocaleSpecificMessage, + getParentNodeInSpan, + getRefactorContextSpan, + getSyntacticModifierFlags, + getTokenAtPosition, Identifier, ImportClause, ImportSpecifier, ImportTypeNode, InterfaceDeclaration, InternalSymbolName, + isAmbientModule, + isExportAssignment, + isExternalModuleAugmentation, + isIdentifier, + isModuleBlock, + isSourceFile, + isStringLiteral, + makeImport, ModifierFlags, NamespaceDeclaration, Node, @@ -22,37 +39,20 @@ import { Program, PropertyAccessExpression, QuotePreference, + quotePreferenceFromString, RefactorContext, RefactorEditInfo, SourceFile, Symbol, SyntaxKind, + textChanges, TypeAliasDeclaration, TypeChecker, VariableStatement, - emptyArray, - factory, - findModifier, - first, - getLocaleSpecificMessage, - getParentNodeInSpan, - getRefactorContextSpan, - getSyntacticModifierFlags, - getTokenAtPosition, - isAmbientModule, - isExportAssignment, - isExternalModuleAugmentation, - isIdentifier, - isModuleBlock, - isSourceFile, - isStringLiteral, - makeImport, - quotePreferenceFromString, - textChanges, } 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 69923c53466cc..a7d0d0d53123b 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -1,14 +1,33 @@ import { ApplicableRefactorInfo, + arrayFrom, + codefix, Debug, Diagnostics, + emptyArray, Expression, + factory, FindAllReferences, + findAncestor, + findNextToken, + getAllowSyntheticDefaultImports, + getLocaleSpecificMessage, + getOwnValues, + getParentNodeInSpan, + getRefactorContextSpan, + getTokenAtPosition, + getUniqueName, Identifier, ImportClause, ImportDeclaration, ImportKind, ImportSpecifier, + isExportSpecifier, + isImportDeclaration, + isPropertyAccessExpression, + isPropertyAccessOrQualifiedName, + isShorthandPropertyAssignment, + isStringLiteral, NamedImports, NamespaceImport, Program, @@ -17,36 +36,17 @@ import { RefactorContext, RefactorEditInfo, ScriptTarget, + some, SourceFile, Symbol, SymbolFlags, SyntaxKind, - TypeChecker, - arrayFrom, - codefix, - emptyArray, - factory, - findAncestor, - findNextToken, - getAllowSyntheticDefaultImports, - getLocaleSpecificMessage, - getOwnValues, - getParentNodeInSpan, - getRefactorContextSpan, - getTokenAtPosition, - getUniqueName, - isExportSpecifier, - isImportDeclaration, - isPropertyAccessExpression, - isPropertyAccessOrQualifiedName, - isShorthandPropertyAssignment, - isStringLiteral, - some, 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 f58b06d5e533a..c0ad2970a6138 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 c7cf380b53e6f..a86e190d2d8cd 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 73eb5a1a1d871..712308df7bed2 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 4cc566753adb9..a86777e97dd63 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 605cd5449fe3d..276804acf15a2 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 8df87debd1542..5172c5020d8e0 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 58c8796cc08fd..2982cacd8af7c 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 7a31be79c606f..ccce34a8a14ac 100644 --- a/src/services/refactors/inferFunctionReturnType.ts +++ b/src/services/refactors/inferFunctionReturnType.ts @@ -2,34 +2,34 @@ import { ApplicableRefactorInfo, ArrowFunction, Diagnostics, - FunctionDeclaration, - FunctionExpression, - MethodDeclaration, - Node, - NodeBuilderFlags, - RefactorContext, - RefactorEditInfo, - SourceFile, - SyntaxKind, - Type, - TypeChecker, - TypeNode, emptyArray, factory, findAncestor, findChildOfKind, first, + FunctionDeclaration, + FunctionExpression, getLocaleSpecificMessage, getTokenAtPosition, isArrowFunction, isBlock, isInJSFile, mapDefined, + MethodDeclaration, + Node, + NodeBuilderFlags, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, textChanges, + Type, + TypeChecker, + TypeNode, } 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 20e8dceafb311..937c31edadd7f 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 e23873907e500..52ee0b8a3f544 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 48d2b98804cbd..41b3c78172ad1 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,23 +62,73 @@ import { EditorSettings, ElementAccessExpression, EmitTextWriter, + emptyArray, + emptyOptions, EndOfFileToken, EntityName, + equateValues, ExportDeclaration, FileReference, FileTextChanges, + filter, + find, FindAllReferences, + findChildOfKind, + findPrecedingToken, + first, + firstDefined, + firstOrOnly, + flatMap, + forEach, + forEachChild, FormatCodeOptions, FormatCodeSettings, + formatting, FunctionLikeDeclaration, GeneratedIdentifierFlags, + getAdjustedRenameLocation, + getAllSuperTypeNodes, + getAssignmentDeclarationKind, GetCompletionsAtPositionOptions, + getContainerNode, + getDefaultLibFileName, + getDirectoryPath, + getEmitDeclarations, + getEntries, + getEscapedTextOfIdentifierOrLiteral, + getFileEmitOutput, + getImpliedNodeFormatForFile, + getJSDocTags, + getLineAndCharacterOfPosition, + getLineStarts, + getMappedDocumentSpan, + getNameFromPropertyName, + getNewLineCharacter, + getNewLineOrDefaultFromHost, + getNonAssignedNameOfDeclaration, + getNormalizedAbsolutePath, + getObjectFlags, + getScriptKind, + getSetExternalModuleIndicator, + getSnapshotText, + getSourceFileOfNode, + getSourceMapper, + getTokenPosOfNode, + getTouchingPropertyName, + getTouchingToken, GoToDefinition, HasInvalidatedResolutions, + hasJSDocNodes, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, HighlightSpanKind, HostCancellationToken, - IScriptSnapshot, + hostGetCanonicalFileName, + hostUsesCaseSensitiveFileNames, Identifier, + identity, + idText, ImplementationLocation, ImportDeclaration, IndexKind, @@ -68,12 +136,56 @@ import { InlayHint, InlayHints, InlayHintsContext, + insertSorted, InterfaceType, IntersectionType, + isArray, + isBindingPattern, + isComputedPropertyName, + isConstTypeReference, + IScriptSnapshot, + isDeclarationName, + isGetAccessor, + isIdentifier, + isImportMeta, + isInComment, + isInsideJsxElement, + isInsideJsxElementOrAttribute, + isInString, + isInTemplateString, + isIntrinsicJsxName, + isJSDocCommentContainingNode, + isJsxAttributes, + isJsxClosingElement, + isJsxElement, + isJsxFragment, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxText, + isLabelName, + isLiteralComputedPropertyDeclarationName, + isNamedExports, + isNamedTupleMember, + isNameOfModuleDeclaration, + isNewExpression, + isNodeKind, + isObjectLiteralElement, + isObjectLiteralExpression, + isPrivateIdentifier, + isProgramUptoDate, + isPropertyAccessExpression, + isPropertyName, + isRightSideOfPropertyAccess, + isRightSideOfQualifiedName, + isSetAccessor, + isStringOrNumericLiteralLike, + isTagName, + isTextWhiteSpaceLike, + isThisTypeParameter, + JsDoc, JSDoc, JSDocContainer, JSDocTagInfo, - JsDoc, JsonSourceFile, JsxAttributes, JsxClosingTagInfo, @@ -84,9 +196,17 @@ import { LanguageServiceHost, LanguageServiceMode, LanguageVariant, + lastOrUndefined, + length, LineAndCharacter, + lineBreakPart, LiteralType, + map, + mapDefined, MapLike, + mapOneOrMany, + maybeBind, + maybeSetLocalizedDiagnosticMessages, ModeAwareCache, ModifierFlags, ModuleDeclaration, @@ -96,6 +216,8 @@ import { Node, NodeArray, NodeFlags, + noop, + normalizePath, NumberLiteralType, NumericLiteral, ObjectAllocator, @@ -110,7 +232,9 @@ import { OutliningSpan, ParseConfigFileHost, ParsedCommandLine, + parseJsonSourceFileConfigFileContent, Path, + positionIsSynthesized, PossibleProgramFileInfo, PragmaMap, PrivateIdentifier, @@ -118,11 +242,12 @@ import { PropertyName, Push, QuickInfo, + refactor, RefactorContext, RefactorEditInfo, RefactorTriggerReason, - ReferenceEntry, ReferencedSymbol, + ReferenceEntry, Rename, RenameInfo, RenameInfoOptions, @@ -130,12 +255,15 @@ import { ResolvedModuleFull, ResolvedProjectReference, ResolvedTypeReferenceDirective, + returnFalse, + scanner, ScriptElementKind, ScriptElementKindModifier, ScriptKind, ScriptTarget, SelectionRange, SemanticClassificationFormat, + setObjectAllocator, Signature, SignatureDeclaration, SignatureFlags, @@ -143,12 +271,14 @@ import { SignatureHelpItems, SignatureHelpItemsOptions, SignatureKind, + singleElementArray, SmartSelectionRange, SortedArray, SourceFile, SourceFileLike, SourceMapSource, Statement, + stringContains, StringLiteral, StringLiteralLike, StringLiteralType, @@ -156,16 +286,22 @@ import { SymbolDisplay, SymbolDisplayPart, SymbolFlags, + symbolName, SyntaxKind, SyntaxList, + tagNamesAreEquivalent, TextChange, TextChangeRange, TextInsertion, TextRange, TextSpan, + textSpanEnd, + timestamp, TodoComment, TodoCommentDescriptor, Token, + toPath, + tracing, TransformFlags, TransientSymbol, Type, @@ -175,149 +311,13 @@ import { TypeParameter, TypePredicate, TypeReference, + typeToDisplayParts, UnderscoreEscapedMap, UnionOrIntersectionType, UnionType, + updateSourceFile, 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, - findChildOfKind, - findPrecedingToken, - first, - firstDefined, - firstOrOnly, - flatMap, - forEach, - forEachChild, - formatting, - getAdjustedRenameLocation, - getAllSuperTypeNodes, - getAssignmentDeclarationKind, - getContainerNode, - getDefaultLibFileName, - getDirectoryPath, - getEmitDeclarations, - getEntries, - getEscapedTextOfIdentifierOrLiteral, - getFileEmitOutput, - getImpliedNodeFormatForFile, - getJSDocTags, - getLineAndCharacterOfPosition, - getLineStarts, - getMappedDocumentSpan, - getNameFromPropertyName, - getNewLineCharacter, - getNewLineOrDefaultFromHost, - getNonAssignedNameOfDeclaration, - getNormalizedAbsolutePath, - getObjectFlags, - getScriptKind, - getSetExternalModuleIndicator, - getSnapshotText, - getSourceFileOfNode, - getSourceMapper, - getTokenPosOfNode, - getTouchingPropertyName, - getTouchingToken, - hasJSDocNodes, - hasProperty, - hasStaticModifier, - hasSyntacticModifier, - hostGetCanonicalFileName, - hostUsesCaseSensitiveFileNames, - idText, - identity, - insertSorted, - isArray, - isBindingPattern, - isComputedPropertyName, - isConstTypeReference, - isDeclarationName, - isGetAccessor, - isIdentifier, - isImportMeta, - isInComment, - isInString, - isInTemplateString, - isInsideJsxElement, - isInsideJsxElementOrAttribute, - isIntrinsicJsxName, - isJSDocCommentContainingNode, - isJsxAttributes, - isJsxClosingElement, - isJsxElement, - isJsxFragment, - isJsxOpeningElement, - isJsxOpeningFragment, - isJsxText, - isLabelName, - isLiteralComputedPropertyDeclarationName, - isNameOfModuleDeclaration, - isNamedExports, - isNamedTupleMember, - isNewExpression, - isNodeKind, - isObjectLiteralElement, - isObjectLiteralExpression, - isPrivateIdentifier, - isProgramUptoDate, - isPropertyAccessExpression, - isPropertyName, - isRightSideOfPropertyAccess, - isRightSideOfQualifiedName, - isSetAccessor, - isStringOrNumericLiteralLike, - isTagName, - isTextWhiteSpaceLike, - isThisTypeParameter, - lastOrUndefined, - length, - lineBreakPart, - map, - mapDefined, - mapOneOrMany, - maybeBind, - maybeSetLocalizedDiagnosticMessages, - noop, - normalizePath, - parseJsonSourceFileConfigFileContent, - positionIsSynthesized, - refactor, - returnFalse, - scanner, - setObjectAllocator, - singleElementArray, - stringContains, - symbolName, - tagNamesAreEquivalent, - textSpanEnd, - timestamp, - toPath, - tracing, - typeToDisplayParts, - updateSourceFile, } from "./_namespaces/ts"; /** The version of the language service API */ diff --git a/src/services/shims.ts b/src/services/shims.ts index ee748bcf30a8a..64b1fe0f624b0 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1,70 +1,70 @@ import { Classifications, Classifier, + clear, CompilerOptions, CompletionEntryData, + 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, - TypeAcquisition, - UserPreferences, - clear, - createClassifier, - createDocumentRegistry, - createGetCanonicalFileName, - createLanguageService, - createTextChangeRange, - createTextSpan, - diagnosticCategoryName, - emptyOptions, - extensionFromPath, - filter, - flattenDiagnosticMessageText, - getAutomaticTypeDirectiveNames, - getDefaultCompilerOptions, - getDirectoryPath, - getFileMatcherPatterns, - getNewLineOrDefaultFromHost, - getProperty, - getSnapshotText, - isString, - map, - normalizeSlashes, - parseJsonSourceFileConfigFileContent, - parseJsonText, - preProcessFile, - resolveModuleName, - resolveTypeReferenceDirective, - servicesVersion, timestamp, toFileNameLowerCase, toPath, + TypeAcquisition, + UserPreferences, } from "./_namespaces/ts"; // diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 9b7ed534cd896..1ca1b0ae6dd15 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 670fe269afd80..0e67fba79a386 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 02a1cb4b27549..e77fe30e4acf1 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 456fe19e6a324..c319ad3b8e92a 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 e7ee92edc2a05..3c242e580766c 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 ce6be17232d6e..fff0b69e39eb0 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 acd409803c53e..98a35af0fe3e0 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 91622afcae8c9..9c6f96408d464 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 83b0b4eb9d4da..7329f788aa197 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 93ae373681330..ee6c8a22ba4dd 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 c80e49a5a79c5..a5e151ac7ab1a 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1,161 +1,66 @@ import { + __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, - DoStatement, DocumentPosition, DocumentSpan, + DoStatement, ElementAccessExpression, EmitFlags, EmitHint, + emptyArray, EndOfFileToken, + ensureScriptKind, EqualityOperator, + escapeString, 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, - assertType, - binarySearchKey, - canHaveModifiers, - cast, - clone, - codefix, - combinePaths, - compareTextSpans, - compareValues, - contains, - createPrinter, - createRange, - createScanner, - createTextSpan, - createTextSpanFromBounds, - defaultMaximumTruncationLength, - directoryProbablyExists, - emptyArray, - ensureScriptKind, - escapeString, 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 7fd649070dec6..bad01ecd0bb01 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 b7baa33cfea42..ece03273f89cf 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 9643d642cc7ac..7ff6ca57011a4 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 d4c490ddf8e95..ff5be50988071 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 60511d4f100cf..65af002657a19 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 5bdac7a0e22a2..2c965e45323e0 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 705d6f70861aa..c349968c89cdf 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 848b17f3db94c..d677b34885fed 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 94efcaba3c818..fa865d423b9d1 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 332d69675dea9..8188d9a2cfd22 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 fc009e2cbc2a4..9374c38dd5a2b 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 fa5710d334b47..44c49398d5925 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 ef4a563f542be..10ecd276fd171 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 bb236257c76a5..ae548a0e51e7b 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 336c1a0f36439..08d5456138032 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 7d66eaa425f25..5275bba2e1149 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 0bcfdf92cf379..cb87c76fbc693 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 310846c2651c4..0c34385b46bea 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 076f56752f086..d78e632d11125 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 6606990897a59..e7ec70725a692 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 d42f37ee5541a..2858099f538e7 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 df418d16e02ad..e084adbe72c49 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 15ac493ec9910..b1739dcd8af0e 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 fc3cdda127755..302334dea4cd8 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 96ddac44558a2..d41f933947218 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 b1c86fcd57135..79d42a00ce4b4 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 4f037949d8b1d..afd3f34b71c67 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 197f5e2f2f6dd..2262dda00cce5 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 67fa32f75c81a..7beecd9cdd2a0 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 a8051822d0c17..914d889806911 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 49db873e21f8b..9823c67dbdb3a 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 77b5384fe3f67..4a198b652f5da 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 a0c7926045010..dfed47e08142d 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 db5e2408ca24e..ff58abc4c85ce 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 dc3dea59d1943..7321dc807dc0a 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 f6aba5b8537f7..e25a5eefacc59 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 21a4dbecb5e8c..4aa07594feade 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 40de351fbd63b..102bbd7746bfe 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 abacbeb6cb4e3..32a271b5e71e6 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 b11d28f640e8b..d7eed858ebe28 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 5eaa1ffedb750..5fdd48039fe35 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 b55f0f72fbeab..94b062a2c7f19 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 fa999ffdd46eb..01b947479a237 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 72be15301416e..c1fddf773323d 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 a5d3948a4e8a3..97aa6aa01f4de 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 6a6d5386159e6..cc4883f4dc915 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 8055317a56629..d834c5c83d7e2 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 739c07e2ade3e..4e3d46204f777 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 c176c061e0d41..aeeba6f8a1973 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 2007276677059..269eeaa96109a 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 c93b84a67a114..6452515db8c7b 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 7af85c3f9d611..28b6c72606bb3 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 6551422911f83..ec3f62c82c422 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 c775e8a104e51..b2584532979f9 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 67f56833399b6..9c6bd0d664ebf 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 92f7e47b7fc01..739a29a503ebb 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 48457ff976dc7..8acf0e1c6b2ac 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 7d75decb752ec..93a5b517af8e6 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 c9e948efbeb5d..5d6919dc33662 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 1c0411cb425c1..c505181c490e9 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 c87e565b36347..eb0182bea6396 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 8f2baf82484ad..917b50ce6ee10 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 8d9051824d582..5d19e9075070d 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 40cd8a791fa3a..c6ade3fb6e2e5 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 603fe35174d27..6fa7aa172e4b8 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 5a69bc6e9f1c1..11fded416f680 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 8fb572967541f..c113207329bc3 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 050d3cc933667..5fcf7726abfc6 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 f65581a725523..f163dbbbfd7d6 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 e79227946d26e..5a2d5dc37958f 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 73d712ff87d62..c83d202d46910 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 b149c7bd6ffe8..5da6c3123de78 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 951287c0df7e2..6414d2441d5d9 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 7e6c9daeb36b9..c7d6b12a684c4 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 190cddc49f295..9933afd8ad00b 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 393c5a24ba02f..b122bd7b89369 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 bc09ece98fc4c..81304941d8a26 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 ae4c598b4b640..6db0fb3509fa2 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 7cc11e9bb1123..10613e0e76bc3 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 c1dafa9ad79b8..b8de4f6d65c19 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 4846ca154307d..4734b18c47337 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 650527ea95a91..400c21cd0a5b3 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 681c79331580a..6e6e3539d7da2 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 ada75410a174e..a1f780dcc8c77 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 b10d7c178afd6..86504b90255a7 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 d22928bcc80ce..d65eee7ac4164 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 05e2dade62e81..72e8bfedf7130 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 7a53291ddf888..b9290fe96ad4a 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 07210c6da3e80..99ed4ead47ebf 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 121399ac4fc99..e6e7a0e993874 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 7bc56c7e5a291..f93933499ce09 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 620f40130d715..f20963c531785 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 450f8f04d9815..9257ac4400ecc 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 3efc9bdd2136a..a741c8517366d 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 ec5ffbcafd825..6750433c9f9ec 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 abc1fb87c1d80..a0db3ccd3f500 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 84f259ba94427..651e0889e1a56 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 231ebfe7b8002..6c016e79cdb9c 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 19f694370092a..de6fbde92e555 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 9b4d8b77cd919..25de36c1ff4e6 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 7b09c8740fdc6..04d1c3745f397 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 c272252d63fc3..f62f1316de1f3 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 c80669e1136b3..bcf2e0128ddae 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 3757134382448..c95b6b420d150 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 bc9d36195ac8f..d3ad989f20001 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 68774b3c5f4d7..0d8d0eb5d61aa 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 d0e249d996068..81c6ec68a107f 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -1,39 +1,39 @@ import { - Comparison, - Extension, - FileWatcher, - GetCanonicalFileName, - JsTyping, - MapLike, - ModuleResolutionKind, - Path, - PollingInterval, - Version, - WatchDirectoryFlags, - WatchFactory, - WatchFactoryHost, - WatchLogLevel, - WatchOptions, 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, } from "./_namespaces/ts"; import { ActionInvalidate, diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index ca3be411e44d7..f5cc041c7b601 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,