From 13d2e046cb68d50b8518fe05d3d7b3f8c9ed3515 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:01:47 -0800 Subject: [PATCH 1/6] Replace all import/export pairs in namespaces with export only --- src/compiler/_namespaces/ts.ts | 6 +- src/harness/_namespaces/Harness.ts | 6 +- src/harness/_namespaces/ts.ts | 3 +- src/jsTyping/_namespaces/ts.ts | 6 +- src/loggedIO/_namespaces/ts.ts | 3 +- src/server/_namespaces/ts.server.ts | 3 +- src/server/_namespaces/ts.ts | 3 +- src/services/_namespaces/ts.Completions.ts | 3 +- src/services/_namespaces/ts.classifier.ts | 3 +- src/services/_namespaces/ts.refactor.ts | 24 +++----- src/services/_namespaces/ts.ts | 60 +++++++------------ .../_namespaces/Harness.Parallel.ts | 6 +- src/testRunner/_namespaces/Harness.ts | 3 +- src/testRunner/_namespaces/ts.ts | 3 +- src/tsserver/_namespaces/ts.ts | 3 +- src/tsserverlibrary/_namespaces/ts.ts | 3 +- src/typingsInstaller/_namespaces/ts.server.ts | 3 +- src/typingsInstaller/_namespaces/ts.ts | 3 +- .../_namespaces/ts.server.ts | 3 +- src/typingsInstallerCore/_namespaces/ts.ts | 3 +- src/webServer/_namespaces/ts.ts | 3 +- 21 files changed, 51 insertions(+), 102 deletions(-) diff --git a/src/compiler/_namespaces/ts.ts b/src/compiler/_namespaces/ts.ts index b31b19cae7cb5..118cb6141fe1a 100644 --- a/src/compiler/_namespaces/ts.ts +++ b/src/compiler/_namespaces/ts.ts @@ -68,7 +68,5 @@ export * from "../watch"; export * from "../watchPublic"; export * from "../tsbuild"; export * from "../tsbuildPublic"; -import * as moduleSpecifiers from "./ts.moduleSpecifiers"; -export { moduleSpecifiers }; -import * as performance from "./ts.performance"; -export { performance }; +export * as moduleSpecifiers from "./ts.moduleSpecifiers"; +export * as performance from "./ts.performance"; diff --git a/src/harness/_namespaces/Harness.ts b/src/harness/_namespaces/Harness.ts index 3ff4b006555c1..f9bbf3302f5b3 100644 --- a/src/harness/_namespaces/Harness.ts +++ b/src/harness/_namespaces/Harness.ts @@ -3,7 +3,5 @@ export * from "../runnerbase"; export * from "../harnessIO"; export * from "../typeWriter"; -import * as LanguageService from "./Harness.LanguageService"; -export { LanguageService }; -import * as SourceMapRecorder from "./Harness.SourceMapRecorder"; -export { SourceMapRecorder }; +export * as LanguageService from "./Harness.LanguageService"; +export * as SourceMapRecorder from "./Harness.SourceMapRecorder"; diff --git a/src/harness/_namespaces/ts.ts b/src/harness/_namespaces/ts.ts index 6f90664e41e33..9f331c87ad1d9 100644 --- a/src/harness/_namespaces/ts.ts +++ b/src/harness/_namespaces/ts.ts @@ -7,5 +7,4 @@ export * from "../../server/_namespaces/ts"; export * from "../../typingsInstallerCore/_namespaces/ts"; export * from "../../deprecatedCompat/_namespaces/ts"; export * from "../harnessGlobals"; -import * as server from "./ts.server"; -export { server }; \ No newline at end of file +export * as server from "./ts.server"; diff --git a/src/jsTyping/_namespaces/ts.ts b/src/jsTyping/_namespaces/ts.ts index adf9791f4d2b5..e50c6a5ec9384 100644 --- a/src/jsTyping/_namespaces/ts.ts +++ b/src/jsTyping/_namespaces/ts.ts @@ -1,7 +1,5 @@ /* Generated file to emulate the ts namespace. */ export * from "../../compiler/_namespaces/ts"; -import * as JsTyping from "./ts.JsTyping"; -export { JsTyping }; -import * as server from "./ts.server"; -export { server }; +export * as JsTyping from "./ts.JsTyping"; +export * as server from "./ts.server"; diff --git a/src/loggedIO/_namespaces/ts.ts b/src/loggedIO/_namespaces/ts.ts index 2f90a4b4fb34f..08280609fcbe2 100644 --- a/src/loggedIO/_namespaces/ts.ts +++ b/src/loggedIO/_namespaces/ts.ts @@ -6,5 +6,4 @@ export * from "../../jsTyping/_namespaces/ts"; export * from "../../server/_namespaces/ts"; export * from "../../typingsInstallerCore/_namespaces/ts"; export * from "../../harness/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; +export * as server from "./ts.server"; diff --git a/src/server/_namespaces/ts.server.ts b/src/server/_namespaces/ts.server.ts index 91d9a909ae7f8..d42abe69da74f 100644 --- a/src/server/_namespaces/ts.server.ts +++ b/src/server/_namespaces/ts.server.ts @@ -4,8 +4,7 @@ export * from "../../jsTyping/_namespaces/ts.server"; export * from "../types"; export * from "../utilitiesPublic"; export * from "../utilities"; -import * as protocol from "./ts.server.protocol"; -export { protocol }; +export * as protocol from "./ts.server.protocol"; export * from "../scriptInfo"; export * from "../typingsCache"; export * from "../project"; diff --git a/src/server/_namespaces/ts.ts b/src/server/_namespaces/ts.ts index 26e554e4cd973..3366e7c3a0c11 100644 --- a/src/server/_namespaces/ts.ts +++ b/src/server/_namespaces/ts.ts @@ -5,5 +5,4 @@ export * from "../../jsTyping/_namespaces/ts"; export * from "../../services/_namespaces/ts"; // Pull this in here so that plugins loaded by the server see compat wrappers. export * from "../../deprecatedCompat/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; +export * as server from "./ts.server"; diff --git a/src/services/_namespaces/ts.Completions.ts b/src/services/_namespaces/ts.Completions.ts index bd0d6a8522511..8f77ff9fb77c5 100644 --- a/src/services/_namespaces/ts.Completions.ts +++ b/src/services/_namespaces/ts.Completions.ts @@ -1,5 +1,4 @@ /* Generated file to emulate the ts.Completions namespace. */ export * from "../completions"; -import * as StringCompletions from "./ts.Completions.StringCompletions"; -export { StringCompletions }; +export * as StringCompletions from "./ts.Completions.StringCompletions"; diff --git a/src/services/_namespaces/ts.classifier.ts b/src/services/_namespaces/ts.classifier.ts index 34bc4e52196cc..5b1ccea67c4ce 100644 --- a/src/services/_namespaces/ts.classifier.ts +++ b/src/services/_namespaces/ts.classifier.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the ts.classifier namespace. */ -import * as v2020 from "./ts.classifier.v2020"; -export { v2020 }; +export * as v2020 from "./ts.classifier.v2020"; diff --git a/src/services/_namespaces/ts.refactor.ts b/src/services/_namespaces/ts.refactor.ts index 19159057c6da6..9f87c5cd7c575 100644 --- a/src/services/_namespaces/ts.refactor.ts +++ b/src/services/_namespaces/ts.refactor.ts @@ -6,19 +6,11 @@ export * from "../refactors/convertImport"; export * from "../refactors/extractType"; export * from "../refactors/helpers"; export * from "../refactors/moveToNewFile"; -import * as addOrRemoveBracesToArrowFunction from "./ts.refactor.addOrRemoveBracesToArrowFunction"; -export { addOrRemoveBracesToArrowFunction }; -import * as convertArrowFunctionOrFunctionExpression from "./ts.refactor.convertArrowFunctionOrFunctionExpression"; -export { convertArrowFunctionOrFunctionExpression }; -import * as convertParamsToDestructuredObject from "./ts.refactor.convertParamsToDestructuredObject"; -export { convertParamsToDestructuredObject }; -import * as convertStringOrTemplateLiteral from "./ts.refactor.convertStringOrTemplateLiteral"; -export { convertStringOrTemplateLiteral }; -import * as convertToOptionalChainExpression from "./ts.refactor.convertToOptionalChainExpression"; -export { convertToOptionalChainExpression }; -import * as extractSymbol from "./ts.refactor.extractSymbol"; -export { extractSymbol }; -import * as generateGetAccessorAndSetAccessor from "./ts.refactor.generateGetAccessorAndSetAccessor"; -export { generateGetAccessorAndSetAccessor }; -import * as inferFunctionReturnType from "./ts.refactor.inferFunctionReturnType"; -export { inferFunctionReturnType }; +export * as addOrRemoveBracesToArrowFunction from "./ts.refactor.addOrRemoveBracesToArrowFunction"; +export * as convertArrowFunctionOrFunctionExpression from "./ts.refactor.convertArrowFunctionOrFunctionExpression"; +export * as convertParamsToDestructuredObject from "./ts.refactor.convertParamsToDestructuredObject"; +export * as convertStringOrTemplateLiteral from "./ts.refactor.convertStringOrTemplateLiteral"; +export * as convertToOptionalChainExpression from "./ts.refactor.convertToOptionalChainExpression"; +export * as extractSymbol from "./ts.refactor.extractSymbol"; +export * as generateGetAccessorAndSetAccessor from "./ts.refactor.generateGetAccessorAndSetAccessor"; +export * as inferFunctionReturnType from "./ts.refactor.inferFunctionReturnType"; diff --git a/src/services/_namespaces/ts.ts b/src/services/_namespaces/ts.ts index eae114fd2e834..8a7cf530e6ca6 100644 --- a/src/services/_namespaces/ts.ts +++ b/src/services/_namespaces/ts.ts @@ -17,43 +17,23 @@ export * from "../transpile"; export * from "../services"; export * from "../transform"; export * from "../shims"; -import * as BreakpointResolver from "./ts.BreakpointResolver"; -export { BreakpointResolver }; -import * as CallHierarchy from "./ts.CallHierarchy"; -export { CallHierarchy }; -import * as classifier from "./ts.classifier"; -export { classifier }; -import * as codefix from "./ts.codefix"; -export { codefix }; -import * as Completions from "./ts.Completions"; -export { Completions }; -import * as FindAllReferences from "./ts.FindAllReferences"; -export { FindAllReferences }; -import * as GoToDefinition from "./ts.GoToDefinition"; -export { GoToDefinition }; -import * as InlayHints from "./ts.InlayHints"; -export { InlayHints }; -import * as JsDoc from "./ts.JsDoc"; -export { JsDoc }; -import * as NavigateTo from "./ts.NavigateTo"; -export { NavigateTo }; -import * as NavigationBar from "./ts.NavigationBar"; -export { NavigationBar }; -import * as OrganizeImports from "./ts.OrganizeImports"; -export { OrganizeImports }; -import * as OutliningElementsCollector from "./ts.OutliningElementsCollector"; -export { OutliningElementsCollector }; -import * as refactor from "./ts.refactor"; -export { refactor }; -import * as Rename from "./ts.Rename"; -export { Rename }; -import * as SignatureHelp from "./ts.SignatureHelp"; -export { SignatureHelp }; -import * as SmartSelectionRange from "./ts.SmartSelectionRange"; -export { SmartSelectionRange }; -import * as SymbolDisplay from "./ts.SymbolDisplay"; -export { SymbolDisplay }; -import * as textChanges from "./ts.textChanges"; -export { textChanges }; -import * as formatting from "./ts.formatting"; -export { formatting }; +export * as BreakpointResolver from "./ts.BreakpointResolver"; +export * as CallHierarchy from "./ts.CallHierarchy"; +export * as classifier from "./ts.classifier"; +export * as codefix from "./ts.codefix"; +export * as Completions from "./ts.Completions"; +export * as FindAllReferences from "./ts.FindAllReferences"; +export * as GoToDefinition from "./ts.GoToDefinition"; +export * as InlayHints from "./ts.InlayHints"; +export * as JsDoc from "./ts.JsDoc"; +export * as NavigateTo from "./ts.NavigateTo"; +export * as NavigationBar from "./ts.NavigationBar"; +export * as OrganizeImports from "./ts.OrganizeImports"; +export * as OutliningElementsCollector from "./ts.OutliningElementsCollector"; +export * as refactor from "./ts.refactor"; +export * as Rename from "./ts.Rename"; +export * as SignatureHelp from "./ts.SignatureHelp"; +export * as SmartSelectionRange from "./ts.SmartSelectionRange"; +export * as SymbolDisplay from "./ts.SymbolDisplay"; +export * as textChanges from "./ts.textChanges"; +export * as formatting from "./ts.formatting"; diff --git a/src/testRunner/_namespaces/Harness.Parallel.ts b/src/testRunner/_namespaces/Harness.Parallel.ts index 10087db7557c3..7e81a1f2d1eba 100644 --- a/src/testRunner/_namespaces/Harness.Parallel.ts +++ b/src/testRunner/_namespaces/Harness.Parallel.ts @@ -1,7 +1,5 @@ /* Generated file to emulate the Harness.Parallel namespace. */ export * from "../parallel/shared"; -import * as Host from "./Harness.Parallel.Host"; -export { Host }; -import * as Worker from "./Harness.Parallel.Worker"; -export { Worker }; +export * as Host from "./Harness.Parallel.Host"; +export * as Worker from "./Harness.Parallel.Worker"; diff --git a/src/testRunner/_namespaces/Harness.ts b/src/testRunner/_namespaces/Harness.ts index a9e4e0904b3fb..0a94086613993 100644 --- a/src/testRunner/_namespaces/Harness.ts +++ b/src/testRunner/_namespaces/Harness.ts @@ -3,8 +3,7 @@ export * from "../../harness/_namespaces/Harness"; export * from "../../loggedIO/_namespaces/Harness"; -import * as Parallel from "./Harness.Parallel"; -export { Parallel }; +export * as Parallel from "./Harness.Parallel"; export * from "../fourslashRunner"; export * from "../compilerRunner"; diff --git a/src/testRunner/_namespaces/ts.ts b/src/testRunner/_namespaces/ts.ts index 427c6e4e0719e..b065d14632362 100644 --- a/src/testRunner/_namespaces/ts.ts +++ b/src/testRunner/_namespaces/ts.ts @@ -10,5 +10,4 @@ export * from "../../typingsInstallerCore/_namespaces/ts"; export * from "../../deprecatedCompat/_namespaces/ts"; export * from "../../harness/_namespaces/ts"; export * from "../../loggedIO/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; \ No newline at end of file +export * as server from "./ts.server"; diff --git a/src/tsserver/_namespaces/ts.ts b/src/tsserver/_namespaces/ts.ts index c37271569f120..a47b18ec9f144 100644 --- a/src/tsserver/_namespaces/ts.ts +++ b/src/tsserver/_namespaces/ts.ts @@ -5,5 +5,4 @@ export * from "../../services/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../server/_namespaces/ts"; export * from "../../webServer/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; +export * as server from "./ts.server"; diff --git a/src/tsserverlibrary/_namespaces/ts.ts b/src/tsserverlibrary/_namespaces/ts.ts index 3060a64378787..1c8251155cecd 100644 --- a/src/tsserverlibrary/_namespaces/ts.ts +++ b/src/tsserverlibrary/_namespaces/ts.ts @@ -4,5 +4,4 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../services/_namespaces/ts"; export * from "../../server/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; +export * as server from "./ts.server"; diff --git a/src/typingsInstaller/_namespaces/ts.server.ts b/src/typingsInstaller/_namespaces/ts.server.ts index 97838f9d9818c..6e4a954290ac0 100644 --- a/src/typingsInstaller/_namespaces/ts.server.ts +++ b/src/typingsInstaller/_namespaces/ts.server.ts @@ -2,5 +2,4 @@ export * from "../../jsTyping/_namespaces/ts.server"; export * from "../../typingsInstallerCore/_namespaces/ts.server"; -import * as typingsInstaller from "./ts.server.typingsInstaller"; -export { typingsInstaller }; +export * as typingsInstaller from "./ts.server.typingsInstaller"; diff --git a/src/typingsInstaller/_namespaces/ts.ts b/src/typingsInstaller/_namespaces/ts.ts index efb16fe7a138d..9f4d487299447 100644 --- a/src/typingsInstaller/_namespaces/ts.ts +++ b/src/typingsInstaller/_namespaces/ts.ts @@ -3,5 +3,4 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../typingsInstallerCore/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; +export * as server from "./ts.server"; diff --git a/src/typingsInstallerCore/_namespaces/ts.server.ts b/src/typingsInstallerCore/_namespaces/ts.server.ts index 252296d2335cf..83f4ea0b19f18 100644 --- a/src/typingsInstallerCore/_namespaces/ts.server.ts +++ b/src/typingsInstallerCore/_namespaces/ts.server.ts @@ -1,5 +1,4 @@ /* Generated file to emulate the ts.server namespace. */ export * from "../../jsTyping/_namespaces/ts.server"; -import * as typingsInstaller from "./ts.server.typingsInstaller"; -export { typingsInstaller }; +export * as typingsInstaller from "./ts.server.typingsInstaller"; diff --git a/src/typingsInstallerCore/_namespaces/ts.ts b/src/typingsInstallerCore/_namespaces/ts.ts index aa90e7daa8eae..f0c6c03e678e8 100644 --- a/src/typingsInstallerCore/_namespaces/ts.ts +++ b/src/typingsInstallerCore/_namespaces/ts.ts @@ -2,5 +2,4 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; +export * as server from "./ts.server"; diff --git a/src/webServer/_namespaces/ts.ts b/src/webServer/_namespaces/ts.ts index 3060a64378787..1c8251155cecd 100644 --- a/src/webServer/_namespaces/ts.ts +++ b/src/webServer/_namespaces/ts.ts @@ -4,5 +4,4 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../services/_namespaces/ts"; export * from "../../server/_namespaces/ts"; -import * as server from "./ts.server"; -export { server }; +export * as server from "./ts.server"; From 34c7e9c60571111f3a7be0de16e6eba2ecce8c0e Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:04:11 -0800 Subject: [PATCH 2/6] Redo import formatting with format-imports --- package-lock.json | 514 +++++++ package.json | 1 + src/compiler/binder.ts | 353 ++++- src/compiler/builder.ts | 94 +- src/compiler/builderPublic.ts | 21 +- src/compiler/builderState.ts | 39 +- src/compiler/builderStatePublic.ts | 5 +- src/compiler/checker.ts | 1206 ++++++++++++++--- src/compiler/commandLineParser.ts | 139 +- src/compiler/core.ts | 15 +- src/compiler/debug.ts | 104 +- src/compiler/emitter.ts | 520 +++++-- src/compiler/factory/baseNodeFactory.ts | 6 +- src/compiler/factory/emitHelpers.ts | 39 +- src/compiler/factory/emitNode.ts | 23 +- src/compiler/factory/nodeConverters.ts | 38 +- src/compiler/factory/nodeFactory.ts | 546 ++++++-- src/compiler/factory/nodeTests.ts | 259 +++- src/compiler/factory/parenthesizerRules.ts | 56 +- src/compiler/factory/utilities.ts | 196 ++- src/compiler/factory/utilitiesPublic.ts | 9 +- src/compiler/moduleNameResolver.ts | 124 +- src/compiler/moduleSpecifiers.ts | 121 +- src/compiler/parser.ts | 447 +++++- src/compiler/path.ts | 20 +- src/compiler/performance.ts | 9 +- src/compiler/performanceCore.ts | 6 +- src/compiler/program.ts | 372 ++++- src/compiler/resolutionCache.ts | 101 +- src/compiler/scanner.ts | 31 +- src/compiler/semver.ts | 11 +- src/compiler/sourcemap.ts | 31 +- src/compiler/symbolWalker.ts | 28 +- src/compiler/sys.ts | 54 +- src/compiler/tracing.ts | 24 +- src/compiler/transformer.ts | 81 +- src/compiler/transformers/classFields.ts | 206 ++- src/compiler/transformers/declarations.ts | 250 +++- .../transformers/declarations/diagnostics.ts | 71 +- src/compiler/transformers/destructuring.ts | 74 +- src/compiler/transformers/es2015.ts | 240 +++- src/compiler/transformers/es2016.ts | 17 +- src/compiler/transformers/es2017.ts | 112 +- src/compiler/transformers/es2018.ts | 130 +- src/compiler/transformers/es2019.ts | 13 +- src/compiler/transformers/es2020.ts | 43 +- src/compiler/transformers/es2021.ts | 25 +- src/compiler/transformers/es5.ts | 27 +- src/compiler/transformers/esnext.ts | 8 +- src/compiler/transformers/generators.ts | 113 +- src/compiler/transformers/jsx.ts | 89 +- src/compiler/transformers/legacyDecorators.ts | 90 +- .../transformers/module/esnextAnd2015.ts | 56 +- src/compiler/transformers/module/module.ts | 158 ++- src/compiler/transformers/module/node.ts | 14 +- src/compiler/transformers/module/system.ts | 150 +- src/compiler/transformers/taggedTemplate.ts | 26 +- src/compiler/transformers/ts.ts | 233 +++- src/compiler/transformers/typeSerializer.ts | 80 +- src/compiler/transformers/utilities.ts | 96 +- src/compiler/tsbuild.ts | 7 +- src/compiler/tsbuildPublic.ts | 156 ++- src/compiler/types.ts | 18 +- src/compiler/utilities.ts | 608 +++++++-- src/compiler/utilitiesPublic.ts | 311 ++++- src/compiler/visitorPublic.ts | 120 +- src/compiler/watch.ts | 125 +- src/compiler/watchPublic.ts | 107 +- src/compiler/watchUtilities.ts | 62 +- .../4.0/nodeFactoryTopLevelExports.ts | 74 +- src/deprecatedCompat/4.0/renamedNodeTests.ts | 6 +- .../4.2/abstractConstructorTypes.ts | 12 +- src/deprecatedCompat/4.2/renamedNodeTests.ts | 6 +- .../4.6/importTypeAssertions.ts | 13 +- .../4.7/typeParameterModifiers.ts | 9 +- .../4.8/mergeDecoratorsAndModifiers.ts | 88 +- src/deprecatedCompat/deprecate.ts | 9 +- src/deprecatedCompat/deprecations.ts | 6 +- src/executeCommandLine/executeCommandLine.ts | 104 +- src/harness/client.ts | 89 +- src/harness/findUpDir.ts | 6 +- src/harness/harnessIO.ts | 6 +- src/harness/harnessLanguageService.ts | 7 +- src/harness/runnerbase.ts | 6 +- src/jsTyping/jsTyping.ts | 35 +- src/jsTyping/shared.ts | 5 +- src/jsTyping/types.ts | 21 +- src/server/editorServices.ts | 210 ++- src/server/moduleSpecifierCache.ts | 11 +- src/server/packageJsonCache.ts | 11 +- src/server/project.ts | 175 ++- src/server/protocol.ts | 20 +- src/server/scriptInfo.ts | 59 +- src/server/scriptVersionCache.ts | 16 +- src/server/session.ts | 208 ++- src/server/types.ts | 8 +- src/server/typingsCache.ts | 20 +- src/server/utilities.ts | 16 +- src/server/utilitiesPublic.ts | 12 +- src/services/breakpoints.ts | 83 +- src/services/callHierarchy.ts | 124 +- src/services/classifier.ts | 88 +- src/services/classifier2020.ts | 51 +- src/services/codeFixProvider.ts | 28 +- ...dConvertToUnknownForNonOverlappingTypes.ts | 20 +- .../codefixes/addEmptyExportDeclaration.ts | 11 +- src/services/codefixes/addMissingAsync.ts | 40 +- src/services/codefixes/addMissingAwait.ts | 56 +- src/services/codefixes/addMissingConst.ts | 27 +- .../codefixes/addMissingDeclareProperty.ts | 15 +- .../addMissingInvocationForDecorator.ts | 15 +- .../codefixes/addNameToNamelessParameter.ts | 15 +- .../codefixes/addOptionalPropertyUndefined.ts | 37 +- .../codefixes/annotateWithTypeFromJSDoc.ts | 55 +- src/services/codefixes/convertConstToLet.ts | 21 +- .../codefixes/convertFunctionToEs6Class.ts | 77 +- .../convertLiteralTypeToMappedType.ts | 19 +- .../codefixes/convertToAsyncFunction.ts | 95 +- src/services/codefixes/convertToEsModule.ts | 93 +- .../codefixes/convertToMappedObjectType.ts | 32 +- .../codefixes/convertToTypeOnlyExport.ts | 27 +- .../codefixes/convertToTypeOnlyImport.ts | 18 +- ...correctQualifiedNameToIndexedAccessType.ts | 19 +- .../codefixes/disableJsDiagnostics.ts | 23 +- .../codefixes/fixAddMissingConstraint.ts | 40 +- src/services/codefixes/fixAddMissingMember.ts | 141 +- .../codefixes/fixAddMissingNewOperator.ts | 16 +- .../fixAddModuleReferTypeMissingTypeof.ts | 15 +- src/services/codefixes/fixAddVoidToPromise.ts | 35 +- .../codefixes/fixAwaitInSyncFunction.ts | 29 +- src/services/codefixes/fixCannotFindModule.ts | 20 +- ...sDoesntImplementInheritedAbstractMember.ts | 23 +- .../fixClassIncorrectlyImplementsInterface.ts | 40 +- .../fixClassSuperMustPrecedeThisAccess.ts | 26 +- .../fixConstructorForDerivedNeedSuperCall.ts | 17 +- .../fixEnableExperimentalDecorators.ts | 12 +- src/services/codefixes/fixEnableJsxFlag.ts | 12 +- src/services/codefixes/fixExpectedComma.ts | 17 +- .../fixExtendsInterfaceBecomesImplements.ts | 18 +- .../fixForgottenThisPropertyAccess.ts | 19 +- src/services/codefixes/fixImplicitThis.ts | 27 +- .../codefixes/fixImportNonExportedMember.ts | 40 +- .../codefixes/fixIncorrectNamedTupleSyntax.ts | 18 +- .../codefixes/fixInvalidImportSyntax.ts | 34 +- .../codefixes/fixInvalidJsxCharacters.ts | 15 +- src/services/codefixes/fixJSDocTypes.ts | 40 +- .../codefixes/fixMissingCallParentheses.ts | 17 +- .../codefixes/fixModuleAndTargetOptions.ts | 17 +- src/services/codefixes/fixNaNEquality.ts | 23 +- .../fixNoPropertyAccessFromIndexSignature.ts | 20 +- src/services/codefixes/fixOverrideModifier.ts | 42 +- .../codefixes/fixPropertyAssignment.ts | 17 +- .../codefixes/fixPropertyOverrideAccessor.ts | 20 +- .../codefixes/fixReturnTypeInAsyncFunction.ts | 19 +- src/services/codefixes/fixSpelling.ts | 53 +- .../codefixes/fixStrictClassInitialization.ts | 39 +- .../codefixes/fixUnmatchedParameter.ts | 29 +- src/services/codefixes/fixUnreachableCode.ts | 22 +- .../fixUnreferenceableDecoratorMetadata.ts | 31 +- src/services/codefixes/fixUnusedIdentifier.ts | 67 +- src/services/codefixes/fixUnusedLabel.ts | 18 +- src/services/codefixes/generateAccessors.ts | 65 +- src/services/codefixes/helpers.ts | 115 +- src/services/codefixes/importFixes.ts | 164 ++- src/services/codefixes/inferFromUsage.ts | 126 +- .../removeAccidentalCallParentheses.ts | 13 +- .../codefixes/removeUnnecessaryAwait.ts | 22 +- src/services/codefixes/requireInTs.ts | 31 +- src/services/codefixes/returnValueCorrect.ts | 52 +- src/services/codefixes/splitTypeOnlyImport.ts | 19 +- src/services/codefixes/useBigintLiteral.ts | 15 +- src/services/codefixes/useDefaultImport.ts | 23 +- src/services/codefixes/wrapJsxInFragment.ts | 20 +- src/services/completions.ts | 392 +++++- src/services/documentHighlights.ts | 92 +- src/services/documentRegistry.ts | 35 +- src/services/exportInfoMap.ts | 71 +- src/services/findAllReferences.ts | 293 +++- src/services/formatting/formatting.ts | 87 +- src/services/formatting/formattingContext.ts | 9 +- src/services/formatting/formattingScanner.ts | 22 +- src/services/formatting/rule.ts | 5 +- src/services/formatting/rules.ts | 34 +- src/services/formatting/rulesMap.ts | 16 +- src/services/formatting/smartIndenter.ts | 68 +- src/services/getEditsForFileRename.ts | 60 +- src/services/goToDefinition.ts | 115 +- src/services/importTracker.ts | 92 +- src/services/inlayHints.ts | 80 +- src/services/jsDoc.ts | 101 +- src/services/navigateTo.ts | 33 +- src/services/navigationBar.ts | 129 +- src/services/organizeImports.ts | 63 +- src/services/outliningElementsCollector.ts | 63 +- src/services/patternMatcher.ts | 13 +- src/services/preProcess.ts | 14 +- src/services/refactorProvider.ts | 7 +- .../addOrRemoveBracesToArrowFunction.ts | 35 +- ...onvertArrowFunctionOrFunctionExpression.ts | 66 +- src/services/refactors/convertExport.ts | 64 +- src/services/refactors/convertImport.ts | 57 +- .../convertOverloadListToSingleSignature.ts | 45 +- .../convertParamsToDestructuredObject.ts | 120 +- .../convertStringOrTemplateLiteral.ts | 42 +- .../convertToOptionalChainExpression.ts | 55 +- src/services/refactors/extractSymbol.ts | 190 ++- src/services/refactors/extractType.ts | 78 +- .../generateGetAccessorAndSetAccessor.ts | 14 +- .../refactors/inferFunctionReturnType.ts | 36 +- src/services/refactors/moveToNewFile.ts | 148 +- src/services/rename.ts | 61 +- src/services/services.ts | 369 ++++- src/services/shims.ts | 78 +- src/services/signatureHelp.ts | 94 +- src/services/smartSelection.ts | 55 +- src/services/sourcemaps.ts | 30 +- src/services/stringCompletions.ts | 175 ++- src/services/suggestionDiagnostics.ts | 69 +- src/services/symbolDisplay.ts | 125 +- src/services/textChanges.ts | 195 ++- src/services/transform.ts | 12 +- src/services/transpile.ts | 33 +- src/services/types.ts | 47 +- src/services/utilities.ts | 411 +++++- src/testRunner/compilerRunner.ts | 12 +- src/testRunner/externalCompileRunner.ts | 8 +- src/testRunner/fourslashRunner.ts | 6 +- src/testRunner/parallel/host.ts | 23 +- src/testRunner/parallel/worker.ts | 18 +- src/testRunner/runner.ts | 18 +- src/testRunner/test262Runner.ts | 9 +- src/testRunner/unittests/builder.ts | 9 +- src/testRunner/unittests/moduleResolution.ts | 6 +- .../unittests/reuseProgramStructure.ts | 22 +- .../services/convertToAsyncFunction.ts | 11 +- .../unittests/services/extract/constants.ts | 5 +- .../unittests/services/extract/helpers.ts | 5 +- .../unittests/services/languageService.ts | 6 +- .../unittests/services/organizeImports.ts | 5 +- .../unittests/tsbuild/amdModulesWithOut.ts | 15 +- src/testRunner/unittests/tsbuild/clean.ts | 6 +- .../unittests/tsbuild/commandLine.ts | 11 +- .../unittests/tsbuild/configFileErrors.ts | 10 +- .../unittests/tsbuild/configFileExtends.ts | 5 +- .../tsbuild/containerOnlyReferenced.ts | 8 +- .../unittests/tsbuild/declarationEmit.ts | 5 +- src/testRunner/unittests/tsbuild/demo.ts | 7 +- .../unittests/tsbuild/emitDeclarationOnly.ts | 6 +- .../unittests/tsbuild/emptyFiles.ts | 5 +- .../unittests/tsbuild/exitCodeOnBogusFile.ts | 5 +- .../inferredTypeFromTransitiveModule.ts | 7 +- .../tsbuild/javascriptProjectEmit.ts | 8 +- .../unittests/tsbuild/lateBoundSymbol.ts | 7 +- .../unittests/tsbuild/moduleResolution.ts | 12 +- .../unittests/tsbuild/moduleSpecifiers.ts | 6 +- src/testRunner/unittests/tsbuild/noEmit.ts | 6 +- .../unittests/tsbuild/noEmitOnError.ts | 7 +- src/testRunner/unittests/tsbuild/outFile.ts | 25 +- .../unittests/tsbuild/outputPaths.ts | 9 +- src/testRunner/unittests/tsbuild/publicApi.ts | 9 +- .../tsbuild/referencesWithRootDirInParent.ts | 6 +- .../unittests/tsbuild/resolveJsonModule.ts | 8 +- src/testRunner/unittests/tsbuild/sample.ts | 27 +- .../unittests/tsbuild/transitiveReferences.ts | 5 +- .../tsbuildWatch/configFileErrors.ts | 6 +- src/testRunner/unittests/tsbuildWatch/demo.ts | 7 +- .../tsbuildWatch/moduleResolution.ts | 5 +- .../unittests/tsbuildWatch/noEmit.ts | 5 +- .../unittests/tsbuildWatch/noEmitOnError.ts | 11 +- .../unittests/tsbuildWatch/programUpdates.ts | 21 +- .../tsbuildWatch/projectsBuilding.ts | 12 +- .../unittests/tsbuildWatch/publicApi.ts | 12 +- .../unittests/tsbuildWatch/reexport.ts | 6 +- .../tsbuildWatch/watchEnvironment.ts | 13 +- .../unittests/tsc/cancellationToken.ts | 17 +- src/testRunner/unittests/tsc/composite.ts | 7 +- .../unittests/tsc/declarationEmit.ts | 7 +- .../tsc/forceConsistentCasingInFileNames.ts | 5 +- src/testRunner/unittests/tsc/helpers.ts | 5 +- src/testRunner/unittests/tsc/incremental.ts | 16 +- src/testRunner/unittests/tsc/listFilesOnly.ts | 7 +- .../unittests/tsc/projectReferences.ts | 5 +- src/testRunner/unittests/tsc/redirect.ts | 5 +- .../unittests/tsc/runWithoutArgs.ts | 5 +- .../unittests/tscWatch/consoleClearing.ts | 14 +- src/testRunner/unittests/tscWatch/emit.ts | 12 +- .../unittests/tscWatch/emitAndErrorUpdates.ts | 12 +- .../forceConsistentCasingInFileNames.ts | 12 +- src/testRunner/unittests/tscWatch/helpers.ts | 20 +- .../unittests/tscWatch/incremental.ts | 20 +- .../unittests/tscWatch/moduleResolution.ts | 6 +- .../unittests/tscWatch/nodeNextWatch.ts | 6 +- .../unittests/tscWatch/programUpdates.ts | 25 +- .../tscWatch/projectsWithReferences.ts | 13 +- .../unittests/tscWatch/resolutionCache.ts | 14 +- .../sourceOfProjectReferenceRedirect.ts | 16 +- src/testRunner/unittests/tscWatch/watchApi.ts | 15 +- .../unittests/tscWatch/watchEnvironment.ts | 17 +- .../tsserver/applyChangesToOpenFiles.ts | 16 +- .../unittests/tsserver/autoImportProvider.ts | 12 +- .../unittests/tsserver/auxiliaryProject.ts | 11 +- .../tsserver/cachingFileSystemInformation.ts | 20 +- .../unittests/tsserver/cancellationToken.ts | 5 +- .../unittests/tsserver/compileOnSave.ts | 20 +- .../unittests/tsserver/completions.ts | 15 +- .../tsserver/completionsIncomplete.ts | 10 +- .../unittests/tsserver/configFileSearch.ts | 15 +- .../unittests/tsserver/configuredProjects.ts | 29 +- .../unittests/tsserver/declarationFileMaps.ts | 24 +- .../unittests/tsserver/documentRegistry.ts | 12 +- .../unittests/tsserver/duplicatePackages.ts | 11 +- .../unittests/tsserver/dynamicFiles.ts | 18 +- .../tsserver/events/largeFileReferenced.ts | 13 +- .../events/projectLanguageServiceState.ts | 15 +- .../tsserver/events/projectLoading.ts | 17 +- .../events/projectUpdatedInBackground.ts | 17 +- .../unittests/tsserver/exportMapCache.ts | 12 +- .../unittests/tsserver/externalProjects.ts | 20 +- .../forceConsistentCasingInFileNames.ts | 18 +- .../tsserver/getApplicableRefactors.ts | 11 +- .../tsserver/getEditsForFileRename.ts | 14 +- .../unittests/tsserver/getExportReferences.ts | 15 +- .../unittests/tsserver/getFileReferences.ts | 12 +- src/testRunner/unittests/tsserver/helpers.ts | 11 +- .../unittests/tsserver/importHelpers.ts | 5 +- .../unittests/tsserver/inferredProjects.ts | 17 +- .../unittests/tsserver/inlayHints.ts | 16 +- src/testRunner/unittests/tsserver/jsdocTag.ts | 10 +- .../tsserver/maxNodeModuleJsDepth.ts | 11 +- .../unittests/tsserver/metadataInResponse.ts | 13 +- .../unittests/tsserver/moduleResolution.ts | 14 +- .../tsserver/moduleSpecifierCache.ts | 17 +- src/testRunner/unittests/tsserver/navTo.ts | 14 +- .../unittests/tsserver/occurences.ts | 10 +- src/testRunner/unittests/tsserver/openFile.ts | 18 +- .../unittests/tsserver/packageJsonInfo.ts | 10 +- .../tsserver/partialSemanticServer.ts | 18 +- src/testRunner/unittests/tsserver/plugins.ts | 14 +- .../unittests/tsserver/projectErrors.ts | 24 +- .../tsserver/projectReferenceCompileOnSave.ts | 14 +- .../tsserver/projectReferenceErrors.ts | 5 +- .../unittests/tsserver/projectReferences.ts | 23 +- .../tsserver/projectReferencesSourcemap.ts | 17 +- src/testRunner/unittests/tsserver/projects.ts | 32 +- .../tsserver/projectsWithReferences.ts | 14 +- .../unittests/tsserver/refactors.ts | 11 +- src/testRunner/unittests/tsserver/reload.ts | 10 +- .../unittests/tsserver/reloadProjects.ts | 14 +- src/testRunner/unittests/tsserver/rename.ts | 14 +- .../unittests/tsserver/resolutionCache.ts | 22 +- src/testRunner/unittests/tsserver/session.ts | 5 +- .../unittests/tsserver/skipLibCheck.ts | 7 +- .../unittests/tsserver/smartSelection.ts | 12 +- src/testRunner/unittests/tsserver/symLinks.ts | 18 +- .../unittests/tsserver/symlinkCache.ts | 11 +- .../unittests/tsserver/syntacticServer.ts | 18 +- .../unittests/tsserver/syntaxOperations.ts | 13 +- .../unittests/tsserver/telemetry.ts | 7 +- .../unittests/tsserver/typeAquisition.ts | 8 +- .../tsserver/typeOnlyImportChains.ts | 11 +- .../tsserver/typeReferenceDirectives.ts | 12 +- .../unittests/tsserver/typingsInstaller.ts | 21 +- .../unittests/tsserver/watchEnvironment.ts | 24 +- .../unittests/tsserver/webServer.ts | 14 +- .../unittests/virtualFileSystemWithWatch.ts | 53 +- src/tsserver/common.ts | 5 +- src/tsserver/nodeServer.ts | 84 +- src/tsserver/server.ts | 16 +- src/tsserver/webServer.ts | 24 +- src/tsserverlibrary/tsserverlibrary.ts | 1 + src/typescript/typescript.ts | 7 +- src/typingsInstaller/nodeTypingsInstaller.ts | 33 +- src/typingsInstallerCore/typingsInstaller.ts | 54 +- src/webServer/webServer.ts | 28 +- 374 files changed, 17291 insertions(+), 2928 deletions(-) diff --git a/package-lock.json b/package-lock.json index de4243a40639a..ae6899c3aea1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "eslint-plugin-local": "^1.0.0", "eslint-plugin-no-null": "^1.0.2", "fast-xml-parser": "^4.0.11", + "format-imports": "^3.1.2", "fs-extra": "^9.1.0", "glob": "latest", "hereby": "^1.6.4", @@ -58,6 +59,52 @@ "node": ">=4.2.0" } }, + "node_modules/@dozerg/condition": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@dozerg/condition/-/condition-1.0.3.tgz", + "integrity": "sha512-1ojWsX70X8VgIRlWUHJuBbHTloqz/ihObK1qOCNnhvioPHy2Fs6+UX+LaY1LwzKi4b4G1CMkcPe8FfKOifP+DQ==", + "dev": true + }, + "node_modules/@dozerg/end-of-line": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@dozerg/end-of-line/-/end-of-line-1.0.10.tgz", + "integrity": "sha512-0ySfd/2nW/lPPuVXCSi6NCVT5hCGX0t8668Aa4YcuJu03ClRQOvvUsTvxU8qdfbA/3bpoceoEP40GFm9w9bJoA==", + "dev": true + }, + "node_modules/@dozerg/find-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@dozerg/find-up/-/find-up-1.0.1.tgz", + "integrity": "sha512-ZogqJqvf9M5xRBm6N6jVp7m/clE2JWeEy/1mz25Wv1yL7qquqSHz3oEe5n4x7C6OBcdx/QiHooFxV3FEz7ME2A==", + "dev": true, + "dependencies": { + "@dozerg/condition": "^1.0.1" + } + }, + "node_modules/@dozerg/merge-options": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@dozerg/merge-options/-/merge-options-1.0.4.tgz", + "integrity": "sha512-cUq8p/l6HEGNVcqIuzw61K33mvIeYd9g4lW+Ed6LZ9V4KAiWH9iPvtK9W4XQmdOYn/0F05904UOE7UEL/WLcng==", + "dev": true, + "dependencies": { + "@dozerg/condition": "^1.0.3" + } + }, + "node_modules/@dozerg/no-new": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dozerg/no-new/-/no-new-0.0.1.tgz", + "integrity": "sha512-+cEHmWDW2icAQ8BBoIiZIT4scqaTp1IRwu5KoH78SdRt25gFWL7o035wTEvzN+DVzQ6BiAMlSpjonQASzskuOQ==", + "dev": true + }, + "node_modules/@dozerg/require-module": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@dozerg/require-module/-/require-module-0.0.2.tgz", + "integrity": "sha512-N46+e1YRQZ/X735duKN8ogqG5oAgpr9rAh60UoBdtf1enggEC28IuC0uEYnntx7MIsyaOteDkpPfRkLbOcB5Gw==", + "dev": true, + "dependencies": { + "@dozerg/find-up": "^1.0.1", + "log4js": "^6.4.4" + } + }, "node_modules/@esbuild/android-arm": { "version": "0.15.14", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.14.tgz", @@ -907,6 +954,18 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1031,6 +1090,15 @@ "wrap-ansi": "^7.0.0" } }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1197,6 +1265,15 @@ "node": ">= 12" } }, + "node_modules/date-format": { + "version": "4.0.14", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", + "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2317,6 +2394,70 @@ "node": ">=8.0.0" } }, + "node_modules/format-imports": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/format-imports/-/format-imports-3.1.2.tgz", + "integrity": "sha512-JpchwcrRvaZ7wAyiW9HotLuT39pN815dXz8qAjzNaAYW2XK/lpTmkNALrXUr6d+zaufj9hqWIeg4cDBa0B/dRA==", + "dev": true, + "dependencies": { + "@dozerg/condition": "^1.0.3", + "@dozerg/end-of-line": "^1.0.10", + "@dozerg/merge-options": "^1.0.4", + "@dozerg/no-new": "^0.0.1", + "@dozerg/require-module": "^0.0.2", + "eslint": "^8.26.0", + "fs-extra": "^10.1.0", + "immutable": "^4.1.0", + "is-builtin-module": "^3.2.0", + "log4js": "^6.7.0", + "minimatch": "^5.1.0", + "node-cache": "^5.1.2", + "optionator": "^0.9.1", + "prettier": "^2.7.1", + "segment-sort": "^1.0.1", + "tmp": "^0.2.1", + "typescript": "^4.8.4", + "utility-types": "^3.10.0" + }, + "bin": { + "format-imports": "dist/bin/main.js" + } + }, + "node_modules/format-imports/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/format-imports/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/format-imports/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -2652,6 +2793,12 @@ "node": ">= 4" } }, + "node_modules/immutable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz", + "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", + "dev": true + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -2775,6 +2922,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-builtin-module": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.0.tgz", + "integrity": "sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -3120,6 +3282,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/log4js": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz", + "integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==", + "dev": true, + "dependencies": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "flatted": "^3.2.7", + "rfdc": "^1.3.0", + "streamroller": "^3.1.3" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -3337,6 +3515,18 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, + "node_modules/node-cache": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", + "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", + "dev": true, + "dependencies": { + "clone": "2.x" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -3624,6 +3814,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-ms": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", @@ -3787,6 +3992,12 @@ "node": ">=0.10.0" } }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -3879,6 +4090,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/segment-sort": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/segment-sort/-/segment-sort-1.0.1.tgz", + "integrity": "sha512-ebmIfxnVtkPRk/fBTnXHHHouFRPRnbtaFSpw7NqUdaVnlDRMSG1sjSum4zvt08FvGbBkDsq7scJSgzIcnF7fAQ==", + "dev": true + }, "node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -3972,6 +4189,52 @@ "source-map": "^0.6.0" } }, + "node_modules/streamroller": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz", + "integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==", + "dev": true, + "dependencies": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/streamroller/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/streamroller/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/streamroller/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -4116,6 +4379,18 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "node_modules/tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "dependencies": { + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=8.17.0" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -4293,6 +4568,15 @@ "punycode": "^2.1.0" } }, + "node_modules/utility-types": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz", + "integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/web-streams-polyfill": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", @@ -4480,6 +4764,52 @@ } }, "dependencies": { + "@dozerg/condition": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@dozerg/condition/-/condition-1.0.3.tgz", + "integrity": "sha512-1ojWsX70X8VgIRlWUHJuBbHTloqz/ihObK1qOCNnhvioPHy2Fs6+UX+LaY1LwzKi4b4G1CMkcPe8FfKOifP+DQ==", + "dev": true + }, + "@dozerg/end-of-line": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@dozerg/end-of-line/-/end-of-line-1.0.10.tgz", + "integrity": "sha512-0ySfd/2nW/lPPuVXCSi6NCVT5hCGX0t8668Aa4YcuJu03ClRQOvvUsTvxU8qdfbA/3bpoceoEP40GFm9w9bJoA==", + "dev": true + }, + "@dozerg/find-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@dozerg/find-up/-/find-up-1.0.1.tgz", + "integrity": "sha512-ZogqJqvf9M5xRBm6N6jVp7m/clE2JWeEy/1mz25Wv1yL7qquqSHz3oEe5n4x7C6OBcdx/QiHooFxV3FEz7ME2A==", + "dev": true, + "requires": { + "@dozerg/condition": "^1.0.1" + } + }, + "@dozerg/merge-options": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@dozerg/merge-options/-/merge-options-1.0.4.tgz", + "integrity": "sha512-cUq8p/l6HEGNVcqIuzw61K33mvIeYd9g4lW+Ed6LZ9V4KAiWH9iPvtK9W4XQmdOYn/0F05904UOE7UEL/WLcng==", + "dev": true, + "requires": { + "@dozerg/condition": "^1.0.3" + } + }, + "@dozerg/no-new": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@dozerg/no-new/-/no-new-0.0.1.tgz", + "integrity": "sha512-+cEHmWDW2icAQ8BBoIiZIT4scqaTp1IRwu5KoH78SdRt25gFWL7o035wTEvzN+DVzQ6BiAMlSpjonQASzskuOQ==", + "dev": true + }, + "@dozerg/require-module": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@dozerg/require-module/-/require-module-0.0.2.tgz", + "integrity": "sha512-N46+e1YRQZ/X735duKN8ogqG5oAgpr9rAh60UoBdtf1enggEC28IuC0uEYnntx7MIsyaOteDkpPfRkLbOcB5Gw==", + "dev": true, + "requires": { + "@dozerg/find-up": "^1.0.1", + "log4js": "^6.4.4" + } + }, "@esbuild/android-arm": { "version": "0.15.14", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.14.tgz", @@ -5093,6 +5423,12 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true + }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -5179,6 +5515,12 @@ "wrap-ansi": "^7.0.0" } }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "dev": true + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -5311,6 +5653,12 @@ "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==", "dev": true }, + "date-format": { + "version": "4.0.14", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", + "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", + "dev": true + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -6060,6 +6408,63 @@ "signal-exit": "^3.0.2" } }, + "format-imports": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/format-imports/-/format-imports-3.1.2.tgz", + "integrity": "sha512-JpchwcrRvaZ7wAyiW9HotLuT39pN815dXz8qAjzNaAYW2XK/lpTmkNALrXUr6d+zaufj9hqWIeg4cDBa0B/dRA==", + "dev": true, + "requires": { + "@dozerg/condition": "^1.0.3", + "@dozerg/end-of-line": "^1.0.10", + "@dozerg/merge-options": "^1.0.4", + "@dozerg/no-new": "^0.0.1", + "@dozerg/require-module": "^0.0.2", + "eslint": "^8.26.0", + "fs-extra": "^10.1.0", + "immutable": "^4.1.0", + "is-builtin-module": "^3.2.0", + "log4js": "^6.7.0", + "minimatch": "^5.1.0", + "node-cache": "^5.1.2", + "optionator": "^0.9.1", + "prettier": "^2.7.1", + "segment-sort": "^1.0.1", + "tmp": "^0.2.1", + "typescript": "^4.8.4", + "utility-types": "^3.10.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, "formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -6300,6 +6705,12 @@ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, + "immutable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz", + "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", + "dev": true + }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -6389,6 +6800,15 @@ "has-tostringtag": "^1.0.0" } }, + "is-builtin-module": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.0.tgz", + "integrity": "sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw==", + "dev": true, + "requires": { + "builtin-modules": "^3.3.0" + } + }, "is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -6630,6 +7050,19 @@ "is-unicode-supported": "^0.1.0" } }, + "log4js": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz", + "integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==", + "dev": true, + "requires": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "flatted": "^3.2.7", + "rfdc": "^1.3.0", + "streamroller": "^3.1.3" + } + }, "loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -6800,6 +7233,15 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, + "node-cache": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", + "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", + "dev": true, + "requires": { + "clone": "2.x" + } + }, "node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -6986,6 +7428,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true + }, "pretty-ms": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", @@ -7086,6 +7534,12 @@ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -7137,6 +7591,12 @@ "is-regex": "^1.1.4" } }, + "segment-sort": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/segment-sort/-/segment-sort-1.0.1.tgz", + "integrity": "sha512-ebmIfxnVtkPRk/fBTnXHHHouFRPRnbtaFSpw7NqUdaVnlDRMSG1sjSum4zvt08FvGbBkDsq7scJSgzIcnF7fAQ==", + "dev": true + }, "semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -7209,6 +7669,45 @@ "source-map": "^0.6.0" } }, + "streamroller": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz", + "integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==", + "dev": true, + "requires": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + } + } + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -7316,6 +7815,15 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.0" + } + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -7455,6 +7963,12 @@ "punycode": "^2.1.0" } }, + "utility-types": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz", + "integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==", + "dev": true + }, "web-streams-polyfill": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", diff --git a/package.json b/package.json index 7f8ab9163074f..4025d40c76e70 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "eslint-plugin-local": "^1.0.0", "eslint-plugin-no-null": "^1.0.2", "fast-xml-parser": "^4.0.11", + "format-imports": "^3.1.2", "fs-extra": "^9.1.0", "glob": "latest", "hereby": "^1.6.4", diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 21b796d43609a..64fbdbce0e572 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,62 +1,299 @@ import { - __String, AccessExpression, addRelatedInfo, append, appendIfUnique, ArrayBindingElement, ArrayLiteralExpression, - ArrowFunction, AssignmentDeclarationKind, BinaryExpression, BinaryOperatorToken, BindableAccessExpression, - BindableObjectDefinePropertyCall, BindablePropertyAssignmentExpression, BindableStaticAccessExpression, - BindableStaticNameExpression, BindableStaticPropertyAssignmentExpression, BindingElement, Block, - BreakOrContinueStatement, CallChain, CallExpression, CaseBlock, CaseClause, cast, CatchClause, ClassLikeDeclaration, - ClassStaticBlockDeclaration, CompilerOptions, concatenate, ConditionalExpression, ConditionalTypeNode, contains, - createBinaryExpressionTrampoline, createDiagnosticForNodeInSourceFile, createFileDiagnostic, createQueue, - createSymbolTable, Debug, Declaration, declarationNameToString, DeleteExpression, DestructuringAssignment, - DiagnosticCategory, DiagnosticMessage, DiagnosticRelatedInformation, Diagnostics, DiagnosticWithLocation, - DoStatement, DynamicNamedDeclaration, ElementAccessChain, ElementAccessExpression, EntityNameExpression, - EnumDeclaration, escapeLeadingUnderscores, every, ExportAssignment, exportAssignmentIsAlias, - ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, findAncestor, FlowFlags, FlowLabel, FlowNode, - FlowReduceLabel, forEach, forEachChild, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, - FunctionLikeDeclaration, GetAccessorDeclaration, getAssignedExpandoInitializer, getAssignmentDeclarationKind, - getAssignmentDeclarationPropertyAccessKind, getCombinedModifierFlags, getCombinedNodeFlags, getContainingClass, - getEffectiveContainerForJSDocTemplateTag, getElementOrPropertyAccessName, getEmitScriptTarget, - getEnclosingBlockScopeContainer, getErrorSpanForNode, getEscapedTextOfIdentifierOrLiteral, getExpandoInitializer, - getHostSignatureFromJSDoc, getImmediatelyInvokedFunctionExpression, getJSDocTypeTag, getLeftmostAccessExpression, - getNameOfDeclaration, getNameOrArgument, getNodeId, getRangesWhere, getRightMostAssignedExpression, - getSourceFileOfNode, getSourceTextOfNodeFromSourceFile, getSpanOfTokenAtPosition, getStrictOptionValue, - getSymbolNameForPrivateIdentifier, getTextOfIdentifierOrLiteral, getThisContainer, getTokenPosOfNode, - hasDynamicName, hasJSDocNodes, hasSyntacticModifier, Identifier, idText, IfStatement, ImportClause, - InternalSymbolName, isAliasableExpression, isAmbientModule, isAssignmentExpression, isAssignmentOperator, - isAssignmentTarget, isAsyncFunction, isAutoAccessorPropertyDeclaration, isBinaryExpression, - isBindableObjectDefinePropertyCall, isBindableStaticAccessExpression, isBindableStaticNameExpression, - isBindingPattern, isBlock, isBlockOrCatchScoped, isCallExpression, isClassStaticBlockDeclaration, - isConditionalTypeNode, isDeclaration, isDeclarationStatement, isDestructuringAssignment, isDottedName, - isElementAccessExpression, isEmptyObjectLiteral, isEntityNameExpression, isEnumConst, isEnumDeclaration, - isExportAssignment, isExportDeclaration, isExportsIdentifier, isExportSpecifier, isExpression, - isExpressionOfOptionalChainRoot, isExternalModule, isExternalOrCommonJsModule, isForInOrOfStatement, - isFunctionDeclaration, isFunctionLike, isFunctionLikeDeclaration, isFunctionLikeOrClassStaticBlockDeclaration, - isFunctionSymbol, isGlobalScopeAugmentation, isIdentifier, isIdentifierName, isInJSFile, isInTopLevelContext, - isJSDocConstructSignature, isJSDocEnumTag, isJSDocTemplateTag, isJSDocTypeAlias, isJsonSourceFile, - isLeftHandSideExpression, isLogicalOrCoalescingAssignmentOperator, isModuleAugmentationExternal, isModuleBlock, - isModuleDeclaration, isModuleExportsAccessExpression, isNamedDeclaration, isNamespaceExport, isNonNullExpression, - isNullishCoalesce, isObjectLiteralExpression, isObjectLiteralMethod, - isObjectLiteralOrClassExpressionMethodOrAccessor, isOmittedExpression, isOptionalChain, isOptionalChainRoot, - isOutermostOptionalChain, isParameterDeclaration, isParameterPropertyDeclaration, isParenthesizedExpression, - isPartOfTypeQuery, isPrefixUnaryExpression, isPrivateIdentifier, isPrologueDirective, - isPropertyAccessEntityNameExpression, isPropertyAccessExpression, isPropertyNameLiteral, isPrototypeAccess, - isPushOrUnshiftIdentifier, isRequireCall, isShorthandPropertyAssignment, isSignedNumericLiteral, isSourceFile, - isSpecialPropertyDeclaration, isStatement, isStatementButNotDeclaration, isStatic, isString, isStringLiteralLike, - isStringOrNumericLiteralLike, isThisInitializedDeclaration, isTypeAliasDeclaration, isTypeOfExpression, - isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, - JSDocCallbackTag, JSDocClassTag, JSDocEnumTag, JSDocFunctionType, JSDocParameterTag, JSDocPropertyLikeTag, - JSDocSignature, JSDocTypedefTag, JSDocTypeLiteral, JsxAttribute, JsxAttributes, LabeledStatement, length, - LiteralLikeElementAccessExpression, MappedTypeNode, MethodDeclaration, ModifierFlags, ModuleBlock, - ModuleDeclaration, Mutable, NamespaceExportDeclaration, Node, NodeArray, NodeFlags, nodeHasName, nodeIsMissing, - nodeIsPresent, NonNullChain, NonNullExpression, NumericLiteral, objectAllocator, ObjectLiteralExpression, - OptionalChain, ParameterDeclaration, ParenthesizedExpression, Pattern, PatternAmbientModule, perfLogger, - PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessChain, PropertyAccessExpression, - PropertyDeclaration, PropertySignature, removeFileExtension, ReturnStatement, ScriptTarget, - SetAccessorDeclaration, setParent, setParentRecursive, setValueDeclaration, ShorthandPropertyAssignment, - shouldPreserveConstEnums, SignatureDeclaration, skipParentheses, sliceAfter, some, SourceFile, SpreadElement, - Statement, StringLiteral, SwitchStatement, Symbol, SymbolFlags, symbolName, SymbolTable, SyntaxKind, TextRange, - ThrowStatement, TokenFlags, tokenToString, tracing, TracingNode, tryCast, tryParsePattern, TryStatement, - TypeLiteralNode, TypeOfExpression, TypeParameterDeclaration, unescapeLeadingUnderscores, unreachableCodeIsError, - unusedLabelIsError, VariableDeclaration, WhileStatement, WithStatement, + __String, + AccessExpression, + addRelatedInfo, + append, + appendIfUnique, + ArrayBindingElement, + ArrayLiteralExpression, + ArrowFunction, + AssignmentDeclarationKind, + BinaryExpression, + BinaryOperatorToken, + BindableAccessExpression, + BindableObjectDefinePropertyCall, + BindablePropertyAssignmentExpression, + BindableStaticAccessExpression, + BindableStaticNameExpression, + BindableStaticPropertyAssignmentExpression, + BindingElement, + Block, + BreakOrContinueStatement, + CallChain, + CallExpression, + CaseBlock, + CaseClause, + cast, + CatchClause, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CompilerOptions, + concatenate, + ConditionalExpression, + ConditionalTypeNode, + contains, + createBinaryExpressionTrampoline, + createDiagnosticForNodeInSourceFile, + createFileDiagnostic, + createQueue, + createSymbolTable, + Debug, + Declaration, + declarationNameToString, + DeleteExpression, + DestructuringAssignment, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticRelatedInformation, + Diagnostics, + DiagnosticWithLocation, + DoStatement, + DynamicNamedDeclaration, + ElementAccessChain, + ElementAccessExpression, + EntityNameExpression, + EnumDeclaration, + escapeLeadingUnderscores, + every, + ExportAssignment, + exportAssignmentIsAlias, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + findAncestor, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, + forEach, + forEachChild, + ForInOrOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + getAssignedExpandoInitializer, + getAssignmentDeclarationKind, + getAssignmentDeclarationPropertyAccessKind, + getCombinedModifierFlags, + getCombinedNodeFlags, + getContainingClass, + getEffectiveContainerForJSDocTemplateTag, + getElementOrPropertyAccessName, + getEmitScriptTarget, + getEnclosingBlockScopeContainer, + getErrorSpanForNode, + getEscapedTextOfIdentifierOrLiteral, + getExpandoInitializer, + getHostSignatureFromJSDoc, + getImmediatelyInvokedFunctionExpression, + getJSDocTypeTag, + getLeftmostAccessExpression, + getNameOfDeclaration, + getNameOrArgument, + getNodeId, + getRangesWhere, + getRightMostAssignedExpression, + getSourceFileOfNode, + getSourceTextOfNodeFromSourceFile, + getSpanOfTokenAtPosition, + getStrictOptionValue, + getSymbolNameForPrivateIdentifier, + getTextOfIdentifierOrLiteral, + getThisContainer, + getTokenPosOfNode, + hasDynamicName, + hasJSDocNodes, + hasSyntacticModifier, + Identifier, + idText, + IfStatement, + ImportClause, + InternalSymbolName, + isAliasableExpression, + isAmbientModule, + isAssignmentExpression, + isAssignmentOperator, + isAssignmentTarget, + isAsyncFunction, + isAutoAccessorPropertyDeclaration, + isBinaryExpression, + isBindableObjectDefinePropertyCall, + isBindableStaticAccessExpression, + isBindableStaticNameExpression, + isBindingPattern, + isBlock, + isBlockOrCatchScoped, + isCallExpression, + isClassStaticBlockDeclaration, + isConditionalTypeNode, + isDeclaration, + isDeclarationStatement, + isDestructuringAssignment, + isDottedName, + isElementAccessExpression, + isEmptyObjectLiteral, + isEntityNameExpression, + isEnumConst, + isEnumDeclaration, + isExportAssignment, + isExportDeclaration, + isExportsIdentifier, + isExportSpecifier, + isExpression, + isExpressionOfOptionalChainRoot, + isExternalModule, + isExternalOrCommonJsModule, + isForInOrOfStatement, + isFunctionDeclaration, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeOrClassStaticBlockDeclaration, + isFunctionSymbol, + isGlobalScopeAugmentation, + isIdentifier, + isIdentifierName, + isInJSFile, + isInTopLevelContext, + isJSDocConstructSignature, + isJSDocEnumTag, + isJSDocTemplateTag, + isJSDocTypeAlias, + isJsonSourceFile, + isLeftHandSideExpression, + isLogicalOrCoalescingAssignmentOperator, + isModuleAugmentationExternal, + isModuleBlock, + isModuleDeclaration, + isModuleExportsAccessExpression, + isNamedDeclaration, + isNamespaceExport, + isNonNullExpression, + isNullishCoalesce, + isObjectLiteralExpression, + isObjectLiteralMethod, + isObjectLiteralOrClassExpressionMethodOrAccessor, + isOmittedExpression, + isOptionalChain, + isOptionalChainRoot, + isOutermostOptionalChain, + isParameterDeclaration, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isPartOfTypeQuery, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAccessEntityNameExpression, + isPropertyAccessExpression, + isPropertyNameLiteral, + isPrototypeAccess, + isPushOrUnshiftIdentifier, + isRequireCall, + isShorthandPropertyAssignment, + isSignedNumericLiteral, + isSourceFile, + isSpecialPropertyDeclaration, + isStatement, + isStatementButNotDeclaration, + isStatic, + isString, + isStringLiteralLike, + isStringOrNumericLiteralLike, + isThisInitializedDeclaration, + isTypeAliasDeclaration, + isTypeOfExpression, + isVariableDeclaration, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableStatement, + JSDocCallbackTag, + JSDocClassTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTypedefTag, + JSDocTypeLiteral, + JsxAttribute, + JsxAttributes, + LabeledStatement, + length, + LiteralLikeElementAccessExpression, + MappedTypeNode, + MethodDeclaration, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + Mutable, + NamespaceExportDeclaration, + Node, + NodeArray, + NodeFlags, + nodeHasName, + nodeIsMissing, + nodeIsPresent, + NonNullChain, + NonNullExpression, + NumericLiteral, + objectAllocator, + ObjectLiteralExpression, + OptionalChain, + ParameterDeclaration, + ParenthesizedExpression, + Pattern, + PatternAmbientModule, + perfLogger, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAccessChain, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + removeFileExtension, + ReturnStatement, + ScriptTarget, + SetAccessorDeclaration, + setParent, + setParentRecursive, + setValueDeclaration, + ShorthandPropertyAssignment, + shouldPreserveConstEnums, + SignatureDeclaration, + skipParentheses, + sliceAfter, + some, + SourceFile, + SpreadElement, + Statement, + StringLiteral, + SwitchStatement, + Symbol, + SymbolFlags, + symbolName, + SymbolTable, + SyntaxKind, + TextRange, + ThrowStatement, + TokenFlags, + tokenToString, + tracing, + TracingNode, + tryCast, + tryParsePattern, + TryStatement, + TypeLiteralNode, + TypeOfExpression, + TypeParameterDeclaration, + unescapeLeadingUnderscores, + unreachableCodeIsError, + unusedLabelIsError, + VariableDeclaration, + WhileStatement, + WithStatement, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 26506bf04368c..6002189104f9b 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1,19 +1,85 @@ import * as ts from "./_namespaces/ts"; import { - addRange, AffectedFileResult, arrayFrom, arrayToMap, BuilderProgram, BuilderProgramHost, BuilderState, BuildInfo, - BundleBuildInfo, CancellationToken, CommandLineOption, compareStringsCaseSensitive, compareValues, CompilerHost, - CompilerOptions, compilerOptionsAffectDeclarationPath, compilerOptionsAffectEmit, - compilerOptionsAffectSemanticDiagnostics, CompilerOptionsValue, concatenate, convertToOptionsWithAbsolutePaths, - createBuildInfo, createGetCanonicalFileName, createProgram, CustomTransformers, Debug, Diagnostic, - DiagnosticCategory, DiagnosticMessageChain, DiagnosticRelatedInformation, DiagnosticWithLocation, - EmitAndSemanticDiagnosticsBuilderProgram, EmitOnly, EmitResult, emitSkippedWithNoDiagnostics, emptyArray, - ensurePathIsNonModuleName, filterSemanticDiagnostics, forEach, forEachEntry, forEachKey, generateDjb2Hash, - GetCanonicalFileName, getDirectoryPath, getEmitDeclarations, getNormalizedAbsolutePath, getOptionsNameMap, - getOwnKeys, getRelativePathFromDirectory, getTsBuildInfoEmitOutputFilePath, handleNoEmitOptions, HostForComputeHash, isArray, - isDeclarationFileName, isJsonSourceFile, isNumber, isString, map, mapDefined, maybeBind, noop, notImplemented, - outFile, Path, Program, ProjectReference, ReadBuildProgramHost, ReadonlyCollection, - returnFalse, returnUndefined, SemanticDiagnosticsBuilderProgram, skipTypeChecking, some, SourceFile, - sourceFileMayBeEmitted, SourceMapEmitResult, toPath, tryAddToSet, WriteFileCallback, WriteFileCallbackData, + addRange, + AffectedFileResult, + arrayFrom, + arrayToMap, + BuilderProgram, + BuilderProgramHost, + BuilderState, + BuildInfo, + BundleBuildInfo, + CancellationToken, + CommandLineOption, + compareStringsCaseSensitive, + compareValues, + CompilerHost, + CompilerOptions, + compilerOptionsAffectDeclarationPath, + compilerOptionsAffectEmit, + compilerOptionsAffectSemanticDiagnostics, + CompilerOptionsValue, + concatenate, + convertToOptionsWithAbsolutePaths, + createBuildInfo, + createGetCanonicalFileName, + createProgram, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCategory, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + DiagnosticWithLocation, + EmitAndSemanticDiagnosticsBuilderProgram, + EmitOnly, + EmitResult, + emitSkippedWithNoDiagnostics, + emptyArray, + ensurePathIsNonModuleName, + filterSemanticDiagnostics, + forEach, + forEachEntry, + forEachKey, + generateDjb2Hash, + GetCanonicalFileName, + getDirectoryPath, + getEmitDeclarations, + getNormalizedAbsolutePath, + getOptionsNameMap, + getOwnKeys, + getRelativePathFromDirectory, + getTsBuildInfoEmitOutputFilePath, + handleNoEmitOptions, + HostForComputeHash, + isArray, + isDeclarationFileName, + isJsonSourceFile, + isNumber, + isString, + map, + mapDefined, + maybeBind, + 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 b2893c4691d38..e664960e4d59e 100644 --- a/src/compiler/builderPublic.ts +++ b/src/compiler/builderPublic.ts @@ -1,8 +1,21 @@ import { - BuilderProgramKind, CancellationToken, CompilerHost, CompilerOptions, createBuilderProgram, - createRedirectedBuilderProgram, CustomTransformers, Diagnostic, DiagnosticWithLocation, EmitResult, - getBuilderCreationParameters, Program, ProjectReference, ReusableBuilderProgramState, SavedBuildProgramEmitState, - SourceFile, WriteFileCallback, + BuilderProgramKind, + CancellationToken, + CompilerHost, + CompilerOptions, + createBuilderProgram, + createRedirectedBuilderProgram, + CustomTransformers, + Diagnostic, + DiagnosticWithLocation, + EmitResult, + getBuilderCreationParameters, + Program, + ProjectReference, + ReusableBuilderProgramState, + SavedBuildProgramEmitState, + SourceFile, + WriteFileCallback, } 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 3fdeb73d1c8b7..8ae0d6295ca8d 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -1,11 +1,38 @@ import { - arrayFrom, CancellationToken, computeSignatureWithDiagnostics, createGetCanonicalFileName, CustomTransformers, Debug, EmitOutput, emptyArray, - ExportedModulesFromDeclarationEmit, GetCanonicalFileName, getDirectoryPath, getSourceFileOfNode, + arrayFrom, + CancellationToken, + computeSignatureWithDiagnostics, + createGetCanonicalFileName, + CustomTransformers, + Debug, + EmitOutput, + emptyArray, + ExportedModulesFromDeclarationEmit, + GetCanonicalFileName, + getDirectoryPath, + getSourceFileOfNode, HostForComputeHash, - isDeclarationFileName, isExternalOrCommonJsModule, isGlobalScopeAugmentation, isJsonSourceFile, - isModuleWithStringLiteralName, isStringLiteral, mapDefined, mapDefinedIterator, ModuleDeclaration, - ModuleKind, outFile, OutputFile, Path, Program, ResolutionMode, some, SourceFile, StringLiteralLike, Symbol, - toPath, TypeChecker, + isDeclarationFileName, + isExternalOrCommonJsModule, + isGlobalScopeAugmentation, + isJsonSourceFile, + isModuleWithStringLiteralName, + 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/builderStatePublic.ts b/src/compiler/builderStatePublic.ts index d520c76ccc56d..17ffc222e30d1 100644 --- a/src/compiler/builderStatePublic.ts +++ b/src/compiler/builderStatePublic.ts @@ -1,4 +1,7 @@ -import { Diagnostic, WriteFileCallbackData } from "./_namespaces/ts"; +import { + Diagnostic, + WriteFileCallbackData, +} from "./_namespaces/ts"; export interface EmitOutput { outputFiles: OutputFile[]; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d316aec55faba..09b5759f59bc3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,201 +1,1015 @@ import * as ts from "./_namespaces/ts"; import { - __String, AccessExpression, AccessFlags, AccessorDeclaration, addRange, addRelatedInfo, addSyntheticLeadingComment, - AllAccessorDeclarations, and, AnonymousType, AnyImportOrReExport, AnyImportSyntax, append, appendIfUnique, - ArrayBindingPattern, arrayFrom, arrayIsHomogeneous, ArrayLiteralExpression, arrayOf, arraysEqual, arrayToMultiMap, - ArrayTypeNode, ArrowFunction, AssertionExpression, AssignmentDeclarationKind, AssignmentKind, AssignmentPattern, - AwaitExpression, BaseType, BigIntLiteral, BigIntLiteralType, BinaryExpression, BinaryOperatorToken, binarySearch, - BindableObjectDefinePropertyCall, BindingElement, BindingElementGrandparent, BindingName, BindingPattern, - bindSourceFile, Block, BreakOrContinueStatement, CallChain, CallExpression, CallLikeExpression, - CallSignatureDeclaration, CancellationToken, canHaveDecorators, canHaveExportModifier, canHaveIllegalDecorators, - canHaveIllegalModifiers, canHaveModifiers, 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, createCompilerDiagnostic, createDiagnosticCollection, - createDiagnosticForFileFromMessageChain, createDiagnosticForNode, createDiagnosticForNodeArray, - createDiagnosticForNodeFromMessageChain, createDiagnosticMessageChainFromDiagnostic, createEmptyExports, - createFileDiagnostic, createGetCanonicalFileName, createGetSymbolWalker, createPrinter, - createPropertyNameNodeForIdentifierOrLiteral, createScanner, createSymbolTable, createTextWriter, - createUnderscoreEscapedMultiMap, Debug, Declaration, DeclarationName, declarationNameToString, DeclarationStatement, - DeclarationWithTypeParameterChildren, DeclarationWithTypeParameters, Decorator, deduplicate, DefaultClause, - defaultMaximumTruncationLength, DeferredTypeReference, DeleteExpression, Diagnostic, DiagnosticCategory, - DiagnosticMessage, DiagnosticMessageChain, DiagnosticRelatedInformation, Diagnostics, DiagnosticWithLocation, - DoStatement, DynamicNamedDeclaration, ElementAccessChain, ElementAccessExpression, ElementFlags, EmitFlags, - EmitHint, EmitResolver, EmitTextWriter, emptyArray, endsWith, EntityName, EntityNameExpression, - EntityNameOrEntityNameExpression, entityNameToString, EnumDeclaration, EnumMember, equateValues, - escapeLeadingUnderscores, escapeString, every, EvolvingArrayType, ExclamationToken, ExportAssignment, - exportAssignmentIsAlias, ExportDeclaration, ExportSpecifier, Expression, expressionResultIsUnused, - ExpressionStatement, ExpressionWithTypeArguments, Extension, ExternalEmitHelpers, externalHelpersModuleNameText, - factory, fileExtensionIs, fileExtensionIsOneOf, filter, find, findAncestor, findBestPatternMatch, findIndex, - findLast, findLastIndex, findUseStrictPrologue, first, firstDefined, firstOrUndefined, flatMap, flatten, - FlowArrayMutation, FlowAssignment, FlowCall, FlowCondition, FlowFlags, FlowLabel, FlowNode, FlowReduceLabel, - FlowStart, FlowSwitchClause, FlowType, forEach, forEachChild, forEachChildRecursively, - forEachEnclosingBlockScopeContainer, forEachEntry, forEachImportClauseDeclaration, forEachKey, - forEachReturnStatement, forEachYieldExpression, ForInOrOfStatement, ForInStatement, formatMessage, ForOfStatement, - ForStatement, FreshableIntrinsicType, FreshableType, FreshObjectLiteralType, FunctionDeclaration, - FunctionExpression, FunctionFlags, FunctionLikeDeclaration, FunctionTypeNode, GenericType, GetAccessorDeclaration, - getAliasDeclarationFromName, getAllAccessorDeclarations, getAllowSyntheticDefaultImports, getAncestor, - getAssignedExpandoInitializer, getAssignmentDeclarationKind, getAssignmentDeclarationPropertyAccessKind, - getAssignmentTargetKind, getCheckFlags, getClassExtendsHeritageElement, getClassLikeDeclarationOfSymbol, - getCombinedLocalAndExportSymbolFlags, getCombinedModifierFlags, getCombinedNodeFlags, getContainingClass, - getContainingFunction, getContainingFunctionOrClassStaticBlock, getDeclarationModifierFlagsFromSymbol, - getDeclarationOfKind, getDeclarationsOfKind, getDeclaredExpandoInitializer, getDirectoryPath, - getEffectiveBaseTypeNode, getEffectiveConstraintOfTypeParameter, getEffectiveContainerForJSDocTemplateTag, - getEffectiveImplementsTypeNodes, getEffectiveInitializer, getEffectiveJSDocHost, getEffectiveModifierFlags, - getEffectiveReturnTypeNode, getEffectiveSetAccessorTypeAnnotationNode, getEffectiveTypeAnnotationNode, - getEffectiveTypeParameterDeclarations, getElementOrPropertyAccessName, getEmitDeclarations, getEmitModuleKind, - getEmitModuleResolutionKind, getEmitScriptTarget, getEnclosingBlockScopeContainer, getEntityNameFromTypeNode, - getEntries, getErrorSpanForNode, getEscapedTextOfIdentifierOrLiteral, getESModuleInterop, getExpandoInitializer, - getExportAssignmentExpression, getExternalModuleImportEqualsDeclarationExpression, getExternalModuleName, - getExternalModuleRequireArgument, getFirstConstructorWithBody, getFirstIdentifier, getFunctionFlags, - getHostSignatureFromJSDoc, getImmediatelyInvokedFunctionExpression, getInitializerOfBinaryExpression, - getInterfaceBaseTypeNodes, getInvokedExpression, getJSDocClassTag, getJSDocDeprecatedTag, getJSDocEnumTag, - getJSDocHost, getJSDocParameterTags, getJSDocRoot, getJSDocTags, getJSDocThisTag, getJSDocType, - getJSDocTypeAssertionType, getJSDocTypeParameterDeclarations, getJSDocTypeTag, getJSXImplicitImportBase, - getJSXRuntimeImport, getJSXTransformEnabled, getLeftmostAccessExpression, getLineAndCharacterOfPosition, - getLocalSymbolForExportDefault, getMembersOfDeclaration, getModeForUsageLocation, getModifiers, - getModuleInstanceState, getNameFromIndexInfo, getNameOfDeclaration, getNameOfExpando, getNamespaceDeclarationNode, - getNewTargetContainer, getNonAugmentationDeclaration, getNormalizedAbsolutePath, getObjectFlags, getOriginalNode, - getOrUpdate, getOwnKeys, getParameterSymbolFromJSDoc, getParseTreeNode, getPropertyAssignmentAliasLikeExpression, - getPropertyNameForPropertyNameNode, getResolutionDiagnostic, getResolutionModeOverrideForClause, - getResolvedExternalModuleName, getResolvedModule, getRestParameterElementType, getRootDeclaration, - getScriptTargetFeatures, getSelectedEffectiveModifierFlags, getSemanticJsxChildren, getSetAccessorValueParameter, - getSingleVariableOfVariableStatement, getSourceFileOfModule, getSourceFileOfNode, getSpanOfTokenAtPosition, - getSpellingSuggestion, getStrictOptionValue, getSuperContainer, getSymbolNameForPrivateIdentifier, - getTextOfIdentifierOrLiteral, getTextOfJSDocComment, getTextOfNode, getTextOfPropertyName, getThisContainer, - getThisParameter, getTrailingSemicolonDeferringWriter, getTypeParameterFromJsDoc, getTypesPackageName, - getUseDefineForClassFields, group, hasAbstractModifier, hasAccessorModifier, hasAmbientModifier, - hasContextSensitiveParameters, hasDecorators, HasDecorators, hasDynamicName, hasEffectiveModifier, - hasEffectiveModifiers, hasEffectiveReadonlyModifier, HasExpressionInitializer, hasExtension, HasIllegalDecorators, - HasIllegalModifiers, hasInitializer, HasInitializer, hasJSDocNodes, hasJSDocParameterTags, hasJsonModuleEmitEnabled, - HasModifiers, hasOnlyExpressionInitializer, hasOverrideModifier, hasPossibleExternalModuleReference, - hasQuestionToken, hasRestParameter, hasScopeMarker, 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, - isAliasableExpression, isAmbientModule, isArray, isArrayBindingPattern, isArrayLiteralExpression, isArrowFunction, - isAssertionExpression, isAssignmentDeclaration, isAssignmentExpression, isAssignmentOperator, isAssignmentPattern, - isAssignmentTarget, isAsyncFunction, isAutoAccessorPropertyDeclaration, isBinaryExpression, - isBindableObjectDefinePropertyCall, isBindableStaticElementAccessExpression, isBindableStaticNameExpression, - isBindingElement, isBindingPattern, isBlock, isBlockOrCatchScoped, isBlockScopedContainerTopLevel, isCallChain, - isCallExpression, isCallLikeExpression, isCallOrNewExpression, isCallSignatureDeclaration, isCatchClause, - isCatchClauseVariableDeclarationOrBindingElement, isCheckJsEnabledForFile, isChildOfNodeWithKind, - isClassDeclaration, isClassElement, isClassExpression, isClassLike, isClassStaticBlockDeclaration, isCommaSequence, - isCommonJsExportedExpression, isCommonJsExportPropertyAssignment, isComputedNonLiteralName, isComputedPropertyName, - isConstructorDeclaration, isConstructorTypeNode, isConstTypeReference, isDeclaration, isDeclarationName, - isDeclarationReadonly, isDecorator, isDefaultedExpandoInitializer, isDeleteTarget, isDottedName, isDynamicName, - isEffectiveExternalModule, isElementAccessExpression, isEntityName, isEntityNameExpression, isEnumConst, - isEnumDeclaration, isEnumMember, isExclusivelyTypeOnlyImportOrExport, isExportAssignment, isExportDeclaration, - isExportsIdentifier, isExportSpecifier, isExpression, isExpressionNode, isExpressionOfOptionalChainRoot, - isExpressionStatement, isExpressionWithTypeArguments, isExpressionWithTypeArgumentsInClassExtendsClause, - isExternalModule, isExternalModuleAugmentation, isExternalModuleImportEqualsDeclaration, isExternalModuleIndicator, - isExternalModuleNameRelative, isExternalModuleReference, isExternalOrCommonJsModule, isForInOrOfStatement, - isForInStatement, isForOfStatement, isForStatement, isFunctionDeclaration, isFunctionExpression, - isFunctionExpressionOrArrowFunction, isFunctionLike, isFunctionLikeDeclaration, - isFunctionLikeOrClassStaticBlockDeclaration, isFunctionOrModuleBlock, isFunctionTypeNode, isGeneratedIdentifier, - isGetAccessor, isGetAccessorDeclaration, isGetOrSetAccessorDeclaration, isGlobalScopeAugmentation, isHeritageClause, - isIdentifier, isIdentifierStart, isIdentifierText, isIdentifierTypePredicate, isIdentifierTypeReference, - isIfStatement, isImportCall, isImportClause, isImportDeclaration, isImportEqualsDeclaration, isImportKeyword, - isImportOrExportSpecifier, isImportSpecifier, isImportTypeNode, isIndexedAccessTypeNode, isInExpressionContext, - isInfinityOrNaNString, isInJSDoc, isInJSFile, isInJsonFile, isInterfaceDeclaration, - isInternalModuleImportEqualsDeclaration, isInTopLevelContext, isIntrinsicJsxName, isIterationStatement, - isJSDocAllType, isJSDocAugmentsTag, isJSDocCallbackTag, isJSDocConstructSignature, isJSDocFunctionType, - isJSDocIndexSignature, isJSDocLinkLike, isJSDocMemberName, isJSDocNameReference, isJSDocNode, - isJSDocNonNullableType, isJSDocNullableType, isJSDocOptionalType, isJSDocParameterTag, isJSDocPropertyLikeTag, - isJSDocReturnTag, isJSDocSignature, isJSDocTemplateTag, isJSDocTypeAlias, isJSDocTypeAssertion, isJSDocTypedefTag, - isJSDocTypeExpression, isJSDocTypeLiteral, isJSDocTypeTag, isJSDocUnknownType, isJSDocVariadicType, - isJsonSourceFile, isJsxAttribute, isJsxAttributeLike, isJsxAttributes, isJsxElement, isJsxOpeningElement, - isJsxOpeningFragment, isJsxOpeningLikeElement, isJsxSelfClosingElement, isJsxSpreadAttribute, isJSXTagName, - isKnownSymbol, isLateVisibilityPaintedStatement, isLeftHandSideExpression, isLet, isLineBreak, - isLiteralComputedPropertyDeclarationName, isLiteralExpressionOfObject, isLiteralImportTypeNode, isLiteralTypeNode, - isMetaProperty, isMethodDeclaration, isMethodSignature, isModifier, isModuleBlock, isModuleDeclaration, - isModuleExportsAccessExpression, isModuleIdentifier, isModuleOrEnumDeclaration, isModuleWithStringLiteralName, - isNamedDeclaration, isNamedExports, isNamedTupleMember, isNamespaceExport, isNamespaceExportDeclaration, - isNamespaceReexportDeclaration, isNewExpression, isNightly, isNodeDescendantOf, isNullishCoalesce, isNumericLiteral, - isNumericLiteralName, isObjectBindingPattern, isObjectLiteralElementLike, isObjectLiteralExpression, - isObjectLiteralMethod, isObjectLiteralOrClassExpressionMethodOrAccessor, isOmittedExpression, isOptionalChain, - isOptionalChainRoot, isOptionalJSDocPropertyLikeTag, isOptionalTypeNode, isOutermostOptionalChain, isParameter, - isParameterDeclaration, isParameterOrCatchClauseVariable, isParameterPropertyDeclaration, isParenthesizedExpression, - isParenthesizedTypeNode, isPartOfTypeNode, isPartOfTypeQuery, isPlainJsFile, isPrefixUnaryExpression, - isPrivateIdentifier, isPrivateIdentifierClassElementDeclaration, isPrivateIdentifierPropertyAccessExpression, - isPropertyAccessEntityNameExpression, isPropertyAccessExpression, isPropertyAccessOrQualifiedNameOrImportTypeNode, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isPropertyNameLiteral, isPropertySignature, - isPrototypeAccess, isPrototypePropertyAssignment, isPushOrUnshiftIdentifier, isQualifiedName, isRequireCall, - isRestParameter, isRestTypeNode, isRightSideOfQualifiedNameOrPropertyAccess, - isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName, isSameEntityName, isSetAccessor, - isShorthandAmbientModuleSymbol, isShorthandPropertyAssignment, isSingleOrDoubleQuote, isSourceFile, isSourceFileJS, - isSpreadAssignment, isSpreadElement, isStatement, isStatementWithLocals, isStatic, isString, - isStringANonContextualKeyword, isStringLiteral, isStringLiteralLike, isStringOrNumericLiteralLike, isSuperCall, - isSuperProperty, isTaggedTemplateExpression, isTemplateSpan, isThisContainerOrFunctionBlock, isThisIdentifier, - isThisInitializedDeclaration, isThisInitializedObjectBindingExpression, isThisInTypeQuery, isThisProperty, - isThisTypeParameter, isTransientSymbol, isTupleTypeNode, isTypeAlias, isTypeAliasDeclaration, isTypeDeclaration, - isTypeLiteralNode, isTypeNode, isTypeNodeKind, isTypeOfExpression, isTypeOnlyImportOrExportDeclaration, - isTypeOperatorNode, isTypeParameterDeclaration, isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, - isTypeReferenceType, isUMDExportSymbol, isValidESSymbolDeclaration, isValidTypeOnlyAliasUseSite, - isValueSignatureDeclaration, isVarConst, isVariableDeclaration, - isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationInVariableStatement, - isVariableDeclarationList, isVariableLike, isVariableLikeOrAccessor, isVariableStatement, isWriteAccess, - isWriteOnlyAccess, IterableOrIteratorType, IterationTypes, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocComment, - JSDocContainer, JSDocEnumTag, JSDocFunctionType, JSDocImplementsTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, - JSDocMemberName, JSDocNullableType, JSDocOptionalType, JSDocParameterTag, JSDocPrivateTag, JSDocPropertyLikeTag, - JSDocPropertyTag, JSDocProtectedTag, JSDocPublicTag, JSDocSignature, JSDocTemplateTag, JSDocTypedefTag, - JSDocTypeExpression, JSDocTypeReferencingNode, JSDocTypeTag, JSDocVariadicType, JsxAttribute, JsxAttributeLike, - JsxAttributes, JsxChild, JsxClosingElement, JsxElement, JsxEmit, JsxExpression, JsxFlags, JsxFragment, - JsxOpeningElement, JsxOpeningFragment, JsxOpeningLikeElement, JsxReferenceKind, JsxSelfClosingElement, - JsxSpreadAttribute, JsxTagNameExpression, KeywordTypeNode, LabeledStatement, last, lastOrUndefined, - LateBoundBinaryExpressionDeclaration, LateBoundDeclaration, LateBoundName, LateVisibilityPaintedStatement, - LeftHandSideExpression, length, LiteralExpression, LiteralType, LiteralTypeNode, mangleScopedPackageName, map, - mapDefined, MappedSymbol, MappedType, MappedTypeNode, MatchingKeys, maybeBind, MemberName, MemberOverrideStatus, - memoize, MetaProperty, MethodDeclaration, MethodSignature, minAndMax, MinusToken, Modifier, ModifierFlags, - modifiersToFlags, modifierToFlag, ModuleBlock, ModuleDeclaration, ModuleInstanceState, ModuleKind, - ModuleResolutionKind, NamedDeclaration, NamedExports, NamedImportsOrExports, NamedTupleMember, - NamespaceDeclaration, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, needsScopeMarker, NewExpression, - Node, NodeArray, NodeBuilderFlags, nodeCanBeDecorated, NodeCheckFlags, NodeFlags, nodeHasName, nodeIsDecorated, - nodeIsMissing, nodeIsPresent, nodeIsSynthesized, NodeLinks, nodeStartsNewLexicalEnvironment, NodeWithTypeArguments, - NonNullChain, NonNullExpression, not, noTruncationMaximumTruncationLength, nullTransformationContext, - NumberLiteralType, NumericLiteral, objectAllocator, ObjectBindingPattern, ObjectFlags, ObjectFlagsType, - ObjectLiteralElementLike, ObjectLiteralExpression, ObjectType, OptionalChain, OptionalTypeNode, or, - orderedRemoveItemAt, OuterExpressionKinds, outFile, ParameterDeclaration, parameterIsThisKeyword, - ParameterPropertyDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, parseIsolatedEntityName, - parseNodeFactory, parsePseudoBigInt, Path, pathIsRelative, PatternAmbientModule, PlusToken, PostfixUnaryExpression, - PrefixUnaryExpression, PrivateIdentifier, Program, PromiseOrAwaitableType, PropertyAccessChain, - PropertyAccessEntityNameExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, - PropertySignature, PseudoBigInt, pseudoBigIntToString, pushIfUnique, QualifiedName, QuestionToken, rangeEquals, - rangeOfNode, rangeOfTypeParameters, ReadonlyKeyword, reduceLeft, RelationComparisonResult, - relativeComplement, removeExtension, removePrefix, replaceElement, resolutionExtensionIsTSOrJson, - ResolvedModuleFull, ResolvedType, resolveTripleslashReference, resolvingEmptyArray, RestTypeNode, ReturnStatement, - ReverseMappedSymbol, ReverseMappedType, sameMap, SatisfiesExpression, ScriptKind, ScriptTarget, - SetAccessorDeclaration, setCommentRange, setEmitFlags, setNodeFlags, setOriginalNode, setParent, - setSyntheticLeadingComments, setTextRange, setTextRangePosEnd, setValueDeclaration, ShorthandPropertyAssignment, - shouldPreserveConstEnums, Signature, SignatureDeclaration, SignatureFlags, SignatureKind, singleElementArray, - skipOuterExpressions, skipParentheses, skipTrivia, skipTypeChecking, some, SourceFile, SpreadAssignment, - SpreadElement, startsWith, Statement, stringContains, StringLiteral, StringLiteralLike, StringLiteralType, - StringMappingType, stripQuotes, StructuredType, SubstitutionType, sum, SuperCall, SwitchStatement, Symbol, - SymbolAccessibility, SymbolAccessibilityResult, SymbolFlags, SymbolFormatFlags, SymbolId, SymbolLinks, symbolName, - SymbolTable, SymbolTracker, SymbolVisibilityResult, SyntaxKind, SyntheticDefaultModuleType, SyntheticExpression, - TaggedTemplateExpression, TemplateExpression, TemplateLiteralType, TemplateLiteralTypeNode, Ternary, - textRangeContainsPositionInclusive, TextSpan, textSpanContainsPosition, textSpanEnd, ThisExpression, ThisTypeNode, - ThrowStatement, TokenFlags, tokenToString, tracing, TracingNode, TransientSymbol, tryAddToSet, tryCast, - tryExtractTSExtension, tryGetClassImplementingOrExtendingExpressionWithTypeArguments, 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, ResolutionMode, + __String, + AccessExpression, + AccessFlags, + AccessorDeclaration, + addRange, + addRelatedInfo, + addSyntheticLeadingComment, + AllAccessorDeclarations, + 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, + binarySearch, + BindableObjectDefinePropertyCall, + BindingElement, + BindingElementGrandparent, + BindingName, + BindingPattern, + bindSourceFile, + Block, + BreakOrContinueStatement, + CallChain, + CallExpression, + CallLikeExpression, + CallSignatureDeclaration, + CancellationToken, + canHaveDecorators, + canHaveExportModifier, + canHaveIllegalDecorators, + canHaveIllegalModifiers, + canHaveModifiers, + 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, + createCompilerDiagnostic, + createDiagnosticCollection, + createDiagnosticForFileFromMessageChain, + createDiagnosticForNode, + createDiagnosticForNodeArray, + createDiagnosticForNodeFromMessageChain, + createDiagnosticMessageChainFromDiagnostic, + createEmptyExports, + createFileDiagnostic, + createGetCanonicalFileName, + createGetSymbolWalker, + createPrinter, + createPropertyNameNodeForIdentifierOrLiteral, + createScanner, + createSymbolTable, + createTextWriter, + createUnderscoreEscapedMultiMap, + Debug, + Declaration, + DeclarationName, + declarationNameToString, + DeclarationStatement, + DeclarationWithTypeParameterChildren, + DeclarationWithTypeParameters, + Decorator, + deduplicate, + DefaultClause, + defaultMaximumTruncationLength, + DeferredTypeReference, + DeleteExpression, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + Diagnostics, + DiagnosticWithLocation, + DoStatement, + DynamicNamedDeclaration, + ElementAccessChain, + ElementAccessExpression, + ElementFlags, + EmitFlags, + EmitHint, + EmitResolver, + EmitTextWriter, + emptyArray, + endsWith, + EntityName, + EntityNameExpression, + EntityNameOrEntityNameExpression, + entityNameToString, + EnumDeclaration, + EnumMember, + equateValues, + escapeLeadingUnderscores, + escapeString, + every, + EvolvingArrayType, + ExclamationToken, + ExportAssignment, + exportAssignmentIsAlias, + ExportDeclaration, + ExportSpecifier, + Expression, + expressionResultIsUnused, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalEmitHelpers, + externalHelpersModuleNameText, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + find, + findAncestor, + findBestPatternMatch, + findIndex, + findLast, + findLastIndex, + findUseStrictPrologue, + first, + firstDefined, + firstOrUndefined, + flatMap, + flatten, + FlowArrayMutation, + FlowAssignment, + FlowCall, + FlowCondition, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, + FlowStart, + FlowSwitchClause, + FlowType, + forEach, + forEachChild, + forEachChildRecursively, + forEachEnclosingBlockScopeContainer, + forEachEntry, + forEachImportClauseDeclaration, + forEachKey, + forEachReturnStatement, + forEachYieldExpression, + ForInOrOfStatement, + ForInStatement, + formatMessage, + ForOfStatement, + ForStatement, + FreshableIntrinsicType, + FreshableType, + FreshObjectLiteralType, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + FunctionTypeNode, + GenericType, + GetAccessorDeclaration, + getAliasDeclarationFromName, + getAllAccessorDeclarations, + getAllowSyntheticDefaultImports, + getAncestor, + getAssignedExpandoInitializer, + getAssignmentDeclarationKind, + getAssignmentDeclarationPropertyAccessKind, + getAssignmentTargetKind, + getCheckFlags, + getClassExtendsHeritageElement, + getClassLikeDeclarationOfSymbol, + getCombinedLocalAndExportSymbolFlags, + getCombinedModifierFlags, + getCombinedNodeFlags, + getContainingClass, + getContainingFunction, + getContainingFunctionOrClassStaticBlock, + getDeclarationModifierFlagsFromSymbol, + getDeclarationOfKind, + getDeclarationsOfKind, + getDeclaredExpandoInitializer, + getDirectoryPath, + getEffectiveBaseTypeNode, + getEffectiveConstraintOfTypeParameter, + getEffectiveContainerForJSDocTemplateTag, + getEffectiveImplementsTypeNodes, + getEffectiveInitializer, + getEffectiveJSDocHost, + getEffectiveModifierFlags, + getEffectiveReturnTypeNode, + getEffectiveSetAccessorTypeAnnotationNode, + getEffectiveTypeAnnotationNode, + getEffectiveTypeParameterDeclarations, + getElementOrPropertyAccessName, + getEmitDeclarations, + getEmitModuleKind, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getEnclosingBlockScopeContainer, + getEntityNameFromTypeNode, + getEntries, + getErrorSpanForNode, + getEscapedTextOfIdentifierOrLiteral, + getESModuleInterop, + getExpandoInitializer, + getExportAssignmentExpression, + getExternalModuleImportEqualsDeclarationExpression, + getExternalModuleName, + getExternalModuleRequireArgument, + getFirstConstructorWithBody, + getFirstIdentifier, + getFunctionFlags, + getHostSignatureFromJSDoc, + getImmediatelyInvokedFunctionExpression, + getInitializerOfBinaryExpression, + getInterfaceBaseTypeNodes, + getInvokedExpression, + getJSDocClassTag, + getJSDocDeprecatedTag, + getJSDocEnumTag, + getJSDocHost, + getJSDocParameterTags, + getJSDocRoot, + getJSDocTags, + getJSDocThisTag, + getJSDocType, + getJSDocTypeAssertionType, + getJSDocTypeParameterDeclarations, + getJSDocTypeTag, + getJSXImplicitImportBase, + getJSXRuntimeImport, + getJSXTransformEnabled, + getLeftmostAccessExpression, + getLineAndCharacterOfPosition, + getLocalSymbolForExportDefault, + getMembersOfDeclaration, + getModeForUsageLocation, + getModifiers, + getModuleInstanceState, + getNameFromIndexInfo, + getNameOfDeclaration, + getNameOfExpando, + getNamespaceDeclarationNode, + getNewTargetContainer, + getNonAugmentationDeclaration, + getNormalizedAbsolutePath, + getObjectFlags, + getOriginalNode, + getOrUpdate, + getOwnKeys, + getParameterSymbolFromJSDoc, + getParseTreeNode, + getPropertyAssignmentAliasLikeExpression, + getPropertyNameForPropertyNameNode, + getResolutionDiagnostic, + getResolutionModeOverrideForClause, + getResolvedExternalModuleName, + getResolvedModule, + getRestParameterElementType, + getRootDeclaration, + getScriptTargetFeatures, + getSelectedEffectiveModifierFlags, + getSemanticJsxChildren, + getSetAccessorValueParameter, + getSingleVariableOfVariableStatement, + getSourceFileOfModule, + getSourceFileOfNode, + getSpanOfTokenAtPosition, + getSpellingSuggestion, + getStrictOptionValue, + getSuperContainer, + getSymbolNameForPrivateIdentifier, + getTextOfIdentifierOrLiteral, + getTextOfJSDocComment, + getTextOfNode, + getTextOfPropertyName, + getThisContainer, + getThisParameter, + getTrailingSemicolonDeferringWriter, + getTypeParameterFromJsDoc, + getTypesPackageName, + getUseDefineForClassFields, + group, + hasAbstractModifier, + hasAccessorModifier, + hasAmbientModifier, + hasContextSensitiveParameters, + hasDecorators, + HasDecorators, + hasDynamicName, + hasEffectiveModifier, + hasEffectiveModifiers, + hasEffectiveReadonlyModifier, + HasExpressionInitializer, + hasExtension, + HasIllegalDecorators, + HasIllegalModifiers, + hasInitializer, + HasInitializer, + hasJSDocNodes, + hasJSDocParameterTags, + hasJsonModuleEmitEnabled, + HasModifiers, + hasOnlyExpressionInitializer, + hasOverrideModifier, + hasPossibleExternalModuleReference, + hasQuestionToken, + hasRestParameter, + hasScopeMarker, + 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, + isAliasableExpression, + isAmbientModule, + isArray, + isArrayBindingPattern, + isArrayLiteralExpression, + isArrowFunction, + isAssertionExpression, + isAssignmentDeclaration, + isAssignmentExpression, + isAssignmentOperator, + isAssignmentPattern, + isAssignmentTarget, + isAsyncFunction, + isAutoAccessorPropertyDeclaration, + isBinaryExpression, + isBindableObjectDefinePropertyCall, + isBindableStaticElementAccessExpression, + isBindableStaticNameExpression, + isBindingElement, + isBindingPattern, + isBlock, + isBlockOrCatchScoped, + isBlockScopedContainerTopLevel, + isCallChain, + isCallExpression, + isCallLikeExpression, + isCallOrNewExpression, + isCallSignatureDeclaration, + isCatchClause, + isCatchClauseVariableDeclarationOrBindingElement, + isCheckJsEnabledForFile, + isChildOfNodeWithKind, + isClassDeclaration, + isClassElement, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isCommaSequence, + isCommonJsExportedExpression, + isCommonJsExportPropertyAssignment, + isComputedNonLiteralName, + isComputedPropertyName, + isConstructorDeclaration, + isConstructorTypeNode, + isConstTypeReference, + isDeclaration, + isDeclarationName, + isDeclarationReadonly, + isDecorator, + isDefaultedExpandoInitializer, + isDeleteTarget, + isDottedName, + isDynamicName, + isEffectiveExternalModule, + isElementAccessExpression, + isEntityName, + isEntityNameExpression, + isEnumConst, + isEnumDeclaration, + isEnumMember, + isExclusivelyTypeOnlyImportOrExport, + isExportAssignment, + isExportDeclaration, + isExportsIdentifier, + isExportSpecifier, + isExpression, + isExpressionNode, + isExpressionOfOptionalChainRoot, + isExpressionStatement, + isExpressionWithTypeArguments, + isExpressionWithTypeArgumentsInClassExtendsClause, + isExternalModule, + isExternalModuleAugmentation, + isExternalModuleImportEqualsDeclaration, + isExternalModuleIndicator, + isExternalModuleNameRelative, + isExternalModuleReference, + isExternalOrCommonJsModule, + isForInOrOfStatement, + isForInStatement, + isForOfStatement, + isForStatement, + isFunctionDeclaration, + isFunctionExpression, + isFunctionExpressionOrArrowFunction, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeOrClassStaticBlockDeclaration, + isFunctionOrModuleBlock, + isFunctionTypeNode, + isGeneratedIdentifier, + isGetAccessor, + isGetAccessorDeclaration, + isGetOrSetAccessorDeclaration, + isGlobalScopeAugmentation, + isHeritageClause, + isIdentifier, + isIdentifierStart, + isIdentifierText, + isIdentifierTypePredicate, + isIdentifierTypeReference, + isIfStatement, + isImportCall, + isImportClause, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isImportOrExportSpecifier, + isImportSpecifier, + isImportTypeNode, + isIndexedAccessTypeNode, + isInExpressionContext, + isInfinityOrNaNString, + isInJSDoc, + isInJSFile, + isInJsonFile, + isInterfaceDeclaration, + isInternalModuleImportEqualsDeclaration, + isInTopLevelContext, + isIntrinsicJsxName, + isIterationStatement, + isJSDocAllType, + isJSDocAugmentsTag, + isJSDocCallbackTag, + isJSDocConstructSignature, + isJSDocFunctionType, + isJSDocIndexSignature, + isJSDocLinkLike, + isJSDocMemberName, + isJSDocNameReference, + isJSDocNode, + isJSDocNonNullableType, + isJSDocNullableType, + isJSDocOptionalType, + isJSDocParameterTag, + isJSDocPropertyLikeTag, + isJSDocReturnTag, + isJSDocSignature, + isJSDocTemplateTag, + isJSDocTypeAlias, + isJSDocTypeAssertion, + isJSDocTypedefTag, + isJSDocTypeExpression, + isJSDocTypeLiteral, + isJSDocTypeTag, + isJSDocUnknownType, + isJSDocVariadicType, + isJsonSourceFile, + isJsxAttribute, + isJsxAttributeLike, + isJsxAttributes, + isJsxElement, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxOpeningLikeElement, + isJsxSelfClosingElement, + isJsxSpreadAttribute, + isJSXTagName, + isKnownSymbol, + isLateVisibilityPaintedStatement, + isLeftHandSideExpression, + isLet, + isLineBreak, + isLiteralComputedPropertyDeclarationName, + isLiteralExpressionOfObject, + isLiteralImportTypeNode, + isLiteralTypeNode, + isMetaProperty, + isMethodDeclaration, + isMethodSignature, + isModifier, + isModuleBlock, + isModuleDeclaration, + isModuleExportsAccessExpression, + isModuleIdentifier, + isModuleOrEnumDeclaration, + isModuleWithStringLiteralName, + isNamedDeclaration, + isNamedExports, + isNamedTupleMember, + isNamespaceExport, + isNamespaceExportDeclaration, + isNamespaceReexportDeclaration, + isNewExpression, + isNightly, + isNodeDescendantOf, + isNullishCoalesce, + isNumericLiteral, + isNumericLiteralName, + isObjectBindingPattern, + isObjectLiteralElementLike, + isObjectLiteralExpression, + isObjectLiteralMethod, + isObjectLiteralOrClassExpressionMethodOrAccessor, + isOmittedExpression, + isOptionalChain, + isOptionalChainRoot, + isOptionalJSDocPropertyLikeTag, + isOptionalTypeNode, + isOutermostOptionalChain, + isParameter, + isParameterDeclaration, + isParameterOrCatchClauseVariable, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isParenthesizedTypeNode, + isPartOfTypeNode, + isPartOfTypeQuery, + isPlainJsFile, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPrivateIdentifierPropertyAccessExpression, + isPropertyAccessEntityNameExpression, + isPropertyAccessExpression, + isPropertyAccessOrQualifiedNameOrImportTypeNode, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isPropertyNameLiteral, + isPropertySignature, + isPrototypeAccess, + isPrototypePropertyAssignment, + isPushOrUnshiftIdentifier, + isQualifiedName, + isRequireCall, + isRestParameter, + isRestTypeNode, + isRightSideOfQualifiedNameOrPropertyAccess, + isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName, + isSameEntityName, + isSetAccessor, + isShorthandAmbientModuleSymbol, + isShorthandPropertyAssignment, + isSingleOrDoubleQuote, + isSourceFile, + isSourceFileJS, + isSpreadAssignment, + isSpreadElement, + isStatement, + isStatementWithLocals, + isStatic, + isString, + isStringANonContextualKeyword, + isStringLiteral, + isStringLiteralLike, + isStringOrNumericLiteralLike, + isSuperCall, + isSuperProperty, + isTaggedTemplateExpression, + isTemplateSpan, + isThisContainerOrFunctionBlock, + isThisIdentifier, + isThisInitializedDeclaration, + isThisInitializedObjectBindingExpression, + isThisInTypeQuery, + isThisProperty, + isThisTypeParameter, + isTransientSymbol, + isTupleTypeNode, + isTypeAlias, + isTypeAliasDeclaration, + isTypeDeclaration, + isTypeLiteralNode, + isTypeNode, + isTypeNodeKind, + isTypeOfExpression, + isTypeOnlyImportOrExportDeclaration, + isTypeOperatorNode, + isTypeParameterDeclaration, + isTypePredicateNode, + isTypeQueryNode, + isTypeReferenceNode, + isTypeReferenceType, + isUMDExportSymbol, + isValidESSymbolDeclaration, + isValidTypeOnlyAliasUseSite, + isValueSignatureDeclaration, + isVarConst, + isVariableDeclaration, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableDeclarationInVariableStatement, + isVariableDeclarationList, + isVariableLike, + isVariableLikeOrAccessor, + isVariableStatement, + isWriteAccess, + isWriteOnlyAccess, + IterableOrIteratorType, + IterationTypes, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocContainer, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNullableType, + JSDocOptionalType, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocSignature, + JSDocTemplateTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeReferencingNode, + JSDocTypeTag, + JSDocVariadicType, + JsxAttribute, + JsxAttributeLike, + JsxAttributes, + JsxChild, + JsxClosingElement, + JsxElement, + JsxEmit, + JsxExpression, + JsxFlags, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxReferenceKind, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + KeywordTypeNode, + LabeledStatement, + last, + lastOrUndefined, + LateBoundBinaryExpressionDeclaration, + LateBoundDeclaration, + LateBoundName, + LateVisibilityPaintedStatement, + LeftHandSideExpression, + length, + LiteralExpression, + LiteralType, + LiteralTypeNode, + mangleScopedPackageName, + map, + mapDefined, + MappedSymbol, + MappedType, + MappedTypeNode, + MatchingKeys, + maybeBind, + MemberName, + MemberOverrideStatus, + memoize, + MetaProperty, + MethodDeclaration, + MethodSignature, + minAndMax, + MinusToken, + Modifier, + ModifierFlags, + modifiersToFlags, + modifierToFlag, + ModuleBlock, + ModuleDeclaration, + ModuleInstanceState, + ModuleKind, + ModuleResolutionKind, + NamedDeclaration, + NamedExports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceDeclaration, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + needsScopeMarker, + NewExpression, + Node, + NodeArray, + NodeBuilderFlags, + nodeCanBeDecorated, + NodeCheckFlags, + NodeFlags, + nodeHasName, + nodeIsDecorated, + nodeIsMissing, + nodeIsPresent, + nodeIsSynthesized, + NodeLinks, + nodeStartsNewLexicalEnvironment, + NodeWithTypeArguments, + NonNullChain, + NonNullExpression, + not, + noTruncationMaximumTruncationLength, + nullTransformationContext, + NumberLiteralType, + NumericLiteral, + objectAllocator, + ObjectBindingPattern, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ObjectType, + OptionalChain, + OptionalTypeNode, + or, + orderedRemoveItemAt, + OuterExpressionKinds, + outFile, + ParameterDeclaration, + parameterIsThisKeyword, + ParameterPropertyDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + parseIsolatedEntityName, + parseNodeFactory, + parsePseudoBigInt, + Path, + pathIsRelative, + PatternAmbientModule, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PromiseOrAwaitableType, + PropertyAccessChain, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + PseudoBigInt, + pseudoBigIntToString, + pushIfUnique, + QualifiedName, + QuestionToken, + rangeEquals, + rangeOfNode, + rangeOfTypeParameters, + ReadonlyKeyword, + reduceLeft, + RelationComparisonResult, + relativeComplement, + removeExtension, + removePrefix, + replaceElement, + resolutionExtensionIsTSOrJson, + ResolutionMode, + ResolvedModuleFull, + ResolvedType, + resolveTripleslashReference, + resolvingEmptyArray, + RestTypeNode, + ReturnStatement, + ReverseMappedSymbol, + ReverseMappedType, + sameMap, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + setCommentRange, + setEmitFlags, + setNodeFlags, + setOriginalNode, + setParent, + setSyntheticLeadingComments, + setTextRange, + setTextRangePosEnd, + setValueDeclaration, + ShorthandPropertyAssignment, + shouldPreserveConstEnums, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + singleElementArray, + skipOuterExpressions, + skipParentheses, + skipTrivia, + skipTypeChecking, + some, + SourceFile, + SpreadAssignment, + SpreadElement, + startsWith, + Statement, + stringContains, + StringLiteral, + StringLiteralLike, + StringLiteralType, + StringMappingType, + stripQuotes, + StructuredType, + SubstitutionType, + sum, + SuperCall, + SwitchStatement, + Symbol, + SymbolAccessibility, + SymbolAccessibilityResult, + SymbolFlags, + SymbolFormatFlags, + SymbolId, + SymbolLinks, + symbolName, + SymbolTable, + SymbolTracker, + SymbolVisibilityResult, + SyntaxKind, + SyntheticDefaultModuleType, + SyntheticExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralType, + TemplateLiteralTypeNode, + Ternary, + textRangeContainsPositionInclusive, + TextSpan, + textSpanContainsPosition, + textSpanEnd, + ThisExpression, + ThisTypeNode, + ThrowStatement, + TokenFlags, + tokenToString, + tracing, + TracingNode, + TransientSymbol, + tryAddToSet, + tryCast, + tryExtractTSExtension, + tryGetClassImplementingOrExtendingExpressionWithTypeArguments, + 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 a9e808dadee17..b62fb3b638ff1 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,24 +1,123 @@ 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, directorySeparator, emptyArray, - endsWith, ensureTrailingDirectorySeparator, every, Expression, extend, Extension, FileExtensionInfo, - fileExtensionIs, fileExtensionIsOneOf, filter, filterMutate, find, findIndex, firstDefined, flatten, forEach, - forEachEntry, getBaseFileName, getDirectoryPath, getEntries, getFileMatcherPatterns, getLocaleSpecificMessage, - getNormalizedAbsolutePath, getRegexFromPattern, getRegularExpressionForWildcard, getRegularExpressionsForWildcards, - getRelativePathFromFile, getSpellingSuggestion, getSupportedExtensions, - getSupportedExtensionsWithJsonIfResolveJsonModule, getTextOfPropertyName, getTsConfigPropArray, - getTsConfigPropArrayElementValue, hasExtension, hasProperty, ImportsNotUsedAsValues, isArray, - isArrayLiteralExpression, isComputedNonLiteralName, isImplicitGlob, isObjectLiteralExpression, isRootedDiskPath, - isString, isStringDoubleQuoted, isStringLiteral, JsonSourceFile, JsxEmit, length, map, mapDefined, mapIterator, - MapLike, ModuleDetectionKind, ModuleKind, ModuleResolutionKind, NewLineKind, Node, NodeArray, - nodeModuleNameResolver, normalizePath, normalizeSlashes, NumericLiteral, ObjectLiteralExpression, ParseConfigHost, - ParsedCommandLine, parseJsonText, Path, PollingWatchKind, PrefixUnaryExpression, ProjectReference, PropertyName, - Push, removeTrailingDirectorySeparator, returnTrue, ScriptTarget, startsWith, StringLiteral, SyntaxKind, sys, - toFileNameLowerCase, toPath, tracing, trimString, TsConfigOnlyOption, TsConfigSourceFile, TypeAcquisition, - unescapeLeadingUnderscores, WatchDirectoryFlags, WatchDirectoryKind, WatchFileKind, WatchOptions, + 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, + directorySeparator, + emptyArray, + endsWith, + ensureTrailingDirectorySeparator, + every, + Expression, + extend, + Extension, + FileExtensionInfo, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + filterMutate, + find, + findIndex, + firstDefined, + flatten, + forEach, + forEachEntry, + getBaseFileName, + getDirectoryPath, + getEntries, + getFileMatcherPatterns, + getLocaleSpecificMessage, + getNormalizedAbsolutePath, + getRegexFromPattern, + getRegularExpressionForWildcard, + getRegularExpressionsForWildcards, + getRelativePathFromFile, + getSpellingSuggestion, + getSupportedExtensions, + getSupportedExtensionsWithJsonIfResolveJsonModule, + getTextOfPropertyName, + getTsConfigPropArray, + getTsConfigPropArrayElementValue, + hasExtension, + hasProperty, + ImportsNotUsedAsValues, + isArray, + isArrayLiteralExpression, + isComputedNonLiteralName, + isImplicitGlob, + isObjectLiteralExpression, + isRootedDiskPath, + isString, + isStringDoubleQuoted, + isStringLiteral, + JsonSourceFile, + JsxEmit, + length, + map, + mapDefined, + mapIterator, + MapLike, + ModuleDetectionKind, + ModuleKind, + ModuleResolutionKind, + NewLineKind, + Node, + NodeArray, + nodeModuleNameResolver, + normalizePath, + normalizeSlashes, + NumericLiteral, + ObjectLiteralExpression, + ParseConfigHost, + ParsedCommandLine, + parseJsonText, + Path, + PollingWatchKind, + PrefixUnaryExpression, + ProjectReference, + PropertyName, + Push, + removeTrailingDirectorySeparator, + returnTrue, + ScriptTarget, + startsWith, + StringLiteral, + SyntaxKind, + sys, + toFileNameLowerCase, + toPath, + tracing, + trimString, + TsConfigOnlyOption, + TsConfigSourceFile, + TypeAcquisition, + unescapeLeadingUnderscores, + WatchDirectoryFlags, + WatchDirectoryKind, + WatchFileKind, + WatchOptions, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 73f6076a21bda..3961e094cde6b 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,6 +1,17 @@ import { - __String, CharacterCodes, Comparer, Comparison, Debug, EqualityComparer, isWhiteSpaceLike, - MapLike, Push, Queue, SortedArray, SortedReadonlyArray, TextSpan, + __String, + CharacterCodes, + Comparer, + Comparison, + Debug, + EqualityComparer, + isWhiteSpaceLike, + MapLike, + Push, + Queue, + SortedArray, + SortedReadonlyArray, + TextSpan, UnderscoreEscapedMap, } from "./_namespaces/ts"; diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index f649a246c9424..9bd8471f531b5 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -1,19 +1,95 @@ import * as ts from "./_namespaces/ts"; import { - AnyFunction, AssertionLevel, BigIntLiteralType, CheckMode, compareValues, EmitFlags, every, FlowFlags, FlowLabel, FlowNode, - FlowNodeBase, FlowSwitchClause, getEffectiveModifierFlagsNoCache, getEmitFlags, getOwnKeys, - getParseTreeNode, getSourceFileOfNode, getSourceTextOfNodeFromSourceFile, hasProperty, idText, IntrinsicType, - isArrayTypeNode, isBigIntLiteral, isCallSignatureDeclaration, isConditionalTypeNode, isConstructorDeclaration, - isConstructorTypeNode, isConstructSignatureDeclaration, isDefaultClause, isFunctionTypeNode, isGeneratedIdentifier, - isGetAccessorDeclaration, isIdentifier, isImportTypeNode, isIndexedAccessTypeNode, isIndexSignatureDeclaration, - isInferTypeNode, isIntersectionTypeNode, isLiteralTypeNode, isMappedTypeNode, isNamedTupleMember, isNumericLiteral, - isOptionalTypeNode, isParameter, isParenthesizedTypeNode, isParseTreeNode, isPrivateIdentifier, isRestTypeNode, - isSetAccessorDeclaration, isStringLiteral, isThisTypeNode, isTupleTypeNode, isTypeLiteralNode, isTypeOperatorNode, - isTypeParameterDeclaration, isTypePredicateNode, 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, + AnyFunction, + AssertionLevel, + BigIntLiteralType, + CheckMode, + compareValues, + EmitFlags, + every, + FlowFlags, + FlowLabel, + FlowNode, + FlowNodeBase, + FlowSwitchClause, + getEffectiveModifierFlagsNoCache, + getEmitFlags, + getOwnKeys, + getParseTreeNode, + getSourceFileOfNode, + getSourceTextOfNodeFromSourceFile, + hasProperty, + idText, + IntrinsicType, + isArrayTypeNode, + isBigIntLiteral, + isCallSignatureDeclaration, + isConditionalTypeNode, + isConstructorDeclaration, + isConstructorTypeNode, + isConstructSignatureDeclaration, + isDefaultClause, + isFunctionTypeNode, + isGeneratedIdentifier, + isGetAccessorDeclaration, + isIdentifier, + isImportTypeNode, + isIndexedAccessTypeNode, + isIndexSignatureDeclaration, + isInferTypeNode, + isIntersectionTypeNode, + isLiteralTypeNode, + isMappedTypeNode, + isNamedTupleMember, + isNumericLiteral, + isOptionalTypeNode, + isParameter, + isParenthesizedTypeNode, + isParseTreeNode, + isPrivateIdentifier, + isRestTypeNode, + isSetAccessorDeclaration, + isStringLiteral, + isThisTypeNode, + isTupleTypeNode, + isTypeLiteralNode, + isTypeOperatorNode, + isTypeParameterDeclaration, + isTypePredicateNode, + 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 ebc9bcaec9917..c438fab6ced3d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1,83 +1,447 @@ import * as ts from "./_namespaces/ts"; import { - AccessorDeclaration, ArrayBindingPattern, ArrayLiteralExpression, arrayToMap, ArrayTypeNode, ArrowFunction, - AsExpression, AssertClause, AssertEntry, AwaitExpression, base64encode, BigIntLiteral, BinaryExpression, - BinaryOperatorToken, BindingElement, BindingPattern, Block, BlockLike, BreakStatement, BuildInfo, Bundle, - BundleBuildInfo, BundleFileInfo, BundleFileSectionKind, BundleFileTextLike, BundleFileTextLikeKind, CallExpression, - CallSignatureDeclaration, 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, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, contains, ContinueStatement, createBinaryExpressionTrampoline, - createDiagnosticCollection, createGetCanonicalFileName, createInputFilesWithFileTexts, createMultiMap, - createPrependNodes, createSourceMapGenerator, createTextWriter, CustomTransformers, Debug, DebuggerStatement, - DeclarationName, 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, Expression, ExpressionStatement, ExpressionWithTypeArguments, - Extension, ExternalModuleReference, factory, fileExtensionIs, fileExtensionIsOneOf, FileReference, filter, - findIndex, firstOrUndefined, forEach, forEachChild, forEachLeadingCommentRange, forEachTrailingCommentRange, - ForInOrOfStatement, ForInStatement, formatGeneratedName, formatGeneratedNamePart, ForOfStatement, ForStatement, - FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, FunctionTypeNode, GeneratedIdentifier, - GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, getAreDeclarationMapsEnabled, - getBaseFileName, GetCanonicalFileName, getCommentRange, getConstantValue, getContainingNodeArray, - getDeclarationEmitExtensionForPath, getDeclarationEmitOutputFilePath, getDirectoryPath, getEmitDeclarations, - getEmitFlags, getEmitHelpers, getEmitModuleKind, getExternalHelpersModuleName, getExternalModuleName, - getLeadingCommentRanges, getLineAndCharacterOfPosition, getLinesBetweenPositionAndNextNonWhitespaceCharacter, - getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, getLinesBetweenRangeEndAndRangeStart, getLineStarts, - getLiteralText, GetLiteralTextFlags, getNewLineCharacter, getNodeForGeneratedName, getNodeId, - getNormalizedAbsolutePath, getOriginalNode, getOwnEmitOutputFilePath, getParseTreeNode, - getRelativePathFromDirectory, getRelativePathToDirectoryOrUrl, getRootLength, getShebang, getSnippetElement, - getSourceFileOfNode, getSourceFilePathInNewDir, getSourceFilesToEmit, getSourceMapRange, - getSourceTextOfNodeFromSourceFile, getStartsOnNewLine, getSyntheticLeadingComments, getSyntheticTrailingComments, - getTextOfJSDocComment, getTrailingCommentRanges, getTrailingSemicolonDeferringWriter, getTransformers, getTypeNode, - guessIndentation, hasRecordedExternalHelpers, HeritageClause, Identifier, idText, IfStatement, ImportClause, - ImportDeclaration, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, - isAccessExpression, isArray, isArrowFunction, isBinaryExpression, isBindingPattern, isBlock, isBundle, - isBundleFileTextLike, isDeclaration, isDeclarationFileName, isDecorator, isEmptyStatement, isExportAssignment, - isExportSpecifier, isExpression, isFunctionLike, isGeneratedIdentifier, isGeneratedPrivateIdentifier, isIdentifier, - isIncrementalCompilation, isInJsonFile, isInternalDeclaration, isJSDocLikeText, isJsonSourceFile, - isJsxClosingElement, isJsxOpeningElement, isKeyword, isLet, isLiteralExpression, isMemberName, isModifier, - isModuleDeclaration, isNodeDescendantOf, isNumericLiteral, isParenthesizedExpression, isPartiallyEmittedExpression, - isPinnedComment, isPrivateIdentifier, isPrologueDirective, isRecognizedTripleSlashComment, isSourceFile, - isSourceFileNotJson, isStringLiteral, isTemplateLiteralKind, isTokenKind, isTypeParameterDeclaration, - isUnparsedNode, isUnparsedPrepend, isUnparsedSource, isVarConst, isVariableStatement, JSDoc, JSDocAugmentsTag, - JSDocCallbackTag, JSDocComment, JSDocEnumTag, JSDocFunctionType, JSDocImplementsTag, JSDocNameReference, - JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocPropertyLikeTag, JSDocReturnTag, JSDocSeeTag, - JSDocSignature, JSDocTag, JSDocTemplateTag, JSDocThisTag, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, - JSDocTypeTag, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, - JsxEmit, JsxExpression, JsxFragment, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, - JsxSpreadAttribute, JsxTagNameExpression, JsxText, LabeledStatement, last, lastOrUndefined, LateBoundDeclaration, - length, ListFormat, LiteralExpression, LiteralLikeNode, LiteralTypeNode, makeIdentifierFromModuleName, - MappedTypeNode, maybeBind, memoize, MetaProperty, MethodDeclaration, MethodSignature, Modifier, ModifierLike, - ModuleBlock, ModuleDeclaration, ModuleKind, ModuleReference, NamedDeclaration, NamedExports, NamedImports, - NamedImportsOrExports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, - NewExpression, Node, NodeArray, NodeFlags, nodeIsSynthesized, noEmitNotification, noEmitSubstitution, - NonNullExpression, normalizePath, normalizeSlashes, notImplemented, NumericLiteral, ObjectBindingPattern, - ObjectLiteralExpression, OptionalTypeNode, outFile, OutputFile, ParameterDeclaration, ParenthesizedExpression, - ParenthesizedTypeNode, ParsedCommandLine, PartiallyEmittedExpression, Placeholder, positionIsSynthesized, - positionsAreOnSameLine, PostfixUnaryExpression, PrefixUnaryExpression, Printer, PrinterOptions, PrintHandlers, - PrivateIdentifier, ProgramBuildInfo, ProgramBundleEmitBuildInfo, ProjectReference, PropertyAccessExpression, - PropertyAssignment, PropertyDeclaration, PropertySignature, QualifiedName, rangeEndIsOnSameLineAsRangeStart, - rangeEndPositionsAreOnSameLine, rangeIsOnSingleLine, 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, SourceMapEmitResult, SourceMapGenerator, SourceMapSource, - SpreadAssignment, SpreadElement, stableSort, Statement, stringContains, StringLiteral, supportedJSExtensionsFlat, - SwitchStatement, Symbol, SymbolFlags, SyntaxKind, SynthesizedComment, sys, TabStop, TaggedTemplateExpression, - TemplateExpression, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, TextRange, ThrowStatement, - tokenToString, tracing, TransformationResult, transformNodes, tryParseRawSourceMap, TryStatement, TupleTypeNode, - TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeNode, TypeOfExpression, TypeOperatorNode, - TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, UnparsedNode, - UnparsedPrepend, UnparsedPrologue, UnparsedSource, UnparsedSyntheticReference, UnparsedTextLike, - VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, - writeCommentRange, writeFile, WriteFileCallbackData, YieldExpression, + AccessorDeclaration, + ArrayBindingPattern, + ArrayLiteralExpression, + arrayToMap, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AwaitExpression, + base64encode, + BigIntLiteral, + BinaryExpression, + BinaryOperatorToken, + BindingElement, + BindingPattern, + Block, + BlockLike, + BreakStatement, + BuildInfo, + Bundle, + BundleBuildInfo, + BundleFileInfo, + BundleFileSectionKind, + BundleFileTextLike, + BundleFileTextLikeKind, + CallExpression, + CallSignatureDeclaration, + 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, + ConstructorDeclaration, + ConstructorTypeNode, + ConstructSignatureDeclaration, + contains, + ContinueStatement, + createBinaryExpressionTrampoline, + createDiagnosticCollection, + createGetCanonicalFileName, + createInputFilesWithFileTexts, + createMultiMap, + createPrependNodes, + createSourceMapGenerator, + createTextWriter, + CustomTransformers, + Debug, + DebuggerStatement, + DeclarationName, + 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, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalModuleReference, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + FileReference, + filter, + findIndex, + firstOrUndefined, + forEach, + forEachChild, + forEachLeadingCommentRange, + forEachTrailingCommentRange, + ForInOrOfStatement, + ForInStatement, + formatGeneratedName, + formatGeneratedNamePart, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + FunctionTypeNode, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedNamePart, + GeneratedPrivateIdentifier, + getAreDeclarationMapsEnabled, + getBaseFileName, + GetCanonicalFileName, + getCommentRange, + getConstantValue, + getContainingNodeArray, + getDeclarationEmitExtensionForPath, + getDeclarationEmitOutputFilePath, + getDirectoryPath, + getEmitDeclarations, + getEmitFlags, + getEmitHelpers, + getEmitModuleKind, + getExternalHelpersModuleName, + getExternalModuleName, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLinesBetweenPositionAndNextNonWhitespaceCharacter, + getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, + getLinesBetweenRangeEndAndRangeStart, + getLineStarts, + getLiteralText, + GetLiteralTextFlags, + getNewLineCharacter, + getNodeForGeneratedName, + getNodeId, + getNormalizedAbsolutePath, + getOriginalNode, + getOwnEmitOutputFilePath, + getParseTreeNode, + getRelativePathFromDirectory, + getRelativePathToDirectoryOrUrl, + getRootLength, + getShebang, + getSnippetElement, + getSourceFileOfNode, + getSourceFilePathInNewDir, + getSourceFilesToEmit, + getSourceMapRange, + getSourceTextOfNodeFromSourceFile, + getStartsOnNewLine, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTextOfJSDocComment, + getTrailingCommentRanges, + getTrailingSemicolonDeferringWriter, + getTransformers, + getTypeNode, + guessIndentation, + hasRecordedExternalHelpers, + HeritageClause, + Identifier, + idText, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IndexedAccessTypeNode, + IndexSignatureDeclaration, + InferTypeNode, + InterfaceDeclaration, + IntersectionTypeNode, + isAccessExpression, + isArray, + isArrowFunction, + isBinaryExpression, + isBindingPattern, + isBlock, + isBundle, + isBundleFileTextLike, + isDeclaration, + isDeclarationFileName, + isDecorator, + isEmptyStatement, + isExportAssignment, + isExportSpecifier, + isExpression, + isFunctionLike, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isIdentifier, + isIncrementalCompilation, + isInJsonFile, + isInternalDeclaration, + isJSDocLikeText, + isJsonSourceFile, + isJsxClosingElement, + isJsxOpeningElement, + isKeyword, + isLet, + isLiteralExpression, + isMemberName, + isModifier, + isModuleDeclaration, + isNodeDescendantOf, + isNumericLiteral, + isParenthesizedExpression, + isPartiallyEmittedExpression, + isPinnedComment, + isPrivateIdentifier, + isPrologueDirective, + isRecognizedTripleSlashComment, + isSourceFile, + isSourceFileNotJson, + isStringLiteral, + isTemplateLiteralKind, + isTokenKind, + isTypeParameterDeclaration, + isUnparsedNode, + isUnparsedPrepend, + isUnparsedSource, + isVarConst, + isVariableStatement, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocNameReference, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocPropertyLikeTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocVariadicType, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxEmit, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxText, + LabeledStatement, + last, + lastOrUndefined, + LateBoundDeclaration, + length, + ListFormat, + LiteralExpression, + LiteralLikeNode, + LiteralTypeNode, + makeIdentifierFromModuleName, + MappedTypeNode, + maybeBind, + memoize, + MetaProperty, + MethodDeclaration, + MethodSignature, + Modifier, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleReference, + NamedDeclaration, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFlags, + nodeIsSynthesized, + noEmitNotification, + noEmitSubstitution, + NonNullExpression, + normalizePath, + normalizeSlashes, + notImplemented, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralExpression, + OptionalTypeNode, + outFile, + OutputFile, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + ParsedCommandLine, + PartiallyEmittedExpression, + Placeholder, + positionIsSynthesized, + positionsAreOnSameLine, + PostfixUnaryExpression, + PrefixUnaryExpression, + Printer, + PrinterOptions, + PrintHandlers, + PrivateIdentifier, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProjectReference, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + QualifiedName, + rangeEndIsOnSameLineAsRangeStart, + rangeEndPositionsAreOnSameLine, + rangeIsOnSingleLine, + 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, + SourceMapEmitResult, + SourceMapGenerator, + SourceMapSource, + SpreadAssignment, + SpreadElement, + stableSort, + Statement, + stringContains, + StringLiteral, + supportedJSExtensionsFlat, + SwitchStatement, + Symbol, + SymbolFlags, + SyntaxKind, + SynthesizedComment, + sys, + TabStop, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateSpan, + TextRange, + ThrowStatement, + tokenToString, + tracing, + TransformationResult, + transformNodes, + tryParseRawSourceMap, + TryStatement, + TupleTypeNode, + TypeAliasDeclaration, + TypeAssertion, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionTypeNode, + UnparsedNode, + UnparsedPrepend, + UnparsedPrologue, + UnparsedSource, + UnparsedSyntheticReference, + UnparsedTextLike, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VoidExpression, + WhileStatement, + WithStatement, + writeCommentRange, + writeFile, + WriteFileCallbackData, + YieldExpression, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/factory/baseNodeFactory.ts b/src/compiler/factory/baseNodeFactory.ts index 39b9490fba770..019d3b9e27477 100644 --- a/src/compiler/factory/baseNodeFactory.ts +++ b/src/compiler/factory/baseNodeFactory.ts @@ -1,4 +1,8 @@ -import { Node, objectAllocator, SyntaxKind } from "../_namespaces/ts"; +import { + Node, + objectAllocator, + SyntaxKind, +} from "../_namespaces/ts"; /** * A `BaseNodeFactory` is an abstraction over an `ObjectAllocator` that handles caching `Node` constructors diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index dc60dae44814b..faa93c77be83a 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -1,10 +1,37 @@ import { - __String, ArrayLiteralExpression, arrayToMap, BindingOrAssignmentElement, Block, compareValues, Comparison, - createExpressionFromEntityName, Debug, EmitFlags, EmitHelper, EmitHelperUniqueNameCallback, EmitNode, EntityName, - Expression, FunctionExpression, GeneratedIdentifierFlags, getEmitFlags, getEmitScriptTarget, - getPropertyNameOfBindingOrAssignmentElement, Identifier, isCallExpression, isComputedPropertyName, isIdentifier, - memoize, PrivateIdentifierKind, ScriptTarget, setEmitFlags, setTextRange, SyntaxKind, TextRange, - TransformationContext, UnscopedEmitHelper, + __String, + ArrayLiteralExpression, + arrayToMap, + BindingOrAssignmentElement, + Block, + compareValues, + Comparison, + createExpressionFromEntityName, + Debug, + EmitFlags, + EmitHelper, + EmitHelperUniqueNameCallback, + EmitNode, + EntityName, + Expression, + FunctionExpression, + GeneratedIdentifierFlags, + 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 693094489a67e..1fa3027f660b4 100644 --- a/src/compiler/factory/emitNode.ts +++ b/src/compiler/factory/emitNode.ts @@ -1,7 +1,24 @@ import { - AccessExpression, append, appendIfUnique, Debug, EmitFlags, EmitHelper, EmitNode, getParseTreeNode, - getSourceFileOfNode, isParseTreeNode, Node, orderedRemoveItem, SnippetElement, some, SourceFile, SourceMapRange, - SyntaxKind, SynthesizedComment, TextRange, TypeNode, + AccessExpression, + append, + appendIfUnique, + Debug, + EmitFlags, + EmitHelper, + EmitNode, + getParseTreeNode, + getSourceFileOfNode, + isParseTreeNode, + Node, + orderedRemoveItem, + SnippetElement, + some, + SourceFile, + SourceMapRange, + SyntaxKind, + SynthesizedComment, + TextRange, + TypeNode, } from "../_namespaces/ts"; /** diff --git a/src/compiler/factory/nodeConverters.ts b/src/compiler/factory/nodeConverters.ts index 74cddf31527b5..e506391a78b78 100644 --- a/src/compiler/factory/nodeConverters.ts +++ b/src/compiler/factory/nodeConverters.ts @@ -1,10 +1,36 @@ import { - ArrayBindingOrAssignmentElement, ArrayBindingOrAssignmentPattern, AssignmentPattern, - BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, Block, cast, ConciseBody, Debug, Expression, - FunctionDeclaration, getStartsOnNewLine, isArrayBindingPattern, isArrayLiteralExpression, isBindingElement, - isBindingPattern, isBlock, isExpression, isIdentifier, isObjectBindingPattern, isObjectLiteralElementLike, - isObjectLiteralExpression, map, NodeConverters, NodeFactory, notImplemented, ObjectBindingOrAssignmentElement, - ObjectBindingOrAssignmentPattern, setOriginalNode, setStartsOnNewLine, setTextRange, SyntaxKind, + ArrayBindingOrAssignmentElement, + ArrayBindingOrAssignmentPattern, + AssignmentPattern, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + Block, + cast, + ConciseBody, + Debug, + Expression, + FunctionDeclaration, + getStartsOnNewLine, + isArrayBindingPattern, + isArrayLiteralExpression, + isBindingElement, + isBindingPattern, + isBlock, + isExpression, + isIdentifier, + isObjectBindingPattern, + 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 afa240bd0b392..4e872d7babb73 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1,83 +1,471 @@ import { - addRange, append, appendIfUnique, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, ArrayTypeNode, - ArrowFunction, AsExpression, AssertClause, AssertEntry, AssertionKey, AssertsKeyword, AssignmentPattern, - AsteriskToken, AwaitExpression, AwaitKeyword, BaseNodeFactory, BigIntLiteral, BinaryExpression, BinaryOperator, - BinaryOperatorToken, BindingElement, BindingName, BindingPattern, Block, BooleanLiteral, BreakStatement, BuildInfo, - Bundle, BundleFileHasNoDefaultLib, BundleFileInfo, BundleFileReference, BundleFileSectionKind, CallBinding, - CallChain, CallExpression, CallSignatureDeclaration, canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, - cast, CatchClause, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, - ClassStaticBlockDeclaration, ColonToken, CommaListExpression, CompilerHost, CompilerOptions, ComputedPropertyName, - ConciseBody, ConditionalExpression, ConditionalTypeNode, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, ContinueStatement, createBaseNodeFactory, createNodeConverters, - createParenthesizerRules, createScanner, Debug, DebuggerStatement, Declaration, DeclarationName, Decorator, - DefaultClause, DeleteExpression, DoStatement, DotDotDotToken, ElementAccessChain, ElementAccessExpression, - EmitFlags, EmitNode, emptyArray, EmptyStatement, EndOfDeclarationMarker, EndOfFileToken, EntityName, - EnumDeclaration, EnumMember, EqualsGreaterThanToken, escapeLeadingUnderscores, every, ExclamationToken, - ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, ExpressionWithTypeArguments, - ExternalModuleReference, FalseLiteral, FileReference, findUseStrictPrologue, forEach, ForInitializer, - ForInStatement, formatGeneratedName, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, - FunctionLikeDeclaration, FunctionTypeNode, GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedNamePart, - GetAccessorDeclaration, getAllUnscopedEmitHelpers, getBuildInfo, getCommentRange, - getElementsOfBindingOrAssignmentPattern, getEmitFlags, getJSDocTypeAliasName, getLineAndCharacterOfPosition, - getNameOfDeclaration, getNodeId, getSourceMapRange, getSyntheticLeadingComments, getSyntheticTrailingComments, - getTargetOfBindingOrAssignmentElement, getTextOfIdentifierOrLiteral, hasInvalidEscape, HasModifiers, hasProperty, - hasStaticModifier, hasSyntacticModifier, HeritageClause, Identifier, idText, IfStatement, ImportClause, - ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, InputFiles, InterfaceDeclaration, - IntersectionTypeNode, isArray, isArrayLiteralExpression, isArrowFunction, isAssignmentPattern, isBinaryExpression, - isCallChain, isClassDeclaration, isClassExpression, isCommaListExpression, isCommaToken, isComputedPropertyName, - isConstructorDeclaration, isConstructorTypeNode, isCustomPrologue, isElementAccessChain, isElementAccessExpression, - isEnumDeclaration, isExclamationToken, isExportAssignment, isExportDeclaration, isExternalModuleReference, - isFunctionDeclaration, isFunctionExpression, isGeneratedIdentifier, isGetAccessorDeclaration, isHoistedFunction, - isHoistedVariableStatement, isIdentifier, isImportDeclaration, isImportEqualsDeclaration, isImportKeyword, - isIndexSignatureDeclaration, isInterfaceDeclaration, isLabeledStatement, isLocalName, - isLogicalOrCoalescingAssignmentOperator, isMemberName, isMethodDeclaration, isMethodSignature, isModuleDeclaration, - isNamedDeclaration, isNodeArray, isNodeKind, isNonNullChain, isNotEmittedStatement, isObjectLiteralExpression, - isOmittedExpression, isOuterExpression, isParameter, isParenthesizedExpression, isParseTreeNode, - isPrivateIdentifier, isPrologueDirective, isPropertyAccessChain, isPropertyAccessExpression, isPropertyDeclaration, - isPropertyName, isPropertySignature, isQuestionToken, isSetAccessorDeclaration, isSourceFile, isStatement, - isStatementOrBlock, isString, isStringLiteral, isSuperKeyword, isSuperProperty, isThisIdentifier, - isTypeAliasDeclaration, isTypeParameterDeclaration, isVariableDeclaration, isVariableStatement, JSDoc, JSDocAllType, - JSDocAugmentsTag, JSDocAuthorTag, JSDocCallbackTag, JSDocClassTag, JSDocComment, JSDocDeprecatedTag, JSDocEnumTag, - JSDocFunctionType, JSDocImplementsTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, JSDocNamepathType, - JSDocNameReference, JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, - JSDocOverrideTag, JSDocParameterTag, JSDocPrivateTag, JSDocPropertyLikeTag, JSDocPropertyTag, JSDocProtectedTag, - JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSeeTag, JSDocSignature, JSDocTag, JSDocTemplateTag, - JSDocText, JSDocThisTag, JSDocType, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, - JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, JsxAttribute, JsxAttributeLike, JsxAttributes, - JsxAttributeValue, JsxChild, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, - JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, JsxTagNameExpression, JsxText, - KeywordSyntaxKind, KeywordToken, KeywordTypeNode, KeywordTypeSyntaxKind, LabeledStatement, LanguageVariant, - lastOrUndefined, LeftHandSideExpression, LiteralToken, LiteralTypeNode, map, MappedTypeNode, - memoize, memoizeOne, MergeDeclarationMarker, MetaProperty, MethodDeclaration, MethodSignature, MinusToken, - MissingDeclaration, Modifier, ModifierFlags, ModifierLike, modifiersToFlags, ModifierSyntaxKind, ModifierToken, - ModuleBlock, ModuleBody, ModuleDeclaration, ModuleKind, ModuleName, ModuleReference, Mutable, MutableNodeArray, - NamedDeclaration, NamedExportBindings, NamedExports, NamedImportBindings, NamedImports, NamedTupleMember, - NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, Node, NodeArray, NodeFactory, - NodeFlags, nodeIsSynthesized, NonNullChain, NonNullExpression, NoSubstitutionTemplateLiteral, NotEmittedStatement, - NullLiteral, nullNodeConverters, nullParenthesizerRules, NumericLiteral, objectAllocator, ObjectBindingPattern, - ObjectLiteralElementLike, ObjectLiteralExpression, OmittedExpression, OptionalTypeNode, OuterExpression, - OuterExpressionKinds, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, parseNodeFactory, - PartiallyEmittedExpression, PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, PrefixUnaryExpression, - PrefixUnaryOperator, PrimaryExpression, PrivateIdentifier, PrologueDirective, PropertyAccessChain, - PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyDescriptorAttributes, PropertyName, - PropertyNameLiteral, PropertySignature, PseudoBigInt, pseudoBigIntToString, PunctuationSyntaxKind, PunctuationToken, - Push, QualifiedName, QuestionDotToken, QuestionToken, ReadonlyKeyword, reduceLeft, RegularExpressionLiteral, - RestTypeNode, ReturnStatement, returnTrue, sameFlatMap, SatisfiesExpression, Scanner, ScriptTarget, - SemicolonClassElement, SetAccessorDeclaration, setEachParent, setEmitFlags, setParent, setTextRange, - setTextRangePosEnd, setTextRangePosWidth, ShorthandPropertyAssignment, SignatureDeclarationBase, singleOrUndefined, - skipOuterExpressions, skipParentheses, some, SourceFile, SourceMapSource, SpreadAssignment, SpreadElement, - startOnNewLine, startsWith, Statement, StringLiteral, StringLiteralLike, stringToToken, SuperExpression, - SwitchStatement, SyntaxKind, SyntaxList, SyntheticExpression, SyntheticReferenceExpression, - TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteral, TemplateLiteralLikeNode, - TemplateLiteralToken, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateMiddle, TemplateSpan, TemplateTail, - TextRange, ThisExpression, ThisTypeNode, ThrowStatement, Token, TokenFlags, TransformFlags, TrueLiteral, - TryStatement, TupleTypeNode, Type, TypeAliasDeclaration, TypeAssertion, TypeElement, TypeLiteralNode, TypeNode, - TypeOfExpression, TypeOfTag, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, - TypeReferenceNode, UnionOrIntersectionTypeNode, UnionTypeNode, UnparsedNode, UnparsedPrepend, UnparsedPrologue, - UnparsedSource, UnparsedSourceText, UnparsedSyntheticReference, UnparsedTextLike, UnscopedEmitHelper, - VariableDeclaration, VariableDeclarationList, VariableStatement, visitNode, VisitResult, VoidExpression, - WhileStatement, WithStatement, YieldExpression, + addRange, + append, + appendIfUnique, + ArrayBindingElement, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AssertionKey, + AssertsKeyword, + AssignmentPattern, + AsteriskToken, + AwaitExpression, + AwaitKeyword, + BaseNodeFactory, + BigIntLiteral, + BinaryExpression, + BinaryOperator, + BinaryOperatorToken, + BindingElement, + BindingName, + BindingPattern, + Block, + BooleanLiteral, + BreakStatement, + BuildInfo, + Bundle, + BundleFileHasNoDefaultLib, + BundleFileInfo, + BundleFileReference, + BundleFileSectionKind, + CallBinding, + CallChain, + CallExpression, + CallSignatureDeclaration, + canHaveModifiers, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + cast, + CatchClause, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + ColonToken, + CommaListExpression, + CompilerHost, + CompilerOptions, + ComputedPropertyName, + ConciseBody, + ConditionalExpression, + ConditionalTypeNode, + ConstructorDeclaration, + ConstructorTypeNode, + ConstructSignatureDeclaration, + ContinueStatement, + createBaseNodeFactory, + createNodeConverters, + createParenthesizerRules, + createScanner, + Debug, + DebuggerStatement, + Declaration, + DeclarationName, + Decorator, + DefaultClause, + DeleteExpression, + DoStatement, + DotDotDotToken, + ElementAccessChain, + ElementAccessExpression, + EmitFlags, + EmitNode, + emptyArray, + EmptyStatement, + EndOfDeclarationMarker, + EndOfFileToken, + EntityName, + EnumDeclaration, + EnumMember, + EqualsGreaterThanToken, + escapeLeadingUnderscores, + every, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + ExternalModuleReference, + FalseLiteral, + FileReference, + findUseStrictPrologue, + forEach, + ForInitializer, + ForInStatement, + formatGeneratedName, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + FunctionTypeNode, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedNamePart, + GetAccessorDeclaration, + getAllUnscopedEmitHelpers, + getBuildInfo, + getCommentRange, + getElementsOfBindingOrAssignmentPattern, + getEmitFlags, + getJSDocTypeAliasName, + getLineAndCharacterOfPosition, + getNameOfDeclaration, + getNodeId, + getSourceMapRange, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTargetOfBindingOrAssignmentElement, + getTextOfIdentifierOrLiteral, + hasInvalidEscape, + HasModifiers, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, + HeritageClause, + Identifier, + idText, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IndexedAccessTypeNode, + IndexSignatureDeclaration, + InferTypeNode, + InputFiles, + InterfaceDeclaration, + IntersectionTypeNode, + isArray, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentPattern, + isBinaryExpression, + isCallChain, + isClassDeclaration, + isClassExpression, + isCommaListExpression, + isCommaToken, + isComputedPropertyName, + isConstructorDeclaration, + isConstructorTypeNode, + isCustomPrologue, + isElementAccessChain, + isElementAccessExpression, + isEnumDeclaration, + isExclamationToken, + isExportAssignment, + isExportDeclaration, + isExternalModuleReference, + isFunctionDeclaration, + isFunctionExpression, + isGeneratedIdentifier, + isGetAccessorDeclaration, + isHoistedFunction, + isHoistedVariableStatement, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isLabeledStatement, + isLocalName, + isLogicalOrCoalescingAssignmentOperator, + isMemberName, + isMethodDeclaration, + isMethodSignature, + isModuleDeclaration, + isNamedDeclaration, + isNodeArray, + isNodeKind, + isNonNullChain, + isNotEmittedStatement, + isObjectLiteralExpression, + isOmittedExpression, + isOuterExpression, + isParameter, + isParenthesizedExpression, + isParseTreeNode, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAccessChain, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertyName, + isPropertySignature, + isQuestionToken, + isSetAccessorDeclaration, + isSourceFile, + isStatement, + isStatementOrBlock, + isString, + isStringLiteral, + isSuperKeyword, + isSuperProperty, + isThisIdentifier, + isTypeAliasDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, + isVariableStatement, + JSDoc, + JSDocAllType, + JSDocAugmentsTag, + JSDocAuthorTag, + JSDocCallbackTag, + JSDocClassTag, + JSDocComment, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNamepathType, + JSDocNameReference, + JSDocNamespaceDeclaration, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocText, + JSDocThisTag, + JSDocType, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocUnknownTag, + JSDocUnknownType, + JSDocVariadicType, + JsxAttribute, + JsxAttributeLike, + JsxAttributes, + JsxAttributeValue, + JsxChild, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxText, + KeywordSyntaxKind, + KeywordToken, + KeywordTypeNode, + KeywordTypeSyntaxKind, + LabeledStatement, + LanguageVariant, + lastOrUndefined, + LeftHandSideExpression, + LiteralToken, + LiteralTypeNode, + map, + MappedTypeNode, + memoize, + memoizeOne, + MergeDeclarationMarker, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + MissingDeclaration, + Modifier, + ModifierFlags, + ModifierLike, + modifiersToFlags, + ModifierSyntaxKind, + ModifierToken, + ModuleBlock, + ModuleBody, + ModuleDeclaration, + ModuleKind, + ModuleName, + ModuleReference, + Mutable, + MutableNodeArray, + NamedDeclaration, + NamedExportBindings, + NamedExports, + NamedImportBindings, + NamedImports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFactory, + NodeFlags, + nodeIsSynthesized, + NonNullChain, + NonNullExpression, + NoSubstitutionTemplateLiteral, + NotEmittedStatement, + NullLiteral, + nullNodeConverters, + nullParenthesizerRules, + NumericLiteral, + objectAllocator, + ObjectBindingPattern, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OmittedExpression, + OptionalTypeNode, + OuterExpression, + OuterExpressionKinds, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + parseNodeFactory, + PartiallyEmittedExpression, + PlusToken, + PostfixUnaryExpression, + PostfixUnaryOperator, + PrefixUnaryExpression, + PrefixUnaryOperator, + PrimaryExpression, + PrivateIdentifier, + PrologueDirective, + PropertyAccessChain, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyDescriptorAttributes, + PropertyName, + PropertyNameLiteral, + PropertySignature, + PseudoBigInt, + pseudoBigIntToString, + PunctuationSyntaxKind, + PunctuationToken, + Push, + QualifiedName, + QuestionDotToken, + QuestionToken, + ReadonlyKeyword, + reduceLeft, + RegularExpressionLiteral, + RestTypeNode, + ReturnStatement, + returnTrue, + sameFlatMap, + SatisfiesExpression, + Scanner, + ScriptTarget, + SemicolonClassElement, + SetAccessorDeclaration, + setEachParent, + setEmitFlags, + setParent, + setTextRange, + setTextRangePosEnd, + setTextRangePosWidth, + ShorthandPropertyAssignment, + SignatureDeclarationBase, + singleOrUndefined, + skipOuterExpressions, + skipParentheses, + some, + SourceFile, + SourceMapSource, + SpreadAssignment, + SpreadElement, + startOnNewLine, + startsWith, + Statement, + StringLiteral, + StringLiteralLike, + stringToToken, + SuperExpression, + SwitchStatement, + SyntaxKind, + SyntaxList, + SyntheticExpression, + SyntheticReferenceExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateHead, + TemplateLiteral, + TemplateLiteralLikeNode, + TemplateLiteralToken, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateMiddle, + TemplateSpan, + TemplateTail, + TextRange, + ThisExpression, + ThisTypeNode, + ThrowStatement, + Token, + TokenFlags, + TransformFlags, + TrueLiteral, + TryStatement, + TupleTypeNode, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeElement, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOfTag, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionOrIntersectionTypeNode, + UnionTypeNode, + UnparsedNode, + UnparsedPrepend, + UnparsedPrologue, + UnparsedSource, + UnparsedSourceText, + UnparsedSyntheticReference, + UnparsedTextLike, + UnscopedEmitHelper, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + visitNode, + VisitResult, + VoidExpression, + WhileStatement, + WithStatement, + YieldExpression, } from "../_namespaces/ts"; let nextAutoGenerateId = 0; diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index f391dbb1edb59..14e296610c54f 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -1,41 +1,226 @@ import { - AbstractKeyword, AccessorKeyword, ArrayBindingPattern, ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, - AsExpression, AssertClause, AssertEntry, AssertsKeyword, AsteriskToken, AsyncKeyword, AwaitExpression, AwaitKeyword, - BigIntLiteral, BinaryExpression, BindingElement, Block, BreakStatement, Bundle, CallExpression, - CallSignatureDeclaration, CaseBlock, CaseClause, CatchClause, ClassDeclaration, ClassExpression, - ClassStaticBlockDeclaration, ColonToken, CommaListExpression, ComputedPropertyName, ConditionalExpression, - ConditionalTypeNode, ConstructorDeclaration, ConstructorTypeNode, ConstructSignatureDeclaration, ContinueStatement, - DebuggerStatement, Decorator, DefaultClause, DeleteExpression, DoStatement, DotDotDotToken, ElementAccessExpression, - EmptyStatement, EndOfDeclarationMarker, EnumDeclaration, EnumMember, EqualsGreaterThanToken, ExclamationToken, - ExportAssignment, ExportDeclaration, ExportKeyword, ExportSpecifier, ExpressionStatement, - ExpressionWithTypeArguments, ExternalModuleReference, ForInStatement, ForOfStatement, ForStatement, - FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, - IfStatement, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportExpression, ImportSpecifier, - ImportTypeAssertionContainer, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, - InterfaceDeclaration, IntersectionTypeNode, JSDoc, JSDocAllType, JSDocAugmentsTag, JSDocAuthorTag, JSDocCallbackTag, - JSDocClassTag, JSDocDeprecatedTag, JSDocEnumTag, JSDocFunctionType, JSDocImplementsTag, JSDocLink, JSDocLinkCode, - JSDocLinkPlain, JSDocMemberName, JSDocNamepathType, JSDocNameReference, JSDocNonNullableType, JSDocNullableType, - JSDocOptionalType, JSDocOverrideTag, JSDocParameterTag, JSDocPrivateTag, JSDocPropertyTag, JSDocProtectedTag, - JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSeeTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, JSDocUnknownTag, JSDocUnknownType, - JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, - JsxFragment, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, JsxText, - LabeledStatement, LiteralTypeNode, MappedTypeNode, MergeDeclarationMarker, MetaProperty, MethodDeclaration, - MethodSignature, MinusToken, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, - NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, Node, - NonNullExpression, NoSubstitutionTemplateLiteral, NotEmittedStatement, NumericLiteral, ObjectBindingPattern, - ObjectLiteralExpression, OmittedExpression, OptionalTypeNode, OverrideKeyword, ParameterDeclaration, - ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PlusToken, PostfixUnaryExpression, - PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, - PropertySignature, QualifiedName, QuestionDotToken, QuestionToken, ReadonlyKeyword, RegularExpressionLiteral, - RestTypeNode, ReturnStatement, SatisfiesExpression, SemicolonClassElement, SetAccessorDeclaration, - ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, StaticKeyword, StringLiteral, - SuperExpression, SwitchStatement, SyntaxKind, SyntaxList, SyntheticExpression, SyntheticReferenceExpression, - TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, - TemplateMiddle, TemplateSpan, TemplateTail, ThisTypeNode, ThrowStatement, Token, TryStatement, TupleTypeNode, - TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, - TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, UnparsedPrepend, UnparsedSource, - VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, + AbstractKeyword, + AccessorKeyword, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AssertsKeyword, + AsteriskToken, + AsyncKeyword, + AwaitExpression, + AwaitKeyword, + BigIntLiteral, + BinaryExpression, + BindingElement, + Block, + BreakStatement, + Bundle, + CallExpression, + CallSignatureDeclaration, + CaseBlock, + CaseClause, + CatchClause, + ClassDeclaration, + ClassExpression, + ClassStaticBlockDeclaration, + ColonToken, + CommaListExpression, + ComputedPropertyName, + ConditionalExpression, + ConditionalTypeNode, + ConstructorDeclaration, + ConstructorTypeNode, + ConstructSignatureDeclaration, + ContinueStatement, + DebuggerStatement, + Decorator, + DefaultClause, + DeleteExpression, + DoStatement, + DotDotDotToken, + ElementAccessExpression, + EmptyStatement, + EndOfDeclarationMarker, + EnumDeclaration, + EnumMember, + EqualsGreaterThanToken, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportKeyword, + ExportSpecifier, + ExpressionStatement, + ExpressionWithTypeArguments, + ExternalModuleReference, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionTypeNode, + GetAccessorDeclaration, + HeritageClause, + Identifier, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportExpression, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IndexedAccessTypeNode, + IndexSignatureDeclaration, + InferTypeNode, + InterfaceDeclaration, + IntersectionTypeNode, + JSDoc, + JSDocAllType, + JSDocAugmentsTag, + JSDocAuthorTag, + JSDocCallbackTag, + JSDocClassTag, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNamepathType, + JSDocNameReference, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocUnknownTag, + JSDocUnknownType, + JSDocVariadicType, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxText, + LabeledStatement, + LiteralTypeNode, + MappedTypeNode, + MergeDeclarationMarker, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + MissingDeclaration, + ModuleBlock, + ModuleDeclaration, + NamedExports, + NamedImports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NonNullExpression, + NoSubstitutionTemplateLiteral, + NotEmittedStatement, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralExpression, + OmittedExpression, + OptionalTypeNode, + OverrideKeyword, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + PartiallyEmittedExpression, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + QualifiedName, + QuestionDotToken, + QuestionToken, + ReadonlyKeyword, + RegularExpressionLiteral, + RestTypeNode, + ReturnStatement, + SatisfiesExpression, + SemicolonClassElement, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SourceFile, + SpreadAssignment, + SpreadElement, + StaticKeyword, + StringLiteral, + SuperExpression, + SwitchStatement, + SyntaxKind, + SyntaxList, + SyntheticExpression, + SyntheticReferenceExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateHead, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateMiddle, + TemplateSpan, + TemplateTail, + ThisTypeNode, + ThrowStatement, + Token, + TryStatement, + TupleTypeNode, + TypeAliasDeclaration, + TypeAssertion, + TypeLiteralNode, + TypeOfExpression, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionTypeNode, + UnparsedPrepend, + UnparsedSource, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VoidExpression, + WhileStatement, + WithStatement, YieldExpression, } from "../_namespaces/ts"; diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index 0f697835674a5..119ad2953a195 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -1,12 +1,52 @@ import { - Associativity, BinaryExpression, BinaryOperator, cast, compareValues, Comparison, ConciseBody, Expression, - getExpressionAssociativity, getExpressionPrecedence, getLeftmostExpression, getOperatorAssociativity, - getOperatorPrecedence, identity, isBinaryExpression, isBlock, isCallExpression, isCommaSequence, - isConditionalTypeNode, isConstructorTypeNode, isFunctionOrConstructorTypeNode, isFunctionTypeNode, isInferTypeNode, - isIntersectionTypeNode, isJSDocNullableType, isLeftHandSideExpression, isLiteralKind, isNamedTupleMember, - isNodeArray, isOptionalChain, isTypeOperatorNode, isUnaryExpression, isUnionTypeNode, last, LeftHandSideExpression, - NamedTupleMember, NewExpression, NodeArray, NodeFactory, OperatorPrecedence, OuterExpressionKinds, - ParenthesizerRules, sameMap, setTextRange, skipPartiallyEmittedExpressions, some, SyntaxKind, TypeNode, + Associativity, + BinaryExpression, + BinaryOperator, + cast, + compareValues, + Comparison, + ConciseBody, + Expression, + getExpressionAssociativity, + getExpressionPrecedence, + getLeftmostExpression, + getOperatorAssociativity, + getOperatorPrecedence, + identity, + isBinaryExpression, + isBlock, + isCallExpression, + isCommaSequence, + isConditionalTypeNode, + isConstructorTypeNode, + isFunctionOrConstructorTypeNode, + isFunctionTypeNode, + isInferTypeNode, + isIntersectionTypeNode, + isJSDocNullableType, + isLeftHandSideExpression, + isLiteralKind, + isNamedTupleMember, + isNodeArray, + isOptionalChain, + isTypeOperatorNode, + isUnaryExpression, + isUnionTypeNode, + last, + LeftHandSideExpression, + NamedTupleMember, + NewExpression, + NodeArray, + NodeFactory, + OperatorPrecedence, + OuterExpressionKinds, + ParenthesizerRules, + sameMap, + setTextRange, + skipPartiallyEmittedExpressions, + some, + SyntaxKind, + TypeNode, UnaryExpression, } from "../_namespaces/ts"; diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index b6c97f8f3b857..190bd6e7cb8b0 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1,35 +1,171 @@ import { - AccessorDeclaration, addEmitFlags, AdditiveOperator, AdditiveOperatorOrHigher, AssertionLevel, - AssignmentOperatorOrHigher, BinaryExpression, BinaryOperator, BinaryOperatorToken, BindingOrAssignmentElement, - BindingOrAssignmentElementRestIndicator, BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, - BitwiseOperator, BitwiseOperatorOrHigher, Block, BooleanLiteral, CharacterCodes, CommaListExpression, - compareStringsCaseSensitive, CompilerOptions, Debug, Declaration, EmitFlags, EmitHelperFactory, EmitHost, - EmitResolver, EntityName, EqualityOperator, EqualityOperatorOrHigher, ExclamationToken, ExponentiationOperator, - ExportDeclaration, Expression, ExpressionStatement, externalHelpersModuleNameText, first, firstOrUndefined, - ForInitializer, GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, + AccessorDeclaration, + addEmitFlags, + AdditiveOperator, + AdditiveOperatorOrHigher, + AssertionLevel, + AssignmentOperatorOrHigher, + BinaryExpression, + BinaryOperator, + BinaryOperatorToken, + BindingOrAssignmentElement, + BindingOrAssignmentElementRestIndicator, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + BitwiseOperator, + BitwiseOperatorOrHigher, + Block, + BooleanLiteral, + CharacterCodes, + CommaListExpression, + compareStringsCaseSensitive, + CompilerOptions, + Debug, + Declaration, + EmitFlags, + EmitHelperFactory, + EmitHost, + EmitResolver, + EntityName, + EqualityOperator, + EqualityOperatorOrHigher, + ExclamationToken, + ExponentiationOperator, + ExportDeclaration, + Expression, + ExpressionStatement, + externalHelpersModuleNameText, + first, + firstOrUndefined, + ForInitializer, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedNamePart, + GeneratedPrivateIdentifier, GetAccessorDeclaration, - getAllAccessorDeclarations, getEmitFlags, getEmitHelpers, getEmitModuleKind, getESModuleInterop, - getExternalModuleName, getExternalModuleNameFromPath, getJSDocType, getJSDocTypeTag, getModifiers, - getNamespaceDeclarationNode, getOrCreateEmitNode, getOriginalNode, getParseTreeNode, - getSourceTextOfNodeFromSourceFile, HasIllegalDecorators, HasIllegalModifiers, HasIllegalType, - HasIllegalTypeParameters, Identifier, idText, ImportCall, ImportDeclaration, ImportEqualsDeclaration, - isAssignmentExpression, isAssignmentOperator, isBlock, isComputedPropertyName, isDeclarationBindingElement, - isDefaultImport, isEffectiveExternalModule, isExclamationToken, isExportNamespaceAsDefaultDeclaration, - isFileLevelUniqueName, isGeneratedIdentifier, isGeneratedPrivateIdentifier, isIdentifier, isInJSFile, - isLiteralExpression, isMemberName, isMinusToken, isObjectLiteralElementLike, isParenthesizedExpression, isPlusToken, - isPostfixUnaryExpression, isPrefixUnaryExpression, isPrivateIdentifier, isPrologueDirective, isPropertyAssignment, - isPropertyName, isQualifiedName, isQuestionToken, isReadonlyKeyword, isShorthandPropertyAssignment, isSourceFile, - isSpreadAssignment, isSpreadElement, isStringLiteral, isThisTypeNode, 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, + getAllAccessorDeclarations, + getEmitFlags, + getEmitHelpers, + getEmitModuleKind, + getESModuleInterop, + getExternalModuleName, + getExternalModuleNameFromPath, + getJSDocType, + getJSDocTypeTag, + getModifiers, + getNamespaceDeclarationNode, + getOrCreateEmitNode, + getOriginalNode, + getParseTreeNode, + getSourceTextOfNodeFromSourceFile, + HasIllegalDecorators, + HasIllegalModifiers, + HasIllegalType, + HasIllegalTypeParameters, + Identifier, + idText, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, + isAssignmentExpression, + isAssignmentOperator, + isBlock, + isComputedPropertyName, + isDeclarationBindingElement, + isDefaultImport, + isEffectiveExternalModule, + isExclamationToken, + isExportNamespaceAsDefaultDeclaration, + isFileLevelUniqueName, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isIdentifier, + isInJSFile, + isLiteralExpression, + isMemberName, + isMinusToken, + isObjectLiteralElementLike, + isParenthesizedExpression, + isPlusToken, + isPostfixUnaryExpression, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAssignment, + isPropertyName, + isQualifiedName, + isQuestionToken, + isReadonlyKeyword, + isShorthandPropertyAssignment, + isSourceFile, + isSpreadAssignment, + isSpreadElement, + isStringLiteral, + isThisTypeNode, + 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 d679f8f34b649..8afd72574c0fb 100644 --- a/src/compiler/factory/utilitiesPublic.ts +++ b/src/compiler/factory/utilitiesPublic.ts @@ -1,4 +1,11 @@ -import { HasDecorators, HasModifiers, Node, setTextRangePosEnd, SyntaxKind, TextRange } from "../_namespaces/ts"; +import { + HasDecorators, + HasModifiers, + Node, + setTextRangePosEnd, + SyntaxKind, + TextRange, +} from "../_namespaces/ts"; export function setTextRange(range: T, location: TextRange | undefined): T { return location ? setTextRangePosEnd(range, location.pos, location.end) : range; diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 6364309fc2d77..5177f1d5a57ab 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,23 +1,111 @@ import { - append, appendIfUnique, arrayFrom, changeAnyExtension, CharacterCodes, combinePaths, comparePaths, Comparison, - CompilerOptions, contains, containsPath, createCompilerDiagnostic, Debug, Diagnostic, DiagnosticMessage, - DiagnosticReporter, Diagnostics, directoryProbablyExists, directorySeparator, emptyArray, endsWith, - ensureTrailingDirectorySeparator, every, Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, - FileReference, filter, firstDefined, forEach, forEachAncestorDirectory, formatMessage, getBaseFileName, - GetCanonicalFileName, getCommonSourceDirectory, getDirectoryPath, GetEffectiveTypeRootsHost, getEmitModuleKind, - getEmitModuleResolutionKind, getModeForUsageLocation, getNormalizedAbsolutePath, getOwnKeys, getPathComponents, - getPathFromPathComponents, getPathsBasePath, getPossibleOriginalInputExtensionForExtension, - getRelativePathFromDirectory, getRootLength, hasJSFileExtension, hasProperty, hasTrailingDirectorySeparator, - hostGetCanonicalFileName, isArray, isExternalModuleNameRelative, isRootedDiskPath, isString, - isStringLiteralLike, lastOrUndefined, length, MapLike, matchedText, MatchingKeys, matchPatternOrExact, - ModuleKind, ModuleResolutionHost, ModuleResolutionKind, noop, noopPush, normalizePath, normalizeSlashes, - optionsHaveModuleResolutionChanges, PackageId, packageIdToString, ParsedCommandLine, Path, pathIsRelative, Pattern, - patternText, perfLogger, Push, readJson, removeExtension, removeFileExtension, removePrefix, + append, + appendIfUnique, + arrayFrom, + changeAnyExtension, + CharacterCodes, + combinePaths, + comparePaths, + Comparison, + CompilerOptions, + contains, + containsPath, + createCompilerDiagnostic, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + directoryProbablyExists, + directorySeparator, + emptyArray, + endsWith, + ensureTrailingDirectorySeparator, + every, + Extension, + extensionIsTS, + fileExtensionIs, + fileExtensionIsOneOf, + FileReference, + filter, + firstDefined, + forEach, + forEachAncestorDirectory, + formatMessage, + getBaseFileName, + GetCanonicalFileName, + getCommonSourceDirectory, + getDirectoryPath, + GetEffectiveTypeRootsHost, + getEmitModuleKind, + getEmitModuleResolutionKind, + getModeForUsageLocation, + getNormalizedAbsolutePath, + getOwnKeys, + getPathComponents, + getPathFromPathComponents, + getPathsBasePath, + getPossibleOriginalInputExtensionForExtension, + getRelativePathFromDirectory, + getRootLength, + hasJSFileExtension, + hasProperty, + hasTrailingDirectorySeparator, + hostGetCanonicalFileName, + isArray, + isExternalModuleNameRelative, + isRootedDiskPath, + isString, + isStringLiteralLike, + lastOrUndefined, + length, + MapLike, + matchedText, + MatchingKeys, + matchPatternOrExact, + ModuleKind, + ModuleResolutionHost, + ModuleResolutionKind, + noop, + noopPush, + normalizePath, + normalizeSlashes, + optionsHaveModuleResolutionChanges, + PackageId, + packageIdToString, + ParsedCommandLine, + Path, + pathIsRelative, + Pattern, + patternText, + perfLogger, + Push, + readJson, + removeExtension, + removeFileExtension, + removePrefix, ResolutionMode, - ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, some, sort, SourceFile, startsWith, stringContains, - StringLiteralLike, supportedDeclarationExtensions, supportedTSImplementationExtensions, toFileNameLowerCase, toPath, tryExtractTSExtension, tryGetExtensionFromPath, - tryParsePatterns, version, Version, versionMajorMinor, VersionRange, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + some, + sort, + SourceFile, + startsWith, + stringContains, + StringLiteralLike, + supportedDeclarationExtensions, + supportedTSImplementationExtensions, + toFileNameLowerCase, + toPath, + tryExtractTSExtension, + tryGetExtensionFromPath, + tryParsePatterns, + version, + Version, + versionMajorMinor, + VersionRange, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index daffd3fc1f746..84031881431b0 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -1,22 +1,107 @@ import { - __String, allKeysStartWithDot, AmbientModuleDeclaration, append, arrayFrom, CharacterCodes, combinePaths, - compareBooleans, compareNumberOfDirectorySeparators, comparePaths, Comparison, CompilerOptions, containsIgnoredPath, - containsPath, createGetCanonicalFileName, Debug, directorySeparator, emptyArray, endsWith, - ensurePathIsNonModuleName, ensureTrailingDirectorySeparator, every, ExportAssignment, Extension, extensionFromPath, - fileExtensionIsOneOf, FileIncludeKind, firstDefined, flatMap, flatten, forEach, forEachAncestorDirectory, - GetCanonicalFileName, getDirectoryPath, getEmitModuleResolutionKind, getImpliedNodeFormatForFile, - getModeForResolutionAtIndex, getModuleNameStringLiteralAt, getNodeModulePathParts, getNormalizedAbsolutePath, - getOwnKeys, getPackageJsonTypesVersionsPaths, getPackageNameFromTypesPackageName, getPathsBasePath, - getRelativePathFromDirectory, getRelativePathToDirectoryOrUrl, getSourceFileOfModule, getSupportedExtensions, - getTextOfIdentifierOrLiteral, hasJSFileExtension, hasTSFileExtension, hostGetCanonicalFileName, Identifier, - isAmbientModule, isApplicableVersionedTypesKey, isExternalModuleAugmentation, isExternalModuleNameRelative, - isModuleBlock, isModuleDeclaration, isNonGlobalAmbientModule, isRootedDiskPath, isSourceFile, isString, JsxEmit, - map, mapDefined, MapLike, matchPatternOrExact, min, ModuleDeclaration, ModuleKind, ModulePath, - ModuleResolutionHost, ModuleResolutionKind, ModuleSpecifierCache, ModuleSpecifierOptions, - ModuleSpecifierResolutionHost, NodeFlags, NodeModulePathParts, normalizePath, Path, pathContainsNodeModules, - pathIsBareSpecifier, pathIsRelative, PropertyAccessExpression, removeFileExtension, removeSuffix, resolvePath, - ScriptKind, some, SourceFile, startsWith, startsWithDirectory, stringContains, StringLiteral, Symbol, SymbolFlags, - toPath, tryGetExtensionFromPath, tryParsePatterns, TypeChecker, UserPreferences, ResolutionMode, + __String, + allKeysStartWithDot, + AmbientModuleDeclaration, + append, + arrayFrom, + CharacterCodes, + combinePaths, + compareBooleans, + compareNumberOfDirectorySeparators, + comparePaths, + Comparison, + CompilerOptions, + containsIgnoredPath, + containsPath, + createGetCanonicalFileName, + Debug, + directorySeparator, + emptyArray, + endsWith, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, + every, + ExportAssignment, + Extension, + extensionFromPath, + fileExtensionIsOneOf, + FileIncludeKind, + firstDefined, + flatMap, + flatten, + forEach, + forEachAncestorDirectory, + GetCanonicalFileName, + getDirectoryPath, + getEmitModuleResolutionKind, + getImpliedNodeFormatForFile, + getModeForResolutionAtIndex, + getModuleNameStringLiteralAt, + getNodeModulePathParts, + getNormalizedAbsolutePath, + getOwnKeys, + getPackageJsonTypesVersionsPaths, + getPackageNameFromTypesPackageName, + getPathsBasePath, + getRelativePathFromDirectory, + getRelativePathToDirectoryOrUrl, + getSourceFileOfModule, + getSupportedExtensions, + getTextOfIdentifierOrLiteral, + hasJSFileExtension, + hasTSFileExtension, + hostGetCanonicalFileName, + Identifier, + isAmbientModule, + isApplicableVersionedTypesKey, + isExternalModuleAugmentation, + isExternalModuleNameRelative, + isModuleBlock, + isModuleDeclaration, + isNonGlobalAmbientModule, + isRootedDiskPath, + isSourceFile, + isString, + JsxEmit, + map, + mapDefined, + MapLike, + matchPatternOrExact, + min, + ModuleDeclaration, + ModuleKind, + ModulePath, + ModuleResolutionHost, + ModuleResolutionKind, + ModuleSpecifierCache, + ModuleSpecifierOptions, + ModuleSpecifierResolutionHost, + NodeFlags, + NodeModulePathParts, + normalizePath, + Path, + pathContainsNodeModules, + pathIsBareSpecifier, + pathIsRelative, + PropertyAccessExpression, + removeFileExtension, + removeSuffix, + ResolutionMode, + resolvePath, + ScriptKind, + some, + SourceFile, + startsWith, + startsWithDirectory, + stringContains, + StringLiteral, + Symbol, + SymbolFlags, + toPath, + tryGetExtensionFromPath, + tryParsePatterns, + TypeChecker, + UserPreferences, } from "./_namespaces/ts"; // Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers. diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 417f2719bdd01..f1f8bd002e875 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,69 +1,388 @@ import * as ts from "./_namespaces/ts"; import { - AccessorDeclaration, addRange, addRelatedInfo, AmdDependency, append, ArrayBindingElement, ArrayBindingPattern, - ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AssertClause, AssertEntry, AssertionLevel, - AsteriskToken, attachFileToDiagnostics, AwaitExpression, BaseNodeFactory, BinaryExpression, BinaryOperatorToken, - BindingElement, BindingName, BindingPattern, Block, BooleanLiteral, BreakOrContinueStatement, BreakStatement, - CallExpression, CallSignatureDeclaration, canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, CatchClause, - CharacterCodes, CheckJsDirective, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, - ClassStaticBlockDeclaration, CommaListExpression, CommentDirective, commentPragmas, CommentRange, - ComputedPropertyName, concatenate, ConditionalExpression, ConditionalTypeNode, ConstructorDeclaration, - ConstructorTypeNode, ConstructSignatureDeclaration, containsParseError, ContinueStatement, convertToObjectWorker, - createDetachedDiagnostic, createNodeFactory, createScanner, createTextChangeRange, createTextSpanFromBounds, Debug, - Decorator, DefaultClause, DeleteExpression, Diagnostic, DiagnosticMessage, Diagnostics, - DiagnosticWithDetachedLocation, DoStatement, DotDotDotToken, ElementAccessExpression, emptyArray, emptyMap, - EndOfFileToken, ensureScriptKind, EntityName, EnumDeclaration, EnumMember, ExclamationToken, - ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, ExpressionWithTypeArguments, - ExternalModuleReference, fileExtensionIsOneOf, FileReference, findIndex, forEach, ForEachChildNodes, - ForInOrOfStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, - FunctionOrConstructorTypeNode, FunctionTypeNode, GetAccessorDeclaration, getBinaryOperatorPrecedence, getFullWidth, - getJSDocCommentRanges, getLanguageVariant, getLastChild, getLeadingCommentRanges, getSpellingSuggestion, - getTextOfNodeFromSourceText, HasJSDoc, hasJSDocNodes, HasModifiers, HeritageClause, Identifier, idText, IfStatement, - ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeAssertionContainer, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, - InterfaceDeclaration, IntersectionTypeNode, isArray, isAssignmentOperator, isAsyncModifier, isClassMemberModifier, - isExportAssignment, isExportDeclaration, isExportModifier, isExpressionWithTypeArguments, isExternalModuleReference, - isFunctionTypeNode, isIdentifierText, isImportDeclaration, isImportEqualsDeclaration, isJSDocFunctionType, - isJSDocNullableType, isJSDocReturnTag, isJSDocTypeTag, isJsxOpeningElement, isJsxOpeningFragment, isKeyword, - isLeftHandSideExpression, isLiteralKind, isMetaProperty, isModifierKind, isNonNullExpression, isPrivateIdentifier, - isSetAccessorDeclaration, isStringOrNumericLiteralLike, isTaggedTemplateExpression, isTemplateLiteralKind, - isTypeReferenceNode, IterationStatement, JSDoc, JSDocAllType, JSDocAugmentsTag, JSDocAuthorTag, JSDocCallbackTag, - JSDocClassTag, JSDocComment, JSDocContainer, JSDocDeprecatedTag, JSDocEnumTag, JSDocFunctionType, - JSDocImplementsTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, JSDocNameReference, - JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocOverrideTag, - JSDocParameterTag, JSDocPrivateTag, JSDocPropertyLikeTag, JSDocPropertyTag, JSDocProtectedTag, JSDocPublicTag, - JSDocReadonlyTag, JSDocReturnTag, JSDocSeeTag, JSDocSignature, JSDocSyntaxKind, JSDocTag, JSDocTemplateTag, - JSDocText, JSDocThisTag, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, JSDocUnknownTag, - JSDocUnknownType, JSDocVariadicType, JsonMinusNumericLiteral, JsonObjectExpressionStatement, JsonSourceFile, - JsxAttribute, JsxAttributes, JsxAttributeValue, JsxChild, JsxClosingElement, JsxClosingFragment, JsxElement, - JsxExpression, JsxFragment, JsxOpeningElement, JsxOpeningFragment, JsxOpeningLikeElement, JsxSelfClosingElement, - JsxSpreadAttribute, JsxTagNameExpression, JsxTagNamePropertyAccess, JsxText, JsxTokenSyntaxKind, LabeledStatement, - LanguageVariant, lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralLikeNode, LiteralTypeNode, map, - mapDefined, MappedTypeNode, MemberExpression, MetaProperty, MethodDeclaration, MethodSignature, MinusToken, - MissingDeclaration, Modifier, ModifierFlags, ModifierLike, ModifiersArray, modifiersToFlags, ModuleBlock, - ModuleDeclaration, ModuleKind, Mutable, NamedExportBindings, NamedExports, NamedImports, NamedImportsOrExports, - NamedTupleMember, NamespaceDeclaration, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, - Node, NodeArray, NodeFactoryFlags, NodeFlags, nodeIsMissing, nodeIsPresent, NonNullExpression, noop, normalizePath, - NoSubstitutionTemplateLiteral, NullLiteral, NumericLiteral, objectAllocator, ObjectBindingPattern, - ObjectLiteralElementLike, ObjectLiteralExpression, OperatorPrecedence, OptionalTypeNode, PackageJsonInfo, - ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, perfLogger, - PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, PragmaDefinition, PragmaKindFlags, PragmaMap, - PragmaPseudoMap, PragmaPseudoMapEntry, PrefixUnaryExpression, PrefixUnaryOperator, PrimaryExpression, - PrivateIdentifier, PropertyAccessEntityNameExpression, PropertyAccessExpression, PropertyAssignment, - PropertyDeclaration, PropertyName, PropertySignature, QualifiedName, QuestionDotToken, QuestionToken, - ReadonlyKeyword, ReadonlyPragmaMap, ReadonlyTextRange, ResolutionMode, RestTypeNode, ReturnStatement, SatisfiesExpression, - ScriptKind, ScriptTarget, SetAccessorDeclaration, setParent, setParentRecursive, setTextRange, setTextRangePos, - setTextRangePosEnd, setTextRangePosWidth, ShorthandPropertyAssignment, skipTrivia, some, SourceFile, - SpreadAssignment, SpreadElement, startsWith, Statement, StringLiteral, supportedDeclarationExtensions, - SwitchStatement, SyntaxKind, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralToken, - TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateMiddle, TemplateSpan, TemplateTail, TextChangeRange, - textChangeRangeIsUnchanged, textChangeRangeNewSpan, TextRange, textSpanEnd, textToKeywordObj, ThisExpression, - ThisTypeNode, ThrowStatement, toArray, Token, TokenFlags, tokenIsIdentifierOrKeyword, - tokenIsIdentifierOrKeywordOrGreaterThan, tokenToString, tracing, TransformFlags, trimString, TryStatement, - TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeElement, TypeLiteralNode, TypeNode, TypeOfExpression, - TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnaryExpression, - UnionOrIntersectionTypeNode, UnionTypeNode, UpdateExpression, VariableDeclaration, VariableDeclarationList, - VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, + AccessorDeclaration, + addRange, + addRelatedInfo, + AmdDependency, + append, + ArrayBindingElement, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AssertionLevel, + AsteriskToken, + attachFileToDiagnostics, + AwaitExpression, + BaseNodeFactory, + BinaryExpression, + BinaryOperatorToken, + BindingElement, + BindingName, + BindingPattern, + Block, + BooleanLiteral, + BreakOrContinueStatement, + BreakStatement, + CallExpression, + CallSignatureDeclaration, + canHaveModifiers, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + CharacterCodes, + CheckJsDirective, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CommaListExpression, + CommentDirective, + commentPragmas, + CommentRange, + ComputedPropertyName, + concatenate, + ConditionalExpression, + ConditionalTypeNode, + ConstructorDeclaration, + ConstructorTypeNode, + ConstructSignatureDeclaration, + containsParseError, + ContinueStatement, + convertToObjectWorker, + createDetachedDiagnostic, + createNodeFactory, + createScanner, + createTextChangeRange, + createTextSpanFromBounds, + Debug, + Decorator, + DefaultClause, + DeleteExpression, + Diagnostic, + DiagnosticMessage, + Diagnostics, + DiagnosticWithDetachedLocation, + DoStatement, + DotDotDotToken, + ElementAccessExpression, + emptyArray, + emptyMap, + EndOfFileToken, + ensureScriptKind, + EntityName, + EnumDeclaration, + EnumMember, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + ExternalModuleReference, + fileExtensionIsOneOf, + FileReference, + findIndex, + forEach, + ForEachChildNodes, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionOrConstructorTypeNode, + FunctionTypeNode, + GetAccessorDeclaration, + getBinaryOperatorPrecedence, + getFullWidth, + getJSDocCommentRanges, + getLanguageVariant, + getLastChild, + getLeadingCommentRanges, + getSpellingSuggestion, + getTextOfNodeFromSourceText, + HasJSDoc, + hasJSDocNodes, + HasModifiers, + HeritageClause, + Identifier, + idText, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IndexedAccessTypeNode, + IndexSignatureDeclaration, + InferTypeNode, + InterfaceDeclaration, + IntersectionTypeNode, + isArray, + isAssignmentOperator, + isAsyncModifier, + isClassMemberModifier, + isExportAssignment, + isExportDeclaration, + isExportModifier, + isExpressionWithTypeArguments, + isExternalModuleReference, + isFunctionTypeNode, + isIdentifierText, + isImportDeclaration, + isImportEqualsDeclaration, + isJSDocFunctionType, + isJSDocNullableType, + isJSDocReturnTag, + isJSDocTypeTag, + isJsxOpeningElement, + isJsxOpeningFragment, + isKeyword, + isLeftHandSideExpression, + isLiteralKind, + isMetaProperty, + isModifierKind, + isNonNullExpression, + isPrivateIdentifier, + isSetAccessorDeclaration, + isStringOrNumericLiteralLike, + isTaggedTemplateExpression, + isTemplateLiteralKind, + isTypeReferenceNode, + IterationStatement, + JSDoc, + JSDocAllType, + JSDocAugmentsTag, + JSDocAuthorTag, + JSDocCallbackTag, + JSDocClassTag, + JSDocComment, + JSDocContainer, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNameReference, + JSDocNamespaceDeclaration, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocSyntaxKind, + JSDocTag, + JSDocTemplateTag, + JSDocText, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocUnknownTag, + JSDocUnknownType, + JSDocVariadicType, + JsonMinusNumericLiteral, + JsonObjectExpressionStatement, + JsonSourceFile, + JsxAttribute, + JsxAttributes, + JsxAttributeValue, + JsxChild, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxTagNamePropertyAccess, + JsxText, + JsxTokenSyntaxKind, + LabeledStatement, + LanguageVariant, + lastOrUndefined, + LeftHandSideExpression, + LiteralExpression, + LiteralLikeNode, + LiteralTypeNode, + map, + mapDefined, + MappedTypeNode, + MemberExpression, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + MissingDeclaration, + Modifier, + ModifierFlags, + ModifierLike, + ModifiersArray, + modifiersToFlags, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + Mutable, + NamedExportBindings, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceDeclaration, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFactoryFlags, + NodeFlags, + nodeIsMissing, + nodeIsPresent, + NonNullExpression, + noop, + normalizePath, + NoSubstitutionTemplateLiteral, + NullLiteral, + NumericLiteral, + objectAllocator, + ObjectBindingPattern, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OperatorPrecedence, + OptionalTypeNode, + PackageJsonInfo, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + PartiallyEmittedExpression, + perfLogger, + PlusToken, + PostfixUnaryExpression, + PostfixUnaryOperator, + PragmaDefinition, + PragmaKindFlags, + PragmaMap, + PragmaPseudoMap, + PragmaPseudoMapEntry, + PrefixUnaryExpression, + PrefixUnaryOperator, + PrimaryExpression, + PrivateIdentifier, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + QualifiedName, + QuestionDotToken, + QuestionToken, + ReadonlyKeyword, + ReadonlyPragmaMap, + ReadonlyTextRange, + ResolutionMode, + RestTypeNode, + ReturnStatement, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + setParent, + setParentRecursive, + setTextRange, + setTextRangePos, + setTextRangePosEnd, + setTextRangePosWidth, + ShorthandPropertyAssignment, + skipTrivia, + some, + SourceFile, + SpreadAssignment, + SpreadElement, + startsWith, + Statement, + StringLiteral, + supportedDeclarationExtensions, + SwitchStatement, + SyntaxKind, + TaggedTemplateExpression, + TemplateExpression, + TemplateHead, + TemplateLiteralToken, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateMiddle, + TemplateSpan, + TemplateTail, + TextChangeRange, + textChangeRangeIsUnchanged, + textChangeRangeNewSpan, + TextRange, + textSpanEnd, + textToKeywordObj, + ThisExpression, + ThisTypeNode, + ThrowStatement, + toArray, + Token, + TokenFlags, + tokenIsIdentifierOrKeyword, + tokenIsIdentifierOrKeywordOrGreaterThan, + tokenToString, + tracing, + TransformFlags, + trimString, + TryStatement, + TupleTypeNode, + TypeAliasDeclaration, + TypeAssertion, + TypeElement, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnaryExpression, + UnionOrIntersectionTypeNode, + UnionTypeNode, + UpdateExpression, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VoidExpression, + WhileStatement, + WithStatement, + YieldExpression, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/path.ts b/src/compiler/path.ts index 7f84ae19c6a9b..b963c9e0cc929 100644 --- a/src/compiler/path.ts +++ b/src/compiler/path.ts @@ -1,7 +1,21 @@ import { - CharacterCodes, compareStringsCaseInsensitive, compareStringsCaseSensitive, compareValues, Comparison, Debug, - endsWith, equateStringsCaseInsensitive, equateStringsCaseSensitive, GetCanonicalFileName, getStringComparer, - identity, lastOrUndefined, Path, some, startsWith, stringContains, + CharacterCodes, + compareStringsCaseInsensitive, + compareStringsCaseSensitive, + compareValues, + Comparison, + Debug, + endsWith, + equateStringsCaseInsensitive, + equateStringsCaseSensitive, + GetCanonicalFileName, + getStringComparer, + identity, + lastOrUndefined, + Path, + some, + startsWith, + stringContains, } from "./_namespaces/ts"; /** diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index 2f0892b17dc1d..166163784abee 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -1,5 +1,12 @@ import { - Debug, noop, Performance, PerformanceHooks, sys, System, timestamp, tryGetNativePerformanceHooks, + Debug, + noop, + Performance, + PerformanceHooks, + sys, + System, + timestamp, + tryGetNativePerformanceHooks, } from "./_namespaces/ts"; /** Performance measurements for the compiler. */ diff --git a/src/compiler/performanceCore.ts b/src/compiler/performanceCore.ts index 3788da62b9072..9e20bddb69480 100644 --- a/src/compiler/performanceCore.ts +++ b/src/compiler/performanceCore.ts @@ -1,4 +1,8 @@ -import { isNodeLikeSystem, Version, VersionRange } from "./_namespaces/ts"; +import { + isNodeLikeSystem, + Version, + VersionRange, +} from "./_namespaces/ts"; // The following definitions provide the minimum compatible support for the Web Performance User Timings API // between browsers and NodeJS: diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c87abb6fc2d87..f1f67c0e87e5f 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,64 +1,318 @@ import * as ts from "./_namespaces/ts"; import { - __String, addEmitFlags, addRange, append, arrayFrom, arrayIsEqualTo, AsExpression, AssertClause, BuilderProgram, - CancellationToken, canHaveModifiers, chainDiagnosticMessages, changeExtension, changesAffectingProgramStructure, - changesAffectModuleResolution, clone, combinePaths, CommentDirective, CommentDirectivesMap, compareDataObjects, - comparePaths, compareValues, Comparison, CompilerHost, CompilerOptions, computeLineAndCharacterOfPosition, - concatenate, contains, containsIgnoredPath, containsPath, convertToRelativePath, createCommentDirectivesMap, - createCompilerDiagnostic, createCompilerDiagnosticFromMessageChain, createDiagnosticCollection, - createDiagnosticForNodeInSourceFile, createDiagnosticForRange, createFileDiagnostic, - createFileDiagnosticFromMessageChain, createGetCanonicalFileName, createInputFilesWithFilePaths, - createModeAwareCache, createModuleResolutionCache, createMultiMap, CreateProgramOptions, createSourceFile, - CreateSourceFileOptions, createSymlinkCache, createTypeChecker, createTypeReferenceDirectiveResolutionCache, - CustomTransformers, Debug, DeclarationWithTypeParameterChildren, Diagnostic, DiagnosticCategory, - diagnosticCategoryName, DiagnosticMessage, DiagnosticMessageChain, DiagnosticReporter, Diagnostics, - DiagnosticWithLocation, directorySeparator, DirectoryStructureHost, emitFiles, EmitFlags, EmitHost, EmitOnly, - EmitResult, emptyArray, ensureTrailingDirectorySeparator, equateStringsCaseInsensitive, equateStringsCaseSensitive, - explainIfFileIsRedirectAndImpliedFormat, ExportAssignment, ExportDeclaration, Extension, extensionFromPath, - externalHelpersModuleNameText, factory, fileExtensionIs, fileExtensionIsOneOf, FileIncludeKind, FileIncludeReason, - fileIncludeReasonToDiagnostics, FilePreprocessingDiagnostics, FilePreprocessingDiagnosticsKind, FileReference, - filter, find, firstDefined, firstDefinedIterator, flatMap, flatten, forEach, forEachAncestorDirectory, forEachChild, - forEachChildRecursively, forEachEmittedFile, forEachEntry, forEachKey, FunctionLikeDeclaration, - getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, getBaseFileName, GetCanonicalFileName, - getCommonSourceDirectoryOfConfig, getDefaultLibFileName, getDirectoryPath, getEmitDeclarations, getEmitModuleKind, - getEmitModuleResolutionKind, getEmitScriptTarget, getErrorSpanForNode, getExternalModuleName, - getJSXImplicitImportBase, getJSXRuntimeImport, getLineAndCharacterOfPosition, getLineStarts, getMatchedFileSpec, - getMatchedIncludeSpec, getNewLineCharacter, getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot, - getNormalizedPathComponents, getOutputDeclarationFileName, getOutputPathsForBundle, getPackageScopeForPath, - getPathFromPathComponents, getPositionOfLineAndCharacter, getPropertyArrayElementValue, getPropertyAssignment, - getResolutionMode, getResolutionName, getResolvedModule, getRootLength, getSetExternalModuleIndicator, - getSpellingSuggestion, getStrictOptionValue, getSupportedExtensions, - getSupportedExtensionsWithJsonIfResolveJsonModule, getTemporaryModuleResolutionState, getTextOfIdentifierOrLiteral, - getTransformers, getTsBuildInfoEmitOutputFilePath, getTsConfigObjectLiteralExpression, getTsConfigPropArray, - getTsConfigPropArrayElementValue, HasChangedAutomaticTypeDirectiveNames, hasChangesInResolutions, hasExtension, - HasInvalidatedResolutions, hasJSDocNodes, hasJSFileExtension, hasJsonModuleEmitEnabled, hasProperty, - hasSyntacticModifier, hasZeroOrOneAsteriskCharacter, HeritageClause, Identifier, identity, ImportClause, - ImportDeclaration, ImportOrExportSpecifier, InputFiles, inverseJsxOptionMap, isAmbientModule, isAnyImportOrReExport, - isArray, isArrayLiteralExpression, isBuildInfoFile, isCheckJsEnabledForFile, isDeclarationFileName, isDecorator, - isExportDeclaration, isExternalModule, isExternalModuleNameRelative, isIdentifierText, isImportCall, - isImportDeclaration, isImportEqualsDeclaration, isImportSpecifier, isImportTypeNode, isIncrementalCompilation, - isInJSFile, isLiteralImportTypeNode, isModifier, isModuleDeclaration, isObjectLiteralExpression, isPlainJsFile, - isRequireCall, isRootedDiskPath, isSourceFileJS, isString, isStringLiteral, isStringLiteralLike, isTraceEnabled, - JsonSourceFile, JsxEmit, length, libMap, libs, mapDefined, mapDefinedIterator, maybeBind, memoize, - MethodDeclaration, ModifierFlags, ModifierLike, ModuleBlock, ModuleDeclaration, ModuleKind, ModuleResolutionCache, - ModuleResolutionHost, ModuleResolutionInfo, moduleResolutionIsEqualTo, ModuleResolutionKind, Mutable, Node, - NodeArray, NodeFlags, nodeModulesPathPart, NodeWithTypeArguments, noop, normalizePath, notImplementedResolver, - noTransformers, ObjectLiteralExpression, OperationCanceledException, optionsHaveChanges, outFile, PackageId, - packageIdToPackageName, packageIdToString, PackageJsonInfoCache, padLeft, ParameterDeclaration, ParseConfigFileHost, - ParsedCommandLine, parseIsolatedEntityName, parseJsonSourceFileConfigFileContent, Path, pathIsAbsolute, - pathIsRelative, Program, ProgramHost, ProjectReference, ProjectReferenceFile, projectReferenceIsEqualTo, - PropertyDeclaration, ReferencedFile, removeFileExtension, removePrefix, removeSuffix, resolutionExtensionIsTSOrJson, - resolveConfigFileProjectName, ResolvedConfigFileName, ResolvedModuleFull, ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, ResolvedTypeReferenceDirective, resolveModuleName, resolveModuleNameFromCache, - resolveTypeReferenceDirective, returnFalse, returnUndefined, SatisfiesExpression, ScriptKind, ScriptTarget, - setParent, setParentRecursive, setResolvedModule, setResolvedTypeReferenceDirective, skipTrivia, skipTypeChecking, - some, sortAndDeduplicateDiagnostics, SortedReadonlyArray, SourceFile, sourceFileAffectingCompilerOptions, - sourceFileMayBeEmitted, SourceOfProjectReferenceRedirect, stableSort, startsWith, Statement, stringContains, - StringLiteral, StringLiteralLike, StructureIsReused, supportedJSExtensionsFlat, SymlinkCache, SyntaxKind, sys, - targetOptionDeclaration, toFileNameLowerCase, tokenToString, trace, tracing, trimStringEnd, TsConfigSourceFile, - TypeChecker, typeDirectiveIsEqualTo, TypeReferenceDirectiveResolutionCache, UnparsedSource, VariableDeclaration, - VariableStatement, walkUpParenthesizedExpressions, WriteFileCallback, WriteFileCallbackData, - writeFileEnsuringDirectories, zipToModeAwareCache, TypeReferenceDirectiveResolutionInfo, getResolvedTypeReferenceDirective, ResolutionMode, + __String, + addEmitFlags, + addRange, + append, + arrayFrom, + arrayIsEqualTo, + AsExpression, + AssertClause, + BuilderProgram, + CancellationToken, + canHaveModifiers, + chainDiagnosticMessages, + changeExtension, + changesAffectingProgramStructure, + changesAffectModuleResolution, + clone, + combinePaths, + CommentDirective, + CommentDirectivesMap, + compareDataObjects, + comparePaths, + compareValues, + Comparison, + CompilerHost, + CompilerOptions, + computeLineAndCharacterOfPosition, + concatenate, + contains, + containsIgnoredPath, + containsPath, + convertToRelativePath, + createCommentDirectivesMap, + createCompilerDiagnostic, + createCompilerDiagnosticFromMessageChain, + createDiagnosticCollection, + createDiagnosticForNodeInSourceFile, + createDiagnosticForRange, + createFileDiagnostic, + createFileDiagnosticFromMessageChain, + createGetCanonicalFileName, + createInputFilesWithFilePaths, + createModeAwareCache, + createModuleResolutionCache, + createMultiMap, + CreateProgramOptions, + createSourceFile, + CreateSourceFileOptions, + createSymlinkCache, + createTypeChecker, + createTypeReferenceDirectiveResolutionCache, + CustomTransformers, + Debug, + DeclarationWithTypeParameterChildren, + Diagnostic, + DiagnosticCategory, + diagnosticCategoryName, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticReporter, + Diagnostics, + DiagnosticWithLocation, + directorySeparator, + DirectoryStructureHost, + emitFiles, + EmitFlags, + EmitHost, + EmitOnly, + EmitResult, + emptyArray, + ensureTrailingDirectorySeparator, + equateStringsCaseInsensitive, + equateStringsCaseSensitive, + explainIfFileIsRedirectAndImpliedFormat, + ExportAssignment, + ExportDeclaration, + Extension, + extensionFromPath, + externalHelpersModuleNameText, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + FileIncludeKind, + FileIncludeReason, + fileIncludeReasonToDiagnostics, + FilePreprocessingDiagnostics, + FilePreprocessingDiagnosticsKind, + FileReference, + filter, + find, + firstDefined, + firstDefinedIterator, + flatMap, + flatten, + forEach, + forEachAncestorDirectory, + forEachChild, + forEachChildRecursively, + forEachEmittedFile, + forEachEntry, + forEachKey, + FunctionLikeDeclaration, + getAllowJSCompilerOption, + getAutomaticTypeDirectiveNames, + getBaseFileName, + GetCanonicalFileName, + getCommonSourceDirectoryOfConfig, + getDefaultLibFileName, + getDirectoryPath, + getEmitDeclarations, + getEmitModuleKind, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getErrorSpanForNode, + getExternalModuleName, + getJSXImplicitImportBase, + getJSXRuntimeImport, + getLineAndCharacterOfPosition, + getLineStarts, + getMatchedFileSpec, + getMatchedIncludeSpec, + getNewLineCharacter, + getNormalizedAbsolutePath, + getNormalizedAbsolutePathWithoutRoot, + getNormalizedPathComponents, + getOutputDeclarationFileName, + getOutputPathsForBundle, + getPackageScopeForPath, + getPathFromPathComponents, + getPositionOfLineAndCharacter, + getPropertyArrayElementValue, + getPropertyAssignment, + getResolutionMode, + getResolutionName, + getResolvedModule, + getResolvedTypeReferenceDirective, + getRootLength, + getSetExternalModuleIndicator, + getSpellingSuggestion, + getStrictOptionValue, + getSupportedExtensions, + getSupportedExtensionsWithJsonIfResolveJsonModule, + getTemporaryModuleResolutionState, + getTextOfIdentifierOrLiteral, + getTransformers, + getTsBuildInfoEmitOutputFilePath, + getTsConfigObjectLiteralExpression, + getTsConfigPropArray, + getTsConfigPropArrayElementValue, + HasChangedAutomaticTypeDirectiveNames, + hasChangesInResolutions, + hasExtension, + HasInvalidatedResolutions, + hasJSDocNodes, + hasJSFileExtension, + hasJsonModuleEmitEnabled, + hasProperty, + hasSyntacticModifier, + hasZeroOrOneAsteriskCharacter, + HeritageClause, + Identifier, + identity, + ImportClause, + ImportDeclaration, + ImportOrExportSpecifier, + InputFiles, + inverseJsxOptionMap, + isAmbientModule, + isAnyImportOrReExport, + isArray, + isArrayLiteralExpression, + isBuildInfoFile, + isCheckJsEnabledForFile, + isDeclarationFileName, + isDecorator, + isExportDeclaration, + isExternalModule, + isExternalModuleNameRelative, + isIdentifierText, + isImportCall, + isImportDeclaration, + isImportEqualsDeclaration, + isImportSpecifier, + isImportTypeNode, + isIncrementalCompilation, + isInJSFile, + isLiteralImportTypeNode, + isModifier, + isModuleDeclaration, + isObjectLiteralExpression, + isPlainJsFile, + isRequireCall, + isRootedDiskPath, + isSourceFileJS, + isString, + isStringLiteral, + isStringLiteralLike, + isTraceEnabled, + JsonSourceFile, + JsxEmit, + length, + libMap, + libs, + mapDefined, + mapDefinedIterator, + maybeBind, + memoize, + MethodDeclaration, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + moduleResolutionIsEqualTo, + ModuleResolutionKind, + Mutable, + Node, + NodeArray, + NodeFlags, + nodeModulesPathPart, + NodeWithTypeArguments, + noop, + normalizePath, + notImplementedResolver, + noTransformers, + ObjectLiteralExpression, + OperationCanceledException, + optionsHaveChanges, + outFile, + PackageId, + packageIdToPackageName, + packageIdToString, + PackageJsonInfoCache, + padLeft, + ParameterDeclaration, + ParseConfigFileHost, + ParsedCommandLine, + parseIsolatedEntityName, + parseJsonSourceFileConfigFileContent, + Path, + pathIsAbsolute, + pathIsRelative, + Program, + ProgramHost, + ProjectReference, + ProjectReferenceFile, + projectReferenceIsEqualTo, + PropertyDeclaration, + ReferencedFile, + removeFileExtension, + removePrefix, + removeSuffix, + resolutionExtensionIsTSOrJson, + ResolutionMode, + resolveConfigFileProjectName, + ResolvedConfigFileName, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + resolveModuleName, + resolveModuleNameFromCache, + resolveTypeReferenceDirective, + returnFalse, + returnUndefined, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + setParent, + setParentRecursive, + setResolvedModule, + setResolvedTypeReferenceDirective, + skipTrivia, + skipTypeChecking, + some, + sortAndDeduplicateDiagnostics, + SortedReadonlyArray, + SourceFile, + sourceFileAffectingCompilerOptions, + sourceFileMayBeEmitted, + SourceOfProjectReferenceRedirect, + stableSort, + startsWith, + Statement, + stringContains, + StringLiteral, + StringLiteralLike, + StructureIsReused, + supportedJSExtensionsFlat, + SymlinkCache, + SyntaxKind, + sys, + targetOptionDeclaration, + toFileNameLowerCase, + tokenToString, + trace, + tracing, + trimStringEnd, + TsConfigSourceFile, + TypeChecker, + typeDirectiveIsEqualTo, + TypeReferenceDirectiveResolutionCache, + TypeReferenceDirectiveResolutionInfo, + UnparsedSource, + VariableDeclaration, + VariableStatement, + walkUpParenthesizedExpressions, + WriteFileCallback, + WriteFileCallbackData, + writeFileEnsuringDirectories, + zipToModeAwareCache, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index ab3d8a880ec91..f63ecc8773fb7 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,21 +1,90 @@ import * as ts from "./_namespaces/ts"; import { - arrayToMap, CachedDirectoryStructureHost, CacheWithRedirects, CharacterCodes, clearMap, closeFileWatcher, - closeFileWatcherOf, CompilerOptions, contains, createCacheWithRedirects, createModeAwareCache, - createModuleResolutionCache, createMultiMap, createTypeReferenceDirectiveResolutionCache, Debug, Diagnostics, - directorySeparator, DirectoryWatcherCallback, emptyArray, emptyIterator, endsWith, Extension, extensionIsTS, - fileExtensionIs, fileExtensionIsOneOf, FileReference, FileWatcher, FileWatcherCallback, firstDefinedIterator, - GetCanonicalFileName, getDirectoryPath, getEffectiveTypeRoots, getModeForFileReference, getModeForResolutionAtIndex, - getModeForUsageLocation, getNormalizedAbsolutePath, getResolutionName, getRootLength, HasInvalidatedResolutions, - ignoredPaths, inferredTypesContainingFile, isEmittedFileOfProgram, isExternalModuleNameRelative, - isExternalOrCommonJsModule, isNodeModulesDirectory, isRootedDiskPath, isString, isStringLiteralLike, isTraceEnabled, - length, loadModuleFromGlobalCache, memoize, MinimalResolutionCacheHost, ModeAwareCache, - ModuleResolutionCache, ModuleResolutionHost, ModuleResolutionInfo, mutateMap, noopFileWatcher, normalizePath, - PackageId, packageIdToString, parseNodeModuleFromPath, Path, pathContainsNodeModules, PerModuleNameCache, Program, - removeSuffix, removeTrailingDirectorySeparator, resolutionExtensionIsTSOrJson, ResolutionMode, ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, returnTrue, some, SourceFile, startsWith, - stringContains, trace, TypeReferenceDirectiveResolutionInfo, unorderedRemoveItem, WatchDirectoryFlags, + arrayToMap, + CachedDirectoryStructureHost, + CacheWithRedirects, + CharacterCodes, + clearMap, + closeFileWatcher, + closeFileWatcherOf, + CompilerOptions, + contains, + createCacheWithRedirects, + createModeAwareCache, + createModuleResolutionCache, + createMultiMap, + createTypeReferenceDirectiveResolutionCache, + Debug, + Diagnostics, + directorySeparator, + DirectoryWatcherCallback, + emptyArray, + emptyIterator, + endsWith, + Extension, + extensionIsTS, + fileExtensionIs, + fileExtensionIsOneOf, + FileReference, + FileWatcher, + FileWatcherCallback, + firstDefinedIterator, + GetCanonicalFileName, + getDirectoryPath, + getEffectiveTypeRoots, + getModeForFileReference, + getModeForResolutionAtIndex, + getModeForUsageLocation, + getNormalizedAbsolutePath, + getResolutionName, + getRootLength, + HasInvalidatedResolutions, + ignoredPaths, + inferredTypesContainingFile, + isEmittedFileOfProgram, + isExternalModuleNameRelative, + isExternalOrCommonJsModule, + isNodeModulesDirectory, + isRootedDiskPath, + isString, + isStringLiteralLike, + isTraceEnabled, + length, + loadModuleFromGlobalCache, + memoize, + MinimalResolutionCacheHost, + ModeAwareCache, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + mutateMap, + noopFileWatcher, + normalizePath, + PackageId, + packageIdToString, + parseNodeModuleFromPath, + Path, + pathContainsNodeModules, + PerModuleNameCache, + Program, + removeSuffix, + removeTrailingDirectorySeparator, + resolutionExtensionIsTSOrJson, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + returnTrue, + some, + SourceFile, + startsWith, + stringContains, + trace, + TypeReferenceDirectiveResolutionInfo, + unorderedRemoveItem, + WatchDirectoryFlags, } from "./_namespaces/ts"; /** diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 643df8727844c..bdb2fe6ef239e 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1,8 +1,31 @@ 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, trimStringStart, + 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, + trimStringStart, } from "./_namespaces/ts"; export type ErrorCallback = (message: DiagnosticMessage, length: number) => void; diff --git a/src/compiler/semver.ts b/src/compiler/semver.ts index c91595719b743..b9c5864c0c042 100644 --- a/src/compiler/semver.ts +++ b/src/compiler/semver.ts @@ -1,5 +1,14 @@ import { - compareStringsCaseSensitive, compareValues, Comparison, Debug, emptyArray, every, isArray, map, some, trimString, + compareStringsCaseSensitive, + compareValues, + Comparison, + Debug, + emptyArray, + every, + isArray, + map, + some, + trimString, } from "./_namespaces/ts"; // https://semver.org/#spec-item-2 diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 3c86ba8564dc2..baf87fdd594c6 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -1,9 +1,30 @@ import { - arrayFrom, binarySearchKey, CharacterCodes, combinePaths, compareValues, Debug, DocumentPosition, - DocumentPositionMapper, DocumentPositionMapperHost, EmitHost, emptyArray, every, getDirectoryPath, - getNormalizedAbsolutePath, getPositionOfLineAndCharacter, getRelativePathToDirectoryOrUrl, identity, isArray, - isString, LineAndCharacter, RawSourceMap, some, sortAndDeduplicate, SortedReadonlyArray, - SourceMapGenerator, trimStringEnd, + arrayFrom, + binarySearchKey, + CharacterCodes, + combinePaths, + compareValues, + Debug, + DocumentPosition, + DocumentPositionMapper, + DocumentPositionMapperHost, + EmitHost, + emptyArray, + every, + getDirectoryPath, + getNormalizedAbsolutePath, + getPositionOfLineAndCharacter, + getRelativePathToDirectoryOrUrl, + 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 71277f27d7d5c..591e19c8eb647 100644 --- a/src/compiler/symbolWalker.ts +++ b/src/compiler/symbolWalker.ts @@ -1,7 +1,29 @@ import { - clear, EntityNameOrEntityNameExpression, forEach, getOwnValues, getSymbolId, Identifier, IndexedAccessType, - IndexType, InterfaceType, MappedType, Node, ObjectFlags, ObjectType, ResolvedType, Signature, Symbol, SymbolWalker, - SyntaxKind, Type, TypeFlags, TypeParameter, TypePredicate, TypeQueryNode, TypeReference, UnionOrIntersectionType, + clear, + EntityNameOrEntityNameExpression, + forEach, + getOwnValues, + getSymbolId, + Identifier, + IndexedAccessType, + IndexType, + InterfaceType, + MappedType, + Node, + ObjectFlags, + ObjectType, + ResolvedType, + Signature, + Symbol, + SymbolWalker, + SyntaxKind, + Type, + TypeFlags, + TypeParameter, + TypePredicate, + TypeQueryNode, + TypeReference, + UnionOrIntersectionType, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 31df7422cd14e..ba707330ffeee 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,11 +1,51 @@ import { - AssertionLevel, closeFileWatcher, closeFileWatcherOf, combinePaths, Comparison, contains, containsPath, - createGetCanonicalFileName, createMultiMap, Debug, directorySeparator, emptyArray, emptyFileSystemEntries, endsWith, - enumerateInsertsAndDeletes, FileSystemEntries, getDirectoryPath, getFallbackOptions, - getNormalizedAbsolutePath, getRelativePathToDirectoryOrUrl, getRootLength, getStringComparer, isArray, isNodeLikeSystem, isString, - mapDefined, matchesExclude, matchFiles, memoize, noop, normalizePath, normalizeSlashes, orderedRemoveItem, - Path, perfLogger, PollingWatchKind, RequireResult, resolveJSModule, some, startsWith, stringContains, timestamp, - unorderedRemoveItem, WatchDirectoryKind, WatchFileKind, WatchOptions, writeFileEnsuringDirectories, + AssertionLevel, + closeFileWatcher, + closeFileWatcherOf, + combinePaths, + Comparison, + contains, + containsPath, + createGetCanonicalFileName, + createMultiMap, + Debug, + directorySeparator, + emptyArray, + emptyFileSystemEntries, + endsWith, + enumerateInsertsAndDeletes, + FileSystemEntries, + getDirectoryPath, + getFallbackOptions, + getNormalizedAbsolutePath, + getRelativePathToDirectoryOrUrl, + getRootLength, + getStringComparer, + isArray, + isNodeLikeSystem, + isString, + mapDefined, + matchesExclude, + matchFiles, + memoize, + noop, + normalizePath, + normalizeSlashes, + orderedRemoveItem, + Path, + perfLogger, + PollingWatchKind, + RequireResult, + resolveJSModule, + some, + startsWith, + stringContains, + timestamp, + unorderedRemoveItem, + WatchDirectoryKind, + WatchFileKind, + WatchOptions, + writeFileEnsuringDirectories, } from "./_namespaces/ts"; declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index f53b477c5dac4..4f091195827a8 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -1,7 +1,25 @@ import { - combinePaths, ConditionalType, Debug, EvolvingArrayType, getLineAndCharacterOfPosition, getSourceFileOfNode, - IndexedAccessType, IndexType, IntersectionType, LineAndCharacter, Node, ObjectFlags, Path, ReverseMappedType, - SubstitutionType, timestamp, Type, TypeFlags, TypeReference, unescapeLeadingUnderscores, UnionType, + combinePaths, + ConditionalType, + Debug, + EvolvingArrayType, + getLineAndCharacterOfPosition, + getSourceFileOfNode, + IndexedAccessType, + IndexType, + IntersectionType, + LineAndCharacter, + Node, + ObjectFlags, + Path, + ReverseMappedType, + SubstitutionType, + timestamp, + Type, + TypeFlags, + TypeReference, + unescapeLeadingUnderscores, + UnionType, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 72cc5fde5ad36..456a23a065577 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,14 +1,75 @@ import { - addRange, append, Bundle, chainBundle, CompilerOptions, createEmitHelperFactory, CustomTransformer, - CustomTransformerFactory, CustomTransformers, Debug, DiagnosticWithLocation, disposeEmitNodes, EmitFlags, - EmitHelper, EmitHint, EmitHost, EmitOnly, EmitResolver, EmitTransformers, 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, transformES2018, - transformES2019, transformES2020, transformES2021, transformES5, transformESNext, transformGenerators, transformJsx, - transformLegacyDecorators, transformModule, transformNodeModule, transformSystemModule, transformTypeScript, + addRange, + append, + Bundle, + chainBundle, + CompilerOptions, + createEmitHelperFactory, + CustomTransformer, + CustomTransformerFactory, + CustomTransformers, + Debug, + DiagnosticWithLocation, + disposeEmitNodes, + EmitFlags, + EmitHelper, + EmitHint, + EmitHost, + EmitOnly, + EmitResolver, + EmitTransformers, + 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, + transformES2018, + transformES2019, + transformES2020, + transformES2021, + transformES5, + transformESNext, + transformGenerators, + transformJsx, + transformLegacyDecorators, + transformModule, + 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 e007a7d7475a8..239a7e125453d 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -1,39 +1,175 @@ import { - __String, AccessorDeclaration, addEmitFlags, addEmitHelpers, addRange, append, AssignmentOperator, - AssignmentPattern, AutoAccessorPropertyDeclaration, BinaryExpression, BindingOrAssignmentElement, 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, getCommentRange, - getEffectiveBaseTypeNode, getEmitFlags, getEmitScriptTarget, getInitializerOfBindingOrAssignmentElement, - getNameOfDeclaration, getNodeForGeneratedName, getNonAssignmentOperatorForCompoundAssignment, getOriginalNode, - getOriginalNodeId, getProperties, getSourceMapRange, getStaticPropertiesAndClassStaticBlock, - getTargetOfBindingOrAssignmentElement, getUseDefineForClassFields, hasAbstractModifier, hasAccessorModifier, - hasDecorators, hasStaticModifier, hasSyntacticModifier, Identifier, InKeyword, isAccessorModifier, - isArrayLiteralExpression, isArrowFunction, isAssignmentExpression, isAutoAccessorPropertyDeclaration, isCallChain, - isClassDeclaration, isClassElement, isClassStaticBlockDeclaration, isCompoundAssignment, isComputedPropertyName, - isConstructorDeclaration, isDestructuringAssignment, isElementAccessExpression, isExpression, isForInitializer, - isGeneratedIdentifier, isGeneratedPrivateIdentifier, isGetAccessor, isGetAccessorDeclaration, isHeritageClause, - isIdentifier, isInitializedProperty, isMethodDeclaration, isModifier, isModifierLike, - isNonStaticMethodOrAccessorWithPrivateName, isObjectBindingOrAssignmentElement, isObjectLiteralElementLike, - isParameterPropertyDeclaration, isParenthesizedExpression, isPrefixUnaryExpression, isPrivateIdentifier, - isPrivateIdentifierClassElementDeclaration, isPrivateIdentifierPropertyAccessExpression, isPropertyAccessExpression, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isSetAccessor, isSetAccessorDeclaration, - isShorthandPropertyAssignment, isSimpleCopiableExpression, isSimpleInlineableExpression, isSpreadAssignment, - isSpreadElement, isStatement, isStatic, isStaticModifier, 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, setSourceMapRange, setSyntheticLeadingComments, setSyntheticTrailingComments, - setTextRange, skipOuterExpressions, skipParentheses, skipPartiallyEmittedExpressions, some, SourceFile, - startOnNewLine, Statement, SuperProperty, SyntaxKind, TaggedTemplateExpression, ThisExpression, - TransformationContext, TransformFlags, tryGetTextOfPropertyName, UnderscoreEscapedMap, unescapeLeadingUnderscores, - VariableStatement, visitArray, visitEachChild, visitFunctionBody, visitIterationBody, visitNode, visitNodes, - visitParameterList, VisitResult, Bundle, + __String, + AccessorDeclaration, + addEmitFlags, + addEmitHelpers, + addRange, + append, + AssignmentOperator, + AssignmentPattern, + AutoAccessorPropertyDeclaration, + BinaryExpression, + 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, + getCommentRange, + getEffectiveBaseTypeNode, + getEmitFlags, + getEmitScriptTarget, + getInitializerOfBindingOrAssignmentElement, + getNameOfDeclaration, + getNodeForGeneratedName, + getNonAssignmentOperatorForCompoundAssignment, + getOriginalNode, + getOriginalNodeId, + getProperties, + getSourceMapRange, + getStaticPropertiesAndClassStaticBlock, + getTargetOfBindingOrAssignmentElement, + getUseDefineForClassFields, + hasAbstractModifier, + hasAccessorModifier, + hasDecorators, + hasStaticModifier, + hasSyntacticModifier, + Identifier, + InKeyword, + isAccessorModifier, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentExpression, + isAutoAccessorPropertyDeclaration, + isCallChain, + isClassDeclaration, + isClassElement, + isClassStaticBlockDeclaration, + isCompoundAssignment, + isComputedPropertyName, + isConstructorDeclaration, + isDestructuringAssignment, + isElementAccessExpression, + isExpression, + isForInitializer, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isGetAccessor, + isGetAccessorDeclaration, + isHeritageClause, + isIdentifier, + isInitializedProperty, + isMethodDeclaration, + isModifier, + isModifierLike, + isNonStaticMethodOrAccessorWithPrivateName, + isObjectBindingOrAssignmentElement, + isObjectLiteralElementLike, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPrivateIdentifierPropertyAccessExpression, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isSetAccessor, + isSetAccessorDeclaration, + isShorthandPropertyAssignment, + isSimpleCopiableExpression, + isSimpleInlineableExpression, + isSpreadAssignment, + isSpreadElement, + isStatement, + isStatic, + isStaticModifier, + 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, + setSourceMapRange, + setSyntheticLeadingComments, + setSyntheticTrailingComments, + setTextRange, + skipOuterExpressions, + skipParentheses, + skipPartiallyEmittedExpressions, + some, + SourceFile, + startOnNewLine, + Statement, + SuperProperty, + SyntaxKind, + TaggedTemplateExpression, + ThisExpression, + TransformationContext, + TransformFlags, + tryGetTextOfPropertyName, + UnderscoreEscapedMap, + unescapeLeadingUnderscores, + VariableStatement, + visitArray, + visitEachChild, + visitFunctionBody, + visitIterationBody, + 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 2a4f521e8881f..a150c9204659e 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,43 +1,215 @@ import { - AccessorDeclaration, addRelatedInfo, AllAccessorDeclarations, AnyImportSyntax, append, ArrayBindingElement, - arrayFrom, AssertClause, BindingElement, BindingName, BindingPattern, Bundle, CallSignatureDeclaration, - canHaveModifiers, canProduceDiagnostics, ClassDeclaration, CommentRange, compact, concatenate, ConditionalTypeNode, - ConstructorDeclaration, ConstructorTypeNode, ConstructSignatureDeclaration, contains, createDiagnosticForNode, - createEmptyExports, createGetSymbolAccessibilityDiagnosticForNode, - createGetSymbolAccessibilityDiagnosticForNodeName, createSymbolTable, createUnparsedSourceFile, Debug, Declaration, - DeclarationDiagnosticProducing, DeclarationName, declarationNameToString, Diagnostics, DiagnosticWithLocation, - EmitFlags, EmitHost, EmitResolver, emptyArray, EntityNameOrEntityNameExpression, EnumDeclaration, - ExportAssignment, ExportDeclaration, ExpressionWithTypeArguments, factory, FileReference, filter, flatMap, flatten, - forEach, FunctionDeclaration, FunctionTypeNode, GeneratedIdentifierFlags, GetAccessorDeclaration, getCommentRange, - getDirectoryPath, getEffectiveBaseTypeNode, getEffectiveModifierFlags, - getExternalModuleImportEqualsDeclarationExpression, getExternalModuleNameFromDeclaration, - getFirstConstructorWithBody, getLeadingCommentRanges, getLeadingCommentRangesOfNode, getLineAndCharacterOfPosition, - getNameOfDeclaration, getOriginalNodeId, getOutputPathsFor, getParseTreeNode, getRelativePathToDirectoryOrUrl, - getResolutionModeOverrideForClause, getResolvedExternalModuleName, getSetAccessorValueParameter, - getSourceFileOfNode, GetSymbolAccessibilityDiagnostic, getTextOfNode, getThisParameter, getTrailingCommentRanges, - hasDynamicName, hasEffectiveModifier, hasExtension, hasJSDocNodes, HasModifiers, hasSyntacticModifier, - HeritageClause, Identifier, ImportDeclaration, ImportEqualsDeclaration, ImportTypeNode, IndexSignatureDeclaration, - InterfaceDeclaration, isAnyImportSyntax, isArray, isBindingPattern, isClassDeclaration, isDeclaration, isEntityName, - isEntityNameExpression, isExportAssignment, isExportDeclaration, isExternalModule, isExternalModuleAugmentation, - isExternalModuleIndicator, isExternalModuleReference, isExternalOrCommonJsModule, isFunctionDeclaration, - isFunctionLike, isGlobalScopeAugmentation, isIdentifier, isImportDeclaration, isImportEqualsDeclaration, - isIndexSignatureDeclaration, isInterfaceDeclaration, isJsonSourceFile, isLateVisibilityPaintedStatement, - isLiteralImportTypeNode, isMappedTypeNode, isMethodDeclaration, isMethodSignature, isModifier, isModuleDeclaration, - isNightly, isOmittedExpression, isPrivateIdentifier, isPropertyAccessExpression, isPropertySignature, - isSemicolonClassElement, isSetAccessorDeclaration, isSourceFile, isSourceFileJS, isSourceFileNotJson, - isStringANonContextualKeyword, isStringLiteral, isStringLiteralLike, isTupleTypeNode, isTypeAliasDeclaration, - isTypeNode, isTypeParameterDeclaration, 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, + AccessorDeclaration, + addRelatedInfo, + AllAccessorDeclarations, + AnyImportSyntax, + append, + ArrayBindingElement, + arrayFrom, + AssertClause, + BindingElement, + BindingName, + BindingPattern, + Bundle, + CallSignatureDeclaration, + canHaveModifiers, + canProduceDiagnostics, + ClassDeclaration, + CommentRange, + compact, + concatenate, + ConditionalTypeNode, + ConstructorDeclaration, + ConstructorTypeNode, + ConstructSignatureDeclaration, + contains, + createDiagnosticForNode, + createEmptyExports, + createGetSymbolAccessibilityDiagnosticForNode, + createGetSymbolAccessibilityDiagnosticForNodeName, + createSymbolTable, + createUnparsedSourceFile, + Debug, + Declaration, + DeclarationDiagnosticProducing, + DeclarationName, + declarationNameToString, + Diagnostics, + DiagnosticWithLocation, + EmitFlags, + EmitHost, + EmitResolver, + emptyArray, + EntityNameOrEntityNameExpression, + EnumDeclaration, + ExportAssignment, + ExportDeclaration, + ExpressionWithTypeArguments, + factory, + FileReference, + filter, + flatMap, + flatten, + forEach, + FunctionDeclaration, + FunctionTypeNode, + GeneratedIdentifierFlags, + GetAccessorDeclaration, + getCommentRange, + getDirectoryPath, + getEffectiveBaseTypeNode, + getEffectiveModifierFlags, + getExternalModuleImportEqualsDeclarationExpression, + getExternalModuleNameFromDeclaration, + getFirstConstructorWithBody, + getLeadingCommentRanges, + getLeadingCommentRangesOfNode, + getLineAndCharacterOfPosition, + getNameOfDeclaration, + getOriginalNodeId, + getOutputPathsFor, + getParseTreeNode, + getRelativePathToDirectoryOrUrl, + getResolutionModeOverrideForClause, + getResolvedExternalModuleName, + getSetAccessorValueParameter, + getSourceFileOfNode, + GetSymbolAccessibilityDiagnostic, + getTextOfNode, + getThisParameter, + getTrailingCommentRanges, + hasDynamicName, + hasEffectiveModifier, + hasExtension, + hasJSDocNodes, + HasModifiers, + hasSyntacticModifier, + HeritageClause, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportTypeNode, + IndexSignatureDeclaration, + InterfaceDeclaration, + isAnyImportSyntax, + isArray, + isBindingPattern, + isClassDeclaration, + isDeclaration, + isEntityName, + isEntityNameExpression, + isExportAssignment, + isExportDeclaration, + isExternalModule, + isExternalModuleAugmentation, + isExternalModuleIndicator, + isExternalModuleReference, + isExternalOrCommonJsModule, + isFunctionDeclaration, + isFunctionLike, + isGlobalScopeAugmentation, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isJsonSourceFile, + isLateVisibilityPaintedStatement, + isLiteralImportTypeNode, + isMappedTypeNode, + isMethodDeclaration, + isMethodSignature, + isModifier, + isModuleDeclaration, + isNightly, + isOmittedExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertySignature, + isSemicolonClassElement, + isSetAccessorDeclaration, + isSourceFile, + isSourceFileJS, + isSourceFileNotJson, + isStringANonContextualKeyword, + isStringLiteral, + isStringLiteralLike, + isTupleTypeNode, + isTypeAliasDeclaration, + isTypeNode, + isTypeParameterDeclaration, + 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 bdd9903796ea4..021a372123072 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -1,16 +1,63 @@ import { - BindingElement, CallSignatureDeclaration, ConstructorDeclaration, ConstructSignatureDeclaration, Debug, Declaration, - DeclarationName, DiagnosticMessage, Diagnostics, ExpressionWithTypeArguments, FunctionDeclaration, - GetAccessorDeclaration, getNameOfDeclaration, hasSyntacticModifier, ImportEqualsDeclaration, - IndexSignatureDeclaration, isBindingElement, isCallSignatureDeclaration, isClassDeclaration, - isConstructorDeclaration, isConstructSignatureDeclaration, isExpressionWithTypeArguments, isFunctionDeclaration, - isGetAccessor, isHeritageClause, isImportEqualsDeclaration, isIndexSignatureDeclaration, isJSDocTypeAlias, - isMethodDeclaration, isMethodSignature, isParameter, isParameterPropertyDeclaration, isPropertyAccessExpression, - isPropertyDeclaration, isPropertySignature, isSetAccessor, isStatic, isTypeAliasDeclaration, - isTypeParameterDeclaration, isVariableDeclaration, JSDocCallbackTag, JSDocEnumTag, JSDocTypedefTag, - MethodDeclaration, MethodSignature, ModifierFlags, NamedDeclaration, Node, ParameterDeclaration, - PropertyAccessExpression, PropertyDeclaration, PropertySignature, QualifiedName, SetAccessorDeclaration, - SymbolAccessibility, SymbolAccessibilityResult, SyntaxKind, TypeAliasDeclaration, TypeParameterDeclaration, + BindingElement, + CallSignatureDeclaration, + ConstructorDeclaration, + ConstructSignatureDeclaration, + Debug, + Declaration, + DeclarationName, + DiagnosticMessage, + Diagnostics, + ExpressionWithTypeArguments, + FunctionDeclaration, + GetAccessorDeclaration, + getNameOfDeclaration, + hasSyntacticModifier, + ImportEqualsDeclaration, + IndexSignatureDeclaration, + isBindingElement, + isCallSignatureDeclaration, + isClassDeclaration, + isConstructorDeclaration, + isConstructSignatureDeclaration, + isExpressionWithTypeArguments, + isFunctionDeclaration, + isGetAccessor, + isHeritageClause, + isImportEqualsDeclaration, + isIndexSignatureDeclaration, + isJSDocTypeAlias, + isMethodDeclaration, + isMethodSignature, + isParameter, + isParameterPropertyDeclaration, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertySignature, + isSetAccessor, + isStatic, + isTypeAliasDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, + JSDocCallbackTag, + JSDocEnumTag, + JSDocTypedefTag, + MethodDeclaration, + MethodSignature, + ModifierFlags, + NamedDeclaration, + Node, + ParameterDeclaration, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + QualifiedName, + SetAccessorDeclaration, + SymbolAccessibility, + SymbolAccessibilityResult, + SyntaxKind, + TypeAliasDeclaration, + TypeParameterDeclaration, VariableDeclaration, } from "../../_namespaces/ts"; diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index b4f4739a803bd..2effd35cfc65f 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -1,17 +1,65 @@ import { - __String, addRange, append, ArrayBindingElement, ArrayBindingOrAssignmentPattern, BindingElement, BindingName, - BindingOrAssignmentElement, BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, Debug, - DestructuringAssignment, ElementAccessExpression, every, Expression, factory, forEach, - getElementsOfBindingOrAssignmentPattern, getInitializerOfBindingOrAssignmentElement, - getPropertyNameOfBindingOrAssignmentElement, getRestIndicatorOfBindingOrAssignmentElement, - getTargetOfBindingOrAssignmentElement, Identifier, idText, isArrayBindingElement, isArrayBindingOrAssignmentPattern, - isBindingElement, isBindingName, isBindingOrAssignmentPattern, isComputedPropertyName, isDeclarationBindingElement, - isDestructuringAssignment, isEmptyArrayLiteral, isEmptyObjectLiteral, isExpression, isIdentifier, - isLiteralExpression, isObjectBindingOrAssignmentPattern, isOmittedExpression, isPropertyNameLiteral, - isSimpleInlineableExpression, isStringOrNumericLiteralLike, isVariableDeclaration, last, LeftHandSideExpression, - map, Node, NodeFactory, nodeIsSynthesized, ObjectBindingOrAssignmentPattern, ParameterDeclaration, PropertyName, - setTextRange, some, TextRange, TransformationContext, TransformFlags, - tryGetPropertyNameOfBindingOrAssignmentElement, VariableDeclaration, visitNode, VisitResult, + __String, + addRange, + append, + ArrayBindingElement, + ArrayBindingOrAssignmentPattern, + BindingElement, + BindingName, + BindingOrAssignmentElement, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + Debug, + DestructuringAssignment, + ElementAccessExpression, + every, + Expression, + factory, + forEach, + getElementsOfBindingOrAssignmentPattern, + getInitializerOfBindingOrAssignmentElement, + getPropertyNameOfBindingOrAssignmentElement, + getRestIndicatorOfBindingOrAssignmentElement, + getTargetOfBindingOrAssignmentElement, + Identifier, + idText, + isArrayBindingElement, + isArrayBindingOrAssignmentPattern, + isBindingElement, + isBindingName, + isBindingOrAssignmentPattern, + isComputedPropertyName, + isDeclarationBindingElement, + isDestructuringAssignment, + isEmptyArrayLiteral, + isEmptyObjectLiteral, + isExpression, + isIdentifier, + isLiteralExpression, + isObjectBindingOrAssignmentPattern, + isOmittedExpression, + isPropertyNameLiteral, + isSimpleInlineableExpression, + 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 7168440df8da1..3c5fc93adb0fd 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1,39 +1,209 @@ import { - __String, AccessorDeclaration, addEmitHelpers, addRange, addSyntheticLeadingComment, AllAccessorDeclarations, - append, arrayIsEqualTo, ArrayLiteralExpression, ArrowFunction, BinaryExpression, BindingElement, BindingPattern, - Block, BreakOrContinueStatement, 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, - ForStatement, FunctionBody, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, - GeneratedIdentifierFlags, getAllAccessorDeclarations, getClassExtendsHeritageElement, getCombinedNodeFlags, - getCommentRange, getEmitFlags, getEnclosingBlockScopeContainer, getFirstConstructorWithBody, getNameOfDeclaration, - getOriginalNode, getParseTreeNode, getSourceMapRange, getSuperCallFromStatement, getUseDefineForClassFields, - hasStaticModifier, hasSyntacticModifier, Identifier, idText, IfStatement, insertStatementAfterCustomPrologue, - insertStatementsAfterCustomPrologue, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, - isArrowFunction, isAssignmentExpression, isBinaryExpression, isBindingPattern, isBlock, isCallExpression, - isCallToHelper, isCaseBlock, isCaseClause, isCatchClause, isClassElement, isClassLike, isComputedPropertyName, - isDefaultClause, isDestructuringAssignment, isExpression, isExpressionStatement, isForInitializer, isForStatement, - isFunctionExpression, isFunctionLike, isHoistedFunction, isHoistedVariableStatement, isIdentifier, - isIdentifierANonContextualKeyword, isIfStatement, isInternalName, isIterationStatement, isLabeledStatement, - isModifier, isObjectLiteralElementLike, isOmittedExpression, isPackedArrayLiteral, isPrivateIdentifier, - isPrologueDirective, isPropertyDeclaration, isPropertyName, isReturnStatement, isSpreadElement, isStatement, - isStatic, isSuperProperty, isSwitchStatement, isTryStatement, 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, setParent, setSourceMapRange, setTextRange, 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, Bundle, + __String, + AccessorDeclaration, + addEmitHelpers, + addRange, + addSyntheticLeadingComment, + AllAccessorDeclarations, + append, + arrayIsEqualTo, + ArrayLiteralExpression, + ArrowFunction, + BinaryExpression, + BindingElement, + BindingPattern, + Block, + BreakOrContinueStatement, + Bundle, + 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, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + getAllAccessorDeclarations, + getClassExtendsHeritageElement, + getCombinedNodeFlags, + getCommentRange, + getEmitFlags, + getEnclosingBlockScopeContainer, + getFirstConstructorWithBody, + getNameOfDeclaration, + getOriginalNode, + getParseTreeNode, + getSourceMapRange, + getSuperCallFromStatement, + getUseDefineForClassFields, + hasStaticModifier, + hasSyntacticModifier, + Identifier, + idText, + IfStatement, + insertStatementAfterCustomPrologue, + insertStatementsAfterCustomPrologue, + insertStatementsAfterStandardPrologue, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentExpression, + isBinaryExpression, + isBindingPattern, + isBlock, + isCallExpression, + isCallToHelper, + isCaseBlock, + isCaseClause, + isCatchClause, + isClassElement, + isClassLike, + isComputedPropertyName, + isDefaultClause, + isDestructuringAssignment, + isExpression, + isExpressionStatement, + isForInitializer, + isForStatement, + isFunctionExpression, + isFunctionLike, + isHoistedFunction, + isHoistedVariableStatement, + isIdentifier, + isIdentifierANonContextualKeyword, + isIfStatement, + isInternalName, + isIterationStatement, + isLabeledStatement, + isModifier, + isObjectLiteralElementLike, + isOmittedExpression, + isPackedArrayLiteral, + isPrivateIdentifier, + isPrologueDirective, + isPropertyDeclaration, + isPropertyName, + isReturnStatement, + isSpreadElement, + isStatement, + isStatic, + isSuperProperty, + isSwitchStatement, + isTryStatement, + 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, + setParent, + setSourceMapRange, + setTextRange, + 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 ca3bbbb980432..33df5b94f0d0b 100644 --- a/src/compiler/transformers/es2016.ts +++ b/src/compiler/transformers/es2016.ts @@ -1,6 +1,19 @@ import { - BinaryExpression, Bundle, chainBundle, Expression, isElementAccessExpression, isExpression, isPropertyAccessExpression, - Node, setTextRange, SourceFile, SyntaxKind, TransformationContext, TransformFlags, visitEachChild, visitNode, + BinaryExpression, + Bundle, + chainBundle, + Expression, + isElementAccessExpression, + isExpression, + isPropertyAccessExpression, + Node, + setTextRange, + SourceFile, + SyntaxKind, + TransformationContext, + TransformFlags, + visitEachChild, + visitNode, VisitResult, } from "../_namespaces/ts"; diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 47a55560d5bf7..2087eca6c45af 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -1,20 +1,100 @@ import { - __String, AccessorDeclaration, addEmitHelper, addEmitHelpers, advancedAsyncSuperHelper, ArrowFunction, - asyncSuperHelper, AwaitExpression, BindingElement, Block, CallExpression, CatchClause, chainBundle, - ClassDeclaration, concatenate, ConciseBody, ConstructorDeclaration, Debug, ElementAccessExpression, EmitFlags, - EmitHint, EmitResolver, Expression, forEach, ForInitializer, ForInStatement, ForOfStatement, ForStatement, - FunctionBody, FunctionDeclaration, FunctionExpression, FunctionFlags, FunctionLikeDeclaration, - GeneratedIdentifierFlags, GetAccessorDeclaration, getEmitScriptTarget, getEntityNameFromTypeNode, getFunctionFlags, - getInitializedVariables, getNodeId, getOriginalNode, insertStatementsAfterStandardPrologue, isBlock, isConciseBody, - isEffectiveStrictModeSourceFile, isEntityName, isExpression, isForInitializer, isFunctionLike, - isFunctionLikeDeclaration, isIdentifier, isModifierLike, isNodeWithPossibleHoistedDeclaration, isOmittedExpression, - isPropertyAccessExpression, isStatement, 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, Bundle, + __String, + AccessorDeclaration, + addEmitHelper, + addEmitHelpers, + advancedAsyncSuperHelper, + ArrowFunction, + asyncSuperHelper, + AwaitExpression, + BindingElement, + Block, + Bundle, + CallExpression, + CatchClause, + chainBundle, + ClassDeclaration, + concatenate, + ConciseBody, + ConstructorDeclaration, + Debug, + ElementAccessExpression, + EmitFlags, + EmitHint, + EmitResolver, + Expression, + forEach, + ForInitializer, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + GetAccessorDeclaration, + getEmitScriptTarget, + getEntityNameFromTypeNode, + getFunctionFlags, + getInitializedVariables, + getNodeId, + getOriginalNode, + insertStatementsAfterStandardPrologue, + isBlock, + isConciseBody, + isEffectiveStrictModeSourceFile, + isEntityName, + isExpression, + isForInitializer, + isFunctionLike, + isFunctionLikeDeclaration, + isIdentifier, + isModifierLike, + isNodeWithPossibleHoistedDeclaration, + isOmittedExpression, + isPropertyAccessExpression, + isStatement, + 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 7ef8dab1b6c4d..296cfaeae2fca 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -1,23 +1,115 @@ import { - __String, AccessorDeclaration, addEmitFlags, addEmitHelper, addEmitHelpers, addRange, advancedAsyncSuperHelper, - append, ArrowFunction, asyncSuperHelper, AwaitExpression, BinaryExpression, CallExpression, CatchClause, - chainBundle, CommaListExpression, concatenate, ConciseBody, ConstructorDeclaration, createForOfBindingStatement, - createSuperAccessVariableStatement, Debug, ElementAccessExpression, EmitFlags, EmitHint, Expression, - ExpressionStatement, flattenDestructuringAssignment, flattenDestructuringBinding, FlattenLevel, ForInitializer, - ForOfStatement, ForStatement, FunctionBody, FunctionDeclaration, FunctionExpression, FunctionFlags, - FunctionLikeDeclaration, GeneratedIdentifierFlags, GetAccessorDeclaration, getEmitScriptTarget, getFunctionFlags, - getNodeId, hasSyntacticModifier, Identifier, insertStatementsAfterStandardPrologue, isAssignmentPattern, - isBindingPattern, isBlock, isConciseBody, isDestructuringAssignment, isEffectiveStrictModeSourceFile, isExpression, - isForInitializer, isIdentifier, isModifier, isModifierLike, isObjectLiteralElementLike, isParameter, - isPropertyAccessExpression, isPropertyName, isStatement, 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, Bundle, + __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, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + GetAccessorDeclaration, + getEmitScriptTarget, + getFunctionFlags, + getNodeId, + hasSyntacticModifier, + Identifier, + insertStatementsAfterStandardPrologue, + isAssignmentPattern, + isBindingPattern, + isBlock, + isConciseBody, + isDestructuringAssignment, + isEffectiveStrictModeSourceFile, + isExpression, + isForInitializer, + isIdentifier, + isModifier, + isModifierLike, + isObjectLiteralElementLike, + isParameter, + isPropertyAccessExpression, + isPropertyName, + isStatement, + 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 eaeb2f19d5381..0bd2be45422a4 100644 --- a/src/compiler/transformers/es2019.ts +++ b/src/compiler/transformers/es2019.ts @@ -1,7 +1,16 @@ import { Bundle, - CatchClause, chainBundle, isBlock, Node, SourceFile, SyntaxKind, TransformationContext, TransformFlags, - visitEachChild, visitNode, VisitResult, + CatchClause, + chainBundle, + isBlock, + Node, + SourceFile, + SyntaxKind, + TransformationContext, + TransformFlags, + visitEachChild, + visitNode, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2020.ts b/src/compiler/transformers/es2020.ts index ec48ca9433563..b030dca03ce5c 100644 --- a/src/compiler/transformers/es2020.ts +++ b/src/compiler/transformers/es2020.ts @@ -1,10 +1,41 @@ import { - AccessExpression, addEmitFlags, BinaryExpression, Bundle, CallExpression, cast, chainBundle, Debug, DeleteExpression, - EmitFlags, Expression, isCallChain, isExpression, isGeneratedIdentifier, isIdentifier, isNonNullChain, - isOptionalChain, isParenthesizedExpression, isSimpleCopiableExpression, isSyntheticReference, - isTaggedTemplateExpression, Node, OptionalChain, OuterExpressionKinds, ParenthesizedExpression, setOriginalNode, - setTextRange, skipParentheses, skipPartiallyEmittedExpressions, SourceFile, SyntaxKind, TransformationContext, - TransformFlags, visitEachChild, visitNode, visitNodes, VisitResult, + AccessExpression, + addEmitFlags, + BinaryExpression, + Bundle, + CallExpression, + cast, + chainBundle, + Debug, + DeleteExpression, + EmitFlags, + Expression, + isCallChain, + isExpression, + isGeneratedIdentifier, + isIdentifier, + isNonNullChain, + isOptionalChain, + isParenthesizedExpression, + 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 a63e4688a7244..c521cf00bc7f0 100644 --- a/src/compiler/transformers/es2021.ts +++ b/src/compiler/transformers/es2021.ts @@ -1,8 +1,25 @@ import { - AssignmentExpression, BinaryExpression, Bundle, chainBundle, getNonAssignmentOperatorForCompoundAssignment, - isAccessExpression, isExpression, isLeftHandSideExpression, isLogicalOrCoalescingAssignmentExpression, - isPropertyAccessExpression, isSimpleCopiableExpression, LogicalOrCoalescingAssignmentOperator, Node, - skipParentheses, SourceFile, SyntaxKind, Token, TransformationContext, TransformFlags, visitEachChild, visitNode, + AssignmentExpression, + BinaryExpression, + Bundle, + chainBundle, + getNonAssignmentOperatorForCompoundAssignment, + isAccessExpression, + isExpression, + isLeftHandSideExpression, + isLogicalOrCoalescingAssignmentExpression, + isPropertyAccessExpression, + isSimpleCopiableExpression, + LogicalOrCoalescingAssignmentOperator, + Node, + skipParentheses, + SourceFile, + SyntaxKind, + Token, + TransformationContext, + TransformFlags, + visitEachChild, + visitNode, VisitResult, } from "../_namespaces/ts"; diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts index 8dd340255a0e6..199cfa582327e 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -1,9 +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, + EmitHint, + Expression, + getOriginalNodeId, + Identifier, + idText, + isIdentifier, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + JsxClosingElement, + JsxEmit, + JsxOpeningElement, + JsxSelfClosingElement, + Node, + nodeIsSynthesized, + PropertyAccessExpression, + PropertyAssignment, + setTextRange, + SourceFile, + stringToToken, + SyntaxKind, + TransformationContext, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index 770153e4e62a5..730958dae1e00 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -1,6 +1,12 @@ import { Bundle, - chainBundle, Node, SourceFile, TransformationContext, TransformFlags, visitEachChild, VisitResult, + chainBundle, + Node, + SourceFile, + TransformationContext, + TransformFlags, + visitEachChild, + VisitResult, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 079e5b638ba73..86abe24d056d0 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -1,21 +1,100 @@ import { - AccessorDeclaration, addEmitHelpers, addSyntheticTrailingComment, ArrayLiteralExpression, Associativity, - BinaryExpression, Block, BreakStatement, Bundle, CallExpression, CaseClause, chainBundle, CommaListExpression, - ConditionalExpression, ContinueStatement, createExpressionForObjectLiteralElementLike, Debug, DoStatement, - ElementAccessExpression, EmitFlags, EmitHint, Expression, ExpressionStatement, forEach, ForInStatement, - ForStatement, FunctionDeclaration, FunctionExpression, getEmitFlags, getEmitScriptTarget, - getExpressionAssociativity, getInitializedVariables, getNonAssignmentOperatorForCompoundAssignment, getOriginalNode, - getOriginalNodeId, Identifier, idText, IfStatement, InitializedVariableDeclaration, - insertStatementsAfterStandardPrologue, isBinaryExpression, isBlock, isCompoundAssignment, isExpression, - isFunctionLikeDeclaration, isGeneratedIdentifier, isIdentifier, isImportCall, isLeftHandSideExpression, - isLogicalOperator, 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, + AccessorDeclaration, + addEmitHelpers, + addSyntheticTrailingComment, + ArrayLiteralExpression, + Associativity, + BinaryExpression, + Block, + BreakStatement, + Bundle, + CallExpression, + CaseClause, + chainBundle, + CommaListExpression, + ConditionalExpression, + ContinueStatement, + createExpressionForObjectLiteralElementLike, + Debug, + DoStatement, + ElementAccessExpression, + EmitFlags, + EmitHint, + Expression, + ExpressionStatement, + forEach, + ForInStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + getEmitFlags, + getEmitScriptTarget, + getExpressionAssociativity, + getInitializedVariables, + getNonAssignmentOperatorForCompoundAssignment, + getOriginalNode, + getOriginalNodeId, + Identifier, + idText, + IfStatement, + InitializedVariableDeclaration, + insertStatementsAfterStandardPrologue, + isBinaryExpression, + isBlock, + isCompoundAssignment, + isExpression, + isFunctionLikeDeclaration, + isGeneratedIdentifier, + isIdentifier, + isImportCall, + isLeftHandSideExpression, + isLogicalOperator, + 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 88fd9b5412a81..2dab57966eef6 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -1,16 +1,81 @@ import { - addEmitHelpers, arrayFrom, Bundle, chainBundle, createExpressionForJsxElement, createExpressionForJsxFragment, - createExpressionFromEntityName, createJsxFactoryExpression, Debug, emptyArray, Expression, filter, find, flatten, - GeneratedIdentifierFlags, getEmitScriptTarget, getEntries, getJSXImplicitImportBase, getJSXRuntimeImport, - getLineAndCharacterOfPosition, getOriginalNode, getSemanticJsxChildren, Identifier, idText, ImportSpecifier, - insertStatementAfterCustomPrologue, isExpression, isExternalModule, isExternalOrCommonJsModule, isIdentifier, - isIntrinsicJsxName, isJsxAttribute, isJsxElement, isJsxFragment, isJsxSelfClosingElement, isJsxSpreadAttribute, - isLineBreak, 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, + addEmitHelpers, + arrayFrom, + Bundle, + chainBundle, + createExpressionForJsxElement, + createExpressionForJsxFragment, + createExpressionFromEntityName, + createJsxFactoryExpression, + Debug, + emptyArray, + Expression, + filter, + find, + flatten, + GeneratedIdentifierFlags, + getEmitScriptTarget, + getEntries, + getJSXImplicitImportBase, + getJSXRuntimeImport, + getLineAndCharacterOfPosition, + getOriginalNode, + getSemanticJsxChildren, + Identifier, + idText, + ImportSpecifier, + insertStatementAfterCustomPrologue, + isExpression, + isExternalModule, + isExternalOrCommonJsModule, + isIdentifier, + isIntrinsicJsxName, + isJsxAttribute, + isJsxElement, + isJsxFragment, + isJsxSelfClosingElement, + isJsxSpreadAttribute, + isLineBreak, + 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 be6c0615eebf1..976e0705e730b 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -1,16 +1,82 @@ import { - addEmitHelpers, addRange, AllDecorators, append, Bundle, canHaveDecorators, chainBundle, childIsDecorated, ClassDeclaration, - ClassElement, ClassExpression, ClassLikeDeclaration, classOrConstructorParameterIsDecorated, ConstructorDeclaration, - Decorator, elideNodes, EmitFlags, EmitHint, EnumMember, Expression, filter, flatMap, GetAccessorDeclaration, - getAllDecoratorsOfClass, getAllDecoratorsOfClassElement, getEmitFlags, getEmitScriptTarget, getOriginalNodeId, - hasAccessorModifier, hasDecorators, hasSyntacticModifier, Identifier, idText, isBindingName, isBlock, - isClassElement, isComputedPropertyName, isDecorator, isExpression, isGeneratedIdentifier, isHeritageClause, - isIdentifier, isModifier, isParameterDeclaration, isPrivateIdentifier, isPropertyDeclaration, isPropertyName, - isSimpleInlineableExpression, isStatic, map, MethodDeclaration, ModifierFlags, moveRangePastModifiers, Node, - NodeArray, NodeCheckFlags, NodeFlags, nodeOrChildIsDecorated, ParameterDeclaration, PropertyDeclaration, - ScriptTarget, SetAccessorDeclaration, setCommentRange, setEmitFlags, setOriginalNode, setSourceMapRange, - setTextRange, singleOrMany, some, SourceFile, Statement, SyntaxKind, TransformationContext, TransformFlags, - visitEachChild, visitNode, visitNodes, VisitResult, + addEmitHelpers, + addRange, + AllDecorators, + append, + Bundle, + canHaveDecorators, + chainBundle, + childIsDecorated, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + classOrConstructorParameterIsDecorated, + ConstructorDeclaration, + Decorator, + elideNodes, + EmitFlags, + EmitHint, + EnumMember, + Expression, + filter, + flatMap, + GetAccessorDeclaration, + getAllDecoratorsOfClass, + getAllDecoratorsOfClassElement, + getEmitFlags, + getEmitScriptTarget, + getOriginalNodeId, + hasAccessorModifier, + hasDecorators, + hasSyntacticModifier, + Identifier, + idText, + isBindingName, + isBlock, + isClassElement, + isComputedPropertyName, + isDecorator, + isExpression, + isGeneratedIdentifier, + isHeritageClause, + isIdentifier, + isModifier, + isParameterDeclaration, + isPrivateIdentifier, + isPropertyDeclaration, + isPropertyName, + isSimpleInlineableExpression, + isStatic, + map, + MethodDeclaration, + ModifierFlags, + moveRangePastModifiers, + Node, + NodeArray, + NodeCheckFlags, + NodeFlags, + nodeOrChildIsDecorated, + ParameterDeclaration, + PropertyDeclaration, + ScriptTarget, + SetAccessorDeclaration, + setCommentRange, + setEmitFlags, + setOriginalNode, + setSourceMapRange, + 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 f4392ab02c783..c6d065a77b88f 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -1,12 +1,52 @@ import { - addRange, append, Bundle, chainBundle, createEmptyExports, createExternalHelpersImportDeclarationIfNeeded, Debug, EmitFlags, - EmitHint, ExportAssignment, ExportDeclaration, Expression, GeneratedIdentifierFlags, getEmitFlags, - getEmitModuleKind, getEmitScriptTarget, getExternalModuleNameLiteral, hasSyntacticModifier, Identifier, idText, - ImportDeclaration, ImportEqualsDeclaration, insertStatementsAfterCustomPrologue, - isExportNamespaceAsDefaultDeclaration, isExternalModule, isExternalModuleImportEqualsDeclaration, - isExternalModuleIndicator, isIdentifier, isNamespaceExport, isSourceFile, isStatement, ModifierFlags, - ModuleKind, Node, NodeFlags, ScriptTarget, setOriginalNode, setTextRange, singleOrMany, some, SourceFile, Statement, - SyntaxKind, TransformationContext, VariableStatement, visitEachChild, visitNodes, VisitResult, + addRange, + append, + Bundle, + chainBundle, + createEmptyExports, + createExternalHelpersImportDeclarationIfNeeded, + Debug, + EmitFlags, + EmitHint, + ExportAssignment, + ExportDeclaration, + Expression, + GeneratedIdentifierFlags, + getEmitFlags, + getEmitModuleKind, + getEmitScriptTarget, + getExternalModuleNameLiteral, + hasSyntacticModifier, + Identifier, + idText, + ImportDeclaration, + ImportEqualsDeclaration, + insertStatementsAfterCustomPrologue, + isExportNamespaceAsDefaultDeclaration, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isExternalModuleIndicator, + isIdentifier, + 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 e5ade93e74fe9..adedbd1281714 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,30 +1,138 @@ import { - addEmitFlags, addEmitHelper, addEmitHelpers, addRange, append, ArrowFunction, BinaryExpression, BindingElement, + 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, getEmitFlags, getEmitModuleKind, getEmitScriptTarget, getESModuleInterop, - getExportNeedsImportStarHelper, getExternalHelpersModuleName, getExternalModuleNameLiteral, - getImportNeedsImportDefaultHelper, getImportNeedsImportStarHelper, getLocalNameForExternalImport, - getNamespaceDeclarationNode, getNodeId, getOriginalNodeId, getStrictOptionValue, getTextOfIdentifierOrLiteral, - hasJsonModuleEmitEnabled, hasSyntacticModifier, Identifier, idText, ImportCall, ImportDeclaration, - ImportEqualsDeclaration, InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, - isArrayLiteralExpression, isArrowFunction, isAssignmentOperator, isBindingPattern, isClassExpression, - isDeclarationNameOfEnumOrNamespace, isDefaultImport, isDestructuringAssignment, isEffectiveExternalModule, - isExportDeclaration, isExportName, isExportNamespaceAsDefaultDeclaration, isExpression, isExternalModule, - isExternalModuleImportEqualsDeclaration, isForInitializer, isFunctionExpression, isGeneratedIdentifier, - isIdentifier, isImportCall, isImportClause, isImportEqualsDeclaration, isImportSpecifier, isJsonSourceFile, - isLocalName, isModifier, isModifierLike, isNamedExports, isObjectLiteralExpression, isOmittedExpression, - isPrefixUnaryExpression, isShorthandPropertyAssignment, isSimpleCopiableExpression, isSimpleInlineableExpression, - isSpreadElement, isStatement, 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, + CallExpression, + chainBundle, + ClassDeclaration, + collectExternalModuleInfo, + Debug, + Declaration, + DestructuringAssignment, + EmitFlags, + EmitHelper, + EmitHint, + emptyArray, + EndOfDeclarationMarker, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, + ExternalModuleInfo, + firstOrUndefined, + flattenDestructuringAssignment, + FlattenLevel, + ForStatement, + FunctionDeclaration, + FunctionExpression, + GeneratedIdentifierFlags, + getEmitFlags, + getEmitModuleKind, + getEmitScriptTarget, + getESModuleInterop, + getExportNeedsImportStarHelper, + getExternalHelpersModuleName, + getExternalModuleNameLiteral, + getImportNeedsImportDefaultHelper, + getImportNeedsImportStarHelper, + getLocalNameForExternalImport, + getNamespaceDeclarationNode, + getNodeId, + getOriginalNodeId, + getStrictOptionValue, + getTextOfIdentifierOrLiteral, + hasJsonModuleEmitEnabled, + hasSyntacticModifier, + Identifier, + idText, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, + InitializedVariableDeclaration, + insertStatementsAfterStandardPrologue, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentOperator, + isBindingPattern, + isClassExpression, + isDeclarationNameOfEnumOrNamespace, + isDefaultImport, + isDestructuringAssignment, + isEffectiveExternalModule, + isExportDeclaration, + isExportName, + isExportNamespaceAsDefaultDeclaration, + isExpression, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isForInitializer, + isFunctionExpression, + isGeneratedIdentifier, + isIdentifier, + isImportCall, + isImportClause, + isImportEqualsDeclaration, + isImportSpecifier, + isJsonSourceFile, + isLocalName, + isModifier, + isModifierLike, + isNamedExports, + isObjectLiteralExpression, + isOmittedExpression, + isPrefixUnaryExpression, + isShorthandPropertyAssignment, + isSimpleCopiableExpression, + isSimpleInlineableExpression, + isSpreadElement, + isStatement, + 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 ac4a48975223e..576c15fe6597e 100644 --- a/src/compiler/transformers/module/node.ts +++ b/src/compiler/transformers/module/node.ts @@ -1,6 +1,16 @@ import { - Bundle, Debug, EmitHint, isSourceFile, map, ModuleKind, Node, SourceFile, SyntaxKind, TransformationContext, - transformECMAScriptModule, transformModule, + Bundle, + Debug, + EmitHint, + isSourceFile, + map, + ModuleKind, + Node, + SourceFile, + SyntaxKind, + TransformationContext, + transformECMAScriptModule, + transformModule, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 5105d8238047b..c773832382369 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,26 +1,132 @@ import { - addRange, append, BinaryExpression, BindingElement, Block, Bundle, CaseBlock, CaseClause, CaseOrDefaultClause, CatchClause, - chainBundle, ClassDeclaration, collectExternalModuleInfo, Debug, Declaration, DefaultClause, - DestructuringAssignment, DoStatement, EmitFlags, EmitHint, EndOfDeclarationMarker, ExportAssignment, - ExportDeclaration, Expression, ExpressionStatement, ExternalModuleInfo, firstOrUndefined, - flattenDestructuringAssignment, FlattenLevel, forEach, ForInitializer, ForInStatement, ForOfStatement, ForStatement, - FunctionDeclaration, getEmitFlags, getExternalHelpersModuleName, getExternalModuleNameLiteral, - getLocalNameForExternalImport, getNodeId, getOriginalNode, getOriginalNodeId, getStrictOptionValue, - getTextOfIdentifierOrLiteral, hasSyntacticModifier, Identifier, idText, ImportCall, ImportDeclaration, - ImportEqualsDeclaration, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, isAssignmentExpression, - isAssignmentOperator, isBindingPattern, isBlock, isCaseBlock, isCaseOrDefaultClause, isClassElement, - isDeclarationNameOfEnumOrNamespace, isDestructuringAssignment, isEffectiveExternalModule, isExpression, - isExternalModule, isExternalModuleImportEqualsDeclaration, isForInitializer, isGeneratedIdentifier, - isHeritageClause, isIdentifier, isImportCall, isImportClause, isImportMeta, isImportSpecifier, isLocalName, - isModifierLike, isModuleOrEnumDeclaration, isNamedExports, isObjectLiteralExpression, isOmittedExpression, - isParameterDeclaration, isPrefixUnaryExpression, isPropertyAssignment, isShorthandPropertyAssignment, - isSpreadElement, 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, + addRange, + append, + BinaryExpression, + BindingElement, + Block, + Bundle, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + chainBundle, + ClassDeclaration, + collectExternalModuleInfo, + Debug, + Declaration, + DefaultClause, + DestructuringAssignment, + DoStatement, + EmitFlags, + EmitHint, + EndOfDeclarationMarker, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, + ExternalModuleInfo, + firstOrUndefined, + flattenDestructuringAssignment, + FlattenLevel, + forEach, + ForInitializer, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionDeclaration, + getEmitFlags, + getExternalHelpersModuleName, + getExternalModuleNameLiteral, + getLocalNameForExternalImport, + getNodeId, + getOriginalNode, + getOriginalNodeId, + getStrictOptionValue, + getTextOfIdentifierOrLiteral, + hasSyntacticModifier, + Identifier, + idText, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, + insertStatementsAfterStandardPrologue, + isArrayLiteralExpression, + isAssignmentExpression, + isAssignmentOperator, + isBindingPattern, + isBlock, + isCaseBlock, + isCaseOrDefaultClause, + isClassElement, + isDeclarationNameOfEnumOrNamespace, + isDestructuringAssignment, + isEffectiveExternalModule, + isExpression, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isForInitializer, + isGeneratedIdentifier, + isHeritageClause, + isIdentifier, + isImportCall, + isImportClause, + isImportMeta, + isImportSpecifier, + isLocalName, + isModifierLike, + isModuleOrEnumDeclaration, + isNamedExports, + isObjectLiteralExpression, + isOmittedExpression, + isParameterDeclaration, + isPrefixUnaryExpression, + isPropertyAssignment, + isShorthandPropertyAssignment, + isSpreadElement, + 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"; diff --git a/src/compiler/transformers/taggedTemplate.ts b/src/compiler/transformers/taggedTemplate.ts index 683c445127820..041e0adf84acb 100644 --- a/src/compiler/transformers/taggedTemplate.ts +++ b/src/compiler/transformers/taggedTemplate.ts @@ -1,9 +1,27 @@ import { CallExpression, - Debug, Expression, factory, getSourceTextOfNodeFromSourceFile, hasInvalidEscape, Identifier, isExpression, - isExternalModule, isNoSubstitutionTemplateLiteral, NoSubstitutionTemplateLiteral, setTextRange, SourceFile, - SyntaxKind, TaggedTemplateExpression, TemplateHead, TemplateLiteralLikeNode, TemplateMiddle, TemplateTail, - TransformationContext, visitEachChild, visitNode, Visitor, + Debug, + Expression, + factory, + getSourceTextOfNodeFromSourceFile, + hasInvalidEscape, + Identifier, + isExpression, + isExternalModule, + isNoSubstitutionTemplateLiteral, + NoSubstitutionTemplateLiteral, + setTextRange, + SourceFile, + SyntaxKind, + TaggedTemplateExpression, + TemplateHead, + TemplateLiteralLikeNode, + TemplateMiddle, + TemplateTail, + TransformationContext, + visitEachChild, + visitNode, + Visitor, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 6e58a3225b19f..1b27a345ce67b 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1,39 +1,202 @@ 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, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, - Expression, ExpressionWithTypeArguments, filter, findSuperStatementIndex, firstOrUndefined, flatMap, - flattenDestructuringAssignment, FlattenLevel, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, - GetAccessorDeclaration, getAllDecoratorsOfClass, getAllDecoratorsOfClassElement, getEffectiveBaseTypeNode, - getEmitFlags, getEmitModuleKind, getEmitScriptTarget, getFirstConstructorWithBody, getInitializedVariables, - getOriginalNode, getParseTreeNode, getProperties, getStrictOptionValue, getTextOfNode, hasDecorators, - hasStaticModifier, hasSyntacticModifier, HeritageClause, Identifier, idText, ImportClause, ImportDeclaration, - ImportEqualsDeclaration, ImportsNotUsedAsValues, ImportSpecifier, InitializedVariableDeclaration, - insertStatementsAfterStandardPrologue, isAccessExpression, isArray, isAssertionExpression, isBindingName, - isBindingPattern, isClassElement, isClassLike, isComputedPropertyName, isDecorator, isElementAccessExpression, - isEnumConst, isExportSpecifier, isExpression, isExternalModule, isExternalModuleImportEqualsDeclaration, - isGeneratedIdentifier, isHeritageClause, isIdentifier, isImportClause, isImportSpecifier, isInJSFile, - isInstantiatedModule, isJsonSourceFile, isJsxAttributes, isJsxTagNameExpression, isLeftHandSideExpression, - isLocalName, isModifier, isModifierLike, isModuleDeclaration, isNamedExportBindings, isNamedImportBindings, - isNamespaceExport, isObjectLiteralElement, isParameterPropertyDeclaration, isPrivateIdentifier, - isPropertyAccessExpression, isPropertyName, isShorthandPropertyAssignment, 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, setOriginalNode, setParent, setSourceMapRange, - setSyntheticLeadingComments, setSyntheticTrailingComments, setTextRange, setTextRangeEnd, setTextRangePos, - setTextRangePosEnd, setTypeNode, ShorthandPropertyAssignment, shouldPreserveConstEnums, singleOrMany, - skipOuterExpressions, skipPartiallyEmittedExpressions, skipTrivia, some, SourceFile, startOnNewLine, Statement, - SyntaxKind, TaggedTemplateExpression, TextRange, TransformationContext, TransformFlags, UnderscoreEscapedMap, - VariableDeclaration, VariableStatement, visitArray, visitEachChild, visitFunctionBody, visitLexicalEnvironment, - visitNode, visitNodes, visitParameterList, VisitResult, + __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, + EnumDeclaration, + EnumMember, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionWithTypeArguments, + filter, + findSuperStatementIndex, + firstOrUndefined, + flatMap, + flattenDestructuringAssignment, + FlattenLevel, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + getAllDecoratorsOfClass, + getAllDecoratorsOfClassElement, + getEffectiveBaseTypeNode, + getEmitFlags, + getEmitModuleKind, + getEmitScriptTarget, + getFirstConstructorWithBody, + getInitializedVariables, + getOriginalNode, + getParseTreeNode, + getProperties, + getStrictOptionValue, + getTextOfNode, + hasDecorators, + hasStaticModifier, + hasSyntacticModifier, + HeritageClause, + Identifier, + idText, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportsNotUsedAsValues, + ImportSpecifier, + InitializedVariableDeclaration, + insertStatementsAfterStandardPrologue, + isAccessExpression, + isArray, + isAssertionExpression, + isBindingName, + isBindingPattern, + isClassElement, + isClassLike, + isComputedPropertyName, + isDecorator, + isElementAccessExpression, + isEnumConst, + isExportSpecifier, + isExpression, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isGeneratedIdentifier, + isHeritageClause, + isIdentifier, + isImportClause, + isImportSpecifier, + isInJSFile, + isInstantiatedModule, + isJsonSourceFile, + isJsxAttributes, + isJsxTagNameExpression, + isLeftHandSideExpression, + isLocalName, + isModifier, + isModifierLike, + isModuleDeclaration, + isNamedExportBindings, + isNamedImportBindings, + isNamespaceExport, + isObjectLiteralElement, + isParameterPropertyDeclaration, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyName, + isShorthandPropertyAssignment, + 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, + setOriginalNode, + setParent, + setSourceMapRange, + setSyntheticLeadingComments, + setSyntheticTrailingComments, + setTextRange, + setTextRangeEnd, + setTextRangePos, + setTextRangePosEnd, + setTypeNode, + ShorthandPropertyAssignment, + shouldPreserveConstEnums, + singleOrMany, + skipOuterExpressions, + skipPartiallyEmittedExpressions, + skipTrivia, + some, + SourceFile, + startOnNewLine, + Statement, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + TransformationContext, + TransformFlags, + UnderscoreEscapedMap, + VariableDeclaration, + VariableStatement, + visitArray, + visitEachChild, + visitFunctionBody, + visitLexicalEnvironment, + visitNode, + visitNodes, + visitParameterList, + VisitResult, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/typeSerializer.ts b/src/compiler/transformers/typeSerializer.ts index fb86fed8a6a20..ca773490be011 100644 --- a/src/compiler/transformers/typeSerializer.ts +++ b/src/compiler/transformers/typeSerializer.ts @@ -1,16 +1,72 @@ import { - AccessorDeclaration, ArrayLiteralExpression, BigIntLiteral, BinaryExpression, Block, CaseBlock, - ClassLikeDeclaration, ConditionalExpression, ConditionalTypeNode, Debug, EntityName, Expression, factory, - findAncestor, FunctionLikeDeclaration, getAllAccessorDeclarations, getEffectiveReturnTypeNode, getEmitScriptTarget, - getFirstConstructorWithBody, getParseTreeNode, getRestParameterElementType, getSetAccessorTypeAnnotationNode, - getStrictOptionValue, Identifier, isAsyncFunction, isBinaryExpression, isClassLike, isConditionalExpression, - isConditionalTypeNode, isFunctionLike, isGeneratedIdentifier, isIdentifier, isLiteralTypeNode, isNumericLiteral, - isParenthesizedExpression, isPropertyAccessExpression, 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, + AccessorDeclaration, + ArrayLiteralExpression, + BigIntLiteral, + BinaryExpression, + Block, + CaseBlock, + ClassLikeDeclaration, + ConditionalExpression, + ConditionalTypeNode, + Debug, + EntityName, + Expression, + factory, + findAncestor, + FunctionLikeDeclaration, + getAllAccessorDeclarations, + getEffectiveReturnTypeNode, + getEmitScriptTarget, + getFirstConstructorWithBody, + getParseTreeNode, + getRestParameterElementType, + getSetAccessorTypeAnnotationNode, + getStrictOptionValue, + Identifier, + isAsyncFunction, + isBinaryExpression, + isClassLike, + isConditionalExpression, + isConditionalTypeNode, + isFunctionLike, + isGeneratedIdentifier, + isIdentifier, + isLiteralTypeNode, + isNumericLiteral, + isParenthesizedExpression, + isPropertyAccessExpression, + 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"; diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index f8bca38723f8f..90ef9bffb7f9d 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -1,19 +1,85 @@ import { - AccessorDeclaration, AllDecorators, append, BinaryOperator, BindingElement, Bundle, cast, ClassDeclaration, - ClassElement, ClassExpression, ClassLikeDeclaration, ClassStaticBlockDeclaration, CompilerOptions, - CompoundAssignmentOperator, CoreTransformationContext, createExternalHelpersImportDeclarationIfNeeded, - createMultiMap, Decorator, EmitResolver, ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, - filter, FunctionDeclaration, FunctionLikeDeclaration, getAllAccessorDeclarations, getDecorators, - getFirstConstructorWithBody, getNamespaceDeclarationNode, getNodeId, getOriginalNode, hasDecorators, - hasStaticModifier, hasSyntacticModifier, Identifier, idText, ImportDeclaration, ImportEqualsDeclaration, - ImportSpecifier, InitializedPropertyDeclaration, InternalSymbolName, isAutoAccessorPropertyDeclaration, - isBindingPattern, isClassStaticBlockDeclaration, isDefaultImport, isExpressionStatement, isGeneratedIdentifier, - isIdentifier, isKeyword, isMethodOrAccessor, isNamedExports, isNamedImports, isOmittedExpression, - isPrivateIdentifier, isPropertyDeclaration, 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, + AccessorDeclaration, + AllDecorators, + append, + BinaryOperator, + BindingElement, + Bundle, + cast, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CompilerOptions, + CompoundAssignmentOperator, + CoreTransformationContext, + createExternalHelpersImportDeclarationIfNeeded, + createMultiMap, + Decorator, + EmitResolver, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + filter, + FunctionDeclaration, + FunctionLikeDeclaration, + getAllAccessorDeclarations, + getDecorators, + getFirstConstructorWithBody, + getNamespaceDeclarationNode, + getNodeId, + getOriginalNode, + hasDecorators, + hasStaticModifier, + hasSyntacticModifier, + Identifier, + idText, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + InitializedPropertyDeclaration, + InternalSymbolName, + isAutoAccessorPropertyDeclaration, + isBindingPattern, + isClassStaticBlockDeclaration, + isDefaultImport, + isExpressionStatement, + isGeneratedIdentifier, + isIdentifier, + isKeyword, + isMethodOrAccessor, + isNamedExports, + isNamedImports, + isOmittedExpression, + isPrivateIdentifier, + isPropertyDeclaration, + 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 ad96f6e39428a..dedf7e4729945 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1,4 +1,9 @@ -import { combinePaths, Extension, fileExtensionIs, ResolvedConfigFileName } from "./_namespaces/ts"; +import { + combinePaths, + Extension, + fileExtensionIs, + ResolvedConfigFileName, +} from "./_namespaces/ts"; /** @internal */ export enum UpToDateStatusType { diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index b44a1ec6e6a72..6eb8ed8862c3c 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -1,32 +1,136 @@ import * as ts from "./_namespaces/ts"; import { - AffectedFileResult, arrayToMap, assertType, BuilderProgram, BuildInfo, CancellationToken, canJsonReportNoInputFiles, - changeCompilerHostLikeToUseCache, clearMap, closeFileWatcher, closeFileWatcherOf, commonOptionsWithBuild, - CompilerHost, CompilerOptions, CompilerOptionsValue, ConfigFileProgramReloadLevel, convertToRelativePath, - copyProperties, createCompilerDiagnostic, createCompilerHostFromProgramHost, createDiagnosticCollection, - createDiagnosticReporter, createGetCanonicalFileName, createModuleResolutionCache, CreateProgram, createProgramHost, - createTypeReferenceDirectiveResolutionCache, createWatchFactory, createWatchHost, CustomTransformers, Debug, - Diagnostic, DiagnosticCollection, DiagnosticMessage, DiagnosticReporter, Diagnostics, - EmitAndSemanticDiagnosticsBuilderProgram, emitFilesAndReportErrors, EmitResult, emitUsingBuildInfo, emptyArray, - ExitStatus, ExtendedConfigCacheEntry, FileWatcher, FileWatcherCallback, findIndex, - flattenDiagnosticMessageText, forEach, ForegroundColorEscapeSequences, formatColorAndReset, getAllProjectOutputs, - getBuildInfoFileVersionMap, GetCanonicalFileName, getConfigFileParsingDiagnostics, getDirectoryPath, getEntries, - getErrorCountForSummary, getFileNamesFromConfigSpecs, getFilesInErrorForSummary, getFirstProjectOutput, - getLocaleTimeString, getNormalizedAbsolutePath, getParsedCommandLineOfConfigFile, getPendingEmitKind, - getSourceFileVersionAsHashFromText, getTsBuildInfoEmitOutputFilePath, getWatchErrorSummaryDiagnosticMessage, - hasProperty, identity, isArray, isIgnoredFileFromWildCardWatching, isIncrementalCompilation, isString, listFiles, - loadWithModeAwareCache, loadWithTypeDirectiveCache, map, maybeBind, missingFileModifiedTime, - ModuleResolutionCache, mutateMap, mutateMapSkippingNewValues, noop, outFile, OutputFile, ParseConfigFileHost, - parseConfigHostFromCompilerHostLike, ParsedCommandLine, Path, PollingInterval, Program, ProgramBuildInfo, - ProgramBundleEmitBuildInfo, ProgramHost, ProgramMultiFileEmitBuildInfo, readBuilderProgram, ReadBuildProgramHost, + AffectedFileResult, + arrayToMap, + assertType, + BuilderProgram, + BuildInfo, + CancellationToken, + canJsonReportNoInputFiles, + changeCompilerHostLikeToUseCache, + clearMap, + closeFileWatcher, + closeFileWatcherOf, + commonOptionsWithBuild, + CompilerHost, + CompilerOptions, + CompilerOptionsValue, + ConfigFileProgramReloadLevel, + convertToRelativePath, + copyProperties, + createCompilerDiagnostic, + createCompilerHostFromProgramHost, + createDiagnosticCollection, + createDiagnosticReporter, + createGetCanonicalFileName, + createModuleResolutionCache, + CreateProgram, + createProgramHost, + createTypeReferenceDirectiveResolutionCache, + createWatchFactory, + createWatchHost, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCollection, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + EmitAndSemanticDiagnosticsBuilderProgram, + emitFilesAndReportErrors, + EmitResult, + emitUsingBuildInfo, + emptyArray, + ExitStatus, + ExtendedConfigCacheEntry, + FileWatcher, + FileWatcherCallback, + findIndex, + flattenDiagnosticMessageText, + forEach, + ForegroundColorEscapeSequences, + formatColorAndReset, + getAllProjectOutputs, + getBuildInfoFileVersionMap, + GetCanonicalFileName, + getConfigFileParsingDiagnostics, + getDirectoryPath, + getEntries, + getErrorCountForSummary, + getFileNamesFromConfigSpecs, + getFilesInErrorForSummary, + getFirstProjectOutput, + getLocaleTimeString, + getNormalizedAbsolutePath, + getParsedCommandLineOfConfigFile, + getPendingEmitKind, + getSourceFileVersionAsHashFromText, + getTsBuildInfoEmitOutputFilePath, + getWatchErrorSummaryDiagnosticMessage, + hasProperty, + identity, + isArray, + isIgnoredFileFromWildCardWatching, + isIncrementalCompilation, + isString, + listFiles, + loadWithModeAwareCache, + loadWithTypeDirectiveCache, + map, + maybeBind, + missingFileModifiedTime, + ModuleResolutionCache, + mutateMap, + mutateMapSkippingNewValues, + noop, + outFile, + OutputFile, + ParseConfigFileHost, + parseConfigHostFromCompilerHostLike, + ParsedCommandLine, + Path, + PollingInterval, + Program, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProgramHost, + ProgramMultiFileEmitBuildInfo, + readBuilderProgram, + ReadBuildProgramHost, ResolutionMode, - resolveConfigFileProjectName, ResolvedConfigFileName, ResolvedProjectReference, ResolvedTypeReferenceDirective, - resolveModuleName, resolvePath, resolveProjectReferencePath, resolveTypeReferenceDirective, returnUndefined, - SemanticDiagnosticsBuilderProgram, setGetSourceFileAsHashVersioned, SharedExtendedConfigFileWatcher, some, - SourceFile, Status, sys, System, TypeReferenceDirectiveResolutionCache, unorderedRemoveItem, - updateErrorForNoInputFiles, updateSharedExtendedConfigFileWatcher, updateWatchingWildcardDirectories, - UpToDateStatus, UpToDateStatusType, version, WatchFactory, WatchHost, WatchOptions, WatchStatusReporter, WatchType, - WildcardDirectoryWatcher, writeFile, WriteFileCallback, + resolveConfigFileProjectName, + ResolvedConfigFileName, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + resolveModuleName, + resolvePath, + resolveProjectReferencePath, + resolveTypeReferenceDirective, + returnUndefined, + SemanticDiagnosticsBuilderProgram, + setGetSourceFileAsHashVersioned, + SharedExtendedConfigFileWatcher, + some, + SourceFile, + Status, + sys, + System, + TypeReferenceDirectiveResolutionCache, + unorderedRemoveItem, + updateErrorForNoInputFiles, + updateSharedExtendedConfigFileWatcher, + updateWatchingWildcardDirectories, + UpToDateStatus, + UpToDateStatusType, + version, + WatchFactory, + WatchHost, + WatchOptions, + WatchStatusReporter, + WatchType, + WildcardDirectoryWatcher, + writeFile, + WriteFileCallback, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d09d1f958de4c..8ab413b786a5e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1,7 +1,19 @@ import { - BaseNodeFactory, CreateSourceFileOptions, EmitHelperFactory, MapLike, ModeAwareCache, - ModuleResolutionCache, MultiMap, NodeFactoryFlags, OptionsNameMap, PackageJsonInfo, PackageJsonInfoCache, Pattern, - ProgramBuildInfo, Push, SymlinkCache, + BaseNodeFactory, + CreateSourceFileOptions, + EmitHelperFactory, + MapLike, + ModeAwareCache, + ModuleResolutionCache, + MultiMap, + NodeFactoryFlags, + OptionsNameMap, + PackageJsonInfo, + PackageJsonInfoCache, + Pattern, + ProgramBuildInfo, + Push, + SymlinkCache, } from "./_namespaces/ts"; // branded string type used to store absolute, normalized and canonicalized paths diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a6eaefed1ef7c..8de47c348430e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,96 +1,520 @@ import { - __String, AccessExpression, AccessorDeclaration, addRange, affectsDeclarationPathOptionDeclarations, - affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, AnyImportOrBareOrAccessedRequire, - AnyImportOrReExport, AnyImportSyntax, AnyValidImportOrReExport, arrayFrom, ArrayLiteralExpression, ArrayTypeNode, - ArrowFunction, AsExpression, AssertionExpression, assertType, AssignmentDeclarationKind, AssignmentExpression, - AssignmentOperatorToken, BinaryExpression, binarySearch, BindableObjectDefinePropertyCall, - BindableStaticAccessExpression, BindableStaticElementAccessExpression, BindableStaticNameExpression, BindingElement, - Block, BundleFileSection, BundleFileSectionKind, BundleFileTextLike, CallExpression, CallLikeExpression, - canHaveDecorators, canHaveIllegalDecorators, canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, - CatchClause, changeAnyExtension, CharacterCodes, CheckFlags, ClassDeclaration, ClassElement, ClassLikeDeclaration, - ClassStaticBlockDeclaration, combinePaths, CommaListExpression, CommandLineOption, CommentDirective, - CommentDirectivesMap, CommentDirectiveType, CommentRange, compareStringsCaseSensitive, compareValues, Comparison, - CompilerOptions, ComputedPropertyName, computeLineAndCharacterOfPosition, computeLineOfPosition, computeLineStarts, - concatenate, ConditionalExpression, ConstructorDeclaration, contains, containsPath, createGetCanonicalFileName, - createModeAwareCache, createMultiMap, createScanner, createTextSpan, createTextSpanFromBounds, Debug, Declaration, - DeclarationName, DeclarationWithTypeParameterChildren, DeclarationWithTypeParameters, Decorator, DefaultClause, - DestructuringAssignment, Diagnostic, DiagnosticCollection, DiagnosticMessage, DiagnosticMessageChain, - DiagnosticRelatedInformation, Diagnostics, DiagnosticWithDetachedLocation, DiagnosticWithLocation, - directorySeparator, DoStatement, DynamicNamedBinaryExpression, DynamicNamedDeclaration, ElementAccessExpression, - EmitFlags, EmitHost, EmitResolver, EmitTextWriter, emptyArray, ensurePathIsNonModuleName, - ensureTrailingDirectorySeparator, EntityName, EntityNameExpression, EntityNameOrEntityNameExpression, - EnumDeclaration, EqualityComparer, equalOwnProperties, EqualsToken, equateValues, escapeLeadingUnderscores, - every, ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, - ExpressionWithTypeArguments, Extension, ExternalModuleReference, factory, FileExtensionInfo, fileExtensionIs, - fileExtensionIsOneOf, FileReference, FileWatcher, filter, find, findAncestor, findBestPatternMatch, findIndex, - findLast, firstDefined, firstOrUndefined, flatMap, flatMapToMutable, flatten, forEach, forEachAncestorDirectory, - forEachChild, forEachChildRecursively, ForInOrOfStatement, ForInStatement, ForOfStatement, ForStatement, - FunctionBody, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, - getBaseFileName, GetCanonicalFileName, getCombinedModifierFlags, getCombinedNodeFlags, getDirectoryPath, getEntries, - getJSDocAugmentsTag, getJSDocDeprecatedTagNoCache, getJSDocImplementsTags, getJSDocOverrideTagNoCache, - getJSDocParameterTags, getJSDocParameterTagsNoCache, getJSDocPrivateTagNoCache, getJSDocProtectedTagNoCache, - getJSDocPublicTagNoCache, getJSDocReadonlyTagNoCache, getJSDocReturnType, getJSDocTags, getJSDocType, - getJSDocTypeParameterTags, getJSDocTypeParameterTagsNoCache, getJSDocTypeTag, getLeadingCommentRanges, - getLineAndCharacterOfPosition, getLinesBetweenPositions, getLineStarts, getNameOfDeclaration, - getNormalizedAbsolutePath, getNormalizedPathComponents, getOwnKeys, getParseTreeNode, getPathComponents, - getPathFromPathComponents, getRelativePathToDirectoryOrUrl, getResolutionMode, getResolutionName, getRootLength, - getStringComparer, getSymbolId, getTrailingCommentRanges, HasExpressionInitializer, hasExtension, hasInitializer, - HasInitializer, HasJSDoc, hasJSDocNodes, HasModifiers, hasProperty, HasType, HasTypeArguments, HeritageClause, - Identifier, IdentifierTypePredicate, identity, idText, IfStatement, ignoredPaths, ImportCall, ImportClause, - ImportDeclaration, ImportEqualsDeclaration, ImportMetaProperty, ImportSpecifier, ImportTypeNode, IndexInfo, - indexOfAnyCharCode, InitializedVariableDeclaration, insertSorted, InterfaceDeclaration, isAccessor, - isAnyDirectorySeparator, isArray, isArrayLiteralExpression, isArrowFunction, isBigIntLiteral, isBinaryExpression, - isBindingPattern, isCallExpression, isClassDeclaration, isClassElement, isClassExpression, isClassLike, - isClassStaticBlockDeclaration, isCommaListExpression, isComputedPropertyName, isConstructorDeclaration, - isDeclaration, isDecorator, isElementAccessExpression, isEnumDeclaration, isEnumMember, isExportAssignment, - isExportDeclaration, isExpressionStatement, isExpressionWithTypeArguments, isExternalModule, - isExternalModuleReference, isFileProbablyExternalModule, isForStatement, isFunctionDeclaration, - isFunctionExpression, isFunctionLike, isFunctionLikeDeclaration, isFunctionLikeOrClassStaticBlockDeclaration, - isGetAccessorDeclaration, isHeritageClause, isIdentifier, isIdentifierText, isImportTypeNode, - isInterfaceDeclaration, isJSDoc, isJSDocFunctionType, isJSDocLinkLike, isJSDocMemberName, isJSDocNameReference, - isJSDocNode, isJSDocParameterTag, isJSDocPropertyLikeTag, isJSDocSignature, isJSDocTag, isJSDocTemplateTag, - isJSDocTypeExpression, isJSDocTypeLiteral, isJSDocTypeTag, isJsxChild, isJsxFragment, isJsxOpeningLikeElement, - isJsxText, isLeftHandSideExpression, isLineBreak, isLiteralTypeNode, isMemberName, isMetaProperty, - isMethodOrAccessor, isModuleDeclaration, isNamedDeclaration, isNamespaceExport, isNamespaceExportDeclaration, - isNamespaceImport, isNoSubstitutionTemplateLiteral, isNumericLiteral, isObjectLiteralExpression, - isOmittedExpression, isParameter, isParameterPropertyDeclaration, isParenthesizedExpression, - isParenthesizedTypeNode, isPrefixUnaryExpression, isPrivateIdentifier, isPropertyAccessExpression, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isPropertySignature, isQualifiedName, isRootedDiskPath, - isSetAccessorDeclaration, isShorthandPropertyAssignment, isSourceFile, isString, isStringLiteral, - isStringLiteralLike, isTypeAliasDeclaration, isTypeElement, isTypeLiteralNode, isTypeNode, isTypeReferenceNode, - isVariableDeclaration, isVariableStatement, isVoidExpression, isWhiteSpaceLike, isWhiteSpaceSingleLine, JSDoc, - JSDocCallbackTag, JSDocEnumTag, JSDocMemberName, JSDocParameterTag, JSDocPropertyLikeTag, JSDocSignature, JSDocTag, - JSDocTemplateTag, JSDocTypedefTag, JsonSourceFile, JsxChild, JsxElement, JsxEmit, JsxFragment, JsxOpeningElement, - JsxOpeningLikeElement, JsxSelfClosingElement, JsxTagNameExpression, KeywordSyntaxKind, LabeledStatement, - LanguageVariant, last, lastOrUndefined, LateVisibilityPaintedStatement, length, LiteralImportTypeNode, - LiteralLikeElementAccessExpression, LiteralLikeNode, LogicalOrCoalescingAssignmentOperator, map, mapDefined, - MapLike, MemberName, MethodDeclaration, ModeAwareCache, ModifierFlags, ModifierLike, ModuleBlock, ModuleDeclaration, - ModuleDetectionKind, ModuleKind, ModuleResolutionKind, moduleResolutionOptionDeclarations, MultiMap, - NamedDeclaration, NamedExports, NamedImports, NamedImportsOrExports, NamespaceExport, NamespaceImport, - NewExpression, NewLineKind, Node, NodeArray, NodeFlags, nodeModulesPathPart, NonNullExpression, noop, normalizePath, - NoSubstitutionTemplateLiteral, NumericLiteral, ObjectFlags, ObjectFlagsType, ObjectLiteralElement, - ObjectLiteralExpression, ObjectLiteralExpressionBase, ObjectTypeDeclaration, optionsAffectingProgramStructure, or, - OuterExpressionKinds, PackageId, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, - parseConfigFileTextToJson, PartiallyEmittedExpression, Path, pathIsRelative, Pattern, PostfixUnaryExpression, - PrefixUnaryExpression, PrinterOptions, PrintHandlers, PrivateIdentifier, ProjectReference, PrologueDirective, - PropertyAccessEntityNameExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, - PropertyNameLiteral, PseudoBigInt, QualifiedName, ReadonlyCollection, ReadonlyTextRange, - removeTrailingDirectorySeparator, RequireOrImportCall, RequireVariableStatement, ResolvedModuleFull, - ResolvedTypeReferenceDirective, ReturnStatement, SatisfiesExpression, ScriptKind, ScriptTarget, - semanticDiagnosticsOptionDeclarations, SetAccessorDeclaration, ShorthandPropertyAssignment, Signature, - SignatureDeclaration, SignatureFlags, SignatureKind, singleElementArray, singleOrUndefined, skipOuterExpressions, - skipTrivia, some, sort, SortedArray, SourceFile, SourceFileLike, SourceFileMayBeEmittedHost, SourceMapSource, - startsWith, startsWithUseStrict, Statement, stringContains, StringLiteral, StringLiteralLike, stringToToken, - SuperCall, SuperExpression, SuperProperty, SwitchStatement, Symbol, SymbolFlags, SymbolTable, SyntaxKind, - SyntaxList, sys, TaggedTemplateExpression, TemplateLiteral, TemplateLiteralLikeNode, TemplateLiteralTypeSpan, - TemplateSpan, TextRange, TextSpan, ThisTypePredicate, Token, TokenFlags, tokenToString, toPath, tracing, - TransformFlags, TransientSymbol, trimString, trimStringStart, TriviaSyntaxKind, tryCast, tryRemovePrefix, - TryStatement, TsConfigSourceFile, TupleTypeNode, Type, TypeAliasDeclaration, TypeAssertion, TypeChecker, - TypeElement, TypeFlags, TypeLiteralNode, TypeNode, TypeNodeSyntaxKind, TypeParameter, TypeParameterDeclaration, - TypePredicate, TypePredicateKind, TypeReferenceNode, unescapeLeadingUnderscores, UnionOrIntersectionTypeNode, - ValidImportTypeNode, VariableDeclaration, VariableDeclarationInitializedTo, VariableDeclarationList, - VariableLikeDeclaration, VariableStatement, version, WhileStatement, WithStatement, WriteFileCallback, - WriteFileCallbackData, YieldExpression, ResolutionMode, + __String, + AccessExpression, + AccessorDeclaration, + addRange, + affectsDeclarationPathOptionDeclarations, + affectsEmitOptionDeclarations, + AllAccessorDeclarations, + AmbientModuleDeclaration, + AnyImportOrBareOrAccessedRequire, + AnyImportOrReExport, + AnyImportSyntax, + AnyValidImportOrReExport, + arrayFrom, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertionExpression, + assertType, + AssignmentDeclarationKind, + AssignmentExpression, + AssignmentOperatorToken, + BinaryExpression, + binarySearch, + BindableObjectDefinePropertyCall, + BindableStaticAccessExpression, + BindableStaticElementAccessExpression, + BindableStaticNameExpression, + BindingElement, + Block, + BundleFileSection, + BundleFileSectionKind, + BundleFileTextLike, + CallExpression, + CallLikeExpression, + canHaveDecorators, + canHaveIllegalDecorators, + canHaveModifiers, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + changeAnyExtension, + CharacterCodes, + CheckFlags, + ClassDeclaration, + ClassElement, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + combinePaths, + CommaListExpression, + CommandLineOption, + CommentDirective, + CommentDirectivesMap, + CommentDirectiveType, + CommentRange, + compareStringsCaseSensitive, + compareValues, + Comparison, + CompilerOptions, + ComputedPropertyName, + computeLineAndCharacterOfPosition, + computeLineOfPosition, + computeLineStarts, + concatenate, + ConditionalExpression, + ConstructorDeclaration, + contains, + containsPath, + createGetCanonicalFileName, + createModeAwareCache, + createMultiMap, + createScanner, + createTextSpan, + createTextSpanFromBounds, + Debug, + Declaration, + DeclarationName, + DeclarationWithTypeParameterChildren, + DeclarationWithTypeParameters, + Decorator, + DefaultClause, + DestructuringAssignment, + Diagnostic, + DiagnosticCollection, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + Diagnostics, + DiagnosticWithDetachedLocation, + DiagnosticWithLocation, + directorySeparator, + DoStatement, + DynamicNamedBinaryExpression, + DynamicNamedDeclaration, + ElementAccessExpression, + EmitFlags, + EmitHost, + EmitResolver, + EmitTextWriter, + emptyArray, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, + EntityName, + EntityNameExpression, + EntityNameOrEntityNameExpression, + EnumDeclaration, + EqualityComparer, + equalOwnProperties, + EqualsToken, + equateValues, + escapeLeadingUnderscores, + every, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalModuleReference, + factory, + FileExtensionInfo, + fileExtensionIs, + fileExtensionIsOneOf, + FileReference, + FileWatcher, + filter, + find, + findAncestor, + findBestPatternMatch, + findIndex, + findLast, + firstDefined, + firstOrUndefined, + flatMap, + flatMapToMutable, + flatten, + forEach, + forEachAncestorDirectory, + forEachChild, + forEachChildRecursively, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + getBaseFileName, + GetCanonicalFileName, + getCombinedModifierFlags, + getCombinedNodeFlags, + getDirectoryPath, + getEntries, + getJSDocAugmentsTag, + getJSDocDeprecatedTagNoCache, + getJSDocImplementsTags, + getJSDocOverrideTagNoCache, + getJSDocParameterTags, + getJSDocParameterTagsNoCache, + getJSDocPrivateTagNoCache, + getJSDocProtectedTagNoCache, + getJSDocPublicTagNoCache, + getJSDocReadonlyTagNoCache, + getJSDocReturnType, + getJSDocTags, + getJSDocType, + getJSDocTypeParameterTags, + getJSDocTypeParameterTagsNoCache, + getJSDocTypeTag, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLinesBetweenPositions, + getLineStarts, + getNameOfDeclaration, + getNormalizedAbsolutePath, + getNormalizedPathComponents, + getOwnKeys, + getParseTreeNode, + getPathComponents, + getPathFromPathComponents, + getRelativePathToDirectoryOrUrl, + getResolutionMode, + getResolutionName, + getRootLength, + getStringComparer, + getSymbolId, + getTrailingCommentRanges, + HasExpressionInitializer, + hasExtension, + hasInitializer, + HasInitializer, + HasJSDoc, + hasJSDocNodes, + HasModifiers, + hasProperty, + HasType, + HasTypeArguments, + HeritageClause, + Identifier, + IdentifierTypePredicate, + identity, + idText, + IfStatement, + ignoredPaths, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportMetaProperty, + ImportSpecifier, + ImportTypeNode, + IndexInfo, + indexOfAnyCharCode, + InitializedVariableDeclaration, + insertSorted, + InterfaceDeclaration, + isAccessor, + isAnyDirectorySeparator, + isArray, + isArrayLiteralExpression, + isArrowFunction, + isBigIntLiteral, + isBinaryExpression, + isBindingPattern, + isCallExpression, + isClassDeclaration, + isClassElement, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isCommaListExpression, + isComputedPropertyName, + isConstructorDeclaration, + isDeclaration, + isDecorator, + isElementAccessExpression, + isEnumDeclaration, + isEnumMember, + isExportAssignment, + isExportDeclaration, + isExpressionStatement, + isExpressionWithTypeArguments, + isExternalModule, + isExternalModuleReference, + isFileProbablyExternalModule, + isForStatement, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeOrClassStaticBlockDeclaration, + isGetAccessorDeclaration, + isHeritageClause, + isIdentifier, + isIdentifierText, + isImportTypeNode, + isInterfaceDeclaration, + isJSDoc, + isJSDocFunctionType, + isJSDocLinkLike, + isJSDocMemberName, + isJSDocNameReference, + isJSDocNode, + isJSDocParameterTag, + isJSDocPropertyLikeTag, + isJSDocSignature, + isJSDocTag, + isJSDocTemplateTag, + isJSDocTypeExpression, + isJSDocTypeLiteral, + isJSDocTypeTag, + isJsxChild, + isJsxFragment, + isJsxOpeningLikeElement, + isJsxText, + isLeftHandSideExpression, + isLineBreak, + isLiteralTypeNode, + isMemberName, + isMetaProperty, + isMethodOrAccessor, + isModuleDeclaration, + isNamedDeclaration, + isNamespaceExport, + isNamespaceExportDeclaration, + isNamespaceImport, + isNoSubstitutionTemplateLiteral, + isNumericLiteral, + isObjectLiteralExpression, + isOmittedExpression, + isParameter, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isParenthesizedTypeNode, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isPropertySignature, + isQualifiedName, + isRootedDiskPath, + isSetAccessorDeclaration, + isShorthandPropertyAssignment, + isSourceFile, + isString, + isStringLiteral, + isStringLiteralLike, + isTypeAliasDeclaration, + isTypeElement, + isTypeLiteralNode, + isTypeNode, + isTypeReferenceNode, + isVariableDeclaration, + isVariableStatement, + isVoidExpression, + isWhiteSpaceLike, + isWhiteSpaceSingleLine, + JSDoc, + JSDocCallbackTag, + JSDocEnumTag, + JSDocMemberName, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocTypedefTag, + JsonSourceFile, + JsxChild, + JsxElement, + JsxEmit, + JsxFragment, + JsxOpeningElement, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxTagNameExpression, + KeywordSyntaxKind, + LabeledStatement, + LanguageVariant, + last, + lastOrUndefined, + LateVisibilityPaintedStatement, + length, + LiteralImportTypeNode, + LiteralLikeElementAccessExpression, + LiteralLikeNode, + LogicalOrCoalescingAssignmentOperator, + map, + mapDefined, + MapLike, + MemberName, + MethodDeclaration, + ModeAwareCache, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleDetectionKind, + ModuleKind, + ModuleResolutionKind, + moduleResolutionOptionDeclarations, + MultiMap, + NamedDeclaration, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamespaceExport, + NamespaceImport, + NewExpression, + NewLineKind, + Node, + NodeArray, + NodeFlags, + nodeModulesPathPart, + NonNullExpression, + noop, + normalizePath, + NoSubstitutionTemplateLiteral, + NumericLiteral, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElement, + ObjectLiteralExpression, + ObjectLiteralExpressionBase, + ObjectTypeDeclaration, + optionsAffectingProgramStructure, + or, + OuterExpressionKinds, + PackageId, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + parseConfigFileTextToJson, + PartiallyEmittedExpression, + Path, + pathIsRelative, + Pattern, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrinterOptions, + PrintHandlers, + PrivateIdentifier, + ProjectReference, + PrologueDirective, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertyNameLiteral, + PseudoBigInt, + QualifiedName, + ReadonlyCollection, + ReadonlyTextRange, + removeTrailingDirectorySeparator, + RequireOrImportCall, + RequireVariableStatement, + ResolutionMode, + ResolvedModuleFull, + ResolvedTypeReferenceDirective, + ReturnStatement, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + semanticDiagnosticsOptionDeclarations, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + singleElementArray, + singleOrUndefined, + skipOuterExpressions, + skipTrivia, + some, + sort, + SortedArray, + SourceFile, + SourceFileLike, + SourceFileMayBeEmittedHost, + SourceMapSource, + startsWith, + startsWithUseStrict, + Statement, + stringContains, + StringLiteral, + StringLiteralLike, + stringToToken, + SuperCall, + SuperExpression, + SuperProperty, + SwitchStatement, + Symbol, + SymbolFlags, + SymbolTable, + SyntaxKind, + SyntaxList, + sys, + TaggedTemplateExpression, + TemplateLiteral, + TemplateLiteralLikeNode, + TemplateLiteralTypeSpan, + TemplateSpan, + TextRange, + TextSpan, + ThisTypePredicate, + Token, + TokenFlags, + tokenToString, + toPath, + tracing, + TransformFlags, + TransientSymbol, + trimString, + trimStringStart, + TriviaSyntaxKind, + tryCast, + tryRemovePrefix, + TryStatement, + TsConfigSourceFile, + TupleTypeNode, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeNodeSyntaxKind, + TypeParameter, + TypeParameterDeclaration, + TypePredicate, + TypePredicateKind, + TypeReferenceNode, + unescapeLeadingUnderscores, + UnionOrIntersectionTypeNode, + ValidImportTypeNode, + VariableDeclaration, + VariableDeclarationInitializedTo, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, + version, + WhileStatement, + WithStatement, + WriteFileCallback, + WriteFileCallbackData, + YieldExpression, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 03b172fa3e7f2..e6c0c5a05602a 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1,51 +1,268 @@ import { - __String, AccessExpression, AccessorDeclaration, ArrayBindingElement, ArrayBindingOrAssignmentPattern, - AssertionExpression, AssertionKey, AssignmentDeclarationKind, AssignmentPattern, AutoAccessorPropertyDeclaration, - BinaryExpression, BindableObjectDefinePropertyCall, BindingElement, BindingName, BindingOrAssignmentElement, - BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, BindingPattern, Block, BooleanLiteral, - BreakOrContinueStatement, CallChain, CallExpression, CallLikeExpression, canHaveIllegalTypeParameters, - CaseOrDefaultClause, CharacterCodes, ClassElement, ClassLikeDeclaration, ClassStaticBlockDeclaration, combinePaths, - compareDiagnostics, CompilerOptions, ConciseBody, ConstructorDeclaration, ConstructorTypeNode, contains, - createCompilerDiagnostic, Debug, Declaration, DeclarationName, DeclarationStatement, DeclarationWithTypeParameters, - Decorator, Diagnostic, Diagnostics, ElementAccessChain, ElementAccessExpression, emptyArray, EntityName, - entityNameToString, EnumDeclaration, every, ExportAssignment, ExportSpecifier, Expression, FileReference, filter, - find, flatMap, ForInitializer, ForInOrOfStatement, FunctionBody, FunctionLikeDeclaration, FunctionTypeNode, - GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedPrivateIdentifier, GetAccessorDeclaration, - getAssignmentDeclarationKind, getDirectoryPath, getEffectiveModifierFlags, - getEffectiveModifierFlagsAlwaysIncludeJSDoc, getElementOrPropertyAccessArgumentExpressionOrName, - getEmitScriptTarget, getJSDocCommentsAndTags, getJSDocTypeParameterDeclarations, hasAccessorModifier, hasDecorators, - HasDecorators, HasExpressionInitializer, HasInitializer, HasJSDoc, HasModifiers, hasProperty, hasSyntacticModifier, - HasType, Identifier, ImportClause, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeNode, isAccessExpression, isAmbientModule, isAnyImportOrReExport, isArrowFunction, isBinaryExpression, - isBindableStaticElementAccessExpression, isBindingElement, isBlock, isCallExpression, isCallSignatureDeclaration, - isClassExpression, isClassStaticBlockDeclaration, isDecorator, isElementAccessExpression, isExportAssignment, - isExportDeclaration, isExportSpecifier, isFunctionBlock, isFunctionExpression, isFunctionTypeNode, isIdentifier, - isImportSpecifier, isInJSFile, isJSDoc, isJSDocAugmentsTag, isJSDocClassTag, isJSDocDeprecatedTag, isJSDocEnumTag, - isJSDocFunctionType, isJSDocImplementsTag, isJSDocOverrideTag, isJSDocParameterTag, isJSDocPrivateTag, - isJSDocProtectedTag, isJSDocPublicTag, isJSDocReadonlyTag, isJSDocReturnTag, isJSDocSignature, isJSDocTemplateTag, - isJSDocThisTag, isJSDocTypeAlias, isJSDocTypeLiteral, isJSDocTypeTag, isModuleBlock, isNonNullExpression, - isNotEmittedStatement, isOmittedExpression, isParameter, isPartiallyEmittedExpression, isPrivateIdentifier, - isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, isRootedDiskPath, isSourceFile, - isStringLiteral, isTypeLiteralNode, isTypeNodeKind, isTypeReferenceNode, isVariableDeclaration, - isVariableDeclarationList, isVariableStatement, isWhiteSpaceLike, IterationStatement, JSDocAugmentsTag, - JSDocClassTag, JSDocComment, JSDocContainer, JSDocDeprecatedTag, JSDocEnumTag, JSDocImplementsTag, JSDocLink, - JSDocLinkCode, JSDocLinkPlain, JSDocNamespaceBody, JSDocOverrideTag, JSDocParameterTag, JSDocPrivateTag, - JSDocPropertyLikeTag, JSDocProtectedTag, JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSignature, JSDocTag, - JSDocTemplateTag, JSDocThisTag, JSDocTypedefTag, JSDocTypeTag, JsxAttributeLike, JsxChild, JsxExpression, - JsxOpeningLikeElement, JsxTagNameExpression, LabeledStatement, lastOrUndefined, LeftHandSideExpression, - LiteralExpression, LiteralToken, MemberName, MethodDeclaration, Modifier, ModifierFlags, ModifierLike, - modifierToFlag, ModuleBody, ModuleDeclaration, ModuleReference, NamedDeclaration, NamedExportBindings, - NamedImportBindings, NamespaceBody, NamespaceImport, NewExpression, Node, NodeArray, NodeFlags, NonNullChain, - normalizePath, NotEmittedStatement, ObjectBindingOrAssignmentElement, ObjectBindingOrAssignmentPattern, - ObjectLiteralElement, ObjectLiteralElementLike, OptionalChain, OptionalChainRoot, OuterExpressionKinds, - ParameterDeclaration, PartiallyEmittedExpression, pathIsRelative, PostfixUnaryExpression, PrefixUnaryExpression, - PrivateClassElementDeclaration, PrivateIdentifier, PrivateIdentifierPropertyAccessExpression, PropertyAccessChain, - PropertyAccessExpression, PropertyDeclaration, PropertyName, Push, QualifiedName, ScriptTarget, - SetAccessorDeclaration, setLocalizedDiagnosticMessages, setUILocale, SignatureDeclaration, skipOuterExpressions, - some, sortAndDeduplicate, SortedReadonlyArray, Statement, StringLiteral, StringLiteralLike, Symbol, SyntaxKind, - TemplateLiteral, TemplateLiteralToken, TemplateMiddle, TemplateTail, TextChangeRange, TextRange, TextSpan, - TypeElement, TypeNode, TypeOnlyAliasDeclaration, TypeParameterDeclaration, TypeReferenceType, UnaryExpression, - UnparsedNode, UnparsedTextLike, VariableDeclaration, + __String, + AccessExpression, + AccessorDeclaration, + ArrayBindingElement, + ArrayBindingOrAssignmentPattern, + AssertionExpression, + AssertionKey, + AssignmentDeclarationKind, + AssignmentPattern, + AutoAccessorPropertyDeclaration, + BinaryExpression, + BindableObjectDefinePropertyCall, + BindingElement, + BindingName, + BindingOrAssignmentElement, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + BindingPattern, + Block, + BooleanLiteral, + BreakOrContinueStatement, + CallChain, + CallExpression, + CallLikeExpression, + canHaveIllegalTypeParameters, + CaseOrDefaultClause, + CharacterCodes, + ClassElement, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + combinePaths, + compareDiagnostics, + CompilerOptions, + ConciseBody, + ConstructorDeclaration, + ConstructorTypeNode, + contains, + createCompilerDiagnostic, + Debug, + Declaration, + DeclarationName, + DeclarationStatement, + DeclarationWithTypeParameters, + Decorator, + Diagnostic, + Diagnostics, + ElementAccessChain, + ElementAccessExpression, + emptyArray, + EntityName, + entityNameToString, + EnumDeclaration, + every, + ExportAssignment, + ExportSpecifier, + Expression, + FileReference, + filter, + find, + flatMap, + ForInitializer, + ForInOrOfStatement, + FunctionBody, + FunctionLikeDeclaration, + FunctionTypeNode, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedPrivateIdentifier, + GetAccessorDeclaration, + getAssignmentDeclarationKind, + getDirectoryPath, + getEffectiveModifierFlags, + getEffectiveModifierFlagsAlwaysIncludeJSDoc, + getElementOrPropertyAccessArgumentExpressionOrName, + getEmitScriptTarget, + getJSDocCommentsAndTags, + getJSDocTypeParameterDeclarations, + hasAccessorModifier, + hasDecorators, + HasDecorators, + HasExpressionInitializer, + HasInitializer, + HasJSDoc, + HasModifiers, + hasProperty, + hasSyntacticModifier, + HasType, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + isAccessExpression, + isAmbientModule, + isAnyImportOrReExport, + isArrowFunction, + isBinaryExpression, + isBindableStaticElementAccessExpression, + isBindingElement, + isBlock, + isCallExpression, + isCallSignatureDeclaration, + isClassExpression, + isClassStaticBlockDeclaration, + isDecorator, + isElementAccessExpression, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isFunctionBlock, + isFunctionExpression, + isFunctionTypeNode, + isIdentifier, + isImportSpecifier, + isInJSFile, + isJSDoc, + isJSDocAugmentsTag, + isJSDocClassTag, + isJSDocDeprecatedTag, + isJSDocEnumTag, + isJSDocFunctionType, + isJSDocImplementsTag, + isJSDocOverrideTag, + isJSDocParameterTag, + isJSDocPrivateTag, + isJSDocProtectedTag, + isJSDocPublicTag, + isJSDocReadonlyTag, + isJSDocReturnTag, + isJSDocSignature, + isJSDocTemplateTag, + isJSDocThisTag, + isJSDocTypeAlias, + isJSDocTypeLiteral, + isJSDocTypeTag, + isModuleBlock, + isNonNullExpression, + isNotEmittedStatement, + isOmittedExpression, + isParameter, + isPartiallyEmittedExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isRootedDiskPath, + isSourceFile, + isStringLiteral, + isTypeLiteralNode, + isTypeNodeKind, + isTypeReferenceNode, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + isWhiteSpaceLike, + IterationStatement, + JSDocAugmentsTag, + JSDocClassTag, + JSDocComment, + JSDocContainer, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocNamespaceBody, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeTag, + JsxAttributeLike, + JsxChild, + JsxExpression, + JsxOpeningLikeElement, + JsxTagNameExpression, + LabeledStatement, + lastOrUndefined, + LeftHandSideExpression, + LiteralExpression, + LiteralToken, + MemberName, + MethodDeclaration, + Modifier, + ModifierFlags, + ModifierLike, + modifierToFlag, + ModuleBody, + ModuleDeclaration, + ModuleReference, + NamedDeclaration, + NamedExportBindings, + NamedImportBindings, + NamespaceBody, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFlags, + NonNullChain, + normalizePath, + NotEmittedStatement, + ObjectBindingOrAssignmentElement, + ObjectBindingOrAssignmentPattern, + ObjectLiteralElement, + ObjectLiteralElementLike, + OptionalChain, + OptionalChainRoot, + OuterExpressionKinds, + ParameterDeclaration, + PartiallyEmittedExpression, + pathIsRelative, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateClassElementDeclaration, + PrivateIdentifier, + PrivateIdentifierPropertyAccessExpression, + PropertyAccessChain, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + Push, + QualifiedName, + ScriptTarget, + SetAccessorDeclaration, + setLocalizedDiagnosticMessages, + setUILocale, + SignatureDeclaration, + skipOuterExpressions, + some, + sortAndDeduplicate, + SortedReadonlyArray, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SyntaxKind, + TemplateLiteral, + TemplateLiteralToken, + TemplateMiddle, + TemplateTail, + TextChangeRange, + TextRange, + TextSpan, + TypeElement, + TypeNode, + TypeOnlyAliasDeclaration, + TypeParameterDeclaration, + TypeReferenceType, + UnaryExpression, + UnparsedNode, + UnparsedTextLike, + VariableDeclaration, } from "./_namespaces/ts"; export function isExternalModuleNameRelative(moduleName: string): boolean { diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 1dec828d395d7..af0fd6e4db0ae 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -1,22 +1,106 @@ import { - ConciseBody, Debug, EmitFlags, Expression, factory, FunctionBody, getEmitFlags, getEmitScriptTarget, Identifier, - isArray, isArrayBindingElement, isAssertClause, isAssertEntry, isAssertionKey, isAssertsKeyword, isAsteriskToken, - isAwaitKeyword, isBinaryOperatorToken, isBindingElement, isBindingName, isBindingPattern, isBlock, isCallChain, - isCaseBlock, isCaseOrDefaultClause, isCatchClause, isClassElement, isColonToken, isConciseBody, isDotDotDotToken, - isElementAccessChain, isEntityName, isEnumMember, isEqualsGreaterThanToken, isExclamationToken, isExportSpecifier, - isExpression, isExpressionWithTypeArguments, isForInitializer, isHeritageClause, isIdentifier, - isIdentifierOrThisTypeNode, isImportClause, isImportSpecifier, isImportTypeAssertionContainer, isJsxAttributeLike, - isJsxAttributes, isJsxChild, isJsxClosingElement, isJsxClosingFragment, isJsxOpeningElement, isJsxOpeningFragment, - isJsxTagNameExpression, isMemberName, isModifier, isModifierLike, isModuleBody, isModuleName, isModuleReference, - isNamedExportBindings, isNamedImportBindings, isObjectLiteralElementLike, isOptionalChain, isParameterDeclaration, - isPropertyAccessChain, isPropertyName, isQuestionDotToken, isQuestionOrExclamationToken, - isQuestionOrPlusOrMinusToken, isQuestionToken, isReadonlyKeywordOrPlusOrMinusToken, isStatement, - isStringLiteralOrJsxExpression, isTemplateHead, isTemplateLiteral, isTemplateLiteralTypeSpan, - isTemplateMiddleOrTemplateTail, isTemplateSpan, isToken, isTypeElement, isTypeNode, - isTypeNodeOrTypeParameterDeclaration, isTypeParameterDeclaration, isVariableDeclaration, isVariableDeclarationList, - LexicalEnvironmentFlags, Node, NodeArray, NodesVisitor, NodeVisitor, ParameterDeclaration, ScriptTarget, - setEmitFlags, setTextRange, setTextRangePosEnd, singleOrUndefined, some, Statement, SyntaxKind, - TransformationContext, VisitEachChildNodes, Visitor, + ConciseBody, + Debug, + EmitFlags, + Expression, + factory, + FunctionBody, + getEmitFlags, + getEmitScriptTarget, + Identifier, + isArray, + isArrayBindingElement, + isAssertClause, + isAssertEntry, + isAssertionKey, + isAssertsKeyword, + isAsteriskToken, + isAwaitKeyword, + isBinaryOperatorToken, + isBindingElement, + isBindingName, + isBindingPattern, + isBlock, + isCallChain, + isCaseBlock, + isCaseOrDefaultClause, + isCatchClause, + isClassElement, + isColonToken, + isConciseBody, + isDotDotDotToken, + isElementAccessChain, + isEntityName, + isEnumMember, + isEqualsGreaterThanToken, + isExclamationToken, + isExportSpecifier, + isExpression, + isExpressionWithTypeArguments, + isForInitializer, + isHeritageClause, + isIdentifier, + isIdentifierOrThisTypeNode, + isImportClause, + isImportSpecifier, + isImportTypeAssertionContainer, + isJsxAttributeLike, + isJsxAttributes, + isJsxChild, + isJsxClosingElement, + isJsxClosingFragment, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxTagNameExpression, + isMemberName, + isModifier, + isModifierLike, + isModuleBody, + isModuleName, + isModuleReference, + isNamedExportBindings, + isNamedImportBindings, + isObjectLiteralElementLike, + isOptionalChain, + isParameterDeclaration, + isPropertyAccessChain, + isPropertyName, + isQuestionDotToken, + isQuestionOrExclamationToken, + isQuestionOrPlusOrMinusToken, + isQuestionToken, + isReadonlyKeywordOrPlusOrMinusToken, + isStatement, + isStringLiteralOrJsxExpression, + isTemplateHead, + isTemplateLiteral, + isTemplateLiteralTypeSpan, + isTemplateMiddleOrTemplateTail, + isTemplateSpan, + isToken, + isTypeElement, + isTypeNode, + isTypeNodeOrTypeParameterDeclaration, + 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 27e281428d913..16bd5f3e8dd4c 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -1,23 +1,110 @@ import { - addRange, BuilderProgram, CancellationToken, chainDiagnosticMessages, CharacterCodes, combinePaths, CompilerHost, - CompilerOptions, contains, convertToRelativePath, copyProperties, countWhere, createCompilerDiagnostic, - createEmitAndSemanticDiagnosticsBuilderProgram, createGetCanonicalFileName, createGetSourceFile, - createIncrementalCompilerHost, createIncrementalProgram, CreateProgram, createWriteFileMeasuringIO, - CustomTransformers, Debug, Diagnostic, DiagnosticCategory, DiagnosticMessage, DiagnosticMessageChain, - DiagnosticReporter, Diagnostics, DirectoryStructureHost, EmitAndSemanticDiagnosticsBuilderProgram, EmitResult, emptyArray, - endsWith, ExitStatus, ExtendedConfigCacheEntry, Extension, externalHelpersModuleNameText, FileExtensionInfo, - fileExtensionIs, FileIncludeKind, FileIncludeReason, FileWatcher, filter, find, flattenDiagnosticMessageText, - forEach, forEachEntry, ForegroundColorEscapeSequences, formatColorAndReset, formatDiagnostic, FormatDiagnosticsHost, - formatDiagnosticsWithColorAndContext, generateDjb2Hash, getDefaultLibFileName, getDirectoryPath, - getEmitScriptTarget, getLineAndCharacterOfPosition, getNewLineCharacter, getNormalizedAbsolutePath, - getParsedCommandLineOfConfigFile, getPatternFromSpec, getReferencedFileLocation, getRegexFromPattern, - getRelativePathFromDirectory, getWatchFactory, HasCurrentDirectory, isExternalOrCommonJsModule, isLineBreak, - isReferencedFile, isReferenceFileLocation, isString, last, maybeBind, memoize, ModuleKind, noop, normalizePath, - outFile, packageIdToString, ParseConfigFileHost, ParsedCommandLine, pathIsAbsolute, Program, ProgramHost, ProjectReference, - ReportEmitErrorSummary, ReportFileInError, sortAndDeduplicateDiagnostics, SortedReadonlyArray, SourceFile, sourceMapCommentRegExp, - sourceMapCommentRegExpDontCareLineStart, sys, System, targetOptionDeclaration, WatchCompilerHost, - WatchCompilerHostOfConfigFile, WatchCompilerHostOfFilesAndCompilerOptions, WatchFactory, WatchFactoryHost, WatchHost, - WatchLogLevel, WatchOptions, WatchStatusReporter, whitespaceOrMapCommentRegExp, WriteFileCallback, + addRange, + BuilderProgram, + CancellationToken, + chainDiagnosticMessages, + CharacterCodes, + combinePaths, + CompilerHost, + CompilerOptions, + contains, + convertToRelativePath, + copyProperties, + countWhere, + createCompilerDiagnostic, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createGetSourceFile, + createIncrementalCompilerHost, + createIncrementalProgram, + CreateProgram, + createWriteFileMeasuringIO, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticReporter, + Diagnostics, + DirectoryStructureHost, + EmitAndSemanticDiagnosticsBuilderProgram, + EmitResult, + emptyArray, + endsWith, + ExitStatus, + ExtendedConfigCacheEntry, + Extension, + externalHelpersModuleNameText, + FileExtensionInfo, + fileExtensionIs, + FileIncludeKind, + FileIncludeReason, + FileWatcher, + filter, + find, + flattenDiagnosticMessageText, + forEach, + forEachEntry, + ForegroundColorEscapeSequences, + formatColorAndReset, + formatDiagnostic, + FormatDiagnosticsHost, + formatDiagnosticsWithColorAndContext, + generateDjb2Hash, + getDefaultLibFileName, + getDirectoryPath, + getEmitScriptTarget, + getLineAndCharacterOfPosition, + getNewLineCharacter, + getNormalizedAbsolutePath, + getParsedCommandLineOfConfigFile, + getPatternFromSpec, + getReferencedFileLocation, + getRegexFromPattern, + getRelativePathFromDirectory, + getWatchFactory, + HasCurrentDirectory, + isExternalOrCommonJsModule, + isLineBreak, + isReferencedFile, + isReferenceFileLocation, + isString, + last, + maybeBind, + memoize, + ModuleKind, + noop, + normalizePath, + outFile, + packageIdToString, + ParseConfigFileHost, + ParsedCommandLine, + pathIsAbsolute, + Program, + ProgramHost, + ProjectReference, + ReportEmitErrorSummary, + ReportFileInError, + sortAndDeduplicateDiagnostics, + SortedReadonlyArray, + SourceFile, + sourceMapCommentRegExp, + sourceMapCommentRegExpDontCareLineStart, + sys, + System, + targetOptionDeclaration, + WatchCompilerHost, + WatchCompilerHostOfConfigFile, + WatchCompilerHostOfFilesAndCompilerOptions, + WatchFactory, + WatchFactoryHost, + WatchHost, + WatchLogLevel, + WatchOptions, + WatchStatusReporter, + whitespaceOrMapCommentRegExp, + WriteFileCallback, } from "./_namespaces/ts"; const sysFormatDiagnosticsHost: FormatDiagnosticsHost | undefined = sys ? { diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index e283f5859d6ef..6810e32608551 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -1,25 +1,94 @@ import * as ts from "./_namespaces/ts"; import { - BuilderProgram, BuildInfo, canJsonReportNoInputFiles, changeCompilerHostLikeToUseCache, - changesAffectModuleResolution, cleanExtendedConfigCache, clearMap, clearSharedExtendedConfigFileWatcher, - closeFileWatcher, closeFileWatcherOf, CompilerHost, CompilerOptions, ConfigFileDiagnosticsReporter, - ConfigFileProgramReloadLevel, createBuilderProgramUsingProgramBuildInfo, createCachedDirectoryStructureHost, - createCompilerDiagnostic, createCompilerHostFromProgramHost, createCompilerHostWorker, - createEmitAndSemanticDiagnosticsBuilderProgram, createGetCanonicalFileName, createResolutionCache, - CreateSourceFileOptions, createWatchCompilerHostOfConfigFile, createWatchCompilerHostOfFilesAndCompilerOptions, - createWatchFactory, Debug, Diagnostic, DiagnosticMessage, DiagnosticReporter, Diagnostics, DirectoryStructureHost, - DirectoryWatcherCallback, EmitAndSemanticDiagnosticsBuilderProgram, ExtendedConfigCacheEntry, - FileExtensionInfo, FileReference, FileWatcher, FileWatcherCallback, FileWatcherEventKind, getBuildInfo, - getConfigFileParsingDiagnostics, getDirectoryPath, getEntries, getFileNamesFromConfigSpecs, getNewLineCharacter, - getNormalizedAbsolutePath, getParsedCommandLineOfConfigFile, getTsBuildInfoEmitOutputFilePath, - HasInvalidatedResolutions, isArray, isIgnoredFileFromWildCardWatching, isProgramUptoDate, MapLike, maybeBind, - ModuleResolutionCache, ModuleResolutionInfo, noop, noopFileWatcher, parseConfigHostFromCompilerHostLike, - ParsedCommandLine, Path, perfLogger, PollingInterval, ProjectReference, ResolutionCacheHost, ResolutionMode, ResolvedModule, - ResolvedProjectReference, ResolvedTypeReferenceDirective, returnFalse, returnTrue, ScriptTarget, - setGetSourceFileAsHashVersioned, SharedExtendedConfigFileWatcher, SourceFile, sys, System, toPath, + BuilderProgram, + BuildInfo, + canJsonReportNoInputFiles, + changeCompilerHostLikeToUseCache, + changesAffectModuleResolution, + cleanExtendedConfigCache, + clearMap, + clearSharedExtendedConfigFileWatcher, + closeFileWatcher, + closeFileWatcherOf, + CompilerHost, + CompilerOptions, + ConfigFileDiagnosticsReporter, + ConfigFileProgramReloadLevel, + createBuilderProgramUsingProgramBuildInfo, + createCachedDirectoryStructureHost, + createCompilerDiagnostic, + createCompilerHostFromProgramHost, + createCompilerHostWorker, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createResolutionCache, + CreateSourceFileOptions, + createWatchCompilerHostOfConfigFile, + createWatchCompilerHostOfFilesAndCompilerOptions, + createWatchFactory, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + DirectoryStructureHost, + DirectoryWatcherCallback, + EmitAndSemanticDiagnosticsBuilderProgram, + ExtendedConfigCacheEntry, + FileExtensionInfo, + FileReference, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + getBuildInfo, + getConfigFileParsingDiagnostics, + getDirectoryPath, + getEntries, + getFileNamesFromConfigSpecs, + getNewLineCharacter, + getNormalizedAbsolutePath, + getParsedCommandLineOfConfigFile, + getTsBuildInfoEmitOutputFilePath, + HasInvalidatedResolutions, + isArray, + isIgnoredFileFromWildCardWatching, + isProgramUptoDate, + MapLike, + maybeBind, + ModuleResolutionCache, + ModuleResolutionInfo, + noop, + noopFileWatcher, + parseConfigHostFromCompilerHostLike, + ParsedCommandLine, + Path, + perfLogger, + PollingInterval, + ProjectReference, + ResolutionCacheHost, + ResolutionMode, + ResolvedModule, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + returnFalse, + returnTrue, + ScriptTarget, + setGetSourceFileAsHashVersioned, + SharedExtendedConfigFileWatcher, + SourceFile, + sys, + System, + toPath, TypeReferenceDirectiveResolutionInfo, - updateErrorForNoInputFiles, updateMissingFilePathsWatch, updateSharedExtendedConfigFileWatcher, - updateWatchingWildcardDirectories, version, WatchDirectoryFlags, WatchOptions, WatchType, WatchTypeRegistry, + updateErrorForNoInputFiles, + updateMissingFilePathsWatch, + updateSharedExtendedConfigFileWatcher, + updateWatchingWildcardDirectories, + version, + WatchDirectoryFlags, + WatchOptions, + WatchType, + WatchTypeRegistry, WildcardDirectoryWatcher, } from "./_namespaces/ts"; diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 8f4ee079fcee2..62d6ffee46091 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -1,14 +1,58 @@ 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, find, - getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, hasExtension, identity, insertSorted, isArray, - isDeclarationFileName, isExcludedFile, isSupportedSourceFileName, map, matchesExclude, matchFiles, mutateMap, - noop, normalizePath, outFile, Path, PollingInterval, Program, removeFileExtension, removeIgnoredPath, - returnNoopFileWatcher, returnTrue, setSysLog, SortedArray, SortedReadonlyArray, supportedJSExtensionsFlat, - timestamp, WatchDirectoryFlags, WatchFileKind, WatchOptions, + arrayToMap, + binarySearch, + BuilderProgram, + closeFileWatcher, + compareStringsCaseSensitive, + CompilerOptions, + createGetCanonicalFileName, + Debug, + DirectoryWatcherCallback, + emptyArray, + emptyFileSystemEntries, + ensureTrailingDirectorySeparator, + ExtendedConfigCacheEntry, + Extension, + FileExtensionInfo, + fileExtensionIsOneOf, + FileSystemEntries, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + find, + getBaseFileName, + getDirectoryPath, + getNormalizedAbsolutePath, + hasExtension, + identity, + insertSorted, + isArray, + isDeclarationFileName, + isExcludedFile, + isSupportedSourceFileName, + map, + matchesExclude, + matchFiles, + mutateMap, + noop, + normalizePath, + outFile, + Path, + PollingInterval, + Program, + removeFileExtension, + removeIgnoredPath, + returnNoopFileWatcher, + returnTrue, + setSysLog, + SortedArray, + SortedReadonlyArray, + supportedJSExtensionsFlat, + timestamp, + WatchDirectoryFlags, + WatchFileKind, + WatchOptions, } from "./_namespaces/ts"; /** diff --git a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts index 2c6778e9b5797..caca5fc914394 100644 --- a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts +++ b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts @@ -1,14 +1,68 @@ import { - ArrowFunction, AsteriskToken, BinaryExpression, BinaryOperator, BinaryOperatorToken, BindingName, BooleanLiteral, - ClassElement, ClassExpression, ColonToken, ConciseBody, ConditionalExpression, ConstructorTypeNode, Debug, - Decorator, DeprecationOptions, EntityName, EqualsGreaterThanToken, ExclamationToken, ExportDeclaration, Expression, - ExpressionWithTypeArguments, factory, GeneratedIdentifierFlags, HeritageClause, Identifier, ImportClause, - IndexSignatureDeclaration, isNodeKind, JSDocParameterTag, JSDocTypeExpression, MethodSignature, Modifier, Mutable, - NamedExportBindings, NamedImportBindings, Node, NodeArray, NoSubstitutionTemplateLiteral, NumericLiteral, - ParameterDeclaration, parseBaseNodeFactory, PostfixUnaryExpression, PrefixUnaryExpression, PrimaryExpression, - PropertyName, PropertySignature, PseudoBigInt, QuestionToken, setParent, setTextRange, setTextRangePosEnd, - StringLiteral, SyntaxKind, TaggedTemplateExpression, TemplateLiteral, ThisTypeNode, Token, TypeNode, - TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, VariableDeclaration, YieldExpression, + ArrowFunction, + AsteriskToken, + BinaryExpression, + BinaryOperator, + BinaryOperatorToken, + BindingName, + BooleanLiteral, + ClassElement, + ClassExpression, + ColonToken, + ConciseBody, + ConditionalExpression, + ConstructorTypeNode, + Debug, + Decorator, + DeprecationOptions, + EntityName, + EqualsGreaterThanToken, + ExclamationToken, + ExportDeclaration, + Expression, + ExpressionWithTypeArguments, + factory, + GeneratedIdentifierFlags, + HeritageClause, + Identifier, + ImportClause, + IndexSignatureDeclaration, + isNodeKind, + JSDocParameterTag, + JSDocTypeExpression, + MethodSignature, + Modifier, + Mutable, + NamedExportBindings, + NamedImportBindings, + Node, + NodeArray, + NoSubstitutionTemplateLiteral, + NumericLiteral, + ParameterDeclaration, + parseBaseNodeFactory, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrimaryExpression, + PropertyName, + PropertySignature, + PseudoBigInt, + QuestionToken, + setParent, + setTextRange, + setTextRangePosEnd, + StringLiteral, + SyntaxKind, + TaggedTemplateExpression, + TemplateLiteral, + ThisTypeNode, + Token, + TypeNode, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + VariableDeclaration, + YieldExpression, } from "../_namespaces/ts"; import { deprecate } from "../deprecate"; diff --git a/src/deprecatedCompat/4.0/renamedNodeTests.ts b/src/deprecatedCompat/4.0/renamedNodeTests.ts index a168223b6f383..0b3f0125de673 100644 --- a/src/deprecatedCompat/4.0/renamedNodeTests.ts +++ b/src/deprecatedCompat/4.0/renamedNodeTests.ts @@ -1,4 +1,8 @@ -import { Node, SyntaxKind, TypeAssertion } from "../_namespaces/ts"; +import { + Node, + SyntaxKind, + TypeAssertion, +} from "../_namespaces/ts"; import { deprecate } from "../deprecate"; // DEPRECATION: Renamed node tests diff --git a/src/deprecatedCompat/4.2/abstractConstructorTypes.ts b/src/deprecatedCompat/4.2/abstractConstructorTypes.ts index 93a305656d6f9..5de292fb9bce3 100644 --- a/src/deprecatedCompat/4.2/abstractConstructorTypes.ts +++ b/src/deprecatedCompat/4.2/abstractConstructorTypes.ts @@ -1,6 +1,14 @@ import { - addNodeFactoryPatcher, buildOverload, ConstructorTypeNode, factory, Modifier, NodeArray, NodeFactory, - ParameterDeclaration, TypeNode, TypeParameterDeclaration, + addNodeFactoryPatcher, + buildOverload, + ConstructorTypeNode, + factory, + Modifier, + NodeArray, + NodeFactory, + ParameterDeclaration, + TypeNode, + TypeParameterDeclaration, } 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 07c8524122bec..78a0f155f53d1 100644 --- a/src/deprecatedCompat/4.2/renamedNodeTests.ts +++ b/src/deprecatedCompat/4.2/renamedNodeTests.ts @@ -1,4 +1,8 @@ -import { isMemberName, MemberName, Node } from "../_namespaces/ts"; +import { + isMemberName, + MemberName, + Node, +} from "../_namespaces/ts"; import { deprecate } from "../deprecate"; // DEPRECATION: Renamed node tests diff --git a/src/deprecatedCompat/4.6/importTypeAssertions.ts b/src/deprecatedCompat/4.6/importTypeAssertions.ts index 143e06edc48ff..738eb2327d1b4 100644 --- a/src/deprecatedCompat/4.6/importTypeAssertions.ts +++ b/src/deprecatedCompat/4.6/importTypeAssertions.ts @@ -1,6 +1,15 @@ import { - addNodeFactoryPatcher, buildOverload, EntityName, factory, ImportTypeAssertionContainer, ImportTypeNode, isArray, - isEntityName, isImportTypeAssertionContainer, NodeFactory, TypeNode, + addNodeFactoryPatcher, + buildOverload, + EntityName, + factory, + ImportTypeAssertionContainer, + ImportTypeNode, + isArray, + isEntityName, + isImportTypeAssertionContainer, + NodeFactory, + TypeNode, } from "../_namespaces/ts"; // DEPRECATION: Overloads to createImportTypeNode/updateImportTypeNode that do not accept `assertions` diff --git a/src/deprecatedCompat/4.7/typeParameterModifiers.ts b/src/deprecatedCompat/4.7/typeParameterModifiers.ts index 6bb1c1630032c..97f35beba4150 100644 --- a/src/deprecatedCompat/4.7/typeParameterModifiers.ts +++ b/src/deprecatedCompat/4.7/typeParameterModifiers.ts @@ -1,5 +1,12 @@ import { - addNodeFactoryPatcher, buildOverload, factory, Identifier, isArray, Modifier, NodeFactory, TypeNode, + addNodeFactoryPatcher, + buildOverload, + factory, + Identifier, + isArray, + Modifier, + NodeFactory, + TypeNode, TypeParameterDeclaration, } from "../_namespaces/ts"; diff --git a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts index 66b163c92d431..d23969ccda6be 100644 --- a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts +++ b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts @@ -1,16 +1,80 @@ 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, Identifier, - ImportClause, ImportDeclaration, ImportEqualsDeclaration, IndexSignatureDeclaration, InterfaceDeclaration, isArray, - isAssertClause, isAsteriskToken, isBindingName, isBlock, isClassElement, isDecorator, isDotDotDotToken, - isExpression, isHeritageClause, isIdentifier, isImportClause, isModifier, isModuleBody, isModuleName, - isModuleReference, isNamedExportBindings, isParameter, isPropertyName, isQuestionOrExclamationToken, - isQuestionToken, isTypeElement, isTypeNode, isTypeParameterDeclaration, MethodDeclaration, Modifier, ModifierLike, - ModuleBody, ModuleDeclaration, ModuleName, ModuleReference, NamedExportBindings, NodeFactory, NodeFlags, - ParameterDeclaration, PropertyDeclaration, PropertyName, QuestionToken, SetAccessorDeclaration, some, - TypeAliasDeclaration, TypeElement, TypeNode, TypeParameterDeclaration, + 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, + Identifier, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + IndexSignatureDeclaration, + InterfaceDeclaration, + isArray, + isAssertClause, + isAsteriskToken, + isBindingName, + isBlock, + isClassElement, + isDecorator, + isDotDotDotToken, + isExpression, + isHeritageClause, + isIdentifier, + isImportClause, + isModifier, + isModuleBody, + isModuleName, + isModuleReference, + isNamedExportBindings, + isParameter, + isPropertyName, + isQuestionOrExclamationToken, + isQuestionToken, + 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 6041425852a9f..c56abe2df1ef2 100644 --- a/src/deprecatedCompat/deprecate.ts +++ b/src/deprecatedCompat/deprecate.ts @@ -1,4 +1,11 @@ -import { Debug, DeprecationOptions, formatStringFromArgs, noop, version, Version } from "./_namespaces/ts"; +import { + Debug, + DeprecationOptions, + formatStringFromArgs, + noop, + version, + Version, +} from "./_namespaces/ts"; export let enableDeprecationWarnings = true; diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index 2f8b59c3411a9..8682631b07830 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -1,4 +1,8 @@ -import { hasProperty, UnionToIntersection, Version } from "./_namespaces/ts"; +import { + hasProperty, + UnionToIntersection, + Version, +} from "./_namespaces/ts"; import { deprecate } from "./deprecate"; /** @internal */ diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 9561348f84da2..58bd58cb02150 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -1,22 +1,92 @@ import * as ts from "./_namespaces/ts"; import { - arrayFrom, BuilderProgram, BuildOptions, buildOpts, changeCompilerHostLikeToUseCache, CharacterCodes, combinePaths, - CommandLineOption, compareStringsCaseInsensitive, CompilerOptions, contains, convertToOptionsWithAbsolutePaths, - convertToTSConfig, createBuilderStatusReporter, createCompilerDiagnostic, createCompilerHostWorker, - createDiagnosticReporter, createGetCanonicalFileName, createIncrementalCompilerHost, createProgram, CreateProgram, - CreateProgramOptions, createSolutionBuilder, createSolutionBuilderHost, createSolutionBuilderWithWatch, - createSolutionBuilderWithWatchHost, createWatchCompilerHostOfConfigFile, - createWatchCompilerHostOfFilesAndCompilerOptions, createWatchProgram, Debug, Diagnostic, DiagnosticMessage, - DiagnosticReporter, Diagnostics, dumpTracingLegend, EmitAndSemanticDiagnosticsBuilderProgram, - emitFilesAndReportErrorsAndGetExitStatus, ExitStatus, ExtendedConfigCacheEntry, Extension, fileExtensionIs, - fileExtensionIsOneOf, filter, findConfigFile, forEach, formatMessage, generateTSConfig, - getBuildOrderFromAnyBuildOrder, getCompilerOptionsDiffValue, getConfigFileParsingDiagnostics, getDiagnosticText, - getEntries, getErrorSummaryText, getLineStarts, getNormalizedAbsolutePath, isIncrementalCompilation, isWatchSet, - normalizePath, optionDeclarations, optionsForBuild, optionsForWatch, padLeft, padRight, parseBuildCommand, - parseCommandLine, parseConfigFileWithSystem, ParsedCommandLine, Program, reduceLeftIterator, ReportEmitErrorSummary, - SolutionBuilder, SolutionBuilderHostBase, sort, SourceFile, startsWith, startTracing, stringContains, - supportedJSExtensionsFlat, supportedTSExtensionsFlat, sys, System, toPath, tracing, validateLocaleAndSetLanguage, - version, WatchCompilerHost, WatchOptions, + arrayFrom, + BuilderProgram, + BuildOptions, + buildOpts, + changeCompilerHostLikeToUseCache, + CharacterCodes, + combinePaths, + CommandLineOption, + compareStringsCaseInsensitive, + CompilerOptions, + contains, + convertToOptionsWithAbsolutePaths, + convertToTSConfig, + createBuilderStatusReporter, + createCompilerDiagnostic, + createCompilerHostWorker, + createDiagnosticReporter, + createGetCanonicalFileName, + createIncrementalCompilerHost, + createProgram, + CreateProgram, + CreateProgramOptions, + createSolutionBuilder, + createSolutionBuilderHost, + createSolutionBuilderWithWatch, + createSolutionBuilderWithWatchHost, + createWatchCompilerHostOfConfigFile, + createWatchCompilerHostOfFilesAndCompilerOptions, + createWatchProgram, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + dumpTracingLegend, + EmitAndSemanticDiagnosticsBuilderProgram, + emitFilesAndReportErrorsAndGetExitStatus, + ExitStatus, + ExtendedConfigCacheEntry, + Extension, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + findConfigFile, + forEach, + formatMessage, + generateTSConfig, + getBuildOrderFromAnyBuildOrder, + getCompilerOptionsDiffValue, + getConfigFileParsingDiagnostics, + getDiagnosticText, + getEntries, + getErrorSummaryText, + getLineStarts, + getNormalizedAbsolutePath, + isIncrementalCompilation, + isWatchSet, + normalizePath, + optionDeclarations, + optionsForBuild, + optionsForWatch, + padLeft, + padRight, + parseBuildCommand, + parseCommandLine, + parseConfigFileWithSystem, + ParsedCommandLine, + Program, + reduceLeftIterator, + ReportEmitErrorSummary, + SolutionBuilder, + SolutionBuilderHostBase, + sort, + SourceFile, + startsWith, + startTracing, + stringContains, + supportedJSExtensionsFlat, + supportedTSExtensionsFlat, + sys, + System, + toPath, + tracing, + validateLocaleAndSetLanguage, + version, + WatchCompilerHost, + WatchOptions, } from "./_namespaces/ts"; import * as performance from "../compiler/_namespaces/ts.performance"; diff --git a/src/harness/client.ts b/src/harness/client.ts index ee8d9add7c400..cfc1c6f1557fa 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -1,18 +1,81 @@ import { - ApplicableRefactorInfo, CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, Classifications, - ClassifiedSpan, CodeActionCommand, CodeFixAction, CompletionEntry, CompletionEntryDetails, CompletionInfo, - computeLineAndCharacterOfPosition, computeLineStarts, computePositionOfLineAndCharacter, createQueue, - createTextSpanFromBounds, Debug, DefinitionInfo, DefinitionInfoAndBoundSpan, Diagnostic, DiagnosticCategory, - DiagnosticWithLocation, DocCommentTemplateOptions, DocumentHighlights, DocumentSpan, EditorOptions, EmitOutput, - FileTextChanges, firstDefined, FormatCodeOptions, FormatCodeSettings, getSnapshotText, identity, - ImplementationLocation, InlayHint, InlayHintKind, isString, JSDocTagInfo, LanguageService, LanguageServiceHost, map, - mapOneOrMany, NavigateToItem, NavigationBarItem, NavigationTree, notImplemented, OrganizeImportsArgs, - OutliningSpan, PatternMatchKind, Program, QuickInfo, RefactorEditInfo, ReferencedSymbol, ReferenceEntry, RenameInfo, - RenameInfoFailure, RenameInfoSuccess, RenameLocation, ScriptElementKind, SemanticClassificationFormat, - SignatureHelpItem, SignatureHelpItems, SourceFile, Symbol, TextChange, TextInsertion, textPart, TextRange, TextSpan, - TodoComment, TodoCommentDescriptor, UserPreferences, + ApplicableRefactorInfo, + CallHierarchyIncomingCall, + CallHierarchyItem, + CallHierarchyOutgoingCall, + Classifications, + ClassifiedSpan, + CodeActionCommand, + CodeFixAction, + CompletionEntry, + CompletionEntryDetails, + CompletionInfo, + computeLineAndCharacterOfPosition, + computeLineStarts, + computePositionOfLineAndCharacter, + createQueue, + createTextSpanFromBounds, + Debug, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + Diagnostic, + DiagnosticCategory, + DiagnosticWithLocation, + DocCommentTemplateOptions, + DocumentHighlights, + DocumentSpan, + EditorOptions, + EmitOutput, + FileTextChanges, + firstDefined, + FormatCodeOptions, + FormatCodeSettings, + getSnapshotText, + identity, + ImplementationLocation, + InlayHint, + InlayHintKind, + isString, + JSDocTagInfo, + LanguageService, + LanguageServiceHost, + map, + mapOneOrMany, + NavigateToItem, + NavigationBarItem, + NavigationTree, + notImplemented, + OrganizeImportsArgs, + OutliningSpan, + PatternMatchKind, + Program, + QuickInfo, + RefactorEditInfo, + ReferencedSymbol, + ReferenceEntry, + RenameInfo, + RenameInfoFailure, + RenameInfoSuccess, + RenameLocation, + ScriptElementKind, + SemanticClassificationFormat, + SignatureHelpItem, + SignatureHelpItems, + SourceFile, + Symbol, + TextChange, + TextInsertion, + textPart, + TextRange, + TextSpan, + TodoComment, + TodoCommentDescriptor, + UserPreferences, } from "./_namespaces/ts"; -import { CommandNames, protocol } from "./_namespaces/ts.server"; +import { + CommandNames, + protocol, +} from "./_namespaces/ts.server"; export interface SessionClientHost extends LanguageServiceHost { writeMessage(message: string): void; diff --git a/src/harness/findUpDir.ts b/src/harness/findUpDir.ts index 878bd87dcb323..52f6d766668ca 100644 --- a/src/harness/findUpDir.ts +++ b/src/harness/findUpDir.ts @@ -1,5 +1,9 @@ import { existsSync } from "fs"; -import { dirname, join, resolve } from "path"; +import { + dirname, + join, + resolve, +} from "path"; // search directories upward to avoid hard-wired paths based on the // build tree (same as scripts/build/findUpDir.js) diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index a8994387a0521..642e4990385b3 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -5,7 +5,11 @@ import * as vfs from "./_namespaces/vfs"; import * as compiler from "./_namespaces/compiler"; import * as documents from "./_namespaces/documents"; import * as fakes from "./_namespaces/fakes"; -import { RunnerBase, TypeWriterResult, TypeWriterWalker } from "./_namespaces/Harness"; +import { + RunnerBase, + TypeWriterResult, + TypeWriterWalker, +} from "./_namespaces/Harness"; export interface IO { newLine(): string; diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 85a543d3f0f86..80bec464788d3 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -4,7 +4,12 @@ import * as vfs from "./_namespaces/vfs"; import * as collections from "./_namespaces/collections"; import * as vpath from "./_namespaces/vpath"; import * as Utils from "./_namespaces/Utils"; -import { Compiler, harnessNewLine, mockHash, virtualFileSystemRoot } from "./_namespaces/Harness"; +import { + Compiler, + harnessNewLine, + mockHash, + virtualFileSystemRoot, +} from "./_namespaces/Harness"; export function makeDefaultProxy(info: ts.server.PluginCreateInfo): ts.LanguageService { const proxy = Object.create(/*prototype*/ null); // eslint-disable-line no-null/no-null diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts index 6a3ee7ef730be..ed85064d8d839 100644 --- a/src/harness/runnerbase.ts +++ b/src/harness/runnerbase.ts @@ -1,5 +1,9 @@ import * as ts from "./_namespaces/ts"; -import { FileBasedTest, IO, userSpecifiedRoot } from "./_namespaces/Harness"; +import { + FileBasedTest, + IO, + userSpecifiedRoot, +} from "./_namespaces/Harness"; export type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project" | "rwc" | "test262" | "user" | "dt" | "docker"; export type CompilerTestKind = "conformance" | "compiler"; diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 4823dac905e83..e3e67e1909dc6 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -1,9 +1,34 @@ import { - CharacterCodes, combinePaths, compareStringsCaseSensitive, CompilerOptions, Debug, deduplicate, - equateStringsCaseSensitive, Extension, fileExtensionIs, flatMap, forEach, getBaseFileName, getDirectoryPath, - getEntries, getNormalizedAbsolutePath, getOwnKeys, getPathComponents, getProperty, hasJSFileExtension, - mapDefined, MapLike, normalizePath, Path, readConfigFile, removeFileExtension, - removeMinAndVersionNumbers, some, TypeAcquisition, Version, versionMajorMinor, + CharacterCodes, + combinePaths, + compareStringsCaseSensitive, + CompilerOptions, + Debug, + deduplicate, + equateStringsCaseSensitive, + Extension, + fileExtensionIs, + flatMap, + forEach, + getBaseFileName, + getDirectoryPath, + getEntries, + getNormalizedAbsolutePath, + getOwnKeys, + getPathComponents, + getProperty, + hasJSFileExtension, + mapDefined, + MapLike, + normalizePath, + Path, + readConfigFile, + removeFileExtension, + removeMinAndVersionNumbers, + some, + TypeAcquisition, + Version, + versionMajorMinor, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/jsTyping/shared.ts b/src/jsTyping/shared.ts index f004b0257ad03..c6a3dfb38bda2 100644 --- a/src/jsTyping/shared.ts +++ b/src/jsTyping/shared.ts @@ -1,4 +1,7 @@ -import { padLeft, sys } from "./_namespaces/ts"; +import { + padLeft, + sys, +} from "./_namespaces/ts"; export type ActionSet = "action::set"; export type ActionInvalidate = "action::invalidate"; diff --git a/src/jsTyping/types.ts b/src/jsTyping/types.ts index 013e32553c6e1..a30a215adf12a 100644 --- a/src/jsTyping/types.ts +++ b/src/jsTyping/types.ts @@ -1,10 +1,23 @@ import { - ActionInvalidate, ActionPackageInstalled, ActionSet, EventBeginInstallTypes, EventEndInstallTypes, - EventInitializationFailed, EventTypesRegistry, + ActionInvalidate, + ActionPackageInstalled, + ActionSet, + EventBeginInstallTypes, + EventEndInstallTypes, + EventInitializationFailed, + EventTypesRegistry, } from "./_namespaces/ts.server"; import { - CompilerOptions, DirectoryWatcherCallback, FileWatcher, FileWatcherCallback, JsTyping, MapLike, Path, - SortedReadonlyArray, TypeAcquisition, WatchOptions, + CompilerOptions, + DirectoryWatcherCallback, + FileWatcher, + FileWatcherCallback, + JsTyping, + MapLike, + Path, + SortedReadonlyArray, + TypeAcquisition, + WatchOptions, } from "./_namespaces/ts"; export interface TypingInstallerResponse { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index bbfd4dfe11042..6b27c3296bcbb 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1,38 +1,184 @@ import { - ActionInvalidate, ActionSet, asNormalizedPath, AutoImportProviderProject, BeginEnablePluginResult, - BeginInstallTypes, ConfiguredProject, countEachFileTypes, createPackageJsonCache, emptyArray, EndInstallTypes, - Errors, ExternalProject, getBaseConfigFileName, hasNoTypeScriptSource, InferredProject, InvalidateCachedTypings, - isConfiguredProject, isDynamicFileName, isInferredProject, isInferredProjectName, ITypingsInstaller, Logger, - LogLevel, makeAutoImportProviderProjectName, makeAuxiliaryProjectName, makeInferredProjectName, Msg, NormalizedPath, - normalizedPathToPath, nullTypingsInstaller, PackageInstalledResponse, PackageJsonCache, Project, - ProjectFilesWithTSDiagnostics, ProjectKind, ProjectOptions, protocol, ScriptInfo, ScriptInfoVersion, ServerHost, - Session, SetTypings, ThrottledOperations, toNormalizedPath, TypingsCache, + ActionInvalidate, + ActionSet, + asNormalizedPath, + AutoImportProviderProject, + BeginEnablePluginResult, + BeginInstallTypes, + ConfiguredProject, + countEachFileTypes, + createPackageJsonCache, + emptyArray, + EndInstallTypes, + Errors, + ExternalProject, + getBaseConfigFileName, + hasNoTypeScriptSource, + InferredProject, + InvalidateCachedTypings, + isConfiguredProject, + isDynamicFileName, + isInferredProject, + isInferredProjectName, + ITypingsInstaller, + Logger, + LogLevel, + makeAutoImportProviderProjectName, + makeAuxiliaryProjectName, + makeInferredProjectName, + Msg, + NormalizedPath, + normalizedPathToPath, + nullTypingsInstaller, + PackageInstalledResponse, + PackageJsonCache, + Project, + ProjectFilesWithTSDiagnostics, + ProjectKind, + ProjectOptions, + protocol, + ScriptInfo, + ScriptInfoVersion, + ServerHost, + Session, + SetTypings, + ThrottledOperations, + toNormalizedPath, + TypingsCache, } from "./_namespaces/ts.server"; import { - addToSeen, arrayFrom, arrayToMap, AssertionLevel, CachedDirectoryStructureHost, canJsonReportNoInputFiles, - canWatchDirectoryOrFile, cleanExtendedConfigCache, clearMap, clearSharedExtendedConfigFileWatcher, - closeFileWatcherOf, combinePaths, CommandLineOption, CompilerOptions, CompletionInfo, ConfigFileProgramReloadLevel, - contains, containsPath, convertCompilerOptionsForTelemetry, convertEnableAutoDiscoveryToEnable, convertJsonOption, - createCachedDirectoryStructureHost, createDocumentRegistryInternal, createGetCanonicalFileName, createMultiMap, - Debug, Diagnostic, directorySeparator, DirectoryStructureHost, DocumentPosition, DocumentPositionMapper, - DocumentRegistry, DocumentRegistryBucketKeyWithMode, emptyOptions, ensureTrailingDirectorySeparator, - ExtendedConfigCacheEntry, FileExtensionInfo, fileExtensionIs, FileWatcher, FileWatcherEventKind, find, flatMap, - forEach, forEachAncestorDirectory, forEachEntry, forEachKey, forEachResolvedProjectReference, FormatCodeSettings, - getAnyExtensionFromPath, getBaseFileName, getDefaultFormatCodeSettings, getDirectoryPath, getDocumentPositionMapper, - getEntries, getFileNamesFromConfigSpecs, getFileWatcherEventKind, getNormalizedAbsolutePath, getSnapshotText, - getWatchFactory, hasExtension, hasProperty, hasTSFileExtension, HostCancellationToken, identity, - IncompleteCompletionsCache, IndentStyle, isArray, isIgnoredFileFromWildCardWatching, isInsideNodeModules, - isJsonEqual, 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, + addToSeen, + arrayFrom, + arrayToMap, + AssertionLevel, + CachedDirectoryStructureHost, + canJsonReportNoInputFiles, + canWatchDirectoryOrFile, + cleanExtendedConfigCache, + clearMap, + clearSharedExtendedConfigFileWatcher, + closeFileWatcherOf, + combinePaths, + CommandLineOption, + CompilerOptions, + CompletionInfo, + ConfigFileProgramReloadLevel, + contains, + containsPath, + convertCompilerOptionsForTelemetry, + convertEnableAutoDiscoveryToEnable, + convertJsonOption, + createCachedDirectoryStructureHost, + createDocumentRegistryInternal, + createGetCanonicalFileName, + createMultiMap, + Debug, + Diagnostic, + directorySeparator, + DirectoryStructureHost, + DocumentPosition, + DocumentPositionMapper, + DocumentRegistry, + DocumentRegistryBucketKeyWithMode, + emptyOptions, + ensureTrailingDirectorySeparator, + ExtendedConfigCacheEntry, + FileExtensionInfo, + fileExtensionIs, + FileWatcher, + FileWatcherEventKind, + find, + flatMap, + forEach, + forEachAncestorDirectory, + forEachEntry, + forEachKey, + forEachResolvedProjectReference, + FormatCodeSettings, + getAnyExtensionFromPath, + getBaseFileName, + getDefaultFormatCodeSettings, + getDirectoryPath, + getDocumentPositionMapper, + getEntries, + getFileNamesFromConfigSpecs, + getFileWatcherEventKind, + getNormalizedAbsolutePath, + getSnapshotText, + getWatchFactory, + hasExtension, + hasProperty, + hasTSFileExtension, + HostCancellationToken, + identity, + IncompleteCompletionsCache, + IndentStyle, + isArray, + isIgnoredFileFromWildCardWatching, + isInsideNodeModules, + isJsonEqual, + 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 5ba251b632c4b..2f2142a5bb0fe 100644 --- a/src/server/moduleSpecifierCache.ts +++ b/src/server/moduleSpecifierCache.ts @@ -1,6 +1,13 @@ import { - Debug, FileWatcher, ModulePath, ModuleSpecifierCache, ModuleSpecifierOptions, nodeModulesPathPart, Path, - ResolvedModuleSpecifierInfo, UserPreferences, + Debug, + FileWatcher, + ModulePath, + ModuleSpecifierCache, + ModuleSpecifierOptions, + nodeModulesPathPart, + Path, + ResolvedModuleSpecifierInfo, + UserPreferences, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/server/packageJsonCache.ts b/src/server/packageJsonCache.ts index 3c34de2dd30d9..d1c12c65d9bfb 100644 --- a/src/server/packageJsonCache.ts +++ b/src/server/packageJsonCache.ts @@ -1,6 +1,13 @@ import { - combinePaths, createPackageJsonInfo, Debug, forEachAncestorDirectory, getDirectoryPath, Path, - ProjectPackageJsonInfo, Ternary, tryFileExists, + combinePaths, + createPackageJsonInfo, + Debug, + forEachAncestorDirectory, + getDirectoryPath, + Path, + ProjectPackageJsonInfo, + Ternary, + tryFileExists, } from "./_namespaces/ts"; import { ProjectService } from "./_namespaces/ts.server"; diff --git a/src/server/project.ts b/src/server/project.ts index d34b2e0e83f87..dcce4777002b2 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,34 +1,155 @@ 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, updateProjectIfDirty, + asNormalizedPath, + createModuleSpecifierCache, + emptyArray, + Errors, + FileStats, + forEachResolvedProjectReferenceProject, + LogLevel, + ModuleImportResult, + Msg, + NormalizedPath, + projectContainsInfoDirectly, + ProjectOptions, + ProjectReferenceProjectLoadKind, + ProjectService, + protocol, + ScriptInfo, + ServerHost, + Session, + toNormalizedPath, + TypingsCache, + updateProjectIfDirty, } from "./_namespaces/ts.server"; import { - 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, forEach, forEachEntry, forEachKey, generateDjb2Hash, - getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, GetCanonicalFileName, - getDeclarationEmitOutputFilePathWorker, getDefaultCompilerOptions, getDefaultLibFileName, getDefaultLibFilePath, - getDirectoryPath, getEffectiveTypeRoots, getEmitDeclarations, getEntrypointsFromPackageJsonInfo, - getNormalizedAbsolutePath, getOrUpdate, getStringComparer, HasInvalidatedResolutions, HostCancellationToken, - inferredTypesContainingFile, InstallPackageOptions, IScriptSnapshot, isDeclarationFileName, - isExternalModuleNameRelative, isInsideNodeModules, JsTyping, LanguageService, LanguageServiceHost, - LanguageServiceMode, map, mapDefined, maybeBind, ModuleResolutionCache, ModuleResolutionHost, - ModuleResolutionInfo, noop, noopFileWatcher, normalizePath, normalizeSlashes, orderedRemoveItem, outFile, - PackageJsonAutoImportPreference, PackageJsonInfo, ParsedCommandLine, parsePackageName, Path, perfLogger, - PerformanceEvent, PluginImport, PollingInterval, Program, ProjectPackageJsonInfo, ProjectReference, - removeFileExtension, ResolutionCache, resolutionExtensionIsTSOrJson, ResolutionMode, ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirective, - resolvePackageNameToPackageJson, returnFalse, returnTrue, ScriptKind, some, sort, sortAndDeduplicate, - SortedReadonlyArray, SourceFile, SourceMapper, startsWith, stripQuotes, StructureIsReused, SymlinkCache, - ThrottledCancellationToken, timestamp, toPath, tracing, TypeAcquisition, TypeReferenceDirectiveResolutionInfo, updateErrorForNoInputFiles, - updateMissingFilePathsWatch, WatchDirectoryFlags, WatchOptions, WatchType, + 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, + forEach, + forEachEntry, + forEachKey, + generateDjb2Hash, + getAllowJSCompilerOption, + getAutomaticTypeDirectiveNames, + GetCanonicalFileName, + getDeclarationEmitOutputFilePathWorker, + getDefaultCompilerOptions, + getDefaultLibFileName, + getDefaultLibFilePath, + getDirectoryPath, + getEffectiveTypeRoots, + getEmitDeclarations, + getEntrypointsFromPackageJsonInfo, + getNormalizedAbsolutePath, + getOrUpdate, + getStringComparer, + HasInvalidatedResolutions, + HostCancellationToken, + inferredTypesContainingFile, + InstallPackageOptions, + IScriptSnapshot, + isDeclarationFileName, + isExternalModuleNameRelative, + isInsideNodeModules, + JsTyping, + LanguageService, + LanguageServiceHost, + LanguageServiceMode, + map, + mapDefined, + maybeBind, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + noop, + noopFileWatcher, + normalizePath, + normalizeSlashes, + orderedRemoveItem, + outFile, + PackageJsonAutoImportPreference, + PackageJsonInfo, + ParsedCommandLine, + parsePackageName, + Path, + perfLogger, + PerformanceEvent, + PluginImport, + PollingInterval, + Program, + ProjectPackageJsonInfo, + ProjectReference, + removeFileExtension, + ResolutionCache, + resolutionExtensionIsTSOrJson, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + resolvePackageNameToPackageJson, + returnFalse, + returnTrue, + ScriptKind, + some, + sort, + sortAndDeduplicate, + SortedReadonlyArray, + SourceFile, + SourceMapper, + startsWith, + stripQuotes, + StructureIsReused, + SymlinkCache, + ThrottledCancellationToken, + timestamp, + toPath, + tracing, + TypeAcquisition, + TypeReferenceDirectiveResolutionInfo, + updateErrorForNoInputFiles, + updateMissingFilePathsWatch, + WatchDirectoryFlags, + WatchOptions, + WatchType, } from "./_namespaces/ts"; export enum ProjectKind { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 6187031e040c2..5f22bb2338693 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1,8 +1,22 @@ import * as ts from "./_namespaces/ts"; import { - CompilerOptionsValue, EndOfLineState, FileExtensionInfo, HighlightSpanKind, MapLike, OutliningSpanKind, OutputFile, - PluginImport, ProjectReference, RenameLocation, ScriptElementKind, ScriptKind, TextChange, TextInsertion, - TodoComment, TodoCommentDescriptor, TypeAcquisition, + CompilerOptionsValue, + EndOfLineState, + FileExtensionInfo, + HighlightSpanKind, + MapLike, + OutliningSpanKind, + OutputFile, + PluginImport, + ProjectReference, + RenameLocation, + ScriptElementKind, + ScriptKind, + TextChange, + TextInsertion, + TodoComment, + TodoCommentDescriptor, + TypeAcquisition, } from "./_namespaces/ts"; /** diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 8afc7e25112a7..9c1371f2d9f57 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -1,15 +1,56 @@ import { - AbsolutePositionAndLineText, ConfiguredProject, Errors, ExternalProject, InferredProject, isConfiguredProject, - isExternalProject, isInferredProject, maxFileSize, NormalizedPath, Project, ProjectKind, protocol, - ScriptVersionCache, ServerHost, + AbsolutePositionAndLineText, + ConfiguredProject, + Errors, + ExternalProject, + InferredProject, + isConfiguredProject, + isExternalProject, + isInferredProject, + maxFileSize, + NormalizedPath, + Project, + ProjectKind, + protocol, + ScriptVersionCache, + ServerHost, } from "./_namespaces/ts.server"; import { - assign, clear, closeFileWatcherOf, computeLineAndCharacterOfPosition, computeLineStarts, - 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, + assign, + clear, + closeFileWatcherOf, + computeLineAndCharacterOfPosition, + computeLineStarts, + 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"; export interface ScriptInfoVersion { diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index fc828b3f8c5bb..a4acf98f5516b 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -1,8 +1,18 @@ import { - collapseTextChangeRangesAcrossMultipleVersions, computeLineStarts, createTextChangeRange, createTextSpan, Debug, - IScriptSnapshot, TextChangeRange, TextSpan, unchangedTextChangeRange, + collapseTextChangeRangesAcrossMultipleVersions, + computeLineStarts, + createTextChangeRange, + createTextSpan, + Debug, + IScriptSnapshot, + TextChangeRange, + TextSpan, + unchangedTextChangeRange, } from "./_namespaces/ts"; -import { emptyArray, protocol } from "./_namespaces/ts.server"; +import { + emptyArray, + protocol, +} from "./_namespaces/ts.server"; const lineCollectionCapacity = 4; diff --git a/src/server/session.ts b/src/server/session.ts index d646606f8d485..ceb15519eb435 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1,37 +1,183 @@ import { - arrayFrom, arrayIterator, arrayReverseIterator, CallHierarchyIncomingCall, CallHierarchyItem, - CallHierarchyOutgoingCall, cast, CodeAction, CodeActionCommand, CodeFixAction, CombinedCodeActions, CompilerOptions, - CompletionEntry, CompletionEntryData, CompletionEntryDetails, CompletionInfo, CompletionTriggerKind, - computeLineAndCharacterOfPosition, computeLineStarts, concatenate, createQueue, 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, getEmitDeclarations, getEntries, getEntrypointsFromPackageJsonInfo, - getLineAndCharacterOfPosition, getMappedContextSpan, getMappedDocumentSpan, getMappedLocation, - getNodeModulePathParts, getNormalizedAbsolutePath, getPackageNameFromTypesPackageName, getPackageScopeForPath, - getSnapshotText, getSupportedCodeFixes, 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, + arrayFrom, + arrayIterator, + arrayReverseIterator, + CallHierarchyIncomingCall, + CallHierarchyItem, + CallHierarchyOutgoingCall, + cast, + CodeAction, + CodeActionCommand, + CodeFixAction, + CombinedCodeActions, + CompilerOptions, + CompletionEntry, + CompletionEntryData, + CompletionEntryDetails, + CompletionInfo, + CompletionTriggerKind, + computeLineAndCharacterOfPosition, + computeLineStarts, + concatenate, + createQueue, + 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, + getEmitDeclarations, + getEntries, + getEntrypointsFromPackageJsonInfo, + getLineAndCharacterOfPosition, + getMappedContextSpan, + getMappedDocumentSpan, + getMappedLocation, + getNodeModulePathParts, + getNormalizedAbsolutePath, + getPackageNameFromTypesPackageName, + getPackageScopeForPath, + getSnapshotText, + getSupportedCodeFixes, + 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, Msg, NormalizedPath, Project, - ProjectInfoTelemetryEvent, ProjectKind, ProjectLanguageServiceStateEvent, ProjectLoadingFinishEvent, - ProjectLoadingStartEvent, ProjectService, ProjectServiceEvent, ProjectServiceEventHandler, ProjectServiceOptions, - ProjectsUpdatedInBackgroundEvent, protocol, ScriptInfo, ScriptInfoOrConfig, ServerHost, stringifyIndented, - toNormalizedPath, updateProjectIfDirty, + ConfigFileDiagEvent, + ConfiguredProject, + convertFormatOptions, + convertScriptKindName, + convertUserPreferences, + EmitResult, + emptyArray, + Errors, + GcTimer, + indent, + isConfigFile, + isConfiguredProject, + isExternalProject, + isInferredProject, + ITypingsInstaller, + LargeFileReferencedEvent, + Logger, + LogLevel, + Msg, + NormalizedPath, + Project, + ProjectInfoTelemetryEvent, + ProjectKind, + ProjectLanguageServiceStateEvent, + ProjectLoadingFinishEvent, + ProjectLoadingStartEvent, + ProjectService, + ProjectServiceEvent, + ProjectServiceEventHandler, + ProjectServiceOptions, + ProjectsUpdatedInBackgroundEvent, + protocol, + ScriptInfo, + ScriptInfoOrConfig, + ServerHost, + stringifyIndented, + toNormalizedPath, + updateProjectIfDirty, } from "./_namespaces/ts.server"; interface StackTraceError extends Error { diff --git a/src/server/types.ts b/src/server/types.ts index 3ebc7655948a5..8e1c38f9a42a3 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -1,4 +1,10 @@ -import { DirectoryWatcherCallback, FileWatcher, FileWatcherCallback, System, WatchOptions } from "./_namespaces/ts"; +import { + DirectoryWatcherCallback, + FileWatcher, + FileWatcherCallback, + System, + WatchOptions, +} from "./_namespaces/ts"; export interface CompressedData { length: number; diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index 60dc13cbded09..42c91be6047d1 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -1,8 +1,22 @@ import { - ApplyCodeActionCommandResult, arrayIsEqualTo, CompilerOptions, getAllowJSCompilerOption, InstallPackageOptions, - noop, notImplemented, Path, returnFalse, sort, SortedReadonlyArray, TypeAcquisition, + ApplyCodeActionCommandResult, + arrayIsEqualTo, + CompilerOptions, + getAllowJSCompilerOption, + InstallPackageOptions, + noop, + notImplemented, + Path, + returnFalse, + sort, + SortedReadonlyArray, + TypeAcquisition, } from "./_namespaces/ts"; -import { emptyArray, Project, ProjectService } from "./_namespaces/ts.server"; +import { + emptyArray, + Project, + ProjectService, +} from "./_namespaces/ts.server"; export interface InstallPackageOptionsWithProject extends InstallPackageOptions { projectName: string; diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 989209b2f1c3e..9c8a45c17159c 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,5 +1,17 @@ -import { binarySearch, Comparer, getBaseFileName, identity, perfLogger, SortedArray } from "./_namespaces/ts"; -import { Logger, LogLevel, NormalizedPath, ServerHost } from "./_namespaces/ts.server"; +import { + binarySearch, + Comparer, + getBaseFileName, + identity, + perfLogger, + SortedArray, +} from "./_namespaces/ts"; +import { + Logger, + LogLevel, + NormalizedPath, + ServerHost, +} from "./_namespaces/ts.server"; /** @internal */ export class ThrottledOperations { diff --git a/src/server/utilitiesPublic.ts b/src/server/utilitiesPublic.ts index a729e4c9f5e4a..e071e87dfbac2 100644 --- a/src/server/utilitiesPublic.ts +++ b/src/server/utilitiesPublic.ts @@ -1,8 +1,16 @@ import { - getNormalizedAbsolutePath, isRootedDiskPath, normalizePath, Path, SortedArray, SortedReadonlyArray, + getNormalizedAbsolutePath, + isRootedDiskPath, + normalizePath, + Path, + SortedArray, + SortedReadonlyArray, TypeAcquisition, } from "./_namespaces/ts"; -import { DiscoverTypings, Project } from "./_namespaces/ts.server"; +import { + DiscoverTypings, + Project, +} from "./_namespaces/ts.server"; export enum LogLevel { terse, diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 5b823d698d651..f06f85142b862 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -1,16 +1,75 @@ import { - ArrayLiteralExpression, BinaryExpression, BindingPattern, Block, BreakOrContinueStatement, canHaveDecorators, - CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, createTextSpanFromBounds, Debug, - DestructuringPattern, DoStatement, EnumDeclaration, ExportAssignment, 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, Node, NodeArray, NodeFlags, ObjectLiteralElement, - ObjectLiteralExpression, ParameterDeclaration, PropertyAssignment, PropertyDeclaration, PropertySignature, - ReturnStatement, skipTrivia, SourceFile, SwitchStatement, SyntaxKind, TextSpan, ThrowStatement, TryStatement, - TypeAssertion, VariableDeclaration, VariableDeclarationList, VariableStatement, WhileStatement, WithStatement, + ArrayLiteralExpression, + BinaryExpression, + BindingPattern, + Block, + BreakOrContinueStatement, + canHaveDecorators, + CaseBlock, + CaseOrDefaultClause, + CatchClause, + ClassDeclaration, + createTextSpanFromBounds, + Debug, + DestructuringPattern, + DoStatement, + EnumDeclaration, + ExportAssignment, + 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, + Node, + NodeArray, + NodeFlags, + ObjectLiteralElement, + ObjectLiteralExpression, + ParameterDeclaration, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + ReturnStatement, + skipTrivia, + SourceFile, + SwitchStatement, + SyntaxKind, + TextSpan, + ThrowStatement, + TryStatement, + TypeAssertion, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + WhileStatement, + WithStatement, } from "./_namespaces/ts"; /** diff --git a/src/services/callHierarchy.ts b/src/services/callHierarchy.ts index 941cb68946a37..fc4280802ee6d 100644 --- a/src/services/callHierarchy.ts +++ b/src/services/callHierarchy.ts @@ -1,23 +1,109 @@ import { - AccessExpression, append, ArrowFunction, AsExpression, CallExpression, CallHierarchyIncomingCall, CallHierarchyItem, - CallHierarchyOutgoingCall, CancellationToken, canHaveModifiers, ClassDeclaration, ClassExpression, - ClassLikeDeclaration, ClassStaticBlockDeclaration, compareStringsCaseSensitive, createPrinter, - createTextRangeFromNode, createTextSpanFromBounds, createTextSpanFromRange, Debug, Decorator, - ElementAccessExpression, EmitHint, filter, find, FindAllReferences, findAncestor, forEach, forEachChild, - FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, getAssignedName, - getClassExtendsHeritageElement, getCombinedNodeFlags, getFirstConstructorWithBody, getNameOfDeclaration, getNodeId, - getNodeKind, getNodeModifiers, group, hasSyntacticModifier, Identifier, idText, indicesOf, isAccessExpression, - isArgumentExpressionOfElementAccess, isArray, isArrowFunction, isCallOrNewExpressionTarget, isClassDeclaration, - isClassExpression, isClassLike, isClassStaticBlockDeclaration, isComputedPropertyName, isConstructorDeclaration, - isDeclarationName, isDecoratorTarget, isFunctionDeclaration, isFunctionExpression, isFunctionLikeDeclaration, - isGetAccessorDeclaration, isIdentifier, isJsxOpeningLikeElement, isJsxOpeningLikeElementTagName, - isMethodDeclaration, isMethodSignature, isModuleBlock, isModuleDeclaration, isNamedDeclaration, isPartOfTypeNode, - isPropertyDeclaration, isRightSideOfPropertyAccess, isSetAccessorDeclaration, isSourceFile, - isStringOrNumericLiteralLike, 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, + AccessExpression, + append, + ArrowFunction, + AsExpression, + CallExpression, + CallHierarchyIncomingCall, + CallHierarchyItem, + CallHierarchyOutgoingCall, + CancellationToken, + canHaveModifiers, + ClassDeclaration, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + compareStringsCaseSensitive, + createPrinter, + createTextRangeFromNode, + createTextSpanFromBounds, + createTextSpanFromRange, + Debug, + Decorator, + ElementAccessExpression, + EmitHint, + filter, + find, + FindAllReferences, + findAncestor, + forEach, + forEachChild, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + getAssignedName, + getClassExtendsHeritageElement, + getCombinedNodeFlags, + getFirstConstructorWithBody, + getNameOfDeclaration, + getNodeId, + getNodeKind, + getNodeModifiers, + group, + hasSyntacticModifier, + Identifier, + idText, + indicesOf, + isAccessExpression, + isArgumentExpressionOfElementAccess, + isArray, + isArrowFunction, + isCallOrNewExpressionTarget, + isClassDeclaration, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isComputedPropertyName, + isConstructorDeclaration, + isDeclarationName, + isDecoratorTarget, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLikeDeclaration, + isGetAccessorDeclaration, + isIdentifier, + isJsxOpeningLikeElement, + isJsxOpeningLikeElementTagName, + isMethodDeclaration, + isMethodSignature, + isModuleBlock, + isModuleDeclaration, + isNamedDeclaration, + isPartOfTypeNode, + isPropertyDeclaration, + isRightSideOfPropertyAccess, + isSetAccessorDeclaration, + isSourceFile, + isStringOrNumericLiteralLike, + 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 eda88ef10b195..40a37c99a6297 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -1,16 +1,80 @@ import { - __String, arrayToNumericMap, CancellationToken, CharacterCodes, ClassDeclaration, ClassificationInfo, - ClassificationResult, Classifications, ClassificationType, ClassificationTypeNames, 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, JSDocEnumTag, JSDocImplementsTag, JSDocParameterTag, JSDocPropertyTag, - JSDocReturnTag, JSDocSeeTag, JSDocTemplateTag, JSDocThisTag, JSDocTypedefTag, JSDocTypeTag, JsxAttribute, - JsxClosingElement, JsxOpeningElement, JsxSelfClosingElement, lastOrUndefined, ModuleDeclaration, - ModuleInstanceState, Node, nodeIsMissing, ParameterDeclaration, parseIsolatedJSDocComment, Push, - Scanner, ScriptTarget, SemanticMeaning, setParent, some, SourceFile, Symbol, SymbolFlags, SyntaxKind, TextSpan, - textSpanIntersectsWith, TokenClass, TypeChecker, TypeParameterDeclaration, + __String, + arrayToNumericMap, + CancellationToken, + CharacterCodes, + ClassDeclaration, + ClassificationInfo, + ClassificationResult, + Classifications, + ClassificationType, + ClassificationTypeNames, + 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, + JSDocEnumTag, + JSDocImplementsTag, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypedefTag, + JSDocTypeTag, + JsxAttribute, + JsxClosingElement, + JsxOpeningElement, + JsxSelfClosingElement, + lastOrUndefined, + ModuleDeclaration, + ModuleInstanceState, + Node, + nodeIsMissing, + ParameterDeclaration, + parseIsolatedJSDocComment, + Push, + Scanner, + ScriptTarget, + SemanticMeaning, + setParent, + some, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + TextSpan, + textSpanIntersectsWith, + TokenClass, + TypeChecker, + TypeParameterDeclaration, } from "./_namespaces/ts"; /** The classifier is used for syntactic highlighting in editors via the TSServer */ diff --git a/src/services/classifier2020.ts b/src/services/classifier2020.ts index db67ea1d8d7b0..96e246a85db80 100644 --- a/src/services/classifier2020.ts +++ b/src/services/classifier2020.ts @@ -1,11 +1,48 @@ import { - BindingElement, CancellationToken, Classifications, ClassifiedSpan2020, createTextSpan, Debug, Declaration, - EndOfLineState, forEachChild, getCombinedModifierFlags, getCombinedNodeFlags, getMeaningFromLocation, - isBindingElement, isCallExpression, isCatchClause, isFunctionDeclaration, isIdentifier, isImportClause, - isImportSpecifier, isInfinityOrNaNString, isJsxElement, isJsxExpression, isJsxSelfClosingElement, isNamespaceImport, - isPropertyAccessExpression, isQualifiedName, isSourceFile, isVariableDeclaration, ModifierFlags, - NamedDeclaration, Node, NodeFlags, ParameterDeclaration, Program, SemanticMeaning, SourceFile, Symbol, SymbolFlags, - SyntaxKind, TextSpan, textSpanIntersectsWith, Type, TypeChecker, VariableDeclaration, + BindingElement, + CancellationToken, + Classifications, + ClassifiedSpan2020, + createTextSpan, + Debug, + Declaration, + EndOfLineState, + forEachChild, + getCombinedModifierFlags, + getCombinedNodeFlags, + getMeaningFromLocation, + isBindingElement, + isCallExpression, + isCatchClause, + isFunctionDeclaration, + isIdentifier, + isImportClause, + isImportSpecifier, + isInfinityOrNaNString, + isJsxElement, + isJsxExpression, + isJsxSelfClosingElement, + isNamespaceImport, + isPropertyAccessExpression, + 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 19d7d00e9d086..0d6ab81face1a 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -1,8 +1,28 @@ import { - arrayFrom, cast, CodeActionCommand, CodeFixAction, CodeFixAllContext, CodeFixContext, CodeFixContextBase, - CodeFixRegistration, CombinedCodeActions, computeSuggestionDiagnostics, contains, createMultiMap, Debug, Diagnostic, - DiagnosticAndArguments, diagnosticToString, DiagnosticWithLocation, FileTextChanges, flatMap, isString, map, - Push, TextChange, textChanges, + arrayFrom, + cast, + CodeActionCommand, + CodeFixAction, + CodeFixAllContext, + CodeFixContext, + CodeFixContextBase, + CodeFixRegistration, + CombinedCodeActions, + computeSuggestionDiagnostics, + contains, + createMultiMap, + Debug, + Diagnostic, + DiagnosticAndArguments, + diagnosticToString, + DiagnosticWithLocation, + FileTextChanges, + flatMap, + isString, + map, + Push, + TextChange, + textChanges, } from "./_namespaces/ts"; const errorCodeToFixes = createMultiMap(); diff --git a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts index 8d7347f4416c6..0360e9d117a52 100644 --- a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts +++ b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts @@ -1,8 +1,22 @@ import { - AsExpression, Diagnostics, factory, findAncestor, getTokenAtPosition, isAsExpression, isInJSFile, - isTypeAssertionExpression, SourceFile, SyntaxKind, textChanges, TypeAssertion, + AsExpression, + Diagnostics, + factory, + findAncestor, + getTokenAtPosition, + isAsExpression, + isInJSFile, + isTypeAssertionExpression, + SourceFile, + SyntaxKind, + textChanges, + TypeAssertion, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addConvertToUnknownForNonOverlappingTypes"; const errorCodes = [Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code]; diff --git a/src/services/codefixes/addEmptyExportDeclaration.ts b/src/services/codefixes/addEmptyExportDeclaration.ts index 0cd3d24a46259..25727bf73a384 100644 --- a/src/services/codefixes/addEmptyExportDeclaration.ts +++ b/src/services/codefixes/addEmptyExportDeclaration.ts @@ -1,5 +1,12 @@ -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; -import { Diagnostics, factory, textChanges } from "../_namespaces/ts"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; +import { + Diagnostics, + factory, + textChanges, +} from "../_namespaces/ts"; registerCodeFix({ errorCodes: [ diff --git a/src/services/codefixes/addMissingAsync.ts b/src/services/codefixes/addMissingAsync.ts index fd27e2b9f4310..bb0510a90d0ad 100644 --- a/src/services/codefixes/addMissingAsync.ts +++ b/src/services/codefixes/addMissingAsync.ts @@ -1,11 +1,39 @@ import { - ArrowFunction, CodeFixAllContext, CodeFixContext, createTextSpanFromNode, Diagnostic, Diagnostics, factory, - FileTextChanges, find, findAncestor, FunctionDeclaration, FunctionExpression, getNodeId, getSyntacticModifierFlags, - getSynthesizedDeepClone, getTokenAtPosition, isArrowFunction, isFunctionDeclaration, isFunctionExpression, - isMethodDeclaration, isNumber, MethodDeclaration, ModifierFlags, some, SourceFile, textChanges, TextSpan, - textSpanEnd, textSpansEqual, + ArrowFunction, + CodeFixAllContext, + CodeFixContext, + createTextSpanFromNode, + Diagnostic, + Diagnostics, + factory, + FileTextChanges, + find, + findAncestor, + FunctionDeclaration, + FunctionExpression, + getNodeId, + getSyntacticModifierFlags, + getSynthesizedDeepClone, + getTokenAtPosition, + isArrowFunction, + isFunctionDeclaration, + isFunctionExpression, + isMethodDeclaration, + isNumber, + MethodDeclaration, + ModifierFlags, + some, + SourceFile, + textChanges, + TextSpan, + textSpanEnd, + textSpansEqual, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; type ContextualTrackChangesFunction = (cb: (changeTracker: textChanges.ChangeTracker) => void) => FileTextChanges[]; const fixId = "addMissingAsync"; diff --git a/src/services/codefixes/addMissingAwait.ts b/src/services/codefixes/addMissingAwait.ts index 5a2ec06f7aa55..d93138a1dbea8 100644 --- a/src/services/codefixes/addMissingAwait.ts +++ b/src/services/codefixes/addMissingAwait.ts @@ -1,13 +1,55 @@ import { - CancellationToken, CodeFixAllContext, CodeFixContext, compact, contains, Diagnostic, Diagnostics, Expression, - factory, FileTextChanges, find, FindAllReferences, findAncestor, findPrecedingToken, forEach, getAncestor, - getFixableErrorSpanExpression, getSymbolId, hasSyntacticModifier, Identifier, isArrowFunction, isBinaryExpression, - isBlock, isCallOrNewExpression, isForOfStatement, isIdentifier, isNumber, isPropertyAccessExpression, - isVariableDeclaration, ModifierFlags, Node, NodeFlags, positionIsASICandidate, Program, some, SourceFile, - Symbol, SyntaxKind, textChanges, TextSpan, textSpansEqual, tryAddToSet, tryCast, TypeChecker, TypeFlags, + CancellationToken, + CodeFixAllContext, + CodeFixContext, + compact, + contains, + Diagnostic, + Diagnostics, + Expression, + factory, + FileTextChanges, + find, + FindAllReferences, + findAncestor, + findPrecedingToken, + forEach, + getAncestor, + getFixableErrorSpanExpression, + getSymbolId, + hasSyntacticModifier, + Identifier, + isArrowFunction, + isBinaryExpression, + isBlock, + isCallOrNewExpression, + isForOfStatement, + isIdentifier, + isNumber, + isPropertyAccessExpression, + isVariableDeclaration, + ModifierFlags, + Node, + NodeFlags, + positionIsASICandidate, + Program, + some, + SourceFile, + Symbol, + SyntaxKind, + textChanges, + TextSpan, + textSpansEqual, + tryAddToSet, + tryCast, + TypeChecker, + TypeFlags, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createCodeFixActionWithoutFixAll, registerCodeFix, + codeFixAll, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + registerCodeFix, } from "../_namespaces/ts.codefix"; type ContextualTrackChangesFunction = (cb: (changeTracker: textChanges.ChangeTracker) => void) => FileTextChanges[]; diff --git a/src/services/codefixes/addMissingConst.ts b/src/services/codefixes/addMissingConst.ts index 0bd44f7974679..8a848c2616f80 100644 --- a/src/services/codefixes/addMissingConst.ts +++ b/src/services/codefixes/addMissingConst.ts @@ -1,9 +1,28 @@ import { - Diagnostics, every, Expression, findAncestor, getTokenAtPosition, isArrayLiteralExpression, isAssignmentExpression, - isBinaryExpression, isExpressionStatement, isForInOrOfStatement, isIdentifier, Node, Program, SourceFile, - SyntaxKind, textChanges, tryAddToSet, TypeChecker, + Diagnostics, + every, + Expression, + findAncestor, + getTokenAtPosition, + isArrayLiteralExpression, + isAssignmentExpression, + isBinaryExpression, + isExpressionStatement, + isForInOrOfStatement, + isIdentifier, + Node, + Program, + SourceFile, + SyntaxKind, + textChanges, + tryAddToSet, + TypeChecker, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingConst"; const errorCodes = [ diff --git a/src/services/codefixes/addMissingDeclareProperty.ts b/src/services/codefixes/addMissingDeclareProperty.ts index 9b5732e249515..c46c353b37f3e 100644 --- a/src/services/codefixes/addMissingDeclareProperty.ts +++ b/src/services/codefixes/addMissingDeclareProperty.ts @@ -1,7 +1,18 @@ import { - Diagnostics, getTokenAtPosition, isIdentifier, Node, SourceFile, SyntaxKind, textChanges, tryAddToSet, + Diagnostics, + getTokenAtPosition, + isIdentifier, + Node, + SourceFile, + SyntaxKind, + textChanges, + tryAddToSet, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingDeclareProperty"; const errorCodes = [ diff --git a/src/services/codefixes/addMissingInvocationForDecorator.ts b/src/services/codefixes/addMissingInvocationForDecorator.ts index bfa4a2200d281..330757c9fa76f 100644 --- a/src/services/codefixes/addMissingInvocationForDecorator.ts +++ b/src/services/codefixes/addMissingInvocationForDecorator.ts @@ -1,7 +1,18 @@ import { - Debug, Diagnostics, factory, findAncestor, getTokenAtPosition, isDecorator, SourceFile, textChanges, + Debug, + Diagnostics, + factory, + findAncestor, + getTokenAtPosition, + isDecorator, + SourceFile, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingInvocationForDecorator"; const errorCodes = [Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code]; diff --git a/src/services/codefixes/addNameToNamelessParameter.ts b/src/services/codefixes/addNameToNamelessParameter.ts index cea54d4c6687c..dc36931d79237 100644 --- a/src/services/codefixes/addNameToNamelessParameter.ts +++ b/src/services/codefixes/addNameToNamelessParameter.ts @@ -1,7 +1,18 @@ import { - Debug, Diagnostics, factory, getTokenAtPosition, Identifier, isParameter, SourceFile, textChanges, + Debug, + Diagnostics, + factory, + getTokenAtPosition, + Identifier, + isParameter, + SourceFile, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addNameToNamelessParameter"; const errorCodes = [Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code]; diff --git a/src/services/codefixes/addOptionalPropertyUndefined.ts b/src/services/codefixes/addOptionalPropertyUndefined.ts index cae2801386cc8..7664bea35be10 100644 --- a/src/services/codefixes/addOptionalPropertyUndefined.ts +++ b/src/services/codefixes/addOptionalPropertyUndefined.ts @@ -1,11 +1,36 @@ import { - Diagnostics, emptyArray, factory, getFixableErrorSpanExpression, getSourceFileOfNode, Identifier, - isBinaryExpression, isCallExpression, isExpression, isFunctionLikeKind, isIdentifier, isPropertyAccessExpression, - isPropertyAssignment, isPropertyDeclaration, isPropertySignature, isShorthandPropertyAssignment, - isVariableDeclaration, Node, PropertyAccessExpression, SignatureDeclaration, SourceFile, Symbol, SyntaxKind, - textChanges, TextSpan, TypeChecker, UnionTypeNode, + Diagnostics, + emptyArray, + factory, + getFixableErrorSpanExpression, + getSourceFileOfNode, + Identifier, + isBinaryExpression, + isCallExpression, + isExpression, + isFunctionLikeKind, + isIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isPropertySignature, + isShorthandPropertyAssignment, + isVariableDeclaration, + Node, + PropertyAccessExpression, + SignatureDeclaration, + SourceFile, + Symbol, + SyntaxKind, + textChanges, + TextSpan, + TypeChecker, + UnionTypeNode, } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const addOptionalPropertyUndefined = "addOptionalPropertyUndefined"; diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts index 2f65561216fe2..292c609bc720c 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -1,13 +1,52 @@ import { - Debug, Diagnostics, EmitFlags, emptyArray, factory, findChildOfKind, first, FunctionLikeDeclaration, - getJSDocReturnType, getJSDocType, getJSDocTypeParameterDeclarations, getTokenAtPosition, isArrowFunction, - isFunctionLikeDeclaration, isIdentifier, 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, + Debug, + Diagnostics, + EmitFlags, + emptyArray, + factory, + findChildOfKind, + first, + FunctionLikeDeclaration, + getJSDocReturnType, + getJSDocType, + getJSDocTypeParameterDeclarations, + getTokenAtPosition, + isArrowFunction, + isFunctionLikeDeclaration, + isIdentifier, + 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, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "annotateWithTypeFromJSDoc"; const errorCodes = [Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types.code]; diff --git a/src/services/codefixes/convertConstToLet.ts b/src/services/codefixes/convertConstToLet.ts index afdbee4662d3e..d9817ab8250b2 100644 --- a/src/services/codefixes/convertConstToLet.ts +++ b/src/services/codefixes/convertConstToLet.ts @@ -1,9 +1,24 @@ import { - addToSeen, Diagnostics, factory, findChildOfKind, getSymbolId, getTokenAtPosition, isVariableDeclarationList, - Program, SourceFile, Symbol, SyntaxKind, textChanges, Token, tryCast, + addToSeen, + Diagnostics, + factory, + findChildOfKind, + getSymbolId, + getTokenAtPosition, + isVariableDeclarationList, + Program, + SourceFile, + Symbol, + SyntaxKind, + textChanges, + Token, + tryCast, } from "../_namespaces/ts"; import { - createCodeFixActionMaybeFixAll, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixActionMaybeFixAll, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixId = "fixConvertConstToLet"; diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts index ce585b6a1ca16..b2af8a230febc 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -1,16 +1,71 @@ import { - __String, AccessExpression, ArrowFunction, BinaryExpression, Block, canHaveModifiers, ClassDeclaration, - ClassElement, CodeFixContext, CompilerOptions, concatenate, copyLeadingComments, Diagnostics, every, Expression, - factory, filter, forEach, FunctionDeclaration, FunctionExpression, getEmitScriptTarget, getNameOfDeclaration, - getQuotePreference, getTokenAtPosition, idText, isAccessExpression, isArrowFunction, isBinaryExpression, - isFunctionDeclaration, isFunctionExpression, isFunctionLike, isGetOrSetAccessorDeclaration, isIdentifier, - isIdentifierText, isMethodDeclaration, isNoSubstitutionTemplateLiteral, isNumericLiteral, isObjectLiteralExpression, - isPropertyAccessExpression, isPropertyAssignment, isSourceFileJS, isStringLiteralLike, isVariableDeclaration, - isVariableDeclarationList, Modifier, Node, ObjectLiteralElementLike, ObjectLiteralExpression, - PropertyAccessExpression, PropertyName, QuotePreference, some, SourceFile, Symbol, SymbolFlags, symbolName, - SyntaxKind, textChanges, TypeChecker, UserPreferences, VariableDeclaration, + __String, + AccessExpression, + ArrowFunction, + BinaryExpression, + Block, + canHaveModifiers, + ClassDeclaration, + ClassElement, + CodeFixContext, + CompilerOptions, + concatenate, + copyLeadingComments, + Diagnostics, + every, + Expression, + factory, + filter, + forEach, + FunctionDeclaration, + FunctionExpression, + getEmitScriptTarget, + getNameOfDeclaration, + getQuotePreference, + getTokenAtPosition, + idText, + isAccessExpression, + isArrowFunction, + isBinaryExpression, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isGetOrSetAccessorDeclaration, + isIdentifier, + isIdentifierText, + isMethodDeclaration, + isNoSubstitutionTemplateLiteral, + isNumericLiteral, + isObjectLiteralExpression, + isPropertyAccessExpression, + isPropertyAssignment, + isSourceFileJS, + 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, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "convertFunctionToEs6Class"; const errorCodes = [Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration.code]; diff --git a/src/services/codefixes/convertLiteralTypeToMappedType.ts b/src/services/codefixes/convertLiteralTypeToMappedType.ts index 8cf9c9bc0716a..1e68d28758d1c 100644 --- a/src/services/codefixes/convertLiteralTypeToMappedType.ts +++ b/src/services/codefixes/convertLiteralTypeToMappedType.ts @@ -1,8 +1,21 @@ import { - cast, Diagnostics, factory, getTokenAtPosition, isIdentifier, isPropertySignature, isTypeLiteralNode, SourceFile, - textChanges, TypeLiteralNode, TypeNode, + cast, + Diagnostics, + factory, + getTokenAtPosition, + isIdentifier, + isPropertySignature, + isTypeLiteralNode, + SourceFile, + textChanges, + TypeLiteralNode, + TypeNode, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "convertLiteralTypeToMappedType"; const errorCodes = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code]; diff --git a/src/services/codefixes/convertToAsyncFunction.ts b/src/services/codefixes/convertToAsyncFunction.ts index 1233782fb84f1..999dab6f413e5 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -1,18 +1,87 @@ import { - ArrowFunction, AwaitExpression, BindingName, BindingPattern, Block, CallExpression, canBeConvertedToAsync, - CodeFixContext, concatenate, createMultiMap, Debug, Diagnostics, elementAt, emptyArray, every, Expression, - factory, firstOrUndefined, flatMap, forEach, forEachChild, forEachReturnStatement, FunctionExpression, - FunctionLikeDeclaration, GeneratedIdentifierFlags, getContainingFunction, getNodeId, getObjectFlags, - getOriginalNode, getSymbolId, getSynthesizedDeepClone, getSynthesizedDeepCloneWithReplacements, getTokenAtPosition, - hasPropertyAccessExpressionWithName, Identifier, idText, isBindingElement, isBlock, isCallExpression, isExpression, - isFixablePromiseHandler, isFunctionLike, isFunctionLikeDeclaration, isGeneratedIdentifier, isIdentifier, isInJSFile, - isObjectBindingPattern, isOmittedExpression, isParameter, isPropertyAccessExpression, isReturnStatement, - isReturnStatementWithFixablePromiseHandler, isVariableDeclaration, lastOrUndefined, moveRangePastModifiers, - Node, NodeFlags, ObjectFlags, PropertyAccessExpression, returnsPromise, ReturnStatement, - returnTrue, Signature, SignatureKind, skipTrivia, SourceFile, Statement, Symbol, SyntaxKind, textChanges, - tryCast, TryStatement, Type, TypeChecker, TypeNode, TypeReference, UnionReduction, + ArrowFunction, + AwaitExpression, + BindingName, + BindingPattern, + Block, + CallExpression, + canBeConvertedToAsync, + CodeFixContext, + concatenate, + createMultiMap, + Debug, + Diagnostics, + elementAt, + emptyArray, + every, + Expression, + factory, + firstOrUndefined, + flatMap, + forEach, + forEachChild, + forEachReturnStatement, + FunctionExpression, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + getContainingFunction, + getNodeId, + getObjectFlags, + getOriginalNode, + getSymbolId, + getSynthesizedDeepClone, + getSynthesizedDeepCloneWithReplacements, + getTokenAtPosition, + hasPropertyAccessExpressionWithName, + Identifier, + idText, + isBindingElement, + isBlock, + isCallExpression, + isExpression, + isFixablePromiseHandler, + isFunctionLike, + isFunctionLikeDeclaration, + isGeneratedIdentifier, + isIdentifier, + isInJSFile, + isObjectBindingPattern, + isOmittedExpression, + isParameter, + isPropertyAccessExpression, + isReturnStatement, + isReturnStatementWithFixablePromiseHandler, + isVariableDeclaration, + lastOrUndefined, + moveRangePastModifiers, + Node, + NodeFlags, + ObjectFlags, + PropertyAccessExpression, + returnsPromise, + ReturnStatement, + returnTrue, + Signature, + SignatureKind, + skipTrivia, + SourceFile, + Statement, + Symbol, + SyntaxKind, + textChanges, + tryCast, + TryStatement, + Type, + TypeChecker, + TypeNode, + TypeReference, + UnionReduction, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "convertToAsyncFunction"; const errorCodes = [Diagnostics.This_may_be_converted_to_an_async_function.code]; diff --git a/src/services/codefixes/convertToEsModule.ts b/src/services/codefixes/convertToEsModule.ts index e58883371d7de..959b9ea4538ad 100644 --- a/src/services/codefixes/convertToEsModule.ts +++ b/src/services/codefixes/convertToEsModule.ts @@ -1,20 +1,85 @@ import { - createCodeFixActionWithoutFixAll, moduleSpecifierToValidIdentifier, registerCodeFix, + createCodeFixActionWithoutFixAll, + moduleSpecifierToValidIdentifier, + 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, factory, filter, findChildOfKind, flatMap, - forEach, FunctionDeclaration, FunctionExpression, getEmitScriptTarget, getModeForUsageLocation, getQuotePreference, - getResolvedModule, getSynthesizedDeepClone, getSynthesizedDeepClones, getSynthesizedDeepClonesWithReplacements, - getSynthesizedDeepCloneWithReplacements, Identifier, ImportDeclaration, importFromModuleSpecifier, ImportSpecifier, - InternalSymbolName, isArray, isArrowFunction, isBinaryExpression, isClassExpression, - isExportsOrModuleExportsOrAlias, isFunctionExpression, isIdentifier, isNonContextualKeyword, - isObjectLiteralExpression, isPropertyAccessExpression, isRequireCall, isVariableStatement, makeImport, map, - mapAllOrFail, mapIterator, MethodDeclaration, Modifier, Node, NodeArray, NodeFlags, ObjectLiteralElementLike, - ObjectLiteralExpression, PropertyAccessExpression, QuotePreference, rangeContainsRange, ReadonlyCollection, - ScriptTarget, some, SourceFile, Statement, StringLiteralLike, SymbolFlags, SyntaxKind, - textChanges, TypeChecker, VariableStatement, + __String, + arrayFrom, + ArrowFunction, + BinaryExpression, + BindingElement, + BindingName, + ClassDeclaration, + ClassExpression, + concatenate, + copyEntries, + createMultiMap, + createRange, + Debug, + Diagnostics, + emptyMap, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + factory, + filter, + findChildOfKind, + flatMap, + forEach, + FunctionDeclaration, + FunctionExpression, + getEmitScriptTarget, + getModeForUsageLocation, + getQuotePreference, + getResolvedModule, + getSynthesizedDeepClone, + getSynthesizedDeepClones, + getSynthesizedDeepClonesWithReplacements, + getSynthesizedDeepCloneWithReplacements, + Identifier, + ImportDeclaration, + importFromModuleSpecifier, + ImportSpecifier, + InternalSymbolName, + isArray, + isArrowFunction, + isBinaryExpression, + isClassExpression, + isExportsOrModuleExportsOrAlias, + isFunctionExpression, + isIdentifier, + isNonContextualKeyword, + isObjectLiteralExpression, + isPropertyAccessExpression, + isRequireCall, + isVariableStatement, + makeImport, + 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 5625eecdd166a..1a3b8498a49f5 100644 --- a/src/services/codefixes/convertToMappedObjectType.ts +++ b/src/services/codefixes/convertToMappedObjectType.ts @@ -1,10 +1,32 @@ import { - cast, Diagnostics, emptyArray, factory, first, getAllSuperTypeNodes, getTokenAtPosition, - hasEffectiveReadonlyModifier, idText, IndexSignatureDeclaration, InterfaceDeclaration, isIdentifier, - isIndexSignatureDeclaration, isInterfaceDeclaration, isTypeAliasDeclaration, SourceFile, SyntaxKind, textChanges, - tryCast, TypeAliasDeclaration, TypeLiteralNode, TypeNode, + cast, + Diagnostics, + emptyArray, + factory, + first, + getAllSuperTypeNodes, + getTokenAtPosition, + hasEffectiveReadonlyModifier, + idText, + IndexSignatureDeclaration, + InterfaceDeclaration, + isIdentifier, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isTypeAliasDeclaration, + SourceFile, + SyntaxKind, + textChanges, + tryCast, + TypeAliasDeclaration, + TypeLiteralNode, + TypeNode, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixConvertToMappedObjectType"; const errorCodes = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code]; diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index 276bdcd5072d5..f6dfc027596d2 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -1,9 +1,28 @@ import { - addToSeen, CodeFixContextBase, contains, createTextSpanFromNode, Diagnostics, ExportSpecifier, factory, filter, - findDiagnosticForNode, getDiagnosticsWithinSpan, getNodeId, getTokenAtPosition, isExportSpecifier, SourceFile, - SyntaxKind, textChanges, TextSpan, tryCast, + addToSeen, + CodeFixContextBase, + contains, + createTextSpanFromNode, + Diagnostics, + ExportSpecifier, + factory, + filter, + findDiagnosticForNode, + getDiagnosticsWithinSpan, + getNodeId, + getTokenAtPosition, + isExportSpecifier, + SourceFile, + SyntaxKind, + textChanges, + TextSpan, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const errorCodes = [Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type.code]; const fixId = "convertToTypeOnlyExport"; diff --git a/src/services/codefixes/convertToTypeOnlyImport.ts b/src/services/codefixes/convertToTypeOnlyImport.ts index d124ceae5870c..b4f5bda36cafa 100644 --- a/src/services/codefixes/convertToTypeOnlyImport.ts +++ b/src/services/codefixes/convertToTypeOnlyImport.ts @@ -1,8 +1,20 @@ import { - CodeFixContextBase, Diagnostics, factory, getTokenAtPosition, ImportDeclaration, isImportDeclaration, SourceFile, - textChanges, TextSpan, tryCast, + CodeFixContextBase, + Diagnostics, + factory, + getTokenAtPosition, + ImportDeclaration, + isImportDeclaration, + SourceFile, + textChanges, + TextSpan, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const errorCodes = [Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code]; const fixId = "convertToTypeOnlyImport"; diff --git a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts index 4c228bae00e30..466a8a9bcd719 100644 --- a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts +++ b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts @@ -1,8 +1,21 @@ import { - Debug, Diagnostics, factory, findAncestor, getTokenAtPosition, Identifier, isIdentifier, isQualifiedName, - QualifiedName, SourceFile, textChanges, + Debug, + Diagnostics, + factory, + findAncestor, + getTokenAtPosition, + Identifier, + isIdentifier, + isQualifiedName, + QualifiedName, + SourceFile, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "correctQualifiedNameToIndexedAccessType"; const errorCodes = [Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code]; diff --git a/src/services/codefixes/disableJsDiagnostics.ts b/src/services/codefixes/disableJsDiagnostics.ts index 1ea24128c08dc..96202931ae090 100644 --- a/src/services/codefixes/disableJsDiagnostics.ts +++ b/src/services/codefixes/disableJsDiagnostics.ts @@ -1,10 +1,25 @@ import { - CodeFixAction, createTextChange, createTextSpan, createTextSpanFromBounds, DiagnosticCategory, Diagnostics, - getLineAndCharacterOfPosition, getNewLineOrDefaultFromHost, isCheckJsEnabledForFile, isInJSFile, mapDefined, - SourceFile, textChanges, tryAddToSet, + CodeFixAction, + createTextChange, + createTextSpan, + createTextSpanFromBounds, + DiagnosticCategory, + Diagnostics, + getLineAndCharacterOfPosition, + getNewLineOrDefaultFromHost, + isCheckJsEnabledForFile, + isInJSFile, + mapDefined, + SourceFile, + textChanges, + tryAddToSet, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createCodeFixActionWithoutFixAll, createFileTextChanges, registerCodeFix, + codeFixAll, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + createFileTextChanges, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixName = "disableJsDiagnostics"; diff --git a/src/services/codefixes/fixAddMissingConstraint.ts b/src/services/codefixes/fixAddMissingConstraint.ts index 2a3954369f02c..c5b2bd3573789 100644 --- a/src/services/codefixes/fixAddMissingConstraint.ts +++ b/src/services/codefixes/fixAddMissingConstraint.ts @@ -1,12 +1,40 @@ import { - addToSeen, createTextSpan, DiagnosticMessageChain, Diagnostics, factory, find, flattenDiagnosticMessageText, - getEmitScriptTarget, getNodeId, getTokenAtPosition, isExpression, isIdentifier, isMappedTypeNode, isString, - isTypeNode, isTypeParameterDeclaration, LanguageServiceHost, Node, Program, SourceFile, textChanges, TextSpan, - Type, TypeChecker, TypeParameterDeclaration, UserPreferences, + addToSeen, + createTextSpan, + DiagnosticMessageChain, + Diagnostics, + factory, + find, + flattenDiagnosticMessageText, + getEmitScriptTarget, + getNodeId, + getTokenAtPosition, + isExpression, + isIdentifier, + isMappedTypeNode, + isString, + isTypeNode, + isTypeParameterDeclaration, + LanguageServiceHost, + Node, + Program, + SourceFile, + textChanges, + TextSpan, + Type, + TypeChecker, + TypeParameterDeclaration, + UserPreferences, } from "../_namespaces/ts"; import { - createCodeFixAction, createCombinedCodeActions, createImportAdder, eachDiagnostic, findAncestorMatchingSpan, - getNoopSymbolTrackerWithResolver, registerCodeFix, typeToAutoImportableTypeNode, + createCodeFixAction, + createCombinedCodeActions, + createImportAdder, + eachDiagnostic, + findAncestorMatchingSpan, + getNoopSymbolTrackerWithResolver, + registerCodeFix, + typeToAutoImportableTypeNode, } from "../_namespaces/ts.codefix"; const fixId = "addMissingConstraint"; diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index 6c8ff9d3f0561..490d65171be2f 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -1,26 +1,127 @@ import { - __String, addToSeen, arrayFrom, BigIntLiteralType, BinaryExpression, CallExpression, CheckFlags, - ClassLikeDeclaration, CodeFixAction, CodeFixContext, CodeFixContextBase, concatenate, - createPropertyNameNodeForIdentifierOrLiteral, Debug, Diagnostics, emptyArray, EnumDeclaration, Expression, factory, - filter, find, findAncestor, findIndex, firstDefined, firstOrUndefined, FunctionExpression, getCheckFlags, - getClassLikeDeclarationOfSymbol, getEmitScriptTarget, getFirstConstructorWithBody, getNodeId, getObjectFlags, - getOrUpdate, getQuotePreference, getSourceFileOfNode, getTokenAtPosition, hasAbstractModifier, hasInitializer, - Identifier, idText, InterfaceDeclaration, isCallExpression, isClassLike, isComputedPropertyName, - isConstructorDeclaration, isEnumDeclaration, isFunctionTypeNode, isIdentifier, isIdentifierText, - isInterfaceDeclaration, isJsxAttribute, isJsxExpression, isJsxOpeningLikeElement, isJsxSpreadAttribute, - isMemberName, isMethodDeclaration, isMethodSignature, isModuleDeclaration, isObjectLiteralExpression, isParameter, - isPrivateIdentifier, isPropertyAccessExpression, isPropertyDeclaration, isReturnStatement, isSourceFile, - isSourceFileFromLibrary, 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, + __String, + addToSeen, + arrayFrom, + BigIntLiteralType, + BinaryExpression, + CallExpression, + CheckFlags, + ClassLikeDeclaration, + CodeFixAction, + CodeFixContext, + CodeFixContextBase, + concatenate, + createPropertyNameNodeForIdentifierOrLiteral, + Debug, + Diagnostics, + emptyArray, + EnumDeclaration, + Expression, + factory, + filter, + find, + findAncestor, + findIndex, + firstDefined, + firstOrUndefined, + FunctionExpression, + getCheckFlags, + getClassLikeDeclarationOfSymbol, + getEmitScriptTarget, + getFirstConstructorWithBody, + getNodeId, + getObjectFlags, + getOrUpdate, + getQuotePreference, + getSourceFileOfNode, + getTokenAtPosition, + hasAbstractModifier, + hasInitializer, + Identifier, + idText, + InterfaceDeclaration, + isCallExpression, + isClassLike, + isComputedPropertyName, + isConstructorDeclaration, + isEnumDeclaration, + isFunctionTypeNode, + isIdentifier, + isIdentifierText, + isInterfaceDeclaration, + isJsxAttribute, + isJsxExpression, + isJsxOpeningLikeElement, + isJsxSpreadAttribute, + isMemberName, + isMethodDeclaration, + isMethodSignature, + isModuleDeclaration, + isObjectLiteralExpression, + isParameter, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyDeclaration, + isReturnStatement, + isSourceFile, + isSourceFileFromLibrary, + 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 { - createCodeFixAction, createCodeFixActionWithoutFixAll, createCombinedCodeActions, createImportAdder, - createSignatureDeclarationFromCallExpression, createSignatureDeclarationFromSignature, createStubbedBody, - eachDiagnostic, getAllSupers, ImportAdder, registerCodeFix, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + createCombinedCodeActions, + createImportAdder, + createSignatureDeclarationFromCallExpression, + createSignatureDeclarationFromSignature, + createStubbedBody, + eachDiagnostic, + getAllSupers, + ImportAdder, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixMissingMember = "fixMissingMember"; diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts index fc8db24afabb7..32b17b39233d8 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -1,8 +1,20 @@ import { - cast, Diagnostics, factory, getTokenAtPosition, isCallExpression, Node, SourceFile, textChanges, TextSpan, + cast, + Diagnostics, + factory, + getTokenAtPosition, + isCallExpression, + Node, + SourceFile, + textChanges, + TextSpan, textSpanEnd, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingNewOperator"; const errorCodes = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code]; diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts index dd5ad944760a5..1fa7b06bedef0 100644 --- a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -1,7 +1,18 @@ import { - Debug, Diagnostics, factory, getTokenAtPosition, ImportTypeNode, SourceFile, SyntaxKind, textChanges, + Debug, + Diagnostics, + factory, + getTokenAtPosition, + ImportTypeNode, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof"; const fixId = fixIdAddMissingTypeof; diff --git a/src/services/codefixes/fixAddVoidToPromise.ts b/src/services/codefixes/fixAddVoidToPromise.ts index c4281a5315bda..4abb3cdedda2d 100644 --- a/src/services/codefixes/fixAddVoidToPromise.ts +++ b/src/services/codefixes/fixAddVoidToPromise.ts @@ -1,10 +1,35 @@ import { - CodeFixAllContext, Diagnostics, factory, getJSDocTypeTag, getTokenAtPosition, idText, isCallExpression, - isIdentifier, isInJSFile, isNewExpression, isParameter, isParenthesizedExpression, isParenthesizedTypeNode, - isTypeReferenceNode, isUnionTypeNode, NewExpression, ParameterDeclaration, Program, skipTrivia, some, - SourceFile, SyntaxKind, textChanges, TextSpan, TypeFlags, + CodeFixAllContext, + Diagnostics, + factory, + getJSDocTypeTag, + getTokenAtPosition, + idText, + isCallExpression, + isIdentifier, + isInJSFile, + isNewExpression, + isParameter, + isParenthesizedExpression, + isParenthesizedTypeNode, + isTypeReferenceNode, + isUnionTypeNode, + NewExpression, + ParameterDeclaration, + Program, + skipTrivia, + some, + SourceFile, + SyntaxKind, + textChanges, + TextSpan, + TypeFlags, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "addVoidToPromise"; const fixId = "addVoidToPromise"; diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts index b79aa7f3641fb..f12ba12e3f0fc 100644 --- a/src/services/codefixes/fixAwaitInSyncFunction.ts +++ b/src/services/codefixes/fixAwaitInSyncFunction.ts @@ -1,9 +1,30 @@ import { - addToSeen, ArrowFunction, Diagnostics, factory, findChildOfKind, first, FunctionDeclaration, FunctionExpression, - getContainingFunction, getEntityNameFromTypeNode, getNodeId, getTokenAtPosition, isFunctionTypeNode, - isVariableDeclaration, MethodDeclaration, Node, SourceFile, SyntaxKind, textChanges, TypeNode, + addToSeen, + ArrowFunction, + Diagnostics, + factory, + findChildOfKind, + first, + FunctionDeclaration, + FunctionExpression, + getContainingFunction, + getEntityNameFromTypeNode, + getNodeId, + getTokenAtPosition, + isFunctionTypeNode, + isVariableDeclaration, + MethodDeclaration, + Node, + SourceFile, + SyntaxKind, + textChanges, + TypeNode, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixAwaitInSyncFunction"; const errorCodes = [ diff --git a/src/services/codefixes/fixCannotFindModule.ts b/src/services/codefixes/fixCannotFindModule.ts index fb959282f6e76..d128045f7f075 100644 --- a/src/services/codefixes/fixCannotFindModule.ts +++ b/src/services/codefixes/fixCannotFindModule.ts @@ -1,8 +1,22 @@ import { - Debug, Diagnostics, getTokenAtPosition, getTypesPackageName, InstallPackageAction, isExternalModuleNameRelative, - isStringLiteral, JsTyping, LanguageServiceHost, parsePackageName, SourceFile, tryCast, + Debug, + Diagnostics, + getTokenAtPosition, + getTypesPackageName, + InstallPackageAction, + isExternalModuleNameRelative, + isStringLiteral, + JsTyping, + LanguageServiceHost, + parsePackageName, + SourceFile, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "fixCannotFindModule"; const fixIdInstallTypesPackage = "installTypesPackage"; diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 95cc015aa9120..ac9d7af09944d 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -1,10 +1,27 @@ import { - addToSeen, cast, ClassElement, ClassLikeDeclaration, Diagnostics, first, getEffectiveBaseTypeNode, getNodeId, - getSyntacticModifierFlags, getTokenAtPosition, isClassLike, ModifierFlags, SourceFile, Symbol, textChanges, + addToSeen, + cast, + ClassElement, + ClassLikeDeclaration, + Diagnostics, + first, + getEffectiveBaseTypeNode, + getNodeId, + getSyntacticModifierFlags, + getTokenAtPosition, + isClassLike, + ModifierFlags, + SourceFile, + Symbol, + textChanges, UserPreferences, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createImportAdder, createMissingMemberNodes, registerCodeFix, + codeFixAll, + createCodeFixAction, + createImportAdder, + createMissingMemberNodes, + registerCodeFix, TypeConstructionContext, } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index defbd8b001ec4..f91c49c9bece9 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -1,13 +1,41 @@ import { - addToSeen, and, ClassElement, ClassLikeDeclaration, CodeFixAction, createSymbolTable, Debug, Diagnostics, - ExpressionWithTypeArguments, find, getContainingClass, getEffectiveBaseTypeNode, getEffectiveImplementsTypeNodes, - getEffectiveModifierFlags, getNodeId, getTokenAtPosition, IndexKind, InterfaceDeclaration, InterfaceType, - isConstructorDeclaration, mapDefined, ModifierFlags, SourceFile, Symbol, SymbolTable, textChanges, TypeChecker, + addToSeen, + and, + ClassElement, + ClassLikeDeclaration, + CodeFixAction, + createSymbolTable, + Debug, + Diagnostics, + ExpressionWithTypeArguments, + find, + getContainingClass, + getEffectiveBaseTypeNode, + getEffectiveImplementsTypeNodes, + getEffectiveModifierFlags, + getNodeId, + getTokenAtPosition, + IndexKind, + InterfaceDeclaration, + InterfaceType, + isConstructorDeclaration, + mapDefined, + ModifierFlags, + SourceFile, + Symbol, + SymbolTable, + textChanges, + TypeChecker, UserPreferences, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createImportAdder, createMissingMemberNodes, getNoopSymbolTrackerWithResolver, - registerCodeFix, 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 0a452fc040b9b..02276f8d7a482 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -1,9 +1,27 @@ import { - addToSeen, CallExpression, ConstructorDeclaration, Diagnostics, ExpressionStatement, forEachChild, - getContainingFunction, getNodeId, getTokenAtPosition, isExpressionStatement, isFunctionLike, - isPropertyAccessExpression, isSuperCall, Node, SourceFile, SyntaxKind, textChanges, + addToSeen, + CallExpression, + ConstructorDeclaration, + Diagnostics, + ExpressionStatement, + forEachChild, + getContainingFunction, + getNodeId, + getTokenAtPosition, + isExpressionStatement, + isFunctionLike, + isPropertyAccessExpression, + isSuperCall, + Node, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "classSuperMustPrecedeThisAccess"; const errorCodes = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code]; diff --git a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts index 118b1b630f4c3..feee99da0d0cf 100644 --- a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts +++ b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts @@ -1,8 +1,19 @@ import { - ConstructorDeclaration, Debug, Diagnostics, emptyArray, factory, getTokenAtPosition, isConstructorDeclaration, - SourceFile, textChanges, + ConstructorDeclaration, + Debug, + Diagnostics, + emptyArray, + factory, + getTokenAtPosition, + isConstructorDeclaration, + SourceFile, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "constructorForDerivedNeedSuperCall"; const errorCodes = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; diff --git a/src/services/codefixes/fixEnableExperimentalDecorators.ts b/src/services/codefixes/fixEnableExperimentalDecorators.ts index 913ba7ee80f75..271c9b969118c 100644 --- a/src/services/codefixes/fixEnableExperimentalDecorators.ts +++ b/src/services/codefixes/fixEnableExperimentalDecorators.ts @@ -1,6 +1,14 @@ -import { Diagnostics, factory, textChanges, TsConfigSourceFile } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixActionWithoutFixAll, registerCodeFix, setJsonCompilerOptionValue, + Diagnostics, + factory, + textChanges, + TsConfigSourceFile, +} from "../_namespaces/ts"; +import { + codeFixAll, + createCodeFixActionWithoutFixAll, + registerCodeFix, + setJsonCompilerOptionValue, } from "../_namespaces/ts.codefix"; const fixId = "enableExperimentalDecorators"; diff --git a/src/services/codefixes/fixEnableJsxFlag.ts b/src/services/codefixes/fixEnableJsxFlag.ts index 7fb645b03d374..4870e021120f7 100644 --- a/src/services/codefixes/fixEnableJsxFlag.ts +++ b/src/services/codefixes/fixEnableJsxFlag.ts @@ -1,6 +1,14 @@ -import { Diagnostics, factory, textChanges, TsConfigSourceFile } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixActionWithoutFixAll, registerCodeFix, setJsonCompilerOptionValue, + Diagnostics, + factory, + textChanges, + TsConfigSourceFile, +} from "../_namespaces/ts"; +import { + codeFixAll, + createCodeFixActionWithoutFixAll, + registerCodeFix, + setJsonCompilerOptionValue, } from "../_namespaces/ts.codefix"; const fixID = "fixEnableJsxFlag"; diff --git a/src/services/codefixes/fixExpectedComma.ts b/src/services/codefixes/fixExpectedComma.ts index 795ff8a6a49e7..ed571ab443352 100644 --- a/src/services/codefixes/fixExpectedComma.ts +++ b/src/services/codefixes/fixExpectedComma.ts @@ -1,8 +1,19 @@ import { - Diagnostics, factory, getTokenAtPosition, isArrayLiteralExpression, isObjectLiteralExpression, Node, SourceFile, - SyntaxKind, textChanges, + Diagnostics, + factory, + getTokenAtPosition, + isArrayLiteralExpression, + isObjectLiteralExpression, + Node, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixExpectedComma"; const expectedErrorCode = Diagnostics._0_expected.code; diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index 9cd8edb6ac997..7beffebd59986 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -1,8 +1,20 @@ import { - Diagnostics, factory, getContainingClass, getTokenAtPosition, HeritageClause, isWhiteSpaceSingleLine, Node, - SourceFile, SyntaxKind, textChanges, + Diagnostics, + factory, + getContainingClass, + getTokenAtPosition, + HeritageClause, + isWhiteSpaceSingleLine, + Node, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "extendsInterfaceBecomesImplements"; const errorCodes = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code]; diff --git a/src/services/codefixes/fixForgottenThisPropertyAccess.ts b/src/services/codefixes/fixForgottenThisPropertyAccess.ts index cf441e9315605..ae8d0cd294f0b 100644 --- a/src/services/codefixes/fixForgottenThisPropertyAccess.ts +++ b/src/services/codefixes/fixForgottenThisPropertyAccess.ts @@ -1,8 +1,21 @@ import { - Diagnostics, factory, getContainingClass, getTokenAtPosition, Identifier, isIdentifier, isPrivateIdentifier, - PrivateIdentifier, SourceFile, suppressLeadingAndTrailingTrivia, textChanges, + Diagnostics, + factory, + getContainingClass, + getTokenAtPosition, + Identifier, + isIdentifier, + isPrivateIdentifier, + PrivateIdentifier, + SourceFile, + suppressLeadingAndTrailingTrivia, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "forgottenThisPropertyAccess"; const didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code; diff --git a/src/services/codefixes/fixImplicitThis.ts b/src/services/codefixes/fixImplicitThis.ts index bd795644946dd..cd288e531df8c 100644 --- a/src/services/codefixes/fixImplicitThis.ts +++ b/src/services/codefixes/fixImplicitThis.ts @@ -1,9 +1,28 @@ import { - ANONYMOUS, Debug, DiagnosticAndArguments, Diagnostics, emptyArray, factory, FindAllReferences, findChildOfKind, - getThisContainer, getTokenAtPosition, isFunctionDeclaration, isFunctionExpression, isSourceFile, isThis, SourceFile, - SyntaxKind, textChanges, TypeChecker, + ANONYMOUS, + Debug, + DiagnosticAndArguments, + Diagnostics, + emptyArray, + factory, + FindAllReferences, + findChildOfKind, + getThisContainer, + getTokenAtPosition, + isFunctionDeclaration, + isFunctionExpression, + isSourceFile, + isThis, + SourceFile, + SyntaxKind, + textChanges, + TypeChecker, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixImplicitThis"; const errorCodes = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code]; diff --git a/src/services/codefixes/fixImportNonExportedMember.ts b/src/services/codefixes/fixImportNonExportedMember.ts index ce81a02dd3085..ba1ec81fc945f 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -1,12 +1,40 @@ import { - canHaveExportModifier, Declaration, Diagnostics, ExportDeclaration, factory, find, findAncestor, findLast, - firstOrUndefined, getResolvedModule, getTokenAtPosition, Identifier, isExportDeclaration, isIdentifier, - isImportDeclaration, isNamedExports, isSourceFileFromLibrary, isStringLiteral, isTypeDeclaration, - isVariableDeclaration, isVariableStatement, length, map, Node, Program, SourceFile, Symbol, textChanges, - tryCast, VariableStatement, + canHaveExportModifier, + Declaration, + Diagnostics, + ExportDeclaration, + factory, + find, + findAncestor, + findLast, + firstOrUndefined, + getResolvedModule, + getTokenAtPosition, + Identifier, + isExportDeclaration, + isIdentifier, + isImportDeclaration, + isNamedExports, + isSourceFileFromLibrary, + isStringLiteral, + isTypeDeclaration, + isVariableDeclaration, + isVariableStatement, + length, + map, + Node, + Program, + SourceFile, + Symbol, + textChanges, + tryCast, + VariableStatement, } from "../_namespaces/ts"; import { - createCodeFixAction, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixAction, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixId = "fixImportNonExportedMember"; diff --git a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts index f9ce4f3167317..f7e8345b217f0 100644 --- a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts +++ b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts @@ -1,8 +1,20 @@ import { - Diagnostics, factory, findAncestor, getTokenAtPosition, NamedTupleMember, OptionalTypeNode, ParenthesizedTypeNode, - RestTypeNode, SourceFile, SyntaxKind, textChanges, + Diagnostics, + factory, + findAncestor, + getTokenAtPosition, + NamedTupleMember, + OptionalTypeNode, + ParenthesizedTypeNode, + RestTypeNode, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixIncorrectNamedTupleSyntax"; const errorCodes = [ diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index d326e8e4cb94b..698a7397878b1 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -1,10 +1,34 @@ import { - addRange, CallExpression, CodeFixAction, CodeFixContext, Diagnostics, factory, findAncestor, getEmitModuleKind, - getNamespaceDeclarationNode, getQuotePreference, getSourceFileOfNode, getTokenAtPosition, ImportDeclaration, - isExpression, isImportCall, isNamedDeclaration, makeImport, ModuleKind, NamespaceImport, NewExpression, Node, - SourceFile, SyntaxKind, textChanges, TransientSymbol, + addRange, + CallExpression, + CodeFixAction, + CodeFixContext, + Diagnostics, + factory, + findAncestor, + getEmitModuleKind, + getNamespaceDeclarationNode, + getQuotePreference, + getSourceFileOfNode, + getTokenAtPosition, + ImportDeclaration, + isExpression, + isImportCall, + isNamedDeclaration, + makeImport, + ModuleKind, + NamespaceImport, + NewExpression, + Node, + SourceFile, + SyntaxKind, + textChanges, + TransientSymbol, } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "invalidImportSyntax"; diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index b439ac6e6a380..3c53a5da26b5e 100644 --- a/src/services/codefixes/fixInvalidJsxCharacters.ts +++ b/src/services/codefixes/fixInvalidJsxCharacters.ts @@ -1,5 +1,16 @@ -import { Diagnostics, hasProperty, quote, SourceFile, textChanges, UserPreferences } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + Diagnostics, + hasProperty, + quote, + SourceFile, + textChanges, + UserPreferences, +} from "../_namespaces/ts"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixIdExpression = "fixInvalidJsxCharacters_expression"; const fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity"; diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts index 56cd99ddc3938..0a5442600d8c4 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -1,11 +1,39 @@ import { - AsExpression, CallSignatureDeclaration, CodeFixAction, ConstructSignatureDeclaration, DiagnosticMessage, - Diagnostics, findAncestor, FunctionDeclaration, GetAccessorDeclaration, getTokenAtPosition, - IndexSignatureDeclaration, MappedTypeNode, MethodDeclaration, MethodSignature, Node, ParameterDeclaration, - PropertyDeclaration, PropertySignature, SetAccessorDeclaration, SourceFile, SyntaxKind, textChanges, Type, - TypeAliasDeclaration, TypeAssertion, TypeChecker, TypeFlags, TypeNode, VariableDeclaration, + AsExpression, + CallSignatureDeclaration, + CodeFixAction, + ConstructSignatureDeclaration, + DiagnosticMessage, + Diagnostics, + findAncestor, + FunctionDeclaration, + GetAccessorDeclaration, + getTokenAtPosition, + IndexSignatureDeclaration, + MappedTypeNode, + MethodDeclaration, + MethodSignature, + Node, + ParameterDeclaration, + PropertyDeclaration, + PropertySignature, + SetAccessorDeclaration, + SourceFile, + SyntaxKind, + textChanges, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeFlags, + TypeNode, + VariableDeclaration, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixIdPlain = "fixJSDocTypes_plain"; const fixIdNullable = "fixJSDocTypes_nullable"; diff --git a/src/services/codefixes/fixMissingCallParentheses.ts b/src/services/codefixes/fixMissingCallParentheses.ts index a4d20b3759025..4fcc89c87fcc0 100644 --- a/src/services/codefixes/fixMissingCallParentheses.ts +++ b/src/services/codefixes/fixMissingCallParentheses.ts @@ -1,8 +1,19 @@ import { - Diagnostics, getTokenAtPosition, Identifier, isIdentifier, isPropertyAccessExpression, PrivateIdentifier, - PropertyAccessExpression, SourceFile, textChanges, + Diagnostics, + getTokenAtPosition, + Identifier, + isIdentifier, + isPropertyAccessExpression, + PrivateIdentifier, + PropertyAccessExpression, + SourceFile, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixMissingCallParentheses"; const errorCodes = [ diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 71142e4cd08b9..3769fa3619ef1 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -1,9 +1,20 @@ import { - createCodeFixActionWithoutFixAll, registerCodeFix, setJsonCompilerOptionValue, setJsonCompilerOptionValues, + createCodeFixActionWithoutFixAll, + registerCodeFix, + setJsonCompilerOptionValue, + setJsonCompilerOptionValues, } from "../_namespaces/ts.codefix"; import { - CodeFixAction, Diagnostics, Expression, factory, getEmitModuleKind, getEmitScriptTarget, - getTsConfigObjectLiteralExpression, ModuleKind, ScriptTarget, textChanges, + CodeFixAction, + Diagnostics, + Expression, + factory, + getEmitModuleKind, + getEmitScriptTarget, + getTsConfigObjectLiteralExpression, + ModuleKind, + ScriptTarget, + textChanges, } from "../_namespaces/ts"; registerCodeFix({ diff --git a/src/services/codefixes/fixNaNEquality.ts b/src/services/codefixes/fixNaNEquality.ts index 02d2c8240620e..cf86a7ef2d53d 100644 --- a/src/services/codefixes/fixNaNEquality.ts +++ b/src/services/codefixes/fixNaNEquality.ts @@ -1,9 +1,26 @@ import { - BinaryExpression, createTextSpan, DiagnosticMessageChain, Diagnostics, Expression, factory, find, - flattenDiagnosticMessageText, isBinaryExpression, isExpression, Program, SourceFile, SyntaxKind, textChanges, + BinaryExpression, + createTextSpan, + DiagnosticMessageChain, + Diagnostics, + Expression, + factory, + find, + flattenDiagnosticMessageText, + isBinaryExpression, + isExpression, + Program, + SourceFile, + SyntaxKind, + textChanges, TextSpan, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, findAncestorMatchingSpan, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + findAncestorMatchingSpan, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixNaNEquality"; const errorCodes = [ diff --git a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts index 33e80189797e9..7a35126032924 100644 --- a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts +++ b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts @@ -1,8 +1,22 @@ import { - cast, Diagnostics, factory, getQuotePreference, getTokenAtPosition, isPropertyAccessChain, - isPropertyAccessExpression, PropertyAccessExpression, QuotePreference, SourceFile, textChanges, UserPreferences, + cast, + Diagnostics, + factory, + getQuotePreference, + getTokenAtPosition, + isPropertyAccessChain, + isPropertyAccessExpression, + PropertyAccessExpression, + QuotePreference, + SourceFile, + textChanges, + UserPreferences, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixNoPropertyAccessFromIndexSignature"; const errorCodes = [ diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index c298256f1cda0..f76a8420e0699 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -1,12 +1,42 @@ import { - CodeFixAllContext, CodeFixContext, ConstructorDeclaration, Debug, DiagnosticMessage, Diagnostics, emptyArray, - factory, find, findAncestor, findLast, GetAccessorDeclaration, getTokenAtPosition, isAbstractModifier, - isAccessibilityModifier, isClassLike, isDecorator, isJSDocOverrideTag, isOverrideModifier, - isParameterPropertyDeclaration, isSourceFileJS, isStaticModifier, MethodDeclaration, Node, not, - ParameterPropertyDeclaration, PropertyDeclaration, SetAccessorDeclaration, skipTrivia, SourceFile, SyntaxKind, + CodeFixAllContext, + CodeFixContext, + ConstructorDeclaration, + Debug, + DiagnosticMessage, + Diagnostics, + emptyArray, + factory, + find, + findAncestor, + findLast, + GetAccessorDeclaration, + getTokenAtPosition, + isAbstractModifier, + isAccessibilityModifier, + isClassLike, + isDecorator, + isJSDocOverrideTag, + isOverrideModifier, + isParameterPropertyDeclaration, + isSourceFileJS, + isStaticModifier, + MethodDeclaration, + Node, + not, + ParameterPropertyDeclaration, + PropertyDeclaration, + SetAccessorDeclaration, + skipTrivia, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixActionMaybeFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixActionMaybeFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "fixOverrideModifier"; const fixAddOverrideId = "fixAddOverrideModifier"; diff --git a/src/services/codefixes/fixPropertyAssignment.ts b/src/services/codefixes/fixPropertyAssignment.ts index 52b250ed43cc3..2f1ef5a198044 100644 --- a/src/services/codefixes/fixPropertyAssignment.ts +++ b/src/services/codefixes/fixPropertyAssignment.ts @@ -1,8 +1,19 @@ import { - cast, Diagnostics, Expression, factory, getTokenAtPosition, isShorthandPropertyAssignment, - ShorthandPropertyAssignment, SourceFile, textChanges, + cast, + Diagnostics, + Expression, + factory, + getTokenAtPosition, + isShorthandPropertyAssignment, + ShorthandPropertyAssignment, + SourceFile, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixPropertyAssignment"; const errorCodes = [ diff --git a/src/services/codefixes/fixPropertyOverrideAccessor.ts b/src/services/codefixes/fixPropertyOverrideAccessor.ts index 8c229c3dc70b3..954a90ba6f34a 100644 --- a/src/services/codefixes/fixPropertyOverrideAccessor.ts +++ b/src/services/codefixes/fixPropertyOverrideAccessor.ts @@ -1,9 +1,23 @@ import { - CodeFixAllContext, CodeFixContext, Debug, Diagnostics, getSourceFileOfNode, getTextOfPropertyName, - getTokenAtPosition, isAccessor, isClassLike, singleOrUndefined, SourceFile, unescapeLeadingUnderscores, + CodeFixAllContext, + CodeFixContext, + Debug, + Diagnostics, + getSourceFileOfNode, + getTextOfPropertyName, + getTokenAtPosition, + isAccessor, + isClassLike, + singleOrUndefined, + SourceFile, + unescapeLeadingUnderscores, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, generateAccessorFromProperty, getAllSupers, registerCodeFix, + codeFixAll, + createCodeFixAction, + generateAccessorFromProperty, + getAllSupers, + registerCodeFix, } from "../_namespaces/ts.codefix"; const errorCodes = [ diff --git a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts index d29797a1a7071..a7071d6e143f4 100644 --- a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts +++ b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts @@ -1,8 +1,21 @@ import { - Diagnostics, factory, findAncestor, getTokenAtPosition, isFunctionLikeDeclaration, isInJSFile, SourceFile, - textChanges, Type, TypeChecker, TypeNode, + Diagnostics, + factory, + findAncestor, + getTokenAtPosition, + isFunctionLikeDeclaration, + isInJSFile, + SourceFile, + textChanges, + Type, + TypeChecker, + TypeNode, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixReturnTypeInAsyncFunction"; const errorCodes = [ diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index cf7768ddfe95c..8e3574aa60cde 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -1,13 +1,50 @@ import { - CodeFixContextBase, Debug, Diagnostics, factory, findAncestor, getEffectiveBaseTypeNode, getEmitScriptTarget, - getMeaningFromLocation, getModeForUsageLocation, getResolvedModule, getTextOfNode, getTokenAtPosition, - hasSyntacticModifier, ImportDeclaration, isBinaryExpression, isClassElement, isClassLike, isIdentifier, - isIdentifierText, isImportDeclaration, isImportSpecifier, isJsxAttribute, isJsxOpeningLikeElement, isMemberName, - isNamedDeclaration, isPrivateIdentifier, isPropertyAccessExpression, isQualifiedName, isStringLiteralLike, - ModifierFlags, Node, NodeFlags, ScriptTarget, SemanticMeaning, SourceFile, Symbol, SymbolFlags, symbolName, - SyntaxKind, textChanges, + CodeFixContextBase, + Debug, + Diagnostics, + factory, + findAncestor, + getEffectiveBaseTypeNode, + getEmitScriptTarget, + getMeaningFromLocation, + getModeForUsageLocation, + getResolvedModule, + getTextOfNode, + getTokenAtPosition, + hasSyntacticModifier, + ImportDeclaration, + isBinaryExpression, + isClassElement, + isClassLike, + isIdentifier, + isIdentifierText, + isImportDeclaration, + isImportSpecifier, + isJsxAttribute, + isJsxOpeningLikeElement, + isMemberName, + isNamedDeclaration, + isPrivateIdentifier, + isPropertyAccessExpression, + isQualifiedName, + isStringLiteralLike, + ModifierFlags, + Node, + NodeFlags, + ScriptTarget, + SemanticMeaning, + SourceFile, + Symbol, + SymbolFlags, + symbolName, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixSpelling"; const errorCodes = [ diff --git a/src/services/codefixes/fixStrictClassInitialization.ts b/src/services/codefixes/fixStrictClassInitialization.ts index 5dc35843d7462..fa78042e08217 100644 --- a/src/services/codefixes/fixStrictClassInitialization.ts +++ b/src/services/codefixes/fixStrictClassInitialization.ts @@ -1,11 +1,38 @@ import { - append, BigIntLiteralType, CodeFixAction, CodeFixContext, Debug, Diagnostics, Expression, factory, firstDefined, - getClassLikeDeclarationOfSymbol, getEffectiveTypeAnnotationNode, getFirstConstructorWithBody, getTokenAtPosition, - hasSyntacticModifier, isIdentifier, isInJSFile, isPropertyDeclaration, isUnionTypeNode, ModifierFlags, - PropertyDeclaration, SourceFile, suppressLeadingAndTrailingTrivia, SyntaxKind, textChanges, Type, TypeChecker, - TypeFlags, TypeNode, + append, + BigIntLiteralType, + CodeFixAction, + CodeFixContext, + Debug, + Diagnostics, + Expression, + factory, + firstDefined, + getClassLikeDeclarationOfSymbol, + getEffectiveTypeAnnotationNode, + getFirstConstructorWithBody, + getTokenAtPosition, + hasSyntacticModifier, + isIdentifier, + isInJSFile, + isPropertyDeclaration, + isUnionTypeNode, + ModifierFlags, + PropertyDeclaration, + SourceFile, + suppressLeadingAndTrailingTrivia, + SyntaxKind, + textChanges, + Type, + TypeChecker, + TypeFlags, + TypeNode, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "strictClassInitialization"; const fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions"; diff --git a/src/services/codefixes/fixUnmatchedParameter.ts b/src/services/codefixes/fixUnmatchedParameter.ts index cfeb0fe7200e9..bdb4bbbb28df0 100644 --- a/src/services/codefixes/fixUnmatchedParameter.ts +++ b/src/services/codefixes/fixUnmatchedParameter.ts @@ -1,10 +1,31 @@ import { - __String, append, CodeFixAction, CodeFixContext, Diagnostics, factory, firstDefined, getHostSignatureFromJSDoc, - getJSDocTags, getTokenAtPosition, Identifier, isIdentifier, isJSDocParameterTag, JSDocParameterTag, JSDocTag, - length, map, SignatureDeclaration, SourceFile, textChanges, + __String, + append, + CodeFixAction, + CodeFixContext, + Diagnostics, + factory, + firstDefined, + getHostSignatureFromJSDoc, + getJSDocTags, + getTokenAtPosition, + Identifier, + isIdentifier, + isJSDocParameterTag, + JSDocParameterTag, + JSDocTag, + length, + map, + SignatureDeclaration, + SourceFile, + textChanges, } from "../_namespaces/ts"; import { - createCodeFixAction, createCodeFixActionWithoutFixAll, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; const deleteUnmatchedParameter = "deleteUnmatchedParameter"; diff --git a/src/services/codefixes/fixUnreachableCode.ts b/src/services/codefixes/fixUnreachableCode.ts index 5e3fa6f45d7d4..17afabda71a93 100644 --- a/src/services/codefixes/fixUnreachableCode.ts +++ b/src/services/codefixes/fixUnreachableCode.ts @@ -1,8 +1,24 @@ import { - Debug, Diagnostics, emptyArray, factory, findAncestor, first, getTokenAtPosition, IfStatement, isBlock, isStatement, - sliceAfter, SourceFile, SyntaxKind, textChanges, + Debug, + Diagnostics, + emptyArray, + factory, + findAncestor, + first, + getTokenAtPosition, + IfStatement, + isBlock, + isStatement, + sliceAfter, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixUnreachableCode"; const errorCodes = [Diagnostics.Unreachable_code_detected.code]; diff --git a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts index 9340f7ddaadea..ec5b5e6e3ca90 100644 --- a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts +++ b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts @@ -1,10 +1,33 @@ import { - append, CodeFixAction, Diagnostics, emptyArray, find, forEachImportClauseDeclaration, getTokenAtPosition, - ImportClause, ImportEqualsDeclaration, ImportSpecifier, isIdentifier, isImportClause, isImportEqualsDeclaration, - isImportSpecifier, Node, or, Program, refactor, skipAlias, SourceFile, SymbolFlags, SyntaxKind, textChanges, + append, + CodeFixAction, + Diagnostics, + emptyArray, + find, + forEachImportClauseDeclaration, + getTokenAtPosition, + ImportClause, + ImportEqualsDeclaration, + ImportSpecifier, + isIdentifier, + isImportClause, + isImportEqualsDeclaration, + isImportSpecifier, + Node, + or, + Program, + refactor, + skipAlias, + SourceFile, + SymbolFlags, + SyntaxKind, + textChanges, tryCast, } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixUnreferenceableDecoratorMetadata"; const errorCodes = [Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code]; diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index c07250c280ae7..e9b0f2fc7ed12 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -1,15 +1,62 @@ import { - ArrayBindingPattern, CancellationToken, cast, CodeFixAction, Debug, DiagnosticAndArguments, DiagnosticMessage, - Diagnostics, factory, FileTextChanges, FindAllReferences, first, forEach, FunctionLikeDeclaration, - getJSDocParameterTags, getTokenAtPosition, Identifier, ImportDeclaration, isArrayBindingPattern, isBinaryExpression, - isCallExpression, isComputedPropertyName, isDeclarationWithTypeParameterChildren, isExpressionStatement, - isIdentifier, isImportClause, isImportDeclaration, isInferTypeNode, isJSDocTemplateTag, isMethodDeclaration, - isMethodSignature, isModifier, isObjectBindingPattern, isParameter, isPostfixUnaryExpression, - isPrefixUnaryExpression, isPropertyAccessExpression, isSuperKeyword, isVariableDeclarationList, map, Node, - ObjectBindingPattern, ParameterDeclaration, Program, showModuleSpecifier, SourceFile, SyntaxKind, textChanges, - tryCast, TypeChecker, VariableDeclaration, VariableDeclarationList, + ArrayBindingPattern, + CancellationToken, + cast, + CodeFixAction, + Debug, + DiagnosticAndArguments, + DiagnosticMessage, + Diagnostics, + factory, + FileTextChanges, + FindAllReferences, + first, + forEach, + FunctionLikeDeclaration, + getJSDocParameterTags, + getTokenAtPosition, + Identifier, + ImportDeclaration, + isArrayBindingPattern, + isBinaryExpression, + isCallExpression, + isComputedPropertyName, + isDeclarationWithTypeParameterChildren, + isExpressionStatement, + isIdentifier, + isImportClause, + isImportDeclaration, + isInferTypeNode, + isJSDocTemplateTag, + isMethodDeclaration, + isMethodSignature, + isModifier, + isObjectBindingPattern, + isParameter, + isPostfixUnaryExpression, + isPrefixUnaryExpression, + isPropertyAccessExpression, + isSuperKeyword, + isVariableDeclarationList, + map, + Node, + ObjectBindingPattern, + ParameterDeclaration, + Program, + showModuleSpecifier, + SourceFile, + SyntaxKind, + textChanges, + tryCast, + TypeChecker, + VariableDeclaration, + VariableDeclarationList, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "unusedIdentifier"; const fixIdPrefix = "unusedIdentifier_prefix"; diff --git a/src/services/codefixes/fixUnusedLabel.ts b/src/services/codefixes/fixUnusedLabel.ts index 2d6fbba8b2016..88e6aed5d41a6 100644 --- a/src/services/codefixes/fixUnusedLabel.ts +++ b/src/services/codefixes/fixUnusedLabel.ts @@ -1,8 +1,20 @@ import { - cast, Diagnostics, findChildOfKind, getTokenAtPosition, isLabeledStatement, positionsAreOnSameLine, skipTrivia, - SourceFile, SyntaxKind, textChanges, + cast, + Diagnostics, + findChildOfKind, + getTokenAtPosition, + isLabeledStatement, + positionsAreOnSameLine, + skipTrivia, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixUnusedLabel"; const errorCodes = [Diagnostics.Unused_label.code]; diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index e6d09c1ad862a..96bee0d7f458b 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -1,14 +1,59 @@ import { - AccessorDeclaration, canHaveDecorators, cast, ClassLikeDeclaration, concatenate, ConstructorDeclaration, - DeclarationName, Diagnostics, factory, FileTextChanges, find, findAncestor, getClassExtendsHeritageElement, - getDecorators, getEffectiveModifierFlags, getFirstConstructorWithBody, getLocaleSpecificMessage, getTokenAtPosition, - getTypeAnnotationNode, getUniqueName, hasEffectiveReadonlyModifier, hasStaticModifier, Identifier, - InterfaceDeclaration, isClassLike, isElementAccessExpression, isFunctionLike, isIdentifier, - isParameterPropertyDeclaration, isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, - isSourceFileJS, isStringLiteral, isUnionTypeNode, isWriteAccess, ModifierFlags, ModifierLike, Node, - nodeOverlapsWithStartEnd, ObjectLiteralExpression, ParameterPropertyDeclaration, Program, PropertyAssignment, - PropertyDeclaration, refactor, SourceFile, startsWithUnderscore, StringLiteral, suppressLeadingAndTrailingTrivia, - SymbolFlags, SyntaxKind, textChanges, TypeChecker, TypeNode, + AccessorDeclaration, + canHaveDecorators, + cast, + ClassLikeDeclaration, + concatenate, + ConstructorDeclaration, + DeclarationName, + Diagnostics, + factory, + FileTextChanges, + find, + findAncestor, + getClassExtendsHeritageElement, + getDecorators, + getEffectiveModifierFlags, + getFirstConstructorWithBody, + getLocaleSpecificMessage, + getTokenAtPosition, + getTypeAnnotationNode, + getUniqueName, + hasEffectiveReadonlyModifier, + hasStaticModifier, + Identifier, + InterfaceDeclaration, + isClassLike, + isElementAccessExpression, + isFunctionLike, + isIdentifier, + isParameterPropertyDeclaration, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isSourceFileJS, + 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 d6f66de1d2bad..1bc5bbb658c27 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -1,20 +1,103 @@ import { - AccessorDeclaration, append, arrayFrom, ArrowFunction, Block, CallExpression, CharacterCodes, ClassLikeDeclaration, - CodeFixContextBase, Debug, Diagnostics, emptyArray, EntityName, Expression, factory, find, flatMap, - FunctionDeclaration, FunctionExpression, GetAccessorDeclaration, getAllAccessorDeclarations, - getEffectiveModifierFlags, getEmitScriptTarget, getFirstIdentifier, getModuleSpecifierResolverHost, - getNameForExportedSymbol, getNameOfDeclaration, getQuotePreference, getSetAccessorValueParameter, - getSynthesizedDeepClone, getTokenAtPosition, getTsConfigObjectLiteralExpression, Identifier, idText, - IntersectionType, isArrowFunction, isAutoAccessorPropertyDeclaration, isFunctionDeclaration, isFunctionExpression, - isGetAccessorDeclaration, isIdentifier, isImportTypeNode, isInJSFile, isLiteralImportTypeNode, isMethodDeclaration, - isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, 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, + AccessorDeclaration, + append, + arrayFrom, + ArrowFunction, + Block, + CallExpression, + CharacterCodes, + ClassLikeDeclaration, + CodeFixContextBase, + Debug, + Diagnostics, + emptyArray, + EntityName, + Expression, + factory, + find, + flatMap, + FunctionDeclaration, + FunctionExpression, + GetAccessorDeclaration, + getAllAccessorDeclarations, + getEffectiveModifierFlags, + getEmitScriptTarget, + getFirstIdentifier, + getModuleSpecifierResolverHost, + getNameForExportedSymbol, + getNameOfDeclaration, + getQuotePreference, + getSetAccessorValueParameter, + getSynthesizedDeepClone, + getTokenAtPosition, + getTsConfigObjectLiteralExpression, + Identifier, + idText, + IntersectionType, + isArrowFunction, + isAutoAccessorPropertyDeclaration, + isFunctionDeclaration, + isFunctionExpression, + isGetAccessorDeclaration, + isIdentifier, + isImportTypeNode, + isInJSFile, + isLiteralImportTypeNode, + isMethodDeclaration, + isObjectLiteralExpression, + isPropertyAccessExpression, + isPropertyAssignment, + 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"; import { ImportAdder } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 7dc2007c18148..2f0c90737549a 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -1,30 +1,146 @@ import { - AnyImportOrRequire, AnyImportOrRequireStatement, AnyImportSyntax, arrayFrom, CancellationToken, cast, CodeAction, - CodeFixAction, CodeFixContextBase, combine, compareBooleans, compareNumberOfDirectorySeparators, compareValues, - Comparison, CompilerOptions, createModuleSpecifierResolutionHost, createMultiMap, createPackageJsonImportFilter, - Debug, DiagnosticAndArguments, Diagnostics, DiagnosticWithLocation, emptyArray, escapeLeadingUnderscores, - every, ExportKind, factory, first, firstDefined, flatMap, flatMapIterator, forEachExternalModuleToImportFrom, - formatting, getAllowSyntheticDefaultImports, getBaseFileName, getDefaultLikeExportInfo, getDirectoryPath, - getEmitModuleKind, getEmitModuleResolutionKind, getEmitScriptTarget, getExportInfoMap, getMeaningFromDeclaration, - getMeaningFromLocation, getNameForExportedSymbol, getNodeId, getQuoteFromPreference, getQuotePreference, - getSourceFileOfNode, getSymbolId, getTokenAtPosition, getTypeKeywordOfTypeOnlyImport, getUniqueSymbolId, - hostGetCanonicalFileName, Identifier, ImportClause, ImportEqualsDeclaration, importFromModuleSpecifier, ImportKind, - ImportsNotUsedAsValues, insertImports, InternalSymbolName, isExternalModule, isExternalModuleReference, - isIdentifier, isIdentifierPart, isIdentifierStart, isImportableFile, isImportEqualsDeclaration, isInJSFile, - isIntrinsicJsxName, isJsxClosingElement, isJsxOpeningFragment, isJsxOpeningLikeElement, isJSXTagName, - isNamedImports, isNamespaceImport, isSourceFileJS, isStringANonContextualKeyword, isStringLiteral, - isStringLiteralLike, isTypeOnlyImportOrExportDeclaration, isUMDExportSymbol, isValidTypeOnlyAliasUseSite, - isVariableDeclarationInitializedToRequire, jsxModeNeedsExplicitImport, LanguageServiceHost, last, makeImport, - makeStringLiteral, mapDefined, memoizeOne, ModuleKind, ModuleResolutionKind, moduleResolutionUsesNodeModules, - moduleSpecifiers, MultiMap, Mutable, NamedImports, Node, NodeFlags, nodeIsMissing, ObjectBindingPattern, - OrganizeImports, PackageJsonImportFilter, Path, pathContainsNodeModules, pathIsBareSpecifier, Program, - QuotePreference, removeFileExtension, removeSuffix, RequireVariableStatement, ScriptTarget, - SemanticMeaning, shouldUseUriStyleNodeCoreModules, single, skipAlias, some, sort, SourceFile, stableSort, - startsWith, StringLiteral, stripQuotes, Symbol, SymbolExportInfo, SymbolFlags, SymbolId, SyntaxKind, textChanges, - toPath, tryCast, tryGetModuleSpecifierFromDeclaration, TypeChecker, TypeOnlyAliasDeclaration, UserPreferences, + AnyImportOrRequire, + AnyImportOrRequireStatement, + AnyImportSyntax, + arrayFrom, + CancellationToken, + cast, + CodeAction, + CodeFixAction, + CodeFixContextBase, + combine, + compareBooleans, + compareNumberOfDirectorySeparators, + compareValues, + Comparison, + CompilerOptions, + createModuleSpecifierResolutionHost, + createMultiMap, + createPackageJsonImportFilter, + Debug, + DiagnosticAndArguments, + Diagnostics, + DiagnosticWithLocation, + emptyArray, + escapeLeadingUnderscores, + every, + ExportKind, + factory, + first, + firstDefined, + flatMap, + flatMapIterator, + forEachExternalModuleToImportFrom, + formatting, + getAllowSyntheticDefaultImports, + getBaseFileName, + getDefaultLikeExportInfo, + getDirectoryPath, + getEmitModuleKind, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getExportInfoMap, + getMeaningFromDeclaration, + getMeaningFromLocation, + getNameForExportedSymbol, + getNodeId, + getQuoteFromPreference, + getQuotePreference, + getSourceFileOfNode, + getSymbolId, + getTokenAtPosition, + getTypeKeywordOfTypeOnlyImport, + getUniqueSymbolId, + hostGetCanonicalFileName, + Identifier, + ImportClause, + ImportEqualsDeclaration, + importFromModuleSpecifier, + ImportKind, + ImportsNotUsedAsValues, + insertImports, + InternalSymbolName, + isExternalModule, + isExternalModuleReference, + isIdentifier, + isIdentifierPart, + isIdentifierStart, + isImportableFile, + isImportEqualsDeclaration, + isInJSFile, + isIntrinsicJsxName, + isJsxClosingElement, + isJsxOpeningFragment, + isJsxOpeningLikeElement, + isJSXTagName, + isNamedImports, + isNamespaceImport, + isSourceFileJS, + isStringANonContextualKeyword, + isStringLiteral, + isStringLiteralLike, + isTypeOnlyImportOrExportDeclaration, + isUMDExportSymbol, + isValidTypeOnlyAliasUseSite, + isVariableDeclarationInitializedToRequire, + jsxModeNeedsExplicitImport, + LanguageServiceHost, + last, + makeImport, + makeStringLiteral, + mapDefined, + memoizeOne, + ModuleKind, + ModuleResolutionKind, + moduleResolutionUsesNodeModules, + moduleSpecifiers, + MultiMap, + Mutable, + NamedImports, + Node, + NodeFlags, + nodeIsMissing, + ObjectBindingPattern, + OrganizeImports, + PackageJsonImportFilter, + Path, + pathContainsNodeModules, + pathIsBareSpecifier, + Program, + QuotePreference, + removeFileExtension, + removeSuffix, + RequireVariableStatement, + ScriptTarget, + SemanticMeaning, + shouldUseUriStyleNodeCoreModules, + single, + skipAlias, + some, + sort, + SourceFile, + stableSort, + startsWith, + StringLiteral, + stripQuotes, + Symbol, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + textChanges, + toPath, + tryCast, + tryGetModuleSpecifierFromDeclaration, + TypeChecker, + TypeOnlyAliasDeclaration, + UserPreferences, } from "../_namespaces/ts"; import { - createCodeFixAction, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixAction, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; /** @internal */ diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index dc380a9d901eb..7be223f9a8332 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -1,23 +1,115 @@ import { - __String, AnonymousType, BinaryExpression, CallExpression, CancellationToken, CaseOrDefaultClause, cast, - createMultiMap, createSymbolTable, Debug, Declaration, DiagnosticMessage, Diagnostics, ElementAccessExpression, - EmitFlags, emptyArray, escapeLeadingUnderscores, Expression, factory, FindAllReferences, findChildOfKind, first, - firstOrUndefined, flatMap, forEach, forEachEntry, getContainingFunction, getEmitScriptTarget, getJSDocType, - getNameOfDeclaration, getObjectFlags, getSourceFileOfNode, getTextOfNode, getTokenAtPosition, - getTypeNodeIfAccessible, Identifier, IndexKind, isArrowFunction, isAssignmentExpression, isCallExpression, - isExpressionNode, isExpressionStatement, isFunctionExpression, isGetAccessorDeclaration, isIdentifier, isInJSFile, - isParameter, isParameterPropertyModifier, isPropertyAccessExpression, isPropertyDeclaration, isPropertySignature, - isRestParameter, isRightSideOfQualifiedNameOrPropertyAccess, isSetAccessorDeclaration, isVariableDeclaration, - isVariableStatement, LanguageServiceHost, last, length, map, mapDefined, mapEntries, NewExpression, Node, - nodeSeenTracker, NodeSeenTracker, ObjectFlags, ParameterDeclaration, PrefixUnaryExpression, PrivateIdentifier, - Program, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, PropertySignature, - returnTrue, ScriptTarget, SetAccessorDeclaration, setEmitFlags, ShorthandPropertyAssignment, Signature, - SignatureDeclaration, SignatureFlags, SignatureKind, singleOrUndefined, SourceFile, Symbol, SymbolFlags, - SymbolLinks, SyntaxKind, textChanges, Token, TransientSymbol, tryCast, Type, TypeFlags, TypeNode, TypeReference, - UnderscoreEscapedMap, UnionOrIntersectionType, UnionReduction, UserPreferences, VariableDeclaration, + __String, + AnonymousType, + BinaryExpression, + CallExpression, + CancellationToken, + CaseOrDefaultClause, + cast, + createMultiMap, + createSymbolTable, + Debug, + Declaration, + DiagnosticMessage, + Diagnostics, + ElementAccessExpression, + EmitFlags, + emptyArray, + escapeLeadingUnderscores, + Expression, + factory, + FindAllReferences, + findChildOfKind, + first, + firstOrUndefined, + flatMap, + forEach, + forEachEntry, + getContainingFunction, + getEmitScriptTarget, + getJSDocType, + getNameOfDeclaration, + getObjectFlags, + getSourceFileOfNode, + getTextOfNode, + getTokenAtPosition, + getTypeNodeIfAccessible, + Identifier, + IndexKind, + isArrowFunction, + isAssignmentExpression, + isCallExpression, + isExpressionNode, + isExpressionStatement, + isFunctionExpression, + isGetAccessorDeclaration, + isIdentifier, + isInJSFile, + isParameter, + isParameterPropertyModifier, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertySignature, + isRestParameter, + isRightSideOfQualifiedNameOrPropertyAccess, + isSetAccessorDeclaration, + isVariableDeclaration, + isVariableStatement, + LanguageServiceHost, + last, + length, + map, + mapDefined, + mapEntries, + NewExpression, + Node, + nodeSeenTracker, + NodeSeenTracker, + ObjectFlags, + ParameterDeclaration, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + returnTrue, + ScriptTarget, + SetAccessorDeclaration, + setEmitFlags, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + singleOrUndefined, + SourceFile, + Symbol, + SymbolFlags, + SymbolLinks, + SyntaxKind, + textChanges, + Token, + TransientSymbol, + tryCast, + Type, + TypeFlags, + TypeNode, + TypeReference, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionReduction, + UserPreferences, + VariableDeclaration, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createImportAdder, ImportAdder, registerCodeFix, + codeFixAll, + createCodeFixAction, + createImportAdder, + ImportAdder, + registerCodeFix, tryGetAutoImportableReferenceFromTypeNode, } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/removeAccidentalCallParentheses.ts b/src/services/codefixes/removeAccidentalCallParentheses.ts index b12146f562864..c4ad5c9ea3721 100644 --- a/src/services/codefixes/removeAccidentalCallParentheses.ts +++ b/src/services/codefixes/removeAccidentalCallParentheses.ts @@ -1,5 +1,14 @@ -import { Diagnostics, findAncestor, getTokenAtPosition, isCallExpression, textChanges } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + Diagnostics, + findAncestor, + getTokenAtPosition, + isCallExpression, + textChanges, +} from "../_namespaces/ts"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "removeAccidentalCallParentheses"; const errorCodes = [ diff --git a/src/services/codefixes/removeUnnecessaryAwait.ts b/src/services/codefixes/removeUnnecessaryAwait.ts index 6508b0fc8895b..521c8e9dc08b2 100644 --- a/src/services/codefixes/removeUnnecessaryAwait.ts +++ b/src/services/codefixes/removeUnnecessaryAwait.ts @@ -1,8 +1,24 @@ import { - AwaitKeywordToken, Diagnostics, findPrecedingToken, getLeftmostExpression, getTokenAtPosition, isAwaitExpression, - isIdentifier, isParenthesizedExpression, Node, SourceFile, SyntaxKind, textChanges, TextSpan, tryCast, + AwaitKeywordToken, + Diagnostics, + findPrecedingToken, + getLeftmostExpression, + getTokenAtPosition, + isAwaitExpression, + isIdentifier, + isParenthesizedExpression, + Node, + SourceFile, + SyntaxKind, + textChanges, + TextSpan, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "removeUnnecessaryAwait"; const errorCodes = [ diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts index 8bd23cb737357..0667683d1ffd0 100644 --- a/src/services/codefixes/requireInTs.ts +++ b/src/services/codefixes/requireInTs.ts @@ -1,9 +1,32 @@ import { - cast, Debug, Diagnostics, factory, first, getAllowSyntheticDefaultImports, getTokenAtPosition, Identifier, - ImportSpecifier, isIdentifier, isObjectBindingPattern, isRequireCall, isVariableDeclaration, isVariableStatement, - NamedImports, ObjectBindingPattern, Program, SourceFile, StringLiteralLike, textChanges, tryCast, VariableStatement, + cast, + Debug, + Diagnostics, + factory, + first, + getAllowSyntheticDefaultImports, + getTokenAtPosition, + Identifier, + ImportSpecifier, + isIdentifier, + isObjectBindingPattern, + isRequireCall, + isVariableDeclaration, + isVariableStatement, + NamedImports, + ObjectBindingPattern, + Program, + SourceFile, + StringLiteralLike, + textChanges, + tryCast, + VariableStatement, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "requireInTs"; const errorCodes = [Diagnostics.require_call_may_be_converted_to_an_import.code]; diff --git a/src/services/codefixes/returnValueCorrect.ts b/src/services/codefixes/returnValueCorrect.ts index f27cdb2470cb7..b6930f0b7efba 100644 --- a/src/services/codefixes/returnValueCorrect.ts +++ b/src/services/codefixes/returnValueCorrect.ts @@ -1,12 +1,50 @@ import { - append, ArrowFunction, CodeFixContext, copyComments, createSymbolTable, Debug, Diagnostics, Expression, factory, - findAncestor, first, FunctionLikeDeclaration, getTokenAtPosition, hasSyntacticModifier, Identifier, isArrowFunction, - isBlock, isCallExpression, isDeclarationName, isExpressionStatement, isFunctionLikeDeclaration, isJsxAttribute, - isJsxExpression, isLabeledStatement, isVariableLike, length, ModifierFlags, needsParentheses, Node, - probablyUsesSemicolons, rangeContainsRange, SourceFile, Statement, suppressLeadingAndTrailingTrivia, SymbolFlags, - SyntaxKind, textChanges, Type, TypeChecker, VariableLikeDeclaration, + append, + ArrowFunction, + CodeFixContext, + copyComments, + createSymbolTable, + Debug, + Diagnostics, + Expression, + factory, + findAncestor, + first, + FunctionLikeDeclaration, + getTokenAtPosition, + hasSyntacticModifier, + Identifier, + isArrowFunction, + isBlock, + isCallExpression, + isDeclarationName, + isExpressionStatement, + isFunctionLikeDeclaration, + isJsxAttribute, + isJsxExpression, + isLabeledStatement, + isVariableLike, + length, + ModifierFlags, + needsParentheses, + Node, + probablyUsesSemicolons, + rangeContainsRange, + SourceFile, + Statement, + suppressLeadingAndTrailingTrivia, + SymbolFlags, + SyntaxKind, + textChanges, + Type, + TypeChecker, + VariableLikeDeclaration, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "returnValueCorrect"; const fixIdAddReturnStatement = "fixAddReturnStatement"; diff --git a/src/services/codefixes/splitTypeOnlyImport.ts b/src/services/codefixes/splitTypeOnlyImport.ts index 1a15a46b61ea7..6af08a70ebff6 100644 --- a/src/services/codefixes/splitTypeOnlyImport.ts +++ b/src/services/codefixes/splitTypeOnlyImport.ts @@ -1,8 +1,21 @@ import { - CodeFixContextBase, Debug, Diagnostics, factory, findAncestor, getTokenAtPosition, ImportDeclaration, - isImportDeclaration, SourceFile, textChanges, TextSpan, + CodeFixContextBase, + Debug, + Diagnostics, + factory, + findAncestor, + getTokenAtPosition, + ImportDeclaration, + isImportDeclaration, + SourceFile, + textChanges, + TextSpan, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const errorCodes = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code]; const fixId = "splitTypeOnlyImport"; diff --git a/src/services/codefixes/useBigintLiteral.ts b/src/services/codefixes/useBigintLiteral.ts index 4dd32727965e0..4492e176b5c57 100644 --- a/src/services/codefixes/useBigintLiteral.ts +++ b/src/services/codefixes/useBigintLiteral.ts @@ -1,7 +1,18 @@ import { - Diagnostics, factory, getTokenAtPosition, isNumericLiteral, SourceFile, textChanges, TextSpan, tryCast, + Diagnostics, + factory, + getTokenAtPosition, + isNumericLiteral, + SourceFile, + textChanges, + TextSpan, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "useBigintLiteral"; const errorCodes = [ diff --git a/src/services/codefixes/useDefaultImport.ts b/src/services/codefixes/useDefaultImport.ts index 2ea1b66abe515..75f72964530b6 100644 --- a/src/services/codefixes/useDefaultImport.ts +++ b/src/services/codefixes/useDefaultImport.ts @@ -1,9 +1,24 @@ import { - AnyImportSyntax, Diagnostics, Expression, getQuotePreference, getTokenAtPosition, Identifier, - isExternalModuleReference, isIdentifier, isImportEqualsDeclaration, isNamespaceImport, makeImport, SourceFile, - textChanges, UserPreferences, + AnyImportSyntax, + Diagnostics, + Expression, + getQuotePreference, + getTokenAtPosition, + Identifier, + isExternalModuleReference, + isIdentifier, + isImportEqualsDeclaration, + isNamespaceImport, + makeImport, + SourceFile, + textChanges, + UserPreferences, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "useDefaultImport"; const errorCodes = [Diagnostics.Import_may_be_converted_to_a_default_import.code]; diff --git a/src/services/codefixes/wrapJsxInFragment.ts b/src/services/codefixes/wrapJsxInFragment.ts index 68c8760a18f28..78122a0840c62 100644 --- a/src/services/codefixes/wrapJsxInFragment.ts +++ b/src/services/codefixes/wrapJsxInFragment.ts @@ -1,8 +1,22 @@ import { - BinaryExpression, Diagnostics, factory, getTokenAtPosition, isBinaryExpression, isJsxChild, JsxChild, Node, - nodeIsMissing, SourceFile, SyntaxKind, textChanges, + BinaryExpression, + Diagnostics, + factory, + getTokenAtPosition, + isBinaryExpression, + isJsxChild, + JsxChild, + Node, + nodeIsMissing, + SourceFile, + SyntaxKind, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixID = "wrapJsxInFragment"; const errorCodes = [Diagnostics.JSX_expressions_must_have_one_parent_element.code]; diff --git a/src/services/completions.ts b/src/services/completions.ts index 80c5e022a614e..11afb4c8c0ab9 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,64 +1,336 @@ import { - __String, addToSeen, append, BinaryExpression, BreakOrContinueStatement, CancellationToken, cast, CharacterCodes, - ClassElement, CodeAction, codefix, compareNumberOfDirectorySeparators, compareStringsCaseSensitiveUI, - compareTextSpans, Comparison, CompilerOptions, compilerOptionsIndicateEsModules, CompletionEntry, - CompletionEntryData, CompletionEntryDataAutoImport, CompletionEntryDataResolved, CompletionEntryDataUnresolved, - CompletionEntryDetails, CompletionEntryLabelDetails, CompletionInfo, CompletionInfoFlags, - CompletionsTriggerCharacter, CompletionTriggerKind, concatenate, ConstructorDeclaration, ContextFlags, - createModuleSpecifierResolutionHost, createPackageJsonImportFilter, createPrinter, createSortedArray, - createTextRangeFromSpan, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, Debug, - Declaration, Diagnostics, diagnosticToString, displayPart, EmitHint, EmitTextWriter, escapeSnippetText, every, - ExportKind, Expression, factory, filter, find, findAncestor, findChildOfKind, findPrecedingToken, first, - firstDefined, flatMap, formatting, FunctionLikeDeclaration, getAllSuperTypeNodes, getAncestor, - getCombinedLocalAndExportSymbolFlags, getContainingClass, getContextualTypeFromParent, - getDeclarationModifierFlagsFromSymbol, getEffectiveBaseTypeNode, getEffectiveModifierFlags, - getEffectiveTypeAnnotationNode, getEmitModuleResolutionKind, getEmitScriptTarget, - getEscapedTextOfIdentifierOrLiteral, getExportInfoMap, getFormatCodeSettingsForWriting, getLanguageVariant, - getLeftmostAccessExpression, getLineAndCharacterOfPosition, getLineStartPositionForPosition, - getLocalSymbolForExportDefault, getNameForExportedSymbol, getNameOfDeclaration, getNameTable, getNewLineCharacter, - getNewLineKind, getPropertyNameForPropertyNameNode, getQuotePreference, getReplacementSpanForContextToken, - getRootDeclaration, getSourceFileOfModule, getSwitchedType, getSymbolId, getSynthesizedDeepClone, - getTokenAtPosition, getTouchingPropertyName, hasDocComment, hasEffectiveModifier, hasInitializer, hasType, - Identifier, ImportDeclaration, ImportEqualsDeclaration, ImportKind, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeNode, IncompleteCompletionsCache, insertSorted, InternalSymbolName, isAbstractConstructorSymbol, - isArrowFunction, isAssertionExpression, isBigIntLiteral, isBinaryExpression, isBindingElement, isBindingPattern, - isBreakOrContinueStatement, isCallExpression, isCaseClause, isCheckJsEnabledForFile, isClassElement, isClassLike, - isClassMemberModifier, isClassOrTypeElement, isClassStaticBlockDeclaration, isComputedPropertyName, - isConstructorDeclaration, isContextualKeyword, isDeclarationName, isDeprecatedDeclaration, isEntityName, - isEqualityOperatorKind, isExportAssignment, isExportDeclaration, isExpression, isExternalModuleNameRelative, - isExternalModuleReference, isExternalModuleSymbol, isFunctionBlock, isFunctionLike, isFunctionLikeDeclaration, - isFunctionLikeKind, isFunctionTypeNode, isIdentifier, isIdentifierText, isImportableFile, isImportDeclaration, - isImportEqualsDeclaration, isImportKeyword, isImportSpecifier, isInComment, isInitializedProperty, isInJSFile, - isInRightSideOfInternalImportEqualsDeclaration, isInString, isIntersectionTypeNode, isJSDoc, isJSDocParameterTag, - isJSDocTag, isJSDocTemplateTag, isJsxAttribute, isJsxClosingElement, isJsxElement, isJsxExpression, isJsxFragment, - isJsxOpeningLikeElement, isJsxSpreadAttribute, isKeyword, isKnownSymbol, isLabeledStatement, - isLiteralImportTypeNode, isMemberName, isMethodDeclaration, isModifier, isModifierKind, isModuleDeclaration, - isNamedExports, isNamedImports, isNamedImportsOrExports, isNamespaceImport, isObjectBindingPattern, - isObjectLiteralExpression, isObjectTypeDeclaration, isParameter, isParameterPropertyModifier, isPartOfTypeNode, - isPossiblyTypeArgumentPosition, isPrivateIdentifier, isPrivateIdentifierClassElementDeclaration, - isPropertyAccessExpression, isPropertyDeclaration, isPropertyNameLiteral, isRegularExpressionLiteral, - isShorthandPropertyAssignment, isSingleOrDoubleQuote, isSourceFile, isSourceFileJS, isSpreadAssignment, isStatement, - isStatic, isString, isStringANonContextualKeyword, isStringLiteralLike, isStringLiteralOrTemplate, - isStringTextContainingNode, isSyntaxList, isTypeKeyword, isTypeKeywordTokenOrIdentifier, isTypeLiteralNode, - isTypeNode, isTypeOfExpression, isTypeOnlyImportOrExportDeclaration, isTypeReferenceType, - isValidTypeOnlyAliasUseSite, isVariableDeclaration, isVariableLike, JsDoc, JSDocParameterTag, JSDocPropertyTag, - JSDocReturnTag, JSDocTag, JSDocTagInfo, JSDocTemplateTag, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeTag, - JsTyping, JsxAttribute, JsxAttributes, JsxClosingElement, JsxElement, JsxOpeningLikeElement, JsxSpreadAttribute, - LanguageServiceHost, LanguageVariant, last, lastOrUndefined, length, ListFormat, mapDefined, maybeBind, - MemberOverrideStatus, memoize, memoizeOne, MethodDeclaration, ModifierFlags, modifiersToFlags, ModifierSyntaxKind, - modifierToFlag, ModuleDeclaration, ModuleReference, moduleResolutionRespectsExports, NamedImportBindings, Node, - NodeArray, NodeBuilderFlags, NodeFlags, nodeIsMissing, ObjectBindingPattern, ObjectLiteralExpression, ObjectType, - ObjectTypeDeclaration, or, positionBelongsToNode, positionIsASICandidate, positionsAreOnSameLine, PrinterOptions, - probablyUsesSemicolons, Program, programContainsModules, PropertyAccessExpression, PropertyDeclaration, - PropertyName, PseudoBigInt, pseudoBigIntToString, QualifiedName, quote, QuotePreference, rangeContainsPosition, - rangeContainsPositionExclusive, rangeIsOnSingleLine, ScriptElementKind, ScriptElementKindModifier, ScriptTarget, - SemanticMeaning, setSnippetElement, shouldUseUriStyleNodeCoreModules, SignatureHelp, SignatureKind, - singleElementArray, skipAlias, SnippetKind, some, SortedArray, SourceFile, SpreadAssignment, stableSort, startsWith, - stringToToken, stripQuotes, Symbol, SymbolDisplay, SymbolDisplayPart, SymbolDisplayPartKind, SymbolExportInfo, - SymbolFlags, SymbolId, SyntaxKind, TextChange, textChanges, textPart, TextRange, TextSpan, timestamp, Token, - TokenSyntaxKind, tokenToString, tryCast, tryGetImportFromModuleSpecifier, Type, TypeChecker, TypeElement, TypeFlags, - typeHasCallOrConstructSignatures, TypeLiteralNode, TypeOnlyAliasDeclaration, unescapeLeadingUnderscores, - UnionReduction, UnionType, UserPreferences, VariableDeclaration, walkUpParenthesizedExpressions, + __String, + addToSeen, + append, + BinaryExpression, + BreakOrContinueStatement, + CancellationToken, + cast, + CharacterCodes, + ClassElement, + CodeAction, + codefix, + compareNumberOfDirectorySeparators, + compareStringsCaseSensitiveUI, + compareTextSpans, + Comparison, + CompilerOptions, + compilerOptionsIndicateEsModules, + CompletionEntry, + CompletionEntryData, + CompletionEntryDataAutoImport, + CompletionEntryDataResolved, + CompletionEntryDataUnresolved, + CompletionEntryDetails, + CompletionEntryLabelDetails, + CompletionInfo, + CompletionInfoFlags, + CompletionsTriggerCharacter, + CompletionTriggerKind, + concatenate, + ConstructorDeclaration, + ContextFlags, + createModuleSpecifierResolutionHost, + createPackageJsonImportFilter, + createPrinter, + createSortedArray, + createTextRangeFromSpan, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + Debug, + Declaration, + Diagnostics, + diagnosticToString, + displayPart, + EmitHint, + EmitTextWriter, + escapeSnippetText, + every, + ExportKind, + Expression, + factory, + filter, + find, + findAncestor, + findChildOfKind, + findPrecedingToken, + first, + firstDefined, + flatMap, + formatting, + FunctionLikeDeclaration, + getAllSuperTypeNodes, + getAncestor, + getCombinedLocalAndExportSymbolFlags, + getContainingClass, + getContextualTypeFromParent, + getDeclarationModifierFlagsFromSymbol, + getEffectiveBaseTypeNode, + getEffectiveModifierFlags, + getEffectiveTypeAnnotationNode, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getEscapedTextOfIdentifierOrLiteral, + getExportInfoMap, + getFormatCodeSettingsForWriting, + getLanguageVariant, + getLeftmostAccessExpression, + getLineAndCharacterOfPosition, + getLineStartPositionForPosition, + getLocalSymbolForExportDefault, + getNameForExportedSymbol, + getNameOfDeclaration, + getNameTable, + getNewLineCharacter, + getNewLineKind, + getPropertyNameForPropertyNameNode, + getQuotePreference, + getReplacementSpanForContextToken, + getRootDeclaration, + getSourceFileOfModule, + getSwitchedType, + getSymbolId, + getSynthesizedDeepClone, + getTokenAtPosition, + getTouchingPropertyName, + hasDocComment, + hasEffectiveModifier, + hasInitializer, + hasType, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportKind, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IncompleteCompletionsCache, + insertSorted, + InternalSymbolName, + isAbstractConstructorSymbol, + isArrowFunction, + isAssertionExpression, + isBigIntLiteral, + isBinaryExpression, + isBindingElement, + isBindingPattern, + isBreakOrContinueStatement, + isCallExpression, + isCaseClause, + isCheckJsEnabledForFile, + isClassElement, + isClassLike, + isClassMemberModifier, + isClassOrTypeElement, + isClassStaticBlockDeclaration, + isComputedPropertyName, + isConstructorDeclaration, + isContextualKeyword, + isDeclarationName, + isDeprecatedDeclaration, + isEntityName, + isEqualityOperatorKind, + isExportAssignment, + isExportDeclaration, + isExpression, + isExternalModuleNameRelative, + isExternalModuleReference, + isExternalModuleSymbol, + isFunctionBlock, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeKind, + isFunctionTypeNode, + isIdentifier, + isIdentifierText, + isImportableFile, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isImportSpecifier, + isInComment, + isInitializedProperty, + isInJSFile, + isInRightSideOfInternalImportEqualsDeclaration, + isInString, + isIntersectionTypeNode, + isJSDoc, + isJSDocParameterTag, + isJSDocTag, + isJSDocTemplateTag, + isJsxAttribute, + isJsxClosingElement, + isJsxElement, + isJsxExpression, + isJsxFragment, + isJsxOpeningLikeElement, + isJsxSpreadAttribute, + isKeyword, + isKnownSymbol, + isLabeledStatement, + isLiteralImportTypeNode, + isMemberName, + isMethodDeclaration, + isModifier, + isModifierKind, + isModuleDeclaration, + isNamedExports, + isNamedImports, + isNamedImportsOrExports, + isNamespaceImport, + isObjectBindingPattern, + isObjectLiteralExpression, + isObjectTypeDeclaration, + isParameter, + isParameterPropertyModifier, + isPartOfTypeNode, + isPossiblyTypeArgumentPosition, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertyNameLiteral, + isRegularExpressionLiteral, + isShorthandPropertyAssignment, + isSingleOrDoubleQuote, + isSourceFile, + isSourceFileJS, + isSpreadAssignment, + isStatement, + isStatic, + isString, + isStringANonContextualKeyword, + isStringLiteralLike, + isStringLiteralOrTemplate, + isStringTextContainingNode, + isSyntaxList, + isTypeKeyword, + isTypeKeywordTokenOrIdentifier, + isTypeLiteralNode, + isTypeNode, + isTypeOfExpression, + isTypeOnlyImportOrExportDeclaration, + isTypeReferenceType, + isValidTypeOnlyAliasUseSite, + isVariableDeclaration, + isVariableLike, + JsDoc, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypedefTag, + JSDocTypeExpression, + JSDocTypeTag, + JsTyping, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxElement, + JsxOpeningLikeElement, + JsxSpreadAttribute, + LanguageServiceHost, + LanguageVariant, + last, + lastOrUndefined, + length, + ListFormat, + mapDefined, + maybeBind, + MemberOverrideStatus, + memoize, + memoizeOne, + MethodDeclaration, + ModifierFlags, + modifiersToFlags, + ModifierSyntaxKind, + modifierToFlag, + ModuleDeclaration, + ModuleReference, + moduleResolutionRespectsExports, + NamedImportBindings, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + nodeIsMissing, + ObjectBindingPattern, + ObjectLiteralExpression, + ObjectType, + ObjectTypeDeclaration, + or, + positionBelongsToNode, + positionIsASICandidate, + positionsAreOnSameLine, + PrinterOptions, + probablyUsesSemicolons, + Program, + programContainsModules, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + PseudoBigInt, + pseudoBigIntToString, + QualifiedName, + quote, + QuotePreference, + rangeContainsPosition, + rangeContainsPositionExclusive, + rangeIsOnSingleLine, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + SemanticMeaning, + setSnippetElement, + shouldUseUriStyleNodeCoreModules, + SignatureHelp, + SignatureKind, + singleElementArray, + skipAlias, + SnippetKind, + some, + SortedArray, + SourceFile, + SpreadAssignment, + stableSort, + startsWith, + stringToToken, + stripQuotes, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + TextChange, + textChanges, + textPart, + TextRange, + TextSpan, + timestamp, + Token, + TokenSyntaxKind, + tokenToString, + tryCast, + tryGetImportFromModuleSpecifier, + Type, + TypeChecker, + TypeElement, + TypeFlags, + typeHasCallOrConstructSignatures, + TypeLiteralNode, + TypeOnlyAliasDeclaration, + unescapeLeadingUnderscores, + UnionReduction, + UnionType, + UserPreferences, + VariableDeclaration, + walkUpParenthesizedExpressions, } from "./_namespaces/ts"; import { StringCompletions } from "./_namespaces/ts.Completions"; diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index ddd211eeaf3fa..c3bb005234dca 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -1,16 +1,84 @@ import { - __String, arrayFrom, arrayToMultiMap, Block, BreakOrContinueStatement, CancellationToken, CaseClause, 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, - isBreakOrContinueStatement, isCaseClause, isClassDeclaration, isClassLike, isConstructorDeclaration, isDeclaration, - isDefaultClause, isFunctionBlock, isFunctionLike, isIfStatement, isInterfaceDeclaration, isIterationStatement, - isJsxClosingElement, isJsxOpeningElement, isLabeledStatement, isModifierKind, isModuleDeclaration, - isReturnStatement, isSwitchStatement, isThrowStatement, isTryStatement, isTypeAliasDeclaration, isTypeNode, - isVariableStatement, isWhiteSpaceSingleLine, isYieldExpression, IterationStatement, mapDefined, MethodDeclaration, - Modifier, ModifierFlags, modifierToFlag, ModuleBlock, Node, ObjectLiteralExpression, ObjectTypeDeclaration, Program, - Push, ReturnStatement, SourceFile, SwitchStatement, SyntaxKind, ThrowStatement, toArray, toPath, TryStatement, + __String, + arrayFrom, + arrayToMultiMap, + Block, + BreakOrContinueStatement, + CancellationToken, + CaseClause, + 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, + isBreakOrContinueStatement, + isCaseClause, + isClassDeclaration, + isClassLike, + isConstructorDeclaration, + isDeclaration, + isDefaultClause, + isFunctionBlock, + isFunctionLike, + isIfStatement, + isInterfaceDeclaration, + isIterationStatement, + isJsxClosingElement, + isJsxOpeningElement, + isLabeledStatement, + isModifierKind, + isModuleDeclaration, + isReturnStatement, + isSwitchStatement, + isThrowStatement, + isTryStatement, + isTypeAliasDeclaration, + isTypeNode, + isVariableStatement, + isWhiteSpaceSingleLine, + isYieldExpression, + IterationStatement, + mapDefined, + MethodDeclaration, + Modifier, + ModifierFlags, + modifierToFlag, + ModuleBlock, + Node, + ObjectLiteralExpression, + ObjectTypeDeclaration, + Program, + Push, + ReturnStatement, + SourceFile, + SwitchStatement, + SyntaxKind, + ThrowStatement, + toArray, + toPath, + TryStatement, } from "./_namespaces/ts"; export interface DocumentHighlights { diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index 022f3147a2452..27faadad16b08 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -1,9 +1,34 @@ import { - arrayFrom, CompilerOptions, createGetCanonicalFileName, createLanguageServiceSourceFile, CreateSourceFileOptions, - Debug, ensureScriptKind, firstDefinedIterator, forEachEntry, getCompilerOptionValue, getEmitScriptTarget, - getImpliedNodeFormatForFile, getOrUpdate, getSetExternalModuleIndicator, hasProperty, identity, isArray, - IScriptSnapshot, isDeclarationFileName, map, MinimalResolutionCacheHost, Path, ResolutionMode, ScriptKind, - ScriptTarget, SourceFile, sourceFileAffectingCompilerOptions, toPath, tracing, updateLanguageServiceSourceFile, + arrayFrom, + CompilerOptions, + createGetCanonicalFileName, + createLanguageServiceSourceFile, + CreateSourceFileOptions, + Debug, + ensureScriptKind, + firstDefinedIterator, + forEachEntry, + getCompilerOptionValue, + getEmitScriptTarget, + getImpliedNodeFormatForFile, + getOrUpdate, + getSetExternalModuleIndicator, + hasProperty, + identity, + isArray, + IScriptSnapshot, + isDeclarationFileName, + map, + MinimalResolutionCacheHost, + Path, + ResolutionMode, + ScriptKind, + ScriptTarget, + SourceFile, + sourceFileAffectingCompilerOptions, + toPath, + tracing, + updateLanguageServiceSourceFile, } from "./_namespaces/ts"; /** diff --git a/src/services/exportInfoMap.ts b/src/services/exportInfoMap.ts index 2abd6214159bf..ffd9501b5db25 100644 --- a/src/services/exportInfoMap.ts +++ b/src/services/exportInfoMap.ts @@ -1,15 +1,64 @@ import { - __String, addToSeen, arrayIsEqualTo, CancellationToken, CompilerOptions, consumesNodeCoreModules, createMultiMap, - Debug, emptyArray, findIndex, firstDefined, forEachAncestorDirectory, forEachEntry, getBaseFileName, - GetCanonicalFileName, getDirectoryPath, getLocalSymbolForExportDefault, getNameForExportedSymbol, - getNamesForExportedSymbol, getNodeModulePathParts, getPackageNameFromTypesPackageName, getPatternFromSpec, - getRegexFromPattern, getSymbolId, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, InternalSymbolName, - isExportAssignment, isExportSpecifier, isExternalModuleNameRelative, isExternalModuleSymbol, - isExternalOrCommonJsModule, isIdentifier, 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, + __String, + addToSeen, + arrayIsEqualTo, + CancellationToken, + CompilerOptions, + consumesNodeCoreModules, + createMultiMap, + Debug, + emptyArray, + findIndex, + firstDefined, + forEachAncestorDirectory, + forEachEntry, + getBaseFileName, + GetCanonicalFileName, + getDirectoryPath, + getLocalSymbolForExportDefault, + getNameForExportedSymbol, + getNamesForExportedSymbol, + getNodeModulePathParts, + getPackageNameFromTypesPackageName, + getPatternFromSpec, + getRegexFromPattern, + getSymbolId, + hostGetCanonicalFileName, + hostUsesCaseSensitiveFileNames, + InternalSymbolName, + isExportAssignment, + isExportSpecifier, + isExternalModuleNameRelative, + isExternalModuleSymbol, + isExternalOrCommonJsModule, + isIdentifier, + 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 041c9d16cf709..6e9a5570306be 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,53 +1,252 @@ import { - __String, addToSeen, append, AssignmentDeclarationKind, BinaryExpression, BindingElement, Block, CallExpression, - CancellationToken, cast, CheckFlags, ClassLikeDeclaration, climbPastPropertyAccess, compareValues, - ConstructorDeclaration, contains, createQueue, createTextSpan, createTextSpanFromBounds, createTextSpanFromRange, - Debug, Declaration, displayPart, DocumentSpan, emptyArray, emptyOptions, escapeLeadingUnderscores, - ExportSpecifier, Expression, FileIncludeReason, FileReference, filter, find, findAncestor, findChildOfKind, - findIndex, first, firstDefined, firstOrUndefined, flatMap, forEachChild, forEachReturnStatement, ForInOrOfStatement, - FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, - getAdjustedReferenceLocation, getAdjustedRenameLocation, getAllSuperTypeNodes, getAncestor, - getAssignmentDeclarationKind, getCheckFlags, getContainerNode, getContainingObjectLiteralElement, - getContextualTypeFromParentOrAncestorTypeNode, getDeclarationFromName, getDeclarationOfKind, - getEffectiveModifierFlags, getLocalSymbolForExportDefault, getMeaningFromDeclaration, getMeaningFromLocation, - getModeForUsageLocation, getNameOfDeclaration, getNameTable, getNextJSDocCommentLocation, getNodeId, getNodeKind, - getPropertySymbolFromBindingElement, getPropertySymbolsFromContextualType, getReferencedFileLocation, - getSuperContainer, getSymbolId, getSyntacticModifierFlags, getTargetLabel, getTextOfNode, getThisContainer, - getTouchingPropertyName, GoToDefinition, hasEffectiveModifier, hasInitializer, hasSyntacticModifier, hasType, - HighlightSpan, HighlightSpanKind, Identifier, ImplementationLocation, InterfaceDeclaration, InternalSymbolName, - isAccessExpression, isArrayLiteralOrObjectLiteralDestructuringPattern, isAssertionExpression, isBinaryExpression, - isBindableObjectDefinePropertyCall, isBindingElement, isBreakOrContinueStatement, isCallExpression, - isCallExpressionTarget, isCatchClause, isClassLike, isClassStaticBlockDeclaration, isComputedPropertyName, - isConstructorDeclaration, isDeclaration, isDeclarationName, isExportAssignment, isExportSpecifier, - isExpressionOfExternalModuleImportEqualsDeclaration, isExpressionStatement, isExpressionWithTypeArguments, - isExternalModule, isExternalModuleSymbol, isExternalOrCommonJsModule, isForInOrOfStatement, isFunctionExpression, - isFunctionLike, isFunctionLikeDeclaration, isIdentifier, isIdentifierPart, isImportMeta, isImportOrExportSpecifier, - isImportSpecifier, isImportTypeNode, isInJSFile, isInNonReferenceComment, isInString, isInterfaceDeclaration, - isJSDocMemberName, isJSDocTag, isJsxClosingElement, isJsxOpeningElement, isJsxSelfClosingElement, - isJumpStatementTarget, isLabeledStatement, isLabelOfLabeledStatement, isLiteralComputedPropertyDeclarationName, - isLiteralNameOfPropertyDeclarationOrIndexAccess, isLiteralTypeNode, isMethodOrAccessor, isModuleDeclaration, - isModuleExportsAccessExpression, isModuleOrEnumDeclaration, isModuleSpecifierLike, isNameOfModuleDeclaration, - isNamespaceExportDeclaration, isNewExpressionTarget, isNoSubstitutionTemplateLiteral, - isObjectBindingElementWithoutPropertyName, isObjectLiteralExpression, isObjectLiteralMethod, isParameter, - isParameterPropertyDeclaration, isPrivateIdentifierClassElementDeclaration, isPropertyAccessExpression, - isQualifiedName, isReferencedFile, isReferenceFileLocation, isRightSideOfPropertyAccess, - isShorthandPropertyAssignment, isSourceFile, isStatement, isStatic, isStaticModifier, isStringLiteralLike, - isSuperProperty, isThis, isTypeAliasDeclaration, isTypeElement, isTypeKeyword, isTypeLiteralNode, isTypeNode, - isTypeOperatorNode, isUnionTypeNode, isVariableDeclarationInitializedToBareOrAccessedRequire, - isVariableDeclarationList, isVariableLike, isVariableStatement, isVoidExpression, isWriteAccess, JSDocTag, map, - mapDefined, MethodDeclaration, ModifierFlags, ModuleDeclaration, MultiMap, NamedDeclaration, Node, NodeFlags, - nodeSeenTracker, NumericLiteral, ParameterDeclaration, ParenthesizedExpression, Path, PrivateIdentifier, Program, - PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, punctuationPart, Push, rangeIsOnSingleLine, - ReferencedSymbol, ReferencedSymbolDefinitionInfo, ReferencedSymbolEntry, ReferenceEntry, - RenameLocation, ScriptElementKind, ScriptTarget, SemanticMeaning, SetAccessorDeclaration, SignatureDeclaration, - skipAlias, some, SourceFile, Statement, StringLiteral, StringLiteralLike, stripQuotes, Symbol, SymbolDisplay, - SymbolDisplayPart, SymbolDisplayPartKind, SymbolFlags, SymbolId, symbolName, SyntaxKind, textPart, TextSpan, - tokenToString, tryAddToSet, tryCast, tryGetClassExtendingExpressionWithTypeArguments, - tryGetImportFromModuleSpecifier, TypeChecker, VariableDeclaration, + __String, + addToSeen, + append, + AssignmentDeclarationKind, + BinaryExpression, + BindingElement, + Block, + CallExpression, + CancellationToken, + cast, + CheckFlags, + ClassLikeDeclaration, + climbPastPropertyAccess, + compareValues, + ConstructorDeclaration, + contains, + createQueue, + createTextSpan, + createTextSpanFromBounds, + createTextSpanFromRange, + Debug, + Declaration, + displayPart, + DocumentSpan, + emptyArray, + emptyOptions, + escapeLeadingUnderscores, + ExportSpecifier, + Expression, + FileIncludeReason, + FileReference, + filter, + find, + findAncestor, + findChildOfKind, + findIndex, + first, + firstDefined, + firstOrUndefined, + flatMap, + forEachChild, + forEachReturnStatement, + ForInOrOfStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + getAdjustedReferenceLocation, + getAdjustedRenameLocation, + getAllSuperTypeNodes, + getAncestor, + getAssignmentDeclarationKind, + getCheckFlags, + getContainerNode, + getContainingObjectLiteralElement, + getContextualTypeFromParentOrAncestorTypeNode, + getDeclarationFromName, + getDeclarationOfKind, + getEffectiveModifierFlags, + getLocalSymbolForExportDefault, + getMeaningFromDeclaration, + getMeaningFromLocation, + getModeForUsageLocation, + getNameOfDeclaration, + getNameTable, + getNextJSDocCommentLocation, + getNodeId, + getNodeKind, + getPropertySymbolFromBindingElement, + getPropertySymbolsFromContextualType, + getReferencedFileLocation, + getSuperContainer, + getSymbolId, + getSyntacticModifierFlags, + getTargetLabel, + getTextOfNode, + getThisContainer, + getTouchingPropertyName, + GoToDefinition, + hasEffectiveModifier, + hasInitializer, + hasSyntacticModifier, + hasType, + HighlightSpan, + HighlightSpanKind, + Identifier, + ImplementationLocation, + InterfaceDeclaration, + InternalSymbolName, + isAccessExpression, + isArrayLiteralOrObjectLiteralDestructuringPattern, + isAssertionExpression, + isBinaryExpression, + isBindableObjectDefinePropertyCall, + isBindingElement, + isBreakOrContinueStatement, + isCallExpression, + isCallExpressionTarget, + isCatchClause, + isClassLike, + isClassStaticBlockDeclaration, + isComputedPropertyName, + isConstructorDeclaration, + isDeclaration, + isDeclarationName, + isExportAssignment, + isExportSpecifier, + isExpressionOfExternalModuleImportEqualsDeclaration, + isExpressionStatement, + isExpressionWithTypeArguments, + isExternalModule, + isExternalModuleSymbol, + isExternalOrCommonJsModule, + isForInOrOfStatement, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isIdentifier, + isIdentifierPart, + isImportMeta, + isImportOrExportSpecifier, + isImportSpecifier, + isImportTypeNode, + isInJSFile, + isInNonReferenceComment, + isInString, + isInterfaceDeclaration, + isJSDocMemberName, + isJSDocTag, + isJsxClosingElement, + isJsxOpeningElement, + isJsxSelfClosingElement, + isJumpStatementTarget, + isLabeledStatement, + isLabelOfLabeledStatement, + isLiteralComputedPropertyDeclarationName, + isLiteralNameOfPropertyDeclarationOrIndexAccess, + isLiteralTypeNode, + isMethodOrAccessor, + isModuleDeclaration, + isModuleExportsAccessExpression, + isModuleOrEnumDeclaration, + isModuleSpecifierLike, + isNameOfModuleDeclaration, + isNamespaceExportDeclaration, + isNewExpressionTarget, + isNoSubstitutionTemplateLiteral, + isObjectBindingElementWithoutPropertyName, + isObjectLiteralExpression, + isObjectLiteralMethod, + isParameter, + isParameterPropertyDeclaration, + isPrivateIdentifierClassElementDeclaration, + isPropertyAccessExpression, + isQualifiedName, + isReferencedFile, + isReferenceFileLocation, + isRightSideOfPropertyAccess, + isShorthandPropertyAssignment, + isSourceFile, + isStatement, + isStatic, + isStaticModifier, + isStringLiteralLike, + isSuperProperty, + isThis, + isTypeAliasDeclaration, + isTypeElement, + isTypeKeyword, + isTypeLiteralNode, + isTypeNode, + isTypeOperatorNode, + isUnionTypeNode, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableDeclarationList, + isVariableLike, + isVariableStatement, + isVoidExpression, + isWriteAccess, + JSDocTag, + map, + mapDefined, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, + MultiMap, + NamedDeclaration, + Node, + NodeFlags, + nodeSeenTracker, + NumericLiteral, + ParameterDeclaration, + ParenthesizedExpression, + Path, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + punctuationPart, + Push, + rangeIsOnSingleLine, + ReferencedSymbol, + ReferencedSymbolDefinitionInfo, + ReferencedSymbolEntry, + ReferenceEntry, + RenameLocation, + ScriptElementKind, + ScriptTarget, + SemanticMeaning, + SetAccessorDeclaration, + SignatureDeclaration, + skipAlias, + some, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + stripQuotes, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolId, + symbolName, + SyntaxKind, + textPart, + TextSpan, + tokenToString, + tryAddToSet, + tryCast, + tryGetClassExtendingExpressionWithTypeArguments, + tryGetImportFromModuleSpecifier, + TypeChecker, + VariableDeclaration, } from "./_namespaces/ts"; import { - createImportTracker, ExportInfo, ExportKind, findModuleReferences, getExportInfo, getImportOrExportSymbol, - ImportExport, ImportsResult, ImportTracker, ModuleReference, + createImportTracker, + ExportInfo, + ExportKind, + findModuleReferences, + getExportInfo, + getImportOrExportSymbol, + ImportExport, + ImportsResult, + ImportTracker, + ModuleReference, } from "./_namespaces/ts.FindAllReferences"; /** @internal */ diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 0d53a1474d57a..ae84a63ecfbcc 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -1,19 +1,80 @@ import { - Block, CallExpression, canHaveModifiers, CatchClause, CharacterCodes, ClassDeclaration, CommentRange, concatenate, - createTextChangeFromStartLength, Debug, Declaration, Diagnostic, EditorSettings, find, findAncestor, findIndex, - findPrecedingToken, forEachChild, forEachRight, FormatCodeSettings, FormattingHost, FunctionDeclaration, - getEndLinePosition, getLeadingCommentRangesOfNode, getLineStartPositionForPosition, getNameOfDeclaration, - getNewLineOrDefaultFromHost, getNonDecoratorTokenPosOfNode, getStartPositionOfLine, getTokenAtPosition, - getTrailingCommentRanges, hasDecorators, InterfaceDeclaration, isComment, isDecorator, isJSDoc, isLineBreak, - isModifier, isNodeArray, isStringOrRegularExpressionOrTemplateLiteral, isToken, isWhiteSpaceSingleLine, - LanguageVariant, last, LineAndCharacter, MethodDeclaration, ModuleDeclaration, Node, NodeArray, nodeIsMissing, - nodeIsSynthesized, rangeContainsPositionExclusive, rangeContainsRange, rangeContainsStartEnd, - rangeOverlapsWithStartEnd, repeatString, SourceFile, SourceFileLike, startEndContainsRange, - startEndOverlapsWithStartEnd, SyntaxKind, TextChange, TextRange, TriviaSyntaxKind, TypeReferenceNode, + Block, + CallExpression, + canHaveModifiers, + CatchClause, + CharacterCodes, + ClassDeclaration, + CommentRange, + concatenate, + createTextChangeFromStartLength, + Debug, + Declaration, + Diagnostic, + EditorSettings, + find, + findAncestor, + findIndex, + findPrecedingToken, + forEachChild, + forEachRight, + FormatCodeSettings, + FormattingHost, + FunctionDeclaration, + getEndLinePosition, + getLeadingCommentRangesOfNode, + getLineStartPositionForPosition, + getNameOfDeclaration, + getNewLineOrDefaultFromHost, + getNonDecoratorTokenPosOfNode, + getStartPositionOfLine, + getTokenAtPosition, + getTrailingCommentRanges, + hasDecorators, + InterfaceDeclaration, + isComment, + isDecorator, + isJSDoc, + isLineBreak, + isModifier, + isNodeArray, + isStringOrRegularExpressionOrTemplateLiteral, + isToken, + isWhiteSpaceSingleLine, + LanguageVariant, + last, + LineAndCharacter, + MethodDeclaration, + ModuleDeclaration, + Node, + NodeArray, + nodeIsMissing, + nodeIsSynthesized, + rangeContainsPositionExclusive, + rangeContainsRange, + 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, + FormattingContext, + FormattingRequestKind, + FormattingScanner, + getFormattingScanner, + Rule, + RuleAction, + RuleFlags, + RulesMap, + SmartIndenter, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index c42ff32dedacd..511246c7d899f 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -1,5 +1,12 @@ import { TextRangeWithKind } from "../_namespaces/ts.formatting"; -import { Debug, findChildOfKind, FormatCodeSettings, Node, SourceFileLike, SyntaxKind } from "../_namespaces/ts"; +import { + Debug, + findChildOfKind, + FormatCodeSettings, + Node, + SourceFileLike, + SyntaxKind, +} from "../_namespaces/ts"; /** @internal */ export const enum FormattingRequestKind { diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 0941d277d2ac3..5d29e814ce807 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -1,9 +1,25 @@ import { - append, createScanner, Debug, isJsxAttribute, isJsxElement, isJsxText, isKeyword, isToken, isTrivia, - LanguageVariant, last, 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, + TextRangeWithKind, + TextRangeWithTriviaKind, + TokenInfo, } 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 ed4e96232d5d1..7a5373a63dd5d 100644 --- a/src/services/formatting/rule.ts +++ b/src/services/formatting/rule.ts @@ -1,5 +1,8 @@ import { FormattingContext } from "../_namespaces/ts.formatting"; -import { emptyArray, SyntaxKind } from "../_namespaces/ts"; +import { + emptyArray, + SyntaxKind, +} from "../_namespaces/ts"; /** @internal */ export interface Rule { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index df1cfeb76a992..fc7a3a0b28a74 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -1,11 +1,35 @@ import { - anyContext, ContextPredicate, FormattingContext, FormattingRequestKind, Rule, RuleAction, RuleFlags, - TextRangeWithKind, TokenRange, + anyContext, + ContextPredicate, + FormattingContext, + FormattingRequestKind, + Rule, + RuleAction, + RuleFlags, + TextRangeWithKind, + TokenRange, } from "../_namespaces/ts.formatting"; import { - BinaryExpression, contains, findAncestor, findNextToken, FormatCodeSettings, hasDecorators, hasProperty, isArray, - isExpression, isFunctionLikeKind, isNumericLiteral, isPropertyAccessExpression, isPropertyDeclaration, - isPropertySignature, isTrivia, Node, positionIsASICandidate, SemicolonPreference, SyntaxKind, typeKeywords, + BinaryExpression, + contains, + findAncestor, + findNextToken, + FormatCodeSettings, + hasDecorators, + hasProperty, + isArray, + isExpression, + isFunctionLikeKind, + isNumericLiteral, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertySignature, + isTrivia, + Node, + positionIsASICandidate, + SemicolonPreference, + SyntaxKind, + typeKeywords, YieldExpression, } from "../_namespaces/ts"; diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 4cdd1b4ca0864..53a578fbe3521 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -1,6 +1,18 @@ -import { Debug, every, FormatCodeSettings, FormattingHost, SyntaxKind } from "../_namespaces/ts"; import { - anyContext, FormatContext, FormattingContext, getAllRules, Rule, RuleAction, RuleSpec, + Debug, + every, + FormatCodeSettings, + FormattingHost, + SyntaxKind, +} from "../_namespaces/ts"; +import { + anyContext, + FormatContext, + FormattingContext, + getAllRules, + Rule, + RuleAction, + RuleSpec, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index bc522163651de..b48051e8a651d 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -1,16 +1,62 @@ import { - ArrayBindingPattern, ArrayLiteralExpression, CallExpression, CharacterCodes, 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, Node, NodeArray, - ObjectBindingPattern, ObjectLiteralExpression, positionBelongsToNode, rangeContainsRange, rangeContainsStartEnd, - SignatureDeclaration, skipTrivia, SourceFile, SourceFileLike, SyntaxKind, TextRange, TypeAliasDeclaration, - TypeLiteralNode, TypeReferenceNode, VariableDeclarationList, + ArrayBindingPattern, + ArrayLiteralExpression, + CallExpression, + CharacterCodes, + 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, + Node, + NodeArray, + ObjectBindingPattern, + ObjectLiteralExpression, + positionBelongsToNode, + rangeContainsRange, + rangeContainsStartEnd, + SignatureDeclaration, + skipTrivia, + SourceFile, + SourceFileLike, + SyntaxKind, + TextRange, + TypeAliasDeclaration, + TypeLiteralNode, + TypeReferenceNode, + VariableDeclarationList, } from "../_namespaces/ts"; -import { getRangeOfEnclosingComment, TextRangeWithKind } from "../_namespaces/ts.formatting"; +import { + getRangeOfEnclosingComment, + TextRangeWithKind, +} from "../_namespaces/ts.formatting"; /** @internal */ export namespace SmartIndenter { diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index 2c2096a86004d..e8c7f4c2bd140 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -1,13 +1,55 @@ import { - combinePaths, createGetCanonicalFileName, createModuleSpecifierResolutionHost, createRange, Debug, emptyArray, - endsWith, ensurePathIsNonModuleName, Expression, factory, FileTextChanges, find, forEach, formatting, - GetCanonicalFileName, getDirectoryPath, getFileMatcherPatterns, getModeForUsageLocation, getOptionFromName, - getRegexFromPattern, getRelativePathFromDirectory, getRelativePathFromFile, getTsConfigObjectLiteralExpression, - hostUsesCaseSensitiveFileNames, isAmbientModule, isArrayLiteralExpression, isObjectLiteralExpression, - isPropertyAssignment, isSourceFile, isStringLiteral, LanguageServiceHost, last, mapDefined, ModuleResolutionHost, - moduleSpecifiers, normalizePath, Path, pathIsRelative, Program, PropertyAssignment, - ResolvedModuleWithFailedLookupLocations, resolveModuleName, SourceFile, SourceFileLike, SourceMapper, - StringLiteralLike, Symbol, textChanges, TextRange, tryRemoveDirectoryPrefix, UserPreferences, + combinePaths, + createGetCanonicalFileName, + createModuleSpecifierResolutionHost, + createRange, + Debug, + emptyArray, + endsWith, + ensurePathIsNonModuleName, + Expression, + factory, + FileTextChanges, + find, + forEach, + formatting, + GetCanonicalFileName, + getDirectoryPath, + getFileMatcherPatterns, + getModeForUsageLocation, + getOptionFromName, + getRegexFromPattern, + getRelativePathFromDirectory, + getRelativePathFromFile, + getTsConfigObjectLiteralExpression, + hostUsesCaseSensitiveFileNames, + isAmbientModule, + isArrayLiteralExpression, + isObjectLiteralExpression, + 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 1a8ebd80f4843..47be1d6781c4f 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -1,22 +1,101 @@ import { - AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, CallLikeExpression, concatenate, - createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, Debug, Declaration, - DefinitionInfo, DefinitionInfoAndBoundSpan, emptyArray, every, FileReference, filter, find, FindAllReferences, - findAncestor, first, flatMap, forEach, FunctionLikeDeclaration, getAssignmentDeclarationKind, - getContainingObjectLiteralElement, getDirectoryPath, getEffectiveBaseTypeNode, getInvokedExpression, - getModeForUsageLocation, getNameFromPropertyName, getNameOfDeclaration, getPropertySymbolsFromContextualType, - getTargetLabel, getTextOfPropertyName, getTouchingPropertyName, getTouchingToken, hasEffectiveModifier, - hasInitializer, hasStaticModifier, isAnyImportOrBareOrAccessedRequire, isAssignmentDeclaration, - isAssignmentExpression, isBindingElement, isCallLikeExpression, isCallOrNewExpressionTarget, isClassElement, - isClassExpression, isClassLike, isClassStaticBlockDeclaration, isConstructorDeclaration, isDeclarationFileName, - isExternalModuleNameRelative, isFunctionLike, isFunctionLikeDeclaration, isFunctionTypeNode, isIdentifier, - isImportMeta, isJSDocOverrideTag, isJsxOpeningLikeElement, isJumpStatementTarget, isModuleSpecifierLike, - isNameOfFunctionDeclaration, isNewExpressionTarget, isObjectBindingPattern, isPropertyName, - isRightSideOfPropertyAccess, isStaticModifier, isVariableDeclaration, 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, + AssignmentDeclarationKind, + AssignmentExpression, + AssignmentOperatorToken, + CallLikeExpression, + concatenate, + createTextSpan, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + Debug, + Declaration, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + emptyArray, + every, + FileReference, + filter, + find, + FindAllReferences, + findAncestor, + first, + flatMap, + forEach, + FunctionLikeDeclaration, + getAssignmentDeclarationKind, + getContainingObjectLiteralElement, + getDirectoryPath, + getEffectiveBaseTypeNode, + getInvokedExpression, + getModeForUsageLocation, + getNameFromPropertyName, + getNameOfDeclaration, + getPropertySymbolsFromContextualType, + getTargetLabel, + getTextOfPropertyName, + getTouchingPropertyName, + getTouchingToken, + hasEffectiveModifier, + hasInitializer, + hasStaticModifier, + isAnyImportOrBareOrAccessedRequire, + isAssignmentDeclaration, + isAssignmentExpression, + isBindingElement, + isCallLikeExpression, + isCallOrNewExpressionTarget, + isClassElement, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isConstructorDeclaration, + isDeclarationFileName, + isExternalModuleNameRelative, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionTypeNode, + isIdentifier, + isImportMeta, + isJSDocOverrideTag, + isJsxOpeningLikeElement, + isJumpStatementTarget, + isModuleSpecifierLike, + isNameOfFunctionDeclaration, + isNewExpressionTarget, + isObjectBindingPattern, + isPropertyName, + isRightSideOfPropertyAccess, + isStaticModifier, + isVariableDeclaration, + 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"; /** @internal */ diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index 802fe1d5417b8..0cca4a93f915b 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -1,18 +1,82 @@ import { - __String, AnyImportOrReExport, AssignmentDeclarationKind, BinaryExpression, BindingElement, CallExpression, - CancellationToken, canHaveModifiers, cast, Debug, ExportAssignment, ExportDeclaration, FileReference, - findAncestor, forEach, getAssignmentDeclarationKind, getFirstIdentifier, getNameOfAccessExpression, - getSourceFileOfNode, getSymbolId, hasSyntacticModifier, Identifier, ImportCall, ImportClause, ImportDeclaration, - ImportEqualsDeclaration, importFromModuleSpecifier, ImportSpecifier, InternalSymbolName, isAccessExpression, - isBinaryExpression, isBindingElement, isCatchClause, isDefaultImport, isExportAssignment, isExportDeclaration, - isExportModifier, isExportSpecifier, isExternalModuleAugmentation, isExternalModuleSymbol, isImportCall, - isImportEqualsDeclaration, isImportTypeNode, isInJSFile, isJSDocTypedefTag, isModuleExportsAccessExpression, - isNamedExports, isNamespaceExport, isPrivateIdentifier, isPropertyAccessExpression, isShorthandPropertyAssignment, - isSourceFile, isStringLiteral, isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, - isVariableStatement, ModifierFlags, ModuleBlock, ModuleDeclaration, NamedImportsOrExports, NamespaceImport, - Node, nodeSeenTracker, Program, some, SourceFile, Statement, StringLiteral, StringLiteralLike, Symbol, - symbolEscapedNameNoDefault, SymbolFlags, symbolName, SyntaxKind, TypeChecker, ValidImportTypeNode, - VariableDeclaration, walkUpBindingElementsAndPatterns, + __String, + AnyImportOrReExport, + AssignmentDeclarationKind, + BinaryExpression, + BindingElement, + CallExpression, + CancellationToken, + canHaveModifiers, + cast, + Debug, + ExportAssignment, + ExportDeclaration, + FileReference, + findAncestor, + forEach, + getAssignmentDeclarationKind, + getFirstIdentifier, + getNameOfAccessExpression, + getSourceFileOfNode, + getSymbolId, + hasSyntacticModifier, + Identifier, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + importFromModuleSpecifier, + ImportSpecifier, + InternalSymbolName, + isAccessExpression, + isBinaryExpression, + isBindingElement, + isCatchClause, + isDefaultImport, + isExportAssignment, + isExportDeclaration, + isExportModifier, + isExportSpecifier, + isExternalModuleAugmentation, + isExternalModuleSymbol, + isImportCall, + isImportEqualsDeclaration, + isImportTypeNode, + isInJSFile, + isJSDocTypedefTag, + isModuleExportsAccessExpression, + isNamedExports, + isNamespaceExport, + isPrivateIdentifier, + isPropertyAccessExpression, + isShorthandPropertyAssignment, + isSourceFile, + isStringLiteral, + isVariableDeclaration, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableStatement, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + NamedImportsOrExports, + NamespaceImport, + Node, + nodeSeenTracker, + Program, + some, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + symbolEscapedNameNoDefault, + SymbolFlags, + symbolName, + SyntaxKind, + TypeChecker, + ValidImportTypeNode, + VariableDeclaration, + walkUpBindingElementsAndPatterns, } from "./_namespaces/ts"; /* Code for finding imports of an exported symbol. Used only by FindAllReferences. */ diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index 2d890d7f31cfc..45bb04e6e1329 100644 --- a/src/services/inlayHints.ts +++ b/src/services/inlayHints.ts @@ -1,16 +1,72 @@ import { - __String, ArrowFunction, CallExpression, createPrinter, Debug, EmitHint, EnumMember, equateStringsCaseInsensitive, - Expression, findChildOfKind, forEachChild, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, - GetAccessorDeclaration, getEffectiveReturnTypeNode, getEffectiveTypeAnnotationNode, getLanguageVariant, - getLeadingCommentRanges, hasContextSensitiveParameters, Identifier, InlayHint, InlayHintKind, InlayHintsContext, - isArrowFunction, isAssertionExpression, isBindingPattern, isCallExpression, isEnumMember, - isExpressionWithTypeArguments, isFunctionDeclaration, isFunctionExpression, isFunctionLikeDeclaration, - isGetAccessorDeclaration, isIdentifier, isIdentifierText, isInfinityOrNaNString, isLiteralExpression, - isMethodDeclaration, isNewExpression, isObjectLiteralExpression, isParameter, isParameterDeclaration, - isPropertyAccessExpression, isPropertyDeclaration, isTypeNode, isVarConst, isVariableDeclaration, MethodDeclaration, - NewExpression, Node, NodeBuilderFlags, ParameterDeclaration, PrefixUnaryExpression, PrinterOptions, - PropertyDeclaration, Signature, skipParentheses, some, Symbol, SymbolFlags, SyntaxKind, textSpanIntersectsWith, - Type, TypeFormatFlags, unescapeLeadingUnderscores, UserPreferences, usingSingleLineStringWriter, + __String, + ArrowFunction, + CallExpression, + createPrinter, + Debug, + EmitHint, + EnumMember, + equateStringsCaseInsensitive, + Expression, + findChildOfKind, + forEachChild, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + getEffectiveReturnTypeNode, + getEffectiveTypeAnnotationNode, + getLanguageVariant, + getLeadingCommentRanges, + hasContextSensitiveParameters, + Identifier, + InlayHint, + InlayHintKind, + InlayHintsContext, + isArrowFunction, + isAssertionExpression, + isBindingPattern, + isCallExpression, + isEnumMember, + isExpressionWithTypeArguments, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLikeDeclaration, + isGetAccessorDeclaration, + isIdentifier, + isIdentifierText, + isInfinityOrNaNString, + isLiteralExpression, + isMethodDeclaration, + isNewExpression, + isObjectLiteralExpression, + isParameter, + isParameterDeclaration, + isPropertyAccessExpression, + isPropertyDeclaration, + 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"; diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index b6b7ba77b0cbe..45e9d80f673a1 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,18 +1,91 @@ import { - arraysEqual, ArrowFunction, AssignmentDeclarationKind, BinaryExpression, buildLinkParts, ClassExpression, - CompletionEntry, CompletionEntryDetails, Completions, ConstructorDeclaration, contains, Declaration, - DocCommentTemplateOptions, emptyArray, Expression, ExpressionStatement, find, findAncestor, flatMap, flatten, - forEach, forEachAncestor, forEachReturnStatement, forEachUnique, FunctionDeclaration, FunctionExpression, - getAssignmentDeclarationKind, getJSDocCommentsAndTags, getJSDocTags, getLineStartPositionForPosition, - getTokenAtPosition, hasJSDocNodes, hasJSFileExtension, intersperse, isArrowFunction, isBlock, - isConstructorDeclaration, isExpression, isFunctionExpression, isFunctionLike, isFunctionLikeDeclaration, - isFunctionTypeNode, isIdentifier, isJSDoc, isJSDocParameterTag, isWhiteSpaceSingleLine, JSDoc, JSDocAugmentsTag, - JSDocCallbackTag, JSDocComment, JSDocImplementsTag, JSDocParameterTag, JSDocPropertyTag, JSDocSeeTag, JSDocTag, - JSDocTagInfo, JSDocTemplateTag, JSDocTypedefTag, JSDocTypeTag, lastOrUndefined, length, lineBreakPart, map, - mapDefined, MethodDeclaration, MethodSignature, Node, ParameterDeclaration, parameterNamePart, - ParenthesizedExpression, PropertyAssignment, PropertyDeclaration, propertyNamePart, PropertySignature, - punctuationPart, ScriptElementKind, SourceFile, spacePart, startsWith, SymbolDisplayPart, SyntaxKind, TextInsertion, - textPart, typeAliasNamePart, TypeChecker, typeParameterNamePart, VariableStatement, + arraysEqual, + ArrowFunction, + AssignmentDeclarationKind, + BinaryExpression, + buildLinkParts, + ClassExpression, + CompletionEntry, + CompletionEntryDetails, + Completions, + ConstructorDeclaration, + contains, + Declaration, + DocCommentTemplateOptions, + emptyArray, + Expression, + ExpressionStatement, + find, + findAncestor, + flatMap, + flatten, + forEach, + forEachAncestor, + forEachReturnStatement, + forEachUnique, + FunctionDeclaration, + FunctionExpression, + getAssignmentDeclarationKind, + getJSDocCommentsAndTags, + getJSDocTags, + getLineStartPositionForPosition, + getTokenAtPosition, + hasJSDocNodes, + hasJSFileExtension, + intersperse, + isArrowFunction, + isBlock, + isConstructorDeclaration, + isExpression, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionTypeNode, + isIdentifier, + isJSDoc, + isJSDocParameterTag, + isWhiteSpaceSingleLine, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocImplementsTag, + JSDocParameterTag, + JSDocPropertyTag, + JSDocSeeTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypedefTag, + JSDocTypeTag, + lastOrUndefined, + length, + lineBreakPart, + map, + mapDefined, + MethodDeclaration, + MethodSignature, + Node, + ParameterDeclaration, + parameterNamePart, + ParenthesizedExpression, + PropertyAssignment, + PropertyDeclaration, + propertyNamePart, + PropertySignature, + punctuationPart, + ScriptElementKind, + SourceFile, + spacePart, + startsWith, + SymbolDisplayPart, + SyntaxKind, + TextInsertion, + textPart, + typeAliasNamePart, + TypeChecker, + typeParameterNamePart, + VariableStatement, } from "./_namespaces/ts"; const jsDocTagNames = [ diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 0d0f78140556d..aa57b808e9f99 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -1,9 +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, Push, - ScriptElementKind, SourceFile, SyntaxKind, TypeChecker, + CancellationToken, + compareStringsCaseSensitiveUI, + compareValues, + createPatternMatcher, + createTextSpanFromNode, + Declaration, + emptyArray, + Expression, + getContainerNode, + getNameOfDeclaration, + getNodeKind, + getNodeModifiers, + getTextOfIdentifierOrLiteral, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportSpecifier, + isPropertyAccessExpression, + isPropertyNameLiteral, + NavigateToItem, + Node, + PatternMatcher, + PatternMatchKind, + Push, + ScriptElementKind, + SourceFile, + SyntaxKind, + TypeChecker, } from "./_namespaces/ts"; interface RawNavigateToItem { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 7d73da78ba472..132ff59e9909b 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -1,24 +1,113 @@ import { - ArrowFunction, AssignmentDeclarationKind, BinaryExpression, BindableElementAccessExpression, - BindableObjectDefinePropertyCall, BindableStaticNameExpression, BindingElement, CallExpression, CancellationToken, - ClassElement, ClassExpression, ClassLikeDeclaration, compareStringsCaseSensitiveUI, compareValues, concatenate, - ConstructorDeclaration, contains, createTextSpanFromNode, createTextSpanFromRange, Debug, Declaration, - DeclarationName, declarationNameToString, EntityNameExpression, EnumDeclaration, EnumMember, escapeString, - ExportAssignment, Expression, factory, filterMutate, forEach, forEachChild, FunctionDeclaration, FunctionExpression, - FunctionLikeDeclaration, getAssignmentDeclarationKind, getBaseFileName, getElementOrPropertyAccessName, - getFullWidth, getNameOfDeclaration, getNameOrArgument, getNodeKind, getNodeModifiers, - getPropertyNameForPropertyNameNode, getSyntacticModifierFlags, getTextOfIdentifierOrLiteral, getTextOfNode, - hasDynamicName, hasJSDocNodes, Identifier, idText, ImportClause, InterfaceDeclaration, InternalSymbolName, - isAmbientModule, isArrowFunction, isBinaryExpression, isBindableStaticAccessExpression, isBindingPattern, - isCallExpression, isClassDeclaration, isClassLike, isDeclaration, isElementAccessExpression, isExportAssignment, - isExpression, isExternalModule, isFunctionDeclaration, isFunctionExpression, isIdentifier, isJSDocTypeAlias, - isModuleBlock, isModuleDeclaration, isObjectLiteralExpression, isParameterPropertyDeclaration, isPrivateIdentifier, - isPropertyAccessExpression, isPropertyAssignment, isPropertyName, isPropertyNameLiteral, isStatic, - isStringLiteralLike, isToken, isVariableDeclaration, lastOrUndefined, map, mapDefined, ModifierFlags, - ModuleDeclaration, NavigationBarItem, NavigationTree, Node, NodeFlags, normalizePath, PropertyAccessExpression, - PropertyAssignment, PropertyDeclaration, PropertyNameLiteral, removeFileExtension, setTextRange, - ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SyntaxKind, TextSpan, TypeElement, - unescapeLeadingUnderscores, VariableDeclaration, + ArrowFunction, + AssignmentDeclarationKind, + BinaryExpression, + BindableElementAccessExpression, + BindableObjectDefinePropertyCall, + BindableStaticNameExpression, + BindingElement, + CallExpression, + CancellationToken, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + compareStringsCaseSensitiveUI, + compareValues, + concatenate, + ConstructorDeclaration, + contains, + createTextSpanFromNode, + createTextSpanFromRange, + Debug, + Declaration, + DeclarationName, + declarationNameToString, + EntityNameExpression, + EnumDeclaration, + EnumMember, + escapeString, + ExportAssignment, + Expression, + factory, + filterMutate, + forEach, + forEachChild, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + getAssignmentDeclarationKind, + getBaseFileName, + getElementOrPropertyAccessName, + getFullWidth, + getNameOfDeclaration, + getNameOrArgument, + getNodeKind, + getNodeModifiers, + getPropertyNameForPropertyNameNode, + getSyntacticModifierFlags, + getTextOfIdentifierOrLiteral, + getTextOfNode, + hasDynamicName, + hasJSDocNodes, + Identifier, + idText, + ImportClause, + InterfaceDeclaration, + InternalSymbolName, + isAmbientModule, + isArrowFunction, + isBinaryExpression, + isBindableStaticAccessExpression, + isBindingPattern, + isCallExpression, + isClassDeclaration, + isClassLike, + isDeclaration, + isElementAccessExpression, + isExportAssignment, + isExpression, + isExternalModule, + isFunctionDeclaration, + isFunctionExpression, + isIdentifier, + isJSDocTypeAlias, + isModuleBlock, + isModuleDeclaration, + isObjectLiteralExpression, + isParameterPropertyDeclaration, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyName, + isPropertyNameLiteral, + isStatic, + isStringLiteralLike, + isToken, + isVariableDeclaration, + 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 f8204d4f4b4be..77874bf6e6d35 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -1,14 +1,59 @@ import { - AnyImportOrRequireStatement, arrayIsSorted, binarySearch, compareBooleans, compareStringsCaseInsensitive, - compareValues, Comparison, createScanner, emptyArray, ExportDeclaration, ExportSpecifier, Expression, factory, + AnyImportOrRequireStatement, + arrayIsSorted, + binarySearch, + compareBooleans, + compareStringsCaseInsensitive, + compareValues, + Comparison, + createScanner, + emptyArray, + ExportDeclaration, + ExportSpecifier, + Expression, + factory, FileTextChanges, - FindAllReferences, flatMap, formatting, getNewLineOrDefaultFromHost, group, Identifier, identity, ImportDeclaration, - ImportOrExportSpecifier, ImportSpecifier, isAmbientModule, isExportDeclaration, isExternalModuleNameRelative, - isExternalModuleReference, isImportDeclaration, isNamedExports, isNamedImports, isNamespaceImport, isString, - isStringLiteral, isStringLiteralLike, jsxModeNeedsExplicitImport, LanguageServiceHost, length, map, - NamedImportBindings, NamedImports, NamespaceImport, OrganizeImportsMode, Program, Scanner, some, - SortedReadonlyArray, SourceFile, stableSort, suppressLeadingTrivia, SyntaxKind, textChanges, TransformFlags, - tryCast, UserPreferences, + FindAllReferences, + flatMap, + formatting, + getNewLineOrDefaultFromHost, + group, + Identifier, + identity, + ImportDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + isAmbientModule, + isExportDeclaration, + isExternalModuleNameRelative, + isExternalModuleReference, + isImportDeclaration, + isNamedExports, + isNamedImports, + isNamespaceImport, + isString, + isStringLiteral, + isStringLiteralLike, + jsxModeNeedsExplicitImport, + LanguageServiceHost, + length, + map, + NamedImportBindings, + NamedImports, + NamespaceImport, + OrganizeImportsMode, + Program, + Scanner, + some, + SortedReadonlyArray, + SourceFile, + stableSort, + suppressLeadingTrivia, + SyntaxKind, + textChanges, + TransformFlags, + tryCast, + UserPreferences, } from "./_namespaces/ts"; /** diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 5a80301e00055..47ac841287c54 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -1,13 +1,58 @@ import { - ArrowFunction, Block, CallExpression, CancellationToken, CaseClause, createTextSpanFromBounds, - createTextSpanFromNode, createTextSpanFromRange, Debug, DefaultClause, findChildOfKind, getLeadingCommentRanges, - isAnyImportSyntax, isArrayLiteralExpression, isBinaryExpression, isBindingElement, isBlock, isCallExpression, - isCallOrNewExpression, isClassLike, isDeclaration, isFunctionLike, isIfStatement, isInComment, - isInterfaceDeclaration, isJsxText, isModuleBlock, isNodeArrayMultiLine, isParenthesizedExpression, - isPropertyAccessExpression, isReturnStatement, isTupleTypeNode, isVariableStatement, JsxAttributes, JsxElement, - JsxFragment, JsxOpeningLikeElement, Node, NodeArray, NoSubstitutionTemplateLiteral, OutliningSpan, - OutliningSpanKind, ParenthesizedExpression, positionsAreOnSameLine, Push, SignatureDeclaration, SourceFile, - startsWith, SyntaxKind, TemplateExpression, TextSpan, trimString, trimStringStart, TryStatement, + ArrowFunction, + Block, + CallExpression, + CancellationToken, + CaseClause, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + Debug, + DefaultClause, + findChildOfKind, + getLeadingCommentRanges, + isAnyImportSyntax, + isArrayLiteralExpression, + isBinaryExpression, + isBindingElement, + isBlock, + isCallExpression, + isCallOrNewExpression, + isClassLike, + isDeclaration, + isFunctionLike, + isIfStatement, + isInComment, + isInterfaceDeclaration, + isJsxText, + isModuleBlock, + isNodeArrayMultiLine, + isParenthesizedExpression, + isPropertyAccessExpression, + 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 21e6a62d70cf5..b021f959c6a34 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -1,6 +1,15 @@ import { - CharacterCodes, compareBooleans, compareValues, Comparison, createTextSpan, isUnicodeIdentifierStart, last, - min, ScriptTarget, startsWith, TextSpan, + CharacterCodes, + 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 be3823693ea75..084a99595cc5b 100644 --- a/src/services/preProcess.ts +++ b/src/services/preProcess.ts @@ -1,6 +1,16 @@ import { - FileReference, isKeyword, lastOrUndefined, length, noop, PragmaContext, PreProcessedFileInfo, processCommentPragmas, - processPragmasIntoFields, scanner, ScriptTarget, SyntaxKind, + FileReference, + 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 856708195654f..611c846c21c99 100644 --- a/src/services/refactorProvider.ts +++ b/src/services/refactorProvider.ts @@ -1,5 +1,10 @@ import { - ApplicableRefactorInfo, arrayFrom, flatMapIterator, Refactor, RefactorContext, RefactorEditInfo, + ApplicableRefactorInfo, + arrayFrom, + flatMapIterator, + Refactor, + RefactorContext, + RefactorEditInfo, } from "./_namespaces/ts"; import { refactorKindBeginsWith } from "./_namespaces/ts.refactor"; diff --git a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts index d0548b1d785ab..25aabb5d07b84 100644 --- a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts +++ b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts @@ -1,12 +1,37 @@ import { - ApplicableRefactorInfo, ArrowFunction, ConciseBody, copyLeadingComments, copyTrailingAsLeadingComments, - copyTrailingComments, Debug, Diagnostics, emptyArray, Expression, factory, first, getContainingFunction, - getLocaleSpecificMessage, getTokenAtPosition, isArrowFunction, isBlock, isExpression, isReturnStatement, - needsParentheses, rangeContainsRange, RefactorContext, RefactorEditInfo, ReturnStatement, SourceFile, SyntaxKind, + ApplicableRefactorInfo, + ArrowFunction, + ConciseBody, + copyLeadingComments, + copyTrailingAsLeadingComments, + copyTrailingComments, + Debug, + Diagnostics, + emptyArray, + Expression, + factory, + first, + getContainingFunction, + getLocaleSpecificMessage, + getTokenAtPosition, + isArrowFunction, + isBlock, + isExpression, + isReturnStatement, + needsParentheses, + rangeContainsRange, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + SyntaxKind, textChanges, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, refactorKindBeginsWith, registerRefactor, + isRefactorErrorInfo, + RefactorErrorInfo, + refactorKindBeginsWith, + registerRefactor, } from "../_namespaces/ts.refactor"; const refactorName = "Add or remove braces in an arrow function"; diff --git a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts index 416f7caf3c1b1..f631f1387e221 100644 --- a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts +++ b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts @@ -1,15 +1,61 @@ import { - ApplicableRefactorInfo, ArrowFunction, Block, ConciseBody, copyComments, copyTrailingAsLeadingComments, Debug, - Diagnostics, emptyArray, factory, FileTextChanges, FindAllReferences, first, forEachChild, FunctionExpression, - getCombinedModifierFlags, getContainingFunction, getEffectiveModifierFlags, getLocaleSpecificMessage, - getTokenAtPosition, Identifier, isArrowFunction, isClassLike, isExpression, isFunctionDeclaration, - isFunctionExpression, isIdentifier, isReturnStatement, isThis, isVariableDeclaration, - isVariableDeclarationInVariableStatement, isVariableDeclarationList, isVariableStatement, length, ModifierFlags, - Node, Program, rangeContainsRange, RefactorActionInfo, RefactorContext, RefactorEditInfo, ReturnStatement, - SourceFile, Statement, suppressLeadingAndTrailingTrivia, suppressLeadingTrivia, SyntaxKind, textChanges, - TypeChecker, VariableDeclaration, VariableDeclarationList, VariableStatement, + ApplicableRefactorInfo, + ArrowFunction, + Block, + ConciseBody, + copyComments, + copyTrailingAsLeadingComments, + Debug, + Diagnostics, + emptyArray, + factory, + FileTextChanges, + FindAllReferences, + first, + forEachChild, + FunctionExpression, + getCombinedModifierFlags, + getContainingFunction, + getEffectiveModifierFlags, + getLocaleSpecificMessage, + getTokenAtPosition, + Identifier, + isArrowFunction, + isClassLike, + isExpression, + isFunctionDeclaration, + isFunctionExpression, + isIdentifier, + isReturnStatement, + isThis, + isVariableDeclaration, + isVariableDeclarationInVariableStatement, + 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, registerRefactor } from "../_namespaces/ts.refactor"; +import { + refactorKindBeginsWith, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert arrow function or function expression"; const refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression); diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index d759fdfbffce0..689460c9ee2dd 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -1,14 +1,60 @@ import { - ApplicableRefactorInfo, CancellationToken, ClassDeclaration, Debug, Diagnostics, emptyArray, EnumDeclaration, - ExportAssignment, ExportSpecifier, factory, FindAllReferences, findModifier, first, FunctionDeclaration, - getLocaleSpecificMessage, getParentNodeInSpan, getRefactorContextSpan, getSyntacticModifierFlags, - getTokenAtPosition, Identifier, ImportClause, ImportSpecifier, ImportTypeNode, InterfaceDeclaration, - InternalSymbolName, isAmbientModule, isExportAssignment, isExternalModuleAugmentation, isIdentifier, isModuleBlock, - isSourceFile, isStringLiteral, makeImport, ModifierFlags, NamespaceDeclaration, Node, NodeFlags, Program, - PropertyAccessExpression, QuotePreference, quotePreferenceFromString, RefactorContext, RefactorEditInfo, SourceFile, - Symbol, SyntaxKind, textChanges, TypeAliasDeclaration, TypeChecker, VariableStatement, + ApplicableRefactorInfo, + CancellationToken, + ClassDeclaration, + Debug, + Diagnostics, + emptyArray, + EnumDeclaration, + ExportAssignment, + ExportSpecifier, + factory, + FindAllReferences, + findModifier, + first, + FunctionDeclaration, + getLocaleSpecificMessage, + getParentNodeInSpan, + getRefactorContextSpan, + getSyntacticModifierFlags, + getTokenAtPosition, + Identifier, + ImportClause, + ImportSpecifier, + ImportTypeNode, + InterfaceDeclaration, + InternalSymbolName, + isAmbientModule, + isExportAssignment, + isExternalModuleAugmentation, + isIdentifier, + isModuleBlock, + isSourceFile, + isStringLiteral, + makeImport, + ModifierFlags, + NamespaceDeclaration, + Node, + NodeFlags, + Program, + PropertyAccessExpression, + QuotePreference, + quotePreferenceFromString, + RefactorContext, + RefactorEditInfo, + SourceFile, + Symbol, + SyntaxKind, + textChanges, + TypeAliasDeclaration, + TypeChecker, + VariableStatement, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + isRefactorErrorInfo, + RefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert export"; diff --git a/src/services/refactors/convertImport.ts b/src/services/refactors/convertImport.ts index 3f0e11d948205..a7d0d0d53123b 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -1,13 +1,54 @@ 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, PropertyAccessExpression, QualifiedName, RefactorContext, RefactorEditInfo, ScriptTarget, some, - SourceFile, Symbol, SymbolFlags, SyntaxKind, textChanges, TypeChecker, + 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, + PropertyAccessExpression, + QualifiedName, + RefactorContext, + RefactorEditInfo, + ScriptTarget, + some, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + textChanges, + TypeChecker, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + isRefactorErrorInfo, + RefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert import"; diff --git a/src/services/refactors/convertOverloadListToSingleSignature.ts b/src/services/refactors/convertOverloadListToSingleSignature.ts index ebe0535e0098e..c0ad2970a6138 100644 --- a/src/services/refactors/convertOverloadListToSingleSignature.ts +++ b/src/services/refactors/convertOverloadListToSingleSignature.ts @@ -1,10 +1,43 @@ import { - ApplicableRefactorInfo, CallSignatureDeclaration, ConstructorDeclaration, ConstructSignatureDeclaration, Debug, - Diagnostics, displayPartsToString, EmitFlags, emptyArray, every, factory, findAncestor, FunctionDeclaration, - getSourceFileOfNode, getSyntheticLeadingComments, getTokenAtPosition, isFunctionLikeDeclaration, isIdentifier, - length, map, mapDefined, MethodDeclaration, MethodSignature, NamedTupleMember, Node, NodeArray, - ParameterDeclaration, Program, rangeContainsPosition, RefactorContext, RefactorEditInfo, setEmitFlags, - setSyntheticLeadingComments, setTextRange, some, SourceFile, SyntaxKind, textChanges, TupleTypeNode, + ApplicableRefactorInfo, + CallSignatureDeclaration, + ConstructorDeclaration, + ConstructSignatureDeclaration, + Debug, + Diagnostics, + displayPartsToString, + EmitFlags, + emptyArray, + every, + factory, + findAncestor, + FunctionDeclaration, + getSourceFileOfNode, + getSyntheticLeadingComments, + getTokenAtPosition, + isFunctionLikeDeclaration, + isIdentifier, + 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 a4072a335b8b7..a86e190d2d8cd 100644 --- a/src/services/refactors/convertParamsToDestructuredObject.ts +++ b/src/services/refactors/convertParamsToDestructuredObject.ts @@ -1,21 +1,107 @@ import { - addEmitFlags, ApplicableRefactorInfo, ArrowFunction, BindingElement, CallExpression, CancellationToken, CheckFlags, - ClassDeclaration, ClassExpression, compareValues, ConstructorDeclaration, contains, copyComments, Debug, - deduplicate, Diagnostics, ElementAccessExpression, EmitFlags, emptyArray, equateValues, every, Expression, factory, - FindAllReferences, findAncestor, findChildOfKind, findModifier, first, flatMap, FunctionBody, FunctionDeclaration, - FunctionExpression, FunctionLikeDeclaration, getCheckFlags, getContainingFunctionDeclaration, - getContainingObjectLiteralElement, getLocaleSpecificMessage, getMeaningFromLocation, getSourceFileOfNode, - getSymbolTarget, getSynthesizedDeepClone, getTextOfIdentifierOrLiteral, getTouchingToken, getTypeNodeIfAccessible, - Identifier, isCallOrNewExpression, isClassDeclaration, isConstructorDeclaration, isDeclaration, - isElementAccessExpression, isExportAssignment, isExportSpecifier, isExpressionWithTypeArgumentsInClassExtendsClause, - isFunctionLikeDeclaration, isIdentifier, isImportClause, isImportEqualsDeclaration, isImportSpecifier, - isInterfaceDeclaration, isJSDocNode, isMethodSignature, isNamespaceImport, isNewExpressionTarget, - isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isRestParameter, isSourceFileJS, - isThis, 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, + addEmitFlags, + ApplicableRefactorInfo, + ArrowFunction, + BindingElement, + CallExpression, + CancellationToken, + CheckFlags, + ClassDeclaration, + ClassExpression, + compareValues, + ConstructorDeclaration, + contains, + copyComments, + Debug, + deduplicate, + Diagnostics, + ElementAccessExpression, + EmitFlags, + emptyArray, + equateValues, + every, + Expression, + factory, + FindAllReferences, + findAncestor, + findChildOfKind, + findModifier, + first, + flatMap, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + getCheckFlags, + getContainingFunctionDeclaration, + getContainingObjectLiteralElement, + getLocaleSpecificMessage, + getMeaningFromLocation, + getSourceFileOfNode, + getSymbolTarget, + getSynthesizedDeepClone, + getTextOfIdentifierOrLiteral, + getTouchingToken, + getTypeNodeIfAccessible, + Identifier, + isCallOrNewExpression, + isClassDeclaration, + isConstructorDeclaration, + isDeclaration, + isElementAccessExpression, + isExportAssignment, + isExportSpecifier, + isExpressionWithTypeArgumentsInClassExtendsClause, + isFunctionLikeDeclaration, + isIdentifier, + isImportClause, + isImportEqualsDeclaration, + isImportSpecifier, + isInterfaceDeclaration, + isJSDocNode, + isMethodSignature, + isNamespaceImport, + isNewExpressionTarget, + isObjectLiteralExpression, + isPropertyAccessExpression, + isPropertyAssignment, + isRestParameter, + isSourceFileJS, + isThis, + 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 f3bff71ac5849..712308df7bed2 100644 --- a/src/services/refactors/convertStringOrTemplateLiteral.ts +++ b/src/services/refactors/convertStringOrTemplateLiteral.ts @@ -1,10 +1,40 @@ import { - ApplicableRefactorInfo, BinaryExpression, BinaryOperator, copyTrailingAsLeadingComments, copyTrailingComments, - Debug, Diagnostics, emptyArray, Expression, factory, findAncestor, getLocaleSpecificMessage, getTextOfNode, - getTokenAtPosition, getTrailingCommentRanges, isBinaryExpression, isNoSubstitutionTemplateLiteral, - isParenthesizedExpression, isStringLiteral, isStringLiteralLike, isTemplateExpression, isTemplateHead, - isTemplateMiddle, map, Node, ParenthesizedExpression, RefactorContext, RefactorEditInfo, SourceFile, SyntaxKind, - TemplateHead, TemplateMiddle, TemplateSpan, TemplateTail, textChanges, Token, + ApplicableRefactorInfo, + BinaryExpression, + BinaryOperator, + copyTrailingAsLeadingComments, + copyTrailingComments, + Debug, + Diagnostics, + emptyArray, + Expression, + factory, + findAncestor, + getLocaleSpecificMessage, + getTextOfNode, + getTokenAtPosition, + getTrailingCommentRanges, + isBinaryExpression, + isNoSubstitutionTemplateLiteral, + isParenthesizedExpression, + isStringLiteral, + isStringLiteralLike, + isTemplateExpression, + 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 5c8153ef5f876..a86777e97dd63 100644 --- a/src/services/refactors/convertToOptionalChainExpression.ts +++ b/src/services/refactors/convertToOptionalChainExpression.ts @@ -1,14 +1,51 @@ import { - ApplicableRefactorInfo, BinaryExpression, CallExpression, ConditionalExpression, createTextSpanFromBounds, Debug, - Diagnostics, ElementAccessExpression, emptyArray, Expression, ExpressionStatement, factory, - findTokenOnLeftOfPosition, getLocaleSpecificMessage, getRefactorContextSpan, getSingleVariableOfVariableStatement, - getTokenAtPosition, Identifier, isBinaryExpression, isCallExpression, isConditionalExpression, - isElementAccessExpression, isExpressionStatement, isIdentifier, isOptionalChain, isPropertyAccessExpression, - isReturnStatement, isStringOrNumericLiteralLike, isVariableStatement, Node, PropertyAccessExpression, - RefactorContext, RefactorEditInfo, ReturnStatement, skipParentheses, SourceFile, SyntaxKind, textChanges, TextSpan, - TypeChecker, VariableStatement, + ApplicableRefactorInfo, + BinaryExpression, + CallExpression, + ConditionalExpression, + createTextSpanFromBounds, + Debug, + Diagnostics, + ElementAccessExpression, + emptyArray, + Expression, + ExpressionStatement, + factory, + findTokenOnLeftOfPosition, + getLocaleSpecificMessage, + getRefactorContextSpan, + getSingleVariableOfVariableStatement, + getTokenAtPosition, + Identifier, + isBinaryExpression, + isCallExpression, + isConditionalExpression, + isElementAccessExpression, + isExpressionStatement, + isIdentifier, + isOptionalChain, + isPropertyAccessExpression, + isReturnStatement, + isStringOrNumericLiteralLike, + isVariableStatement, + Node, + PropertyAccessExpression, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + skipParentheses, + SourceFile, + SyntaxKind, + textChanges, + TextSpan, + TypeChecker, + VariableStatement, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + isRefactorErrorInfo, + RefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert to optional chain expression"; const convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression); diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 0918765f6567e..276804acf15a2 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1,32 +1,168 @@ 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, DiagnosticCategory, DiagnosticMessage, Diagnostics, EmitFlags, - emptyArray, EntityName, Expression, ExpressionStatement, factory, find, findAncestor, - findFirstNonJsxWhitespaceToken, findTokenOnLeftOfPosition, first, firstOrUndefined, forEachChild, - formatStringFromArgs, FunctionDeclaration, FunctionLikeDeclaration, getContainingClass, getContainingFunction, - getEffectiveTypeParameterDeclarations, getEmitScriptTarget, getEnclosingBlockScopeContainer, - getLocaleSpecificMessage, getModifiers, getNodeId, getParentNodeInSpan, getRefactorContextSpan, getRenameLocation, - getSymbolId, getSynthesizedDeepClone, getThisContainer, getUniqueName, hasEffectiveModifier, hasSyntacticModifier, - Identifier, isArray, isArrowFunction, isAssignmentExpression, isBinaryExpression, isBlock, isBlockScope, - isCaseClause, isClassLike, isConstructorDeclaration, isDeclaration, isDeclarationWithTypeParameters, - isElementAccessExpression, isExpression, isExpressionNode, isExpressionStatement, isFunctionBody, - isFunctionExpression, isFunctionLike, isFunctionLikeDeclaration, isIdentifier, isInJSFile, isIterationStatement, - isJsxAttribute, isJsxElement, isJsxFragment, isJsxSelfClosingElement, isKeyword, isModuleBlock, - isParenthesizedTypeNode, isPartOfTypeNode, isPrivateIdentifier, isPropertyAccessExpression, isPropertyDeclaration, - isQualifiedName, isReturnStatement, isShorthandPropertyAssignment, isSourceFile, isStatement, isStatic, - isStringLiteral, isSwitchStatement, isThis, isUnaryExpressionWithWrite, isUnionTypeNode, 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, + __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, + DiagnosticCategory, + DiagnosticMessage, + Diagnostics, + EmitFlags, + emptyArray, + EntityName, + Expression, + ExpressionStatement, + factory, + find, + findAncestor, + findFirstNonJsxWhitespaceToken, + findTokenOnLeftOfPosition, + first, + firstOrUndefined, + forEachChild, + formatStringFromArgs, + FunctionDeclaration, + FunctionLikeDeclaration, + getContainingClass, + getContainingFunction, + getEffectiveTypeParameterDeclarations, + getEmitScriptTarget, + getEnclosingBlockScopeContainer, + getLocaleSpecificMessage, + getModifiers, + getNodeId, + getParentNodeInSpan, + getRefactorContextSpan, + getRenameLocation, + getSymbolId, + getSynthesizedDeepClone, + getThisContainer, + getUniqueName, + hasEffectiveModifier, + hasSyntacticModifier, + Identifier, + isArray, + isArrowFunction, + isAssignmentExpression, + isBinaryExpression, + isBlock, + isBlockScope, + isCaseClause, + isClassLike, + isConstructorDeclaration, + isDeclaration, + isDeclarationWithTypeParameters, + isElementAccessExpression, + isExpression, + isExpressionNode, + isExpressionStatement, + isFunctionBody, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isIdentifier, + isInJSFile, + isIterationStatement, + isJsxAttribute, + isJsxElement, + isJsxFragment, + isJsxSelfClosingElement, + isKeyword, + isModuleBlock, + isParenthesizedTypeNode, + isPartOfTypeNode, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyDeclaration, + isQualifiedName, + isReturnStatement, + isShorthandPropertyAssignment, + isSourceFile, + isStatement, + isStatic, + isStringLiteral, + isSwitchStatement, + isThis, + isUnaryExpressionWithWrite, + isUnionTypeNode, + 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, registerRefactor } from "../_namespaces/ts.refactor"; +import { + refactorKindBeginsWith, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Extract Symbol"; diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index 6cb298c0ffe13..5172c5020d8e0 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -1,16 +1,72 @@ import { - addRange, addToSeen, append, ApplicableRefactorInfo, cast, concatenate, createTextRangeFromSpan, Debug, Diagnostics, - EmitFlags, emptyArray, factory, findAncestor, forEach, forEachChild, getEffectiveConstraintOfTypeParameter, - getLineAndCharacterOfPosition, getLocaleSpecificMessage, getNameFromPropertyName, getRefactorContextSpan, - getRenameLocation, getTokenAtPosition, getUniqueName, ignoreSourceNewlines, isConditionalTypeNode, isFunctionLike, - isIdentifier, isInferTypeNode, isIntersectionTypeNode, isJSDocTypeExpression, isParenthesizedTypeNode, - isSourceFileJS, isStatement, isThisIdentifier, isThisTypeNode, isTupleTypeNode, isTypeLiteralNode, isTypeNode, - isTypeParameterDeclaration, isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, JSDocTag, JSDocTemplateTag, - Node, nodeOverlapsWithStartEnd, pushIfUnique, rangeContainsStartEnd, RefactorContext, RefactorEditInfo, - setEmitFlags, setTextRange, skipTrivia, SourceFile, Statement, SymbolFlags, textChanges, TextRange, TypeChecker, - TypeElement, TypeNode, TypeParameterDeclaration, + addRange, + addToSeen, + append, + ApplicableRefactorInfo, + cast, + concatenate, + createTextRangeFromSpan, + Debug, + Diagnostics, + EmitFlags, + emptyArray, + factory, + findAncestor, + forEach, + forEachChild, + getEffectiveConstraintOfTypeParameter, + getLineAndCharacterOfPosition, + getLocaleSpecificMessage, + getNameFromPropertyName, + getRefactorContextSpan, + getRenameLocation, + getTokenAtPosition, + getUniqueName, + ignoreSourceNewlines, + isConditionalTypeNode, + isFunctionLike, + isIdentifier, + isInferTypeNode, + isIntersectionTypeNode, + isJSDocTypeExpression, + isParenthesizedTypeNode, + isSourceFileJS, + isStatement, + isThisIdentifier, + isThisTypeNode, + isTupleTypeNode, + isTypeLiteralNode, + isTypeNode, + isTypeParameterDeclaration, + isTypePredicateNode, + isTypeQueryNode, + isTypeReferenceNode, + JSDocTag, + JSDocTemplateTag, + Node, + nodeOverlapsWithStartEnd, + pushIfUnique, + rangeContainsStartEnd, + RefactorContext, + RefactorEditInfo, + setEmitFlags, + setTextRange, + skipTrivia, + SourceFile, + Statement, + SymbolFlags, + textChanges, + TextRange, + TypeChecker, + TypeElement, + TypeNode, + TypeParameterDeclaration, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + isRefactorErrorInfo, + RefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Extract type"; diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index d8d70a1ea3abf..2982cacd8af7c 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -1,8 +1,18 @@ import { - ApplicableRefactorInfo, codefix, Debug, Diagnostics, emptyArray, getRenameLocation, isIdentifier, isParameter, + ApplicableRefactorInfo, + codefix, + Debug, + Diagnostics, + emptyArray, + getRenameLocation, + isIdentifier, + isParameter, RefactorContext, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + isRefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const actionName = "Generate 'get' and 'set' accessors"; const actionDescription = Diagnostics.Generate_get_and_set_accessors.message; diff --git a/src/services/refactors/inferFunctionReturnType.ts b/src/services/refactors/inferFunctionReturnType.ts index c81a08bf4b164..ccce34a8a14ac 100644 --- a/src/services/refactors/inferFunctionReturnType.ts +++ b/src/services/refactors/inferFunctionReturnType.ts @@ -1,11 +1,37 @@ import { - ApplicableRefactorInfo, ArrowFunction, Diagnostics, emptyArray, factory, findAncestor, findChildOfKind, first, - FunctionDeclaration, FunctionExpression, getLocaleSpecificMessage, getTokenAtPosition, isArrowFunction, isBlock, - isInJSFile, mapDefined, MethodDeclaration, Node, NodeBuilderFlags, RefactorContext, RefactorEditInfo, SourceFile, - SyntaxKind, textChanges, Type, TypeChecker, TypeNode, + ApplicableRefactorInfo, + ArrowFunction, + Diagnostics, + emptyArray, + factory, + findAncestor, + findChildOfKind, + first, + FunctionDeclaration, + FunctionExpression, + getLocaleSpecificMessage, + getTokenAtPosition, + isArrowFunction, + isBlock, + isInJSFile, + mapDefined, + MethodDeclaration, + Node, + NodeBuilderFlags, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, + textChanges, + Type, + TypeChecker, + TypeNode, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, refactorKindBeginsWith, registerRefactor, + isRefactorErrorInfo, + RefactorErrorInfo, + refactorKindBeginsWith, + registerRefactor, } from "../_namespaces/ts.refactor"; const refactorName = "Infer function return type"; diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 58687f7b7cb57..937c31edadd7f 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -1,25 +1,131 @@ import { - AnyImportOrRequireStatement, append, ApplicableRefactorInfo, AssignmentDeclarationKind, BinaryExpression, - BindingElement, BindingName, CallExpression, canHaveDecorators, canHaveModifiers, cast, ClassDeclaration, codefix, - combinePaths, concatenate, contains, copyEntries, createTextRangeFromSpan, Debug, Declaration, DeclarationStatement, - Diagnostics, emptyArray, ensurePathIsNonModuleName, EnumDeclaration, escapeLeadingUnderscores, Expression, - ExpressionStatement, extensionFromPath, ExternalModuleReference, factory, find, FindAllReferences, findIndex, - firstDefined, flatMap, forEachEntry, FunctionDeclaration, getAssignmentDeclarationKind, getBaseFileName, - GetCanonicalFileName, getDecorators, getDirectoryPath, getLocaleSpecificMessage, getModifiers, - getPropertySymbolFromBindingElement, getQuotePreference, getRangesWhere, getRefactorContextSpan, - getRelativePathFromFile, getSymbolId, getUniqueName, hasSyntacticModifier, hostGetCanonicalFileName, Identifier, - ImportDeclaration, ImportEqualsDeclaration, insertImports, InterfaceDeclaration, InternalSymbolName, - isArrayLiteralExpression, isBinaryExpression, isBindingElement, isDeclarationName, isExpressionStatement, - isExternalModuleReference, isIdentifier, isImportDeclaration, isImportEqualsDeclaration, isNamedDeclaration, - isObjectLiteralExpression, isOmittedExpression, isPrologueDirective, isPropertyAccessExpression, - isPropertyAssignment, isRequireCall, isSourceFile, isStringLiteral, isStringLiteralLike, isVariableDeclaration, - isVariableDeclarationList, isVariableStatement, LanguageServiceHost, last, length, makeImportIfNecessary, - mapDefined, ModifierFlags, ModifierLike, ModuleDeclaration, NamedImportBindings, Node, NodeFlags, nodeSeenTracker, - normalizePath, ObjectBindingElementWithoutPropertyName, Program, PropertyAccessExpression, PropertyAssignment, - QuotePreference, rangeContainsRange, RefactorContext, RefactorEditInfo, removeFileExtension, RequireOrImportCall, - RequireVariableStatement, ScriptTarget, skipAlias, some, SourceFile, Statement, StringLiteralLike, Symbol, - SymbolFlags, symbolNameNoDefault, SyntaxKind, takeWhile, textChanges, TransformFlags, tryCast, TypeAliasDeclaration, - TypeChecker, TypeNode, UserPreferences, VariableDeclaration, VariableDeclarationList, VariableStatement, + AnyImportOrRequireStatement, + append, + ApplicableRefactorInfo, + AssignmentDeclarationKind, + BinaryExpression, + BindingElement, + BindingName, + CallExpression, + canHaveDecorators, + canHaveModifiers, + cast, + ClassDeclaration, + codefix, + combinePaths, + concatenate, + contains, + copyEntries, + createTextRangeFromSpan, + Debug, + Declaration, + DeclarationStatement, + Diagnostics, + emptyArray, + ensurePathIsNonModuleName, + EnumDeclaration, + escapeLeadingUnderscores, + Expression, + ExpressionStatement, + extensionFromPath, + ExternalModuleReference, + factory, + find, + FindAllReferences, + findIndex, + firstDefined, + flatMap, + forEachEntry, + FunctionDeclaration, + getAssignmentDeclarationKind, + getBaseFileName, + GetCanonicalFileName, + getDecorators, + getDirectoryPath, + getLocaleSpecificMessage, + getModifiers, + getPropertySymbolFromBindingElement, + getQuotePreference, + getRangesWhere, + getRefactorContextSpan, + getRelativePathFromFile, + getSymbolId, + getUniqueName, + hasSyntacticModifier, + hostGetCanonicalFileName, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + insertImports, + InterfaceDeclaration, + InternalSymbolName, + isArrayLiteralExpression, + isBinaryExpression, + isBindingElement, + isDeclarationName, + isExpressionStatement, + isExternalModuleReference, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isNamedDeclaration, + isObjectLiteralExpression, + isOmittedExpression, + isPrologueDirective, + isPropertyAccessExpression, + isPropertyAssignment, + isRequireCall, + isSourceFile, + isStringLiteral, + isStringLiteralLike, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + LanguageServiceHost, + last, + length, + makeImportIfNecessary, + mapDefined, + ModifierFlags, + ModifierLike, + ModuleDeclaration, + NamedImportBindings, + Node, + NodeFlags, + nodeSeenTracker, + normalizePath, + ObjectBindingElementWithoutPropertyName, + Program, + PropertyAccessExpression, + PropertyAssignment, + QuotePreference, + rangeContainsRange, + RefactorContext, + RefactorEditInfo, + removeFileExtension, + RequireOrImportCall, + RequireVariableStatement, + ScriptTarget, + skipAlias, + some, + SourceFile, + Statement, + StringLiteralLike, + Symbol, + SymbolFlags, + symbolNameNoDefault, + SyntaxKind, + takeWhile, + textChanges, + TransformFlags, + tryCast, + TypeAliasDeclaration, + TypeChecker, + TypeNode, + UserPreferences, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/rename.ts b/src/services/rename.ts index 7508c150d41b4..52ee0b8a3f544 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -1,13 +1,56 @@ import { - compareStringsCaseSensitive, Comparison, createTextSpan, DiagnosticMessage, Diagnostics, endsWith, every, Extension, - fileExtensionIs, find, getAdjustedRenameLocation, getContextualTypeFromParentOrAncestorTypeNode, - getLocaleSpecificMessage, getPathComponents, getTextOfIdentifierOrLiteral, getTextOfNode, getTouchingPropertyName, - ImportSpecifier, isExternalModuleNameRelative, isIdentifier, isImportOrExportSpecifierName, isImportSpecifier, - isInsideNodeModules, isLabelName, isLiteralNameOfPropertyDeclarationOrIndexAccess, 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, + compareStringsCaseSensitive, + Comparison, + createTextSpan, + DiagnosticMessage, + Diagnostics, + endsWith, + every, + Extension, + fileExtensionIs, + find, + getAdjustedRenameLocation, + getContextualTypeFromParentOrAncestorTypeNode, + getLocaleSpecificMessage, + getPathComponents, + getTextOfIdentifierOrLiteral, + getTextOfNode, + getTouchingPropertyName, + ImportSpecifier, + isExternalModuleNameRelative, + isIdentifier, + isImportOrExportSpecifierName, + isImportSpecifier, + isInsideNodeModules, + isLabelName, + isLiteralNameOfPropertyDeclarationOrIndexAccess, + 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 ac4c3bb15c1d5..41b3c78172ad1 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,59 +2,322 @@ 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, BaseType, - BinaryExpression, BreakpointResolver, CallHierarchy, CallHierarchyIncomingCall, 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, - DocumentSpan, EditorOptions, EditorSettings, ElementAccessExpression, EmitTextWriter, emptyArray, emptyOptions, - EndOfFileToken, EntityName, equateValues, ExportDeclaration, FileReference, FileTextChanges, filter, find, - FindAllReferences, findChildOfKind, findPrecedingToken, first, firstDefined, firstOrOnly, flatMap, forEach, - forEachChild, FormatCodeOptions, FormatCodeSettings, formatting, FunctionLikeDeclaration, GeneratedIdentifierFlags, - getAdjustedRenameLocation, getAllSuperTypeNodes, getAssignmentDeclarationKind, GetCompletionsAtPositionOptions, - getContainerNode, getDefaultLibFileName, getDirectoryPath, getEmitDeclarations, getEntries, - getEscapedTextOfIdentifierOrLiteral, getFileEmitOutput, getImpliedNodeFormatForFile, getJSDocTags, - getLineAndCharacterOfPosition, getLineStarts, getMappedDocumentSpan, getNameFromPropertyName, getNewLineCharacter, - getNewLineOrDefaultFromHost, getNonAssignedNameOfDeclaration, getNormalizedAbsolutePath, getObjectFlags, - getScriptKind, getSetExternalModuleIndicator, getSnapshotText, getSourceFileOfNode, getSourceMapper, - getTokenPosOfNode, getTouchingPropertyName, getTouchingToken, GoToDefinition, HasInvalidatedResolutions, - hasJSDocNodes, hasProperty, hasStaticModifier, hasSyntacticModifier, HighlightSpanKind, HostCancellationToken, - hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, Identifier, identity, idText, ImplementationLocation, - ImportDeclaration, IndexKind, IndexType, InlayHint, InlayHints, InlayHintsContext, insertSorted, InterfaceType, - IntersectionType, isArray, isBindingPattern, isComputedPropertyName, isConstTypeReference, IScriptSnapshot, - isDeclarationName, isGetAccessor, isIdentifier, isImportMeta, isInComment, isInsideJsxElement, - isInsideJsxElementOrAttribute, isInString, isInTemplateString, isIntrinsicJsxName, isJSDocCommentContainingNode, - isJsxAttributes, isJsxClosingElement, isJsxElement, isJsxFragment, isJsxOpeningElement, isJsxOpeningFragment, - isJsxText, isLabelName, isLiteralComputedPropertyDeclarationName, isNamedExports, isNamedTupleMember, - isNameOfModuleDeclaration, isNewExpression, isNodeKind, isObjectLiteralElement, isObjectLiteralExpression, - isPrivateIdentifier, isProgramUptoDate, isPropertyAccessExpression, isPropertyName, isRightSideOfPropertyAccess, - isRightSideOfQualifiedName, isSetAccessor, isStringOrNumericLiteralLike, isTagName, isTextWhiteSpaceLike, - isThisTypeParameter, JsDoc, JSDoc, JSDocContainer, JSDocTagInfo, JsonSourceFile, JsxAttributes, JsxClosingTagInfo, - JsxElement, JsxEmit, JsxFragment, LanguageService, LanguageServiceHost, LanguageServiceMode, LanguageVariant, - lastOrUndefined, length, LineAndCharacter, lineBreakPart, LiteralType, map, mapDefined, MapLike, mapOneOrMany, - maybeBind, maybeSetLocalizedDiagnosticMessages, ModeAwareCache, ModifierFlags, ModuleDeclaration, NavigateToItem, - NavigationBarItem, NavigationTree, Node, NodeArray, NodeFlags, noop, normalizePath, NumberLiteralType, - NumericLiteral, ObjectAllocator, ObjectFlags, ObjectLiteralElement, ObjectLiteralExpression, - OperationCanceledException, OrganizeImports, OrganizeImportsArgs, OrganizeImportsMode, OutliningElementsCollector, - OutliningSpan, ParseConfigFileHost, ParsedCommandLine, parseJsonSourceFileConfigFileContent, Path, - positionIsSynthesized, PossibleProgramFileInfo, PragmaMap, PrivateIdentifier, Program, PropertyName, Push, - QuickInfo, refactor, RefactorContext, RefactorEditInfo, RefactorTriggerReason, ReferencedSymbol, ReferenceEntry, - Rename, RenameInfo, RenameInfoOptions, RenameLocation, ResolvedModuleFull, ResolvedProjectReference, - ResolvedTypeReferenceDirective, returnFalse, scanner, ScriptElementKind, ScriptElementKindModifier, ScriptKind, - ScriptTarget, SelectionRange, SemanticClassificationFormat, setObjectAllocator, Signature, - SignatureDeclaration, SignatureFlags, SignatureHelp, SignatureHelpItems, SignatureHelpItemsOptions, SignatureKind, - singleElementArray, SmartSelectionRange, SortedArray, SourceFile, SourceFileLike, SourceMapSource, Statement, - stringContains, StringLiteral, StringLiteralLike, StringLiteralType, Symbol, SymbolDisplay, SymbolDisplayPart, - SymbolFlags, symbolName, SyntaxKind, SyntaxList, tagNamesAreEquivalent, TextChange, TextChangeRange, TextInsertion, - TextRange, TextSpan, textSpanEnd, timestamp, TodoComment, TodoCommentDescriptor, Token, toPath, tracing, - TransformFlags, TransientSymbol, Type, TypeChecker, TypeFlags, TypeNode, TypeParameter, TypePredicate, - TypeReference, typeToDisplayParts, UnderscoreEscapedMap, UnionOrIntersectionType, UnionType, updateSourceFile, - UserPreferences, VariableDeclaration, + __String, + ApplicableRefactorInfo, + ApplyCodeActionCommandResult, + AssignmentDeclarationKind, + BaseType, + BinaryExpression, + BreakpointResolver, + CallHierarchy, + CallHierarchyIncomingCall, + 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, + DocumentSpan, + EditorOptions, + EditorSettings, + ElementAccessExpression, + EmitTextWriter, + emptyArray, + emptyOptions, + EndOfFileToken, + EntityName, + equateValues, + ExportDeclaration, + FileReference, + FileTextChanges, + filter, + find, + FindAllReferences, + findChildOfKind, + findPrecedingToken, + first, + firstDefined, + firstOrOnly, + flatMap, + forEach, + forEachChild, + FormatCodeOptions, + FormatCodeSettings, + formatting, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + getAdjustedRenameLocation, + getAllSuperTypeNodes, + getAssignmentDeclarationKind, + GetCompletionsAtPositionOptions, + getContainerNode, + getDefaultLibFileName, + getDirectoryPath, + getEmitDeclarations, + getEntries, + getEscapedTextOfIdentifierOrLiteral, + getFileEmitOutput, + getImpliedNodeFormatForFile, + getJSDocTags, + getLineAndCharacterOfPosition, + getLineStarts, + getMappedDocumentSpan, + getNameFromPropertyName, + getNewLineCharacter, + getNewLineOrDefaultFromHost, + getNonAssignedNameOfDeclaration, + getNormalizedAbsolutePath, + getObjectFlags, + getScriptKind, + getSetExternalModuleIndicator, + getSnapshotText, + getSourceFileOfNode, + getSourceMapper, + getTokenPosOfNode, + getTouchingPropertyName, + getTouchingToken, + GoToDefinition, + HasInvalidatedResolutions, + hasJSDocNodes, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, + HighlightSpanKind, + HostCancellationToken, + hostGetCanonicalFileName, + hostUsesCaseSensitiveFileNames, + Identifier, + identity, + idText, + ImplementationLocation, + ImportDeclaration, + IndexKind, + IndexType, + InlayHint, + InlayHints, + InlayHintsContext, + insertSorted, + InterfaceType, + IntersectionType, + isArray, + isBindingPattern, + isComputedPropertyName, + isConstTypeReference, + IScriptSnapshot, + isDeclarationName, + isGetAccessor, + isIdentifier, + isImportMeta, + isInComment, + isInsideJsxElement, + isInsideJsxElementOrAttribute, + isInString, + isInTemplateString, + isIntrinsicJsxName, + isJSDocCommentContainingNode, + isJsxAttributes, + isJsxClosingElement, + isJsxElement, + isJsxFragment, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxText, + isLabelName, + isLiteralComputedPropertyDeclarationName, + isNamedExports, + isNamedTupleMember, + isNameOfModuleDeclaration, + isNewExpression, + isNodeKind, + isObjectLiteralElement, + isObjectLiteralExpression, + isPrivateIdentifier, + isProgramUptoDate, + isPropertyAccessExpression, + isPropertyName, + isRightSideOfPropertyAccess, + isRightSideOfQualifiedName, + isSetAccessor, + isStringOrNumericLiteralLike, + isTagName, + isTextWhiteSpaceLike, + isThisTypeParameter, + JsDoc, + JSDoc, + JSDocContainer, + JSDocTagInfo, + JsonSourceFile, + JsxAttributes, + JsxClosingTagInfo, + JsxElement, + JsxEmit, + JsxFragment, + LanguageService, + LanguageServiceHost, + LanguageServiceMode, + LanguageVariant, + lastOrUndefined, + length, + LineAndCharacter, + lineBreakPart, + LiteralType, + map, + mapDefined, + MapLike, + mapOneOrMany, + maybeBind, + maybeSetLocalizedDiagnosticMessages, + ModeAwareCache, + ModifierFlags, + ModuleDeclaration, + NavigateToItem, + NavigationBarItem, + NavigationTree, + Node, + NodeArray, + NodeFlags, + noop, + normalizePath, + NumberLiteralType, + NumericLiteral, + ObjectAllocator, + ObjectFlags, + ObjectLiteralElement, + ObjectLiteralExpression, + OperationCanceledException, + OrganizeImports, + OrganizeImportsArgs, + OrganizeImportsMode, + OutliningElementsCollector, + OutliningSpan, + ParseConfigFileHost, + ParsedCommandLine, + parseJsonSourceFileConfigFileContent, + Path, + positionIsSynthesized, + PossibleProgramFileInfo, + PragmaMap, + PrivateIdentifier, + Program, + PropertyName, + Push, + QuickInfo, + refactor, + RefactorContext, + RefactorEditInfo, + RefactorTriggerReason, + ReferencedSymbol, + ReferenceEntry, + Rename, + RenameInfo, + RenameInfoOptions, + RenameLocation, + ResolvedModuleFull, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + returnFalse, + scanner, + ScriptElementKind, + ScriptElementKindModifier, + ScriptKind, + ScriptTarget, + SelectionRange, + SemanticClassificationFormat, + setObjectAllocator, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureHelp, + SignatureHelpItems, + SignatureHelpItemsOptions, + SignatureKind, + singleElementArray, + SmartSelectionRange, + SortedArray, + SourceFile, + SourceFileLike, + SourceMapSource, + Statement, + stringContains, + StringLiteral, + StringLiteralLike, + StringLiteralType, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolFlags, + symbolName, + SyntaxKind, + SyntaxList, + tagNamesAreEquivalent, + TextChange, + TextChangeRange, + TextInsertion, + TextRange, + TextSpan, + textSpanEnd, + timestamp, + TodoComment, + TodoCommentDescriptor, + Token, + toPath, + tracing, + TransformFlags, + TransientSymbol, + Type, + TypeChecker, + TypeFlags, + TypeNode, + TypeParameter, + TypePredicate, + TypeReference, + typeToDisplayParts, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionType, + updateSourceFile, + UserPreferences, + VariableDeclaration, } from "./_namespaces/ts"; /** The version of the language service API */ diff --git a/src/services/shims.ts b/src/services/shims.ts index 50849ae0875db..64b1fe0f624b0 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1,16 +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, timestamp, toFileNameLowerCase, toPath, TypeAcquisition, UserPreferences, + 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, + timestamp, + toFileNameLowerCase, + toPath, + TypeAcquisition, + UserPreferences, } from "./_namespaces/ts"; // diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index cf672d0699634..1ca1b0ae6dd15 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -1,17 +1,85 @@ import { - ArrowFunction, BinaryExpression, CallLikeExpression, CancellationToken, CheckFlags, contains, countWhere, - createPrinter, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, Debug, EmitHint, emptyArray, - Expression, factory, findContainingList, findIndex, findPrecedingToken, findTokenOnLeftOfPosition, first, - firstDefined, flatMapToMutable, FunctionExpression, getInvokedExpression, getPossibleGenericSignatures, - getPossibleTypeArgumentsInfo, Identifier, identity, InternalSymbolName, isBinaryExpression, isBlock, - isCallOrNewExpression, isFunctionTypeNode, isIdentifier, isInComment, isInsideTemplateLiteral, isInString, - isJsxOpeningLikeElement, isMethodDeclaration, isNoSubstitutionTemplateLiteral, isPropertyAccessExpression, - isSourceFile, isSourceFileJS, isTaggedTemplateExpression, isTemplateHead, isTemplateLiteralToken, isTemplateSpan, - isTemplateTail, last, lastOrUndefined, ListFormat, map, mapToDisplayParts, Node, NodeBuilderFlags, - ParameterDeclaration, ParenthesizedExpression, Printer, Program, punctuationPart, rangeContainsRange, Signature, - SignatureHelpItem, SignatureHelpItems, SignatureHelpParameter, SignatureHelpTriggerReason, skipTrivia, SourceFile, - spacePart, Symbol, SymbolDisplayPart, symbolToDisplayParts, SyntaxKind, TaggedTemplateExpression, - TemplateExpression, TextSpan, TransientSymbol, Type, TypeChecker, TypeParameter, + ArrowFunction, + BinaryExpression, + CallLikeExpression, + CancellationToken, + CheckFlags, + contains, + countWhere, + createPrinter, + createTextSpan, + createTextSpanFromBounds, + createTextSpanFromNode, + Debug, + EmitHint, + emptyArray, + Expression, + factory, + findContainingList, + findIndex, + findPrecedingToken, + findTokenOnLeftOfPosition, + first, + firstDefined, + flatMapToMutable, + FunctionExpression, + getInvokedExpression, + getPossibleGenericSignatures, + getPossibleTypeArgumentsInfo, + Identifier, + identity, + InternalSymbolName, + isBinaryExpression, + isBlock, + isCallOrNewExpression, + isFunctionTypeNode, + isIdentifier, + isInComment, + isInsideTemplateLiteral, + isInString, + isJsxOpeningLikeElement, + isMethodDeclaration, + isNoSubstitutionTemplateLiteral, + isPropertyAccessExpression, + isSourceFile, + isSourceFileJS, + isTaggedTemplateExpression, + isTemplateHead, + isTemplateLiteralToken, + isTemplateSpan, + isTemplateTail, + last, + lastOrUndefined, + ListFormat, + map, + mapToDisplayParts, + Node, + NodeBuilderFlags, + ParameterDeclaration, + ParenthesizedExpression, + Printer, + Program, + punctuationPart, + rangeContainsRange, + Signature, + SignatureHelpItem, + SignatureHelpItems, + SignatureHelpParameter, + SignatureHelpTriggerReason, + skipTrivia, + SourceFile, + spacePart, + Symbol, + SymbolDisplayPart, + symbolToDisplayParts, + SyntaxKind, + TaggedTemplateExpression, + TemplateExpression, + TextSpan, + TransientSymbol, + Type, + TypeChecker, + TypeParameter, } from "./_namespaces/ts"; const enum InvocationKind { Call, TypeArgs, Contextual } diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index 04ffc73c4b10a..0e67fba79a386 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -1,12 +1,51 @@ import { - CharacterCodes, compact, contains, createTextSpanFromBounds, Debug, findIndex, first, getTokenPosOfNode, - getTouchingPropertyName, getTrailingCommentRanges, hasJSDocNodes, isBindingElement, isBlock, isFunctionBody, - isFunctionLikeDeclaration, isImportDeclaration, isImportEqualsDeclaration, isJSDocSignature, isJSDocTypeExpression, - isJSDocTypeLiteral, isMappedTypeNode, isParameter, isPropertySignature, isSourceFile, isStringLiteral, isSyntaxList, - isTemplateHead, isTemplateLiteral, isTemplateMiddleOrTemplateTail, isTemplateSpan, isTemplateTail, - isVariableDeclaration, isVariableDeclarationList, isVariableStatement, last, Node, or, parseNodeFactory, - positionsAreOnSameLine, SelectionRange, setTextRangePosEnd, singleOrUndefined, SourceFile, SyntaxKind, SyntaxList, - textSpanIntersectsWithPosition, textSpansEqual, + CharacterCodes, + compact, + contains, + createTextSpanFromBounds, + Debug, + findIndex, + first, + getTokenPosOfNode, + getTouchingPropertyName, + getTrailingCommentRanges, + hasJSDocNodes, + isBindingElement, + isBlock, + isFunctionBody, + isFunctionLikeDeclaration, + isImportDeclaration, + isImportEqualsDeclaration, + isJSDocSignature, + isJSDocTypeExpression, + isJSDocTypeLiteral, + isMappedTypeNode, + isParameter, + isPropertySignature, + isSourceFile, + isStringLiteral, + isSyntaxList, + isTemplateHead, + isTemplateLiteral, + isTemplateMiddleOrTemplateTail, + isTemplateSpan, + isTemplateTail, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + last, + Node, + or, + parseNodeFactory, + positionsAreOnSameLine, + SelectionRange, + setTextRangePosEnd, + singleOrUndefined, + SourceFile, + SyntaxKind, + SyntaxList, + textSpanIntersectsWithPosition, + textSpansEqual, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index ba242bed8559c..e77fe30e4acf1 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -1,10 +1,30 @@ import * as ts from "./_namespaces/ts"; import { - base64decode, computeLineAndCharacterOfPosition, createDocumentPositionMapper, createGetCanonicalFileName, - DocumentPosition, DocumentPositionMapper, DocumentPositionMapperHost, Extension, - getDeclarationEmitOutputFilePathWorker, getDirectoryPath, getLineInfo, getLineStarts, getNormalizedAbsolutePath, - identitySourceMapConsumer, isDeclarationFileName, isString, LineAndCharacter, LineInfo, outFile, Program, - removeFileExtension, SourceFileLike, sys, tryGetSourceMappingURL, tryParseRawSourceMap, + base64decode, + computeLineAndCharacterOfPosition, + createDocumentPositionMapper, + createGetCanonicalFileName, + DocumentPosition, + DocumentPositionMapper, + DocumentPositionMapperHost, + Extension, + getDeclarationEmitOutputFilePathWorker, + getDirectoryPath, + getLineInfo, + getLineStarts, + getNormalizedAbsolutePath, + identitySourceMapConsumer, + isDeclarationFileName, + isString, + LineAndCharacter, + LineInfo, + outFile, + Program, + removeFileExtension, + SourceFileLike, + sys, + tryGetSourceMappingURL, + tryParseRawSourceMap, } from "./_namespaces/ts"; const base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 3dc68ff39b633..c319ad3b8e92a 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -1,32 +1,155 @@ import { - 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, findAncestor, findPackageJson, - findPackageJsons, firstDefined, firstOrUndefined, flatMap, flatten, forEachAncestorDirectory, getBaseFileName, - getContextualTypeFromParent, getDirectoryPath, getEffectiveTypeRoots, getEmitModuleResolutionKind, - getLeadingCommentRanges, getModeForUsageLocation, getOwnKeys, getPackageJsonTypesVersionsPaths, getPathComponents, - getReplacementSpanForContextToken, getSupportedExtensions, getSupportedExtensionsWithJsonIfResolveJsonModule, - getTokenAtPosition, hasIndexSignature, hasProperty, hasTrailingDirectorySeparator, hostGetCanonicalFileName, - IndexedAccessTypeNode, isApplicableVersionedTypesKey, isArray, isCallExpression, isIdentifier, isIdentifierText, - isImportCall, isInReferenceComment, isInString, isJsxAttribute, isJsxOpeningLikeElement, isLiteralTypeNode, - isObjectLiteralExpression, isPatternMatch, isPrivateIdentifierClassElementDeclaration, isRootedDiskPath, isString, - isStringLiteral, isStringLiteralLike, isTypeReferenceNode, isUrl, JsxAttribute, LanguageServiceHost, - length, LiteralExpression, LiteralTypeNode, mapDefined, MapLike, ModuleKind, ModuleResolutionKind, - moduleSpecifiers, Node, normalizePath, normalizeSlashes, ObjectLiteralExpression, Path, Program, PropertyAssignment, - rangeContainsPosition, readJson, removeFileExtension, removePrefix, removeTrailingDirectorySeparator, ResolutionMode, resolvePath, - ScriptElementKind, ScriptElementKindModifier, ScriptTarget, Signature, signatureHasRestParameter, SignatureHelp, - singleElementArray, skipConstraint, skipParentheses, SourceFile, startsWith, stringContains, StringLiteralLike, - StringLiteralType, stripQuotes, Symbol, SyntaxKind, textPart, TextSpan, tryAndIgnoreErrors, tryDirectoryExists, - tryFileExists, tryGetDirectories, tryGetExtensionFromPath, tryParsePattern, tryReadDirectory, - tryRemoveDirectoryPrefix, tryRemovePrefix, Type, TypeChecker, TypeFlags, UnionTypeNode, unmangleScopedPackageName, - UserPreferences, walkUpParenthesizedExpressions, walkUpParenthesizedTypes, + 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, + findAncestor, + findPackageJson, + findPackageJsons, + firstDefined, + firstOrUndefined, + flatMap, + flatten, + forEachAncestorDirectory, + getBaseFileName, + getContextualTypeFromParent, + getDirectoryPath, + getEffectiveTypeRoots, + getEmitModuleResolutionKind, + getLeadingCommentRanges, + getModeForUsageLocation, + getOwnKeys, + getPackageJsonTypesVersionsPaths, + getPathComponents, + getReplacementSpanForContextToken, + getSupportedExtensions, + getSupportedExtensionsWithJsonIfResolveJsonModule, + getTokenAtPosition, + hasIndexSignature, + hasProperty, + hasTrailingDirectorySeparator, + hostGetCanonicalFileName, + IndexedAccessTypeNode, + isApplicableVersionedTypesKey, + isArray, + isCallExpression, + isIdentifier, + isIdentifierText, + isImportCall, + isInReferenceComment, + isInString, + isJsxAttribute, + isJsxOpeningLikeElement, + isLiteralTypeNode, + isObjectLiteralExpression, + isPatternMatch, + isPrivateIdentifierClassElementDeclaration, + isRootedDiskPath, + isString, + isStringLiteral, + isStringLiteralLike, + isTypeReferenceNode, + isUrl, + JsxAttribute, + LanguageServiceHost, + length, + LiteralExpression, + LiteralTypeNode, + mapDefined, + MapLike, + ModuleKind, + ModuleResolutionKind, + moduleSpecifiers, + Node, + normalizePath, + normalizeSlashes, + ObjectLiteralExpression, + Path, + Program, + PropertyAssignment, + rangeContainsPosition, + readJson, + removeFileExtension, + removePrefix, + removeTrailingDirectorySeparator, + ResolutionMode, + resolvePath, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + Signature, + signatureHasRestParameter, + SignatureHelp, + singleElementArray, + skipConstraint, + skipParentheses, + SourceFile, + startsWith, + stringContains, + StringLiteralLike, + StringLiteralType, + stripQuotes, + Symbol, + SyntaxKind, + textPart, + TextSpan, + tryAndIgnoreErrors, + tryDirectoryExists, + tryFileExists, + tryGetDirectories, + tryGetExtensionFromPath, + tryParsePattern, + tryReadDirectory, + tryRemoveDirectoryPrefix, + tryRemovePrefix, + Type, + TypeChecker, + TypeFlags, + UnionTypeNode, + unmangleScopedPackageName, + UserPreferences, + walkUpParenthesizedExpressions, + walkUpParenthesizedTypes, } from "./_namespaces/ts"; import { - CompletionKind, createCompletionDetails, createCompletionDetailsForSymbol, getCompletionEntriesFromSymbols, - getPropertiesForObjectExpression, Log, SortText, + CompletionKind, + 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 4fc0b29a9cede..3c242e580766c 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -1,14 +1,63 @@ import { - addRange, AnyValidImportOrReExport, ArrowFunction, AssignmentDeclarationKind, Block, CallExpression, - CancellationToken, codefix, compilerOptionsIndicateEsModules, createDiagnosticForNode, Diagnostics, - DiagnosticWithLocation, Expression, ExpressionStatement, Extension, fileExtensionIsOneOf, forEachReturnStatement, - FunctionDeclaration, FunctionExpression, FunctionFlags, FunctionLikeDeclaration, getAllowSyntheticDefaultImports, - getAssignmentDeclarationKind, getFunctionFlags, getModeForUsageLocation, getResolvedModule, hasInitializer, - hasPropertyAccessExpressionWithName, Identifier, importFromModuleSpecifier, isAsyncFunction, isBinaryExpression, - isBlock, isCallExpression, isExportAssignment, isFunctionLike, isIdentifier, isPropertyAccessExpression, - isRequireCall, isReturnStatement, isSourceFileJS, isStringLiteral, isVariableDeclaration, isVariableStatement, - MethodDeclaration, ModuleKind, Node, NodeFlags, Program, programContainsEsModules, PropertyAccessExpression, Push, - ReturnStatement, skipAlias, some, SourceFile, SyntaxKind, TypeChecker, VariableStatement, + addRange, + AnyValidImportOrReExport, + ArrowFunction, + AssignmentDeclarationKind, + Block, + CallExpression, + CancellationToken, + codefix, + compilerOptionsIndicateEsModules, + createDiagnosticForNode, + Diagnostics, + DiagnosticWithLocation, + Expression, + ExpressionStatement, + Extension, + fileExtensionIsOneOf, + forEachReturnStatement, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + getAllowSyntheticDefaultImports, + getAssignmentDeclarationKind, + getFunctionFlags, + getModeForUsageLocation, + getResolvedModule, + hasInitializer, + hasPropertyAccessExpressionWithName, + Identifier, + importFromModuleSpecifier, + isAsyncFunction, + isBinaryExpression, + isBlock, + isCallExpression, + isExportAssignment, + isFunctionLike, + isIdentifier, + isPropertyAccessExpression, + isRequireCall, + isReturnStatement, + isSourceFileJS, + 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 b31c32e592c4a..fff0b69e39eb0 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -1,22 +1,111 @@ import { - addRange, arrayFrom, BinaryExpression, CallExpression, CheckFlags, contains, createPrinter, Debug, displayPart, - EmitHint, emptyArray, EnumMember, ExportAssignment, find, first, firstDefined, forEach, GetAccessorDeclaration, - getCombinedLocalAndExportSymbolFlags, getDeclarationOfKind, getExternalModuleImportEqualsDeclarationExpression, - getMeaningFromLocation, getNameOfDeclaration, getNodeModifiers, getObjectFlags, getParseTreeNode, - getSourceFileOfNode, getTextOfConstantValue, getTextOfIdentifierOrLiteral, getTextOfNode, hasSyntacticModifier, - idText, ImportEqualsDeclaration, isArrowFunction, isBindingElement, isCallExpression, isCallExpressionTarget, - isCallOrNewExpression, isClassExpression, isConstTypeReference, isDeprecatedDeclaration, isEnumConst, - isEnumDeclaration, isExpression, isExternalModuleImportEqualsDeclaration, isFirstDeclarationOfSymbolParameter, - isFunctionBlock, isFunctionExpression, isFunctionLike, isFunctionLikeKind, isIdentifier, isInExpressionContext, - isJsxOpeningLikeElement, isLet, isModuleWithStringLiteralName, isNameOfFunctionDeclaration, isNewExpressionTarget, - isObjectBindingPattern, isTaggedTemplateExpression, isThisInTypeQuery, isVarConst, JSDocTagInfo, - JsxOpeningLikeElement, keywordPart, length, lineBreakPart, ListFormat, mapToDisplayParts, ModifierFlags, - ModuleDeclaration, NewExpression, Node, NodeBuilderFlags, ObjectFlags, operatorPart, Printer, - PropertyAccessExpression, PropertyDeclaration, punctuationPart, ScriptElementKind, ScriptElementKindModifier, - SemanticMeaning, SetAccessorDeclaration, Signature, SignatureDeclaration, SignatureFlags, - signatureToDisplayParts, some, SourceFile, spacePart, Symbol, SymbolDisplayPart, SymbolDisplayPartKind, SymbolFlags, - SymbolFormatFlags, symbolToDisplayParts, SyntaxKind, TaggedTemplateExpression, textOrKeywordPart, textPart, - TransientSymbol, Type, TypeChecker, TypeFormatFlags, TypeParameter, typeToDisplayParts, VariableDeclaration, + addRange, + arrayFrom, + BinaryExpression, + CallExpression, + CheckFlags, + contains, + createPrinter, + Debug, + displayPart, + EmitHint, + emptyArray, + EnumMember, + ExportAssignment, + find, + first, + firstDefined, + forEach, + GetAccessorDeclaration, + getCombinedLocalAndExportSymbolFlags, + getDeclarationOfKind, + getExternalModuleImportEqualsDeclarationExpression, + getMeaningFromLocation, + getNameOfDeclaration, + getNodeModifiers, + getObjectFlags, + getParseTreeNode, + getSourceFileOfNode, + getTextOfConstantValue, + getTextOfIdentifierOrLiteral, + getTextOfNode, + hasSyntacticModifier, + idText, + ImportEqualsDeclaration, + isArrowFunction, + isBindingElement, + isCallExpression, + isCallExpressionTarget, + isCallOrNewExpression, + isClassExpression, + isConstTypeReference, + isDeprecatedDeclaration, + isEnumConst, + isEnumDeclaration, + isExpression, + isExternalModuleImportEqualsDeclaration, + isFirstDeclarationOfSymbolParameter, + isFunctionBlock, + isFunctionExpression, + isFunctionLike, + isFunctionLikeKind, + isIdentifier, + isInExpressionContext, + isJsxOpeningLikeElement, + isLet, + isModuleWithStringLiteralName, + isNameOfFunctionDeclaration, + isNewExpressionTarget, + isObjectBindingPattern, + isTaggedTemplateExpression, + isThisInTypeQuery, + isVarConst, + JSDocTagInfo, + JsxOpeningLikeElement, + keywordPart, + length, + lineBreakPart, + ListFormat, + mapToDisplayParts, + ModifierFlags, + ModuleDeclaration, + NewExpression, + Node, + NodeBuilderFlags, + ObjectFlags, + operatorPart, + Printer, + PropertyAccessExpression, + PropertyDeclaration, + punctuationPart, + ScriptElementKind, + ScriptElementKindModifier, + SemanticMeaning, + SetAccessorDeclaration, + Signature, + SignatureDeclaration, + SignatureFlags, + signatureToDisplayParts, + some, + SourceFile, + spacePart, + Symbol, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolFormatFlags, + symbolToDisplayParts, + SyntaxKind, + TaggedTemplateExpression, + textOrKeywordPart, + textPart, + TransientSymbol, + Type, + TypeChecker, + TypeFormatFlags, + TypeParameter, + typeToDisplayParts, + VariableDeclaration, } from "./_namespaces/ts"; const symbolDisplayNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope; diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index ddf9c67cd1976..98a35af0fe3e0 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -1,31 +1,172 @@ import { - addToSeen, ArrowFunction, BindingElement, CharacterCodes, ClassElement, ClassExpression, ClassLikeDeclaration, - CommentRange, concatenate, ConstructorDeclaration, contains, createNodeFactory, createPrinter, createRange, - createSourceFile, createTextChange, createTextRangeFromSpan, createTextSpan, createTextSpanFromRange, - createTextWriter, Debug, DeclarationStatement, EmitHint, EmitTextWriter, endsWith, Expression, factory, - FileTextChanges, filter, find, findChildOfKind, findLastIndex, findNextToken, findPrecedingToken, first, - firstOrUndefined, flatMap, flatMapToMutable, formatting, FunctionDeclaration, FunctionExpression, getAncestor, - getFirstNonSpaceCharacterPosition, getFormatCodeSettingsForWriting, getJSDocCommentRanges, getLeadingCommentRanges, - getLineAndCharacterOfPosition, getLineOfLocalPosition, getLineStartPositionForPosition, getNewLineKind, - getNewLineOrDefaultFromHost, getNodeId, getPrecedingNonSpaceCharacterPosition, getScriptKindFromFileName, - getShebang, getStartPositionOfLine, getTokenAtPosition, getTouchingToken, getTrailingCommentRanges, group, HasJSDoc, - hasJSDocNodes, ImportClause, ImportSpecifier, indexOfNode, InterfaceDeclaration, intersperse, isAnyImportSyntax, - isArray, isArrowFunction, isCallExpression, isClassElement, isClassOrTypeElement, isExpressionStatement, - isFunctionDeclaration, isFunctionExpression, isFunctionLike, isIdentifier, isImportClause, isImportDeclaration, - isImportSpecifier, isInComment, isInJSXText, isInString, isInTemplateString, isInterfaceDeclaration, - isJsonSourceFile, isLineBreak, isNamedImports, isObjectLiteralExpression, isParameter, isPinnedComment, - isPrologueDirective, isPropertyDeclaration, isPropertySignature, isRecognizedTripleSlashComment, isStatement, - isStatementButNotDeclaration, isString, isStringLiteral, isSuperCall, 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, + addToSeen, + ArrowFunction, + BindingElement, + CharacterCodes, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + CommentRange, + concatenate, + ConstructorDeclaration, + contains, + createNodeFactory, + createPrinter, + createRange, + createSourceFile, + createTextChange, + createTextRangeFromSpan, + createTextSpan, + createTextSpanFromRange, + createTextWriter, + Debug, + DeclarationStatement, + EmitHint, + EmitTextWriter, + endsWith, + Expression, + factory, + FileTextChanges, + filter, + find, + findChildOfKind, + findLastIndex, + findNextToken, + findPrecedingToken, + first, + firstOrUndefined, + flatMap, + flatMapToMutable, + formatting, + FunctionDeclaration, + FunctionExpression, + getAncestor, + getFirstNonSpaceCharacterPosition, + getFormatCodeSettingsForWriting, + getJSDocCommentRanges, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLineOfLocalPosition, + getLineStartPositionForPosition, + getNewLineKind, + getNewLineOrDefaultFromHost, + getNodeId, + getPrecedingNonSpaceCharacterPosition, + getScriptKindFromFileName, + getShebang, + getStartPositionOfLine, + getTokenAtPosition, + getTouchingToken, + getTrailingCommentRanges, + group, + HasJSDoc, + hasJSDocNodes, + ImportClause, + ImportSpecifier, + indexOfNode, + InterfaceDeclaration, + intersperse, + isAnyImportSyntax, + isArray, + isArrowFunction, + isCallExpression, + isClassElement, + isClassOrTypeElement, + isExpressionStatement, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isIdentifier, + isImportClause, + isImportDeclaration, + isImportSpecifier, + isInComment, + isInJSXText, + isInString, + isInTemplateString, + isInterfaceDeclaration, + isJsonSourceFile, + isLineBreak, + isNamedImports, + isObjectLiteralExpression, + isParameter, + isPinnedComment, + isPrologueDirective, + isPropertyDeclaration, + isPropertySignature, + isRecognizedTripleSlashComment, + isStatement, + isStatementButNotDeclaration, + isString, + isStringLiteral, + isSuperCall, + 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 f76326ea3fd2a..9c6f96408d464 100644 --- a/src/services/transform.ts +++ b/src/services/transform.ts @@ -1,6 +1,14 @@ import { - CompilerOptions, concatenate, DiagnosticWithLocation, factory, fixupCompilerOptions, isArray, Node, - TransformationResult, TransformerFactory, transformNodes, + CompilerOptions, + concatenate, + DiagnosticWithLocation, + factory, + fixupCompilerOptions, + isArray, + Node, + TransformationResult, + TransformerFactory, + transformNodes, } from "./_namespaces/ts"; /** diff --git a/src/services/transpile.ts b/src/services/transpile.ts index b21da9696c1dc..7329f788aa197 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -1,9 +1,32 @@ import { - addRange, cloneCompilerOptions, CommandLineOptionOfCustomType, CompilerHost, CompilerOptions, - createCompilerDiagnosticForInvalidCustomType, createProgram, createSourceFile, CustomTransformers, Debug, - Diagnostic, fileExtensionIs, filter, forEachEntry, getDefaultCompilerOptions, getEmitScriptTarget, getEntries, - getImpliedNodeFormatForFile, getNewLineCharacter, getSetExternalModuleIndicator, hasProperty, isString, - MapLike, normalizePath, optionDeclarations, parseCustomTypeOption, toPath, transpileOptionValueCompilerOptions, + addRange, + cloneCompilerOptions, + CommandLineOptionOfCustomType, + CompilerHost, + CompilerOptions, + createCompilerDiagnosticForInvalidCustomType, + createProgram, + createSourceFile, + CustomTransformers, + Debug, + Diagnostic, + fileExtensionIs, + filter, + forEachEntry, + getDefaultCompilerOptions, + getEmitScriptTarget, + getEntries, + getImpliedNodeFormatForFile, + getNewLineCharacter, + getSetExternalModuleIndicator, + hasProperty, + isString, + MapLike, + normalizePath, + optionDeclarations, + parseCustomTypeOption, + toPath, + transpileOptionValueCompilerOptions, } from "./_namespaces/ts"; export interface TranspileOptions { diff --git a/src/services/types.ts b/src/services/types.ts index 22a3c4a1f76dd..ee6c8a22ba4dd 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1,11 +1,44 @@ import { - CancellationToken, CompilerHost, CompilerOptions, CustomTransformers, Diagnostic, DiagnosticWithLocation, - DocumentHighlights, DocumentPositionMapper, EmitOutput, ExportInfoMap, FileReference, - GetEffectiveTypeRootsHost, HasChangedAutomaticTypeDirectiveNames, HasInvalidatedResolutions, LineAndCharacter, - MinimalResolutionCacheHost, ModuleResolutionCache, ModuleResolutionInfo, ModuleSpecifierCache, - ParsedCommandLine, Path, Program, ProjectReference, ResolutionMode, ResolvedModule, ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, ResolvedTypeReferenceDirective, ScriptKind, SourceFile, SourceFileLike, SourceMapper, - Symbol, SymlinkCache, TextChangeRange, textChanges, TextRange, TextSpan, TypeReferenceDirectiveResolutionInfo, UserPreferences, + CancellationToken, + CompilerHost, + CompilerOptions, + CustomTransformers, + Diagnostic, + DiagnosticWithLocation, + DocumentHighlights, + DocumentPositionMapper, + EmitOutput, + ExportInfoMap, + FileReference, + GetEffectiveTypeRootsHost, + HasChangedAutomaticTypeDirectiveNames, + HasInvalidatedResolutions, + LineAndCharacter, + MinimalResolutionCacheHost, + ModuleResolutionCache, + ModuleResolutionInfo, + ModuleSpecifierCache, + ParsedCommandLine, + Path, + Program, + ProjectReference, + ResolutionMode, + ResolvedModule, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ScriptKind, + SourceFile, + SourceFileLike, + SourceMapper, + Symbol, + SymlinkCache, + TextChangeRange, + textChanges, + TextRange, + TextSpan, + TypeReferenceDirectiveResolutionInfo, + UserPreferences, } from "./_namespaces/ts"; declare module "../compiler/types" { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index b32f090bebcda..a5e151ac7ab1a 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1,63 +1,356 @@ 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, - DocumentPosition, DocumentSpan, DoStatement, ElementAccessExpression, EmitFlags, EmitHint, emptyArray, - EndOfFileToken, ensureScriptKind, EqualityOperator, escapeString, ExportAssignment, ExportDeclaration, Expression, - ExpressionStatement, factory, FileTextChanges, filter, find, findAncestor, findConfigFile, first, firstDefined, - firstOrUndefined, forEachAncestorDirectory, forEachChild, forEachLeadingCommentRange, forEachTrailingCommentRange, - FormatCodeSettings, formatStringFromArgs, formatting, FormattingHost, ForOfStatement, FunctionDeclaration, - FunctionExpression, FunctionLikeDeclaration, getAssignmentDeclarationKind, getCombinedNodeFlagsAlwaysIncludeJSDoc, - getDirectoryPath, getEmitScriptTarget, getExternalModuleImportEqualsDeclarationExpression, getIndentString, - getJSDocEnumTag, getLastChild, getLineAndCharacterOfPosition, getLineStarts, getLocaleSpecificMessage, - getModuleInstanceState, getNameOfDeclaration, getNodeId, getPackageNameFromTypesPackageName, getPathComponents, - getRootDeclaration, getSourceFileOfNode, getSpanOfTokenAtPosition, getSymbolId, getTextOfIdentifierOrLiteral, - getTextOfNode, getTypesPackageName, hasSyntacticModifier, HeritageClause, Identifier, identifierIsThisKeyword, - identity, idText, IfStatement, ImportClause, ImportDeclaration, ImportSpecifier, ImportTypeNode, indexOfNode, - IndexSignatureDeclaration, InternalSymbolName, isAmbientModule, isAnyImportSyntax, isArray, isArrayBindingPattern, - isArrayTypeNode, isAsExpression, isAwaitExpression, isBinaryExpression, isBindingElement, - isBreakOrContinueStatement, isCallExpression, isCallOrNewExpression, isClassDeclaration, isClassExpression, - isClassStaticBlockDeclaration, isConditionalTypeNode, IScriptSnapshot, isDeclaration, isDeclarationName, - isDecorator, isDeleteExpression, isElementAccessExpression, isEntityName, isEnumDeclaration, isExportAssignment, - isExportDeclaration, isExportSpecifier, isExpression, isExpressionNode, isExternalModule, - isExternalModuleImportEqualsDeclaration, isExternalModuleReference, isFileLevelUniqueName, isForInStatement, - isForOfStatement, isFunctionBlock, isFunctionDeclaration, isFunctionExpression, isFunctionLike, - isGetAccessorDeclaration, isGlobalScopeAugmentation, isHeritageClause, isIdentifier, isImportCall, isImportClause, - isImportDeclaration, isImportEqualsDeclaration, isImportOrExportSpecifier, isImportSpecifier, isInferTypeNode, - isInJSFile, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, isJSDoc, isJSDocCommentContainingNode, - isJSDocLink, isJSDocLinkCode, isJSDocLinkLike, isJSDocMemberName, isJSDocNameReference, isJSDocTag, - isJSDocTemplateTag, isJSDocTypeAlias, isJsxElement, isJsxExpression, isJsxOpeningLikeElement, isJsxText, isKeyword, - isLabeledStatement, isLet, isLiteralTypeNode, isMappedTypeNode, isModifier, isModuleBlock, isModuleDeclaration, - isNamedDeclaration, isNamedExports, isNamedImports, isNamespaceExport, isNamespaceImport, isNewExpression, - isNumericLiteral, isObjectBindingPattern, isObjectLiteralExpression, isOptionalChain, isOptionalChainRoot, - isParameter, isPartOfTypeNode, isPrivateIdentifier, isPropertyAccessExpression, isPropertyNameLiteral, - isQualifiedName, isRequireCall, isRequireVariableStatement, isRightSideOfQualifiedNameOrPropertyAccess, - isRootedDiskPath, isSetAccessorDeclaration, isSourceFile, isSourceFileJS, isStringDoubleQuoted, isStringLiteral, - isStringLiteralLike, isStringOrNumericLiteralLike, isStringTextContainingNode, isSyntaxList, - isTaggedTemplateExpression, isTemplateLiteralKind, isToken, isTypeAliasDeclaration, isTypeElement, isTypeNode, - isTypeOfExpression, isTypeOperatorNode, isTypeParameterDeclaration, isTypeReferenceNode, isVarConst, - isVariableDeclarationList, isVoidExpression, isWhiteSpaceLike, isWhiteSpaceSingleLine, isYieldExpression, - IterationStatement, JSDocLink, JSDocLinkCode, JSDocLinkDisplayPart, JSDocLinkPlain, JSDocTypedefTag, JsTyping, - JsxEmit, JsxOpeningLikeElement, LabeledStatement, LanguageServiceHost, last, lastOrUndefined, LiteralExpression, - map, maybeBind, Modifier, ModifierFlags, ModuleDeclaration, ModuleInstanceState, ModuleResolutionKind, - ModuleSpecifierResolutionHost, moduleSpecifiers, Mutable, NewExpression, NewLineKind, Node, NodeArray, - NodeBuilderFlags, NodeFlags, nodeIsMissing, nodeIsPresent, nodeIsSynthesized, noop, normalizePath, - NoSubstitutionTemplateLiteral, notImplemented, nullTransformationContext, NumericLiteral, or, OrganizeImports, - PackageJsonDependencyGroup, pathIsRelative, PrefixUnaryExpression, Program, ProjectPackageJsonInfo, - PropertyAccessExpression, PropertyAssignment, PropertyName, QualifiedName, RefactorContext, Scanner, - ScriptElementKind, ScriptElementKindModifier, ScriptKind, ScriptTarget, SemicolonPreference, setConfigFileInOptions, - setOriginalNode, setTextRange, Signature, SignatureDeclaration, singleOrUndefined, skipAlias, skipOuterExpressions, - some, SourceFile, SourceFileLike, SourceMapper, SpreadElement, stableSort, startsWith, stringContains, - StringLiteral, StringLiteralLike, stringToToken, stripQuotes, Symbol, SymbolAccessibility, SymbolDisplayPart, - SymbolDisplayPartKind, SymbolFlags, SymbolFormatFlags, SymbolTracker, SyntaxKind, SyntaxList, - TaggedTemplateExpression, TemplateExpression, TemplateLiteralToken, TemplateSpan, TextChange, textChanges, - TextRange, TextSpan, textSpanContainsPosition, textSpanContainsTextSpan, textSpanEnd, Token, tokenToString, - TransientSymbol, tryCast, Type, TypeChecker, TypeFormatFlags, TypeNode, TypeOfExpression, TypeQueryNode, - unescapeLeadingUnderscores, UserPreferences, VariableDeclaration, visitEachChild, VoidExpression, YieldExpression, + __String, + addEmitFlags, + addSyntheticLeadingComment, + addSyntheticTrailingComment, + AnyImportOrRequireStatement, + assertType, + AssignmentDeclarationKind, + BinaryExpression, + binarySearchKey, + BindingElement, + BreakOrContinueStatement, + CallExpression, + canHaveModifiers, + CaseClause, + cast, + CatchClause, + CharacterCodes, + ClassDeclaration, + ClassExpression, + clone, + codefix, + combinePaths, + CommentKind, + CommentRange, + compareTextSpans, + compareValues, + Comparison, + CompilerOptions, + ConditionalExpression, + contains, + createPrinter, + createRange, + createScanner, + createTextSpan, + createTextSpanFromBounds, + Debug, + Declaration, + Decorator, + defaultMaximumTruncationLength, + DeleteExpression, + Diagnostic, + DiagnosticMessage, + DiagnosticWithLocation, + directoryProbablyExists, + DisplayPartsSymbolWriter, + DocumentPosition, + DocumentSpan, + DoStatement, + ElementAccessExpression, + EmitFlags, + EmitHint, + emptyArray, + EndOfFileToken, + ensureScriptKind, + EqualityOperator, + escapeString, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, + factory, + FileTextChanges, + filter, + find, + findAncestor, + findConfigFile, + first, + firstDefined, + firstOrUndefined, + forEachAncestorDirectory, + forEachChild, + forEachLeadingCommentRange, + forEachTrailingCommentRange, + FormatCodeSettings, + formatStringFromArgs, + formatting, + FormattingHost, + ForOfStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + getAssignmentDeclarationKind, + getCombinedNodeFlagsAlwaysIncludeJSDoc, + getDirectoryPath, + getEmitScriptTarget, + getExternalModuleImportEqualsDeclarationExpression, + getIndentString, + getJSDocEnumTag, + getLastChild, + getLineAndCharacterOfPosition, + getLineStarts, + getLocaleSpecificMessage, + getModuleInstanceState, + getNameOfDeclaration, + getNodeId, + getPackageNameFromTypesPackageName, + getPathComponents, + getRootDeclaration, + getSourceFileOfNode, + getSpanOfTokenAtPosition, + getSymbolId, + getTextOfIdentifierOrLiteral, + getTextOfNode, + getTypesPackageName, + hasSyntacticModifier, + HeritageClause, + Identifier, + identifierIsThisKeyword, + identity, + idText, + IfStatement, + ImportClause, + ImportDeclaration, + ImportSpecifier, + ImportTypeNode, + indexOfNode, + IndexSignatureDeclaration, + InternalSymbolName, + isAmbientModule, + isAnyImportSyntax, + isArray, + isArrayBindingPattern, + isArrayTypeNode, + isAsExpression, + isAwaitExpression, + isBinaryExpression, + isBindingElement, + isBreakOrContinueStatement, + isCallExpression, + isCallOrNewExpression, + isClassDeclaration, + isClassExpression, + isClassStaticBlockDeclaration, + isConditionalTypeNode, + IScriptSnapshot, + isDeclaration, + isDeclarationName, + isDecorator, + isDeleteExpression, + isElementAccessExpression, + isEntityName, + isEnumDeclaration, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isExpression, + isExpressionNode, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isExternalModuleReference, + isFileLevelUniqueName, + isForInStatement, + isForOfStatement, + isFunctionBlock, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isGetAccessorDeclaration, + isGlobalScopeAugmentation, + isHeritageClause, + isIdentifier, + isImportCall, + isImportClause, + isImportDeclaration, + isImportEqualsDeclaration, + isImportOrExportSpecifier, + isImportSpecifier, + isInferTypeNode, + isInJSFile, + isInterfaceDeclaration, + isInternalModuleImportEqualsDeclaration, + isJSDoc, + isJSDocCommentContainingNode, + isJSDocLink, + isJSDocLinkCode, + isJSDocLinkLike, + isJSDocMemberName, + isJSDocNameReference, + isJSDocTag, + isJSDocTemplateTag, + isJSDocTypeAlias, + isJsxElement, + isJsxExpression, + isJsxOpeningLikeElement, + isJsxText, + isKeyword, + isLabeledStatement, + isLet, + isLiteralTypeNode, + isMappedTypeNode, + isModifier, + isModuleBlock, + isModuleDeclaration, + isNamedDeclaration, + isNamedExports, + isNamedImports, + isNamespaceExport, + isNamespaceImport, + isNewExpression, + isNumericLiteral, + isObjectBindingPattern, + isObjectLiteralExpression, + isOptionalChain, + isOptionalChainRoot, + isParameter, + isPartOfTypeNode, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyNameLiteral, + isQualifiedName, + isRequireCall, + isRequireVariableStatement, + isRightSideOfQualifiedNameOrPropertyAccess, + isRootedDiskPath, + isSetAccessorDeclaration, + isSourceFile, + isSourceFileJS, + isStringDoubleQuoted, + isStringLiteral, + isStringLiteralLike, + isStringOrNumericLiteralLike, + isStringTextContainingNode, + isSyntaxList, + isTaggedTemplateExpression, + isTemplateLiteralKind, + isToken, + isTypeAliasDeclaration, + isTypeElement, + isTypeNode, + isTypeOfExpression, + isTypeOperatorNode, + isTypeParameterDeclaration, + isTypeReferenceNode, + isVarConst, + isVariableDeclarationList, + isVoidExpression, + isWhiteSpaceLike, + isWhiteSpaceSingleLine, + isYieldExpression, + IterationStatement, + JSDocLink, + JSDocLinkCode, + JSDocLinkDisplayPart, + JSDocLinkPlain, + JSDocTypedefTag, + JsTyping, + JsxEmit, + JsxOpeningLikeElement, + LabeledStatement, + LanguageServiceHost, + last, + lastOrUndefined, + LiteralExpression, + map, + maybeBind, + Modifier, + ModifierFlags, + ModuleDeclaration, + ModuleInstanceState, + ModuleResolutionKind, + ModuleSpecifierResolutionHost, + moduleSpecifiers, + Mutable, + NewExpression, + NewLineKind, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + nodeIsMissing, + nodeIsPresent, + nodeIsSynthesized, + noop, + normalizePath, + NoSubstitutionTemplateLiteral, + notImplemented, + nullTransformationContext, + NumericLiteral, + or, + OrganizeImports, + PackageJsonDependencyGroup, + pathIsRelative, + PrefixUnaryExpression, + Program, + ProjectPackageJsonInfo, + PropertyAccessExpression, + PropertyAssignment, + PropertyName, + QualifiedName, + RefactorContext, + Scanner, + ScriptElementKind, + ScriptElementKindModifier, + ScriptKind, + ScriptTarget, + SemicolonPreference, + setConfigFileInOptions, + setOriginalNode, + setTextRange, + Signature, + SignatureDeclaration, + singleOrUndefined, + skipAlias, + skipOuterExpressions, + some, + SourceFile, + SourceFileLike, + SourceMapper, + SpreadElement, + stableSort, + startsWith, + stringContains, + StringLiteral, + StringLiteralLike, + stringToToken, + stripQuotes, + Symbol, + SymbolAccessibility, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolFormatFlags, + SymbolTracker, + SyntaxKind, + SyntaxList, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralToken, + TemplateSpan, + TextChange, + textChanges, + TextRange, + TextSpan, + textSpanContainsPosition, + textSpanContainsTextSpan, + textSpanEnd, + Token, + tokenToString, + TransientSymbol, + tryCast, + Type, + TypeChecker, + TypeFormatFlags, + TypeNode, + TypeOfExpression, + TypeQueryNode, + unescapeLeadingUnderscores, + UserPreferences, + VariableDeclaration, + visitEachChild, + VoidExpression, + YieldExpression, } from "./_namespaces/ts"; // These utilities are common to multiple language service features. diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index 2133aad726734..bad01ecd0bb01 100644 --- a/src/testRunner/compilerRunner.ts +++ b/src/testRunner/compilerRunner.ts @@ -3,8 +3,16 @@ import * as ts from "./_namespaces/ts"; import * as compiler from "./_namespaces/compiler"; import * as Utils from "./_namespaces/Utils"; import { - Baseline, Compiler, FileBasedTest, FileBasedTestConfiguration, getFileBasedTestConfigurationDescription, - getFileBasedTestConfigurations, IO, RunnerBase, TestCaseParser, TestRunnerKind, + Baseline, + Compiler, + FileBasedTest, + FileBasedTestConfiguration, + getFileBasedTestConfigurationDescription, + getFileBasedTestConfigurations, + IO, + RunnerBase, + TestCaseParser, + TestRunnerKind, } from "./_namespaces/Harness"; export const enum CompilerTestType { diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index 766b939ab4b0d..ece03273f89cf 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -3,7 +3,13 @@ import * as fs from "fs"; import * as path from "path"; import * as ts from "./_namespaces/ts"; -import { Baseline, IO, isWorker, RunnerBase, TestRunnerKind } from "./_namespaces/Harness"; +import { + Baseline, + IO, + isWorker, + RunnerBase, + TestRunnerKind, +} from "./_namespaces/Harness"; interface ExecResult { stdout: Buffer; diff --git a/src/testRunner/fourslashRunner.ts b/src/testRunner/fourslashRunner.ts index 31312e37c6a20..3c9712c4324a2 100644 --- a/src/testRunner/fourslashRunner.ts +++ b/src/testRunner/fourslashRunner.ts @@ -1,6 +1,10 @@ import * as FourSlash from "./_namespaces/FourSlash"; import * as ts from "./_namespaces/ts"; -import { IO, RunnerBase, TestRunnerKind } from "./_namespaces/Harness"; +import { + IO, + RunnerBase, + TestRunnerKind, +} from "./_namespaces/Harness"; export class FourSlashRunner extends RunnerBase { protected basePath: string; diff --git a/src/testRunner/parallel/host.ts b/src/testRunner/parallel/host.ts index de5a909360a3d..7ff6ca57011a4 100644 --- a/src/testRunner/parallel/host.ts +++ b/src/testRunner/parallel/host.ts @@ -1,11 +1,28 @@ import * as Utils from "../_namespaces/Utils"; import * as ts from "../_namespaces/ts"; import { - configOption, globalTimeout, IO, keepFailed, lightMode, noColors, runners, runUnitTests, stackTraceLimit, - taskConfigsFolder, TestConfig, TestRunnerKind, workerCount, + configOption, + globalTimeout, + IO, + keepFailed, + lightMode, + noColors, + runners, + runUnitTests, + stackTraceLimit, + taskConfigsFolder, + TestConfig, + TestRunnerKind, + workerCount, } from "../_namespaces/Harness"; import { - ErrorInfo, ParallelClientMessage, ParallelHostMessage, shimNoopTestInterface, Task, TaskTimeout, TestInfo, + ErrorInfo, + ParallelClientMessage, + ParallelHostMessage, + shimNoopTestInterface, + Task, + TaskTimeout, + TestInfo, } from "../_namespaces/Harness.Parallel"; export function start() { diff --git a/src/testRunner/parallel/worker.ts b/src/testRunner/parallel/worker.ts index cf08354f77edc..ff5be50988071 100644 --- a/src/testRunner/parallel/worker.ts +++ b/src/testRunner/parallel/worker.ts @@ -1,8 +1,20 @@ import { - ErrorInfo, ParallelClientMessage, ParallelHostMessage, RunnerTask, shimNoopTestInterface, Task, TaskResult, - TestInfo, UnitTestTask, + ErrorInfo, + ParallelClientMessage, + ParallelHostMessage, + RunnerTask, + shimNoopTestInterface, + Task, + TaskResult, + TestInfo, + UnitTestTask, } from "../_namespaces/Harness.Parallel"; -import { createRunner, globalTimeout, RunnerBase, runUnitTests } from "../_namespaces/Harness"; +import { + createRunner, + globalTimeout, + RunnerBase, + runUnitTests, +} from "../_namespaces/Harness"; export function start() { function hookUncaughtExceptions() { diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index f84e6df70b7ac..65af002657a19 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -4,9 +4,21 @@ import * as FourSlash from "./_namespaces/FourSlash"; import * as project from "./_namespaces/project"; import * as RWC from "./_namespaces/RWC"; import { - CompilerBaselineRunner, CompilerTestType, DefinitelyTypedRunner, DockerfileRunner, FourSlashRunner, - GeneratedFourslashRunner, IO, Parallel, RunnerBase, setLightMode, setShardId, setShards, Test262BaselineRunner, - TestRunnerKind, UserCodeRunner, + CompilerBaselineRunner, + CompilerTestType, + DefinitelyTypedRunner, + DockerfileRunner, + FourSlashRunner, + GeneratedFourslashRunner, + IO, + Parallel, + RunnerBase, + setLightMode, + setShardId, + setShards, + Test262BaselineRunner, + TestRunnerKind, + UserCodeRunner, } from "./_namespaces/Harness"; /* eslint-disable prefer-const */ diff --git a/src/testRunner/test262Runner.ts b/src/testRunner/test262Runner.ts index 87aee2bf57401..7393e0bd79b1f 100644 --- a/src/testRunner/test262Runner.ts +++ b/src/testRunner/test262Runner.ts @@ -1,7 +1,14 @@ import * as ts from "./_namespaces/ts"; import * as compiler from "./_namespaces/compiler"; import * as Utils from "./_namespaces/Utils"; -import { Baseline, Compiler, IO, RunnerBase, TestCaseParser, TestRunnerKind } from "./_namespaces/Harness"; +import { + Baseline, + Compiler, + IO, + RunnerBase, + TestCaseParser, + TestRunnerKind, +} from "./_namespaces/Harness"; // In harness baselines, null is different than undefined. See `generateActual` in `harness.ts`. export class Test262BaselineRunner extends RunnerBase { diff --git a/src/testRunner/unittests/builder.ts b/src/testRunner/unittests/builder.ts index 8ac912824f334..2c965e45323e0 100644 --- a/src/testRunner/unittests/builder.ts +++ b/src/testRunner/unittests/builder.ts @@ -1,5 +1,12 @@ import * as ts from "../_namespaces/ts"; -import { NamedSourceText, newProgram, ProgramWithSourceTexts, SourceText, updateProgram, updateProgramText } from "./helpers"; +import { + NamedSourceText, + newProgram, + ProgramWithSourceTexts, + SourceText, + updateProgram, + updateProgramText, +} from "./helpers"; describe("unittests:: builder", () => { it("emits dependent files", () => { diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 2954f181f7043..43d2beed1493c 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -1,6 +1,10 @@ import * as ts from "../_namespaces/ts"; import * as Harness from "../_namespaces/Harness"; -import { checkResolvedModule, checkResolvedModuleWithFailedLookupLocations, createResolvedModule } from "./helpers"; +import { + checkResolvedModule, + checkResolvedModuleWithFailedLookupLocations, + createResolvedModule, +} from "./helpers"; interface File { name: string; diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index 6394394560114..c349968c89cdf 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -1,7 +1,23 @@ import * as ts from "../_namespaces/ts"; - -import { checkResolvedModulesCache, checkResolvedTypeDirectivesCache, createResolvedModule, createTestCompilerHost, NamedSourceText, newLine, newProgram, ProgramWithSourceTexts, SourceText, TestCompilerHost, updateProgram, updateProgramText } from "./helpers"; -import { createWatchedSystem, File, libFile } from "./virtualFileSystemWithWatch"; +import { + checkResolvedModulesCache, + checkResolvedTypeDirectivesCache, + createResolvedModule, + createTestCompilerHost, + NamedSourceText, + newLine, + newProgram, + ProgramWithSourceTexts, + SourceText, + TestCompilerHost, + updateProgram, + updateProgramText, +} from "./helpers"; +import { + createWatchedSystem, + File, + libFile, +} from "./virtualFileSystemWithWatch"; describe("unittests:: Reuse program structure:: General", () => { const target = ts.ScriptTarget.Latest; diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index dd5543cbac2cb..d677b34885fed 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -1,8 +1,15 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; import { createProjectService } from "../tsserver/helpers"; -import { extractTest, newLineCharacter, notImplementedHost } from "./extract/helpers"; +import { + extractTest, + newLineCharacter, + notImplementedHost, +} from "./extract/helpers"; const libFile: File = { path: "/a/lib/lib.d.ts", diff --git a/src/testRunner/unittests/services/extract/constants.ts b/src/testRunner/unittests/services/extract/constants.ts index b99760b97a29e..24b44e689deb0 100644 --- a/src/testRunner/unittests/services/extract/constants.ts +++ b/src/testRunner/unittests/services/extract/constants.ts @@ -1,5 +1,8 @@ import * as ts from "../../../_namespaces/ts"; -import { testExtractSymbol, testExtractSymbolFailed } from "./helpers"; +import { + testExtractSymbol, + testExtractSymbolFailed, +} from "./helpers"; describe("unittests:: services:: extract:: extractConstants", () => { testExtractConstant("extractConstant_TopLevel", diff --git a/src/testRunner/unittests/services/extract/helpers.ts b/src/testRunner/unittests/services/extract/helpers.ts index 91afea867bfbc..170ac60d0df94 100644 --- a/src/testRunner/unittests/services/extract/helpers.ts +++ b/src/testRunner/unittests/services/extract/helpers.ts @@ -1,6 +1,9 @@ import * as ts from "../../../_namespaces/ts"; import * as Harness from "../../../_namespaces/Harness"; -import { createServerHost, libFile } from "../../virtualFileSystemWithWatch"; +import { + createServerHost, + libFile, +} from "../../virtualFileSystemWithWatch"; import { createProjectService } from "../../tsserver/helpers"; interface Range { diff --git a/src/testRunner/unittests/services/languageService.ts b/src/testRunner/unittests/services/languageService.ts index a93147bc2b870..fa865d423b9d1 100644 --- a/src/testRunner/unittests/services/languageService.ts +++ b/src/testRunner/unittests/services/languageService.ts @@ -1,7 +1,11 @@ import { expect } from "chai"; import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; describe("unittests:: services:: languageService", () => { const files: {[index: string]: string} = { diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 59f1d9a9cae09..8188d9a2cfd22 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -1,6 +1,9 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; import { createProjectService } from "../tsserver/helpers"; import { newLineCharacter } from "./extract/helpers"; diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index a835b87109d09..111506e197414 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; -import { addRest, addShebang, addSpread, addTestPrologue, addTripleSlashRef, appendText, enableStrict, loadProjectFromDisk, removeRest, replaceText, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + addRest, + addShebang, + addSpread, + addTestPrologue, + addTripleSlashRef, + appendText, + enableStrict, + loadProjectFromDisk, + removeRest, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { let outFileFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/clean.ts b/src/testRunner/unittests/tsbuild/clean.ts index 48fc319eabdcf..0778e4ef60fdf 100644 --- a/src/testRunner/unittests/tsbuild/clean.ts +++ b/src/testRunner/unittests/tsbuild/clean.ts @@ -1,4 +1,8 @@ -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; + describe("unittests:: tsbuild - clean", () => { verifyTsc({ scenario: "clean", diff --git a/src/testRunner/unittests/tsbuild/commandLine.ts b/src/testRunner/unittests/tsbuild/commandLine.ts index dfd703445eed5..9374c38dd5a2b 100644 --- a/src/testRunner/unittests/tsbuild/commandLine.ts +++ b/src/testRunner/unittests/tsbuild/commandLine.ts @@ -1,5 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { appendText, compilerOptionsToConfigJson, loadProjectFromFiles, noChangeRun, noChangeWithExportsDiscrepancyRun, replaceText, TestTscEdit, verifyTscWithEdits } from "../tsc/helpers"; +import { + appendText, + compilerOptionsToConfigJson, + loadProjectFromFiles, + noChangeRun, + noChangeWithExportsDiscrepancyRun, + replaceText, + TestTscEdit, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: commandLine::", () => { describe("different options::", () => { diff --git a/src/testRunner/unittests/tsbuild/configFileErrors.ts b/src/testRunner/unittests/tsbuild/configFileErrors.ts index f1d047c37c5d0..d88780fa6cf4e 100644 --- a/src/testRunner/unittests/tsbuild/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuild/configFileErrors.ts @@ -1,4 +1,12 @@ -import { appendText, loadProjectFromDisk, loadProjectFromFiles, noChangeRun, replaceText, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + appendText, + loadProjectFromDisk, + loadProjectFromFiles, + noChangeRun, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; import { dedent } from "../../_namespaces/Utils"; describe("unittests:: tsbuild:: configFileErrors:: when tsconfig extends the missing file", () => { diff --git a/src/testRunner/unittests/tsbuild/configFileExtends.ts b/src/testRunner/unittests/tsbuild/configFileExtends.ts index c319b10f86e45..3fcd12acf0c02 100644 --- a/src/testRunner/unittests/tsbuild/configFileExtends.ts +++ b/src/testRunner/unittests/tsbuild/configFileExtends.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: configFileExtends:: when tsconfig extends another config", () => { function getConfigExtendsWithIncludeFs() { diff --git a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts index ed0a50da8a03c..71001af364655 100644 --- a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts +++ b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts @@ -1,4 +1,10 @@ -import { loadProjectFromDisk, loadProjectFromFiles, noChangeOnlyRuns, replaceText, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + loadProjectFromFiles, + noChangeOnlyRuns, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: when containerOnly project is referenced", () => { verifyTscWithEdits({ diff --git a/src/testRunner/unittests/tsbuild/declarationEmit.ts b/src/testRunner/unittests/tsbuild/declarationEmit.ts index f819b1f55c998..06cf8a24d4d59 100644 --- a/src/testRunner/unittests/tsbuild/declarationEmit.ts +++ b/src/testRunner/unittests/tsbuild/declarationEmit.ts @@ -1,6 +1,9 @@ import * as vfs from "../../_namespaces/vfs"; import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: declarationEmit", () => { function getFiles(): vfs.FileSet { diff --git a/src/testRunner/unittests/tsbuild/demo.ts b/src/testRunner/unittests/tsbuild/demo.ts index 371cae4b63fc3..dfc7868fe54e4 100644 --- a/src/testRunner/unittests/tsbuild/demo.ts +++ b/src/testRunner/unittests/tsbuild/demo.ts @@ -1,5 +1,10 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, prependText, replaceText, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + prependText, + replaceText, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: on demo project", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts index 2c35740fa39d4..c9deb5e89d446 100644 --- a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts +++ b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts @@ -1,5 +1,9 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, replaceText, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index 7243034678195..b86584263bb53 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -1,5 +1,8 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild - empty files option in tsconfig", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts index 6e8aff6c2af14..19459648351a2 100644 --- a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts +++ b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; // https://github.com/microsoft/TypeScript/issues/33849 describe("unittests:: tsbuild:: exitCodeOnBogusFile:: test exit code", () => { diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 1933a979dcf22..6b2f7d749b3b4 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -1,5 +1,10 @@ import * as vfs from "../../_namespaces/vfs"; -import { appendText, loadProjectFromDisk, replaceText, verifyTscWithEdits } from "../tsc/helpers"; +import { + appendText, + loadProjectFromDisk, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts b/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts index 744cc88faa6b6..6f58a0eeab45c 100644 --- a/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts +++ b/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts @@ -1,5 +1,11 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, replaceText, symbolLibContent, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromFiles, + replaceText, + symbolLibContent, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: javascriptProjectEmit::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts index 161a6063a8651..45ccd5c76b0a3 100644 --- a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts +++ b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts @@ -1,4 +1,9 @@ -import { replaceText, appendText, loadProjectFromDisk, verifyTscWithEdits } from "../tsc/helpers"; +import { + appendText, + loadProjectFromDisk, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: lateBoundSymbol:: interface is merged and contains late bound member", () => { verifyTscWithEdits({ diff --git a/src/testRunner/unittests/tsbuild/moduleResolution.ts b/src/testRunner/unittests/tsbuild/moduleResolution.ts index cb095a477d875..682d4f3f02461 100644 --- a/src/testRunner/unittests/tsbuild/moduleResolution.ts +++ b/src/testRunner/unittests/tsbuild/moduleResolution.ts @@ -1,7 +1,15 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, libFile } from "../virtualFileSystemWithWatch"; -import { loadProjectFromFiles, noChangeOnlyRuns, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + loadProjectFromFiles, + noChangeOnlyRuns, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; describe("unittests:: tsbuild:: moduleResolution:: handles the modules and options from referenced project correctly", () => { diff --git a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts index d8023f071b13f..b79d53fd180a2 100644 --- a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts +++ b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts @@ -1,6 +1,10 @@ import { libFile } from "../virtualFileSystemWithWatch"; import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, symbolLibContent, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + symbolLibContent, + verifyTsc, +} from "../tsc/helpers"; // https://github.com/microsoft/TypeScript/issues/31696 describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers to referenced projects resolve correctly", () => { diff --git a/src/testRunner/unittests/tsbuild/noEmit.ts b/src/testRunner/unittests/tsbuild/noEmit.ts index 0782691f47c2c..5ca66a285d3f2 100644 --- a/src/testRunner/unittests/tsbuild/noEmit.ts +++ b/src/testRunner/unittests/tsbuild/noEmit.ts @@ -1,4 +1,8 @@ -import { loadProjectFromFiles, noChangeRun, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromFiles, + noChangeRun, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: noEmit", () => { function verifyNoEmitWorker(subScenario: string, aTsContent: string, commandLineArgs: readonly string[]) { diff --git a/src/testRunner/unittests/tsbuild/noEmitOnError.ts b/src/testRunner/unittests/tsbuild/noEmitOnError.ts index a5bdfc3b5c7e8..0f814b7643c59 100644 --- a/src/testRunner/unittests/tsbuild/noEmitOnError.ts +++ b/src/testRunner/unittests/tsbuild/noEmitOnError.ts @@ -1,4 +1,9 @@ -import { loadProjectFromDisk, noChangeRun, noChangeWithExportsDiscrepancyRun, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + noChangeRun, + noChangeWithExportsDiscrepancyRun, + verifyTscWithEdits, +} from "../tsc/helpers"; import * as vfs from "../../_namespaces/vfs"; describe("unittests:: tsbuild - with noEmitOnError", () => { diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index e0a9ac5bad978..44c49398d5925 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -1,7 +1,30 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; -import { addRest, addShebang, addSpread, addStubFoo, addTestPrologue, addTripleSlashRef, appendText, changeStubToRest, createSolutionBuilderHostForBaseline, enableStrict, loadProjectFromDisk, noChangeOnlyRuns, prependText, removeRest, replaceText, testTscCompileLike, TestTscEdit, TscCompileSystem, verifyTsc, verifyTscCompileLike, verifyTscWithEdits, VerifyTscWithEditsInput } from "../tsc/helpers"; +import { + addRest, + addShebang, + addSpread, + addStubFoo, + addTestPrologue, + addTripleSlashRef, + appendText, + changeStubToRest, + createSolutionBuilderHostForBaseline, + enableStrict, + loadProjectFromDisk, + noChangeOnlyRuns, + prependText, + removeRest, + replaceText, + testTscCompileLike, + TestTscEdit, + TscCompileSystem, + verifyTsc, + verifyTscCompileLike, + verifyTscWithEdits, + VerifyTscWithEditsInput, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: outFile::", () => { let outFileFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index a58f3d4380868..10ecd276fd171 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; import * as fakes from "../../_namespaces/fakes"; -import { loadProjectFromFiles, noChangeRun, TestTscEdit, TscCompileSystem, verifyTscWithEdits, VerifyTscWithEditsInput } from "../tsc/helpers"; +import { + loadProjectFromFiles, + noChangeRun, + TestTscEdit, + TscCompileSystem, + verifyTscWithEdits, + VerifyTscWithEditsInput, +} from "../tsc/helpers"; describe("unittests:: tsbuild - output file paths", () => { const noChangeProject: TestTscEdit = { diff --git a/src/testRunner/unittests/tsbuild/publicApi.ts b/src/testRunner/unittests/tsbuild/publicApi.ts index 880beea1ef7a5..ae548a0e51e7b 100644 --- a/src/testRunner/unittests/tsbuild/publicApi.ts +++ b/src/testRunner/unittests/tsbuild/publicApi.ts @@ -1,7 +1,14 @@ import * as ts from "../../_namespaces/ts"; import * as fakes from "../../_namespaces/fakes"; import * as vfs from "../../_namespaces/vfs"; -import { baselinePrograms, commandLineCallbacks, loadProjectFromFiles, toPathWithSystem, TscCompileSystem, verifyTscBaseline } from "../tsc/helpers"; +import { + baselinePrograms, + commandLineCallbacks, + loadProjectFromFiles, + toPathWithSystem, + TscCompileSystem, + verifyTscBaseline, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: Public API with custom transformers when passed to build", () => { let sys: TscCompileSystem; diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index 4349e906559ce..5ceaa6ac3ea37 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -1,5 +1,9 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, replaceText, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + replaceText, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: with rootDir of project reference in parentDirectory", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 27ef64a886fe1..5eaa7ecc40a90 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -1,5 +1,11 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, noChangeOnlyRuns, replaceText, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + noChangeOnlyRuns, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: with resolveJsonModule option on project resolveJsonModuleAndComposite", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 2fb4d2eee3211..08d5456138032 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -2,8 +2,31 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; import * as Harness from "../../_namespaces/Harness"; -import { changeToHostTrackingWrittenFiles, createWatchedSystem, File, getTsBuildProjectFilePath, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { appendText, createSolutionBuilderHostForBaseline, libContent, loadProjectFromDisk, loadProjectFromFiles, noChangeOnlyRuns, noChangeRun, prependText, replaceText, testTscCompileLike, TestTscEdit, TscCompileSystem, verifyTsc, verifyTscCompileLike, verifyTscWithEdits } from "../tsc/helpers"; +import { + changeToHostTrackingWrittenFiles, + createWatchedSystem, + File, + getTsBuildProjectFilePath, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + appendText, + createSolutionBuilderHostForBaseline, + libContent, + loadProjectFromDisk, + loadProjectFromFiles, + noChangeOnlyRuns, + noChangeRun, + prependText, + replaceText, + testTscCompileLike, + TestTscEdit, + TscCompileSystem, + verifyTsc, + verifyTscCompileLike, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: on 'sample1' project", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index b48a9c9c6911f..a49d83c21a12d 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -1,5 +1,8 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: when project reference is referenced transitively", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts index cf4eda9a904fa..5275bba2e1149 100644 --- a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts @@ -1,4 +1,8 @@ -import { createWatchedSystem, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; +import { + 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 54aa361a76ce9..cb87c76fbc693 100644 --- a/src/testRunner/unittests/tsbuildWatch/demo.ts +++ b/src/testRunner/unittests/tsbuildWatch/demo.ts @@ -1,4 +1,9 @@ -import { createWatchedSystem, File, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + File, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts b/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts index 05889e33048e0..e76f19e16d5b0 100644 --- a/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts @@ -1,4 +1,7 @@ -import { createWatchedSystem, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "../tscWatch/helpers"; import { dedent } from "../../_namespaces/Utils"; diff --git a/src/testRunner/unittests/tsbuildWatch/noEmit.ts b/src/testRunner/unittests/tsbuildWatch/noEmit.ts index b6d77b0cf8d92..f00789f8684d0 100644 --- a/src/testRunner/unittests/tsbuildWatch/noEmit.ts +++ b/src/testRunner/unittests/tsbuildWatch/noEmit.ts @@ -1,4 +1,7 @@ -import { createWatchedSystem, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts index f9dfe11eba12c..d818df804f28f 100644 --- a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts +++ b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts @@ -1,6 +1,13 @@ -import { createWatchedSystem, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; -import { TscWatchCompileChange, verifyTscWatch } from "../tscWatch/helpers"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "../tscWatch/helpers"; describe("unittests:: tsbuildWatch:: watchMode:: with noEmitOnError", () => { function change(caption: string, content: string): TscWatchCompileChange { diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index f4147f4870d4a..0c34385b46bea 100644 --- a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts +++ b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts @@ -1,6 +1,23 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, createBaseline, createSolutionBuilderWithWatchHostForBaseline, noopChange, runWatchBaseline, TscWatchCompileChange, verifyTscWatch } from "../tscWatch/helpers"; +import { + createWatchedSystem, + File, + getTsBuildProjectFile, + getTsBuildProjectFilePath, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, + createBaseline, + createSolutionBuilderWithWatchHostForBaseline, + noopChange, + runWatchBaseline, + TscWatchCompileChange, + verifyTscWatch, +} from "../tscWatch/helpers"; + describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => { const enum SubProject { core = "core", diff --git a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts index f95f91590afe6..d78e632d11125 100644 --- a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts +++ b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { noopChange, TscWatchCompileChange, verifyTscWatch } from "../tscWatch/helpers"; +import { + createWatchedSystem, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + noopChange, + TscWatchCompileChange, + verifyTscWatch, +} from "../tscWatch/helpers"; describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { function pkgs(cb: (index: number) => T, count: number, startIndex?: number): T[] { diff --git a/src/testRunner/unittests/tsbuildWatch/publicApi.ts b/src/testRunner/unittests/tsbuildWatch/publicApi.ts index 54f00c2fed815..e7ec70725a692 100644 --- a/src/testRunner/unittests/tsbuildWatch/publicApi.ts +++ b/src/testRunner/unittests/tsbuildWatch/publicApi.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { createBaseline, createSolutionBuilderWithWatchHostForBaseline, runWatchBaseline } from "../tscWatch/helpers"; +import { + createWatchedSystem, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createBaseline, + createSolutionBuilderWithWatchHostForBaseline, + runWatchBaseline, +} from "../tscWatch/helpers"; it("unittests:: tsbuildWatch:: watchMode:: Public API with custom transformers", () => { const solution: File = { diff --git a/src/testRunner/unittests/tsbuildWatch/reexport.ts b/src/testRunner/unittests/tsbuildWatch/reexport.ts index 849403d63dd7d..67d29dea604d6 100644 --- a/src/testRunner/unittests/tsbuildWatch/reexport.ts +++ b/src/testRunner/unittests/tsbuildWatch/reexport.ts @@ -1,4 +1,8 @@ -import { createWatchedSystem, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index e04ddf12f190e..2858099f538e7 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -1,6 +1,15 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createBaseline, createSolutionBuilderWithWatchHostForBaseline, runWatchBaseline } from "../tscWatch/helpers"; +import { + createWatchedSystem, + File, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createBaseline, + createSolutionBuilderWithWatchHostForBaseline, + runWatchBaseline, +} from "../tscWatch/helpers"; describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: with different watch environments", () => { it("watchFile on same file multiple times because file is part of multiple projects", () => { diff --git a/src/testRunner/unittests/tsc/cancellationToken.ts b/src/testRunner/unittests/tsc/cancellationToken.ts index 0ea048025bb9f..e084adbe72c49 100644 --- a/src/testRunner/unittests/tsc/cancellationToken.ts +++ b/src/testRunner/unittests/tsc/cancellationToken.ts @@ -1,9 +1,20 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { baselineBuildInfo, CommandLineProgram } from "../tsc/helpers"; -import { applyChange, createBaseline, watchBaseline } from "../tscWatch/helpers"; +import { + createWatchedSystem, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineBuildInfo, + CommandLineProgram, +} from "../tsc/helpers"; +import { + applyChange, + createBaseline, + watchBaseline, +} from "../tscWatch/helpers"; describe("unittests:: tsc:: builder cancellationToken", () => { verifyCancellation(/*useBuildInfo*/ true, "when emitting buildInfo"); diff --git a/src/testRunner/unittests/tsc/composite.ts b/src/testRunner/unittests/tsc/composite.ts index f5f274d3a4200..06bcfb478da89 100644 --- a/src/testRunner/unittests/tsc/composite.ts +++ b/src/testRunner/unittests/tsc/composite.ts @@ -1,5 +1,10 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, replaceText, verifyTsc, verifyTscWithEdits } from "./helpers"; +import { + loadProjectFromFiles, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "./helpers"; describe("unittests:: tsc:: composite::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index 09b8912166323..b1739dcd8af0e 100644 --- a/src/testRunner/unittests/tsc/declarationEmit.ts +++ b/src/testRunner/unittests/tsc/declarationEmit.ts @@ -1,6 +1,11 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, FileOrFolderOrSymLink, isSymLink, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + FileOrFolderOrSymLink, + isSymLink, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "../tscWatch/helpers"; describe("unittests:: tsc:: declarationEmit::", () => { diff --git a/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts index becde8318e9c6..70c79ac8b44a3 100644 --- a/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts @@ -1,5 +1,8 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: forceConsistentCasingInFileNames::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 129da093cb139..302334dea4cd8 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -3,7 +3,10 @@ import * as fakes from "../../_namespaces/fakes"; import * as vfs from "../../_namespaces/vfs"; import * as vpath from "../../_namespaces/vpath"; import * as Harness from "../../_namespaces/Harness"; -import { libFile, TestServerHost } from "../virtualFileSystemWithWatch"; +import { + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; export type TscCompileSystem = fakes.System & { writtenFiles: Set; diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 5bfe1a27c53e1..d41f933947218 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -1,7 +1,21 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import * as vfs from "../../_namespaces/vfs"; -import { appendText, compilerOptionsToConfigJson, libContent, loadProjectFromDisk, loadProjectFromFiles, noChangeOnlyRuns, noChangeRun, noChangeWithExportsDiscrepancyRun, prependText, replaceText, TestTscEdit, verifyTsc, verifyTscWithEdits } from "./helpers"; +import { + appendText, + compilerOptionsToConfigJson, + libContent, + loadProjectFromDisk, + loadProjectFromFiles, + noChangeOnlyRuns, + noChangeRun, + noChangeWithExportsDiscrepancyRun, + prependText, + replaceText, + TestTscEdit, + verifyTsc, + verifyTscWithEdits, +} from "./helpers"; describe("unittests:: tsc:: incremental::", () => { verifyTscWithEdits({ diff --git a/src/testRunner/unittests/tsc/listFilesOnly.ts b/src/testRunner/unittests/tsc/listFilesOnly.ts index 258b0609f9455..206373e21267f 100644 --- a/src/testRunner/unittests/tsc/listFilesOnly.ts +++ b/src/testRunner/unittests/tsc/listFilesOnly.ts @@ -1,5 +1,10 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, noChangeRun, verifyTsc, verifyTscWithEdits } from "./helpers"; +import { + loadProjectFromFiles, + noChangeRun, + verifyTsc, + verifyTscWithEdits, +} from "./helpers"; describe("unittests:: tsc:: listFilesOnly::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/projectReferences.ts b/src/testRunner/unittests/tsc/projectReferences.ts index 98e6c6ad14f84..070d2b338920a 100644 --- a/src/testRunner/unittests/tsc/projectReferences.ts +++ b/src/testRunner/unittests/tsc/projectReferences.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: projectReferences::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/redirect.ts b/src/testRunner/unittests/tsc/redirect.ts index 10925a26181e1..086fa782130ee 100644 --- a/src/testRunner/unittests/tsc/redirect.ts +++ b/src/testRunner/unittests/tsc/redirect.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: redirect::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index fa8fe674e9c50..cf5ea49cbc099 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: runWithoutArgs::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index 856fc8fb36898..79d42a00ce4b4 100644 --- a/src/testRunner/unittests/tscWatch/consoleClearing.ts +++ b/src/testRunner/unittests/tscWatch/consoleClearing.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { createBaseline, createWatchCompilerHostOfConfigFileForBaseline, runWatchBaseline, TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + createWatchedSystem, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createBaseline, + createWatchCompilerHostOfConfigFileForBaseline, + runWatchBaseline, + TscWatchCompileChange, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: console clearing", () => { const scenario = "consoleClearing"; diff --git a/src/testRunner/unittests/tscWatch/emit.ts b/src/testRunner/unittests/tscWatch/emit.ts index d061b0085c168..afd3f34b71c67 100644 --- a/src/testRunner/unittests/tscWatch/emit.ts +++ b/src/testRunner/unittests/tscWatch/emit.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + createWatchedSystem, + File, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "./helpers"; const scenario = "emit"; describe("unittests:: tsc-watch:: emit with outFile or out setting", () => { diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 992c2bbb0de09..2262dda00cce5 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -1,6 +1,14 @@ -import { createWatchedSystem, File, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + File, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; -import { TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: Emit times and Error updates in builder after program changes", () => { const config: File = { diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 59bb5fb48cf05..7beecd9cdd2a0 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -1,7 +1,15 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile, SymLink } from "../virtualFileSystemWithWatch"; -import { TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + createWatchedSystem, + File, + libFile, + SymLink, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { const loggerFile: File = { diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 03c82333c1e27..914d889806911 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -1,8 +1,24 @@ 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 } from "../virtualFileSystemWithWatch"; -import { baselinePrograms, commandLineCallbacks, CommandLineCallbacks, CommandLineProgram, createSolutionBuilderHostForBaseline, generateSourceMapBaselineFiles } from "../tsc/helpers"; +import { + changeToHostTrackingWrittenFiles, + createWatchedSystem, + File, + FileOrFolderOrSymLink, + FileOrFolderOrSymLinkMap, + TestServerHost, + TestServerHostCreationParameters, + TestServerHostTrackingWrittenFiles, +} from "../virtualFileSystemWithWatch"; +import { + baselinePrograms, + commandLineCallbacks, + CommandLineCallbacks, + CommandLineProgram, + createSolutionBuilderHostForBaseline, + generateSourceMapBaselineFiles, +} from "../tsc/helpers"; export const commonFile1: File = { path: "/a/b/commonFile1.ts", diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index fbf7305bd79b8..9823c67dbdb3a 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -1,8 +1,22 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { CommandLineProgram, libContent } from "../tsc/helpers"; -import { applyChange, createBaseline, SystemSnap, verifyTscWatch, watchBaseline } from "./helpers"; +import { + createWatchedSystem, + File, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + CommandLineProgram, + libContent, +} from "../tsc/helpers"; +import { + applyChange, + createBaseline, + SystemSnap, + verifyTscWatch, + watchBaseline, +} from "./helpers"; describe("unittests:: tsc-watch:: emit file --incremental", () => { const project = "/users/username/projects/project"; diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 4631e1bc39e60..4a198b652f5da 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -1,6 +1,10 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + File, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; describe("unittests:: tsc-watch:: moduleResolution", () => { diff --git a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts index e1eb489fe06ae..dfed47e08142d 100644 --- a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts +++ b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts @@ -1,5 +1,9 @@ import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + File, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; describe("unittests:: tsc-watch:: nodeNextWatch:: emit when module emit is specified as nodenext", () => { diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 6eb0365275c88..ff58abc4c85ce 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -1,8 +1,27 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, createBaseline, createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, noopChange, runWatchBaseline, TscWatchCompileChange, verifyTscWatch, watchBaseline } from "./helpers"; -import { commandLineCallbacks, compilerOptionsToConfigJson } from "../tsc/helpers"; +import { + createWatchedSystem, + File, + libFile, + SymLink, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, + createBaseline, + createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, + noopChange, + runWatchBaseline, + TscWatchCompileChange, + verifyTscWatch, + watchBaseline, +} from "./helpers"; +import { + commandLineCallbacks, + compilerOptionsToConfigJson, +} from "../tsc/helpers"; describe("unittests:: tsc-watch:: program updates", () => { const scenario = "programUpdates"; diff --git a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts index 37ca522138694..7321dc807dc0a 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -1,6 +1,15 @@ import * as ts from "../../_namespaces/ts"; -import { getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createSolutionBuilder, createSystemWithSolutionBuild, verifyTscWatch } from "./helpers"; +import { + getTsBuildProjectFile, + getTsBuildProjectFilePath, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSolutionBuilder, + createSystemWithSolutionBuild, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: projects with references: invoking when references are already built", () => { verifyTscWatch({ diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index 48cb73fc18592..e25a5eefacc59 100644 --- a/src/testRunner/unittests/tscWatch/resolutionCache.ts +++ b/src/testRunner/unittests/tscWatch/resolutionCache.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile, SymLink } from "../virtualFileSystemWithWatch"; -import { createBaseline, createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, runWatchBaseline, verifyTscWatch } from "./helpers"; +import { + createWatchedSystem, + File, + libFile, + SymLink, +} from "../virtualFileSystemWithWatch"; +import { + createBaseline, + createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, + runWatchBaseline, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution caching", () => { const scenario = "resolutionCache"; diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index 23589d5a52f71..4aa07594feade 100644 --- a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts +++ b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts @@ -1,7 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, FileOrFolderOrSymLink, getTsBuildProjectFile, libFile, SymLink } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + File, + FileOrFolderOrSymLink, + getTsBuildProjectFile, + libFile, + SymLink, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; -import { createBaseline, createWatchCompilerHostOfConfigFileForBaseline, runWatchBaseline, solutionBuildWithBaseline } from "./helpers"; +import { + createBaseline, + createWatchCompilerHostOfConfigFileForBaseline, + runWatchBaseline, + solutionBuildWithBaseline, +} from "./helpers"; describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedirect", () => { interface VerifyWatchInput { diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index bd3b40da83ab9..102bbd7746bfe 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -1,7 +1,18 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile, TestServerHostTrackingWrittenFiles } from "../virtualFileSystemWithWatch"; -import { applyChange, createBaseline, createWatchCompilerHostOfConfigFileForBaseline, runWatchBaseline, watchBaseline } from "./helpers"; +import { + createWatchedSystem, + File, + libFile, + TestServerHostTrackingWrittenFiles, +} from "../virtualFileSystemWithWatch"; +import { + applyChange, + createBaseline, + createWatchCompilerHostOfConfigFileForBaseline, + runWatchBaseline, + watchBaseline, +} from "./helpers"; import { commandLineCallbacks } from "../tsc/helpers"; describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolution", () => { diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index e6b82706e2709..32a271b5e71e6 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile, SymLink, TestServerHost, Tsc_WatchDirectory, Tsc_WatchFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, noopChange, verifyTscWatch } from "./helpers"; +import { + createWatchedSystem, + File, + libFile, + SymLink, + TestServerHost, + Tsc_WatchDirectory, + Tsc_WatchFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, + noopChange, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different polling/non polling options", () => { const scenario = "watchEnvironment"; diff --git a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts index 1eefb848ce30f..d7eed858ebe28 100644 --- a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts +++ b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { TestSession, createSession } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + createSession, + TestSession, +} from "./helpers"; describe("unittests:: tsserver:: applyChangesToOpenFiles", () => { const configFile: File = { diff --git a/src/testRunner/unittests/tsserver/autoImportProvider.ts b/src/testRunner/unittests/tsserver/autoImportProvider.ts index ba3442ad9e643..5fdd48039fe35 100644 --- a/src/testRunner/unittests/tsserver/autoImportProvider.ts +++ b/src/testRunner/unittests/tsserver/autoImportProvider.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { openFilesForSession, checkNumberOfInferredProjects, checkNumberOfConfiguredProjects, createSession } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + createSession, + openFilesForSession, +} from "./helpers"; const angularFormsDts: File = { path: "/node_modules/@angular/forms/forms.d.ts", diff --git a/src/testRunner/unittests/tsserver/auxiliaryProject.ts b/src/testRunner/unittests/tsserver/auxiliaryProject.ts index 0538634c6825f..94b062a2c7f19 100644 --- a/src/testRunner/unittests/tsserver/auxiliaryProject.ts +++ b/src/testRunner/unittests/tsserver/auxiliaryProject.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, checkNumberOfInferredProjects } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfInferredProjects, + createSession, + openFilesForSession, +} from "./helpers"; const aTs: File = { path: "/a.ts", diff --git a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts index 16e82192623f5..01b947479a237 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -1,6 +1,22 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { Logger, createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs, createSession, openFilesForSession, makeSessionRequest, checkProjectActualFiles, checkNumberOfProjects } from "./helpers"; +import { + createServerHost, + File, + libFile, + SymLink, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + Logger, + makeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectSystem CachingFileSystemInformation", () => { enum CalledMapsWithSingleArg { diff --git a/src/testRunner/unittests/tsserver/cancellationToken.ts b/src/testRunner/unittests/tsserver/cancellationToken.ts index 84c1b914e411c..c1fddf773323d 100644 --- a/src/testRunner/unittests/tsserver/cancellationToken.ts +++ b/src/testRunner/unittests/tsserver/cancellationToken.ts @@ -1,6 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { createServerHost } from "../virtualFileSystemWithWatch"; -import { createSession, TestServerCancellationToken } from "./helpers"; +import { + createSession, + TestServerCancellationToken, +} from "./helpers"; describe("unittests:: tsserver:: cancellationToken", () => { // Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index 39ba6857b0715..97aa6aa01f4de 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -1,6 +1,22 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { TestTypingsInstaller, makeSessionRequest, createSession, openFilesForSession, checkNumberOfProjects, checkProjectRootFiles, createLoggerWithInMemoryLogs, baselineTsserverLogs, toExternalFiles, protocolTextSpanFromSubstring, TestSession } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectRootFiles, + createLoggerWithInMemoryLogs, + createSession, + makeSessionRequest, + openFilesForSession, + protocolTextSpanFromSubstring, + TestSession, + TestTypingsInstaller, + toExternalFiles, +} from "./helpers"; function createTestTypingsInstaller(host: ts.server.ServerHost) { return new TestTypingsInstaller("/a/data/", /*throttleLimit*/5, host); diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 59852f1fdb857..cc4883f4dc915 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -1,6 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest, TestTypingsInstaller, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + createSession, + executeSessionRequest, + openFilesForSession, + TestTypingsInstaller, +} from "./helpers"; describe("unittests:: tsserver:: completions", () => { it("works", () => { diff --git a/src/testRunner/unittests/tsserver/completionsIncomplete.ts b/src/testRunner/unittests/tsserver/completionsIncomplete.ts index 2088ed57d0a09..d834c5c83d7e2 100644 --- a/src/testRunner/unittests/tsserver/completionsIncomplete.ts +++ b/src/testRunner/unittests/tsserver/completionsIncomplete.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { openFilesForSession, createSession } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + openFilesForSession, +} from "./helpers"; function createExportingModuleFile(path: string, exportPrefix: string, exportCount: number): File { return { diff --git a/src/testRunner/unittests/tsserver/configFileSearch.ts b/src/testRunner/unittests/tsserver/configFileSearch.ts index d264aba5619b9..4e3d46204f777 100644 --- a/src/testRunner/unittests/tsserver/configFileSearch.ts +++ b/src/testRunner/unittests/tsserver/configFileSearch.ts @@ -1,5 +1,16 @@ -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, createLoggerWithInMemoryLogs, checkNumberOfProjects, baselineTsserverLogs } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + createLoggerWithInMemoryLogs, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: searching for config file", () => { it("should stop at projectRootPath if given", () => { diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index a8c107f48cebc..aeeba6f8a1973 100644 --- a/src/testRunner/unittests/tsserver/configuredProjects.ts +++ b/src/testRunner/unittests/tsserver/configuredProjects.ts @@ -1,7 +1,30 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, SymLink } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, ensureErrorFreeBuild } from "../tscWatch/helpers"; -import { createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkNumberOfConfiguredProjects, configuredProjectAt, checkProjectRootFiles, checkNumberOfInferredProjects, checkNumberOfProjects, checkProjectActualFiles, createSessionWithEventTracking, createSession, openFilesForSession, verifyGetErrRequest } from "./helpers"; +import { + createServerHost, + File, + libFile, + SymLink, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, + ensureErrorFreeBuild, +} from "../tscWatch/helpers"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + createSessionWithEventTracking, + openFilesForSession, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: ConfiguredProjects", () => { it("create configured project without file list", () => { diff --git a/src/testRunner/unittests/tsserver/declarationFileMaps.ts b/src/testRunner/unittests/tsserver/declarationFileMaps.ts index 5f98d88ecdd5a..269eeaa96109a 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -1,6 +1,26 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { DocumentSpanFromSubstring, textSpanFromSubstring, TestSession, openFilesForSession, closeFilesForSession, createSession, checkNumberOfProjects, checkProjectActualFiles, executeSessionRequest, protocolFileLocationFromSubstring, protocolFileSpanWithContextFromSubstring, protocolTextSpanFromSubstring, protocolFileSpanFromSubstring, makeReferenceItem, protocolLocationFromSubstring, protocolRenameSpanFromSubstring } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + closeFilesForSession, + createSession, + DocumentSpanFromSubstring, + executeSessionRequest, + makeReferenceItem, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolFileSpanFromSubstring, + protocolFileSpanWithContextFromSubstring, + protocolLocationFromSubstring, + protocolRenameSpanFromSubstring, + protocolTextSpanFromSubstring, + TestSession, + textSpanFromSubstring, +} from "./helpers"; function documentSpanFromSubstring({ file, text, contextText, options, contextOptions }: DocumentSpanFromSubstring): ts.DocumentSpan { const contextSpan = contextText !== undefined ? documentSpanFromSubstring({ file, text: contextText, options: contextOptions }) : undefined; diff --git a/src/testRunner/unittests/tsserver/documentRegistry.ts b/src/testRunner/unittests/tsserver/documentRegistry.ts index 304e0b78f5af0..6452515db8c7b 100644 --- a/src/testRunner/unittests/tsserver/documentRegistry.ts +++ b/src/testRunner/unittests/tsserver/documentRegistry.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { TestProjectService, checkProjectActualFiles, createProjectService } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkProjectActualFiles, + createProjectService, + TestProjectService, +} from "./helpers"; describe("unittests:: tsserver:: document registry in project service", () => { const importModuleContent = `import {a} from "./module1"`; diff --git a/src/testRunner/unittests/tsserver/duplicatePackages.ts b/src/testRunner/unittests/tsserver/duplicatePackages.ts index 41b7565b51fc5..28b6c72606bb3 100644 --- a/src/testRunner/unittests/tsserver/duplicatePackages.ts +++ b/src/testRunner/unittests/tsserver/duplicatePackages.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: duplicate packages", () => { // Tests that 'moduleSpecifiers.ts' will import from the redirecting file, and not from the file it redirects to, if that can provide a global module specifier. diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index 007ba4d02d6c5..ec3f62c82c422 100644 --- a/src/testRunner/unittests/tsserver/dynamicFiles.ts +++ b/src/testRunner/unittests/tsserver/dynamicFiles.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { checkNumberOfProjects, checkProjectActualFiles, checkProjectRootFiles, createProjectService, createSession, executeSessionRequest, executeSessionRequestNoResponse, openFilesForSession, verifyDynamic } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + createProjectService, + createSession, + executeSessionRequest, + executeSessionRequestNoResponse, + openFilesForSession, + verifyDynamic, +} from "./helpers"; function verifyPathRecognizedAsDynamic(path: string) { const file: File = { diff --git a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts index 61c60887ea6e3..b2584532979f9 100644 --- a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts +++ b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts @@ -1,6 +1,15 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../../virtualFileSystemWithWatch"; -import { createSessionWithEventTracking, checkProjectActualFiles, openFilesForSession, checkNumberOfProjects } from "../helpers"; +import { + createServerHost, + File, + libFile, +} from "../../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + createSessionWithEventTracking, + openFilesForSession, +} from "../helpers"; describe("unittests:: tsserver:: events:: LargeFileReferencedEvent with large file", () => { diff --git a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts index ac95c7d01a546..9c6bd0d664ebf 100644 --- a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts +++ b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts @@ -1,6 +1,17 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../../virtualFileSystemWithWatch"; -import { createSessionWithEventTracking, checkNumberOfProjects, configuredProjectAt, createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs } from "../helpers"; +import { + createServerHost, + File, + libFile, +} from "../../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSessionWithEventTracking, +} from "../helpers"; describe("unittests:: tsserver:: events:: ProjectLanguageServiceStateEvent", () => { it("language service disabled events are triggered", () => { diff --git a/src/testRunner/unittests/tsserver/events/projectLoading.ts b/src/testRunner/unittests/tsserver/events/projectLoading.ts index 34bf3d736fd81..739a29a503ebb 100644 --- a/src/testRunner/unittests/tsserver/events/projectLoading.ts +++ b/src/testRunner/unittests/tsserver/events/projectLoading.ts @@ -1,6 +1,19 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../../virtualFileSystemWithWatch"; -import { TestSession, openFilesForSession, checkNumberOfProjects, protocolLocationFromSubstring, toExternalFiles, createSessionWithEventTracking, createSessionWithDefaultEventHandler } from "../helpers"; +import { + createServerHost, + File, + libFile, + TestServerHost, +} from "../../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + createSessionWithDefaultEventHandler, + createSessionWithEventTracking, + openFilesForSession, + protocolLocationFromSubstring, + TestSession, + toExternalFiles, +} from "../helpers"; describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoadingFinish events", () => { const aTs: File = { diff --git a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts index 857858cf7fc5b..8acf0e1c6b2ac 100644 --- a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts +++ b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts @@ -1,6 +1,19 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../../virtualFileSystemWithWatch"; -import { TestSession, Logger, createLoggerWithInMemoryLogs, baselineTsserverLogs, createSessionWithEventTracking, createSessionWithDefaultEventHandler, createHasErrorMessageLogger } from "../helpers"; +import { + createServerHost, + File, + libFile, + TestServerHost, +} from "../../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createHasErrorMessageLogger, + createLoggerWithInMemoryLogs, + createSessionWithDefaultEventHandler, + createSessionWithEventTracking, + Logger, + TestSession, +} from "../helpers"; describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { function verifyFiles(caption: string, actual: readonly string[], expected: readonly string[]) { diff --git a/src/testRunner/unittests/tsserver/exportMapCache.ts b/src/testRunner/unittests/tsserver/exportMapCache.ts index 6e195e47724c3..93a5b517af8e6 100644 --- a/src/testRunner/unittests/tsserver/exportMapCache.ts +++ b/src/testRunner/unittests/tsserver/exportMapCache.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, configuredProjectAt, executeSessionRequest } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + configuredProjectAt, + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; const packageJson: File = { path: "/package.json", diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index b6cd6ecdb96f7..5d6919dc33662 100644 --- a/src/testRunner/unittests/tsserver/externalProjects.ts +++ b/src/testRunner/unittests/tsserver/externalProjects.ts @@ -1,7 +1,23 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, toExternalFiles, checkProjectActualFiles, toExternalFile, createSession, checkNumberOfProjects, checkNumberOfExternalProjects, checkNumberOfInferredProjects, verifyDynamic, checkProjectRootFiles, configuredProjectAt } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfExternalProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + configuredProjectAt, + createProjectService, + createSession, + toExternalFile, + toExternalFiles, + verifyDynamic, +} from "./helpers"; describe("unittests:: tsserver:: ExternalProjects", () => { describe("can handle tsconfig file name with difference casing", () => { diff --git a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts index c2dc254e961cc..c505181c490e9 100644 --- a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, checkNumberOfProjects, configuredProjectAt, createLoggerWithInMemoryLogs, verifyGetErrRequest, closeFilesForSession, protocolTextSpanFromSubstring, baselineTsserverLogs } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + closeFilesForSession, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolTextSpanFromSubstring, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => { it("works when extends is specified with a case insensitive file system", () => { diff --git a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts index 43004a13f8c25..eb0182bea6396 100644 --- a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts +++ b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: getApplicableRefactors", () => { it("works when taking position", () => { diff --git a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts index 9b28cc90512dc..917b50ce6ee10 100644 --- a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts +++ b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createProjectService, textSpanFromSubstring, createSession, openFilesForSession, executeSessionRequest, protocolTextSpanFromSubstring } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createProjectService, + createSession, + executeSessionRequest, + openFilesForSession, + protocolTextSpanFromSubstring, + textSpanFromSubstring, +} from "./helpers"; describe("unittests:: tsserver:: getEditsForFileRename", () => { it("works for host implementing 'resolveModuleNames' and 'getResolvedModuleWithFailedLookupLocationsFromCache'", () => { diff --git a/src/testRunner/unittests/tsserver/getExportReferences.ts b/src/testRunner/unittests/tsserver/getExportReferences.ts index 7b8152631580a..5d19e9075070d 100644 --- a/src/testRunner/unittests/tsserver/getExportReferences.ts +++ b/src/testRunner/unittests/tsserver/getExportReferences.ts @@ -1,6 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, makeReferenceItem, MakeReferenceItem, executeSessionRequest, protocolFileLocationFromSubstring, protocolLocationFromSubstring } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + makeReferenceItem, + MakeReferenceItem, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolLocationFromSubstring, +} from "./helpers"; describe("unittests:: tsserver:: getExportReferences", () => { const exportVariable = "export const value = 0;"; diff --git a/src/testRunner/unittests/tsserver/getFileReferences.ts b/src/testRunner/unittests/tsserver/getFileReferences.ts index 37e0381d04c88..c6ade3fb6e2e5 100644 --- a/src/testRunner/unittests/tsserver/getFileReferences.ts +++ b/src/testRunner/unittests/tsserver/getFileReferences.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest, makeReferenceItem } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + makeReferenceItem, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: getFileReferences", () => { const importA = `import "./a";`; diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 6fb580890d5c7..6fa7aa172e4b8 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -1,7 +1,16 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import * as Utils from "../../_namespaces/Utils"; -import { changeToHostTrackingWrittenFiles, checkArray, createServerHost, File, FileOrFolderOrSymLink, libFile, TestServerHost, TestServerHostTrackingWrittenFiles } from "../virtualFileSystemWithWatch"; +import { + changeToHostTrackingWrittenFiles, + checkArray, + createServerHost, + File, + FileOrFolderOrSymLink, + libFile, + TestServerHost, + TestServerHostTrackingWrittenFiles, +} from "../virtualFileSystemWithWatch"; import { ensureErrorFreeBuild } from "../tscWatch/helpers"; const outputEventRegex = /Content\-Length: [\d]+\r\n\r\n/; diff --git a/src/testRunner/unittests/tsserver/importHelpers.ts b/src/testRunner/unittests/tsserver/importHelpers.ts index f9f51ecf5dcc5..34bb711b5ab4f 100644 --- a/src/testRunner/unittests/tsserver/importHelpers.ts +++ b/src/testRunner/unittests/tsserver/importHelpers.ts @@ -1,5 +1,8 @@ import { createServerHost } from "../virtualFileSystemWithWatch"; -import { createProjectService, toExternalFile } from "./helpers"; +import { + createProjectService, + toExternalFile, +} from "./helpers"; describe("unittests:: tsserver:: import helpers", () => { it("should not crash in tsserver", () => { diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index c68750cf513c1..11fded416f680 100644 --- a/src/testRunner/unittests/tsserver/inferredProjects.ts +++ b/src/testRunner/unittests/tsserver/inferredProjects.ts @@ -1,7 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; import { commonFile1 } from "../tscWatch/helpers"; -import { createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, checkProjectActualFiles, checkNumberOfProjects, createSession } from "./helpers"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: Inferred projects", () => { it("create inferred project", () => { diff --git a/src/testRunner/unittests/tsserver/inlayHints.ts b/src/testRunner/unittests/tsserver/inlayHints.ts index 3e658a06990c8..c113207329bc3 100644 --- a/src/testRunner/unittests/tsserver/inlayHints.ts +++ b/src/testRunner/unittests/tsserver/inlayHints.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { createSession, TestSession } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + createSession, + TestSession, +} from "./helpers"; describe("unittests:: tsserver:: inlayHints", () => { const configFile: File = { diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 568475465a536..5fcf7726abfc6 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: jsdoc @link ", () => { const config: File = { diff --git a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts index b3588e9bd446e..f163dbbbfd7d6 100644 --- a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts +++ b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, checkNumberOfInferredProjects } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfInferredProjects, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: maxNodeModuleJsDepth for inferred projects", () => { it("should be set to 2 if the project has js root files", () => { diff --git a/src/testRunner/unittests/tsserver/metadataInResponse.ts b/src/testRunner/unittests/tsserver/metadataInResponse.ts index 81fb935298f1a..5a2d5dc37958f 100644 --- a/src/testRunner/unittests/tsserver/metadataInResponse.ts +++ b/src/testRunner/unittests/tsserver/metadataInResponse.ts @@ -1,7 +1,16 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File, TestServerHost } from "../virtualFileSystemWithWatch"; -import { mapOutputToJson, TestSession, createSession, openFilesForSession } from "./helpers"; +import { + createServerHost, + File, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + mapOutputToJson, + openFilesForSession, + TestSession, +} from "./helpers"; describe("unittests:: tsserver:: with metadata in response", () => { const metadata = "Extra Info"; diff --git a/src/testRunner/unittests/tsserver/moduleResolution.ts b/src/testRunner/unittests/tsserver/moduleResolution.ts index 2c75549113521..c83d202d46910 100644 --- a/src/testRunner/unittests/tsserver/moduleResolution.ts +++ b/src/testRunner/unittests/tsserver/moduleResolution.ts @@ -1,6 +1,16 @@ import * as Utils from "../../_namespaces/Utils"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, verifyGetErrRequest, baselineTsserverLogs } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: moduleResolution", () => { describe("package json file is edited", () => { diff --git a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts index 4151e78e7a82b..5da6c3123de78 100644 --- a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts +++ b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createLoggerWithInMemoryLogs, baselineTsserverLogs, executeSessionRequest, Logger, createSession, openFilesForSession, configuredProjectAt } from "./helpers"; +import { + createServerHost, + File, + SymLink, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createSession, + executeSessionRequest, + Logger, + openFilesForSession, +} from "./helpers"; const packageJson: File = { path: "/package.json", diff --git a/src/testRunner/unittests/tsserver/navTo.ts b/src/testRunner/unittests/tsserver/navTo.ts index 9c6acda8fd1a1..6414d2441d5d9 100644 --- a/src/testRunner/unittests/tsserver/navTo.ts +++ b/src/testRunner/unittests/tsserver/navTo.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, makeSessionRequest, createLoggerWithInMemoryLogs, baselineTsserverLogs } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + makeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: navigate-to for javascript project", () => { function findNavToItem(items: ts.server.protocol.NavtoItem[], itemName: string, itemKind: string) { diff --git a/src/testRunner/unittests/tsserver/occurences.ts b/src/testRunner/unittests/tsserver/occurences.ts index 4d5481e065388..c7d6b12a684c4 100644 --- a/src/testRunner/unittests/tsserver/occurences.ts +++ b/src/testRunner/unittests/tsserver/occurences.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, makeSessionRequest } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + makeSessionRequest, +} from "./helpers"; describe("unittests:: tsserver:: occurrence highlight on string", () => { it("should be marked if only on string values", () => { diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 998c68cfa505a..9933afd8ad00b 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, toExternalFile, checkProjectActualFiles, createSession, createLoggerWithInMemoryLogs, openFilesForSession, verifyGetErrRequest, protocolTextSpanFromSubstring, baselineTsserverLogs } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkProjectActualFiles, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + openFilesForSession, + protocolTextSpanFromSubstring, + toExternalFile, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: Open-file", () => { it("can be reloaded with empty content", () => { diff --git a/src/testRunner/unittests/tsserver/packageJsonInfo.ts b/src/testRunner/unittests/tsserver/packageJsonInfo.ts index 02de3b01ebcd5..b122bd7b89369 100644 --- a/src/testRunner/unittests/tsserver/packageJsonInfo.ts +++ b/src/testRunner/unittests/tsserver/packageJsonInfo.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, configuredProjectAt } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + configuredProjectAt, + createSession, +} from "./helpers"; const tsConfig: File = { path: "/tsconfig.json", diff --git a/src/testRunner/unittests/tsserver/partialSemanticServer.ts b/src/testRunner/unittests/tsserver/partialSemanticServer.ts index 416ce5c2cec98..81304941d8a26 100644 --- a/src/testRunner/unittests/tsserver/partialSemanticServer.ts +++ b/src/testRunner/unittests/tsserver/partialSemanticServer.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, checkNumberOfProjects, checkProjectActualFiles, baselineTsserverLogs, protocolFileLocationFromSubstring, verifyGetErrRequest, closeFilesForSession } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + closeFilesForSession, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolFileLocationFromSubstring, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: Semantic operations on partialSemanticServer", () => { function setup() { diff --git a/src/testRunner/unittests/tsserver/plugins.ts b/src/testRunner/unittests/tsserver/plugins.ts index de4650ffc64a3..6db0fb3509fa2 100644 --- a/src/testRunner/unittests/tsserver/plugins.ts +++ b/src/testRunner/unittests/tsserver/plugins.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, createSession, createLoggerWithInMemoryLogs, openFilesForSession, baselineTsserverLogs } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: plugins loading", () => { const testProtocolCommand = "testProtocolCommand"; diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 95fd7af6d89c6..10613e0e76bc3 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -1,6 +1,26 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, Folder, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, toExternalFiles, checkNumberOfProjects, openFilesForSession, configuredProjectAt, createProjectService, checkProjectRootFiles, createLoggerWithInMemoryLogs, appendAllScriptInfos, verifyGetErrRequest, baselineTsserverLogs, closeFilesForSession, verifyGetErrScenario, executeSessionRequest } from "./helpers"; +import { + createServerHost, + File, + Folder, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + appendAllScriptInfos, + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectRootFiles, + closeFilesForSession, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + executeSessionRequest, + openFilesForSession, + toExternalFiles, + verifyGetErrRequest, + verifyGetErrScenario, +} from "./helpers"; describe("unittests:: tsserver:: Project Errors", () => { function checkProjectErrors(projectFiles: ts.server.ProjectFilesWithTSDiagnostics, expectedErrors: readonly string[]): void { diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index 1daceed20d992..b8de4f6d65c19 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; import { ensureErrorFreeBuild } from "../tscWatch/helpers"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, baselineTsserverLogs, protocolToLocation } from "./helpers"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolToLocation, +} from "./helpers"; describe("unittests:: tsserver:: with project references and compile on save", () => { const dependecyLocation = `/user/username/projects/myproject/dependency`; diff --git a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts index 7d25ffdfb4011..a590f7906ea3c 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts @@ -1,5 +1,8 @@ import { File } from "../virtualFileSystemWithWatch"; -import { GetErrForProjectDiagnostics, verifyGetErrScenario } from "./helpers"; +import { + GetErrForProjectDiagnostics, + verifyGetErrScenario, +} from "./helpers"; describe("unittests:: tsserver:: with project references and error reporting", () => { const dependecyLocation = `/user/username/projects/myproject/dependency`; diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index 8fa087a7a7cde..4734b18c47337 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -1,6 +1,25 @@ import * as ts from "../../_namespaces/ts"; -import { baselineTsserverLogs, checkProjectActualFiles, createHostWithSolutionBuild, createLoggerWithInMemoryLogs, createProjectService, createSession, makeReferenceItem, openFilesForSession, protocolFileLocationFromSubstring, protocolLocationFromSubstring, verifyGetErrRequest } from "./helpers"; -import { createServerHost, File, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, SymLink } from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkProjectActualFiles, + createHostWithSolutionBuild, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + makeReferenceItem, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolLocationFromSubstring, + verifyGetErrRequest, +} from "./helpers"; +import { + createServerHost, + File, + getTsBuildProjectFile, + getTsBuildProjectFilePath, + libFile, + SymLink, +} from "../virtualFileSystemWithWatch"; import { solutionBuildWithBaseline } from "../tscWatch/helpers"; describe("unittests:: tsserver:: with project references and tsbuild", () => { diff --git a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts index e8149dae66471..400c21cd0a5b3 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TestSession, closeFilesForSession, openFilesForSession, createHostWithSolutionBuild, createSession, createLoggerWithInMemoryLogs, baselineTsserverLogs } from "./helpers"; +import { + createServerHost, + File, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + closeFilesForSession, + createHostWithSolutionBuild, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + TestSession, +} from "./helpers"; describe("unittests:: tsserver:: with project references and tsbuild source map", () => { const dependecyLocation = `/user/username/projects/myproject/dependency`; diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 35984a6707845..6e6e3539d7da2 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1,7 +1,33 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, makeSessionRequest, baselineTsserverLogs, createProjectService, configuredProjectAt, checkProjectRootFiles, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, toExternalFiles, checkNumberOfProjects, checkProjectActualFiles, customTypesMap, toExternalFile, closeFilesForSession, verifyGetErrRequest, protocolFileLocationFromSubstring } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + closeFilesForSession, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + customTypesMap, + makeSessionRequest, + openFilesForSession, + protocolFileLocationFromSubstring, + toExternalFile, + toExternalFiles, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: Projects", () => { it("handles the missing files - that were added to program because they were added with /// { diff --git a/src/testRunner/unittests/tsserver/projectsWithReferences.ts b/src/testRunner/unittests/tsserver/projectsWithReferences.ts index d797ac31b01eb..a1f780dcc8c77 100644 --- a/src/testRunner/unittests/tsserver/projectsWithReferences.ts +++ b/src/testRunner/unittests/tsserver/projectsWithReferences.ts @@ -1,5 +1,15 @@ -import { createServerHost, File, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; -import { createLoggerWithInMemoryLogs, createProjectService, baselineTsserverLogs, checkNumberOfProjects } from "./helpers"; +import { + createServerHost, + File, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + createLoggerWithInMemoryLogs, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: projects with references: invoking when references are already built", () => { it("on sample project", () => { diff --git a/src/testRunner/unittests/tsserver/refactors.ts b/src/testRunner/unittests/tsserver/refactors.ts index 2753c6dee5bf8..86504b90255a7 100644 --- a/src/testRunner/unittests/tsserver/refactors.ts +++ b/src/testRunner/unittests/tsserver/refactors.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: refactors", () => { it("use formatting options", () => { diff --git a/src/testRunner/unittests/tsserver/reload.ts b/src/testRunner/unittests/tsserver/reload.ts index b6e5db0cc6d4b..4bd0ac29c2994 100644 --- a/src/testRunner/unittests/tsserver/reload.ts +++ b/src/testRunner/unittests/tsserver/reload.ts @@ -1,6 +1,12 @@ -import { createServerHost, libFile } from "../virtualFileSystemWithWatch"; +import { + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; import * as ts from "../../_namespaces/ts"; -import { createSession, checkNumberOfProjects } from "./helpers"; +import { + checkNumberOfProjects, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: reload", () => { it("should work with temp file", () => { diff --git a/src/testRunner/unittests/tsserver/reloadProjects.ts b/src/testRunner/unittests/tsserver/reloadProjects.ts index 687b3c465e7a9..d65eee7ac4164 100644 --- a/src/testRunner/unittests/tsserver/reloadProjects.ts +++ b/src/testRunner/unittests/tsserver/reloadProjects.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TestProjectService, createProjectService, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + createServerHost, + File, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + createProjectService, + TestProjectService, +} from "./helpers"; describe("unittests:: tsserver:: reloadProjects", () => { const configFile: File = { diff --git a/src/testRunner/unittests/tsserver/rename.ts b/src/testRunner/unittests/tsserver/rename.ts index 19cf8ba6c6006..72e8bfedf7130 100644 --- a/src/testRunner/unittests/tsserver/rename.ts +++ b/src/testRunner/unittests/tsserver/rename.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest, protocolFileLocationFromSubstring, protocolTextSpanFromSubstring, protocolRenameSpanFromSubstring } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolRenameSpanFromSubstring, + protocolTextSpanFromSubstring, +} from "./helpers"; describe("unittests:: tsserver:: rename", () => { it("works with fileToRename", () => { diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index eb2636a9491a0..b9290fe96ad4a 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -1,6 +1,24 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createProjectService, TestTypingsInstaller, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkProjectActualFiles, configuredProjectAt, createSession, openFilesForSession, makeSessionRequest, verifyGetErrRequest, toExternalFiles, checkNumberOfProjects } from "./helpers"; +import { + createServerHost, + File, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + makeSessionRequest, + openFilesForSession, + TestTypingsInstaller, + toExternalFiles, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem extra resolution pass in server host", () => { it("can load typings that are proper modules", () => { diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 000076f78e772..d50ed165dde2d 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -3,7 +3,10 @@ import { expect } from "chai"; import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import * as Utils from "../../_namespaces/Utils"; -import { nullLogger, createHasErrorMessageLogger } from "./helpers"; +import { + createHasErrorMessageLogger, + nullLogger, +} from "./helpers"; let lastWrittenToHost: string; const noopFileWatcher: ts.FileWatcher = { close: ts.noop }; diff --git a/src/testRunner/unittests/tsserver/skipLibCheck.ts b/src/testRunner/unittests/tsserver/skipLibCheck.ts index 7be07cb172f6a..add3fb8c30a24 100644 --- a/src/testRunner/unittests/tsserver/skipLibCheck.ts +++ b/src/testRunner/unittests/tsserver/skipLibCheck.ts @@ -1,6 +1,11 @@ import { createServerHost } from "../virtualFileSystemWithWatch"; import * as ts from "../../_namespaces/ts"; -import { createSession, openFilesForSession, makeSessionRequest, toExternalFiles } from "./helpers"; +import { + createSession, + makeSessionRequest, + openFilesForSession, + toExternalFiles, +} from "./helpers"; describe("unittests:: tsserver:: with skipLibCheck", () => { it("should be turned on for js-only inferred projects", () => { diff --git a/src/testRunner/unittests/tsserver/smartSelection.ts b/src/testRunner/unittests/tsserver/smartSelection.ts index 257d009d42b3b..99ed4ead47ebf 100644 --- a/src/testRunner/unittests/tsserver/smartSelection.ts +++ b/src/testRunner/unittests/tsserver/smartSelection.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; function setup(fileName: string, content: string) { const file: File = { path: fileName, content }; diff --git a/src/testRunner/unittests/tsserver/symLinks.ts b/src/testRunner/unittests/tsserver/symLinks.ts index afcfb9731db31..e6e7a0e993874 100644 --- a/src/testRunner/unittests/tsserver/symLinks.ts +++ b/src/testRunner/unittests/tsserver/symLinks.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, executeSessionRequest, protocolLocationFromSubstring, baselineTsserverLogs, verifyGetErrRequest } from "./helpers"; +import { + createServerHost, + File, + libFile, + SymLink, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + executeSessionRequest, + openFilesForSession, + protocolLocationFromSubstring, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: symLinks", () => { it("rename in common file renames all project", () => { diff --git a/src/testRunner/unittests/tsserver/symlinkCache.ts b/src/testRunner/unittests/tsserver/symlinkCache.ts index 31dfa9879ec64..f93933499ce09 100644 --- a/src/testRunner/unittests/tsserver/symlinkCache.ts +++ b/src/testRunner/unittests/tsserver/symlinkCache.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, SymLink } from "../virtualFileSystemWithWatch"; -import { openFilesForSession, createSession } from "./helpers"; +import { + createServerHost, + File, + SymLink, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + openFilesForSession, +} from "./helpers"; const appTsconfigJson: File = { path: "/packages/app/tsconfig.json", diff --git a/src/testRunner/unittests/tsserver/syntacticServer.ts b/src/testRunner/unittests/tsserver/syntacticServer.ts index 546ac68c5683a..f20963c531785 100644 --- a/src/testRunner/unittests/tsserver/syntacticServer.ts +++ b/src/testRunner/unittests/tsserver/syntacticServer.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, TestSession, openFilesForSession, closeFilesForSession, baselineTsserverLogs, protocolFileLocationFromSubstring, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + closeFilesForSession, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolFileLocationFromSubstring, + TestSession, +} from "./helpers"; describe("unittests:: tsserver:: Semantic operations on Syntax server", () => { function setup() { diff --git a/src/testRunner/unittests/tsserver/syntaxOperations.ts b/src/testRunner/unittests/tsserver/syntaxOperations.ts index 0432f18ca0965..9257ac4400ecc 100644 --- a/src/testRunner/unittests/tsserver/syntaxOperations.ts +++ b/src/testRunner/unittests/tsserver/syntaxOperations.ts @@ -1,6 +1,15 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { TestSession, createSession, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + createSession, + TestSession, +} from "./helpers"; describe("unittests:: tsserver:: syntax operations", () => { function navBarFull(session: TestSession, file: File) { diff --git a/src/testRunner/unittests/tsserver/telemetry.ts b/src/testRunner/unittests/tsserver/telemetry.ts index 28a6767a1c1f8..a741c8517366d 100644 --- a/src/testRunner/unittests/tsserver/telemetry.ts +++ b/src/testRunner/unittests/tsserver/telemetry.ts @@ -1,6 +1,11 @@ import * as ts from "../../_namespaces/ts"; import { File } from "../virtualFileSystemWithWatch"; -import { TestServerEventManager, checkNumberOfProjects, fileStats, toExternalFiles } from "./helpers"; +import { + checkNumberOfProjects, + fileStats, + TestServerEventManager, + toExternalFiles, +} from "./helpers"; describe("unittests:: tsserver:: project telemetry", () => { it("does nothing for inferred project", () => { diff --git a/src/testRunner/unittests/tsserver/typeAquisition.ts b/src/testRunner/unittests/tsserver/typeAquisition.ts index 3209f3388afa0..6750433c9f9ec 100644 --- a/src/testRunner/unittests/tsserver/typeAquisition.ts +++ b/src/testRunner/unittests/tsserver/typeAquisition.ts @@ -1,6 +1,12 @@ import { createServerHost } from "../virtualFileSystemWithWatch"; import * as ts from "../../_namespaces/ts"; -import { createProjectService, toExternalFile, TestTypingsInstaller, checkProjectActualFiles, configuredProjectAt } from "./helpers"; +import { + checkProjectActualFiles, + configuredProjectAt, + createProjectService, + TestTypingsInstaller, + toExternalFile, +} from "./helpers"; describe("unittests:: tsserver:: autoDiscovery", () => { it("does not depend on extension", () => { diff --git a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts index 42c5426b2e55d..a0db3ccd3f500 100644 --- a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts +++ b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, makeSessionRequest } from "./helpers"; +import { + createServerHost, + File, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + makeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: typeOnlyImportChains", () => { it("named export -> type-only namespace import -> named export -> named import", () => { diff --git a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts index 6a86032438680..651e0889e1a56 100644 --- a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts +++ b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts @@ -1,5 +1,13 @@ -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: typeReferenceDirectives", () => { it("when typeReferenceDirective contains UpperCasePackage", () => { diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index 267791ff75394..6c016e79cdb9c 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -1,6 +1,23 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TestTypingsInstaller, createTypesRegistry, createProjectService, checkProjectActualFiles, configuredProjectAt, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkNumberOfProjects, toExternalFile, customTypesMap, createSession } from "./helpers"; +import { + createServerHost, + File, + libFile, + TestServerHost, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + createTypesRegistry, + customTypesMap, + TestTypingsInstaller, + toExternalFile, +} from "./helpers"; import validatePackageName = ts.JsTyping.validatePackageName; import NameValidationResult = ts.JsTyping.NameValidationResult; diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 28c7bc8169cf2..de6fbde92e555 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -1,7 +1,25 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, Tsc_WatchDirectory } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, protocolFileLocationFromSubstring, baselineTsserverLogs, Logger, TestSession, toExternalFiles, createProjectService } from "./helpers"; +import { + createServerHost, + File, + libFile, + Tsc_WatchDirectory, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + Logger, + openFilesForSession, + protocolFileLocationFromSubstring, + TestSession, + toExternalFiles, +} from "./helpers"; describe("unittests:: tsserver:: watchEnvironment:: tsserverProjectSystem watchDirectories implementation", () => { function verifyCompletionListWithNewFileInSubFolder(scenario: string, tscWatchDirectory: Tsc_WatchDirectory) { diff --git a/src/testRunner/unittests/tsserver/webServer.ts b/src/testRunner/unittests/tsserver/webServer.ts index 2b6b118232302..25de36c1ff4e6 100644 --- a/src/testRunner/unittests/tsserver/webServer.ts +++ b/src/testRunner/unittests/tsserver/webServer.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { nullLogger, checkNumberOfProjects, checkProjectActualFiles, protocolFileLocationFromSubstring, protocolTextSpanWithContextFromSubstring } from "./helpers"; +import { + createServerHost, + File, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + nullLogger, + protocolFileLocationFromSubstring, + protocolTextSpanWithContextFromSubstring, +} from "./helpers"; /* eslint-disable local/boolean-trivia */ describe("unittests:: tsserver:: webServer", () => { diff --git a/src/testRunner/unittests/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 6481f0fe2be69..04d1c3745f397 100644 --- a/src/testRunner/unittests/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/virtualFileSystemWithWatch.ts @@ -1,12 +1,51 @@ import * as Harness from "../_namespaces/Harness"; import { - arrayFrom, arrayToMap, clear, clone, combinePaths, compareStringsCaseSensitive, createGetCanonicalFileName, - createMultiMap, createSystemWatchFunctions, Debug, directorySeparator, FileSystemEntryKind, FileWatcher, - FileWatcherCallback, FileWatcherEventKind, filterMutate, forEach, FormatDiagnosticsHost, FsWatchCallback, - FsWatchWorkerWatcher, generateDjb2Hash, getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, - getRelativePathToDirectoryOrUrl, hasProperty, HostWatchDirectory, HostWatchFile, identity, insertSorted, isArray, - isNumber, isString, mapDefined, matchFiles, ModuleResolutionHost, MultiMap, noop, - patchWriteFileEnsuringDirectory, Path, PollingInterval, RequireResult, server, SortedArray, sys, toPath, + arrayFrom, + arrayToMap, + clear, + clone, + combinePaths, + compareStringsCaseSensitive, + createGetCanonicalFileName, + createMultiMap, + createSystemWatchFunctions, + Debug, + directorySeparator, + FileSystemEntryKind, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + filterMutate, + forEach, + FormatDiagnosticsHost, + FsWatchCallback, + FsWatchWorkerWatcher, + generateDjb2Hash, + getBaseFileName, + getDirectoryPath, + getNormalizedAbsolutePath, + getRelativePathToDirectoryOrUrl, + hasProperty, + HostWatchDirectory, + HostWatchFile, + identity, + insertSorted, + isArray, + isNumber, + isString, + mapDefined, + matchFiles, + ModuleResolutionHost, + MultiMap, + noop, + patchWriteFileEnsuringDirectory, + Path, + PollingInterval, + RequireResult, + server, + SortedArray, + sys, + toPath, } from "../_namespaces/ts"; import { timeIncrements } from "../_namespaces/vfs"; diff --git a/src/tsserver/common.ts b/src/tsserver/common.ts index e2d3ad716e4b7..f62f1316de1f3 100644 --- a/src/tsserver/common.ts +++ b/src/tsserver/common.ts @@ -1,5 +1,8 @@ import { - Logger, LogLevel, ServerCancellationToken, StartSessionOptions, + Logger, + LogLevel, + ServerCancellationToken, + StartSessionOptions, } from "./_namespaces/ts.server"; import { LanguageServiceMode } from "./_namespaces/ts"; diff --git a/src/tsserver/nodeServer.ts b/src/tsserver/nodeServer.ts index 20800b86cd3fb..bcf2e0128ddae 100644 --- a/src/tsserver/nodeServer.ts +++ b/src/tsserver/nodeServer.ts @@ -1,21 +1,81 @@ import * as ts from "./_namespaces/ts"; import * as server from "./_namespaces/ts.server"; import { - ActionInvalidate, ActionPackageInstalled, ActionSet, Arguments, BaseLogger, BeginInstallTypes, - createInstallTypingsRequest, EndInstallTypes, EventBeginInstallTypes, EventEndInstallTypes, - EventInitializationFailed, EventTypesRegistry, findArgument, formatMessage, getLogLevel, hasArgument, indent, - InitializationFailedResponse, InstallPackageOptionsWithProject, InstallPackageRequest, InvalidateCachedTypings, - ITypingsInstaller, Logger, LogLevel, ModuleImportResult, Msg, nullCancellationToken, nullTypingsInstaller, - PackageInstalledResponse, Project, ProjectService, protocol, ServerCancellationToken, ServerHost, Session, - SetTypings, StartInput, StartSessionOptions, stringifyIndented, toEvent, TypesRegistryResponse, + ActionInvalidate, + ActionPackageInstalled, + ActionSet, + Arguments, + BaseLogger, + BeginInstallTypes, + createInstallTypingsRequest, + EndInstallTypes, + EventBeginInstallTypes, + EventEndInstallTypes, + EventInitializationFailed, + EventTypesRegistry, + findArgument, + formatMessage, + getLogLevel, + hasArgument, + indent, + InitializationFailedResponse, + InstallPackageOptionsWithProject, + InstallPackageRequest, + InvalidateCachedTypings, + ITypingsInstaller, + Logger, + LogLevel, + ModuleImportResult, + Msg, + nullCancellationToken, + nullTypingsInstaller, + PackageInstalledResponse, + Project, + ProjectService, + protocol, + ServerCancellationToken, + ServerHost, + Session, + SetTypings, + StartInput, + StartSessionOptions, + stringifyIndented, + toEvent, + TypesRegistryResponse, TypingInstallerRequestUnion, } from "./_namespaces/ts.server"; import { - ApplyCodeActionCommandResult, assertType, CharacterCodes, combinePaths, createQueue, Debug, directorySeparator, - DirectoryWatcherCallback, FileWatcher, getDirectoryPath, getEntries, getNodeMajorVersion, getRootLength, - JsTyping, LanguageServiceMode, MapLike, noop, noopFileWatcher, normalizePath, normalizeSlashes, resolveJSModule, - SortedReadonlyArray, startTracing, stripQuotes, sys, toFileNameLowerCase, tracing, TypeAcquisition, - validateLocaleAndSetLanguage, versionMajorMinor, WatchOptions, + ApplyCodeActionCommandResult, + assertType, + CharacterCodes, + combinePaths, + createQueue, + Debug, + directorySeparator, + DirectoryWatcherCallback, + FileWatcher, + getDirectoryPath, + getEntries, + getNodeMajorVersion, + getRootLength, + JsTyping, + LanguageServiceMode, + MapLike, + noop, + noopFileWatcher, + normalizePath, + normalizeSlashes, + resolveJSModule, + SortedReadonlyArray, + startTracing, + stripQuotes, + sys, + toFileNameLowerCase, + tracing, + TypeAcquisition, + validateLocaleAndSetLanguage, + versionMajorMinor, + WatchOptions, } from "./_namespaces/ts"; interface LogOptions { diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index f88fcb3bff204..c95b6b420d150 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -1,8 +1,20 @@ import { - emptyArray, findArgument, hasArgument, initializeNodeSystem, initializeWebSystem, Msg, + emptyArray, + findArgument, + hasArgument, + initializeNodeSystem, + initializeWebSystem, + Msg, StartInput, } from "./_namespaces/ts.server"; -import { Debug, getNodeMajorVersion, setStackTraceLimit, sys, version } from "./_namespaces/ts"; +import { + Debug, + getNodeMajorVersion, + setStackTraceLimit, + sys, + version, +} from "./_namespaces/ts"; + export * from "./_namespaces/ts"; declare const addEventListener: any; diff --git a/src/tsserver/webServer.ts b/src/tsserver/webServer.ts index 712baecea0a58..d3ad989f20001 100644 --- a/src/tsserver/webServer.ts +++ b/src/tsserver/webServer.ts @@ -3,14 +3,30 @@ import * as ts from "./_namespaces/ts"; import * as server from "./_namespaces/ts.server"; import { - findArgument, getLogLevel, Logger, MainProcessLogger, Msg, nullCancellationToken, ServerCancellationToken, - ServerHost, StartInput, StartSessionOptions, WebHost, + findArgument, + getLogLevel, + Logger, + MainProcessLogger, + Msg, + nullCancellationToken, + ServerCancellationToken, + ServerHost, + StartInput, + StartSessionOptions, + WebHost, } from "./_namespaces/ts.server"; import { - Debug, LanguageServiceMode, LogLevel, noop, returnFalse, returnUndefined, setSys, sys, validateLocaleAndSetLanguage, + Debug, + LanguageServiceMode, + LogLevel, + noop, + returnFalse, + returnUndefined, + setSys, + sys, + validateLocaleAndSetLanguage, } from "./_namespaces/ts"; - const nullLogger: Logger = { close: noop, hasLevel: returnFalse, diff --git a/src/tsserverlibrary/tsserverlibrary.ts b/src/tsserverlibrary/tsserverlibrary.ts index 6d2ea4f2b682b..6651ea687d4d7 100644 --- a/src/tsserverlibrary/tsserverlibrary.ts +++ b/src/tsserverlibrary/tsserverlibrary.ts @@ -1,2 +1,3 @@ import * as ts from "./_namespaces/ts"; + export = ts; diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index 2b6f76c71d418..9f1934f652a2c 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -1,4 +1,8 @@ -import { Debug, LogLevel } from "./_namespaces/ts"; +import { + Debug, + LogLevel, +} from "./_namespaces/ts"; +import * as ts from "./_namespaces/ts"; // enable deprecation logging declare const console: any; @@ -15,5 +19,4 @@ if (typeof console !== "undefined") { }; } -import * as ts from "./_namespaces/ts"; export = ts; diff --git a/src/typingsInstaller/nodeTypingsInstaller.ts b/src/typingsInstaller/nodeTypingsInstaller.ts index 6b996af1fdafd..0d8d0eb5d61aa 100644 --- a/src/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/typingsInstaller/nodeTypingsInstaller.ts @@ -2,16 +2,39 @@ import * as fs from "fs"; import * as path from "path"; import { - installNpmPackages, Log, RequestCompletedAction, TypingsInstaller, + installNpmPackages, + Log, + RequestCompletedAction, + TypingsInstaller, } from "./_namespaces/ts.server.typingsInstaller"; import { - ActionPackageInstalled, Arguments, EventTypesRegistry, findArgument, hasArgument, InitializationFailedResponse, - InstallTypingHost, nowString, PackageInstalledResponse, TypesRegistryResponse, TypingInstallerRequestUnion, + ActionPackageInstalled, + Arguments, + EventTypesRegistry, + findArgument, + hasArgument, + InitializationFailedResponse, + InstallTypingHost, + nowString, + PackageInstalledResponse, + TypesRegistryResponse, + TypingInstallerRequestUnion, TypingInstallerResponseUnion, } from "./_namespaces/ts.server"; import { - combinePaths, createGetCanonicalFileName, Debug, forEachAncestorDirectory, getDirectoryPath, getEntries, - MapLike, normalizePath, normalizeSlashes, stringContains, sys, toPath, version, + combinePaths, + createGetCanonicalFileName, + Debug, + forEachAncestorDirectory, + getDirectoryPath, + getEntries, + MapLike, + normalizePath, + normalizeSlashes, + stringContains, + sys, + toPath, + version, } from "./_namespaces/ts"; class FileLog implements Log { diff --git a/src/typingsInstallerCore/typingsInstaller.ts b/src/typingsInstallerCore/typingsInstaller.ts index 3f3ab40d3d940..81c6ec68a107f 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -1,14 +1,52 @@ import { - clearMap, closeFileWatcher, combinePaths, compareStringsCaseInsensitive, Comparison, containsPath, copyEntries, - createGetCanonicalFileName, directorySeparator, Extension, fileExtensionIs, FileWatcher, getBaseFileName, - GetCanonicalFileName, getDirectoryPath, getProperty, getWatchFactory, hasProperty, JsTyping, - mangleScopedPackageName, mapDefined, MapLike, ModuleResolutionKind, noop, Path, PollingInterval, - resolveModuleName, version, Version, versionMajorMinor, WatchDirectoryFlags, WatchFactory, WatchFactoryHost, - WatchLogLevel, WatchOptions, + clearMap, + closeFileWatcher, + combinePaths, + compareStringsCaseInsensitive, + 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, ActionSet, BeginInstallTypes, CloseProject, DiscoverTypings, EndInstallTypes, - EventBeginInstallTypes, EventEndInstallTypes, InstallTypingHost, InvalidateCachedTypings, SetTypings, + ActionInvalidate, + ActionSet, + BeginInstallTypes, + CloseProject, + DiscoverTypings, + EndInstallTypes, + EventBeginInstallTypes, + EventEndInstallTypes, + InstallTypingHost, + InvalidateCachedTypings, + SetTypings, } from "./_namespaces/ts.server"; interface NpmConfig { diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index 07280259807dc..f5cc041c7b601 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -2,12 +2,32 @@ /// import { - indent, Logger, LogLevel, ModuleImportResult, Msg, nowString, nullTypingsInstaller, protocol, - ServerCancellationToken, ServerHost, Session, SessionOptions, + indent, + Logger, + LogLevel, + ModuleImportResult, + Msg, + nowString, + nullTypingsInstaller, + protocol, + ServerCancellationToken, + ServerHost, + Session, + SessionOptions, } from "./_namespaces/ts.server"; import { - combinePaths, Debug, directorySeparator, ensureTrailingDirectorySeparator, getDirectoryPath, identity, memoize, - notImplemented, perfLogger, returnFalse, returnNoopFileWatcher, startsWith, + combinePaths, + Debug, + directorySeparator, + ensureTrailingDirectorySeparator, + getDirectoryPath, + identity, + memoize, + notImplemented, + perfLogger, + returnFalse, + returnNoopFileWatcher, + startsWith, } from "./_namespaces/ts"; /** @internal */ From ca5a93902ae91cb61b9adc37de44caac37b57e63 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:24:25 -0800 Subject: [PATCH 3/6] Add lint rule --- .eslintrc.json | 6 ++++++ Herebyfile.mjs | 6 +++--- scripts/build/findUpDir.mjs | 2 +- scripts/build/projects.mjs | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2b6afe437b0f5..5dd81f7d7eed2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,6 +13,12 @@ "@typescript-eslint", "no-null", "import", "eslint-plugin-local" ], "rules": { + "sort-imports": ["error", { + "ignoreCase": true, + "ignoreDeclarationSort": true, + "allowSeparatedGroups": true + }], + "@typescript-eslint/adjacent-overload-signatures": "error", "@typescript-eslint/array-type": "error", "@typescript-eslint/no-array-constructor": "error", diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 9a4fff3df2756..4a916bbf4c0ea 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -6,9 +6,9 @@ import { task } from "hereby"; import _glob from "glob"; import util from "util"; import chalk from "chalk"; -import { exec, readJson, getDiffTool, getDirSize, memoize, needsUpdate, Debouncer, Deferred } from "./scripts/build/utils.mjs"; -import { runConsoleTests, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline, cleanTestDirs } from "./scripts/build/tests.mjs"; -import { buildProject as realBuildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs"; +import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs"; +import { cleanTestDirs, localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs"; +import { cleanProject, buildProject as realBuildProject, watchProject } from "./scripts/build/projects.mjs"; import { localizationDirectories } from "./scripts/build/localization.mjs"; import cmdLineOptions from "./scripts/build/options.mjs"; import esbuild from "esbuild"; diff --git a/scripts/build/findUpDir.mjs b/scripts/build/findUpDir.mjs index b88efd92fe10f..e663697db4451 100644 --- a/scripts/build/findUpDir.mjs +++ b/scripts/build/findUpDir.mjs @@ -1,4 +1,4 @@ -import { join, resolve, dirname } from "path"; +import { dirname, join, resolve } from "path"; import { existsSync } from "fs"; import url from "url"; diff --git a/scripts/build/projects.mjs b/scripts/build/projects.mjs index df5a4906e1702..6df499445c177 100644 --- a/scripts/build/projects.mjs +++ b/scripts/build/projects.mjs @@ -1,4 +1,4 @@ -import { exec, Debouncer } from "./utils.mjs"; +import { Debouncer, exec } from "./utils.mjs"; import { resolve } from "path"; import { findUpRoot } from "./findUpDir.mjs"; import cmdLineOptions from "./options.mjs"; From 4a469f2e04cd142a58a88a9cb3fdaf0d3c32d778 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:27:39 -0800 Subject: [PATCH 4/6] Don't actually depend on the formatting tool --- package-lock.json | 514 ---------------------------------------------- package.json | 1 - 2 files changed, 515 deletions(-) diff --git a/package-lock.json b/package-lock.json index ae6899c3aea1f..de4243a40639a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,6 @@ "eslint-plugin-local": "^1.0.0", "eslint-plugin-no-null": "^1.0.2", "fast-xml-parser": "^4.0.11", - "format-imports": "^3.1.2", "fs-extra": "^9.1.0", "glob": "latest", "hereby": "^1.6.4", @@ -59,52 +58,6 @@ "node": ">=4.2.0" } }, - "node_modules/@dozerg/condition": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@dozerg/condition/-/condition-1.0.3.tgz", - "integrity": "sha512-1ojWsX70X8VgIRlWUHJuBbHTloqz/ihObK1qOCNnhvioPHy2Fs6+UX+LaY1LwzKi4b4G1CMkcPe8FfKOifP+DQ==", - "dev": true - }, - "node_modules/@dozerg/end-of-line": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@dozerg/end-of-line/-/end-of-line-1.0.10.tgz", - "integrity": "sha512-0ySfd/2nW/lPPuVXCSi6NCVT5hCGX0t8668Aa4YcuJu03ClRQOvvUsTvxU8qdfbA/3bpoceoEP40GFm9w9bJoA==", - "dev": true - }, - "node_modules/@dozerg/find-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@dozerg/find-up/-/find-up-1.0.1.tgz", - "integrity": "sha512-ZogqJqvf9M5xRBm6N6jVp7m/clE2JWeEy/1mz25Wv1yL7qquqSHz3oEe5n4x7C6OBcdx/QiHooFxV3FEz7ME2A==", - "dev": true, - "dependencies": { - "@dozerg/condition": "^1.0.1" - } - }, - "node_modules/@dozerg/merge-options": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@dozerg/merge-options/-/merge-options-1.0.4.tgz", - "integrity": "sha512-cUq8p/l6HEGNVcqIuzw61K33mvIeYd9g4lW+Ed6LZ9V4KAiWH9iPvtK9W4XQmdOYn/0F05904UOE7UEL/WLcng==", - "dev": true, - "dependencies": { - "@dozerg/condition": "^1.0.3" - } - }, - "node_modules/@dozerg/no-new": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@dozerg/no-new/-/no-new-0.0.1.tgz", - "integrity": "sha512-+cEHmWDW2icAQ8BBoIiZIT4scqaTp1IRwu5KoH78SdRt25gFWL7o035wTEvzN+DVzQ6BiAMlSpjonQASzskuOQ==", - "dev": true - }, - "node_modules/@dozerg/require-module": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@dozerg/require-module/-/require-module-0.0.2.tgz", - "integrity": "sha512-N46+e1YRQZ/X735duKN8ogqG5oAgpr9rAh60UoBdtf1enggEC28IuC0uEYnntx7MIsyaOteDkpPfRkLbOcB5Gw==", - "dev": true, - "dependencies": { - "@dozerg/find-up": "^1.0.1", - "log4js": "^6.4.4" - } - }, "node_modules/@esbuild/android-arm": { "version": "0.15.14", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.14.tgz", @@ -954,18 +907,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/builtin-modules": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", - "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1090,15 +1031,6 @@ "wrap-ansi": "^7.0.0" } }, - "node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "dev": true, - "engines": { - "node": ">=0.8" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1265,15 +1197,6 @@ "node": ">= 12" } }, - "node_modules/date-format": { - "version": "4.0.14", - "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", - "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2394,70 +2317,6 @@ "node": ">=8.0.0" } }, - "node_modules/format-imports": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/format-imports/-/format-imports-3.1.2.tgz", - "integrity": "sha512-JpchwcrRvaZ7wAyiW9HotLuT39pN815dXz8qAjzNaAYW2XK/lpTmkNALrXUr6d+zaufj9hqWIeg4cDBa0B/dRA==", - "dev": true, - "dependencies": { - "@dozerg/condition": "^1.0.3", - "@dozerg/end-of-line": "^1.0.10", - "@dozerg/merge-options": "^1.0.4", - "@dozerg/no-new": "^0.0.1", - "@dozerg/require-module": "^0.0.2", - "eslint": "^8.26.0", - "fs-extra": "^10.1.0", - "immutable": "^4.1.0", - "is-builtin-module": "^3.2.0", - "log4js": "^6.7.0", - "minimatch": "^5.1.0", - "node-cache": "^5.1.2", - "optionator": "^0.9.1", - "prettier": "^2.7.1", - "segment-sort": "^1.0.1", - "tmp": "^0.2.1", - "typescript": "^4.8.4", - "utility-types": "^3.10.0" - }, - "bin": { - "format-imports": "dist/bin/main.js" - } - }, - "node_modules/format-imports/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/format-imports/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/format-imports/node_modules/minimatch": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", - "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -2793,12 +2652,6 @@ "node": ">= 4" } }, - "node_modules/immutable": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz", - "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", - "dev": true - }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -2922,21 +2775,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-builtin-module": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.0.tgz", - "integrity": "sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw==", - "dev": true, - "dependencies": { - "builtin-modules": "^3.3.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -3282,22 +3120,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log4js": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz", - "integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==", - "dev": true, - "dependencies": { - "date-format": "^4.0.14", - "debug": "^4.3.4", - "flatted": "^3.2.7", - "rfdc": "^1.3.0", - "streamroller": "^3.1.3" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -3515,18 +3337,6 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, - "node_modules/node-cache": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", - "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", - "dev": true, - "dependencies": { - "clone": "2.x" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -3814,21 +3624,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "node_modules/pretty-ms": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", @@ -3992,12 +3787,6 @@ "node": ">=0.10.0" } }, - "node_modules/rfdc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", - "dev": true - }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -4090,12 +3879,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/segment-sort": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/segment-sort/-/segment-sort-1.0.1.tgz", - "integrity": "sha512-ebmIfxnVtkPRk/fBTnXHHHouFRPRnbtaFSpw7NqUdaVnlDRMSG1sjSum4zvt08FvGbBkDsq7scJSgzIcnF7fAQ==", - "dev": true - }, "node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -4189,52 +3972,6 @@ "source-map": "^0.6.0" } }, - "node_modules/streamroller": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz", - "integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==", - "dev": true, - "dependencies": { - "date-format": "^4.0.14", - "debug": "^4.3.4", - "fs-extra": "^8.1.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/streamroller/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/streamroller/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/streamroller/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -4379,18 +4116,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, - "dependencies": { - "rimraf": "^3.0.0" - }, - "engines": { - "node": ">=8.17.0" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -4568,15 +4293,6 @@ "punycode": "^2.1.0" } }, - "node_modules/utility-types": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz", - "integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/web-streams-polyfill": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", @@ -4764,52 +4480,6 @@ } }, "dependencies": { - "@dozerg/condition": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@dozerg/condition/-/condition-1.0.3.tgz", - "integrity": "sha512-1ojWsX70X8VgIRlWUHJuBbHTloqz/ihObK1qOCNnhvioPHy2Fs6+UX+LaY1LwzKi4b4G1CMkcPe8FfKOifP+DQ==", - "dev": true - }, - "@dozerg/end-of-line": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@dozerg/end-of-line/-/end-of-line-1.0.10.tgz", - "integrity": "sha512-0ySfd/2nW/lPPuVXCSi6NCVT5hCGX0t8668Aa4YcuJu03ClRQOvvUsTvxU8qdfbA/3bpoceoEP40GFm9w9bJoA==", - "dev": true - }, - "@dozerg/find-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@dozerg/find-up/-/find-up-1.0.1.tgz", - "integrity": "sha512-ZogqJqvf9M5xRBm6N6jVp7m/clE2JWeEy/1mz25Wv1yL7qquqSHz3oEe5n4x7C6OBcdx/QiHooFxV3FEz7ME2A==", - "dev": true, - "requires": { - "@dozerg/condition": "^1.0.1" - } - }, - "@dozerg/merge-options": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@dozerg/merge-options/-/merge-options-1.0.4.tgz", - "integrity": "sha512-cUq8p/l6HEGNVcqIuzw61K33mvIeYd9g4lW+Ed6LZ9V4KAiWH9iPvtK9W4XQmdOYn/0F05904UOE7UEL/WLcng==", - "dev": true, - "requires": { - "@dozerg/condition": "^1.0.3" - } - }, - "@dozerg/no-new": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@dozerg/no-new/-/no-new-0.0.1.tgz", - "integrity": "sha512-+cEHmWDW2icAQ8BBoIiZIT4scqaTp1IRwu5KoH78SdRt25gFWL7o035wTEvzN+DVzQ6BiAMlSpjonQASzskuOQ==", - "dev": true - }, - "@dozerg/require-module": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@dozerg/require-module/-/require-module-0.0.2.tgz", - "integrity": "sha512-N46+e1YRQZ/X735duKN8ogqG5oAgpr9rAh60UoBdtf1enggEC28IuC0uEYnntx7MIsyaOteDkpPfRkLbOcB5Gw==", - "dev": true, - "requires": { - "@dozerg/find-up": "^1.0.1", - "log4js": "^6.4.4" - } - }, "@esbuild/android-arm": { "version": "0.15.14", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.14.tgz", @@ -5423,12 +5093,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "builtin-modules": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", - "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", - "dev": true - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -5515,12 +5179,6 @@ "wrap-ansi": "^7.0.0" } }, - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "dev": true - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -5653,12 +5311,6 @@ "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==", "dev": true }, - "date-format": { - "version": "4.0.14", - "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", - "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", - "dev": true - }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -6408,63 +6060,6 @@ "signal-exit": "^3.0.2" } }, - "format-imports": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/format-imports/-/format-imports-3.1.2.tgz", - "integrity": "sha512-JpchwcrRvaZ7wAyiW9HotLuT39pN815dXz8qAjzNaAYW2XK/lpTmkNALrXUr6d+zaufj9hqWIeg4cDBa0B/dRA==", - "dev": true, - "requires": { - "@dozerg/condition": "^1.0.3", - "@dozerg/end-of-line": "^1.0.10", - "@dozerg/merge-options": "^1.0.4", - "@dozerg/no-new": "^0.0.1", - "@dozerg/require-module": "^0.0.2", - "eslint": "^8.26.0", - "fs-extra": "^10.1.0", - "immutable": "^4.1.0", - "is-builtin-module": "^3.2.0", - "log4js": "^6.7.0", - "minimatch": "^5.1.0", - "node-cache": "^5.1.2", - "optionator": "^0.9.1", - "prettier": "^2.7.1", - "segment-sort": "^1.0.1", - "tmp": "^0.2.1", - "typescript": "^4.8.4", - "utility-types": "^3.10.0" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "minimatch": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", - "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, "formdata-polyfill": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", @@ -6705,12 +6300,6 @@ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, - "immutable": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz", - "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", - "dev": true - }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -6800,15 +6389,6 @@ "has-tostringtag": "^1.0.0" } }, - "is-builtin-module": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.0.tgz", - "integrity": "sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw==", - "dev": true, - "requires": { - "builtin-modules": "^3.3.0" - } - }, "is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -7050,19 +6630,6 @@ "is-unicode-supported": "^0.1.0" } }, - "log4js": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz", - "integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==", - "dev": true, - "requires": { - "date-format": "^4.0.14", - "debug": "^4.3.4", - "flatted": "^3.2.7", - "rfdc": "^1.3.0", - "streamroller": "^3.1.3" - } - }, "loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -7233,15 +6800,6 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, - "node-cache": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", - "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", - "dev": true, - "requires": { - "clone": "2.x" - } - }, "node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -7428,12 +6986,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", - "dev": true - }, "pretty-ms": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", @@ -7534,12 +7086,6 @@ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, - "rfdc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", - "dev": true - }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -7591,12 +7137,6 @@ "is-regex": "^1.1.4" } }, - "segment-sort": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/segment-sort/-/segment-sort-1.0.1.tgz", - "integrity": "sha512-ebmIfxnVtkPRk/fBTnXHHHouFRPRnbtaFSpw7NqUdaVnlDRMSG1sjSum4zvt08FvGbBkDsq7scJSgzIcnF7fAQ==", - "dev": true - }, "semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -7669,45 +7209,6 @@ "source-map": "^0.6.0" } }, - "streamroller": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz", - "integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==", - "dev": true, - "requires": { - "date-format": "^4.0.14", - "debug": "^4.3.4", - "fs-extra": "^8.1.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - } - } - }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -7815,15 +7316,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, - "requires": { - "rimraf": "^3.0.0" - } - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -7963,12 +7455,6 @@ "punycode": "^2.1.0" } }, - "utility-types": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz", - "integrity": "sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==", - "dev": true - }, "web-streams-polyfill": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", diff --git a/package.json b/package.json index 4025d40c76e70..7f8ab9163074f 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "eslint-plugin-local": "^1.0.0", "eslint-plugin-no-null": "^1.0.2", "fast-xml-parser": "^4.0.11", - "format-imports": "^3.1.2", "fs-extra": "^9.1.0", "glob": "latest", "hereby": "^1.6.4", From 53aeebfe14b0e5f786f718c17b34c00109e60c59 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:36:07 -0800 Subject: [PATCH 5/6] Make case sensitive --- .eslintrc.json | 1 - src/compiler/binder.ts | 178 ++--- src/compiler/builder.ts | 52 +- src/compiler/builderPublic.ts | 6 +- src/compiler/builderState.ts | 30 +- src/compiler/checker.ts | 754 +++++++++--------- src/compiler/commandLineParser.ts | 88 +- src/compiler/core.ts | 4 +- src/compiler/debug.ts | 58 +- src/compiler/emitter.ts | 382 ++++----- 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 | 282 +++---- 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 | 64 +- src/compiler/moduleSpecifiers.ts | 64 +- src/compiler/parser.ts | 194 ++--- src/compiler/path.ts | 8 +- src/compiler/performance.ts | 4 +- src/compiler/performanceCore.ts | 2 +- src/compiler/program.ts | 210 ++--- src/compiler/resolutionCache.ts | 60 +- 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 | 108 +-- src/compiler/utilities.ts | 460 +++++------ src/compiler/utilitiesPublic.ts | 196 ++--- src/compiler/visitorPublic.ts | 28 +- src/compiler/watch.ts | 86 +- src/compiler/watchPublic.ts | 86 +- 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 | 28 +- src/jsTyping/jsTyping.ts | 14 +- src/server/editorServices.ts | 136 ++-- src/server/moduleSpecifierCache.ts | 2 +- src/server/packageJsonCache.ts | 8 +- src/server/project.ts | 130 +-- 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 | 14 +- .../codefixes/fixIncorrectNamedTupleSyntax.ts | 6 +- .../codefixes/fixInvalidImportSyntax.ts | 18 +- .../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 | 88 +- src/services/codefixes/inferFromUsage.ts | 92 +-- .../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 | 214 ++--- src/services/documentHighlights.ts | 56 +- src/services/documentRegistry.ts | 20 +- src/services/exportInfoMap.ts | 34 +- src/services/findAllReferences.ts | 146 ++-- 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 | 44 +- src/services/importTracker.ts | 54 +- src/services/inlayHints.ts | 50 +- src/services/jsDoc.ts | 68 +- src/services/navigateTo.ts | 26 +- src/services/navigationBar.ts | 64 +- src/services/organizeImports.ts | 44 +- 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 | 36 +- .../generateGetAccessorAndSetAccessor.ts | 4 +- .../refactors/inferFunctionReturnType.ts | 26 +- src/services/refactors/moveToNewFile.ts | 98 +-- src/services/rename.ts | 46 +- src/services/services.ts | 282 +++---- 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 | 246 +++--- 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 | 10 +- .../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 | 6 +- .../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 | 6 +- .../unittests/tsserver/cancellationToken.ts | 2 +- .../unittests/tsserver/compileOnSave.ts | 6 +- .../unittests/tsserver/completions.ts | 4 +- .../tsserver/completionsIncomplete.ts | 2 +- .../unittests/tsserver/configFileSearch.ts | 2 +- .../unittests/tsserver/configuredProjects.ts | 4 +- .../unittests/tsserver/declarationFileMaps.ts | 6 +- .../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 | 4 +- .../unittests/tsserver/getFileReferences.ts | 2 +- src/testRunner/unittests/tsserver/helpers.ts | 8 +- .../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 | 4 +- 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 | 6 +- src/testRunner/unittests/tsserver/projects.ts | 2 +- .../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 | 4 +- .../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/tsserver/webServer.ts | 2 +- .../unittests/virtualFileSystemWithWatch.ts | 32 +- src/tsserver/common.ts | 2 +- src/tsserver/nodeServer.ts | 46 +- src/tsserver/server.ts | 4 +- src/tsserver/webServer.ts | 6 +- src/typingsInstaller/nodeTypingsInstaller.ts | 12 +- src/typingsInstallerCore/typingsInstaller.ts | 30 +- src/webServer/webServer.ts | 12 +- 318 files changed, 5183 insertions(+), 5184 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 5dd81f7d7eed2..7b7c1f525891c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,7 +14,6 @@ ], "rules": { "sort-imports": ["error", { - "ignoreCase": true, "ignoreDeclarationSort": true, "allowSeparatedGroups": true }], diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 64fbdbce0e572..60172033a77aa 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,9 +1,5 @@ import { - __String, AccessExpression, - addRelatedInfo, - append, - appendIfUnique, ArrayBindingElement, ArrayLiteralExpression, ArrowFunction, @@ -23,57 +19,129 @@ import { CallExpression, CaseBlock, CaseClause, - cast, CatchClause, ClassLikeDeclaration, ClassStaticBlockDeclaration, CompilerOptions, - concatenate, ConditionalExpression, ConditionalTypeNode, - contains, - createBinaryExpressionTrampoline, - createDiagnosticForNodeInSourceFile, - createFileDiagnostic, - createQueue, - createSymbolTable, Debug, Declaration, - declarationNameToString, DeleteExpression, DestructuringAssignment, DiagnosticCategory, DiagnosticMessage, DiagnosticRelatedInformation, - 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, + Identifier, + IfStatement, + ImportClause, + InternalSymbolName, + JSDocCallbackTag, + JSDocClassTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTypeLiteral, + JSDocTypedefTag, + JsxAttribute, + JsxAttributes, + LabeledStatement, + LiteralLikeElementAccessExpression, + MappedTypeNode, + MethodDeclaration, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + Mutable, + NamespaceExportDeclaration, + Node, + NodeArray, + NodeFlags, + NonNullChain, + NonNullExpression, + NumericLiteral, + ObjectLiteralExpression, + OptionalChain, + ParameterDeclaration, + ParenthesizedExpression, + Pattern, + PatternAmbientModule, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAccessChain, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + ReturnStatement, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SignatureDeclaration, + SourceFile, + SpreadElement, + Statement, + StringLiteral, + SwitchStatement, + Symbol, + SymbolFlags, + SymbolTable, + SyntaxKind, + TextRange, + ThrowStatement, + TokenFlags, + TracingNode, + TryStatement, + TypeLiteralNode, + TypeOfExpression, + TypeParameterDeclaration, + VariableDeclaration, + WhileStatement, + WithStatement, + __String, + addRelatedInfo, + append, + appendIfUnique, + cast, + concatenate, + contains, + createBinaryExpressionTrampoline, + createDiagnosticForNodeInSourceFile, + createFileDiagnostic, + createQueue, + createSymbolTable, + declarationNameToString, + escapeLeadingUnderscores, + every, + exportAssignmentIsAlias, + findAncestor, + forEach, + forEachChild, getAssignedExpandoInitializer, getAssignmentDeclarationKind, getAssignmentDeclarationPropertyAccessKind, @@ -107,11 +175,7 @@ import { hasDynamicName, hasJSDocNodes, hasSyntacticModifier, - Identifier, idText, - IfStatement, - ImportClause, - InternalSymbolName, isAliasableExpression, isAmbientModule, isAssignmentExpression, @@ -140,8 +204,8 @@ import { isEnumDeclaration, isExportAssignment, isExportDeclaration, - isExportsIdentifier, isExportSpecifier, + isExportsIdentifier, isExpression, isExpressionOfOptionalChainRoot, isExternalModule, @@ -208,92 +272,28 @@ import { isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, - JSDocCallbackTag, - JSDocClassTag, - JSDocEnumTag, - JSDocFunctionType, - JSDocParameterTag, - JSDocPropertyLikeTag, - JSDocSignature, - JSDocTypedefTag, - JSDocTypeLiteral, - JsxAttribute, - JsxAttributes, - LabeledStatement, length, - LiteralLikeElementAccessExpression, - MappedTypeNode, - MethodDeclaration, - ModifierFlags, - ModuleBlock, - ModuleDeclaration, - Mutable, - NamespaceExportDeclaration, - Node, - NodeArray, - NodeFlags, nodeHasName, nodeIsMissing, nodeIsPresent, - NonNullChain, - NonNullExpression, - NumericLiteral, objectAllocator, - ObjectLiteralExpression, - OptionalChain, - ParameterDeclaration, - ParenthesizedExpression, - Pattern, - PatternAmbientModule, perfLogger, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrivateIdentifier, - PropertyAccessChain, - PropertyAccessExpression, - PropertyDeclaration, - PropertySignature, removeFileExtension, - ReturnStatement, - ScriptTarget, - SetAccessorDeclaration, setParent, setParentRecursive, setValueDeclaration, - ShorthandPropertyAssignment, shouldPreserveConstEnums, - SignatureDeclaration, skipParentheses, sliceAfter, some, - SourceFile, - SpreadElement, - Statement, - StringLiteral, - SwitchStatement, - Symbol, - SymbolFlags, symbolName, - SymbolTable, - SyntaxKind, - TextRange, - ThrowStatement, - TokenFlags, tokenToString, tracing, - TracingNode, tryCast, tryParsePattern, - TryStatement, - TypeLiteralNode, - TypeOfExpression, - TypeParameterDeclaration, unescapeLeadingUnderscores, unreachableCodeIsError, unusedLabelIsError, - VariableDeclaration, - WhileStatement, - WithStatement, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 6002189104f9b..313e1298f3108 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,31 @@ import { EmitAndSemanticDiagnosticsBuilderProgram, EmitOnly, EmitResult, + GetCanonicalFileName, + HostForComputeHash, + Path, + Program, + ProjectReference, + ReadBuildProgramHost, + ReadonlyCollection, + SemanticDiagnosticsBuilderProgram, + SourceFile, + SourceMapEmitResult, + WriteFileCallback, + WriteFileCallbackData, + addRange, + arrayFrom, + arrayToMap, + compareStringsCaseSensitive, + compareValues, + compilerOptionsAffectDeclarationPath, + compilerOptionsAffectEmit, + compilerOptionsAffectSemanticDiagnostics, + concatenate, + convertToOptionsWithAbsolutePaths, + createBuildInfo, + createGetCanonicalFileName, + createProgram, emitSkippedWithNoDiagnostics, emptyArray, ensurePathIsNonModuleName, @@ -42,7 +54,6 @@ import { forEachEntry, forEachKey, generateDjb2Hash, - GetCanonicalFileName, getDirectoryPath, getEmitDeclarations, getNormalizedAbsolutePath, @@ -51,7 +62,6 @@ import { getRelativePathFromDirectory, getTsBuildInfoEmitOutputFilePath, handleNoEmitOptions, - HostForComputeHash, isArray, isDeclarationFileName, isJsonSourceFile, @@ -63,23 +73,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 e664960e4d59e..0e155a0f2be9b 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 8ae0d6295ca8d..57abd590d56c9 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -1,17 +1,27 @@ import { - arrayFrom, CancellationToken, - computeSignatureWithDiagnostics, - createGetCanonicalFileName, CustomTransformers, Debug, EmitOutput, - emptyArray, ExportedModulesFromDeclarationEmit, GetCanonicalFileName, + HostForComputeHash, + ModuleDeclaration, + ModuleKind, + OutputFile, + Path, + Program, + ResolutionMode, + SourceFile, + StringLiteralLike, + Symbol, + TypeChecker, + arrayFrom, + computeSignatureWithDiagnostics, + createGetCanonicalFileName, + emptyArray, getDirectoryPath, getSourceFileOfNode, - HostForComputeHash, isDeclarationFileName, isExternalOrCommonJsModule, isGlobalScopeAugmentation, @@ -20,19 +30,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 09b5759f59bc3..b30a02406896d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,26 +1,14 @@ import * as ts from "./_namespaces/ts"; import { - __String, AccessExpression, AccessFlags, AccessorDeclaration, - addRange, - addRelatedInfo, - addSyntheticLeadingComment, AllAccessorDeclarations, - and, AnonymousType, AnyImportOrReExport, AnyImportSyntax, - append, - appendIfUnique, ArrayBindingPattern, - arrayFrom, - arrayIsHomogeneous, ArrayLiteralExpression, - arrayOf, - arraysEqual, - arrayToMultiMap, ArrayTypeNode, ArrowFunction, AssertionExpression, @@ -33,13 +21,11 @@ import { BigIntLiteralType, BinaryExpression, BinaryOperatorToken, - binarySearch, BindableObjectDefinePropertyCall, BindingElement, BindingElementGrandparent, BindingName, BindingPattern, - bindSourceFile, Block, BreakOrContinueStatement, CallChain, @@ -47,17 +33,9 @@ import { CallLikeExpression, CallSignatureDeclaration, CancellationToken, - canHaveDecorators, - canHaveExportModifier, - canHaveIllegalDecorators, - canHaveIllegalModifiers, - canHaveModifiers, - cartesianProduct, CaseBlock, CaseClause, CaseOrDefaultClause, - cast, - chainDiagnosticMessages, CharacterCodes, CheckFlags, ClassDeclaration, @@ -65,57 +43,25 @@ import { ClassExpression, ClassLikeDeclaration, ClassStaticBlockDeclaration, - clear, - combinePaths, - compareDiagnostics, - comparePaths, - compareValues, Comparison, CompilerOptions, ComputedPropertyName, - concatenate, - concatenateDiagnosticMessageChains, ConditionalExpression, ConditionalRoot, ConditionalType, ConditionalTypeNode, + ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, - contains, - containsParseError, ContextFlags, - copyEntries, - countWhere, - createBinaryExpressionTrampoline, - createCompilerDiagnostic, - createDiagnosticCollection, - createDiagnosticForFileFromMessageChain, - createDiagnosticForNode, - createDiagnosticForNodeArray, - createDiagnosticForNodeFromMessageChain, - createDiagnosticMessageChainFromDiagnostic, - createEmptyExports, - createFileDiagnostic, - createGetCanonicalFileName, - createGetSymbolWalker, - createPrinter, - createPropertyNameNodeForIdentifierOrLiteral, - createScanner, - createSymbolTable, - createTextWriter, - createUnderscoreEscapedMultiMap, Debug, Declaration, DeclarationName, - declarationNameToString, DeclarationStatement, DeclarationWithTypeParameterChildren, DeclarationWithTypeParameters, Decorator, - deduplicate, DefaultClause, - defaultMaximumTruncationLength, DeferredTypeReference, DeleteExpression, Diagnostic, @@ -123,8 +69,8 @@ import { DiagnosticMessage, DiagnosticMessageChain, DiagnosticRelatedInformation, - Diagnostics, DiagnosticWithLocation, + Diagnostics, DoStatement, DynamicNamedDeclaration, ElementAccessChain, @@ -134,30 +80,382 @@ import { EmitHint, EmitResolver, EmitTextWriter, - emptyArray, - endsWith, EntityName, EntityNameExpression, EntityNameOrEntityNameExpression, - entityNameToString, EnumDeclaration, EnumMember, - equateValues, - escapeLeadingUnderscores, - escapeString, - every, EvolvingArrayType, ExclamationToken, ExportAssignment, - exportAssignmentIsAlias, ExportDeclaration, ExportSpecifier, Expression, - expressionResultIsUnused, ExpressionStatement, ExpressionWithTypeArguments, Extension, ExternalEmitHelpers, + FlowArrayMutation, + FlowAssignment, + FlowCall, + FlowCondition, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, + FlowStart, + FlowSwitchClause, + FlowType, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FreshObjectLiteralType, + FreshableIntrinsicType, + FreshableType, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + FunctionTypeNode, + GenericType, + GetAccessorDeclaration, + HasDecorators, + HasExpressionInitializer, + HasIllegalDecorators, + HasIllegalModifiers, + HasInitializer, + HasModifiers, + HeritageClause, + Identifier, + IdentifierTypePredicate, + IfStatement, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + ImportsNotUsedAsValues, + IncompleteType, + IndexInfo, + IndexKind, + IndexSignatureDeclaration, + IndexType, + IndexedAccessType, + IndexedAccessTypeNode, + InferTypeNode, + InferenceContext, + InferenceFlags, + InferenceInfo, + InferencePriority, + InstantiableType, + InstantiationExpressionType, + InterfaceDeclaration, + InterfaceType, + InterfaceTypeWithDeclaredMembers, + InternalSymbolName, + IntersectionType, + IntersectionTypeNode, + IntrinsicType, + IterableOrIteratorType, + IterationTypes, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocContainer, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNullableType, + JSDocOptionalType, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocSignature, + JSDocTemplateTag, + JSDocTypeExpression, + JSDocTypeReferencingNode, + JSDocTypeTag, + JSDocTypedefTag, + JSDocVariadicType, + JsxAttribute, + JsxAttributeLike, + JsxAttributes, + JsxChild, + JsxClosingElement, + JsxElement, + JsxEmit, + JsxExpression, + JsxFlags, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxReferenceKind, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + KeywordTypeNode, + LabeledStatement, + LateBoundBinaryExpressionDeclaration, + LateBoundDeclaration, + LateBoundName, + LateVisibilityPaintedStatement, + LeftHandSideExpression, + LiteralExpression, + LiteralType, + LiteralTypeNode, + MappedSymbol, + MappedType, + MappedTypeNode, + MatchingKeys, + MemberName, + MemberOverrideStatus, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + Modifier, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + ModuleInstanceState, + ModuleKind, + ModuleResolutionKind, + NamedDeclaration, + NamedExports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceDeclaration, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeBuilderFlags, + NodeCheckFlags, + NodeFlags, + NodeLinks, + NodeWithTypeArguments, + NonNullChain, + NonNullExpression, + NumberLiteralType, + NumericLiteral, + ObjectBindingPattern, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ObjectType, + OptionalChain, + OptionalTypeNode, + OuterExpressionKinds, + ParameterDeclaration, + ParameterPropertyDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + Path, + PatternAmbientModule, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PromiseOrAwaitableType, + PropertyAccessChain, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + PseudoBigInt, + QualifiedName, + QuestionToken, + ReadonlyKeyword, + RelationComparisonResult, + ResolutionMode, + ResolvedModuleFull, + ResolvedType, + RestTypeNode, + ReturnStatement, + ReverseMappedSymbol, + ReverseMappedType, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SourceFile, + SpreadAssignment, + SpreadElement, + Statement, + StringLiteral, + StringLiteralLike, + StringLiteralType, + StringMappingType, + StructuredType, + SubstitutionType, + SuperCall, + SwitchStatement, + Symbol, + SymbolAccessibility, + SymbolAccessibilityResult, + SymbolFlags, + SymbolFormatFlags, + SymbolId, + SymbolLinks, + SymbolTable, + SymbolTracker, + SymbolVisibilityResult, + SyntaxKind, + SyntheticDefaultModuleType, + SyntheticExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralType, + TemplateLiteralTypeNode, + Ternary, + TextSpan, + ThisExpression, + ThisTypeNode, + ThrowStatement, + TokenFlags, + TracingNode, + TransientSymbol, + TryStatement, + TupleType, + TupleTypeNode, + TupleTypeReference, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeCheckerHost, + TypeComparer, + TypeElement, + TypeFlags, + TypeFormatFlags, + TypeId, + TypeLiteralNode, + TypeMapKind, + TypeMapper, + TypeNode, + TypeNodeSyntaxKind, + TypeOfExpression, + TypeOnlyAliasDeclaration, + TypeOnlyCompatibleAliasDeclaration, + TypeOperatorNode, + TypeParameter, + TypeParameterDeclaration, + TypePredicate, + TypePredicateKind, + TypePredicateNode, + TypeQueryNode, + TypeReference, + TypeReferenceNode, + TypeReferenceSerializationKind, + TypeReferenceType, + TypeVariable, + UnaryExpression, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionOrIntersectionTypeNode, + UnionReduction, + UnionType, + UnionTypeNode, + UniqueESSymbolType, + VariableDeclaration, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, + VarianceFlags, + VisitResult, + Visitor, + VoidExpression, + WhileStatement, + WideningContext, + WithStatement, + YieldExpression, + __String, + addRange, + addRelatedInfo, + addSyntheticLeadingComment, + and, + append, + appendIfUnique, + arrayFrom, + arrayIsHomogeneous, + arrayOf, + arrayToMultiMap, + arraysEqual, + binarySearch, + bindSourceFile, + canHaveDecorators, + canHaveExportModifier, + canHaveIllegalDecorators, + canHaveIllegalModifiers, + canHaveModifiers, + cartesianProduct, + cast, + chainDiagnosticMessages, + clear, + combinePaths, + compareDiagnostics, + comparePaths, + compareValues, + concatenate, + concatenateDiagnosticMessageChains, + contains, + containsParseError, + copyEntries, + countWhere, + createBinaryExpressionTrampoline, + createCompilerDiagnostic, + createDiagnosticCollection, + createDiagnosticForFileFromMessageChain, + createDiagnosticForNode, + createDiagnosticForNodeArray, + createDiagnosticForNodeFromMessageChain, + createDiagnosticMessageChainFromDiagnostic, + createEmptyExports, + createFileDiagnostic, + createGetCanonicalFileName, + createGetSymbolWalker, + createPrinter, + createPropertyNameNodeForIdentifierOrLiteral, + createScanner, + createSymbolTable, + createTextWriter, + createUnderscoreEscapedMultiMap, + declarationNameToString, + deduplicate, + defaultMaximumTruncationLength, + emptyArray, + endsWith, + entityNameToString, + equateValues, + escapeLeadingUnderscores, + escapeString, + every, + exportAssignmentIsAlias, + expressionResultIsUnused, externalHelpersModuleNameText, factory, fileExtensionIs, @@ -175,17 +473,6 @@ import { firstOrUndefined, flatMap, flatten, - FlowArrayMutation, - FlowAssignment, - FlowCall, - FlowCondition, - FlowFlags, - FlowLabel, - FlowNode, - FlowReduceLabel, - FlowStart, - FlowSwitchClause, - FlowType, forEach, forEachChild, forEachChildRecursively, @@ -195,21 +482,7 @@ import { forEachKey, forEachReturnStatement, forEachYieldExpression, - ForInOrOfStatement, - ForInStatement, formatMessage, - ForOfStatement, - ForStatement, - FreshableIntrinsicType, - FreshableType, - FreshObjectLiteralType, - FunctionDeclaration, - FunctionExpression, - FunctionFlags, - FunctionLikeDeclaration, - FunctionTypeNode, - GenericType, - GetAccessorDeclaration, getAliasDeclarationFromName, getAllAccessorDeclarations, getAllowSyntheticDefaultImports, @@ -232,6 +505,7 @@ import { getDeclarationsOfKind, getDeclaredExpandoInitializer, getDirectoryPath, + getESModuleInterop, getEffectiveBaseTypeNode, getEffectiveConstraintOfTypeParameter, getEffectiveContainerForJSDocTemplateTag, @@ -253,7 +527,6 @@ import { getEntries, getErrorSpanForNode, getEscapedTextOfIdentifierOrLiteral, - getESModuleInterop, getExpandoInitializer, getExportAssignmentExpression, getExternalModuleImportEqualsDeclarationExpression, @@ -297,8 +570,8 @@ import { getNonAugmentationDeclaration, getNormalizedAbsolutePath, getObjectFlags, - getOriginalNode, getOrUpdate, + getOriginalNode, getOwnKeys, getParameterSymbolFromJSDoc, getParseTreeNode, @@ -338,21 +611,15 @@ import { hasAmbientModifier, hasContextSensitiveParameters, hasDecorators, - HasDecorators, hasDynamicName, hasEffectiveModifier, hasEffectiveModifiers, hasEffectiveReadonlyModifier, - HasExpressionInitializer, hasExtension, - HasIllegalDecorators, - HasIllegalModifiers, hasInitializer, - HasInitializer, hasJSDocNodes, hasJSDocParameterTags, hasJsonModuleEmitEnabled, - HasModifiers, hasOnlyExpressionInitializer, hasOverrideModifier, hasPossibleExternalModuleReference, @@ -362,43 +629,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, @@ -440,13 +673,13 @@ import { isClassLike, isClassStaticBlockDeclaration, isCommaSequence, - isCommonJsExportedExpression, isCommonJsExportPropertyAssignment, + isCommonJsExportedExpression, isComputedNonLiteralName, isComputedPropertyName, + isConstTypeReference, isConstructorDeclaration, isConstructorTypeNode, - isConstTypeReference, isDeclaration, isDeclarationName, isDeclarationReadonly, @@ -465,8 +698,8 @@ import { isExclusivelyTypeOnlyImportOrExport, isExportAssignment, isExportDeclaration, - isExportsIdentifier, isExportSpecifier, + isExportsIdentifier, isExpression, isExpressionNode, isExpressionOfOptionalChainRoot, @@ -512,15 +745,15 @@ import { isImportOrExportSpecifier, isImportSpecifier, isImportTypeNode, - isIndexedAccessTypeNode, isInExpressionContext, - isInfinityOrNaNString, isInJSDoc, isInJSFile, isInJsonFile, + isInTopLevelContext, + isIndexedAccessTypeNode, + isInfinityOrNaNString, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, - isInTopLevelContext, isIntrinsicJsxName, isIterationStatement, isJSDocAllType, @@ -543,12 +776,13 @@ import { isJSDocTemplateTag, isJSDocTypeAlias, isJSDocTypeAssertion, - isJSDocTypedefTag, isJSDocTypeExpression, isJSDocTypeLiteral, isJSDocTypeTag, + isJSDocTypedefTag, isJSDocUnknownType, isJSDocVariadicType, + isJSXTagName, isJsonSourceFile, isJsxAttribute, isJsxAttributeLike, @@ -559,7 +793,6 @@ import { isJsxOpeningLikeElement, isJsxSelfClosingElement, isJsxSpreadAttribute, - isJSXTagName, isKnownSymbol, isLateVisibilityPaintedStatement, isLeftHandSideExpression, @@ -655,9 +888,9 @@ import { isTemplateSpan, isThisContainerOrFunctionBlock, isThisIdentifier, + isThisInTypeQuery, isThisInitializedDeclaration, isThisInitializedObjectBindingExpression, - isThisInTypeQuery, isThisProperty, isThisTypeParameter, isTransientSymbol, @@ -682,196 +915,59 @@ import { isValueSignatureDeclaration, isVarConst, isVariableDeclaration, - isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationInVariableStatement, + isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationList, isVariableLike, isVariableLikeOrAccessor, isVariableStatement, isWriteAccess, isWriteOnlyAccess, - IterableOrIteratorType, - IterationTypes, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocComment, - JSDocContainer, - JSDocEnumTag, - JSDocFunctionType, - JSDocImplementsTag, - JSDocLink, - JSDocLinkCode, - JSDocLinkPlain, - JSDocMemberName, - JSDocNullableType, - JSDocOptionalType, - JSDocParameterTag, - JSDocPrivateTag, - JSDocPropertyLikeTag, - JSDocPropertyTag, - JSDocProtectedTag, - JSDocPublicTag, - JSDocSignature, - JSDocTemplateTag, - JSDocTypedefTag, - JSDocTypeExpression, - JSDocTypeReferencingNode, - JSDocTypeTag, - JSDocVariadicType, - JsxAttribute, - JsxAttributeLike, - JsxAttributes, - JsxChild, - JsxClosingElement, - JsxElement, - JsxEmit, - JsxExpression, - JsxFlags, - JsxFragment, - JsxOpeningElement, - JsxOpeningFragment, - JsxOpeningLikeElement, - JsxReferenceKind, - JsxSelfClosingElement, - JsxSpreadAttribute, - JsxTagNameExpression, - KeywordTypeNode, - LabeledStatement, last, lastOrUndefined, - LateBoundBinaryExpressionDeclaration, - LateBoundDeclaration, - LateBoundName, - LateVisibilityPaintedStatement, - LeftHandSideExpression, length, - LiteralExpression, - LiteralType, - LiteralTypeNode, mangleScopedPackageName, map, mapDefined, - MappedSymbol, - MappedType, - MappedTypeNode, - MatchingKeys, maybeBind, - MemberName, - MemberOverrideStatus, memoize, - MetaProperty, - MethodDeclaration, - MethodSignature, minAndMax, - MinusToken, - Modifier, - ModifierFlags, - modifiersToFlags, modifierToFlag, - ModuleBlock, - ModuleDeclaration, - ModuleInstanceState, - ModuleKind, - ModuleResolutionKind, - 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, - 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, @@ -881,65 +977,23 @@ import { setTextRange, setTextRangePosEnd, setValueDeclaration, - ShorthandPropertyAssignment, shouldPreserveConstEnums, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureKind, singleElementArray, skipOuterExpressions, skipParentheses, skipTrivia, skipTypeChecking, some, - SourceFile, - SpreadAssignment, - SpreadElement, startsWith, - Statement, stringContains, - StringLiteral, - StringLiteralLike, - StringLiteralType, - StringMappingType, stripQuotes, - StructuredType, - SubstitutionType, sum, - SuperCall, - SwitchStatement, - Symbol, - SymbolAccessibility, - SymbolAccessibilityResult, - SymbolFlags, - SymbolFormatFlags, - SymbolId, - SymbolLinks, symbolName, - SymbolTable, - SymbolTracker, - SymbolVisibilityResult, - SyntaxKind, - SyntheticDefaultModuleType, - SyntheticExpression, - TaggedTemplateExpression, - TemplateExpression, - TemplateLiteralType, - TemplateLiteralTypeNode, - Ternary, textRangeContainsPositionInclusive, - TextSpan, textSpanContainsPosition, textSpanEnd, - ThisExpression, - ThisTypeNode, - ThrowStatement, - TokenFlags, tokenToString, tracing, - TracingNode, - TransientSymbol, tryAddToSet, tryCast, tryExtractTSExtension, @@ -947,69 +1001,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 b62fb3b638ff1..55db718e997a2 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,52 +101,23 @@ import { isString, isStringDoubleQuoted, isStringLiteral, - JsonSourceFile, - JsxEmit, length, map, mapDefined, mapIterator, - MapLike, - ModuleDetectionKind, - ModuleKind, - ModuleResolutionKind, - NewLineKind, - Node, - NodeArray, nodeModuleNameResolver, normalizePath, normalizeSlashes, - NumericLiteral, - ObjectLiteralExpression, - ParseConfigHost, - ParsedCommandLine, parseJsonText, - Path, - PollingWatchKind, - PrefixUnaryExpression, - ProjectReference, - PropertyName, - Push, removeTrailingDirectorySeparator, returnTrue, - ScriptTarget, startsWith, - StringLiteral, - SyntaxKind, sys, toFileNameLowerCase, toPath, tracing, trimString, - TsConfigOnlyOption, - TsConfigSourceFile, - TypeAcquisition, unescapeLeadingUnderscores, - WatchDirectoryFlags, - WatchDirectoryKind, - WatchFileKind, - WatchOptions, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 3961e094cde6b..d256371dbbf16 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 9bd8471f531b5..f0eb1166c6026 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 c438fab6ced3d..daaa68073ea77 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, @@ -31,41 +29,23 @@ import { CaseBlock, CaseClause, CaseOrDefaultClause, - cast, CatchClause, - changeExtension, CharacterCodes, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, - clone, - combinePaths, CommaListExpression, CommentRange, - compareEmitHelpers, - comparePaths, Comparison, CompilerHost, CompilerOptions, - computeCommonSourceDirectoryOfFilenames, ComputedPropertyName, - computeLineStarts, - computeSignature, ConditionalExpression, ConditionalTypeNode, + ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, - contains, ContinueStatement, - createBinaryExpressionTrampoline, - createDiagnosticCollection, - createGetCanonicalFileName, - createInputFilesWithFileTexts, - createMultiMap, - createPrependNodes, - createSourceMapGenerator, - createTextWriter, CustomTransformers, Debug, DebuggerStatement, @@ -73,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, @@ -107,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, @@ -132,59 +89,10 @@ import { GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, - getAreDeclarationMapsEnabled, - getBaseFileName, GetCanonicalFileName, - getCommentRange, - getConstantValue, - getContainingNodeArray, - getDeclarationEmitExtensionForPath, - getDeclarationEmitOutputFilePath, - getDirectoryPath, - getEmitDeclarations, - getEmitFlags, - getEmitHelpers, - getEmitModuleKind, - getExternalHelpersModuleName, - getExternalModuleName, - getLeadingCommentRanges, - getLineAndCharacterOfPosition, - getLinesBetweenPositionAndNextNonWhitespaceCharacter, - getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, - getLinesBetweenRangeEndAndRangeStart, - getLineStarts, - getLiteralText, GetLiteralTextFlags, - getNewLineCharacter, - getNodeForGeneratedName, - getNodeId, - getNormalizedAbsolutePath, - getOriginalNode, - getOwnEmitOutputFilePath, - getParseTreeNode, - getRelativePathFromDirectory, - getRelativePathToDirectoryOrUrl, - getRootLength, - getShebang, - getSnippetElement, - getSourceFileOfNode, - getSourceFilePathInNewDir, - getSourceFilesToEmit, - getSourceMapRange, - getSourceTextOfNodeFromSourceFile, - getStartsOnNewLine, - getSyntheticLeadingComments, - getSyntheticTrailingComments, - getTextOfJSDocComment, - getTrailingCommentRanges, - getTrailingSemicolonDeferringWriter, - getTransformers, - getTypeNode, - guessIndentation, - hasRecordedExternalHelpers, HeritageClause, Identifier, - idText, IfStatement, ImportClause, ImportDeclaration, @@ -192,62 +100,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, @@ -266,10 +123,10 @@ import { JSDocTag, JSDocTemplateTag, JSDocThisTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocVariadicType, JsxAttribute, JsxAttributes, @@ -286,18 +143,12 @@ import { JsxTagNameExpression, JsxText, LabeledStatement, - last, - lastOrUndefined, LateBoundDeclaration, - length, ListFormat, LiteralExpression, LiteralLikeNode, LiteralTypeNode, - makeIdentifierFromModuleName, MappedTypeNode, - maybeBind, - memoize, MetaProperty, MethodDeclaration, MethodSignature, @@ -319,18 +170,11 @@ import { Node, NodeArray, NodeFlags, - nodeIsSynthesized, - noEmitNotification, - noEmitSubstitution, NonNullExpression, - normalizePath, - normalizeSlashes, - notImplemented, NumericLiteral, ObjectBindingPattern, ObjectLiteralExpression, OptionalTypeNode, - outFile, OutputFile, ParameterDeclaration, ParenthesizedExpression, @@ -338,13 +182,11 @@ import { ParsedCommandLine, PartiallyEmittedExpression, Placeholder, - positionIsSynthesized, - positionsAreOnSameLine, PostfixUnaryExpression, PrefixUnaryExpression, + PrintHandlers, Printer, PrinterOptions, - PrintHandlers, PrivateIdentifier, ProgramBuildInfo, ProgramBundleEmitBuildInfo, @@ -354,33 +196,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, @@ -389,17 +212,13 @@ import { SourceMapSource, SpreadAssignment, SpreadElement, - stableSort, Statement, - stringContains, StringLiteral, - supportedJSExtensionsFlat, SwitchStatement, Symbol, SymbolFlags, SyntaxKind, SynthesizedComment, - sys, TabStop, TaggedTemplateExpression, TemplateExpression, @@ -408,11 +227,7 @@ import { TemplateSpan, TextRange, ThrowStatement, - tokenToString, - tracing, TransformationResult, - transformNodes, - tryParseRawSourceMap, TryStatement, TupleTypeNode, TypeAliasDeclaration, @@ -438,10 +253,195 @@ import { VoidExpression, WhileStatement, WithStatement, - writeCommentRange, - writeFile, WriteFileCallbackData, YieldExpression, + arrayToMap, + base64encode, + cast, + changeExtension, + clone, + combinePaths, + compareEmitHelpers, + comparePaths, + computeCommonSourceDirectoryOfFilenames, + computeLineStarts, + computeSignature, + contains, + createBinaryExpressionTrampoline, + createDiagnosticCollection, + createGetCanonicalFileName, + createInputFilesWithFileTexts, + createMultiMap, + createPrependNodes, + createSourceMapGenerator, + createTextWriter, + directorySeparator, + emitDetachedComments, + emitNewLineBeforeLeadingCommentOfPosition, + emptyArray, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, + escapeJsxAttributeString, + escapeLeadingUnderscores, + escapeNonAsciiString, + escapeString, + every, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + findIndex, + firstOrUndefined, + forEach, + forEachChild, + forEachLeadingCommentRange, + forEachTrailingCommentRange, + formatGeneratedName, + formatGeneratedNamePart, + getAreDeclarationMapsEnabled, + getBaseFileName, + getCommentRange, + getConstantValue, + getContainingNodeArray, + getDeclarationEmitExtensionForPath, + getDeclarationEmitOutputFilePath, + getDirectoryPath, + getEmitDeclarations, + getEmitFlags, + getEmitHelpers, + getEmitModuleKind, + getExternalHelpersModuleName, + getExternalModuleName, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLineStarts, + getLinesBetweenPositionAndNextNonWhitespaceCharacter, + getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, + getLinesBetweenRangeEndAndRangeStart, + getLiteralText, + getNewLineCharacter, + getNodeForGeneratedName, + getNodeId, + getNormalizedAbsolutePath, + getOriginalNode, + getOwnEmitOutputFilePath, + getParseTreeNode, + getRelativePathFromDirectory, + getRelativePathToDirectoryOrUrl, + getRootLength, + getShebang, + getSnippetElement, + getSourceFileOfNode, + getSourceFilePathInNewDir, + getSourceFilesToEmit, + getSourceMapRange, + getSourceTextOfNodeFromSourceFile, + getStartsOnNewLine, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTextOfJSDocComment, + getTrailingCommentRanges, + getTrailingSemicolonDeferringWriter, + getTransformers, + getTypeNode, + guessIndentation, + hasRecordedExternalHelpers, + idText, + isAccessExpression, + isArray, + isArrowFunction, + isBinaryExpression, + isBindingPattern, + isBlock, + isBundle, + isBundleFileTextLike, + isDeclaration, + isDeclarationFileName, + isDecorator, + isEmptyStatement, + isExportAssignment, + isExportSpecifier, + isExpression, + isFunctionLike, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isIdentifier, + isInJsonFile, + isIncrementalCompilation, + isInternalDeclaration, + isJSDocLikeText, + isJsonSourceFile, + isJsxClosingElement, + isJsxOpeningElement, + isKeyword, + isLet, + isLiteralExpression, + isMemberName, + isModifier, + isModuleDeclaration, + isNodeDescendantOf, + isNumericLiteral, + isParenthesizedExpression, + isPartiallyEmittedExpression, + isPinnedComment, + isPrivateIdentifier, + isPrologueDirective, + isRecognizedTripleSlashComment, + isSourceFile, + isSourceFileNotJson, + isStringLiteral, + isTemplateLiteralKind, + isTokenKind, + isTypeParameterDeclaration, + isUnparsedNode, + isUnparsedPrepend, + isUnparsedSource, + isVarConst, + isVariableStatement, + last, + lastOrUndefined, + length, + makeIdentifierFromModuleName, + maybeBind, + memoize, + noEmitNotification, + noEmitSubstitution, + nodeIsSynthesized, + normalizePath, + normalizeSlashes, + notImplemented, + outFile, + positionIsSynthesized, + positionsAreOnSameLine, + rangeEndIsOnSameLineAsRangeStart, + rangeEndPositionsAreOnSameLine, + rangeIsOnSingleLine, + rangeStartPositionsAreOnSameLine, + readJsonOrUndefined, + removeFileExtension, + resolvePath, + returnFalse, + returnUndefined, + setEachParent, + setOriginalNode, + setParent, + setTextRange, + setTextRangePosEnd, + setTextRangePosWidth, + singleOrUndefined, + skipPartiallyEmittedExpressions, + skipTrivia, + some, + stableSort, + stringContains, + supportedJSExtensionsFlat, + sys, + tokenToString, + tracing, + transformNodes, + tryParseRawSourceMap, + writeCommentRange, + writeFile, } 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 4e872d7babb73..19bef1d352b62 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1,7 +1,4 @@ import { - addRange, - append, - appendIfUnique, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, @@ -37,11 +34,9 @@ import { CallChain, CallExpression, CallSignatureDeclaration, - canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, - cast, CatchClause, ClassDeclaration, ClassElement, @@ -56,14 +51,10 @@ import { ConciseBody, ConditionalExpression, ConditionalTypeNode, + ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, ContinueStatement, - createBaseNodeFactory, - createNodeConverters, - createParenthesizerRules, - createScanner, Debug, DebuggerStatement, Declaration, @@ -77,7 +68,6 @@ import { ElementAccessExpression, EmitFlags, EmitNode, - emptyArray, EmptyStatement, EndOfDeclarationMarker, EndOfFileToken, @@ -85,8 +75,6 @@ import { EnumDeclaration, EnumMember, EqualsGreaterThanToken, - escapeLeadingUnderscores, - every, ExclamationToken, ExportAssignment, ExportDeclaration, @@ -97,11 +85,8 @@ import { ExternalModuleReference, FalseLiteral, FileReference, - findUseStrictPrologue, - forEach, - ForInitializer, ForInStatement, - formatGeneratedName, + ForInitializer, ForOfStatement, ForStatement, FunctionDeclaration, @@ -112,28 +97,9 @@ import { GeneratedIdentifierFlags, GeneratedNamePart, GetAccessorDeclaration, - getAllUnscopedEmitHelpers, - getBuildInfo, - getCommentRange, - getElementsOfBindingOrAssignmentPattern, - getEmitFlags, - getJSDocTypeAliasName, - getLineAndCharacterOfPosition, - getNameOfDeclaration, - getNodeId, - getSourceMapRange, - getSyntheticLeadingComments, - getSyntheticTrailingComments, - getTargetOfBindingOrAssignmentElement, - getTextOfIdentifierOrLiteral, - hasInvalidEscape, HasModifiers, - hasProperty, - hasStaticModifier, - hasSyntacticModifier, HeritageClause, Identifier, - idText, IfStatement, ImportClause, ImportDeclaration, @@ -141,84 +107,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, - 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, @@ -234,8 +128,8 @@ import { JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, - JSDocNamepathType, JSDocNameReference, + JSDocNamepathType, JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, @@ -256,17 +150,17 @@ import { JSDocText, JSDocThisTag, JSDocType, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, JsxAttribute, JsxAttributeLike, - JsxAttributes, JsxAttributeValue, + JsxAttributes, JsxChild, JsxClosingElement, JsxClosingFragment, @@ -285,14 +179,10 @@ import { KeywordTypeSyntaxKind, LabeledStatement, LanguageVariant, - lastOrUndefined, LeftHandSideExpression, LiteralToken, LiteralTypeNode, - map, MappedTypeNode, - memoize, - memoizeOne, MergeDeclarationMarker, MetaProperty, MethodDeclaration, @@ -302,7 +192,6 @@ import { Modifier, ModifierFlags, ModifierLike, - modifiersToFlags, ModifierSyntaxKind, ModifierToken, ModuleBlock, @@ -323,20 +212,16 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, + NoSubstitutionTemplateLiteral, Node, NodeArray, NodeFactory, NodeFlags, - nodeIsSynthesized, NonNullChain, NonNullExpression, - NoSubstitutionTemplateLiteral, NotEmittedStatement, NullLiteral, - nullNodeConverters, - nullParenthesizerRules, NumericLiteral, - objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -347,7 +232,6 @@ import { ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, - parseNodeFactory, PartiallyEmittedExpression, PlusToken, PostfixUnaryExpression, @@ -366,7 +250,6 @@ import { PropertyNameLiteral, PropertySignature, PseudoBigInt, - pseudoBigIntToString, PunctuationSyntaxKind, PunctuationToken, Push, @@ -374,39 +257,23 @@ import { QuestionDotToken, QuestionToken, ReadonlyKeyword, - reduceLeft, RegularExpressionLiteral, RestTypeNode, ReturnStatement, - returnTrue, - sameFlatMap, SatisfiesExpression, Scanner, ScriptTarget, SemicolonClassElement, SetAccessorDeclaration, - setEachParent, - setEmitFlags, - setParent, - setTextRange, - setTextRangePosEnd, - setTextRangePosWidth, ShorthandPropertyAssignment, SignatureDeclarationBase, - singleOrUndefined, - skipOuterExpressions, - skipParentheses, - some, SourceFile, SourceMapSource, SpreadAssignment, SpreadElement, - startOnNewLine, - startsWith, Statement, StringLiteral, StringLiteralLike, - stringToToken, SuperExpression, SwitchStatement, SyntaxKind, @@ -460,12 +327,145 @@ import { VariableDeclaration, VariableDeclarationList, VariableStatement, - visitNode, VisitResult, VoidExpression, WhileStatement, WithStatement, YieldExpression, + addRange, + append, + appendIfUnique, + canHaveModifiers, + cast, + createBaseNodeFactory, + createNodeConverters, + createParenthesizerRules, + createScanner, + emptyArray, + escapeLeadingUnderscores, + every, + findUseStrictPrologue, + forEach, + formatGeneratedName, + getAllUnscopedEmitHelpers, + getBuildInfo, + getCommentRange, + getElementsOfBindingOrAssignmentPattern, + getEmitFlags, + getJSDocTypeAliasName, + getLineAndCharacterOfPosition, + getNameOfDeclaration, + getNodeId, + getSourceMapRange, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTargetOfBindingOrAssignmentElement, + getTextOfIdentifierOrLiteral, + hasInvalidEscape, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, + idText, + isArray, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentPattern, + isBinaryExpression, + isCallChain, + isClassDeclaration, + isClassExpression, + isCommaListExpression, + isCommaToken, + isComputedPropertyName, + isConstructorDeclaration, + isConstructorTypeNode, + isCustomPrologue, + isElementAccessChain, + isElementAccessExpression, + isEnumDeclaration, + isExclamationToken, + isExportAssignment, + isExportDeclaration, + isExternalModuleReference, + isFunctionDeclaration, + isFunctionExpression, + isGeneratedIdentifier, + isGetAccessorDeclaration, + isHoistedFunction, + isHoistedVariableStatement, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isLabeledStatement, + isLocalName, + isLogicalOrCoalescingAssignmentOperator, + isMemberName, + isMethodDeclaration, + isMethodSignature, + isModuleDeclaration, + isNamedDeclaration, + isNodeArray, + isNodeKind, + isNonNullChain, + isNotEmittedStatement, + isObjectLiteralExpression, + isOmittedExpression, + isOuterExpression, + isParameter, + isParenthesizedExpression, + isParseTreeNode, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAccessChain, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertyName, + isPropertySignature, + isQuestionToken, + isSetAccessorDeclaration, + isSourceFile, + isStatement, + isStatementOrBlock, + isString, + isStringLiteral, + isSuperKeyword, + isSuperProperty, + isThisIdentifier, + isTypeAliasDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, + isVariableStatement, + lastOrUndefined, + map, + memoize, + memoizeOne, + modifiersToFlags, + nodeIsSynthesized, + nullNodeConverters, + nullParenthesizerRules, + objectAllocator, + parseNodeFactory, + pseudoBigIntToString, + reduceLeft, + returnTrue, + sameFlatMap, + setEachParent, + setEmitFlags, + setParent, + setTextRange, + setTextRangePosEnd, + setTextRangePosWidth, + singleOrUndefined, + skipOuterExpressions, + skipParentheses, + some, + startOnNewLine, + startsWith, + stringToToken, + visitNode, } from "../_namespaces/ts"; let nextAutoGenerateId = 0; diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 14e296610c54f..800751735be96 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -32,9 +32,9 @@ import { ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, + ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, ContinueStatement, DebuggerStatement, Decorator, @@ -73,8 +73,8 @@ import { ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, + IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, @@ -92,8 +92,8 @@ import { JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, - JSDocNamepathType, JSDocNameReference, + JSDocNamepathType, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, @@ -109,10 +109,10 @@ import { JSDocSignature, JSDocTemplateTag, JSDocThisTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, @@ -146,9 +146,9 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, + NoSubstitutionTemplateLiteral, Node, NonNullExpression, - NoSubstitutionTemplateLiteral, NotEmittedStatement, NumericLiteral, ObjectBindingPattern, diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index 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 190bd6e7cb8b0..c6e2c43bfbe4a 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 5177f1d5a57ab..57acdf388a970 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,42 +1,61 @@ import { + CharacterCodes, + Comparison, + CompilerOptions, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + Extension, + FileReference, + GetCanonicalFileName, + GetEffectiveTypeRootsHost, + MapLike, + MatchingKeys, + ModuleKind, + ModuleResolutionHost, + ModuleResolutionKind, + PackageId, + ParsedCommandLine, + Path, + Pattern, + Push, + ResolutionMode, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + SourceFile, + StringLiteralLike, + Version, + VersionRange, append, appendIfUnique, arrayFrom, changeAnyExtension, - CharacterCodes, combinePaths, comparePaths, - Comparison, - CompilerOptions, contains, containsPath, createCompilerDiagnostic, - Debug, - Diagnostic, - DiagnosticMessage, - DiagnosticReporter, - Diagnostics, directoryProbablyExists, directorySeparator, emptyArray, endsWith, ensureTrailingDirectorySeparator, every, - Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, - FileReference, filter, firstDefined, forEach, forEachAncestorDirectory, formatMessage, getBaseFileName, - GetCanonicalFileName, getCommonSourceDirectory, getDirectoryPath, - GetEffectiveTypeRootsHost, getEmitModuleKind, getEmitModuleResolutionKind, getModeForUsageLocation, @@ -59,42 +78,25 @@ import { isStringLiteralLike, lastOrUndefined, length, - MapLike, - matchedText, - MatchingKeys, matchPatternOrExact, - ModuleKind, - ModuleResolutionHost, - ModuleResolutionKind, + matchedText, noop, noopPush, normalizePath, normalizeSlashes, optionsHaveModuleResolutionChanges, - PackageId, packageIdToString, - ParsedCommandLine, - Path, pathIsRelative, - Pattern, patternText, perfLogger, - Push, readJson, removeExtension, removeFileExtension, removePrefix, - ResolutionMode, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, some, sort, - SourceFile, startsWith, stringContains, - StringLiteralLike, supportedDeclarationExtensions, supportedTSImplementationExtensions, toFileNameLowerCase, @@ -103,9 +105,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 84031881431b0..5f583ed5bfe4f 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, + ModuleResolutionHost, + ModuleResolutionKind, + ModuleSpecifierCache, + ModuleSpecifierOptions, + ModuleSpecifierResolutionHost, + NodeFlags, + NodeModulePathParts, + Path, + PropertyAccessExpression, + ResolutionMode, + ScriptKind, + SourceFile, + StringLiteral, + Symbol, + SymbolFlags, + TypeChecker, + UserPreferences, __String, allKeysStartWithDot, - AmbientModuleDeclaration, append, arrayFrom, - CharacterCodes, combinePaths, compareBooleans, compareNumberOfDirectorySeparators, comparePaths, - Comparison, - CompilerOptions, containsIgnoredPath, containsPath, createGetCanonicalFileName, - Debug, directorySeparator, emptyArray, endsWith, ensurePathIsNonModuleName, ensureTrailingDirectorySeparator, every, - ExportAssignment, - Extension, extensionFromPath, fileExtensionIsOneOf, - FileIncludeKind, firstDefined, flatMap, flatten, forEach, forEachAncestorDirectory, - GetCanonicalFileName, getDirectoryPath, getEmitModuleResolutionKind, getImpliedNodeFormatForFile, @@ -51,7 +74,6 @@ import { hasJSFileExtension, hasTSFileExtension, hostGetCanonicalFileName, - Identifier, isAmbientModule, isApplicableVersionedTypesKey, isExternalModuleAugmentation, @@ -62,46 +84,24 @@ import { isRootedDiskPath, isSourceFile, isString, - JsxEmit, map, mapDefined, - MapLike, matchPatternOrExact, min, - ModuleDeclaration, - ModuleKind, - ModulePath, - ModuleResolutionHost, - ModuleResolutionKind, - ModuleSpecifierCache, - ModuleSpecifierOptions, - ModuleSpecifierResolutionHost, - NodeFlags, - NodeModulePathParts, normalizePath, - Path, pathContainsNodeModules, pathIsBareSpecifier, pathIsRelative, - PropertyAccessExpression, removeFileExtension, removeSuffix, - ResolutionMode, resolvePath, - ScriptKind, some, - SourceFile, startsWith, startsWithDirectory, stringContains, - StringLiteral, - Symbol, - SymbolFlags, toPath, tryGetExtensionFromPath, tryParsePatterns, - TypeChecker, - UserPreferences, } from "./_namespaces/ts"; // Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers. diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f1f8bd002e875..392467212a7ff 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,10 +1,7 @@ import * as ts from "./_namespaces/ts"; import { AccessorDeclaration, - addRange, - addRelatedInfo, AmdDependency, - append, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, @@ -15,7 +12,6 @@ import { AssertEntry, AssertionLevel, AsteriskToken, - attachFileToDiagnostics, AwaitExpression, BaseNodeFactory, BinaryExpression, @@ -29,7 +25,6 @@ import { BreakStatement, CallExpression, CallSignatureDeclaration, - canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, @@ -43,38 +38,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, @@ -86,10 +69,7 @@ import { ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, - fileExtensionIsOneOf, FileReference, - findIndex, - forEach, ForEachChildNodes, ForInOrOfStatement, ForInStatement, @@ -100,20 +80,10 @@ import { FunctionOrConstructorTypeNode, FunctionTypeNode, GetAccessorDeclaration, - getBinaryOperatorPrecedence, - getFullWidth, - getJSDocCommentRanges, - getLanguageVariant, - getLastChild, - getLeadingCommentRanges, - getSpellingSuggestion, - getTextOfNodeFromSourceText, HasJSDoc, - hasJSDocNodes, HasModifiers, HeritageClause, Identifier, - idText, IfStatement, ImportClause, ImportDeclaration, @@ -122,42 +92,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, @@ -196,10 +135,10 @@ import { JSDocTemplateTag, JSDocText, JSDocThisTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, + JSDocTypedefTag, JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, @@ -207,8 +146,8 @@ import { JsonObjectExpressionStatement, JsonSourceFile, JsxAttribute, - JsxAttributes, JsxAttributeValue, + JsxAttributes, JsxChild, JsxClosingElement, JsxClosingFragment, @@ -226,13 +165,10 @@ import { JsxTokenSyntaxKind, LabeledStatement, LanguageVariant, - lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralLikeNode, LiteralTypeNode, - map, - mapDefined, MappedTypeNode, MemberExpression, MetaProperty, @@ -244,7 +180,6 @@ import { ModifierFlags, ModifierLike, ModifiersArray, - modifiersToFlags, ModuleBlock, ModuleDeclaration, ModuleKind, @@ -259,19 +194,14 @@ import { NamespaceExportDeclaration, NamespaceImport, NewExpression, + NoSubstitutionTemplateLiteral, Node, NodeArray, NodeFactoryFlags, NodeFlags, - nodeIsMissing, - nodeIsPresent, NonNullExpression, - noop, - normalizePath, - NoSubstitutionTemplateLiteral, NullLiteral, NumericLiteral, - objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -282,7 +212,6 @@ import { ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, - perfLogger, PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, @@ -314,22 +243,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 +261,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 +292,97 @@ import { WhileStatement, WithStatement, YieldExpression, + addRange, + addRelatedInfo, + append, + attachFileToDiagnostics, + canHaveModifiers, + commentPragmas, + concatenate, + containsParseError, + convertToObjectWorker, + createDetachedDiagnostic, + createNodeFactory, + createScanner, + createTextChangeRange, + createTextSpanFromBounds, + emptyArray, + emptyMap, + ensureScriptKind, + fileExtensionIsOneOf, + findIndex, + forEach, + getBinaryOperatorPrecedence, + getFullWidth, + getJSDocCommentRanges, + getLanguageVariant, + getLastChild, + getLeadingCommentRanges, + getSpellingSuggestion, + getTextOfNodeFromSourceText, + hasJSDocNodes, + idText, + isArray, + isAssignmentOperator, + isAsyncModifier, + isClassMemberModifier, + isExportAssignment, + isExportDeclaration, + isExportModifier, + isExpressionWithTypeArguments, + isExternalModuleReference, + isFunctionTypeNode, + isIdentifierText, + isImportDeclaration, + isImportEqualsDeclaration, + isJSDocFunctionType, + isJSDocNullableType, + isJSDocReturnTag, + isJSDocTypeTag, + isJsxOpeningElement, + isJsxOpeningFragment, + isKeyword, + isLeftHandSideExpression, + isLiteralKind, + isMetaProperty, + isModifierKind, + isNonNullExpression, + isPrivateIdentifier, + isSetAccessorDeclaration, + isStringOrNumericLiteralLike, + isTaggedTemplateExpression, + isTemplateLiteralKind, + isTypeReferenceNode, + lastOrUndefined, + map, + mapDefined, + modifiersToFlags, + nodeIsMissing, + nodeIsPresent, + noop, + normalizePath, + objectAllocator, + perfLogger, + setParent, + setParentRecursive, + setTextRange, + setTextRangePos, + setTextRangePosEnd, + setTextRangePosWidth, + skipTrivia, + some, + startsWith, + supportedDeclarationExtensions, + textChangeRangeIsUnchanged, + textChangeRangeNewSpan, + textSpanEnd, + textToKeywordObj, + toArray, + tokenIsIdentifierOrKeyword, + tokenIsIdentifierOrKeywordOrGreaterThan, + tokenToString, + tracing, + trimString, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/path.ts b/src/compiler/path.ts index 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 f1f67c0e87e5f..e2f470d144dbc 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,30 +1,123 @@ import * as ts from "./_namespaces/ts"; import { + AsExpression, + AssertClause, + BuilderProgram, + CancellationToken, + CommentDirective, + CommentDirectivesMap, + Comparison, + CompilerHost, + CompilerOptions, + CreateProgramOptions, + CreateSourceFileOptions, + CustomTransformers, + Debug, + DeclarationWithTypeParameterChildren, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticReporter, + DiagnosticWithLocation, + Diagnostics, + DirectoryStructureHost, + EmitFlags, + EmitHost, + EmitOnly, + EmitResult, + ExportAssignment, + ExportDeclaration, + Extension, + FileIncludeKind, + FileIncludeReason, + FilePreprocessingDiagnostics, + FilePreprocessingDiagnosticsKind, + FileReference, + FunctionLikeDeclaration, + GetCanonicalFileName, + HasChangedAutomaticTypeDirectiveNames, + HasInvalidatedResolutions, + HeritageClause, + Identifier, + ImportClause, + ImportDeclaration, + ImportOrExportSpecifier, + InputFiles, + JsonSourceFile, + JsxEmit, + MethodDeclaration, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + ModuleResolutionKind, + Mutable, + Node, + NodeArray, + NodeFlags, + NodeWithTypeArguments, + ObjectLiteralExpression, + OperationCanceledException, + PackageId, + PackageJsonInfoCache, + ParameterDeclaration, + ParseConfigFileHost, + ParsedCommandLine, + Path, + Program, + ProgramHost, + ProjectReference, + ProjectReferenceFile, + PropertyDeclaration, + ReferencedFile, + ResolutionMode, + ResolvedConfigFileName, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SortedReadonlyArray, + SourceFile, + SourceOfProjectReferenceRedirect, + Statement, + StringLiteral, + StringLiteralLike, + StructureIsReused, + SymlinkCache, + SyntaxKind, + TsConfigSourceFile, + TypeChecker, + TypeReferenceDirectiveResolutionCache, + TypeReferenceDirectiveResolutionInfo, + UnparsedSource, + VariableDeclaration, + VariableStatement, + WriteFileCallback, + WriteFileCallbackData, __String, addEmitFlags, addRange, append, arrayFrom, arrayIsEqualTo, - AsExpression, - AssertClause, - BuilderProgram, - CancellationToken, canHaveModifiers, chainDiagnosticMessages, changeExtension, - changesAffectingProgramStructure, changesAffectModuleResolution, + changesAffectingProgramStructure, clone, combinePaths, - CommentDirective, - CommentDirectivesMap, compareDataObjects, comparePaths, compareValues, - Comparison, - CompilerHost, - CompilerOptions, computeLineAndCharacterOfPosition, concatenate, contains, @@ -44,49 +137,24 @@ import { createModeAwareCache, createModuleResolutionCache, createMultiMap, - CreateProgramOptions, createSourceFile, - CreateSourceFileOptions, createSymlinkCache, createTypeChecker, createTypeReferenceDirectiveResolutionCache, - CustomTransformers, - Debug, - DeclarationWithTypeParameterChildren, - Diagnostic, - DiagnosticCategory, diagnosticCategoryName, - DiagnosticMessage, - DiagnosticMessageChain, - DiagnosticReporter, - Diagnostics, - DiagnosticWithLocation, directorySeparator, - DirectoryStructureHost, emitFiles, - EmitFlags, - EmitHost, - EmitOnly, - EmitResult, emptyArray, ensureTrailingDirectorySeparator, equateStringsCaseInsensitive, equateStringsCaseSensitive, explainIfFileIsRedirectAndImpliedFormat, - ExportAssignment, - ExportDeclaration, - Extension, extensionFromPath, externalHelpersModuleNameText, factory, fileExtensionIs, fileExtensionIsOneOf, - FileIncludeKind, - FileIncludeReason, fileIncludeReasonToDiagnostics, - FilePreprocessingDiagnostics, - FilePreprocessingDiagnosticsKind, - FileReference, filter, find, firstDefined, @@ -100,11 +168,9 @@ import { forEachEmittedFile, forEachEntry, forEachKey, - FunctionLikeDeclaration, getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, getBaseFileName, - GetCanonicalFileName, getCommonSourceDirectoryOfConfig, getDefaultLibFileName, getDirectoryPath, @@ -148,23 +214,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, @@ -183,8 +241,8 @@ import { isImportEqualsDeclaration, isImportSpecifier, isImportTypeNode, - isIncrementalCompilation, isInJSFile, + isIncrementalCompilation, isLiteralImportTypeNode, isModifier, isModuleDeclaration, @@ -197,8 +255,6 @@ import { isStringLiteral, isStringLiteralLike, isTraceEnabled, - JsonSourceFile, - JsxEmit, length, libMap, libs, @@ -206,70 +262,32 @@ import { mapDefinedIterator, maybeBind, memoize, - MethodDeclaration, - ModifierFlags, - ModifierLike, - ModuleBlock, - ModuleDeclaration, - ModuleKind, - ModuleResolutionCache, - ModuleResolutionHost, - ModuleResolutionInfo, moduleResolutionIsEqualTo, - ModuleResolutionKind, - 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, - Path, pathIsAbsolute, pathIsRelative, - Program, - ProgramHost, - ProjectReference, - ProjectReferenceFile, projectReferenceIsEqualTo, - PropertyDeclaration, - ReferencedFile, removeFileExtension, removePrefix, removeSuffix, resolutionExtensionIsTSOrJson, - ResolutionMode, resolveConfigFileProjectName, - ResolvedConfigFileName, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, resolveModuleName, resolveModuleNameFromCache, resolveTypeReferenceDirective, returnFalse, returnUndefined, - SatisfiesExpression, - ScriptKind, - ScriptTarget, setParent, setParentRecursive, setResolvedModule, @@ -278,21 +296,12 @@ import { skipTypeChecking, some, sortAndDeduplicateDiagnostics, - SortedReadonlyArray, - SourceFile, sourceFileAffectingCompilerOptions, sourceFileMayBeEmitted, - SourceOfProjectReferenceRedirect, stableSort, startsWith, - Statement, stringContains, - StringLiteral, - StringLiteralLike, - StructureIsReused, supportedJSExtensionsFlat, - SymlinkCache, - SyntaxKind, sys, targetOptionDeclaration, toFileNameLowerCase, @@ -300,17 +309,8 @@ import { trace, tracing, trimStringEnd, - TsConfigSourceFile, - TypeChecker, typeDirectiveIsEqualTo, - TypeReferenceDirectiveResolutionCache, - TypeReferenceDirectiveResolutionInfo, - UnparsedSource, - VariableDeclaration, - VariableStatement, walkUpParenthesizedExpressions, - WriteFileCallback, - WriteFileCallbackData, writeFileEnsuringDirectories, zipToModeAwareCache, } from "./_namespaces/ts"; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index f63ecc8773fb7..1f72a2c3367e5 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,35 +1,54 @@ import * as ts from "./_namespaces/ts"; import { - arrayToMap, - CachedDirectoryStructureHost, CacheWithRedirects, + CachedDirectoryStructureHost, CharacterCodes, + CompilerOptions, + Debug, + Diagnostics, + DirectoryWatcherCallback, + Extension, + FileReference, + FileWatcher, + FileWatcherCallback, + GetCanonicalFileName, + HasInvalidatedResolutions, + MinimalResolutionCacheHost, + ModeAwareCache, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + PackageId, + Path, + PerModuleNameCache, + Program, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + SourceFile, + TypeReferenceDirectiveResolutionInfo, + WatchDirectoryFlags, + arrayToMap, clearMap, closeFileWatcher, closeFileWatcherOf, - CompilerOptions, contains, createCacheWithRedirects, createModeAwareCache, createModuleResolutionCache, createMultiMap, createTypeReferenceDirectiveResolutionCache, - Debug, - Diagnostics, directorySeparator, - DirectoryWatcherCallback, emptyArray, emptyIterator, endsWith, - Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, - FileReference, - FileWatcher, - FileWatcherCallback, firstDefinedIterator, - GetCanonicalFileName, getDirectoryPath, getEffectiveTypeRoots, getModeForFileReference, @@ -38,7 +57,6 @@ import { getNormalizedAbsolutePath, getResolutionName, getRootLength, - HasInvalidatedResolutions, ignoredPaths, inferredTypesContainingFile, isEmittedFileOfProgram, @@ -52,39 +70,21 @@ import { length, loadModuleFromGlobalCache, memoize, - MinimalResolutionCacheHost, - ModeAwareCache, - ModuleResolutionCache, - ModuleResolutionHost, - ModuleResolutionInfo, mutateMap, noopFileWatcher, normalizePath, - PackageId, packageIdToString, parseNodeModuleFromPath, - Path, pathContainsNodeModules, - PerModuleNameCache, - Program, removeSuffix, removeTrailingDirectorySeparator, resolutionExtensionIsTSOrJson, - ResolutionMode, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, returnTrue, some, - SourceFile, startsWith, stringContains, trace, - TypeReferenceDirectiveResolutionInfo, unorderedRemoveItem, - WatchDirectoryFlags, } from "./_namespaces/ts"; /** diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 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 ba707330ffeee..ab28c7e572c93 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 239a7e125453d..4a150992b040b 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 3c5fc93adb0fd..50910d77fed50 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 2087eca6c45af..7a459426889e6 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 adedbd1281714..706b1f857f84c 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 6eb8ed8862c3c..394bbceb8f07f 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -1,21 +1,68 @@ 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, + GetCanonicalFileName, + ModuleResolutionCache, + OutputFile, + ParseConfigFileHost, + ParsedCommandLine, + Path, + PollingInterval, + Program, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProgramHost, + ProgramMultiFileEmitBuildInfo, + ReadBuildProgramHost, + ResolutionMode, + ResolvedConfigFileName, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + SemanticDiagnosticsBuilderProgram, + SharedExtendedConfigFileWatcher, + SourceFile, + Status, + System, + TypeReferenceDirectiveResolutionCache, + UpToDateStatus, + UpToDateStatusType, + WatchFactory, + WatchHost, + WatchOptions, + WatchStatusReporter, + WatchType, + WildcardDirectoryWatcher, + WriteFileCallback, + arrayToMap, + assertType, canJsonReportNoInputFiles, changeCompilerHostLikeToUseCache, clearMap, closeFileWatcher, closeFileWatcherOf, commonOptionsWithBuild, - CompilerHost, - CompilerOptions, - CompilerOptionsValue, - ConfigFileProgramReloadLevel, convertToRelativePath, copyProperties, createCompilerDiagnostic, @@ -24,35 +71,19 @@ import { createDiagnosticReporter, createGetCanonicalFileName, createModuleResolutionCache, - CreateProgram, createProgramHost, createTypeReferenceDirectiveResolutionCache, createWatchFactory, createWatchHost, - CustomTransformers, - Debug, - Diagnostic, - DiagnosticCollection, - DiagnosticMessage, - DiagnosticReporter, - Diagnostics, - EmitAndSemanticDiagnosticsBuilderProgram, emitFilesAndReportErrors, - EmitResult, emitUsingBuildInfo, emptyArray, - ExitStatus, - ExtendedConfigCacheEntry, - FileWatcher, - FileWatcherCallback, findIndex, flattenDiagnosticMessageText, forEach, - ForegroundColorEscapeSequences, formatColorAndReset, getAllProjectOutputs, getBuildInfoFileVersionMap, - GetCanonicalFileName, getConfigFileParsingDiagnostics, getDirectoryPath, getEntries, @@ -79,58 +110,27 @@ import { map, maybeBind, missingFileModifiedTime, - ModuleResolutionCache, mutateMap, mutateMapSkippingNewValues, noop, outFile, - OutputFile, - ParseConfigFileHost, parseConfigHostFromCompilerHostLike, - ParsedCommandLine, - Path, - PollingInterval, - Program, - ProgramBuildInfo, - ProgramBundleEmitBuildInfo, - ProgramHost, - ProgramMultiFileEmitBuildInfo, readBuilderProgram, - ReadBuildProgramHost, - ResolutionMode, resolveConfigFileProjectName, - ResolvedConfigFileName, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, resolveModuleName, resolvePath, resolveProjectReferencePath, resolveTypeReferenceDirective, returnUndefined, - SemanticDiagnosticsBuilderProgram, setGetSourceFileAsHashVersioned, - SharedExtendedConfigFileWatcher, some, - SourceFile, - Status, sys, - System, - TypeReferenceDirectiveResolutionCache, unorderedRemoveItem, updateErrorForNoInputFiles, updateSharedExtendedConfigFileWatcher, updateWatchingWildcardDirectories, - UpToDateStatus, - UpToDateStatusType, version, - WatchFactory, - WatchHost, - WatchOptions, - WatchStatusReporter, - WatchType, - WildcardDirectoryWatcher, writeFile, - WriteFileCallback, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8de47c348430e..f026b086585a3 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,28 +1,21 @@ import { - __String, AccessExpression, AccessorDeclaration, - addRange, - affectsDeclarationPathOptionDeclarations, - affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, AnyImportOrBareOrAccessedRequire, AnyImportOrReExport, AnyImportSyntax, AnyValidImportOrReExport, - arrayFrom, ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AssertionExpression, - assertType, AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, BinaryExpression, - binarySearch, BindableObjectDefinePropertyCall, BindableStaticAccessExpression, BindableStaticElementAccessExpression, @@ -34,46 +27,27 @@ import { BundleFileTextLike, CallExpression, CallLikeExpression, - 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, - contains, - containsPath, - createGetCanonicalFileName, - createModeAwareCache, - createMultiMap, - createScanner, - createTextSpan, - createTextSpanFromBounds, Debug, Declaration, DeclarationName, @@ -87,10 +61,9 @@ import { DiagnosticMessage, DiagnosticMessageChain, DiagnosticRelatedInformation, - Diagnostics, DiagnosticWithDetachedLocation, DiagnosticWithLocation, - directorySeparator, + Diagnostics, DoStatement, DynamicNamedBinaryExpression, DynamicNamedDeclaration, @@ -99,19 +72,12 @@ import { EmitHost, EmitResolver, EmitTextWriter, - emptyArray, - ensurePathIsNonModuleName, - ensureTrailingDirectorySeparator, EntityName, EntityNameExpression, EntityNameOrEntityNameExpression, EnumDeclaration, EqualityComparer, - equalOwnProperties, EqualsToken, - equateValues, - escapeLeadingUnderscores, - every, ExportAssignment, ExportDeclaration, ExportSpecifier, @@ -120,12 +86,234 @@ import { ExpressionWithTypeArguments, Extension, ExternalModuleReference, - factory, FileExtensionInfo, - fileExtensionIs, - fileExtensionIsOneOf, FileReference, FileWatcher, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + GetCanonicalFileName, + HasExpressionInitializer, + HasInitializer, + HasJSDoc, + HasModifiers, + HasType, + HasTypeArguments, + HeritageClause, + Identifier, + IdentifierTypePredicate, + IfStatement, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportMetaProperty, + ImportSpecifier, + ImportTypeNode, + IndexInfo, + InitializedVariableDeclaration, + InterfaceDeclaration, + JSDoc, + JSDocCallbackTag, + JSDocEnumTag, + JSDocMemberName, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocTypedefTag, + JsonSourceFile, + JsxChild, + JsxElement, + JsxEmit, + JsxFragment, + JsxOpeningElement, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxTagNameExpression, + KeywordSyntaxKind, + LabeledStatement, + LanguageVariant, + LateVisibilityPaintedStatement, + LiteralImportTypeNode, + LiteralLikeElementAccessExpression, + LiteralLikeNode, + LogicalOrCoalescingAssignmentOperator, + MapLike, + MemberName, + MethodDeclaration, + ModeAwareCache, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleDetectionKind, + ModuleKind, + ModuleResolutionKind, + MultiMap, + NamedDeclaration, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamespaceExport, + NamespaceImport, + NewExpression, + NewLineKind, + NoSubstitutionTemplateLiteral, + Node, + NodeArray, + NodeFlags, + NonNullExpression, + NumericLiteral, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElement, + ObjectLiteralExpression, + ObjectLiteralExpressionBase, + ObjectTypeDeclaration, + OuterExpressionKinds, + PackageId, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + PartiallyEmittedExpression, + Path, + Pattern, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrintHandlers, + PrinterOptions, + PrivateIdentifier, + ProjectReference, + PrologueDirective, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertyNameLiteral, + PseudoBigInt, + QualifiedName, + ReadonlyCollection, + ReadonlyTextRange, + RequireOrImportCall, + RequireVariableStatement, + ResolutionMode, + ResolvedModuleFull, + ResolvedTypeReferenceDirective, + ReturnStatement, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SortedArray, + SourceFile, + SourceFileLike, + SourceFileMayBeEmittedHost, + SourceMapSource, + Statement, + StringLiteral, + StringLiteralLike, + SuperCall, + SuperExpression, + SuperProperty, + SwitchStatement, + Symbol, + SymbolFlags, + SymbolTable, + SyntaxKind, + SyntaxList, + TaggedTemplateExpression, + TemplateLiteral, + TemplateLiteralLikeNode, + TemplateLiteralTypeSpan, + TemplateSpan, + TextRange, + TextSpan, + ThisTypePredicate, + Token, + TokenFlags, + TransformFlags, + TransientSymbol, + TriviaSyntaxKind, + TryStatement, + TsConfigSourceFile, + TupleTypeNode, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeNodeSyntaxKind, + TypeParameter, + TypeParameterDeclaration, + TypePredicate, + TypePredicateKind, + TypeReferenceNode, + UnionOrIntersectionTypeNode, + ValidImportTypeNode, + VariableDeclaration, + VariableDeclarationInitializedTo, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, + WhileStatement, + WithStatement, + WriteFileCallback, + WriteFileCallbackData, + YieldExpression, + __String, + addRange, + affectsDeclarationPathOptionDeclarations, + affectsEmitOptionDeclarations, + arrayFrom, + assertType, + binarySearch, + canHaveDecorators, + canHaveIllegalDecorators, + canHaveModifiers, + changeAnyExtension, + combinePaths, + compareStringsCaseSensitive, + compareValues, + computeLineAndCharacterOfPosition, + computeLineOfPosition, + computeLineStarts, + concatenate, + contains, + containsPath, + createGetCanonicalFileName, + createModeAwareCache, + createMultiMap, + createScanner, + createTextSpan, + createTextSpanFromBounds, + directorySeparator, + emptyArray, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, + equalOwnProperties, + equateValues, + escapeLeadingUnderscores, + every, + factory, + fileExtensionIs, + fileExtensionIsOneOf, filter, find, findAncestor, @@ -141,17 +329,7 @@ import { forEachAncestorDirectory, forEachChild, forEachChildRecursively, - ForInOrOfStatement, - ForInStatement, - ForOfStatement, - ForStatement, - FunctionBody, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, getBaseFileName, - GetCanonicalFileName, getCombinedModifierFlags, getCombinedNodeFlags, getDirectoryPath, @@ -174,8 +352,8 @@ import { getJSDocTypeTag, getLeadingCommentRanges, getLineAndCharacterOfPosition, - getLinesBetweenPositions, getLineStarts, + getLinesBetweenPositions, getNameOfDeclaration, getNormalizedAbsolutePath, getNormalizedPathComponents, @@ -190,35 +368,15 @@ import { getStringComparer, getSymbolId, getTrailingCommentRanges, - HasExpressionInitializer, hasExtension, 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, - InitializedVariableDeclaration, insertSorted, - InterfaceDeclaration, isAccessor, isAnyDirectorySeparator, isArray, @@ -322,199 +480,41 @@ import { isVoidExpression, isWhiteSpaceLike, isWhiteSpaceSingleLine, - JSDoc, - JSDocCallbackTag, - JSDocEnumTag, - JSDocMemberName, - JSDocParameterTag, - JSDocPropertyLikeTag, - JSDocSignature, - JSDocTag, - JSDocTemplateTag, - JSDocTypedefTag, - JsonSourceFile, - JsxChild, - JsxElement, - JsxEmit, - JsxFragment, - JsxOpeningElement, - JsxOpeningLikeElement, - JsxSelfClosingElement, - JsxTagNameExpression, - KeywordSyntaxKind, - LabeledStatement, - LanguageVariant, last, lastOrUndefined, - LateVisibilityPaintedStatement, length, - LiteralImportTypeNode, - LiteralLikeElementAccessExpression, - LiteralLikeNode, - LogicalOrCoalescingAssignmentOperator, map, mapDefined, - MapLike, - MemberName, - MethodDeclaration, - ModeAwareCache, - ModifierFlags, - ModifierLike, - ModuleBlock, - ModuleDeclaration, - ModuleDetectionKind, - ModuleKind, - ModuleResolutionKind, moduleResolutionOptionDeclarations, - MultiMap, - NamedDeclaration, - NamedExports, - NamedImports, - NamedImportsOrExports, - NamespaceExport, - NamespaceImport, - NewExpression, - NewLineKind, - Node, - NodeArray, - NodeFlags, nodeModulesPathPart, - NonNullExpression, noop, normalizePath, - NoSubstitutionTemplateLiteral, - NumericLiteral, - ObjectFlags, - ObjectFlagsType, - ObjectLiteralElement, - ObjectLiteralExpression, - ObjectLiteralExpressionBase, - ObjectTypeDeclaration, optionsAffectingProgramStructure, or, - OuterExpressionKinds, - PackageId, - ParameterDeclaration, - ParenthesizedExpression, - ParenthesizedTypeNode, parseConfigFileTextToJson, - PartiallyEmittedExpression, - Path, pathIsRelative, - Pattern, - PostfixUnaryExpression, - PrefixUnaryExpression, - PrinterOptions, - PrintHandlers, - PrivateIdentifier, - ProjectReference, - PrologueDirective, - PropertyAccessEntityNameExpression, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertyName, - PropertyNameLiteral, - PseudoBigInt, - QualifiedName, - ReadonlyCollection, - ReadonlyTextRange, removeTrailingDirectorySeparator, - RequireOrImportCall, - RequireVariableStatement, - ResolutionMode, - ResolvedModuleFull, - ResolvedTypeReferenceDirective, - ReturnStatement, - SatisfiesExpression, - ScriptKind, - ScriptTarget, semanticDiagnosticsOptionDeclarations, - SetAccessorDeclaration, - ShorthandPropertyAssignment, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureKind, singleElementArray, singleOrUndefined, skipOuterExpressions, skipTrivia, some, sort, - SortedArray, - SourceFile, - SourceFileLike, - SourceFileMayBeEmittedHost, - SourceMapSource, startsWith, startsWithUseStrict, - Statement, stringContains, - StringLiteral, - StringLiteralLike, stringToToken, - SuperCall, - SuperExpression, - SuperProperty, - SwitchStatement, - Symbol, - SymbolFlags, - SymbolTable, - SyntaxKind, - SyntaxList, sys, - 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, - 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 e6c0c5a05602a..9ff1b4f72aaaf 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1,5 +1,4 @@ import { - __String, AccessExpression, AccessorDeclaration, ArrayBindingElement, @@ -23,20 +22,15 @@ import { CallChain, CallExpression, CallLikeExpression, - canHaveIllegalTypeParameters, CaseOrDefaultClause, CharacterCodes, ClassElement, ClassLikeDeclaration, ClassStaticBlockDeclaration, - combinePaths, - compareDiagnostics, CompilerOptions, ConciseBody, ConstructorDeclaration, ConstructorTypeNode, - contains, - createCompilerDiagnostic, Debug, Declaration, DeclarationName, @@ -47,20 +41,14 @@ import { Diagnostics, ElementAccessChain, ElementAccessExpression, - emptyArray, EntityName, - entityNameToString, EnumDeclaration, - every, ExportAssignment, ExportSpecifier, Expression, FileReference, - filter, - find, - flatMap, - ForInitializer, ForInOrOfStatement, + ForInitializer, FunctionBody, FunctionLikeDeclaration, FunctionTypeNode, @@ -68,23 +56,11 @@ import { GeneratedIdentifierFlags, GeneratedPrivateIdentifier, GetAccessorDeclaration, - getAssignmentDeclarationKind, - getDirectoryPath, - getEffectiveModifierFlags, - getEffectiveModifierFlagsAlwaysIncludeJSDoc, - getElementOrPropertyAccessArgumentExpressionOrName, - getEmitScriptTarget, - getJSDocCommentsAndTags, - getJSDocTypeParameterDeclarations, - hasAccessorModifier, - hasDecorators, HasDecorators, HasExpressionInitializer, HasInitializer, HasJSDoc, HasModifiers, - hasProperty, - hasSyntacticModifier, HasType, Identifier, ImportClause, @@ -92,69 +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, - 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, @@ -179,15 +92,14 @@ import { JSDocTag, JSDocTemplateTag, JSDocThisTag, - JSDocTypedefTag, JSDocTypeTag, + JSDocTypedefTag, JsxAttributeLike, JsxChild, JsxExpression, JsxOpeningLikeElement, JsxTagNameExpression, LabeledStatement, - lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralToken, @@ -196,7 +108,6 @@ import { Modifier, ModifierFlags, ModifierLike, - modifierToFlag, ModuleBody, ModuleDeclaration, ModuleReference, @@ -210,7 +121,6 @@ import { NodeArray, NodeFlags, NonNullChain, - normalizePath, NotEmittedStatement, ObjectBindingOrAssignmentElement, ObjectBindingOrAssignmentPattern, @@ -221,7 +131,6 @@ import { OuterExpressionKinds, ParameterDeclaration, PartiallyEmittedExpression, - pathIsRelative, PostfixUnaryExpression, PrefixUnaryExpression, PrivateClassElementDeclaration, @@ -235,12 +144,7 @@ import { QualifiedName, ScriptTarget, SetAccessorDeclaration, - setLocalizedDiagnosticMessages, - setUILocale, SignatureDeclaration, - skipOuterExpressions, - some, - sortAndDeduplicate, SortedReadonlyArray, Statement, StringLiteral, @@ -263,6 +167,102 @@ import { UnparsedNode, UnparsedTextLike, VariableDeclaration, + __String, + canHaveIllegalTypeParameters, + combinePaths, + compareDiagnostics, + contains, + createCompilerDiagnostic, + emptyArray, + entityNameToString, + every, + filter, + find, + flatMap, + getAssignmentDeclarationKind, + getDirectoryPath, + getEffectiveModifierFlags, + getEffectiveModifierFlagsAlwaysIncludeJSDoc, + getElementOrPropertyAccessArgumentExpressionOrName, + getEmitScriptTarget, + getJSDocCommentsAndTags, + getJSDocTypeParameterDeclarations, + hasAccessorModifier, + hasDecorators, + hasProperty, + hasSyntacticModifier, + isAccessExpression, + isAmbientModule, + isAnyImportOrReExport, + isArrowFunction, + isBinaryExpression, + isBindableStaticElementAccessExpression, + isBindingElement, + isBlock, + isCallExpression, + isCallSignatureDeclaration, + isClassExpression, + isClassStaticBlockDeclaration, + isDecorator, + isElementAccessExpression, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isFunctionBlock, + isFunctionExpression, + isFunctionTypeNode, + isIdentifier, + isImportSpecifier, + isInJSFile, + isJSDoc, + isJSDocAugmentsTag, + isJSDocClassTag, + isJSDocDeprecatedTag, + isJSDocEnumTag, + isJSDocFunctionType, + isJSDocImplementsTag, + isJSDocOverrideTag, + isJSDocParameterTag, + isJSDocPrivateTag, + isJSDocProtectedTag, + isJSDocPublicTag, + isJSDocReadonlyTag, + isJSDocReturnTag, + isJSDocSignature, + isJSDocTemplateTag, + isJSDocThisTag, + isJSDocTypeAlias, + isJSDocTypeLiteral, + isJSDocTypeTag, + isModuleBlock, + isNonNullExpression, + isNotEmittedStatement, + isOmittedExpression, + isParameter, + isPartiallyEmittedExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isRootedDiskPath, + isSourceFile, + isStringLiteral, + isTypeLiteralNode, + isTypeNodeKind, + isTypeReferenceNode, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + isWhiteSpaceLike, + lastOrUndefined, + modifierToFlag, + normalizePath, + pathIsRelative, + setLocalizedDiagnosticMessages, + setUILocale, + skipOuterExpressions, + some, + sortAndDeduplicate, } from "./_namespaces/ts"; export function isExternalModuleNameRelative(moduleName: string): boolean { diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 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 16bd5f3e8dd4c..78af4166e9478 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 6810e32608551..7a673bdb89efc 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,48 @@ import { FileWatcher, FileWatcherCallback, FileWatcherEventKind, + HasInvalidatedResolutions, + MapLike, + ModuleResolutionCache, + ModuleResolutionInfo, + ParsedCommandLine, + Path, + PollingInterval, + ProjectReference, + ResolutionCacheHost, + ResolutionMode, + ResolvedModule, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ScriptTarget, + SharedExtendedConfigFileWatcher, + SourceFile, + System, + TypeReferenceDirectiveResolutionInfo, + WatchDirectoryFlags, + WatchOptions, + WatchType, + WatchTypeRegistry, + WildcardDirectoryWatcher, + canJsonReportNoInputFiles, + changeCompilerHostLikeToUseCache, + changesAffectModuleResolution, + cleanExtendedConfigCache, + clearMap, + clearSharedExtendedConfigFileWatcher, + closeFileWatcher, + closeFileWatcherOf, + createBuilderProgramUsingProgramBuildInfo, + createCachedDirectoryStructureHost, + createCompilerDiagnostic, + createCompilerHostFromProgramHost, + createCompilerHostWorker, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createResolutionCache, + createWatchCompilerHostOfConfigFile, + createWatchCompilerHostOfFilesAndCompilerOptions, + createWatchFactory, getBuildInfo, getConfigFileParsingDiagnostics, getDirectoryPath, @@ -49,47 +72,24 @@ import { getNormalizedAbsolutePath, getParsedCommandLineOfConfigFile, getTsBuildInfoEmitOutputFilePath, - HasInvalidatedResolutions, isArray, isIgnoredFileFromWildCardWatching, isProgramUptoDate, - MapLike, maybeBind, - ModuleResolutionCache, - ModuleResolutionInfo, noop, noopFileWatcher, parseConfigHostFromCompilerHostLike, - ParsedCommandLine, - Path, perfLogger, - PollingInterval, - ProjectReference, - ResolutionCacheHost, - ResolutionMode, - ResolvedModule, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, returnFalse, returnTrue, - ScriptTarget, setGetSourceFileAsHashVersioned, - SharedExtendedConfigFileWatcher, - SourceFile, sys, - System, toPath, - TypeReferenceDirectiveResolutionInfo, updateErrorForNoInputFiles, updateMissingFilePathsWatch, updateSharedExtendedConfigFileWatcher, updateWatchingWildcardDirectories, version, - WatchDirectoryFlags, - WatchOptions, - WatchType, - WatchTypeRegistry, - WildcardDirectoryWatcher, } from "./_namespaces/ts"; export interface ReadBuildProgramHost { diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 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 58bd58cb02150..8d9b465d80b3b 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 cfc1c6f1557fa..852372aea4930 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,32 +22,25 @@ import { EditorOptions, EmitOutput, FileTextChanges, - firstDefined, FormatCodeOptions, FormatCodeSettings, - getSnapshotText, - identity, ImplementationLocation, InlayHint, InlayHintKind, - isString, JSDocTagInfo, LanguageService, LanguageServiceHost, - map, - mapOneOrMany, NavigateToItem, NavigationBarItem, NavigationTree, - notImplemented, OrganizeImportsArgs, OutliningSpan, PatternMatchKind, Program, QuickInfo, RefactorEditInfo, - ReferencedSymbol, ReferenceEntry, + ReferencedSymbol, RenameInfo, RenameInfoFailure, RenameInfoSuccess, @@ -65,12 +53,24 @@ import { Symbol, TextChange, TextInsertion, - textPart, TextRange, TextSpan, TodoComment, TodoCommentDescriptor, UserPreferences, + computeLineAndCharacterOfPosition, + computeLineStarts, + computePositionOfLineAndCharacter, + createQueue, + createTextSpanFromBounds, + firstDefined, + getSnapshotText, + identity, + isString, + map, + mapOneOrMany, + notImplemented, + textPart, } from "./_namespaces/ts"; import { CommandNames, diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index e3e67e1909dc6..69777db105bf8 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,15 +23,11 @@ import { getProperty, hasJSFileExtension, mapDefined, - MapLike, normalizePath, - Path, readConfigFile, removeFileExtension, removeMinAndVersionNumbers, some, - TypeAcquisition, - Version, versionMajorMinor, } from "./_namespaces/ts"; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6b27c3296bcbb..4004c82e98f1a 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 dcce4777002b2..8c8748fe5bdc3 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,65 +1,105 @@ 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, + ModuleResolutionInfo, + PackageJsonAutoImportPreference, + PackageJsonInfo, + ParsedCommandLine, + Path, + PerformanceEvent, + PluginImport, + PollingInterval, + Program, + ProjectPackageJsonInfo, + ProjectReference, + ResolutionCache, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ScriptKind, + SortedReadonlyArray, + SourceFile, + SourceMapper, + StructureIsReused, + SymlinkCache, + ThrottledCancellationToken, + TypeAcquisition, + TypeReferenceDirectiveResolutionInfo, + WatchDirectoryFlags, + WatchOptions, + WatchType, addRange, append, - ApplyCodeActionCommandResult, arrayFrom, arrayToMap, - BuilderState, - CachedDirectoryStructureHost, changesAffectModuleResolution, clearMap, cloneCompilerOptions, closeFileWatcher, closeFileWatcherOf, combinePaths, - CompilerHost, - CompilerOptions, concatenate, - ConfigFileProgramReloadLevel, createCacheableExportInfoMap, createLanguageService, createResolutionCache, createSymlinkCache, - Debug, - Diagnostic, - DirectoryStructureHost, - DirectoryWatcherCallback, - DocumentPositionMapper, - DocumentRegistry, enumerateInsertsAndDeletes, every, explainFiles, - ExportInfoMap, - Extension, fileExtensionIs, - FileReference, - FileWatcher, - FileWatcherCallback, - FileWatcherEventKind, filter, firstDefined, flatMap, @@ -69,7 +109,6 @@ import { generateDjb2Hash, getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, - GetCanonicalFileName, getDeclarationEmitOutputFilePathWorker, getDefaultCompilerOptions, getDefaultLibFileName, @@ -81,75 +120,36 @@ import { getNormalizedAbsolutePath, getOrUpdate, getStringComparer, - HasInvalidatedResolutions, - HostCancellationToken, inferredTypesContainingFile, - InstallPackageOptions, - IScriptSnapshot, isDeclarationFileName, isExternalModuleNameRelative, isInsideNodeModules, - JsTyping, - LanguageService, - LanguageServiceHost, - LanguageServiceMode, map, mapDefined, maybeBind, - ModuleResolutionCache, - ModuleResolutionHost, - ModuleResolutionInfo, noop, noopFileWatcher, normalizePath, normalizeSlashes, orderedRemoveItem, outFile, - PackageJsonAutoImportPreference, - PackageJsonInfo, - ParsedCommandLine, parsePackageName, - Path, perfLogger, - PerformanceEvent, - PluginImport, - PollingInterval, - Program, - ProjectPackageJsonInfo, - ProjectReference, removeFileExtension, - ResolutionCache, resolutionExtensionIsTSOrJson, - ResolutionMode, - ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, - ResolvedTypeReferenceDirective, resolvePackageNameToPackageJson, returnFalse, returnTrue, - ScriptKind, some, sort, sortAndDeduplicate, - SortedReadonlyArray, - SourceFile, - SourceMapper, startsWith, stripQuotes, - StructureIsReused, - SymlinkCache, - ThrottledCancellationToken, timestamp, toPath, tracing, - TypeAcquisition, - TypeReferenceDirectiveResolutionInfo, updateErrorForNoInputFiles, updateMissingFilePathsWatch, - WatchDirectoryFlags, - WatchOptions, - WatchType, } from "./_namespaces/ts"; export enum ProjectKind { diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 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 ceb15519eb435..d3893f37495c0 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 40a37c99a6297..cd62000d549b8 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, @@ -47,34 +25,56 @@ import { JSDocSeeTag, JSDocTemplateTag, JSDocThisTag, - 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 0d6ab81face1a..7c37ddee959d8 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 999dab6f413e5..9417618ceaf08 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -5,25 +5,43 @@ import { BindingPattern, Block, CallExpression, - canBeConvertedToAsync, CodeFixContext, - concatenate, - createMultiMap, 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, + concatenate, + createMultiMap, elementAt, emptyArray, every, - Expression, factory, firstOrUndefined, flatMap, forEach, forEachChild, forEachReturnStatement, - FunctionExpression, - FunctionLikeDeclaration, - GeneratedIdentifierFlags, getContainingFunction, getNodeId, getObjectFlags, @@ -33,7 +51,6 @@ import { getSynthesizedDeepCloneWithReplacements, getTokenAtPosition, hasPropertyAccessExpressionWithName, - Identifier, idText, isBindingElement, isBlock, @@ -54,28 +71,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 490d65171be2f..98f640935287b 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 cd288e531df8c..6d392fbed1628 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 ba1ec81fc945f..24749a9f1e28c 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -1,8 +1,14 @@ import { - canHaveExportModifier, Declaration, Diagnostics, ExportDeclaration, + Identifier, + Node, + Program, + SourceFile, + Symbol, + VariableStatement, + canHaveExportModifier, factory, find, findAncestor, @@ -10,7 +16,6 @@ import { firstOrUndefined, getResolvedModule, getTokenAtPosition, - Identifier, isExportDeclaration, isIdentifier, isImportDeclaration, @@ -22,13 +27,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 698a7397878b1..544b37d9f853c 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -1,9 +1,17 @@ import { - addRange, CallExpression, CodeFixAction, CodeFixContext, Diagnostics, + ImportDeclaration, + ModuleKind, + NamespaceImport, + NewExpression, + Node, + SourceFile, + SyntaxKind, + TransientSymbol, + addRange, factory, findAncestor, getEmitModuleKind, @@ -11,19 +19,11 @@ import { getQuotePreference, getSourceFileOfNode, getTokenAtPosition, - ImportDeclaration, isExpression, isImportCall, isNamedDeclaration, makeImport, - ModuleKind, - NamespaceImport, - NewExpression, - Node, - SourceFile, - SyntaxKind, textChanges, - TransientSymbol, } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index 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 1bc5bbb658c27..9fcec04c92033 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 2f0c90737549a..233a148f889b6 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -2,29 +2,62 @@ import { AnyImportOrRequire, AnyImportOrRequireStatement, AnyImportSyntax, - arrayFrom, CancellationToken, - cast, CodeAction, CodeFixAction, CodeFixContextBase, + Comparison, + CompilerOptions, + Debug, + DiagnosticAndArguments, + DiagnosticWithLocation, + Diagnostics, + ExportKind, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportKind, + ImportsNotUsedAsValues, + InternalSymbolName, + LanguageServiceHost, + ModuleKind, + ModuleResolutionKind, + MultiMap, + Mutable, + NamedImports, + Node, + NodeFlags, + ObjectBindingPattern, + OrganizeImports, + PackageJsonImportFilter, + Path, + Program, + QuotePreference, + RequireVariableStatement, + ScriptTarget, + SemanticMeaning, + SourceFile, + StringLiteral, + Symbol, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + TypeChecker, + TypeOnlyAliasDeclaration, + UserPreferences, + arrayFrom, + cast, combine, compareBooleans, compareNumberOfDirectorySeparators, compareValues, - Comparison, - CompilerOptions, createModuleSpecifierResolutionHost, createMultiMap, createPackageJsonImportFilter, - Debug, - DiagnosticAndArguments, - Diagnostics, - DiagnosticWithLocation, emptyArray, escapeLeadingUnderscores, every, - ExportKind, factory, first, firstDefined, @@ -52,27 +85,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,57 +111,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, - 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 7be223f9a8332..d9604716d1b6f 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -1,24 +1,63 @@ import { - __String, AnonymousType, BinaryExpression, CallExpression, CancellationToken, CaseOrDefaultClause, - cast, - createMultiMap, - createSymbolTable, Debug, Declaration, DiagnosticMessage, Diagnostics, ElementAccessExpression, EmitFlags, + Expression, + FindAllReferences, + Identifier, + IndexKind, + LanguageServiceHost, + NewExpression, + Node, + NodeSeenTracker, + ObjectFlags, + ParameterDeclaration, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SourceFile, + Symbol, + SymbolFlags, + SymbolLinks, + SyntaxKind, + Token, + TransientSymbol, + Type, + TypeFlags, + TypeNode, + TypeReference, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionReduction, + UserPreferences, + VariableDeclaration, + __String, + cast, + createMultiMap, + createSymbolTable, emptyArray, escapeLeadingUnderscores, - Expression, factory, - FindAllReferences, findChildOfKind, first, firstOrUndefined, @@ -34,8 +73,6 @@ import { getTextOfNode, getTokenAtPosition, getTypeNodeIfAccessible, - Identifier, - IndexKind, isArrowFunction, isAssignmentExpression, isCallExpression, @@ -55,60 +92,23 @@ import { isSetAccessorDeclaration, isVariableDeclaration, isVariableStatement, - LanguageServiceHost, last, length, map, mapDefined, mapEntries, - NewExpression, - Node, nodeSeenTracker, - NodeSeenTracker, - ObjectFlags, - ParameterDeclaration, - PrefixUnaryExpression, - PrivateIdentifier, - Program, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, - PropertyName, - PropertySignature, returnTrue, - ScriptTarget, - SetAccessorDeclaration, setEmitFlags, - ShorthandPropertyAssignment, - Signature, - SignatureDeclaration, - SignatureFlags, - SignatureKind, singleOrUndefined, - SourceFile, - Symbol, - SymbolFlags, - SymbolLinks, - SyntaxKind, textChanges, - Token, - TransientSymbol, tryCast, - Type, - TypeFlags, - TypeNode, - TypeReference, - UnderscoreEscapedMap, - UnionOrIntersectionType, - UnionReduction, - UserPreferences, - VariableDeclaration, } from "../_namespaces/ts"; import { + ImportAdder, codeFixAll, createCodeFixAction, createImportAdder, - ImportAdder, registerCodeFix, tryGetAutoImportableReferenceFromTypeNode, } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/removeUnnecessaryAwait.ts b/src/services/codefixes/removeUnnecessaryAwait.ts index 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 b6930f0b7efba..b56d81e7ad2d7 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 11afb4c8c0ab9..4a0e1097cb1cd 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,21 +1,12 @@ import { - __String, - addToSeen, - append, BinaryExpression, BreakOrContinueStatement, CancellationToken, - cast, CharacterCodes, ClassElement, CodeAction, - codefix, - compareNumberOfDirectorySeparators, - compareStringsCaseSensitiveUI, - compareTextSpans, Comparison, CompilerOptions, - compilerOptionsIndicateEsModules, CompletionEntry, CompletionEntryData, CompletionEntryDataAutoImport, @@ -25,11 +16,113 @@ import { CompletionEntryLabelDetails, CompletionInfo, CompletionInfoFlags, - CompletionsTriggerCharacter, CompletionTriggerKind, - concatenate, + CompletionsTriggerCharacter, ConstructorDeclaration, ContextFlags, + Debug, + Declaration, + Diagnostics, + EmitHint, + EmitTextWriter, + ExportKind, + Expression, + FunctionLikeDeclaration, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportKind, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IncompleteCompletionsCache, + InternalSymbolName, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypeExpression, + JSDocTypeTag, + JSDocTypedefTag, + JsDoc, + JsTyping, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxElement, + JsxOpeningLikeElement, + JsxSpreadAttribute, + LanguageServiceHost, + LanguageVariant, + ListFormat, + MemberOverrideStatus, + MethodDeclaration, + ModifierFlags, + ModifierSyntaxKind, + ModuleDeclaration, + ModuleReference, + NamedImportBindings, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + ObjectBindingPattern, + ObjectLiteralExpression, + ObjectType, + ObjectTypeDeclaration, + PrinterOptions, + Program, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + PseudoBigInt, + QualifiedName, + QuotePreference, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + SemanticMeaning, + SignatureHelp, + SignatureKind, + SnippetKind, + SortedArray, + SourceFile, + SpreadAssignment, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + TextChange, + TextRange, + TextSpan, + Token, + TokenSyntaxKind, + Type, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeOnlyAliasDeclaration, + UnionReduction, + UnionType, + UserPreferences, + VariableDeclaration, + __String, + addToSeen, + append, + cast, + codefix, + compareNumberOfDirectorySeparators, + compareStringsCaseSensitiveUI, + compareTextSpans, + compilerOptionsIndicateEsModules, + concatenate, createModuleSpecifierResolutionHost, createPackageJsonImportFilter, createPrinter, @@ -38,17 +131,10 @@ import { createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, - Debug, - Declaration, - Diagnostics, diagnosticToString, displayPart, - EmitHint, - EmitTextWriter, escapeSnippetText, every, - ExportKind, - Expression, factory, filter, find, @@ -59,7 +145,6 @@ import { firstDefined, flatMap, formatting, - FunctionLikeDeclaration, getAllSuperTypeNodes, getAncestor, getCombinedLocalAndExportSymbolFlags, @@ -98,16 +183,7 @@ import { hasEffectiveModifier, hasInitializer, hasType, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, - ImportKind, - ImportOrExportSpecifier, - ImportSpecifier, - ImportTypeNode, - IncompleteCompletionsCache, insertSorted, - InternalSymbolName, isAbstractConstructorSymbol, isArrowFunction, isAssertionExpression, @@ -144,16 +220,16 @@ import { isFunctionTypeNode, isIdentifier, isIdentifierText, - isImportableFile, isImportDeclaration, isImportEqualsDeclaration, isImportKeyword, isImportSpecifier, + isImportableFile, isInComment, - isInitializedProperty, isInJSFile, isInRightSideOfInternalImportEqualsDeclaration, isInString, + isInitializedProperty, isIntersectionTypeNode, isJSDoc, isJSDocParameterTag, @@ -215,121 +291,45 @@ import { isValidTypeOnlyAliasUseSite, isVariableDeclaration, isVariableLike, - JsDoc, - JSDocParameterTag, - JSDocPropertyTag, - JSDocReturnTag, - JSDocTag, - JSDocTagInfo, - JSDocTemplateTag, - JSDocTypedefTag, - JSDocTypeExpression, - JSDocTypeTag, - JsTyping, - JsxAttribute, - JsxAttributes, - JsxClosingElement, - JsxElement, - JsxOpeningLikeElement, - JsxSpreadAttribute, - LanguageServiceHost, - LanguageVariant, last, lastOrUndefined, length, - ListFormat, mapDefined, maybeBind, - MemberOverrideStatus, memoize, memoizeOne, - MethodDeclaration, - ModifierFlags, - modifiersToFlags, - ModifierSyntaxKind, modifierToFlag, - ModuleDeclaration, - ModuleReference, + modifiersToFlags, moduleResolutionRespectsExports, - NamedImportBindings, - Node, - NodeArray, - NodeBuilderFlags, - NodeFlags, nodeIsMissing, - ObjectBindingPattern, - ObjectLiteralExpression, - ObjectType, - ObjectTypeDeclaration, or, positionBelongsToNode, positionIsASICandidate, positionsAreOnSameLine, - PrinterOptions, probablyUsesSemicolons, - Program, programContainsModules, - PropertyAccessExpression, - PropertyDeclaration, - PropertyName, - PseudoBigInt, pseudoBigIntToString, - QualifiedName, quote, - QuotePreference, rangeContainsPosition, rangeContainsPositionExclusive, rangeIsOnSingleLine, - ScriptElementKind, - ScriptElementKindModifier, - ScriptTarget, - SemanticMeaning, setSnippetElement, shouldUseUriStyleNodeCoreModules, - SignatureHelp, - SignatureKind, singleElementArray, skipAlias, - SnippetKind, some, - SortedArray, - SourceFile, - SpreadAssignment, stableSort, startsWith, stringToToken, stripQuotes, - Symbol, - SymbolDisplay, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolExportInfo, - SymbolFlags, - SymbolId, - SyntaxKind, - TextChange, textChanges, textPart, - TextRange, - TextSpan, timestamp, - Token, - TokenSyntaxKind, tokenToString, tryCast, tryGetImportFromModuleSpecifier, - Type, - TypeChecker, - TypeElement, - TypeFlags, typeHasCallOrConstructSignatures, - TypeLiteralNode, - TypeOnlyAliasDeclaration, unescapeLeadingUnderscores, - UnionReduction, - UnionType, - UserPreferences, - VariableDeclaration, walkUpParenthesizedExpressions, } from "./_namespaces/ts"; import { StringCompletions } from "./_namespaces/ts.Completions"; diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index c3bb005234dca..dce36fc57044c 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -1,35 +1,51 @@ import { - __String, - arrayFrom, - arrayToMultiMap, Block, BreakOrContinueStatement, CancellationToken, CaseClause, + ConstructorDeclaration, + Debug, + DefaultClause, + FindAllReferences, + FunctionDeclaration, + FunctionLikeDeclaration, + HighlightSpan, + HighlightSpanKind, + IfStatement, + IterationStatement, + MethodDeclaration, + Modifier, + ModifierFlags, + ModuleBlock, + Node, + ObjectLiteralExpression, + ObjectTypeDeclaration, + Program, + Push, + ReturnStatement, + SourceFile, + SwitchStatement, + SyntaxKind, + ThrowStatement, + TryStatement, + __String, + arrayFrom, + arrayToMultiMap, cast, concatenate, - ConstructorDeclaration, contains, createGetCanonicalFileName, createTextSpanFromBounds, createTextSpanFromNode, - Debug, - DefaultClause, find, - FindAllReferences, findAncestor, findChildOfKind, findModifier, forEach, forEachChild, forEachReturnStatement, - FunctionDeclaration, - FunctionLikeDeclaration, getContainingFunction, getTouchingPropertyName, - HighlightSpan, - HighlightSpanKind, - IfStatement, isAccessor, isAwaitExpression, isBlock, @@ -59,26 +75,10 @@ import { isVariableStatement, isWhiteSpaceSingleLine, isYieldExpression, - IterationStatement, mapDefined, - MethodDeclaration, - Modifier, - ModifierFlags, modifierToFlag, - ModuleBlock, - Node, - ObjectLiteralExpression, - ObjectTypeDeclaration, - Program, - Push, - ReturnStatement, - SourceFile, - SwitchStatement, - SyntaxKind, - ThrowStatement, toArray, toPath, - TryStatement, } from "./_namespaces/ts"; export interface DocumentHighlights { diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index 27faadad16b08..f06edbcf41433 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, @@ -16,15 +23,8 @@ import { hasProperty, identity, isArray, - IScriptSnapshot, isDeclarationFileName, map, - MinimalResolutionCacheHost, - Path, - ResolutionMode, - ScriptKind, - ScriptTarget, - SourceFile, sourceFileAffectingCompilerOptions, toPath, tracing, diff --git a/src/services/exportInfoMap.ts b/src/services/exportInfoMap.ts index 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 6e9a5570306be..a0d9c1088c562 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,35 +1,89 @@ import { - __String, - addToSeen, - append, AssignmentDeclarationKind, BinaryExpression, BindingElement, Block, CallExpression, CancellationToken, - cast, CheckFlags, ClassLikeDeclaration, + ConstructorDeclaration, + Debug, + Declaration, + DocumentSpan, + ExportSpecifier, + Expression, + FileIncludeReason, + FileReference, + ForInOrOfStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + GoToDefinition, + HighlightSpan, + HighlightSpanKind, + Identifier, + ImplementationLocation, + InterfaceDeclaration, + InternalSymbolName, + JSDocTag, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, + MultiMap, + NamedDeclaration, + Node, + NodeFlags, + NumericLiteral, + ParameterDeclaration, + ParenthesizedExpression, + Path, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + Push, + ReferenceEntry, + ReferencedSymbol, + ReferencedSymbolDefinitionInfo, + ReferencedSymbolEntry, + RenameLocation, + ScriptElementKind, + ScriptTarget, + SemanticMeaning, + SetAccessorDeclaration, + SignatureDeclaration, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolId, + SyntaxKind, + TextSpan, + TypeChecker, + VariableDeclaration, + __String, + addToSeen, + append, + cast, climbPastPropertyAccess, compareValues, - ConstructorDeclaration, contains, createQueue, createTextSpan, createTextSpanFromBounds, createTextSpanFromRange, - Debug, - Declaration, displayPart, - DocumentSpan, emptyArray, emptyOptions, escapeLeadingUnderscores, - ExportSpecifier, - Expression, - FileIncludeReason, - FileReference, filter, find, findAncestor, @@ -41,11 +95,6 @@ import { flatMap, forEachChild, forEachReturnStatement, - ForInOrOfStatement, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, - GetAccessorDeclaration, getAdjustedReferenceLocation, getAdjustedRenameLocation, getAllSuperTypeNodes, @@ -77,17 +126,10 @@ import { getTextOfNode, getThisContainer, getTouchingPropertyName, - GoToDefinition, hasEffectiveModifier, hasInitializer, hasSyntacticModifier, hasType, - HighlightSpan, - HighlightSpanKind, - Identifier, - ImplementationLocation, - InterfaceDeclaration, - InternalSymbolName, isAccessExpression, isArrayLiteralOrObjectLiteralDestructuringPattern, isAssertionExpression, @@ -132,8 +174,8 @@ import { isJsxOpeningElement, isJsxSelfClosingElement, isJumpStatementTarget, - isLabeledStatement, isLabelOfLabeledStatement, + isLabeledStatement, isLiteralComputedPropertyDeclarationName, isLiteralNameOfPropertyDeclarationOrIndexAccess, isLiteralTypeNode, @@ -154,8 +196,8 @@ import { isPrivateIdentifierClassElementDeclaration, isPropertyAccessExpression, isQualifiedName, - isReferencedFile, isReferenceFileLocation, + isReferencedFile, isRightSideOfPropertyAccess, isShorthandPropertyAssignment, isSourceFile, @@ -178,75 +220,33 @@ import { isVariableStatement, isVoidExpression, isWriteAccess, - JSDocTag, map, mapDefined, - MethodDeclaration, - ModifierFlags, - ModuleDeclaration, - MultiMap, - NamedDeclaration, - Node, - NodeFlags, nodeSeenTracker, - NumericLiteral, - ParameterDeclaration, - ParenthesizedExpression, - Path, - PrivateIdentifier, - Program, - PropertyAccessExpression, - PropertyAssignment, - PropertyDeclaration, punctuationPart, - Push, rangeIsOnSingleLine, - ReferencedSymbol, - ReferencedSymbolDefinitionInfo, - ReferencedSymbolEntry, - ReferenceEntry, - RenameLocation, - ScriptElementKind, - ScriptTarget, - SemanticMeaning, - SetAccessorDeclaration, - SignatureDeclaration, skipAlias, some, - SourceFile, - Statement, - StringLiteral, - StringLiteralLike, stripQuotes, - Symbol, - SymbolDisplay, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolFlags, - SymbolId, symbolName, - SyntaxKind, textPart, - TextSpan, tokenToString, tryAddToSet, tryCast, tryGetClassExtendingExpressionWithTypeArguments, tryGetImportFromModuleSpecifier, - TypeChecker, - VariableDeclaration, } from "./_namespaces/ts"; import { - createImportTracker, ExportInfo, ExportKind, - 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 7a5373a63dd5d..ebea49a117888 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 53a578fbe3521..caa4808d4de17 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 e8c7f4c2bd140..e8371e232b7d7 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 47be1d6781c4f..39fb28caa0ff4 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -3,26 +3,41 @@ import { AssignmentExpression, AssignmentOperatorToken, CallLikeExpression, + Debug, + Declaration, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + FileReference, + FindAllReferences, + FunctionLikeDeclaration, + ModifierFlags, + Node, + NodeFlags, + Program, + ScriptElementKind, + SignatureDeclaration, + SourceFile, + Symbol, + SymbolDisplay, + SymbolFlags, + SyntaxKind, + TextSpan, + Type, + TypeChecker, + TypeFlags, concatenate, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, - Debug, - Declaration, - DefinitionInfo, - DefinitionInfoAndBoundSpan, emptyArray, every, - FileReference, filter, find, - FindAllReferences, findAncestor, first, flatMap, forEach, - FunctionLikeDeclaration, getAssignmentDeclarationKind, getContainingObjectLiteralElement, getDirectoryPath, @@ -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 0cca4a93f915b..5c0a1d6e6f588 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -1,17 +1,41 @@ import { - __String, AnyImportOrReExport, AssignmentDeclarationKind, BinaryExpression, BindingElement, CallExpression, CancellationToken, - canHaveModifiers, - cast, Debug, ExportAssignment, ExportDeclaration, FileReference, + Identifier, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + InternalSymbolName, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + NamedImportsOrExports, + NamespaceImport, + Node, + Program, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SymbolFlags, + SyntaxKind, + TypeChecker, + ValidImportTypeNode, + VariableDeclaration, + __String, + canHaveModifiers, + cast, findAncestor, forEach, getAssignmentDeclarationKind, @@ -20,14 +44,7 @@ import { getSourceFileOfNode, getSymbolId, hasSyntacticModifier, - Identifier, - ImportCall, - ImportClause, - ImportDeclaration, - ImportEqualsDeclaration, importFromModuleSpecifier, - ImportSpecifier, - InternalSymbolName, isAccessExpression, isBinaryExpression, isBindingElement, @@ -55,27 +72,10 @@ import { isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, - ModifierFlags, - ModuleBlock, - ModuleDeclaration, - NamedImportsOrExports, - NamespaceImport, - Node, nodeSeenTracker, - Program, some, - SourceFile, - Statement, - StringLiteral, - StringLiteralLike, - Symbol, symbolEscapedNameNoDefault, - SymbolFlags, symbolName, - SyntaxKind, - TypeChecker, - ValidImportTypeNode, - VariableDeclaration, walkUpBindingElementsAndPatterns, } from "./_namespaces/ts"; diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index 45bb04e6e1329..3af19b6c9e731 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 45e9d80f673a1..fa2335f019790 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,20 +1,50 @@ import { - arraysEqual, ArrowFunction, AssignmentDeclarationKind, BinaryExpression, - buildLinkParts, ClassExpression, CompletionEntry, CompletionEntryDetails, Completions, ConstructorDeclaration, - contains, Declaration, DocCommentTemplateOptions, - emptyArray, Expression, ExpressionStatement, + FunctionDeclaration, + FunctionExpression, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocImplementsTag, + JSDocParameterTag, + JSDocPropertyTag, + JSDocSeeTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypeTag, + JSDocTypedefTag, + MethodDeclaration, + MethodSignature, + Node, + ParameterDeclaration, + ParenthesizedExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + ScriptElementKind, + SourceFile, + SymbolDisplayPart, + SyntaxKind, + TextInsertion, + TypeChecker, + VariableStatement, + arraysEqual, + buildLinkParts, + contains, + emptyArray, find, findAncestor, flatMap, @@ -23,8 +53,6 @@ import { forEachAncestor, forEachReturnStatement, forEachUnique, - FunctionDeclaration, - FunctionExpression, getAssignmentDeclarationKind, getJSDocCommentsAndTags, getJSDocTags, @@ -45,47 +73,19 @@ import { isJSDoc, isJSDocParameterTag, isWhiteSpaceSingleLine, - JSDoc, - JSDocAugmentsTag, - JSDocCallbackTag, - JSDocComment, - JSDocImplementsTag, - JSDocParameterTag, - JSDocPropertyTag, - JSDocSeeTag, - JSDocTag, - JSDocTagInfo, - JSDocTemplateTag, - JSDocTypedefTag, - JSDocTypeTag, lastOrUndefined, length, lineBreakPart, map, mapDefined, - MethodDeclaration, - MethodSignature, - Node, - ParameterDeclaration, parameterNamePart, - ParenthesizedExpression, - PropertyAssignment, - PropertyDeclaration, propertyNamePart, - PropertySignature, punctuationPart, - ScriptElementKind, - SourceFile, spacePart, startsWith, - SymbolDisplayPart, - SyntaxKind, - TextInsertion, textPart, typeAliasNamePart, - TypeChecker, typeParameterNamePart, - VariableStatement, } from "./_namespaces/ts"; const jsDocTagNames = [ diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 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 77874bf6e6d35..22a40608dca4c 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -1,28 +1,40 @@ import { AnyImportOrRequireStatement, + Comparison, + ExportDeclaration, + ExportSpecifier, + Expression, + FileTextChanges, + FindAllReferences, + Identifier, + ImportDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + LanguageServiceHost, + NamedImportBindings, + NamedImports, + NamespaceImport, + OrganizeImportsMode, + Program, + Scanner, + SortedReadonlyArray, + SourceFile, + SyntaxKind, + TransformFlags, + UserPreferences, arrayIsSorted, binarySearch, compareBooleans, compareStringsCaseInsensitive, compareValues, - Comparison, createScanner, emptyArray, - ExportDeclaration, - ExportSpecifier, - Expression, factory, - FileTextChanges, - FindAllReferences, flatMap, formatting, getNewLineOrDefaultFromHost, group, - Identifier, identity, - ImportDeclaration, - ImportOrExportSpecifier, - ImportSpecifier, isAmbientModule, isExportDeclaration, isExternalModuleNameRelative, @@ -35,25 +47,13 @@ import { isStringLiteral, isStringLiteralLike, jsxModeNeedsExplicitImport, - LanguageServiceHost, length, map, - NamedImportBindings, - NamedImports, - NamespaceImport, - OrganizeImportsMode, - Program, - Scanner, some, - SortedReadonlyArray, - SourceFile, stableSort, suppressLeadingTrivia, - SyntaxKind, textChanges, - TransformFlags, tryCast, - UserPreferences, } from "./_namespaces/ts"; /** diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 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 689460c9ee2dd..4ee420179c265 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, NamespaceDeclaration, Node, @@ -39,20 +22,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 276804acf15a2..605cd5449fe3d 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 5172c5020d8e0..8df87debd1542 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -1,14 +1,27 @@ import { + ApplicableRefactorInfo, + Debug, + Diagnostics, + EmitFlags, + JSDocTag, + JSDocTemplateTag, + Node, + RefactorContext, + RefactorEditInfo, + SourceFile, + Statement, + SymbolFlags, + TextRange, + TypeChecker, + TypeElement, + TypeNode, + TypeParameterDeclaration, addRange, addToSeen, append, - ApplicableRefactorInfo, cast, concatenate, createTextRangeFromSpan, - Debug, - Diagnostics, - EmitFlags, emptyArray, factory, findAncestor, @@ -41,30 +54,17 @@ import { isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, - JSDocTag, - JSDocTemplateTag, - Node, nodeOverlapsWithStartEnd, pushIfUnique, rangeContainsStartEnd, - RefactorContext, - RefactorEditInfo, setEmitFlags, setTextRange, skipTrivia, - SourceFile, - Statement, - SymbolFlags, textChanges, - TextRange, - TypeChecker, - TypeElement, - TypeNode, - TypeParameterDeclaration, } from "../_namespaces/ts"; import { - 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 937c31edadd7f..20e8dceafb311 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -1,45 +1,81 @@ import { AnyImportOrRequireStatement, - append, ApplicableRefactorInfo, AssignmentDeclarationKind, BinaryExpression, BindingElement, BindingName, CallExpression, + ClassDeclaration, + Debug, + Declaration, + DeclarationStatement, + Diagnostics, + EnumDeclaration, + Expression, + ExpressionStatement, + ExternalModuleReference, + FindAllReferences, + FunctionDeclaration, + GetCanonicalFileName, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + InterfaceDeclaration, + InternalSymbolName, + LanguageServiceHost, + ModifierFlags, + ModifierLike, + ModuleDeclaration, + NamedImportBindings, + Node, + NodeFlags, + ObjectBindingElementWithoutPropertyName, + Program, + PropertyAccessExpression, + PropertyAssignment, + QuotePreference, + RefactorContext, + RefactorEditInfo, + RequireOrImportCall, + RequireVariableStatement, + ScriptTarget, + SourceFile, + Statement, + StringLiteralLike, + Symbol, + SymbolFlags, + SyntaxKind, + TransformFlags, + TypeAliasDeclaration, + TypeChecker, + TypeNode, + UserPreferences, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + append, canHaveDecorators, canHaveModifiers, cast, - ClassDeclaration, codefix, combinePaths, concatenate, contains, copyEntries, createTextRangeFromSpan, - Debug, - Declaration, - DeclarationStatement, - Diagnostics, emptyArray, ensurePathIsNonModuleName, - EnumDeclaration, escapeLeadingUnderscores, - Expression, - ExpressionStatement, extensionFromPath, - ExternalModuleReference, factory, find, - FindAllReferences, findIndex, firstDefined, flatMap, forEachEntry, - FunctionDeclaration, getAssignmentDeclarationKind, getBaseFileName, - GetCanonicalFileName, getDecorators, getDirectoryPath, getLocaleSpecificMessage, @@ -53,12 +89,7 @@ import { getUniqueName, hasSyntacticModifier, hostGetCanonicalFileName, - Identifier, - ImportDeclaration, - ImportEqualsDeclaration, insertImports, - InterfaceDeclaration, - InternalSymbolName, isArrayLiteralExpression, isBinaryExpression, isBindingElement, @@ -81,51 +112,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, removeFileExtension, - RequireOrImportCall, - RequireVariableStatement, - ScriptTarget, skipAlias, some, - SourceFile, - Statement, - StringLiteralLike, - Symbol, - SymbolFlags, symbolNameNoDefault, - SyntaxKind, takeWhile, textChanges, - TransformFlags, tryCast, - TypeAliasDeclaration, - TypeChecker, - TypeNode, - UserPreferences, - VariableDeclaration, - VariableDeclarationList, - VariableStatement, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/rename.ts b/src/services/rename.ts index 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 41b3c78172ad1..48d2b98804cbd 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, @@ -14,46 +13,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, @@ -62,73 +44,23 @@ import { EditorSettings, ElementAccessExpression, EmitTextWriter, - emptyArray, - emptyOptions, EndOfFileToken, EntityName, - equateValues, ExportDeclaration, FileReference, FileTextChanges, - filter, - find, FindAllReferences, - findChildOfKind, - findPrecedingToken, - first, - firstDefined, - firstOrOnly, - flatMap, - forEach, - forEachChild, FormatCodeOptions, FormatCodeSettings, - formatting, FunctionLikeDeclaration, GeneratedIdentifierFlags, - getAdjustedRenameLocation, - getAllSuperTypeNodes, - getAssignmentDeclarationKind, GetCompletionsAtPositionOptions, - getContainerNode, - getDefaultLibFileName, - getDirectoryPath, - getEmitDeclarations, - getEntries, - getEscapedTextOfIdentifierOrLiteral, - getFileEmitOutput, - getImpliedNodeFormatForFile, - getJSDocTags, - getLineAndCharacterOfPosition, - getLineStarts, - getMappedDocumentSpan, - getNameFromPropertyName, - getNewLineCharacter, - getNewLineOrDefaultFromHost, - getNonAssignedNameOfDeclaration, - getNormalizedAbsolutePath, - getObjectFlags, - getScriptKind, - getSetExternalModuleIndicator, - getSnapshotText, - getSourceFileOfNode, - getSourceMapper, - getTokenPosOfNode, - getTouchingPropertyName, - getTouchingToken, GoToDefinition, HasInvalidatedResolutions, - hasJSDocNodes, - hasProperty, - hasStaticModifier, - hasSyntacticModifier, HighlightSpanKind, HostCancellationToken, - hostGetCanonicalFileName, - hostUsesCaseSensitiveFileNames, + IScriptSnapshot, Identifier, - identity, - idText, ImplementationLocation, ImportDeclaration, IndexKind, @@ -136,56 +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, - JsDoc, JSDoc, JSDocContainer, JSDocTagInfo, + JsDoc, JsonSourceFile, JsxAttributes, JsxClosingTagInfo, @@ -196,17 +84,9 @@ import { LanguageServiceHost, LanguageServiceMode, LanguageVariant, - lastOrUndefined, - length, LineAndCharacter, - lineBreakPart, LiteralType, - map, - mapDefined, MapLike, - mapOneOrMany, - maybeBind, - maybeSetLocalizedDiagnosticMessages, ModeAwareCache, ModifierFlags, ModuleDeclaration, @@ -216,8 +96,6 @@ import { Node, NodeArray, NodeFlags, - noop, - normalizePath, NumberLiteralType, NumericLiteral, ObjectAllocator, @@ -232,9 +110,7 @@ import { OutliningSpan, ParseConfigFileHost, ParsedCommandLine, - parseJsonSourceFileConfigFileContent, Path, - positionIsSynthesized, PossibleProgramFileInfo, PragmaMap, PrivateIdentifier, @@ -242,12 +118,11 @@ import { PropertyName, Push, QuickInfo, - refactor, RefactorContext, RefactorEditInfo, RefactorTriggerReason, - ReferencedSymbol, ReferenceEntry, + ReferencedSymbol, Rename, RenameInfo, RenameInfoOptions, @@ -255,15 +130,12 @@ import { ResolvedModuleFull, ResolvedProjectReference, ResolvedTypeReferenceDirective, - returnFalse, - scanner, ScriptElementKind, ScriptElementKindModifier, ScriptKind, ScriptTarget, SelectionRange, SemanticClassificationFormat, - setObjectAllocator, Signature, SignatureDeclaration, SignatureFlags, @@ -271,14 +143,12 @@ import { SignatureHelpItems, SignatureHelpItemsOptions, SignatureKind, - singleElementArray, SmartSelectionRange, SortedArray, SourceFile, SourceFileLike, SourceMapSource, Statement, - stringContains, StringLiteral, StringLiteralLike, StringLiteralType, @@ -286,22 +156,16 @@ import { SymbolDisplay, SymbolDisplayPart, SymbolFlags, - symbolName, SyntaxKind, SyntaxList, - tagNamesAreEquivalent, TextChange, TextChangeRange, TextInsertion, TextRange, TextSpan, - textSpanEnd, - timestamp, TodoComment, TodoCommentDescriptor, Token, - toPath, - tracing, TransformFlags, TransientSymbol, Type, @@ -311,13 +175,149 @@ import { TypeParameter, TypePredicate, TypeReference, - typeToDisplayParts, UnderscoreEscapedMap, UnionOrIntersectionType, UnionType, - updateSourceFile, UserPreferences, VariableDeclaration, + __String, + changeCompilerHostLikeToUseCache, + classifier, + codefix, + combinePaths, + compareValues, + computePositionOfLineAndCharacter, + computeSuggestionDiagnostics, + createDocumentRegistry, + createGetCanonicalFileName, + createMultiMap, + createProgram, + createSourceFile, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + deduplicate, + directoryProbablyExists, + emptyArray, + emptyOptions, + equateValues, + filter, + find, + findChildOfKind, + findPrecedingToken, + first, + firstDefined, + firstOrOnly, + flatMap, + forEach, + forEachChild, + formatting, + getAdjustedRenameLocation, + getAllSuperTypeNodes, + getAssignmentDeclarationKind, + getContainerNode, + getDefaultLibFileName, + getDirectoryPath, + getEmitDeclarations, + getEntries, + getEscapedTextOfIdentifierOrLiteral, + getFileEmitOutput, + getImpliedNodeFormatForFile, + getJSDocTags, + getLineAndCharacterOfPosition, + getLineStarts, + getMappedDocumentSpan, + getNameFromPropertyName, + getNewLineCharacter, + getNewLineOrDefaultFromHost, + getNonAssignedNameOfDeclaration, + getNormalizedAbsolutePath, + getObjectFlags, + getScriptKind, + getSetExternalModuleIndicator, + getSnapshotText, + getSourceFileOfNode, + getSourceMapper, + getTokenPosOfNode, + getTouchingPropertyName, + getTouchingToken, + hasJSDocNodes, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, + hostGetCanonicalFileName, + hostUsesCaseSensitiveFileNames, + idText, + identity, + insertSorted, + isArray, + isBindingPattern, + isComputedPropertyName, + isConstTypeReference, + isDeclarationName, + isGetAccessor, + isIdentifier, + isImportMeta, + isInComment, + isInString, + isInTemplateString, + isInsideJsxElement, + isInsideJsxElementOrAttribute, + isIntrinsicJsxName, + isJSDocCommentContainingNode, + isJsxAttributes, + isJsxClosingElement, + isJsxElement, + isJsxFragment, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxText, + isLabelName, + isLiteralComputedPropertyDeclarationName, + isNameOfModuleDeclaration, + isNamedExports, + isNamedTupleMember, + isNewExpression, + isNodeKind, + isObjectLiteralElement, + isObjectLiteralExpression, + isPrivateIdentifier, + isProgramUptoDate, + isPropertyAccessExpression, + isPropertyName, + isRightSideOfPropertyAccess, + isRightSideOfQualifiedName, + isSetAccessor, + isStringOrNumericLiteralLike, + isTagName, + isTextWhiteSpaceLike, + isThisTypeParameter, + lastOrUndefined, + length, + lineBreakPart, + map, + mapDefined, + mapOneOrMany, + maybeBind, + maybeSetLocalizedDiagnosticMessages, + noop, + normalizePath, + parseJsonSourceFileConfigFileContent, + positionIsSynthesized, + refactor, + returnFalse, + scanner, + setObjectAllocator, + singleElementArray, + stringContains, + symbolName, + tagNamesAreEquivalent, + textSpanEnd, + timestamp, + toPath, + tracing, + typeToDisplayParts, + updateSourceFile, } from "./_namespaces/ts"; /** The version of the language service API */ diff --git a/src/services/shims.ts b/src/services/shims.ts index 64b1fe0f624b0..ee748bcf30a8a 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 1ca1b0ae6dd15..9b7ed534cd896 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -4,16 +4,42 @@ import { CallLikeExpression, CancellationToken, CheckFlags, + Debug, + EmitHint, + Expression, + FunctionExpression, + Identifier, + InternalSymbolName, + ListFormat, + Node, + NodeBuilderFlags, + ParameterDeclaration, + ParenthesizedExpression, + Printer, + Program, + Signature, + SignatureHelpItem, + SignatureHelpItems, + SignatureHelpParameter, + SignatureHelpTriggerReason, + SourceFile, + Symbol, + SymbolDisplayPart, + SyntaxKind, + TaggedTemplateExpression, + TemplateExpression, + TextSpan, + TransientSymbol, + Type, + TypeChecker, + TypeParameter, contains, countWhere, createPrinter, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, - Debug, - EmitHint, emptyArray, - Expression, factory, findContainingList, findIndex, @@ -22,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, @@ -50,36 +73,13 @@ import { isTemplateTail, last, lastOrUndefined, - ListFormat, map, mapToDisplayParts, - Node, - NodeBuilderFlags, - ParameterDeclaration, - ParenthesizedExpression, - Printer, - Program, punctuationPart, rangeContainsRange, - Signature, - SignatureHelpItem, - SignatureHelpItems, - SignatureHelpParameter, - SignatureHelpTriggerReason, skipTrivia, - SourceFile, spacePart, - Symbol, - SymbolDisplayPart, symbolToDisplayParts, - SyntaxKind, - TaggedTemplateExpression, - TemplateExpression, - TextSpan, - TransientSymbol, - Type, - TypeChecker, - TypeParameter, } from "./_namespaces/ts"; const enum InvocationKind { Call, TypeArgs, Contextual } diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index 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 c319ad3b8e92a..456fe19e6a324 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, + ModuleResolutionKind, + Node, + ObjectLiteralExpression, + Path, + Program, + PropertyAssignment, + ResolutionMode, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + Signature, + SignatureHelp, + SourceFile, + StringLiteralLike, + StringLiteralType, + Symbol, + SyntaxKind, + TextSpan, + Type, + TypeChecker, + TypeFlags, + UnionTypeNode, + UserPreferences, addToSeen, altDirectorySeparator, arrayFrom, - CallLikeExpression, - CancellationToken, changeExtension, - CharacterCodes, combinePaths, comparePaths, comparePatternKeys, compareStringsCaseSensitive, compareValues, - Comparison, - CompilerOptions, - CompletionEntry, - CompletionEntryDetails, - CompletionInfo, contains, containsPath, - ContextFlags, createSortedArray, createTextSpan, createTextSpanFromStringLiteralLikeContent, - Debug, deduplicate, directorySeparator, - ElementAccessExpression, emptyArray, endsWith, ensureTrailingDirectorySeparator, equateStringsCaseSensitive, - Extension, fileExtensionIsOneOf, filter, find, @@ -60,7 +90,6 @@ import { hasProperty, hasTrailingDirectorySeparator, hostGetCanonicalFileName, - IndexedAccessTypeNode, isApplicableVersionedTypesKey, isArray, isCallExpression, @@ -81,49 +110,25 @@ import { isStringLiteralLike, isTypeReferenceNode, isUrl, - JsxAttribute, - LanguageServiceHost, length, - LiteralExpression, - LiteralTypeNode, mapDefined, - MapLike, - ModuleKind, - ModuleResolutionKind, moduleSpecifiers, - Node, normalizePath, normalizeSlashes, - ObjectLiteralExpression, - Path, - Program, - PropertyAssignment, rangeContainsPosition, readJson, removeFileExtension, removePrefix, removeTrailingDirectorySeparator, - ResolutionMode, resolvePath, - ScriptElementKind, - ScriptElementKindModifier, - ScriptTarget, - Signature, signatureHasRestParameter, - SignatureHelp, singleElementArray, skipConstraint, skipParentheses, - SourceFile, startsWith, stringContains, - StringLiteralLike, - StringLiteralType, stripQuotes, - Symbol, - SyntaxKind, textPart, - TextSpan, tryAndIgnoreErrors, tryDirectoryExists, tryFileExists, @@ -133,23 +138,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 3c242e580766c..e7ee92edc2a05 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, @@ -43,21 +55,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 fff0b69e39eb0..ce6be17232d6e 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, @@ -60,52 +93,19 @@ import { isTaggedTemplateExpression, isThisInTypeQuery, isVarConst, - JSDocTagInfo, - JsxOpeningLikeElement, keywordPart, length, lineBreakPart, - ListFormat, mapToDisplayParts, - ModifierFlags, - ModuleDeclaration, - NewExpression, - Node, - NodeBuilderFlags, - ObjectFlags, operatorPart, - Printer, - PropertyAccessExpression, - PropertyDeclaration, punctuationPart, - ScriptElementKind, - ScriptElementKindModifier, - SemanticMeaning, - SetAccessorDeclaration, - Signature, - SignatureDeclaration, - SignatureFlags, signatureToDisplayParts, some, - SourceFile, spacePart, - Symbol, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolFlags, - SymbolFormatFlags, symbolToDisplayParts, - SyntaxKind, - TaggedTemplateExpression, textOrKeywordPart, textPart, - TransientSymbol, - Type, - TypeChecker, - TypeFormatFlags, - TypeParameter, typeToDisplayParts, - VariableDeclaration, } from "./_namespaces/ts"; const symbolDisplayNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope; diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 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 ee6c8a22ba4dd..93ae373681330 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -34,11 +34,11 @@ import { Symbol, SymlinkCache, TextChangeRange, - textChanges, TextRange, TextSpan, TypeReferenceDirectiveResolutionInfo, UserPreferences, + textChanges, } from "./_namespaces/ts"; declare module "../compiler/types" { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index a5e151ac7ab1a..c80e49a5a79c5 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1,66 +1,161 @@ 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, + TransientSymbol, + Type, + TypeChecker, + TypeFormatFlags, + TypeNode, + TypeOfExpression, + TypeQueryNode, + UserPreferences, + VariableDeclaration, + VoidExpression, + YieldExpression, + __String, + addEmitFlags, + addSyntheticLeadingComment, + addSyntheticTrailingComment, + assertType, + binarySearchKey, + canHaveModifiers, + cast, + clone, + codefix, + combinePaths, + compareTextSpans, + compareValues, + contains, + createPrinter, + createRange, + createScanner, + createTextSpan, + createTextSpanFromBounds, + defaultMaximumTruncationLength, + directoryProbablyExists, + emptyArray, + ensureScriptKind, + escapeString, + factory, filter, find, findAncestor, @@ -72,14 +167,8 @@ import { forEachChild, forEachLeadingCommentRange, forEachTrailingCommentRange, - FormatCodeSettings, formatStringFromArgs, formatting, - FormattingHost, - ForOfStatement, - FunctionDeclaration, - FunctionExpression, - FunctionLikeDeclaration, getAssignmentDeclarationKind, getCombinedNodeFlagsAlwaysIncludeJSDoc, getDirectoryPath, @@ -104,19 +193,10 @@ import { getTextOfNode, getTypesPackageName, hasSyntacticModifier, - HeritageClause, - Identifier, + idText, identifierIsThisKeyword, identity, - idText, - IfStatement, - ImportClause, - ImportDeclaration, - ImportSpecifier, - ImportTypeNode, indexOfNode, - IndexSignatureDeclaration, - InternalSymbolName, isAmbientModule, isAnyImportSyntax, isArray, @@ -133,7 +213,6 @@ import { isClassExpression, isClassStaticBlockDeclaration, isConditionalTypeNode, - IScriptSnapshot, isDeclaration, isDeclarationName, isDecorator, @@ -166,8 +245,8 @@ import { isImportEqualsDeclaration, isImportOrExportSpecifier, isImportSpecifier, - isInferTypeNode, isInJSFile, + isInferTypeNode, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, isJSDoc, @@ -238,119 +317,40 @@ import { isWhiteSpaceLike, isWhiteSpaceSingleLine, isYieldExpression, - IterationStatement, - JSDocLink, - JSDocLinkCode, - JSDocLinkDisplayPart, - JSDocLinkPlain, - JSDocTypedefTag, - JsTyping, - JsxEmit, - JsxOpeningLikeElement, - LabeledStatement, - LanguageServiceHost, last, lastOrUndefined, - LiteralExpression, map, maybeBind, - Modifier, - ModifierFlags, - ModuleDeclaration, - ModuleInstanceState, - ModuleResolutionKind, - ModuleSpecifierResolutionHost, moduleSpecifiers, - Mutable, - NewExpression, - NewLineKind, - Node, - NodeArray, - NodeBuilderFlags, - NodeFlags, nodeIsMissing, nodeIsPresent, nodeIsSynthesized, noop, normalizePath, - NoSubstitutionTemplateLiteral, notImplemented, nullTransformationContext, - NumericLiteral, or, - OrganizeImports, - PackageJsonDependencyGroup, pathIsRelative, - PrefixUnaryExpression, - Program, - ProjectPackageJsonInfo, - PropertyAccessExpression, - PropertyAssignment, - PropertyName, - QualifiedName, - RefactorContext, - Scanner, - ScriptElementKind, - ScriptElementKindModifier, - ScriptKind, - ScriptTarget, - SemicolonPreference, setConfigFileInOptions, setOriginalNode, setTextRange, - Signature, - SignatureDeclaration, singleOrUndefined, skipAlias, skipOuterExpressions, some, - SourceFile, - SourceFileLike, - SourceMapper, - SpreadElement, stableSort, startsWith, stringContains, - StringLiteral, - StringLiteralLike, stringToToken, stripQuotes, - Symbol, - SymbolAccessibility, - SymbolDisplayPart, - SymbolDisplayPartKind, - SymbolFlags, - SymbolFormatFlags, - SymbolTracker, - SyntaxKind, - SyntaxList, - TaggedTemplateExpression, - TemplateExpression, - TemplateLiteralToken, - TemplateSpan, - TextChange, textChanges, - TextRange, - TextSpan, textSpanContainsPosition, textSpanContainsTextSpan, textSpanEnd, - Token, tokenToString, - TransientSymbol, tryCast, - Type, - TypeChecker, - TypeFormatFlags, - TypeNode, - TypeOfExpression, - TypeQueryNode, unescapeLeadingUnderscores, - UserPreferences, - VariableDeclaration, visitEachChild, - VoidExpression, - YieldExpression, } from "./_namespaces/ts"; // These utilities are common to multiple language service features. diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index bad01ecd0bb01..7fd649070dec6 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 ece03273f89cf..b7baa33cfea42 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 7ff6ca57011a4..9643d642cc7ac 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 c349968c89cdf..705d6f70861aa 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -1,21 +1,21 @@ import * as ts from "../_namespaces/ts"; import { + NamedSourceText, + ProgramWithSourceTexts, + SourceText, + TestCompilerHost, checkResolvedModulesCache, checkResolvedTypeDirectivesCache, createResolvedModule, createTestCompilerHost, - NamedSourceText, newLine, newProgram, - ProgramWithSourceTexts, - SourceText, - TestCompilerHost, updateProgram, updateProgramText, } from "./helpers"; import { - 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 8188d9a2cfd22..332d69675dea9 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 9374c38dd5a2b..fc009e2cbc2a4 100644 --- a/src/testRunner/unittests/tsbuild/commandLine.ts +++ b/src/testRunner/unittests/tsbuild/commandLine.ts @@ -1,12 +1,12 @@ import * as ts from "../../_namespaces/ts"; import { + TestTscEdit, appendText, compilerOptionsToConfigJson, loadProjectFromFiles, noChangeRun, noChangeWithExportsDiscrepancyRun, replaceText, - TestTscEdit, verifyTscWithEdits, } from "../tsc/helpers"; diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 44c49398d5925..fa5710d334b47 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -2,6 +2,9 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; import { + TestTscEdit, + TscCompileSystem, + VerifyTscWithEditsInput, addRest, addShebang, addSpread, @@ -18,12 +21,9 @@ import { removeRest, replaceText, testTscCompileLike, - TestTscEdit, - TscCompileSystem, verifyTsc, verifyTscCompileLike, verifyTscWithEdits, - VerifyTscWithEditsInput, } from "../tsc/helpers"; describe("unittests:: tsbuild:: outFile::", () => { diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index 10ecd276fd171..ef4a563f542be 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, - verifyTscWithEdits, VerifyTscWithEditsInput, + loadProjectFromFiles, + noChangeRun, + verifyTscWithEdits, } 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 08d5456138032..336c1a0f36439 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, verifyTscWithEdits, diff --git a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts index 5275bba2e1149..7d66eaa425f25 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 cb87c76fbc693..0bcfdf92cf379 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 0c34385b46bea..310846c2651c4 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 d78e632d11125..076f56752f086 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 e7ec70725a692..6606990897a59 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 2858099f538e7..d42f37ee5541a 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 e084adbe72c49..df418d16e02ad 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 { applyChange, diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index b1739dcd8af0e..15ac493ec9910 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 302334dea4cd8..fc3cdda127755 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 type TscCompileSystem = fakes.System & { diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index d41f933947218..96ddac44558a2 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, @@ -12,7 +13,6 @@ import { noChangeWithExportsDiscrepancyRun, prependText, replaceText, - TestTscEdit, verifyTsc, verifyTscWithEdits, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index 79d42a00ce4b4..b1c86fcd57135 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 afd3f34b71c67..4f037949d8b1d 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 2262dda00cce5..197f5e2f2f6dd 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 7beecd9cdd2a0..67fa32f75c81a 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -1,10 +1,10 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - 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 914d889806911..a8051822d0c17 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 9823c67dbdb3a..49db873e21f8b 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, applyChange, createBaseline, - SystemSnap, verifyTscWatch, watchBaseline, } from "./helpers"; diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 4a198b652f5da..77b5384fe3f67 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - 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 dfed47e08142d..a0c7926045010 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 ff58abc4c85ce..db5e2408ca24e 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 7321dc807dc0a..dc3dea59d1943 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -1,9 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { + TestServerHost, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, - TestServerHost, } from "../virtualFileSystemWithWatch"; import { createSolutionBuilder, diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index e25a5eefacc59..f6aba5b8537f7 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 4aa07594feade..21a4dbecb5e8c 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 102bbd7746bfe..40de351fbd63b 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 { applyChange, diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index 32a271b5e71e6..abacbeb6cb4e3 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 01b947479a237..fa999ffdd46eb 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -1,19 +1,19 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, - libFile, SymLink, TestServerHost, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { + Logger, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, createLoggerWithInMemoryLogs, createProjectService, createSession, - Logger, makeSessionRequest, openFilesForSession, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/cancellationToken.ts b/src/testRunner/unittests/tsserver/cancellationToken.ts index c1fddf773323d..72be15301416e 100644 --- a/src/testRunner/unittests/tsserver/cancellationToken.ts +++ b/src/testRunner/unittests/tsserver/cancellationToken.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import { createServerHost } from "../virtualFileSystemWithWatch"; import { - createSession, TestServerCancellationToken, + createSession, } from "./helpers"; describe("unittests:: tsserver:: cancellationToken", () => { diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index 97aa6aa01f4de..a5d3948a4e8a3 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -1,10 +1,12 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { + TestSession, + TestTypingsInstaller, baselineTsserverLogs, checkNumberOfProjects, checkProjectRootFiles, @@ -13,8 +15,6 @@ import { makeSessionRequest, openFilesForSession, protocolTextSpanFromSubstring, - TestSession, - TestTypingsInstaller, toExternalFiles, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index cc4883f4dc915..6a6d5386159e6 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -1,16 +1,16 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { + TestTypingsInstaller, checkNumberOfProjects, checkProjectActualFiles, createSession, executeSessionRequest, openFilesForSession, - TestTypingsInstaller, } from "./helpers"; describe("unittests:: tsserver:: completions", () => { diff --git a/src/testRunner/unittests/tsserver/completionsIncomplete.ts b/src/testRunner/unittests/tsserver/completionsIncomplete.ts index 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 269eeaa96109a..2007276677059 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -1,14 +1,15 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { + DocumentSpanFromSubstring, + TestSession, checkNumberOfProjects, checkProjectActualFiles, closeFilesForSession, createSession, - DocumentSpanFromSubstring, executeSessionRequest, makeReferenceItem, openFilesForSession, @@ -18,7 +19,6 @@ import { protocolLocationFromSubstring, protocolRenameSpanFromSubstring, protocolTextSpanFromSubstring, - TestSession, textSpanFromSubstring, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/documentRegistry.ts b/src/testRunner/unittests/tsserver/documentRegistry.ts index 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 28b6c72606bb3..7af85c3f9d611 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 { createSession, diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index ec3f62c82c422..6551422911f83 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 93a5b517af8e6..7d75decb752ec 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 5d6919dc33662..c9e948efbeb5d 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 eb0182bea6396..c87e565b36347 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 { createSession, diff --git a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts index 917b50ce6ee10..8f2baf82484ad 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 { createProjectService, diff --git a/src/testRunner/unittests/tsserver/getExportReferences.ts b/src/testRunner/unittests/tsserver/getExportReferences.ts index 5d19e9075070d..8d9051824d582 100644 --- a/src/testRunner/unittests/tsserver/getExportReferences.ts +++ b/src/testRunner/unittests/tsserver/getExportReferences.ts @@ -1,13 +1,13 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, } from "../virtualFileSystemWithWatch"; import { + MakeReferenceItem, createSession, executeSessionRequest, makeReferenceItem, - MakeReferenceItem, openFilesForSession, protocolFileLocationFromSubstring, protocolLocationFromSubstring, diff --git a/src/testRunner/unittests/tsserver/getFileReferences.ts b/src/testRunner/unittests/tsserver/getFileReferences.ts index c6ade3fb6e2e5..40cd8a791fa3a 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 { createSession, diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 6fa7aa172e4b8..603fe35174d27 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -2,14 +2,14 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import * as Utils from "../../_namespaces/Utils"; import { - changeToHostTrackingWrittenFiles, - checkArray, - createServerHost, File, FileOrFolderOrSymLink, - libFile, TestServerHost, TestServerHostTrackingWrittenFiles, + changeToHostTrackingWrittenFiles, + checkArray, + 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 5da6c3123de78..b149c7bd6ffe8 100644 --- a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts +++ b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts @@ -1,17 +1,17 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, SymLink, TestServerHost, + createServerHost, } from "../virtualFileSystemWithWatch"; import { + Logger, baselineTsserverLogs, configuredProjectAt, createLoggerWithInMemoryLogs, createSession, executeSessionRequest, - Logger, openFilesForSession, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/navTo.ts b/src/testRunner/unittests/tsserver/navTo.ts index 6414d2441d5d9..951287c0df7e2 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 c7d6b12a684c4..7e6c9daeb36b9 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 { createSession, 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 6db0fb3509fa2..ae4c598b4b640 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 10613e0e76bc3..7cc11e9bb1123 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 4734b18c47337..4846ca154307d 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -13,12 +13,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 400c21cd0a5b3..650527ea95a91 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -1,18 +1,18 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, - libFile, TestServerHost, + createServerHost, + libFile, } from "../virtualFileSystemWithWatch"; import { + TestSession, baselineTsserverLogs, closeFilesForSession, createHostWithSolutionBuild, createLoggerWithInMemoryLogs, createSession, openFilesForSession, - TestSession, } from "./helpers"; describe("unittests:: tsserver:: with project references and tsbuild source map", () => { diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 6e6e3539d7da2..681c79331580a 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 { 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 86504b90255a7..b10d7c178afd6 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 { createSession, 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 72e8bfedf7130..05e2dade62e81 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 { createSession, diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index b9290fe96ad4a..7a53291ddf888 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.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, makeSessionRequest, openFilesForSession, - TestTypingsInstaller, toExternalFiles, verifyGetErrRequest, } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/smartSelection.ts b/src/testRunner/unittests/tsserver/smartSelection.ts index 99ed4ead47ebf..07210c6da3e80 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 e6e7a0e993874..121399ac4fc99 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 f93933499ce09..7bc56c7e5a291 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 f20963c531785..620f40130d715 100644 --- a/src/testRunner/unittests/tsserver/syntacticServer.ts +++ b/src/testRunner/unittests/tsserver/syntacticServer.ts @@ -1,10 +1,11 @@ import * as ts from "../../_namespaces/ts"; import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { + TestSession, baselineTsserverLogs, checkNumberOfProjects, checkProjectActualFiles, @@ -13,7 +14,6 @@ import { createSession, openFilesForSession, protocolFileLocationFromSubstring, - TestSession, } from "./helpers"; describe("unittests:: tsserver:: Semantic operations on Syntax server", () => { diff --git a/src/testRunner/unittests/tsserver/syntaxOperations.ts b/src/testRunner/unittests/tsserver/syntaxOperations.ts index 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 a0db3ccd3f500..abc1fb87c1d80 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, } from "../virtualFileSystemWithWatch"; import { createSession, 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 6c016e79cdb9c..231ebfe7b8002 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/tsserver/webServer.ts b/src/testRunner/unittests/tsserver/webServer.ts index 25de36c1ff4e6..9b4d8b77cd919 100644 --- a/src/testRunner/unittests/tsserver/webServer.ts +++ b/src/testRunner/unittests/tsserver/webServer.ts @@ -1,8 +1,8 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import { - createServerHost, File, + createServerHost, libFile, } from "../virtualFileSystemWithWatch"; import { diff --git a/src/testRunner/unittests/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 04d1c3745f397..7b09c8740fdc6 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, arrayFrom, arrayToMap, clear, @@ -9,25 +25,15 @@ import { createGetCanonicalFileName, createMultiMap, createSystemWatchFunctions, - Debug, directorySeparator, - FileSystemEntryKind, - FileWatcher, - FileWatcherCallback, - FileWatcherEventKind, filterMutate, forEach, - FormatDiagnosticsHost, - FsWatchCallback, - FsWatchWorkerWatcher, generateDjb2Hash, getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, getRelativePathToDirectoryOrUrl, hasProperty, - HostWatchDirectory, - HostWatchFile, identity, insertSorted, isArray, @@ -35,15 +41,9 @@ import { isString, mapDefined, matchFiles, - ModuleResolutionHost, - MultiMap, noop, patchWriteFileEnsuringDirectory, - Path, - PollingInterval, - RequireResult, server, - SortedArray, sys, toPath, } from "../_namespaces/ts"; diff --git a/src/tsserver/common.ts b/src/tsserver/common.ts index f62f1316de1f3..c272252d63fc3 100644 --- a/src/tsserver/common.ts +++ b/src/tsserver/common.ts @@ -1,6 +1,6 @@ import { - Logger, LogLevel, + Logger, ServerCancellationToken, StartSessionOptions, } from "./_namespaces/ts.server"; diff --git a/src/tsserver/nodeServer.ts b/src/tsserver/nodeServer.ts index bcf2e0128ddae..c80669e1136b3 100644 --- a/src/tsserver/nodeServer.ts +++ b/src/tsserver/nodeServer.ts @@ -7,75 +7,75 @@ import { Arguments, BaseLogger, BeginInstallTypes, - createInstallTypingsRequest, EndInstallTypes, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, EventTypesRegistry, - findArgument, - formatMessage, - getLogLevel, - hasArgument, - indent, + ITypingsInstaller, InitializationFailedResponse, InstallPackageOptionsWithProject, InstallPackageRequest, InvalidateCachedTypings, - ITypingsInstaller, - Logger, LogLevel, + Logger, ModuleImportResult, Msg, - nullCancellationToken, - nullTypingsInstaller, PackageInstalledResponse, Project, ProjectService, - protocol, ServerCancellationToken, ServerHost, Session, SetTypings, StartInput, StartSessionOptions, - stringifyIndented, - toEvent, TypesRegistryResponse, TypingInstallerRequestUnion, + createInstallTypingsRequest, + findArgument, + formatMessage, + getLogLevel, + hasArgument, + indent, + 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, 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 c95b6b420d150..3757134382448 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -1,11 +1,11 @@ import { + Msg, + StartInput, emptyArray, findArgument, hasArgument, initializeNodeSystem, initializeWebSystem, - Msg, - StartInput, } from "./_namespaces/ts.server"; import { Debug, diff --git a/src/tsserver/webServer.ts b/src/tsserver/webServer.ts index d3ad989f20001..bc9d36195ac8f 100644 --- a/src/tsserver/webServer.ts +++ b/src/tsserver/webServer.ts @@ -3,17 +3,17 @@ import * as ts from "./_namespaces/ts"; import * as server from "./_namespaces/ts.server"; import { - findArgument, - getLogLevel, Logger, MainProcessLogger, Msg, - nullCancellationToken, ServerCancellationToken, ServerHost, StartInput, StartSessionOptions, WebHost, + findArgument, + getLogLevel, + nullCancellationToken, } from "./_namespaces/ts.server"; import { Debug, diff --git a/src/typingsInstaller/nodeTypingsInstaller.ts b/src/typingsInstaller/nodeTypingsInstaller.ts index 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 81c6ec68a107f..d0e249d996068 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -1,39 +1,39 @@ import { + Comparison, + Extension, + FileWatcher, + GetCanonicalFileName, + JsTyping, + MapLike, + ModuleResolutionKind, + Path, + PollingInterval, + Version, + WatchDirectoryFlags, + WatchFactory, + WatchFactoryHost, + WatchLogLevel, + WatchOptions, clearMap, closeFileWatcher, combinePaths, compareStringsCaseInsensitive, - Comparison, containsPath, copyEntries, createGetCanonicalFileName, directorySeparator, - Extension, fileExtensionIs, - FileWatcher, getBaseFileName, - GetCanonicalFileName, getDirectoryPath, getProperty, getWatchFactory, hasProperty, - JsTyping, mangleScopedPackageName, mapDefined, - MapLike, - ModuleResolutionKind, noop, - Path, - PollingInterval, resolveModuleName, version, - Version, versionMajorMinor, - WatchDirectoryFlags, - WatchFactory, - WatchFactoryHost, - WatchLogLevel, - WatchOptions, } from "./_namespaces/ts"; import { ActionInvalidate, diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index f5cc041c7b601..ca3be411e44d7 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -2,22 +2,22 @@ /// import { - indent, - Logger, LogLevel, + Logger, ModuleImportResult, Msg, - nowString, - nullTypingsInstaller, - protocol, ServerCancellationToken, ServerHost, Session, SessionOptions, + indent, + nowString, + nullTypingsInstaller, + protocol, } from "./_namespaces/ts.server"; import { - combinePaths, Debug, + combinePaths, directorySeparator, ensureTrailingDirectorySeparator, getDirectoryPath, From 94746765ba26f95fc2c0d47ef47bda0ec23767da Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:13:38 -0800 Subject: [PATCH 6/6] Bring the gross reexports back for now --- src/compiler/_namespaces/ts.ts | 6 +- src/harness/_namespaces/Harness.ts | 6 +- src/harness/_namespaces/ts.ts | 3 +- src/jsTyping/_namespaces/ts.ts | 6 +- src/loggedIO/_namespaces/ts.ts | 3 +- src/server/_namespaces/ts.server.ts | 3 +- src/server/_namespaces/ts.ts | 3 +- src/services/_namespaces/ts.Completions.ts | 3 +- src/services/_namespaces/ts.classifier.ts | 3 +- src/services/_namespaces/ts.refactor.ts | 24 +++++--- src/services/_namespaces/ts.ts | 60 ++++++++++++------- .../_namespaces/Harness.Parallel.ts | 6 +- src/testRunner/_namespaces/Harness.ts | 3 +- src/testRunner/_namespaces/ts.ts | 3 +- src/tsserver/_namespaces/ts.ts | 3 +- src/tsserverlibrary/_namespaces/ts.ts | 3 +- src/typingsInstaller/_namespaces/ts.server.ts | 3 +- src/typingsInstaller/_namespaces/ts.ts | 3 +- .../_namespaces/ts.server.ts | 3 +- src/typingsInstallerCore/_namespaces/ts.ts | 3 +- src/webServer/_namespaces/ts.ts | 3 +- 21 files changed, 102 insertions(+), 51 deletions(-) diff --git a/src/compiler/_namespaces/ts.ts b/src/compiler/_namespaces/ts.ts index 118cb6141fe1a..b31b19cae7cb5 100644 --- a/src/compiler/_namespaces/ts.ts +++ b/src/compiler/_namespaces/ts.ts @@ -68,5 +68,7 @@ export * from "../watch"; export * from "../watchPublic"; export * from "../tsbuild"; export * from "../tsbuildPublic"; -export * as moduleSpecifiers from "./ts.moduleSpecifiers"; -export * as performance from "./ts.performance"; +import * as moduleSpecifiers from "./ts.moduleSpecifiers"; +export { moduleSpecifiers }; +import * as performance from "./ts.performance"; +export { performance }; diff --git a/src/harness/_namespaces/Harness.ts b/src/harness/_namespaces/Harness.ts index f9bbf3302f5b3..3ff4b006555c1 100644 --- a/src/harness/_namespaces/Harness.ts +++ b/src/harness/_namespaces/Harness.ts @@ -3,5 +3,7 @@ export * from "../runnerbase"; export * from "../harnessIO"; export * from "../typeWriter"; -export * as LanguageService from "./Harness.LanguageService"; -export * as SourceMapRecorder from "./Harness.SourceMapRecorder"; +import * as LanguageService from "./Harness.LanguageService"; +export { LanguageService }; +import * as SourceMapRecorder from "./Harness.SourceMapRecorder"; +export { SourceMapRecorder }; diff --git a/src/harness/_namespaces/ts.ts b/src/harness/_namespaces/ts.ts index 9f331c87ad1d9..3f6ecdc8eeea5 100644 --- a/src/harness/_namespaces/ts.ts +++ b/src/harness/_namespaces/ts.ts @@ -7,4 +7,5 @@ export * from "../../server/_namespaces/ts"; export * from "../../typingsInstallerCore/_namespaces/ts"; export * from "../../deprecatedCompat/_namespaces/ts"; export * from "../harnessGlobals"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/jsTyping/_namespaces/ts.ts b/src/jsTyping/_namespaces/ts.ts index e50c6a5ec9384..adf9791f4d2b5 100644 --- a/src/jsTyping/_namespaces/ts.ts +++ b/src/jsTyping/_namespaces/ts.ts @@ -1,5 +1,7 @@ /* Generated file to emulate the ts namespace. */ export * from "../../compiler/_namespaces/ts"; -export * as JsTyping from "./ts.JsTyping"; -export * as server from "./ts.server"; +import * as JsTyping from "./ts.JsTyping"; +export { JsTyping }; +import * as server from "./ts.server"; +export { server }; diff --git a/src/loggedIO/_namespaces/ts.ts b/src/loggedIO/_namespaces/ts.ts index 08280609fcbe2..2f90a4b4fb34f 100644 --- a/src/loggedIO/_namespaces/ts.ts +++ b/src/loggedIO/_namespaces/ts.ts @@ -6,4 +6,5 @@ export * from "../../jsTyping/_namespaces/ts"; export * from "../../server/_namespaces/ts"; export * from "../../typingsInstallerCore/_namespaces/ts"; export * from "../../harness/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/server/_namespaces/ts.server.ts b/src/server/_namespaces/ts.server.ts index d42abe69da74f..91d9a909ae7f8 100644 --- a/src/server/_namespaces/ts.server.ts +++ b/src/server/_namespaces/ts.server.ts @@ -4,7 +4,8 @@ export * from "../../jsTyping/_namespaces/ts.server"; export * from "../types"; export * from "../utilitiesPublic"; export * from "../utilities"; -export * as protocol from "./ts.server.protocol"; +import * as protocol from "./ts.server.protocol"; +export { protocol }; export * from "../scriptInfo"; export * from "../typingsCache"; export * from "../project"; diff --git a/src/server/_namespaces/ts.ts b/src/server/_namespaces/ts.ts index 3366e7c3a0c11..26e554e4cd973 100644 --- a/src/server/_namespaces/ts.ts +++ b/src/server/_namespaces/ts.ts @@ -5,4 +5,5 @@ export * from "../../jsTyping/_namespaces/ts"; export * from "../../services/_namespaces/ts"; // Pull this in here so that plugins loaded by the server see compat wrappers. export * from "../../deprecatedCompat/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/services/_namespaces/ts.Completions.ts b/src/services/_namespaces/ts.Completions.ts index 8f77ff9fb77c5..bd0d6a8522511 100644 --- a/src/services/_namespaces/ts.Completions.ts +++ b/src/services/_namespaces/ts.Completions.ts @@ -1,4 +1,5 @@ /* Generated file to emulate the ts.Completions namespace. */ export * from "../completions"; -export * as StringCompletions from "./ts.Completions.StringCompletions"; +import * as StringCompletions from "./ts.Completions.StringCompletions"; +export { StringCompletions }; diff --git a/src/services/_namespaces/ts.classifier.ts b/src/services/_namespaces/ts.classifier.ts index 5b1ccea67c4ce..34bc4e52196cc 100644 --- a/src/services/_namespaces/ts.classifier.ts +++ b/src/services/_namespaces/ts.classifier.ts @@ -1,3 +1,4 @@ /* Generated file to emulate the ts.classifier namespace. */ -export * as v2020 from "./ts.classifier.v2020"; +import * as v2020 from "./ts.classifier.v2020"; +export { v2020 }; diff --git a/src/services/_namespaces/ts.refactor.ts b/src/services/_namespaces/ts.refactor.ts index 9f87c5cd7c575..19159057c6da6 100644 --- a/src/services/_namespaces/ts.refactor.ts +++ b/src/services/_namespaces/ts.refactor.ts @@ -6,11 +6,19 @@ export * from "../refactors/convertImport"; export * from "../refactors/extractType"; export * from "../refactors/helpers"; export * from "../refactors/moveToNewFile"; -export * as addOrRemoveBracesToArrowFunction from "./ts.refactor.addOrRemoveBracesToArrowFunction"; -export * as convertArrowFunctionOrFunctionExpression from "./ts.refactor.convertArrowFunctionOrFunctionExpression"; -export * as convertParamsToDestructuredObject from "./ts.refactor.convertParamsToDestructuredObject"; -export * as convertStringOrTemplateLiteral from "./ts.refactor.convertStringOrTemplateLiteral"; -export * as convertToOptionalChainExpression from "./ts.refactor.convertToOptionalChainExpression"; -export * as extractSymbol from "./ts.refactor.extractSymbol"; -export * as generateGetAccessorAndSetAccessor from "./ts.refactor.generateGetAccessorAndSetAccessor"; -export * as inferFunctionReturnType from "./ts.refactor.inferFunctionReturnType"; +import * as addOrRemoveBracesToArrowFunction from "./ts.refactor.addOrRemoveBracesToArrowFunction"; +export { addOrRemoveBracesToArrowFunction }; +import * as convertArrowFunctionOrFunctionExpression from "./ts.refactor.convertArrowFunctionOrFunctionExpression"; +export { convertArrowFunctionOrFunctionExpression }; +import * as convertParamsToDestructuredObject from "./ts.refactor.convertParamsToDestructuredObject"; +export { convertParamsToDestructuredObject }; +import * as convertStringOrTemplateLiteral from "./ts.refactor.convertStringOrTemplateLiteral"; +export { convertStringOrTemplateLiteral }; +import * as convertToOptionalChainExpression from "./ts.refactor.convertToOptionalChainExpression"; +export { convertToOptionalChainExpression }; +import * as extractSymbol from "./ts.refactor.extractSymbol"; +export { extractSymbol }; +import * as generateGetAccessorAndSetAccessor from "./ts.refactor.generateGetAccessorAndSetAccessor"; +export { generateGetAccessorAndSetAccessor }; +import * as inferFunctionReturnType from "./ts.refactor.inferFunctionReturnType"; +export { inferFunctionReturnType }; diff --git a/src/services/_namespaces/ts.ts b/src/services/_namespaces/ts.ts index 8a7cf530e6ca6..eae114fd2e834 100644 --- a/src/services/_namespaces/ts.ts +++ b/src/services/_namespaces/ts.ts @@ -17,23 +17,43 @@ export * from "../transpile"; export * from "../services"; export * from "../transform"; export * from "../shims"; -export * as BreakpointResolver from "./ts.BreakpointResolver"; -export * as CallHierarchy from "./ts.CallHierarchy"; -export * as classifier from "./ts.classifier"; -export * as codefix from "./ts.codefix"; -export * as Completions from "./ts.Completions"; -export * as FindAllReferences from "./ts.FindAllReferences"; -export * as GoToDefinition from "./ts.GoToDefinition"; -export * as InlayHints from "./ts.InlayHints"; -export * as JsDoc from "./ts.JsDoc"; -export * as NavigateTo from "./ts.NavigateTo"; -export * as NavigationBar from "./ts.NavigationBar"; -export * as OrganizeImports from "./ts.OrganizeImports"; -export * as OutliningElementsCollector from "./ts.OutliningElementsCollector"; -export * as refactor from "./ts.refactor"; -export * as Rename from "./ts.Rename"; -export * as SignatureHelp from "./ts.SignatureHelp"; -export * as SmartSelectionRange from "./ts.SmartSelectionRange"; -export * as SymbolDisplay from "./ts.SymbolDisplay"; -export * as textChanges from "./ts.textChanges"; -export * as formatting from "./ts.formatting"; +import * as BreakpointResolver from "./ts.BreakpointResolver"; +export { BreakpointResolver }; +import * as CallHierarchy from "./ts.CallHierarchy"; +export { CallHierarchy }; +import * as classifier from "./ts.classifier"; +export { classifier }; +import * as codefix from "./ts.codefix"; +export { codefix }; +import * as Completions from "./ts.Completions"; +export { Completions }; +import * as FindAllReferences from "./ts.FindAllReferences"; +export { FindAllReferences }; +import * as GoToDefinition from "./ts.GoToDefinition"; +export { GoToDefinition }; +import * as InlayHints from "./ts.InlayHints"; +export { InlayHints }; +import * as JsDoc from "./ts.JsDoc"; +export { JsDoc }; +import * as NavigateTo from "./ts.NavigateTo"; +export { NavigateTo }; +import * as NavigationBar from "./ts.NavigationBar"; +export { NavigationBar }; +import * as OrganizeImports from "./ts.OrganizeImports"; +export { OrganizeImports }; +import * as OutliningElementsCollector from "./ts.OutliningElementsCollector"; +export { OutliningElementsCollector }; +import * as refactor from "./ts.refactor"; +export { refactor }; +import * as Rename from "./ts.Rename"; +export { Rename }; +import * as SignatureHelp from "./ts.SignatureHelp"; +export { SignatureHelp }; +import * as SmartSelectionRange from "./ts.SmartSelectionRange"; +export { SmartSelectionRange }; +import * as SymbolDisplay from "./ts.SymbolDisplay"; +export { SymbolDisplay }; +import * as textChanges from "./ts.textChanges"; +export { textChanges }; +import * as formatting from "./ts.formatting"; +export { formatting }; diff --git a/src/testRunner/_namespaces/Harness.Parallel.ts b/src/testRunner/_namespaces/Harness.Parallel.ts index 7e81a1f2d1eba..10087db7557c3 100644 --- a/src/testRunner/_namespaces/Harness.Parallel.ts +++ b/src/testRunner/_namespaces/Harness.Parallel.ts @@ -1,5 +1,7 @@ /* Generated file to emulate the Harness.Parallel namespace. */ export * from "../parallel/shared"; -export * as Host from "./Harness.Parallel.Host"; -export * as Worker from "./Harness.Parallel.Worker"; +import * as Host from "./Harness.Parallel.Host"; +export { Host }; +import * as Worker from "./Harness.Parallel.Worker"; +export { Worker }; diff --git a/src/testRunner/_namespaces/Harness.ts b/src/testRunner/_namespaces/Harness.ts index 0a94086613993..a9e4e0904b3fb 100644 --- a/src/testRunner/_namespaces/Harness.ts +++ b/src/testRunner/_namespaces/Harness.ts @@ -3,7 +3,8 @@ export * from "../../harness/_namespaces/Harness"; export * from "../../loggedIO/_namespaces/Harness"; -export * as Parallel from "./Harness.Parallel"; +import * as Parallel from "./Harness.Parallel"; +export { Parallel }; export * from "../fourslashRunner"; export * from "../compilerRunner"; diff --git a/src/testRunner/_namespaces/ts.ts b/src/testRunner/_namespaces/ts.ts index b065d14632362..14184486f6fca 100644 --- a/src/testRunner/_namespaces/ts.ts +++ b/src/testRunner/_namespaces/ts.ts @@ -10,4 +10,5 @@ export * from "../../typingsInstallerCore/_namespaces/ts"; export * from "../../deprecatedCompat/_namespaces/ts"; export * from "../../harness/_namespaces/ts"; export * from "../../loggedIO/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/tsserver/_namespaces/ts.ts b/src/tsserver/_namespaces/ts.ts index a47b18ec9f144..c37271569f120 100644 --- a/src/tsserver/_namespaces/ts.ts +++ b/src/tsserver/_namespaces/ts.ts @@ -5,4 +5,5 @@ export * from "../../services/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../server/_namespaces/ts"; export * from "../../webServer/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/tsserverlibrary/_namespaces/ts.ts b/src/tsserverlibrary/_namespaces/ts.ts index 1c8251155cecd..3060a64378787 100644 --- a/src/tsserverlibrary/_namespaces/ts.ts +++ b/src/tsserverlibrary/_namespaces/ts.ts @@ -4,4 +4,5 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../services/_namespaces/ts"; export * from "../../server/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/typingsInstaller/_namespaces/ts.server.ts b/src/typingsInstaller/_namespaces/ts.server.ts index 6e4a954290ac0..97838f9d9818c 100644 --- a/src/typingsInstaller/_namespaces/ts.server.ts +++ b/src/typingsInstaller/_namespaces/ts.server.ts @@ -2,4 +2,5 @@ export * from "../../jsTyping/_namespaces/ts.server"; export * from "../../typingsInstallerCore/_namespaces/ts.server"; -export * as typingsInstaller from "./ts.server.typingsInstaller"; +import * as typingsInstaller from "./ts.server.typingsInstaller"; +export { typingsInstaller }; diff --git a/src/typingsInstaller/_namespaces/ts.ts b/src/typingsInstaller/_namespaces/ts.ts index 9f4d487299447..efb16fe7a138d 100644 --- a/src/typingsInstaller/_namespaces/ts.ts +++ b/src/typingsInstaller/_namespaces/ts.ts @@ -3,4 +3,5 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../typingsInstallerCore/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/typingsInstallerCore/_namespaces/ts.server.ts b/src/typingsInstallerCore/_namespaces/ts.server.ts index 83f4ea0b19f18..252296d2335cf 100644 --- a/src/typingsInstallerCore/_namespaces/ts.server.ts +++ b/src/typingsInstallerCore/_namespaces/ts.server.ts @@ -1,4 +1,5 @@ /* Generated file to emulate the ts.server namespace. */ export * from "../../jsTyping/_namespaces/ts.server"; -export * as typingsInstaller from "./ts.server.typingsInstaller"; +import * as typingsInstaller from "./ts.server.typingsInstaller"; +export { typingsInstaller }; diff --git a/src/typingsInstallerCore/_namespaces/ts.ts b/src/typingsInstallerCore/_namespaces/ts.ts index f0c6c03e678e8..aa90e7daa8eae 100644 --- a/src/typingsInstallerCore/_namespaces/ts.ts +++ b/src/typingsInstallerCore/_namespaces/ts.ts @@ -2,4 +2,5 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server }; diff --git a/src/webServer/_namespaces/ts.ts b/src/webServer/_namespaces/ts.ts index 1c8251155cecd..3060a64378787 100644 --- a/src/webServer/_namespaces/ts.ts +++ b/src/webServer/_namespaces/ts.ts @@ -4,4 +4,5 @@ export * from "../../compiler/_namespaces/ts"; export * from "../../jsTyping/_namespaces/ts"; export * from "../../services/_namespaces/ts"; export * from "../../server/_namespaces/ts"; -export * as server from "./ts.server"; +import * as server from "./ts.server"; +export { server };