From 0192dc8bccdc2f9bedb8058d0e267f43d99dad63 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 26 May 2022 20:40:20 -0700 Subject: [PATCH] Remove a bunch of namespace uses --- src/compiler/binder.ts | 5 ++--- src/compiler/builder.ts | 6 ++--- src/compiler/checker.ts | 17 +++++++------- src/compiler/emitter.ts | 20 ++++++++--------- src/compiler/parser.ts | 22 +++++++++---------- src/compiler/program.ts | 6 ++--- src/compiler/resolutionCache.ts | 9 ++++---- src/compiler/sourcemap.ts | 2 +- src/compiler/sys.ts | 21 +++++++++--------- src/compiler/tracing.ts | 2 +- src/compiler/transformer.ts | 2 +- src/compiler/transformers/declarations.ts | 9 ++++---- .../transformers/declarations/diagnostics.ts | 5 ++--- src/compiler/tsbuildPublic.ts | 5 ++--- src/compiler/types.ts | 1 + src/compiler/utilities.ts | 9 ++------ src/compiler/watch.ts | 9 ++++---- src/compiler/watchPublic.ts | 5 ++--- src/compiler/watchUtilities.ts | 5 ++--- src/debug/dbg.ts | 8 ------- src/executeCommandLine/executeCommandLine.ts | 11 +++++----- src/harness/client.ts | 2 +- src/harness/compilerImpl.ts | 10 ++++----- src/harness/evaluatorImpl.ts | 6 ++--- src/harness/fakesHosts.ts | 8 +++---- src/harness/fourslashImpl.ts | 12 +++++----- src/harness/fourslashInterfaceImpl.ts | 4 ++-- src/harness/harnessIO.ts | 10 ++++----- src/harness/harnessLanguageService.ts | 10 ++++----- src/harness/sourceMapRecorder.ts | 2 +- src/harness/vfsUtil.ts | 6 ++--- src/harness/vpathUtil.ts | 2 +- src/jsTyping/types.ts | 2 +- src/server/editorServices.ts | 2 +- src/server/project.ts | 4 ++-- src/server/scriptInfo.ts | 2 +- src/server/scriptVersionCache.ts | 2 +- src/server/session.ts | 2 +- src/services/codeFixProvider.ts | 2 +- ...dConvertToUnknownForNonOverlappingTypes.ts | 2 +- .../codefixes/addEmptyExportDeclaration.ts | 4 ++-- src/services/codefixes/addMissingAsync.ts | 2 +- src/services/codefixes/addMissingConst.ts | 2 +- .../codefixes/addMissingDeclareProperty.ts | 2 +- .../addMissingInvocationForDecorator.ts | 2 +- .../codefixes/addNameToNamelessParameter.ts | 2 +- .../codefixes/addOptionalPropertyUndefined.ts | 2 +- .../codefixes/annotateWithTypeFromJSDoc.ts | 2 +- src/services/codefixes/convertConstToLet.ts | 2 +- .../codefixes/convertFunctionToEs6Class.ts | 2 +- .../convertLiteralTypeToMappedType.ts | 2 +- .../codefixes/convertToAsyncFunction.ts | 2 +- src/services/codefixes/convertToEsModule.ts | 2 +- .../codefixes/convertToMappedObjectType.ts | 2 +- .../codefixes/convertToTypeOnlyExport.ts | 2 +- .../codefixes/convertToTypeOnlyImport.ts | 2 +- ...correctQualifiedNameToIndexedAccessType.ts | 2 +- .../codefixes/disableJsDiagnostics.ts | 2 +- src/services/codefixes/fixAddMissingMember.ts | 2 +- .../codefixes/fixAddMissingNewOperator.ts | 2 +- .../fixAddModuleReferTypeMissingTypeof.ts | 2 +- src/services/codefixes/fixAddVoidToPromise.ts | 4 ++-- .../codefixes/fixAwaitInSyncFunction.ts | 2 +- src/services/codefixes/fixCannotFindModule.ts | 2 +- ...sDoesntImplementInheritedAbstractMember.ts | 2 +- .../fixClassIncorrectlyImplementsInterface.ts | 2 +- .../fixClassSuperMustPrecedeThisAccess.ts | 2 +- .../fixConstructorForDerivedNeedSuperCall.ts | 2 +- .../fixEnableExperimentalDecorators.ts | 2 +- src/services/codefixes/fixEnableJsxFlag.ts | 2 +- src/services/codefixes/fixExpectedComma.ts | 2 +- .../fixExtendsInterfaceBecomesImplements.ts | 2 +- .../fixForgottenThisPropertyAccess.ts | 2 +- .../codefixes/fixIncorrectNamedTupleSyntax.ts | 2 +- .../codefixes/fixInvalidImportSyntax.ts | 2 +- .../codefixes/fixInvalidJsxCharacters.ts | 2 +- src/services/codefixes/fixJSDocTypes.ts | 2 +- .../codefixes/fixMissingCallParentheses.ts | 2 +- .../codefixes/fixModuleAndTargetOptions.ts | 2 +- .../fixNoPropertyAccessFromIndexSignature.ts | 2 +- src/services/codefixes/fixOverrideModifier.ts | 2 +- .../codefixes/fixPropertyAssignment.ts | 2 +- .../codefixes/fixReturnTypeInAsyncFunction.ts | 2 +- src/services/codefixes/fixSpelling.ts | 2 +- .../codefixes/fixStrictClassInitialization.ts | 2 +- .../codefixes/fixUnmatchedParameter.ts | 2 +- src/services/codefixes/fixUnreachableCode.ts | 2 +- .../fixUnreferenceableDecoratorMetadata.ts | 2 +- src/services/codefixes/fixUnusedLabel.ts | 2 +- src/services/codefixes/generateAccessors.ts | 2 +- src/services/codefixes/helpers.ts | 2 +- .../removeAccidentalCallParentheses.ts | 2 +- .../codefixes/removeUnnecessaryAwait.ts | 2 +- src/services/codefixes/requireInTs.ts | 2 +- src/services/codefixes/returnValueCorrect.ts | 2 +- src/services/codefixes/splitTypeOnlyImport.ts | 2 +- src/services/codefixes/useBigintLiteral.ts | 2 +- src/services/codefixes/useDefaultImport.ts | 2 +- src/services/codefixes/wrapJsxInFragment.ts | 2 +- src/services/completions.ts | 10 ++++----- src/services/documentRegistry.ts | 5 ++--- src/services/getEditsForFileRename.ts | 2 +- .../addOrRemoveBracesToArrowFunction.ts | 2 +- .../convertOverloadListToSingleSignature.ts | 2 +- .../convertStringOrTemplateLiteral.ts | 2 +- .../convertToOptionalChainExpression.ts | 2 +- src/services/refactors/extractSymbol.ts | 2 +- src/services/refactors/extractType.ts | 2 +- .../refactors/inferFunctionReturnType.ts | 2 +- src/services/services.ts | 6 ++--- src/services/shims.ts | 2 +- src/services/stringCompletions.ts | 2 +- src/services/types.ts | 2 +- src/services/utilities.ts | 5 +++-- src/testRunner/_namespaces/FourSlash.ts | 1 - src/testRunner/_namespaces/Playback.ts | 1 - src/testRunner/_namespaces/Utils.ts | 1 - src/testRunner/_namespaces/compiler.ts | 1 - src/testRunner/_namespaces/documents.ts | 1 - src/testRunner/_namespaces/evaluator.ts | 1 - src/testRunner/_namespaces/fakes.ts | 1 - src/testRunner/_namespaces/vfs.ts | 1 - src/testRunner/_namespaces/vpath.ts | 1 - src/testRunner/compilerRef.ts | 2 -- src/testRunner/compilerRunner.ts | 2 +- src/testRunner/documentsRef.ts | 2 -- src/testRunner/evaluatorRef.ts | 2 -- src/testRunner/fakesRef.ts | 2 -- src/testRunner/fourslashRef.ts | 2 -- src/testRunner/fourslashRunner.ts | 2 +- src/testRunner/playbackRef.ts | 2 -- src/testRunner/projectsRunner.ts | 8 +++---- src/testRunner/runner.ts | 6 ++--- src/testRunner/rwcRunner.ts | 2 +- src/testRunner/tsconfig.json | 10 --------- .../config/configurationExtension.ts | 4 ++-- .../config/convertCompilerOptionsFromJson.ts | 4 ++-- .../config/convertTypeAcquisitionFromJson.ts | 4 ++-- src/testRunner/unittests/config/matchFiles.ts | 4 ++-- .../unittests/config/projectReferences.ts | 4 ++-- .../unittests/config/tsconfigParsing.ts | 4 ++-- .../config/tsconfigParsingWatchOptions.ts | 4 ++-- src/testRunner/unittests/printer.ts | 4 ++-- src/testRunner/unittests/programApi.ts | 6 ++--- src/testRunner/unittests/publicApi.ts | 6 ++--- .../unittests/reuseProgramStructure.ts | 2 +- .../services/convertToAsyncFunction.ts | 2 +- .../unittests/services/extract/helpers.ts | 2 +- .../unittests/services/organizeImports.ts | 2 +- .../unittests/services/textChanges.ts | 4 +++- src/testRunner/unittests/transform.ts | 6 ++--- .../unittests/tsbuild/amdModulesWithOut.ts | 2 +- .../unittests/tsbuild/declarationEmit.ts | 2 +- src/testRunner/unittests/tsbuild/demo.ts | 2 +- .../unittests/tsbuild/emitDeclarationOnly.ts | 2 +- .../unittests/tsbuild/emptyFiles.ts | 2 +- .../unittests/tsbuild/graphOrdering.ts | 4 ++-- src/testRunner/unittests/tsbuild/helpers.ts | 6 ++--- .../inferredTypeFromTransitiveModule.ts | 2 +- .../unittests/tsbuild/noEmitOnError.ts | 2 +- src/testRunner/unittests/tsbuild/outFile.ts | 4 ++-- .../unittests/tsbuild/outputPaths.ts | 2 +- src/testRunner/unittests/tsbuild/publicApi.ts | 8 +++---- .../tsbuild/referencesWithRootDirInParent.ts | 2 +- .../unittests/tsbuild/resolveJsonModule.ts | 2 +- src/testRunner/unittests/tsbuild/sample.ts | 4 ++-- .../unittests/tsbuild/transitiveReferences.ts | 2 +- src/testRunner/unittests/tsc/helpers.ts | 9 ++++---- src/testRunner/unittests/tsc/incremental.ts | 2 +- src/testRunner/unittests/tscWatch/helpers.ts | 8 +++---- .../unittests/tsserver/cancellationToken.ts | 2 +- .../unittests/tsserver/compileOnSave.ts | 2 +- src/testRunner/unittests/tsserver/helpers.ts | 2 +- .../unittests/tsserver/inferredProjects.ts | 2 +- .../unittests/tsserver/projectErrors.ts | 2 +- src/testRunner/unittests/tsserver/projects.ts | 2 +- .../unittests/tsserver/refactors.ts | 2 +- src/testRunner/unittests/tsserver/reload.ts | 2 +- .../unittests/tsserver/resolutionCache.ts | 2 +- src/testRunner/unittests/tsserver/session.ts | 2 +- .../unittests/tsserver/syntacticServer.ts | 2 +- .../unittests/tsserver/telemetry.ts | 2 +- .../unittests/tsserver/typingsInstaller.ts | 6 ++--- src/testRunner/utilsRef.ts | 2 -- src/testRunner/vfsRef.ts | 2 -- src/testRunner/vpathRef.ts | 2 -- src/tsserver/nodeServer.ts | 4 ++-- src/tsserver/webServer.ts | 2 +- src/typingsInstallerCore/typingsInstaller.ts | 2 +- src/webServer/webServer.ts | 2 +- 190 files changed, 306 insertions(+), 359 deletions(-) delete mode 100644 src/testRunner/compilerRef.ts delete mode 100644 src/testRunner/documentsRef.ts delete mode 100644 src/testRunner/evaluatorRef.ts delete mode 100644 src/testRunner/fakesRef.ts delete mode 100644 src/testRunner/fourslashRef.ts delete mode 100644 src/testRunner/playbackRef.ts delete mode 100644 src/testRunner/utilsRef.ts delete mode 100644 src/testRunner/vfsRef.ts delete mode 100644 src/testRunner/vpathRef.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 566c09e6417ed..797b82073ad7b 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,5 +1,3 @@ -import * as ts from "./_namespaces/ts"; -import { performance } from "./_namespaces/ts"; import { getNodeId } from "./checker"; import { append, appendIfUnique, cast, concatenate, contains, every, forEach, getRangesWhere, isString, length, Pattern, @@ -19,6 +17,7 @@ import { import { createBinaryExpressionTrampoline } from "./factory/utilities"; import { forEachChild, isExternalModule } from "./parser"; import { perfLogger } from "./perfLogger"; +import * as performance from "./performance"; import { tokenToString } from "./scanner"; import { tracing, TracingNode } from "./tracing"; import { @@ -471,7 +470,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { case SyntaxKind.Parameter: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType, "Impossible parameter parent kind", () => `parent is: ${(ts as any).SyntaxKind ? (ts as any).SyntaxKind[node.parent.kind] : node.parent.kind}, expected JSDocFunctionType`); + Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType, "Impossible parameter parent kind", () => `parent is: ${Debug.formatSyntaxKind(node.parent.kind)}, expected JSDocFunctionType`); const functionType = node.parent as JSDocFunctionType; const index = functionType.parameters.indexOf(node as ParameterDeclaration); return "arg" + index as __String; diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index ff784ad15c61f..ed43ea1ce3c7c 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { AffectedFileResult, BuilderProgram, BuilderProgramHost, EmitAndSemanticDiagnosticsBuilderProgram, SemanticDiagnosticsBuilderProgram, @@ -16,6 +15,7 @@ import { getTsBuildInfoEmitOutputFilePath } from "./emitter"; import { isDeclarationFileName } from "./parser"; import { ensurePathIsNonModuleName, getDirectoryPath, getNormalizedAbsolutePath, getRelativePathFromDirectory, + toPath as toPathInternal, } from "./path"; import { createProgram, emitSkippedWithNoDiagnostics, filterSemanticDiagnostics, handleNoEmitOptions } from "./program"; import { generateDjb2Hash } from "./sys"; @@ -328,7 +328,7 @@ function convertToDiagnostics(diagnostics: readonly ReusableDiagnostic[], newPro }); function toPath(path: string) { - return ts.toPath(path, buildInfoDirectory, getCanonicalFileName); + return toPathInternal(path, buildInfoDirectory, getCanonicalFileName); } } @@ -1456,7 +1456,7 @@ export function createBuildProgramUsingProgramBuildInfo(program: ProgramBuildInf }; function toPath(path: string) { - return ts.toPath(path, buildInfoDirectory, getCanonicalFileName); + return toPathInternal(path, buildInfoDirectory, getCanonicalFileName); } function toAbsolutePath(path: string) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3e74b1f36cc5a..f15ba7088e347 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,5 +1,3 @@ -import * as ts from "./_namespaces/ts"; -import { moduleSpecifiers, performance } from "./_namespaces/ts"; import { bindSourceFile, getModuleInstanceState, ModuleInstanceState } from "./binder"; import { addRange, and, append, appendIfUnique, arrayFrom, arrayOf, arraysEqual, arrayToMultiMap, binarySearch, @@ -49,6 +47,7 @@ import { } from "./factory/utilities"; import { setTextRange } from "./factory/utilitiesPublic"; import { getTypesPackageName, mangleScopedPackageName } from "./moduleNameResolver"; +import * as moduleSpecifiers from "./moduleSpecifiers"; import { forEachChild, forEachChildRecursively, isExternalModule, parseIsolatedEntityName, parseNodeFactory, } from "./parser"; @@ -56,6 +55,7 @@ import { comparePaths, fileExtensionIs, fileExtensionIsOneOf, getDirectoryPath, getNormalizedAbsolutePath, hasExtension, pathIsRelative, } from "./path"; +import * as performance from "./performance"; import { getModeForUsageLocation, getResolutionDiagnostic, getResolutionModeOverrideForClause, isExclusivelyTypeOnlyImportOrExport, resolveTripleslashReference, @@ -211,8 +211,8 @@ import { getEffectiveConstraintOfTypeParameter, getEffectiveTypeParameterDeclarations, getJSDocClassTag, getJSDocDeprecatedTag, getJSDocEnumTag, getJSDocParameterTags, getJSDocTags, getJSDocThisTag, getJSDocType, getJSDocTypeTag, getNameOfDeclaration, getOriginalNode, getParseTreeNode, getTextOfJSDocComment, hasInitializer, - hasJSDocNodes, hasJSDocParameterTags, hasOnlyExpressionInitializer, hasRestParameter, hasScopeMarker, idText, - isAccessor, isAssertionExpression, isAssignmentPattern, isBindingPattern, isCallChain, isCallLikeExpression, + hasJSDocNodes, hasJSDocParameterTags, hasOnlyExpressionInitializer, hasRestParameter, hasScopeMarker, hasType, + idText, isAccessor, isAssertionExpression, isAssignmentPattern, isBindingPattern, isCallChain, isCallLikeExpression, isCallOrNewExpression, isClassElement, isClassLike, isConstTypeReference, isDeclaration, isEntityName, isExpression, isExpressionOfOptionalChainRoot, isExternalModuleIndicator, isExternalModuleNameRelative, isForInOrOfStatement, isFunctionLike, isFunctionLikeDeclaration, isFunctionLikeOrClassStaticBlockDeclaration, isFunctionOrModuleBlock, @@ -965,6 +965,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { isPropertyAccessible, getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus, + typeHasCallOrConstructSignatures, }; function runWithInferenceBlockedFromSourceNode(node: Node | undefined, fn: () => T): T { @@ -8816,7 +8817,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function findResolutionCycleStartIndex(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): number { for (let i = resolutionTargets.length - 1; i >= 0; i--) { - if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) { + if (resolutionTargetHasType(resolutionTargets[i], resolutionPropertyNames[i])) { return -1; } if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) { @@ -8826,7 +8827,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return -1; } - function hasType(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean { + function resolutionTargetHasType(target: TypeSystemEntity, propertyName: TypeSystemPropertyName): boolean { switch (propertyName) { case TypeSystemPropertyName.Type: return !!getSymbolLinks(target as Symbol).type; @@ -17750,7 +17751,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return false; } // Or functions with annotated parameter types - if (some(node.parameters, ts.hasType)) { + if (some(node.parameters, hasType)) { return false; } const sourceSig = getSingleCallSignature(source); @@ -42642,7 +42643,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function typeHasCallOrConstructSignatures(type: Type): boolean { - return ts.typeHasCallOrConstructSignatures(type, checker); + return getSignaturesOfType(type, SignatureKind.Call).length !== 0 || getSignaturesOfType(type, SignatureKind.Construct).length !== 0; } function getRootSymbols(symbol: Symbol): readonly Symbol[] { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 82754ac7f6f15..42ae569e53509 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1,5 +1,3 @@ -import * as ts from "./_namespaces/ts"; -import { performance } from "./_namespaces/ts"; import { OutputFile } from "./builderStatePublic"; import { getNodeId } from "./checker"; import { @@ -7,7 +5,7 @@ import { forEach, GetCanonicalFileName, isArray, last, lastOrUndefined, length, memoize, notImplemented, returnFalse, returnUndefined, singleOrUndefined, some, stableSort, stringContains, } from "./core"; -import { Comparison, Map, Set } from "./corePublic"; +import { Comparison, Map, Set, version } from "./corePublic"; import { Debug } from "./debug"; import { compareEmitHelpers } from "./factory/emitHelpers"; import { @@ -32,6 +30,7 @@ import { getRelativePathFromDirectory, getRelativePathToDirectoryOrUrl, getRootLength, normalizePath, normalizeSlashes, resolvePath, } from "./path"; +import * as performance from "./performance"; import { computeCommonSourceDirectoryOfFilenames, createPrependNodes } from "./program"; import { computeLineStarts, forEachLeadingCommentRange, forEachTrailingCommentRange, getLeadingCommentRanges, @@ -93,12 +92,12 @@ import { getLinesBetweenRangeEndAndRangeStart, getLiteralText, GetLiteralTextFlags, getNewLineCharacter, getOwnEmitOutputFilePath, getSourceFileOfNode, getSourceFilePathInNewDir, getSourceFilesToEmit, getSourceTextOfNodeFromSourceFile, getTrailingSemicolonDeferringWriter, isAccessExpression, isBundleFileTextLike, - isIncrementalCompilation, isInJsonFile, isJsonSourceFile, isKeyword, isLet, isNodeDescendantOf, isPinnedComment, - isPrologueDirective, isRecognizedTripleSlashComment, isSourceFileNotJson, isVarConst, makeIdentifierFromModuleName, - nodeIsSynthesized, outFile, positionIsSynthesized, positionsAreOnSameLine, rangeEndIsOnSameLineAsRangeStart, - rangeEndPositionsAreOnSameLine, rangeIsOnSingleLine, rangeStartPositionsAreOnSameLine, removeFileExtension, - setEachParent, setParent, setTextRangePosEnd, setTextRangePosWidth, supportedJSExtensionsFlat, writeCommentRange, - writeFile, + isFileLevelUniqueName as isFileLevelUniqueNameInternal, isIncrementalCompilation, isInJsonFile, isJsonSourceFile, + isKeyword, isLet, isNodeDescendantOf, isPinnedComment, isPrologueDirective, isRecognizedTripleSlashComment, + isSourceFileNotJson, isVarConst, makeIdentifierFromModuleName, nodeIsSynthesized, outFile, positionIsSynthesized, + positionsAreOnSameLine, rangeEndIsOnSameLineAsRangeStart, rangeEndPositionsAreOnSameLine, rangeIsOnSingleLine, + rangeStartPositionsAreOnSameLine, removeFileExtension, setEachParent, setParent, setTextRangePosEnd, + setTextRangePosWidth, supportedJSExtensionsFlat, writeCommentRange, writeFile, } from "./utilities"; import { escapeLeadingUnderscores, getOriginalNode, getParseTreeNode, getTextOfJSDocComment, guessIndentation, idText, @@ -472,7 +471,6 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi emitSkipped = true; return; } - const version = ts.version; // Extracted into a const so the form is stable between namespace and module writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle, program, version }), /*writeByteOrderMark*/ false); } @@ -5210,7 +5208,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri * Returns a value indicating whether a name is unique globally or within the current file. */ function isFileLevelUniqueName(name: string) { - return currentSourceFile ? ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true; + return currentSourceFile ? isFileLevelUniqueNameInternal(currentSourceFile, name, hasGlobalName) : true; } /** diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 821bf35a7fc99..87a2d9269ac3b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,5 +1,3 @@ -import * as ts from "./_namespaces/ts"; -import { performance } from "./_namespaces/ts"; import { convertToObjectWorker } from "./commandLineParser"; import { addRange, append, AssertionLevel, concatenate, emptyArray, emptyMap, findIndex, forEach, getSpellingSuggestion, @@ -12,13 +10,15 @@ import { BaseNodeFactory } from "./factory/baseNodeFactory"; import { createNodeFactory, NodeFactoryFlags } from "./factory/nodeFactory"; import { isAsyncModifier, isExportAssignment, isExportDeclaration, isExportModifier, isExternalModuleReference, - isFunctionTypeNode, isImportDeclaration, isImportEqualsDeclaration, isJSDocFunctionType, isJSDocNullableType, - isJSDocReturnTag, isJSDocTypeTag, isJsxOpeningElement, isJsxOpeningFragment, isMetaProperty, isNonNullExpression, - isPrivateIdentifier, isTaggedTemplateExpression, isTypeReferenceNode, + isFunctionTypeNode, isIdentifier as isIdentifierNode, isImportDeclaration, isImportEqualsDeclaration, + isJSDocFunctionType, isJSDocNullableType, isJSDocReturnTag, isJSDocTypeTag, isJsxOpeningElement, + isJsxOpeningFragment, isMetaProperty, isNonNullExpression, isPrivateIdentifier, isTaggedTemplateExpression, + isTypeReferenceNode, } from "./factory/nodeTests"; import { setTextRange } from "./factory/utilitiesPublic"; import { fileExtensionIsOneOf, normalizePath } from "./path"; import { perfLogger } from "./perfLogger"; +import * as performance from "./performance"; import { createScanner, getLeadingCommentRanges, isIdentifierText, skipTrivia, textToKeywordObj, tokenIsIdentifierOrKeyword, tokenIsIdentifierOrKeywordOrGreaterThan, tokenToString, @@ -1757,7 +1757,7 @@ namespace Parser { } // Otherwise, if this isn't a well-known keyword-like identifier, give the generic fallback message. - const expressionText = ts.isIdentifier(node) ? idText(node) : undefined; + const expressionText = isIdentifierNode(node) ? idText(node) : undefined; if (!expressionText || !isIdentifierText(expressionText, languageVersion)) { parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.SemicolonToken)); return; @@ -6335,7 +6335,7 @@ namespace Parser { let node: ExpressionStatement | LabeledStatement; const hasParen = token() === SyntaxKind.OpenParenToken; const expression = allowInAnd(parseExpression); - if (ts.isIdentifier(expression) && parseOptional(SyntaxKind.ColonToken)) { + if (isIdentifierNode(expression) && parseOptional(SyntaxKind.ColonToken)) { node = factory.createLabeledStatement(expression, parseStatement()); } else { @@ -8393,7 +8393,7 @@ namespace Parser { case SyntaxKind.ArrayType: return isObjectOrObjectArrayTypeReference((node as ArrayTypeNode).elementType); default: - return isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; + return isTypeReferenceNode(node) && isIdentifierNode(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; } } @@ -8664,8 +8664,8 @@ namespace Parser { } function escapedTextsEqual(a: EntityName, b: EntityName): boolean { - while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) { - if (!ts.isIdentifier(a) && !ts.isIdentifier(b) && a.right.escapedText === b.right.escapedText) { + while (!isIdentifierNode(a) || !isIdentifierNode(b)) { + if (!isIdentifierNode(a) && !isIdentifierNode(b) && a.right.escapedText === b.right.escapedText) { a = a.left; b = b.left; } @@ -8690,7 +8690,7 @@ namespace Parser { const child = tryParseChildTag(target, indent); if (child && (child.kind === SyntaxKind.JSDocParameterTag || child.kind === SyntaxKind.JSDocPropertyTag) && target !== PropertyLikeParse.CallbackParameter && - name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { + name && (isIdentifierNode(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } return child; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 120b8e6d96d17..e6322ebe82295 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,5 +1,4 @@ import * as ts from "./_namespaces/ts"; -import { performance } from "./_namespaces/ts"; import { BuilderProgram } from "./builderPublic"; import { createTypeChecker } from "./checker"; import { @@ -42,8 +41,9 @@ import { ensureTrailingDirectorySeparator, fileExtensionIs, fileExtensionIsOneOf, forEachAncestorDirectory, getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot, getNormalizedPathComponents, getPathFromPathComponents, getRootLength, hasExtension, isRootedDiskPath, normalizePath, pathIsAbsolute, - pathIsRelative, + pathIsRelative, toPath as toPathInternal, } from "./path"; +import * as performance from "./performance"; import { computeLineAndCharacterOfPosition, getLineAndCharacterOfPosition, getLineStarts, getPositionOfLineAndCharacter, isIdentifierText, skipTrivia, tokenToString, @@ -1570,7 +1570,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } function toPath(fileName: string): Path { - return ts.toPath(fileName, currentDirectory, getCanonicalFileName); + return toPathInternal(fileName, currentDirectory, getCanonicalFileName); } function getCommonSourceDirectory() { diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 5b79bdcbb1de9..6f444844f176f 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { arrayToMap, contains, createMultiMap, emptyIterator, endsWith, firstDefinedIterator, GetCanonicalFileName, isString, length, memoize, removeSuffix, returnTrue, some, startsWith, stringContains, unorderedRemoveItem, @@ -9,7 +8,9 @@ import { Diagnostics } from "./diagnosticInformationMap.generated"; import { CacheWithRedirects, createCacheWithRedirects, createModeAwareCache, createModuleResolutionCache, createTypeReferenceDirectiveResolutionCache, getEffectiveTypeRoots, isTraceEnabled, loadModuleFromGlobalCache, - ModeAwareCache, ModuleResolutionCache, parseNodeModuleFromPath, pathContainsNodeModules, PerModuleNameCache, trace, + ModeAwareCache, ModuleResolutionCache, parseNodeModuleFromPath, pathContainsNodeModules, PerModuleNameCache, + resolveModuleName as internalResolveModuleName, + resolveTypeReferenceDirective as internalResolveTypeReferenceDirective, trace, } from "./moduleNameResolver"; import { directorySeparator, fileExtensionIs, fileExtensionIsOneOf, getDirectoryPath, getNormalizedAbsolutePath, @@ -349,7 +350,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD } function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference, _containingSourceFile?: never, mode?: ModuleKind.CommonJS | ModuleKind.ESNext | undefined): CachedResolvedModuleWithFailedLookupLocations { - const primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode); + const primaryResult = internalResolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode); // return result immediately only if global cache support is not enabled or if it is .ts, .tsx or .d.ts if (!resolutionHost.getGlobalCache) { return primaryResult; @@ -381,7 +382,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD } function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference, _containingSourceFile?: SourceFile, resolutionMode?: SourceFile["impliedNodeFormat"] | undefined): CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations { - return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); + return internalResolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); } interface ResolveNamesWithLocalCacheInput { diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index de32e59d8109c..a49f17324f130 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -1,4 +1,3 @@ -import { performance } from "./_namespaces/ts"; import { arrayFrom, binarySearchKey, compareValues, emptyArray, every, identity, isArray, isString, some, sortAndDeduplicate, trimStringEnd, @@ -6,6 +5,7 @@ import { import { ESMap, Iterator, Map, SortedReadonlyArray } from "./corePublic"; import { Debug } from "./debug"; import { combinePaths, getDirectoryPath, getNormalizedAbsolutePath, getRelativePathToDirectoryOrUrl } from "./path"; +import * as performance from "./performance"; import { getPositionOfLineAndCharacter } from "./scanner"; import { CharacterCodes, DocumentPosition, DocumentPositionMapper, DocumentPositionMapperHost, EmitHost, LineAndCharacter, diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index a8628245acde8..aaf8bca43d208 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { matchesExclude } from "./commandLineParser"; import { AssertionLevel, contains, createGetCanonicalFileName, createMultiMap, emptyArray, enumerateInsertsAndDeletes, @@ -215,26 +214,26 @@ export function createDynamicPriorityPollingWatchFile(host: { getModifiedTime: NonNullable; setTimeout: NonNullable; }): HostWatchFile { - interface WatchedFile extends ts.WatchedFile { + interface DynamicWatchedFile extends WatchedFile { isClosed?: boolean; unchangedPolls: number; } - interface PollingIntervalQueue extends Array { + interface PollingIntervalQueue extends Array { pollingInterval: PollingInterval; pollIndex: number; pollScheduled: boolean; } - const watchedFiles: WatchedFile[] = []; - const changedFilesInLastPoll: WatchedFile[] = []; + const watchedFiles: DynamicWatchedFile[] = []; + const changedFilesInLastPoll: DynamicWatchedFile[] = []; const lowPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Low); const mediumPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.Medium); const highPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.High); return watchFile; function watchFile(fileName: string, callback: FileWatcherCallback, defaultPollingInterval: PollingInterval): FileWatcher { - const file: WatchedFile = { + const file: DynamicWatchedFile = { fileName, callback, unchangedPolls: 0, @@ -254,7 +253,7 @@ export function createDynamicPriorityPollingWatchFile(host: { } function createPollingIntervalQueue(pollingInterval: PollingInterval): PollingIntervalQueue { - const queue = [] as WatchedFile[] as PollingIntervalQueue; + const queue = [] as DynamicWatchedFile[] as PollingIntervalQueue; queue.pollingInterval = pollingInterval; queue.pollIndex = 0; queue.pollScheduled = false; @@ -286,7 +285,7 @@ export function createDynamicPriorityPollingWatchFile(host: { } } - function pollQueue(queue: (WatchedFile | undefined)[], pollingInterval: PollingInterval, pollIndex: number, chunkSize: number) { + function pollQueue(queue: (DynamicWatchedFile | undefined)[], pollingInterval: PollingInterval, pollIndex: number, chunkSize: number) { return pollWatchedFileQueue( host, queue, @@ -295,7 +294,7 @@ export function createDynamicPriorityPollingWatchFile(host: { onWatchFileStat ); - function onWatchFileStat(watchedFile: WatchedFile, pollIndex: number, fileChanged: boolean) { + function onWatchFileStat(watchedFile: DynamicWatchedFile, pollIndex: number, fileChanged: boolean) { if (fileChanged) { watchedFile.unchangedPolls = 0; // Changed files go to changedFilesInLastPoll queue @@ -332,12 +331,12 @@ export function createDynamicPriorityPollingWatchFile(host: { } } - function addToPollingIntervalQueue(file: WatchedFile, pollingInterval: PollingInterval) { + function addToPollingIntervalQueue(file: DynamicWatchedFile, pollingInterval: PollingInterval) { pollingIntervalQueue(pollingInterval).push(file); scheduleNextPollIfNotAlreadyScheduled(pollingInterval); } - function addChangedFileToLowPollingIntervalQueue(file: WatchedFile) { + function addChangedFileToLowPollingIntervalQueue(file: DynamicWatchedFile) { changedFilesInLastPoll.push(file); scheduleNextPollIfNotAlreadyScheduled(PollingInterval.Low); } diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index 9705b1b5609b3..8654d385aa9cb 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -1,7 +1,7 @@ -import { performance } from "./_namespaces/ts"; import { Map } from "./corePublic"; import { Debug } from "./debug"; import { combinePaths } from "./path"; +import * as performance from "./performance"; import { timestamp } from "./performanceCore"; import { getLineAndCharacterOfPosition } from "./scanner"; import { diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 2df182d5e7a1c..78706cfd2a820 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,10 +1,10 @@ -import { performance } from "./_namespaces/ts"; import { addRange, append, emptyArray, map, memoize, noop, notImplemented, returnUndefined, some } from "./core"; import { Debug } from "./debug"; import { createEmitHelperFactory } from "./factory/emitHelpers"; import { disposeEmitNodes, setEmitFlags } from "./factory/emitNode"; import { factory } from "./factory/nodeFactory"; import { isBundle, isSourceFile } from "./factory/nodeTests"; +import * as performance from "./performance"; import { tracing } from "./tracing"; import { transformClassFields } from "./transformers/classFields"; import { transformDeclarations } from "./transformers/declarations"; diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 594b920035dd9..6cecbf4c215c2 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,5 +1,3 @@ -import * as ts from "../_namespaces/ts"; -import { moduleSpecifiers } from "../_namespaces/ts"; import { append, arrayFrom, compact, concatenate, contains, emptyArray, filter, flatMap, flatten, forEach, isArray, last, length, map, mapDefined, orderedRemoveItem, pushIfUnique, some, startsWith, stringContains, toFileNameLowerCase, @@ -21,6 +19,7 @@ import { import { canHaveModifiers, createEmptyExports } from "../factory/utilities"; import { setTextRange } from "../factory/utilitiesPublic"; import { pathContainsNodeModules } from "../moduleNameResolver"; +import * as moduleSpecifiers from "../moduleSpecifiers"; import { isExternalModule, parseNodeFactory } from "../parser"; import { getDirectoryPath, getRelativePathToDirectoryOrUrl, hasExtension, normalizeSlashes, pathIsRelative, toPath, @@ -886,7 +885,7 @@ export function transformDeclarations(context: TransformationContext) { while (length(lateMarkedStatements)) { const i = lateMarkedStatements!.shift()!; if (!isLateVisibilityPaintedStatement(i)) { - return Debug.fail(`Late replaced statement was found which is not handled by the declaration transformer!: ${(ts as any).SyntaxKind ? (ts as any).SyntaxKind[(i as any).kind] : (i as any).kind}`); + return Debug.fail(`Late replaced statement was found which is not handled by the declaration transformer!: ${Debug.formatSyntaxKind((i as any).kind)}`); } const priorNeedsDeclare = needsDeclare; needsDeclare = i.parent && isSourceFile(i.parent) && !(isExternalModule(i.parent) && isBundledEmit); @@ -1142,7 +1141,7 @@ export function transformDeclarations(context: TransformationContext) { input.isTypeOf )); } - default: Debug.assertNever(input, `Attempted to process unhandled node kind: ${(ts as any).SyntaxKind[(input as any).kind]}`); + default: Debug.assertNever(input, `Attempted to process unhandled node kind: ${Debug.formatSyntaxKind((input as any).kind)}`); } } @@ -1571,7 +1570,7 @@ export function transformDeclarations(context: TransformationContext) { } } // Anything left unhandled is an error, so this should be unreachable - return Debug.assertNever(input, `Unhandled top-level node in declaration emit: ${(ts as any).SyntaxKind[(input as any).kind]}`); + return Debug.assertNever(input, `Unhandled top-level node in declaration emit: ${Debug.formatSyntaxKind((input as any).kind)}`); function cleanup(node: T | undefined): T | undefined { if (isEnclosingDeclaration(input)) { diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index a821217498f13..0b7535fcdb87e 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -1,4 +1,3 @@ -import * as ts from "../../_namespaces/ts"; import { Debug } from "../../debug"; import { Diagnostics } from "../../diagnosticInformationMap.generated"; import { @@ -185,7 +184,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD return getTypeAliasDeclarationVisibilityError; } else { - return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${(ts as any).SyntaxKind[(node as any).kind]}`); + return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${Debug.formatSyntaxKind((node as any).kind)}`); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) { @@ -414,7 +413,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1; default: - return Debug.fail(`Unknown parent for parameter: ${(ts as any).SyntaxKind[node.parent.kind]}`); + return Debug.fail(`Unknown parent for parameter: ${Debug.formatSyntaxKind(node.parent.kind)}`); } } diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index c457a697ca40f..c3546ec61b9ea 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { AffectedFileResult, BuilderProgram, EmitAndSemanticDiagnosticsBuilderProgram, SemanticDiagnosticsBuilderProgram, } from "./builderPublic"; @@ -23,7 +22,7 @@ import { resolveTypeReferenceDirective, TypeReferenceDirectiveResolutionCache, } from "./moduleNameResolver"; import { isDeclarationFileName } from "./parser"; -import { convertToRelativePath, getDirectoryPath, resolvePath } from "./path"; +import { convertToRelativePath, getDirectoryPath, resolvePath, toPath as internalToPath } from "./path"; import { changeCompilerHostLikeToUseCache, flattenDiagnosticMessageText, ForegroundColorEscapeSequences, formatColorAndReset, getConfigFileParsingDiagnostics, loadWithModeAwareCache, loadWithTypeDirectiveCache, @@ -408,7 +407,7 @@ function createSolutionBuilderState(watch: boolean, ho } function toPath(state: SolutionBuilderState, fileName: string) { - return ts.toPath(fileName, state.currentDirectory, state.getCanonicalFileName); + return internalToPath(fileName, state.currentDirectory, state.getCanonicalFileName); } function toResolvedConfigFilePath(state: SolutionBuilderState, fileName: ResolvedConfigFileName): ResolvedConfigFilePath { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a0960a952014e..a9ae4d1be7e1f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4468,6 +4468,7 @@ export interface TypeChecker { /* @internal */ isPropertyAccessible(node: Node, isSuper: boolean, isWrite: boolean, containingType: Type, property: Symbol): boolean; /* @internal */ getTypeOnlyAliasDeclaration(symbol: Symbol): TypeOnlyAliasDeclaration | undefined; /* @internal */ getMemberOverrideModifierStatus(node: ClassLikeDeclaration, member: ClassElement): MemberOverrideStatus; + /* @internal */ typeHasCallOrConstructSignatures(type: Type): boolean; } /* @internal */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 25e4e6f08b50a..75c1920517bcf 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -87,8 +87,8 @@ import { PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, PropertyNameLiteral, PseudoBigInt, QualifiedName, ReadonlyTextRange, RequireOrImportCall, RequireVariableStatement, ResolvedModuleFull, ResolvedTypeReferenceDirective, ReturnStatement, ScriptKind, ScriptTarget, SetAccessorDeclaration, - ShorthandPropertyAssignment, Signature, SignatureDeclaration, SignatureFlags, SignatureKind, SourceFile, - SourceFileLike, SourceFileMayBeEmittedHost, SourceMapSource, Statement, StringLiteral, StringLiteralLike, SuperCall, + ShorthandPropertyAssignment, Signature, SignatureDeclaration, SignatureFlags, 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, @@ -6326,11 +6326,6 @@ export function getObjectFlags(type: Type): ObjectFlags { return type.flags & TypeFlags.ObjectFlagsType ? (type as ObjectFlagsType).objectFlags : 0; } -/* @internal */ -export function typeHasCallOrConstructSignatures(type: Type, checker: TypeChecker) { - return checker.getSignaturesOfType(type, SignatureKind.Call).length !== 0 || checker.getSignaturesOfType(type, SignatureKind.Construct).length !== 0; -} - /* @internal */ export function forSomeAncestorDirectory(directory: string, callback: (directory: string) => boolean): boolean { return !!forEachAncestorDirectory(directory, d => callback(d) ? true : undefined); diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index b6b67c40a22ee..54fb404f529f2 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -1,5 +1,3 @@ -import * as ts from "./_namespaces/ts"; -import { performance } from "./_namespaces/ts"; import { BuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, EmitAndSemanticDiagnosticsBuilderProgram, } from "./builderPublic"; @@ -19,6 +17,7 @@ import { combinePaths, convertToRelativePath, fileExtensionIs, getDirectoryPath, getNormalizedAbsolutePath, getRelativePathFromDirectory, normalizePath, pathIsAbsolute, } from "./path"; +import * as performance from "./performance"; import { flattenDiagnosticMessageText, ForegroundColorEscapeSequences, formatColorAndReset, formatDiagnostic, FormatDiagnosticsHost, formatDiagnosticsWithColorAndContext, getReferencedFileLocation, isReferencedFile, @@ -42,7 +41,9 @@ import { createIncrementalCompilerHost, createIncrementalProgram, CreateProgram, ProgramHost, WatchCompilerHost, WatchCompilerHostOfConfigFile, WatchCompilerHostOfFilesAndCompilerOptions, WatchHost, WatchStatusReporter, } from "./watchPublic"; -import { DirectoryStructureHost, getWatchFactory, WatchFactoryHost, WatchLogLevel } from "./watchUtilities"; +import { + DirectoryStructureHost, getWatchFactory, WatchFactory as InternalWatchFactory, WatchFactoryHost, WatchLogLevel, +} from "./watchUtilities"; const sysFormatDiagnosticsHost: FormatDiagnosticsHost | undefined = sys ? { getCurrentDirectory: () => sys.getCurrentDirectory(), @@ -613,7 +614,7 @@ export interface WatchTypeRegistry { NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation", } -interface WatchFactory extends ts.WatchFactory { +interface WatchFactory extends InternalWatchFactory { writeLog: (s: string) => void; } diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index abfcfc4ab4e34..658b4a50053dc 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { createBuildProgramUsingProgramBuildInfo } from "./builder"; import { BuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, EmitAndSemanticDiagnosticsBuilderProgram, @@ -13,7 +12,7 @@ import { Debug } from "./debug"; import { Diagnostics } from "./diagnosticInformationMap.generated"; import { getBuildInfo, getTsBuildInfoEmitOutputFilePath } from "./emitter"; import { CreateSourceFileOptions } from "./parser"; -import { getDirectoryPath, getNormalizedAbsolutePath, toPath } from "./path"; +import { getDirectoryPath, getNormalizedAbsolutePath, toPath, toPath as toPathInternal } from "./path"; import { perfLogger } from "./perfLogger"; import { changeCompilerHostLikeToUseCache, createCompilerHostWorker, getConfigFileParsingDiagnostics, @@ -556,7 +555,7 @@ export function createWatchProgram(host: WatchCompiler } function toPath(fileName: string) { - return ts.toPath(fileName, currentDirectory, getCanonicalFileName); + return toPathInternal(fileName, currentDirectory, getCanonicalFileName); } function isFileMissingOnHost(hostSourceFile: HostFileInfo | undefined): hostSourceFile is FileMissingOnHost { diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 5a9110e2b3b30..b3e5305d0a835 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { BuilderProgram } from "./builderPublic"; import { ExtendedConfigCacheEntry, isExcludedFile, matchesExclude } from "./commandLineParser"; import { @@ -10,7 +9,7 @@ import { Debug } from "./debug"; import { isDeclarationFileName } from "./parser"; import { ensureTrailingDirectorySeparator, fileExtensionIsOneOf, getBaseFileName, getDirectoryPath, - getNormalizedAbsolutePath, hasExtension, normalizePath, + getNormalizedAbsolutePath, hasExtension, normalizePath, toPath as toPathInternal, } from "./path"; import { timestamp } from "./performanceCore"; import { removeIgnoredPath } from "./resolutionCache"; @@ -91,7 +90,7 @@ export function createCachedDirectoryStructureHost(host: DirectoryStructureHost, }; function toPath(fileName: string) { - return ts.toPath(fileName, currentDirectory, getCanonicalFileName); + return toPathInternal(fileName, currentDirectory, getCanonicalFileName); } function getCachedFileSystemEntries(rootDirPath: Path) { diff --git a/src/debug/dbg.ts b/src/debug/dbg.ts index c86b021fe2060..342bf6bd2dd61 100644 --- a/src/debug/dbg.ts +++ b/src/debug/dbg.ts @@ -1,5 +1,3 @@ -import * as Debug from "./_namespaces/Debug"; - /// interface Node { @@ -510,9 +508,3 @@ export function formatControlFlowGraph(flowNode: FlowNode) { return s; } } - -// Export as a module. NOTE: Can't use module exports as this is built using --outFile -declare const module: { exports: {} }; -if (typeof module !== "undefined" && module.exports) { - module.exports = Debug; -} \ No newline at end of file diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 58e1e2fcd38d9..a3853686fb9df 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -1,4 +1,3 @@ -import { performance } from "../compiler/_namespaces/ts"; import { BuilderProgram, EmitAndSemanticDiagnosticsBuilderProgram } from "../compiler/builderPublic"; import { buildOpts, convertToOptionsWithAbsolutePaths, convertToTSConfig, DiagnosticReporter, ExtendedConfigCacheEntry, @@ -15,6 +14,7 @@ import { Diagnostics } from "../compiler/diagnosticInformationMap.generated"; import { combinePaths, fileExtensionIs, fileExtensionIsOneOf, getNormalizedAbsolutePath, normalizePath, toPath, } from "../compiler/path"; +import * as performance from "../compiler/performance"; import { changeCompilerHostLikeToUseCache, createCompilerHostWorker, createProgram, findConfigFile, getConfigFileParsingDiagnostics, @@ -37,12 +37,13 @@ import { import { validateLocaleAndSetLanguage } from "../compiler/utilitiesPublic"; import { createDiagnosticReporter, createWatchCompilerHostOfConfigFile, createWatchCompilerHostOfFilesAndCompilerOptions, - emitFilesAndReportErrorsAndGetExitStatus, getErrorSummaryText, parseConfigFileWithSystem, + createWatchStatusReporter as createWatchStatusReporterInternal, emitFilesAndReportErrorsAndGetExitStatus, + getErrorSummaryText, parseConfigFileWithSystem, + performIncrementalCompilation as performIncrementalCompilationInternal, } from "../compiler/watch"; import { createIncrementalCompilerHost, CreateProgram, createWatchProgram, WatchCompilerHost, } from "../compiler/watchPublic"; -import * as ts from "./_namespaces/ts"; interface Statistic { name: string; @@ -863,7 +864,7 @@ function performIncrementalCompilation( const { options, fileNames, projectReferences } = config; enableStatisticsAndTracing(sys, options, /*isBuildMode*/ false); const host = createIncrementalCompilerHost(options, sys); - const exitStatus = ts.performIncrementalCompilation({ + const exitStatus = performIncrementalCompilationInternal({ host, system: sys, rootNames: fileNames, @@ -919,7 +920,7 @@ function updateWatchCompilationHost( } function createWatchStatusReporter(sys: System, options: CompilerOptions | BuildOptions) { - return ts.createWatchStatusReporter(sys, shouldBePretty(sys, options)); + return createWatchStatusReporterInternal(sys, shouldBePretty(sys, options)); } function createWatchOfConfigFile( diff --git a/src/harness/client.ts b/src/harness/client.ts index 1c7d6f7cea548..d33388551ac57 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -10,7 +10,7 @@ import { UserPreferences, } from "../compiler/types"; import { createTextSpanFromBounds } from "../compiler/utilitiesPublic"; -import { protocol } from "../server/_namespaces/ts.server"; +import * as protocol from "../server/protocol"; import { CommandNames } from "../server/session"; import { DocumentHighlights } from "../services/documentHighlights"; import { PatternMatchKind } from "../services/patternMatcher"; diff --git a/src/harness/compilerImpl.ts b/src/harness/compilerImpl.ts index 9fc8383e506ee..03fa404130e50 100644 --- a/src/harness/compilerImpl.ts +++ b/src/harness/compilerImpl.ts @@ -11,12 +11,12 @@ import { import { addRelatedInfo, compareDiagnostics, createCompilerDiagnostic, getDeclarationEmitExtensionForPath, } from "../compiler/utilities"; -import * as collections from "./_namespaces/collections"; -import * as documents from "./_namespaces/documents"; -import * as fakes from "./_namespaces/fakes"; -import * as vfs from "./_namespaces/vfs"; -import * as vpath from "./_namespaces/vpath"; +import * as collections from "./collectionsImpl"; +import * as documents from "./documentsUtil"; +import * as fakes from "./fakesHosts"; import { getSourceMapRecord } from "./sourceMapRecorder"; +import * as vfs from "./vfsUtil"; +import * as vpath from "./vpathUtil"; /** * Test harness compiler functionality. diff --git a/src/harness/evaluatorImpl.ts b/src/harness/evaluatorImpl.ts index 60b9b2e3d749c..26026978ea5d6 100644 --- a/src/harness/evaluatorImpl.ts +++ b/src/harness/evaluatorImpl.ts @@ -5,11 +5,11 @@ import { formatDiagnostics } from "../compiler/program"; import { CompilerOptions, ModuleKind, ScriptTarget } from "../compiler/types"; import { getEmitModuleKind } from "../compiler/utilities"; import { isExternalModuleNameRelative } from "../compiler/utilitiesPublic"; -import * as fakes from "./_namespaces/fakes"; import * as Harness from "./_namespaces/Harness"; -import * as vfs from "./_namespaces/vfs"; -import * as vpath from "./_namespaces/vpath"; import { compileFiles } from "./compilerImpl"; +import * as fakes from "./fakesHosts"; +import * as vfs from "./vfsUtil"; +import * as vpath from "./vpathUtil"; declare let Symbol: SymbolConstructor; diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index dffca45fefe95..45ec821ff441b 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -14,14 +14,14 @@ import { getDefaultLibFileName } from "../compiler/utilitiesPublic"; import { createDiagnosticReporter } from "../compiler/watch"; import { CreateProgram } from "../compiler/watchPublic"; import { getDefaultCompilerOptions } from "../services/services"; -import * as collections from "./_namespaces/collections"; -import * as documents from "./_namespaces/documents"; import * as Harness from "./_namespaces/Harness"; import * as ts from "./_namespaces/ts"; -import * as vfs from "./_namespaces/vfs"; -import * as vpath from "./_namespaces/vpath"; +import * as collections from "./collectionsImpl"; +import * as documents from "./documentsUtil"; import { assertInvariants } from "./harnessUtils"; import { addUTF8ByteOrderMark, removeByteOrderMark } from "./util"; +import * as vfs from "./vfsUtil"; +import * as vpath from "./vpathUtil"; /** * Fake implementations of various compiler dependencies. diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index e27c51bee1100..d9120c700b590 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -36,14 +36,14 @@ import { createTextSpan, textRangeContainsPositionInclusive, textSpanContainsPosition, textSpanEnd, textSpanIntersectsWithPosition, } from "../compiler/utilitiesPublic"; -import { protocol } from "../server/_namespaces/ts.server"; -import { textChanges } from "../services/_namespaces/ts"; +import * as protocol from "../server/protocol"; import { TokenEncodingConsts, TokenModifier, TokenType } from "../services/classifier2020"; import { importFixName } from "../services/codefixes/importFixes"; import { SortText } from "../services/completions"; import { getPathUpdater } from "../services/getEditsForFileRename"; import { createLanguageServiceSourceFile, displayPartsToString, toEditorSettings } from "../services/services"; import { RealizedDiagnostic, realizeDiagnostics } from "../services/shims"; +import * as textChanges from "../services/textChanges"; import { transpileModule } from "../services/transpile"; import { ApplicableRefactorInfo, CallHierarchyItem, ClassifiedSpan, ClassifiedSpan2020, CodeFixAction, CompletionEntry, @@ -59,18 +59,18 @@ import { createTextRangeFromSpan, createTextSpanFromRange, documentSpansEqual, getTouchingPropertyName, mapOneOrMany, repeatString, textSpansEqual, } from "../services/utilities"; -import * as fakes from "./_namespaces/fakes"; -import * as FourSlashInterface from "./_namespaces/FourSlashInterface"; import * as Harness from "./_namespaces/Harness"; import * as ts from "./_namespaces/ts"; -import * as vfs from "./_namespaces/vfs"; -import * as vpath from "./_namespaces/vpath"; import { SessionClient } from "./client"; +import * as fakes from "./fakesHosts"; +import * as FourSlashInterface from "./fourslashInterfaceImpl"; import { LanguageServiceAdapter, LanguageServiceAdapterHost, NativeLanguageServiceAdapter, ScriptInfo, ServerLanguageServiceAdapter, ShimLanguageServiceAdapter, } from "./harnessLanguageService"; import { assertDiagnosticsEquals, assertInvariants, assertStructuralEquals, memoize } from "./harnessUtils"; +import * as vfs from "./vfsUtil"; +import * as vpath from "./vpathUtil"; import ArrayOrSingle = FourSlashInterface.ArrayOrSingle; diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index f0fddd78c286f..23fcd515b3fac 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -4,7 +4,7 @@ import { Comparison, ESMap, MapLike } from "../compiler/corePublic"; import { tokenToString } from "../compiler/scanner"; import { LineAndCharacter, Symbol, SyntaxKind, TextSpan, UserPreferences } from "../compiler/types"; import { createTextSpan } from "../compiler/utilitiesPublic"; -import { protocol } from "../server/_namespaces/ts.server"; +import * as protocol from "../server/protocol"; import { Completions } from "../services/_namespaces/ts"; import { SortText } from "../services/completions"; import { PatternMatchKind } from "../services/patternMatcher"; @@ -14,8 +14,8 @@ import { IndentStyle, InlayHintKind, JSDocTagInfo, JsxClosingTagInfo, RefactorTriggerReason, RenameInfoOptions, ScriptElementKind, SemanticClassificationFormat, SignatureHelpTriggerReason, SymbolDisplayPart, } from "../services/types"; -import * as FourSlash from "./_namespaces/FourSlash"; import * as ts from "./_namespaces/ts"; +import * as FourSlash from "./fourslashImpl"; export class Test { constructor(private state: FourSlash.TestState) { diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index 4147b0a851cc9..e762354362ec5 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -30,18 +30,18 @@ import { import { textSpanEnd } from "../compiler/utilitiesPublic"; import { getErrorCountForSummary, getErrorSummaryText, getFilesInErrorForSummary } from "../compiler/watch"; import { cloneCompilerOptions } from "../services/utilities"; -import * as compiler from "./_namespaces/compiler"; -import * as documents from "./_namespaces/documents"; -import * as fakes from "./_namespaces/fakes"; import * as ts from "./_namespaces/ts"; -import * as vfs from "./_namespaces/vfs"; -import * as vpath from "./_namespaces/vpath"; +import * as compiler from "./compilerImpl"; import { CompilationResult } from "./compilerImpl"; +import * as documents from "./documentsUtil"; +import * as fakes from "./fakesHosts"; import { findUpRoot } from "./findUpDir"; import { assertInvariants, canonicalizeForHarness, encodeString, splitContentByNewlines } from "./harnessUtils"; import { RunnerBase } from "./runnerbase"; import { TypeWriterResult, TypeWriterWalker } from "./typeWriter"; import { removeByteOrderMark, removeTestPathPrefixes } from "./util"; +import * as vfs from "./vfsUtil"; +import * as vpath from "./vpathUtil"; export interface IO { newLine(): string; diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 9a6de62a91e03..e63cb2310c685 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -43,15 +43,15 @@ import { TextInsertion, TodoComment, TodoCommentDescriptor, } from "../services/types"; import { getSnapshotText } from "../services/utilities"; -import * as collections from "./_namespaces/collections"; -import * as fakes from "./_namespaces/fakes"; import * as Harness from "./_namespaces/Harness"; import * as ts from "./_namespaces/ts"; -import { server } from "./_namespaces/ts"; -import * as vfs from "./_namespaces/vfs"; -import * as vpath from "./_namespaces/vpath"; +import * as server from "./_namespaces/ts.server"; import { SessionClient } from "./client"; +import * as collections from "./collectionsImpl"; +import * as fakes from "./fakesHosts"; import { byteLength } from "./harnessUtils"; +import * as vfs from "./vfsUtil"; +import * as vpath from "./vpathUtil"; export function makeDefaultProxy(info: PluginCreateInfo): LanguageService { const proxy = Object.create(/*prototype*/ null); // eslint-disable-line no-null/no-null diff --git a/src/harness/sourceMapRecorder.ts b/src/harness/sourceMapRecorder.ts index be2a05167336c..b62896772427d 100644 --- a/src/harness/sourceMapRecorder.ts +++ b/src/harness/sourceMapRecorder.ts @@ -9,8 +9,8 @@ import { } from "../compiler/sourcemap"; import { System } from "../compiler/sys"; import { Program, RawSourceMap, SourceFile, SourceMapEmitResult } from "../compiler/types"; -import * as documents from "./_namespaces/documents"; import * as Harness from "./_namespaces/Harness"; +import * as documents from "./documentsUtil"; import { removeByteOrderMark } from "./util"; interface SourceMapSpanWithDecodeErrors { diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index e8afae1d88290..50b2752951bbf 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -1,11 +1,11 @@ import { arrayFrom } from "../compiler/core"; import { sys } from "../compiler/sys"; import { FileSystemEntries } from "../compiler/utilities"; -import * as collections from "./_namespaces/collections"; -import * as documents from "./_namespaces/documents"; import * as Harness from "./_namespaces/Harness"; -import * as vpath from "./_namespaces/vpath"; +import * as collections from "./collectionsImpl"; +import * as documents from "./documentsUtil"; import { timeIncrements } from "./virtualFileSystemWithWatch"; +import * as vpath from "./vpathUtil"; /** * Posix-style path to the TypeScript compiler build outputs (including tsc.js, lib.d.ts, etc.) diff --git a/src/harness/vpathUtil.ts b/src/harness/vpathUtil.ts index c57d089690dc6..3357eb703560a 100644 --- a/src/harness/vpathUtil.ts +++ b/src/harness/vpathUtil.ts @@ -10,7 +10,7 @@ import { removeTrailingDirectorySeparator as removeTrailingSeparator, resolvePath as resolve, } from "../compiler/path"; import { hasJSFileExtension as isJavaScript, hasTSFileExtension as isTypeScript } from "../compiler/utilities"; -import * as vfs from "./_namespaces/vfs"; +import * as vfs from "./vfsUtil"; export { sep }; export { normalizeSeparators }; diff --git a/src/jsTyping/types.ts b/src/jsTyping/types.ts index 8ea6d0b6a5151..4bb5db5bbff11 100644 --- a/src/jsTyping/types.ts +++ b/src/jsTyping/types.ts @@ -1,7 +1,7 @@ import { MapLike, SortedReadonlyArray } from "../compiler/corePublic"; import { DirectoryWatcherCallback, FileWatcher, FileWatcherCallback } from "../compiler/sys"; import { CompilerOptions, Path, TypeAcquisition, WatchOptions } from "../compiler/types"; -import { JsTyping } from "./_namespaces/ts"; +import * as JsTyping from "./jsTyping"; import { ActionInvalidate, ActionPackageInstalled, ActionSet, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, EventTypesRegistry, diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 899f8ffb19350..2e6c9375173e6 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -51,12 +51,12 @@ import { PerformanceEvent, TextChange, } from "../services/types"; import { getSnapshotText, isInsideNodeModules } from "../services/utilities"; -import { protocol } from "./_namespaces/ts.server"; import { createPackageJsonCache, PackageJsonCache } from "./packageJsonCache"; import { AutoImportProviderProject, ConfiguredProject, countEachFileTypes, ExternalProject, hasNoTypeScriptSource, InferredProject, isConfiguredProject, isInferredProject, Project, ProjectFilesWithTSDiagnostics, ProjectKind, } from "./project"; +import * as protocol from "./protocol"; import { isDynamicFileName, ScriptInfo, ScriptInfoVersion } from "./scriptInfo"; import { Session } from "./session"; import { ServerHost } from "./types"; diff --git a/src/server/project.ts b/src/server/project.ts index d6d1f3591e41e..258251de0defe 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -41,7 +41,7 @@ import { CachedDirectoryStructureHost, closeFileWatcherOf, ConfigFileProgramReloadLevel, DirectoryStructureHost, updateMissingFilePathsWatch, } from "../compiler/watchUtilities"; -import { JsTyping } from "../jsTyping/_namespaces/ts"; +import * as JsTyping from "../jsTyping/jsTyping"; import { DocumentRegistry } from "../services/documentRegistry"; import { createCacheableExportInfoMap, ExportInfoMap } from "../services/exportInfoMap"; import { @@ -54,12 +54,12 @@ import { } from "../services/types"; import { cloneCompilerOptions, isInsideNodeModules } from "../services/utilities"; import * as ts from "./_namespaces/ts"; -import { protocol } from "./_namespaces/ts.server"; import { FileStats, forEachResolvedProjectReferenceProject, projectContainsInfoDirectly, ProjectReferenceProjectLoadKind, ProjectService, updateProjectIfDirty, } from "./editorServices"; import { createModuleSpecifierCache } from "./moduleSpecifierCache"; +import * as protocol from "./protocol"; import { ScriptInfo } from "./scriptInfo"; import { Session } from "./session"; import { ServerHost } from "./types"; diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index b01706465f5d6..2aa1a9ce7a073 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -18,12 +18,12 @@ import { emptyOptions, FormatCodeSettings, getDefaultFormatCodeSettings, IScriptSnapshot, ScriptSnapshot, } from "../services/types"; import { getSnapshotText } from "../services/utilities"; -import { protocol } from "./_namespaces/ts.server"; import { maxFileSize } from "./editorServices"; import { ConfiguredProject, ExternalProject, InferredProject, isConfiguredProject, isExternalProject, isInferredProject, Project, ProjectKind, } from "./project"; +import * as protocol from "./protocol"; import { AbsolutePositionAndLineText, ScriptVersionCache } from "./scriptVersionCache"; import { ServerHost } from "./types"; import { Errors, NormalizedPath } from "./utilitiesPublic"; diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index 4eec06854a8c5..74d4ba7eb460f 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -5,7 +5,7 @@ import { collapseTextChangeRangesAcrossMultipleVersions, createTextChangeRange, createTextSpan, unchangedTextChangeRange, } from "../compiler/utilitiesPublic"; import { IScriptSnapshot } from "../services/types"; -import { protocol } from "./_namespaces/ts.server"; +import * as protocol from "./protocol"; import { emptyArray } from "./utilitiesPublic"; const lineCollectionCapacity = 4; diff --git a/src/server/session.ts b/src/server/session.ts index cc6ef0db9034e..741c932ed1775 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -48,7 +48,6 @@ import { import { documentSpansEqual, getSnapshotText, getTouchingPropertyName, mapOneOrMany, PossibleProgramFileInfo, } from "../services/utilities"; -import { protocol } from "./_namespaces/ts.server"; import { ConfigFileDiagEvent, convertFormatOptions, convertScriptKindName, convertUserPreferences, isConfigFile, LargeFileReferencedEvent, ProjectInfoTelemetryEvent, ProjectLanguageServiceStateEvent, ProjectLoadingFinishEvent, @@ -58,6 +57,7 @@ import { import { ConfiguredProject, EmitResult, isConfiguredProject, isExternalProject, isInferredProject, Project, ProjectKind, } from "./project"; +import * as protocol from "./protocol"; import { ScriptInfo } from "./scriptInfo"; import { ServerHost } from "./types"; import { ITypingsInstaller } from "./typingsCache"; diff --git a/src/services/codeFixProvider.ts b/src/services/codeFixProvider.ts index cc95b94099f8b..7f1020624fe48 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -2,8 +2,8 @@ import { arrayFrom, cast, contains, createMultiMap, flatMap, isString, map } fro import { Map, Push } from "../compiler/corePublic"; import { Debug } from "../compiler/debug"; import { Diagnostic, DiagnosticWithLocation } from "../compiler/types"; -import { textChanges } from "./_namespaces/ts"; import { computeSuggestionDiagnostics } from "./suggestionDiagnostics"; +import * as textChanges from "./textChanges"; import { CodeActionCommand, CodeFixAction, CodeFixAllContext, CodeFixContext, CodeFixContextBase, CodeFixRegistration, CombinedCodeActions, FileTextChanges, TextChange, diff --git a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts index 9e41743ebe2a1..7217e016f75d4 100644 --- a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts +++ b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts @@ -4,8 +4,8 @@ import { isAsExpression, isTypeAssertionExpression } from "../../compiler/factor import { AsExpression, SourceFile, SyntaxKind, TypeAssertion } from "../../compiler/types"; import { isInJSFile } from "../../compiler/utilities"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "addConvertToUnknownForNonOverlappingTypes"; diff --git a/src/services/codefixes/addEmptyExportDeclaration.ts b/src/services/codefixes/addEmptyExportDeclaration.ts index 689fa8db18c2d..d3624e1d6eb3c 100644 --- a/src/services/codefixes/addEmptyExportDeclaration.ts +++ b/src/services/codefixes/addEmptyExportDeclaration.ts @@ -1,7 +1,7 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; registerCodeFix({ errorCodes: [ @@ -22,4 +22,4 @@ registerCodeFix({ }); return [createCodeFixActionWithoutFixAll("addEmptyExportDeclaration", changes, Diagnostics.Add_export_to_make_this_file_into_a_module)]; }, -}); \ No newline at end of file +}); diff --git a/src/services/codefixes/addMissingAsync.ts b/src/services/codefixes/addMissingAsync.ts index 71715f5ff51a2..dc83ba091e0ee 100644 --- a/src/services/codefixes/addMissingAsync.ts +++ b/src/services/codefixes/addMissingAsync.ts @@ -12,8 +12,8 @@ import { } from "../../compiler/types"; import { getSyntacticModifierFlags } from "../../compiler/utilities"; import { findAncestor, textSpanEnd } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAllContext, CodeFixContext, FileTextChanges } from "../types"; import { createTextSpanFromNode, getSynthesizedDeepClone, getTokenAtPosition, textSpansEqual } from "../utilities"; diff --git a/src/services/codefixes/addMissingConst.ts b/src/services/codefixes/addMissingConst.ts index 8e8a147096e55..ac7b9faaf2e94 100644 --- a/src/services/codefixes/addMissingConst.ts +++ b/src/services/codefixes/addMissingConst.ts @@ -7,8 +7,8 @@ import { import { Expression, Node, Program, SourceFile, SyntaxKind, TypeChecker } from "../../compiler/types"; import { isAssignmentExpression } from "../../compiler/utilities"; import { findAncestor, isForInOrOfStatement } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "addMissingConst"; diff --git a/src/services/codefixes/addMissingDeclareProperty.ts b/src/services/codefixes/addMissingDeclareProperty.ts index ec44aafaf372b..b96db59202bcc 100644 --- a/src/services/codefixes/addMissingDeclareProperty.ts +++ b/src/services/codefixes/addMissingDeclareProperty.ts @@ -3,8 +3,8 @@ import { Set } from "../../compiler/corePublic"; import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { isIdentifier } from "../../compiler/factory/nodeTests"; import { Node, SourceFile, SyntaxKind } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "addMissingDeclareProperty"; diff --git a/src/services/codefixes/addMissingInvocationForDecorator.ts b/src/services/codefixes/addMissingInvocationForDecorator.ts index 65a436ca32c01..e2910a2b44c24 100644 --- a/src/services/codefixes/addMissingInvocationForDecorator.ts +++ b/src/services/codefixes/addMissingInvocationForDecorator.ts @@ -4,8 +4,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isDecorator } from "../../compiler/factory/nodeTests"; import { SourceFile } from "../../compiler/types"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "addMissingInvocationForDecorator"; diff --git a/src/services/codefixes/addNameToNamelessParameter.ts b/src/services/codefixes/addNameToNamelessParameter.ts index 6a8a4086a9f80..7e71ef1618357 100644 --- a/src/services/codefixes/addNameToNamelessParameter.ts +++ b/src/services/codefixes/addNameToNamelessParameter.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { isParameter } from "../../compiler/factory/nodeTests"; import { Identifier, SourceFile } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "addNameToNamelessParameter"; diff --git a/src/services/codefixes/addOptionalPropertyUndefined.ts b/src/services/codefixes/addOptionalPropertyUndefined.ts index e42a0efd7bfde..99f9609057c00 100644 --- a/src/services/codefixes/addOptionalPropertyUndefined.ts +++ b/src/services/codefixes/addOptionalPropertyUndefined.ts @@ -11,8 +11,8 @@ import { } from "../../compiler/types"; import { getSourceFileOfNode } from "../../compiler/utilities"; import { isExpression, isFunctionLikeKind } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getFixableErrorSpanExpression } from "../utilities"; const addOptionalPropertyUndefined = "addOptionalPropertyUndefined"; diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts index bba3bbebe3c72..a208700600925 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -13,8 +13,8 @@ import { import { getJSDocTypeParameterDeclarations, isJSDocIndexSignature } from "../../compiler/utilities"; import { getJSDocReturnType, getJSDocType, isFunctionLikeDeclaration } from "../../compiler/utilitiesPublic"; import { visitEachChild, visitNode, visitNodes } from "../../compiler/visitorPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { findChildOfKind, getTokenAtPosition } from "../utilities"; const fixId = "annotateWithTypeFromJSDoc"; diff --git a/src/services/codefixes/convertConstToLet.ts b/src/services/codefixes/convertConstToLet.ts index eccf0af47b7de..f2032c8a823df 100644 --- a/src/services/codefixes/convertConstToLet.ts +++ b/src/services/codefixes/convertConstToLet.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { isVariableDeclarationList } from "../../compiler/factory/nodeTests"; import { Program, SourceFile, SyntaxKind, TextRange } from "../../compiler/types"; import { createRange } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { findChildOfKind, getTokenAtPosition } from "../utilities"; const fixId = "fixConvertConstToLet"; diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts index bfee7dcc1bbfe..1d907349dd9ce 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -17,8 +17,8 @@ import { getEmitScriptTarget, isAccessExpression, isSourceFileJS } from "../../c import { getNameOfDeclaration, idText, isFunctionLike, isGetOrSetAccessorDeclaration, isStringLiteralLike, symbolName, } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixContext } from "../types"; import { copyLeadingComments, getQuotePreference, getTokenAtPosition, QuotePreference } from "../utilities"; diff --git a/src/services/codefixes/convertLiteralTypeToMappedType.ts b/src/services/codefixes/convertLiteralTypeToMappedType.ts index 32e71f9668a0a..c82ef6ea44f6f 100644 --- a/src/services/codefixes/convertLiteralTypeToMappedType.ts +++ b/src/services/codefixes/convertLiteralTypeToMappedType.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { isIdentifier, isPropertySignature, isTypeLiteralNode } from "../../compiler/factory/nodeTests"; import { SourceFile, TypeLiteralNode, TypeNode } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "convertLiteralTypeToMappedType"; diff --git a/src/services/codefixes/convertToAsyncFunction.ts b/src/services/codefixes/convertToAsyncFunction.ts index 7848731ac6794..881772720f71d 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -23,11 +23,11 @@ import { forEachReturnStatement, getContainingFunction, getObjectFlags, isInJSFi import { getOriginalNode, idText, isExpression, isFunctionLike, isFunctionLikeDeclaration, isGeneratedIdentifier, } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; import { canBeConvertedToAsync, isFixablePromiseHandler, isReturnStatementWithFixablePromiseHandler, returnsPromise, } from "../suggestionDiagnostics"; +import * as textChanges from "../textChanges"; import { CodeFixContext } from "../types"; import { getSynthesizedDeepClone, getSynthesizedDeepCloneWithReplacements, getTokenAtPosition, diff --git a/src/services/codefixes/convertToEsModule.ts b/src/services/codefixes/convertToEsModule.ts index 7dd9aeb6a8c44..687761fd94d50 100644 --- a/src/services/codefixes/convertToEsModule.ts +++ b/src/services/codefixes/convertToEsModule.ts @@ -23,8 +23,8 @@ import { copyEntries, createRange, getEmitScriptTarget, getResolvedModule, importFromModuleSpecifier, isNonContextualKeyword, isRequireCall, } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { findChildOfKind, getQuotePreference, getSynthesizedDeepClone, getSynthesizedDeepClones, getSynthesizedDeepClonesWithReplacements, getSynthesizedDeepCloneWithReplacements, makeImport, QuotePreference, diff --git a/src/services/codefixes/convertToMappedObjectType.ts b/src/services/codefixes/convertToMappedObjectType.ts index 88a37592caaf0..dedbecbf45a23 100644 --- a/src/services/codefixes/convertToMappedObjectType.ts +++ b/src/services/codefixes/convertToMappedObjectType.ts @@ -10,8 +10,8 @@ import { } from "../../compiler/types"; import { getAllSuperTypeNodes, hasEffectiveReadonlyModifier } from "../../compiler/utilities"; import { idText } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "fixConvertToMappedObjectType"; diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index e434c5459fd22..ee6329fd05e0e 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -6,8 +6,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isExportSpecifier } from "../../compiler/factory/nodeTests"; import { ExportSpecifier, SourceFile, SyntaxKind, TextSpan } from "../../compiler/types"; import { addToSeen } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixContextBase } from "../types"; import { createTextSpanFromNode, findDiagnosticForNode, getDiagnosticsWithinSpan, getTokenAtPosition, diff --git a/src/services/codefixes/convertToTypeOnlyImport.ts b/src/services/codefixes/convertToTypeOnlyImport.ts index 008787736c8dc..f4267d28d767e 100644 --- a/src/services/codefixes/convertToTypeOnlyImport.ts +++ b/src/services/codefixes/convertToTypeOnlyImport.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { isImportDeclaration } from "../../compiler/factory/nodeTests"; import { ImportDeclaration, SourceFile, TextSpan } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixContextBase } from "../types"; import { getTokenAtPosition } from "../utilities"; diff --git a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts index 5a9de62c8e2aa..1c121d932fbc0 100644 --- a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts +++ b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts @@ -4,8 +4,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isIdentifier, isQualifiedName } from "../../compiler/factory/nodeTests"; import { Identifier, QualifiedName, SourceFile } from "../../compiler/types"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "correctQualifiedNameToIndexedAccessType"; diff --git a/src/services/codefixes/disableJsDiagnostics.ts b/src/services/codefixes/disableJsDiagnostics.ts index 80a7e552b2628..c5d765e00053d 100644 --- a/src/services/codefixes/disableJsDiagnostics.ts +++ b/src/services/codefixes/disableJsDiagnostics.ts @@ -5,10 +5,10 @@ import { getLineAndCharacterOfPosition } from "../../compiler/scanner"; import { DiagnosticCategory, SourceFile } from "../../compiler/types"; import { isCheckJsEnabledForFile, isInJSFile } from "../../compiler/utilities"; import { createTextSpan, createTextSpanFromBounds } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, createCodeFixActionWithoutFixAll, createFileTextChanges, registerCodeFix, } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction } from "../types"; import { createTextChange, getNewLineOrDefaultFromHost } from "../utilities"; diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index cc78ae1973506..d4aa80d70c836 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -28,10 +28,10 @@ import { import { findAncestor, hasInitializer, idText, isClassLike, isJsxOpeningLikeElement, isMemberName, } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixAction, createCodeFixActionWithoutFixAll, createCombinedCodeActions, eachDiagnostic, registerCodeFix, } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction, CodeFixContext, CodeFixContextBase } from "../types"; import { getQuotePreference, getTokenAtPosition, QuotePreference, skipConstraint, startsWithUnderscore, diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts index 8b444a638a3f9..9548ffd42ba3f 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -4,8 +4,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isCallExpression } from "../../compiler/factory/nodeTests"; import { Node, SourceFile, TextSpan } from "../../compiler/types"; import { textSpanEnd } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "addMissingNewOperator"; diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts index f72143702f6fb..f6de9061ee8fb 100644 --- a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -2,8 +2,8 @@ import { Debug } from "../../compiler/debug"; import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { ImportTypeNode, SourceFile, SyntaxKind } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof"; diff --git a/src/services/codefixes/fixAddVoidToPromise.ts b/src/services/codefixes/fixAddVoidToPromise.ts index 586ede72ffb0a..9be8c9778564d 100644 --- a/src/services/codefixes/fixAddVoidToPromise.ts +++ b/src/services/codefixes/fixAddVoidToPromise.ts @@ -12,8 +12,8 @@ import { } from "../../compiler/types"; import { isInJSFile } from "../../compiler/utilities"; import { getJSDocTypeTag, idText } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAllContext } from "../types"; import { getTokenAtPosition } from "../utilities"; @@ -96,4 +96,4 @@ function getEffectiveTypeArguments(node: NewExpression) { else { return node.typeArguments; } -} \ No newline at end of file +} diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts index fd4623224a4d8..88ef669a55092 100644 --- a/src/services/codefixes/fixAwaitInSyncFunction.ts +++ b/src/services/codefixes/fixAwaitInSyncFunction.ts @@ -8,8 +8,8 @@ import { ArrowFunction, FunctionDeclaration, FunctionExpression, MethodDeclaration, Node, SourceFile, SyntaxKind, TypeNode, } from "../../compiler/types"; import { addToSeen, getContainingFunction, getEntityNameFromTypeNode } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { findChildOfKind, getTokenAtPosition } from "../utilities"; const fixId = "fixAwaitInSyncFunction"; diff --git a/src/services/codefixes/fixCannotFindModule.ts b/src/services/codefixes/fixCannotFindModule.ts index 9f8a1ea0b0b5d..28b52b1f394b1 100644 --- a/src/services/codefixes/fixCannotFindModule.ts +++ b/src/services/codefixes/fixCannotFindModule.ts @@ -5,7 +5,7 @@ import { isStringLiteral } from "../../compiler/factory/nodeTests"; import { getTypesPackageName, parsePackageName } from "../../compiler/moduleNameResolver"; import { SourceFile } from "../../compiler/types"; import { isExternalModuleNameRelative } from "../../compiler/utilitiesPublic"; -import { JsTyping } from "../../jsTyping/_namespaces/ts"; +import * as JsTyping from "../../jsTyping/jsTyping"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; import { InstallPackageAction, LanguageServiceHost } from "../types"; import { getTokenAtPosition } from "../utilities"; diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index c6ac9bcad1549..384991c7f8148 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -7,8 +7,8 @@ import { } from "../../compiler/types"; import { addToSeen, getEffectiveBaseTypeNode, getSyntacticModifierFlags } from "../../compiler/utilities"; import { isClassLike } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; import { createMissingMemberNodes, TypeConstructionContext } from "./helpers"; import { createImportAdder } from "./importFixes"; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 2a40140de0a67..93ff10926218f 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -12,8 +12,8 @@ import { addToSeen, createSymbolTable, getContainingClass, getEffectiveBaseTypeNode, getEffectiveImplementsTypeNodes, getEffectiveModifierFlags, } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction } from "../types"; import { getTokenAtPosition } from "../utilities"; import { createMissingMemberNodes, getNoopSymbolTrackerWithResolver, TypeConstructionContext } from "./helpers"; diff --git a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts index 045d3c7f0eb53..140f339e10c30 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -8,8 +8,8 @@ import { } from "../../compiler/types"; import { addToSeen, getContainingFunction, isSuperCall } from "../../compiler/utilities"; import { isFunctionLike } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "classSuperMustPrecedeThisAccess"; diff --git a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts index d192ca6592ae3..d7dc3300e2ae3 100644 --- a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts +++ b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts @@ -4,8 +4,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { isConstructorDeclaration } from "../../compiler/factory/nodeTests"; import { ConstructorDeclaration, SourceFile } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "constructorForDerivedNeedSuperCall"; diff --git a/src/services/codefixes/fixEnableExperimentalDecorators.ts b/src/services/codefixes/fixEnableExperimentalDecorators.ts index ef2ce8a349b14..36e9eade5ff4d 100644 --- a/src/services/codefixes/fixEnableExperimentalDecorators.ts +++ b/src/services/codefixes/fixEnableExperimentalDecorators.ts @@ -1,8 +1,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { TsConfigSourceFile } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { setJsonCompilerOptionValue } from "./helpers"; const fixId = "enableExperimentalDecorators"; diff --git a/src/services/codefixes/fixEnableJsxFlag.ts b/src/services/codefixes/fixEnableJsxFlag.ts index c7a0ec6eec5ad..10be76c76891d 100644 --- a/src/services/codefixes/fixEnableJsxFlag.ts +++ b/src/services/codefixes/fixEnableJsxFlag.ts @@ -1,8 +1,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { TsConfigSourceFile } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { setJsonCompilerOptionValue } from "./helpers"; const fixID = "fixEnableJsxFlag"; diff --git a/src/services/codefixes/fixExpectedComma.ts b/src/services/codefixes/fixExpectedComma.ts index 42ae9c82f1ee2..f0282bd4b5890 100644 --- a/src/services/codefixes/fixExpectedComma.ts +++ b/src/services/codefixes/fixExpectedComma.ts @@ -2,8 +2,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { isArrayLiteralExpression, isObjectLiteralExpression } from "../../compiler/factory/nodeTests"; import { Node, SourceFile, SyntaxKind } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "fixExpectedComma"; diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index df7e80c737839..da289b939d0e4 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -3,8 +3,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isWhiteSpaceSingleLine } from "../../compiler/scanner"; import { HeritageClause, Node, SourceFile, SyntaxKind } from "../../compiler/types"; import { getContainingClass } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "extendsInterfaceBecomesImplements"; diff --git a/src/services/codefixes/fixForgottenThisPropertyAccess.ts b/src/services/codefixes/fixForgottenThisPropertyAccess.ts index 950487149a87d..06868e20fb2ee 100644 --- a/src/services/codefixes/fixForgottenThisPropertyAccess.ts +++ b/src/services/codefixes/fixForgottenThisPropertyAccess.ts @@ -3,8 +3,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isIdentifier, isPrivateIdentifier } from "../../compiler/factory/nodeTests"; import { Identifier, PrivateIdentifier, SourceFile } from "../../compiler/types"; import { getContainingClass } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition, suppressLeadingAndTrailingTrivia } from "../utilities"; const fixId = "forgottenThisPropertyAccess"; diff --git a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts index 0539c9ae9bd12..bdbd7d14b4b10 100644 --- a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts +++ b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts @@ -4,8 +4,8 @@ import { NamedTupleMember, OptionalTypeNode, ParenthesizedTypeNode, RestTypeNode, SourceFile, SyntaxKind, } from "../../compiler/types"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "fixIncorrectNamedTupleSyntax"; diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index 7af24d79b55a0..9b301b8841494 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -9,8 +9,8 @@ import { getEmitModuleKind, getNamespaceDeclarationNode, getSourceFileOfNode, isImportCall, } from "../../compiler/utilities"; import { findAncestor, isExpression, isNamedDeclaration } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction, CodeFixContext } from "../types"; import { getQuotePreference, getTokenAtPosition, makeImport } from "../utilities"; diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index cb768746f7dd0..2f3da3ad72b29 100644 --- a/src/services/codefixes/fixInvalidJsxCharacters.ts +++ b/src/services/codefixes/fixInvalidJsxCharacters.ts @@ -1,8 +1,8 @@ import { hasProperty } from "../../compiler/core"; import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { SourceFile, UserPreferences } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { quote } from "../utilities"; const fixIdExpression = "fixInvalidJsxCharacters_expression"; diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts index 40a71f599e7de..592c3933e851e 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -6,8 +6,8 @@ import { TypeAliasDeclaration, TypeAssertion, TypeChecker, TypeFlags, TypeNode, VariableDeclaration, } from "../../compiler/types"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction } from "../types"; import { getTokenAtPosition } from "../utilities"; diff --git a/src/services/codefixes/fixMissingCallParentheses.ts b/src/services/codefixes/fixMissingCallParentheses.ts index b62316bd49511..36139c8129d2d 100644 --- a/src/services/codefixes/fixMissingCallParentheses.ts +++ b/src/services/codefixes/fixMissingCallParentheses.ts @@ -1,8 +1,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { isIdentifier, isPropertyAccessExpression } from "../../compiler/factory/nodeTests"; import { Identifier, PrivateIdentifier, PropertyAccessExpression, SourceFile } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "fixMissingCallParentheses"; diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index a608b02b87f67..d952276d1a05f 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -2,8 +2,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { Expression, ModuleKind, ScriptTarget } from "../../compiler/types"; import { getEmitModuleKind, getEmitScriptTarget, getTsConfigObjectLiteralExpression } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction } from "../types"; import { setJsonCompilerOptionValue, setJsonCompilerOptionValues } from "./helpers"; diff --git a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts index 4046a0f0f225e..561b3ea910083 100644 --- a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts +++ b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts @@ -4,8 +4,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isPropertyAccessExpression } from "../../compiler/factory/nodeTests"; import { PropertyAccessExpression, SourceFile, UserPreferences } from "../../compiler/types"; import { isPropertyAccessChain } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getQuotePreference, getTokenAtPosition, QuotePreference } from "../utilities"; const fixId = "fixNoPropertyAccessFromIndexSignature"; diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index 89def6a354e21..1fc7324e407e6 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -12,8 +12,8 @@ import { isSourceFileJS } from "../../compiler/utilities"; import { findAncestor, isClassLike, isParameterPropertyDeclaration, ParameterPropertyDeclaration, } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixActionMaybeFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAllContext, CodeFixContext } from "../types"; import { getTokenAtPosition, isAccessibilityModifier } from "../utilities"; diff --git a/src/services/codefixes/fixPropertyAssignment.ts b/src/services/codefixes/fixPropertyAssignment.ts index 111d5765a80a7..2562fadefbda9 100644 --- a/src/services/codefixes/fixPropertyAssignment.ts +++ b/src/services/codefixes/fixPropertyAssignment.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { isShorthandPropertyAssignment } from "../../compiler/factory/nodeTests"; import { Expression, ShorthandPropertyAssignment, SourceFile } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "fixPropertyAssignment"; diff --git a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts index a93483986cfc2..8da72eeb29831 100644 --- a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts +++ b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts @@ -3,8 +3,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { SourceFile, Type, TypeChecker, TypeNode } from "../../compiler/types"; import { isInJSFile } from "../../compiler/utilities"; import { findAncestor, isFunctionLikeDeclaration } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "fixReturnTypeInAsyncFunction"; diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index bc4fa812c41ba..b704bc5d47027 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -17,8 +17,8 @@ import { findAncestor, isClassElement, isClassLike, isJsxOpeningLikeElement, isMemberName, isNamedDeclaration, isStringLiteralLike, symbolName, } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixContextBase } from "../types"; import { getMeaningFromLocation, getTokenAtPosition, SemanticMeaning } from "../utilities"; diff --git a/src/services/codefixes/fixStrictClassInitialization.ts b/src/services/codefixes/fixStrictClassInitialization.ts index f353db31d4b6f..5ad5221daa25d 100644 --- a/src/services/codefixes/fixStrictClassInitialization.ts +++ b/src/services/codefixes/fixStrictClassInitialization.ts @@ -11,8 +11,8 @@ import { getClassLikeDeclarationOfSymbol, getEffectiveTypeAnnotationNode, getFirstConstructorWithBody, hasSyntacticModifier, isInJSFile, } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction, CodeFixContext } from "../types"; import { getTokenAtPosition, suppressLeadingAndTrailingTrivia } from "../utilities"; diff --git a/src/services/codefixes/fixUnmatchedParameter.ts b/src/services/codefixes/fixUnmatchedParameter.ts index 4a303a370149f..13b34d6488865 100644 --- a/src/services/codefixes/fixUnmatchedParameter.ts +++ b/src/services/codefixes/fixUnmatchedParameter.ts @@ -8,10 +8,10 @@ import { } from "../../compiler/types"; import { getHostSignatureFromJSDoc } from "../../compiler/utilities"; import { getJSDocTags } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixAction, createCodeFixActionWithoutFixAll, createCombinedCodeActions, eachDiagnostic, registerCodeFix, } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixAction, CodeFixContext } from "../types"; import { getTokenAtPosition } from "../utilities"; diff --git a/src/services/codefixes/fixUnreachableCode.ts b/src/services/codefixes/fixUnreachableCode.ts index 74c94d95e6115..d5f16c2321fab 100644 --- a/src/services/codefixes/fixUnreachableCode.ts +++ b/src/services/codefixes/fixUnreachableCode.ts @@ -6,8 +6,8 @@ import { isBlock } from "../../compiler/factory/nodeTests"; import { IfStatement, SourceFile, SyntaxKind } from "../../compiler/types"; import { sliceAfter } from "../../compiler/utilities"; import { findAncestor, isStatement } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "fixUnreachableCode"; diff --git a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts index 7cacbf9fe4e04..047d60ef0224f 100644 --- a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts +++ b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts @@ -7,9 +7,9 @@ import { ImportClause, ImportEqualsDeclaration, ImportSpecifier, Node, Program, SourceFile, SymbolFlags, SyntaxKind, } from "../../compiler/types"; import { forEachImportClauseDeclaration, skipAlias } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; import { doChangeNamedToNamespaceOrDefault } from "../refactors/convertImport"; +import * as textChanges from "../textChanges"; import { CodeFixAction } from "../types"; import { getTokenAtPosition } from "../utilities"; diff --git a/src/services/codefixes/fixUnusedLabel.ts b/src/services/codefixes/fixUnusedLabel.ts index 514933bd339a5..b961e3edf7457 100644 --- a/src/services/codefixes/fixUnusedLabel.ts +++ b/src/services/codefixes/fixUnusedLabel.ts @@ -4,8 +4,8 @@ import { isLabeledStatement } from "../../compiler/factory/nodeTests"; import { skipTrivia } from "../../compiler/scanner"; import { SourceFile, SyntaxKind } from "../../compiler/types"; import { positionsAreOnSameLine } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { findChildOfKind, getTokenAtPosition } from "../utilities"; const fixId = "fixUnusedLabel"; diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index e428b180fb31b..a25e67e279782 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -18,8 +18,8 @@ import { import { findAncestor, isClassLike, isFunctionLike, isParameterPropertyDeclaration, ParameterPropertyDeclaration, } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { isRefactorErrorInfo, RefactorErrorInfo } from "../refactors/helpers"; +import * as textChanges from "../textChanges"; import { FileTextChanges } from "../types"; import { getTokenAtPosition, getUniqueName, nodeOverlapsWithStartEnd, startsWithUnderscore, suppressLeadingAndTrailingTrivia, diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index f7ec7f4148ef2..73b4bd3e013a7 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -24,7 +24,7 @@ import { } from "../../compiler/utilities"; import { getNameOfDeclaration, idText } from "../../compiler/utilitiesPublic"; import { visitEachChild, visitNode } from "../../compiler/visitorPublic"; -import { textChanges } from "../_namespaces/ts"; +import * as textChanges from "../textChanges"; import { CodeFixContextBase, LanguageServiceHost } from "../types"; import { getModuleSpecifierResolverHost, getNameForExportedSymbol, getQuotePreference, getSynthesizedDeepClone, diff --git a/src/services/codefixes/removeAccidentalCallParentheses.ts b/src/services/codefixes/removeAccidentalCallParentheses.ts index eb332bc26e476..9e773d14c6ec3 100644 --- a/src/services/codefixes/removeAccidentalCallParentheses.ts +++ b/src/services/codefixes/removeAccidentalCallParentheses.ts @@ -1,8 +1,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { isCallExpression } from "../../compiler/factory/nodeTests"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "removeAccidentalCallParentheses"; diff --git a/src/services/codefixes/removeUnnecessaryAwait.ts b/src/services/codefixes/removeUnnecessaryAwait.ts index 42fc1dda03e73..64b53b717491a 100644 --- a/src/services/codefixes/removeUnnecessaryAwait.ts +++ b/src/services/codefixes/removeUnnecessaryAwait.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { isAwaitExpression, isIdentifier, isParenthesizedExpression } from "../../compiler/factory/nodeTests"; import { AwaitKeywordToken, Node, SourceFile, SyntaxKind, TextSpan } from "../../compiler/types"; import { getLeftmostExpression } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { findPrecedingToken, getTokenAtPosition } from "../utilities"; const fixId = "removeUnnecessaryAwait"; diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts index 2d7775e862e73..72ed67d86bf86 100644 --- a/src/services/codefixes/requireInTs.ts +++ b/src/services/codefixes/requireInTs.ts @@ -10,8 +10,8 @@ import { VariableStatement, } from "../../compiler/types"; import { getAllowSyntheticDefaultImports, isRequireCall } from "../../compiler/utilities"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "requireInTs"; diff --git a/src/services/codefixes/returnValueCorrect.ts b/src/services/codefixes/returnValueCorrect.ts index 83563f89f4e3e..63b8a6ca8d8e2 100644 --- a/src/services/codefixes/returnValueCorrect.ts +++ b/src/services/codefixes/returnValueCorrect.ts @@ -12,8 +12,8 @@ import { } from "../../compiler/types"; import { createSymbolTable, hasSyntacticModifier, isDeclarationName, isVariableLike } from "../../compiler/utilities"; import { findAncestor, isFunctionLikeDeclaration } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixContext } from "../types"; import { copyComments, getTokenAtPosition, needsParentheses, probablyUsesSemicolons, rangeContainsRange, diff --git a/src/services/codefixes/splitTypeOnlyImport.ts b/src/services/codefixes/splitTypeOnlyImport.ts index fd40b1a8e7c18..77d72f02043b8 100644 --- a/src/services/codefixes/splitTypeOnlyImport.ts +++ b/src/services/codefixes/splitTypeOnlyImport.ts @@ -4,8 +4,8 @@ import { factory } from "../../compiler/factory/nodeFactory"; import { isImportDeclaration } from "../../compiler/factory/nodeTests"; import { ImportDeclaration, SourceFile, TextSpan } from "../../compiler/types"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { CodeFixContextBase } from "../types"; import { getTokenAtPosition } from "../utilities"; diff --git a/src/services/codefixes/useBigintLiteral.ts b/src/services/codefixes/useBigintLiteral.ts index bc2280500b190..973ef3d7e5407 100644 --- a/src/services/codefixes/useBigintLiteral.ts +++ b/src/services/codefixes/useBigintLiteral.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../compiler/diagnosticInformationMap.generated"; import { factory } from "../../compiler/factory/nodeFactory"; import { isNumericLiteral } from "../../compiler/factory/nodeTests"; import { SourceFile, TextSpan } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixId = "useBigintLiteral"; diff --git a/src/services/codefixes/useDefaultImport.ts b/src/services/codefixes/useDefaultImport.ts index a682f1872f219..f572d89907190 100644 --- a/src/services/codefixes/useDefaultImport.ts +++ b/src/services/codefixes/useDefaultImport.ts @@ -3,8 +3,8 @@ import { isExternalModuleReference, isIdentifier, isImportEqualsDeclaration, isNamespaceImport, } from "../../compiler/factory/nodeTests"; import { AnyImportSyntax, Expression, Identifier, SourceFile, UserPreferences } from "../../compiler/types"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getQuotePreference, getTokenAtPosition, makeImport } from "../utilities"; const fixId = "useDefaultImport"; diff --git a/src/services/codefixes/wrapJsxInFragment.ts b/src/services/codefixes/wrapJsxInFragment.ts index ac7a5883b24af..d0b9ddc8fa604 100644 --- a/src/services/codefixes/wrapJsxInFragment.ts +++ b/src/services/codefixes/wrapJsxInFragment.ts @@ -4,8 +4,8 @@ import { isBinaryExpression } from "../../compiler/factory/nodeTests"; import { BinaryExpression, JsxChild, Node, SourceFile, SyntaxKind } from "../../compiler/types"; import { nodeIsMissing } from "../../compiler/utilities"; import { isJsxChild } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { codeFixAll, createCodeFixAction, registerCodeFix } from "../codeFixProvider"; +import * as textChanges from "../textChanges"; import { getTokenAtPosition } from "../utilities"; const fixID = "wrapJsxInFragment"; diff --git a/src/services/completions.ts b/src/services/completions.ts index 3164515fdfb84..482cc664842d2 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -50,8 +50,7 @@ import { isLiteralImportTypeNode, isNamedImportsOrExports, isObjectTypeDeclaration, isPartOfTypeNode, isPropertyNameLiteral, isSingleOrDoubleQuote, isSourceFileJS, isStatic, isStringANonContextualKeyword, isValidTypeOnlyAliasUseSite, isVariableLike, modifiersToFlags, modifierToFlag, nodeIsMissing, positionsAreOnSameLine, pseudoBigIntToString, - rangeIsOnSingleLine, skipAlias, stripQuotes, tryGetImportFromModuleSpecifier, typeHasCallOrConstructSignatures, - walkUpParenthesizedExpressions, + rangeIsOnSingleLine, skipAlias, stripQuotes, tryGetImportFromModuleSpecifier, walkUpParenthesizedExpressions, } from "../compiler/utilities"; import { createTextSpanFromBounds, findAncestor, getNameOfDeclaration, hasInitializer, hasType, isAssertionExpression, @@ -62,8 +61,8 @@ import { isStringLiteralLike, isStringTextContainingNode, isTypeNode, isTypeOnlyImportOrExportDeclaration, isTypeReferenceType, unescapeLeadingUnderscores, } from "../compiler/utilitiesPublic"; -import { JsTyping } from "../jsTyping/_namespaces/ts"; -import { formatting, textChanges } from "./_namespaces/ts"; +import * as JsTyping from "../jsTyping/jsTyping"; +import { formatting } from "./_namespaces/ts"; import { addNewNodeForMemberSymbol, getNoopSymbolTrackerWithResolver, PreserveOptionalFlags, } from "./codefixes/helpers"; @@ -80,6 +79,7 @@ import { getNameTable } from "./services"; import { getArgumentInfoForCompletions } from "./signatureHelp"; import { getStringLiteralCompletionDetails, getStringLiteralCompletions } from "./stringCompletions"; import { getSymbolDisplayPartsDocumentationAndSymbolKind, getSymbolKind, getSymbolModifiers } from "./symbolDisplay"; +import * as textChanges from "./textChanges"; import { CodeAction, CompletionEntry, CompletionEntryData, CompletionEntryDataAutoImport, CompletionEntryDataResolved, CompletionEntryDataUnresolved, CompletionEntryDetails, CompletionEntryLabelDetails, CompletionInfo, @@ -4176,7 +4176,7 @@ function getApparentProperties(type: Type, node: ObjectLiteralExpression | JsxAt !(memberType.flags & TypeFlags.Primitive || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) - || typeHasCallOrConstructSignatures(memberType, checker) + || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())))); } diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index 2dc2d26fe35b2..72fa96d99ea92 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -1,6 +1,6 @@ import { sourceFileAffectingCompilerOptions } from "../compiler/commandLineParser"; import { - arrayFrom, createGetCanonicalFileName, firstDefinedIterator, getOrUpdate, identity, isArray, map, + arrayFrom, createGetCanonicalFileName, firstDefinedIterator, getOrUpdate, hasProperty, identity, isArray, map, } from "../compiler/core"; import { ESMap, Map } from "../compiler/corePublic"; import { Debug } from "../compiler/debug"; @@ -14,7 +14,6 @@ import { import { ensureScriptKind, forEachEntry, getCompilerOptionValue, getEmitScriptTarget, getSetExternalModuleIndicator, } from "../compiler/utilities"; -import * as ts from "./_namespaces/ts"; import { createLanguageServiceSourceFile, updateLanguageServiceSourceFile } from "./services"; import { IScriptSnapshot } from "./types"; @@ -385,7 +384,7 @@ function compilerOptionValueToString(value: unknown): string { } let str = "{"; for (const key in value) { - if (ts.hasOwnProperty.call(value, key)) { // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier + if (hasProperty.call(value, key)) { // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier str += `${key}: ${compilerOptionValueToString((value as any)[key])}`; } } diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index 6c2fd16e0d1a7..f24ff91744661 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -1,4 +1,3 @@ -import { moduleSpecifiers } from "../compiler/_namespaces/ts"; import { getOptionFromName } from "../compiler/commandLineParser"; import { createGetCanonicalFileName, emptyArray, endsWith, find, forEach, GetCanonicalFileName, last, mapDefined, @@ -9,6 +8,7 @@ import { isArrayLiteralExpression, isObjectLiteralExpression, isPropertyAssignment, isSourceFile, isStringLiteral, } from "../compiler/factory/nodeTests"; import { resolveModuleName } from "../compiler/moduleNameResolver"; +import * as moduleSpecifiers from "../compiler/moduleSpecifiers"; import { combinePaths, ensurePathIsNonModuleName, getDirectoryPath, getRelativePathFromDirectory, getRelativePathFromFile, normalizePath, pathIsRelative, diff --git a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts index d7b24c01b0f90..022b7f5cff655 100644 --- a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts +++ b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts @@ -6,8 +6,8 @@ import { isArrowFunction, isBlock, isReturnStatement } from "../../compiler/fact import { ArrowFunction, ConciseBody, Expression, ReturnStatement, SourceFile, SyntaxKind } from "../../compiler/types"; import { getContainingFunction, getLocaleSpecificMessage } from "../../compiler/utilities"; import { isExpression } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { registerRefactor } from "../refactorProvider"; +import * as textChanges from "../textChanges"; import { ApplicableRefactorInfo, RefactorContext, RefactorEditInfo } from "../types"; import { copyLeadingComments, copyTrailingAsLeadingComments, copyTrailingComments, getTokenAtPosition, needsParentheses, diff --git a/src/services/refactors/convertOverloadListToSingleSignature.ts b/src/services/refactors/convertOverloadListToSingleSignature.ts index ad99096a20ffd..6540b254cf0ad 100644 --- a/src/services/refactors/convertOverloadListToSingleSignature.ts +++ b/src/services/refactors/convertOverloadListToSingleSignature.ts @@ -14,9 +14,9 @@ import { } from "../../compiler/types"; import { getSourceFileOfNode } from "../../compiler/utilities"; import { findAncestor, isFunctionLikeDeclaration } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { registerRefactor } from "../refactorProvider"; import { displayPartsToString } from "../services"; +import * as textChanges from "../textChanges"; import { ApplicableRefactorInfo, RefactorContext, RefactorEditInfo } from "../types"; import { getTokenAtPosition } from "../utilities"; diff --git a/src/services/refactors/convertStringOrTemplateLiteral.ts b/src/services/refactors/convertStringOrTemplateLiteral.ts index f1b262f25ca0f..a49f0c71cadd8 100644 --- a/src/services/refactors/convertStringOrTemplateLiteral.ts +++ b/src/services/refactors/convertStringOrTemplateLiteral.ts @@ -13,8 +13,8 @@ import { } from "../../compiler/types"; import { getLocaleSpecificMessage, getTextOfNode } from "../../compiler/utilities"; import { findAncestor, isStringLiteralLike } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { registerRefactor } from "../refactorProvider"; +import * as textChanges from "../textChanges"; import { ApplicableRefactorInfo, RefactorContext, RefactorEditInfo } from "../types"; import { copyTrailingAsLeadingComments, copyTrailingComments, getTokenAtPosition } from "../utilities"; diff --git a/src/services/refactors/convertToOptionalChainExpression.ts b/src/services/refactors/convertToOptionalChainExpression.ts index 068b4b5d9ca90..0d5a48afb4af7 100644 --- a/src/services/refactors/convertToOptionalChainExpression.ts +++ b/src/services/refactors/convertToOptionalChainExpression.ts @@ -15,8 +15,8 @@ import { getLocaleSpecificMessage, getSingleVariableOfVariableStatement, isStringOrNumericLiteralLike, skipParentheses, } from "../../compiler/utilities"; import { createTextSpanFromBounds, isOptionalChain } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { registerRefactor } from "../refactorProvider"; +import * as textChanges from "../textChanges"; import { ApplicableRefactorInfo, RefactorContext, RefactorEditInfo } from "../types"; import { findTokenOnLeftOfPosition, getRefactorContextSpan, getTokenAtPosition } from "../utilities"; import { isRefactorErrorInfo, RefactorErrorInfo } from "./helpers"; diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 35b438056c709..3297eea3d9798 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -40,10 +40,10 @@ import { textSpanEnd, } from "../../compiler/utilitiesPublic"; import { visitEachChild, visitNode, visitNodes } from "../../compiler/visitorPublic"; -import { textChanges } from "../_namespaces/ts"; import { typeToAutoImportableTypeNode } from "../codefixes/helpers"; import { createImportAdder } from "../codefixes/importFixes"; import { registerRefactor } from "../refactorProvider"; +import * as textChanges from "../textChanges"; import { ApplicableRefactorInfo, RefactorActionInfo, RefactorContext, RefactorEditInfo } from "../types"; import { ANONYMOUS, findFirstNonJsxWhitespaceToken, findTokenOnLeftOfPosition, getParentNodeInSpan, getRefactorContextSpan, diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index 77462fb8c7945..6385bd6926a81 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -20,8 +20,8 @@ import { addToSeen, getLocaleSpecificMessage, isSourceFileJS, isThisIdentifier } import { findAncestor, getEffectiveConstraintOfTypeParameter, isFunctionLike, isStatement, isTypeNode, } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { registerRefactor } from "../refactorProvider"; +import * as textChanges from "../textChanges"; import { ApplicableRefactorInfo, RefactorContext, RefactorEditInfo } from "../types"; import { createTextRangeFromSpan, getNameFromPropertyName, getRefactorContextSpan, getRenameLocation, getTokenAtPosition, diff --git a/src/services/refactors/inferFunctionReturnType.ts b/src/services/refactors/inferFunctionReturnType.ts index b519532d456ff..d3c4f68f0ddf3 100644 --- a/src/services/refactors/inferFunctionReturnType.ts +++ b/src/services/refactors/inferFunctionReturnType.ts @@ -8,8 +8,8 @@ import { } from "../../compiler/types"; import { getLocaleSpecificMessage, isInJSFile } from "../../compiler/utilities"; import { findAncestor } from "../../compiler/utilitiesPublic"; -import { textChanges } from "../_namespaces/ts"; import { registerRefactor } from "../refactorProvider"; +import * as textChanges from "../textChanges"; import { ApplicableRefactorInfo, RefactorContext, RefactorEditInfo } from "../types"; import { findChildOfKind, getTokenAtPosition } from "../utilities"; import { isRefactorErrorInfo, RefactorErrorInfo, refactorKindBeginsWith } from "./helpers"; diff --git a/src/services/services.ts b/src/services/services.ts index 2d03cc15cb3bc..03159294829aa 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -56,11 +56,11 @@ import { Completions, FindAllReferences, formatting, GoToDefinition, InlayHints, JsDoc, NavigateTo, NavigationBar, OrganizeImports, refactor, Rename, SignatureHelp, SmartSelectionRange, } from "./_namespaces/ts"; -import { v2020 } from "./_namespaces/ts.classifier"; import { spanInSourceFileAtLocation } from "./breakpoints"; import { createCallHierarchyItem, getIncomingCalls, getOutgoingCalls, resolveCallHierarchyDeclaration, } from "./callHierarchy"; +import * as classifier2020 from "./classifier2020"; import { getAllFixes, getFixes, getSupportedErrorCodes } from "./codeFixProvider"; import { DocumentHighlights } from "./documentHighlights"; import { createDocumentRegistry, DocumentRegistry } from "./documentRegistry"; @@ -2067,7 +2067,7 @@ export function createLanguageService( const responseFormat = format || SemanticClassificationFormat.Original; if (responseFormat === SemanticClassificationFormat.TwentyTwenty) { - return v2020.getSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); + return classifier2020.getSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); } else { return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); @@ -2082,7 +2082,7 @@ export function createLanguageService( return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); } else { - return v2020.getEncodedSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); + return classifier2020.getEncodedSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); } } diff --git a/src/services/shims.ts b/src/services/shims.ts index 4c693e7ae4669..1cc174b757811 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -18,7 +18,7 @@ import { } from "../compiler/types"; import { extensionFromPath, getFileMatcherPatterns } from "../compiler/utilities"; import { createTextChangeRange, createTextSpan } from "../compiler/utilitiesPublic"; -import { JsTyping } from "../jsTyping/_namespaces/ts"; +import * as JsTyping from "../jsTyping/jsTyping"; import { createClassifier } from "./classifier"; import { createDocumentRegistry, DocumentRegistry } from "./documentRegistry"; import { preProcessFile } from "./preProcess"; diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 44721a379f141..013f4c577fdd1 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -1,4 +1,3 @@ -import { moduleSpecifiers } from "../compiler/_namespaces/ts"; import { signatureHasRestParameter } from "../compiler/checker"; import { compareStringsCaseSensitive, contains, createSortedArray, deduplicate, emptyArray, endsWith, @@ -14,6 +13,7 @@ import { import { getEffectiveTypeRoots, getPackageJsonTypesVersionsPaths, unmangleScopedPackageName, } from "../compiler/moduleNameResolver"; +import * as moduleSpecifiers from "../compiler/moduleSpecifiers"; import { altDirectorySeparator, combinePaths, comparePaths, containsPath, directorySeparator, ensureTrailingDirectorySeparator, fileExtensionIsOneOf, forEachAncestorDirectory, getBaseFileName, getDirectoryPath, diff --git a/src/services/types.ts b/src/services/types.ts index c308a203191a5..13b2ed05f5163 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -10,10 +10,10 @@ import { TextChangeRange, TextRange, TextSpan, UserPreferences, } from "../compiler/types"; import { SymlinkCache } from "../compiler/utilities"; -import { textChanges } from "./_namespaces/ts"; import { DocumentHighlights } from "./documentHighlights"; import { ExportInfoMap } from "./exportInfoMap"; import { SourceMapper } from "./sourcemaps"; +import * as textChanges from "./textChanges"; declare module "../compiler/types" { // Module transform: converted from interface augmentation diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 0a27ecaa54daa..023707102d293 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -81,13 +81,14 @@ import { textSpanContainsTextSpan, textSpanEnd, unescapeLeadingUnderscores, } from "../compiler/utilitiesPublic"; import { visitEachChild } from "../compiler/visitorPublic"; -import { JsTyping } from "../jsTyping/_namespaces/ts"; -import { formatting, textChanges } from "./_namespaces/ts"; +import * as JsTyping from "../jsTyping/jsTyping"; +import { formatting } from "./_namespaces/ts"; import { moduleSymbolToValidIdentifier } from "./codefixes/importFixes"; import { compareImportsOrRequireStatements, getImportDeclarationInsertionIndex, importsAreSorted, } from "./organizeImports"; import { DisplayPartsSymbolWriter } from "./services"; +import * as textChanges from "./textChanges"; import { DocumentSpan, FileTextChanges, FormatCodeSettings, FormattingHost, IScriptSnapshot, JSDocLinkDisplayPart, LanguageServiceHost, PackageJsonDependencyGroup, PackageJsonInfo, RefactorContext, ScriptElementKind, diff --git a/src/testRunner/_namespaces/FourSlash.ts b/src/testRunner/_namespaces/FourSlash.ts index b314d7d2e24bf..b81535c48ffd8 100644 --- a/src/testRunner/_namespaces/FourSlash.ts +++ b/src/testRunner/_namespaces/FourSlash.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the FourSlash namespace. */ export * from "../../harness/_namespaces/FourSlash"; -export * from "../fourslashRef"; diff --git a/src/testRunner/_namespaces/Playback.ts b/src/testRunner/_namespaces/Playback.ts index 756f8f0e4eddc..90e7eae5f16b9 100644 --- a/src/testRunner/_namespaces/Playback.ts +++ b/src/testRunner/_namespaces/Playback.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the Playback namespace. */ export * from "../../loggedIO/_namespaces/Playback"; -export * from "../playbackRef"; diff --git a/src/testRunner/_namespaces/Utils.ts b/src/testRunner/_namespaces/Utils.ts index 69e9f1e29d042..f7bd754263d74 100644 --- a/src/testRunner/_namespaces/Utils.ts +++ b/src/testRunner/_namespaces/Utils.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the Utils namespace. */ export * from "../../harness/_namespaces/Utils"; -export * from "../utilsRef"; diff --git a/src/testRunner/_namespaces/compiler.ts b/src/testRunner/_namespaces/compiler.ts index b0836c2749afc..62e194d59712a 100644 --- a/src/testRunner/_namespaces/compiler.ts +++ b/src/testRunner/_namespaces/compiler.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the compiler namespace. */ export * from "../../harness/_namespaces/compiler"; -export * from "../compilerRef"; diff --git a/src/testRunner/_namespaces/documents.ts b/src/testRunner/_namespaces/documents.ts index ceeb38f29c6b9..bf76b1332fc47 100644 --- a/src/testRunner/_namespaces/documents.ts +++ b/src/testRunner/_namespaces/documents.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the documents namespace. */ export * from "../../harness/_namespaces/documents"; -export * from "../documentsRef"; diff --git a/src/testRunner/_namespaces/evaluator.ts b/src/testRunner/_namespaces/evaluator.ts index 26676e38c3e55..9710863c9b2ec 100644 --- a/src/testRunner/_namespaces/evaluator.ts +++ b/src/testRunner/_namespaces/evaluator.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the evaluator namespace. */ export * from "../../harness/_namespaces/evaluator"; -export * from "../evaluatorRef"; diff --git a/src/testRunner/_namespaces/fakes.ts b/src/testRunner/_namespaces/fakes.ts index f783f8f72b1dc..1b6c51d409411 100644 --- a/src/testRunner/_namespaces/fakes.ts +++ b/src/testRunner/_namespaces/fakes.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the fakes namespace. */ export * from "../../harness/_namespaces/fakes"; -export * from "../fakesRef"; diff --git a/src/testRunner/_namespaces/vfs.ts b/src/testRunner/_namespaces/vfs.ts index 3a8b4f1e4acbe..5fe2e7d9362b5 100644 --- a/src/testRunner/_namespaces/vfs.ts +++ b/src/testRunner/_namespaces/vfs.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the vfs namespace. */ export * from "../../harness/_namespaces/vfs"; -export * from "../vfsRef"; diff --git a/src/testRunner/_namespaces/vpath.ts b/src/testRunner/_namespaces/vpath.ts index 4b1fd139b3b5a..9ae8ad3777f57 100644 --- a/src/testRunner/_namespaces/vpath.ts +++ b/src/testRunner/_namespaces/vpath.ts @@ -1,4 +1,3 @@ /* Generated file to emulate the vpath namespace. */ export * from "../../harness/_namespaces/vpath"; -export * from "../vpathRef"; diff --git a/src/testRunner/compilerRef.ts b/src/testRunner/compilerRef.ts deleted file mode 100644 index c524071b842bd..0000000000000 --- a/src/testRunner/compilerRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to compiler so it can be referenced by unittests -export { }; diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index 933d8cbbba501..90afe100b4930 100644 --- a/src/testRunner/compilerRunner.ts +++ b/src/testRunner/compilerRunner.ts @@ -6,9 +6,9 @@ import { CompilerOptions, Extension } from "../compiler/types"; import { CompilationResult } from "../harness/compilerImpl"; import { RunnerBase, TestRunnerKind } from "../harness/runnerbase"; import { removeTestPathPrefixes, sanitizeTraceResolutionLogEntry } from "../harness/util"; +import * as vpath from "../harness/vpathUtil"; import { cloneCompilerOptions } from "../services/utilities"; import * as Harness from "./_namespaces/Harness"; -import * as vpath from "./_namespaces/vpath"; export const enum CompilerTestType { Conformance, diff --git a/src/testRunner/documentsRef.ts b/src/testRunner/documentsRef.ts deleted file mode 100644 index e1abbfb2d9c6d..0000000000000 --- a/src/testRunner/documentsRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to documents so it can be referenced by unittests -export { }; diff --git a/src/testRunner/evaluatorRef.ts b/src/testRunner/evaluatorRef.ts deleted file mode 100644 index 965acc02d95be..0000000000000 --- a/src/testRunner/evaluatorRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to evaluator so it can be referenced by unittests -export { }; diff --git a/src/testRunner/fakesRef.ts b/src/testRunner/fakesRef.ts deleted file mode 100644 index ef7d690d5b64c..0000000000000 --- a/src/testRunner/fakesRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to fakes so it can be referenced by unittests -export { }; diff --git a/src/testRunner/fourslashRef.ts b/src/testRunner/fourslashRef.ts deleted file mode 100644 index 7436f5ad2d7a2..0000000000000 --- a/src/testRunner/fourslashRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to FourSlash so it can be referenced by unittests -export { }; diff --git a/src/testRunner/fourslashRunner.ts b/src/testRunner/fourslashRunner.ts index 37f8c466950a1..231eaa157263d 100644 --- a/src/testRunner/fourslashRunner.ts +++ b/src/testRunner/fourslashRunner.ts @@ -1,7 +1,7 @@ import { Debug } from "../compiler/debug"; import { normalizeSlashes } from "../compiler/path"; +import * as FourSlash from "../harness/fourslashImpl"; import { RunnerBase, TestRunnerKind } from "../harness/runnerbase"; -import * as FourSlash from "./_namespaces/FourSlash"; import * as Harness from "./_namespaces/Harness"; export class FourSlashRunner extends RunnerBase { diff --git a/src/testRunner/playbackRef.ts b/src/testRunner/playbackRef.ts deleted file mode 100644 index 9a46d5740c446..0000000000000 --- a/src/testRunner/playbackRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to Playback so it can be referenced by unittests -export { }; diff --git a/src/testRunner/projectsRunner.ts b/src/testRunner/projectsRunner.ts index 8d8eb9ef49cd8..c29a549dbb8a0 100644 --- a/src/testRunner/projectsRunner.ts +++ b/src/testRunner/projectsRunner.ts @@ -11,13 +11,13 @@ import { Program, SourceFile, SourceMapEmitResult, } from "../compiler/types"; import { removeFileExtension } from "../compiler/utilities"; +import * as documents from "../harness/documentsUtil"; +import * as fakes from "../harness/fakesHosts"; import { RunnerBase, shardId, shards, TestRunnerKind } from "../harness/runnerbase"; import { removeTestPathPrefixes } from "../harness/util"; -import * as documents from "./_namespaces/documents"; -import * as fakes from "./_namespaces/fakes"; +import * as vfs from "../harness/vfsUtil"; +import * as vpath from "../harness/vpathUtil"; import * as Harness from "./_namespaces/Harness"; -import * as vfs from "./_namespaces/vfs"; -import * as vpath from "./_namespaces/vpath"; // Test case is json of below type in tests/cases/project/ interface ProjectRunnerTestCase { diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index d1d9b7fe55f82..c021412adef2e 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -1,13 +1,13 @@ import { forEach, getUILocale, noop, setUILocale } from "../compiler/core"; import { Debug } from "../compiler/debug"; +import * as FourSlash from "../harness/fourslashImpl"; import { RunnerBase, setShardId, setShards, TestRunnerKind } from "../harness/runnerbase"; -import * as FourSlash from "./_namespaces/FourSlash"; +import * as vpath from "../harness/vpathUtil"; import * as Harness from "./_namespaces/Harness"; -import { Host } from "./_namespaces/Harness.Parallel"; -import * as vpath from "./_namespaces/vpath"; import { CompilerBaselineRunner, CompilerTestType } from "./compilerRunner"; import { DefinitelyTypedRunner, DockerfileRunner, UserCodeRunner } from "./externalCompileRunner"; import { FourSlashRunner, GeneratedFourslashRunner } from "./fourslashRunner"; +import * as Host from "./parallel/host"; import { start } from "./parallel/worker"; import { ProjectRunner } from "./projectsRunner"; import { RWCRunner } from "./rwcRunner"; diff --git a/src/testRunner/rwcRunner.ts b/src/testRunner/rwcRunner.ts index f405724a6c076..c12093407b167 100644 --- a/src/testRunner/rwcRunner.ts +++ b/src/testRunner/rwcRunner.ts @@ -8,9 +8,9 @@ import { getBaseFileName, getDirectoryPath, normalizeSlashes } from "../compiler import { CompilerOptions, ParseConfigHost, ParsedCommandLine } from "../compiler/types"; import { CompilationResult } from "../harness/compilerImpl"; import { RunnerBase, TestRunnerKind } from "../harness/runnerbase"; +import * as vpath from "../harness/vpathUtil"; import { IoLog, newStyleLogIntoOldStyleLog, wrapIO } from "../loggedIO/loggedIO"; import * as Harness from "./_namespaces/Harness"; -import * as vpath from "./_namespaces/vpath"; // In harness baselines, null is different than undefined. See `generateActual` in `harness.ts`. function runWithIOLog(ioLog: IoLog, fn: (oldIO: Harness.IO) => void) { diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index c0e652fdbd2a9..d7b9d0ebc2b2a 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -27,16 +27,6 @@ ], "files": [ - "compilerRef.ts", - "evaluatorRef.ts", - "fakesRef.ts", - "vpathRef.ts", - "vfsRef.ts", - "fourslashRef.ts", - "playbackRef.ts", - "utilsRef.ts", - "documentsRef.ts", - "fourslashRunner.ts", "compilerRunner.ts", "projectsRunner.ts", diff --git a/src/testRunner/unittests/config/configurationExtension.ts b/src/testRunner/unittests/config/configurationExtension.ts index be5ab1faffb7d..fd2fc5443a192 100644 --- a/src/testRunner/unittests/config/configurationExtension.ts +++ b/src/testRunner/unittests/config/configurationExtension.ts @@ -5,8 +5,8 @@ import { forEach } from "../../../compiler/core"; import { combinePaths } from "../../../compiler/path"; import { flattenDiagnosticMessageText } from "../../../compiler/program"; import { CompilerOptions, Diagnostic, DiagnosticCategory, ModuleKind } from "../../../compiler/types"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; function createFileSystem(ignoreCase: boolean, cwd: string, root: string) { return new vfs.FileSystem(ignoreCase, { diff --git a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts index 2f36f1f57d46c..9a012ca2ba5dc 100644 --- a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts +++ b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts @@ -6,8 +6,8 @@ import { Diagnostics } from "../../../compiler/diagnosticInformationMap.generate import { parseJsonText } from "../../../compiler/parser"; import { formatDiagnostic, FormatDiagnosticsHost } from "../../../compiler/program"; import { CompilerOptions, Diagnostic, ModuleKind, ParseConfigHost, ScriptTarget } from "../../../compiler/types"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; describe("unittests:: config:: convertCompilerOptionsFromJson", () => { const formatDiagnosticHost: FormatDiagnosticsHost = { diff --git a/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts b/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts index 41fc01bf3507d..b2250c30497d1 100644 --- a/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts +++ b/src/testRunner/unittests/config/convertTypeAcquisitionFromJson.ts @@ -5,8 +5,8 @@ import { filter } from "../../../compiler/core"; import { Diagnostics } from "../../../compiler/diagnosticInformationMap.generated"; import { parseJsonText } from "../../../compiler/parser"; import { Diagnostic, ParseConfigHost, TypeAcquisition } from "../../../compiler/types"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; interface ExpectedResult { typeAcquisition: TypeAcquisition; errors: Diagnostic[]; } describe("unittests:: config:: convertTypeAcquisitionFromJson", () => { diff --git a/src/testRunner/unittests/config/matchFiles.ts b/src/testRunner/unittests/config/matchFiles.ts index be0dd02c20fad..1ded49c4b77db 100644 --- a/src/testRunner/unittests/config/matchFiles.ts +++ b/src/testRunner/unittests/config/matchFiles.ts @@ -6,8 +6,8 @@ import { SyntaxKind, WatchDirectoryFlags, } from "../../../compiler/types"; import { createCompilerDiagnostic, createFileDiagnostic } from "../../../compiler/utilities"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; const caseInsensitiveBasePath = "c:/dev/"; const caseInsensitiveTsconfigPath = "c:/dev/tsconfig.json"; diff --git a/src/testRunner/unittests/config/projectReferences.ts b/src/testRunner/unittests/config/projectReferences.ts index 9633c72ef7413..ef9d2223bc81d 100644 --- a/src/testRunner/unittests/config/projectReferences.ts +++ b/src/testRunner/unittests/config/projectReferences.ts @@ -6,9 +6,9 @@ import { createProgram, flattenDiagnosticMessageText, parseConfigHostFromCompilerHostLike, } from "../../../compiler/program"; import { CompilerOptions, Diagnostic, DiagnosticMessage, Program, ProjectReference } from "../../../compiler/types"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; import { libFile } from "../../../harness/virtualFileSystemWithWatch"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; interface TestProjectSpecification { configFileName?: string; diff --git a/src/testRunner/unittests/config/tsconfigParsing.ts b/src/testRunner/unittests/config/tsconfigParsing.ts index b91013affad83..b2cbfd4223827 100644 --- a/src/testRunner/unittests/config/tsconfigParsing.ts +++ b/src/testRunner/unittests/config/tsconfigParsing.ts @@ -7,8 +7,8 @@ import { parseJsonText } from "../../../compiler/parser"; import { sys } from "../../../compiler/sys"; import { Diagnostic, ParseConfigHost, WatchDirectoryFlags } from "../../../compiler/types"; import { createCompilerDiagnostic } from "../../../compiler/utilities"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () => { function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic[] }) { diff --git a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts index 98e900acd53ec..55556ad0ce170 100644 --- a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts +++ b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts @@ -5,8 +5,8 @@ import { parseJsonText } from "../../../compiler/parser"; import { Diagnostic, PollingWatchKind, SourceFile, WatchDirectoryKind, WatchFileKind, WatchOptions, } from "../../../compiler/types"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileTextToJson", () => { function createParseConfigHost(additionalFiles?: vfs.FileSet) { diff --git a/src/testRunner/unittests/printer.ts b/src/testRunner/unittests/printer.ts index aaa9b4e62b207..8b64db486a244 100644 --- a/src/testRunner/unittests/printer.ts +++ b/src/testRunner/unittests/printer.ts @@ -8,9 +8,9 @@ import { Bundle, EmitFlags, EmitHint, NewLineKind, NodeFlags, Printer, PrinterOptions, ScriptKind, ScriptTarget, SourceFile, SyntaxKind, } from "../../compiler/types"; -import * as fakes from "../_namespaces/fakes"; +import * as fakes from "../../harness/fakesHosts"; +import * as vfs from "../../harness/vfsUtil"; import * as Harness from "../_namespaces/Harness"; -import * as vfs from "../_namespaces/vfs"; describe("unittests:: PrinterAPI", () => { function makePrintsCorrectly(prefix: string) { diff --git a/src/testRunner/unittests/programApi.ts b/src/testRunner/unittests/programApi.ts index 7de8e431d189c..c35e57f76596e 100644 --- a/src/testRunner/unittests/programApi.ts +++ b/src/testRunner/unittests/programApi.ts @@ -7,11 +7,11 @@ import { AsExpression, CompilerHost, CompilerOptions, ExpressionStatement, ImportDeclaration, ModuleKind, NewLineKind, Path, Program, ScriptKind, ScriptTarget, } from "../../compiler/types"; +import * as documents from "../../harness/documentsUtil"; +import * as fakes from "../../harness/fakesHosts"; +import * as vfs from "../../harness/vfsUtil"; import { emptyOptions } from "../../services/types"; -import * as documents from "../_namespaces/documents"; -import * as fakes from "../_namespaces/fakes"; import * as Harness from "../_namespaces/Harness"; -import * as vfs from "../_namespaces/vfs"; function verifyMissingFilePaths(missingPaths: readonly Path[], expected: readonly string[]) { assert.isDefined(missingPaths); diff --git a/src/testRunner/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts index 6b3116f59880f..352c14a0bd908 100644 --- a/src/testRunner/unittests/publicApi.ts +++ b/src/testRunner/unittests/publicApi.ts @@ -12,11 +12,11 @@ import { getJSDocTags, isPropertyName, supportedLocaleDirectories, validateLocaleAndSetLanguage, } from "../../compiler/utilitiesPublic"; import { compileFiles } from "../../harness/compilerImpl"; +import * as documents from "../../harness/documentsUtil"; +import * as fakes from "../../harness/fakesHosts"; +import * as vfs from "../../harness/vfsUtil"; import { getDefaultCompilerOptions } from "../../services/services"; -import * as documents from "../_namespaces/documents"; -import * as fakes from "../_namespaces/fakes"; import * as Harness from "../_namespaces/Harness"; -import * as vfs from "../_namespaces/vfs"; describe("unittests:: Public APIs", () => { function verifyApi(fileName: string) { diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index 61a1a513e88ef..4c259e0995c1e 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -19,7 +19,7 @@ import { createWatchCompilerHostOfConfigFile, createWatchCompilerHostOfFilesAndCompilerOptions, parseConfigFileWithSystem, } from "../../compiler/watch"; import { createWatchProgram } from "../../compiler/watchPublic"; -import { TestFSWithWatch } from "../../harness/_namespaces/ts"; +import * as TestFSWithWatch from "../../harness/virtualFileSystemWithWatch"; import { createWatchedSystem as createTestSystem, libFile } from "../../harness/virtualFileSystemWithWatch"; import { IScriptSnapshot } from "../../services/types"; import { checkResolvedModule, createResolvedModule } from "./moduleResolution"; diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index d1a3d33039985..8680dcc467139 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -3,9 +3,9 @@ import { Debug } from "../../../compiler/debug"; import { Diagnostics } from "../../../compiler/diagnosticInformationMap.generated"; import { Extension, Program } from "../../../compiler/types"; import { File } from "../../../harness/virtualFileSystemWithWatch"; -import { textChanges } from "../../../services/_namespaces/ts"; import { getFixes } from "../../../services/codeFixProvider"; import { getFormatContext } from "../../../services/formatting/rulesMap"; +import * as textChanges from "../../../services/textChanges"; import { CodeFixContext, emptyOptions, testFormatSettings } from "../../../services/types"; import * as Harness from "../../_namespaces/Harness"; import { createProjectService, createServerHost } from "../tsserver/helpers"; diff --git a/src/testRunner/unittests/services/extract/helpers.ts b/src/testRunner/unittests/services/extract/helpers.ts index 78cd501d95783..589aef71d2671 100644 --- a/src/testRunner/unittests/services/extract/helpers.ts +++ b/src/testRunner/unittests/services/extract/helpers.ts @@ -2,11 +2,11 @@ import { find, hasProperty, length, noop, notImplemented, returnFalse } from ".. import { ESMap, Map } from "../../../../compiler/corePublic"; import { isIdentifierPart } from "../../../../compiler/scanner"; import { CharacterCodes, DiagnosticMessage, Extension, Program, ScriptTarget } from "../../../../compiler/types"; -import { textChanges } from "../../../../services/_namespaces/ts"; import { getFormatContext } from "../../../../services/formatting/rulesMap"; import { getRangeToExtract, getRefactorActionsToExtractSymbol, getRefactorEditsToExtractSymbol, } from "../../../../services/refactors/extractSymbol"; +import * as textChanges from "../../../../services/textChanges"; import { emptyOptions, LanguageServiceHost, RefactorContext, testFormatSettings } from "../../../../services/types"; import { createTextSpanFromRange } from "../../../../services/utilities"; import * as Harness from "../../../_namespaces/Harness"; diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 25161910776eb..121df5c1de97b 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -7,8 +7,8 @@ import { LiteralLikeNode, NamedExports, NamedImports, NamespaceImport, Node, ScriptKind, ScriptTarget, SyntaxKind, } from "../../../compiler/types"; import { File } from "../../../harness/virtualFileSystemWithWatch"; -import { textChanges } from "../../../services/_namespaces/ts"; import { coalesceExports, coalesceImports, compareModuleSpecifiers } from "../../../services/organizeImports"; +import * as textChanges from "../../../services/textChanges"; import { emptyOptions, testFormatSettings } from "../../../services/types"; import * as Harness from "../../_namespaces/Harness"; import { createProjectService, createServerHost } from "../tsserver/helpers"; diff --git a/src/testRunner/unittests/services/textChanges.ts b/src/testRunner/unittests/services/textChanges.ts index 95a6f5ffa5702..33915fae23bc1 100644 --- a/src/testRunner/unittests/services/textChanges.ts +++ b/src/testRunner/unittests/services/textChanges.ts @@ -11,14 +11,16 @@ import { } from "../../../compiler/types"; import { getNewLineCharacter } from "../../../compiler/utilities"; import { isDeclaration } from "../../../compiler/utilitiesPublic"; -import { formatting, textChanges } from "../../../services/_namespaces/ts"; +import * as formatting from "../../../services/_namespaces/ts.formatting"; import { getFormatContext } from "../../../services/formatting/rulesMap"; +import * as textChanges from "../../../services/textChanges"; import { testFormatSettings } from "../../../services/types"; import * as Harness from "../../_namespaces/Harness"; import { notImplementedHost } from "./extract/helpers"; // Some tests have trailing whitespace + describe("unittests:: services:: textChanges", () => { function findChild(name: string, n: Node) { return find(n)!; diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index 0804d2f27a1ed..8f5dfedfc93aa 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -18,13 +18,13 @@ import { } from "../../compiler/types"; import { isClassLike, isParameterPropertyDeclaration } from "../../compiler/utilitiesPublic"; import { visitEachChild, visitNode } from "../../compiler/visitorPublic"; +import * as documents from "../../harness/documentsUtil"; import { evaluateJavaScript } from "../../harness/evaluatorImpl"; +import * as fakes from "../../harness/fakesHosts"; +import * as vfs from "../../harness/vfsUtil"; import { transform } from "../../services/transform"; import { transpileModule, TranspileOptions } from "../../services/transpile"; -import * as documents from "../_namespaces/documents"; -import * as fakes from "../_namespaces/fakes"; import * as Harness from "../_namespaces/Harness"; -import * as vfs from "../_namespaces/vfs"; describe("unittests:: TransformAPI", () => { function replaceUndefinedWithVoid0(context: TransformationContext) { diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 8b838047ae739..890c02a7ec0ce 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -1,5 +1,5 @@ import { emptyArray } from "../../../compiler/core"; -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { verifyTsc } from "../tsc/helpers"; import { addRest, addShebang, addSpread, addTestPrologue, addTripleSlashRef, appendText, enableStrict, loadProjectFromDisk, diff --git a/src/testRunner/unittests/tsbuild/declarationEmit.ts b/src/testRunner/unittests/tsbuild/declarationEmit.ts index 46d812a77ecac..57cb0e0ab7cbd 100644 --- a/src/testRunner/unittests/tsbuild/declarationEmit.ts +++ b/src/testRunner/unittests/tsbuild/declarationEmit.ts @@ -1,5 +1,5 @@ import { dedent } from "../../../harness/util"; -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { verifyTsc } from "../tsc/helpers"; import { loadProjectFromFiles } from "./helpers"; diff --git a/src/testRunner/unittests/tsbuild/demo.ts b/src/testRunner/unittests/tsbuild/demo.ts index 1e1e0c0ed5c05..510b49aaf04ac 100644 --- a/src/testRunner/unittests/tsbuild/demo.ts +++ b/src/testRunner/unittests/tsbuild/demo.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { verifyTsc } from "../tsc/helpers"; import { loadProjectFromDisk, prependText, replaceText } from "./helpers"; diff --git a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts index 46fcfd2e2e767..b4c963037626f 100644 --- a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts +++ b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { loadProjectFromDisk, replaceText, verifyTscWithEdits } from "./helpers"; describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index c740cdf7414f7..a2875b40b15ad 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { verifyTsc } from "../tsc/helpers"; import { loadProjectFromDisk } from "./helpers"; diff --git a/src/testRunner/unittests/tsbuild/graphOrdering.ts b/src/testRunner/unittests/tsbuild/graphOrdering.ts index c7fca754d2221..878328202b9db 100644 --- a/src/testRunner/unittests/tsbuild/graphOrdering.ts +++ b/src/testRunner/unittests/tsbuild/graphOrdering.ts @@ -2,8 +2,8 @@ import { createSolutionBuilder, getBuildOrderFromAnyBuildOrder, isCircularBuildOrder, } from "../../../compiler/tsbuildPublic"; import { ResolvedConfigFileName } from "../../../compiler/types"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; describe("unittests:: tsbuild - graph-ordering", () => { let host: fakes.SolutionBuilderHost | undefined; diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 2c5480b2b5454..0e7464f144af1 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -20,13 +20,13 @@ import { } from "../../../compiler/types"; import { outFile } from "../../../compiler/utilities"; import { isBuild } from "../../../executeCommandLine/executeCommandLine"; +import * as fakes from "../../../harness/fakesHosts"; import { getSourceMapRecordWithSystem } from "../../../harness/sourceMapRecorder"; +import * as vfs from "../../../harness/vfsUtil"; import { libFile } from "../../../harness/virtualFileSystemWithWatch"; -import * as fakes from "../../_namespaces/fakes"; +import * as vpath from "../../../harness/vpathUtil"; import * as Harness from "../../_namespaces/Harness"; import * as ts from "../../_namespaces/ts"; -import * as vfs from "../../_namespaces/vfs"; -import * as vpath from "../../_namespaces/vpath"; import { testTscCompile, TestTscCompile, TscCompileSystem, verifyTscBaseline } from "../tsc/helpers"; import { WatchedSystem } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 993f6f492ba8a..0a66eda3916c0 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { appendText, loadProjectFromDisk, replaceText, verifyTscWithEdits } from "./helpers"; describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => { diff --git a/src/testRunner/unittests/tsbuild/noEmitOnError.ts b/src/testRunner/unittests/tsbuild/noEmitOnError.ts index 54a8ee9b57715..2bdf920272861 100644 --- a/src/testRunner/unittests/tsbuild/noEmitOnError.ts +++ b/src/testRunner/unittests/tsbuild/noEmitOnError.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { noChangeRun, noChangeWithExportsDiscrepancyRun } from "../tsc/helpers"; import { loadProjectFromDisk, verifyTscWithEdits } from "./helpers"; diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 84dbe1e5b6af9..0fe584273f125 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -1,6 +1,6 @@ import { createSolutionBuilder } from "../../../compiler/tsbuildPublic"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; import { createSolutionBuilderHostForBaseline, noChangeOnlyRuns, testTscCompileLike, TscCompileSystem, verifyTsc, verifyTscCompileLike, diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index 9c8c427c5fea9..4c74f08cd2eea 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -1,7 +1,7 @@ import { noop } from "../../../compiler/core"; import { getOutputFileNames } from "../../../compiler/emitter"; import { parseConfigFileWithSystem } from "../../../compiler/watch"; -import * as fakes from "../../_namespaces/fakes"; +import * as fakes from "../../../harness/fakesHosts"; import { noChangeRun, TscCompileSystem } from "../tsc/helpers"; import { loadProjectFromFiles, TestTscEdit, verifyTscWithEdits, VerifyTscWithEditsInput } from "./helpers"; diff --git a/src/testRunner/unittests/tsbuild/publicApi.ts b/src/testRunner/unittests/tsbuild/publicApi.ts index 9257772adef14..a993634789e7c 100644 --- a/src/testRunner/unittests/tsbuild/publicApi.ts +++ b/src/testRunner/unittests/tsbuild/publicApi.ts @@ -10,10 +10,10 @@ import { } from "../../../compiler/types"; import { visitEachChild } from "../../../compiler/visitorPublic"; import { createDiagnosticReporter, getErrorSummaryText } from "../../../compiler/watch"; -import * as fakes from "../../_namespaces/fakes"; -import * as vfs from "../../_namespaces/vfs"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; import { commandLineCallbacks, TscCompileSystem, verifyTscBaseline } from "../tsc/helpers"; -import { baselinePrograms } from "../tscWatch/helpers"; +import { baselineAllPrograms } from "../tscWatch/helpers"; import { loadProjectFromFiles, toPathWithSystem } from "./helpers"; describe("unittests:: tsbuild:: Public API with custom transformers when passed to build", () => { @@ -78,7 +78,7 @@ export function f22() { } // trailing`, sys.exit(exitStatus); sys.write(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}\n`); const baseline: string[] = []; - baselinePrograms(baseline, getPrograms, emptyArray, /*baselineDependencies*/ false); + baselineAllPrograms(baseline, getPrograms, emptyArray, /*baselineDependencies*/ false); sys.write(baseline.join("\n")); fs.makeReadonly(); sys.baseLine = () => { diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index fb98b55a4cb56..5f9c27e2d7177 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { verifyTsc } from "../tsc/helpers"; import { loadProjectFromDisk, replaceText } from "./helpers"; diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 199155b625e4d..caad7eaca929f 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { noChangeOnlyRuns, verifyTsc } from "../tsc/helpers"; import { loadProjectFromDisk, replaceText, verifyTscWithEdits } from "./helpers"; diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 072ada266e037..86c06e08b0fe3 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -1,12 +1,12 @@ import { createAbstractBuilder } from "../../../compiler/builderPublic"; import { UpToDateStatusType } from "../../../compiler/tsbuild"; import { createSolutionBuilder, ResolvedConfigFilePath } from "../../../compiler/tsbuildPublic"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; import { changeToHostTrackingWrittenFiles, getTsBuildProjectFilePath, TestServerHost, } from "../../../harness/virtualFileSystemWithWatch"; -import * as fakes from "../../_namespaces/fakes"; import * as Harness from "../../_namespaces/Harness"; -import * as vfs from "../../_namespaces/vfs"; import { createSolutionBuilderHostForBaseline, noChangeOnlyRuns, noChangeRun, testTscCompileLike, TscCompileSystem, verifyTsc, verifyTscCompileLike, diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index 5af256598159c..7d18eb4305b1d 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -1,4 +1,4 @@ -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { verifyTsc } from "../tsc/helpers"; import { loadProjectFromDisk } from "./helpers"; diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 69b901e5dd20d..078c301610af5 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -9,12 +9,11 @@ import { createDiagnosticReporter, isBuilderProgram } from "../../../compiler/wa import { executeCommandLine, ExecuteCommandLineCallbacks, isBuild, } from "../../../executeCommandLine/executeCommandLine"; -import * as fakes from "../../_namespaces/fakes"; +import * as fakes from "../../../harness/fakesHosts"; +import * as vfs from "../../../harness/vfsUtil"; import * as Harness from "../../_namespaces/Harness"; -import { tscWatch } from "../../_namespaces/ts"; -import * as vfs from "../../_namespaces/vfs"; import { baselineBuildInfo, generateSourceMapBaselineFiles, TestTscEdit, toPathWithSystem } from "../tsbuild/helpers"; -import { WatchedSystem } from "../tscWatch/helpers"; +import { baselineAllPrograms, WatchedSystem } from "../tscWatch/helpers"; export type TscCompileSystem = fakes.System & { writtenFiles: Set; @@ -210,7 +209,7 @@ export function testTscCompile(input: TestTscCompile) { const { baselineSourceMap, baselineReadFileCalls, baselinePrograms, baselineDependencies } = input; if (baselinePrograms) { const baseline: string[] = []; - tscWatch.baselinePrograms(baseline, getPrograms!, emptyArray, baselineDependencies); + baselineAllPrograms(baseline, getPrograms!, emptyArray, baselineDependencies); sys.write(baseline.join("\n")); } if (baselineReadFileCalls) { diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 3235a22eaf6d6..94af3b4231a49 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -2,7 +2,7 @@ import { hasProperty } from "../../../compiler/core"; import { CompilerOptions } from "../../../compiler/types"; import { getEmitDeclarations } from "../../../compiler/utilities"; import { dedent } from "../../../harness/util"; -import * as vfs from "../../_namespaces/vfs"; +import * as vfs from "../../../harness/vfsUtil"; import { appendText, libContent, loadProjectFromDisk, loadProjectFromFiles, prependText, replaceText, TestTscEdit, verifyTscWithEdits, diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index c61098889d0e7..454b7d900884c 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -20,14 +20,14 @@ import { WatchCompilerHost, WatchOfConfigFile, WatchOfFilesAndCompilerOptions } import { executeCommandLine, ExecuteCommandLineCallbacks, isBuild, } from "../../../executeCommandLine/executeCommandLine"; -import { TestFSWithWatch } from "../../../harness/_namespaces/ts"; +import * as fakes from "../../../harness/fakesHosts"; +import * as TestFSWithWatch from "../../../harness/virtualFileSystemWithWatch"; import { changeToHostTrackingWrittenFiles, checkArray, checkOutputContains, checkOutputDoesNotContain, checkWatchedDirectories, checkWatchedDirectoriesDetailed, checkWatchedFiles, checkWatchedFilesDetailed, createWatchedSystem, FileOrFolderOrSymLink, libFile, TestServerHost as WatchedSystem, TestServerHostCreationParameters, TestServerHostTrackingWrittenFiles, } from "../../../harness/virtualFileSystemWithWatch"; -import * as fakes from "../../_namespaces/fakes"; import * as Harness from "../../_namespaces/Harness"; import * as ts from "../../_namespaces/ts"; import { generateSourceMapBaselineFiles } from "../tsbuild/helpers"; @@ -335,7 +335,7 @@ export interface WatchBaseline extends BaselineBase, TscWatchCheckOptions { export function watchBaseline({ baseline, getPrograms, oldPrograms, sys, oldSnap, baselineSourceMap, baselineDependencies }: WatchBaseline) { if (baselineSourceMap) generateSourceMapBaselineFiles(sys); sys.serializeOutput(baseline); - const programs = baselinePrograms(baseline, getPrograms, oldPrograms, baselineDependencies); + const programs = baselineAllPrograms(baseline, getPrograms, oldPrograms, baselineDependencies); sys.serializeWatches(baseline); baseline.push(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}`, ""); sys.diff(baseline, oldSnap); @@ -346,7 +346,7 @@ export function watchBaseline({ baseline, getPrograms, oldPrograms, sys, oldSnap return programs; } -export function baselinePrograms(baseline: string[], getPrograms: () => readonly CommandLineProgram[], oldPrograms: readonly (CommandLineProgram | undefined)[], baselineDependencies: boolean | undefined) { +export function baselineAllPrograms(baseline: string[], getPrograms: () => readonly CommandLineProgram[], oldPrograms: readonly (CommandLineProgram | undefined)[], baselineDependencies: boolean | undefined) { const programs = getPrograms(); for (let i = 0; i < programs.length; i++) { baselineProgram(baseline, programs[i], oldPrograms[i], baselineDependencies); diff --git a/src/testRunner/unittests/tsserver/cancellationToken.ts b/src/testRunner/unittests/tsserver/cancellationToken.ts index 996c51151023f..3f746f8468233 100644 --- a/src/testRunner/unittests/tsserver/cancellationToken.ts +++ b/src/testRunner/unittests/tsserver/cancellationToken.ts @@ -1,7 +1,7 @@ import { AnyFunction, noop } from "../../../compiler/core"; import { OperationCanceledException } from "../../../compiler/types"; import { extractMessage } from "../../../harness/client"; -import { protocol } from "../../../server/_namespaces/ts.server"; +import * as protocol from "../../../server/protocol"; import { ServerCancellationToken } from "../../../server/session"; import { projectSystem } from "../../_namespaces/ts"; import { createServerHost, createSession, TestServerCancellationToken } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index 05863a3172313..a373c8de14c6f 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -2,7 +2,7 @@ import { arrayIsEqualTo, compareStringsCaseSensitive, emptyArray, map, stringCon import { Diagnostics } from "../../../compiler/diagnosticInformationMap.generated"; import { CompilerOptions, diagnosticCategoryName, Extension } from "../../../compiler/types"; import { changeExtension, formatStringFromArgs } from "../../../compiler/utilities"; -import { protocol } from "../../../server/_namespaces/ts.server"; +import * as protocol from "../../../server/protocol"; import { CommandNames, Session } from "../../../server/session"; import { ServerHost } from "../../../server/types"; import { projectSystem } from "../../_namespaces/ts"; diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 89793c060b93e..4a5a425aff700 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -18,12 +18,12 @@ import { createServerHost, libFile, safeList, TestServerHost, } from "../../../harness/virtualFileSystemWithWatch"; import { InvalidateCachedTypings, SetTypings } from "../../../jsTyping/types"; -import { protocol } from "../../../server/_namespaces/ts.server"; import { FileStats, OpenFileInfo, OpenFileInfoTelemetryEvent, OpenFileInfoTelemetryEventData, ProjectInfoTelemetryEvent, ProjectInfoTelemetryEventData, ProjectService, ProjectServiceEvent, ProjectServiceOptions, } from "../../../server/editorServices"; import { Project, ProjectKind } from "../../../server/project"; +import * as protocol from "../../../server/protocol"; import { CommandNames, nullCancellationToken, ServerCancellationToken, Session, SessionOptions, toEvent, } from "../../../server/session"; diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index dae82b946006c..fe5c20e6ec434 100644 --- a/src/testRunner/unittests/tsserver/inferredProjects.ts +++ b/src/testRunner/unittests/tsserver/inferredProjects.ts @@ -1,8 +1,8 @@ import { Map } from "../../../compiler/corePublic"; import { combinePaths } from "../../../compiler/path"; import { ModuleResolutionKind, ScriptKind, ScriptTarget } from "../../../compiler/types"; -import { protocol } from "../../../server/_namespaces/ts.server"; import { InferredProject } from "../../../server/project"; +import * as protocol from "../../../server/protocol"; import { projectRoot } from "../tscWatch/helpers"; import { checkArray, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, checkNumberOfProjects, diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 8d07f64aae179..f9ed0d0b4aeab 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -3,8 +3,8 @@ import { Diagnostics } from "../../../compiler/diagnosticInformationMap.generate import { getBaseFileName } from "../../../compiler/path"; import { flattenDiagnosticMessageText } from "../../../compiler/program"; import { Diagnostic, ModuleKind } from "../../../compiler/types"; -import { protocol } from "../../../server/_namespaces/ts.server"; import { ProjectFilesWithTSDiagnostics } from "../../../server/project"; +import * as protocol from "../../../server/protocol"; import { CommandNames } from "../../../server/session"; import { projectSystem } from "../../_namespaces/ts"; import { projectRoot } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index c0728a7189dbd..8d995e73e78fa 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -5,7 +5,7 @@ import { Debug } from "../../../compiler/debug"; import { combinePaths, getDirectoryPath, normalizePath } from "../../../compiler/path"; import { Path, ScriptKind, ScriptTarget } from "../../../compiler/types"; import { createTextSpan } from "../../../compiler/utilitiesPublic"; -import { protocol } from "../../../server/_namespaces/ts.server"; +import * as protocol from "../../../server/protocol"; import { CommandNames } from "../../../server/session"; import { ITypingsInstaller } from "../../../server/typingsCache"; import { diff --git a/src/testRunner/unittests/tsserver/refactors.ts b/src/testRunner/unittests/tsserver/refactors.ts index 12d8b4f95dbd5..1ab816eeebd5b 100644 --- a/src/testRunner/unittests/tsserver/refactors.ts +++ b/src/testRunner/unittests/tsserver/refactors.ts @@ -1,4 +1,4 @@ -import { protocol } from "../../../server/_namespaces/ts.server"; +import * as protocol from "../../../server/protocol"; import { projectSystem } from "../../_namespaces/ts"; import { createServerHost, createSession, executeSessionRequest, File, openFilesForSession } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/reload.ts b/src/testRunner/unittests/tsserver/reload.ts index 64a468cda7460..e1d988ff9b962 100644 --- a/src/testRunner/unittests/tsserver/reload.ts +++ b/src/testRunner/unittests/tsserver/reload.ts @@ -1,4 +1,4 @@ -import { protocol } from "../../../server/_namespaces/ts.server"; +import * as protocol from "../../../server/protocol"; import { getSnapshotText } from "../../../services/utilities"; import { checkNumberOfProjects, createServerHost, createSession, libFile } from "./helpers"; diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 6161da3c7af00..dcd8c9fc967f3 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -4,7 +4,7 @@ import { Debug } from "../../../compiler/debug"; import { combinePaths, forEachAncestorDirectory, getDirectoryPath, normalizePath } from "../../../compiler/path"; import { ModuleResolutionHost, ScriptKind } from "../../../compiler/types"; import { removeFileExtension } from "../../../compiler/utilities"; -import { protocol } from "../../../server/_namespaces/ts.server"; +import * as protocol from "../../../server/protocol"; import { CommandNames } from "../../../server/session"; import { projectSystem } from "../../_namespaces/ts"; import { projectRoot } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 95cf0a202ad8d..9c7bef4fa8ab7 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -8,8 +8,8 @@ import { CompilerOptions, JsxEmit, ModuleKind, ModuleResolutionKind, NewLineKind, ScriptTarget, } from "../../../compiler/types"; import { byteLength } from "../../../harness/harnessUtils"; -import { protocol } from "../../../server/_namespaces/ts.server"; import { ProjectService } from "../../../server/editorServices"; +import * as protocol from "../../../server/protocol"; import { CommandNames, getLocationInNewDocument, HandlerResponse, nullCancellationToken, Session, SessionOptions, } from "../../../server/session"; diff --git a/src/testRunner/unittests/tsserver/syntacticServer.ts b/src/testRunner/unittests/tsserver/syntacticServer.ts index f09e3b5f37ab7..085e58b6f6e1a 100644 --- a/src/testRunner/unittests/tsserver/syntacticServer.ts +++ b/src/testRunner/unittests/tsserver/syntacticServer.ts @@ -1,5 +1,5 @@ import { emptyArray } from "../../../compiler/core"; -import { protocol } from "../../../server/_namespaces/ts.server"; +import * as protocol from "../../../server/protocol"; import { projectSystem } from "../../_namespaces/ts"; import { projectRoot } from "../tscWatch/helpers"; import { diff --git a/src/testRunner/unittests/tsserver/telemetry.ts b/src/testRunner/unittests/tsserver/telemetry.ts index 2adb39d2010c5..6438df4d1f825 100644 --- a/src/testRunner/unittests/tsserver/telemetry.ts +++ b/src/testRunner/unittests/tsserver/telemetry.ts @@ -1,9 +1,9 @@ import { isString } from "../../../compiler/core"; import { CompilerOptions } from "../../../compiler/types"; -import { protocol } from "../../../server/_namespaces/ts.server"; import { maxProgramSizeForNonTsFiles, ProjectInfoTelemetryEvent, ProjectLanguageServiceStateEvent, } from "../../../server/editorServices"; +import * as protocol from "../../../server/protocol"; import { checkNumberOfProjects, File, fileStats, TestServerEventManager, toExternalFiles } from "./helpers"; describe("unittests:: tsserver:: project telemetry", () => { diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index b139f2a600a53..dc53a54bd4422 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -5,13 +5,13 @@ import { Version } from "../../../compiler/semver"; import { JsxEmit, ModuleKind, ModuleResolutionKind, Path, ScriptKind, ScriptTarget, TypeAcquisition, } from "../../../compiler/types"; -import { TestFSWithWatch } from "../../../harness/_namespaces/ts"; -import { JsTyping } from "../../../jsTyping/_namespaces/ts"; +import * as TestFSWithWatch from "../../../harness/virtualFileSystemWithWatch"; +import * as JsTyping from "../../../jsTyping/jsTyping"; import { EventBeginInstallTypes, EventEndInstallTypes } from "../../../jsTyping/shared"; import { BeginInstallTypes, EndInstallTypes, InvalidateCachedTypings, SetTypings } from "../../../jsTyping/types"; -import { protocol } from "../../../server/_namespaces/ts.server"; import { updateProjectIfDirty } from "../../../server/editorServices"; import { Project } from "../../../server/project"; +import * as protocol from "../../../server/protocol"; import { ServerHost } from "../../../server/types"; import { getNpmCommandForInstallation, installNpmPackages, Log, RequestCompletedAction, typingsName, diff --git a/src/testRunner/utilsRef.ts b/src/testRunner/utilsRef.ts deleted file mode 100644 index 02df007be146d..0000000000000 --- a/src/testRunner/utilsRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to Utils so it can be referenced by unittests -export { }; diff --git a/src/testRunner/vfsRef.ts b/src/testRunner/vfsRef.ts deleted file mode 100644 index 7a9130a0d9c65..0000000000000 --- a/src/testRunner/vfsRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to vfs so it can be referenced by unittests -export { }; diff --git a/src/testRunner/vpathRef.ts b/src/testRunner/vpathRef.ts deleted file mode 100644 index 13cb846ee5ee8..0000000000000 --- a/src/testRunner/vpathRef.ts +++ /dev/null @@ -1,2 +0,0 @@ -// empty ref to vpath so it can be referenced by unittests -export { }; diff --git a/src/tsserver/nodeServer.ts b/src/tsserver/nodeServer.ts index 8c8263c202386..5c581ca296169 100644 --- a/src/tsserver/nodeServer.ts +++ b/src/tsserver/nodeServer.ts @@ -9,7 +9,7 @@ import { CharacterCodes, TypeAcquisition, WatchFileKind, WatchOptions } from ".. import { stripQuotes } from "../compiler/utilities"; import { validateLocaleAndSetLanguage } from "../compiler/utilitiesPublic"; import { noopFileWatcher } from "../compiler/watch"; -import { JsTyping } from "../jsTyping/_namespaces/ts"; +import * as JsTyping from "../jsTyping/jsTyping"; import { ActionInvalidate, ActionPackageInstalled, ActionSet, Arguments, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, EventTypesRegistry, findArgument, hasArgument, @@ -18,9 +18,9 @@ import { BeginInstallTypes, EndInstallTypes, InitializationFailedResponse, InstallPackageRequest, InvalidateCachedTypings, PackageInstalledResponse, SetTypings, TypesRegistryResponse, TypingInstallerRequestUnion, } from "../jsTyping/types"; -import { protocol } from "../server/_namespaces/ts.server"; import { ProjectService } from "../server/editorServices"; import { Project } from "../server/project"; +import * as protocol from "../server/protocol"; import { Event, formatMessage, nullCancellationToken, ServerCancellationToken, Session, toEvent, } from "../server/session"; diff --git a/src/tsserver/webServer.ts b/src/tsserver/webServer.ts index 4aa2a072f151d..d5cd5aeea6e0d 100644 --- a/src/tsserver/webServer.ts +++ b/src/tsserver/webServer.ts @@ -1,6 +1,6 @@ -import { performance } from "../compiler/_namespaces/ts"; import { noop, returnFalse, returnUndefined } from "../compiler/core"; import { Debug } from "../compiler/debug"; +import * as performance from "../compiler/performance"; import { setSys, sys } from "../compiler/sys"; import { validateLocaleAndSetLanguage } from "../compiler/utilitiesPublic"; import { findArgument } from "../jsTyping/shared"; diff --git a/src/typingsInstallerCore/typingsInstaller.ts b/src/typingsInstallerCore/typingsInstaller.ts index 8f658dda693ed..5e1324e8028f2 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -12,7 +12,7 @@ import { FileWatcher, PollingInterval } from "../compiler/sys"; import { Extension, ModuleResolutionKind, Path, WatchDirectoryFlags, WatchOptions } from "../compiler/types"; import { clearMap, closeFileWatcher, copyEntries } from "../compiler/utilities"; import { getWatchFactory, WatchFactory, WatchFactoryHost, WatchLogLevel } from "../compiler/watchUtilities"; -import { JsTyping } from "../jsTyping/_namespaces/ts"; +import * as JsTyping from "../jsTyping/jsTyping"; import { ActionInvalidate, ActionSet, EventBeginInstallTypes, EventEndInstallTypes } from "../jsTyping/shared"; import { BeginInstallTypes, CloseProject, DiscoverTypings, EndInstallTypes, InstallTypingHost, InvalidateCachedTypings, diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index a248c8253c2ab..5a6b7d6f2cb2d 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -4,7 +4,7 @@ import { directorySeparator, ensureTrailingDirectorySeparator, getDirectoryPath import { perfLogger } from "../compiler/perfLogger"; import { returnNoopFileWatcher } from "../compiler/watch"; import { nowString } from "../jsTyping/shared"; -import { protocol } from "../server/_namespaces/ts.server"; +import * as protocol from "../server/protocol"; import { ServerCancellationToken, Session, SessionOptions } from "../server/session"; import { ServerHost } from "../server/types"; import { nullTypingsInstaller } from "../server/typingsCache";