From 59b03364c041036bf4b529e963aeb766990830dd Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 15 Dec 2022 14:49:05 -0800 Subject: [PATCH 1/3] Switch imports back to case sensitive sorting --- .eslintrc.json | 2 +- src/compiler/binder.ts | 206 ++--- src/compiler/builder.ts | 50 +- src/compiler/builderPublic.ts | 6 +- src/compiler/builderState.ts | 28 +- src/compiler/checker.ts | 830 +++++++++--------- src/compiler/commandLineParser.ts | 88 +- src/compiler/core.ts | 4 +- src/compiler/debug.ts | 58 +- src/compiler/emitter.ts | 386 ++++---- src/compiler/factory/baseNodeFactory.ts | 2 +- src/compiler/factory/emitHelpers.ts | 22 +- src/compiler/factory/emitNode.ts | 14 +- src/compiler/factory/nodeConverters.ts | 12 +- src/compiler/factory/nodeFactory.ts | 280 +++--- src/compiler/factory/nodeTests.ts | 10 +- src/compiler/factory/parenthesizerRules.ts | 26 +- src/compiler/factory/utilities.ts | 130 +-- src/compiler/factory/utilitiesPublic.ts | 2 +- src/compiler/moduleNameResolver.ts | 62 +- src/compiler/moduleSpecifiers.ts | 64 +- src/compiler/parser.ts | 196 ++--- src/compiler/path.ts | 8 +- src/compiler/performance.ts | 4 +- src/compiler/performanceCore.ts | 2 +- src/compiler/program.ts | 214 ++--- src/compiler/resolutionCache.ts | 50 +- src/compiler/scanner.ts | 16 +- src/compiler/semver.ts | 4 +- src/compiler/sourcemap.ts | 16 +- src/compiler/symbolWalker.ts | 10 +- src/compiler/sys.ts | 20 +- src/compiler/tracing.ts | 12 +- src/compiler/transformer.ts | 42 +- src/compiler/transformers/classFields.ts | 92 +- src/compiler/transformers/declarations.ts | 144 +-- .../transformers/declarations/diagnostics.ts | 48 +- src/compiler/transformers/destructuring.ts | 32 +- src/compiler/transformers/es2015.ts | 134 +-- src/compiler/transformers/es2016.ts | 14 +- src/compiler/transformers/es2017.ts | 64 +- src/compiler/transformers/es2018.ts | 90 +- src/compiler/transformers/es2019.ts | 8 +- src/compiler/transformers/es2020.ts | 24 +- src/compiler/transformers/es2021.ts | 16 +- src/compiler/transformers/es5.ts | 20 +- src/compiler/transformers/esnext.ts | 6 +- src/compiler/transformers/generators.ts | 72 +- src/compiler/transformers/jsx.ts | 64 +- src/compiler/transformers/legacyDecorators.ts | 52 +- .../transformers/module/esnextAnd2015.ts | 38 +- src/compiler/transformers/module/module.ts | 82 +- src/compiler/transformers/module/node.ts | 4 +- src/compiler/transformers/module/system.ts | 80 +- src/compiler/transformers/taggedTemplate.ts | 16 +- src/compiler/transformers/ts.ts | 138 +-- src/compiler/transformers/typeSerializer.ts | 54 +- src/compiler/transformers/utilities.ts | 58 +- src/compiler/tsbuild.ts | 4 +- src/compiler/tsbuildPublic.ts | 100 +-- src/compiler/utilities.ts | 480 +++++----- src/compiler/utilitiesPublic.ts | 200 ++--- src/compiler/visitorPublic.ts | 28 +- src/compiler/watch.ts | 86 +- src/compiler/watchPublic.ts | 88 +- src/compiler/watchUtilities.ts | 36 +- .../4.0/nodeFactoryTopLevelExports.ts | 14 +- .../4.2/abstractConstructorTypes.ts | 6 +- src/deprecatedCompat/4.2/renamedNodeTests.ts | 2 +- .../4.6/importTypeAssertions.ts | 10 +- .../4.7/typeParameterModifiers.ts | 8 +- .../4.8/mergeDecoratorsAndModifiers.ts | 48 +- src/deprecatedCompat/deprecate.ts | 2 +- src/deprecatedCompat/deprecations.ts | 2 +- src/executeCommandLine/executeCommandLine.ts | 52 +- src/harness/client.ts | 30 +- src/jsTyping/jsTyping.ts | 14 +- src/server/editorServices.ts | 136 +-- src/server/moduleSpecifierCache.ts | 2 +- src/server/packageJsonCache.ts | 8 +- src/server/project.ts | 124 +-- src/server/scriptInfo.ts | 38 +- src/server/scriptVersionCache.ts | 8 +- src/server/session.ts | 138 +-- src/server/typingsCache.ts | 12 +- src/server/utilities.ts | 6 +- src/server/utilitiesPublic.ts | 6 +- src/services/breakpoints.ts | 40 +- src/services/callHierarchy.ts | 66 +- src/services/classifier.ts | 60 +- src/services/classifier2020.ts | 32 +- src/services/codeFixProvider.ts | 16 +- ...dConvertToUnknownForNonOverlappingTypes.ts | 6 +- src/services/codefixes/addMissingAsync.ts | 16 +- src/services/codefixes/addMissingAwait.ts | 30 +- src/services/codefixes/addMissingConst.ts | 12 +- .../codefixes/addMissingDeclareProperty.ts | 4 +- .../addMissingInvocationForDecorator.ts | 2 +- .../codefixes/addNameToNamelessParameter.ts | 4 +- .../codefixes/addOptionalPropertyUndefined.ts | 20 +- .../codefixes/annotateWithTypeFromJSDoc.ts | 32 +- src/services/codefixes/convertConstToLet.ts | 12 +- .../codefixes/convertFunctionToEs6Class.ts | 40 +- .../convertLiteralTypeToMappedType.ts | 8 +- .../codefixes/convertToAsyncFunction.ts | 52 +- src/services/codefixes/convertToEsModule.ts | 64 +- .../codefixes/convertToMappedObjectType.ts | 16 +- .../codefixes/convertToTypeOnlyExport.ts | 12 +- .../codefixes/convertToTypeOnlyImport.ts | 6 +- ...correctQualifiedNameToIndexedAccessType.ts | 6 +- .../codefixes/disableJsDiagnostics.ts | 6 +- .../codefixes/fixAddMissingConstraint.ts | 22 +- src/services/codefixes/fixAddMissingMember.ts | 80 +- .../codefixes/fixAddMissingNewOperator.ts | 8 +- .../fixAddModuleReferTypeMissingTypeof.ts | 4 +- src/services/codefixes/fixAddVoidToPromise.ts | 14 +- .../codefixes/fixAwaitInSyncFunction.ts | 16 +- src/services/codefixes/fixCannotFindModule.ts | 8 +- ...sDoesntImplementInheritedAbstractMember.ts | 14 +- .../fixClassIncorrectlyImplementsInterface.ts | 26 +- .../fixClassSuperMustPrecedeThisAccess.ts | 8 +- .../fixConstructorForDerivedNeedSuperCall.ts | 2 +- .../fixEnableExperimentalDecorators.ts | 2 +- src/services/codefixes/fixEnableJsxFlag.ts | 2 +- src/services/codefixes/fixExpectedComma.ts | 6 +- .../fixExtendsInterfaceBecomesImplements.ts | 8 +- .../fixForgottenThisPropertyAccess.ts | 6 +- src/services/codefixes/fixImplicitThis.ts | 8 +- .../codefixes/fixImportNonExportedMember.ts | 16 +- .../codefixes/fixIncorrectNamedTupleSyntax.ts | 6 +- .../codefixes/fixInvalidImportSyntax.ts | 16 +- .../codefixes/fixInvalidJsxCharacters.ts | 4 +- src/services/codefixes/fixJSDocTypes.ts | 6 +- .../codefixes/fixMissingCallParentheses.ts | 6 +- .../codefixes/fixModuleAndTargetOptions.ts | 4 +- src/services/codefixes/fixNaNEquality.ts | 10 +- .../fixNoPropertyAccessFromIndexSignature.ts | 10 +- src/services/codefixes/fixOverrideModifier.ts | 16 +- .../codefixes/fixPropertyAssignment.ts | 6 +- .../codefixes/fixPropertyOverrideAccessor.ts | 2 +- .../codefixes/fixReturnTypeInAsyncFunction.ts | 8 +- src/services/codefixes/fixSpelling.ts | 20 +- .../codefixes/fixStrictClassInitialization.ts | 18 +- .../codefixes/fixUnmatchedParameter.ts | 14 +- src/services/codefixes/fixUnreachableCode.ts | 6 +- .../fixUnreferenceableDecoratorMetadata.ts | 18 +- src/services/codefixes/fixUnusedIdentifier.ts | 28 +- src/services/codefixes/fixUnusedLabel.ts | 6 +- src/services/codefixes/generateAccessors.ts | 40 +- src/services/codefixes/helpers.ts | 88 +- src/services/codefixes/importFixes.ts | 90 +- src/services/codefixes/inferFromUsage.ts | 90 +- .../codefixes/removeUnnecessaryAwait.ts | 8 +- src/services/codefixes/requireInTs.ts | 18 +- src/services/codefixes/returnValueCorrect.ts | 28 +- src/services/codefixes/splitTypeOnlyImport.ts | 6 +- src/services/codefixes/useBigintLiteral.ts | 4 +- src/services/codefixes/useDefaultImport.ts | 6 +- src/services/codefixes/wrapJsxInFragment.ts | 8 +- src/services/completions.ts | 246 +++--- src/services/documentHighlights.ts | 58 +- src/services/documentRegistry.ts | 20 +- src/services/exportInfoMap.ts | 34 +- src/services/findAllReferences.ts | 154 ++-- src/services/formatting/formatting.ts | 42 +- src/services/formatting/formattingContext.ts | 2 +- src/services/formatting/formattingScanner.ts | 14 +- src/services/formatting/rule.ts | 2 +- src/services/formatting/rules.ts | 12 +- src/services/formatting/rulesMap.ts | 6 +- src/services/formatting/smartIndenter.ts | 46 +- src/services/getEditsForFileRename.ts | 34 +- src/services/goToDefinition.ts | 46 +- src/services/importTracker.ts | 56 +- src/services/inlayHints.ts | 50 +- src/services/jsDoc.ts | 70 +- src/services/navigateTo.ts | 26 +- src/services/navigationBar.ts | 64 +- src/services/organizeImports.ts | 46 +- src/services/outliningElementsCollector.ts | 38 +- src/services/patternMatcher.ts | 6 +- src/services/preProcess.ts | 8 +- src/services/refactorProvider.ts | 4 +- .../addOrRemoveBracesToArrowFunction.ts | 18 +- ...onvertArrowFunctionOrFunctionExpression.ts | 40 +- src/services/refactors/convertExport.ts | 40 +- src/services/refactors/convertImport.ts | 44 +- .../convertOverloadListToSingleSignature.ts | 30 +- .../convertParamsToDestructuredObject.ts | 74 +- .../convertStringOrTemplateLiteral.ts | 28 +- .../convertToOptionalChainExpression.ts | 28 +- src/services/refactors/extractSymbol.ts | 102 +-- src/services/refactors/extractType.ts | 34 +- .../generateGetAccessorAndSetAccessor.ts | 4 +- .../refactors/inferFunctionReturnType.ts | 26 +- src/services/refactors/moveToNewFile.ts | 100 +-- src/services/rename.ts | 46 +- src/services/services.ts | 286 +++--- src/services/shims.ts | 60 +- src/services/signatureHelp.ts | 60 +- src/services/smartSelection.ts | 12 +- src/services/sourcemaps.ts | 16 +- src/services/stringCompletions.ts | 88 +- src/services/suggestionDiagnostics.ts | 40 +- src/services/symbolDisplay.ts | 82 +- src/services/textChanges.ts | 112 +-- src/services/transform.ts | 8 +- src/services/transpile.ts | 12 +- src/services/types.ts | 2 +- src/services/utilities.ts | 244 ++--- src/testRunner/compilerRunner.ts | 4 +- src/testRunner/externalCompileRunner.ts | 2 +- src/testRunner/parallel/host.ts | 10 +- src/testRunner/parallel/worker.ts | 4 +- src/testRunner/runner.ts | 6 +- src/testRunner/unittests/builder.ts | 2 +- .../unittests/reuseProgramStructure.ts | 8 +- .../services/convertToAsyncFunction.ts | 2 +- .../unittests/services/languageService.ts | 2 +- .../unittests/services/organizeImports.ts | 2 +- .../unittests/tsbuild/commandLine.ts | 2 +- src/testRunner/unittests/tsbuild/outFile.ts | 4 +- .../unittests/tsbuild/outputPaths.ts | 6 +- src/testRunner/unittests/tsbuild/publicApi.ts | 2 +- src/testRunner/unittests/tsbuild/sample.ts | 8 +- .../tsbuildWatch/configFileErrors.ts | 2 +- src/testRunner/unittests/tsbuildWatch/demo.ts | 2 +- .../unittests/tsbuildWatch/programUpdates.ts | 6 +- .../tsbuildWatch/projectsBuilding.ts | 4 +- .../unittests/tsbuildWatch/publicApi.ts | 2 +- .../tsbuildWatch/watchEnvironment.ts | 4 +- .../unittests/tsc/cancellationToken.ts | 4 +- .../unittests/tsc/declarationEmit.ts | 2 +- src/testRunner/unittests/tsc/helpers.ts | 2 +- src/testRunner/unittests/tsc/incremental.ts | 2 +- .../unittests/tscWatch/consoleClearing.ts | 4 +- src/testRunner/unittests/tscWatch/emit.ts | 4 +- .../unittests/tscWatch/emitAndErrorUpdates.ts | 2 +- .../forceConsistentCasingInFileNames.ts | 4 +- src/testRunner/unittests/tscWatch/helpers.ts | 8 +- .../unittests/tscWatch/incremental.ts | 6 +- .../unittests/tscWatch/moduleResolution.ts | 2 +- .../unittests/tscWatch/nodeNextWatch.ts | 2 +- .../unittests/tscWatch/programUpdates.ts | 6 +- .../tscWatch/projectsWithReferences.ts | 2 +- .../unittests/tscWatch/resolutionCache.ts | 4 +- .../sourceOfProjectReferenceRedirect.ts | 4 +- src/testRunner/unittests/tscWatch/watchApi.ts | 4 +- .../unittests/tscWatch/watchEnvironment.ts | 4 +- .../tsserver/applyChangesToOpenFiles.ts | 4 +- .../unittests/tsserver/autoImportProvider.ts | 2 +- .../unittests/tsserver/auxiliaryProject.ts | 2 +- .../tsserver/cachingFileSystemInformation.ts | 8 +- .../unittests/tsserver/cancellationToken.ts | 2 +- .../unittests/tsserver/compileOnSave.ts | 8 +- .../unittests/tsserver/completions.ts | 4 +- .../tsserver/completionsIncomplete.ts | 2 +- .../unittests/tsserver/configFileSearch.ts | 2 +- .../unittests/tsserver/configuredProjects.ts | 4 +- .../unittests/tsserver/declarationFileMaps.ts | 4 +- .../unittests/tsserver/documentRegistry.ts | 4 +- .../unittests/tsserver/duplicatePackages.ts | 2 +- .../unittests/tsserver/dynamicFiles.ts | 2 +- .../tsserver/events/largeFileReferenced.ts | 2 +- .../events/projectLanguageServiceState.ts | 2 +- .../tsserver/events/projectLoading.ts | 6 +- .../events/projectUpdatedInBackground.ts | 8 +- .../unittests/tsserver/exportMapCache.ts | 2 +- .../unittests/tsserver/externalProjects.ts | 2 +- .../forceConsistentCasingInFileNames.ts | 2 +- .../tsserver/getApplicableRefactors.ts | 2 +- .../tsserver/getEditsForFileRename.ts | 2 +- .../unittests/tsserver/getExportReferences.ts | 2 +- .../unittests/tsserver/getFileReferences.ts | 2 +- src/testRunner/unittests/tsserver/helpers.ts | 6 +- .../unittests/tsserver/inferredProjects.ts | 2 +- .../unittests/tsserver/inlayHints.ts | 4 +- src/testRunner/unittests/tsserver/jsdocTag.ts | 2 +- .../tsserver/maxNodeModuleJsDepth.ts | 2 +- .../unittests/tsserver/metadataInResponse.ts | 4 +- .../unittests/tsserver/moduleResolution.ts | 2 +- .../tsserver/moduleSpecifierCache.ts | 2 +- src/testRunner/unittests/tsserver/navTo.ts | 2 +- .../unittests/tsserver/occurences.ts | 2 +- src/testRunner/unittests/tsserver/openFile.ts | 2 +- .../unittests/tsserver/packageJsonInfo.ts | 2 +- .../tsserver/partialSemanticServer.ts | 2 +- src/testRunner/unittests/tsserver/plugins.ts | 2 +- .../unittests/tsserver/projectErrors.ts | 2 +- .../tsserver/projectReferenceCompileOnSave.ts | 2 +- .../unittests/tsserver/projectReferences.ts | 4 +- .../tsserver/projectReferencesSourcemap.ts | 8 +- src/testRunner/unittests/tsserver/projects.ts | 4 +- .../tsserver/projectsWithReferences.ts | 2 +- .../unittests/tsserver/refactors.ts | 2 +- .../unittests/tsserver/reloadProjects.ts | 6 +- src/testRunner/unittests/tsserver/rename.ts | 2 +- .../unittests/tsserver/resolutionCache.ts | 6 +- .../unittests/tsserver/smartSelection.ts | 2 +- src/testRunner/unittests/tsserver/symLinks.ts | 4 +- .../unittests/tsserver/symlinkCache.ts | 2 +- .../unittests/tsserver/syntacticServer.ts | 6 +- .../unittests/tsserver/syntaxOperations.ts | 4 +- .../unittests/tsserver/telemetry.ts | 2 +- .../unittests/tsserver/typeAquisition.ts | 2 +- .../tsserver/typeOnlyImportChains.ts | 2 +- .../tsserver/typeReferenceDirectives.ts | 2 +- .../unittests/tsserver/typingsInstaller.ts | 6 +- .../unittests/tsserver/watchEnvironment.ts | 8 +- .../unittests/virtualFileSystemWithWatch.ts | 32 +- src/tsserver/common.ts | 2 +- src/tsserver/nodeServer.ts | 48 +- src/tsserver/server.ts | 4 +- src/typingsInstaller/nodeTypingsInstaller.ts | 12 +- src/typingsInstallerCore/typingsInstaller.ts | 30 +- 315 files changed, 5255 insertions(+), 5255 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 4d268386e1434..d0c53c04fd6a8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -26,7 +26,7 @@ ], "rules": { "sort-imports": ["error", { - "ignoreCase": true, + "ignoreCase": false, "ignoreDeclarationSort": true, "allowSeparatedGroups": true }], diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index fc23222eb520b..f083a371e5859 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,9 +1,5 @@ import { - __String, AccessExpression, - addRelatedInfo, - append, - appendIfUnique, ArrayBindingElement, ArrayLiteralExpression, ArrowFunction, @@ -21,61 +17,145 @@ import { BreakOrContinueStatement, CallChain, CallExpression, - canHaveLocals, - canHaveSymbol, CaseBlock, CaseClause, - cast, CatchClause, ClassLikeDeclaration, ClassStaticBlockDeclaration, CompilerOptions, - concatenate, ConditionalExpression, ConditionalTypeNode, - contains, - createBinaryExpressionTrampoline, - createDiagnosticForNodeInSourceFile, - createFileDiagnostic, - createQueue, - createSymbolTable, Debug, Declaration, - declarationNameToString, DeleteExpression, DestructuringAssignment, DiagnosticCategory, DiagnosticMessage, DiagnosticRelatedInformation, - Diagnostics, DiagnosticWithLocation, + Diagnostics, 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, + HasContainerFlags, + HasFlowNode, + HasLocals, + Identifier, + IfStatement, + ImportClause, + InternalSymbolName, + IsBlockScopedContainer, + IsContainer, + JSDocCallbackTag, + JSDocClassTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocOverloadTag, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTypeLiteral, + JSDocTypedefTag, + JsxAttribute, + JsxAttributes, + LabeledStatement, + LiteralLikeElementAccessExpression, + MappedTypeNode, + MetaProperty, + MethodDeclaration, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + ModuleResolutionKind, + Mutable, + NamespaceExportDeclaration, + Node, + NodeArray, + NodeFlags, + NonNullChain, + NonNullExpression, + NumericLiteral, + ObjectLiteralExpression, + OptionalChain, + ParameterDeclaration, + ParenthesizedExpression, + Pattern, + PatternAmbientModule, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAccessChain, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + QualifiedName, + ReturnStatement, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SignatureDeclaration, + SourceFile, + SpreadElement, + Statement, + StringLiteral, + SuperExpression, + SwitchStatement, + Symbol, + SymbolFlags, + SymbolTable, + SyntaxKind, + TextRange, + ThisExpression, + ThrowStatement, + TokenFlags, + TracingNode, + TryStatement, + TypeLiteralNode, + TypeOfExpression, + TypeParameterDeclaration, + VariableDeclaration, + WhileStatement, + WithStatement, + __String, + addRelatedInfo, + append, + appendIfUnique, + canHaveLocals, + canHaveSymbol, + cast, + concatenate, + contains, + createBinaryExpressionTrampoline, + createDiagnosticForNodeInSourceFile, + createFileDiagnostic, + createQueue, + createSymbolTable, + declarationNameToString, + escapeLeadingUnderscores, + every, + exportAssignmentIsAlias, + findAncestor, + forEach, + forEachChild, getAssignedExpandoInitializer, getAssignmentDeclarationKind, getAssignmentDeclarationPropertyAccessKind, @@ -107,17 +187,10 @@ import { getTextOfIdentifierOrLiteral, getThisContainer, getTokenPosOfNode, - HasContainerFlags, hasDynamicName, - HasFlowNode, hasJSDocNodes, - HasLocals, hasSyntacticModifier, - Identifier, idText, - IfStatement, - ImportClause, - InternalSymbolName, isAliasableExpression, isAmbientModule, isAssignmentExpression, @@ -132,11 +205,9 @@ import { isBindingPattern, isBlock, isBlockOrCatchScoped, - IsBlockScopedContainer, isCallExpression, isClassStaticBlockDeclaration, isConditionalTypeNode, - IsContainer, isDeclaration, isDeclarationStatement, isDestructuringAssignment, @@ -148,8 +219,8 @@ import { isEnumDeclaration, isExportAssignment, isExportDeclaration, - isExportsIdentifier, isExportSpecifier, + isExportsIdentifier, isExpression, isExpressionOfOptionalChainRoot, isExternalModule, @@ -216,99 +287,28 @@ import { isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, - JSDocCallbackTag, - JSDocClassTag, - JSDocEnumTag, - JSDocFunctionType, - JSDocOverloadTag, - JSDocParameterTag, - JSDocPropertyLikeTag, - JSDocSignature, - JSDocTypedefTag, - JSDocTypeLiteral, - JsxAttribute, - JsxAttributes, - LabeledStatement, length, - LiteralLikeElementAccessExpression, - MappedTypeNode, - MetaProperty, - MethodDeclaration, - ModifierFlags, - ModuleBlock, - ModuleDeclaration, - ModuleResolutionKind, - Mutable, - NamespaceExportDeclaration, - Node, - NodeArray, - NodeFlags, nodeHasName, nodeIsMissing, nodeIsPresent, - NonNullChain, - NonNullExpression, - NumericLiteral, objectAllocator, - ObjectLiteralExpression, - OptionalChain, - ParameterDeclaration, - ParenthesizedExpression, - Pattern, - PatternAmbientModule, perfLogger, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrivateIdentifier, - PropertyAccessChain, - PropertyAccessEntityNameExpression, - PropertyAccessExpression, - PropertyDeclaration, - PropertySignature, - QualifiedName, removeFileExtension, - ReturnStatement, - ScriptTarget, - SetAccessorDeclaration, setParent, setParentRecursive, setValueDeclaration, - ShorthandPropertyAssignment, shouldPreserveConstEnums, - SignatureDeclaration, skipParentheses, sliceAfter, some, - SourceFile, - SpreadElement, - Statement, - StringLiteral, - SuperExpression, - SwitchStatement, - Symbol, - SymbolFlags, symbolName, - SymbolTable, - SyntaxKind, - TextRange, - ThisExpression, - 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 550baef382984..b9a8641778058 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1,29 +1,16 @@ import * as ts from "./_namespaces/ts"; import { - addRange, AffectedFileResult, - arrayFrom, - arrayToMap, + BuildInfo, BuilderProgram, BuilderProgramHost, BuilderState, - BuildInfo, BundleBuildInfo, CancellationToken, CommandLineOption, - compareStringsCaseSensitive, - compareValues, CompilerHost, CompilerOptions, - compilerOptionsAffectDeclarationPath, - compilerOptionsAffectEmit, - compilerOptionsAffectSemanticDiagnostics, CompilerOptionsValue, - concatenate, - convertToOptionsWithAbsolutePaths, - createBuildInfo, - createGetCanonicalFileName, - createProgram, CustomTransformers, Debug, Diagnostic, @@ -34,6 +21,30 @@ import { EmitAndSemanticDiagnosticsBuilderProgram, EmitOnly, EmitResult, + 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, @@ -50,7 +61,6 @@ import { getRelativePathFromDirectory, getTsBuildInfoEmitOutputFilePath, handleNoEmitOptions, - HostForComputeHash, isArray, isDeclarationFileName, isJsonSourceFile, @@ -62,23 +72,13 @@ 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 4cfcb731fb61c..332763c39d809 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 870e82f2f2d55..22f7276c13a62 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -1,16 +1,26 @@ import { - arrayFrom, CancellationToken, - computeSignatureWithDiagnostics, CustomTransformers, Debug, EmitOutput, - emptyArray, ExportedModulesFromDeclarationEmit, GetCanonicalFileName, + HostForComputeHash, + ModuleDeclaration, + ModuleKind, + OutputFile, + Path, + Program, + ResolutionMode, + SourceFile, + StringLiteralLike, + Symbol, + TypeChecker, + arrayFrom, + computeSignatureWithDiagnostics, + emptyArray, getDirectoryPath, getSourceFileOfNode, - HostForComputeHash, isDeclarationFileName, isExternalOrCommonJsModule, isGlobalScopeAugmentation, @@ -19,19 +29,9 @@ 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 def39591676e1..893ea5739a356 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,54 +1,418 @@ import * as ts from "./_namespaces/ts"; import { + AccessExpression, + AccessFlags, + AccessorDeclaration, + AllAccessorDeclarations, + AmbientModuleDeclaration, + AnonymousType, + AnyImportOrReExport, + AnyImportSyntax, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AssertionExpression, + AssignmentDeclarationKind, + AssignmentKind, + AssignmentPattern, + AwaitExpression, + BaseType, + BigIntLiteral, + BigIntLiteralType, + BinaryExpression, + BinaryOperatorToken, + BindableObjectDefinePropertyCall, + BindableStaticNameExpression, + BindingElement, + BindingElementGrandparent, + BindingName, + BindingPattern, + Block, + BreakOrContinueStatement, + CallChain, + CallExpression, + CallLikeExpression, + CallSignatureDeclaration, + CancellationToken, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CharacterCodes, + CheckFlags, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + Comparison, + CompilerOptions, + ComputedPropertyName, + ConditionalExpression, + ConditionalRoot, + ConditionalType, + ConditionalTypeNode, + ConstructSignatureDeclaration, + ConstructorDeclaration, + ConstructorTypeNode, + ContextFlags, + Debug, + Declaration, + DeclarationName, + DeclarationStatement, + DeclarationWithTypeParameterChildren, + DeclarationWithTypeParameters, + Decorator, + DefaultClause, + DeferredTypeReference, + DeleteExpression, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + DiagnosticWithLocation, + Diagnostics, + DoStatement, + DynamicNamedDeclaration, + ElementAccessChain, + ElementAccessExpression, + ElementFlags, + EmitFlags, + EmitHint, + EmitResolver, + EmitTextWriter, + EntityName, + EntityNameExpression, + EntityNameOrEntityNameExpression, + EnumDeclaration, + EnumMember, + EvolvingArrayType, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalEmitHelpers, + FlowArrayMutation, + FlowAssignment, + FlowCall, + FlowCondition, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, + FlowStart, + FlowSwitchClause, + FlowType, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FreshObjectLiteralType, + FreshableIntrinsicType, + FreshableType, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + FunctionOrConstructorTypeNode, + FunctionTypeNode, + GenericType, + GetAccessorDeclaration, + HasDecorators, + HasExpressionInitializer, + HasIllegalDecorators, + HasIllegalModifiers, + HasInitializer, + HasLocals, + 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, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNullableType, + JSDocOptionalType, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocSignature, + JSDocTemplateTag, + JSDocTypeExpression, + JSDocTypeLiteral, + 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, + ModuleSpecifierResolutionHost, + 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, + TransientSymbolLinks, + 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, - AccessExpression, - AccessFlags, - AccessorDeclaration, addRange, addRelatedInfo, addSyntheticLeadingComment, - AllAccessorDeclarations, - AmbientModuleDeclaration, and, - AnonymousType, - AnyImportOrReExport, - AnyImportSyntax, append, appendIfUnique, - ArrayBindingPattern, arrayFrom, arrayIsHomogeneous, - ArrayLiteralExpression, arrayOf, - arraysEqual, arrayToMultiMap, - ArrayTypeNode, - ArrowFunction, - AssertionExpression, - AssignmentDeclarationKind, - AssignmentKind, - AssignmentPattern, - AwaitExpression, - BaseType, - BigIntLiteral, - BigIntLiteralType, - BinaryExpression, - BinaryOperatorToken, + arraysEqual, binarySearch, - BindableObjectDefinePropertyCall, - BindableStaticNameExpression, - BindingElement, - BindingElementGrandparent, - BindingName, - BindingPattern, bindSourceFile, - Block, - BreakOrContinueStatement, - CallChain, - CallExpression, - CallLikeExpression, - CallSignatureDeclaration, - CancellationToken, canHaveDecorators, canHaveExportModifier, canHaveFlowNode, @@ -60,38 +424,17 @@ import { canHaveSymbol, canUsePropertyAccess, cartesianProduct, - CaseBlock, - CaseClause, - CaseOrDefaultClause, cast, chainDiagnosticMessages, - CharacterCodes, - CheckFlags, - ClassDeclaration, - ClassElement, - ClassExpression, - ClassLikeDeclaration, - ClassStaticBlockDeclaration, clear, combinePaths, compareDiagnostics, comparePaths, compareValues, - Comparison, - CompilerOptions, - ComputedPropertyName, concatenate, concatenateDiagnosticMessageChains, - ConditionalExpression, - ConditionalRoot, - ConditionalType, - ConditionalTypeNode, - ConstructorDeclaration, - ConstructorTypeNode, - ConstructSignatureDeclaration, contains, containsParseError, - ContextFlags, copyEntries, countWhere, createBinaryExpressionTrampoline, @@ -112,60 +455,19 @@ import { createSymbolTable, createTextWriter, createUnderscoreEscapedMultiMap, - Debug, - Declaration, - DeclarationName, declarationNameToString, - DeclarationStatement, - DeclarationWithTypeParameterChildren, - DeclarationWithTypeParameters, - Decorator, deduplicate, - DefaultClause, defaultMaximumTruncationLength, - DeferredTypeReference, - DeleteExpression, - Diagnostic, - DiagnosticCategory, - DiagnosticMessage, - DiagnosticMessageChain, - DiagnosticRelatedInformation, - Diagnostics, - DiagnosticWithLocation, - DoStatement, - DynamicNamedDeclaration, - ElementAccessChain, - ElementAccessExpression, - ElementFlags, - EmitFlags, - EmitHint, emitModuleKindIsNonNodeESM, - EmitResolver, - EmitTextWriter, emptyArray, endsWith, - EntityName, - EntityNameExpression, - EntityNameOrEntityNameExpression, entityNameToString, - EnumDeclaration, - EnumMember, equateValues, escapeLeadingUnderscores, escapeString, every, - EvolvingArrayType, - ExclamationToken, - ExportAssignment, exportAssignmentIsAlias, - ExportDeclaration, - ExportSpecifier, - Expression, expressionResultIsUnused, - ExpressionStatement, - ExpressionWithTypeArguments, - Extension, - ExternalEmitHelpers, externalHelpersModuleNameText, factory, fileExtensionIs, @@ -183,17 +485,6 @@ import { firstOrUndefined, flatMap, flatten, - FlowArrayMutation, - FlowAssignment, - FlowCall, - FlowCondition, - FlowFlags, - FlowLabel, - FlowNode, - FlowReduceLabel, - FlowStart, - FlowSwitchClause, - FlowType, forEach, forEachAncestor, forEachChild, @@ -204,22 +495,7 @@ import { forEachKey, forEachReturnStatement, forEachYieldExpression, - ForInOrOfStatement, - ForInStatement, formatMessage, - ForOfStatement, - ForStatement, - FreshableIntrinsicType, - FreshableType, - FreshObjectLiteralType, - FunctionDeclaration, - FunctionExpression, - FunctionFlags, - FunctionLikeDeclaration, - FunctionOrConstructorTypeNode, - FunctionTypeNode, - GenericType, - GetAccessorDeclaration, getAliasDeclarationFromName, getAllAccessorDeclarations, getAllowSyntheticDefaultImports, @@ -242,6 +518,7 @@ import { getDeclarationsOfKind, getDeclaredExpandoInitializer, getDirectoryPath, + getESModuleInterop, getEffectiveBaseTypeNode, getEffectiveConstraintOfTypeParameter, getEffectiveContainerForJSDocTemplateTag, @@ -263,7 +540,6 @@ import { getEntries, getErrorSpanForNode, getEscapedTextOfIdentifierOrLiteral, - getESModuleInterop, getExpandoInitializer, getExportAssignmentExpression, getExternalModuleImportEqualsDeclarationExpression, @@ -307,8 +583,8 @@ import { getNonAugmentationDeclaration, getNormalizedAbsolutePath, getObjectFlags, - getOriginalNode, getOrUpdate, + getOriginalNode, getOwnKeys, getParameterSymbolFromJSDoc, getParseTreeNode, @@ -316,9 +592,9 @@ import { getPropertyNameForPropertyNameNode, getResolutionDiagnostic, getResolutionModeOverrideForClause, + getResolveJsonModule, getResolvedExternalModuleName, getResolvedModule, - getResolveJsonModule, getRestParameterElementType, getRootDeclaration, getScriptTargetFeatures, @@ -349,22 +625,15 @@ import { hasAmbientModifier, hasContextSensitiveParameters, hasDecorators, - HasDecorators, hasDynamicName, hasEffectiveModifier, hasEffectiveModifiers, hasEffectiveReadonlyModifier, - HasExpressionInitializer, hasExtension, - HasIllegalDecorators, - HasIllegalModifiers, hasInitializer, - HasInitializer, hasJSDocNodes, hasJSDocParameterTags, hasJsonModuleEmitEnabled, - HasLocals, - HasModifiers, hasOnlyExpressionInitializer, hasOverrideModifier, hasPossibleExternalModuleReference, @@ -374,43 +643,9 @@ 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, @@ -452,13 +687,13 @@ import { isClassLike, isClassStaticBlockDeclaration, isCommaSequence, - isCommonJsExportedExpression, isCommonJsExportPropertyAssignment, + isCommonJsExportedExpression, isComputedNonLiteralName, isComputedPropertyName, + isConstTypeReference, isConstructorDeclaration, isConstructorTypeNode, - isConstTypeReference, isDeclaration, isDeclarationFileName, isDeclarationName, @@ -478,8 +713,8 @@ import { isExclusivelyTypeOnlyImportOrExport, isExportAssignment, isExportDeclaration, - isExportsIdentifier, isExportSpecifier, + isExportsIdentifier, isExpression, isExpressionNode, isExpressionOfOptionalChainRoot, @@ -524,15 +759,15 @@ import { isImportOrExportSpecifier, isImportSpecifier, isImportTypeNode, - isIndexedAccessTypeNode, isInExpressionContext, - isInfinityOrNaNString, isInJSDoc, isInJSFile, isInJsonFile, + isInTopLevelContext, + isIndexedAccessTypeNode, + isInfinityOrNaNString, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, - isInTopLevelContext, isIntrinsicJsxName, isIterationStatement, isJSDocAllType, @@ -558,12 +793,13 @@ import { isJSDocTemplateTag, isJSDocTypeAlias, isJSDocTypeAssertion, - isJSDocTypedefTag, isJSDocTypeExpression, isJSDocTypeLiteral, isJSDocTypeTag, + isJSDocTypedefTag, isJSDocUnknownType, isJSDocVariadicType, + isJSXTagName, isJsonSourceFile, isJsxAttribute, isJsxAttributeLike, @@ -574,7 +810,6 @@ import { isJsxOpeningLikeElement, isJsxSelfClosingElement, isJsxSpreadAttribute, - isJSXTagName, isKnownSymbol, isLateVisibilityPaintedStatement, isLeftHandSideExpression, @@ -671,9 +906,9 @@ import { isTemplateSpan, isThisContainerOrFunctionBlock, isThisIdentifier, + isThisInTypeQuery, isThisInitializedDeclaration, isThisInitializedObjectBindingExpression, - isThisInTypeQuery, isThisProperty, isThisTypeParameter, isTransientSymbol, @@ -699,198 +934,60 @@ import { isValueSignatureDeclaration, isVarConst, isVariableDeclaration, - isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationInVariableStatement, + isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationList, isVariableLike, isVariableLikeOrAccessor, isVariableStatement, isWriteAccess, isWriteOnlyAccess, - IterableOrIteratorType, - IterationTypes, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocComment, - JSDocEnumTag, - JSDocFunctionType, - JSDocImplementsTag, - JSDocLink, - JSDocLinkCode, - JSDocLinkPlain, - JSDocMemberName, - JSDocNullableType, - JSDocOptionalType, - JSDocParameterTag, - JSDocPrivateTag, - JSDocPropertyLikeTag, - JSDocPropertyTag, - JSDocProtectedTag, - JSDocPublicTag, - JSDocSignature, - JSDocTemplateTag, - JSDocTypedefTag, - JSDocTypeExpression, - JSDocTypeLiteral, - 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, - MinusToken, - Modifier, - ModifierFlags, - modifiersToFlags, modifierToFlag, - ModuleBlock, - ModuleDeclaration, - ModuleInstanceState, - ModuleKind, - ModuleResolutionKind, - ModuleSpecifierResolutionHost, - NamedDeclaration, - NamedExports, - NamedImportsOrExports, - NamedTupleMember, - NamespaceDeclaration, - NamespaceExport, - NamespaceExportDeclaration, - NamespaceImport, + modifiersToFlags, needsScopeMarker, - NewExpression, - Node, - NodeArray, - NodeBuilderFlags, + noTruncationMaximumTruncationLength, 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, parseValidBigInt, - 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, @@ -900,67 +997,24 @@ import { setTextRange, setTextRangePosEnd, setValueDeclaration, - ShorthandPropertyAssignment, shouldAllowImportingTsExtension, 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, - TransientSymbolLinks, tryAddToSet, tryCast, tryExtractTSExtension, @@ -968,69 +1022,15 @@ 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 1e6935ca223fb..9e50fda25b629 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,39 +1,69 @@ import { AlternateModeDiagnostics, - append, - arrayFrom, ArrayLiteralExpression, - arrayToMap, - assign, BuildOptions, - changeExtension, CharacterCodes, - combinePaths, CommandLineOption, CommandLineOptionOfCustomType, CommandLineOptionOfListType, CompilerOptions, CompilerOptionsValue, ConfigFileSpecs, - containsPath, - convertToRelativePath, - createCompilerDiagnostic, - createDiagnosticForNodeInSourceFile, - createGetCanonicalFileName, 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, directorySeparator, emptyArray, endsWith, ensureTrailingDirectorySeparator, every, - Expression, extend, - Extension, - FileExtensionInfo, fileExtensionIs, fileExtensionIsOneOf, filter, @@ -62,7 +92,6 @@ import { getTsConfigPropArrayElementValue, hasExtension, hasProperty, - ImportsNotUsedAsValues, isArray, isArrayLiteralExpression, isComputedNonLiteralName, @@ -72,53 +101,24 @@ 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, stringContains, - 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 8be7299567361..61950cc5b2acb 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,11 +1,9 @@ import { - __String, CharacterCodes, Comparer, Comparison, Debug, EqualityComparer, - isWhiteSpaceLike, MapLike, Push, Queue, @@ -13,6 +11,8 @@ import { SortedReadonlyArray, TextSpan, UnderscoreEscapedMap, + __String, + isWhiteSpaceLike, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index ffbef3ef157c4..c33bf1f0f2bea 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -4,14 +4,39 @@ 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, @@ -20,22 +45,21 @@ import { getSourceTextOfNodeFromSourceFile, hasProperty, idText, - IntrinsicType, isArrayTypeNode, isBigIntLiteral, isCallSignatureDeclaration, isConditionalTypeNode, + isConstructSignatureDeclaration, isConstructorDeclaration, isConstructorTypeNode, - isConstructSignatureDeclaration, isDefaultClause, isFunctionTypeNode, isGeneratedIdentifier, isGetAccessorDeclaration, isIdentifier, isImportTypeNode, - isIndexedAccessTypeNode, isIndexSignatureDeclaration, + isIndexedAccessTypeNode, isInferTypeNode, isIntersectionTypeNode, isLiteralTypeNode, @@ -59,37 +83,13 @@ 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 9194f03407ee3..a4f79ff754221 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3,14 +3,12 @@ import { AccessorDeclaration, ArrayBindingPattern, ArrayLiteralExpression, - arrayToMap, ArrayTypeNode, ArrowFunction, AsExpression, AssertClause, AssertEntry, AwaitExpression, - base64encode, BigIntLiteral, BinaryExpression, BinaryOperatorToken, @@ -28,45 +26,26 @@ import { BundleFileTextLikeKind, CallExpression, CallSignatureDeclaration, - canHaveLocals, 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, @@ -74,32 +53,21 @@ 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, @@ -108,21 +76,9 @@ import { ExpressionWithTypeArguments, Extension, ExternalModuleReference, - factory, - fileExtensionIs, - fileExtensionIsOneOf, FileReference, - filter, - findIndex, - firstOrUndefined, - forEach, - forEachChild, - forEachLeadingCommentRange, - forEachTrailingCommentRange, ForInOrOfStatement, ForInStatement, - formatGeneratedName, - formatGeneratedNamePart, ForOfStatement, ForStatement, FunctionDeclaration, @@ -133,60 +89,11 @@ 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, HasLocals, - hasRecordedExternalHelpers, HeritageClause, Identifier, - idText, IfStatement, ImportClause, ImportDeclaration, @@ -194,62 +101,11 @@ import { ImportOrExportSpecifier, ImportSpecifier, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, + IndexedAccessTypeNode, 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, @@ -269,10 +125,10 @@ import { JSDocTag, JSDocTemplateTag, JSDocThisTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocVariadicType, JsxAttribute, JsxAttributes, @@ -289,18 +145,12 @@ import { JsxTagNameExpression, JsxText, LabeledStatement, - last, - lastOrUndefined, LateBoundDeclaration, - length, ListFormat, LiteralExpression, LiteralLikeNode, LiteralTypeNode, - makeIdentifierFromModuleName, MappedTypeNode, - maybeBind, - memoize, MetaProperty, MethodDeclaration, MethodSignature, @@ -322,18 +172,11 @@ import { Node, NodeArray, NodeFlags, - nodeIsSynthesized, - noEmitNotification, - noEmitSubstitution, NonNullExpression, - normalizePath, - normalizeSlashes, - notImplemented, NumericLiteral, ObjectBindingPattern, ObjectLiteralExpression, OptionalTypeNode, - outFile, OutputFile, ParameterDeclaration, ParenthesizedExpression, @@ -341,13 +184,11 @@ import { ParsedCommandLine, PartiallyEmittedExpression, Placeholder, - positionIsSynthesized, - positionsAreOnSameLine, PostfixUnaryExpression, PrefixUnaryExpression, + PrintHandlers, Printer, PrinterOptions, - PrintHandlers, PrivateIdentifier, ProgramBuildInfo, ProgramBundleEmitBuildInfo, @@ -357,33 +198,14 @@ 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, @@ -392,17 +214,13 @@ import { SourceMapSource, SpreadAssignment, SpreadElement, - stableSort, Statement, - stringContains, StringLiteral, - supportedJSExtensionsFlat, SwitchStatement, Symbol, SymbolFlags, SyntaxKind, SynthesizedComment, - sys, TabStop, TaggedTemplateExpression, TemplateExpression, @@ -411,12 +229,7 @@ import { TemplateSpan, TextRange, ThrowStatement, - tokenToString, - tracing, TransformationResult, - transformNodes, - tryCast, - tryParseRawSourceMap, TryStatement, TupleTypeNode, TypeAliasDeclaration, @@ -442,10 +255,197 @@ import { VoidExpression, WhileStatement, WithStatement, - writeCommentRange, - writeFile, WriteFileCallbackData, YieldExpression, + arrayToMap, + base64encode, + canHaveLocals, + 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, + tryCast, + tryParseRawSourceMap, + writeCommentRange, + writeFile, } 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 019d3b9e27477..600de9bb0dff7 100644 --- a/src/compiler/factory/baseNodeFactory.ts +++ b/src/compiler/factory/baseNodeFactory.ts @@ -1,7 +1,7 @@ import { Node, - objectAllocator, SyntaxKind, + objectAllocator, } from "../_namespaces/ts"; /** diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index faa93c77be83a..63b764018c495 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -1,12 +1,8 @@ import { - __String, ArrayLiteralExpression, - arrayToMap, BindingOrAssignmentElement, Block, - compareValues, Comparison, - createExpressionFromEntityName, Debug, EmitFlags, EmitHelper, @@ -16,22 +12,26 @@ 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 1fa3027f660b4..2bb7140bc60d9 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 e506391a78b78..66c8170f03e9f 100644 --- a/src/compiler/factory/nodeConverters.ts +++ b/src/compiler/factory/nodeConverters.ts @@ -5,11 +5,16 @@ import { BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, Block, - cast, ConciseBody, Debug, Expression, FunctionDeclaration, + NodeConverters, + NodeFactory, + ObjectBindingOrAssignmentElement, + ObjectBindingOrAssignmentPattern, + SyntaxKind, + cast, getStartsOnNewLine, isArrayBindingPattern, isArrayLiteralExpression, @@ -22,15 +27,10 @@ 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 99811f7a315f1..6a31a2d99b78c 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1,8 +1,4 @@ import { - __String, - addRange, - append, - appendIfUnique, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, @@ -41,7 +37,6 @@ import { CaseBlock, CaseClause, CaseOrDefaultClause, - cast, CatchClause, ClassDeclaration, ClassElement, @@ -55,14 +50,10 @@ import { ConciseBody, ConditionalExpression, ConditionalTypeNode, + ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, ContinueStatement, - createBaseNodeFactory, - createNodeConverters, - createParenthesizerRules, - createScanner, Debug, DebuggerStatement, Declaration, @@ -76,7 +67,6 @@ import { ElementAccessExpression, EmitFlags, EmitNode, - emptyArray, EmptyStatement, EndOfDeclarationMarker, EndOfFileToken, @@ -84,8 +74,6 @@ import { EnumDeclaration, EnumMember, EqualsGreaterThanToken, - escapeLeadingUnderscores, - every, ExclamationToken, ExportAssignment, ExportDeclaration, @@ -96,11 +84,8 @@ import { ExternalModuleReference, FalseLiteral, FileReference, - findUseStrictPrologue, - forEach, - ForInitializer, ForInStatement, - formatGeneratedName, + ForInitializer, ForOfStatement, ForStatement, FunctionDeclaration, @@ -111,27 +96,9 @@ import { GeneratedNamePart, GeneratedPrivateIdentifier, GetAccessorDeclaration, - getAllUnscopedEmitHelpers, - getBuildInfo, - getCommentRange, - getElementsOfBindingOrAssignmentPattern, - getEmitFlags, - getJSDocTypeAliasName, - getLineAndCharacterOfPosition, - getNameOfDeclaration, - getNodeId, - getSourceMapRange, - getSyntheticLeadingComments, - getSyntheticTrailingComments, - getTargetOfBindingOrAssignmentElement, - getTextOfIdentifierOrLiteral, - hasInvalidEscape, HasModifiers, - hasProperty, - hasSyntacticModifier, HeritageClause, Identifier, - idText, IfStatement, ImportClause, ImportDeclaration, @@ -139,85 +106,12 @@ import { ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, + IndexedAccessTypeNode, 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, - isGeneratedPrivateIdentifier, - 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, @@ -233,8 +127,8 @@ import { JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, - JSDocNamepathType, JSDocNameReference, + JSDocNamepathType, JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, @@ -257,17 +151,17 @@ import { JSDocThisTag, JSDocThrowsTag, JSDocType, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, JsxAttribute, JsxAttributeLike, - JsxAttributes, JsxAttributeValue, + JsxAttributes, JsxChild, JsxClosingElement, JsxClosingFragment, @@ -286,15 +180,11 @@ import { KeywordTypeSyntaxKind, LabeledStatement, LanguageVariant, - lastOrUndefined, LeftHandSideExpression, LiteralToken, LiteralTypeNode, - map, MappedTypeNode, MemberName, - memoize, - memoizeOne, MergeDeclarationMarker, MetaProperty, MethodDeclaration, @@ -304,7 +194,6 @@ import { Modifier, ModifierFlags, ModifierLike, - modifiersToFlags, ModifierSyntaxKind, ModifierToken, ModuleBlock, @@ -324,20 +213,16 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, + NoSubstitutionTemplateLiteral, Node, NodeArray, NodeFactory, NodeFlags, - nodeIsSynthesized, NonNullChain, NonNullExpression, - NoSubstitutionTemplateLiteral, NotEmittedStatement, NullLiteral, - nullNodeConverters, - nullParenthesizerRules, NumericLiteral, - objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -348,7 +233,6 @@ import { ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, - parseNodeFactory, PartiallyEmittedExpression, Path, PlusToken, @@ -368,7 +252,6 @@ import { PropertyNameLiteral, PropertySignature, PseudoBigInt, - pseudoBigIntToString, PunctuationSyntaxKind, PunctuationToken, Push, @@ -377,37 +260,22 @@ import { QuestionToken, ReadonlyKeyword, RedirectInfo, - reduceLeft, RegularExpressionLiteral, RestTypeNode, ReturnStatement, - returnTrue, - sameFlatMap, SatisfiesExpression, Scanner, ScriptTarget, SemicolonClassElement, SetAccessorDeclaration, - setEachParent, - setEmitFlags, - setParent, - setTextRange, - setTextRangePosWidth, ShorthandPropertyAssignment, SignatureDeclarationBase, - singleOrUndefined, - skipOuterExpressions, - skipParentheses, - some, SourceFile, SourceMapSource, SpreadAssignment, SpreadElement, - startOnNewLine, - startsWith, Statement, StringLiteral, - stringToToken, SuperExpression, SwitchStatement, SyntaxKind, @@ -461,12 +329,144 @@ import { VariableDeclaration, VariableDeclarationList, VariableStatement, - visitNode, VisitResult, VoidExpression, WhileStatement, WithStatement, YieldExpression, + __String, + addRange, + append, + appendIfUnique, + 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, + 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, + isGeneratedPrivateIdentifier, + 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, + 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 874b443d9bdc5..dde28c02484bb 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -33,9 +33,9 @@ import { ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, + ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, ContinueStatement, DebuggerStatement, Decorator, @@ -74,8 +74,8 @@ import { ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, + IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, @@ -93,8 +93,8 @@ import { JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, - JSDocNamepathType, JSDocNameReference, + JSDocNamepathType, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, @@ -112,10 +112,10 @@ import { JSDocTemplateTag, JSDocThisTag, JSDocThrowsTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, @@ -149,9 +149,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 119ad2953a195..c1c0f96a8d4fd 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -2,11 +2,22 @@ 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, @@ -33,21 +44,10 @@ 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 40075da95e036..daa2aa0b69b9f 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1,6 +1,5 @@ import { AccessorDeclaration, - addEmitFlags, AdditiveOperator, AdditiveOperatorOrHigher, AssertionLevel, @@ -18,7 +17,6 @@ import { BooleanLiteral, CharacterCodes, CommaListExpression, - compareStringsCaseSensitive, CompilerOptions, Debug, Declaration, @@ -34,20 +32,81 @@ 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, @@ -58,15 +117,7 @@ import { getOriginalNode, getParseTreeNode, getSourceTextOfNodeFromSourceFile, - HasIllegalDecorators, - HasIllegalModifiers, - HasIllegalType, - HasIllegalTypeParameters, - Identifier, idText, - ImportCall, - ImportDeclaration, - ImportEqualsDeclaration, isAssignmentExpression, isAssignmentOperator, isBlock, @@ -105,67 +156,16 @@ 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 8afd72574c0fb..66b71eaa6a0b9 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 4bf80337bf530..17b4117e8a69b 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,32 +1,52 @@ import { + CharacterCodes, + CommandLineOption, + Comparison, + CompilerOptions, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + Extension, + GetCanonicalFileName, + GetEffectiveTypeRootsHost, + MapLike, + MatchingKeys, + ModuleKind, + ModuleResolutionHost, + ModuleResolutionKind, + PackageId, + Path, + Pattern, + Push, + ResolutionMode, + ResolutionNameAndModeGetter, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + SourceFile, + Version, + VersionRange, append, appendIfUnique, arrayFrom, arrayIsEqualTo, changeAnyExtension, - CharacterCodes, combinePaths, - CommandLineOption, comparePaths, - Comparison, - CompilerOptions, concatenate, contains, containsPath, createCompilerDiagnostic, - Debug, deduplicate, - Diagnostic, - DiagnosticMessage, - DiagnosticReporter, - Diagnostics, directoryProbablyExists, directorySeparator, emptyArray, endsWith, ensureTrailingDirectorySeparator, every, - Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, @@ -36,11 +56,9 @@ import { forEachAncestorDirectory, formatMessage, getBaseFileName, - GetCanonicalFileName, getCommonSourceDirectory, getCompilerOptionValue, getDirectoryPath, - GetEffectiveTypeRootsHost, getEmitModuleKind, getEmitModuleResolutionKind, getNormalizedAbsolutePath, @@ -63,39 +81,23 @@ import { isString, lastOrUndefined, length, - MapLike, - matchedText, - MatchingKeys, matchPatternOrExact, - ModuleKind, - ModuleResolutionHost, - ModuleResolutionKind, + matchedText, moduleResolutionOptionDeclarations, noop, noopPush, normalizePath, normalizeSlashes, - PackageId, packageIdToString, - Path, pathIsRelative, - Pattern, patternText, perfLogger, - Push, readJson, removeExtension, removeFileExtension, removePrefix, - ResolutionMode, - ResolutionNameAndModeGetter, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, some, sort, - SourceFile, startsWith, stringContains, supportedDeclarationExtensions, @@ -106,9 +108,7 @@ import { tryGetExtensionFromPath, tryParsePatterns, version, - Version, versionMajorMinor, - VersionRange, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 351d98a24bd19..f6ea0badd4b5d 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -1,37 +1,60 @@ import { + AmbientModuleDeclaration, + CharacterCodes, + Comparison, + CompilerOptions, + Debug, + ExportAssignment, + Extension, + FileIncludeKind, + GetCanonicalFileName, + Identifier, + JsxEmit, + MapLike, + ModuleDeclaration, + ModuleKind, + ModulePath, + ModuleResolutionKind, + ModuleSpecifierCache, + ModuleSpecifierEnding, + 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, getModeForResolutionAtIndex, @@ -51,7 +74,6 @@ import { hasJSFileExtension, hasTSFileExtension, hostGetCanonicalFileName, - Identifier, isAmbientModule, isApplicableVersionedTypesKey, isDeclarationFileName, @@ -63,47 +85,25 @@ import { isRootedDiskPath, isSourceFile, isString, - JsxEmit, map, mapDefined, - MapLike, matchPatternOrExact, min, - ModuleDeclaration, - ModuleKind, - ModulePath, - ModuleResolutionKind, - ModuleSpecifierCache, - ModuleSpecifierEnding, - ModuleSpecifierOptions, - ModuleSpecifierResolutionHost, - NodeFlags, - NodeModulePathParts, normalizePath, - Path, pathContainsNodeModules, pathIsBareSpecifier, pathIsRelative, - PropertyAccessExpression, removeFileExtension, removeSuffix, - ResolutionMode, resolvePath, - ScriptKind, shouldAllowImportingTsExtension, 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 b7c335f09efb6..98ae84119fda7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,9 +1,6 @@ import * as ts from "./_namespaces/ts"; import { AccessorDeclaration, - addRange, - addRelatedInfo, - append, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, @@ -14,7 +11,6 @@ import { AssertEntry, AssertionLevel, AsteriskToken, - attachFileToDiagnostics, AwaitExpression, BaseNodeFactory, BinaryExpression, @@ -28,8 +24,6 @@ import { BreakStatement, CallExpression, CallSignatureDeclaration, - canHaveJSDoc, - canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, @@ -42,38 +36,26 @@ 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, - Diagnostics, DiagnosticWithDetachedLocation, + Diagnostics, DoStatement, DotDotDotToken, ElementAccessExpression, - emptyArray, - emptyMap, EndOfFileToken, - ensureScriptKind, EntityName, EnumDeclaration, EnumMember, @@ -85,9 +67,6 @@ import { ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, - fileExtensionIsOneOf, - findIndex, - forEach, ForEachChildNodes, ForInOrOfStatement, ForInStatement, @@ -98,20 +77,10 @@ import { FunctionOrConstructorTypeNode, FunctionTypeNode, GetAccessorDeclaration, - getBinaryOperatorPrecedence, - getFullWidth, - getJSDocCommentRanges, - getLanguageVariant, - getLastChild, - getLeadingCommentRanges, - getSpellingSuggestion, - getTextOfNodeFromSourceText, HasJSDoc, - hasJSDocNodes, HasModifiers, HeritageClause, Identifier, - idText, IfStatement, ImportClause, ImportDeclaration, @@ -120,42 +89,11 @@ import { ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, + IndexedAccessTypeNode, 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, @@ -195,10 +133,10 @@ import { JSDocText, JSDocThisTag, JSDocThrowsTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, @@ -206,8 +144,8 @@ import { JsonObjectExpressionStatement, JsonSourceFile, JsxAttribute, - JsxAttributes, JsxAttributeValue, + JsxAttributes, JsxChild, JsxClosingElement, JsxClosingFragment, @@ -225,13 +163,10 @@ import { JsxTokenSyntaxKind, LabeledStatement, LanguageVariant, - lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralLikeNode, LiteralTypeNode, - map, - mapDefined, MappedTypeNode, MemberExpression, MetaProperty, @@ -243,7 +178,6 @@ import { ModifierFlags, ModifierLike, ModifiersArray, - modifiersToFlags, ModuleBlock, ModuleDeclaration, ModuleKind, @@ -258,19 +192,14 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, + NoSubstitutionTemplateLiteral, Node, NodeArray, NodeFactoryFlags, NodeFlags, - nodeIsMissing, - nodeIsPresent, NonNullExpression, - noop, - normalizePath, - NoSubstitutionTemplateLiteral, NullLiteral, NumericLiteral, - objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -281,7 +210,6 @@ import { ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, - perfLogger, PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, @@ -314,22 +242,12 @@ import { ScriptKind, ScriptTarget, SetAccessorDeclaration, - setParent, - setParentRecursive, - setTextRange, - setTextRangePos, - setTextRangePosEnd, - setTextRangePosWidth, ShorthandPropertyAssignment, - skipTrivia, - some, SourceFile, SpreadAssignment, SpreadElement, - startsWith, Statement, StringLiteral, - supportedDeclarationExtensions, SwitchStatement, SyntaxKind, TaggedTemplateExpression, @@ -342,23 +260,13 @@ import { TemplateSpan, TemplateTail, TextChangeRange, - textChangeRangeIsUnchanged, - textChangeRangeNewSpan, TextRange, - textSpanEnd, - textToKeywordObj, ThisExpression, ThisTypeNode, ThrowStatement, - toArray, Token, TokenFlags, - tokenIsIdentifierOrKeyword, - tokenIsIdentifierOrKeywordOrGreaterThan, - tokenToString, - tracing, TransformFlags, - trimString, TryStatement, TupleTypeNode, TypeAliasDeclaration, @@ -383,6 +291,98 @@ import { WhileStatement, WithStatement, YieldExpression, + addRange, + addRelatedInfo, + append, + attachFileToDiagnostics, + canHaveJSDoc, + 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 b963c9e0cc929..e87e30aa4c3c2 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 166163784abee..1076eb2705baa 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -1,10 +1,10 @@ import { Debug, - noop, Performance, PerformanceHooks, - sys, System, + noop, + sys, timestamp, tryGetNativePerformanceHooks, } from "./_namespaces/ts"; diff --git a/src/compiler/performanceCore.ts b/src/compiler/performanceCore.ts index 9e20bddb69480..e124311b376f8 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 a9ac7f940e220..74c396975dadf 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,29 +1,123 @@ import * as ts from "./_namespaces/ts"; import { + AsExpression, + AssertClause, + BuilderProgram, + CancellationToken, + CommentDirective, + CommentDirectivesMap, + Comparison, + CompilerHost, + CompilerOptions, + CreateProgramOptions, + CreateSourceFileOptions, + CustomTransformers, + Debug, + DeclarationWithTypeParameterChildren, + DeprecationVersion, + 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, + ModeAwareCache, + ModeAwareCacheKey, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleResolutionCache, + ModuleResolutionHost, + 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, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SortedReadonlyArray, + SourceFile, + SourceOfProjectReferenceRedirect, + Statement, + StringLiteral, + StringLiteralLike, + StructureIsReused, + SymlinkCache, + SyntaxKind, + TsConfigSourceFile, + TypeChecker, + TypeReferenceDirectiveResolutionCache, + UnparsedSource, + VariableDeclaration, + VariableStatement, + WriteFileCallback, + WriteFileCallbackData, __String, addEmitFlags, addRange, append, arrayFrom, arrayIsEqualTo, - AsExpression, - AssertClause, - BuilderProgram, - CancellationToken, canHaveModifiers, chainDiagnosticMessages, changeExtension, - changesAffectingProgramStructure, changesAffectModuleResolution, + changesAffectingProgramStructure, combinePaths, - CommentDirective, - CommentDirectivesMap, compareDataObjects, comparePaths, compareValues, - Comparison, - CompilerHost, - CompilerOptions, computeLineAndCharacterOfPosition, concatenate, contains, @@ -44,50 +138,24 @@ import { createModeAwareCacheKey, createModuleResolutionCache, createMultiMap, - CreateProgramOptions, createSourceFile, - CreateSourceFileOptions, createSymlinkCache, createTypeChecker, createTypeReferenceDirectiveResolutionCache, - CustomTransformers, - Debug, - DeclarationWithTypeParameterChildren, - DeprecationVersion, - 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, @@ -101,11 +169,9 @@ import { forEachEmittedFile, forEachEntry, forEachKey, - FunctionLikeDeclaration, getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, getBaseFileName, - GetCanonicalFileName, getCommonSourceDirectoryOfConfig, getDefaultLibFileName, getDirectoryPath, @@ -132,8 +198,8 @@ import { getPositionOfLineAndCharacter, getPropertyArrayElementValue, getPropertyAssignment, - getResolvedModule, getResolveJsonModule, + getResolvedModule, getRootLength, getSetExternalModuleIndicator, getSpellingSuggestion, @@ -147,23 +213,15 @@ import { getTsConfigObjectLiteralExpression, getTsConfigPropArray, getTsConfigPropArrayElementValue, - HasChangedAutomaticTypeDirectiveNames, hasChangesInResolutions, hasExtension, - HasInvalidatedResolutions, hasJSDocNodes, hasJSFileExtension, hasJsonModuleEmitEnabled, hasProperty, hasSyntacticModifier, hasZeroOrOneAsteriskCharacter, - HeritageClause, - Identifier, identity, - ImportClause, - ImportDeclaration, - ImportOrExportSpecifier, - InputFiles, inverseJsxOptionMap, isAmbientModule, isAnyImportOrReExport, @@ -182,8 +240,8 @@ import { isImportEqualsDeclaration, isImportSpecifier, isImportTypeNode, - isIncrementalCompilation, isInJSFile, + isIncrementalCompilation, isLiteralImportTypeNode, isModifier, isModuleDeclaration, @@ -196,8 +254,6 @@ import { isStringLiteral, isStringLiteralLike, isTraceEnabled, - JsonSourceFile, - JsxEmit, length, libMap, libs, @@ -205,73 +261,34 @@ import { mapDefinedIterator, maybeBind, memoize, - MethodDeclaration, - ModeAwareCache, - ModeAwareCacheKey, - ModifierFlags, - ModifierLike, - ModuleBlock, - ModuleDeclaration, - ModuleKind, - ModuleResolutionCache, - ModuleResolutionHost, moduleResolutionIsEqualTo, - ModuleResolutionKind, moduleResolutionSupportsPackageJsonExportsAndImports, moduleResolutionSupportsResolvingTsExtensions, - Mutable, - Node, - NodeArray, - NodeFlags, + noTransformers, nodeModulesPathPart, - NodeWithTypeArguments, noop, normalizePath, notImplementedResolver, - noTransformers, - ObjectLiteralExpression, - OperationCanceledException, optionsHaveChanges, outFile, - PackageId, packageIdToPackageName, packageIdToString, - PackageJsonInfoCache, padLeft, - ParameterDeclaration, - ParseConfigFileHost, - ParsedCommandLine, parseIsolatedEntityName, parseJsonSourceFileConfigFileContent, parseNodeFactory, - Path, pathIsAbsolute, pathIsRelative, - Program, - ProgramHost, - ProjectReference, - ProjectReferenceFile, projectReferenceIsEqualTo, - PropertyDeclaration, - ReferencedFile, removeFileExtension, removePrefix, removeSuffix, resolutionExtensionIsTSOrJson, - ResolutionMode, resolveConfigFileProjectName, - ResolvedConfigFileName, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, resolveModuleName, resolveTypeReferenceDirective, returnFalse, returnUndefined, - SatisfiesExpression, - ScriptKind, - ScriptTarget, setParent, setParentRecursive, setResolvedModule, @@ -280,21 +297,12 @@ import { skipTypeChecking, some, sortAndDeduplicateDiagnostics, - SortedReadonlyArray, - SourceFile, sourceFileAffectingCompilerOptions, sourceFileMayBeEmitted, - SourceOfProjectReferenceRedirect, stableSort, startsWith, - Statement, stringContains, - StringLiteral, - StringLiteralLike, - StructureIsReused, supportedJSExtensionsFlat, - SymlinkCache, - SyntaxKind, sys, targetOptionDeclaration, toFileNameLowerCase, @@ -302,17 +310,9 @@ import { trace, tracing, trimStringEnd, - TsConfigSourceFile, - TypeChecker, typeDirectiveIsEqualTo, - TypeReferenceDirectiveResolutionCache, - UnparsedSource, - VariableDeclaration, - VariableStatement, versionMajorMinor, walkUpParenthesizedExpressions, - WriteFileCallback, - WriteFileCallbackData, writeFileEnsuringDirectories, zipToModeAwareCache, } from "./_namespaces/ts"; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 1f8d9e179fefb..dfb93c194abb7 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,38 +1,52 @@ import * as ts from "./_namespaces/ts"; import { - arrayToMap, CachedDirectoryStructureHost, CharacterCodes, + CompilerOptions, + Debug, + Diagnostics, + DirectoryWatcherCallback, + Extension, + FileReference, + FileWatcher, + FileWatcherCallback, + GetCanonicalFileName, + HasInvalidatedResolutions, + MinimalResolutionCacheHost, + ModeAwareCache, + ModuleResolutionCache, + PackageId, + Path, + Program, + ResolutionLoader, + ResolutionMode, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + SourceFile, + StringLiteralLike, + WatchDirectoryFlags, + arrayToMap, clearMap, closeFileWatcher, closeFileWatcherOf, - CompilerOptions, createModeAwareCache, createModuleResolutionCache, createMultiMap, createTypeReferenceDirectiveResolutionCache, createTypeReferenceResolutionLoader, - Debug, - Diagnostics, directorySeparator, - DirectoryWatcherCallback, emptyArray, emptyIterator, endsWith, - Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, - FileReference, - FileWatcher, - FileWatcherCallback, firstDefinedIterator, - GetCanonicalFileName, getDirectoryPath, getEffectiveTypeRoots, getNormalizedAbsolutePath, getRootLength, - HasInvalidatedResolutions, ignoredPaths, inferredTypesContainingFile, isEmittedFileOfProgram, @@ -43,36 +57,22 @@ import { isTraceEnabled, loadModuleFromGlobalCache, memoize, - MinimalResolutionCacheHost, - ModeAwareCache, - ModuleResolutionCache, moduleResolutionNameAndModeGetter, mutateMap, noopFileWatcher, normalizePath, - PackageId, packageIdToString, parseNodeModuleFromPath, - Path, pathContainsNodeModules, - Program, removeSuffix, removeTrailingDirectorySeparator, resolutionExtensionIsTSOrJson, - ResolutionLoader, - ResolutionMode, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, returnTrue, some, - SourceFile, startsWith, stringContains, - StringLiteralLike, trace, updateResolutionField, - WatchDirectoryFlags, } from "./_namespaces/ts"; /** diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index bdb2fe6ef239e..eec80e9eede43 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 b9c5864c0c042..77f3477327541 100644 --- a/src/compiler/semver.ts +++ b/src/compiler/semver.ts @@ -1,8 +1,8 @@ import { - compareStringsCaseSensitive, - compareValues, Comparison, Debug, + compareStringsCaseSensitive, + compareValues, emptyArray, every, isArray, diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index baf87fdd594c6..0ee96bf209fd5 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -1,14 +1,18 @@ import { - arrayFrom, - binarySearchKey, CharacterCodes, - combinePaths, - compareValues, Debug, DocumentPosition, DocumentPositionMapper, DocumentPositionMapperHost, EmitHost, + LineAndCharacter, + RawSourceMap, + SortedReadonlyArray, + SourceMapGenerator, + arrayFrom, + binarySearchKey, + combinePaths, + compareValues, emptyArray, every, getDirectoryPath, @@ -18,12 +22,8 @@ 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 591e19c8eb647..70fd4b0d75b2f 100644 --- a/src/compiler/symbolWalker.ts +++ b/src/compiler/symbolWalker.ts @@ -1,12 +1,8 @@ import { - clear, EntityNameOrEntityNameExpression, - forEach, - getOwnValues, - getSymbolId, Identifier, - IndexedAccessType, IndexType, + IndexedAccessType, InterfaceType, MappedType, Node, @@ -24,6 +20,10 @@ 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 097960d0e2634..8fea5eaae488a 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,20 +1,26 @@ 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, @@ -25,26 +31,20 @@ import { isNodeLikeSystem, isString, mapDefined, - matchesExclude, matchFiles, + matchesExclude, 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 4f091195827a8..6626294c00bc7 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -1,12 +1,9 @@ import { - combinePaths, ConditionalType, Debug, EvolvingArrayType, - getLineAndCharacterOfPosition, - getSourceFileOfNode, - IndexedAccessType, IndexType, + IndexedAccessType, IntersectionType, LineAndCharacter, Node, @@ -14,12 +11,15 @@ import { Path, ReverseMappedType, SubstitutionType, - timestamp, Type, TypeFlags, TypeReference, - unescapeLeadingUnderscores, UnionType, + combinePaths, + getLineAndCharacterOfPosition, + getSourceFileOfNode, + timestamp, + unescapeLeadingUnderscores, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 456a23a065577..eda2672939caa 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,16 +1,11 @@ import { - addRange, - append, Bundle, - chainBundle, CompilerOptions, - createEmitHelperFactory, CustomTransformer, CustomTransformerFactory, CustomTransformers, Debug, DiagnosticWithLocation, - disposeEmitNodes, EmitFlags, EmitHelper, EmitHint, @@ -18,42 +13,48 @@ 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, @@ -70,7 +71,6 @@ 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 50fb29df0a716..a065f7f3c6e18 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -1,10 +1,5 @@ import { - __String, AccessorDeclaration, - addEmitFlags, - addEmitHelpers, - addRange, - append, AssignmentOperator, AssignmentPattern, AutoAccessorPropertyDeclaration, @@ -12,37 +7,72 @@ 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, @@ -63,8 +93,6 @@ import { hasDecorators, hasStaticModifier, hasSyntacticModifier, - Identifier, - InKeyword, isAccessorModifier, isArrayLiteralExpression, isArrowFunction, @@ -117,27 +145,10 @@ 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, @@ -149,19 +160,9 @@ import { skipParentheses, skipPartiallyEmittedExpressions, some, - SourceFile, startOnNewLine, - Statement, - SuperProperty, - SyntaxKind, - TaggedTemplateExpression, - ThisExpression, - TransformationContext, - TransformFlags, tryGetTextOfPropertyName, - UnderscoreEscapedMap, unescapeLeadingUnderscores, - VariableStatement, visitArray, visitEachChild, visitFunctionBody, @@ -169,7 +170,6 @@ 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 a150c9204659e..665c2ecded638 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,60 +1,109 @@ 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, - declarationNameToString, - Diagnostics, DiagnosticWithLocation, + Diagnostics, EmitFlags, EmitHost, EmitResolver, - emptyArray, EntityNameOrEntityNameExpression, EnumDeclaration, ExportAssignment, ExportDeclaration, ExpressionWithTypeArguments, - factory, FileReference, - filter, - flatMap, - flatten, - forEach, 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, + filter, + flatMap, + flatten, + forEach, getCommentRange, getDirectoryPath, getEffectiveBaseTypeNode, @@ -74,7 +123,6 @@ import { getResolvedExternalModuleName, getSetAccessorValueParameter, getSourceFileOfNode, - GetSymbolAccessibilityDiagnostic, getTextOfNode, getThisParameter, getTrailingCommentRanges, @@ -82,15 +130,7 @@ import { hasEffectiveModifier, hasExtension, hasJSDocNodes, - HasModifiers, hasSyntacticModifier, - HeritageClause, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - ImportTypeNode, - IndexSignatureDeclaration, - InterfaceDeclaration, isAnyImportSyntax, isArray, isBindingPattern, @@ -141,75 +181,35 @@ 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 021a372123072..ca62ec25c82c6 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -1,8 +1,8 @@ import { BindingElement, CallSignatureDeclaration, - ConstructorDeclaration, ConstructSignatureDeclaration, + ConstructorDeclaration, Debug, Declaration, DeclarationName, @@ -11,15 +11,35 @@ import { ExpressionWithTypeArguments, FunctionDeclaration, GetAccessorDeclaration, - getNameOfDeclaration, - hasSyntacticModifier, ImportEqualsDeclaration, IndexSignatureDeclaration, + JSDocCallbackTag, + JSDocEnumTag, + JSDocTypedefTag, + MethodDeclaration, + MethodSignature, + ModifierFlags, + NamedDeclaration, + Node, + ParameterDeclaration, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + QualifiedName, + SetAccessorDeclaration, + SymbolAccessibility, + SymbolAccessibilityResult, + SyntaxKind, + TypeAliasDeclaration, + TypeParameterDeclaration, + VariableDeclaration, + getNameOfDeclaration, + hasSyntacticModifier, isBindingElement, isCallSignatureDeclaration, isClassDeclaration, - isConstructorDeclaration, isConstructSignatureDeclaration, + isConstructorDeclaration, isExpressionWithTypeArguments, isFunctionDeclaration, isGetAccessor, @@ -39,26 +59,6 @@ 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 2effd35cfc65f..0f3044b63462b 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -1,7 +1,4 @@ import { - __String, - addRange, - append, ArrayBindingElement, ArrayBindingOrAssignmentPattern, BindingElement, @@ -12,8 +9,23 @@ import { Debug, DestructuringAssignment, ElementAccessExpression, - every, Expression, + Identifier, + LeftHandSideExpression, + Node, + NodeFactory, + ObjectBindingOrAssignmentPattern, + ParameterDeclaration, + PropertyName, + TextRange, + TransformFlags, + TransformationContext, + VariableDeclaration, + VisitResult, + __String, + addRange, + append, + every, factory, forEach, getElementsOfBindingOrAssignmentPattern, @@ -21,7 +33,6 @@ import { getPropertyNameOfBindingOrAssignmentElement, getRestIndicatorOfBindingOrAssignmentElement, getTargetOfBindingOrAssignmentElement, - Identifier, idText, isArrayBindingElement, isArrayBindingOrAssignmentPattern, @@ -43,23 +54,12 @@ 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 ab5ea56408a4c..f36deb1aa5809 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1,12 +1,6 @@ import { - __String, AccessorDeclaration, - addEmitHelpers, - addRange, - addSyntheticLeadingComment, AllAccessorDeclarations, - append, - arrayIsEqualTo, ArrayLiteralExpression, ArrowFunction, BinaryExpression, @@ -18,38 +12,22 @@ 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, @@ -59,6 +37,73 @@ 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, @@ -74,9 +119,7 @@ import { getUseDefineForClassFields, hasStaticModifier, hasSyntacticModifier, - Identifier, idText, - IfStatement, insertStatementAfterCustomPrologue, insertStatementsAfterCustomPrologue, insertStatementsAfterStandardPrologue, @@ -128,38 +171,15 @@ 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, @@ -169,41 +189,21 @@ 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 33df5b94f0d0b..ce6353ff8b0f0 100644 --- a/src/compiler/transformers/es2016.ts +++ b/src/compiler/transformers/es2016.ts @@ -1,20 +1,20 @@ import { BinaryExpression, Bundle, - chainBundle, Expression, - isElementAccessExpression, - isExpression, - isPropertyAccessExpression, Node, - setTextRange, SourceFile, SyntaxKind, - TransformationContext, TransformFlags, + TransformationContext, + VisitResult, + chainBundle, + isElementAccessExpression, + isExpression, + isPropertyAccessExpression, + setTextRange, visitEachChild, visitNode, - VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 4c7a90fa6944e..e38bcab33932d 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -1,20 +1,13 @@ import { - __String, AccessorDeclaration, - addEmitHelper, - addEmitHelpers, - advancedAsyncSuperHelper, ArrowFunction, - asyncSuperHelper, AwaitExpression, BindingElement, Block, Bundle, CallExpression, CatchClause, - chainBundle, ClassDeclaration, - concatenate, ConciseBody, ConstructorDeclaration, Debug, @@ -23,9 +16,8 @@ import { EmitHint, EmitResolver, Expression, - forEach, - ForInitializer, ForInStatement, + ForInitializer, ForOfStatement, ForStatement, FunctionBody, @@ -35,6 +27,37 @@ 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, @@ -59,42 +82,19 @@ 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 296cfaeae2fca..f3144fc4ee9eb 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -1,34 +1,20 @@ 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, @@ -40,11 +26,55 @@ 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, @@ -65,51 +95,21 @@ 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 0bd2be45422a4..921c13c4be80f 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, - TransformationContext, TransformFlags, + TransformationContext, + VisitResult, + chainBundle, + isBlock, visitEachChild, visitNode, - VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2020.ts b/src/compiler/transformers/es2020.ts index b030dca03ce5c..dae72e5bef773 100644 --- a/src/compiler/transformers/es2020.ts +++ b/src/compiler/transformers/es2020.ts @@ -1,15 +1,24 @@ 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, @@ -20,22 +29,13 @@ 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 c521cf00bc7f0..903adf52ea469 100644 --- a/src/compiler/transformers/es2021.ts +++ b/src/compiler/transformers/es2021.ts @@ -2,6 +2,14 @@ import { AssignmentExpression, BinaryExpression, Bundle, + LogicalOrCoalescingAssignmentOperator, + Node, + SourceFile, + SyntaxKind, + Token, + TransformFlags, + TransformationContext, + VisitResult, chainBundle, getNonAssignmentOperatorForCompoundAssignment, isAccessExpression, @@ -10,17 +18,9 @@ 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 199cfa582327e..d4f046418529f 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 730958dae1e00..bf56eec9b073b 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -1,12 +1,12 @@ import { Bundle, - chainBundle, Node, SourceFile, - TransformationContext, TransformFlags, - visitEachChild, + TransformationContext, VisitResult, + chainBundle, + visitEachChild, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 86abe24d056d0..c8265d760f6ea 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -1,7 +1,5 @@ import { AccessorDeclaration, - addEmitHelpers, - addSyntheticTrailingComment, ArrayLiteralExpression, Associativity, BinaryExpression, @@ -10,11 +8,9 @@ import { Bundle, CallExpression, CaseClause, - chainBundle, CommaListExpression, ConditionalExpression, ContinueStatement, - createExpressionForObjectLiteralElementLike, Debug, DoStatement, ElementAccessExpression, @@ -22,11 +18,46 @@ 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, @@ -34,10 +65,7 @@ import { getNonAssignmentOperatorForCompoundAssignment, getOriginalNode, getOriginalNodeId, - Identifier, idText, - IfStatement, - InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, isBinaryExpression, isBlock, @@ -52,49 +80,21 @@ 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 2dab57966eef6..34797c4d5ce23 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -1,19 +1,47 @@ 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, @@ -21,9 +49,7 @@ import { getLineAndCharacterOfPosition, getOriginalNode, getSemanticJsxChildren, - Identifier, idText, - ImportSpecifier, insertStatementAfterCustomPrologue, isExpression, isExternalModule, @@ -39,43 +65,17 @@ 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 976e0705e730b..40515d2f50555 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -1,27 +1,44 @@ 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, @@ -30,7 +47,6 @@ import { hasAccessorModifier, hasDecorators, hasSyntacticModifier, - Identifier, idText, isBindingName, isBlock, @@ -49,18 +65,8 @@ import { isSimpleInlineableExpression, isStatic, map, - MethodDeclaration, - ModifierFlags, moveRangePastModifiers, - Node, - NodeArray, - NodeCheckFlags, - NodeFlags, nodeOrChildIsDecorated, - ParameterDeclaration, - PropertyDeclaration, - ScriptTarget, - SetAccessorDeclaration, setCommentRange, setEmitFlags, setOriginalNode, @@ -68,15 +74,9 @@ 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 c6d065a77b88f..312c70d3bba79 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -1,10 +1,5 @@ import { - addRange, - append, Bundle, - chainBundle, - createEmptyExports, - createExternalHelpersImportDeclarationIfNeeded, Debug, EmitFlags, EmitHint, @@ -12,15 +7,31 @@ 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, @@ -30,23 +41,12 @@ 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 0a0a1473ade2a..a21714ccfb7b1 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,41 +1,71 @@ 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, @@ -49,12 +79,7 @@ import { getTextOfIdentifierOrLiteral, hasJsonModuleEmitEnabled, hasSyntacticModifier, - Identifier, idText, - ImportCall, - ImportDeclaration, - ImportEqualsDeclaration, - InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, isArrowFunction, @@ -95,44 +120,19 @@ 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 576c15fe6597e..a0f6a89ad8caa 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 c773832382369..c1af3e9cc98ee 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,6 +1,4 @@ import { - addRange, - append, BinaryExpression, BindingElement, Block, @@ -9,9 +7,7 @@ import { CaseClause, CaseOrDefaultClause, CatchClause, - chainBundle, ClassDeclaration, - collectExternalModuleInfo, Debug, Declaration, DefaultClause, @@ -25,15 +21,51 @@ import { Expression, ExpressionStatement, ExternalModuleInfo, - firstOrUndefined, - flattenDestructuringAssignment, FlattenLevel, - forEach, - ForInitializer, ForInStatement, + ForInitializer, 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, @@ -44,11 +76,7 @@ import { getStrictOptionValue, getTextOfIdentifierOrLiteral, hasSyntacticModifier, - Identifier, idText, - ImportCall, - ImportDeclaration, - ImportEqualsDeclaration, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, isAssignmentExpression, @@ -86,48 +114,20 @@ 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 041e0adf84acb..dd0f9ef96db50 100644 --- a/src/compiler/transformers/taggedTemplate.ts +++ b/src/compiler/transformers/taggedTemplate.ts @@ -2,15 +2,8 @@ import { CallExpression, Debug, Expression, - factory, - getSourceTextOfNodeFromSourceFile, - hasInvalidEscape, Identifier, - isExpression, - isExternalModule, - isNoSubstitutionTemplateLiteral, NoSubstitutionTemplateLiteral, - setTextRange, SourceFile, SyntaxKind, TaggedTemplateExpression, @@ -19,9 +12,16 @@ 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 1b27a345ce67b..3d4400dc38445 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1,36 +1,21 @@ 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, @@ -41,16 +26,80 @@ import { ExportSpecifier, Expression, ExpressionWithTypeArguments, - filter, - findSuperStatementIndex, - firstOrUndefined, - flatMap, - flattenDestructuringAssignment, 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, getAllDecoratorsOfClass, getAllDecoratorsOfClassElement, getEffectiveBaseTypeNode, @@ -67,15 +116,7 @@ import { hasDecorators, hasStaticModifier, hasSyntacticModifier, - HeritageClause, - Identifier, idText, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportsNotUsedAsValues, - ImportSpecifier, - InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, isAccessExpression, isArray, @@ -119,45 +160,16 @@ 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, @@ -171,24 +183,13 @@ 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, @@ -196,7 +197,6 @@ import { visitNode, visitNodes, visitParameterList, - VisitResult, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/typeSerializer.ts b/src/compiler/transformers/typeSerializer.ts index ca773490be011..37e757a7d4332 100644 --- a/src/compiler/transformers/typeSerializer.ts +++ b/src/compiler/transformers/typeSerializer.ts @@ -11,9 +11,35 @@ 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, @@ -22,7 +48,6 @@ import { getRestParameterElementType, getSetAccessorTypeAnnotationNode, getStrictOptionValue, - Identifier, isAsyncFunction, isBinaryExpression, isClassLike, @@ -38,36 +63,11 @@ 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 90ef9bffb7f9d..8705633a4cb18 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -1,11 +1,9 @@ import { AccessorDeclaration, AllDecorators, - append, BinaryOperator, BindingElement, Bundle, - cast, ClassDeclaration, ClassElement, ClassExpression, @@ -14,17 +12,43 @@ 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, @@ -34,13 +58,7 @@ import { hasDecorators, hasStaticModifier, hasSyntacticModifier, - Identifier, idText, - ImportDeclaration, - ImportEqualsDeclaration, - ImportSpecifier, - InitializedPropertyDeclaration, - InternalSymbolName, isAutoAccessorPropertyDeclaration, isBindingPattern, isClassStaticBlockDeclaration, @@ -58,28 +76,10 @@ 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 dedf7e4729945..c192abeb6cc0b 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1,8 +1,8 @@ import { - combinePaths, Extension, - fileExtensionIs, ResolvedConfigFileName, + combinePaths, + fileExtensionIs, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index d67b8bb3f2cd4..26aae13f0d59f 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -1,21 +1,64 @@ import * as ts from "./_namespaces/ts"; import { AffectedFileResult, - arrayToMap, - assertType, - BuilderProgram, BuildInfo, + BuilderProgram, CancellationToken, + CompilerHost, + CompilerOptions, + CompilerOptionsValue, + ConfigFileProgramReloadLevel, + CreateProgram, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCollection, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + EmitAndSemanticDiagnosticsBuilderProgram, + EmitResult, + ExitStatus, + ExtendedConfigCacheEntry, + FileWatcher, + FileWatcherCallback, + ForegroundColorEscapeSequences, + ModuleResolutionCache, + OutputFile, + ParseConfigFileHost, + ParsedCommandLine, + Path, + PollingInterval, + Program, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProgramHost, + ProgramMultiFileEmitBuildInfo, + ReadBuildProgramHost, + ResolvedConfigFileName, + SemanticDiagnosticsBuilderProgram, + SharedExtendedConfigFileWatcher, + SourceFile, + Status, + System, + TypeReferenceDirectiveResolutionCache, + UpToDateStatus, + UpToDateStatusType, + WatchFactory, + WatchHost, + WatchOptions, + WatchStatusReporter, + WatchType, + WildcardDirectoryWatcher, + WriteFileCallback, + arrayToMap, + assertType, canJsonReportNoInputFiles, changeCompilerHostLikeToUseCache, clearMap, closeFileWatcher, closeFileWatcherOf, commonOptionsWithBuild, - CompilerHost, - CompilerOptions, - CompilerOptionsValue, - ConfigFileProgramReloadLevel, convertToRelativePath, copyProperties, createCompilerDiagnostic, @@ -24,32 +67,17 @@ import { createDiagnosticReporter, createModuleResolutionCache, createModuleResolutionLoader, - CreateProgram, createProgramHost, createTypeReferenceDirectiveResolutionCache, createTypeReferenceResolutionLoader, 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, @@ -78,53 +106,25 @@ import { map, maybeBind, missingFileModifiedTime, - ModuleResolutionCache, mutateMap, mutateMapSkippingNewValues, noop, outFile, - OutputFile, - ParseConfigFileHost, parseConfigHostFromCompilerHostLike, - ParsedCommandLine, - Path, - PollingInterval, - Program, - ProgramBuildInfo, - ProgramBundleEmitBuildInfo, - ProgramHost, - ProgramMultiFileEmitBuildInfo, readBuilderProgram, - ReadBuildProgramHost, resolveConfigFileProjectName, - ResolvedConfigFileName, resolvePath, resolveProjectReferencePath, 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 56b18ff90056d..d7fca64c11cf8 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,29 +1,21 @@ import { - __String, AccessExpression, AccessorDeclaration, - addRange, - affectsDeclarationPathOptionDeclarations, - affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, AnyImportOrBareOrAccessedRequire, AnyImportOrReExport, AnyImportSyntax, AnyValidImportOrReExport, - append, - arrayFrom, ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AssertionExpression, - assertType, AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, BinaryExpression, - binarySearch, BindableObjectDefinePropertyCall, BindableStaticAccessExpression, BindableStaticElementAccessExpression, @@ -36,47 +28,28 @@ import { CallExpression, CallLikeExpression, CallSignatureDeclaration, - canHaveDecorators, - canHaveIllegalDecorators, - canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, CatchClause, - changeAnyExtension, CharacterCodes, CheckFlags, ClassDeclaration, ClassElement, ClassLikeDeclaration, ClassStaticBlockDeclaration, - combinePaths, CommaListExpression, CommandLineOption, CommentDirective, - CommentDirectivesMap, CommentDirectiveType, + CommentDirectivesMap, CommentRange, - compareStringsCaseSensitive, - compareValues, Comparison, CompilerOptions, ComputedPropertyName, - computeLineAndCharacterOfPosition, - computeLineOfPosition, - computeLineStarts, - concatenate, ConditionalExpression, - ConstructorDeclaration, ConstructSignatureDeclaration, - contains, - containsPath, - createGetCanonicalFileName, - createModeAwareCache, - createMultiMap, - createScanner, - createTextSpan, - createTextSpanFromBounds, + ConstructorDeclaration, Debug, Declaration, DeclarationName, @@ -90,10 +63,9 @@ import { DiagnosticMessage, DiagnosticMessageChain, DiagnosticRelatedInformation, - Diagnostics, DiagnosticWithDetachedLocation, DiagnosticWithLocation, - directorySeparator, + Diagnostics, DoStatement, DynamicNamedBinaryExpression, DynamicNamedDeclaration, @@ -102,19 +74,12 @@ import { EmitHost, EmitResolver, EmitTextWriter, - emptyArray, - ensurePathIsNonModuleName, - ensureTrailingDirectorySeparator, EntityName, EntityNameExpression, EntityNameOrEntityNameExpression, EnumDeclaration, EqualityComparer, - equalOwnProperties, EqualsToken, - equateValues, - escapeLeadingUnderscores, - every, ExportAssignment, ExportDeclaration, ExportSpecifier, @@ -123,11 +88,243 @@ import { ExpressionWithTypeArguments, Extension, ExternalModuleReference, - factory, FileExtensionInfo, + FileWatcher, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + GetCanonicalFileName, + HasExpressionInitializer, + HasFlowNode, + HasInitializer, + HasJSDoc, + HasModifiers, + HasType, + HasTypeArguments, + HeritageClause, + Identifier, + IdentifierTypePredicate, + IfStatement, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportMetaProperty, + ImportSpecifier, + ImportTypeNode, + IndexInfo, + IndexSignatureDeclaration, + 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, + MethodSignature, + 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, + PropertySignature, + PseudoBigInt, + QualifiedName, + ReadonlyCollection, + ReadonlyTextRange, + RequireOrImportCall, + RequireVariableStatement, + ResolutionMode, + ResolutionNameAndModeGetter, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + ReturnStatement, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SnippetKind, + 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, + UserPreferences, + ValidImportTypeNode, + VariableDeclaration, + VariableDeclarationInitializedTo, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, + WhileStatement, + WithStatement, + WriteFileCallback, + WriteFileCallbackData, + YieldExpression, + __String, + addRange, + affectsDeclarationPathOptionDeclarations, + affectsEmitOptionDeclarations, + append, + 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, fileExtensionIs, fileExtensionIsOneOf, - FileWatcher, filter, find, findAncestor, @@ -143,17 +340,7 @@ import { forEachAncestorDirectory, forEachChild, forEachChildRecursively, - ForInOrOfStatement, - ForInStatement, - ForOfStatement, - ForStatement, - FunctionBody, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, getBaseFileName, - GetCanonicalFileName, getCombinedModifierFlags, getCombinedNodeFlags, getDirectoryPath, @@ -176,8 +363,8 @@ import { getJSDocTypeTag, getLeadingCommentRanges, getLineAndCharacterOfPosition, - getLinesBetweenPositions, getLineStarts, + getLinesBetweenPositions, getNameOfDeclaration, getNormalizedAbsolutePath, getNormalizedPathComponents, @@ -191,37 +378,15 @@ import { getStringComparer, getSymbolId, getTrailingCommentRanges, - HasExpressionInitializer, hasExtension, - HasFlowNode, - HasInitializer, hasInitializer, - HasJSDoc, hasJSDocNodes, - HasModifiers, hasProperty, - HasType, - HasTypeArguments, - HeritageClause, - Identifier, - IdentifierTypePredicate, - identity, idText, - IfStatement, + identity, ignoredPaths, - ImportCall, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, - ImportMetaProperty, - ImportSpecifier, - ImportTypeNode, - IndexInfo, indexOfAnyCharCode, - IndexSignatureDeclaration, - InitializedVariableDeclaration, insertSorted, - InterfaceDeclaration, isAccessor, isAnyDirectorySeparator, isArray, @@ -328,207 +493,42 @@ 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, - MethodSignature, - 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, - PropertySignature, - PseudoBigInt, - QualifiedName, - ReadonlyCollection, - ReadonlyTextRange, removeTrailingDirectorySeparator, - RequireOrImportCall, - RequireVariableStatement, - ResolutionMode, - ResolutionNameAndModeGetter, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, - ReturnStatement, - SatisfiesExpression, - ScriptKind, - ScriptTarget, semanticDiagnosticsOptionDeclarations, - SetAccessorDeclaration, - ShorthandPropertyAssignment, shouldAllowImportingTsExtension, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureKind, singleElementArray, singleOrUndefined, skipOuterExpressions, skipTrivia, - SnippetKind, some, sort, - SortedArray, - SourceFile, - SourceFileLike, - SourceFileMayBeEmittedHost, - SourceMapSource, startsWith, startsWithUseStrict, - Statement, stringContains, - StringLiteral, - StringLiteralLike, stringToToken, - SuperCall, - SuperExpression, - SuperProperty, - SwitchStatement, - Symbol, - SymbolFlags, - SymbolTable, - SyntaxKind, - SyntaxList, sys, - TaggedTemplateExpression, - TemplateLiteral, - TemplateLiteralLikeNode, - TemplateLiteralTypeSpan, - TemplateSpan, - TextRange, - TextSpan, - ThisTypePredicate, - Token, - TokenFlags, - tokenToString, toPath, + tokenToString, 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, - UserPreferences, - 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 c2f8f7ac9e1ea..18f39aff2e8a5 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1,5 +1,4 @@ import { - __String, AccessExpression, AccessorDeclaration, ArrayBindingElement, @@ -23,21 +22,15 @@ import { CallChain, CallExpression, CallLikeExpression, - canHaveIllegalTypeParameters, - canHaveJSDoc, CaseOrDefaultClause, CharacterCodes, ClassElement, ClassLikeDeclaration, ClassStaticBlockDeclaration, - combinePaths, - compareDiagnostics, CompilerOptions, ConciseBody, ConstructorDeclaration, ConstructorTypeNode, - contains, - createCompilerDiagnostic, Debug, Declaration, DeclarationName, @@ -48,44 +41,26 @@ import { Diagnostics, ElementAccessChain, ElementAccessExpression, - emptyArray, EntityName, - entityNameToString, EnumDeclaration, - every, ExportAssignment, ExportSpecifier, Expression, FileReference, - filter, - find, - flatMap, - ForInitializer, ForInOrOfStatement, + ForInitializer, FunctionBody, FunctionLikeDeclaration, FunctionTypeNode, GeneratedIdentifier, GeneratedPrivateIdentifier, GetAccessorDeclaration, - getAssignmentDeclarationKind, - getDirectoryPath, - getEffectiveModifierFlags, - getEffectiveModifierFlagsAlwaysIncludeJSDoc, - getElementOrPropertyAccessArgumentExpressionOrName, - getEmitScriptTarget, - getJSDocCommentsAndTags, - getJSDocTypeParameterDeclarations, - hasAccessorModifier, - hasDecorators, HasDecorators, HasExpressionInitializer, HasInitializer, HasJSDoc, HasLocals, HasModifiers, - hasProperty, - hasSyntacticModifier, HasType, Identifier, ImportClause, @@ -93,70 +68,6 @@ 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, - isJSDocOverloadTag, - 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, @@ -181,15 +92,14 @@ import { JSDocTag, JSDocTemplateTag, JSDocThisTag, - JSDocTypedefTag, JSDocTypeTag, + JSDocTypedefTag, JsxAttributeLike, JsxChild, JsxExpression, JsxOpeningLikeElement, JsxTagNameExpression, LabeledStatement, - lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralToken, @@ -198,7 +108,6 @@ import { Modifier, ModifierFlags, ModifierLike, - modifierToFlag, ModuleBody, ModuleDeclaration, ModuleReference, @@ -212,7 +121,6 @@ import { NodeArray, NodeFlags, NonNullChain, - normalizePath, NotEmittedStatement, ObjectBindingOrAssignmentElement, ObjectBindingOrAssignmentPattern, @@ -223,7 +131,6 @@ import { OuterExpressionKinds, ParameterDeclaration, PartiallyEmittedExpression, - pathIsRelative, PostfixUnaryExpression, PrefixUnaryExpression, PrivateClassElementDeclaration, @@ -237,12 +144,7 @@ import { QualifiedName, ScriptTarget, SetAccessorDeclaration, - setLocalizedDiagnosticMessages, - setUILocale, SignatureDeclaration, - skipOuterExpressions, - some, - sortAndDeduplicate, SortedReadonlyArray, Statement, StringLiteral, @@ -265,6 +167,104 @@ import { UnparsedNode, UnparsedTextLike, VariableDeclaration, + __String, + canHaveIllegalTypeParameters, + canHaveJSDoc, + 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, + isJSDocOverloadTag, + 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 af0fd6e4db0ae..0ed6462e14508 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -3,11 +3,23 @@ import { Debug, EmitFlags, Expression, - factory, FunctionBody, + Identifier, + LexicalEnvironmentFlags, + Node, + NodeArray, + NodeVisitor, + NodesVisitor, + ParameterDeclaration, + ScriptTarget, + Statement, + SyntaxKind, + TransformationContext, + VisitEachChildNodes, + Visitor, + factory, getEmitFlags, getEmitScriptTarget, - Identifier, isArray, isArrayBindingElement, isAssertClause, @@ -84,23 +96,11 @@ 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 0d32009aee680..703bf7fac11ae 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -1,24 +1,10 @@ import { - addRange, BuilderProgram, CancellationToken, - chainDiagnosticMessages, CharacterCodes, - combinePaths, CompilerHost, CompilerOptions, - contains, - convertToRelativePath, - copyProperties, - countWhere, - createCompilerDiagnostic, - createEmitAndSemanticDiagnosticsBuilderProgram, - createGetCanonicalFileName, - createGetSourceFile, - createIncrementalCompilerHost, - createIncrementalProgram, CreateProgram, - createWriteFileMeasuringIO, CustomTransformers, Debug, Diagnostic, @@ -30,26 +16,62 @@ 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, @@ -64,47 +86,25 @@ import { getRegexFromPattern, getRelativePathFromDirectory, getWatchFactory, - HasCurrentDirectory, isExternalOrCommonJsModule, isLineBreak, - isReferencedFile, isReferenceFileLocation, + isReferencedFile, 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 9da08decb51da..0ba563a74a507 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -1,31 +1,12 @@ import * as ts from "./_namespaces/ts"; import { - BuilderProgram, BuildInfo, - canJsonReportNoInputFiles, - changeCompilerHostLikeToUseCache, - changesAffectModuleResolution, - cleanExtendedConfigCache, - clearMap, - clearSharedExtendedConfigFileWatcher, - closeFileWatcher, - closeFileWatcherOf, + BuilderProgram, CompilerHost, CompilerOptions, ConfigFileDiagnosticsReporter, ConfigFileProgramReloadLevel, - createBuilderProgramUsingProgramBuildInfo, - createCachedDirectoryStructureHost, - createCompilerDiagnostic, - createCompilerHostFromProgramHost, - createCompilerHostWorker, - createEmitAndSemanticDiagnosticsBuilderProgram, - createGetCanonicalFileName, - createResolutionCache, CreateSourceFileOptions, - createWatchCompilerHostOfConfigFile, - createWatchCompilerHostOfFilesAndCompilerOptions, - createWatchFactory, Debug, Diagnostic, DiagnosticMessage, @@ -40,6 +21,49 @@ import { FileWatcher, FileWatcherCallback, FileWatcherEventKind, + HasInvalidatedResolutions, + MapLike, + ModuleResolutionCache, + ParsedCommandLine, + Path, + PollingInterval, + ProjectReference, + ResolutionCacheHost, + ResolutionMode, + ResolvedModule, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + ScriptTarget, + SharedExtendedConfigFileWatcher, + SourceFile, + StringLiteralLike, + System, + WatchDirectoryFlags, + WatchOptions, + WatchType, + WatchTypeRegistry, + WildcardDirectoryWatcher, + canJsonReportNoInputFiles, + changeCompilerHostLikeToUseCache, + changesAffectModuleResolution, + cleanExtendedConfigCache, + clearMap, + clearSharedExtendedConfigFileWatcher, + closeFileWatcher, + closeFileWatcherOf, + createBuilderProgramUsingProgramBuildInfo, + createCachedDirectoryStructureHost, + createCompilerDiagnostic, + createCompilerHostFromProgramHost, + createCompilerHostWorker, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createResolutionCache, + createWatchCompilerHostOfConfigFile, + createWatchCompilerHostOfFilesAndCompilerOptions, + createWatchFactory, getBuildInfo, getConfigFileParsingDiagnostics, getDirectoryPath, @@ -50,48 +74,24 @@ import { getParsedCommandLineOfConfigFile, getSourceFileVersionAsHashFromText, getTsBuildInfoEmitOutputFilePath, - HasInvalidatedResolutions, isArray, isIgnoredFileFromWildCardWatching, isProgramUptoDate, - MapLike, maybeBind, - ModuleResolutionCache, noop, noopFileWatcher, parseConfigHostFromCompilerHostLike, - ParsedCommandLine, - Path, perfLogger, - PollingInterval, - ProjectReference, - ResolutionCacheHost, - ResolutionMode, - ResolvedModule, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, returnFalse, returnTrue, - ScriptTarget, setGetSourceFileAsHashVersioned, - SharedExtendedConfigFileWatcher, - SourceFile, - StringLiteralLike, sys, - System, toPath, 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 62d6ffee46091..ac62a2d612d06 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -1,25 +1,33 @@ 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, @@ -32,27 +40,19 @@ import { isExcludedFile, isSupportedSourceFileName, map, - matchesExclude, matchFiles, + matchesExclude, 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 caca5fc914394..aa235dc1cc988 100644 --- a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts +++ b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts @@ -21,13 +21,11 @@ import { ExportDeclaration, Expression, ExpressionWithTypeArguments, - factory, GeneratedIdentifierFlags, HeritageClause, Identifier, ImportClause, IndexSignatureDeclaration, - isNodeKind, JSDocParameterTag, JSDocTypeExpression, MethodSignature, @@ -35,12 +33,11 @@ import { Mutable, NamedExportBindings, NamedImportBindings, + NoSubstitutionTemplateLiteral, Node, NodeArray, - NoSubstitutionTemplateLiteral, NumericLiteral, ParameterDeclaration, - parseBaseNodeFactory, PostfixUnaryExpression, PrefixUnaryExpression, PrimaryExpression, @@ -48,9 +45,6 @@ import { PropertySignature, PseudoBigInt, QuestionToken, - setParent, - setTextRange, - setTextRangePosEnd, StringLiteral, SyntaxKind, TaggedTemplateExpression, @@ -63,6 +57,12 @@ 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 5de292fb9bce3..6cca290144766 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 78a0f155f53d1..014aab74d75b3 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 738eb2327d1b4..9464b3d24e9e0 100644 --- a/src/deprecatedCompat/4.6/importTypeAssertions.ts +++ b/src/deprecatedCompat/4.6/importTypeAssertions.ts @@ -1,15 +1,15 @@ import { - addNodeFactoryPatcher, - buildOverload, EntityName, - factory, ImportTypeAssertionContainer, ImportTypeNode, + NodeFactory, + TypeNode, + addNodeFactoryPatcher, + buildOverload, + factory, 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 97f35beba4150..6f501f791d492 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 d23969ccda6be..a86a327bef8b0 100644 --- a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts +++ b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts @@ -1,27 +1,22 @@ 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, @@ -31,6 +26,30 @@ 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, @@ -55,26 +74,7 @@ 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 c56abe2df1ef2..860fde1b65474 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 8682631b07830..641a78b8e611c 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 0853f9c6916f4..8fc999534f115 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -1,15 +1,35 @@ import * as ts from "./_namespaces/ts"; import { - arrayFrom, - BuilderProgram, 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, buildOpts, changeCompilerHostLikeToUseCache, - CharacterCodes, combinePaths, - CommandLineOption, compareStringsCaseInsensitive, - CompilerOptions, contains, convertToOptionsWithAbsolutePaths, convertToTSConfig, @@ -20,8 +40,6 @@ import { createGetCanonicalFileName, createIncrementalCompilerHost, createProgram, - CreateProgram, - CreateProgramOptions, createSolutionBuilder, createSolutionBuilderHost, createSolutionBuilderWithWatch, @@ -29,17 +47,8 @@ import { createWatchCompilerHostOfConfigFile, createWatchCompilerHostOfFilesAndCompilerOptions, createWatchProgram, - Debug, - Diagnostic, - DiagnosticMessage, - DiagnosticReporter, - Diagnostics, dumpTracingLegend, - EmitAndSemanticDiagnosticsBuilderProgram, emitFilesAndReportErrorsAndGetExitStatus, - ExitStatus, - ExtendedConfigCacheEntry, - Extension, fileExtensionIs, fileExtensionIsOneOf, filter, @@ -66,27 +75,18 @@ import { parseBuildCommand, parseCommandLine, parseConfigFileWithSystem, - ParsedCommandLine, - Program, reduceLeftIterator, - ReportEmitErrorSummary, - SolutionBuilder, - SolutionBuilderHostBase, sort, - SourceFile, - startsWith, startTracing, + startsWith, 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 c7ea299f207bf..4b48a830412e3 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -10,11 +10,6 @@ import { CompletionEntry, CompletionEntryDetails, CompletionInfo, - computeLineAndCharacterOfPosition, - computeLineStarts, - computePositionOfLineAndCharacter, - createQueue, - createTextSpanFromBounds, Debug, DefinitionInfo, DefinitionInfoAndBoundSpan, @@ -27,33 +22,25 @@ import { EditorOptions, EmitOutput, FileTextChanges, - firstDefined, FormatCodeOptions, FormatCodeSettings, - getSnapshotText, - getSupportedCodeFixes, - identity, ImplementationLocation, InlayHint, InlayHintKind, - isString, JSDocTagInfo, LanguageService, LanguageServiceHost, - map, - mapOneOrMany, NavigateToItem, NavigationBarItem, NavigationTree, - notImplemented, OrganizeImportsArgs, OutliningSpan, PatternMatchKind, Program, QuickInfo, RefactorEditInfo, - ReferencedSymbol, ReferenceEntry, + ReferencedSymbol, RenameInfo, RenameInfoFailure, RenameInfoSuccess, @@ -66,12 +53,25 @@ import { Symbol, TextChange, TextInsertion, - textPart, TextRange, TextSpan, TodoComment, TodoCommentDescriptor, UserPreferences, + computeLineAndCharacterOfPosition, + computeLineStarts, + computePositionOfLineAndCharacter, + createQueue, + createTextSpanFromBounds, + firstDefined, + getSnapshotText, + getSupportedCodeFixes, + identity, + isString, + map, + mapOneOrMany, + notImplemented, + textPart, } from "./_namespaces/ts"; import { CommandNames, diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 069bc142c9dde..42a5182b04de5 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -1,12 +1,16 @@ import { CharacterCodes, - combinePaths, - compareStringsCaseSensitive, CompilerOptions, Debug, + Extension, + MapLike, + Path, + TypeAcquisition, + Version, + combinePaths, + compareStringsCaseSensitive, deduplicate, equateStringsCaseSensitive, - Extension, fileExtensionIs, flatMap, forEach, @@ -19,16 +23,12 @@ import { getProperty, hasJSFileExtension, mapDefined, - MapLike, normalizePath, - Path, readConfigFile, removeFileExtension, removeMinAndVersionNumbers, some, toFileNameLowerCase, - TypeAcquisition, - Version, versionMajorMinor, } from "./_namespaces/ts"; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index ba1e906bbfe2c..66b61bfb7d9e2 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1,57 +1,104 @@ import { ActionInvalidate, ActionSet, - asNormalizedPath, AutoImportProviderProject, BeginEnablePluginResult, BeginInstallTypes, ConfiguredProject, - countEachFileTypes, - createPackageJsonCache, - emptyArray, EndInstallTypes, Errors, ExternalProject, - getBaseConfigFileName, - hasNoTypeScriptSource, + ITypingsInstaller, InferredProject, InvalidateCachedTypings, - isConfiguredProject, - isDynamicFileName, - isInferredProject, - isInferredProjectName, - ITypingsInstaller, - Logger, LogLevel, - makeAutoImportProviderProjectName, - makeAuxiliaryProjectName, - makeInferredProjectName, + Logger, Msg, NormalizedPath, - normalizedPathToPath, - nullTypingsInstaller, PackageInstalledResponse, PackageJsonCache, Project, ProjectFilesWithTSDiagnostics, ProjectKind, ProjectOptions, - protocol, ScriptInfo, ScriptInfoVersion, ServerHost, Session, SetTypings, ThrottledOperations, - toNormalizedPath, TypingsCache, + asNormalizedPath, + countEachFileTypes, + createPackageJsonCache, + emptyArray, + getBaseConfigFileName, + hasNoTypeScriptSource, + isConfiguredProject, + isDynamicFileName, + isInferredProject, + isInferredProjectName, + makeAutoImportProviderProjectName, + makeAuxiliaryProjectName, + makeInferredProjectName, + normalizedPathToPath, + nullTypingsInstaller, + protocol, + toNormalizedPath, } 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, @@ -59,10 +106,6 @@ import { clearSharedExtendedConfigFileWatcher, closeFileWatcherOf, combinePaths, - CommandLineOption, - CompilerOptions, - CompletionInfo, - ConfigFileProgramReloadLevel, contains, containsPath, convertCompilerOptionsForTelemetry, @@ -72,21 +115,10 @@ import { createDocumentRegistryInternal, createGetCanonicalFileName, createMultiMap, - Debug, - Diagnostic, directorySeparator, - DirectoryStructureHost, - DocumentPosition, - DocumentPositionMapper, - DocumentRegistry, - DocumentRegistryBucketKeyWithMode, emptyOptions, ensureTrailingDirectorySeparator, - ExtendedConfigCacheEntry, - FileExtensionInfo, fileExtensionIs, - FileWatcher, - FileWatcherEventKind, find, flatMap, forEach, @@ -94,7 +126,6 @@ import { forEachEntry, forEachKey, forEachResolvedProjectReference, - FormatCodeSettings, getAnyExtensionFromPath, getBaseFileName, getDefaultFormatCodeSettings, @@ -109,10 +140,7 @@ import { hasExtension, hasProperty, hasTSFileExtension, - HostCancellationToken, identity, - IncompleteCompletionsCache, - IndentStyle, isArray, isIgnoredFileFromWildCardWatching, isInsideNodeModules, @@ -120,65 +148,37 @@ 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 2f2142a5bb0fe..c54a68b354da1 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 d1c12c65d9bfb..2f2f0be330559 100644 --- a/src/server/packageJsonCache.ts +++ b/src/server/packageJsonCache.ts @@ -1,12 +1,12 @@ import { - combinePaths, - createPackageJsonInfo, Debug, - forEachAncestorDirectory, - getDirectoryPath, Path, ProjectPackageJsonInfo, Ternary, + combinePaths, + createPackageJsonInfo, + forEachAncestorDirectory, + getDirectoryPath, tryFileExists, } from "./_namespaces/ts"; import { ProjectService } from "./_namespaces/ts.server"; diff --git a/src/server/project.ts b/src/server/project.ts index ab2a5252cd749..679c8bb26c4d4 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,65 +1,102 @@ 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, - toNormalizedPath, TypingsCache, + asNormalizedPath, + createModuleSpecifierCache, + emptyArray, + forEachResolvedProjectReferenceProject, + projectContainsInfoDirectly, + protocol, + toNormalizedPath, 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, + PackageJsonAutoImportPreference, + PackageJsonInfo, + ParsedCommandLine, + Path, + PerformanceEvent, + PluginImport, + PollingInterval, + Program, + ProjectPackageJsonInfo, + ProjectReference, + ResolutionCache, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + ScriptKind, + SortedReadonlyArray, + SourceFile, + SourceMapper, + StringLiteralLike, + StructureIsReused, + SymlinkCache, + ThrottledCancellationToken, + TypeAcquisition, + 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, @@ -69,7 +106,6 @@ import { generateDjb2Hash, getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, - GetCanonicalFileName, getDeclarationEmitOutputFilePathWorker, getDefaultCompilerOptions, getDefaultLibFileName, @@ -81,72 +117,36 @@ import { getNormalizedAbsolutePath, getOrUpdate, getStringComparer, - HasInvalidatedResolutions, - HostCancellationToken, inferredTypesContainingFile, - InstallPackageOptions, - IScriptSnapshot, isDeclarationFileName, isExternalModuleNameRelative, isInsideNodeModules, - JsTyping, - LanguageService, - LanguageServiceHost, - LanguageServiceMode, map, mapDefined, maybeBind, - ModuleResolutionCache, - ModuleResolutionHost, noop, noopFileWatcher, normalizePath, normalizeSlashes, orderedRemoveItem, outFile, - PackageJsonAutoImportPreference, - PackageJsonInfo, - ParsedCommandLine, parsePackageName, - Path, perfLogger, - PerformanceEvent, - PluginImport, - PollingInterval, - Program, - ProjectPackageJsonInfo, - ProjectReference, removeFileExtension, - ResolutionCache, resolutionExtensionIsTSOrJson, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, resolvePackageNameToPackageJson, returnFalse, returnTrue, - ScriptKind, some, sort, sortAndDeduplicate, - SortedReadonlyArray, - SourceFile, - SourceMapper, startsWith, - StringLiteralLike, stripQuotes, - StructureIsReused, - SymlinkCache, - ThrottledCancellationToken, timestamp, toPath, tracing, - TypeAcquisition, updateErrorForNoInputFiles, updateMissingFilePathsWatch, - WatchDirectoryFlags, - WatchOptions, - WatchType, } from "./_namespaces/ts"; export enum ProjectKind { diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 9c1371f2d9f57..f21e316baacc2 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -4,18 +4,32 @@ import { Errors, ExternalProject, InferredProject, - isConfiguredProject, - isExternalProject, - isInferredProject, - maxFileSize, NormalizedPath, Project, ProjectKind, - protocol, ScriptVersionCache, ServerHost, + isConfiguredProject, + isExternalProject, + isInferredProject, + maxFileSize, + protocol, } from "./_namespaces/ts.server"; import { + Debug, + DocumentPositionMapper, + DocumentRegistryBucketKeyWithMode, + FileWatcher, + FileWatcherEventKind, + FormatCodeSettings, + IScriptSnapshot, + LineInfo, + Path, + ScriptKind, + ScriptSnapshot, + SourceFile, + SourceFileLike, + TextSpan, assign, clear, closeFileWatcherOf, @@ -24,32 +38,18 @@ 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 a4acf98f5516b..d73d8508643af 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -1,12 +1,12 @@ import { - collapseTextChangeRangesAcrossMultipleVersions, - computeLineStarts, - createTextChangeRange, - createTextSpan, Debug, IScriptSnapshot, TextChangeRange, TextSpan, + collapseTextChangeRangesAcrossMultipleVersions, + computeLineStarts, + createTextChangeRange, + createTextSpan, unchangedTextChangeRange, } from "./_namespaces/ts"; import { diff --git a/src/server/session.ts b/src/server/session.ts index 93a2874192494..ca5c4f474e956 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1,11 +1,7 @@ import { - arrayFrom, - arrayIterator, - arrayReverseIterator, CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, - cast, CodeAction, CodeActionCommand, CodeFixAction, @@ -16,6 +12,64 @@ 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, @@ -23,32 +77,20 @@ 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, @@ -68,96 +110,45 @@ 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, - Logger, LogLevel, + Logger, Msg, NormalizedPath, Project, @@ -171,10 +162,19 @@ 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 42c91be6047d1..65c707bb929ef 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -1,21 +1,21 @@ import { ApplyCodeActionCommandResult, - arrayIsEqualTo, CompilerOptions, - getAllowJSCompilerOption, InstallPackageOptions, + Path, + SortedReadonlyArray, + TypeAcquisition, + arrayIsEqualTo, + getAllowJSCompilerOption, 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 9c8a45c17159c..2ba220593a309 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,14 +1,14 @@ import { - binarySearch, Comparer, + SortedArray, + binarySearch, getBaseFileName, identity, perfLogger, - SortedArray, } from "./_namespaces/ts"; import { - Logger, LogLevel, + Logger, NormalizedPath, ServerHost, } from "./_namespaces/ts.server"; diff --git a/src/server/utilitiesPublic.ts b/src/server/utilitiesPublic.ts index e071e87dfbac2..e2621359f41b2 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 f06f85142b862..cd08b00b51aaf 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -4,12 +4,10 @@ import { BindingPattern, Block, BreakOrContinueStatement, - canHaveDecorators, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, - createTextSpanFromBounds, Debug, DestructuringPattern, DoStatement, @@ -18,32 +16,15 @@ 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, @@ -57,7 +38,6 @@ import { PropertyDeclaration, PropertySignature, ReturnStatement, - skipTrivia, SourceFile, SwitchStatement, SyntaxKind, @@ -70,6 +50,26 @@ 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 fc4280802ee6d..4784490883c2b 100644 --- a/src/services/callHierarchy.ts +++ b/src/services/callHierarchy.ts @@ -1,6 +1,5 @@ import { AccessExpression, - append, ArrowFunction, AsExpression, CallExpression, @@ -8,30 +7,53 @@ 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, @@ -42,7 +64,6 @@ import { getNodeModifiers, group, hasSyntacticModifier, - Identifier, idText, indicesOf, isAccessExpression, @@ -79,31 +100,10 @@ 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 74450102e3476..b9d4284b81c1e 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -1,41 +1,19 @@ 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, @@ -48,34 +26,56 @@ import { JSDocTemplateTag, JSDocThisTag, JSDocThrowsTag, - JSDocTypedefTag, JSDocTypeTag, + JSDocTypedefTag, 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 96e246a85db80..a2b505591249f 100644 --- a/src/services/classifier2020.ts +++ b/src/services/classifier2020.ts @@ -3,10 +3,25 @@ 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, @@ -27,22 +42,7 @@ 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 de923d7242433..4b97d2ef40737 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -1,6 +1,4 @@ import { - arrayFrom, - cast, CodeActionCommand, CodeFixAction, CodeFixAllContext, @@ -8,20 +6,22 @@ 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 0360e9d117a52..2702dd72cab0a 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 bb0510a90d0ad..909e2b68c0d57 100644 --- a/src/services/codefixes/addMissingAsync.ts +++ b/src/services/codefixes/addMissingAsync.ts @@ -2,15 +2,19 @@ import { ArrowFunction, CodeFixAllContext, CodeFixContext, - createTextSpanFromNode, Diagnostic, Diagnostics, - factory, FileTextChanges, - find, - findAncestor, FunctionDeclaration, FunctionExpression, + MethodDeclaration, + ModifierFlags, + SourceFile, + TextSpan, + createTextSpanFromNode, + factory, + find, + findAncestor, getNodeId, getSyntacticModifierFlags, getSynthesizedDeepClone, @@ -20,12 +24,8 @@ 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 d93138a1dbea8..a71854c682daa 100644 --- a/src/services/codefixes/addMissingAwait.ts +++ b/src/services/codefixes/addMissingAwait.ts @@ -2,15 +2,26 @@ import { CancellationToken, CodeFixAllContext, CodeFixContext, - compact, - contains, Diagnostic, Diagnostics, Expression, - factory, FileTextChanges, - find, FindAllReferences, + Identifier, + ModifierFlags, + Node, + NodeFlags, + Program, + SourceFile, + Symbol, + SyntaxKind, + TextSpan, + TypeChecker, + TypeFlags, + compact, + contains, + factory, + find, findAncestor, findPrecedingToken, forEach, @@ -18,7 +29,6 @@ import { getFixableErrorSpanExpression, getSymbolId, hasSyntacticModifier, - Identifier, isArrowFunction, isBinaryExpression, isBlock, @@ -28,22 +38,12 @@ 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 8a848c2616f80..bc443c21eb34c 100644 --- a/src/services/codefixes/addMissingConst.ts +++ b/src/services/codefixes/addMissingConst.ts @@ -1,7 +1,12 @@ import { Diagnostics, - every, Expression, + Node, + Program, + SourceFile, + SyntaxKind, + TypeChecker, + every, findAncestor, getTokenAtPosition, isArrayLiteralExpression, @@ -10,13 +15,8 @@ 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 c46c353b37f3e..1b73fc93980bd 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 330757c9fa76f..81f696963e11f 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 dc36931d79237..afb0cbca3f5a1 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 7664bea35be10..13445ee79cf99 100644 --- a/src/services/codefixes/addOptionalPropertyUndefined.ts +++ b/src/services/codefixes/addOptionalPropertyUndefined.ts @@ -1,10 +1,19 @@ import { Diagnostics, + Identifier, + Node, + PropertyAccessExpression, + SignatureDeclaration, + SourceFile, + Symbol, + SyntaxKind, + TextSpan, + TypeChecker, + UnionTypeNode, emptyArray, factory, getFixableErrorSpanExpression, getSourceFileOfNode, - Identifier, isBinaryExpression, isCallExpression, isExpression, @@ -16,16 +25,7 @@ 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 292c609bc720c..847dfd53fbec1 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -2,11 +2,26 @@ 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, @@ -17,27 +32,12 @@ 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 d9817ab8250b2..df499530c1a91 100644 --- a/src/services/codefixes/convertConstToLet.ts +++ b/src/services/codefixes/convertConstToLet.ts @@ -1,17 +1,17 @@ import { - addToSeen, Diagnostics, + Program, + SourceFile, + Symbol, + SyntaxKind, + Token, + addToSeen, 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 b2af8a230febc..631d747404715 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -1,24 +1,38 @@ 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, @@ -43,23 +57,9 @@ 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 1e68d28758d1c..487277eba10fa 100644 --- a/src/services/codefixes/convertLiteralTypeToMappedType.ts +++ b/src/services/codefixes/convertLiteralTypeToMappedType.ts @@ -1,15 +1,15 @@ import { - cast, Diagnostics, + SourceFile, + TypeLiteralNode, + TypeNode, + cast, 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 e6851157938fe..cf3abba493eea 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -5,26 +5,44 @@ 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, canHaveSymbol, - CodeFixContext, concatenate, createMultiMap, - Debug, - Diagnostics, elementAt, emptyArray, every, - Expression, factory, firstOrUndefined, flatMap, forEach, forEachChild, forEachReturnStatement, - FunctionExpression, - FunctionLikeDeclaration, - GeneratedIdentifierFlags, getContainingFunction, getNodeId, getObjectFlags, @@ -34,7 +52,6 @@ import { getSynthesizedDeepCloneWithReplacements, getTokenAtPosition, hasPropertyAccessExpressionWithName, - Identifier, idText, isBindingElement, isBlock, @@ -55,28 +72,11 @@ import { isVariableDeclaration, lastOrUndefined, moveRangePastModifiers, - Node, - NodeFlags, - ObjectFlags, - PropertyAccessExpression, - returnsPromise, - ReturnStatement, returnTrue, - Signature, - SignatureKind, + returnsPromise, 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 959b9ea4538ad..6b75fafa79be3 100644 --- a/src/services/codefixes/convertToEsModule.ts +++ b/src/services/codefixes/convertToEsModule.ts @@ -4,45 +4,63 @@ 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, @@ -59,27 +77,9 @@ 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 1a3b8498a49f5..ed80aef7764da 100644 --- a/src/services/codefixes/convertToMappedObjectType.ts +++ b/src/services/codefixes/convertToMappedObjectType.ts @@ -1,6 +1,13 @@ import { - cast, Diagnostics, + IndexSignatureDeclaration, + InterfaceDeclaration, + SourceFile, + SyntaxKind, + TypeAliasDeclaration, + TypeLiteralNode, + TypeNode, + cast, emptyArray, factory, first, @@ -8,19 +15,12 @@ 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 f6dfc027596d2..c8fbc5fce3e39 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -1,10 +1,13 @@ import { - addToSeen, CodeFixContextBase, - contains, - createTextSpanFromNode, Diagnostics, ExportSpecifier, + SourceFile, + SyntaxKind, + TextSpan, + addToSeen, + contains, + createTextSpanFromNode, factory, filter, findDiagnosticForNode, @@ -12,10 +15,7 @@ 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 b4f5bda36cafa..d58e559a3292d 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 466a8a9bcd719..b2f1d20aed13b 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 96202931ae090..e9187463faacb 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 c5b2bd3573789..e2e2048cb2d99 100644 --- a/src/services/codefixes/fixAddMissingConstraint.ts +++ b/src/services/codefixes/fixAddMissingConstraint.ts @@ -1,8 +1,17 @@ import { - addToSeen, - createTextSpan, DiagnosticMessageChain, Diagnostics, + LanguageServiceHost, + Node, + Program, + SourceFile, + TextSpan, + Type, + TypeChecker, + TypeParameterDeclaration, + UserPreferences, + addToSeen, + createTextSpan, factory, find, flattenDiagnosticMessageText, @@ -15,16 +24,7 @@ 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 80fdb0380ad1c..89c47c8f523c5 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -1,7 +1,4 @@ import { - __String, - addToSeen, - arrayFrom, BigIntLiteralType, BinaryExpression, CallExpression, @@ -10,13 +7,49 @@ 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, @@ -24,7 +57,6 @@ import { findIndex, firstDefined, firstOrUndefined, - FunctionExpression, getCheckFlags, getClassLikeDeclarationOfSymbol, getEmitScriptTarget, @@ -37,9 +69,7 @@ import { getTokenAtPosition, hasAbstractModifier, hasInitializer, - Identifier, idText, - InterfaceDeclaration, isCallExpression, isClassLike, isComputedPropertyName, @@ -68,49 +98,20 @@ 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, @@ -120,7 +121,6 @@ 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 32b17b39233d8..d21da714a0e39 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -1,13 +1,13 @@ import { - cast, Diagnostics, + Node, + SourceFile, + TextSpan, + cast, 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 1fa7b06bedef0..cfcb1abcae757 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 4abb3cdedda2d..e2e6c36305797 100644 --- a/src/services/codefixes/fixAddVoidToPromise.ts +++ b/src/services/codefixes/fixAddVoidToPromise.ts @@ -1,6 +1,13 @@ import { CodeFixAllContext, Diagnostics, + NewExpression, + ParameterDeclaration, + Program, + SourceFile, + SyntaxKind, + TextSpan, + TypeFlags, factory, getJSDocTypeTag, getTokenAtPosition, @@ -14,16 +21,9 @@ 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 f12ba12e3f0fc..f8283609be9d4 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 d128045f7f075..d49b9feeb9316 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 ac9d7af09944d..f5a009c00e55d 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 f91c49c9bece9..cba4f1eba2854 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -1,13 +1,22 @@ 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, @@ -15,27 +24,18 @@ 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 02276f8d7a482..0cb3b1087158d 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -1,9 +1,12 @@ import { - addToSeen, CallExpression, ConstructorDeclaration, Diagnostics, ExpressionStatement, + Node, + SourceFile, + SyntaxKind, + addToSeen, forEachChild, getContainingFunction, getNodeId, @@ -12,9 +15,6 @@ 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 feee99da0d0cf..9b46c41d685de 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 271c9b969118c..281afd5ebeb1f 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 4870e021120f7..2dab4970f1f68 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 ed571ab443352..7fcb9311e7de9 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 7beffebd59986..f7eeff43a6a25 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -1,13 +1,13 @@ import { Diagnostics, - factory, - getContainingClass, - getTokenAtPosition, HeritageClause, - isWhiteSpaceSingleLine, Node, SourceFile, SyntaxKind, + factory, + getContainingClass, + getTokenAtPosition, + isWhiteSpaceSingleLine, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixForgottenThisPropertyAccess.ts b/src/services/codefixes/fixForgottenThisPropertyAccess.ts index ae8d0cd294f0b..a90d84936425f 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 c8f02aba81850..b14a5cd4bac54 100644 --- a/src/services/codefixes/fixImplicitThis.ts +++ b/src/services/codefixes/fixImplicitThis.ts @@ -3,9 +3,12 @@ import { Debug, DiagnosticAndArguments, Diagnostics, + FindAllReferences, + SourceFile, + SyntaxKind, + TypeChecker, emptyArray, factory, - FindAllReferences, findChildOfKind, getThisContainer, getTokenAtPosition, @@ -13,10 +16,7 @@ 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 23731400a1601..8498101584038 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -1,9 +1,15 @@ import { - canHaveExportModifier, - canHaveLocals, Declaration, Diagnostics, ExportDeclaration, + Identifier, + Node, + Program, + SourceFile, + Symbol, + VariableStatement, + canHaveExportModifier, + canHaveLocals, factory, find, findAncestor, @@ -11,7 +17,6 @@ import { firstOrUndefined, getResolvedModule, getTokenAtPosition, - Identifier, isExportDeclaration, isIdentifier, isImportDeclaration, @@ -23,13 +28,8 @@ 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 f7e8345b217f0..38081bd81ecc9 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 bae3f2d2c0f16..fc2805752f4d9 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -1,9 +1,16 @@ import { - addRange, CallExpression, CodeFixAction, CodeFixContext, Diagnostics, + ImportDeclaration, + ModuleKind, + NamespaceImport, + NewExpression, + Node, + SourceFile, + SyntaxKind, + addRange, factory, findAncestor, getEmitModuleKind, @@ -11,18 +18,11 @@ import { getQuotePreference, getSourceFileOfNode, getTokenAtPosition, - ImportDeclaration, isExpression, isImportCall, isNamedDeclaration, isTransientSymbol, makeImport, - ModuleKind, - NamespaceImport, - NewExpression, - Node, - SourceFile, - SyntaxKind, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index 3c53a5da26b5e..d5b5a0ffd4f9b 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 0a5442600d8c4..a5cb3e2b79533 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -5,10 +5,8 @@ import { ConstructSignatureDeclaration, DiagnosticMessage, Diagnostics, - findAncestor, FunctionDeclaration, GetAccessorDeclaration, - getTokenAtPosition, IndexSignatureDeclaration, MappedTypeNode, MethodDeclaration, @@ -20,7 +18,6 @@ import { SetAccessorDeclaration, SourceFile, SyntaxKind, - textChanges, Type, TypeAliasDeclaration, TypeAssertion, @@ -28,6 +25,9 @@ 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 4fcc89c87fcc0..06cceb0968d57 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 3769fa3619ef1..323c6e3d0679a 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 cf86a7ef2d53d..3a84eedb2a59e 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 7a35126032924..adaeaf39c7694 100644 --- a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts +++ b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts @@ -1,16 +1,16 @@ import { - cast, Diagnostics, + PropertyAccessExpression, + QuotePreference, + SourceFile, + UserPreferences, + cast, 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 f76a8420e0699..46ab91a11866f 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -5,12 +5,19 @@ import { Debug, DiagnosticMessage, Diagnostics, + GetAccessorDeclaration, + MethodDeclaration, + Node, + ParameterPropertyDeclaration, + PropertyDeclaration, + SetAccessorDeclaration, + SourceFile, + SyntaxKind, emptyArray, factory, find, findAncestor, findLast, - GetAccessorDeclaration, getTokenAtPosition, isAbstractModifier, isAccessibilityModifier, @@ -21,15 +28,8 @@ 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 2f1ef5a198044..e57879b5899cd 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 954a90ba6f34a..5116f291cfdbb 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 a7071d6e143f4..464800e46e95f 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 8e3574aa60cde..5be6d9b423404 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -2,6 +2,16 @@ import { CodeFixContextBase, Debug, Diagnostics, + ImportDeclaration, + ModifierFlags, + Node, + NodeFlags, + ScriptTarget, + SemanticMeaning, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, factory, findAncestor, getEffectiveBaseTypeNode, @@ -12,7 +22,6 @@ import { getTextOfNode, getTokenAtPosition, hasSyntacticModifier, - ImportDeclaration, isBinaryExpression, isClassElement, isClassLike, @@ -28,16 +37,7 @@ 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 fa78042e08217..e84a766a25e20 100644 --- a/src/services/codefixes/fixStrictClassInitialization.ts +++ b/src/services/codefixes/fixStrictClassInitialization.ts @@ -1,11 +1,19 @@ import { - append, BigIntLiteralType, CodeFixAction, CodeFixContext, Debug, Diagnostics, Expression, + ModifierFlags, + PropertyDeclaration, + SourceFile, + SyntaxKind, + Type, + TypeChecker, + TypeFlags, + TypeNode, + append, factory, firstDefined, getClassLikeDeclarationOfSymbol, @@ -17,16 +25,8 @@ 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 bdb4bbbb28df0..9cd1c5abbc299 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 17afabda71a93..6287923a313b5 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 ec5b5e6e3ca90..960a4d8cb9022 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 e9b0f2fc7ed12..e16d098c709a2 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -1,22 +1,31 @@ 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, @@ -39,18 +48,9 @@ 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 88e6aed5d41a6..ed32e3d7d2faf 100644 --- a/src/services/codefixes/fixUnusedLabel.ts +++ b/src/services/codefixes/fixUnusedLabel.ts @@ -1,13 +1,13 @@ import { - cast, Diagnostics, + SourceFile, + SyntaxKind, + cast, 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 96bee0d7f458b..1c68baaade8fd 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -1,14 +1,30 @@ import { AccessorDeclaration, - canHaveDecorators, - cast, ClassLikeDeclaration, - concatenate, ConstructorDeclaration, DeclarationName, Diagnostics, - factory, FileTextChanges, + Identifier, + InterfaceDeclaration, + ModifierFlags, + ModifierLike, + Node, + ObjectLiteralExpression, + ParameterPropertyDeclaration, + Program, + PropertyAssignment, + PropertyDeclaration, + SourceFile, + StringLiteral, + SymbolFlags, + SyntaxKind, + TypeChecker, + TypeNode, + canHaveDecorators, + cast, + concatenate, + factory, find, findAncestor, getClassExtendsHeritageElement, @@ -21,8 +37,6 @@ import { getUniqueName, hasEffectiveReadonlyModifier, hasStaticModifier, - Identifier, - InterfaceDeclaration, isClassLike, isElementAccessExpression, isFunctionLike, @@ -35,25 +49,11 @@ 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 8f85058cc6334..4c965be47e239 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -1,7 +1,5 @@ import { AccessorDeclaration, - append, - arrayFrom, ArrowFunction, Block, CallExpression, @@ -10,15 +8,55 @@ import { CodeFixContextBase, Debug, Diagnostics, - emptyArray, EntityName, Expression, - factory, - find, - flatMap, 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, getAllAccessorDeclarations, getEffectiveModifierFlags, getEmitScriptTarget, @@ -31,9 +69,7 @@ import { getSynthesizedDeepClone, getTokenAtPosition, getTsConfigObjectLiteralExpression, - Identifier, idText, - IntersectionType, isArrowFunction, isAutoAccessorPropertyDeclaration, isFunctionDeclaration, @@ -50,52 +86,16 @@ 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 ac89579ab0ed5..0a82281ebda0f 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -2,29 +2,63 @@ 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, + SortKind, + 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, @@ -52,27 +86,21 @@ import { getTypeKeywordOfTypeOnlyImport, getUniqueSymbolId, hostGetCanonicalFileName, - Identifier, - ImportClause, - ImportEqualsDeclaration, importFromModuleSpecifier, - ImportKind, - ImportsNotUsedAsValues, insertImports, - InternalSymbolName, isExternalModule, isExternalModuleReference, isIdentifier, isIdentifierPart, isIdentifierStart, - isImportableFile, isImportEqualsDeclaration, + isImportableFile, isInJSFile, isIntrinsicJsxName, + isJSXTagName, isJsxClosingElement, isJsxOpeningFragment, isJsxOpeningLikeElement, - isJSXTagName, isNamedImports, isNamespaceImport, isSourceFileJS, @@ -84,58 +112,30 @@ 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, - SortKind, - 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 174b56cad88ff..3cd998b8ef24e 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -1,24 +1,62 @@ 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, + SyntaxKind, + Token, + TransientSymbol, + Type, + TypeFlags, + TypeNode, + TypeReference, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionReduction, + UserPreferences, + VariableDeclaration, + __String, + cast, + createMultiMap, + createSymbolTable, emptyArray, escapeLeadingUnderscores, - Expression, factory, - FindAllReferences, findChildOfKind, first, firstOrUndefined, @@ -34,8 +72,6 @@ import { getTextOfNode, getTokenAtPosition, getTypeNodeIfAccessible, - Identifier, - IndexKind, isArrowFunction, isAssignmentExpression, isCallExpression, @@ -56,59 +92,23 @@ import { isTransientSymbol, 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, - 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 521c8e9dc08b2..0c6b2a243a98c 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 0667683d1ffd0..45cabbb7134d2 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 1492e6377ce26..85e037edfc083 100644 --- a/src/services/codefixes/returnValueCorrect.ts +++ b/src/services/codefixes/returnValueCorrect.ts @@ -1,19 +1,28 @@ 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, @@ -25,20 +34,11 @@ 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 6af08a70ebff6..5bca880f21e30 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 4492e176b5c57..093e3ce400e5a 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 75f72964530b6..4219714e0d7e4 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 78122a0840c62..bc488d5e0802c 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 45c25e900c2ce..7fb44f805ca2c 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,24 +1,14 @@ import { - __String, - addToSeen, - append, BinaryExpression, BreakOrContinueStatement, CancellationToken, - canUsePropertyAccess, CaseBlock, CaseClause, - cast, CharacterCodes, ClassElement, CodeAction, - codefix, - compareNumberOfDirectorySeparators, - compareStringsCaseSensitiveUI, - compareTextSpans, Comparison, CompilerOptions, - compilerOptionsIndicateEsModules, CompletionEntry, CompletionEntryData, CompletionEntryDataAutoImport, @@ -28,11 +18,129 @@ import { CompletionEntryLabelDetails, CompletionInfo, CompletionInfoFlags, - CompletionsTriggerCharacter, CompletionTriggerKind, - concatenate, + CompletionsTriggerCharacter, ConstructorDeclaration, ContextFlags, + Debug, + Declaration, + DefaultClause, + Diagnostics, + EmitHint, + EmitTextWriter, + EntityName, + EnumMember, + ExportKind, + Expression, + ExpressionWithTypeArguments, + FunctionLikeDeclaration, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportKind, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IncompleteCompletionsCache, + IndexedAccessTypeNode, + InternalSymbolName, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocThrowsTag, + JSDocTypeExpression, + JSDocTypeTag, + JSDocTypedefTag, + JsDoc, + JsTyping, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxElement, + JsxOpeningLikeElement, + JsxSpreadAttribute, + LanguageServiceHost, + LanguageVariant, + ListFormat, + LiteralType, + LiteralTypeNode, + MemberOverrideStatus, + MethodDeclaration, + ModifierFlags, + ModifierSyntaxKind, + ModuleDeclaration, + ModuleReference, + NamedImportBindings, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralExpression, + ObjectType, + ObjectTypeDeclaration, + ParenthesizedTypeNode, + PrinterOptions, + Program, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + PropertySignature, + PseudoBigInt, + QualifiedName, + QuotePreference, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + SemanticMeaning, + SignatureHelp, + SignatureKind, + SnippetKind, + SortedArray, + SourceFile, + SpreadAssignment, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + TextChange, + TextRange, + TextSpan, + ThisContainer, + Token, + TokenSyntaxKind, + Type, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeOnlyAliasDeclaration, + TypeQueryNode, + TypeReferenceNode, + UnionReduction, + UnionType, + UserPreferences, + VariableDeclaration, + __String, + addToSeen, + append, + canUsePropertyAccess, + cast, + codefix, + compareNumberOfDirectorySeparators, + compareStringsCaseSensitiveUI, + compareTextSpans, + compilerOptionsIndicateEsModules, + concatenate, createModuleSpecifierResolutionHost, createPackageJsonImportFilter, createPrinter, @@ -41,22 +149,11 @@ import { createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, - Debug, - Declaration, - DefaultClause, - Diagnostics, diagnosticToString, displayPart, - EmitHint, - EmitTextWriter, endsWith, - EntityName, - EnumMember, escapeSnippetText, every, - ExportKind, - Expression, - ExpressionWithTypeArguments, factory, filter, find, @@ -67,7 +164,6 @@ import { firstDefined, flatMap, formatting, - FunctionLikeDeclaration, getAllSuperTypeNodes, getAncestor, getCombinedLocalAndExportSymbolFlags, @@ -106,17 +202,7 @@ import { hasEffectiveModifier, hasInitializer, hasType, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - ImportKind, - ImportOrExportSpecifier, - ImportSpecifier, - ImportTypeNode, - IncompleteCompletionsCache, - IndexedAccessTypeNode, insertSorted, - InternalSymbolName, isAbstractConstructorSymbol, isArrowFunction, isAssertionExpression, @@ -157,16 +243,16 @@ import { isFunctionTypeNode, isIdentifier, isIdentifierText, - isImportableFile, isImportDeclaration, isImportEqualsDeclaration, isImportKeyword, isImportSpecifier, + isImportableFile, isInComment, - isInitializedProperty, isInJSFile, isInRightSideOfInternalImportEqualsDeclaration, isInString, + isInitializedProperty, isIntersectionTypeNode, isJSDoc, isJSDocAugmentsTag, @@ -232,133 +318,47 @@ import { isValidTypeOnlyAliasUseSite, isVariableDeclaration, isVariableLike, - JsDoc, - JSDocParameterTag, - JSDocPropertyTag, - JSDocReturnTag, - JSDocTag, - JSDocTagInfo, - JSDocTemplateTag, - JSDocThrowsTag, - JSDocTypedefTag, - JSDocTypeExpression, - JSDocTypeTag, - JsTyping, - JsxAttribute, - JsxAttributes, - JsxClosingElement, - JsxElement, - JsxOpeningLikeElement, - JsxSpreadAttribute, - LanguageServiceHost, - LanguageVariant, last, lastOrUndefined, length, - ListFormat, - LiteralType, - LiteralTypeNode, map, mapDefined, maybeBind, - MemberOverrideStatus, memoize, memoizeOne, - MethodDeclaration, - ModifierFlags, - modifiersToFlags, - ModifierSyntaxKind, modifierToFlag, - ModuleDeclaration, - ModuleReference, + modifiersToFlags, moduleResolutionSupportsPackageJsonExportsAndImports, - NamedImportBindings, - Node, - NodeArray, - NodeBuilderFlags, - NodeFlags, nodeIsMissing, - NumericLiteral, - ObjectBindingPattern, - ObjectLiteralExpression, - ObjectType, - ObjectTypeDeclaration, or, - ParenthesizedTypeNode, parseBigInt, positionBelongsToNode, positionIsASICandidate, positionsAreOnSameLine, - PrinterOptions, probablyUsesSemicolons, - Program, programContainsModules, - PropertyAccessExpression, - PropertyDeclaration, - PropertyName, - PropertySignature, - 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, - ThisContainer, timestamp, - Token, - TokenSyntaxKind, tokenToString, tryCast, tryGetImportFromModuleSpecifier, - Type, - TypeChecker, - TypeElement, - TypeFlags, typeHasCallOrConstructSignatures, - TypeLiteralNode, - TypeNode, - TypeOnlyAliasDeclaration, - TypeQueryNode, - TypeReferenceNode, 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 797d7346b36c7..7058a51405bf1 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -1,36 +1,52 @@ import { - __String, - arrayFrom, - arrayToMultiMap, Block, BreakOrContinueStatement, CancellationToken, - canHaveSymbol, 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, + canHaveSymbol, 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, @@ -60,27 +76,11 @@ import { isVariableStatement, isWhiteSpaceSingleLine, isYieldExpression, - IterationStatement, mapDefined, - MethodDeclaration, - Modifier, - ModifierFlags, modifierToFlag, - ModuleBlock, - Node, - ObjectLiteralExpression, - ObjectTypeDeclaration, - Program, - Push, - ReturnStatement, - SourceFile, - SwitchStatement, - SyntaxKind, - ThrowStatement, toArray, toPath, tryCast, - TryStatement, } from "./_namespaces/ts"; export interface DocumentHighlights { diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index 50f660d6bf746..cd9d29f5de146 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -1,10 +1,17 @@ import { - arrayFrom, CompilerOptions, - createGetCanonicalFileName, - createLanguageServiceSourceFile, CreateSourceFileOptions, Debug, + IScriptSnapshot, + MinimalResolutionCacheHost, + Path, + ResolutionMode, + ScriptKind, + ScriptTarget, + SourceFile, + arrayFrom, + createGetCanonicalFileName, + createLanguageServiceSourceFile, ensureScriptKind, firstDefinedIterator, forEachEntry, @@ -14,14 +21,7 @@ import { getOrUpdate, getSetExternalModuleIndicator, identity, - IScriptSnapshot, isDeclarationFileName, - MinimalResolutionCacheHost, - Path, - ResolutionMode, - ScriptKind, - ScriptTarget, - SourceFile, sourceFileAffectingCompilerOptions, toPath, tracing, diff --git a/src/services/exportInfoMap.ts b/src/services/exportInfoMap.ts index ffd9501b5db25..56fd00c2ae786 100644 --- a/src/services/exportInfoMap.ts +++ b/src/services/exportInfoMap.ts @@ -1,19 +1,32 @@ 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, @@ -25,7 +38,6 @@ import { getSymbolId, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, - InternalSymbolName, isExportAssignment, isExportSpecifier, isExternalModuleNameRelative, @@ -35,30 +47,18 @@ 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 01ad83b784169..3e999cb756573 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,36 +1,93 @@ import { - __String, - addToSeen, - append, AssignmentDeclarationKind, BinaryExpression, BindingElement, Block, CallExpression, CancellationToken, - canHaveSymbol, - 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, + ObjectLiteralExpression, + ParameterDeclaration, + ParenthesizedExpression, + Path, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + Push, + ReferenceEntry, + ReferencedSymbol, + ReferencedSymbolDefinitionInfo, + ReferencedSymbolEntry, + RenameLocation, + ScriptElementKind, + ScriptTarget, + SemanticMeaning, + SetAccessorDeclaration, + SignatureDeclaration, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + SuperContainer, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolId, + SyntaxKind, + TextSpan, + TypeChecker, + TypeLiteralNode, + VariableDeclaration, + __String, + addToSeen, + append, + canHaveSymbol, + cast, climbPastPropertyAccess, compareValues, - ConstructorDeclaration, contains, createQueue, createTextSpan, createTextSpanFromBounds, createTextSpanFromRange, - Debug, - Declaration, displayPart, - DocumentSpan, emptyArray, emptyOptions, escapeLeadingUnderscores, - ExportSpecifier, - Expression, - FileIncludeReason, - FileReference, filter, find, findAncestor, @@ -42,11 +99,6 @@ import { flatMap, forEachChild, forEachReturnStatement, - ForInOrOfStatement, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, getAdjustedReferenceLocation, getAdjustedRenameLocation, getAllSuperTypeNodes, @@ -78,17 +130,10 @@ import { getTextOfNode, getThisContainer, getTouchingPropertyName, - GoToDefinition, hasEffectiveModifier, hasInitializer, hasSyntacticModifier, hasType, - HighlightSpan, - HighlightSpanKind, - Identifier, - ImplementationLocation, - InterfaceDeclaration, - InternalSymbolName, isAccessExpression, isArrayLiteralOrObjectLiteralDestructuringPattern, isAssertionExpression, @@ -133,8 +178,8 @@ import { isJsxOpeningElement, isJsxSelfClosingElement, isJumpStatementTarget, - isLabeledStatement, isLabelOfLabeledStatement, + isLabeledStatement, isLiteralComputedPropertyDeclarationName, isLiteralNameOfPropertyDeclarationOrIndexAccess, isLiteralTypeNode, @@ -155,8 +200,8 @@ import { isPrivateIdentifierClassElementDeclaration, isPropertyAccessExpression, isQualifiedName, - isReferencedFile, isReferenceFileLocation, + isReferencedFile, isRightSideOfPropertyAccess, isShorthandPropertyAssignment, isSourceFile, @@ -179,78 +224,33 @@ import { isVariableStatement, isVoidExpression, isWriteAccess, - JSDocTag, map, mapDefined, - MethodDeclaration, - ModifierFlags, - ModuleDeclaration, - MultiMap, - NamedDeclaration, - Node, - NodeFlags, nodeSeenTracker, - NumericLiteral, - ObjectLiteralExpression, - 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, - SuperContainer, - Symbol, - SymbolDisplay, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolFlags, - SymbolId, symbolName, - SyntaxKind, textPart, - TextSpan, tokenToString, tryAddToSet, tryCast, tryGetClassExtendingExpressionWithTypeArguments, tryGetImportFromModuleSpecifier, - TypeChecker, - TypeLiteralNode, - VariableDeclaration, } from "./_namespaces/ts"; import { - createImportTracker, ExportInfo, ExportKind, - findModuleReferences, - getExportInfo, - getImportOrExportSymbol, ImportExport, - ImportsResult, ImportTracker, + ImportsResult, ModuleReference, + createImportTracker, + findModuleReferences, + getExportInfo, + getImportOrExportSymbol, } from "./_namespaces/ts.FindAllReferences"; /** @internal */ diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index ae84a63ecfbcc..2223105546fa7 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -1,26 +1,40 @@ 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, @@ -31,7 +45,6 @@ import { getTokenAtPosition, getTrailingCommentRanges, hasDecorators, - InterfaceDeclaration, isComment, isDecorator, isJSDoc, @@ -41,13 +54,7 @@ import { isStringOrRegularExpressionOrTemplateLiteral, isToken, isWhiteSpaceSingleLine, - LanguageVariant, last, - LineAndCharacter, - MethodDeclaration, - ModuleDeclaration, - Node, - NodeArray, nodeIsMissing, nodeIsSynthesized, rangeContainsPositionExclusive, @@ -55,26 +62,19 @@ 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 511246c7d899f..4c90a6f312c4f 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 5d29e814ce807..7ddb731cf3a26 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 b474c67969f6c..6242025b63b23 100644 --- a/src/services/formatting/rule.ts +++ b/src/services/formatting/rule.ts @@ -1,7 +1,7 @@ import { FormattingContext } from "../_namespaces/ts.formatting"; import { - emptyArray, SyntaxKind, + emptyArray, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index fc7a3a0b28a74..74d6240b6aa7f 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -1,5 +1,4 @@ import { - anyContext, ContextPredicate, FormattingContext, FormattingRequestKind, @@ -8,13 +7,18 @@ import { RuleFlags, TextRangeWithKind, TokenRange, + anyContext, } from "../_namespaces/ts.formatting"; import { BinaryExpression, + FormatCodeSettings, + Node, + SemicolonPreference, + SyntaxKind, + YieldExpression, contains, findAncestor, findNextToken, - FormatCodeSettings, hasDecorators, hasProperty, isArray, @@ -25,12 +29,8 @@ 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 8970be77c18a5..70257f02417ca 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 b48051e8a651d..948bf0fb0e3fe 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -6,32 +6,14 @@ 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, @@ -39,11 +21,7 @@ import { NodeArray, ObjectBindingPattern, ObjectLiteralExpression, - positionBelongsToNode, - rangeContainsRange, - rangeContainsStartEnd, SignatureDeclaration, - skipTrivia, SourceFile, SourceFileLike, SyntaxKind, @@ -52,10 +30,32 @@ 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 { - getRangeOfEnclosingComment, TextRangeWithKind, + getRangeOfEnclosingComment, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index ef3a1107fca0b..cdc3d5deb7ba2 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -1,19 +1,32 @@ 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, @@ -29,27 +42,14 @@ 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 2529f9194610b..6f14f5ab8f91a 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -3,26 +3,41 @@ import { AssignmentExpression, AssignmentOperatorToken, CallLikeExpression, - canHaveSymbol, concatenate, + Debug, Declaration, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + FileReference, + FindAllReferences, + FunctionLikeDeclaration, + ModifierFlags, + Node, + NodeFlags, + Program, + ScriptElementKind, + SignatureDeclaration, + SourceFile, + Symbol, + SymbolDisplay, + SymbolFlags, + SyntaxKind, + TextSpan, + Type, + TypeChecker, + TypeFlags, + canHaveSymbol, + concatenate, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, - Debug, - Declaration, - DefinitionInfo, - DefinitionInfoAndBoundSpan, emptyArray, every, - FileReference, filter, find, - FindAllReferences, findAncestor, first, flatMap, forEach, - FunctionLikeDeclaration, getAssignmentDeclarationKind, getContainingObjectLiteralElement, getDirectoryPath, @@ -71,30 +86,15 @@ 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 1d59846a2a8f5..bcdf6e4060ee2 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -1,18 +1,42 @@ import { - __String, AnyImportOrReExport, AssignmentDeclarationKind, BinaryExpression, BindingElement, CallExpression, CancellationToken, - canHaveModifiers, - canHaveSymbol, - 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, + canHaveSymbol, + cast, findAncestor, forEach, getAssignmentDeclarationKind, @@ -21,14 +45,7 @@ import { getSourceFileOfNode, getSymbolId, hasSyntacticModifier, - Identifier, - ImportCall, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, importFromModuleSpecifier, - ImportSpecifier, - InternalSymbolName, isAccessExpression, isBinaryExpression, isBindingElement, @@ -56,28 +73,11 @@ import { isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, - ModifierFlags, - ModuleBlock, - ModuleDeclaration, - NamedImportsOrExports, - NamespaceImport, - Node, nodeSeenTracker, - Program, some, - SourceFile, - Statement, - StringLiteral, - StringLiteralLike, - Symbol, symbolEscapedNameNoDefault, - SymbolFlags, symbolName, - SyntaxKind, tryCast, - TypeChecker, - ValidImportTypeNode, - VariableDeclaration, walkUpBindingElementsAndPatterns, } from "./_namespaces/ts"; diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index 5544aaa920c02..795e4eedcb6a3 100644 --- a/src/services/inlayHints.ts +++ b/src/services/inlayHints.ts @@ -1,28 +1,44 @@ 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, @@ -47,27 +63,11 @@ 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 8e26719167ba2..a7e5860ffd4f7 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,20 +1,51 @@ 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, + JSDocThrowsTag, + JSDocTypeTag, + JSDocTypedefTag, + MethodDeclaration, + MethodSignature, + Node, + ParameterDeclaration, + ParenthesizedExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + ScriptElementKind, + SourceFile, + SymbolDisplayPart, + SyntaxKind, + TextInsertion, + TypeChecker, + VariableStatement, + arraysEqual, + buildLinkParts, + contains, + emptyArray, find, findAncestor, flatMap, @@ -23,8 +54,6 @@ import { forEachAncestor, forEachReturnStatement, forEachUnique, - FunctionDeclaration, - FunctionExpression, getAssignmentDeclarationKind, getJSDocCommentsAndTags, getJSDocTags, @@ -45,48 +74,19 @@ import { isJSDoc, isJSDocParameterTag, isWhiteSpaceSingleLine, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocComment, - JSDocImplementsTag, - JSDocParameterTag, - JSDocPropertyTag, - JSDocSeeTag, - JSDocTag, - JSDocTagInfo, - JSDocTemplateTag, - JSDocThrowsTag, - 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 aa57b808e9f99..d9bb97eb9d9eb 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, - PatternMatcher, PatternMatchKind, + PatternMatcher, 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 132ff59e9909b..ef79aa8f4ff3d 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -11,30 +11,51 @@ 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, @@ -49,11 +70,7 @@ import { getTextOfNode, hasDynamicName, hasJSDocNodes, - Identifier, idText, - ImportClause, - InterfaceDeclaration, - InternalSymbolName, isAmbientModule, isArrowFunction, isBinaryExpression, @@ -87,27 +104,10 @@ 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 881c2d6471501..a70d6f784461d 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -1,32 +1,44 @@ import { AnyImportOrRequireStatement, + Comparison, + EmitFlags, + ExportDeclaration, + ExportSpecifier, + Expression, + FileTextChanges, + FindAllReferences, + Identifier, + ImportDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + LanguageServiceHost, + NamedImportBindings, + NamedImports, + NamespaceImport, + OrganizeImportsMode, + Program, + Scanner, + SortKind, + SourceFile, + SyntaxKind, + TransformFlags, + UserPreferences, arrayIsSorted, binarySearch, compareBooleans, compareStringsCaseInsensitiveEslintCompatible, compareStringsCaseSensitive, compareValues, - Comparison, createScanner, detectSortCaseSensitivity, - EmitFlags, emptyArray, - ExportDeclaration, - ExportSpecifier, - Expression, factory, - FileTextChanges, find, - FindAllReferences, flatMap, formatting, getNewLineOrDefaultFromHost, group, - Identifier, identity, - ImportDeclaration, - ImportOrExportSpecifier, - ImportSpecifier, isAmbientModule, isExportDeclaration, isExternalModuleNameRelative, @@ -39,28 +51,16 @@ import { isStringLiteral, isStringLiteralLike, jsxModeNeedsExplicitImport, - LanguageServiceHost, length, map, memoizeWeak, - NamedImportBindings, - NamedImports, - NamespaceImport, - OrganizeImportsMode, - Program, rangeIsOnSingleLine, - Scanner, setEmitFlags, some, - SortKind, - SourceFile, stableSort, suppressLeadingTrivia, - SyntaxKind, textChanges, - TransformFlags, tryCast, - UserPreferences, } from "./_namespaces/ts"; /** diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 47ac841287c54..b7933b52970ec 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -4,11 +4,28 @@ 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, @@ -32,27 +49,10 @@ 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 b021f959c6a34..4e4004a774d9c 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 084a99595cc5b..af3194a019961 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 611c846c21c99..fc9ad1abc6ea0 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 25aabb5d07b84..c7f9f753025c4 100644 --- a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts +++ b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts @@ -2,13 +2,18 @@ import { ApplicableRefactorInfo, ArrowFunction, ConciseBody, + Debug, + Diagnostics, + Expression, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + SyntaxKind, copyLeadingComments, copyTrailingAsLeadingComments, copyTrailingComments, - Debug, - Diagnostics, emptyArray, - Expression, factory, first, getContainingFunction, @@ -20,16 +25,11 @@ import { isReturnStatement, needsParentheses, rangeContainsRange, - RefactorContext, - RefactorEditInfo, - ReturnStatement, - SourceFile, - SyntaxKind, textChanges, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, + isRefactorErrorInfo, refactorKindBeginsWith, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts index f631f1387e221..f3938e271716e 100644 --- a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts +++ b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts @@ -3,23 +3,37 @@ import { ArrowFunction, Block, ConciseBody, - copyComments, - copyTrailingAsLeadingComments, Debug, Diagnostics, - emptyArray, - factory, FileTextChanges, FindAllReferences, + FunctionExpression, + Identifier, + ModifierFlags, + Node, + Program, + RefactorActionInfo, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + Statement, + SyntaxKind, + TypeChecker, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + copyComments, + copyTrailingAsLeadingComments, + emptyArray, + factory, first, forEachChild, - FunctionExpression, getCombinedModifierFlags, getContainingFunction, getEffectiveModifierFlags, getLocaleSpecificMessage, getTokenAtPosition, - Identifier, isArrowFunction, isClassLike, isExpression, @@ -33,24 +47,10 @@ 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 64c758895e9d7..588326c35eec7 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -4,34 +4,17 @@ 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, ModuleBlock, NamespaceDeclaration, @@ -40,20 +23,37 @@ 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 { - isRefactorErrorInfo, RefactorErrorInfo, + isRefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertImport.ts b/src/services/refactors/convertImport.ts index a7d0d0d53123b..69923c53466cc 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -1,33 +1,14 @@ 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, @@ -36,17 +17,36 @@ import { RefactorContext, RefactorEditInfo, ScriptTarget, - some, SourceFile, Symbol, SymbolFlags, SyntaxKind, - textChanges, TypeChecker, + arrayFrom, + codefix, + emptyArray, + factory, + findAncestor, + findNextToken, + getAllowSyntheticDefaultImports, + getLocaleSpecificMessage, + getOwnValues, + getParentNodeInSpan, + getRefactorContextSpan, + getTokenAtPosition, + getUniqueName, + isExportSpecifier, + isImportDeclaration, + isPropertyAccessExpression, + isPropertyAccessOrQualifiedName, + isShorthandPropertyAssignment, + isStringLiteral, + some, + textChanges, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, + isRefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertOverloadListToSingleSignature.ts b/src/services/refactors/convertOverloadListToSingleSignature.ts index c0ad2970a6138..f58b06d5e533a 100644 --- a/src/services/refactors/convertOverloadListToSingleSignature.ts +++ b/src/services/refactors/convertOverloadListToSingleSignature.ts @@ -1,17 +1,29 @@ import { ApplicableRefactorInfo, CallSignatureDeclaration, - ConstructorDeclaration, ConstructSignatureDeclaration, + ConstructorDeclaration, Debug, Diagnostics, - displayPartsToString, EmitFlags, + FunctionDeclaration, + MethodDeclaration, + MethodSignature, + NamedTupleMember, + Node, + NodeArray, + ParameterDeclaration, + Program, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, + TupleTypeNode, + displayPartsToString, emptyArray, every, factory, findAncestor, - FunctionDeclaration, getSourceFileOfNode, getSyntheticLeadingComments, getTokenAtPosition, @@ -20,24 +32,12 @@ 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 a86e190d2d8cd..c7cf380b53e6f 100644 --- a/src/services/refactors/convertParamsToDestructuredObject.ts +++ b/src/services/refactors/convertParamsToDestructuredObject.ts @@ -1,5 +1,4 @@ import { - addEmitFlags, ApplicableRefactorInfo, ArrowFunction, BindingElement, @@ -8,30 +7,57 @@ 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, @@ -43,7 +69,6 @@ import { getTextOfIdentifierOrLiteral, getTouchingToken, getTypeNodeIfAccessible, - Identifier, isCallOrNewExpression, isClassDeclaration, isConstructorDeclaration, @@ -71,38 +96,13 @@ 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 712308df7bed2..73eb5a1a1d871 100644 --- a/src/services/refactors/convertStringOrTemplateLiteral.ts +++ b/src/services/refactors/convertStringOrTemplateLiteral.ts @@ -2,12 +2,23 @@ import { ApplicableRefactorInfo, BinaryExpression, BinaryOperator, - copyTrailingAsLeadingComments, - copyTrailingComments, Debug, Diagnostics, - emptyArray, Expression, + Node, + ParenthesizedExpression, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, + TemplateHead, + TemplateMiddle, + TemplateSpan, + TemplateTail, + Token, + copyTrailingAsLeadingComments, + copyTrailingComments, + emptyArray, factory, findAncestor, getLocaleSpecificMessage, @@ -23,18 +34,7 @@ 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 a86777e97dd63..4cc566753adb9 100644 --- a/src/services/refactors/convertToOptionalChainExpression.ts +++ b/src/services/refactors/convertToOptionalChainExpression.ts @@ -3,20 +3,30 @@ 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, @@ -28,22 +38,12 @@ import { isReturnStatement, isStringOrNumericLiteralLike, isVariableStatement, - Node, - PropertyAccessExpression, - RefactorContext, - RefactorEditInfo, - ReturnStatement, skipParentheses, - SourceFile, - SyntaxKind, textChanges, - TextSpan, - TypeChecker, - VariableStatement, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, + isRefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 35aab0a65c361..a682bc5caeec8 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1,26 +1,15 @@ 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, @@ -28,10 +17,60 @@ 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, @@ -41,8 +80,6 @@ import { firstOrUndefined, forEachChild, formatStringFromArgs, - FunctionDeclaration, - FunctionLikeDeclaration, getContainingClass, getContainingFunction, getEffectiveTypeParameterDeclarations, @@ -60,7 +97,6 @@ import { getUniqueName, hasEffectiveModifier, hasSyntacticModifier, - Identifier, isArray, isArrowFunction, isAssignmentExpression, @@ -108,56 +144,20 @@ 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 d84d408cf6c46..1346b9208f33f 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -1,14 +1,26 @@ import { + ApplicableRefactorInfo, + Debug, + Diagnostics, + EmitFlags, + JSDocTag, + JSDocTemplateTag, + Node, + RefactorContext, + RefactorEditInfo, + SourceFile, + SymbolFlags, + TextRange, + TypeChecker, + TypeElement, + TypeNode, + TypeParameterDeclaration, addRange, addToSeen, append, - ApplicableRefactorInfo, cast, concatenate, createTextRangeFromSpan, - Debug, - Diagnostics, - EmitFlags, emptyArray, factory, findAncestor, @@ -44,29 +56,17 @@ import { isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, - JSDocTag, - JSDocTemplateTag, - Node, nodeOverlapsWithStartEnd, pushIfUnique, rangeContainsStartEnd, - RefactorContext, - RefactorEditInfo, setEmitFlags, setTextRange, skipTrivia, - SourceFile, - SymbolFlags, textChanges, - TextRange, - TypeChecker, - TypeElement, - TypeNode, - TypeParameterDeclaration, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, + isRefactorErrorInfo, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index 2982cacd8af7c..58c8796cc08fd 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 ccce34a8a14ac..7a31be79c606f 100644 --- a/src/services/refactors/inferFunctionReturnType.ts +++ b/src/services/refactors/inferFunctionReturnType.ts @@ -2,19 +2,8 @@ import { ApplicableRefactorInfo, ArrowFunction, Diagnostics, - emptyArray, - factory, - findAncestor, - findChildOfKind, - first, FunctionDeclaration, FunctionExpression, - getLocaleSpecificMessage, - getTokenAtPosition, - isArrowFunction, - isBlock, - isInJSFile, - mapDefined, MethodDeclaration, Node, NodeBuilderFlags, @@ -22,14 +11,25 @@ import { RefactorEditInfo, SourceFile, SyntaxKind, - textChanges, Type, TypeChecker, TypeNode, + emptyArray, + factory, + findAncestor, + findChildOfKind, + first, + getLocaleSpecificMessage, + getTokenAtPosition, + isArrowFunction, + isBlock, + isInJSFile, + mapDefined, + textChanges, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, + isRefactorErrorInfo, refactorKindBeginsWith, registerRefactor, } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 7950f25f5a6cf..42fb07472686b 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -1,17 +1,64 @@ import { getModuleSpecifier } from "../../compiler/moduleSpecifiers"; 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, - canHaveSymbol, cast, - ClassDeclaration, + canHaveSymbol, + cast, codefix, combinePaths, concatenate, @@ -19,28 +66,17 @@ import { copyEntries, createModuleSpecifierResolutionHost, createTextRangeFromSpan, - Debug, - Declaration, - DeclarationStatement, - Diagnostics, emptyArray, - EnumDeclaration, escapeLeadingUnderscores, - Expression, - ExpressionStatement, extensionFromPath, - ExternalModuleReference, factory, find, - FindAllReferences, findIndex, firstDefined, flatMap, forEachEntry, - FunctionDeclaration, getAssignmentDeclarationKind, getBaseFileName, - GetCanonicalFileName, getDecorators, getDirectoryPath, getLocaleSpecificMessage, @@ -54,12 +90,7 @@ import { getUniqueName, hasSyntacticModifier, hostGetCanonicalFileName, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, insertImports, - InterfaceDeclaration, - InternalSymbolName, isArrayLiteralExpression, isBinaryExpression, isBindingElement, @@ -82,51 +113,20 @@ 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, - RequireOrImportCall, - RequireVariableStatement, resolvePath, - 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 52ee0b8a3f544..e23873907e500 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -1,12 +1,32 @@ 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, @@ -16,7 +36,6 @@ import { getTextOfIdentifierOrLiteral, getTextOfNode, getTouchingPropertyName, - ImportSpecifier, isExternalModuleNameRelative, isIdentifier, isImportOrExportSpecifierName, @@ -27,30 +46,11 @@ 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 0071e942139a6..a37756baf2add 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,7 +2,6 @@ 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, @@ -15,46 +14,29 @@ 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, @@ -63,73 +45,22 @@ 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, - 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, - hasTabstop, HighlightSpanKind, HostCancellationToken, - hostGetCanonicalFileName, - hostUsesCaseSensitiveFileNames, + IScriptSnapshot, Identifier, - identity, - idText, ImplementationLocation, ImportDeclaration, IndexKind, @@ -137,57 +68,12 @@ 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, - isTransientSymbol, - JsDoc, JSDoc, JSDocContainer, JSDocTagInfo, + JsDoc, JsonSourceFile, JsxAttributes, JsxClosingTagInfo, @@ -198,17 +84,9 @@ import { LanguageServiceHost, LanguageServiceMode, LanguageVariant, - lastOrUndefined, - length, LineAndCharacter, - lineBreakPart, LiteralType, - map, - mapDefined, MapLike, - mapOneOrMany, - maybeBind, - maybeSetLocalizedDiagnosticMessages, ModeAwareCache, ModifierFlags, ModuleDeclaration, @@ -218,8 +96,6 @@ import { Node, NodeArray, NodeFlags, - noop, - normalizePath, NumberLiteralType, NumericLiteral, ObjectAllocator, @@ -234,9 +110,7 @@ import { OutliningSpan, ParseConfigFileHost, ParsedCommandLine, - parseJsonSourceFileConfigFileContent, Path, - positionIsSynthesized, PossibleProgramFileInfo, PragmaMap, PrivateIdentifier, @@ -244,12 +118,11 @@ import { PropertyName, Push, QuickInfo, - refactor, RefactorContext, RefactorEditInfo, RefactorTriggerReason, - ReferencedSymbol, ReferenceEntry, + ReferencedSymbol, Rename, RenameInfo, RenameInfoOptions, @@ -257,15 +130,12 @@ import { ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirectiveWithFailedLookupLocations, - returnFalse, - scanner, ScriptElementKind, ScriptElementKindModifier, ScriptKind, ScriptTarget, SelectionRange, SemanticClassificationFormat, - setObjectAllocator, Signature, SignatureDeclaration, SignatureFlags, @@ -273,14 +143,12 @@ import { SignatureHelpItems, SignatureHelpItemsOptions, SignatureKind, - singleElementArray, SmartSelectionRange, SortedArray, SourceFile, SourceFileLike, SourceMapSource, Statement, - stringContains, StringLiteral, StringLiteralLike, StringLiteralType, @@ -288,22 +156,16 @@ import { SymbolDisplay, SymbolDisplayPart, SymbolFlags, - symbolName, SyntaxKind, SyntaxList, - tagNamesAreEquivalent, TextChange, TextChangeRange, TextInsertion, TextRange, TextSpan, - textSpanEnd, - timestamp, TodoComment, TodoCommentDescriptor, Token, - toPath, - tracing, TransformFlags, Type, TypeChecker, @@ -312,13 +174,151 @@ 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, + hasTabstop, + 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, + isTransientSymbol, + 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 6f36697703396..4fbee2981a071 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 f662021481c4c..ea17a2de7e4dc 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -3,18 +3,43 @@ import { BinaryExpression, CallLikeExpression, CancellationToken, - canHaveSymbol, 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, + Type, + TypeChecker, + TypeParameter, + canHaveSymbol, contains, countWhere, createPrinter, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, - Debug, - EmitHint, emptyArray, - Expression, factory, findContainingList, findIndex, @@ -23,21 +48,18 @@ import { first, firstDefined, flatMapToMutable, - FunctionExpression, getInvokedExpression, getPossibleGenericSignatures, getPossibleTypeArgumentsInfo, - Identifier, identity, - InternalSymbolName, isBinaryExpression, isBlock, isCallOrNewExpression, isFunctionTypeNode, isIdentifier, isInComment, - isInsideTemplateLiteral, isInString, + isInsideTemplateLiteral, isJsxOpeningLikeElement, isMethodDeclaration, isNoSubstitutionTemplateLiteral, @@ -52,36 +74,14 @@ import { isTransientSymbol, 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, tryCast, - 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 0e67fba79a386..670fe269afd80 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -1,9 +1,14 @@ import { CharacterCodes, + Debug, + Node, + SelectionRange, + SourceFile, + SyntaxKind, + SyntaxList, compact, contains, createTextSpanFromBounds, - Debug, findIndex, first, getTokenPosOfNode, @@ -34,16 +39,11 @@ 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 e77fe30e4acf1..02a1cb4b27549 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -1,13 +1,17 @@ import * as ts from "./_namespaces/ts"; import { - base64decode, - computeLineAndCharacterOfPosition, - createDocumentPositionMapper, - createGetCanonicalFileName, DocumentPosition, DocumentPositionMapper, DocumentPositionMapperHost, Extension, + LineAndCharacter, + LineInfo, + Program, + SourceFileLike, + base64decode, + computeLineAndCharacterOfPosition, + createDocumentPositionMapper, + createGetCanonicalFileName, getDeclarationEmitOutputFilePathWorker, getDirectoryPath, getLineInfo, @@ -16,12 +20,8 @@ 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 18f8e17750e2c..81affabcb4b07 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -1,36 +1,66 @@ import { + CallLikeExpression, + CancellationToken, + CharacterCodes, + Comparison, + CompilerOptions, + CompletionEntry, + CompletionEntryDetails, + CompletionInfo, + ContextFlags, + Debug, + ElementAccessExpression, + Extension, + IndexedAccessTypeNode, + JsxAttribute, + LanguageServiceHost, + LiteralExpression, + LiteralTypeNode, + MapLike, + ModuleKind, + ModuleSpecifierEnding, + 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, @@ -62,7 +92,6 @@ import { hasProperty, hasTrailingDirectorySeparator, hostGetCanonicalFileName, - IndexedAccessTypeNode, isApplicableVersionedTypesKey, isArray, isCallExpression, @@ -83,51 +112,27 @@ import { isStringLiteralLike, isTypeReferenceNode, isUrl, - JsxAttribute, - LanguageServiceHost, length, - LiteralExpression, - LiteralTypeNode, mapDefined, - MapLike, - ModuleKind, moduleResolutionUsesNodeModules, - ModuleSpecifierEnding, 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, supportedTSImplementationExtensions, - Symbol, - SyntaxKind, textPart, - TextSpan, tryAndIgnoreErrors, tryDirectoryExists, tryFileExists, @@ -137,23 +142,18 @@ 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 87cf371041f37..f47dcd1cfa0a9 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -1,25 +1,38 @@ import { - addRange, AnyValidImportOrReExport, ArrowFunction, AssignmentDeclarationKind, Block, CallExpression, CancellationToken, - codefix, - compilerOptionsIndicateEsModules, - createDiagnosticForNode, - Diagnostics, DiagnosticWithLocation, + Diagnostics, 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, @@ -27,7 +40,6 @@ import { getResolvedModule, hasInitializer, hasPropertyAccessExpressionWithName, - Identifier, importFromModuleSpecifier, isAsyncFunction, isBinaryExpression, @@ -45,21 +57,9 @@ 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 bda7ba595090c..bb91f386d51f2 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -1,22 +1,56 @@ import { - addRange, - arrayFrom, BinaryExpression, CallExpression, CheckFlags, - contains, - createPrinter, Debug, - displayPart, EmitHint, - emptyArray, 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, + displayPart, + emptyArray, find, first, firstDefined, forEach, - GetAccessorDeclaration, getCombinedLocalAndExportSymbolFlags, getDeclarationOfKind, getExternalModuleImportEqualsDeclarationExpression, @@ -31,7 +65,6 @@ import { getTextOfNode, hasSyntacticModifier, idText, - ImportEqualsDeclaration, isArrowFunction, isBindingElement, isCallExpression, @@ -61,52 +94,19 @@ import { isTransientSymbol, isTypeAliasDeclaration, 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 98a35af0fe3e0..acd409803c53e 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -1,5 +1,4 @@ import { - addToSeen, ArrowFunction, BindingElement, CharacterCodes, @@ -7,8 +6,63 @@ import { ClassExpression, ClassLikeDeclaration, CommentRange, - concatenate, 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, contains, createNodeFactory, createPrinter, @@ -19,14 +73,8 @@ import { createTextSpan, createTextSpanFromRange, createTextWriter, - Debug, - DeclarationStatement, - EmitHint, - EmitTextWriter, endsWith, - Expression, factory, - FileTextChanges, filter, find, findChildOfKind, @@ -38,8 +86,6 @@ import { flatMap, flatMapToMutable, formatting, - FunctionDeclaration, - FunctionExpression, getAncestor, getFirstNonSpaceCharacterPosition, getFormatCodeSettingsForWriting, @@ -59,12 +105,8 @@ import { getTouchingToken, getTrailingCommentRanges, group, - HasJSDoc, hasJSDocNodes, - ImportClause, - ImportSpecifier, indexOfNode, - InterfaceDeclaration, intersperse, isAnyImportSyntax, isArray, @@ -103,70 +145,28 @@ 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 9c6f96408d464..91622afcae8c9 100644 --- a/src/services/transform.ts +++ b/src/services/transform.ts @@ -1,13 +1,13 @@ import { CompilerOptions, - concatenate, DiagnosticWithLocation, - factory, - fixupCompilerOptions, - isArray, Node, TransformationResult, TransformerFactory, + concatenate, + factory, + fixupCompilerOptions, + isArray, transformNodes, } from "./_namespaces/ts"; diff --git a/src/services/transpile.ts b/src/services/transpile.ts index 7329f788aa197..83b0b4eb9d4da 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -1,15 +1,16 @@ import { - addRange, - cloneCompilerOptions, CommandLineOptionOfCustomType, CompilerHost, CompilerOptions, - createCompilerDiagnosticForInvalidCustomType, - createProgram, - createSourceFile, CustomTransformers, Debug, Diagnostic, + MapLike, + addRange, + cloneCompilerOptions, + createCompilerDiagnosticForInvalidCustomType, + createProgram, + createSourceFile, fileExtensionIs, filter, forEachEntry, @@ -21,7 +22,6 @@ import { getSetExternalModuleIndicator, hasProperty, isString, - MapLike, normalizePath, optionDeclarations, parseCustomTypeOption, diff --git a/src/services/types.ts b/src/services/types.ts index ff726ff0663c7..e9356c0ff26a2 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -35,10 +35,10 @@ import { Symbol, SymlinkCache, TextChangeRange, - textChanges, TextRange, TextSpan, UserPreferences, + textChanges, } from "./_namespaces/ts"; declare module "../compiler/types" { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 3ac4c255fdde5..abef00afd758f 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1,66 +1,160 @@ 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, - factory, 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, + 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, filter, find, findAncestor, @@ -72,14 +166,8 @@ import { forEachChild, forEachLeadingCommentRange, forEachTrailingCommentRange, - FormatCodeSettings, formatStringFromArgs, formatting, - FormattingHost, - ForOfStatement, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, getAssignmentDeclarationKind, getCombinedNodeFlagsAlwaysIncludeJSDoc, getDirectoryPath, @@ -104,19 +192,10 @@ import { getTextOfNode, getTypesPackageName, hasSyntacticModifier, - HeritageClause, - Identifier, + idText, identifierIsThisKeyword, identity, - idText, - IfStatement, - ImportClause, - ImportDeclaration, - ImportSpecifier, - ImportTypeNode, indexOfNode, - IndexSignatureDeclaration, - InternalSymbolName, isAmbientModule, isAnyImportSyntax, isArray, @@ -133,7 +212,6 @@ import { isClassExpression, isClassStaticBlockDeclaration, isConditionalTypeNode, - IScriptSnapshot, isDeclaration, isDeclarationName, isDecorator, @@ -166,8 +244,8 @@ import { isImportEqualsDeclaration, isImportOrExportSpecifier, isImportSpecifier, - isInferTypeNode, isInJSFile, + isInferTypeNode, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, isJSDoc, @@ -239,117 +317,39 @@ 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, 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, 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 33d01f4c24953..890f281bde5e3 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 10122d7a899a5..55582b3987e6b 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 1ace1b58a423e..b71ee0cb07f63 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, - runners, runUnitTests, + runners, 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 ff5be50988071..d4c490ddf8e95 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 65af002657a19..60511d4f100cf 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -13,12 +13,12 @@ import { IO, Parallel, RunnerBase, - setLightMode, - setShardId, - setShards, Test262BaselineRunner, TestRunnerKind, UserCodeRunner, + setLightMode, + setShardId, + setShards, } from "./_namespaces/Harness"; /* eslint-disable prefer-const */ diff --git a/src/testRunner/unittests/builder.ts b/src/testRunner/unittests/builder.ts index 2c965e45323e0..5bdac7a0e22a2 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 6ce787dd72bf5..904369674334d 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -2,19 +2,19 @@ import * as ts from "../_namespaces/ts"; import * as Harness from "../_namespaces/Harness"; import * as Utils from "../_namespaces/Utils"; import { - createTestCompilerHost, NamedSourceText, - newLine, - newProgram, ProgramWithSourceTexts, SourceText, TestCompilerHost, + createTestCompilerHost, + newLine, + newProgram, updateProgram, updateProgramText, } from "./helpers"; import { - createWatchedSystem, File, + createWatchedSystem, libFile, } from "./virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index d677b34885fed..848b17f3db94c 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 { - createServerHost, File, + createServerHost, } 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 fa865d423b9d1..94efcaba3c818 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 6f0d500b8011f..26ae00cea14e4 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 { - createServerHost, File, + createServerHost, } 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 7e4f45752fcf4..ea8b2a007dc5e 100644 --- a/src/testRunner/unittests/tsbuild/commandLine.ts +++ b/src/testRunner/unittests/tsbuild/commandLine.ts @@ -1,11 +1,11 @@ import * as ts from "../../_namespaces/ts"; import { + TestTscEdit, appendText, compilerOptionsToConfigJson, loadProjectFromFiles, noChangeRun, replaceText, - TestTscEdit, verifyTsc, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 9f6b15a1f1629..ec3373530aa1c 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -2,6 +2,8 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; import { + TestTscEdit, + TscCompileSystem, addRest, addShebang, addSpread, @@ -18,8 +20,6 @@ import { removeRest, replaceText, testTscCompileLike, - TestTscEdit, - TscCompileSystem, verifyTsc, verifyTscCompileLike, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index 5d9cacc2b28dc..5fad3113a9151 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 { - loadProjectFromFiles, - noChangeRun, TestTscEdit, TscCompileSystem, - verifyTsc, VerifyTscWithEditsInput, + loadProjectFromFiles, + noChangeRun, + verifyTsc, } 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 ae548a0e51e7b..bb236257c76a5 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 b98f14f7c8e59..ef436c6c94bac 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -3,14 +3,16 @@ 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, @@ -21,8 +23,6 @@ import { prependText, replaceText, testTscCompileLike, - TestTscEdit, - TscCompileSystem, verifyTsc, verifyTscCompileLike, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts index 6b5bf9ade7e46..cc35b7182650b 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 8eefdb5ab203e..35a8d3acf79cb 100644 --- a/src/testRunner/unittests/tsbuildWatch/demo.ts +++ b/src/testRunner/unittests/tsbuildWatch/demo.ts @@ -1,6 +1,6 @@ import { - createWatchedSystem, File, + createWatchedSystem, getTsBuildProjectFile, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index b4498d1f7e5f9..2601fb561c046 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 { - createWatchedSystem, File, + TestServerHost, + createWatchedSystem, 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 6e37733643f0d..a39fbee85a6ea 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 { - createWatchedSystem, File, + createWatchedSystem, libFile, } from "../virtualFileSystemWithWatch"; import { - noopChange, TscWatchCompileChange, + noopChange, verifyTscWatch, } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/publicApi.ts b/src/testRunner/unittests/tsbuildWatch/publicApi.ts index af2bdb8f395b2..bb6fc13c2e3e2 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 { - createWatchedSystem, File, + createWatchedSystem, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index 2d02a48763242..ea13de090cf39 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 { - createWatchedSystem, File, - libFile, TestServerHost, + createWatchedSystem, + libFile, } from "../virtualFileSystemWithWatch"; import { createBaseline, diff --git a/src/testRunner/unittests/tsc/cancellationToken.ts b/src/testRunner/unittests/tsc/cancellationToken.ts index 9d83d93730410..9d4065eb44f76 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 { - createWatchedSystem, File, + createWatchedSystem, libFile, } from "../virtualFileSystemWithWatch"; import { - baselineBuildInfo, CommandLineProgram, + baselineBuildInfo, } from "../tsc/helpers"; import { applyEdit, diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index 65af3d8f3a8f8..c3214eb44d024 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 { - createWatchedSystem, FileOrFolderOrSymLink, + createWatchedSystem, isSymLink, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index acb23487741a5..0c7951ced7b55 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 { - libFile, TestServerHost, + libFile, } from "../virtualFileSystemWithWatch"; export interface DtsSignatureData { diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 3c3405dec550b..a18dc1055b329 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -2,6 +2,7 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import * as vfs from "../../_namespaces/vfs"; import { + TestTscEdit, appendText, compilerOptionsToConfigJson, libContent, @@ -11,7 +12,6 @@ import { noChangeRun, prependText, replaceText, - TestTscEdit, verifyTsc, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index 4c05b6f76b0b7..9a5b60ac19429 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 { - createWatchedSystem, File, + createWatchedSystem, 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 9cf3434477d56..430852a79040c 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 { - createWatchedSystem, File, - libFile, TestServerHost, + createWatchedSystem, + libFile, } from "../virtualFileSystemWithWatch"; import { TscWatchCompileChange, diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index afb337082c8c8..41d991d3999b4 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -1,6 +1,6 @@ import { - createWatchedSystem, File, + createWatchedSystem, getTsBuildProjectFile, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 89b7e5c293c6f..09dd36ddd9cab 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -1,9 +1,9 @@ import * as Utils from "../../_namespaces/Utils"; import { - createWatchedSystem, File, - libFile, SymLink, + createWatchedSystem, + libFile, } from "../virtualFileSystemWithWatch"; import { TscWatchCompileChange, diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 6cedbc57d9daa..15882d238f3f3 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 { - baselinePrograms, - commandLineCallbacks, CommandLineCallbacks, CommandLineProgram, + baselinePrograms, + commandLineCallbacks, createSolutionBuilderHostForBaseline, generateSourceMapBaselineFiles, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index 2773a739e6a80..dfaeaef7d0a75 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 { - createWatchedSystem, File, - libFile, TestServerHost, + createWatchedSystem, + libFile, } from "../virtualFileSystemWithWatch"; import { CommandLineProgram, libContent, } from "../tsc/helpers"; import { + SystemSnap, applyEdit, createBaseline, - SystemSnap, verifyTscWatch, watchBaseline, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 8aabf0b435798..4a9c6fab265f5 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -1,7 +1,7 @@ import * as Utils from "../../_namespaces/Utils"; import { - createWatchedSystem, File, + createWatchedSystem, libFile, } from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts index b9ab7e29666bf..891f6270fc681 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 { - createWatchedSystem, File, + createWatchedSystem, libFile, } from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 3437470bcd461..f9aa1f53c4617 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 fc2cc62640988..51c3988901a66 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -1,8 +1,8 @@ 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 0d50c03db8ce9..8c55d8fe47cd8 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 { - createWatchedSystem, File, - libFile, SymLink, + createWatchedSystem, + libFile, } from "../virtualFileSystemWithWatch"; import { createBaseline, diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index 37714c2b34275..b3bed27e607f2 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 09be991f9a308..45c63bd3b1313 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 { - createWatchedSystem, File, - libFile, TestServerHostTrackingWrittenFiles, + createWatchedSystem, + libFile, } from "../virtualFileSystemWithWatch"; import { applyEdit, diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index 17886d2f9da73..fbe722fd881ff 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 d7eed858ebe28..b11d28f640e8b 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { @@ -9,8 +9,8 @@ import { commonFile2, } from "../tscWatch/helpers"; import { - createSession, TestSession, + createSession, } from "./helpers"; describe("unittests:: tsserver:: applyChangesToOpenFiles", () => { diff --git a/src/testRunner/unittests/tsserver/autoImportProvider.ts b/src/testRunner/unittests/tsserver/autoImportProvider.ts index 5fdd48039fe35..5eaa1ffedb750 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { checkNumberOfConfiguredProjects, diff --git a/src/testRunner/unittests/tsserver/auxiliaryProject.ts b/src/testRunner/unittests/tsserver/auxiliaryProject.ts index 94b062a2c7f19..b55f0f72fbeab 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { checkNumberOfInferredProjects, diff --git a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts index cf3ca9ac028d6..9b84804f7bd88 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -1,21 +1,21 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, - libFile, SymLink, TestServerHost, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { + Logger, + TestProjectService, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, createLoggerWithInMemoryLogs, createProjectService, createSession, - Logger, openFilesForSession, - TestProjectService, } from "./helpers"; describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectSystem CachingFileSystemInformation", () => { diff --git a/src/testRunner/unittests/tsserver/cancellationToken.ts b/src/testRunner/unittests/tsserver/cancellationToken.ts index 4fb05770c6d6b..faead5a4b0a91 100644 --- a/src/testRunner/unittests/tsserver/cancellationToken.ts +++ b/src/testRunner/unittests/tsserver/cancellationToken.ts @@ -1,9 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { createServerHost } from "../virtualFileSystemWithWatch"; import { - createSession, TestServerCancellationToken, TestSessionRequest, + createSession, } from "./helpers"; describe("unittests:: tsserver:: cancellationToken", () => { diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index 88d52ef98203a..b2224ccf09235 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -1,18 +1,18 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { + Logger, + TestSession, + TestTypingsInstaller, baselineTsserverLogs, createLoggerWithInMemoryLogs, createSession, - Logger, openFilesForSession, protocolTextSpanFromSubstring, - TestSession, - TestTypingsInstaller, toExternalFiles, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 8e9a57cb23cc4..76e94110df746 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -1,15 +1,15 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { + TestTypingsInstaller, baselineTsserverLogs, createLoggerWithInMemoryLogs, createSession, 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 d834c5c83d7e2..8055317a56629 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/configFileSearch.ts b/src/testRunner/unittests/tsserver/configFileSearch.ts index 4e3d46204f777..739c07e2ade3e 100644 --- a/src/testRunner/unittests/tsserver/configFileSearch.ts +++ b/src/testRunner/unittests/tsserver/configFileSearch.ts @@ -1,6 +1,6 @@ import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index aeeba6f8a1973..c176c061e0d41 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 { - createServerHost, File, - libFile, SymLink, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { commonFile1, diff --git a/src/testRunner/unittests/tsserver/declarationFileMaps.ts b/src/testRunner/unittests/tsserver/declarationFileMaps.ts index aaf6a110e6cf0..bd31a09b852bc 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -1,16 +1,16 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { + TestSession, baselineTsserverLogs, closeFilesForSession, createLoggerWithInMemoryLogs, createSession, openFilesForSession, protocolFileLocationFromSubstring, - TestSession, } from "./helpers"; function checkDeclarationFiles(file: File, session: TestSession): void { diff --git a/src/testRunner/unittests/tsserver/documentRegistry.ts b/src/testRunner/unittests/tsserver/documentRegistry.ts index 6452515db8c7b..c93b84a67a114 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 { - createServerHost, File, + createServerHost, 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 dbaa4888f346d..1dcefad51fc3a 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index f4ec990c9eee7..157369e26891f 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts index b2584532979f9..c775e8a104e51 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 { - createServerHost, File, + createServerHost, libFile, } from "../../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts index 9c6bd0d664ebf..67f56833399b6 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 { - createServerHost, File, + createServerHost, libFile, } from "../../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/events/projectLoading.ts b/src/testRunner/unittests/tsserver/events/projectLoading.ts index 739a29a503ebb..92f7e47b7fc01 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 { - createServerHost, File, - libFile, TestServerHost, + createServerHost, + libFile, } 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 8acf0e1c6b2ac..48457ff976dc7 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 { - createServerHost, File, - libFile, TestServerHost, + createServerHost, + libFile, } 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 81c05fd4b2db2..495840e5e4d24 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { configuredProjectAt, diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index dfa9ec8b3264b..222fe93f82edf 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts index c505181c490e9..1c0411cb425c1 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts index a383a414dc70f..5a9348e96360d 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts index ec177e791923b..a7c436b899e9d 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/getExportReferences.ts b/src/testRunner/unittests/tsserver/getExportReferences.ts index 08b03e9bf54f2..5e59818a522df 100644 --- a/src/testRunner/unittests/tsserver/getExportReferences.ts +++ b/src/testRunner/unittests/tsserver/getExportReferences.ts @@ -1,7 +1,7 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/getFileReferences.ts b/src/testRunner/unittests/tsserver/getFileReferences.ts index b6092d2524352..950f958a7b985 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 62ae117c734bd..408645652df0f 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -2,13 +2,13 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import * as Utils from "../../_namespaces/Utils"; import { - changeToHostTrackingWrittenFiles, - createServerHost, File, FileOrFolderOrSymLink, - libFile, TestServerHost, TestServerHostTrackingWrittenFiles, + changeToHostTrackingWrittenFiles, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { ensureErrorFreeBuild } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index 11fded416f680..5a69bc6e9f1c1 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 { - createServerHost, File, + createServerHost, 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 c113207329bc3..8fb572967541f 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { @@ -9,8 +9,8 @@ import { commonFile2, } from "../tscWatch/helpers"; import { - createSession, TestSession, + createSession, } from "./helpers"; describe("unittests:: tsserver:: inlayHints", () => { diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 5fcf7726abfc6..050d3cc933667 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { createSession, diff --git a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts index f163dbbbfd7d6..f65581a725523 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/metadataInResponse.ts b/src/testRunner/unittests/tsserver/metadataInResponse.ts index 5a2d5dc37958f..e79227946d26e 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 c83d202d46910..73d712ff87d62 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts index b96b7ae68119b..31217a043fa01 100644 --- a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts +++ b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, SymLink, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/navTo.ts b/src/testRunner/unittests/tsserver/navTo.ts index 1ba1051fc2935..92f937b053dda 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/occurences.ts b/src/testRunner/unittests/tsserver/occurences.ts index 62da2a80b7449..de5b655211166 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 9933afd8ad00b..190cddc49f295 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/packageJsonInfo.ts b/src/testRunner/unittests/tsserver/packageJsonInfo.ts index b122bd7b89369..393c5a24ba02f 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { configuredProjectAt, diff --git a/src/testRunner/unittests/tsserver/partialSemanticServer.ts b/src/testRunner/unittests/tsserver/partialSemanticServer.ts index 81304941d8a26..bc09ece98fc4c 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/plugins.ts b/src/testRunner/unittests/tsserver/plugins.ts index 114ce5d078847..199856101b96f 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 57e8cf3db4cc3..6fa2f4785f1e2 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 b8de4f6d65c19..c1dafa9ad79b8 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 { - createServerHost, File, + createServerHost, 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 cc3ffc3d0523d..2bb8a16dea4d6 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -12,12 +12,12 @@ import { verifyGetErrRequest, } from "./helpers"; import { - createServerHost, File, + SymLink, + createServerHost, 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 f9926640e6f54..bd0d8e6fd9f3e 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -1,19 +1,19 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, - libFile, TestServerHost, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { + TestSession, + TestSessionRequest, baselineTsserverLogs, closeFilesForSession, createHostWithSolutionBuild, createLoggerWithInMemoryLogs, createSession, openFilesForSession, - TestSession, - TestSessionRequest, } 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 344b1a4793d21..05a4b247fc754 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { @@ -9,6 +9,7 @@ import { commonFile2, } from "../tscWatch/helpers"; import { + TestSessionRequest, baselineTsserverLogs, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, @@ -23,7 +24,6 @@ import { customTypesMap, openFilesForSession, protocolFileLocationFromSubstring, - TestSessionRequest, toExternalFile, toExternalFiles, verifyGetErrRequest, diff --git a/src/testRunner/unittests/tsserver/projectsWithReferences.ts b/src/testRunner/unittests/tsserver/projectsWithReferences.ts index a1f780dcc8c77..ada75410a174e 100644 --- a/src/testRunner/unittests/tsserver/projectsWithReferences.ts +++ b/src/testRunner/unittests/tsserver/projectsWithReferences.ts @@ -1,6 +1,6 @@ import { - createServerHost, File, + createServerHost, getTsBuildProjectFile, libFile, } from "../virtualFileSystemWithWatch"; diff --git a/src/testRunner/unittests/tsserver/refactors.ts b/src/testRunner/unittests/tsserver/refactors.ts index c8885712174ff..8a7bff7605cd2 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/reloadProjects.ts b/src/testRunner/unittests/tsserver/reloadProjects.ts index d65eee7ac4164..d22928bcc80ce 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 { - createServerHost, File, - libFile, TestServerHost, + createServerHost, + libFile, } 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 71d60988656e9..5b14f87572dfd 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 { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { baselineTsserverLogs, diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 29e9f7b33339a..803aff0991f11 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -1,15 +1,16 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - createServerHost, File, - libFile, TestServerHost, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { compilerOptionsToConfigJson, } from "../tsc/helpers"; import { + TestTypingsInstaller, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, @@ -18,7 +19,6 @@ import { createProjectService, createSession, openFilesForSession, - TestTypingsInstaller, toExternalFiles, verifyGetErrRequest, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/smartSelection.ts b/src/testRunner/unittests/tsserver/smartSelection.ts index 3fe5245b5f30e..baded4407b473 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/symLinks.ts b/src/testRunner/unittests/tsserver/symLinks.ts index 33e0ac5e7a9e3..7ae878ecb2355 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 e389efd319f5a..4d1e73f6def7a 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 fa98fbdd1e8f2..d20b6367b0425 100644 --- a/src/testRunner/unittests/tsserver/syntacticServer.ts +++ b/src/testRunner/unittests/tsserver/syntacticServer.ts @@ -1,10 +1,12 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { + TestSession, + TestSessionRequest, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, @@ -13,8 +15,6 @@ import { createSession, openFilesForSession, protocolFileLocationFromSubstring, - TestSession, - TestSessionRequest, } 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 9257ac4400ecc..450f8f04d9815 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 { - createServerHost, File, + createServerHost, 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 a741c8517366d..3efc9bdd2136a 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 6750433c9f9ec..ec5ffbcafd825 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 c500f042d60c1..3d4006070c0cf 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 { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts index 651e0889e1a56..84f259ba94427 100644 --- a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts +++ b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts @@ -1,6 +1,6 @@ import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index 5071df7b4be96..81a5224a70233 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -1,11 +1,12 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, - libFile, TestServerHost, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { + TestTypingsInstaller, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, @@ -15,7 +16,6 @@ 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 de6fbde92e555..19f694370092a 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 { - createServerHost, File, - libFile, Tsc_WatchDirectory, + createServerHost, + libFile, } 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/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 7dfb1f195f381..50815e4246c54 100644 --- a/src/testRunner/unittests/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/virtualFileSystemWithWatch.ts @@ -1,5 +1,21 @@ import * as Harness from "../_namespaces/Harness"; import { + Debug, + FileSystemEntryKind, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + FormatDiagnosticsHost, + FsWatchCallback, + FsWatchWorkerWatcher, + HostWatchDirectory, + HostWatchFile, + ModuleResolutionHost, + MultiMap, + Path, + PollingInterval, + RequireResult, + SortedArray, clear, clone, combinePaths, @@ -7,38 +23,22 @@ import { createGetCanonicalFileName, createMultiMap, createSystemWatchFunctions, - Debug, directorySeparator, - FileSystemEntryKind, - FileWatcher, - FileWatcherCallback, - FileWatcherEventKind, filterMutate, - FormatDiagnosticsHost, - FsWatchCallback, - FsWatchWorkerWatcher, generateDjb2Hash, getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, getRelativePathToDirectoryOrUrl, hasProperty, - HostWatchDirectory, - HostWatchFile, insertSorted, isArray, 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 109f255e6cfaf..5bf8994ac738c 100644 --- a/src/tsserver/common.ts +++ b/src/tsserver/common.ts @@ -1,6 +1,6 @@ import { - Logger, LogLevel, + Logger, ServerCancellationToken, SessionOptions, } from "./_namespaces/ts.server"; diff --git a/src/tsserver/nodeServer.ts b/src/tsserver/nodeServer.ts index 29ed8aaa81109..187d2c0372392 100644 --- a/src/tsserver/nodeServer.ts +++ b/src/tsserver/nodeServer.ts @@ -6,77 +6,77 @@ import { ActionSet, Arguments, BeginInstallTypes, - createInstallTypingsRequest, EndInstallTypes, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, EventTypesRegistry, - findArgument, - formatMessage, - getLogLevel, - hasArgument, - indent, + ITypingsInstaller, InitializationFailedResponse, InstallPackageOptionsWithProject, InstallPackageRequest, InvalidateCachedTypings, - ITypingsInstaller, - Logger, LogLevel, + Logger, ModuleImportResult, Msg, - nowString, - nullCancellationToken, - nullTypingsInstaller, PackageInstalledResponse, Project, ProjectService, - protocol, ServerCancellationToken, ServerHost, Session, SetTypings, StartInput, StartSessionOptions, - stringifyIndented, - toEvent, TypesRegistryResponse, TypingInstallerRequestUnion, + createInstallTypingsRequest, + findArgument, + formatMessage, + getLogLevel, + hasArgument, + indent, + nowString, + nullCancellationToken, + nullTypingsInstaller, + protocol, + stringifyIndented, + toEvent, } from "./_namespaces/ts.server"; import { ApplyCodeActionCommandResult, - assertType, CharacterCodes, - combinePaths, - createQueue, Debug, - directorySeparator, DirectoryWatcherCallback, FileWatcher, + JsTyping, + LanguageServiceMode, + MapLike, + SortedReadonlyArray, + TypeAcquisition, + WatchOptions, + assertType, + combinePaths, + createQueue, + directorySeparator, getDirectoryPath, getEntries, getNodeMajorVersion, getRootLength, - JsTyping, - LanguageServiceMode, - MapLike, noop, noopFileWatcher, normalizePath, normalizeSlashes, perfLogger, 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 a07a98e6781c5..39a1788a23eaa 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -1,10 +1,10 @@ import { + Msg, + StartInput, emptyArray, findArgument, hasArgument, initializeNodeSystem, - Msg, - StartInput, } from "./_namespaces/ts.server"; import { Debug, diff --git a/src/typingsInstaller/nodeTypingsInstaller.ts b/src/typingsInstaller/nodeTypingsInstaller.ts index 0d8d0eb5d61aa..68774b3c5f4d7 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 3300603c6ccfa..db4414ad45935 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, From 5000d76f31a401d6f538c33d5f30d973259ee444 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 20 Dec 2022 10:48:36 -0800 Subject: [PATCH 2/3] Fix bad merge --- src/compiler/commandLineParser.ts | 8 +------- src/services/outliningElementsCollector.ts | 10 ---------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 7a7487aa9bccb..bd233f6dfe299 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -21,19 +21,12 @@ import { JsonSourceFile, JsxEmit, MapLike, - MapLike, - ModuleDetectionKind, ModuleDetectionKind, ModuleKind, - ModuleKind, - ModuleResolutionKind, ModuleResolutionKind, NewLineKind, - NewLineKind, - Node, Node, NodeArray, - NodeArray, NumericLiteral, ObjectLiteralExpression, ParseConfigHost, @@ -122,6 +115,7 @@ import { stringContains, sys, toFileNameLowerCase, + toPath, tracing, trimString, unescapeLeadingUnderscores, diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 6844831674f71..a3a855d82d3ea 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -8,26 +8,16 @@ import { Debug, DefaultClause, JsxAttributes, - JsxAttributes, - JsxElement, JsxElement, JsxFragment, - JsxFragment, - JsxOpeningLikeElement, JsxOpeningLikeElement, NamedExports, NamedImports, NoSubstitutionTemplateLiteral, - NoSubstitutionTemplateLiteral, Node, - Node, - NodeArray, NodeArray, OutliningSpan, - OutliningSpan, OutliningSpanKind, - OutliningSpanKind, - ParenthesizedExpression, ParenthesizedExpression, Push, SignatureDeclaration, From 118bdad1024dd8aa4ef61f5d1782f9c13615d753 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 3 Jan 2023 11:08:21 -0800 Subject: [PATCH 3/3] Fix --- src/services/codefixes/fixJSDocTypes.ts | 4 ++-- src/services/utilities.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts index 1861ac082e8a2..21396291bf827 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -1,5 +1,4 @@ import { - append, AsExpression, CallSignatureDeclaration, CodeFixAction, @@ -9,7 +8,6 @@ import { FunctionDeclaration, GetAccessorDeclaration, IndexSignatureDeclaration, - isJSDocNullableType, MappedTypeNode, MethodDeclaration, MethodSignature, @@ -27,8 +25,10 @@ import { TypeFlags, TypeNode, VariableDeclaration, + append, findAncestor, getTokenAtPosition, + isJSDocNullableType, textChanges, } from "../_namespaces/ts"; import { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index b104febf4a706..1e2cfadb7bf6e 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -15,6 +15,7 @@ import { Comparison, CompilerOptions, ConditionalExpression, + ContextFlags, Debug, Declaration, Decorator, @@ -144,7 +145,6 @@ import { compareTextSpans, compareValues, contains, - ContextFlags, createPrinter, createRange, createScanner,