summaryrefslogtreecommitdiff
path: root/cli/tsc/00_typescript.js
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-09-14 11:58:47 +0100
committerGitHub <noreply@github.com>2024-09-14 11:58:47 +0100
commitaf2d992ecd2b9320072164b6ee295c31a3194406 (patch)
tree0926e2852aa2c4eb300e1f54f4c84d7568589b3b /cli/tsc/00_typescript.js
parent2c0bf6fd65b3276c4818c73028b19819608c8e70 (diff)
feat: TypeScript 5.6 and `npm:@types/node@22` (#25614)
Diffstat (limited to 'cli/tsc/00_typescript.js')
-rw-r--r--cli/tsc/00_typescript.js8129
1 files changed, 4644 insertions, 3485 deletions
diff --git a/cli/tsc/00_typescript.js b/cli/tsc/00_typescript.js
index e6ae49e0c..7d20f9236 100644
--- a/cli/tsc/00_typescript.js
+++ b/cli/tsc/00_typescript.js
@@ -86,7 +86,6 @@ __export(typescript_exports, {
GoToDefinition: () => ts_GoToDefinition_exports,
HighlightSpanKind: () => HighlightSpanKind,
IdentifierNameMap: () => IdentifierNameMap,
- IdentifierNameMultiMap: () => IdentifierNameMultiMap,
ImportKind: () => ImportKind,
ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
IndentStyle: () => IndentStyle,
@@ -97,6 +96,7 @@ __export(typescript_exports, {
InlayHintKind: () => InlayHintKind2,
InlayHints: () => ts_InlayHints_exports,
InternalEmitFlags: () => InternalEmitFlags,
+ InternalNodeBuilderFlags: () => InternalNodeBuilderFlags,
InternalSymbolName: () => InternalSymbolName,
IntersectionFlags: () => IntersectionFlags,
InvalidatedProjectKind: () => InvalidatedProjectKind,
@@ -143,6 +143,7 @@ __export(typescript_exports, {
PollingInterval: () => PollingInterval,
PollingWatchKind: () => PollingWatchKind,
PragmaKindFlags: () => PragmaKindFlags,
+ PredicateSemantics: () => PredicateSemantics,
PrivateIdentifierKind: () => PrivateIdentifierKind,
ProcessLevel: () => ProcessLevel,
ProgramUpdateLevel: () => ProgramUpdateLevel,
@@ -173,7 +174,6 @@ __export(typescript_exports, {
SymbolFlags: () => SymbolFlags,
SymbolFormatFlags: () => SymbolFormatFlags,
SyntaxKind: () => SyntaxKind,
- SyntheticSymbolKind: () => SyntheticSymbolKind,
Ternary: () => Ternary,
ThrottledCancellationToken: () => ThrottledCancellationToken,
TokenClass: () => TokenClass,
@@ -196,7 +196,6 @@ __export(typescript_exports, {
WatchLogLevel: () => WatchLogLevel,
WatchType: () => WatchType,
accessPrivateIdentifier: () => accessPrivateIdentifier,
- addDisposableResourceHelper: () => addDisposableResourceHelper,
addEmitFlags: () => addEmitFlags,
addEmitHelper: () => addEmitHelper,
addEmitHelpers: () => addEmitHelpers,
@@ -219,23 +218,15 @@ __export(typescript_exports, {
arrayFrom: () => arrayFrom,
arrayIsEqualTo: () => arrayIsEqualTo,
arrayIsHomogeneous: () => arrayIsHomogeneous,
- arrayIsSorted: () => arrayIsSorted,
arrayOf: () => arrayOf,
arrayReverseIterator: () => arrayReverseIterator,
arrayToMap: () => arrayToMap,
arrayToMultiMap: () => arrayToMultiMap,
arrayToNumericMap: () => arrayToNumericMap,
- arraysEqual: () => arraysEqual,
assertType: () => assertType,
assign: () => assign,
- assignHelper: () => assignHelper,
- asyncDelegator: () => asyncDelegator,
- asyncGeneratorHelper: () => asyncGeneratorHelper,
asyncSuperHelper: () => asyncSuperHelper,
- asyncValues: () => asyncValues,
attachFileToDiagnostics: () => attachFileToDiagnostics,
- awaitHelper: () => awaitHelper,
- awaiterHelper: () => awaiterHelper,
base64decode: () => base64decode,
base64encode: () => base64encode,
binarySearch: () => binarySearch,
@@ -248,6 +239,7 @@ __export(typescript_exports, {
buildOverload: () => buildOverload,
bundlerModuleNameResolver: () => bundlerModuleNameResolver,
canBeConvertedToAsync: () => canBeConvertedToAsync,
+ canEmitTsBuildInfo: () => canEmitTsBuildInfo,
canHaveDecorators: () => canHaveDecorators,
canHaveExportModifier: () => canHaveExportModifier,
canHaveFlowNode: () => canHaveFlowNode,
@@ -258,8 +250,9 @@ __export(typescript_exports, {
canHaveJSDoc: () => canHaveJSDoc,
canHaveLocals: () => canHaveLocals,
canHaveModifiers: () => canHaveModifiers,
+ canHaveModuleSpecifier: () => canHaveModuleSpecifier,
canHaveSymbol: () => canHaveSymbol,
- canIncludeBindAndCheckDiagnsotics: () => canIncludeBindAndCheckDiagnsotics,
+ canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
canProduceDiagnostics: () => canProduceDiagnostics,
canUsePropertyAccess: () => canUsePropertyAccess,
@@ -276,16 +269,13 @@ __export(typescript_exports, {
changeFullExtension: () => changeFullExtension,
changesAffectModuleResolution: () => changesAffectModuleResolution,
changesAffectingProgramStructure: () => changesAffectingProgramStructure,
- characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
+ characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
childIsDecorated: () => childIsDecorated,
classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
classHasClassThisAssignment: () => classHasClassThisAssignment,
classHasDeclaredOrExplicitlyAssignedName: () => classHasDeclaredOrExplicitlyAssignedName,
classHasExplicitlyAssignedName: () => classHasExplicitlyAssignedName,
classOrConstructorParameterIsDecorated: () => classOrConstructorParameterIsDecorated,
- classPrivateFieldGetHelper: () => classPrivateFieldGetHelper,
- classPrivateFieldInHelper: () => classPrivateFieldInHelper,
- classPrivateFieldSetHelper: () => classPrivateFieldSetHelper,
classicNameResolver: () => classicNameResolver,
classifier: () => ts_classifier_exports,
cleanExtendedConfigCache: () => cleanExtendedConfigCache,
@@ -293,7 +283,6 @@ __export(typescript_exports, {
clearMap: () => clearMap,
clearSharedExtendedConfigFileWatcher: () => clearSharedExtendedConfigFileWatcher,
climbPastPropertyAccess: () => climbPastPropertyAccess,
- climbPastPropertyOrElementAccess: () => climbPastPropertyOrElementAccess,
clone: () => clone,
cloneCompilerOptions: () => cloneCompilerOptions,
closeFileWatcher: () => closeFileWatcher,
@@ -306,12 +295,10 @@ __export(typescript_exports, {
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
commentPragmas: () => commentPragmas,
commonOptionsWithBuild: () => commonOptionsWithBuild,
- commonPackageFolders: () => commonPackageFolders,
compact: () => compact,
compareBooleans: () => compareBooleans,
compareDataObjects: () => compareDataObjects,
compareDiagnostics: () => compareDiagnostics,
- compareDiagnosticsSkipRelatedInformation: () => compareDiagnosticsSkipRelatedInformation,
compareEmitHelpers: () => compareEmitHelpers,
compareNumberOfDirectorySeparators: () => compareNumberOfDirectorySeparators,
comparePaths: () => comparePaths,
@@ -325,26 +312,21 @@ __export(typescript_exports, {
compareStringsCaseSensitiveUI: () => compareStringsCaseSensitiveUI,
compareTextSpans: () => compareTextSpans,
compareValues: () => compareValues,
- compileOnSaveCommandLineOption: () => compileOnSaveCommandLineOption,
compilerOptionsAffectDeclarationPath: () => compilerOptionsAffectDeclarationPath,
compilerOptionsAffectEmit: () => compilerOptionsAffectEmit,
compilerOptionsAffectSemanticDiagnostics: () => compilerOptionsAffectSemanticDiagnostics,
compilerOptionsDidYouMeanDiagnostics: () => compilerOptionsDidYouMeanDiagnostics,
compilerOptionsIndicateEsModules: () => compilerOptionsIndicateEsModules,
- compose: () => compose,
computeCommonSourceDirectoryOfFilenames: () => computeCommonSourceDirectoryOfFilenames,
computeLineAndCharacterOfPosition: () => computeLineAndCharacterOfPosition,
computeLineOfPosition: () => computeLineOfPosition,
computeLineStarts: () => computeLineStarts,
computePositionOfLineAndCharacter: () => computePositionOfLineAndCharacter,
- computeSignature: () => computeSignature,
computeSignatureWithDiagnostics: () => computeSignatureWithDiagnostics,
computeSuggestionDiagnostics: () => computeSuggestionDiagnostics,
computedOptions: () => computedOptions,
concatenate: () => concatenate,
concatenateDiagnosticMessageChains: () => concatenateDiagnosticMessageChains,
- configDirTemplateSubstitutionOptions: () => configDirTemplateSubstitutionOptions,
- configDirTemplateSubstitutionWatchOptions: () => configDirTemplateSubstitutionWatchOptions,
consumesNodeCoreModules: () => consumesNodeCoreModules,
contains: () => contains,
containsIgnoredPath: () => containsIgnoredPath,
@@ -375,16 +357,11 @@ __export(typescript_exports, {
createAccessorPropertySetRedirector: () => createAccessorPropertySetRedirector,
createBaseNodeFactory: () => createBaseNodeFactory,
createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
- createBindingHelper: () => createBindingHelper,
- createBuildInfo: () => createBuildInfo,
createBuilderProgram: () => createBuilderProgram,
- createBuilderProgramUsingProgramBuildInfo: () => createBuilderProgramUsingProgramBuildInfo,
+ createBuilderProgramUsingIncrementalBuildInfo: () => createBuilderProgramUsingIncrementalBuildInfo,
createBuilderStatusReporter: () => createBuilderStatusReporter,
- createCacheWithRedirects: () => createCacheWithRedirects,
createCacheableExportInfoMap: () => createCacheableExportInfoMap,
createCachedDirectoryStructureHost: () => createCachedDirectoryStructureHost,
- createClassNamedEvaluationHelperBlock: () => createClassNamedEvaluationHelperBlock,
- createClassThisAssignmentBlock: () => createClassThisAssignmentBlock,
createClassifier: () => createClassifier,
createCommentDirectivesMap: () => createCommentDirectivesMap,
createCompilerDiagnostic: () => createCompilerDiagnostic,
@@ -436,6 +413,7 @@ __export(typescript_exports, {
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
createModeAwareCache: () => createModeAwareCache,
createModeAwareCacheKey: () => createModeAwareCacheKey,
+ createModeMismatchDetails: () => createModeMismatchDetails,
createModuleNotFoundChain: () => createModuleNotFoundChain,
createModuleResolutionCache: () => createModuleResolutionCache,
createModuleResolutionLoader: () => createModuleResolutionLoader,
@@ -506,9 +484,7 @@ __export(typescript_exports, {
declarationNameToString: () => declarationNameToString,
decodeMappings: () => decodeMappings,
decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
- decorateHelper: () => decorateHelper,
deduplicate: () => deduplicate,
- defaultIncludeSpec: () => defaultIncludeSpec,
defaultInitCompilerOptions: () => defaultInitCompilerOptions,
defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
deno: () => deno_exports,
@@ -520,27 +496,22 @@ __export(typescript_exports, {
displayPart: () => displayPart,
displayPartsToString: () => displayPartsToString,
disposeEmitNodes: () => disposeEmitNodes,
- disposeResourcesHelper: () => disposeResourcesHelper,
documentSpansEqual: () => documentSpansEqual,
dumpTracingLegend: () => dumpTracingLegend,
elementAt: () => elementAt,
elideNodes: () => elideNodes,
- emitComments: () => emitComments,
emitDetachedComments: () => emitDetachedComments,
emitFiles: () => emitFiles,
emitFilesAndReportErrors: () => emitFilesAndReportErrors,
emitFilesAndReportErrorsAndGetExitStatus: () => emitFilesAndReportErrorsAndGetExitStatus,
emitModuleKindIsNonNodeESM: () => emitModuleKindIsNonNodeESM,
emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
- emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
- emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
emitResolverSkipsTypeChecking: () => emitResolverSkipsTypeChecking,
emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
emptyArray: () => emptyArray,
emptyFileSystemEntries: () => emptyFileSystemEntries,
emptyMap: () => emptyMap,
emptyOptions: () => emptyOptions,
- emptySet: () => emptySet,
endsWith: () => endsWith,
ensurePathIsNonModuleName: () => ensurePathIsNonModuleName,
ensureScriptKind: () => ensureScriptKind,
@@ -551,7 +522,6 @@ __export(typescript_exports, {
equateStringsCaseInsensitive: () => equateStringsCaseInsensitive,
equateStringsCaseSensitive: () => equateStringsCaseSensitive,
equateValues: () => equateValues,
- esDecorateHelper: () => esDecorateHelper,
escapeJsxAttributeString: () => escapeJsxAttributeString,
escapeLeadingUnderscores: () => escapeLeadingUnderscores,
escapeNonAsciiString: () => escapeNonAsciiString,
@@ -565,15 +535,14 @@ __export(typescript_exports, {
explainFiles: () => explainFiles,
explainIfFileIsRedirectAndImpliedFormat: () => explainIfFileIsRedirectAndImpliedFormat,
exportAssignmentIsAlias: () => exportAssignmentIsAlias,
- exportStarHelper: () => exportStarHelper,
expressionResultIsUnused: () => expressionResultIsUnused,
extend: () => extend,
- extendsHelper: () => extendsHelper,
extensionFromPath: () => extensionFromPath,
extensionIsTS: () => extensionIsTS,
extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
externalHelpersModuleNameText: () => externalHelpersModuleNameText,
factory: () => factory,
+ fileContainsPackageImport: () => fileContainsPackageImport,
fileExtensionIs: () => fileExtensionIs,
fileExtensionIsOneOf: () => fileExtensionIsOneOf,
fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
@@ -595,7 +564,6 @@ __export(typescript_exports, {
findLast: () => findLast,
findLastIndex: () => findLastIndex,
findListItemInfo: () => findListItemInfo,
- findMap: () => findMap,
findModifier: () => findModifier,
findNextToken: () => findNextToken,
findPackageJson: () => findPackageJson,
@@ -643,7 +611,6 @@ __export(typescript_exports, {
forEachTsConfigPropArray: () => forEachTsConfigPropArray,
forEachUnique: () => forEachUnique,
forEachYieldExpression: () => forEachYieldExpression,
- forSomeAncestorDirectory: () => forSomeAncestorDirectory,
formatColorAndReset: () => formatColorAndReset,
formatDiagnostic: () => formatDiagnostic,
formatDiagnostics: () => formatDiagnostics,
@@ -654,11 +621,8 @@ __export(typescript_exports, {
formatMessage: () => formatMessage,
formatStringFromArgs: () => formatStringFromArgs,
formatting: () => ts_formatting_exports,
- fullTripleSlashAMDReferencePathRegEx: () => fullTripleSlashAMDReferencePathRegEx,
- fullTripleSlashReferencePathRegEx: () => fullTripleSlashReferencePathRegEx,
generateDjb2Hash: () => generateDjb2Hash,
generateTSConfig: () => generateTSConfig,
- generatorHelper: () => generatorHelper,
getAdjustedReferenceLocation: () => getAdjustedReferenceLocation,
getAdjustedRenameLocation: () => getAdjustedRenameLocation,
getAliasDeclarationFromName: () => getAliasDeclarationFromName,
@@ -677,7 +641,6 @@ __export(typescript_exports, {
getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled,
getAssignedExpandoInitializer: () => getAssignedExpandoInitializer,
getAssignedName: () => getAssignedName,
- getAssignedNameOfIdentifier: () => getAssignedNameOfIdentifier,
getAssignmentDeclarationKind: () => getAssignmentDeclarationKind,
getAssignmentDeclarationPropertyAccessKind: () => getAssignmentDeclarationPropertyAccessKind,
getAssignmentTargetKind: () => getAssignmentTargetKind,
@@ -718,7 +681,6 @@ __export(typescript_exports, {
getContainingObjectLiteralElement: () => getContainingObjectLiteralElement,
getContextualTypeFromParent: () => getContextualTypeFromParent,
getContextualTypeFromParentOrAncestorTypeNode: () => getContextualTypeFromParentOrAncestorTypeNode,
- getCurrentTime: () => getCurrentTime,
getDeclarationDiagnostics: () => getDeclarationDiagnostics,
getDeclarationEmitExtensionForPath: () => getDeclarationEmitExtensionForPath,
getDeclarationEmitOutputFilePath: () => getDeclarationEmitOutputFilePath,
@@ -736,6 +698,7 @@ __export(typescript_exports, {
getDefaultLibFilePath: () => getDefaultLibFilePath,
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
+ getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
getDiagnosticText: () => getDiagnosticText,
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
getDirectoryPath: () => getDirectoryPath,
@@ -766,6 +729,7 @@ __export(typescript_exports, {
getEmitFlags: () => getEmitFlags,
getEmitHelpers: () => getEmitHelpers,
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
+ getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
getEmitModuleKind: () => getEmitModuleKind,
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
getEmitScriptTarget: () => getEmitScriptTarget,
@@ -816,11 +780,11 @@ __export(typescript_exports, {
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
+ getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
- getIndentSize: () => getIndentSize,
getIndentString: () => getIndentString,
getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom,
getInitializedVariables: () => getInitializedVariables,
@@ -829,6 +793,7 @@ __export(typescript_exports, {
getInterfaceBaseTypeNodes: () => getInterfaceBaseTypeNodes,
getInternalEmitFlags: () => getInternalEmitFlags,
getInvokedExpression: () => getInvokedExpression,
+ getIsFileExcluded: () => getIsFileExcluded,
getIsolatedModules: () => getIsolatedModules,
getJSDocAugmentsTag: () => getJSDocAugmentsTag,
getJSDocClassTag: () => getJSDocClassTag,
@@ -857,7 +822,6 @@ __export(typescript_exports, {
getJSDocSatisfiesExpressionType: () => getJSDocSatisfiesExpressionType,
getJSDocSatisfiesTag: () => getJSDocSatisfiesTag,
getJSDocTags: () => getJSDocTags,
- getJSDocTagsNoCache: () => getJSDocTagsNoCache,
getJSDocTemplateTag: () => getJSDocTemplateTag,
getJSDocThisTag: () => getJSDocThisTag,
getJSDocType: () => getJSDocType,
@@ -881,7 +845,6 @@ __export(typescript_exports, {
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
getLineInfo: () => getLineInfo,
getLineOfLocalPosition: () => getLineOfLocalPosition,
- getLineOfLocalPositionFromLineMap: () => getLineOfLocalPositionFromLineMap,
getLineStartPositionForPosition: () => getLineStartPositionForPosition,
getLineStarts: () => getLineStarts,
getLinesBetweenPositionAndNextNonWhitespaceCharacter: () => getLinesBetweenPositionAndNextNonWhitespaceCharacter,
@@ -923,7 +886,6 @@ __export(typescript_exports, {
getNameOfScriptTarget: () => getNameOfScriptTarget,
getNameOrArgument: () => getNameOrArgument,
getNameTable: () => getNameTable,
- getNamesForExportedSymbol: () => getNamesForExportedSymbol,
getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
getNewLineCharacter: () => getNewLineCharacter,
getNewLineKind: () => getNewLineKind,
@@ -940,49 +902,43 @@ __export(typescript_exports, {
getNonAssignmentOperatorForCompoundAssignment: () => getNonAssignmentOperatorForCompoundAssignment,
getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
+ getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots,
+ getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode,
getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
getNormalizedPathComponents: () => getNormalizedPathComponents,
getObjectFlags: () => getObjectFlags,
- getOperator: () => getOperator,
getOperatorAssociativity: () => getOperatorAssociativity,
getOperatorPrecedence: () => getOperatorPrecedence,
getOptionFromName: () => getOptionFromName,
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
getOptionsNameMap: () => getOptionsNameMap,
getOrCreateEmitNode: () => getOrCreateEmitNode,
- getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
getOrUpdate: () => getOrUpdate,
getOriginalNode: () => getOriginalNode,
getOriginalNodeId: () => getOriginalNodeId,
- getOriginalSourceFile: () => getOriginalSourceFile,
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
getOutputDeclarationFileNameWorker: () => getOutputDeclarationFileNameWorker,
getOutputExtension: () => getOutputExtension,
getOutputFileNames: () => getOutputFileNames,
getOutputJSFileNameWorker: () => getOutputJSFileNameWorker,
getOutputPathsFor: () => getOutputPathsFor,
- getOutputPathsForBundle: () => getOutputPathsForBundle,
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
getOwnKeys: () => getOwnKeys,
getOwnValues: () => getOwnValues,
- getPackageJsonInfo: () => getPackageJsonInfo,
getPackageJsonTypesVersionsPaths: () => getPackageJsonTypesVersionsPaths,
- getPackageJsonsVisibleToFile: () => getPackageJsonsVisibleToFile,
getPackageNameFromTypesPackageName: () => getPackageNameFromTypesPackageName,
getPackageScopeForPath: () => getPackageScopeForPath,
getParameterSymbolFromJSDoc: () => getParameterSymbolFromJSDoc,
- getParameterTypeNode: () => getParameterTypeNode,
getParentNodeInSpan: () => getParentNodeInSpan,
getParseTreeNode: () => getParseTreeNode,
getParsedCommandLineOfConfigFile: () => getParsedCommandLineOfConfigFile,
getPathComponents: () => getPathComponents,
- getPathComponentsRelativeTo: () => getPathComponentsRelativeTo,
getPathFromPathComponents: () => getPathFromPathComponents,
getPathUpdater: () => getPathUpdater,
getPathsBasePath: () => getPathsBasePath,
getPatternFromSpec: () => getPatternFromSpec,
- getPendingEmitKind: () => getPendingEmitKind,
+ getPendingEmitKindWithSeen: () => getPendingEmitKindWithSeen,
getPositionOfLineAndCharacter: () => getPositionOfLineAndCharacter,
getPossibleGenericSignatures: () => getPossibleGenericSignatures,
getPossibleOriginalInputExtensionForExtension: () => getPossibleOriginalInputExtensionForExtension,
@@ -995,7 +951,6 @@ __export(typescript_exports, {
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
- getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
getPropertyNameFromType: () => getPropertyNameFromType,
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
@@ -1019,13 +974,14 @@ __export(typescript_exports, {
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
+ getResolvedModuleFromResolution: () => getResolvedModuleFromResolution,
+ getResolvedTypeReferenceDirectiveFromResolution: () => getResolvedTypeReferenceDirectiveFromResolution,
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
getRestParameterElementType: () => getRestParameterElementType,
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
getRootDeclaration: () => getRootDeclaration,
getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
getRootLength: () => getRootLength,
- getRootPathSplitLength: () => getRootPathSplitLength,
getScriptKind: () => getScriptKind,
getScriptKindFromFileName: () => getScriptKindFromFileName,
getScriptTargetFeatures: () => getScriptTargetFeatures,
@@ -1037,14 +993,12 @@ __export(typescript_exports, {
getSetAccessorValueParameter: () => getSetAccessorValueParameter,
getSetExternalModuleIndicator: () => getSetExternalModuleIndicator,
getShebang: () => getShebang,
- getSingleInitializerOfVariableStatementOrPropertyDeclaration: () => getSingleInitializerOfVariableStatementOrPropertyDeclaration,
getSingleVariableOfVariableStatement: () => getSingleVariableOfVariableStatement,
getSnapshotText: () => getSnapshotText,
getSnippetElement: () => getSnippetElement,
getSourceFileOfModule: () => getSourceFileOfModule,
getSourceFileOfNode: () => getSourceFileOfNode,
getSourceFilePathInNewDir: () => getSourceFilePathInNewDir,
- getSourceFilePathInNewDirWorker: () => getSourceFilePathInNewDirWorker,
getSourceFileVersionAsHashFromText: () => getSourceFileVersionAsHashFromText,
getSourceFilesToEmit: () => getSourceFilesToEmit,
getSourceMapRange: () => getSourceMapRange,
@@ -1067,7 +1021,6 @@ __export(typescript_exports, {
getSwitchedType: () => getSwitchedType,
getSymbolId: () => getSymbolId,
getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
- getSymbolParentOrFail: () => getSymbolParentOrFail,
getSymbolTarget: () => getSymbolTarget,
getSyntacticClassifications: () => getSyntacticClassifications,
getSyntacticModifierFlags: () => getSyntacticModifierFlags,
@@ -1098,7 +1051,6 @@ __export(typescript_exports, {
getTouchingToken: () => getTouchingToken,
getTrailingCommentRanges: () => getTrailingCommentRanges,
getTrailingSemicolonDeferringWriter: () => getTrailingSemicolonDeferringWriter,
- getTransformFlagsSubtreeExclusions: () => getTransformFlagsSubtreeExclusions,
getTransformers: () => getTransformers,
getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
@@ -1126,7 +1078,6 @@ __export(typescript_exports, {
hasAccessorModifier: () => hasAccessorModifier,
hasAmbientModifier: () => hasAmbientModifier,
hasChangesInResolutions: () => hasChangesInResolutions,
- hasChildOfKind: () => hasChildOfKind,
hasContextSensitiveParameters: () => hasContextSensitiveParameters,
hasDecorators: () => hasDecorators,
hasDocComment: () => hasDocComment,
@@ -1135,6 +1086,7 @@ __export(typescript_exports, {
hasEffectiveModifiers: () => hasEffectiveModifiers,
hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
hasExtension: () => hasExtension,
+ hasImplementationTSFileExtension: () => hasImplementationTSFileExtension,
hasIndexSignature: () => hasIndexSignature,
hasInferredType: () => hasInferredType,
hasInitializer: () => hasInitializer,
@@ -1162,7 +1114,6 @@ __export(typescript_exports, {
hasType: () => hasType,
hasTypeArguments: () => hasTypeArguments,
hasZeroOrOneAsteriskCharacter: () => hasZeroOrOneAsteriskCharacter,
- helperString: () => helperString,
hostGetCanonicalFileName: () => hostGetCanonicalFileName,
hostUsesCaseSensitiveFileNames: () => hostUsesCaseSensitiveFileNames,
idText: () => idText,
@@ -1172,9 +1123,8 @@ __export(typescript_exports, {
identitySourceMapConsumer: () => identitySourceMapConsumer,
ignoreSourceNewlines: () => ignoreSourceNewlines,
ignoredPaths: () => ignoredPaths,
- importDefaultHelper: () => importDefaultHelper,
importFromModuleSpecifier: () => importFromModuleSpecifier,
- importStarHelper: () => importStarHelper,
+ importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
indexOfAnyCharCode: () => indexOfAnyCharCode,
indexOfNode: () => indexOfNode,
indicesOf: () => indicesOf,
@@ -1182,7 +1132,6 @@ __export(typescript_exports, {
injectClassNamedEvaluationHelperBlockIfMissing: () => injectClassNamedEvaluationHelperBlockIfMissing,
injectClassThisAssignmentIfMissing: () => injectClassThisAssignmentIfMissing,
insertImports: () => insertImports,
- insertLeadingStatement: () => insertLeadingStatement,
insertSorted: () => insertSorted,
insertStatementAfterCustomPrologue: () => insertStatementAfterCustomPrologue,
insertStatementAfterStandardPrologue: () => insertStatementAfterStandardPrologue,
@@ -1198,11 +1147,9 @@ __export(typescript_exports, {
isAccessibilityModifier: () => isAccessibilityModifier,
isAccessor: () => isAccessor,
isAccessorModifier: () => isAccessorModifier,
- isAliasSymbolDeclaration: () => isAliasSymbolDeclaration,
isAliasableExpression: () => isAliasableExpression,
isAmbientModule: () => isAmbientModule,
isAmbientPropertyDeclaration: () => isAmbientPropertyDeclaration,
- isAnonymousFunctionDefinition: () => isAnonymousFunctionDefinition,
isAnyDirectorySeparator: () => isAnyDirectorySeparator,
isAnyImportOrBareOrAccessedRequire: () => isAnyImportOrBareOrAccessedRequire,
isAnyImportOrReExport: () => isAnyImportOrReExport,
@@ -1238,6 +1185,7 @@ __export(typescript_exports, {
isAwaitKeyword: () => isAwaitKeyword,
isBigIntLiteral: () => isBigIntLiteral,
isBinaryExpression: () => isBinaryExpression,
+ isBinaryLogicalOperator: () => isBinaryLogicalOperator,
isBinaryOperatorToken: () => isBinaryOperatorToken,
isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
@@ -1259,7 +1207,7 @@ __export(typescript_exports, {
isBreakStatement: () => isBreakStatement,
isBuild: () => isBuild,
isBuildInfoFile: () => isBuildInfoFile,
- isBuilderProgram: () => isBuilderProgram2,
+ isBuilderProgram: () => isBuilderProgram,
isBundle: () => isBundle,
isCallChain: () => isCallChain,
isCallExpression: () => isCallExpression,
@@ -1278,7 +1226,6 @@ __export(typescript_exports, {
isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
- isChildOfNodeWithKind: () => isChildOfNodeWithKind,
isCircularBuildOrder: () => isCircularBuildOrder,
isClassDeclaration: () => isClassDeclaration,
isClassElement: () => isClassElement,
@@ -1290,7 +1237,6 @@ __export(typescript_exports, {
isClassOrTypeElement: () => isClassOrTypeElement,
isClassStaticBlockDeclaration: () => isClassStaticBlockDeclaration,
isClassThisAssignmentBlock: () => isClassThisAssignmentBlock,
- isCollapsedRange: () => isCollapsedRange,
isColonToken: () => isColonToken,
isCommaExpression: () => isCommaExpression,
isCommaListExpression: () => isCommaListExpression,
@@ -1333,16 +1279,13 @@ __export(typescript_exports, {
isDeleteTarget: () => isDeleteTarget,
isDeprecatedDeclaration: () => isDeprecatedDeclaration,
isDestructuringAssignment: () => isDestructuringAssignment,
- isDiagnosticWithLocation: () => isDiagnosticWithLocation,
isDiskPathRoot: () => isDiskPathRoot,
isDoStatement: () => isDoStatement,
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
isDotDotDotToken: () => isDotDotDotToken,
isDottedName: () => isDottedName,
isDynamicName: () => isDynamicName,
- isESSymbolIdentifier: () => isESSymbolIdentifier,
isEffectiveExternalModule: () => isEffectiveExternalModule,
- isEffectiveModuleDeclaration: () => isEffectiveModuleDeclaration,
isEffectiveStrictModeSourceFile: () => isEffectiveStrictModeSourceFile,
isElementAccessChain: () => isElementAccessChain,
isElementAccessExpression: () => isElementAccessExpression,
@@ -1412,13 +1355,11 @@ __export(typescript_exports, {
isFunctionOrModuleBlock: () => isFunctionOrModuleBlock,
isFunctionSymbol: () => isFunctionSymbol,
isFunctionTypeNode: () => isFunctionTypeNode,
- isFutureReservedKeyword: () => isFutureReservedKeyword,
isGeneratedIdentifier: () => isGeneratedIdentifier,
isGeneratedPrivateIdentifier: () => isGeneratedPrivateIdentifier,
isGetAccessor: () => isGetAccessor,
isGetAccessorDeclaration: () => isGetAccessorDeclaration,
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
- isGlobalDeclaration: () => isGlobalDeclaration,
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
isGlobalSourceFile: () => isGlobalSourceFile,
isGrammarError: () => isGrammarError,
@@ -1466,6 +1407,8 @@ __export(typescript_exports, {
isInTemplateString: () => isInTemplateString,
isInTopLevelContext: () => isInTopLevelContext,
isInTypeQuery: () => isInTypeQuery,
+ isIncrementalBuildInfo: () => isIncrementalBuildInfo,
+ isIncrementalBundleEmitBuildInfo: () => isIncrementalBundleEmitBuildInfo,
isIncrementalCompilation: () => isIncrementalCompilation,
isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
@@ -1572,7 +1515,6 @@ __export(typescript_exports, {
isLabeledStatement: () => isLabeledStatement,
isLateVisibilityPaintedStatement: () => isLateVisibilityPaintedStatement,
isLeftHandSideExpression: () => isLeftHandSideExpression,
- isLeftHandSideOfAssignment: () => isLeftHandSideOfAssignment,
isLet: () => isLet,
isLineBreak: () => isLineBreak,
isLiteralComputedPropertyDeclarationName: () => isLiteralComputedPropertyDeclarationName,
@@ -1580,10 +1522,7 @@ __export(typescript_exports, {
isLiteralExpressionOfObject: () => isLiteralExpressionOfObject,
isLiteralImportTypeNode: () => isLiteralImportTypeNode,
isLiteralKind: () => isLiteralKind,
- isLiteralLikeAccess: () => isLiteralLikeAccess,
- isLiteralLikeElementAccess: () => isLiteralLikeElementAccess,
isLiteralNameOfPropertyDeclarationOrIndexAccess: () => isLiteralNameOfPropertyDeclarationOrIndexAccess,
- isLiteralTypeLikeExpression: () => isLiteralTypeLikeExpression,
isLiteralTypeLiteral: () => isLiteralTypeLiteral,
isLiteralTypeNode: () => isLiteralTypeNode,
isLocalName: () => isLocalName,
@@ -1608,6 +1547,7 @@ __export(typescript_exports, {
isModuleBlock: () => isModuleBlock,
isModuleBody: () => isModuleBody,
isModuleDeclaration: () => isModuleDeclaration,
+ isModuleExportName: () => isModuleExportName,
isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
isModuleIdentifier: () => isModuleIdentifier,
isModuleName: () => isModuleName,
@@ -1617,7 +1557,6 @@ __export(typescript_exports, {
isModuleWithStringLiteralName: () => isModuleWithStringLiteralName,
isNameOfFunctionDeclaration: () => isNameOfFunctionDeclaration,
isNameOfModuleDeclaration: () => isNameOfModuleDeclaration,
- isNamedClassElement: () => isNamedClassElement,
isNamedDeclaration: () => isNamedDeclaration,
isNamedEvaluation: () => isNamedEvaluation,
isNamedEvaluationSource: () => isNamedEvaluationSource,
@@ -1635,7 +1574,6 @@ __export(typescript_exports, {
isNewExpression: () => isNewExpression,
isNewExpressionTarget: () => isNewExpressionTarget,
isNoSubstitutionTemplateLiteral: () => isNoSubstitutionTemplateLiteral,
- isNode: () => isNode,
isNodeArray: () => isNodeArray,
isNodeArrayMultiLine: () => isNodeArrayMultiLine,
isNodeDescendantOf: () => isNodeDescendantOf,
@@ -1644,14 +1582,11 @@ __export(typescript_exports, {
isNodeModulesDirectory: () => isNodeModulesDirectory,
isNodeWithPossibleHoistedDeclaration: () => isNodeWithPossibleHoistedDeclaration,
isNonContextualKeyword: () => isNonContextualKeyword,
- isNonExportDefaultModifier: () => isNonExportDefaultModifier,
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
- isNonGlobalDeclaration: () => isNonGlobalDeclaration,
isNonNullAccess: () => isNonNullAccess,
isNonNullChain: () => isNonNullChain,
isNonNullExpression: () => isNonNullExpression,
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
- isNotEmittedOrPartiallyEmittedNode: () => isNotEmittedOrPartiallyEmittedNode,
isNotEmittedStatement: () => isNotEmittedStatement,
isNullishCoalesce: () => isNullishCoalesce,
isNumber: () => isNumber,
@@ -1667,7 +1602,6 @@ __export(typescript_exports, {
isObjectLiteralMethod: () => isObjectLiteralMethod,
isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor,
isObjectTypeDeclaration: () => isObjectTypeDeclaration,
- isOctalDigit: () => isOctalDigit,
isOmittedExpression: () => isOmittedExpression,
isOptionalChain: () => isOptionalChain,
isOptionalChainRoot: () => isOptionalChainRoot,
@@ -1701,7 +1635,6 @@ __export(typescript_exports, {
isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
- isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
isProgramUptoDate: () => isProgramUptoDate,
isPrologueDirective: () => isPrologueDirective,
isPropertyAccessChain: () => isPropertyAccessChain,
@@ -1714,7 +1647,6 @@ __export(typescript_exports, {
isPropertyName: () => isPropertyName,
isPropertyNameLiteral: () => isPropertyNameLiteral,
isPropertySignature: () => isPropertySignature,
- isProtoSetter: () => isProtoSetter,
isPrototypeAccess: () => isPrototypeAccess,
isPrototypePropertyAssignment: () => isPrototypePropertyAssignment,
isPunctuation: () => isPunctuation,
@@ -1724,7 +1656,6 @@ __export(typescript_exports, {
isQuestionOrExclamationToken: () => isQuestionOrExclamationToken,
isQuestionOrPlusOrMinusToken: () => isQuestionOrPlusOrMinusToken,
isQuestionToken: () => isQuestionToken,
- isRawSourceMap: () => isRawSourceMap,
isReadonlyKeyword: () => isReadonlyKeyword,
isReadonlyKeywordOrPlusOrMinusToken: () => isReadonlyKeywordOrPlusOrMinusToken,
isRecognizedTripleSlashComment: () => isRecognizedTripleSlashComment,
@@ -1746,24 +1677,22 @@ __export(typescript_exports, {
isRootedDiskPath: () => isRootedDiskPath,
isSameEntityName: () => isSameEntityName,
isSatisfiesExpression: () => isSatisfiesExpression,
- isScopeMarker: () => isScopeMarker,
isSemicolonClassElement: () => isSemicolonClassElement,
isSetAccessor: () => isSetAccessor,
isSetAccessorDeclaration: () => isSetAccessorDeclaration,
- isShebangTrivia: () => isShebangTrivia,
isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
+ isSideEffectImport: () => isSideEffectImport,
isSignedNumericLiteral: () => isSignedNumericLiteral,
isSimpleCopiableExpression: () => isSimpleCopiableExpression,
isSimpleInlineableExpression: () => isSimpleInlineableExpression,
- isSimpleParameter: () => isSimpleParameter,
isSimpleParameterList: () => isSimpleParameterList,
isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
+ isSourceElement: () => isSourceElement,
isSourceFile: () => isSourceFile,
isSourceFileFromLibrary: () => isSourceFileFromLibrary,
isSourceFileJS: () => isSourceFileJS,
- isSourceFileNotJS: () => isSourceFileNotJS,
isSourceFileNotJson: () => isSourceFileNotJson,
isSourceMapping: () => isSourceMapping,
isSpecialPropertyDeclaration: () => isSpecialPropertyDeclaration,
@@ -1776,7 +1705,6 @@ __export(typescript_exports, {
isStatic: () => isStatic,
isStaticModifier: () => isStaticModifier,
isString: () => isString,
- isStringAKeyword: () => isStringAKeyword,
isStringANonContextualKeyword: () => isStringANonContextualKeyword,
isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted: () => isStringDoubleQuoted,
@@ -1789,7 +1717,6 @@ __export(typescript_exports, {
isStringTextContainingNode: () => isStringTextContainingNode,
isSuperCall: () => isSuperCall,
isSuperKeyword: () => isSuperKeyword,
- isSuperOrSuperProperty: () => isSuperOrSuperProperty,
isSuperProperty: () => isSuperProperty,
isSupportedSourceFileName: () => isSupportedSourceFileName,
isSwitchStatement: () => isSwitchStatement,
@@ -1835,7 +1762,6 @@ __export(typescript_exports, {
isTypeDeclaration: () => isTypeDeclaration,
isTypeElement: () => isTypeElement,
isTypeKeyword: () => isTypeKeyword,
- isTypeKeywordToken: () => isTypeKeywordToken,
isTypeKeywordTokenOrIdentifier: () => isTypeKeywordTokenOrIdentifier,
isTypeLiteralNode: () => isTypeLiteralNode,
isTypeNode: () => isTypeNode,
@@ -1890,10 +1816,6 @@ __export(typescript_exports, {
libMap: () => libMap,
libs: () => libs,
lineBreakPart: () => lineBreakPart,
- linkNamePart: () => linkNamePart,
- linkPart: () => linkPart,
- linkTextPart: () => linkTextPart,
- listFiles: () => listFiles,
loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
loadWithModeAwareCache: () => loadWithModeAwareCache,
makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
@@ -1903,7 +1825,6 @@ __export(typescript_exports, {
map: () => map,
mapAllOrFail: () => mapAllOrFail,
mapDefined: () => mapDefined,
- mapDefinedEntries: () => mapDefinedEntries,
mapDefinedIterator: () => mapDefinedIterator,
mapEntries: () => mapEntries,
mapIterator: () => mapIterator,
@@ -1913,18 +1834,19 @@ __export(typescript_exports, {
matchPatternOrExact: () => matchPatternOrExact,
matchedText: () => matchedText,
matchesExclude: () => matchesExclude,
+ maxBy: () => maxBy,
maybeBind: () => maybeBind,
maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
memoize: () => memoize,
- memoizeCached: () => memoizeCached,
memoizeOne: () => memoizeOne,
- memoizeWeak: () => memoizeWeak,
- metadataHelper: () => metadataHelper,
min: () => min,
minAndMax: () => minAndMax,
missingFileModifiedTime: () => missingFileModifiedTime,
modifierToFlag: () => modifierToFlag,
modifiersToFlags: () => modifiersToFlags,
+ moduleExportNameIsDefault: () => moduleExportNameIsDefault,
+ moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
+ moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
moduleOptionDeclaration: () => moduleOptionDeclaration,
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
@@ -1964,11 +1886,11 @@ __export(typescript_exports, {
nodePosToString: () => nodePosToString,
nodeSeenTracker: () => nodeSeenTracker,
nodeStartsNewLexicalEnvironment: () => nodeStartsNewLexicalEnvironment,
- nodeToDisplayParts: () => nodeToDisplayParts,
noop: () => noop,
noopFileWatcher: () => noopFileWatcher,
normalizePath: () => normalizePath,
normalizeSlashes: () => normalizeSlashes,
+ normalizeSpans: () => normalizeSpans,
not: () => not,
notImplemented: () => notImplemented,
notImplementedResolver: () => notImplementedResolver,
@@ -1983,13 +1905,11 @@ __export(typescript_exports, {
optionsForBuild: () => optionsForBuild,
optionsForWatch: () => optionsForWatch,
optionsHaveChanges: () => optionsHaveChanges,
- optionsHaveModuleResolutionChanges: () => optionsHaveModuleResolutionChanges,
or: () => or,
orderedRemoveItem: () => orderedRemoveItem,
orderedRemoveItemAt: () => orderedRemoveItemAt,
packageIdToPackageName: () => packageIdToPackageName,
packageIdToString: () => packageIdToString,
- paramHelper: () => paramHelper,
parameterIsThisKeyword: () => parameterIsThisKeyword,
parameterNamePart: () => parameterNamePart,
parseBaseNodeFactory: () => parseBaseNodeFactory,
@@ -2020,10 +1940,8 @@ __export(typescript_exports, {
pathIsBareSpecifier: () => pathIsBareSpecifier,
pathIsRelative: () => pathIsRelative,
patternText: () => patternText,
- perfLogger: () => perfLogger,
performIncrementalCompilation: () => performIncrementalCompilation,
performance: () => ts_performance_exports,
- plainJSErrors: () => plainJSErrors,
positionBelongsToNode: () => positionBelongsToNode,
positionIsASICandidate: () => positionIsASICandidate,
positionIsSynthesized: () => positionIsSynthesized,
@@ -2036,7 +1954,6 @@ __export(typescript_exports, {
programContainsEsModules: () => programContainsEsModules,
programContainsModules: () => programContainsModules,
projectReferenceIsEqualTo: () => projectReferenceIsEqualTo,
- propKeyHelper: () => propKeyHelper,
propertyNamePart: () => propertyNamePart,
pseudoBigIntToString: () => pseudoBigIntToString,
punctuationPart: () => punctuationPart,
@@ -2059,7 +1976,6 @@ __export(typescript_exports, {
rangeStartPositionsAreOnSameLine: () => rangeStartPositionsAreOnSameLine,
readBuilderProgram: () => readBuilderProgram,
readConfigFile: () => readConfigFile,
- readHelper: () => readHelper,
readJson: () => readJson,
readJsonConfigFile: () => readJsonConfigFile,
readJsonOrUndefined: () => readJsonOrUndefined,
@@ -2070,7 +1986,7 @@ __export(typescript_exports, {
reducePathComponents: () => reducePathComponents,
refactor: () => ts_refactor_exports,
regExpEscape: () => regExpEscape,
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
relativeComplement: () => relativeComplement,
removeAllComments: () => removeAllComments,
removeEmitHelper: () => removeEmitHelper,
@@ -2078,7 +1994,6 @@ __export(typescript_exports, {
removeFileExtension: () => removeFileExtension,
removeIgnoredPath: () => removeIgnoredPath,
removeMinAndVersionNumbers: () => removeMinAndVersionNumbers,
- removeOptionality: () => removeOptionality,
removePrefix: () => removePrefix,
removeSuffix: () => removeSuffix,
removeTrailingDirectorySeparator: () => removeTrailingDirectorySeparator,
@@ -2097,20 +2012,16 @@ __export(typescript_exports, {
resolveTripleslashReference: () => resolveTripleslashReference,
resolveTypeReferenceDirective: () => resolveTypeReferenceDirective,
resolvingEmptyArray: () => resolvingEmptyArray,
- restHelper: () => restHelper,
returnFalse: () => returnFalse,
returnNoopFileWatcher: () => returnNoopFileWatcher,
returnTrue: () => returnTrue,
returnUndefined: () => returnUndefined,
returnsPromise: () => returnsPromise,
- runInitializersHelper: () => runInitializersHelper,
sameFlatMap: () => sameFlatMap,
sameMap: () => sameMap,
sameMapping: () => sameMapping,
- scanShebangTrivia: () => scanShebangTrivia,
scanTokenAtPosition: () => scanTokenAtPosition,
scanner: () => scanner,
- screenStartingMessageCodes: () => screenStartingMessageCodes,
semanticDiagnosticsOptionDeclarations: () => semanticDiagnosticsOptionDeclarations,
serializeCompilerOptions: () => serializeCompilerOptions,
server: () => ts_server_exports4,
@@ -2118,16 +2029,13 @@ __export(typescript_exports, {
setCommentRange: () => setCommentRange,
setConfigFileInOptions: () => setConfigFileInOptions,
setConstantValue: () => setConstantValue,
- setEachParent: () => setEachParent,
setEmitFlags: () => setEmitFlags,
- setFunctionNameHelper: () => setFunctionNameHelper,
setGetSourceFileAsHashVersioned: () => setGetSourceFileAsHashVersioned,
setIdentifierAutoGenerate: () => setIdentifierAutoGenerate,
setIdentifierGeneratedImportReference: () => setIdentifierGeneratedImportReference,
setIdentifierTypeArguments: () => setIdentifierTypeArguments,
setInternalEmitFlags: () => setInternalEmitFlags,
setLocalizedDiagnosticMessages: () => setLocalizedDiagnosticMessages,
- setModuleDefaultHelper: () => setModuleDefaultHelper,
setNodeChildren: () => setNodeChildren,
setNodeFlags: () => setNodeFlags,
setObjectAllocator: () => setObjectAllocator,
@@ -2156,7 +2064,6 @@ __export(typescript_exports, {
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
showModuleSpecifier: () => showModuleSpecifier,
- signatureHasLiteralTypes: () => signatureHasLiteralTypes,
signatureHasRestParameter: () => signatureHasRestParameter,
signatureToDisplayParts: () => signatureToDisplayParts,
single: () => single,
@@ -2165,18 +2072,17 @@ __export(typescript_exports, {
singleOrMany: () => singleOrMany,
singleOrUndefined: () => singleOrUndefined,
skipAlias: () => skipAlias,
- skipAssertions: () => skipAssertions,
skipConstraint: () => skipConstraint,
skipOuterExpressions: () => skipOuterExpressions,
skipParentheses: () => skipParentheses,
skipPartiallyEmittedExpressions: () => skipPartiallyEmittedExpressions,
skipTrivia: () => skipTrivia,
skipTypeChecking: () => skipTypeChecking,
+ skipTypeCheckingIgnoringNoCheck: () => skipTypeCheckingIgnoringNoCheck,
skipTypeParentheses: () => skipTypeParentheses,
skipWhile: () => skipWhile,
sliceAfter: () => sliceAfter,
some: () => some,
- sort: () => sort,
sortAndDeduplicate: () => sortAndDeduplicate,
sortAndDeduplicateDiagnostics: () => sortAndDeduplicateDiagnostics,
sourceFileAffectingCompilerOptions: () => sourceFileAffectingCompilerOptions,
@@ -2185,8 +2091,6 @@ __export(typescript_exports, {
sourceMapCommentRegExpDontCareLineStart: () => sourceMapCommentRegExpDontCareLineStart,
spacePart: () => spacePart,
spanMap: () => spanMap,
- spreadArrayHelper: () => spreadArrayHelper,
- stableSort: () => stableSort,
startEndContainsRange: () => startEndContainsRange,
startEndOverlapsWithStartEnd: () => startEndOverlapsWithStartEnd,
startOnNewLine: () => startOnNewLine,
@@ -2199,10 +2103,8 @@ __export(typescript_exports, {
stringToToken: () => stringToToken,
stripQuotes: () => stripQuotes,
supportedDeclarationExtensions: () => supportedDeclarationExtensions,
- supportedJSExtensions: () => supportedJSExtensions,
supportedJSExtensionsFlat: () => supportedJSExtensionsFlat,
supportedLocaleDirectories: () => supportedLocaleDirectories,
- supportedTSExtensions: () => supportedTSExtensions,
supportedTSExtensionsFlat: () => supportedTSExtensionsFlat,
supportedTSImplementationExtensions: () => supportedTSImplementationExtensions,
suppressLeadingAndTrailingTrivia: () => suppressLeadingAndTrailingTrivia,
@@ -2211,16 +2113,12 @@ __export(typescript_exports, {
symbolEscapedNameNoDefault: () => symbolEscapedNameNoDefault,
symbolName: () => symbolName,
symbolNameNoDefault: () => symbolNameNoDefault,
- symbolPart: () => symbolPart,
symbolToDisplayParts: () => symbolToDisplayParts,
- syntaxMayBeASICandidate: () => syntaxMayBeASICandidate,
- syntaxRequiresTrailingSemicolonOrASI: () => syntaxRequiresTrailingSemicolonOrASI,
sys: () => sys,
sysLog: () => sysLog,
tagNamesAreEquivalent: () => tagNamesAreEquivalent,
takeWhile: () => takeWhile,
targetOptionDeclaration: () => targetOptionDeclaration,
- templateObjectHelper: () => templateObjectHelper,
testFormatSettings: () => testFormatSettings,
textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
textChangeRangeNewSpan: () => textChangeRangeNewSpan,
@@ -2228,7 +2126,10 @@ __export(typescript_exports, {
textOrKeywordPart: () => textOrKeywordPart,
textPart: () => textPart,
textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
+ textRangeContainsTextSpan: () => textRangeContainsTextSpan,
+ textRangeIntersectsWithTextSpan: () => textRangeIntersectsWithTextSpan,
textSpanContainsPosition: () => textSpanContainsPosition,
+ textSpanContainsTextRange: () => textSpanContainsTextRange,
textSpanContainsTextSpan: () => textSpanContainsTextSpan,
textSpanEnd: () => textSpanEnd,
textSpanIntersection: () => textSpanIntersection,
@@ -2246,15 +2147,16 @@ __export(typescript_exports, {
toBuilderStateFileInfoForMultiEmit: () => toBuilderStateFileInfoForMultiEmit,
toEditorSettings: () => toEditorSettings,
toFileNameLowerCase: () => toFileNameLowerCase,
- toLowerCase: () => toLowerCase,
toPath: () => toPath,
toProgramEmitPending: () => toProgramEmitPending,
+ toSorted: () => toSorted,
tokenIsIdentifierOrKeyword: () => tokenIsIdentifierOrKeyword,
tokenIsIdentifierOrKeywordOrGreaterThan: () => tokenIsIdentifierOrKeywordOrGreaterThan,
tokenToString: () => tokenToString,
trace: () => trace,
tracing: () => tracing,
tracingEnabled: () => tracingEnabled,
+ transferSourceFileChildren: () => transferSourceFileChildren,
transform: () => transform,
transformClassFields: () => transformClassFields,
transformDeclarations: () => transformDeclarations,
@@ -2269,11 +2171,11 @@ __export(typescript_exports, {
transformESDecorators: () => transformESDecorators,
transformESNext: () => transformESNext,
transformGenerators: () => transformGenerators,
+ transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
transformJsx: () => transformJsx,
transformLegacyDecorators: () => transformLegacyDecorators,
transformModule: () => transformModule,
transformNamedEvaluation: () => transformNamedEvaluation,
- transformNodeModule: () => transformNodeModule,
transformNodes: () => transformNodes,
transformSystemModule: () => transformSystemModule,
transformTypeScript: () => transformTypeScript,
@@ -2300,7 +2202,6 @@ __export(typescript_exports, {
tryGetPropertyNameOfBindingOrAssignmentElement: () => tryGetPropertyNameOfBindingOrAssignmentElement,
tryGetSourceMappingURL: () => tryGetSourceMappingURL,
tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
- tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
tryParseJson: () => tryParseJson,
tryParsePattern: () => tryParsePattern,
tryParsePatterns: () => tryParsePatterns,
@@ -2322,7 +2223,6 @@ __export(typescript_exports, {
unescapeLeadingUnderscores: () => unescapeLeadingUnderscores,
unmangleScopedPackageName: () => unmangleScopedPackageName,
unorderedRemoveItem: () => unorderedRemoveItem,
- unorderedRemoveItemAt: () => unorderedRemoveItemAt,
unreachableCodeIsError: () => unreachableCodeIsError,
unsetNodeChildren: () => unsetNodeChildren,
unusedLabelIsError: () => unusedLabelIsError,
@@ -2335,11 +2235,9 @@ __export(typescript_exports, {
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
updateSourceFile: () => updateSourceFile,
updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories,
- usesExtensionsOnImports: () => usesExtensionsOnImports,
usingSingleLineStringWriter: () => usingSingleLineStringWriter,
utf16EncodeAsString: () => utf16EncodeAsString,
validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage,
- valuesHelper: () => valuesHelper,
version: () => version,
versionMajorMinor: () => versionMajorMinor,
visitArray: () => visitArray,
@@ -2352,7 +2250,6 @@ __export(typescript_exports, {
visitNodes: () => visitNodes2,
visitParameterList: () => visitParameterList,
walkUpBindingElementsAndPatterns: () => walkUpBindingElementsAndPatterns,
- walkUpLexicalEnvironments: () => walkUpLexicalEnvironments,
walkUpOuterExpressions: () => walkUpOuterExpressions,
walkUpParenthesizedExpressions: () => walkUpParenthesizedExpressions,
walkUpParenthesizedTypes: () => walkUpParenthesizedTypes,
@@ -2366,8 +2263,8 @@ __export(typescript_exports, {
module.exports = __toCommonJS(typescript_exports);
// src/compiler/corePublic.ts
-var versionMajorMinor = "5.5";
-var version = "5.5.2";
+var versionMajorMinor = "5.6";
+var version = "5.6.2";
var Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -2378,12 +2275,11 @@ var Comparison = /* @__PURE__ */ ((Comparison3) => {
// src/compiler/core.ts
var emptyArray = [];
var emptyMap = /* @__PURE__ */ new Map();
-var emptySet = /* @__PURE__ */ new Set();
function length(array) {
- return array ? array.length : 0;
+ return array !== void 0 ? array.length : 0;
}
function forEach(array, callback) {
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const result = callback(array[i], i);
if (result) {
@@ -2394,7 +2290,7 @@ function forEach(array, callback) {
return void 0;
}
function forEachRight(array, callback) {
- if (array) {
+ if (array !== void 0) {
for (let i = array.length - 1; i >= 0; i--) {
const result = callback(array[i], i);
if (result) {
@@ -2450,13 +2346,13 @@ function intersperse(input, element) {
}
const result = [];
for (let i = 0, n = input.length; i < n; i++) {
- if (i) result.push(element);
+ if (i !== 0) result.push(element);
result.push(input[i]);
}
return result;
}
function every(array, callback) {
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
if (!callback(array[i], i)) {
return false;
@@ -2503,30 +2399,18 @@ function findLastIndex(array, predicate, startIndex) {
}
return -1;
}
-function findMap(array, callback) {
- for (let i = 0; i < array.length; i++) {
- const result = callback(array[i], i);
- if (result) {
- return result;
- }
- }
- return Debug.fail();
-}
function contains(array, value, equalityComparer = equateValues) {
- if (array) {
- for (const v of array) {
- if (equalityComparer(v, value)) {
+ if (array !== void 0) {
+ for (let i = 0; i < array.length; i++) {
+ if (equalityComparer(array[i], value)) {
return true;
}
}
}
return false;
}
-function arraysEqual(a, b, equalityComparer = equateValues) {
- return a.length === b.length && a.every((x, i) => equalityComparer(x, b[i]));
-}
function indexOfAnyCharCode(text, charCodes, start) {
- for (let i = start || 0; i < text.length; i++) {
+ for (let i = start ?? 0; i < text.length; i++) {
if (contains(charCodes, text.charCodeAt(i))) {
return i;
}
@@ -2535,7 +2419,7 @@ function indexOfAnyCharCode(text, charCodes, start) {
}
function countWhere(array, predicate) {
let count = 0;
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const v = array[i];
if (predicate(v, i)) {
@@ -2546,7 +2430,7 @@ function countWhere(array, predicate) {
return count;
}
function filter(array, f) {
- if (array) {
+ if (array !== void 0) {
const len = array.length;
let i = 0;
while (i < len && f(array[i])) i++;
@@ -2580,7 +2464,7 @@ function clear(array) {
}
function map(array, f) {
let result;
- if (array) {
+ if (array !== void 0) {
result = [];
for (let i = 0; i < array.length; i++) {
result.push(f(array[i], i));
@@ -2594,7 +2478,7 @@ function* mapIterator(iter, mapFn) {
}
}
function sameMap(array, f) {
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const item = array[i];
const mapped = f(item, i);
@@ -2612,7 +2496,8 @@ function sameMap(array, f) {
}
function flatten(array) {
const result = [];
- for (const v of array) {
+ for (let i = 0; i < array.length; i++) {
+ const v = array[i];
if (v) {
if (isArray(v)) {
addRange(result, v);
@@ -2625,7 +2510,7 @@ function flatten(array) {
}
function flatMap(array, mapfn) {
let result;
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const v = mapfn(array[i], i);
if (v) {
@@ -2637,11 +2522,11 @@ function flatMap(array, mapfn) {
}
}
}
- return result || emptyArray;
+ return result ?? emptyArray;
}
function flatMapToMutable(array, mapfn) {
const result = [];
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const v = mapfn(array[i], i);
if (v) {
@@ -2664,7 +2549,7 @@ function* flatMapIterator(iter, mapfn) {
}
function sameFlatMap(array, mapfn) {
let result;
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const item = array[i];
const mapped = mapfn(item, i);
@@ -2680,7 +2565,7 @@ function sameFlatMap(array, mapfn) {
}
}
}
- return result || array;
+ return result ?? array;
}
function mapAllOrFail(array, mapFn) {
const result = [];
@@ -2695,7 +2580,7 @@ function mapAllOrFail(array, mapFn) {
}
function mapDefined(array, mapFn) {
const result = [];
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const mapped = mapFn(array[i], i);
if (mapped !== void 0) {
@@ -2713,22 +2598,6 @@ function* mapDefinedIterator(iter, mapFn) {
}
}
}
-function mapDefinedEntries(map2, f) {
- if (!map2) {
- return void 0;
- }
- const result = /* @__PURE__ */ new Map();
- map2.forEach((value, key) => {
- const entry = f(key, value);
- if (entry !== void 0) {
- const [newKey, newValue] = entry;
- if (newKey !== void 0 && newValue !== void 0) {
- result.set(newKey, newValue);
- }
- }
- });
- return result;
-}
function getOrUpdate(map2, key, callback) {
if (map2.has(key)) {
return map2.get(key);
@@ -2749,7 +2618,7 @@ function* singleIterator(value) {
}
function spanMap(array, keyfn, mapfn) {
let result;
- if (array) {
+ if (array !== void 0) {
result = [];
const len = array.length;
let previousKey;
@@ -2781,7 +2650,7 @@ function spanMap(array, keyfn, mapfn) {
return result;
}
function mapEntries(map2, f) {
- if (!map2) {
+ if (map2 === void 0) {
return void 0;
}
const result = /* @__PURE__ */ new Map();
@@ -2792,10 +2661,10 @@ function mapEntries(map2, f) {
return result;
}
function some(array, predicate) {
- if (array) {
- if (predicate) {
- for (const v of array) {
- if (predicate(v)) {
+ if (array !== void 0) {
+ if (predicate !== void 0) {
+ for (let i = 0; i < array.length; i++) {
+ if (predicate(array[i])) {
return true;
}
}
@@ -2820,8 +2689,8 @@ function getRangesWhere(arr, pred, cb) {
if (start !== void 0) cb(start, arr.length);
}
function concatenate(array1, array2) {
- if (!some(array2)) return array1;
- if (!some(array1)) return array2;
+ if (array2 === void 0 || array2.length === 0) return array1;
+ if (array1 === void 0 || array1.length === 0) return array2;
return [...array1, ...array2];
}
function selectIndex(_, i) {
@@ -2848,8 +2717,8 @@ function deduplicateRelational(array, equalityComparer, comparer) {
}
function deduplicateEquality(array, equalityComparer) {
const result = [];
- for (const item of array) {
- pushIfUnique(result, item, equalityComparer);
+ for (let i = 0; i < array.length; i++) {
+ pushIfUnique(result, array[i], equalityComparer);
}
return result;
}
@@ -2903,19 +2772,10 @@ function insertSorted(array, insert, compare, equalityComparer, allowDuplicates)
return false;
}
function sortAndDeduplicate(array, comparer, equalityComparer) {
- return deduplicateSorted(sort(array, comparer), equalityComparer || comparer || compareStringsCaseSensitive);
-}
-function arrayIsSorted(array, comparer) {
- if (array.length < 2) return true;
- for (let i = 1, len = array.length; i < len; i++) {
- if (comparer(array[i - 1], array[i]) === 1 /* GreaterThan */) {
- return false;
- }
- }
- return true;
+ return deduplicateSorted(toSorted(array, comparer), equalityComparer ?? comparer ?? compareStringsCaseSensitive);
}
function arrayIsEqualTo(array1, array2, equalityComparer = equateValues) {
- if (!array1 || !array2) {
+ if (array1 === void 0 || array2 === void 0) {
return array1 === array2;
}
if (array1.length !== array2.length) {
@@ -2930,20 +2790,18 @@ function arrayIsEqualTo(array1, array2, equalityComparer = equateValues) {
}
function compact(array) {
let result;
- if (array) {
+ if (array !== void 0) {
for (let i = 0; i < array.length; i++) {
const v = array[i];
- if (result || !v) {
- if (!result) {
- result = array.slice(0, i);
- }
+ if (result ?? !v) {
+ result ?? (result = array.slice(0, i));
if (v) {
result.push(v);
}
}
}
}
- return result || array;
+ return result ?? array;
}
function relativeComplement(arrayA, arrayB, comparer) {
if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0) return arrayB;
@@ -3008,7 +2866,7 @@ function pushIfUnique(array, toAdd, equalityComparer) {
}
}
function appendIfUnique(array, toAdd, equalityComparer) {
- if (array) {
+ if (array !== void 0) {
pushIfUnique(array, toAdd, equalityComparer);
return array;
} else {
@@ -3018,19 +2876,14 @@ function appendIfUnique(array, toAdd, equalityComparer) {
function stableSortIndices(array, indices, comparer) {
indices.sort((x, y) => comparer(array[x], array[y]) || compareValues(x, y));
}
-function sort(array, comparer) {
- return array.length === 0 ? array : array.slice().sort(comparer);
+function toSorted(array, comparer) {
+ return array.length === 0 ? emptyArray : array.slice().sort(comparer);
}
function* arrayReverseIterator(array) {
for (let i = array.length - 1; i >= 0; i--) {
yield array[i];
}
}
-function stableSort(array, comparer) {
- const indices = indicesOf(array);
- stableSortIndices(array, indices, comparer);
- return indices.map((i) => array[i]);
-}
function rangeEquals(array1, array2, pos, end) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
@@ -3041,7 +2894,7 @@ function rangeEquals(array1, array2, pos, end) {
return true;
}
var elementAt = !!Array.prototype.at ? (array, offset) => array == null ? void 0 : array.at(offset) : (array, offset) => {
- if (array) {
+ if (array !== void 0) {
offset = toOffset(array, offset);
if (offset < array.length) {
return array[offset];
@@ -3053,7 +2906,7 @@ function firstOrUndefined(array) {
return array === void 0 || array.length === 0 ? void 0 : array[0];
}
function firstOrUndefinedIterator(iter) {
- if (iter) {
+ if (iter !== void 0) {
for (const value of iter) {
return value;
}
@@ -3078,13 +2931,13 @@ function last(array) {
return array[array.length - 1];
}
function singleOrUndefined(array) {
- return array && array.length === 1 ? array[0] : void 0;
+ return array !== void 0 && array.length === 1 ? array[0] : void 0;
}
function single(array) {
return Debug.checkDefined(singleOrUndefined(array));
}
function singleOrMany(array) {
- return array && array.length === 1 ? array[0] : array;
+ return array !== void 0 && array.length === 1 ? array[0] : array;
}
function replaceElement(array, index, value) {
const result = array.slice(0);
@@ -3098,7 +2951,7 @@ function binarySearchKey(array, key, keySelector, keyComparer, offset) {
if (!some(array)) {
return -1;
}
- let low = offset || 0;
+ let low = offset ?? 0;
let high = array.length - 1;
while (low <= high) {
const middle = low + (high - low >> 1);
@@ -3216,7 +3069,8 @@ function equalOwnProperties(left, right, equalityComparer = equateValues) {
}
function arrayToMap(array, makeKey, makeValue = identity) {
const result = /* @__PURE__ */ new Map();
- for (const value of array) {
+ for (let i = 0; i < array.length; i++) {
+ const value = array[i];
const key = makeKey(value);
if (key !== void 0) result.set(key, makeValue(value));
}
@@ -3224,14 +3078,16 @@ function arrayToMap(array, makeKey, makeValue = identity) {
}
function arrayToNumericMap(array, makeKey, makeValue = identity) {
const result = [];
- for (const value of array) {
+ for (let i = 0; i < array.length; i++) {
+ const value = array[i];
result[makeKey(value)] = makeValue(value);
}
return result;
}
function arrayToMultiMap(values, makeKey, makeValue = identity) {
const result = createMultiMap();
- for (const value of values) {
+ for (let i = 0; i < values.length; i++) {
+ const value = values[i];
result.add(makeKey(value), makeValue(value));
}
return result;
@@ -3241,8 +3097,9 @@ function group(values, getGroupId, resultSelector = identity) {
}
function groupBy(values, keySelector) {
const result = {};
- if (values) {
- for (const value of values) {
+ if (values !== void 0) {
+ for (let i = 0; i < values.length; i++) {
+ const value = values[i];
const key = `${keySelector(value)}`;
const array = result[key] ?? (result[key] = []);
array.push(value);
@@ -3281,7 +3138,7 @@ function copyProperties(first2, second) {
}
}
function maybeBind(obj, fn) {
- return fn ? fn.bind(obj) : void 0;
+ return fn == null ? void 0 : fn.bind(obj);
}
function createMultiMap() {
const map2 = /* @__PURE__ */ new Map();
@@ -3291,7 +3148,7 @@ function createMultiMap() {
}
function multiMapAdd(key, value) {
let values = this.get(key);
- if (values) {
+ if (values !== void 0) {
values.push(value);
} else {
this.set(key, values = [value]);
@@ -3300,7 +3157,7 @@ function multiMapAdd(key, value) {
}
function multiMapRemove(key, value) {
const values = this.get(key);
- if (values) {
+ if (values !== void 0) {
unorderedRemoveItem(values, value);
if (!values.length) {
this.delete(key);
@@ -3308,7 +3165,7 @@ function multiMapRemove(key, value) {
}
}
function createQueue(items) {
- const elements = (items == null ? void 0 : items.slice()) || [];
+ const elements = (items == null ? void 0 : items.slice()) ?? [];
let headIndex = 0;
function isEmpty() {
return headIndex === elements.length;
@@ -3359,13 +3216,8 @@ function createSet(getHashCode, equals) {
const hash = getHashCode(element);
if (!multiMap.has(hash)) return false;
const candidates = multiMap.get(hash);
- if (!isArray(candidates)) return equals(candidates, element);
- for (const candidate of candidates) {
- if (equals(candidate, element)) {
- return true;
- }
- }
- return false;
+ if (isArray(candidates)) return contains(candidates, element, equals);
+ return equals(candidates, element);
},
add(element) {
const hash = getHashCode(element);
@@ -3519,46 +3371,6 @@ function memoizeOne(callback) {
return value;
};
}
-function memoizeWeak(callback) {
- const map2 = /* @__PURE__ */ new WeakMap();
- return (arg) => {
- let value = map2.get(arg);
- if (value === void 0 && !map2.has(arg)) {
- value = callback(arg);
- map2.set(arg, value);
- }
- return value;
- };
-}
-function memoizeCached(callback, cache) {
- return (...args) => {
- let value = cache.get(args);
- if (value === void 0 && !cache.has(args)) {
- value = callback(...args);
- cache.set(args, value);
- }
- return value;
- };
-}
-function compose(a, b, c, d, e) {
- if (!!e) {
- const args = [];
- for (let i = 0; i < arguments.length; i++) {
- args[i] = arguments[i];
- }
- return (t) => reduceLeft(args, (u, f) => f(u), t);
- } else if (d) {
- return (t) => d(c(b(a(t))));
- } else if (c) {
- return (t) => c(b(a(t)));
- } else if (b) {
- return (t) => b(a(t));
- } else if (a) {
- return (t) => a(t);
- } else {
- return (t) => t;
- }
-}
var AssertionLevel = /* @__PURE__ */ ((AssertionLevel2) => {
AssertionLevel2[AssertionLevel2["None"] = 0] = "None";
AssertionLevel2[AssertionLevel2["Normal"] = 1] = "Normal";
@@ -3584,6 +3396,12 @@ function compareValues(a, b) {
function compareTextSpans(a, b) {
return compareValues(a == null ? void 0 : a.start, b == null ? void 0 : b.start) || compareValues(a == null ? void 0 : a.length, b == null ? void 0 : b.length);
}
+function maxBy(arr, init, mapper) {
+ for (let i = 0; i < arr.length; i++) {
+ init = Math.max(init, mapper(arr[i]));
+ }
+ return init;
+}
function min(items, compare) {
return reduceLeft(items, (x, y) => compare(x, y) === -1 /* LessThan */ ? x : y);
}
@@ -3635,8 +3453,8 @@ function setUILocale(value) {
}
}
function compareStringsCaseSensitiveUI(a, b) {
- const comparer = uiComparerCaseSensitive || (uiComparerCaseSensitive = createUIStringComparer(uiLocale));
- return comparer(a, b);
+ uiComparerCaseSensitive ?? (uiComparerCaseSensitive = createUIStringComparer(uiLocale));
+ return uiComparerCaseSensitive(a, b);
}
function compareProperties(a, b, key, comparer) {
return a === b ? 0 /* EqualTo */ : a === void 0 ? -1 /* LessThan */ : b === void 0 ? 1 /* GreaterThan */ : comparer(a[key], b[key]);
@@ -3796,7 +3614,8 @@ function matchedText(pattern, candidate) {
function findBestPatternMatch(values, getPattern, candidate) {
let matchedValue;
let longestMatchPrefixLength = -1;
- for (const v of values) {
+ for (let i = 0; i < values.length; i++) {
+ const v = values[i];
const pattern = getPattern(v);
if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
longestMatchPrefixLength = pattern.prefix.length;
@@ -3841,7 +3660,7 @@ function singleElementArray(t) {
return t === void 0 ? void 0 : [t];
}
function enumerateInsertsAndDeletes(newItems, oldItems, comparer, inserted, deleted, unchanged) {
- unchanged = unchanged || noop;
+ unchanged ?? (unchanged = noop);
let newIndex = 0;
let oldIndex = 0;
const newLen = newItems.length;
@@ -3903,7 +3722,7 @@ function cartesianProductWorker(arrays, result, outer, index) {
}
}
function takeWhile(array, predicate) {
- if (array) {
+ if (array !== void 0) {
const len = array.length;
let index = 0;
while (index < len && predicate(array[index])) {
@@ -3913,7 +3732,7 @@ function takeWhile(array, predicate) {
}
}
function skipWhile(array, predicate) {
- if (array) {
+ if (array !== void 0) {
const len = array.length;
let index = 0;
while (index < len && predicate(array[index])) {
@@ -4209,7 +4028,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
result.push([value, name]);
}
}
- const sorted = stableSort(result, (x, y) => compareValues(x[0], y[0]));
+ const sorted = toSorted(result, (x, y) => compareValues(x[0], y[0]));
enumMemberCache.set(enumObject, sorted);
return sorted;
}
@@ -4418,7 +4237,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
Object.defineProperties(array, {
__tsDebuggerDisplay: {
value(defaultValue) {
- defaultValue = String(defaultValue).replace(/(?:,[\s\w\d_]+:[^,]+)+\]$/, "]");
+ defaultValue = String(defaultValue).replace(/(?:,[\s\w]+:[^,]+)+\]$/, "]");
return `NodeArray ${defaultValue}`;
}
}
@@ -4838,7 +4657,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
}
function renderGraph() {
const columnCount = columnWidths.length;
- const laneCount = nodes.reduce((x, n) => Math.max(x, n.lane), 0) + 1;
+ const laneCount = maxBy(nodes, 0, (n) => n.lane) + 1;
const lanes = fill(Array(laneCount), "");
const grid = columnWidths.map(() => Array(laneCount));
const connectors = columnWidths.map(() => fill(Array(laneCount), 0));
@@ -4961,7 +4780,7 @@ var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
var buildPartRegExp = /^[a-z0-9-]+$/i;
-var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
+var numericIdentifierRegExp = /^(?:0|[1-9]\d*)$/;
var _Version = class _Version {
constructor(major, minor = 0, patch = 0, prerelease = "", build2 = "") {
if (typeof major === "string") {
@@ -5084,11 +4903,11 @@ var VersionRange = class _VersionRange {
return formatDisjunction(this._alternatives);
}
};
-var logicalOrRegExp = /\|\|/g;
-var whitespaceRegExp = /\s+/g;
-var partialRegExp = /^([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:\.([xX*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
+var logicalOrRegExp = /\|\|/;
+var whitespaceRegExp = /\s+/;
+var partialRegExp = /^([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
-var rangeRegExp = /^(~|\^|<|<=|>|>=|=)?\s*([a-z0-9-+.*]+)$/i;
+var rangeRegExp = /^([~^<>=]|<=|>=)?\s*([a-z0-9-+.*]+)$/i;
function parseRange(text) {
const alternatives = [];
for (let range of text.trim().split(logicalOrRegExp)) {
@@ -5240,10 +5059,12 @@ function tryGetPerformance() {
if (isNodeLikeSystem()) {
try {
const { performance: performance2 } = require("perf_hooks");
- return {
- shouldWriteNativeEvents: false,
- performance: performance2
- };
+ if (performance2) {
+ return {
+ shouldWriteNativeEvents: false,
+ performance: performance2
+ };
+ }
} catch {
}
}
@@ -5279,16 +5100,6 @@ function tryGetNativePerformanceHooks() {
}
var timestamp = nativePerformanceTime ? () => nativePerformanceTime.now() : Date.now;
-// src/compiler/perfLogger.ts
-var etwModule;
-try {
- const etwModulePath = process.env.TS_ETW_MODULE_PATH ?? "./node_modules/@microsoft/typescript-etw";
- etwModule = require(etwModulePath);
-} catch (e) {
- etwModule = void 0;
-}
-var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : void 0;
-
// src/compiler/_namespaces/ts.performance.ts
var ts_performance_exports = {};
__export(ts_performance_exports, {
@@ -6177,12 +5988,21 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
- RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
RelationComparisonResult3[RelationComparisonResult3["ReportsUnmeasurable"] = 8] = "ReportsUnmeasurable";
RelationComparisonResult3[RelationComparisonResult3["ReportsUnreliable"] = 16] = "ReportsUnreliable";
RelationComparisonResult3[RelationComparisonResult3["ReportsMask"] = 24] = "ReportsMask";
+ RelationComparisonResult3[RelationComparisonResult3["ComplexityOverflow"] = 32] = "ComplexityOverflow";
+ RelationComparisonResult3[RelationComparisonResult3["StackDepthOverflow"] = 64] = "StackDepthOverflow";
+ RelationComparisonResult3[RelationComparisonResult3["Overflow"] = 96] = "Overflow";
return RelationComparisonResult3;
})(RelationComparisonResult || {});
+var PredicateSemantics = /* @__PURE__ */ ((PredicateSemantics2) => {
+ PredicateSemantics2[PredicateSemantics2["None"] = 0] = "None";
+ PredicateSemantics2[PredicateSemantics2["Always"] = 1] = "Always";
+ PredicateSemantics2[PredicateSemantics2["Never"] = 2] = "Never";
+ PredicateSemantics2[PredicateSemantics2["Sometimes"] = 3] = "Sometimes";
+ return PredicateSemantics2;
+})(PredicateSemantics || {});
var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["None"] = 0] = "None";
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Auto"] = 1] = "Auto";
@@ -6227,6 +6047,7 @@ var TokenFlags = /* @__PURE__ */ ((TokenFlags2) => {
TokenFlags2[TokenFlags2["HexEscape"] = 4096] = "HexEscape";
TokenFlags2[TokenFlags2["ContainsLeadingZero"] = 8192] = "ContainsLeadingZero";
TokenFlags2[TokenFlags2["ContainsInvalidSeparator"] = 16384] = "ContainsInvalidSeparator";
+ TokenFlags2[TokenFlags2["PrecedingJSDocLeadingAsterisks"] = 32768] = "PrecedingJSDocLeadingAsterisks";
TokenFlags2[TokenFlags2["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier";
TokenFlags2[TokenFlags2["WithSpecifier"] = 448] = "WithSpecifier";
TokenFlags2[TokenFlags2["StringLiteralFlags"] = 7176] = "StringLiteralFlags";
@@ -6281,6 +6102,7 @@ var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagno
var EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
EmitOnly4[EmitOnly4["Js"] = 0] = "Js";
EmitOnly4[EmitOnly4["Dts"] = 1] = "Dts";
+ EmitOnly4[EmitOnly4["BuilderSignature"] = 2] = "BuilderSignature";
return EmitOnly4;
})(EmitOnly || {});
var StructureIsReused = /* @__PURE__ */ ((StructureIsReused2) => {
@@ -6350,17 +6172,21 @@ var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple";
NodeBuilderFlags2[NodeBuilderFlags2["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
NodeBuilderFlags2[NodeBuilderFlags2["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType";
- NodeBuilderFlags2[NodeBuilderFlags2["WriteComputedProps"] = 1073741824] = "WriteComputedProps";
- NodeBuilderFlags2[NodeBuilderFlags2["NoSyntacticPrinter"] = -2147483648] = "NoSyntacticPrinter";
NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
- NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
- NodeBuilderFlags2[NodeBuilderFlags2["AllowUnresolvedNames"] = 1] = "AllowUnresolvedNames";
NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors";
NodeBuilderFlags2[NodeBuilderFlags2["InObjectTypeLiteral"] = 4194304] = "InObjectTypeLiteral";
NodeBuilderFlags2[NodeBuilderFlags2["InTypeAlias"] = 8388608] = "InTypeAlias";
NodeBuilderFlags2[NodeBuilderFlags2["InInitialEntityName"] = 16777216] = "InInitialEntityName";
return NodeBuilderFlags2;
})(NodeBuilderFlags || {});
+var InternalNodeBuilderFlags = /* @__PURE__ */ ((InternalNodeBuilderFlags2) => {
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["None"] = 0] = "None";
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["WriteComputedProps"] = 1] = "WriteComputedProps";
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["NoSyntacticPrinter"] = 2] = "NoSyntacticPrinter";
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["DoNotIncludeSymbolChain"] = 4] = "DoNotIncludeSymbolChain";
+ InternalNodeBuilderFlags2[InternalNodeBuilderFlags2["AllowUnresolvedNames"] = 8] = "AllowUnresolvedNames";
+ return InternalNodeBuilderFlags2;
+})(InternalNodeBuilderFlags || {});
var TypeFormatFlags = /* @__PURE__ */ ((TypeFormatFlags2) => {
TypeFormatFlags2[TypeFormatFlags2["None"] = 0] = "None";
TypeFormatFlags2[TypeFormatFlags2["NoTruncation"] = 1] = "NoTruncation";
@@ -6405,11 +6231,6 @@ var SymbolAccessibility = /* @__PURE__ */ ((SymbolAccessibility2) => {
SymbolAccessibility2[SymbolAccessibility2["NotResolved"] = 3] = "NotResolved";
return SymbolAccessibility2;
})(SymbolAccessibility || {});
-var SyntheticSymbolKind = /* @__PURE__ */ ((SyntheticSymbolKind2) => {
- SyntheticSymbolKind2[SyntheticSymbolKind2["UnionOrIntersection"] = 0] = "UnionOrIntersection";
- SyntheticSymbolKind2[SyntheticSymbolKind2["Spread"] = 1] = "Spread";
- return SyntheticSymbolKind2;
-})(SyntheticSymbolKind || {});
var TypePredicateKind = /* @__PURE__ */ ((TypePredicateKind2) => {
TypePredicateKind2[TypePredicateKind2["This"] = 0] = "This";
TypePredicateKind2[TypePredicateKind2["Identifier"] = 1] = "Identifier";
@@ -6575,6 +6396,7 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
+ NodeCheckFlags3[NodeCheckFlags3["PartiallyTypeChecked"] = 8388608] = "PartiallyTypeChecked";
NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
return NodeCheckFlags3;
})(NodeCheckFlags || {});
@@ -6728,7 +6550,7 @@ var AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
AccessFlags2[AccessFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
AccessFlags2[AccessFlags2["Writing"] = 4] = "Writing";
AccessFlags2[AccessFlags2["CacheSymbol"] = 8] = "CacheSymbol";
- AccessFlags2[AccessFlags2["NoTupleBoundsCheck"] = 16] = "NoTupleBoundsCheck";
+ AccessFlags2[AccessFlags2["AllowMissing"] = 16] = "AllowMissing";
AccessFlags2[AccessFlags2["ExpressionPosition"] = 32] = "ExpressionPosition";
AccessFlags2[AccessFlags2["ReportDeprecated"] = 64] = "ReportDeprecated";
AccessFlags2[AccessFlags2["SuppressNoImplicitAnyError"] = 128] = "SuppressNoImplicitAnyError";
@@ -6922,22 +6744,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
return ScriptKind7;
})(ScriptKind || {});
-var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
- ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
- ScriptTarget11[ScriptTarget11["ES5"] = 1] = "ES5";
- ScriptTarget11[ScriptTarget11["ES2015"] = 2] = "ES2015";
- ScriptTarget11[ScriptTarget11["ES2016"] = 3] = "ES2016";
- ScriptTarget11[ScriptTarget11["ES2017"] = 4] = "ES2017";
- ScriptTarget11[ScriptTarget11["ES2018"] = 5] = "ES2018";
- ScriptTarget11[ScriptTarget11["ES2019"] = 6] = "ES2019";
- ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
- ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
- ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
- ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
- ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
- ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
- ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
- return ScriptTarget11;
+var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
+ ScriptTarget12[ScriptTarget12["ES3"] = 0] = "ES3";
+ ScriptTarget12[ScriptTarget12["ES5"] = 1] = "ES5";
+ ScriptTarget12[ScriptTarget12["ES2015"] = 2] = "ES2015";
+ ScriptTarget12[ScriptTarget12["ES2016"] = 3] = "ES2016";
+ ScriptTarget12[ScriptTarget12["ES2017"] = 4] = "ES2017";
+ ScriptTarget12[ScriptTarget12["ES2018"] = 5] = "ES2018";
+ ScriptTarget12[ScriptTarget12["ES2019"] = 6] = "ES2019";
+ ScriptTarget12[ScriptTarget12["ES2020"] = 7] = "ES2020";
+ ScriptTarget12[ScriptTarget12["ES2021"] = 8] = "ES2021";
+ ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022";
+ ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023";
+ ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext";
+ ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON";
+ ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
+ return ScriptTarget12;
})(ScriptTarget || {});
var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
@@ -7299,9 +7121,10 @@ var OuterExpressionKinds = /* @__PURE__ */ ((OuterExpressionKinds2) => {
OuterExpressionKinds2[OuterExpressionKinds2["TypeAssertions"] = 2] = "TypeAssertions";
OuterExpressionKinds2[OuterExpressionKinds2["NonNullAssertions"] = 4] = "NonNullAssertions";
OuterExpressionKinds2[OuterExpressionKinds2["PartiallyEmittedExpressions"] = 8] = "PartiallyEmittedExpressions";
+ OuterExpressionKinds2[OuterExpressionKinds2["ExpressionsWithTypeArguments"] = 16] = "ExpressionsWithTypeArguments";
OuterExpressionKinds2[OuterExpressionKinds2["Assertions"] = 6] = "Assertions";
- OuterExpressionKinds2[OuterExpressionKinds2["All"] = 15] = "All";
- OuterExpressionKinds2[OuterExpressionKinds2["ExcludeJSDocTypeAssertion"] = 16] = "ExcludeJSDocTypeAssertion";
+ OuterExpressionKinds2[OuterExpressionKinds2["All"] = 31] = "All";
+ OuterExpressionKinds2[OuterExpressionKinds2["ExcludeJSDocTypeAssertion"] = -2147483648] = "ExcludeJSDocTypeAssertion";
return OuterExpressionKinds2;
})(OuterExpressionKinds || {});
var LexicalEnvironmentFlags = /* @__PURE__ */ ((LexicalEnvironmentFlags2) => {
@@ -8407,7 +8230,7 @@ function patchWriteFileEnsuringDirectory(sys2) {
var sys = (() => {
const byteOrderMarkIndicator = "\uFEFF";
function getNodeSystem() {
- const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
+ const nativePattern = /^native |^\([^)]+\)$|^(?:internal[\\/]|[\w\s]+(?:\.js)?$)/;
const _fs = require("fs");
const _path = require("path");
const _os = require("os");
@@ -8465,6 +8288,7 @@ var sys = (() => {
writeFile: writeFile2,
watchFile: watchFile2,
watchDirectory,
+ preferNonRecursiveWatch: !fsSupportsRecursiveFsWatch,
resolvePath: (path) => _path.resolve(path),
fileExists,
directoryExists,
@@ -8517,7 +8341,7 @@ var sys = (() => {
disableCPUProfiler,
cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
realpath,
- debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)) || !!process.recordreplay,
+ debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
tryEnableSourceMapsForHost() {
try {
require("source-map-support").install();
@@ -8527,7 +8351,7 @@ var sys = (() => {
setTimeout,
clearTimeout,
clearScreen: () => {
- process.stdout.write("\x1Bc");
+ process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
},
setBlocking: () => {
var _a;
@@ -8668,11 +8492,11 @@ var sys = (() => {
callback
);
}
- function readFileWorker(fileName, _encoding) {
+ function readFile(fileName, _encoding) {
let buffer;
try {
buffer = _fs.readFileSync(fileName);
- } catch (e) {
+ } catch {
return void 0;
}
let len = buffer.length;
@@ -8693,16 +8517,7 @@ var sys = (() => {
}
return buffer.toString("utf8");
}
- function readFile(fileName, _encoding) {
- var _a, _b;
- (_a = perfLogger) == null ? void 0 : _a.logStartReadFile(fileName);
- const file = readFileWorker(fileName, _encoding);
- (_b = perfLogger) == null ? void 0 : _b.logStopReadFile();
- return file;
- }
function writeFile2(fileName, data, writeByteOrderMark) {
- var _a;
- (_a = perfLogger) == null ? void 0 : _a.logEvent("WriteFile: " + fileName);
if (writeByteOrderMark) {
data = byteOrderMarkIndicator + data;
}
@@ -8723,8 +8538,6 @@ var sys = (() => {
}
}
function getAccessibleFileSystemEntries(path) {
- var _a;
- (_a = perfLogger) == null ? void 0 : _a.logEvent("ReadDir: " + (path || "."));
try {
const entries = _fs.readdirSync(path || ".", { withFileTypes: true });
const files = [];
@@ -8742,7 +8555,7 @@ var sys = (() => {
if (!stat) {
continue;
}
- } catch (e) {
+ } catch {
continue;
}
} else {
@@ -8757,7 +8570,7 @@ var sys = (() => {
files.sort();
directories.sort();
return { files, directories };
- } catch (e) {
+ } catch {
return emptyFileSystemEntries;
}
}
@@ -8780,7 +8593,7 @@ var sys = (() => {
default:
return false;
}
- } catch (e) {
+ } catch {
return false;
} finally {
Error.stackTraceLimit = originalStackTraceLimit;
@@ -8811,7 +8624,7 @@ var sys = (() => {
Error.stackTraceLimit = 0;
try {
return (_a = statSync(path)) == null ? void 0 : _a.mtime;
- } catch (e) {
+ } catch {
return void 0;
} finally {
Error.stackTraceLimit = originalStackTraceLimit;
@@ -8820,14 +8633,14 @@ var sys = (() => {
function setModifiedTime(path, time) {
try {
_fs.utimesSync(path, time, time);
- } catch (e) {
+ } catch {
return;
}
}
function deleteFile(path) {
try {
return _fs.unlinkSync(path);
- } catch (e) {
+ } catch {
return;
}
}
@@ -8881,7 +8694,7 @@ function pathIsAbsolute(path) {
return getEncodedRootLength(path) !== 0;
}
function pathIsRelative(path) {
- return /^\.\.?($|[\\/])/.test(path);
+ return /^\.\.?(?:$|[\\/])/.test(path);
}
function pathIsBareSpecifier(path) {
return !pathIsAbsolute(path) && !pathIsRelative(path);
@@ -9120,7 +8933,7 @@ function changeFullExtension(path, newExtension) {
}
return changeAnyExtension(path, newExtension);
}
-var relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
+var relativePathSegmentRegExp = /\/\/|(?:^|\/)\.\.?(?:$|\/)/;
function comparePathsWorker(a, b, componentComparer) {
if (a === b) return 0 /* EqualTo */;
if (a === void 0) return -1 /* LessThan */;
@@ -9508,6 +9321,7 @@ var Diagnostics = {
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
+ ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -9523,7 +9337,7 @@ var Diagnostics = {
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, 1 /* Error */, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, 1 /* Error */, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
- Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
+ Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodene_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'."),
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, 1 /* Error */, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, 1 /* Error */, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
@@ -9716,6 +9530,20 @@ var Diagnostics = {
This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
+ Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1538, 1 /* Error */, "Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_se_1538", "Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
+ A_bigint_literal_cannot_be_used_as_a_property_name: diag(1539, 1 /* Error */, "A_bigint_literal_cannot_be_used_as_a_property_name_1539", "A 'bigint' literal cannot be used as a property name."),
+ A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead: diag(
+ 1540,
+ 2 /* Suggestion */,
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540",
+ "A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.",
+ /*reportsUnnecessary*/
+ void 0,
+ /*elidedInCompatabilityPyramid*/
+ void 0,
+ /*reportsDeprecated*/
+ true
+ ),
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -9970,7 +9798,6 @@ var Diagnostics = {
The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES5_Consider_using_a_standard_function_or_method: diag(2522, 1 /* Error */, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES5_Consider_using_a_sta_2522", "The 'arguments' object cannot be referenced in an async function or method in ES5. Consider using a standard function or method."),
yield_expressions_cannot_be_used_in_a_parameter_initializer: diag(2523, 1 /* Error */, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."),
await_expressions_cannot_be_used_in_a_parameter_initializer: diag(2524, 1 /* Error */, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."),
- Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: diag(2525, 1 /* Error */, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."),
A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: diag(2526, 1 /* Error */, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."),
The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary: diag(2527, 1 /* Error */, "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."),
A_module_cannot_have_multiple_default_exports: diag(2528, 1 /* Error */, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."),
@@ -10283,6 +10110,11 @@ var Diagnostics = {
Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun: diag(2867, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2867", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig: diag(2868, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2868", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig."),
+ Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish: diag(2869, 1 /* Error */, "Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish_2869", "Right operand of ?? is unreachable because the left operand is never nullish."),
+ This_binary_expression_is_never_nullish_Are_you_missing_parentheses: diag(2870, 1 /* Error */, "This_binary_expression_is_never_nullish_Are_you_missing_parentheses_2870", "This binary expression is never nullish. Are you missing parentheses?"),
+ This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
+ This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
+ This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -10359,7 +10191,7 @@ var Diagnostics = {
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
- Property_0_of_exported_class_expression_may_not_be_private_or_protected: diag(4094, 1 /* Error */, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."),
+ Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected: diag(4094, 1 /* Error */, "Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected_4094", "Property '{0}' of exported anonymous class type may not be private or protected."),
Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4095, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4096, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4097, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."),
@@ -10396,7 +10228,6 @@ var Diagnostics = {
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
Cannot_read_file_0_Colon_1: diag(5012, 1 /* Error */, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."),
- Failed_to_parse_file_0_Colon_1: diag(5014, 1 /* Error */, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."),
Unknown_compiler_option_0: diag(5023, 1 /* Error */, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."),
Compiler_option_0_requires_a_value_of_type_1: diag(5024, 1 /* Error */, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."),
Unknown_compiler_option_0_Did_you_mean_1: diag(5025, 1 /* Error */, "Unknown_compiler_option_0_Did_you_mean_1_5025", "Unknown compiler option '{0}'. Did you mean '{1}'?"),
@@ -10459,6 +10290,7 @@ var Diagnostics = {
Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."),
Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."),
Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."),
+ Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b: diag(5111, 1 /* Error */, "Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if__5111", "Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'."),
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -10597,7 +10429,6 @@ var Diagnostics = {
Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, 3 /* Message */, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", 'Parse in strict mode and emit "use strict" for each source file.'),
Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, 1 /* Error */, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."),
Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, 3 /* Message */, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."),
- Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, 3 /* Message */, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."),
Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, 3 /* Message */, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."),
Resolution_for_module_0_was_found_in_cache_from_location_1: diag(6147, 3 /* Message */, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."),
Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, 3 /* Message */, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."),
@@ -10839,6 +10670,8 @@ var Diagnostics = {
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
+ Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -10885,6 +10718,7 @@ var Diagnostics = {
Ensure_that_casing_is_correct_in_imports: diag(6637, 3 /* Message */, "Ensure_that_casing_is_correct_in_imports_6637", "Ensure that casing is correct in imports."),
Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging: diag(6638, 3 /* Message */, "Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging_6638", "Emit a v8 CPU profile of the compiler run for debugging."),
Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file: diag(6639, 3 /* Message */, "Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file_6639", "Allow importing helper functions from tslib once per project, instead of including them per-file."),
+ Skip_building_downstream_projects_on_error_in_upstream_project: diag(6640, 3 /* Message */, "Skip_building_downstream_projects_on_error_in_upstream_project_6640", "Skip building downstream projects on error in upstream project."),
Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation: diag(6641, 3 /* Message */, "Specify_a_list_of_glob_patterns_that_match_files_to_be_included_in_compilation_6641", "Specify a list of glob patterns that match files to be included in compilation."),
Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects: diag(6642, 3 /* Message */, "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642", "Save .tsbuildinfo files to allow for incremental compilation of projects."),
Include_sourcemap_files_inside_the_emitted_JavaScript: diag(6643, 3 /* Message */, "Include_sourcemap_files_inside_the_emitted_JavaScript_6643", "Include sourcemap files inside the emitted JavaScript."),
@@ -10961,9 +10795,12 @@ var Diagnostics = {
Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
+ Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any: diag(6720, 3 /* Message */, "Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any_6720", "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'."),
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
+ Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
+ This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
@@ -11457,7 +11294,8 @@ var Diagnostics = {
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is__18055", "'{0}' has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled."),
- Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
+ Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled."),
+ String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020: diag(18057, 1 /* Error */, "String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es_18057", "String literal import and export names are not supported when the '--module' flag is set to 'es2015' or 'es2020'.")
};
// src/compiler/deno.ts
@@ -11466,28 +11304,21 @@ __export(deno_exports, {
createDenoForkContext: () => createDenoForkContext,
parseNpmPackageReference: () => parseNpmPackageReference,
setIsNodeSourceFileCallback: () => setIsNodeSourceFileCallback,
- setNodeBuiltInModuleNames: () => setNodeBuiltInModuleNames,
setNodeOnlyGlobalNames: () => setNodeOnlyGlobalNames,
tryParseNpmPackageReference: () => tryParseNpmPackageReference
});
var isNodeSourceFile = () => false;
-var nodeBuiltInModuleNames = /* @__PURE__ */ new Set();
var nodeOnlyGlobalNames = /* @__PURE__ */ new Set();
function setIsNodeSourceFileCallback(callback) {
isNodeSourceFile = callback;
}
-function setNodeBuiltInModuleNames(names) {
- nodeBuiltInModuleNames = new Set(names);
-}
function setNodeOnlyGlobalNames(names) {
- nodeBuiltInModuleNames = new Set(names);
nodeOnlyGlobalNames = new Set(names);
}
function createDenoForkContext({
mergeSymbol,
globals,
- nodeGlobals,
- ambientModuleSymbolRegex: ambientModuleSymbolRegex2
+ nodeGlobals
}) {
return {
hasNodeSourceFile,
@@ -11501,15 +11332,6 @@ function createDenoForkContext({
return isNodeSourceFile(sourceFile);
}
function getGlobalsForName(id) {
- if (ambientModuleSymbolRegex2.test(id)) {
- if (id.startsWith('"node:')) {
- const name = id.slice(6, -1);
- if (nodeBuiltInModuleNames.has(name)) {
- return globals;
- }
- }
- return nodeGlobals;
- }
return nodeOnlyGlobalNames.has(id) ? nodeGlobals : globals;
}
function mergeGlobalSymbolTable(node, source, unidirectional = false) {
@@ -11777,16 +11599,16 @@ var textToToken = new Map(Object.entries({
"#": 63 /* HashToken */,
"`": 62 /* BacktickToken */
}));
-var charToRegExpFlag = new Map(Object.entries({
- d: 1 /* HasIndices */,
- g: 2 /* Global */,
- i: 4 /* IgnoreCase */,
- m: 8 /* Multiline */,
- s: 16 /* DotAll */,
- u: 32 /* Unicode */,
- v: 64 /* UnicodeSets */,
- y: 128 /* Sticky */
-}));
+var charCodeToRegExpFlag = /* @__PURE__ */ new Map([
+ [100 /* d */, 1 /* HasIndices */],
+ [103 /* g */, 2 /* Global */],
+ [105 /* i */, 4 /* IgnoreCase */],
+ [109 /* m */, 8 /* Multiline */],
+ [115 /* s */, 16 /* DotAll */],
+ [117 /* u */, 32 /* Unicode */],
+ [118 /* v */, 64 /* UnicodeSets */],
+ [121 /* y */, 128 /* Sticky */]
+]);
var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
[1 /* HasIndices */, 9 /* RegularExpressionFlagsHasIndices */],
[16 /* DotAll */, 5 /* RegularExpressionFlagsDotAll */],
@@ -11842,12 +11664,12 @@ function tokenToString(t) {
function stringToToken(s) {
return textToToken.get(s);
}
-var regExpFlagChars = makeReverseMap(charToRegExpFlag);
-function regularExpressionFlagToCharacter(f) {
- return regExpFlagChars[f];
+var regExpFlagCharCodes = makeReverseMap(charCodeToRegExpFlag);
+function regularExpressionFlagToCharacterCode(f) {
+ return regExpFlagCharCodes[f];
}
-function characterToRegularExpressionFlag(c) {
- return charToRegExpFlag.get(c);
+function characterCodeToRegularExpressionFlag(ch) {
+ return charCodeToRegExpFlag.get(ch);
}
function computeLineStarts(text) {
const result = [];
@@ -11884,7 +11706,7 @@ function computePositionOfLineAndCharacter(lineStarts, line, character, debugTex
if (allowEdits) {
line = line < 0 ? 0 : line >= lineStarts.length ? lineStarts.length - 1 : line;
} else {
- Debug.fail(`Bad line number. Line: ${line}, lineStarts.length: ${lineStarts.length} , line map is correct? ${debugText !== void 0 ? arraysEqual(lineStarts, computeLineStarts(debugText)) : "unknown"}`);
+ Debug.fail(`Bad line number. Line: ${line}, lineStarts.length: ${lineStarts.length} , line map is correct? ${debugText !== void 0 ? arrayIsEqualTo(lineStarts, computeLineStarts(debugText)) : "unknown"}`);
}
}
const res = lineStarts[line] + character;
@@ -12333,6 +12155,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
hasExtendedUnicodeEscape: () => (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0,
hasPrecedingLineBreak: () => (tokenFlags & 1 /* PrecedingLineBreak */) !== 0,
hasPrecedingJSDocComment: () => (tokenFlags & 2 /* PrecedingJSDocComment */) !== 0,
+ hasPrecedingJSDocLeadingAsterisks: () => (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) !== 0,
isIdentifier: () => token === 80 /* Identifier */ || token > 118 /* LastReservedWord */,
isReservedWord: () => token >= 83 /* FirstReservedWord */ && token <= 118 /* LastReservedWord */,
isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
@@ -12749,9 +12572,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
case 34 /* doubleQuote */:
return '"';
case 117 /* u */:
- if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
+ if (pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
pos -= 2;
- return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
+ const result = scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
+ if (!(flags & 17 /* AllowExtendedUnicodeEscape */)) {
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
+ error2(Diagnostics.Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
+ }
+ }
+ return result;
}
for (; pos < start2 + 6; pos++) {
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
@@ -12769,7 +12599,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
const nextStart = pos;
let nextPos = pos + 2;
for (; nextPos < nextStart + 6; nextPos++) {
- if (!isHexDigit(charCodeUnchecked(pos))) {
+ if (!isHexDigit(charCodeUnchecked(nextPos))) {
return escapedValueString;
}
}
@@ -12973,7 +12803,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
function scan() {
fullStartPos = pos;
tokenFlags = 0 /* None */;
- let asteriskSeen = false;
while (true) {
tokenStart = pos;
if (pos >= end) {
@@ -13089,8 +12918,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
}
pos++;
- if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
- asteriskSeen = true;
+ if (skipJsDocLeadingAsterisks && (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) === 0 && tokenFlags & 1 /* PrecedingLineBreak */) {
+ tokenFlags |= 32768 /* PrecedingJSDocLeadingAsterisks */;
continue;
}
return token = 42 /* AsteriskToken */;
@@ -13563,24 +13392,25 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
pos++;
let regExpFlags = 0 /* None */;
while (true) {
- const ch = charCodeChecked(pos);
+ const ch = codePointChecked(pos);
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
break;
}
+ const size = charSize(ch);
if (reportErrors2) {
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
+ const flag = characterCodeToRegularExpressionFlag(ch);
if (flag === void 0) {
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
} else if (regExpFlags & flag) {
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
} else if (((regExpFlags | flag) & 96 /* AnyUnicodeMode */) === 96 /* AnyUnicodeMode */) {
- error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, 1);
+ error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, size);
} else {
regExpFlags |= flag;
- checkRegularExpressionFlagAvailable(flag, pos);
+ checkRegularExpressionFlagAvailability(flag, size);
}
}
- pos++;
+ pos += size;
}
if (reportErrors2) {
scanRange(startOfRegExpBody, endOfRegExpBody - startOfRegExpBody, () => {
@@ -13795,22 +13625,23 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
}
function scanPatternModifiers(currFlags) {
while (true) {
- const ch = charCodeChecked(pos);
+ const ch = codePointChecked(pos);
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
break;
}
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
+ const size = charSize(ch);
+ const flag = characterCodeToRegularExpressionFlag(ch);
if (flag === void 0) {
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
} else if (currFlags & flag) {
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
} else if (!(flag & 28 /* Modifiers */)) {
- error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
+ error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, size);
} else {
currFlags |= flag;
- checkRegularExpressionFlagAvailable(flag, pos);
+ checkRegularExpressionFlagAvailability(flag, size);
}
- pos++;
+ pos += size;
}
return currFlags;
}
@@ -14396,7 +14227,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
return value;
}
function scanSourceCharacter() {
- const size = anyUnicodeMode ? charSize(charCodeChecked(pos)) : 1;
+ const size = anyUnicodeMode ? charSize(codePointChecked(pos)) : 1;
pos += size;
return size > 0 ? text.substring(pos - size, pos) : "";
}
@@ -14414,6 +14245,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
forEach(groupNameReferences, (reference) => {
if (!(groupSpecifiers == null ? void 0 : groupSpecifiers.has(reference.name))) {
error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
+ if (groupSpecifiers) {
+ const suggestion = getSpellingSuggestion(reference.name, groupSpecifiers, identity);
+ if (suggestion) {
+ error2(Diagnostics.Did_you_mean_0, reference.pos, reference.end - reference.pos, suggestion);
+ }
+ }
}
});
forEach(decimalEscapes, (escape) => {
@@ -14426,10 +14263,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
}
});
}
- function checkRegularExpressionFlagAvailable(flag, pos2) {
+ function checkRegularExpressionFlagAvailability(flag, size) {
const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
if (availableFrom && languageVersion < availableFrom) {
- error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos2, 1, getNameOfScriptTarget(availableFrom));
+ error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, size, getNameOfScriptTarget(availableFrom));
}
}
function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
@@ -14861,12 +14698,18 @@ function textSpanIsEmpty(span) {
function textSpanContainsPosition(span, position) {
return position >= span.start && position < textSpanEnd(span);
}
-function textRangeContainsPositionInclusive(span, position) {
- return position >= span.pos && position <= span.end;
+function textRangeContainsPositionInclusive(range, position) {
+ return position >= range.pos && position <= range.end;
}
function textSpanContainsTextSpan(span, other) {
return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
}
+function textSpanContainsTextRange(span, range) {
+ return range.pos >= span.start && range.end <= textSpanEnd(span);
+}
+function textRangeContainsTextSpan(range, span) {
+ return span.start >= range.pos && textSpanEnd(span) <= range.end;
+}
function textSpanOverlapsWith(span, other) {
return textSpanOverlap(span, other) !== void 0;
}
@@ -14888,11 +14731,34 @@ function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {
function textSpanIntersectsWithPosition(span, position) {
return position <= textSpanEnd(span) && position >= span.start;
}
+function textRangeIntersectsWithTextSpan(range, span) {
+ return textSpanIntersectsWith(span, range.pos, range.end - range.pos);
+}
function textSpanIntersection(span1, span2) {
const start = Math.max(span1.start, span2.start);
const end = Math.min(textSpanEnd(span1), textSpanEnd(span2));
return start <= end ? createTextSpanFromBounds(start, end) : void 0;
}
+function normalizeSpans(spans) {
+ spans = spans.filter((span) => span.length > 0).sort((a, b) => {
+ return a.start !== b.start ? a.start - b.start : a.length - b.length;
+ });
+ const result = [];
+ let i = 0;
+ while (i < spans.length) {
+ let span = spans[i];
+ let j = i + 1;
+ while (j < spans.length && textSpanIntersectsWithTextSpan(span, spans[j])) {
+ const start = Math.min(span.start, spans[j].start);
+ const end = Math.max(textSpanEnd(span), textSpanEnd(spans[j]));
+ span = createTextSpanFromBounds(start, end);
+ j++;
+ }
+ i = j;
+ result.push(span);
+ }
+ return result;
+}
function createTextSpan(start, length2) {
if (start < 0) {
throw new Error("start < 0");
@@ -15010,7 +14876,7 @@ function getNodeFlags(node) {
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
function validateLocaleAndSetLanguage(locale, sys2, errors) {
const lowerCaseLocale = locale.toLowerCase();
- const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
+ const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
if (!matchResult) {
if (errors) {
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
@@ -15018,7 +14884,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
return;
}
const language = matchResult[1];
- const territory = matchResult[3];
+ const territory = matchResult[2];
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
trySetLanguageAndTerritory(
language,
@@ -15042,7 +14908,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
let fileContents = "";
try {
fileContents = sys2.readFile(filePath);
- } catch (e) {
+ } catch {
if (errors2) {
errors2.push(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, filePath));
}
@@ -15441,13 +15307,6 @@ function getJSDocTags(node) {
false
);
}
-function getJSDocTagsNoCache(node) {
- return getJSDocTagsWorker(
- node,
- /*noCache*/
- true
- );
-}
function getFirstJSDocTag(node, predicate, noCache) {
return find(getJSDocTagsWorker(node, noCache), predicate);
}
@@ -15550,9 +15409,6 @@ function isNamedExportBindings(node) {
function isJSDocPropertyLikeTag(node) {
return node.kind === 348 /* JSDocPropertyTag */ || node.kind === 341 /* JSDocParameterTag */;
}
-function isNode(node) {
- return isNodeKind(node.kind);
-}
function isNodeKind(kind) {
return kind >= 166 /* FirstNode */;
}
@@ -15764,17 +15620,6 @@ function isMethodOrAccessor(node) {
return false;
}
}
-function isNamedClassElement(node) {
- switch (node.kind) {
- case 174 /* MethodDeclaration */:
- case 177 /* GetAccessor */:
- case 178 /* SetAccessor */:
- case 172 /* PropertyDeclaration */:
- return true;
- default:
- return false;
- }
-}
function isModifierLike(node) {
return isModifier(node) || isDecorator(node);
}
@@ -16008,9 +15853,6 @@ function isAssertionExpression(node) {
const kind = node.kind;
return kind === 216 /* TypeAssertionExpression */ || kind === 234 /* AsExpression */;
}
-function isNotEmittedOrPartiallyEmittedNode(node) {
- return isNotEmittedStatement(node) || isPartiallyEmittedExpression(node);
-}
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
case 248 /* ForStatement */:
@@ -16495,6 +16337,12 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.alternateResult === newResolution.alternateResult;
}
+function getResolvedModuleFromResolution(resolution) {
+ return resolution.resolvedModule;
+}
+function getResolvedTypeReferenceDirectiveFromResolution(resolution) {
+ return resolution.resolvedTypeReferenceDirective;
+}
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
var _a;
const alternateResult = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.alternateResult;
@@ -16529,6 +16377,34 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
if (result) result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
return result;
}
+function createModeMismatchDetails(currentSourceFile) {
+ const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
+ const scope = currentSourceFile.packageJsonScope;
+ const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
+ const result = scope && !scope.contents.packageJsonContent.type ? targetExt ? chainDiagnosticMessages(
+ /*details*/
+ void 0,
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
+ targetExt,
+ combinePaths(scope.packageDirectory, "package.json")
+ ) : chainDiagnosticMessages(
+ /*details*/
+ void 0,
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
+ combinePaths(scope.packageDirectory, "package.json")
+ ) : targetExt ? chainDiagnosticMessages(
+ /*details*/
+ void 0,
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
+ targetExt
+ ) : chainDiagnosticMessages(
+ /*details*/
+ void 0,
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
+ );
+ result.repopulateInfo = () => true;
+ return result;
+}
function packageIdIsEqual(a, b) {
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
}
@@ -16719,7 +16595,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
}
if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
return skipTrivia(
- (sourceFile || getSourceFileOfNode(node)).text,
+ (sourceFile ?? getSourceFileOfNode(node)).text,
node.pos,
/*stopAfterLineBreak*/
false,
@@ -16731,13 +16607,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
}
if (node.kind === 352 /* SyntaxList */) {
- const first2 = firstOrUndefined(getNodeChildren(node));
+ sourceFile ?? (sourceFile = getSourceFileOfNode(node));
+ const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
if (first2) {
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
}
}
return skipTrivia(
- (sourceFile || getSourceFileOfNode(node)).text,
+ (sourceFile ?? getSourceFileOfNode(node)).text,
node.pos,
/*stopAfterLineBreak*/
false,
@@ -16753,6 +16630,13 @@ function getNonDecoratorTokenPosOfNode(node, sourceFile) {
}
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastDecorator.end);
}
+function getNonModifierTokenPosOfNode(node, sourceFile) {
+ const lastModifier = !nodeIsMissing(node) && canHaveModifiers(node) && node.modifiers ? last(node.modifiers) : void 0;
+ if (!lastModifier) {
+ return getTokenPosOfNode(node, sourceFile);
+ }
+ return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastModifier.end);
+}
function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia = false) {
return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia);
}
@@ -16760,7 +16644,16 @@ function isJSDocTypeExpressionOrChild(node) {
return !!findAncestor(node, isJSDocTypeExpression);
}
function isExportNamespaceAsDefaultDeclaration(node) {
- return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && node.exportClause.name.escapedText === "default");
+ return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && moduleExportNameIsDefault(node.exportClause.name));
+}
+function moduleExportNameTextUnescaped(node) {
+ return node.kind === 11 /* StringLiteral */ ? node.text : unescapeLeadingUnderscores(node.escapedText);
+}
+function moduleExportNameTextEscaped(node) {
+ return node.kind === 11 /* StringLiteral */ ? escapeLeadingUnderscores(node.text) : node.escapedText;
+}
+function moduleExportNameIsDefault(node) {
+ return (node.kind === 11 /* StringLiteral */ ? node.text : node.escapedText) === "default" /* Default */;
}
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia = false) {
if (nodeIsMissing(node)) {
@@ -16813,7 +16706,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Iterator: new Map(Object.entries({
@@ -17090,7 +16987,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Uint8Array: new Map(Object.entries({
@@ -17099,7 +17000,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Uint8ClampedArray: new Map(Object.entries({
@@ -17108,7 +17013,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Int16Array: new Map(Object.entries({
@@ -17117,7 +17026,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Uint16Array: new Map(Object.entries({
@@ -17126,7 +17039,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Int32Array: new Map(Object.entries({
@@ -17135,7 +17052,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Uint32Array: new Map(Object.entries({
@@ -17144,7 +17065,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Float32Array: new Map(Object.entries({
@@ -17153,7 +17078,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Float64Array: new Map(Object.entries({
@@ -17162,7 +17091,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
BigInt64Array: new Map(Object.entries({
@@ -17172,7 +17105,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
BigUint64Array: new Map(Object.entries({
@@ -17182,7 +17119,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
],
es2023: [
"findLastIndex",
- "findLast"
+ "findLast",
+ "toReversed",
+ "toSorted",
+ "toSpliced",
+ "with"
]
})),
Error: new Map(Object.entries({
@@ -17473,6 +17414,7 @@ function tryGetTextOfPropertyName(name) {
return ((_a = name.emitNode) == null ? void 0 : _a.autoGenerate) ? void 0 : name.escapedText;
case 11 /* StringLiteral */:
case 9 /* NumericLiteral */:
+ case 10 /* BigIntLiteral */:
case 15 /* NoSubstitutionTemplateLiteral */:
return escapeLeadingUnderscores(name.text);
case 167 /* ComputedPropertyName */:
@@ -17781,12 +17723,12 @@ function getJSDocCommentRanges(node, text) {
return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
}
-var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
-var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
-var fullTripleSlashLibReferenceRegEx = /^(\/\/\/\s*<reference\s+lib\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
-var fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
-var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+.*?\/>/;
-var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)(('[^']*')|("[^"]*"))\s*\/>/;
+var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
+var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
+var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
+var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
+var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
+var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
function isPartOfTypeNode(node) {
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
return true;
@@ -17869,15 +17811,6 @@ function isPartOfTypeNode(node) {
function isPartOfTypeExpressionWithTypeArguments(node) {
return isJSDocImplementsTag(node.parent) || isJSDocAugmentsTag(node.parent) || isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node);
}
-function isChildOfNodeWithKind(node, kind) {
- while (node) {
- if (node.kind === kind) {
- return true;
- }
- node = node.parent;
- }
- return false;
-}
function forEachReturnStatement(body, visitor) {
return traverse(body);
function traverse(node) {
@@ -18214,9 +18147,6 @@ function getImmediatelyInvokedFunctionExpression(func) {
}
}
}
-function isSuperOrSuperProperty(node) {
- return node.kind === 108 /* SuperKeyword */ || isSuperProperty(node);
-}
function isSuperProperty(node) {
const kind = node.kind;
return (kind === 211 /* PropertyAccessExpression */ || kind === 212 /* ElementAccessExpression */) && node.expression.kind === 108 /* SuperKeyword */;
@@ -18490,9 +18420,6 @@ function isFullSourceFile(sourceFile) {
function isSourceFileJS(file) {
return isInJSFile(file);
}
-function isSourceFileNotJS(file) {
- return !isInJSFile(file);
-}
function isInJSFile(node) {
return !!node && !!(node.flags & 524288 /* JavaScriptFile */);
}
@@ -18794,6 +18721,23 @@ function isFunctionSymbol(symbol) {
const decl = symbol.valueDeclaration;
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
}
+function canHaveModuleSpecifier(node) {
+ switch (node == null ? void 0 : node.kind) {
+ case 260 /* VariableDeclaration */:
+ case 208 /* BindingElement */:
+ case 272 /* ImportDeclaration */:
+ case 278 /* ExportDeclaration */:
+ case 271 /* ImportEqualsDeclaration */:
+ case 273 /* ImportClause */:
+ case 280 /* NamespaceExport */:
+ case 274 /* NamespaceImport */:
+ case 281 /* ExportSpecifier */:
+ case 276 /* ImportSpecifier */:
+ case 205 /* ImportType */:
+ return true;
+ }
+ return false;
+}
function tryGetModuleSpecifierFromDeclaration(node) {
var _a, _b;
switch (node.kind) {
@@ -19275,7 +19219,7 @@ function skipTypeParentheses(node) {
return node;
}
function skipParentheses(node, excludeJSDocTypeAssertions) {
- const flags = excludeJSDocTypeAssertions ? 1 /* Parentheses */ | 16 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */;
+ const flags = excludeJSDocTypeAssertions ? 1 /* Parentheses */ | -2147483648 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */;
return skipOuterExpressions(node, flags);
}
function isDeleteTarget(node) {
@@ -19348,12 +19292,6 @@ function isIdentifierName(node) {
}
return false;
}
-function isAliasSymbolDeclaration(node) {
- if (node.kind === 271 /* ImportEqualsDeclaration */ || node.kind === 270 /* NamespaceExportDeclaration */ || node.kind === 273 /* ImportClause */ && !!node.name || node.kind === 274 /* NamespaceImport */ || node.kind === 280 /* NamespaceExport */ || node.kind === 276 /* ImportSpecifier */ || node.kind === 281 /* ExportSpecifier */ || node.kind === 277 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
- return true;
- }
- return isInJSFile(node) && (isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isPropertyAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */ && isAliasableExpression(node.parent.right));
-}
function getAliasDeclarationFromName(node) {
switch (node.parent.kind) {
case 273 /* ImportClause */:
@@ -19447,17 +19385,10 @@ function isContextualKeyword(token) {
function isNonContextualKeyword(token) {
return isKeyword(token) && !isContextualKeyword(token);
}
-function isFutureReservedKeyword(token) {
- return 119 /* FirstFutureReservedWord */ <= token && token <= 127 /* LastFutureReservedWord */;
-}
function isStringANonContextualKeyword(name) {
const token = stringToToken(name);
return token !== void 0 && isNonContextualKeyword(token);
}
-function isStringAKeyword(name) {
- const token = stringToToken(name);
- return token !== void 0 && isKeyword(token);
-}
function isIdentifierANonContextualKeyword(node) {
const originalKeywordKind = identifierToKeywordKind(node);
return !!originalKeywordKind && !isContextualKeyword(originalKeywordKind);
@@ -19531,6 +19462,7 @@ function getPropertyNameForPropertyNameNode(name) {
case 11 /* StringLiteral */:
case 15 /* NoSubstitutionTemplateLiteral */:
case 9 /* NumericLiteral */:
+ case 10 /* BigIntLiteral */:
return escapeLeadingUnderscores(name.text);
case 167 /* ComputedPropertyName */:
const nameExpression = name.expression;
@@ -19566,9 +19498,6 @@ function getTextOfIdentifierOrLiteral(node) {
function getEscapedTextOfIdentifierOrLiteral(node) {
return isMemberName(node) ? node.escapedText : isJsxNamespacedName(node) ? getEscapedTextOfJsxNamespacedName(node) : escapeLeadingUnderscores(node.text);
}
-function getPropertyNameForUniqueESSymbol(symbol) {
- return `__@${getSymbolId(symbol)}@${symbol.escapedName}`;
-}
function getSymbolNameForPrivateIdentifier(containingClassSymbol, description3) {
return `__#${getSymbolId(containingClassSymbol)}@${description3}`;
}
@@ -19578,9 +19507,6 @@ function isKnownSymbol(symbol) {
function isPrivateIdentifierSymbol(symbol) {
return startsWith(symbol.escapedName, "__#");
}
-function isESSymbolIdentifier(node) {
- return node.kind === 80 /* Identifier */ && node.escapedText === "Symbol";
-}
function isProtoSetter(node) {
return isIdentifier(node) ? idText(node) === "__proto__" : isStringLiteral(node) && node.text === "__proto__";
}
@@ -19670,9 +19596,6 @@ function nodeStartsNewLexicalEnvironment(node) {
function nodeIsSynthesized(range) {
return positionIsSynthesized(range.pos) || positionIsSynthesized(range.end);
}
-function getOriginalSourceFile(sourceFile) {
- return getParseTreeNode(sourceFile, isSourceFile) || sourceFile;
-}
var Associativity = /* @__PURE__ */ ((Associativity2) => {
Associativity2[Associativity2["Left"] = 0] = "Left";
Associativity2[Associativity2["Right"] = 1] = "Right";
@@ -19975,9 +19898,9 @@ function containsInvalidEscapeFlag(node) {
function hasInvalidEscape(template) {
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
}
-var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
-var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
-var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g;
+var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
+var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
+var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
var escapedCharsMap = new Map(Object.entries({
" ": "\\t",
"\v": "\\v",
@@ -20280,11 +20203,11 @@ function getOwnEmitOutputFilePath(fileName, host, extension) {
return emitOutputFilePathWithoutExtension + extension;
}
function getDeclarationEmitOutputFilePath(fileName, host) {
- return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f));
+ return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host);
}
-function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
+function getDeclarationEmitOutputFilePathWorker(fileName, options, host) {
const outputDir = options.declarationDir || options.outDir;
- const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) : fileName;
+ const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f)) : fileName;
const declarationExtension = getDeclarationEmitExtensionForPath(path);
return removeFileExtension(path) + declarationExtension;
}
@@ -20832,9 +20755,6 @@ function tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node) {
function isAssignmentExpression(node, excludeCompoundAssignment) {
return isBinaryExpression(node) && (excludeCompoundAssignment ? node.operatorToken.kind === 64 /* EqualsToken */ : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left);
}
-function isLeftHandSideOfAssignment(node) {
- return isAssignmentExpression(node.parent) && node.parent.left === node;
-}
function isDestructuringAssignment(node) {
if (isAssignmentExpression(
node,
@@ -21088,9 +21008,6 @@ function moveRangePastModifiers(node) {
const lastModifier = canHaveModifiers(node) ? lastOrUndefined(node.modifiers) : void 0;
return lastModifier && !positionIsSynthesized(lastModifier.end) ? moveRangePos(node, lastModifier.end) : moveRangePastDecorators(node);
}
-function isCollapsedRange(range) {
- return range.pos === range.end;
-}
function createTokenRange(pos, token) {
return createRange(pos, pos + tokenToString(token).length);
}
@@ -21332,9 +21249,6 @@ function getClassLikeDeclarationOfSymbol(symbol) {
function getObjectFlags(type) {
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
}
-function forSomeAncestorDirectory(directory, callback) {
- return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
-}
function isUMDExportSymbol(symbol) {
return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
}
@@ -21534,7 +21448,7 @@ function setObjectAllocator(alloc) {
forEach(objectAllocatorPatchers, (fn) => fn(objectAllocator));
}
function formatStringFromArgs(text, args) {
- return text.replace(/{(\d+)}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
+ return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
}
var localizedDiagnosticMessages;
function setLocalizedDiagnosticMessages(messages) {
@@ -21808,8 +21722,8 @@ function walkTreeForJSXTags(node) {
function isFileModuleFromUsingJSXTag(file) {
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
}
-function isFileForcedToBeModuleByFormat(file) {
- return (file.impliedNodeFormat === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
+function isFileForcedToBeModuleByFormat(file, options) {
+ return (getImpliedNodeFormatForEmitWorker(file, options) === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
}
function getSetExternalModuleIndicator(options) {
switch (getEmitModuleDetectionKind(options)) {
@@ -21828,10 +21742,14 @@ function getSetExternalModuleIndicator(options) {
}
checks.push(isFileForcedToBeModuleByFormat);
const combined = or(...checks);
- const callback = (file) => void (file.externalModuleIndicator = combined(file));
+ const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
return callback;
}
}
+function importSyntaxAffectsModuleResolution(options) {
+ const moduleResolution = getEmitModuleResolutionKind(options);
+ return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
+}
function createComputedCompilerOptions(options) {
return options;
}
@@ -22030,6 +21948,12 @@ var computedOptions = createComputedCompilerOptions({
return getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
}
},
+ strictBuiltinIteratorReturn: {
+ dependencies: ["strict"],
+ computeValue: (compilerOptions) => {
+ return getStrictOptionValue(compilerOptions, "strictBuiltinIteratorReturn");
+ }
+ },
alwaysStrict: {
dependencies: ["strict"],
computeValue: (compilerOptions) => {
@@ -22108,7 +22032,12 @@ function getJSXTransformEnabled(options) {
function getJSXImplicitImportBase(compilerOptions, file) {
const jsxImportSourcePragmas = file == null ? void 0 : file.pragmas.get("jsximportsource");
const jsxImportSourcePragma = isArray(jsxImportSourcePragmas) ? jsxImportSourcePragmas[jsxImportSourcePragmas.length - 1] : jsxImportSourcePragmas;
- return compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */ || compilerOptions.jsxImportSource || jsxImportSourcePragma ? (jsxImportSourcePragma == null ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" : void 0;
+ const jsxRuntimePragmas = file == null ? void 0 : file.pragmas.get("jsxruntime");
+ const jsxRuntimePragma = isArray(jsxRuntimePragmas) ? jsxRuntimePragmas[jsxRuntimePragmas.length - 1] : jsxRuntimePragmas;
+ if ((jsxRuntimePragma == null ? void 0 : jsxRuntimePragma.arguments.factory) === "classic") {
+ return void 0;
+ }
+ return compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */ || compilerOptions.jsxImportSource || jsxImportSourcePragma || (jsxRuntimePragma == null ? void 0 : jsxRuntimePragma.arguments.factory) === "automatic" ? (jsxImportSourcePragma == null ? void 0 : jsxImportSourcePragma.arguments.factory) || compilerOptions.jsxImportSource || "react" : void 0;
}
function getJSXRuntimeImport(base, options) {
return base ? `${base}/${options.jsx === 5 /* ReactJSXDev */ ? "jsx-dev-runtime" : "jsx-runtime"}` : void 0;
@@ -22352,7 +22281,7 @@ function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNa
if (visited.has(canonicalPath)) return;
visited.set(canonicalPath, true);
const { files, directories } = getFileSystemEntries(path2);
- for (const current of sort(files, compareStringsCaseSensitive)) {
+ for (const current of toSorted(files, compareStringsCaseSensitive)) {
const name = combinePaths(path2, current);
const absoluteName = combinePaths(absolutePath, current);
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
@@ -22372,7 +22301,7 @@ function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNa
return;
}
}
- for (const current of sort(directories, compareStringsCaseSensitive)) {
+ for (const current of toSorted(directories, compareStringsCaseSensitive)) {
const name = combinePaths(path2, current);
const absoluteName = combinePaths(absolutePath, current);
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) {
@@ -22468,6 +22397,9 @@ function hasJSFileExtension(fileName) {
function hasTSFileExtension(fileName) {
return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
}
+function hasImplementationTSFileExtension(fileName) {
+ return some(supportedTSImplementationExtensions, (extension) => fileExtensionIs(fileName, extension)) && !isDeclarationFileName(fileName);
+}
var ModuleSpecifierEnding = /* @__PURE__ */ ((ModuleSpecifierEnding2) => {
ModuleSpecifierEnding2[ModuleSpecifierEnding2["Minimal"] = 0] = "Minimal";
ModuleSpecifierEnding2[ModuleSpecifierEnding2["Index"] = 1] = "Index";
@@ -22675,9 +22607,27 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
return { pos, end };
}
function skipTypeChecking(sourceFile, options, host) {
- return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnsotics(sourceFile, options);
+ return skipTypeCheckingWorker(
+ sourceFile,
+ options,
+ host,
+ /*ignoreNoCheck*/
+ false
+ );
+}
+function skipTypeCheckingIgnoringNoCheck(sourceFile, options, host) {
+ return skipTypeCheckingWorker(
+ sourceFile,
+ options,
+ host,
+ /*ignoreNoCheck*/
+ true
+ );
+}
+function skipTypeCheckingWorker(sourceFile, options, host, ignoreNoCheck) {
+ return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || !ignoreNoCheck && options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnostics(sourceFile, options);
}
-function canIncludeBindAndCheckDiagnsotics(sourceFile, options) {
+function canIncludeBindAndCheckDiagnostics(sourceFile, options) {
if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) return false;
if (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */ || sourceFile.scriptKind === 5 /* External */) return true;
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
@@ -22851,14 +22801,6 @@ function setParent(child, parent2) {
}
return child;
}
-function setEachParent(children, parent2) {
- if (children) {
- for (const child of children) {
- setParent(child, parent2);
- }
- }
- return children;
-}
function setParentRecursive(rootNode, incremental) {
if (!rootNode) return rootNode;
forEachChildRecursively(rootNode, isJSDocNode(rootNode) ? bindParentToChildIgnoringJSDoc : bindParentToChild);
@@ -23002,7 +22944,7 @@ function isFunctionExpressionOrArrowFunction(node) {
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
}
function escapeSnippetText(text) {
- return text.replace(/\$/gm, () => "\\$");
+ return text.replace(/\$/g, () => "\\$");
}
function isNumericLiteralName(name) {
return (+name).toString() === name;
@@ -23061,10 +23003,6 @@ function getNodeModulePathParts(fullPath) {
fileNameIndex = partStart;
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex, topLevelPackageNameIndex, packageRootIndex, fileNameIndex } : void 0;
}
-function getParameterTypeNode(parameter) {
- var _a;
- return parameter.kind === 341 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) == null ? void 0 : _a.type : parameter.type;
-}
function isTypeDeclaration(node) {
switch (node.kind) {
case 168 /* TypeParameter */:
@@ -23185,6 +23123,105 @@ function replaceFirstStar(s, replacement) {
function getNameFromImportAttribute(node) {
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
}
+function isSourceElement(node) {
+ switch (node.kind) {
+ case 168 /* TypeParameter */:
+ case 169 /* Parameter */:
+ case 172 /* PropertyDeclaration */:
+ case 171 /* PropertySignature */:
+ case 185 /* ConstructorType */:
+ case 184 /* FunctionType */:
+ case 179 /* CallSignature */:
+ case 180 /* ConstructSignature */:
+ case 181 /* IndexSignature */:
+ case 174 /* MethodDeclaration */:
+ case 173 /* MethodSignature */:
+ case 175 /* ClassStaticBlockDeclaration */:
+ case 176 /* Constructor */:
+ case 177 /* GetAccessor */:
+ case 178 /* SetAccessor */:
+ case 183 /* TypeReference */:
+ case 182 /* TypePredicate */:
+ case 186 /* TypeQuery */:
+ case 187 /* TypeLiteral */:
+ case 188 /* ArrayType */:
+ case 189 /* TupleType */:
+ case 192 /* UnionType */:
+ case 193 /* IntersectionType */:
+ case 196 /* ParenthesizedType */:
+ case 190 /* OptionalType */:
+ case 191 /* RestType */:
+ case 197 /* ThisType */:
+ case 198 /* TypeOperator */:
+ case 194 /* ConditionalType */:
+ case 195 /* InferType */:
+ case 203 /* TemplateLiteralType */:
+ case 205 /* ImportType */:
+ case 202 /* NamedTupleMember */:
+ case 328 /* JSDocAugmentsTag */:
+ case 329 /* JSDocImplementsTag */:
+ case 346 /* JSDocTypedefTag */:
+ case 338 /* JSDocCallbackTag */:
+ case 340 /* JSDocEnumTag */:
+ case 345 /* JSDocTemplateTag */:
+ case 344 /* JSDocTypeTag */:
+ case 324 /* JSDocLink */:
+ case 325 /* JSDocLinkCode */:
+ case 326 /* JSDocLinkPlain */:
+ case 341 /* JSDocParameterTag */:
+ case 348 /* JSDocPropertyTag */:
+ case 317 /* JSDocFunctionType */:
+ case 315 /* JSDocNonNullableType */:
+ case 314 /* JSDocNullableType */:
+ case 312 /* JSDocAllType */:
+ case 313 /* JSDocUnknownType */:
+ case 322 /* JSDocTypeLiteral */:
+ case 318 /* JSDocVariadicType */:
+ case 309 /* JSDocTypeExpression */:
+ case 333 /* JSDocPublicTag */:
+ case 335 /* JSDocProtectedTag */:
+ case 334 /* JSDocPrivateTag */:
+ case 350 /* JSDocSatisfiesTag */:
+ case 343 /* JSDocThisTag */:
+ case 199 /* IndexedAccessType */:
+ case 200 /* MappedType */:
+ case 262 /* FunctionDeclaration */:
+ case 241 /* Block */:
+ case 268 /* ModuleBlock */:
+ case 243 /* VariableStatement */:
+ case 244 /* ExpressionStatement */:
+ case 245 /* IfStatement */:
+ case 246 /* DoStatement */:
+ case 247 /* WhileStatement */:
+ case 248 /* ForStatement */:
+ case 249 /* ForInStatement */:
+ case 250 /* ForOfStatement */:
+ case 251 /* ContinueStatement */:
+ case 252 /* BreakStatement */:
+ case 253 /* ReturnStatement */:
+ case 254 /* WithStatement */:
+ case 255 /* SwitchStatement */:
+ case 256 /* LabeledStatement */:
+ case 257 /* ThrowStatement */:
+ case 258 /* TryStatement */:
+ case 260 /* VariableDeclaration */:
+ case 208 /* BindingElement */:
+ case 263 /* ClassDeclaration */:
+ case 264 /* InterfaceDeclaration */:
+ case 265 /* TypeAliasDeclaration */:
+ case 266 /* EnumDeclaration */:
+ case 267 /* ModuleDeclaration */:
+ case 272 /* ImportDeclaration */:
+ case 271 /* ImportEqualsDeclaration */:
+ case 278 /* ExportDeclaration */:
+ case 277 /* ExportAssignment */:
+ case 242 /* EmptyStatement */:
+ case 259 /* DebuggerStatement */:
+ case 282 /* MissingDeclaration */:
+ return true;
+ }
+ return false;
+}
function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false, hasExternalReferences = false) {
return { value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences };
}
@@ -23743,6 +23780,10 @@ function hasInferredType(node) {
return false;
}
}
+function isSideEffectImport(node) {
+ const ancestor = findAncestor(node, isImportDeclaration);
+ return !!ancestor && !ancestor.importClause;
+}
// src/compiler/factory/baseNodeFactory.ts
function createBaseNodeFactory() {
@@ -25519,7 +25560,11 @@ function createNodeFactory(flags, baseFactory2) {
node.modifiers = asNodeArray(modifiers);
node.parameters = createNodeArray(parameters);
node.body = body;
- node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | 1024 /* ContainsES2015 */;
+ if (!node.body) {
+ node.transformFlags = 1 /* ContainsTypeScript */;
+ } else {
+ node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | 1024 /* ContainsES2015 */;
+ }
node.typeParameters = void 0;
node.type = void 0;
node.typeArguments = void 0;
@@ -27859,7 +27904,7 @@ function createNodeFactory(flags, baseFactory2) {
}
function createSyntaxList3(children) {
const node = createBaseNode(352 /* SyntaxList */);
- setNodeChildren(node, children);
+ node._children = children;
return node;
}
function createNotEmittedStatement(original) {
@@ -28145,6 +28190,8 @@ function createNodeFactory(flags, baseFactory2) {
return updateSatisfiesExpression(outerExpression, expression, outerExpression.type);
case 235 /* NonNullExpression */:
return updateNonNullExpression(outerExpression, expression);
+ case 233 /* ExpressionWithTypeArguments */:
+ return updateExpressionWithTypeArguments(outerExpression, expression, outerExpression.typeArguments);
case 354 /* PartiallyEmittedExpression */:
return updatePartiallyEmittedExpression(outerExpression, expression);
}
@@ -28152,7 +28199,7 @@ function createNodeFactory(flags, baseFactory2) {
function isIgnorableParen(node) {
return isParenthesizedExpression(node) && nodeIsSynthesized(node) && nodeIsSynthesized(getSourceMapRange(node)) && nodeIsSynthesized(getCommentRange(node)) && !some(getSyntheticLeadingComments(node)) && !some(getSyntheticTrailingComments(node));
}
- function restoreOuterExpressions(outerExpression, innerExpression, kinds = 15 /* All */) {
+ function restoreOuterExpressions(outerExpression, innerExpression, kinds = 31 /* All */) {
if (outerExpression && isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) {
return updateOuterExpression(
outerExpression,
@@ -28198,7 +28245,7 @@ function createNodeFactory(flags, baseFactory2) {
}
}
function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers = false) {
- const callee = skipOuterExpressions(expression, 15 /* All */);
+ const callee = skipOuterExpressions(expression, 31 /* All */);
let thisArg;
let target;
if (isSuperProperty(callee)) {
@@ -29686,7 +29733,7 @@ var asyncGeneratorHelper = {
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
- return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
@@ -29868,8 +29915,8 @@ var generatorHelper = {
priority: 6,
text: `
var __generator = (this && this.__generator) || function (thisArg, body) {
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
@@ -30032,17 +30079,22 @@ var disposeResourcesHelper = {
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
+ var r, s = 0;
function next() {
- while (env.stack.length) {
- var rec = env.stack.pop();
+ while (r = env.stack.pop()) {
try {
- var result = rec.dispose && rec.dispose.call(rec.value);
- if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
+ if (r.dispose) {
+ var result = r.dispose.call(r.value);
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
+ }
+ else s |= 1;
}
catch (e) {
fail(e);
}
}
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
@@ -30543,6 +30595,9 @@ function isNamedExports(node) {
function isExportSpecifier(node) {
return node.kind === 281 /* ExportSpecifier */;
}
+function isModuleExportName(node) {
+ return node.kind === 80 /* Identifier */ || node.kind === 11 /* StringLiteral */;
+}
function isMissingDeclaration(node) {
return node.kind === 282 /* MissingDeclaration */;
}
@@ -30752,17 +30807,43 @@ function isSyntaxList(n) {
}
// src/compiler/factory/nodeChildren.ts
-var nodeChildren = /* @__PURE__ */ new WeakMap();
-function getNodeChildren(node) {
- if (!isNodeKind(node.kind)) return emptyArray;
- return nodeChildren.get(node);
+var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
+function getNodeChildren(node, sourceFile) {
+ var _a;
+ const kind = node.kind;
+ if (!isNodeKind(kind)) {
+ return emptyArray;
+ }
+ if (kind === 352 /* SyntaxList */) {
+ return node._children;
+ }
+ return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
}
-function setNodeChildren(node, children) {
- nodeChildren.set(node, children);
+function setNodeChildren(node, sourceFile, children) {
+ if (node.kind === 352 /* SyntaxList */) {
+ Debug.fail("Should not need to re-set the children of a SyntaxList.");
+ }
+ let map2 = sourceFileToNodeChildren.get(sourceFile);
+ if (map2 === void 0) {
+ map2 = /* @__PURE__ */ new WeakMap();
+ sourceFileToNodeChildren.set(sourceFile, map2);
+ }
+ map2.set(node, children);
return children;
}
-function unsetNodeChildren(node) {
- nodeChildren.delete(node);
+function unsetNodeChildren(node, origSourceFile) {
+ var _a;
+ if (node.kind === 352 /* SyntaxList */) {
+ Debug.fail("Did not expect to unset the children of a SyntaxList.");
+ }
+ (_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
+}
+function transferSourceFileChildren(sourceFile, targetSourceFile) {
+ const map2 = sourceFileToNodeChildren.get(sourceFile);
+ if (map2 !== void 0) {
+ sourceFileToNodeChildren.delete(sourceFile);
+ sourceFileToNodeChildren.set(targetSourceFile, map2);
+ }
}
// src/compiler/factory/utilities.ts
@@ -30901,17 +30982,6 @@ function createForOfBindingStatement(factory2, node, boundValue) {
);
}
}
-function insertLeadingStatement(factory2, dest, source) {
- if (isBlock(dest)) {
- return factory2.updateBlock(dest, setTextRange(factory2.createNodeArray([source, ...dest.statements]), dest.statements));
- } else {
- return factory2.createBlock(
- factory2.createNodeArray([dest, source]),
- /*multiLine*/
- true
- );
- }
-}
function createExpressionFromEntityName(factory2, node) {
if (isQualifiedName(node)) {
const left = createExpressionFromEntityName(factory2, node.left);
@@ -31143,18 +31213,19 @@ function getJSDocTypeAssertionType(node) {
Debug.assertIsDefined(type);
return type;
}
-function isOuterExpression(node, kinds = 15 /* All */) {
+function isOuterExpression(node, kinds = 31 /* All */) {
switch (node.kind) {
case 217 /* ParenthesizedExpression */:
- if (kinds & 16 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) {
+ if (kinds & -2147483648 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) {
return false;
}
return (kinds & 1 /* Parentheses */) !== 0;
case 216 /* TypeAssertionExpression */:
case 234 /* AsExpression */:
- case 233 /* ExpressionWithTypeArguments */:
case 238 /* SatisfiesExpression */:
return (kinds & 2 /* TypeAssertions */) !== 0;
+ case 233 /* ExpressionWithTypeArguments */:
+ return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
case 235 /* NonNullExpression */:
return (kinds & 4 /* NonNullAssertions */) !== 0;
case 354 /* PartiallyEmittedExpression */:
@@ -31162,13 +31233,13 @@ function isOuterExpression(node, kinds = 15 /* All */) {
}
return false;
}
-function skipOuterExpressions(node, kinds = 15 /* All */) {
+function skipOuterExpressions(node, kinds = 31 /* All */) {
while (isOuterExpression(node, kinds)) {
node = node.expression;
}
return node;
}
-function walkUpOuterExpressions(node, kinds = 15 /* All */) {
+function walkUpOuterExpressions(node, kinds = 31 /* All */) {
let parent2 = node.parent;
while (isOuterExpression(parent2, kinds)) {
parent2 = parent2.parent;
@@ -31176,9 +31247,6 @@ function walkUpOuterExpressions(node, kinds = 15 /* All */) {
}
return parent2;
}
-function skipAssertions(node) {
- return skipOuterExpressions(node, 6 /* Assertions */);
-}
function startOnNewLine(node) {
return setStartsOnNewLine(
node,
@@ -31200,7 +31268,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
let namedBindings;
const moduleKind = getEmitModuleKind(compilerOptions);
- if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile.impliedNodeFormat === 99 /* ESNext */) {
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
const helpers = getEmitHelpers(sourceFile);
if (helpers) {
const helperNames = [];
@@ -31265,8 +31333,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
if (externalHelpersModuleName) {
return externalHelpersModuleName;
}
- const moduleKind = getEmitModuleKind(compilerOptions);
- let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
+ let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
if (!create) {
const helpers = getEmitHelpers(node);
if (helpers) {
@@ -31289,6 +31356,9 @@ function getLocalNameForExternalImport(factory2, node, sourceFile) {
const namespaceDeclaration = getNamespaceDeclarationNode(node);
if (namespaceDeclaration && !isDefaultImport(node) && !isExportNamespaceAsDefaultDeclaration(node)) {
const name = namespaceDeclaration.name;
+ if (name.kind === 11 /* StringLiteral */) {
+ return factory2.getGeneratedNameForNode(node);
+ }
return isGeneratedIdentifier(name) ? name : factory2.createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, name) || idText(name));
}
if (node.kind === 272 /* ImportDeclaration */ && node.importClause) {
@@ -31481,10 +31551,6 @@ function isQuestionOrPlusOrMinusToken(node) {
function isModuleName(node) {
return isIdentifier(node) || isStringLiteral(node);
}
-function isLiteralTypeLikeExpression(node) {
- const kind = node.kind;
- return kind === 106 /* NullKeyword */ || kind === 112 /* TrueKeyword */ || kind === 97 /* FalseKeyword */ || isLiteralExpression(node) || isPrefixUnaryExpression(node);
-}
function isExponentiationOperator(kind) {
return kind === 43 /* AsteriskAsteriskToken */;
}
@@ -31670,10 +31736,6 @@ function isExportOrDefaultModifier(node) {
const kind = node.kind;
return isExportOrDefaultKeywordKind(kind);
}
-function isNonExportDefaultModifier(node) {
- const kind = node.kind;
- return isModifierKind(kind) && !isExportOrDefaultKeywordKind(kind);
-}
function elideNodes(factory2, nodes) {
if (nodes === void 0) return void 0;
if (nodes.length === 0) return nodes;
@@ -32449,7 +32511,7 @@ function setExternalModuleIndicator(sourceFile) {
sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
}
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
- var _a, _b, _c, _d;
+ var _a, _b;
(_a = tracing) == null ? void 0 : _a.push(
tracing.Phase.Parse,
"createSourceFile",
@@ -32459,7 +32521,6 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
);
mark("beforeParse");
let result;
- (_b = perfLogger) == null ? void 0 : _b.logStartParseSourceFile(fileName);
const {
languageVersion,
setExternalModuleIndicator: overrideSetExternalModuleIndicator,
@@ -32495,10 +32556,9 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
jsDocParsingMode
);
}
- (_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
mark("afterParse");
measure("Parse", "beforeParse", "afterParse");
- (_d = tracing) == null ? void 0 : _d.pop();
+ (_b = tracing) == null ? void 0 : _b.pop();
return result;
}
function parseIsolatedEntityName(text, languageVersion) {
@@ -33438,7 +33498,7 @@ var Parser;
function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
if (isIdentifier3) {
identifierCount++;
- const pos = getNodePos();
+ const pos = scanner2.hasPrecedingJSDocLeadingAsterisks() ? scanner2.getTokenStart() : getNodePos();
const originalKeywordKind = token();
const text = internIdentifier(scanner2.getTokenValue());
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
@@ -33486,13 +33546,13 @@ var Parser;
return createIdentifier(tokenIsIdentifierOrKeyword(token()));
}
function isLiteralPropertyName() {
- return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
+ return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */;
}
function isImportAttributeName2() {
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
}
function parsePropertyNameWorker(allowComputedPropertyNames) {
- if (token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */) {
+ if (token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */) {
const node = parseLiteralNode();
node.text = internIdentifier(node.text);
return node;
@@ -33651,6 +33711,9 @@ var Parser;
if (token() === 161 /* FromKeyword */ && lookAhead(nextTokenIsStringLiteral)) {
return false;
}
+ if (token() === 11 /* StringLiteral */) {
+ return true;
+ }
return tokenIsIdentifierOrKeyword(token());
case 13 /* JsxAttributes */:
return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
@@ -37716,7 +37779,7 @@ var Parser;
if (isIndexSignature()) {
return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers);
}
- if (tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 42 /* AsteriskToken */ || token() === 23 /* OpenBracketToken */) {
+ if (tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */ || token() === 42 /* AsteriskToken */ || token() === 23 /* OpenBracketToken */) {
const isAmbient = some(modifiers, isDeclareModifier);
if (isAmbient) {
for (const m of modifiers) {
@@ -38099,6 +38162,12 @@ var Parser;
const name = parseIdentifier();
return finishNode(factory2.createNamespaceImport(name), pos);
}
+ function canParseModuleExportName() {
+ return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
+ }
+ function parseModuleExportName(parseName) {
+ return token() === 11 /* StringLiteral */ ? parseLiteralNode() : parseName();
+ }
function parseNamedImportsOrExports(kind) {
const pos = getNodePos();
const node = kind === 275 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */));
@@ -38119,42 +38188,51 @@ var Parser;
let isTypeOnly = false;
let propertyName;
let canParseAsKeyword = true;
- let name = parseIdentifierName();
- if (name.escapedText === "type") {
+ let name = parseModuleExportName(parseIdentifierName);
+ if (name.kind === 80 /* Identifier */ && name.escapedText === "type") {
if (token() === 130 /* AsKeyword */) {
const firstAs = parseIdentifierName();
if (token() === 130 /* AsKeyword */) {
const secondAs = parseIdentifierName();
- if (tokenIsIdentifierOrKeyword(token())) {
+ if (canParseModuleExportName()) {
isTypeOnly = true;
propertyName = firstAs;
- name = parseNameWithKeywordCheck();
+ name = parseModuleExportName(parseNameWithKeywordCheck);
canParseAsKeyword = false;
} else {
propertyName = name;
name = secondAs;
canParseAsKeyword = false;
}
- } else if (tokenIsIdentifierOrKeyword(token())) {
+ } else if (canParseModuleExportName()) {
propertyName = name;
canParseAsKeyword = false;
- name = parseNameWithKeywordCheck();
+ name = parseModuleExportName(parseNameWithKeywordCheck);
} else {
isTypeOnly = true;
name = firstAs;
}
- } else if (tokenIsIdentifierOrKeyword(token())) {
+ } else if (canParseModuleExportName()) {
isTypeOnly = true;
- name = parseNameWithKeywordCheck();
+ name = parseModuleExportName(parseNameWithKeywordCheck);
}
}
if (canParseAsKeyword && token() === 130 /* AsKeyword */) {
propertyName = name;
parseExpected(130 /* AsKeyword */);
- name = parseNameWithKeywordCheck();
+ name = parseModuleExportName(parseNameWithKeywordCheck);
}
- if (kind === 276 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
- parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
+ if (kind === 276 /* ImportSpecifier */) {
+ if (name.kind !== 80 /* Identifier */) {
+ parseErrorAt(skipTrivia(sourceText, name.pos), name.end, Diagnostics.Identifier_expected);
+ name = setTextRangePosEnd(createMissingNode(
+ 80 /* Identifier */,
+ /*reportAtCurrentPosition*/
+ false
+ ), name.pos, name.pos);
+ } else if (checkIdentifierIsKeyword) {
+ parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
+ }
}
const node = kind === 276 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name);
return finishNode(node, pos);
@@ -38166,7 +38244,7 @@ var Parser;
}
}
function parseNamespaceExport(pos) {
- return finishNode(factory2.createNamespaceExport(parseIdentifierName()), pos);
+ return finishNode(factory2.createNamespaceExport(parseModuleExportName(parseIdentifierName)), pos);
}
function parseExportDeclaration(pos, hasJSDoc, modifiers) {
const savedAwaitContext = inAwaitContext();
@@ -39374,6 +39452,7 @@ var IncrementalParser;
aggressiveChecks
);
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
+ transferSourceFileChildren(sourceFile, result);
return result;
}
IncrementalParser2.updateSourceFile = updateSourceFile2;
@@ -39409,7 +39488,7 @@ var IncrementalParser;
}
}
}
- function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
+ function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
if (isArray2) {
visitArray2(element);
} else {
@@ -39421,7 +39500,7 @@ var IncrementalParser;
if (aggressiveChecks && shouldCheckNode(node)) {
text = oldText.substring(node.pos, node.end);
}
- unsetNodeChildren(node);
+ unsetNodeChildren(node, origSourceFile);
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
if (aggressiveChecks && shouldCheckNode(node)) {
Debug.assert(text === newText.substring(node.pos, node.end));
@@ -39495,6 +39574,7 @@ var IncrementalParser;
if (child.pos > changeRangeOldEnd) {
moveElementEntirelyPastChangeRange(
child,
+ sourceFile,
/*isArray*/
false,
delta,
@@ -39507,7 +39587,7 @@ var IncrementalParser;
const fullEnd = child.end;
if (fullEnd >= changeStart) {
markAsIntersectingIncrementalChange(child);
- unsetNodeChildren(child);
+ unsetNodeChildren(child, sourceFile);
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
forEachChild(child, visitNode3, visitArray2);
if (hasJSDocNodes(child)) {
@@ -39525,6 +39605,7 @@ var IncrementalParser;
if (array.pos > changeRangeOldEnd) {
moveElementEntirelyPastChangeRange(
array,
+ sourceFile,
/*isArray*/
true,
delta,
@@ -39816,8 +39897,8 @@ function getNamedArgRegEx(name) {
namedArgRegExCache.set(name, result);
return result;
}
-var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
-var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)\s*$/im;
+var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
+var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
function extractPragmas(pragmas, range, text) {
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
if (tripleSlash) {
@@ -39858,7 +39939,7 @@ function extractPragmas(pragmas, range, text) {
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
}
if (range.kind === 3 /* MultiLineCommentTrivia */) {
- const multiLinePragmaRegEx = /@(\S+)(\s+.*)?$/gim;
+ const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
let multiLineMatch;
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
@@ -40015,6 +40096,7 @@ var libEntries = [
["esnext.array", "lib.esnext.array.d.ts"],
["esnext.regexp", "lib.esnext.regexp.d.ts"],
["esnext.string", "lib.esnext.string.d.ts"],
+ ["esnext.iterator", "lib.esnext.iterator.d.ts"],
["decorators", "lib.decorators.d.ts"],
["decorators.legacy", "lib.decorators.legacy.d.ts"]
];
@@ -40193,7 +40275,6 @@ var commonOptionsWithBuild = [
name: "generateTrace",
type: "string",
isFilePath: true,
- isCommandLineOnly: true,
paramType: Diagnostics.DIRECTORY,
category: Diagnostics.Compiler_Diagnostics,
description: Diagnostics.Generates_an_event_trace_and_a_list_of_types
@@ -40226,7 +40307,6 @@ var commonOptionsWithBuild = [
affectsBuildInfo: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Emit,
- transpileOptionValue: void 0,
defaultValueDescription: false,
description: Diagnostics.Create_sourcemaps_for_d_ts_files
},
@@ -40261,6 +40341,25 @@ var commonOptionsWithBuild = [
defaultValueDescription: false
},
{
+ name: "noCheck",
+ type: "boolean",
+ showInSimplifiedHelpView: false,
+ category: Diagnostics.Compiler_Diagnostics,
+ description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
+ transpileOptionValue: true,
+ defaultValueDescription: false
+ // Not setting affectsSemanticDiagnostics or affectsBuildInfo because we dont want all diagnostics to go away, its handled in builder
+ },
+ {
+ name: "noEmit",
+ type: "boolean",
+ showInSimplifiedHelpView: true,
+ category: Diagnostics.Emit,
+ description: Diagnostics.Disable_emitting_files_from_a_compilation,
+ transpileOptionValue: void 0,
+ defaultValueDescription: false
+ },
+ {
name: "assumeChangesOnlyAffectDirectDependencies",
type: "boolean",
affectsSemanticDiagnostics: true,
@@ -40525,33 +40624,11 @@ var commandOptionsWithoutBuild = [
description: Diagnostics.Disable_emitting_comments
},
{
- name: "noCheck",
- type: "boolean",
- showInSimplifiedHelpView: false,
- category: Diagnostics.Compiler_Diagnostics,
- description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
- transpileOptionValue: true,
- defaultValueDescription: false,
- affectsSemanticDiagnostics: true,
- affectsBuildInfo: true,
- extraValidation() {
- return [Diagnostics.Unknown_compiler_option_0, "noCheck"];
- }
- },
- {
- name: "noEmit",
- type: "boolean",
- showInSimplifiedHelpView: true,
- category: Diagnostics.Emit,
- description: Diagnostics.Disable_emitting_files_from_a_compilation,
- transpileOptionValue: void 0,
- defaultValueDescription: false
- },
- {
name: "importHelpers",
type: "boolean",
affectsEmit: true,
affectsBuildInfo: true,
+ affectsSourceFile: true,
category: Diagnostics.Emit,
description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
defaultValueDescription: false
@@ -40671,6 +40748,16 @@ var commandOptionsWithoutBuild = [
defaultValueDescription: Diagnostics.false_unless_strict_is_set
},
{
+ name: "strictBuiltinIteratorReturn",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ affectsBuildInfo: true,
+ strictFlag: true,
+ category: Diagnostics.Type_Checking,
+ description: Diagnostics.Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any,
+ defaultValueDescription: Diagnostics.false_unless_strict_is_set
+ },
+ {
name: "noImplicitThis",
type: "boolean",
affectsSemanticDiagnostics: true,
@@ -40945,6 +41032,15 @@ var commandOptionsWithoutBuild = [
category: Diagnostics.Modules,
description: Diagnostics.Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports
},
+ {
+ name: "noUncheckedSideEffectImports",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ affectsBuildInfo: true,
+ category: Diagnostics.Modules,
+ description: Diagnostics.Check_side_effect_imports,
+ defaultValueDescription: false
+ },
// Source Maps
{
name: "sourceRoot",
@@ -41016,6 +41112,7 @@ var commandOptionsWithoutBuild = [
affectsEmit: true,
affectsBuildInfo: true,
affectsModuleResolution: true,
+ affectsSourceFile: true,
category: Diagnostics.Language_and_Environment,
description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
defaultValueDescription: "react"
@@ -41399,6 +41496,13 @@ var optionsForBuild = [
description: Diagnostics.Delete_the_outputs_of_all_projects,
type: "boolean",
defaultValueDescription: false
+ },
+ {
+ name: "stopBuildOnErrors",
+ category: Diagnostics.Command_line_Options,
+ description: Diagnostics.Skip_building_downstream_projects_on_error_in_upstream_project,
+ type: "boolean",
+ defaultValueDescription: false
}
];
var buildOpts = [
@@ -42081,9 +42185,7 @@ function convertToTSConfig(configParseResult, configFileName, host) {
return config;
}
function optionMapToObject(optionMap) {
- return {
- ...arrayFrom(optionMap.entries()).reduce((prev, cur) => ({ ...prev, [cur[0]]: cur[1] }), {})
- };
+ return Object.fromEntries(optionMap);
}
function filterSameAsDefaultInclude(specs) {
if (!length(specs)) return void 0;
@@ -42951,7 +43053,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
}
-var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
+var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
basePath = normalizePath(basePath);
@@ -44085,7 +44187,6 @@ function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
);
}
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
- var _a, _b, _c;
const traceEnabled = isTraceEnabled(compilerOptions, host);
if (redirectedReference) {
compilerOptions = redirectedReference.commandLine.options;
@@ -44114,7 +44215,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
}
}
- (_a = perfLogger) == null ? void 0 : _a.logStartResolveModule(moduleName);
switch (moduleResolution) {
case 3 /* Node16 */:
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -44134,8 +44234,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
default:
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
}
- if (result && result.resolvedModule) (_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
- (_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
if (cache && !cache.isReadonly) {
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
if (!isExternalModuleNameRelative(moduleName)) {
@@ -44842,22 +44940,16 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
resolvedPackageDirectory: false
};
}
-function getPackageScopeForPath(fileName, state) {
- const parts = getPathComponents(fileName);
- parts.pop();
- while (parts.length > 0) {
- const pkg = getPackageJsonInfo(
- getPathFromPathComponents(parts),
+function getPackageScopeForPath(directory, state) {
+ return forEachAncestorDirectory(
+ directory,
+ (dir) => getPackageJsonInfo(
+ dir,
/*onlyRecordFailures*/
false,
state
- );
- if (pkg) {
- return pkg;
- }
- parts.pop();
- }
- return void 0;
+ )
+ );
}
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
if (packageJsonInfo.contents.versionPaths === void 0) {
@@ -45020,7 +45112,7 @@ function noKeyStartsWithDot(obj) {
}
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
var _a, _b;
- const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
+ const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
const scope = getPackageScopeForPath(directoryPath, state);
if (!scope || !scope.contents.packageJsonContent.exports) {
return void 0;
@@ -45116,7 +45208,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
void 0
);
}
- const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
+ const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
const scope = getPackageScopeForPath(directoryPath, state);
if (!scope) {
if (state.traceEnabled) {
@@ -45184,7 +45276,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
moduleName
);
}
- const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => hasOneAsterisk(k) || endsWith(k, "/")), comparePatternKeys);
+ const expandingKeys = toSorted(filter(getOwnKeys(lookupTable), (k) => hasOneAsterisk(k) || endsWith(k, "/")), comparePatternKeys);
for (const potentialTarget of expandingKeys) {
if (state.features & 16 /* ExportsPatternTrailers */ && matchesPatternWithTrailer(potentialTarget, moduleName)) {
const target = lookupTable[potentialTarget];
@@ -45928,6 +46020,9 @@ function getModuleInstanceStateWorker(node, visited) {
}
function getModuleInstanceStateForAliasTarget(specifier, visited) {
const name = specifier.propertyName || specifier.name;
+ if (name.kind !== 80 /* Identifier */) {
+ return 1 /* Instantiated */;
+ }
let p = specifier.parent;
while (p) {
if (isBlock(p) || isModuleBlock(p) || isSourceFile(p)) {
@@ -45980,11 +46075,8 @@ function createFlowNode(flags, node, antecedent) {
}
var binder = /* @__PURE__ */ createBinder();
function bindSourceFile(file, options) {
- var _a, _b;
mark("beforeBind");
- (_a = perfLogger) == null ? void 0 : _a.logStartBindFile("" + file.fileName);
binder(file, options);
- (_b = perfLogger) == null ? void 0 : _b.logStopBindFile();
mark("afterBind");
measure("Bind", "beforeBind", "afterBind");
}
@@ -46184,7 +46276,7 @@ function createBinder() {
}
function declareSymbol(symbolTable, parent3, node, includes, excludes, isReplaceableByMethod, isComputedName) {
Debug.assert(isComputedName || !hasDynamicName(node));
- const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && node.name.escapedText === "default";
+ const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && moduleExportNameIsDefault(node.name);
const name = isComputedName ? "__computed" /* Computed */ : isDefaultExport && parent3 ? "default" /* Default */ : getDeclarationName(node);
let symbol;
if (name === void 0) {
@@ -47281,6 +47373,8 @@ function createBinder() {
}
function bindJSDocImportTag(node) {
bind(node.tagName);
+ bind(node.moduleSpecifier);
+ bind(node.attributes);
if (typeof node.comment !== "string") {
bindEach(node.comment);
}
@@ -48664,21 +48758,25 @@ function createBinder() {
const reportError = (
// report error on all statements except empty ones
isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
- node.kind === 263 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
+ node.kind === 263 /* ClassDeclaration */ || // report errors on enums with preserved emit
+ isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
);
if (reportError) {
currentFlow = reportedUnreachableFlow;
if (!options.allowUnreachableCode) {
const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
- eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
+ eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
}
}
}
return true;
}
}
-function eachUnreachableRange(node, cb) {
+function isEnumDeclarationWithPreservedEmit(node, options) {
+ return node.kind === 266 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
+}
+function eachUnreachableRange(node, options, cb) {
if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
const { statements } = node.parent;
const slice = sliceAfter(statements, node);
@@ -48686,22 +48784,22 @@ function eachUnreachableRange(node, cb) {
} else {
cb(node, node);
}
-}
-function isExecutableStatement(s) {
- return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !isEnumDeclaration(s) && // `var x;` may declare a variable used above
- !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
-}
-function isPurelyTypeDeclaration(s) {
- switch (s.kind) {
- case 264 /* InterfaceDeclaration */:
- case 265 /* TypeAliasDeclaration */:
- return true;
- case 267 /* ModuleDeclaration */:
- return getModuleInstanceState(s) !== 1 /* Instantiated */;
- case 266 /* EnumDeclaration */:
- return hasSyntacticModifier(s, 4096 /* Const */);
- default:
- return false;
+ function isExecutableStatement(s) {
+ return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
+ !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
+ }
+ function isPurelyTypeDeclaration(s) {
+ switch (s.kind) {
+ case 264 /* InterfaceDeclaration */:
+ case 265 /* TypeAliasDeclaration */:
+ return true;
+ case 267 /* ModuleDeclaration */:
+ return getModuleInstanceState(s) !== 1 /* Instantiated */;
+ case 266 /* EnumDeclaration */:
+ return !isEnumDeclarationWithPreservedEmit(s, options);
+ default:
+ return false;
+ }
}
}
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
@@ -48970,6 +49068,28 @@ __export(ts_moduleSpecifiers_exports, {
});
// src/compiler/moduleSpecifiers.ts
+var stringToRegex = memoizeOne((pattern) => {
+ try {
+ let slash = pattern.indexOf("/");
+ if (slash !== 0) {
+ return new RegExp(pattern);
+ }
+ const lastSlash = pattern.lastIndexOf("/");
+ if (slash === lastSlash) {
+ return new RegExp(pattern);
+ }
+ while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) {
+ if (pattern[slash - 1] !== "\\") {
+ return new RegExp(pattern);
+ }
+ }
+ const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, "");
+ pattern = pattern.substring(1, lastSlash);
+ return new RegExp(pattern, flags);
+ } catch {
+ return void 0;
+ }
+});
var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
RelativePreference2[RelativePreference2["Relative"] = 0] = "Relative";
RelativePreference2[RelativePreference2["NonRelative"] = 1] = "NonRelative";
@@ -48977,13 +49097,16 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
return RelativePreference2;
})(RelativePreference || {});
-function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
+function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding, autoImportSpecifierExcludeRegexes }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
const filePreferredEnding = getPreferredEnding();
return {
+ excludeRegexes: autoImportSpecifierExcludeRegexes,
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
- const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
- if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
+ const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
+ const preferredEnding = syntaxImpliedNodeFormat !== impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
+ const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
+ if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
return [3 /* TsExtension */, 2 /* JsExtension */];
}
@@ -49014,19 +49137,19 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
}
return getModuleSpecifierEndingPreference(
importModuleSpecifierEnding,
- resolutionMode ?? importingSourceFile.impliedNodeFormat,
+ resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
compilerOptions,
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
);
}
}
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
- const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
+ const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
if (res === oldImportSpecifier) return void 0;
return res;
}
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
- return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
+ return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
}
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
const info = getInfo(importingSourceFile.fileName, host);
@@ -49056,7 +49179,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
/*packageNameOnly*/
void 0,
options.overrideImportMode
- )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
+ )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
}
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
const result = tryGetModuleSpecifiersFromCacheWorker(
@@ -49094,7 +49217,13 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
let computedWithoutCache = false;
const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
- if (ambient) return { kind: "ambient", moduleSpecifiers: [ambient], computedWithoutCache };
+ if (ambient) {
+ return {
+ kind: "ambient",
+ moduleSpecifiers: !(forAutoImport && isExcludedByRegex(ambient, userPreferences.autoImportSpecifierExcludeRegexes)) ? [ambient] : emptyArray,
+ computedWithoutCache
+ };
+ }
let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
moduleSymbol,
importingSourceFile,
@@ -49118,7 +49247,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, result.kind, modulePaths, result.moduleSpecifiers);
return result;
}
-function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName, compilerOptions, host, options = {}) {
+function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName, compilerOptions, host, preferences, options = {}) {
const info = getInfo(importingFile.fileName, host);
const importMode = options.overrideImportMode ?? importingFile.impliedNodeFormat;
return getLocalModuleSpecifier(
@@ -49127,17 +49256,21 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
compilerOptions,
host,
importMode,
- getModuleSpecifierPreferences({}, compilerOptions, importingFile)
+ getModuleSpecifierPreferences(preferences, host, compilerOptions, importingFile)
);
}
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
const info = getInfo(importingSourceFile.fileName, host);
- const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
+ const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
(reason) => {
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
- if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return void 0;
+ const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index);
+ const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
+ if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
+ return void 0;
+ }
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
}
@@ -49162,9 +49295,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
void 0,
options.overrideImportMode
) : void 0;
- nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
- if (specifier && modulePath.isRedirect) {
- return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
+ if (specifier && !(forAutoImport && isExcludedByRegex(specifier, preferences.excludeRegexes))) {
+ nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
+ if (modulePath.isRedirect) {
+ return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
+ }
}
if (!specifier) {
const local = getLocalModuleSpecifier(
@@ -49177,7 +49312,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
/*pathsOnly*/
modulePath.isRedirect
);
- if (!local) {
+ if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
continue;
}
if (modulePath.isRedirect) {
@@ -49193,7 +49328,13 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
}
}
}
- return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: Debug.checkDefined(relativeSpecifiers), computedWithoutCache: true };
+ return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
+}
+function isExcludedByRegex(moduleSpecifier, excludeRegexes) {
+ return some(excludeRegexes, (pattern) => {
+ var _a;
+ return !!((_a = stringToRegex(pattern)) == null ? void 0 : _a.test(moduleSpecifier));
+ });
}
function getInfo(importingSourceFileName, host) {
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
@@ -49206,7 +49347,7 @@ function getInfo(importingSourceFileName, host) {
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
};
}
-function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
+function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference, excludeRegexes }, pathsOnly) {
const { baseUrl, paths, rootDirs } = compilerOptions;
if (pathsOnly && !paths) {
return void 0;
@@ -49222,7 +49363,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
if (!relativeToBaseUrl) {
return pathsOnly ? void 0 : relativePath;
}
- const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
+ const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
+ moduleFileName,
+ sourceDirectory,
+ compilerOptions,
+ host,
+ importMode,
+ prefersTsExtension(allowedEndings)
+ );
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
if (pathsOnly) {
return fromPaths;
@@ -49231,6 +49379,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
if (!maybeNonRelative) {
return relativePath;
}
+ const relativeIsExcluded = isExcludedByRegex(relativePath, excludeRegexes);
+ const nonRelativeIsExcluded = isExcludedByRegex(maybeNonRelative, excludeRegexes);
+ if (!relativeIsExcluded && nonRelativeIsExcluded) {
+ return relativePath;
+ }
+ if (relativeIsExcluded && !nonRelativeIsExcluded) {
+ return maybeNonRelative;
+ }
if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
return maybeNonRelative;
}
@@ -49345,7 +49501,7 @@ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions,
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
Debug.type(host);
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
- const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
+ const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
if (packageJson) {
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
for (const depName of toResolve || emptyArray) {
@@ -49470,7 +49626,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
}
}
-function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
+function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports, preferTsExtension) {
if (typeof exports2 === "string") {
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
@@ -49482,6 +49638,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
void 0
);
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
+ const canTryTsExtension = preferTsExtension && hasImplementationTSFileExtension(targetFilePath);
switch (mode) {
case 0 /* Exact */:
if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */) {
@@ -49489,6 +49646,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
}
break;
case 1 /* Directory */:
+ if (canTryTsExtension && containsPath(targetFilePath, pathOrPattern, ignoreCase)) {
+ const fragment = getRelativePathFromDirectory(
+ pathOrPattern,
+ targetFilePath,
+ /*ignoreCase*/
+ false
+ );
+ return { moduleFileToTry: getNormalizedAbsolutePath(
+ combinePaths(combinePaths(packageName, exports2), fragment),
+ /*currentDirectory*/
+ void 0
+ ) };
+ }
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
const fragment = getRelativePathFromDirectory(
pathOrPattern,
@@ -49502,7 +49672,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
void 0
) };
}
- if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
+ if (!canTryTsExtension && containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
const fragment = getRelativePathFromDirectory(
pathOrPattern,
targetFilePath,
@@ -49525,12 +49695,12 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
return { moduleFileToTry: combinePaths(packageName, fragment) };
}
if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
- const fragment = getRelativePathFromDirectory(
+ const fragment = changeFullExtension(getRelativePathFromDirectory(
pathOrPattern,
declarationFile,
/*ignoreCase*/
false
- );
+ ), getJSExtensionForFile(declarationFile, options));
return { moduleFileToTry: combinePaths(packageName, fragment) };
}
break;
@@ -49538,11 +49708,15 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
const starPos = pathOrPattern.indexOf("*");
const leadingSlice = pathOrPattern.slice(0, starPos);
const trailingSlice = pathOrPattern.slice(starPos + 1);
+ if (canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
+ const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
+ }
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
}
- if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
+ if (!canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
}
@@ -49552,17 +49726,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
}
if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
- return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
+ const substituted = replaceFirstStar(packageName, starReplacement);
+ const jsExtension = tryGetJSExtensionForFile(declarationFile, options);
+ return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : void 0;
}
break;
}
} else if (Array.isArray(exports2)) {
- return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
+ return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports, preferTsExtension));
} else if (typeof exports2 === "object" && exports2 !== null) {
for (const key of getOwnKeys(exports2)) {
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
const subTarget = exports2[key];
- const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
+ const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports, preferTsExtension);
if (result) {
return result;
}
@@ -49590,6 +49766,8 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
conditions,
mode,
/*isImports*/
+ false,
+ /*preferTsExtension*/
false
);
});
@@ -49604,10 +49782,12 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
conditions,
0 /* Exact */,
/*isImports*/
+ false,
+ /*preferTsExtension*/
false
);
}
-function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
+function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode, preferTsExtension) {
var _a, _b, _c;
if (!host.readFile || !getResolvePackageJsonImports(options)) {
return void 0;
@@ -49640,7 +49820,8 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory,
conditions,
mode,
/*isImports*/
- true
+ true,
+ preferTsExtension
);
})) == null ? void 0 : _c.moduleFileToTry;
}
@@ -49667,7 +49848,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
if (!parts) {
return void 0;
}
- const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
+ const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
let moduleSpecifier = path;
let isPackageRootPath = false;
@@ -49717,12 +49898,20 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
- const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
+ const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
if (getResolvePackageJsonExports(options)) {
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
const conditions = getConditions(options, importMode);
- const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
+ const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
+ options,
+ host,
+ path,
+ packageRootPath,
+ packageName2,
+ packageJsonContent.exports,
+ conditions
+ ) : void 0;
if (fromExports) {
return { ...fromExports, verbatimFromExports: true };
}
@@ -49867,6 +50056,13 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
function isPathRelativeToParent(path) {
return startsWith(path, "..");
}
+function getDefaultResolutionModeForFile(file, host, compilerOptions) {
+ return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
+}
+function prefersTsExtension(allowedEndings) {
+ const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
+ return tsPriority > -1 && tsPriority < allowedEndings.indexOf(2 /* JsExtension */);
+}
// src/compiler/checker.ts
var ambientModuleSymbolRegex = /^".+"$/;
@@ -50048,10 +50244,12 @@ function createTypeChecker(host) {
var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
var strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
var strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
+ var strictBuiltinIteratorReturn = getStrictOptionValue(compilerOptions, "strictBuiltinIteratorReturn");
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
+ var noUncheckedSideEffectImports = !!compilerOptions.noUncheckedSideEffectImports;
var checkBinaryExpression = createCheckBinaryExpression();
var emitResolver = createResolver();
var nodeBuilder = createNodeBuilder();
@@ -50063,7 +50261,8 @@ function createTypeChecker(host) {
isUndefinedIdentifierExpression(node) {
Debug.assert(isExpressionNode(node));
return getSymbolAtLocation(node) === undefinedSymbol;
- }
+ },
+ isDefinitelyReferenceToGlobalSymbolObject
});
var evaluate = createEvaluator({
evaluateElementAccessExpression,
@@ -50080,13 +50279,36 @@ function createTypeChecker(host) {
const denoContext = deno_exports.createDenoForkContext({
globals: denoGlobals,
nodeGlobals,
- mergeSymbol,
- ambientModuleSymbolRegex
+ mergeSymbol
});
const nodeGlobalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
nodeGlobalThisSymbol.exports = denoContext.combinedGlobals;
nodeGlobalThisSymbol.declarations = [];
nodeGlobals.set(nodeGlobalThisSymbol.escapedName, nodeGlobalThisSymbol);
+ nodeGlobals.set(
+ "onmessage",
+ createSymbol(1536 /* Module */, "onmessage", 8 /* Readonly */)
+ );
+ nodeGlobals.set(
+ "onabort",
+ createSymbol(1536 /* Module */, "onabort", 8 /* Readonly */)
+ );
+ nodeGlobals.set(
+ "ReportingObserver",
+ createSymbol(1536 /* Module */, "ReportingObserver", 8 /* Readonly */)
+ );
+ nodeGlobals.set(
+ "PerformanceObserver",
+ createSymbol(1536 /* Module */, "PerformanceObserver", 8 /* Readonly */)
+ );
+ nodeGlobals.set(
+ "PerformanceObserverEntryList",
+ createSymbol(1536 /* Module */, "PerformanceObserverEntryList", 8 /* Readonly */)
+ );
+ nodeGlobals.set(
+ "PerformanceResourceTiming",
+ createSymbol(1536 /* Module */, "PerformanceResourceTiming", 8 /* Readonly */)
+ );
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
var requireSymbol = createSymbol(4 /* Property */, "require");
var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
@@ -50195,6 +50417,7 @@ function createTypeChecker(host) {
getNonOptionalType: removeOptionalTypeMarker,
getTypeArguments,
typeToTypeNode: nodeBuilder.typeToTypeNode,
+ typePredicateToTypePredicateNode: nodeBuilder.typePredicateToTypePredicateNode,
indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
symbolToEntityName: nodeBuilder.symbolToEntityName,
@@ -50360,13 +50583,6 @@ function createTypeChecker(host) {
/*withAugmentations*/
true
),
- tryFindAmbientModuleWithoutAugmentations: (moduleName) => {
- return tryFindAmbientModule(
- moduleName,
- /*withAugmentations*/
- false
- );
- },
getApparentType,
getUnionType,
isTypeAssignableTo,
@@ -50380,6 +50596,7 @@ function createTypeChecker(host) {
getNumberType: () => numberType,
getNumberLiteralType,
getBigIntType: () => bigintType,
+ getBigIntLiteralType,
createPromiseType,
createArrayType,
getElementTypeOfArrayType,
@@ -50400,13 +50617,13 @@ function createTypeChecker(host) {
/*reportErrors*/
false
),
- getAsyncIterableType: () => {
+ getAnyAsyncIterableType: () => {
const type = getGlobalAsyncIterableType(
/*reportErrors*/
false
);
if (type === emptyGenericType) return void 0;
- return type;
+ return createTypeReference(type, [anyType, anyType, anyType]);
},
isSymbolAccessible,
isArrayType,
@@ -50878,8 +51095,6 @@ function createTypeChecker(host) {
}
};
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
- var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
- var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
var asyncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfAsyncIterable",
iteratorCacheKey: "iterationTypesOfAsyncIterator",
@@ -50887,7 +51102,9 @@ function createTypeChecker(host) {
getGlobalIteratorType: getGlobalAsyncIteratorType,
getGlobalIterableType: getGlobalAsyncIterableType,
getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
+ getGlobalIteratorObjectType: getGlobalAsyncIteratorObjectType,
getGlobalGeneratorType: getGlobalAsyncGeneratorType,
+ getGlobalBuiltinIteratorTypes: getGlobalBuiltinAsyncIteratorTypes,
resolveIterationType: (type, errorNode) => getAwaitedType(type, errorNode, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member),
mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method,
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
@@ -50900,7 +51117,9 @@ function createTypeChecker(host) {
getGlobalIteratorType,
getGlobalIterableType,
getGlobalIterableIteratorType,
+ getGlobalIteratorObjectType,
getGlobalGeneratorType,
+ getGlobalBuiltinIteratorTypes,
resolveIterationType: (type, _errorNode) => type,
mustHaveANextMethodDiagnostic: Diagnostics.An_iterator_must_have_a_next_method,
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_iterator_must_be_a_method,
@@ -50908,6 +51127,7 @@ function createTypeChecker(host) {
};
var amalgamatedDuplicates;
var reverseMappedCache = /* @__PURE__ */ new Map();
+ var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
var ambientModulesCache;
var nodeAmbientModulesCache;
var patternAmbientModules;
@@ -50938,12 +51158,16 @@ function createTypeChecker(host) {
var deferredGlobalIterableType;
var deferredGlobalIteratorType;
var deferredGlobalIterableIteratorType;
+ var deferredGlobalIteratorObjectType;
var deferredGlobalGeneratorType;
var deferredGlobalIteratorYieldResultType;
var deferredGlobalIteratorReturnResultType;
var deferredGlobalAsyncIterableType;
var deferredGlobalAsyncIteratorType;
var deferredGlobalAsyncIterableIteratorType;
+ var deferredGlobalBuiltinIteratorTypes;
+ var deferredGlobalBuiltinAsyncIteratorTypes;
+ var deferredGlobalAsyncIteratorObjectType;
var deferredGlobalAsyncGeneratorType;
var deferredGlobalTemplateStringsArrayType;
var deferredGlobalImportMetaType;
@@ -50979,6 +51203,7 @@ function createTypeChecker(host) {
var contextualTypes = [];
var contextualIsCache = [];
var contextualTypeCount = 0;
+ var contextualBindingPatterns = [];
var inferenceContextNodes = [];
var inferenceContexts = [];
var inferenceContextCount = 0;
@@ -51036,6 +51261,23 @@ function createTypeChecker(host) {
];
initializeTypeChecker();
return checker;
+ function isDefinitelyReferenceToGlobalSymbolObject(node) {
+ if (!isPropertyAccessExpression(node)) return false;
+ if (!isIdentifier(node.name)) return false;
+ if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
+ if (isIdentifier(node.expression)) {
+ return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
+ "Symbol",
+ 111551 /* Value */ | 1048576 /* ExportValue */,
+ /*diagnostic*/
+ void 0
+ ) || unknownSymbol);
+ }
+ if (!isIdentifier(node.expression.expression)) return false;
+ if (idText(node.expression.name) !== "Symbol" || idText(node.expression.expression) !== "globalThis") return false;
+ const resolvedSymbol = getResolvedSymbol(node.expression.expression);
+ return resolvedSymbol === denoGlobalThisSymbol || resolvedSymbol === nodeGlobalThisSymbol;
+ }
function getCachedType(key) {
return key ? cachedTypes.get(key) : void 0;
}
@@ -51281,7 +51523,7 @@ function createTypeChecker(host) {
}
if (source.exports) {
if (!target.exports) target.exports = createSymbolTable();
- mergeSymbolTable(target.exports, source.exports, unidirectional);
+ mergeSymbolTable(target.exports, source.exports, unidirectional, target);
}
if (!unidirectional) {
recordMergedSymbol(target, source);
@@ -51361,10 +51603,14 @@ function createTypeChecker(host) {
mergeSymbolTable(combined, second);
return combined;
}
- function mergeSymbolTable(target, source, unidirectional = false) {
+ function mergeSymbolTable(target, source, unidirectional = false, mergedParent) {
source.forEach((sourceSymbol, id) => {
const targetSymbol = target.get(id);
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
+ const merged = targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol);
+ if (mergedParent && targetSymbol) {
+ merged.parent = mergedParent;
+ }
+ target.set(id, merged);
});
}
function mergeModuleAugmentation(moduleName) {
@@ -51382,6 +51628,8 @@ function createTypeChecker(host) {
moduleName,
moduleName,
moduleNotFoundError,
+ /*ignoreErrors*/
+ false,
/*isForAugmentation*/
true
);
@@ -52022,9 +52270,9 @@ function createTypeChecker(host) {
}
}
function getDeclarationOfAliasSymbol(symbol) {
- return symbol.declarations && findLast(symbol.declarations, isAliasSymbolDeclaration2);
+ return symbol.declarations && findLast(symbol.declarations, isAliasSymbolDeclaration);
}
- function isAliasSymbolDeclaration2(node) {
+ function isAliasSymbolDeclaration(node) {
return node.kind === 271 /* ImportEqualsDeclaration */ || node.kind === 270 /* NamespaceExportDeclaration */ || node.kind === 273 /* ImportClause */ && !!node.name || node.kind === 274 /* NamespaceImport */ || node.kind === 280 /* NamespaceExport */ || node.kind === 276 /* ImportSpecifier */ || node.kind === 281 /* ExportSpecifier */ || node.kind === 277 /* ExportAssignment */ && exportAssignmentIsAlias(node) || isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */ && isAliasableOrJsExpression(node.parent.right) || node.kind === 304 /* ShorthandPropertyAssignment */ || node.kind === 303 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) || node.kind === 260 /* VariableDeclaration */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node) || node.kind === 208 /* BindingElement */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
}
function isAliasableOrJsExpression(e) {
@@ -52068,7 +52316,7 @@ function createTypeChecker(host) {
const isExport = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */;
const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
- const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
+ const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : moduleExportNameTextUnescaped(typeOnlyDeclaration.name);
addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
}
}
@@ -52093,22 +52341,25 @@ function createTypeChecker(host) {
function isSyntacticDefault(node) {
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
}
- function getUsageModeForExpression(usage) {
- return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
+ function getEmitSyntaxForModuleSpecifierExpression(usage) {
+ return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
}
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
}
- function isOnlyImportedAsDefault(usage) {
- const usageMode = getUsageModeForExpression(usage);
- return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
+ function isOnlyImportableAsDefault(usage) {
+ if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
+ const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
+ return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
+ }
+ return false;
}
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
- const usageMode = file && getUsageModeForExpression(usage);
- if (file && usageMode !== void 0 && file.impliedNodeFormat === 1 /* CommonJS */) {
- const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
- if (result) {
- return result;
+ const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage);
+ if (file && usageMode !== void 0) {
+ const targetMode = host.getImpliedNodeFormatForEmit(file);
+ if (usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */ && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
+ return true;
}
}
if (!allowSyntheticDefaultImports) {
@@ -52167,7 +52418,7 @@ function createTypeChecker(host) {
if (!specifier) {
return exportDefaultSymbol;
}
- const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
+ const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
@@ -52306,12 +52557,12 @@ function createTypeChecker(host) {
if (valueSymbol.exports) result.exports = new Map(valueSymbol.exports);
return result;
}
- function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
+ function getExportOfModule(symbol, nameText, specifier, dontResolveAlias) {
var _a;
if (symbol.flags & 1536 /* Module */) {
- const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
+ const exportSymbol = getExportsOfSymbol(symbol).get(nameText);
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
- const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(name.escapedText);
+ const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(nameText);
markSymbolOfAliasDeclarationIfTypeOnly(
specifier,
exportSymbol,
@@ -52319,7 +52570,7 @@ function createTypeChecker(host) {
/*overwriteEmpty*/
false,
exportStarDeclaration,
- name.escapedText
+ nameText
);
return resolved;
}
@@ -52337,10 +52588,11 @@ function createTypeChecker(host) {
const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
- if (!isIdentifier(name)) {
+ if (!isIdentifier(name) && name.kind !== 11 /* StringLiteral */) {
return void 0;
}
- const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
+ const nameText = moduleExportNameTextEscaped(name);
+ const suppressInteropError = nameText === "default" /* Default */ && allowSyntheticDefaultImports;
const targetSymbol = resolveESModuleSymbol(
moduleSymbol,
moduleSpecifier,
@@ -52349,7 +52601,7 @@ function createTypeChecker(host) {
suppressInteropError
);
if (targetSymbol) {
- if (name.escapedText) {
+ if (nameText || name.kind === 11 /* StringLiteral */) {
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
return moduleSymbol;
}
@@ -52357,18 +52609,18 @@ function createTypeChecker(host) {
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" /* ExportEquals */)) {
symbolFromVariable = getPropertyOfType(
getTypeOfSymbol(targetSymbol),
- name.escapedText,
+ nameText,
/*skipObjectFunctionPropertyAugment*/
true
);
} else {
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText);
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, nameText);
}
symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
- let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
- if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
+ let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
+ if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
- if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
+ if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
}
}
@@ -52384,7 +52636,7 @@ function createTypeChecker(host) {
var _a;
const moduleName = getFullyQualifiedName(moduleSymbol, node);
const declarationName = declarationNameToString(name);
- const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
+ const suggestion = isIdentifier(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0;
if (suggestion !== void 0) {
const suggestionName = symbolToString(suggestion);
const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
@@ -52406,7 +52658,7 @@ function createTypeChecker(host) {
}
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
var _a, _b;
- const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name.escapedText);
+ const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(moduleExportNameTextEscaped(name));
const exports2 = moduleSymbol.exports;
if (localSymbol) {
const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
@@ -52438,7 +52690,7 @@ function createTypeChecker(host) {
}
}
function getTargetOfImportSpecifier(node, dontResolveAlias) {
- if (isImportSpecifier(node) && idText(node.propertyName || node.name) === "default" /* Default */) {
+ if (isImportSpecifier(node) && moduleExportNameIsDefault(node.propertyName || node.name)) {
const specifier = getModuleSpecifierForImportOrExport(node);
const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
if (moduleSymbol) {
@@ -52482,19 +52734,23 @@ function createTypeChecker(host) {
}
}
function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
- if (idText(node.propertyName || node.name) === "default" /* Default */) {
+ const name = node.propertyName || node.name;
+ if (moduleExportNameIsDefault(name)) {
const specifier = getModuleSpecifierForImportOrExport(node);
const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
if (moduleSymbol) {
return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
}
}
- const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : resolveEntityName(
- node.propertyName || node.name,
- meaning,
- /*ignoreErrors*/
- false,
- dontResolveAlias
+ const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : name.kind === 11 /* StringLiteral */ ? void 0 : (
+ // Skip for invalid syntax like this: export { "x" }
+ resolveEntityName(
+ name,
+ meaning,
+ /*ignoreErrors*/
+ false,
+ dontResolveAlias
+ )
);
markSymbolOfAliasDeclarationIfTypeOnly(
node,
@@ -52942,10 +53198,10 @@ function createTypeChecker(host) {
function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
- return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage);
+ return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage, ignoreErrors);
}
- function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation = false) {
- return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
+ function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) {
+ return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
}
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
var _a;
@@ -52968,7 +53224,7 @@ function createTypeChecker(host) {
}
function resolveExternalModuleInner(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
- if (startsWith(moduleReference, "@types/")) {
+ if (errorNode && startsWith(moduleReference, "@types/")) {
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
@@ -52987,10 +53243,10 @@ function createTypeChecker(host) {
/*requireStringLiteralLikeArgument*/
true
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
- const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
+ const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
- const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
+ const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
if (sourceFile) {
if (resolutionDiagnostic) {
@@ -52998,7 +53254,7 @@ function createTypeChecker(host) {
}
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
- if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
+ if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
error2(
errorNode,
Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
@@ -53007,13 +53263,13 @@ function createTypeChecker(host) {
}
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
- if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
+ if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
}
}
if (sourceFile.symbol) {
- if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
+ if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
errorOnImplicitAnyModule(
/*isError*/
false,
@@ -53024,9 +53280,9 @@ function createTypeChecker(host) {
moduleReference
);
}
- if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
+ if (errorNode && (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */)) {
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
- const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
+ const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
if (findAncestor(location, isImportEqualsDeclaration)) {
error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -53034,41 +53290,7 @@ function createTypeChecker(host) {
let diagnosticDetails;
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
- const scope = currentSourceFile.packageJsonScope;
- const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
- if (scope && !scope.contents.packageJsonContent.type) {
- if (targetExt) {
- diagnosticDetails = chainDiagnosticMessages(
- /*details*/
- void 0,
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
- targetExt,
- combinePaths(scope.packageDirectory, "package.json")
- );
- } else {
- diagnosticDetails = chainDiagnosticMessages(
- /*details*/
- void 0,
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
- combinePaths(scope.packageDirectory, "package.json")
- );
- }
- } else {
- if (targetExt) {
- diagnosticDetails = chainDiagnosticMessages(
- /*details*/
- void 0,
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
- targetExt
- );
- } else {
- diagnosticDetails = chainDiagnosticMessages(
- /*details*/
- void 0,
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
- );
- }
- }
+ diagnosticDetails = createModeMismatchDetails(currentSourceFile);
}
diagnostics.add(createDiagnosticForNodeFromMessageChain(
getSourceFileOfNode(errorNode),
@@ -53084,7 +53306,7 @@ function createTypeChecker(host) {
}
return getMergedSymbol(sourceFile.symbol);
}
- if (moduleNotFoundError) {
+ if (errorNode && moduleNotFoundError && !isSideEffectImport(errorNode)) {
error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
}
return void 0;
@@ -53099,6 +53321,9 @@ function createTypeChecker(host) {
return getMergedSymbol(pattern.symbol);
}
}
+ if (!errorNode) {
+ return void 0;
+ }
if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
if (isForAugmentation) {
const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
@@ -53166,6 +53391,9 @@ function createTypeChecker(host) {
}
}
function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
+ if (isSideEffectImport(errorNode)) {
+ return;
+ }
let errorInfo;
if (!isExternalModuleNameRelative(moduleReference) && packageId) {
errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
@@ -53231,7 +53459,7 @@ function createTypeChecker(host) {
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
}
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
- const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat);
+ const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
if (!sigs || !sigs.length) {
@@ -54110,6 +54338,7 @@ function createTypeChecker(host) {
}
function symbolToString(symbol, enclosingDeclaration, meaning, flags = 4 /* AllowAnyNodeKind */, writer) {
let nodeFlags = 70221824 /* IgnoreErrors */;
+ let internalNodeFlags = 0 /* None */;
if (flags & 2 /* UseOnlyExternalAliasing */) {
nodeFlags |= 128 /* UseOnlyExternalAliasing */;
}
@@ -54120,15 +54349,15 @@ function createTypeChecker(host) {
nodeFlags |= 16384 /* UseAliasDefinedOutsideCurrentScope */;
}
if (flags & 32 /* DoNotIncludeSymbolChain */) {
- nodeFlags |= 134217728 /* DoNotIncludeSymbolChain */;
+ internalNodeFlags |= 4 /* DoNotIncludeSymbolChain */;
}
if (flags & 16 /* WriteComputedProps */) {
- nodeFlags |= 1073741824 /* WriteComputedProps */;
+ internalNodeFlags |= 1 /* WriteComputedProps */;
}
const builder = flags & 4 /* AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName;
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
function symbolToStringWorker(writer2) {
- const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
+ const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags, internalNodeFlags);
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 307 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
@@ -54165,7 +54394,13 @@ function createTypeChecker(host) {
}
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
- const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
+ const typeNode = nodeBuilder.typeToTypeNode(
+ type,
+ enclosingDeclaration,
+ toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
+ /*internalFlags*/
+ void 0
+ );
if (typeNode === void 0) return Debug.fail("should always get typenode");
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
@@ -54214,31 +54449,31 @@ function createTypeChecker(host) {
}
function createNodeBuilder() {
return {
- typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
- typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
- expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
- serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
- serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
- indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
+ typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
+ typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
+ expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
+ serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
+ serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
+ indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
indexInfo,
context,
/*typeNode*/
void 0
)),
- signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
- symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToName(
+ signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
+ symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
symbol,
context,
meaning,
/*expectsIdentifier*/
false
)),
- symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
- symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
- symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
- typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
- symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
- symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
+ symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
+ symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
+ symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
+ typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
+ symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
+ symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
};
function getTypeFromTypeNode2(context, node, noMappedTypes) {
const type = getTypeFromTypeNodeWithoutContext(node);
@@ -54254,19 +54489,26 @@ function createTypeChecker(host) {
if (!location) {
return range;
}
- if (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(location))) {
- return setOriginalNode(range, location);
+ let original = range.original;
+ while (original && original !== location) {
+ original = original.original;
+ }
+ if (!original) {
+ setOriginalNode(range, location);
}
- return setTextRange(setOriginalNode(range, location), location);
+ if (context.enclosingFile && context.enclosingFile === getSourceFileOfNode(getOriginalNode(location))) {
+ return setTextRange(range, location);
+ }
+ return range;
}
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
- const oldFlags = context.flags;
- if (expr && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
+ const restoreFlags = saveRestoreFlags(context);
+ if (expr && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
syntacticNodeBuilder.serializeTypeOfExpression(expr, context, addUndefined);
}
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
+ context.internalFlags |= 2 /* NoSyntacticPrinter */;
const result = expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined);
- context.flags = oldFlags;
+ restoreFlags();
return result;
}
function expressionOrTypeToTypeNodeHelper(context, expr, type, addUndefined) {
@@ -54287,11 +54529,11 @@ function createTypeChecker(host) {
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
const originalType = type;
if (addUndefined) {
- type = getOptionalType(type);
+ type = getOptionalType(type, !isParameter(host2));
}
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
if (clone2) {
- if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
+ if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
}
return clone2;
@@ -54319,7 +54561,7 @@ function createTypeChecker(host) {
return void 0;
}
function symbolToNode(symbol, context, meaning) {
- if (context.flags & 1073741824 /* WriteComputedProps */) {
+ if (context.internalFlags & 1 /* WriteComputedProps */) {
if (symbol.valueDeclaration) {
const name = getNameOfDeclaration(symbol.valueDeclaration);
if (name && isComputedPropertyName(name)) return name;
@@ -54332,12 +54574,13 @@ function createTypeChecker(host) {
}
return symbolToExpression(symbol, context, meaning);
}
- function withContext2(enclosingDeclaration, flags, tracker, cb) {
- const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
+ function withContext2(enclosingDeclaration, flags, internalFlags, tracker, cb) {
+ const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
const context = {
enclosingDeclaration,
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
flags: flags || 0 /* None */,
+ internalFlags: internalFlags || 0 /* None */,
tracker: void 0,
encounteredError: false,
reportedDiagnostic: false,
@@ -54367,14 +54610,23 @@ function createTypeChecker(host) {
}
return context.encounteredError ? void 0 : resultingNode;
}
+ function saveRestoreFlags(context) {
+ const flags = context.flags;
+ const internalFlags = context.internalFlags;
+ return restore;
+ function restore() {
+ context.flags = flags;
+ context.internalFlags = internalFlags;
+ }
+ }
function checkTruncationLength(context) {
if (context.truncating) return context.truncating;
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
}
function typeToTypeNodeHelper(type, context) {
- const savedFlags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
const typeNode = typeToTypeNodeWorker(type, context);
- context.flags = savedFlags;
+ restoreFlags();
return typeNode;
}
function typeToTypeNodeWorker(type, context) {
@@ -54828,7 +55080,7 @@ function createTypeChecker(host) {
context.symbolDepth = /* @__PURE__ */ new Map();
}
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
- const key = `${getTypeId(type2)}|${context.flags}`;
+ const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
if (links) {
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
}
@@ -54934,10 +55186,10 @@ function createTypeChecker(host) {
}
return typeToTypeNodeHelper(getIntersectionType(types), context);
}
- const savedFlags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
context.flags |= 4194304 /* InObjectTypeLiteral */;
const members = createTypeNodesFromResolvedType(resolved);
- context.flags = savedFlags;
+ restoreFlags();
const typeLiteralNode = factory.createTypeLiteralNode(members);
context.approximateLength += 2;
setEmitFlags(typeLiteralNode, context.flags & 1024 /* MultilineObjectLiterals */ ? 0 : 1 /* SingleLine */);
@@ -55000,23 +55252,51 @@ function createTypeChecker(host) {
} while (i < length2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent2);
if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) {
const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context);
- const flags2 = context.flags;
+ const restoreFlags2 = saveRestoreFlags(context);
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
const ref = symbolToTypeNode(parent2, context, 788968 /* Type */, typeArgumentSlice);
- context.flags = flags2;
+ restoreFlags2();
resultType = !resultType ? ref : appendReferenceToType(resultType, ref);
}
}
}
let typeArgumentNodes;
if (typeArguments.length > 0) {
- const typeParameterCount = (type2.target.typeParameters || emptyArray).length;
+ let typeParameterCount = 0;
+ if (type2.target.typeParameters) {
+ typeParameterCount = Math.min(type2.target.typeParameters.length, typeArguments.length);
+ if (isReferenceToType2(type2, getGlobalIterableType(
+ /*reportErrors*/
+ false
+ )) || isReferenceToType2(type2, getGlobalIterableIteratorType(
+ /*reportErrors*/
+ false
+ )) || isReferenceToType2(type2, getGlobalAsyncIterableType(
+ /*reportErrors*/
+ false
+ )) || isReferenceToType2(type2, getGlobalAsyncIterableIteratorType(
+ /*reportErrors*/
+ false
+ ))) {
+ if (!type2.node || !isTypeReferenceNode(type2.node) || !type2.node.typeArguments || type2.node.typeArguments.length < typeParameterCount) {
+ while (typeParameterCount > 0) {
+ const typeArgument = typeArguments[typeParameterCount - 1];
+ const typeParameter = type2.target.typeParameters[typeParameterCount - 1];
+ const defaultType = getDefaultFromTypeParameter(typeParameter);
+ if (!defaultType || !isTypeIdenticalTo(typeArgument, defaultType)) {
+ break;
+ }
+ typeParameterCount--;
+ }
+ }
+ }
+ }
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
}
- const flags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
context.flags |= 16 /* ForbidIndexedAccessSymbolReferences */;
const finalRef = symbolToTypeNode(type2.symbol, context, 788968 /* Type */, typeArgumentNodes);
- context.flags = flags;
+ restoreFlags();
return !resultType ? finalRef : appendReferenceToType(resultType, finalRef);
}
}
@@ -55151,7 +55431,21 @@ function createTypeChecker(host) {
}
function shouldUsePlaceholderForProperty(propertySymbol, context) {
var _a;
- return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
+ const depth = 3;
+ return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
+ function isDeeplyNestedReverseMappedTypeProperty() {
+ var _a2;
+ if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
+ return false;
+ }
+ for (let i = 0; i < depth; i++) {
+ const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
+ if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
+ return false;
+ }
+ }
+ return true;
+ }
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
var _a;
@@ -55314,7 +55608,7 @@ function createTypeChecker(host) {
}
}
if (seenNames) {
- const saveContextFlags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
context.flags |= 64 /* UseFullyQualifiedType */;
seenNames.forEach((types2) => {
if (!arrayIsHomogeneous(types2, ([a], [b]) => typesAreSameReference(a, b))) {
@@ -55323,7 +55617,7 @@ function createTypeChecker(host) {
}
}
});
- context.flags = saveContextFlags;
+ restoreFlags();
}
return result;
}
@@ -55375,19 +55669,19 @@ function createTypeChecker(host) {
} else {
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
}
- const flags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
context.flags &= ~256 /* SuppressAnyReturnType */;
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
if (thisParameter) {
parameters.unshift(thisParameter);
}
- context.flags = flags;
+ restoreFlags();
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
let modifiers = options == null ? void 0 : options.modifiers;
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
- const flags2 = modifiersToFlags(modifiers);
- modifiers = factory.createModifiersFromModifierFlags(flags2 | 64 /* Abstract */);
+ const flags = modifiersToFlags(modifiers);
+ modifiers = factory.createModifiersFromModifierFlags(flags | 64 /* Abstract */);
}
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
modifiers,
@@ -55607,13 +55901,13 @@ function createTypeChecker(host) {
}
}
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
- const savedContextFlags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */;
const modifiers = factory.createModifiersFromModifierFlags(getTypeParameterModifiers(type));
const name = typeParameterToName(type, context);
const defaultParameter = getDefaultFromTypeParameter(type);
const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context);
- context.flags = savedContextFlags;
+ restoreFlags();
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
}
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
@@ -55717,7 +56011,7 @@ function createTypeChecker(host) {
function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
let chain;
const isTypeParameter = symbol.flags & 262144 /* TypeParameter */;
- if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.flags & 134217728 /* DoNotIncludeSymbolChain */)) {
+ if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64 /* UseFullyQualifiedType */) && !(context.internalFlags & 4 /* DoNotIncludeSymbolChain */)) {
chain = Debug.checkDefined(getSymbolChain(
symbol,
meaning,
@@ -55853,8 +56147,10 @@ function createTypeChecker(host) {
}
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
}
+ const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
+ const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
const contextFile = context.enclosingFile;
- const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
+ const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
const links = getSymbolLinks(symbol);
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
@@ -55896,14 +56192,6 @@ function createTypeChecker(host) {
if (getEmitModuleResolutionKind(compilerOptions) === 3 /* Node16 */ || getEmitModuleResolutionKind(compilerOptions) === 99 /* NodeNext */) {
if ((targetFile == null ? void 0 : targetFile.impliedNodeFormat) === 99 /* ESNext */ && targetFile.impliedNodeFormat !== (contextFile == null ? void 0 : contextFile.impliedNodeFormat)) {
specifier = getSpecifierForModuleSymbol(chain[0], context, 99 /* ESNext */);
- attributes = factory.createImportAttributes(
- factory.createNodeArray([
- factory.createImportAttribute(
- factory.createStringLiteral("resolution-mode"),
- factory.createStringLiteral("import")
- )
- ])
- );
}
}
if (!specifier) {
@@ -56238,21 +56526,22 @@ function createTypeChecker(host) {
return enclosingDeclaration;
}
function serializeTypeForDeclaration(context, declaration, type, symbol) {
- var _a;
- const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
+ var _a, _b;
+ const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
const enclosingDeclaration = context.enclosingDeclaration;
- const oldFlags = context.flags;
- if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
+ const restoreFlags = saveRestoreFlags(context);
+ if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
}
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
- if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
+ context.internalFlags |= 2 /* NoSyntacticPrinter */;
+ if (enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */)) {
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
+ const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
if (result2) {
- context.flags = oldFlags;
+ restoreFlags();
return result2;
}
}
@@ -56260,10 +56549,10 @@ function createTypeChecker(host) {
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
}
- const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
+ const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
- const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
- context.flags = oldFlags;
+ const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
+ restoreFlags();
return result;
}
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
@@ -56277,29 +56566,29 @@ function createTypeChecker(host) {
}
function serializeReturnTypeForSignature(context, signature) {
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
- const flags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */;
let returnTypeNode;
const returnType = getReturnTypeOfSignature(signature);
if (returnType && !(suppressAny && isTypeAny(returnType))) {
- if (signature.declaration && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
+ if (signature.declaration && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, context);
}
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
+ context.internalFlags |= 2 /* NoSyntacticPrinter */;
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
} else if (!suppressAny) {
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
}
- context.flags = flags;
+ restoreFlags();
return returnTypeNode;
}
function serializeReturnTypeForSignatureWorker(context, signature) {
const typePredicate = getTypePredicateOfSignature(signature);
const type = getReturnTypeOfSignature(signature);
- if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
- const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
- if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
- const result = tryReuseExistingTypeNodeHelper(context, annotation);
+ if (context.enclosingDeclaration && (!isErrorType(type) || context.internalFlags & 8 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
+ const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
+ if (annotation) {
+ const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
if (result) {
return result;
}
@@ -56370,6 +56659,8 @@ function createTypeChecker(host) {
}
introducesError = true;
return { introducesError, node, sym };
+ } else {
+ sym = symAtLocation;
}
}
if (sym) {
@@ -56793,7 +57084,10 @@ function createTypeChecker(host) {
);
}
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
- if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
+ if (!hasDynamicName(node)) {
+ return visitEachChild2(node, visitExistingNodeTreeSymbols);
+ }
+ if (!(context.internalFlags & 8 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
return void 0;
}
}
@@ -56923,7 +57217,7 @@ function createTypeChecker(host) {
if (result) {
if (result.pos !== -1 || result.end !== -1) {
if (result === nodes) {
- result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
+ result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
}
setTextRangePosEnd(result, -1, -1);
}
@@ -57144,9 +57438,10 @@ function createTypeChecker(host) {
if (index >= 0) {
const exportDecl = statements[index];
const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
- if (!e.propertyName) {
+ if (!e.propertyName && e.name.kind !== 11 /* StringLiteral */) {
+ const name = e.name;
const indices = indicesOf(statements);
- const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], e.name));
+ const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], name));
if (length(associatedIndices) && every(associatedIndices, (i) => canHaveExportModifier(statements[i]))) {
for (const index2 of associatedIndices) {
statements[index2] = addExportModifier(statements[index2]);
@@ -57444,7 +57739,7 @@ function createTypeChecker(host) {
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias);
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
- const oldFlags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
context.flags |= 8388608 /* InTypeAlias */;
const oldEnclosingDecl = context.enclosingDeclaration;
context.enclosingDeclaration = jsdocAliasDecl;
@@ -57468,7 +57763,7 @@ function createTypeChecker(host) {
),
modifierFlags
);
- context.flags = oldFlags;
+ restoreFlags();
context.enclosingDeclaration = oldEnclosingDecl;
}
function serializeInterface(symbol, symbolName2, modifierFlags) {
@@ -57780,7 +58075,7 @@ function createTypeChecker(host) {
function getSomeTargetNameFromDeclarations(declarations) {
return firstDefined(declarations, (d) => {
if (isImportSpecifier(d) || isExportSpecifier(d)) {
- return idText(d.propertyName || d.name);
+ return moduleExportNameTextUnescaped(d.propertyName || d.name);
}
if (isBinaryExpression(d) || isExportAssignment(d)) {
const expression = isExportAssignment(d) ? d.expression : d.right;
@@ -57788,7 +58083,7 @@ function createTypeChecker(host) {
return idText(expression.name);
}
}
- if (isAliasSymbolDeclaration2(d)) {
+ if (isAliasSymbolDeclaration(d)) {
const name = getNameOfDeclaration(d);
if (name && isIdentifier(name)) {
return idText(name);
@@ -57798,7 +58093,7 @@ function createTypeChecker(host) {
});
}
function serializeAsAlias(symbol, localName, modifierFlags) {
- var _a2, _b, _c, _d, _e, _f;
+ var _a2, _b, _c, _d, _e;
const node = getDeclarationOfAliasSymbol(symbol);
if (!node) return Debug.fail();
const target = getMergedSymbol(getTargetOfAliasDeclaration(
@@ -57996,8 +58291,11 @@ function createTypeChecker(host) {
}
case 281 /* ExportSpecifier */:
const specifier = node.parent.parent.moduleSpecifier;
- if (specifier && ((_f = node.propertyName) == null ? void 0 : _f.escapedText) === "default" /* Default */) {
- verbatimTargetName = "default" /* Default */;
+ if (specifier) {
+ const propertyName = node.propertyName;
+ if (propertyName && moduleExportNameIsDefault(propertyName)) {
+ verbatimTargetName = "default" /* Default */;
+ }
}
serializeExportSpecifier(
unescapeLeadingUnderscores(symbol.escapedName),
@@ -58474,10 +58772,10 @@ function createTypeChecker(host) {
}
function getNameCandidateWorker(symbol, localName) {
if (localName === "default" /* Default */ || localName === "__class" /* Class */ || localName === "__function" /* Function */) {
- const flags = context.flags;
+ const restoreFlags = saveRestoreFlags(context);
context.flags |= 16777216 /* InInitialEntityName */;
const nameCandidate = getNameOfSymbolAsWritten(symbol, context);
- context.flags = flags;
+ restoreFlags();
localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes(nameCandidate) : nameCandidate;
}
if (localName === "default" /* Default */) {
@@ -58485,7 +58783,7 @@ function createTypeChecker(host) {
} else if (localName === "export=" /* ExportEquals */) {
localName = "_exports";
}
- localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-zA-Z0-9]/g, "_");
+ localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
return localName;
}
function getInternalSymbolName(symbol, localName) {
@@ -58710,7 +59008,7 @@ function createTypeChecker(host) {
}
function collectLinkedAliases(node, setVisibility) {
let exportSymbol;
- if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
+ if (node.kind !== 11 /* StringLiteral */ && node.parent && node.parent.kind === 277 /* ExportAssignment */) {
exportSymbol = resolveName(
node,
node,
@@ -58995,6 +59293,7 @@ function createTypeChecker(host) {
} else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
}
+ const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* AllowMissing */ : 0);
let type;
if (pattern.kind === 206 /* ObjectBindingPattern */) {
if (declaration.dotDotDotToken) {
@@ -59013,7 +59312,7 @@ function createTypeChecker(host) {
} else {
const name = declaration.propertyName || declaration.name;
const indexType = getLiteralTypeFromPropertyName(name);
- const declaredType = getIndexedAccessType(parentType, indexType, 32 /* ExpressionPosition */, name);
+ const declaredType = getIndexedAccessType(parentType, indexType, accessFlags, name);
type = getFlowTypeOfDestructuring(declaration, declaredType);
}
} else {
@@ -59024,7 +59323,6 @@ function createTypeChecker(host) {
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
} else if (isArrayLikeType(parentType)) {
const indexType = getNumberLiteralType(index);
- const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
type = getFlowTypeOfDestructuring(declaration, declaredType);
} else {
@@ -59510,7 +59808,7 @@ function createTypeChecker(host) {
/*reportErrors*/
false
) : unknownType;
- return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, reportErrors2 ? 0 /* Normal */ : 1 /* Contextual */, contextualType)));
+ return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
}
if (isBindingPattern(element.name)) {
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2);
@@ -59581,7 +59879,10 @@ function createTypeChecker(host) {
return result;
}
function getTypeFromBindingPattern(pattern, includePatternInType = false, reportErrors2 = false) {
- return pattern.kind === 206 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2);
+ if (includePatternInType) contextualBindingPatterns.push(pattern);
+ const result = pattern.kind === 206 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2);
+ if (includePatternInType) contextualBindingPatterns.pop();
+ return result;
}
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors2) {
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(
@@ -59662,18 +59963,18 @@ function createTypeChecker(host) {
}
return false;
}
- function getTypeOfVariableOrParameterOrProperty(symbol, checkMode) {
+ function getTypeOfVariableOrParameterOrProperty(symbol) {
const links = getSymbolLinks(symbol);
if (!links.type) {
- const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol, checkMode);
- if (!links.type && !isParameterOfContextSensitiveSignature(symbol) && !checkMode) {
+ const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
+ if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
links.type = type;
}
return type;
}
return links.type;
}
- function getTypeOfVariableOrParameterOrPropertyWorker(symbol, checkMode) {
+ function getTypeOfVariableOrParameterOrPropertyWorker(symbol) {
if (symbol.flags & 4194304 /* Prototype */) {
return getTypeOfPrototypeProperty(symbol);
}
@@ -59708,9 +60009,6 @@ function createTypeChecker(host) {
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
return getTypeOfFuncClassEnumModule(symbol);
}
- if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
- return errorType;
- }
return reportCircularityError(symbol);
}
let type;
@@ -59748,9 +60046,6 @@ function createTypeChecker(host) {
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
return getTypeOfFuncClassEnumModule(symbol);
}
- if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
- return type;
- }
return reportCircularityError(symbol);
}
return type;
@@ -59979,7 +60274,7 @@ function createTypeChecker(host) {
}
return getTypeOfSymbol(symbol);
}
- function getTypeOfSymbol(symbol, checkMode) {
+ function getTypeOfSymbol(symbol) {
const checkFlags = getCheckFlags(symbol);
if (checkFlags & 65536 /* DeferredType */) {
return getTypeOfSymbolWithDeferredType(symbol);
@@ -59994,7 +60289,7 @@ function createTypeChecker(host) {
return getTypeOfReverseMappedSymbol(symbol);
}
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
- return getTypeOfVariableOrParameterOrProperty(symbol, checkMode);
+ return getTypeOfVariableOrParameterOrProperty(symbol);
}
if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {
return getTypeOfFuncClassEnumModule(symbol);
@@ -60013,6 +60308,17 @@ function createTypeChecker(host) {
function getNonMissingTypeOfSymbol(symbol) {
return removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216 /* Optional */));
}
+ function isReferenceToSomeType(type, targets) {
+ if (type === void 0 || (getObjectFlags(type) & 4 /* Reference */) === 0) {
+ return false;
+ }
+ for (const target of targets) {
+ if (type.target === target) {
+ return true;
+ }
+ }
+ return false;
+ }
function isReferenceToType2(type, target) {
return type !== void 0 && target !== void 0 && (getObjectFlags(type) & 4 /* Reference */) !== 0 && type.target === target;
}
@@ -60052,7 +60358,8 @@ function createTypeChecker(host) {
if (!node) {
return void 0;
}
- switch (node.kind) {
+ const kind = node.kind;
+ switch (kind) {
case 263 /* ClassDeclaration */:
case 231 /* ClassExpression */:
case 264 /* InterfaceDeclaration */:
@@ -60074,13 +60381,19 @@ function createTypeChecker(host) {
case 200 /* MappedType */:
case 194 /* ConditionalType */: {
const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
- if (node.kind === 200 /* MappedType */) {
+ if ((kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */ || isObjectLiteralMethod(node)) && isContextSensitive(node)) {
+ const signature = firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfDeclaration(node)), 0 /* Call */));
+ if (signature && signature.typeParameters) {
+ return [...outerTypeParameters || emptyArray, ...signature.typeParameters];
+ }
+ }
+ if (kind === 200 /* MappedType */) {
return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter)));
- } else if (node.kind === 194 /* ConditionalType */) {
+ } else if (kind === 194 /* ConditionalType */) {
return concatenate(outerTypeParameters, getInferTypeParameters(node));
}
const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node));
- const thisType = includeThisTypes && (node.kind === 263 /* ClassDeclaration */ || node.kind === 231 /* ClassExpression */ || node.kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
+ const thisType = includeThisTypes && (kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType;
return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
}
case 341 /* JSDocParameterTag */:
@@ -60434,6 +60747,9 @@ function createTypeChecker(host) {
links.instantiations = /* @__PURE__ */ new Map();
links.instantiations.set(getTypeListId(typeParameters), type);
}
+ if (type === intrinsicMarkerType && symbol.escapedName === "BuiltinIteratorReturn") {
+ type = getBuiltinIteratorReturnType();
+ }
} else {
type = errorType;
if (declaration.kind === 340 /* JSDocEnumTag */) {
@@ -60898,18 +61214,18 @@ function createTypeChecker(host) {
function getExpandedParameters(sig, skipUnionExpanding) {
if (signatureHasRestParameter(sig)) {
const restIndex = sig.parameters.length - 1;
- const restName = sig.parameters[restIndex].escapedName;
- const restType = getTypeOfSymbol(sig.parameters[restIndex]);
+ const restSymbol = sig.parameters[restIndex];
+ const restType = getTypeOfSymbol(restSymbol);
if (isTupleType(restType)) {
- return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol)];
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restSymbol));
}
}
return [sig.parameters];
- function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol) {
const elementTypes = getTypeArguments(restType);
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restSymbol);
const restParams = map(elementTypes, (t, i) => {
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
const flags = restType.target.elementFlags[i];
@@ -60920,19 +61236,29 @@ function createTypeChecker(host) {
});
return concatenate(sig.parameters.slice(0, restIndex), restParams);
}
- function getUniqAssociatedNamesFromTupleType(type, restName) {
- const associatedNamesMap = /* @__PURE__ */ new Map();
- return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
- const name = getTupleElementLabel(labeledElement, i, restName);
- const prevCounter = associatedNamesMap.get(name);
- if (prevCounter === void 0) {
- associatedNamesMap.set(name, 1);
- return name;
- } else {
- associatedNamesMap.set(name, prevCounter + 1);
- return `${name}_${prevCounter}`;
+ function getUniqAssociatedNamesFromTupleType(type, restSymbol) {
+ const names = map(type.target.labeledElementDeclarations, (labeledElement, i) => getTupleElementLabel(labeledElement, i, type.target.elementFlags[i], restSymbol));
+ if (names) {
+ const duplicates = [];
+ const uniqueNames = /* @__PURE__ */ new Set();
+ for (let i = 0; i < names.length; i++) {
+ const name = names[i];
+ if (!tryAddToSet(uniqueNames, name)) {
+ duplicates.push(i);
+ }
}
- });
+ const counters = /* @__PURE__ */ new Map();
+ for (const i of duplicates) {
+ let counter = counters.get(names[i]) ?? 1;
+ let name;
+ while (!tryAddToSet(uniqueNames, name = `${names[i]}_${counter}`)) {
+ counter++;
+ }
+ names[i] = name;
+ counters.set(names[i], counter + 1);
+ }
+ }
+ return names;
}
}
function getDefaultConstructSignatures(classType) {
@@ -62879,8 +63205,11 @@ function createTypeChecker(host) {
true
);
}
+ function getTypeParametersForMapper(signature) {
+ return sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp);
+ }
function createSignatureTypeMapper(signature, typeArguments) {
- return createTypeMapper(signature.typeParameters, typeArguments);
+ return createTypeMapper(getTypeParametersForMapper(signature), typeArguments);
}
function getErasedSignature(signature) {
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
@@ -63141,14 +63470,14 @@ function createTypeChecker(host) {
var _a, _b;
if (!type.resolvedTypeArguments) {
if (!pushTypeResolution(type, 5 /* ResolvedTypeArguments */)) {
- return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
+ return concatenate(type.target.outerTypeParameters, (_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
}
const node = type.node;
const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
if (popTypeResolution()) {
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments);
} else {
- type.resolvedTypeArguments ?? (type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray);
+ type.resolvedTypeArguments ?? (type.resolvedTypeArguments = concatenate(type.target.outerTypeParameters, ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray));
error2(
type.node || currentNode,
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
@@ -63599,6 +63928,18 @@ function createTypeChecker(host) {
const symbol = getGlobalTypeSymbol(name, reportErrors2);
return symbol || reportErrors2 ? getTypeOfGlobalSymbol(symbol, arity) : void 0;
}
+ function getGlobalBuiltinTypes(typeNames, arity) {
+ let types;
+ for (const typeName of typeNames) {
+ types = append(types, getGlobalType(
+ typeName,
+ arity,
+ /*reportErrors*/
+ false
+ ));
+ }
+ return types ?? emptyArray;
+ }
function getGlobalTypedPropertyDescriptorType() {
return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType(
"TypedPropertyDescriptor",
@@ -63701,7 +64042,7 @@ function createTypeChecker(host) {
return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
"AsyncIterable",
/*arity*/
- 1,
+ 3,
reportErrors2
)) || emptyGenericType;
}
@@ -63717,7 +64058,18 @@ function createTypeChecker(host) {
return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
"AsyncIterableIterator",
/*arity*/
- 1,
+ 3,
+ reportErrors2
+ )) || emptyGenericType;
+ }
+ function getGlobalBuiltinAsyncIteratorTypes() {
+ return deferredGlobalBuiltinAsyncIteratorTypes ?? (deferredGlobalBuiltinAsyncIteratorTypes = getGlobalBuiltinTypes(["ReadableStreamAsyncIterator"], 1));
+ }
+ function getGlobalAsyncIteratorObjectType(reportErrors2) {
+ return deferredGlobalAsyncIteratorObjectType || (deferredGlobalAsyncIteratorObjectType = getGlobalType(
+ "AsyncIteratorObject",
+ /*arity*/
+ 3,
reportErrors2
)) || emptyGenericType;
}
@@ -63733,7 +64085,7 @@ function createTypeChecker(host) {
return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
"Iterable",
/*arity*/
- 1,
+ 3,
reportErrors2
)) || emptyGenericType;
}
@@ -63749,7 +64101,21 @@ function createTypeChecker(host) {
return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
"IterableIterator",
/*arity*/
- 1,
+ 3,
+ reportErrors2
+ )) || emptyGenericType;
+ }
+ function getBuiltinIteratorReturnType() {
+ return strictBuiltinIteratorReturn ? undefinedType : anyType;
+ }
+ function getGlobalBuiltinIteratorTypes() {
+ return deferredGlobalBuiltinIteratorTypes ?? (deferredGlobalBuiltinIteratorTypes = getGlobalBuiltinTypes(["ArrayIterator", "MapIterator", "SetIterator", "StringIterator"], 1));
+ }
+ function getGlobalIteratorObjectType(reportErrors2) {
+ return deferredGlobalIteratorObjectType || (deferredGlobalIteratorObjectType = getGlobalType(
+ "IteratorObject",
+ /*arity*/
+ 3,
reportErrors2
)) || emptyGenericType;
}
@@ -63931,7 +64297,7 @@ function createTypeChecker(host) {
return createTypeFromGenericGlobalType(getGlobalIterableType(
/*reportErrors*/
true
- ), [iteratedType]);
+ ), [iteratedType, voidType, undefinedType]);
}
function createArrayType(elementType, readonly) {
return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
@@ -64595,6 +64961,12 @@ function createTypeChecker(host) {
function eachUnionContains(unionTypes2, type) {
for (const u of unionTypes2) {
if (!containsType(u.types, type)) {
+ if (type === missingType) {
+ return containsType(u.types, undefinedType);
+ }
+ if (type === undefinedType) {
+ return containsType(u.types, missingType);
+ }
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
if (!primitive || !containsType(u.types, primitive)) {
return false;
@@ -64651,6 +65023,13 @@ function createTypeChecker(host) {
for (const t of u.types) {
if (insertType(checked, t)) {
if (eachUnionContains(unionTypes2, t)) {
+ if (t === undefinedType && result.length && result[0] === missingType) {
+ continue;
+ }
+ if (t === missingType && result.length && result[0] === undefinedType) {
+ result[0] = missingType;
+ continue;
+ }
insertType(result, t);
}
}
@@ -64735,7 +65114,7 @@ function createTypeChecker(host) {
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
removeFromEach(typeSet, 65536 /* Null */);
result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
- } else if (typeSet.length >= 4) {
+ } else if (typeSet.length >= 3 && types.length > 2) {
const middle = Math.floor(typeSet.length / 2);
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
} else {
@@ -65131,7 +65510,7 @@ function createTypeChecker(host) {
}
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
const index = +propName;
- if (accessNode && everyType(objectType, (t) => !t.target.hasRestElement) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
+ if (accessNode && everyType(objectType, (t) => !(t.target.combinedFlags & 12 /* Variable */)) && !(accessFlags & 16 /* AllowMissing */)) {
const indexNode = getIndexNodeForAccessExpression(accessNode);
if (isTupleType(objectType)) {
if (index < 0) {
@@ -65272,17 +65651,21 @@ function createTypeChecker(host) {
return void 0;
}
}
+ if (accessFlags & 16 /* AllowMissing */ && isObjectLiteralType2(objectType)) {
+ return undefinedType;
+ }
if (isJSLiteralType(objectType)) {
return anyType;
}
if (accessNode) {
const indexNode = getIndexNodeForAccessExpression(accessNode);
- if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
+ if (indexNode.kind !== 10 /* BigIntLiteral */ && indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
} else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
} else {
- error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ const typeString = indexNode.kind === 10 /* BigIntLiteral */ ? "bigint" : typeToString(indexType);
+ error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeString);
}
}
if (isTypeAny(indexType)) {
@@ -67525,6 +67908,10 @@ function createTypeChecker(host) {
function containsUndefinedType(type) {
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
}
+ function containsNonMissingUndefinedType(type) {
+ const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
+ return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
+ }
function isStringIndexSignatureOnlyType(type) {
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
}
@@ -67539,7 +67926,7 @@ function createTypeChecker(host) {
}
const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
const entry = enumRelation.get(id);
- if (entry !== void 0 && !(!(entry & 4 /* Reported */) && entry & 2 /* Failed */ && errorReporter)) {
+ if (entry !== void 0 && !(entry & 2 /* Failed */ && errorReporter)) {
return !!(entry & 1 /* Succeeded */);
}
const targetEnumType = getTypeOfSymbol(targetSymbol);
@@ -67554,10 +67941,8 @@ function createTypeChecker(host) {
void 0,
64 /* UseFullyQualifiedType */
));
- enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
- } else {
- enumRelation.set(id, 2 /* Failed */);
}
+ enumRelation.set(id, 2 /* Failed */);
return false;
}
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */)).value;
@@ -67566,26 +67951,22 @@ function createTypeChecker(host) {
const sourceIsString = typeof sourceValue === "string";
const targetIsString = typeof targetValue === "string";
if (sourceValue !== void 0 && targetValue !== void 0) {
- if (!errorReporter) {
- enumRelation.set(id, 2 /* Failed */);
- } else {
+ if (errorReporter) {
const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue;
const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue;
errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource);
- enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
}
+ enumRelation.set(id, 2 /* Failed */);
return false;
}
if (sourceIsString || targetIsString) {
- if (!errorReporter) {
- enumRelation.set(id, 2 /* Failed */);
- } else {
+ if (errorReporter) {
const knownStringValue = sourceValue ?? targetValue;
Debug.assert(typeof knownStringValue === "string");
const escapedValue = `"${escapeString(knownStringValue)}"`;
errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue);
- enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
}
+ enumRelation.set(id, 2 /* Failed */);
return false;
}
}
@@ -67743,7 +68124,7 @@ function createTypeChecker(host) {
/*ignoreConstraints*/
false
);
- relation.set(id, 4 /* Reported */ | 2 /* Failed */);
+ relation.set(id, 2 /* Failed */ | (relationCount <= 0 ? 32 /* ComplexityOverflow */ : 64 /* StackDepthOverflow */));
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
const diag2 = error2(errorNode || currentNode, message, typeToString(source), typeToString(target));
@@ -68596,7 +68977,7 @@ function createTypeChecker(host) {
);
const entry = relation.get(id);
if (entry !== void 0) {
- if (reportErrors2 && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
+ if (reportErrors2 && entry & 2 /* Failed */ && !(entry & 96 /* Overflow */)) {
} else {
if (outofbandVarianceMarkerHandler) {
const saved = entry & 24 /* ReportsMask */;
@@ -68607,6 +68988,11 @@ function createTypeChecker(host) {
instantiateType(source2, reportUnreliableMapper);
}
}
+ if (reportErrors2 && entry & 96 /* Overflow */) {
+ const message = entry & 32 /* ComplexityOverflow */ ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
+ reportError(message, typeToString(source2), typeToString(target2));
+ overrideNextErrorInfo++;
+ }
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
}
}
@@ -68704,7 +69090,7 @@ function createTypeChecker(host) {
}
}
} else {
- relation.set(id, (reportErrors2 ? 4 /* Reported */ : 0) | 2 /* Failed */ | propagatingVarianceFlags);
+ relation.set(id, 2 /* Failed */ | propagatingVarianceFlags);
relationCount--;
resetMaybeStack(
/*markAllAsSucceeded*/
@@ -69597,7 +69983,7 @@ function createTypeChecker(host) {
const sourceArity = getTypeReferenceArity(source2);
const targetArity = getTypeReferenceArity(target2);
const sourceRestFlag = isTupleType(source2) ? source2.target.combinedFlags & 4 /* Rest */ : 4 /* Rest */;
- const targetRestFlag = target2.target.combinedFlags & 4 /* Rest */;
+ const targetHasRestElement = !!(target2.target.combinedFlags & 12 /* Variable */);
const sourceMinLength = isTupleType(source2) ? source2.target.minLength : 0;
const targetMinLength = target2.target.minLength;
if (!sourceRestFlag && sourceArity < targetMinLength) {
@@ -69606,13 +69992,13 @@ function createTypeChecker(host) {
}
return 0 /* False */;
}
- if (!targetRestFlag && targetArity < sourceMinLength) {
+ if (!targetHasRestElement && targetArity < sourceMinLength) {
if (reportErrors2) {
reportError(Diagnostics.Source_has_0_element_s_but_target_allows_only_1, sourceMinLength, targetArity);
}
return 0 /* False */;
}
- if (!targetRestFlag && (sourceRestFlag || targetArity < sourceArity)) {
+ if (!targetHasRestElement && (sourceRestFlag || targetArity < sourceArity)) {
if (reportErrors2) {
if (sourceMinLength < targetMinLength) {
reportError(Diagnostics.Target_requires_0_element_s_but_source_may_have_fewer, targetMinLength);
@@ -69626,7 +70012,6 @@ function createTypeChecker(host) {
const targetTypeArguments = getTypeArguments(target2);
const targetStartCount = getStartElementCount(target2.target, 11 /* NonRest */);
const targetEndCount = getEndElementCount(target2.target, 11 /* NonRest */);
- const targetHasRestElement = target2.target.hasRestElement;
let canExcludeDiscriminants = !!excludedProperties;
for (let sourcePosition = 0; sourcePosition < sourceArity; sourcePosition++) {
const sourceFlags = isTupleType(source2) ? source2.target.elementFlags[sourcePosition] : 4 /* Rest */;
@@ -70086,7 +70471,7 @@ function createTypeChecker(host) {
for (let i = 0; i < types.length; i++) {
if (include[i]) {
const targetType = getTypeOfPropertyOrIndexSignatureOfType(types[i], propertyName);
- if (targetType && related(getDiscriminatingType(), targetType)) {
+ if (targetType && someType(getDiscriminatingType(), (t) => !!related(t, targetType))) {
matched = true;
} else {
include[i] = 3 /* Maybe */;
@@ -70866,6 +71251,7 @@ function createTypeChecker(host) {
return type;
}
function reportWideningErrorsInType(type) {
+ var _a;
let errorReported = false;
if (getObjectFlags(type) & 65536 /* ContainsWideningType */) {
if (type.flags & 1048576 /* Union */) {
@@ -70873,27 +71259,28 @@ function createTypeChecker(host) {
errorReported = true;
} else {
for (const t of type.types) {
- if (reportWideningErrorsInType(t)) {
- errorReported = true;
- }
+ errorReported || (errorReported = reportWideningErrorsInType(t));
}
}
- }
- if (isArrayOrTupleType(type)) {
+ } else if (isArrayOrTupleType(type)) {
for (const t of getTypeArguments(type)) {
- if (reportWideningErrorsInType(t)) {
- errorReported = true;
- }
+ errorReported || (errorReported = reportWideningErrorsInType(t));
}
- }
- if (isObjectLiteralType2(type)) {
+ } else if (isObjectLiteralType2(type)) {
for (const p of getPropertiesOfObjectType(type)) {
const t = getTypeOfSymbol(p);
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
- if (!reportWideningErrorsInType(t)) {
- error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
+ errorReported = reportWideningErrorsInType(t);
+ if (!errorReported) {
+ const valueDeclaration = (_a = p.declarations) == null ? void 0 : _a.find((d) => {
+ var _a2;
+ return ((_a2 = d.symbol.valueDeclaration) == null ? void 0 : _a2.parent) === type.symbol.valueDeclaration;
+ });
+ if (valueDeclaration) {
+ error2(valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
+ errorReported = true;
+ }
}
- errorReported = true;
}
}
}
@@ -71173,11 +71560,11 @@ function createTypeChecker(host) {
}
function inferTypeForHomomorphicMappedType(source, target, constraint) {
const cacheKey = source.id + "," + target.id + "," + constraint.id;
- if (reverseMappedCache.has(cacheKey)) {
- return reverseMappedCache.get(cacheKey);
+ if (reverseHomomorphicMappedCache.has(cacheKey)) {
+ return reverseHomomorphicMappedCache.get(cacheKey);
}
const type = createReverseMappedType(source, target, constraint);
- reverseMappedCache.set(cacheKey, type);
+ reverseHomomorphicMappedCache.set(cacheKey, type);
return type;
}
function isPartiallyInferableType(type) {
@@ -71272,7 +71659,7 @@ function createTypeChecker(host) {
return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
}
function tupleTypesDefinitelyUnrelated(source, target) {
- return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
+ return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !(target.target.combinedFlags & 12 /* Variable */) && (!!(source.target.combinedFlags & 12 /* Variable */) || target.target.fixedLength < source.target.fixedLength);
}
function typesDefinitelyUnrelated(source, target) {
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
@@ -71361,7 +71748,7 @@ function createTypeChecker(host) {
return false;
}
function inferTypesFromTemplateLiteralType(source, target) {
- return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, (s, i) => {
+ return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arrayIsEqualTo(source.texts, target.texts) ? map(source.types, (s, i) => {
return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s);
}) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
}
@@ -71890,7 +72277,7 @@ function createTypeChecker(host) {
return;
}
const startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
- const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0);
+ const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0, target.target.combinedFlags & 12 /* Variable */ ? getEndElementCount(target.target, 3 /* Fixed */) : 0);
for (let i = 0; i < startLength; i++) {
inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
}
@@ -71911,7 +72298,7 @@ function createTypeChecker(host) {
} else if (elementFlags[startLength] & 8 /* Variadic */ && elementFlags[startLength + 1] & 4 /* Rest */) {
const param = (_a = getInferenceInfoForType(elementTypes[startLength])) == null ? void 0 : _a.typeParameter;
const constraint = param && getBaseConstraintOfType(param);
- if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) {
+ if (constraint && isTupleType(constraint) && !(constraint.target.combinedFlags & 12 /* Variable */)) {
const impliedArity = constraint.target.fixedLength;
inferFromTypes(sliceTupleType(source, startLength, sourceArity - (startLength + impliedArity)), elementTypes[startLength]);
inferFromTypes(getElementTypeOfSliceOfTupleType(source, startLength + impliedArity, endLength), elementTypes[startLength + 1]);
@@ -71919,7 +72306,7 @@ function createTypeChecker(host) {
} else if (elementFlags[startLength] & 4 /* Rest */ && elementFlags[startLength + 1] & 8 /* Variadic */) {
const param = (_b = getInferenceInfoForType(elementTypes[startLength + 1])) == null ? void 0 : _b.typeParameter;
const constraint = param && getBaseConstraintOfType(param);
- if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) {
+ if (constraint && isTupleType(constraint) && !(constraint.target.combinedFlags & 12 /* Variable */)) {
const impliedArity = constraint.target.fixedLength;
const endIndex = sourceArity - getEndElementCount(target.target, 3 /* Fixed */);
const startIndex = endIndex - impliedArity;
@@ -72071,7 +72458,7 @@ function createTypeChecker(host) {
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
if (inferredCovariantType || inferredContravariantType) {
- const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
+ const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
} else if (context.flags & 1 /* NoDefault */) {
@@ -72458,6 +72845,9 @@ function createTypeChecker(host) {
return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
}
function isFunctionObjectType(type) {
+ if (getObjectFlags(type) & 256 /* EvolvingArray */) {
+ return false;
+ }
const resolved = resolveStructuredTypeMembers(type);
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
}
@@ -73525,7 +73915,7 @@ function createTypeChecker(host) {
return getEvolvingArrayType(getUnionType(map(types, getElementTypeOfEvolvingArrayType)));
}
const result = recombineUnknownType(getUnionType(sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
- if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && arraysEqual(result.types, declaredType.types)) {
+ if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && arrayIsEqualTo(result.types, declaredType.types)) {
return declaredType;
}
return result;
@@ -74285,9 +74675,10 @@ function createTypeChecker(host) {
return;
case 281 /* ExportSpecifier */:
const exportDeclaration = node.parent.parent;
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
+ const name = node.propertyName || node.name;
+ if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier && name.kind !== 11 /* StringLiteral */) {
const symbol = resolveEntityName(
- node.propertyName || node.name,
+ name,
111551 /* Value */,
/*ignoreErrors*/
true,
@@ -74405,7 +74796,7 @@ function createTypeChecker(host) {
if (!canCollectSymbolAliasAccessabilityData) {
return;
}
- if (location.flags & 33554432 /* Ambient */) {
+ if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
return;
}
switch (hint) {
@@ -74581,6 +74972,9 @@ function createTypeChecker(host) {
function markExportSpecifierAliasReferenced(location) {
if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
const exportedName = location.propertyName || location.name;
+ if (exportedName.kind === 11 /* StringLiteral */) {
+ return;
+ }
const symbol = resolveName(
exportedName,
exportedName.escapedText,
@@ -74595,7 +74989,7 @@ function createTypeChecker(host) {
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
markExportAsReferenced(location);
- markIdentifierAliasReferenced(location.propertyName || location.name);
+ markIdentifierAliasReferenced(exportedName);
}
}
return;
@@ -74711,7 +75105,7 @@ function createTypeChecker(host) {
markAliasSymbolAsReferenced(rootSymbol);
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
- const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
+ const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration);
if (aliasDeclaration) {
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
}
@@ -74735,9 +75129,9 @@ function createTypeChecker(host) {
);
}
}
- function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
+ function getNarrowedTypeOfSymbol(symbol, location) {
var _a;
- const type = getTypeOfSymbol(symbol, checkMode);
+ const type = getTypeOfSymbol(symbol);
const declaration = symbol.valueDeclaration;
if (declaration) {
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
@@ -74876,7 +75270,10 @@ function createTypeChecker(host) {
}
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
let declaration = localOrExportSymbol.valueDeclaration;
- let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
+ if (declaration && declaration.kind === 208 /* BindingElement */ && contains(contextualBindingPatterns, declaration.parent) && findAncestor(node, (parent2) => parent2 === declaration.parent)) {
+ return nonInferrableAnyType;
+ }
+ let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
const assignmentKind = getAssignmentTargetKind(node);
if (assignmentKind) {
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
@@ -75831,7 +76228,7 @@ function createTypeChecker(host) {
type,
(t) => {
var _a;
- if (isGenericMappedType(t) && !t.declaration.nameType) {
+ if (isGenericMappedType(t) && getMappedTypeNameTypeKind(t) !== 2 /* Remapping */) {
const constraint = getConstraintTypeFromMappedType(t);
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
@@ -75929,7 +76326,7 @@ function createTypeChecker(host) {
return removeMissingType(getTypeArguments(t)[index], !!(t.target.elementFlags[index] && 2 /* Optional */));
}
const offset = length2 !== void 0 && (lastSpreadIndex === void 0 || index > lastSpreadIndex) ? length2 - index : 0;
- const fixedEndLength = offset > 0 && t.target.hasRestElement ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
+ const fixedEndLength = offset > 0 && t.target.combinedFlags & 12 /* Variable */ ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
if (offset > 0 && offset <= fixedEndLength) {
return getTypeArguments(t)[getTypeReferenceArity(t) - offset];
}
@@ -76572,7 +76969,7 @@ function createTypeChecker(host) {
return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type;
}
function hasDefaultValue(node) {
- return node.kind === 208 /* BindingElement */ && !!node.initializer || node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */;
+ return node.kind === 208 /* BindingElement */ && !!node.initializer || node.kind === 303 /* PropertyAssignment */ && hasDefaultValue(node.initializer) || node.kind === 304 /* ShorthandPropertyAssignment */ && !!node.objectAssignmentInitializer || node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */;
}
function isSpreadIntoCallOrNew(node) {
const parent2 = walkUpParenthesizedExpressions(node.parent);
@@ -76741,7 +77138,6 @@ function createTypeChecker(host) {
return links.immediateTarget;
}
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
- var _a;
const inDestructuringPattern = isAssignmentTarget(node);
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
@@ -76796,11 +77192,8 @@ function createTypeChecker(host) {
if (nameType) {
prop.links.nameType = nameType;
}
- if (inDestructuringPattern) {
- const isOptional = memberDecl.kind === 303 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 304 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer;
- if (isOptional) {
- prop.flags |= 16777216 /* Optional */;
- }
+ if (inDestructuringPattern && hasDefaultValue(memberDecl)) {
+ prop.flags |= 16777216 /* Optional */;
} else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512 /* ObjectLiteralPatternWithComputedProperties */)) {
const impliedProp = getPropertyOfType(contextualType, member.escapedName);
if (impliedProp) {
@@ -76875,21 +77268,6 @@ function createTypeChecker(host) {
propertiesArray.push(member);
}
popContextualType();
- if (contextualTypeHasPattern) {
- const rootPatternParent = findAncestor(contextualType.pattern.parent, (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */);
- const spreadOrOutsideRootObject = findAncestor(node, (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */);
- if (spreadOrOutsideRootObject.kind !== 305 /* SpreadAssignment */) {
- for (const prop of getPropertiesOfType(contextualType)) {
- if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
- if (!(prop.flags & 16777216 /* Optional */)) {
- error2(prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
- }
- propertiesTable.set(prop.escapedName, prop);
- propertiesArray.push(prop);
- }
- }
- }
- }
if (isErrorType(spread)) {
return errorType;
}
@@ -77412,7 +77790,7 @@ function createTypeChecker(host) {
checkGrammarJsxElement(node);
}
checkJsxPreconditions(node);
- markLinkedReferences(node, 4 /* Jsx */);
+ markJsxAliasReferenced(node);
if (isNodeOpeningLikeElement) {
const jsxOpeningLikeNode = node;
const sig = getResolvedSignature(jsxOpeningLikeNode);
@@ -77565,8 +77943,21 @@ function createTypeChecker(host) {
function getEnclosingClassFromThisParameter(node) {
const thisParameter = getThisParameterFromNodeContext(node);
let thisType = (thisParameter == null ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
- if (thisType && thisType.flags & 262144 /* TypeParameter */) {
- thisType = getConstraintOfTypeParameter(thisType);
+ if (thisType) {
+ if (thisType.flags & 262144 /* TypeParameter */) {
+ thisType = getConstraintOfTypeParameter(thisType);
+ }
+ } else {
+ const thisContainer = getThisContainer(
+ node,
+ /*includeArrowFunctions*/
+ false,
+ /*includeClassComputedPropertyName*/
+ false
+ );
+ if (isFunctionLike(thisContainer)) {
+ thisType = getContextualThisParameterType(thisContainer);
+ }
}
if (thisType && getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
return getTargetType(thisType);
@@ -78085,7 +78476,7 @@ function createTypeChecker(host) {
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
}
function containerSeemsToBeEmptyDomElement(containingType) {
- return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|((HTML[a-zA-Z]*)?Element))$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
+ return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
}
function typeHasStaticProperty(propName, containingType) {
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
@@ -78526,7 +78917,7 @@ function createTypeChecker(host) {
return void 0;
}
function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
- const context = createInferenceContext(signature.typeParameters, signature, 0 /* None */, compareTypes);
+ const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes);
const restType = getEffectiveRestType(contextualSignature);
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
@@ -80346,7 +80737,7 @@ function createTypeChecker(host) {
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
}
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
- const hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
+ const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
if (hasDefaultOnly && type && !isErrorType(type)) {
const synthType = type;
if (!synthType.defaultOnlyType) {
@@ -80672,14 +81063,45 @@ function createTypeChecker(host) {
!!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
);
}
- function getTupleElementLabel(d, index, restParameterName = "arg") {
+ function getTupleElementLabelFromBindingElement(node, index, elementFlags) {
+ switch (node.name.kind) {
+ case 80 /* Identifier */: {
+ const name = node.name.escapedText;
+ if (node.dotDotDotToken) {
+ return elementFlags & 12 /* Variable */ ? name : `${name}_${index}`;
+ } else {
+ return elementFlags & 3 /* Fixed */ ? name : `${name}_n`;
+ }
+ }
+ case 207 /* ArrayBindingPattern */: {
+ if (node.dotDotDotToken) {
+ const elements = node.name.elements;
+ const lastElement = tryCast(lastOrUndefined(elements), isBindingElement);
+ const elementCount = elements.length - ((lastElement == null ? void 0 : lastElement.dotDotDotToken) ? 1 : 0);
+ if (index < elementCount) {
+ const element = elements[index];
+ if (isBindingElement(element)) {
+ return getTupleElementLabelFromBindingElement(element, index, elementFlags);
+ }
+ } else if (lastElement == null ? void 0 : lastElement.dotDotDotToken) {
+ return getTupleElementLabelFromBindingElement(lastElement, index - elementCount, elementFlags);
+ }
+ }
+ break;
+ }
+ }
+ return `arg_${index}`;
+ }
+ function getTupleElementLabel(d, index = 0, elementFlags = 3 /* Fixed */, restSymbol) {
if (!d) {
- return `${restParameterName}_${index}`;
+ const restParameter = tryCast(restSymbol == null ? void 0 : restSymbol.valueDeclaration, isParameter);
+ return restParameter ? getTupleElementLabelFromBindingElement(restParameter, index, elementFlags) : `${(restSymbol == null ? void 0 : restSymbol.escapedName) ?? "arg"}_${index}`;
}
Debug.assert(isIdentifier(d.name));
return d.name.escapedText;
}
function getParameterNameAtPosition(signature, pos, overrideRestType) {
+ var _a;
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
if (pos < paramCount) {
return signature.parameters[pos].escapedName;
@@ -80687,9 +81109,11 @@ function createTypeChecker(host) {
const restParameter = signature.parameters[paramCount] || unknownSymbol;
const restType = overrideRestType || getTypeOfSymbol(restParameter);
if (isTupleType(restType)) {
- const associatedNames = restType.target.labeledElementDeclarations;
+ const tupleType = restType.target;
const index = pos - paramCount;
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
+ const associatedName = (_a = tupleType.labeledElementDeclarations) == null ? void 0 : _a[index];
+ const elementFlags = tupleType.elementFlags[index];
+ return getTupleElementLabel(associatedName, index, elementFlags, restParameter);
}
return restParameter.escapedName;
}
@@ -80762,7 +81186,7 @@ function createTypeChecker(host) {
if (signatureHasRestParameter(signature)) {
const restType = getTypeOfSymbol(signature.parameters[paramCount]);
const index = pos - paramCount;
- if (!isTupleType(restType) || restType.target.hasRestElement || index < restType.target.fixedLength) {
+ if (!isTupleType(restType) || restType.target.combinedFlags & 12 /* Variable */ || index < restType.target.fixedLength) {
return getIndexedAccessType(restType, getNumberLiteralType(index));
}
}
@@ -80800,7 +81224,7 @@ function createTypeChecker(host) {
if (signatureHasRestParameter(signature)) {
const restType = getTypeOfSymbol(signature.parameters[length2 - 1]);
if (isTupleType(restType)) {
- return length2 + restType.target.fixedLength - (restType.target.hasRestElement ? 0 : 1);
+ return length2 + restType.target.fixedLength - (restType.target.combinedFlags & 12 /* Variable */ ? 0 : 1);
}
}
return length2;
@@ -80843,7 +81267,7 @@ function createTypeChecker(host) {
function hasEffectiveRestParameter(signature) {
if (signatureHasRestParameter(signature)) {
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
- return !isTupleType(restType) || restType.target.hasRestElement;
+ return !isTupleType(restType) || !!(restType.target.combinedFlags & 12 /* Variable */);
}
return false;
}
@@ -80853,7 +81277,7 @@ function createTypeChecker(host) {
if (!isTupleType(restType)) {
return isTypeAny(restType) ? anyArrayType : restType;
}
- if (restType.target.hasRestElement) {
+ if (restType.target.combinedFlags & 12 /* Variable */) {
return sliceTupleType(restType, restType.target.fixedLength);
}
}
@@ -81367,30 +81791,15 @@ function createTypeChecker(host) {
/*errorNode*/
void 0
) || unknownType;
- nextType = resolver.resolveIterationType(
- nextType,
- /*errorNode*/
- void 0
- ) || unknownType;
if (globalGeneratorType === emptyGenericType) {
- const globalType = resolver.getGlobalIterableIteratorType(
+ const globalIterableIteratorType = resolver.getGlobalIterableIteratorType(
/*reportErrors*/
false
);
- const iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : void 0;
- const iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType;
- const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
- if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
- if (globalType !== emptyGenericType) {
- return createTypeFromGenericGlobalType(globalType, [yieldType]);
- }
- resolver.getGlobalIterableIteratorType(
- /*reportErrors*/
- true
- );
- return emptyObjectType;
+ if (globalIterableIteratorType !== emptyGenericType) {
+ return createTypeFromGenericGlobalType(globalIterableIteratorType, [yieldType, returnType, nextType]);
}
- resolver.getGlobalGeneratorType(
+ resolver.getGlobalIterableIteratorType(
/*reportErrors*/
true
);
@@ -82170,7 +82579,7 @@ function createTypeChecker(host) {
);
}
}
- const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */, name);
+ const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */ | (hasDefaultValue(property) ? 16 /* AllowMissing */ : 0), name);
const type = getFlowTypeOfDestructuring(property, elementType);
return checkDestructuringAssignment(property.kind === 304 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
} else if (property.kind === 305 /* SpreadAssignment */) {
@@ -82219,7 +82628,7 @@ function createTypeChecker(host) {
if (element.kind !== 230 /* SpreadElement */) {
const indexType = getNumberLiteralType(elementIndex);
if (isArrayLikeType(sourceType)) {
- const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* NoTupleBoundsCheck */ : 0);
+ const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* AllowMissing */ : 0);
const elementType2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType2, 524288 /* NEUndefined */) : elementType2;
const type = getFlowTypeOfDestructuring(element, assignedType);
@@ -82369,7 +82778,7 @@ function createTypeChecker(host) {
setLastResult(state, checkExpression(node.right, checkMode));
return state;
}
- checkGrammarNullishCoalesceWithLogicalExpression(node);
+ checkNullishCoalesceOperands(node);
const operator = node.operatorToken.kind;
if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) {
state.skip = true;
@@ -82402,7 +82811,9 @@ function createTypeChecker(host) {
if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) {
checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
}
- checkTruthinessOfType(leftType, node.left);
+ if (isBinaryLogicalOperator(operator)) {
+ checkTruthinessOfType(leftType, node.left);
+ }
}
}
}
@@ -82459,7 +82870,7 @@ function createTypeChecker(host) {
state.typeStack[state.stackIndex + 1] = type;
}
}
- function checkGrammarNullishCoalesceWithLogicalExpression(node) {
+ function checkNullishCoalesceOperands(node) {
const { left, operatorToken, right } = node;
if (operatorToken.kind === 61 /* QuestionQuestionToken */) {
if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
@@ -82468,15 +82879,63 @@ function createTypeChecker(host) {
if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
}
+ const leftTarget = skipOuterExpressions(left, 31 /* All */);
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
+ if (nullishSemantics !== 3 /* Sometimes */) {
+ if (node.parent.kind === 226 /* BinaryExpression */) {
+ error2(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
+ } else {
+ if (nullishSemantics === 1 /* Always */) {
+ error2(leftTarget, Diagnostics.This_expression_is_always_nullish);
+ } else {
+ error2(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
+ }
+ }
+ }
}
}
+ function getSyntacticNullishnessSemantics(node) {
+ node = skipOuterExpressions(node);
+ switch (node.kind) {
+ case 223 /* AwaitExpression */:
+ case 213 /* CallExpression */:
+ case 212 /* ElementAccessExpression */:
+ case 214 /* NewExpression */:
+ case 211 /* PropertyAccessExpression */:
+ case 229 /* YieldExpression */:
+ case 110 /* ThisKeyword */:
+ return 3 /* Sometimes */;
+ case 226 /* BinaryExpression */:
+ switch (node.operatorToken.kind) {
+ case 64 /* EqualsToken */:
+ case 61 /* QuestionQuestionToken */:
+ case 78 /* QuestionQuestionEqualsToken */:
+ case 57 /* BarBarToken */:
+ case 76 /* BarBarEqualsToken */:
+ case 56 /* AmpersandAmpersandToken */:
+ case 77 /* AmpersandAmpersandEqualsToken */:
+ return 3 /* Sometimes */;
+ }
+ return 2 /* Never */;
+ case 227 /* ConditionalExpression */:
+ return getSyntacticNullishnessSemantics(node.whenTrue) | getSyntacticNullishnessSemantics(node.whenFalse);
+ case 106 /* NullKeyword */:
+ return 1 /* Always */;
+ case 80 /* Identifier */:
+ if (getResolvedSymbol(node) === undefinedSymbol) {
+ return 1 /* Always */;
+ }
+ return 3 /* Sometimes */;
+ }
+ return 2 /* Never */;
+ }
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
const operator = operatorToken.kind;
if (operator === 64 /* EqualsToken */ && (left.kind === 210 /* ObjectLiteralExpression */ || left.kind === 209 /* ArrayLiteralExpression */)) {
return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */);
}
let leftType;
- if (isLogicalOrCoalescingBinaryOperator(operator)) {
+ if (isBinaryLogicalOperator(operator)) {
leftType = checkTruthinessExpression(left, checkMode);
} else {
leftType = checkExpression(left, checkMode);
@@ -82556,6 +83015,29 @@ function createTypeChecker(host) {
}
if (leftOk && rightOk) {
checkAssignmentOperator(resultType2);
+ switch (operator) {
+ case 48 /* LessThanLessThanToken */:
+ case 71 /* LessThanLessThanEqualsToken */:
+ case 49 /* GreaterThanGreaterThanToken */:
+ case 72 /* GreaterThanGreaterThanEqualsToken */:
+ case 50 /* GreaterThanGreaterThanGreaterThanToken */:
+ case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ const rhsEval = evaluate(right);
+ if (typeof rhsEval.value === "number" && Math.abs(rhsEval.value) >= 32) {
+ errorOrSuggestion(
+ isEnumMember(walkUpParenthesizedExpressions(right.parent.parent)),
+ // elevate from suggestion to error within an enum member
+ errorNode || operatorToken,
+ Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2,
+ getTextOfNode(left),
+ tokenToString(operator),
+ rhsEval.value % 32
+ );
+ }
+ break;
+ default:
+ break;
+ }
}
return resultType2;
}
@@ -82914,9 +83396,8 @@ function createTypeChecker(host) {
const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
- const resolvedSignatureNextType = isAsync ? getAwaitedType(signatureNextType) || anyType : signatureNextType;
const yieldExpressionType = node.expression ? checkExpression(node.expression) : undefinedWideningType;
- const yieldedType = getYieldedTypeOfYieldExpression(node, yieldExpressionType, resolvedSignatureNextType, isAsync);
+ const yieldedType = getYieldedTypeOfYieldExpression(node, yieldExpressionType, signatureNextType, isAsync);
if (returnType && yieldedType) {
checkTypeAssignableToAndOptionallyElaborate(yieldedType, signatureYieldType, node.expression || node, node.expression);
}
@@ -83058,9 +83539,56 @@ function createTypeChecker(host) {
void 0,
checkMode || 0 /* Normal */
) : checkExpressionCached(initializer, checkMode));
- return isParameter(declaration) && declaration.name.kind === 207 /* ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type;
+ if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
+ if (declaration.name.kind === 206 /* ObjectBindingPattern */ && isObjectLiteralType2(type)) {
+ return padObjectLiteralType(type, declaration.name);
+ }
+ if (declaration.name.kind === 207 /* ArrayBindingPattern */ && isTupleType(type)) {
+ return padTupleType(type, declaration.name);
+ }
+ }
+ return type;
+ }
+ function padObjectLiteralType(type, pattern) {
+ let missingElements;
+ for (const e of pattern.elements) {
+ if (e.initializer) {
+ const name = getPropertyNameFromBindingElement(e);
+ if (name && !getPropertyOfType(type, name)) {
+ missingElements = append(missingElements, e);
+ }
+ }
+ }
+ if (!missingElements) {
+ return type;
+ }
+ const members = createSymbolTable();
+ for (const prop of getPropertiesOfObjectType(type)) {
+ members.set(prop.escapedName, prop);
+ }
+ for (const e of missingElements) {
+ const symbol = createSymbol(4 /* Property */ | 16777216 /* Optional */, getPropertyNameFromBindingElement(e));
+ symbol.links.type = getTypeFromBindingElement(
+ e,
+ /*includePatternInType*/
+ false,
+ /*reportErrors*/
+ false
+ );
+ members.set(symbol.escapedName, symbol);
+ }
+ const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, getIndexInfosOfType(type));
+ result.objectFlags = type.objectFlags;
+ return result;
+ }
+ function getPropertyNameFromBindingElement(e) {
+ const exprType = getLiteralTypeFromPropertyName(e.propertyName || e.name);
+ return isTypeUsableAsPropertyName(exprType) ? getPropertyNameFromType(exprType) : void 0;
}
function padTupleType(type, pattern) {
+ if (type.target.combinedFlags & 12 /* Variable */ || getTypeReferenceArity(type) >= pattern.elements.length) {
+ return type;
+ }
const patternElements = pattern.elements;
const elementTypes = getElementTypes(type).slice();
const elementFlags = type.target.elementFlags.slice();
@@ -83369,7 +83897,17 @@ function createTypeChecker(host) {
if (!ok) {
error2(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
- if (getIsolatedModules(compilerOptions)) {
+ if (compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax && ok && !resolveName(
+ node,
+ getFirstIdentifier(node),
+ 2097152 /* Alias */,
+ /*nameNotFoundMessage*/
+ void 0,
+ /*isUse*/
+ false,
+ /*excludeGlobals*/
+ true
+ )) {
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
const constEnumDeclaration = type.symbol.valueDeclaration;
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
@@ -83593,9 +84131,7 @@ function createTypeChecker(host) {
}
checkSourceElement(node.type);
const { parameterName } = node;
- if (typePredicate.kind === 0 /* This */ || typePredicate.kind === 2 /* AssertsThis */) {
- getTypeFromThisTypeNode(parameterName);
- } else {
+ if (typePredicate.kind !== 0 /* This */ && typePredicate.kind !== 2 /* AssertsThis */) {
if (typePredicate.parameterIndex >= 0) {
if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) {
error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
@@ -84330,16 +84866,20 @@ function createTypeChecker(host) {
const someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;
if (someButNotAllOverloadFlags !== 0) {
const canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck2);
- forEach(overloads, (o) => {
- const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
- if (deviation & 32 /* Export */) {
- error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
- } else if (deviation & 128 /* Ambient */) {
- error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
- } else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
- error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
- } else if (deviation & 64 /* Abstract */) {
- error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
+ group(overloads, (o) => getSourceFileOfNode(o).fileName).forEach((overloadsInFile) => {
+ const canonicalFlagsForFile = getEffectiveDeclarationFlags(getCanonicalOverload(overloadsInFile, implementation), flagsToCheck2);
+ for (const o of overloadsInFile) {
+ const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
+ const deviationInFile = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlagsForFile;
+ if (deviationInFile & 32 /* Export */) {
+ error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
+ } else if (deviationInFile & 128 /* Ambient */) {
+ error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
+ } else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
+ error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
+ } else if (deviation & 64 /* Abstract */) {
+ error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
+ }
}
});
}
@@ -85474,7 +86014,7 @@ function createTypeChecker(host) {
if (!wrappingDeclaration.type) {
addRelatedInfo(
diagnostic,
- createFileDiagnostic(getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 1, Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, declarationNameToString(node.propertyName))
+ createFileDiagnostic(getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 0, Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, declarationNameToString(node.propertyName))
);
}
diagnostics.add(diagnostic);
@@ -85573,7 +86113,7 @@ function createTypeChecker(host) {
});
}
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
- if (moduleKind >= 5 /* ES2015 */ && !(moduleKind >= 100 /* Node16 */ && getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
return;
}
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
@@ -85783,6 +86323,9 @@ function createTypeChecker(host) {
checkAliasSymbol(node);
return;
}
+ if (node.name.kind === 10 /* BigIntLiteral */) {
+ error2(node.name, Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name);
+ }
const type = convertAutoToAny(getTypeOfSymbol(symbol));
if (node === symbol.valueDeclaration) {
const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node);
@@ -85810,7 +86353,7 @@ function createTypeChecker(host) {
);
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
const optionalDisposableType = getUnionType([globalAsyncDisposableType, globalDisposableType, nullType, undefinedType]);
- checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
+ checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
}
} else if (blockScopeKind === 4 /* Using */) {
const globalDisposableType = getGlobalDisposableType(
@@ -85819,7 +86362,7 @@ function createTypeChecker(host) {
);
if (globalDisposableType !== emptyObjectType) {
const optionalDisposableType = getUnionType([globalDisposableType, nullType, undefinedType]);
- checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
+ checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
}
}
}
@@ -85937,7 +86480,7 @@ function createTypeChecker(host) {
bothHelper(location, body2);
return;
}
- const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
+ const type = location === condExpr2 ? condType : checkExpression(location);
if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
error2(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
return;
@@ -86032,9 +86575,51 @@ function createTypeChecker(host) {
function checkTruthinessOfType(type, node) {
if (type.flags & 16384 /* Void */) {
error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
+ } else {
+ const semantics = getSyntacticTruthySemantics(node);
+ if (semantics !== 3 /* Sometimes */) {
+ error2(
+ node,
+ semantics === 1 /* Always */ ? Diagnostics.This_kind_of_expression_is_always_truthy : Diagnostics.This_kind_of_expression_is_always_falsy
+ );
+ }
}
return type;
}
+ function getSyntacticTruthySemantics(node) {
+ node = skipOuterExpressions(node);
+ switch (node.kind) {
+ case 9 /* NumericLiteral */:
+ if (node.text === "0" || node.text === "1") {
+ return 3 /* Sometimes */;
+ }
+ return 1 /* Always */;
+ case 209 /* ArrayLiteralExpression */:
+ case 219 /* ArrowFunction */:
+ case 10 /* BigIntLiteral */:
+ case 231 /* ClassExpression */:
+ case 218 /* FunctionExpression */:
+ case 284 /* JsxElement */:
+ case 285 /* JsxSelfClosingElement */:
+ case 210 /* ObjectLiteralExpression */:
+ case 14 /* RegularExpressionLiteral */:
+ return 1 /* Always */;
+ case 222 /* VoidExpression */:
+ case 106 /* NullKeyword */:
+ return 2 /* Never */;
+ case 15 /* NoSubstitutionTemplateLiteral */:
+ case 11 /* StringLiteral */:
+ return !!node.text ? 1 /* Always */ : 2 /* Never */;
+ case 227 /* ConditionalExpression */:
+ return getSyntacticTruthySemantics(node.whenTrue) | getSyntacticTruthySemantics(node.whenFalse);
+ case 80 /* Identifier */:
+ if (getResolvedSymbol(node) === undefinedSymbol) {
+ return 2 /* Never */;
+ }
+ return 3 /* Sometimes */;
+ }
+ return 3 /* Sometimes */;
+ }
function checkTruthinessExpression(node, checkMode) {
return checkTruthinessOfType(checkExpression(node, checkMode), node);
}
@@ -86417,30 +87002,21 @@ function createTypeChecker(host) {
function getIterationTypesOfIterableCached(type, resolver) {
return getCachedIterationTypes(type, resolver.iterableCacheKey);
}
- function getIterationTypesOfGlobalIterableType(globalType, resolver) {
- const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
- globalType,
- resolver,
- /*errorNode*/
- void 0,
- /*errorOutputContainer*/
- void 0,
- /*noCache*/
- false
- );
- return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
- }
function getIterationTypesOfIterableFast(type, resolver) {
- let globalType;
- if (isReferenceToType2(type, globalType = resolver.getGlobalIterableType(
+ if (isReferenceToType2(type, resolver.getGlobalIterableType(
/*reportErrors*/
false
- )) || isReferenceToType2(type, globalType = resolver.getGlobalIterableIteratorType(
+ )) || isReferenceToType2(type, resolver.getGlobalIteratorObjectType(
+ /*reportErrors*/
+ false
+ )) || isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
+ /*reportErrors*/
+ false
+ )) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
/*reportErrors*/
false
))) {
- const [yieldType] = getTypeArguments(type);
- const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver);
+ const [yieldType, returnType, nextType] = getTypeArguments(type);
return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
yieldType,
/*errorNode*/
@@ -86451,11 +87027,10 @@ function createTypeChecker(host) {
void 0
) || returnType, nextType));
}
- if (isReferenceToType2(type, resolver.getGlobalGeneratorType(
- /*reportErrors*/
- false
- ))) {
- const [yieldType, returnType, nextType] = getTypeArguments(type);
+ if (isReferenceToSomeType(type, resolver.getGlobalBuiltinIteratorTypes())) {
+ const [yieldType] = getTypeArguments(type);
+ const returnType = getBuiltinIteratorReturnType();
+ const nextType = unknownType;
return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
yieldType,
/*errorNode*/
@@ -86496,10 +87071,10 @@ function createTypeChecker(host) {
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
/*reportErrors*/
false
- ) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
+ ) !== emptyGenericType && isTypeAssignableTo(type, createTypeFromGenericGlobalType(getGlobalAsyncIterableType(
/*reportErrors*/
false
- ))
+ ), [anyType, anyType, anyType]))
);
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
}
@@ -86529,26 +87104,13 @@ function createTypeChecker(host) {
return getCachedIterationTypes(type, resolver.iteratorCacheKey);
}
function getIterationTypesOfIteratorFast(type, resolver) {
- const globalType = resolver.getGlobalIterableIteratorType(
+ if (isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
/*reportErrors*/
false
- );
- if (isReferenceToType2(type, globalType)) {
- const [yieldType] = getTypeArguments(type);
- const globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow(
- globalType,
- resolver,
- /*errorNode*/
- void 0,
- /*errorOutputContainer*/
- void 0,
- /*noCache*/
- false
- );
- const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
- return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
- }
- if (isReferenceToType2(type, resolver.getGlobalIteratorType(
+ )) || isReferenceToType2(type, resolver.getGlobalIteratorType(
+ /*reportErrors*/
+ false
+ )) || isReferenceToType2(type, resolver.getGlobalIteratorObjectType(
/*reportErrors*/
false
)) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
@@ -86558,6 +87120,12 @@ function createTypeChecker(host) {
const [yieldType, returnType, nextType] = getTypeArguments(type);
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
}
+ if (isReferenceToSomeType(type, resolver.getGlobalBuiltinIteratorTypes())) {
+ const [yieldType] = getTypeArguments(type);
+ const returnType = getBuiltinIteratorReturnType();
+ const nextType = unknownType;
+ return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
+ }
}
function isIteratorResult(type, kind) {
const doneType = getTypeOfPropertyOfType(type, "done") || falseType;
@@ -86625,7 +87193,7 @@ function createTypeChecker(host) {
}
const methodType = method && !(methodName === "next" && method.flags & 16777216 /* Optional */) ? methodName === "next" ? getTypeOfSymbol(method) : getTypeWithFacts(getTypeOfSymbol(method), 2097152 /* NEUndefinedOrNull */) : void 0;
if (isTypeAny(methodType)) {
- return methodName === "next" ? anyIterationTypes : anyIterationTypesExceptNext;
+ return anyIterationTypes;
}
const methodSignatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : emptyArray;
if (methodSignatures.length === 0) {
@@ -86994,7 +87562,7 @@ function createTypeChecker(host) {
}
}
function checkClassNameCollisionWithObject(name) {
- if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
+ if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
}
}
@@ -87373,23 +87941,22 @@ function createTypeChecker(host) {
hasAbstractModifier(member),
isStatic(member),
memberIsParameterProperty,
- symbolName(declaredProp),
+ declaredProp,
reportErrors2 ? member : void 0
);
}
- function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
+ function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, member, errorNode) {
const isJs = isInJSFile(node);
const nodeInAmbientContext = !!(node.flags & 33554432 /* Ambient */);
if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
- const memberEscapedName = escapeLeadingUnderscores(memberName);
const thisType = memberIsStatic ? staticType : typeWithThis;
const baseType = memberIsStatic ? baseStaticType : baseWithThis;
- const prop = getPropertyOfType(thisType, memberEscapedName);
- const baseProp = getPropertyOfType(baseType, memberEscapedName);
+ const prop = getPropertyOfType(thisType, member.escapedName);
+ const baseProp = getPropertyOfType(baseType, member.escapedName);
const baseClassName = typeToString(baseWithThis);
if (prop && !baseProp && memberHasOverrideModifier) {
if (errorNode) {
- const suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType);
+ const suggestion = getSuggestedSymbolForNonexistentClassMember(symbolName(member), baseType);
suggestion ? error2(
errorNode,
isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 : Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1,
@@ -87506,7 +88073,7 @@ function createTypeChecker(host) {
isStatic(member),
/*memberIsParameterProperty*/
false,
- symbolName(memberSymbol)
+ memberSymbol
);
}
function getTargetSymbol(s) {
@@ -87764,7 +88331,9 @@ function createTypeChecker(host) {
checkExportsOnMergedDeclarations(node);
checkTypeParameters(node.typeParameters);
if (node.type.kind === 141 /* IntrinsicKeyword */) {
- if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
+ const typeParameterCount = length(node.typeParameters);
+ const valid = typeParameterCount === 0 ? node.name.escapedText === "BuiltinIteratorReturn" : typeParameterCount === 1 && intrinsicTypeKinds.has(node.name.escapedText);
+ if (!valid) {
error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
}
} else {
@@ -88054,6 +88623,14 @@ function createTypeChecker(host) {
}
if (isIdentifier(node.name)) {
checkCollisionsForDeclarationName(node, node.name);
+ if (!(node.flags & (32 /* Namespace */ | 2048 /* GlobalAugmentation */))) {
+ const sourceFile = getSourceFileOfNode(node);
+ const pos = getNonModifierTokenPosOfNode(node);
+ const span = getSpanOfTokenAtPosition(sourceFile, pos);
+ suggestionDiagnostics.add(
+ createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead)
+ );
+ }
}
checkExportsOnMergedDeclarations(node);
const symbol = getSymbolOfDeclaration(node);
@@ -88075,7 +88652,7 @@ function createTypeChecker(host) {
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
}
}
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
if (exportModifier) {
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -88118,6 +88695,7 @@ function createTypeChecker(host) {
grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
case 271 /* ImportEqualsDeclaration */:
+ if (isInternalModuleImportEqualsDeclaration(node)) break;
case 272 /* ImportDeclaration */:
grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
@@ -88197,6 +88775,16 @@ function createTypeChecker(host) {
}
return true;
}
+ function checkModuleExportName(name, allowStringLiteral = true) {
+ if (name === void 0 || name.kind !== 11 /* StringLiteral */) {
+ return;
+ }
+ if (!allowStringLiteral) {
+ grammarErrorOnNode(name, Diagnostics.Identifier_expected);
+ } else if (moduleKind === 5 /* ES2015 */ || moduleKind === 6 /* ES2020 */) {
+ grammarErrorOnNode(name, Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020);
+ }
+ }
function checkAliasSymbol(node) {
var _a, _b, _c, _d;
let symbol = getSymbolOfDeclaration(node);
@@ -88208,7 +88796,7 @@ function createTypeChecker(host) {
Debug.assert(node.kind !== 280 /* NamespaceExport */);
if (node.kind === 281 /* ExportSpecifier */) {
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
- const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
+ const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get(moduleExportNameTextEscaped(node.propertyName || node.name));
if (alreadyExportedSymbol === target) {
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
if (exportingDeclaration) {
@@ -88263,7 +88851,7 @@ function createTypeChecker(host) {
if (compilerOptions.verbatimModuleSyntax) {
Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name");
const message = compilerOptions.verbatimModuleSyntax && isInternalModuleImportEqualsDeclaration(node) ? Diagnostics.An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled : isType ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled;
- const name = idText(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
+ const name = moduleExportNameTextUnescaped(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
addTypeOnlyDeclarationRelatedInfo(
error2(node, message, name),
isType ? void 0 : typeOnlyAlias,
@@ -88277,7 +88865,7 @@ function createTypeChecker(host) {
}
case 281 /* ExportSpecifier */: {
if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
- const name = idText(node.propertyName || node.name);
+ const name = moduleExportNameTextUnescaped(node.propertyName || node.name);
const diagnostic = isType ? error2(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error2(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName);
addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
break;
@@ -88285,8 +88873,17 @@ function createTypeChecker(host) {
}
}
}
- if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
+ if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
+ } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
+ error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
+ }
+ if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
+ const constEnumDeclaration = target.valueDeclaration;
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
+ error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
+ }
}
}
if (isImportSpecifier(node)) {
@@ -88325,8 +88922,11 @@ function createTypeChecker(host) {
function checkImportBinding(node) {
checkCollisionsForDeclarationName(node, node.name);
checkAliasSymbol(node);
- if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
- checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
+ if (node.kind === 276 /* ImportSpecifier */) {
+ checkModuleExportName(node.propertyName);
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
+ checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
+ }
}
}
function checkImportAttributes(declaration) {
@@ -88346,7 +88946,7 @@ function createTypeChecker(host) {
if (validForTypeAttributes && override) {
return;
}
- const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
+ const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
return grammarErrorOnNode(node, message);
@@ -88379,7 +88979,7 @@ function createTypeChecker(host) {
if (importClause.namedBindings) {
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
checkImportBinding(importClause.namedBindings);
- if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) {
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
}
} else {
@@ -88389,6 +88989,8 @@ function createTypeChecker(host) {
}
}
}
+ } else if (noUncheckedSideEffectImports && !importClause) {
+ void resolveExternalModuleName(node, node.moduleSpecifier);
}
}
checkImportAttributes(node);
@@ -88419,7 +89021,7 @@ function createTypeChecker(host) {
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
}
} else {
- if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
+ if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
@@ -88447,8 +89049,9 @@ function createTypeChecker(host) {
error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
} else if (node.exportClause) {
checkAliasSymbol(node.exportClause);
+ checkModuleExportName(node.exportClause.name);
}
- if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
if (node.exportClause) {
if (getESModuleInterop(compilerOptions)) {
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
@@ -88477,6 +89080,9 @@ function createTypeChecker(host) {
}
function checkExportSpecifier(node) {
checkAliasSymbol(node);
+ const hasModuleSpecifier = node.parent.parent.moduleSpecifier !== void 0;
+ checkModuleExportName(node.propertyName, hasModuleSpecifier);
+ checkModuleExportName(node.name);
if (getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(
node.propertyName || node.name,
@@ -88484,8 +89090,11 @@ function createTypeChecker(host) {
true
);
}
- if (!node.parent.parent.moduleSpecifier) {
+ if (!hasModuleSpecifier) {
const exportedName = node.propertyName || node.name;
+ if (exportedName.kind === 11 /* StringLiteral */) {
+ return;
+ }
const symbol = resolveName(
exportedName,
exportedName.escapedText,
@@ -88501,7 +89110,7 @@ function createTypeChecker(host) {
markLinkedReferences(node, 7 /* ExportSpecifier */);
}
} else {
- if (getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && idText(node.propertyName || node.name) === "default") {
+ if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
}
}
@@ -88527,7 +89136,7 @@ function createTypeChecker(host) {
if (typeAnnotationNode) {
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
}
- const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
+ const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
if (node.expression.kind === 80 /* Identifier */) {
const id = node.expression;
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
@@ -88607,9 +89216,7 @@ function createTypeChecker(host) {
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
}
if (node.isExportEquals) {
- if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && // deno: temporarily disable this one until Deno 2.0 (https://github.com/microsoft/TypeScript/pull/52109)
- /* (node.flags & NodeFlags.Ambient && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.ESNext) || */
- (!(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) !== 1 /* CommonJS */)) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
@@ -88670,6 +89277,9 @@ function createTypeChecker(host) {
}
}
function checkSourceElementWorker(node) {
+ if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
+ return;
+ }
if (canHaveJSDoc(node)) {
forEach(node.jsDoc, ({ comment, tags }) => {
checkJSDocCommentWorker(comment);
@@ -89013,19 +89623,21 @@ function createTypeChecker(host) {
currentNode = saveCurrentNode;
(_b = tracing) == null ? void 0 : _b.pop();
}
- function checkSourceFile(node) {
+ function checkSourceFile(node, nodesToCheck) {
var _a, _b;
(_a = tracing) == null ? void 0 : _a.push(
tracing.Phase.Check,
- "checkSourceFile",
+ nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile",
{ path: node.path },
/*separateBeginAndEnd*/
true
);
- mark("beforeCheck");
- checkSourceFileWorker(node);
- mark("afterCheck");
- measure("Check", "beforeCheck", "afterCheck");
+ const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck";
+ const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck";
+ mark(beforeMark);
+ nodesToCheck ? checkSourceFileNodesWorker(node, nodesToCheck) : checkSourceFileWorker(node);
+ mark(afterMark);
+ measure("Check", beforeMark, afterMark);
(_b = tracing) == null ? void 0 : _b.pop();
}
function unusedIsError(kind, isAmbient) {
@@ -89056,6 +89668,13 @@ function createTypeChecker(host) {
clear(potentialWeakMapSetCollisions);
clear(potentialReflectCollisions);
clear(potentialUnusedRenamedBindingElementsInTypes);
+ if (links.flags & 8388608 /* PartiallyTypeChecked */) {
+ potentialThisCollisions = links.potentialThisCollisions;
+ potentialNewTargetCollisions = links.potentialNewTargetCollisions;
+ potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions;
+ potentialReflectCollisions = links.potentialReflectCollisions;
+ potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes;
+ }
forEach(node.statements, checkSourceElement);
checkSourceElement(node.endOfFileToken);
checkDeferredNodes(node);
@@ -89096,10 +89715,38 @@ function createTypeChecker(host) {
links.flags |= 1 /* TypeChecked */;
}
}
- function getDiagnostics2(sourceFile, ct) {
+ function checkSourceFileNodesWorker(file, nodes) {
+ const links = getNodeLinks(file);
+ if (!(links.flags & 1 /* TypeChecked */)) {
+ if (skipTypeChecking(file, compilerOptions, host)) {
+ return;
+ }
+ checkGrammarSourceFile(file);
+ clear(potentialThisCollisions);
+ clear(potentialNewTargetCollisions);
+ clear(potentialWeakMapSetCollisions);
+ clear(potentialReflectCollisions);
+ clear(potentialUnusedRenamedBindingElementsInTypes);
+ forEach(nodes, checkSourceElement);
+ checkDeferredNodes(file);
+ (links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
+ (links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions);
+ (links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions);
+ (links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions);
+ (links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push(
+ ...potentialUnusedRenamedBindingElementsInTypes
+ );
+ links.flags |= 8388608 /* PartiallyTypeChecked */;
+ for (const node of nodes) {
+ const nodeLinks2 = getNodeLinks(node);
+ nodeLinks2.flags |= 8388608 /* PartiallyTypeChecked */;
+ }
+ }
+ }
+ function getDiagnostics2(sourceFile, ct, nodesToCheck) {
try {
cancellationToken = ct;
- return getDiagnosticsWorker(sourceFile);
+ return getDiagnosticsWorker(sourceFile, nodesToCheck);
} finally {
cancellationToken = void 0;
}
@@ -89110,20 +89757,23 @@ function createTypeChecker(host) {
}
deferredDiagnosticsCallbacks = [];
}
- function checkSourceFileWithEagerDiagnostics(sourceFile) {
+ function checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck) {
ensurePendingDiagnosticWorkComplete();
const oldAddLazyDiagnostics = addLazyDiagnostic;
addLazyDiagnostic = (cb) => cb();
- checkSourceFile(sourceFile);
+ checkSourceFile(sourceFile, nodesToCheck);
addLazyDiagnostic = oldAddLazyDiagnostics;
}
- function getDiagnosticsWorker(sourceFile) {
+ function getDiagnosticsWorker(sourceFile, nodesToCheck) {
if (sourceFile) {
ensurePendingDiagnosticWorkComplete();
const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
- checkSourceFileWithEagerDiagnostics(sourceFile);
+ checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck);
const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
+ if (nodesToCheck) {
+ return semanticDiagnostics;
+ }
const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
@@ -89133,7 +89783,7 @@ function createTypeChecker(host) {
}
return semanticDiagnostics;
}
- forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
+ forEach(host.getSourceFiles(), (file) => checkSourceFileWithEagerDiagnostics(file));
return diagnostics.getDiagnostics();
}
function getGlobalDiagnostics() {
@@ -89661,7 +90311,11 @@ function createTypeChecker(host) {
}
function getExportSpecifierLocalTargetSymbol(node) {
if (isExportSpecifier(node)) {
- return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
+ const name = node.propertyName || node.name;
+ return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : name.kind === 11 /* StringLiteral */ ? void 0 : (
+ // Skip for invalid syntax like this: export { "x" }
+ resolveEntityName(name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)
+ );
} else {
return resolveEntityName(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
@@ -90007,7 +90661,7 @@ function createTypeChecker(host) {
}
function isReferencedAliasDeclaration(node, checkChildren) {
Debug.assert(canCollectSymbolAliasAccessabilityData);
- if (isAliasSymbolDeclaration2(node)) {
+ if (isAliasSymbolDeclaration(node)) {
const symbol = getSymbolOfDeclaration(node);
const links = symbol && getSymbolLinks(symbol);
if (links == null ? void 0 : links.referenced) {
@@ -90043,11 +90697,17 @@ function createTypeChecker(host) {
const type = getTypeFromTypeNode(typeNode);
return containsUndefinedType(type);
}
- function requiresAddingImplicitUndefined(parameter) {
- return (isRequiredInitializedParameter(parameter) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
+ function requiresAddingImplicitUndefined(parameter, enclosingDeclaration) {
+ return (isRequiredInitializedParameter(parameter, enclosingDeclaration) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
}
- function isRequiredInitializedParameter(parameter) {
- return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
+ function isRequiredInitializedParameter(parameter, enclosingDeclaration) {
+ if (!strictNullChecks || isOptionalParameter(parameter) || isJSDocParameterTag(parameter) || !parameter.initializer) {
+ return false;
+ }
+ if (hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */)) {
+ return !!enclosingDeclaration && isFunctionLikeDeclaration(enclosingDeclaration);
+ }
+ return true;
}
function isOptionalUninitializedParameterProperty(parameter) {
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
@@ -90094,7 +90754,7 @@ function createTypeChecker(host) {
return !!(getNodeCheckFlags(node) & flag);
}
function calculateNodeCheckFlagWorker(node, flag) {
- if (!compilerOptions.noCheck && canIncludeBindAndCheckDiagnsotics(getSourceFileOfNode(node), compilerOptions)) {
+ if (!compilerOptions.noCheck && canIncludeBindAndCheckDiagnostics(getSourceFileOfNode(node), compilerOptions)) {
return;
}
const links = getNodeLinks(node);
@@ -90156,17 +90816,19 @@ function createTypeChecker(host) {
function checkChildIdentifiers(node2) {
forEachNodeRecursively(node2, checkIdentifiers);
}
+ function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
+ return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
+ }
function checkSingleIdentifier(node2) {
const nodeLinks2 = getNodeLinks(node2);
- nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
- if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
- const s = getSymbolAtLocation(
- node2,
- /*ignoreErrors*/
- true
- );
- if (s && s !== unknownSymbol) {
- checkIdentifierCalculateNodeCheckFlags(node2, s);
+ nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */;
+ if (isIdentifier(node2)) {
+ nodeLinks2.calculatedFlags |= 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
+ if (isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
+ const s = getResolvedSymbol(node2);
+ if (s && s !== unknownSymbol) {
+ checkIdentifierCalculateNodeCheckFlags(node2, s);
+ }
}
}
}
@@ -90319,14 +90981,14 @@ function createTypeChecker(host) {
return 11 /* ObjectType */;
}
}
- function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
+ function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
if (!declaration) {
return factory.createToken(133 /* AnyKeyword */);
}
const symbol = getSymbolOfDeclaration(declaration);
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
- return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
+ return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
}
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
@@ -90369,14 +91031,14 @@ function createTypeChecker(host) {
}
return candidateExpr;
}
- function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
+ function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, internalFlags, tracker) {
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
if (!signatureDeclaration) {
return factory.createToken(133 /* AnyKeyword */);
}
- return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
+ return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, internalFlags, tracker);
}
- function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
+ function createTypeOfExpression(exprIn, enclosingDeclaration, flags, internalFlags, tracker) {
const expr = getParseTreeNode(exprIn, isExpression);
if (!expr) {
return factory.createToken(133 /* AnyKeyword */);
@@ -90389,6 +91051,7 @@ function createTypeChecker(host) {
void 0,
enclosingDeclaration,
flags | 1024 /* MultilineObjectLiterals */,
+ internalFlags,
tracker
);
}
@@ -90494,6 +91157,8 @@ function createTypeChecker(host) {
enclosing,
/*flags*/
void 0,
+ /*internalFlags*/
+ void 0,
tracker
) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse();
if (enumResult) return enumResult;
@@ -90622,17 +91287,18 @@ function createTypeChecker(host) {
const parseDecl = getParseTreeNode(decl);
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
},
- getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
+ getDeclarationStatementsForSourceFile: (node, flags, internalFlags, tracker) => {
const n = getParseTreeNode(node);
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
const sym = getSymbolOfDeclaration(node);
if (!sym) {
- return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
+ return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, internalFlags, tracker);
}
resolveExternalModuleSymbol(sym);
- return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
+ return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
},
- isImportRequiredByAugmentation
+ isImportRequiredByAugmentation,
+ isDefinitelyReferenceToGlobalSymbolObject
};
function isImportRequiredByAugmentation(node) {
const file = getSourceFileOfNode(node);
@@ -91113,7 +91779,7 @@ function createTypeChecker(host) {
break;
case 95 /* ExportKeyword */:
if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
- node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
+ node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
}
if (flags & 32 /* Export */) {
@@ -91620,6 +92286,13 @@ function createTypeChecker(host) {
if (name.kind === 9 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
+ if (name.kind === 10 /* BigIntLiteral */) {
+ addErrorOrSuggestion(
+ /*isError*/
+ true,
+ createDiagnosticForNode(name, Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name)
+ );
+ }
currentKind = 4 /* PropertyAssignment */;
break;
case 174 /* MethodDeclaration */:
@@ -91716,6 +92389,7 @@ function createTypeChecker(host) {
}
case 7 /* ES2022 */:
case 99 /* ESNext */:
+ case 200 /* Preserve */:
case 4 /* System */:
if (languageVersion >= 4 /* ES2017 */) {
break;
@@ -92022,7 +92696,7 @@ function createTypeChecker(host) {
const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
return grammarErrorOnNode(node.exclamationToken, message);
}
- if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
checkESModuleMarker(node.name);
}
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
@@ -92290,8 +92964,8 @@ function createTypeChecker(host) {
return false;
}
function getAmbientModules(sourceFile) {
- const isNode2 = denoContext.hasNodeSourceFile(sourceFile);
- if (isNode2) {
+ const isNode = denoContext.hasNodeSourceFile(sourceFile);
+ if (isNode) {
if (!nodeAmbientModulesCache) {
nodeAmbientModulesCache = getAmbientModules2(denoContext.combinedGlobals);
}
@@ -92343,11 +93017,11 @@ function createTypeChecker(host) {
return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
}
const nodeArguments = node.arguments;
- if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
+ if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */ && moduleKind !== 200 /* Preserve */) {
checkGrammarForDisallowedTrailingComma(nodeArguments);
if (nodeArguments.length > 1) {
const importAttributesArgument = nodeArguments[1];
- return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
+ return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve);
}
}
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
@@ -92486,7 +93160,7 @@ function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
case 276 /* ImportSpecifier */:
case 281 /* ExportSpecifier */:
- return isIdentifier(name);
+ return isIdentifier(name) || name.kind === 11 /* StringLiteral */;
default:
return isDeclarationName(name);
}
@@ -92535,7 +93209,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
fileExists: (fileName) => host.fileExists(fileName),
getFileIncludeReasons: () => host.getFileIncludeReasons(),
- readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
+ readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
+ getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
+ getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
};
}
var SymbolTrackerImpl = class _SymbolTrackerImpl {
@@ -93729,7 +94405,7 @@ var visitEachChildTable = {
return context.factory.updateImportSpecifier(
node,
node.isTypeOnly,
- nodeVisitor(node.propertyName, visitor, isIdentifier),
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
);
},
@@ -93760,8 +94436,8 @@ var visitEachChildTable = {
return context.factory.updateExportSpecifier(
node,
node.isTypeOnly,
- nodeVisitor(node.propertyName, visitor, isIdentifier),
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleExportName))
);
},
// Module references
@@ -94477,7 +95153,7 @@ function containsDefaultReference(node) {
return some(node.elements, isNamedDefaultReference);
}
function isNamedDefaultReference(e) {
- return e.propertyName !== void 0 ? e.propertyName.escapedText === "default" /* Default */ : e.name.escapedText === "default" /* Default */;
+ return moduleExportNameIsDefault(e.propertyName || e.name);
}
function chainBundle(context, transformSourceFile) {
return transformSourceFileOrBundle;
@@ -94553,9 +95229,10 @@ function collectExternalModuleInfo(context, sourceFile) {
hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
} else {
const name = node.exportClause.name;
- if (!uniqueExports.get(idText(name))) {
+ const nameText = moduleExportNameTextUnescaped(name);
+ if (!uniqueExports.get(nameText)) {
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
- uniqueExports.set(idText(name), true);
+ uniqueExports.set(nameText, true);
exportedNames = append(exportedNames, name);
}
hasImportStar = true;
@@ -94613,26 +95290,29 @@ function collectExternalModuleInfo(context, sourceFile) {
return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, exportedFunctions, externalHelpersImportDeclaration };
function addExportedNamesForExportDeclaration(node) {
for (const specifier of cast(node.exportClause, isNamedExports).elements) {
- if (!uniqueExports.get(idText(specifier.name))) {
+ const specifierNameText = moduleExportNameTextUnescaped(specifier.name);
+ if (!uniqueExports.get(specifierNameText)) {
const name = specifier.propertyName || specifier.name;
- if (!node.moduleSpecifier) {
- exportSpecifiers.add(name, specifier);
- }
- const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
- if (decl) {
- if (decl.kind === 262 /* FunctionDeclaration */) {
- addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
- continue;
+ if (name.kind !== 11 /* StringLiteral */) {
+ if (!node.moduleSpecifier) {
+ exportSpecifiers.add(name, specifier);
+ }
+ const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
+ if (decl) {
+ if (decl.kind === 262 /* FunctionDeclaration */) {
+ addExportedFunctionDeclaration(decl, specifier.name, moduleExportNameIsDefault(specifier.name));
+ continue;
+ }
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
}
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
}
- uniqueExports.set(idText(specifier.name), true);
+ uniqueExports.set(specifierNameText, true);
exportedNames = append(exportedNames, specifier.name);
}
}
}
function addExportedFunctionDeclaration(node, name, isDefault) {
- exportedFunctions.add(node);
+ exportedFunctions.add(getOriginalNode(node, isFunctionDeclaration));
if (isDefault) {
if (!hasExportDefault) {
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
@@ -94640,9 +95320,10 @@ function collectExternalModuleInfo(context, sourceFile) {
}
} else {
name ?? (name = node.name);
- if (!uniqueExports.get(idText(name))) {
+ const nameText = moduleExportNameTextUnescaped(name);
+ if (!uniqueExports.get(nameText)) {
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
- uniqueExports.set(idText(name), true);
+ uniqueExports.set(nameText, true);
}
}
}
@@ -95358,7 +96039,7 @@ function createDestructuringPropertyAccess(flattenContext, value, propertyName)
propertyName
);
return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
- } else if (isStringOrNumericLiteralLike(propertyName)) {
+ } else if (isStringOrNumericLiteralLike(propertyName) || isBigIntLiteral(propertyName)) {
const argumentExpression = factory2.cloneNode(propertyName);
return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
} else {
@@ -95783,7 +96464,6 @@ function transformTypeScript(context) {
let currentNamespaceContainerName;
let currentLexicalScope;
let currentScopeFirstDeclarationsOfName;
- let currentClassHasParameterProperties;
let enabledSubstitutions;
let applicableSubstitutions;
return transformSourceFileOrBundle;
@@ -95811,14 +96491,12 @@ function transformTypeScript(context) {
function saveStateAndInvoke(node, f) {
const savedCurrentScope = currentLexicalScope;
const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
- const savedCurrentClassHasParameterProperties = currentClassHasParameterProperties;
onBeforeVisitNode(node);
const visited = f(node);
if (currentLexicalScope !== savedCurrentScope) {
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
}
currentLexicalScope = savedCurrentScope;
- currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
return visited;
}
function onBeforeVisitNode(node) {
@@ -96451,7 +97129,7 @@ function transformTypeScript(context) {
}
function visitPropertyNameOfClassElement(member) {
const name = member.name;
- if (isComputedPropertyName(name) && (!hasStaticModifier(member) && currentClassHasParameterProperties || hasDecorators(member) && legacyDecorators)) {
+ if (legacyDecorators && isComputedPropertyName(name) && hasDecorators(member)) {
const expression = visitNode(name.expression, visitor, isExpression);
Debug.assert(expression);
const innerExpression = skipPartiallyEmittedExpressions(expression);
@@ -96826,7 +97504,7 @@ function transformTypeScript(context) {
return updated;
}
function visitParenthesizedExpression(node) {
- const innerExpression = skipOuterExpressions(node.expression, ~6 /* Assertions */);
+ const innerExpression = skipOuterExpressions(node.expression, ~(6 /* Assertions */ | 16 /* ExpressionsWithTypeArguments */));
if (isAssertionExpression(innerExpression) || isSatisfiesExpression(innerExpression)) {
const expression = visitNode(node.expression, visitor, isExpression);
Debug.assert(expression);
@@ -97632,8 +98310,6 @@ function transformClassFields(context) {
return node;
}
switch (node.kind) {
- case 129 /* AccessorKeyword */:
- return Debug.fail("Use `modifierVisitor` instead.");
case 263 /* ClassDeclaration */:
return visitClassDeclaration(node);
case 231 /* ClassExpression */:
@@ -99046,6 +99722,7 @@ function transformClassFields(context) {
addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset));
}
function transformConstructorBody(node, constructor, isDerivedClass) {
+ var _a;
const instanceProperties = getProperties(
node,
/*requireInitializer*/
@@ -99139,12 +99816,12 @@ function transformClassFields(context) {
setTextRange(
factory2.createNodeArray(statements),
/*location*/
- constructor ? constructor.body.statements : node.members
+ ((_a = constructor == null ? void 0 : constructor.body) == null ? void 0 : _a.statements) ?? node.members
),
multiLine
),
/*location*/
- constructor ? constructor.body : void 0
+ constructor == null ? void 0 : constructor.body
);
}
function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
@@ -106148,7 +106825,7 @@ function transformJsx(context) {
const name = node.name;
if (isIdentifier(name)) {
const text = idText(name);
- return /^[A-Za-z_]\w*$/.test(text) ? name : factory2.createStringLiteral(text);
+ return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
}
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
}
@@ -108272,7 +108949,7 @@ function transformES2015(context) {
statement,
/*outermostLabeledStatement*/
node
- ) : factory2.restoreEnclosingLabel(Debug.checkDefined(visitNode(statement, visitor, isStatement, factory2.liftToBlock)), node, convertedLoopState && resetLabel);
+ ) : factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), statement), node, convertedLoopState && resetLabel);
}
function visitIterationStatement(node, outermostLabeledStatement) {
switch (node.kind) {
@@ -111929,7 +112606,7 @@ function transformModule(context) {
factory2.createExpressionStatement(
reduceLeft(
currentModuleInfo.exportedNames.slice(i, i + chunkSize),
- (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
+ (prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
factory2.createVoidZero()
)
)
@@ -112252,7 +112929,10 @@ function transformModule(context) {
append(statements, createUnderscoreUnderscoreESModule());
}
if (some(currentModuleInfo.exportedNames)) {
- append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
+ append(
+ statements,
+ factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero()))
+ );
}
for (const f of currentModuleInfo.exportedFunctions) {
appendExportsOfHoistedDeclaration(statements, f);
@@ -112382,7 +113062,7 @@ function transformModule(context) {
case 354 /* PartiallyEmittedExpression */:
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
case 213 /* CallExpression */:
- if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
+ if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
return visitImportCallExpression(node);
}
break;
@@ -112575,7 +113255,7 @@ function transformModule(context) {
return factory2.updateLabeledStatement(
node,
node.label,
- Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
+ visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), node.statement)
);
}
function visitWithStatement(node) {
@@ -112589,7 +113269,7 @@ function transformModule(context) {
return factory2.updateIfStatement(
node,
visitNode(node.expression, visitor, isExpression),
- Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
+ visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createBlock([]),
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
);
}
@@ -113123,17 +113803,16 @@ function transformModule(context) {
);
}
for (const specifier of node.exportClause.elements) {
- const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && idText(specifier.propertyName || specifier.name) === "default";
- const exportedValue = factory2.createPropertyAccessExpression(
- exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName,
- specifier.propertyName || specifier.name
- );
+ const specifierName = specifier.propertyName || specifier.name;
+ const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && moduleExportNameIsDefault(specifierName);
+ const target = exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName;
+ const exportedValue = specifierName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, specifierName) : factory2.createPropertyAccessExpression(target, specifierName);
statements.push(
setOriginalNode(
setTextRange(
factory2.createExpressionStatement(
createExportExpression(
- factory2.getExportName(specifier),
+ specifier.name.kind === 11 /* StringLiteral */ ? factory2.cloneNode(specifier.name) : factory2.getExportName(specifier),
exportedValue,
/*location*/
void 0,
@@ -113158,7 +113837,7 @@ function transformModule(context) {
factory2.cloneNode(node.exportClause.name),
getHelperExpressionForExport(
node,
- moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
+ moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : node.exportClause.name.kind === 11 /* StringLiteral */ ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
)
)
),
@@ -113488,10 +114167,13 @@ function transformModule(context) {
return statements;
}
function appendExportStatement(statements, seen, exportName, expression, location, allowComments, liveBinding) {
- if (!seen.has(exportName)) {
+ if (exportName.kind !== 11 /* StringLiteral */) {
+ if (seen.has(exportName)) {
+ return statements;
+ }
seen.set(exportName, true);
- statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
}
+ statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
return statements;
}
function createUnderscoreUnderscoreESModule() {
@@ -113561,7 +114243,10 @@ function transformModule(context) {
])
]
) : factory2.createAssignment(
- factory2.createPropertyAccessExpression(
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(
+ factory2.createIdentifier("exports"),
+ factory2.cloneNode(name)
+ ) : factory2.createPropertyAccessExpression(
factory2.createIdentifier("exports"),
factory2.cloneNode(name)
),
@@ -113697,11 +114382,9 @@ function transformModule(context) {
);
} else if (isImportSpecifier(importDeclaration)) {
const name = importDeclaration.propertyName || importDeclaration.name;
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
return setTextRange(
- factory2.createPropertyAccessExpression(
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
- factory2.cloneNode(name)
- ),
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(name)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(name)),
/*location*/
node
);
@@ -113989,7 +114672,7 @@ function transformSystemModule(context) {
const exportedNames = [];
if (moduleInfo.exportedNames) {
for (const exportedLocalName of moduleInfo.exportedNames) {
- if (exportedLocalName.escapedText === "default") {
+ if (moduleExportNameIsDefault(exportedLocalName)) {
continue;
}
exportedNames.push(
@@ -114167,10 +114850,10 @@ function transformSystemModule(context) {
for (const e of entry.exportClause.elements) {
properties.push(
factory2.createPropertyAssignment(
- factory2.createStringLiteral(idText(e.name)),
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.name)),
factory2.createElementAccessExpression(
parameterName,
- factory2.createStringLiteral(idText(e.propertyName || e.name))
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.propertyName || e.name))
)
)
);
@@ -114197,7 +114880,7 @@ function transformSystemModule(context) {
/*typeArguments*/
void 0,
[
- factory2.createStringLiteral(idText(entry.exportClause.name)),
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(entry.exportClause.name)),
parameterName
]
)
@@ -114537,7 +115220,7 @@ function transformSystemModule(context) {
const exportSpecifiers = moduleInfo.exportSpecifiers.get(name);
if (exportSpecifiers) {
for (const exportSpecifier of exportSpecifiers) {
- if (exportSpecifier.name.escapedText !== excludeName) {
+ if (moduleExportNameTextUnescaped(exportSpecifier.name) !== excludeName) {
statements = appendExportStatement(statements, exportSpecifier.name, name);
}
}
@@ -114689,7 +115372,7 @@ function transformSystemModule(context) {
return factory2.updateLabeledStatement(
node,
node.label,
- Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
+ visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createExpressionStatement(factory2.createIdentifier(""))
);
}
function visitWithStatement(node) {
@@ -114703,7 +115386,7 @@ function transformSystemModule(context) {
return factory2.updateIfStatement(
node,
visitNode(node.expression, visitor, isExpression),
- Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
+ visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createBlock([]),
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
);
}
@@ -114958,13 +115641,12 @@ function transformSystemModule(context) {
node
);
} else if (isImportSpecifier(importDeclaration)) {
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
return setTextRange(
factory2.createPropertyAssignment(
factory2.cloneNode(name),
- factory2.createPropertyAccessExpression(
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
- )
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName))
),
/*location*/
node
@@ -115007,11 +115689,10 @@ function transformSystemModule(context) {
node
);
} else if (isImportSpecifier(importDeclaration)) {
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
return setTextRange(
- factory2.createPropertyAccessExpression(
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
- ),
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName)),
/*location*/
node
);
@@ -115377,8 +116058,8 @@ function transformECMAScriptModule(context) {
}
}
-// src/compiler/transformers/module/node.ts
-function transformNodeModule(context) {
+// src/compiler/transformers/module/impliedNodeFormatDependent.ts
+function transformImpliedNodeFormatDependentModule(context) {
const previousOnSubstituteNode = context.onSubstituteNode;
const previousOnEmitNode = context.onEmitNode;
const esmTransform = transformECMAScriptModule(context);
@@ -115389,6 +116070,7 @@ function transformNodeModule(context) {
const cjsTransform = transformModule(context);
const cjsOnSubstituteNode = context.onSubstituteNode;
const cjsOnEmitNode = context.onEmitNode;
+ const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
context.enableSubstitution(307 /* SourceFile */);
@@ -115403,7 +116085,7 @@ function transformNodeModule(context) {
if (!currentSourceFile) {
return previousOnSubstituteNode(hint, node);
}
- if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
+ if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
return esmOnSubstituteNode(hint, node);
}
return cjsOnSubstituteNode(hint, node);
@@ -115416,13 +116098,13 @@ function transformNodeModule(context) {
if (!currentSourceFile) {
return previousOnEmitNode(hint, node, emitCallback);
}
- if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
+ if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
return esmOnEmitNode(hint, node, emitCallback);
}
return cjsOnEmitNode(hint, node, emitCallback);
}
function getModuleTransformForFile(file) {
- return file.impliedNodeFormat === 99 /* ESNext */ ? esmTransform : cjsTransform;
+ return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
}
function transformSourceFile(node) {
if (node.isDeclarationFile) {
@@ -115844,7 +116526,11 @@ function createGetIsolatedDeclarationErrors(resolver) {
if (isSetAccessor(node.parent)) {
return createAccessorTypeError(node.parent);
}
- const addUndefined = resolver.requiresAddingImplicitUndefined(node);
+ const addUndefined = resolver.requiresAddingImplicitUndefined(
+ node,
+ /*enclosingDeclaration*/
+ void 0
+ );
if (!addUndefined && node.initializer) {
return createExpressionError(node.initializer);
}
@@ -115899,19 +116585,19 @@ function createGetIsolatedDeclarationErrors(resolver) {
function getDeclarationDiagnostics(host, resolver, file) {
const compilerOptions = host.getCompilerOptions();
const files = filter(getSourceFilesToEmit(host, file), isSourceFileNotJson);
- const result = transformNodes(
+ return contains(files, file) ? transformNodes(
resolver,
host,
factory,
compilerOptions,
- file ? contains(files, file) ? [file] : emptyArray : files,
+ [file],
[transformDeclarations],
/*allowDtsFiles*/
false
- );
- return result.diagnostics;
+ ).diagnostics : void 0;
}
-var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
+var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
+var declarationEmitInternalNodeBuilderFlags = 8 /* AllowUnresolvedNames */;
function transformDeclarations(context) {
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
let getSymbolAccessibilityDiagnostic = throwDiagnostic;
@@ -115963,6 +116649,7 @@ function transformDeclarations(context) {
}
function reportInferenceFallback(node) {
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
+ if (getSourceFileOfNode(node) !== currentSourceFile) return;
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
reportExpandoFunctionErrors(node);
} else {
@@ -116007,7 +116694,10 @@ function transformDeclarations(context) {
function reportPrivateInBaseOfClassExpression(propertyName) {
if (errorNameNode || errorFallbackNode) {
context.addDiagnostic(
- createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected, propertyName)
+ addRelatedInfo(
+ createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected, propertyName),
+ ...isVariableDeclaration((errorNameNode || errorFallbackNode).parent) ? [createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : []
+ )
);
}
}
@@ -116063,7 +116753,7 @@ function transformDeclarations(context) {
diagnosticMessage: s.errorModuleName ? Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit : Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit,
errorNode: s.errorNode || sourceFile
};
- const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
+ const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
getSymbolAccessibilityDiagnostic = oldDiag;
return result;
}
@@ -116316,7 +117006,7 @@ function transformDeclarations(context) {
if (shouldPrintWithInitializer(node)) {
return;
}
- const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
+ const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node, enclosingDeclaration);
if (type && !shouldAddImplicitUndefined) {
return visitNode(type, visitDeclarationSubtree, isTypeNode);
}
@@ -116333,7 +117023,7 @@ function transformDeclarations(context) {
case 172 /* PropertyDeclaration */:
case 208 /* BindingElement */:
case 260 /* VariableDeclaration */:
- typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
+ typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
break;
case 262 /* FunctionDeclaration */:
case 180 /* ConstructSignature */:
@@ -116341,7 +117031,7 @@ function transformDeclarations(context) {
case 174 /* MethodDeclaration */:
case 177 /* GetAccessor */:
case 179 /* CallSignature */:
- typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
+ typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
break;
default:
Debug.assertNever(node);
@@ -116601,15 +117291,17 @@ function transformDeclarations(context) {
if (isDeclarationAndNotVisible(input)) return;
if (hasDynamicName(input)) {
if (isolatedDeclarations) {
- if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
- return;
- } else if (
- // Type declarations just need to double-check that the input computed name is an entity name expression
- (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
- ) {
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
- return;
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
+ return;
+ } else if (
+ // Type declarations just need to double-check that the input computed name is an entity name expression
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
+ ) {
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
+ return;
+ }
}
} else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
return;
@@ -116940,7 +117632,7 @@ function transformDeclarations(context) {
newId,
/*exclamationToken*/
void 0,
- resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
+ resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
/*initializer*/
void 0
);
@@ -117066,7 +117758,7 @@ function transformDeclarations(context) {
return void 0;
}
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
- const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags | -2147483648 /* NoSyntacticPrinter */, symbolTracker);
+ const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags | 2 /* NoSyntacticPrinter */, symbolTracker);
getSymbolAccessibilityDiagnostic = oldDiag;
const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr);
const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr);
@@ -117269,7 +117961,7 @@ function transformDeclarations(context) {
newId,
/*exclamationToken*/
void 0,
- resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
+ resolver.createTypeOfExpression(extendsClause.expression, input, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker),
/*initializer*/
void 0
);
@@ -117542,17 +118234,18 @@ function isProcessedComponent(node) {
// src/compiler/transformer.ts
function getModuleTransformer(moduleKind) {
switch (moduleKind) {
+ case 200 /* Preserve */:
+ return transformECMAScriptModule;
case 99 /* ESNext */:
case 7 /* ES2022 */:
case 6 /* ES2020 */:
case 5 /* ES2015 */:
- case 200 /* Preserve */:
- return transformECMAScriptModule;
- case 4 /* System */:
- return transformSystemModule;
case 100 /* Node16 */:
case 199 /* NodeNext */:
- return transformNodeModule;
+ case 1 /* CommonJS */:
+ return transformImpliedNodeFormatDependentModule;
+ case 4 /* System */:
+ return transformSystemModule;
default:
return transformModule;
}
@@ -117976,16 +118669,16 @@ function isBuildInfoFile(file) {
function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit = false, onlyBuildInfo, includeBuildInfo) {
const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit);
const options = host.getCompilerOptions();
- if (options.outFile) {
- if (sourceFiles.length) {
- const bundle = factory.createBundle(sourceFiles);
- const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
- if (result) {
- return result;
+ if (!onlyBuildInfo) {
+ if (options.outFile) {
+ if (sourceFiles.length) {
+ const bundle = factory.createBundle(sourceFiles);
+ const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
+ if (result) {
+ return result;
+ }
}
- }
- } else {
- if (!onlyBuildInfo) {
+ } else {
for (const sourceFile of sourceFiles) {
const result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile);
if (result) {
@@ -117993,19 +118686,19 @@ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDt
}
}
}
- if (includeBuildInfo) {
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
- if (buildInfoPath) return action(
- { buildInfoPath },
- /*sourceFileOrBundle*/
- void 0
- );
- }
+ }
+ if (includeBuildInfo) {
+ const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
+ if (buildInfoPath) return action(
+ { buildInfoPath },
+ /*sourceFileOrBundle*/
+ void 0
+ );
}
}
function getTsBuildInfoEmitOutputFilePath(options) {
const configFile = options.configFilePath;
- if (!isIncrementalCompilation(options)) return void 0;
+ if (!canEmitTsBuildInfo(options)) return void 0;
if (options.tsBuildInfoFile) return options.tsBuildInfoFile;
const outPath = options.outFile;
let buildInfoExtensionLess;
@@ -118023,14 +118716,16 @@ function getTsBuildInfoEmitOutputFilePath(options) {
}
return buildInfoExtensionLess + ".tsbuildinfo" /* TsBuildInfo */;
}
+function canEmitTsBuildInfo(options) {
+ return isIncrementalCompilation(options) || !!options.tscBuild;
+}
function getOutputPathsForBundle(options, forceDtsPaths) {
const outPath = options.outFile;
const jsFilePath = options.emitDeclarationOnly ? void 0 : outPath;
const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : void 0;
const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath };
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
}
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
const options = host.getCompilerOptions();
@@ -118044,7 +118739,7 @@ function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
const sourceMapFilePath = !jsFilePath || isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options);
const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) && !isJsonFile ? getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : void 0;
const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath: void 0 };
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
}
}
function getSourceMapFilePath(jsFilePath, options) {
@@ -118093,7 +118788,7 @@ function createAddOutput() {
}
}
function getSingleOutputFileNames(configFile, addOutput) {
- const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(
+ const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(
configFile.options,
/*forceDtsPaths*/
false
@@ -118102,7 +118797,6 @@ function getSingleOutputFileNames(configFile, addOutput) {
addOutput(sourceMapFilePath);
addOutput(declarationFilePath);
addOutput(declarationMapPath);
- addOutput(buildInfoPath);
}
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2) {
if (isDeclarationFileName(inputFileName)) return;
@@ -118153,8 +118847,8 @@ function getAllProjectOutputs(configFile, ignoreCase) {
for (const inputFileName of configFile.fileNames) {
getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2);
}
- addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
}
+ addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
return getOutputs();
}
function getOutputFileNames(commandLine, inputFileName, ignoreCase) {
@@ -118194,7 +118888,7 @@ function getFirstProjectOutput(configFile, ignoreCase) {
function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
return !!forceDtsEmit && !!emitOnly;
}
-function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
+function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit, skipBuildInfo) {
var compilerOptions = host.getCompilerOptions();
var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
@@ -118210,7 +118904,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit),
forceDtsEmit,
onlyBuildInfo,
- !targetSourceFile
+ !targetSourceFile && !skipBuildInfo
);
exit();
return {
@@ -118232,15 +118926,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
(_f = tracing) == null ? void 0 : _f.pop();
}
function emitBuildInfo(buildInfoPath) {
- if (!buildInfoPath || targetSourceFile || emitSkipped) return;
+ if (!buildInfoPath || targetSourceFile) return;
if (host.isEmitBlocked(buildInfoPath)) {
emitSkipped = true;
return;
}
- const buildInfo = host.getBuildInfo() || createBuildInfo(
- /*program*/
- void 0
- );
+ const buildInfo = host.getBuildInfo() || { version };
writeFile(
host,
emitterDiagnostics,
@@ -118264,7 +118955,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
}
(isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : filter(sourceFileOrBundle.sourceFiles, isSourceFileNotJson)).forEach(
(sourceFile) => {
- if (compilerOptions.noCheck || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) markLinkedReferences(sourceFile);
+ if (compilerOptions.noCheck || !canIncludeBindAndCheckDiagnostics(sourceFile, compilerOptions)) markLinkedReferences(sourceFile);
}
);
const transform2 = transformNodes(
@@ -118282,6 +118973,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
newLine: compilerOptions.newLine,
noEmitHelpers: compilerOptions.noEmitHelpers,
module: getEmitModuleKind(compilerOptions),
+ moduleResolution: getEmitModuleResolutionKind(compilerOptions),
target: getEmitScriptTarget(compilerOptions),
sourceMap: compilerOptions.sourceMap,
inlineSourceMap: compilerOptions.inlineSourceMap,
@@ -118316,7 +119008,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
filesForEmit.forEach((sourceFile) => {
- if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) || !canIncludeBindAndCheckDiagnsotics(sourceFile, compilerOptions)) {
+ if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) || !canIncludeBindAndCheckDiagnostics(sourceFile, compilerOptions)) {
collectLinkedAliases(sourceFile);
}
});
@@ -118344,8 +119036,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
newLine: compilerOptions.newLine,
noEmitHelpers: true,
module: compilerOptions.module,
+ moduleResolution: compilerOptions.moduleResolution,
target: compilerOptions.target,
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
+ sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
inlineSourceMap: compilerOptions.inlineSourceMap,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
onlyPrintJsDocStyle: true,
@@ -118359,7 +119052,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
substituteNode: declarationTransform.substituteNode
});
- printSourceFileOrBundle(
+ const dtsWritten = printSourceFileOrBundle(
declarationFilePath,
declarationMapPath,
declarationTransform,
@@ -118373,7 +119066,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
}
);
if (emittedFilesList) {
- emittedFilesList.push(declarationFilePath);
+ if (dtsWritten) emittedFilesList.push(declarationFilePath);
if (declarationMapPath) {
emittedFilesList.push(declarationMapPath);
}
@@ -118402,6 +119095,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
forEachChild(node, collectLinkedAliases);
}
function markLinkedReferences(file) {
+ if (isSourceFileJS(file)) return;
forEachChildRecursively(file, (n) => {
if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
if (isImportDeclaration(n)) return "skip";
@@ -118464,8 +119158,10 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
writer.writeLine();
}
const text = writer.getText();
- writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos, diagnostics: transform2.diagnostics });
+ const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
+ writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
writer.clear();
+ return !data.skippedDtsWrite;
}
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 307 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
@@ -118521,9 +119217,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
return encodeURI(sourceMapFile);
}
}
-function createBuildInfo(program) {
- return { program, version };
-}
function getBuildInfoText(buildInfo) {
return JSON.stringify(buildInfo);
}
@@ -118568,7 +119261,8 @@ var notImplementedResolver = {
getJsxFragmentFactoryEntity: notImplemented,
isBindingCapturedByNode: notImplemented,
getDeclarationStatementsForSourceFile: notImplemented,
- isImportRequiredByAugmentation: notImplemented
+ isImportRequiredByAugmentation: notImplemented,
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
};
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -119385,7 +120079,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function getSortedEmitHelpers(node) {
const helpers = getEmitHelpers(node);
- return helpers && stableSort(helpers, compareEmitHelpers);
+ return helpers && toSorted(helpers, compareEmitHelpers);
}
function emitNumericOrBigIntLiteral(node) {
emitLiteral(
@@ -119395,7 +120089,13 @@ function createPrinter(printerOptions = {}, handlers = {}) {
);
}
function emitLiteral(node, jsxAttributeEscape) {
- const text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape, jsxAttributeEscape);
+ const text = getLiteralTextOfNode(
+ node,
+ /*sourceFile*/
+ void 0,
+ printerOptions.neverAsciiEscape,
+ jsxAttributeEscape
+ );
if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind))) {
writeLiteral(text);
} else {
@@ -119876,6 +120576,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
if (isNumericLiteral(expression)) {
const text = getLiteralTextOfNode(
expression,
+ /*sourceFile*/
+ void 0,
/*neverAsciiEscape*/
true,
/*jsxAttributeEscape*/
@@ -121097,7 +121799,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
if (node.comment) {
const text = getTextOfJSDocComment(node.comment);
if (text) {
- const lines = text.split(/\r\n?|\n/g);
+ const lines = text.split(/\r\n?|\n/);
for (const line of lines) {
writeLine();
writeSpace();
@@ -121524,7 +122226,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
return emitTypeArguments(parentNode, parentNode.typeArguments);
}
- emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
+ emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
}
function emitParameters(parentNode, parameters) {
emitList(parentNode, parameters, 2576 /* Parameters */);
@@ -121792,7 +122494,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
}
function writeLines(text) {
- const lines = text.split(/\r\n?|\n/g);
+ const lines = text.split(/\r\n?|\n/);
const indentation = guessIndentation(lines);
for (const lineText of lines) {
const line = indentation ? lineText.slice(indentation) : lineText;
@@ -122017,18 +122719,18 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
return getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
}
- function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
+ function getLiteralTextOfNode(node, sourceFile = currentSourceFile, neverAsciiEscape, jsxAttributeEscape) {
if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
const textSourceNode = node.textSourceNode;
if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
} else {
- return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape);
+ return getLiteralTextOfNode(textSourceNode, getSourceFileOfNode(textSourceNode), neverAsciiEscape, jsxAttributeEscape);
}
}
const flags = (neverAsciiEscape ? 1 /* NeverAsciiEscape */ : 0) | (jsxAttributeEscape ? 2 /* JsxAttributeEscape */ : 0) | (printerOptions.terminateUnterminatedLiterals ? 4 /* TerminateUnterminatedLiterals */ : 0) | (printerOptions.target && printerOptions.target >= 8 /* ES2021 */ ? 8 /* AllowNumericSeparator */ : 0);
- return getLiteralText(node, currentSourceFile, flags);
+ return getLiteralText(node, sourceFile, flags);
}
function pushNameGenerationScope(node) {
privateNameTempFlagsStack.push(privateNameTempFlags);
@@ -123029,7 +123731,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
}
try {
return createCachedFileSystemEntries(rootDir, rootDirPath);
- } catch (_e) {
+ } catch {
Debug.assert(!cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(rootDirPath)));
return void 0;
}
@@ -123118,6 +123820,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
function realpath(s) {
return host.realpath ? host.realpath(s) : s;
}
+ function clearFirstAncestorEntry(fileOrDirectoryPath) {
+ forEachAncestorDirectory(
+ getDirectoryPath(fileOrDirectoryPath),
+ (ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
+ );
+ }
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
if (existingResult !== void 0) {
@@ -123126,6 +123834,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
}
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
if (!parentResult) {
+ clearFirstAncestorEntry(fileOrDirectoryPath);
return void 0;
}
if (!host.directoryExists) {
@@ -123151,6 +123860,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
if (parentResult) {
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
+ } else {
+ clearFirstAncestorEntry(filePath);
}
}
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
@@ -123309,7 +124020,7 @@ function isIgnoredFileFromWildCardWatching({
}
return false;
function hasSourceFile(file) {
- return realProgram ? !!realProgram.getSourceFileByPath(file) : builderProgram ? builderProgram.getState().fileInfos.has(file) : !!find(program, (rootFile) => toPath3(rootFile) === file);
+ return realProgram ? !!realProgram.getSourceFileByPath(file) : builderProgram ? builderProgram.state.fileInfos.has(file) : !!find(program, (rootFile) => toPath3(rootFile) === file);
}
function isSupportedScriptKind() {
if (!getScriptKind2) return false;
@@ -123330,9 +124041,6 @@ function isIgnoredFileFromWildCardWatching({
}
}
}
-function isBuilderProgram(program) {
- return !!program.getState;
-}
function isEmittedFileOfProgram(program, file) {
if (!program) {
return false;
@@ -123857,8 +124565,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
return getModeForUsageLocationWorker(file, usage, compilerOptions);
}
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
- var _a;
- if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
+ if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
if (isTypeOnly) {
const override = getResolutionModeOverride(usage.parent.attributes);
@@ -123873,19 +124580,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
return override;
}
}
- if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
- return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
- usage.parent,
- /*requireStringLiteralLikeArgument*/
- false
- ) ? 1 /* CommonJS */ : 99 /* ESNext */;
+ if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
+ return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
}
- if (file.impliedNodeFormat === void 0) return void 0;
- if (file.impliedNodeFormat !== 99 /* ESNext */) {
- return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
+}
+function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
+ var _a;
+ if (!compilerOptions) {
+ return void 0;
}
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
- return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
+ if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
+ usage.parent,
+ /*requireStringLiteralLikeArgument*/
+ false
+ )) {
+ return 1 /* CommonJS */;
+ }
+ if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
+ return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
+ }
+ const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
+ return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
}
function getResolutionModeOverride(node, grammarErrorOnNode) {
if (!node) return void 0;
@@ -123942,7 +124658,7 @@ function getTypeReferenceResolutionName(entry) {
}
var typeReferenceResolutionNameAndModeGetter = {
getName: getTypeReferenceResolutionName,
- getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
+ getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
};
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
return {
@@ -124116,19 +124832,15 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
return typeof result === "object" ? result.impliedNodeFormat : result;
}
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
- switch (getEmitModuleResolutionKind(options)) {
- case 3 /* Node16 */:
- case 99 /* NodeNext */:
- return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
- default:
- return void 0;
- }
+ const moduleResolution = getEmitModuleResolutionKind(options);
+ const shouldLookupFromPackageJson = 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || pathContainsNodeModules(fileName);
+ return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : shouldLookupFromPackageJson && fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
function lookupFromPackageJson() {
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
const packageJsonLocations = [];
state.failedLookupLocations = packageJsonLocations;
state.affectingLocations = packageJsonLocations;
- const packageJsonScope = getPackageScopeForPath(fileName, state);
+ const packageJsonScope = getPackageScopeForPath(getDirectoryPath(fileName), state);
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS */;
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
}
@@ -124264,13 +124976,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
let commonSourceDirectory;
let typeChecker;
let classifiableNames;
- const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
let fileReasons = createMultiMap();
let filesWithReferencesProcessed;
let fileReasonsToChain;
let reasonToRelatedInfo;
- const cachedBindAndCheckDiagnosticsForFile = {};
- const cachedDeclarationDiagnosticsForFile = {};
+ let cachedBindAndCheckDiagnosticsForFile;
+ let cachedDeclarationDiagnosticsForFile;
let fileProcessingDiagnostics;
let automaticTypeDirectiveNames;
let automaticTypeDirectiveResolutions;
@@ -124502,7 +125213,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
});
}
}
- files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
+ files = toSorted(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
processingDefaultLibFiles = void 0;
processingOtherFiles = void 0;
filesWithReferencesProcessed = void 0;
@@ -124513,7 +125224,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
const newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is
oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
- host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
+ host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path), newFile);
}
}
if (!host.getParsedCommandLine) {
@@ -124523,7 +125234,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
resolvedProjectReference.sourceFile,
oldProgram.getCompilerOptions(),
/*hasSourceFileByPath*/
- false
+ false,
+ /*newSourceFileByResolvedPath*/
+ void 0
);
}
});
@@ -124581,6 +125294,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
isSourceFileFromExternalLibrary,
isSourceFileDefaultLibrary,
getModeForUsageLocation: getModeForUsageLocation2,
+ getEmitSyntaxForUsageLocation,
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
getSourceFileFromReference,
getLibFileFromReference,
@@ -124609,6 +125323,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
forEachResolvedProjectReference: forEachResolvedProjectReference2,
isSourceOfProjectReferenceRedirect,
getRedirectReferenceForResolutionFromSourceOfProject,
+ getCompilerOptionsForFile,
+ getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
+ getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
+ getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
+ shouldTransformImportCall,
emitBuildInfo,
fileExists,
readFile,
@@ -124740,12 +125459,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
var _a2, _b2;
- if (!moduleNames.length) return emptyArray;
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
const redirectedReference = getRedirectReferenceForResolution(containingFile);
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
mark("beforeResolveModule");
- const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference, options, containingFile, reusedNames);
+ const result = actualResolveModuleNamesWorker(
+ moduleNames,
+ containingFileName,
+ redirectedReference,
+ options,
+ containingFile,
+ reusedNames
+ );
mark("afterResolveModule");
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
(_b2 = tracing) == null ? void 0 : _b2.pop();
@@ -124753,13 +125478,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
var _a2, _b2;
- if (!typeDirectiveNames.length) return [];
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
mark("beforeResolveTypeReference");
- const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, options, containingSourceFile, reusedNames);
+ const result = actualResolveTypeReferenceDirectiveNamesWorker(
+ typeDirectiveNames,
+ containingFileName,
+ redirectedReference,
+ options,
+ containingSourceFile,
+ reusedNames
+ );
mark("afterResolveTypeReference");
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
(_b2 = tracing) == null ? void 0 : _b2.pop();
@@ -124829,144 +125560,108 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
return classifiableNames;
}
- function resolveModuleNamesReusingOldState(moduleNames, file) {
- if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
- return resolveModuleNamesWorker(
- moduleNames,
- file,
+ function resolveModuleNamesReusingOldState(moduleNames, containingFile) {
+ return resolveNamesReusingOldState({
+ entries: moduleNames,
+ containingFile,
+ containingSourceFile: containingFile,
+ redirectedReference: getRedirectReferenceForResolution(containingFile),
+ nameAndModeGetter: moduleResolutionNameAndModeGetter,
+ resolutionWorker: resolveModuleNamesWorker,
+ getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
+ getResolved: getResolvedModuleFromResolution,
+ canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
+ resolveToOwnAmbientModule: true
+ });
+ }
+ function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
+ const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
+ return resolveNamesReusingOldState({
+ entries: typeDirectiveNames,
+ containingFile,
+ containingSourceFile,
+ redirectedReference: containingSourceFile && getRedirectReferenceForResolution(containingSourceFile),
+ nameAndModeGetter: typeReferenceResolutionNameAndModeGetter,
+ resolutionWorker: resolveTypeReferenceDirectiveNamesWorker,
+ getResolutionFromOldProgram: (name, mode) => {
+ var _a2;
+ return containingSourceFile ? oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(containingSourceFile, name, mode) : (_a2 = oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(name, mode);
+ },
+ getResolved: getResolvedTypeReferenceDirectiveFromResolution,
+ canReuseResolutionsInFile: () => containingSourceFile ? containingSourceFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName)) && !hasInvalidatedResolutions(containingSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile))
+ });
+ }
+ function resolveNamesReusingOldState({
+ entries,
+ containingFile,
+ containingSourceFile,
+ redirectedReference,
+ nameAndModeGetter,
+ resolutionWorker,
+ getResolutionFromOldProgram,
+ getResolved,
+ canReuseResolutionsInFile,
+ resolveToOwnAmbientModule
+ }) {
+ if (!entries.length) return emptyArray;
+ if (structureIsReused === 0 /* Not */ && (!resolveToOwnAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
+ return resolutionWorker(
+ entries,
+ containingFile,
/*reusedNames*/
void 0
);
}
- let unknownModuleNames;
+ let unknownEntries;
+ let unknownEntryIndices;
let result;
let reusedNames;
- const predictedToResolveToAmbientModuleMarker = emptyResolution;
- const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
- for (let i = 0; i < moduleNames.length; i++) {
- const moduleName = moduleNames[i];
- if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
- const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName));
- if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
+ const reuseResolutions = canReuseResolutionsInFile();
+ for (let i = 0; i < entries.length; i++) {
+ const entry = entries[i];
+ if (reuseResolutions) {
+ const name = nameAndModeGetter.getName(entry);
+ const mode = nameAndModeGetter.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) ?? options);
+ const oldResolution = getResolutionFromOldProgram(name, mode);
+ const oldResolved = oldResolution && getResolved(oldResolution);
+ if (oldResolved) {
if (isTraceEnabled(options, host)) {
trace(
host,
- oldResolution.resolvedModule.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
- moduleName.text,
- getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
- oldResolution.resolvedModule.resolvedFileName,
- oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
+ resolutionWorker === resolveModuleNamesWorker ? oldResolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : oldResolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
+ name,
+ containingSourceFile ? getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : containingFile,
+ oldResolved.resolvedFileName,
+ oldResolved.packageId && packageIdToString(oldResolved.packageId)
);
}
- (result ?? (result = new Array(moduleNames.length)))[i] = oldResolution;
- (reusedNames ?? (reusedNames = [])).push(moduleName);
+ (result ?? (result = new Array(entries.length)))[i] = oldResolution;
+ (reusedNames ?? (reusedNames = [])).push(entry);
continue;
}
}
- let resolvesToAmbientModuleInNonModifiedFile = false;
- if (contains(file.ambientModuleNames, moduleName.text)) {
- resolvesToAmbientModuleInNonModifiedFile = true;
- if (isTraceEnabled(options, host)) {
- trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
- }
- } else {
- resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
- }
- if (resolvesToAmbientModuleInNonModifiedFile) {
- (result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
- } else {
- (unknownModuleNames ?? (unknownModuleNames = [])).push(moduleName);
- }
- }
- const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : emptyArray;
- if (!result) {
- Debug.assert(resolutions.length === moduleNames.length);
- return resolutions;
- }
- let j = 0;
- for (let i = 0; i < result.length; i++) {
- if (!result[i]) {
- result[i] = resolutions[j];
- j++;
- }
- }
- Debug.assert(j === resolutions.length);
- return result;
- function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
- var _a2;
- const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
- const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
- if (resolutionToFile && resolvedFile) {
- return false;
- }
- const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
- if (!unmodifiedFile) {
- return false;
- }
- if (isTraceEnabled(options, host)) {
- trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
- }
- return true;
- }
- }
- function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
- var _a2;
- if (structureIsReused === 0 /* Not */) {
- return resolveTypeReferenceDirectiveNamesWorker(
- typeDirectiveNames,
- containingFile,
- /*reusedNames*/
- void 0
- );
- }
- let unknownTypeReferenceDirectiveNames;
- let result;
- let reusedNames;
- const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
- const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
- const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
- for (let i = 0; i < typeDirectiveNames.length; i++) {
- const entry = typeDirectiveNames[i];
- if (canReuseResolutions) {
- const typeDirectiveName = getTypeReferenceResolutionName(entry);
- const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
- const oldResolution = !isString(containingFile) ? oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(containingFile, typeDirectiveName, mode) : (_a2 = oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode);
- if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
+ if (resolveToOwnAmbientModule) {
+ const name = nameAndModeGetter.getName(entry);
+ if (contains(containingSourceFile.ambientModuleNames, name)) {
if (isTraceEnabled(options, host)) {
trace(
host,
- oldResolution.resolvedTypeReferenceDirective.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
- typeDirectiveName,
- !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile,
- oldResolution.resolvedTypeReferenceDirective.resolvedFileName,
- oldResolution.resolvedTypeReferenceDirective.packageId && packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId)
+ Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1,
+ name,
+ getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory)
);
}
- (result ?? (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
- (reusedNames ?? (reusedNames = [])).push(entry);
+ (result ?? (result = new Array(entries.length)))[i] = emptyResolution;
continue;
}
}
- (unknownTypeReferenceDirectiveNames ?? (unknownTypeReferenceDirectiveNames = [])).push(entry);
+ (unknownEntries ?? (unknownEntries = [])).push(entry);
+ (unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
}
- if (!unknownTypeReferenceDirectiveNames) return result || emptyArray;
- const resolutions = resolveTypeReferenceDirectiveNamesWorker(
- unknownTypeReferenceDirectiveNames,
- containingFile,
- reusedNames
- );
- if (!result) {
- Debug.assert(resolutions.length === typeDirectiveNames.length);
- return resolutions;
- }
- let j = 0;
- for (let i = 0; i < result.length; i++) {
- if (!result[i]) {
- result[i] = resolutions[j];
- j++;
- }
- }
- Debug.assert(j === resolutions.length);
+ if (!unknownEntries) return result;
+ const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
+ if (!result) return resolutions;
+ resolutions.forEach((resolution, index) => result[unknownEntryIndices[index]] = resolution);
return result;
}
function canReuseProjectReferences() {
@@ -125095,10 +125790,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
} else if (hasInvalidatedResolutions(oldSourceFile.path)) {
structureIsReused = 1 /* SafeModules */;
modifiedSourceFiles.push(newSourceFile);
- } else {
- for (const moduleName of oldSourceFile.ambientModuleNames) {
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
- }
}
newSourceFiles.push(newSourceFile);
}
@@ -125191,6 +125882,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
getSymlinkCache,
writeFile: writeFileCallback || writeFile2,
isEmitBlocked,
+ shouldTransformImportCall,
+ getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
+ getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
+ getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
readFile: (f) => host.readFile(f),
fileExists: (f) => {
const path = toPath3(f);
@@ -125217,7 +125912,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
function emitBuildInfo(writeFileCallback) {
var _a2, _b2;
- Debug.assert(!options.outFile);
(_a2 = tracing) == null ? void 0 : _a2.push(
tracing.Phase.Emit,
"emitBuildInfo",
@@ -125259,20 +125953,23 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (file.hasNoDefaultLib) {
return true;
}
- if (!options.noLib) {
+ if (options.noLib) {
return false;
}
const equalityComparer = host.useCaseSensitiveFileNames() ? equateStringsCaseSensitive : equateStringsCaseInsensitive;
if (!options.lib) {
return equalityComparer(file.fileName, getDefaultLibraryFileName());
} else {
- return some(options.lib, (libFileName) => equalityComparer(file.fileName, resolvedLibReferences.get(libFileName).actual));
+ return some(options.lib, (libFileName) => {
+ const resolvedLib = resolvedLibReferences.get(libFileName);
+ return !!resolvedLib && equalityComparer(file.fileName, resolvedLib.actual);
+ });
}
}
function getTypeChecker() {
return typeChecker || (typeChecker = createTypeChecker(program));
}
- function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit) {
+ function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit, skipBuildInfo) {
var _a2, _b2;
(_a2 = tracing) == null ? void 0 : _a2.push(
tracing.Phase.Emit,
@@ -125281,14 +125978,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
/*separateBeginAndEnd*/
true
);
- const result = runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit));
+ const result = runWithCancellationToken(
+ () => emitWorker(
+ program,
+ sourceFile,
+ writeFileCallback,
+ cancellationToken,
+ emitOnly,
+ transformers,
+ forceDtsEmit,
+ skipBuildInfo
+ )
+ );
(_b2 = tracing) == null ? void 0 : _b2.pop();
return result;
}
function isEmitBlocked(emitFileName) {
return hasEmitBlockingDiagnostics.has(toPath3(emitFileName));
}
- function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit) {
+ function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit, skipBuildInfo) {
if (!forceDtsEmit) {
const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
if (result) return result;
@@ -125310,7 +126018,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
emitOnly,
/*onlyBuildInfo*/
false,
- forceDtsEmit
+ forceDtsEmit,
+ skipBuildInfo
)
);
mark("afterEmit");
@@ -125337,15 +126046,23 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
function getSyntacticDiagnostics(sourceFile, cancellationToken) {
return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
}
- function getSemanticDiagnostics(sourceFile, cancellationToken) {
- return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);
+ function getSemanticDiagnostics(sourceFile, cancellationToken, nodesToCheck) {
+ return getDiagnosticsHelper(
+ sourceFile,
+ (sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
+ cancellationToken
+ );
}
function getCachedSemanticDiagnostics(sourceFile) {
- var _a2;
- return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
+ return cachedBindAndCheckDiagnosticsForFile == null ? void 0 : cachedBindAndCheckDiagnosticsForFile.get(sourceFile.path);
}
function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
- return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken);
+ return getBindAndCheckDiagnosticsForFile(
+ sourceFile,
+ cancellationToken,
+ /*nodesToCheck*/
+ void 0
+ );
}
function getProgramDiagnostics(sourceFile) {
var _a2;
@@ -125359,12 +126076,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics;
}
function getDeclarationDiagnostics2(sourceFile, cancellationToken) {
- const options2 = program.getCompilerOptions();
- if (!sourceFile || options2.outFile) {
- return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
- } else {
- return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
- }
+ return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
}
function getSyntacticDiagnosticsForFile(sourceFile) {
if (isSourceFileJS(sourceFile)) {
@@ -125385,16 +126097,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
throw e;
}
}
- function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
+ function getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
return concatenate(
- filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
+ filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options),
getProgramDiagnostics(sourceFile)
);
}
- function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
- return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
+ function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
+ if (nodesToCheck) {
+ return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
+ }
+ let result = cachedBindAndCheckDiagnosticsForFile == null ? void 0 : cachedBindAndCheckDiagnosticsForFile.get(sourceFile.path);
+ if (!result) {
+ (cachedBindAndCheckDiagnosticsForFile ?? (cachedBindAndCheckDiagnosticsForFile = /* @__PURE__ */ new Map())).set(
+ sourceFile.path,
+ result = getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken)
+ );
+ }
+ return result;
}
- function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
+ function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
return runWithCancellationToken(() => {
if (skipTypeChecking(sourceFile, options, program)) {
return emptyArray;
@@ -125402,24 +126124,34 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
const typeChecker2 = getTypeChecker();
Debug.assert(!!sourceFile.bindDiagnostics);
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
- const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
+ const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
let bindDiagnostics = sourceFile.bindDiagnostics;
- let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
+ let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken, nodesToCheck);
if (isPlainJs) {
bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
}
- return getMergedBindAndCheckDiagnostics(sourceFile, !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
+ return getMergedBindAndCheckDiagnostics(
+ sourceFile,
+ !isPlainJs,
+ !!nodesToCheck,
+ bindDiagnostics,
+ checkDiagnostics,
+ isCheckJs ? sourceFile.jsDocDiagnostics : void 0
+ );
});
}
- function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
+ function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, partialCheck, ...allDiagnostics) {
var _a2;
const flatDiagnostics = flatten(allDiagnostics);
if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
return flatDiagnostics;
}
const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
+ if (partialCheck) {
+ return diagnostics;
+ }
for (const errorExpectation of directives.getUnusedExpectations()) {
diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
}
@@ -125447,7 +126179,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
return line;
}
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
- if (lineText !== "" && !/^(\s*)\/\/(.*)$/.test(lineText)) {
+ if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
return -1;
}
line--;
@@ -125670,7 +126402,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
});
}
function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {
- return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache);
+ let result = cachedDeclarationDiagnosticsForFile == null ? void 0 : cachedDeclarationDiagnosticsForFile.get(sourceFile.path);
+ if (!result) {
+ (cachedDeclarationDiagnosticsForFile ?? (cachedDeclarationDiagnosticsForFile = /* @__PURE__ */ new Map())).set(
+ sourceFile.path,
+ result = getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken)
+ );
+ }
+ return result;
}
function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
return runWithCancellationToken(() => {
@@ -125678,22 +126417,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
return getDeclarationDiagnostics(getEmitHost(noop), resolver, sourceFile) || emptyArray;
});
}
- function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics2) {
- var _a2;
- const cachedResult = sourceFile ? (_a2 = cache.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cache.allDiagnostics;
- if (cachedResult) {
- return cachedResult;
- }
- const result = getDiagnostics2(sourceFile, cancellationToken);
- if (sourceFile) {
- (cache.perFile || (cache.perFile = /* @__PURE__ */ new Map())).set(sourceFile.path, result);
- } else {
- cache.allDiagnostics = result;
- }
- return result;
- }
function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
- return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
+ return sourceFile.isDeclarationFile ? emptyArray : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
}
function getOptionsDiagnostics() {
return sortAndDeduplicateDiagnostics(concatenate(
@@ -126240,10 +126965,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
const resolvedTypeReferenceDirective = resolutions[index];
const fileName = ref.fileName;
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
- const mode = ref.resolutionMode || file.impliedNodeFormat;
+ const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
}
}
+ function getCompilerOptionsForFile(file) {
+ var _a2;
+ return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
+ }
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
var _a2, _b2;
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
@@ -126344,13 +127073,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
return host.getCanonicalFileName(fileName);
}
function processImportedModules(file) {
- var _a2;
collectExternalModuleReferences(file);
if (file.imports.length || file.moduleAugmentations.length) {
const moduleNames = getModuleNames(file);
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
Debug.assert(resolutions.length === moduleNames.length);
- const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
+ const optionsForFile = getCompilerOptionsForFile(file);
const resolutionsInFile = createModeAwareCache();
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
for (let index = 0; index < moduleNames.length; index++) {
@@ -126515,8 +127243,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
const outputFile = options.outFile;
if (options.tsBuildInfoFile) {
- if (!isIncrementalCompilation(options)) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
+ if (!canEmitTsBuildInfo(options)) {
+ createDiagnosticForOptionName(Diagnostics.Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b, "tsBuildInfoFile");
}
} else if (options.incremental && !outputFile && !options.configFilePath) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
@@ -126641,7 +127369,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (options.outDir || // there is --outDir specified
options.rootDir || // there is --rootDir specified
options.sourceRoot || // there is --sourceRoot specified
- options.mapRoot) {
+ options.mapRoot || // there is --mapRoot specified
+ getEmitDeclarations(options) && options.declarationDir) {
const dir = getCommonSourceDirectory2();
if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@@ -126654,14 +127383,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (!getEmitDeclarations(options)) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite");
}
- if (options.noEmit) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
- }
- }
- if (options.noCheck) {
- if (options.noEmit) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
- }
}
if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
@@ -126773,7 +127494,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
return Version.zero;
}
- function checkDeprecations(deprecatedIn, stopsWorkingIn, removedIn, createDiagnostic, fn) {
+ function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) {
const deprecatedInVersion = new Version(deprecatedIn);
const removedInVersion = new Version(removedIn);
const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor);
@@ -126790,9 +127511,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
} else {
if (value === void 0) {
- createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, stopsWorkingIn, deprecatedIn);
+ createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
} else {
- createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, stopsWorkingIn, deprecatedIn);
+ createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
}
}
});
@@ -126828,7 +127549,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
);
}
}
- checkDeprecations("5.0", "5.5", "6.0", createDiagnostic, (createDeprecatedDiagnostic) => {
+ checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
if (options.target === 0 /* ES3 */) {
createDeprecatedDiagnostic("target", "ES3");
}
@@ -126880,7 +127601,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
createDiagnosticForReference(parentFile, index, message, ...args);
}
- checkDeprecations("5.0", "5.5", "6.0", createDiagnostic, (createDeprecatedDiagnostic) => {
+ checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
if (ref.prepend) {
createDeprecatedDiagnostic("prepend");
}
@@ -126906,7 +127627,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
redirectInfo = cachedChain.redirectInfo;
} else {
reasons == null ? void 0 : reasons.forEach(processReason);
- redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
+ redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
}
if (fileProcessingReason) processReason(fileProcessingReason);
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
@@ -127264,13 +127985,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
return symlinks;
}
function getModeForUsageLocation2(file, usage) {
- var _a2;
- const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
- return getModeForUsageLocationWorker(file, usage, optionsForFile);
+ return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
+ }
+ function getEmitSyntaxForUsageLocation(file, usage) {
+ return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
}
function getModeForResolutionAtIndex2(file, index) {
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
}
+ function getDefaultResolutionModeForFile2(sourceFile) {
+ return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
+ }
+ function getImpliedNodeFormatForEmit2(sourceFile) {
+ return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
+ }
+ function getEmitModuleFormatOfFile2(sourceFile) {
+ return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
+ }
+ function shouldTransformImportCall(sourceFile) {
+ return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
+ }
+}
+function shouldTransformImportCallWorker(sourceFile, options) {
+ const moduleKind = getEmitModuleKind(options);
+ if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
+ return false;
+ }
+ return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
+}
+function getEmitModuleFormatOfFileWorker(sourceFile, options) {
+ return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
+}
+function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
+ var _a, _b;
+ const moduleKind = getEmitModuleKind(options);
+ if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
+ return sourceFile.impliedNodeFormat;
+ }
+ if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
+ return 1 /* CommonJS */;
+ }
+ if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
+ return 99 /* ESNext */;
+ }
+ return void 0;
+}
+function getDefaultResolutionModeForFileWorker(sourceFile, options) {
+ return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
}
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
let setOfDeclarationDirectories;
@@ -127398,8 +128159,7 @@ var emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0
function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken) {
const options = program.getCompilerOptions();
if (options.noEmit) {
- program.getSemanticDiagnostics(sourceFile, cancellationToken);
- return sourceFile || options.outFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
+ return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
}
if (!options.noEmitOnError) return void 0;
let diagnostics = [
@@ -127417,7 +128177,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
}
if (!diagnostics.length) return void 0;
let emittedFiles;
- if (!sourceFile && !options.outFile) {
+ if (!sourceFile) {
const emitResult = program.emitBuildInfo(writeFile2, cancellationToken);
if (emitResult.diagnostics) diagnostics = [...diagnostics, ...emitResult.diagnostics];
emittedFiles = emitResult.emittedFiles;
@@ -127740,8 +128500,7 @@ var BuilderState;
);
},
cancellationToken,
- /*emitOnly*/
- true,
+ 2 /* BuilderSignature */,
/*customTransformers*/
void 0,
/*forceDtsEmit*/
@@ -127883,20 +128642,30 @@ var BuilderFileEmit = /* @__PURE__ */ ((BuilderFileEmit2) => {
BuilderFileEmit2[BuilderFileEmit2["Js"] = 1] = "Js";
BuilderFileEmit2[BuilderFileEmit2["JsMap"] = 2] = "JsMap";
BuilderFileEmit2[BuilderFileEmit2["JsInlineMap"] = 4] = "JsInlineMap";
- BuilderFileEmit2[BuilderFileEmit2["Dts"] = 8] = "Dts";
- BuilderFileEmit2[BuilderFileEmit2["DtsMap"] = 16] = "DtsMap";
+ BuilderFileEmit2[BuilderFileEmit2["DtsErrors"] = 8] = "DtsErrors";
+ BuilderFileEmit2[BuilderFileEmit2["DtsEmit"] = 16] = "DtsEmit";
+ BuilderFileEmit2[BuilderFileEmit2["DtsMap"] = 32] = "DtsMap";
+ BuilderFileEmit2[BuilderFileEmit2["Dts"] = 24] = "Dts";
BuilderFileEmit2[BuilderFileEmit2["AllJs"] = 7] = "AllJs";
- BuilderFileEmit2[BuilderFileEmit2["AllDts"] = 24] = "AllDts";
- BuilderFileEmit2[BuilderFileEmit2["All"] = 31] = "All";
+ BuilderFileEmit2[BuilderFileEmit2["AllDtsEmit"] = 48] = "AllDtsEmit";
+ BuilderFileEmit2[BuilderFileEmit2["AllDts"] = 56] = "AllDts";
+ BuilderFileEmit2[BuilderFileEmit2["All"] = 63] = "All";
return BuilderFileEmit2;
})(BuilderFileEmit || {});
+function isBuilderProgramStateWithDefinedProgram(state) {
+ return state.program !== void 0;
+}
+function toBuilderProgramStateWithDefinedProgram(state) {
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
+ return state;
+}
function getBuilderFileEmit(options) {
let result = 1 /* Js */;
if (options.sourceMap) result = result | 2 /* JsMap */;
if (options.inlineSourceMap) result = result | 4 /* JsInlineMap */;
- if (getEmitDeclarations(options)) result = result | 8 /* Dts */;
- if (options.declarationMap) result = result | 16 /* DtsMap */;
- if (options.emitDeclarationOnly) result = result & 24 /* AllDts */;
+ if (getEmitDeclarations(options)) result = result | 24 /* Dts */;
+ if (options.declarationMap) result = result | 32 /* DtsMap */;
+ if (options.emitDeclarationOnly) result = result & 56 /* AllDts */;
return result;
}
function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
@@ -127907,7 +128676,8 @@ function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
const diff = oldEmitKind ^ emitKind;
let result = 0 /* None */;
if (diff & 7 /* AllJs */) result = emitKind & 7 /* AllJs */;
- if (diff & 24 /* AllDts */) result = result | emitKind & 24 /* AllDts */;
+ if (diff & 8 /* DtsErrors */) result = result | emitKind & 8 /* DtsErrors */;
+ if (diff & 48 /* AllDtsEmit */) result = result | emitKind & 48 /* AllDtsEmit */;
return result;
}
function hasSameKeys(map1, map2) {
@@ -127925,17 +128695,18 @@ function createBuilderProgramState(newProgram, oldState) {
const compilerOptions = newProgram.getCompilerOptions();
state.compilerOptions = compilerOptions;
const outFilePath = compilerOptions.outFile;
- if (!outFilePath) {
- state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
- } else if (compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
+ state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
+ if (outFilePath && compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
state.outSignature = oldState.outSignature && getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldState.outSignature);
}
state.changedFilesSet = /* @__PURE__ */ new Set();
state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
+ state.checkPending = state.compilerOptions.noCheck ? true : void 0;
const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
- const canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
+ let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
const canCopyEmitSignatures = compilerOptions.composite && (oldState == null ? void 0 : oldState.emitSignatures) && !outFilePath && !compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
+ let canCopyEmitDiagnostics = true;
if (useOldState) {
(_a = oldState.changedFilesSet) == null ? void 0 : _a.forEach((value) => state.changedFilesSet.add(value));
if (!outFilePath && ((_b = oldState.affectedFilesPendingEmit) == null ? void 0 : _b.size)) {
@@ -127943,8 +128714,13 @@ function createBuilderProgramState(newProgram, oldState) {
state.seenAffectedFiles = /* @__PURE__ */ new Set();
}
state.programEmitPending = oldState.programEmitPending;
+ if (outFilePath && state.changedFilesSet.size) {
+ canCopySemanticDiagnostics = false;
+ canCopyEmitDiagnostics = false;
+ }
+ state.hasErrorsFromOldState = oldState.hasErrors;
} else {
- state.buildInfoEmitPending = true;
+ state.buildInfoEmitPending = isIncrementalCompilation(compilerOptions);
}
const referencedMap = state.referencedMap;
const oldReferencedMap = useOldState ? oldState.referencedMap : void 0;
@@ -127960,10 +128736,10 @@ function createBuilderProgramState(newProgram, oldState) {
oldInfo.impliedFormat !== info.impliedFormat || // Referenced files changed
!hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
- addFileToChangeSet(state, sourceFilePath);
+ addFileToChangeSet(sourceFilePath);
} else {
const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
- const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
+ const emitDiagnostics = canCopyEmitDiagnostics ? (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath) : void 0;
if (emitDiagnostics) {
(state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
sourceFilePath,
@@ -127992,16 +128768,16 @@ function createBuilderProgramState(newProgram, oldState) {
});
if (useOldState && forEachEntry(oldState.fileInfos, (info, sourceFilePath) => {
if (state.fileInfos.has(sourceFilePath)) return false;
- if (outFilePath || info.affectsGlobalScope) return true;
+ if (info.affectsGlobalScope) return true;
state.buildInfoEmitPending = true;
- return false;
+ return !!outFilePath;
})) {
BuilderState.getAllFilesExcludingDefaultLibraryFile(
state,
newProgram,
/*firstSourceFile*/
void 0
- ).forEach((file) => addFileToChangeSet(state, file.resolvedPath));
+ ).forEach((file) => addFileToChangeSet(file.resolvedPath));
} else if (oldCompilerOptions) {
const pendingEmitKind = compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions) ? getBuilderFileEmit(compilerOptions) : getPendingEmitKind(compilerOptions, oldCompilerOptions);
if (pendingEmitKind !== 0 /* None */) {
@@ -128017,18 +128793,26 @@ function createBuilderProgramState(newProgram, oldState) {
});
Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
state.seenAffectedFiles = state.seenAffectedFiles || /* @__PURE__ */ new Set();
- state.buildInfoEmitPending = true;
- } else {
+ } else if (!state.changedFilesSet.size) {
state.programEmitPending = state.programEmitPending ? state.programEmitPending | pendingEmitKind : pendingEmitKind;
}
+ state.buildInfoEmitPending = true;
}
}
+ if (useOldState && state.semanticDiagnosticsPerFile.size !== state.fileInfos.size && oldState.checkPending !== state.checkPending) state.buildInfoEmitPending = true;
return state;
-}
-function addFileToChangeSet(state, path) {
- state.changedFilesSet.add(path);
- state.buildInfoEmitPending = true;
- state.programEmitPending = void 0;
+ function addFileToChangeSet(path) {
+ state.changedFilesSet.add(path);
+ if (outFilePath) {
+ canCopySemanticDiagnostics = false;
+ canCopyEmitDiagnostics = false;
+ state.semanticDiagnosticsFromOldState = void 0;
+ state.semanticDiagnosticsPerFile.clear();
+ state.emitDiagnosticsPerFile = void 0;
+ }
+ state.buildInfoEmitPending = true;
+ state.programEmitPending = void 0;
+ }
}
function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature) {
return !!options.declarationMap === !!oldOptions.declarationMap ? (
@@ -128052,7 +128836,12 @@ function repopulateDiagnostics(diagnostics, newProgram) {
}
function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
const info = repopulateInfo(chain);
- if (info) {
+ if (info === true) {
+ return {
+ ...createModeMismatchDetails(sourceFile),
+ next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
+ };
+ } else if (info) {
return {
...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
@@ -128095,34 +128884,6 @@ function releaseCache(state) {
BuilderState.releaseCache(state);
state.program = void 0;
}
-function backupBuilderProgramEmitState(state) {
- const outFilePath = state.compilerOptions.outFile;
- Debug.assert(!state.changedFilesSet.size || outFilePath);
- return {
- affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
- seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
- programEmitPending: state.programEmitPending,
- emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
- outSignature: state.outSignature,
- latestChangedDtsFile: state.latestChangedDtsFile,
- hasChangedEmitSignature: state.hasChangedEmitSignature,
- changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
- buildInfoEmitPending: state.buildInfoEmitPending,
- emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
- };
-}
-function restoreBuilderProgramEmitState(state, savedEmitState) {
- state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
- state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
- state.programEmitPending = savedEmitState.programEmitPending;
- state.emitSignatures = savedEmitState.emitSignatures;
- state.outSignature = savedEmitState.outSignature;
- state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
- state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
- state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
- state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
- if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
-}
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
}
@@ -128137,7 +128898,11 @@ function getNextAffectedFile(state, cancellationToken, host) {
const affectedFile = affectedFiles[affectedFilesIndex];
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
state.affectedFilesIndex = affectedFilesIndex;
- addToAffectedFilesPendingEmit(state, affectedFile.resolvedPath, getBuilderFileEmit(state.compilerOptions));
+ addToAffectedFilesPendingEmit(
+ state,
+ affectedFile.resolvedPath,
+ getBuilderFileEmit(state.compilerOptions)
+ );
handleDtsMayChangeOfAffectedFile(
state,
affectedFile,
@@ -128157,15 +128922,11 @@ function getNextAffectedFile(state, cancellationToken, host) {
if (nextKey.done) {
return void 0;
}
- const program = Debug.checkDefined(state.program);
- const compilerOptions = program.getCompilerOptions();
- if (compilerOptions.outFile) {
- Debug.assert(!state.semanticDiagnosticsPerFile);
- return program;
- }
+ const compilerOptions = state.program.getCompilerOptions();
+ if (compilerOptions.outFile) return state.program;
state.affectedFiles = BuilderState.getFilesAffectedByWithOldState(
state,
- program,
+ state.program,
nextKey.value,
cancellationToken,
host
@@ -128175,17 +128936,34 @@ function getNextAffectedFile(state, cancellationToken, host) {
if (!state.seenAffectedFiles) state.seenAffectedFiles = /* @__PURE__ */ new Set();
}
}
-function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
- var _a;
- if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return;
- if (!emitOnlyDtsFiles) return state.affectedFilesPendingEmit = void 0;
- state.affectedFilesPendingEmit.forEach((emitKind, path) => {
- const pending = emitKind & 7 /* AllJs */;
+function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, isForDtsErrors) {
+ var _a, _b;
+ if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
+ if (!emitOnlyDtsFiles && !isForDtsErrors) {
+ state.affectedFilesPendingEmit = void 0;
+ state.programEmitPending = void 0;
+ }
+ (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
+ const pending = !isForDtsErrors ? emitKind & 7 /* AllJs */ : emitKind & (7 /* AllJs */ | 48 /* AllDtsEmit */);
if (!pending) state.affectedFilesPendingEmit.delete(path);
else state.affectedFilesPendingEmit.set(path, pending);
});
+ if (state.programEmitPending) {
+ const pending = !isForDtsErrors ? state.programEmitPending & 7 /* AllJs */ : state.programEmitPending & (7 /* AllJs */ | 48 /* AllDtsEmit */);
+ if (!pending) state.programEmitPending = void 0;
+ else state.programEmitPending = pending;
+ }
}
-function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
+function getPendingEmitKindWithSeen(optionsOrEmitKind, seenOldOptionsOrEmitKind, emitOnlyDtsFiles, isForDtsErrors) {
+ let pendingKind = getPendingEmitKind(optionsOrEmitKind, seenOldOptionsOrEmitKind);
+ if (emitOnlyDtsFiles) pendingKind = pendingKind & 56 /* AllDts */;
+ if (isForDtsErrors) pendingKind = pendingKind & 8 /* DtsErrors */;
+ return pendingKind;
+}
+function getBuilderFileEmitAllDts(isForDtsErrors) {
+ return !isForDtsErrors ? 56 /* AllDts */ : 8 /* DtsErrors */;
+}
+function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles, isForDtsErrors) {
var _a;
if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return void 0;
return forEachEntry(state.affectedFilesPendingEmit, (emitKind, path) => {
@@ -128196,12 +128974,16 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
return void 0;
}
const seenKind = (_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath);
- let pendingKind = getPendingEmitKind(emitKind, seenKind);
- if (emitOnlyDtsFiles) pendingKind = pendingKind & 24 /* AllDts */;
+ const pendingKind = getPendingEmitKindWithSeen(
+ emitKind,
+ seenKind,
+ emitOnlyDtsFiles,
+ isForDtsErrors
+ );
if (pendingKind) return { affectedFile, emitKind: pendingKind };
});
}
-function getNextPendingEmitDiagnosticsFile(state) {
+function getNextPendingEmitDiagnosticsFile(state, isForDtsErrors) {
var _a;
if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) return void 0;
return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
@@ -128212,15 +128994,14 @@ function getNextPendingEmitDiagnosticsFile(state) {
return void 0;
}
const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
- if (!(seenKind & 24 /* AllDts */)) return { affectedFile, diagnostics, seenKind };
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) return { affectedFile, diagnostics, seenKind };
});
}
function removeDiagnosticsOfLibraryFiles(state) {
if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
- const program = Debug.checkDefined(state.program);
- const options = program.getCompilerOptions();
- forEach(program.getSourceFiles(), (f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
+ const options = state.program.getCompilerOptions();
+ forEach(state.program.getSourceFiles(), (f) => state.program.isSourceFileDefaultLibrary(f) && !skipTypeCheckingIgnoringNoCheck(f, options, state.program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
}
}
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
@@ -128229,7 +129010,7 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
removeDiagnosticsOfLibraryFiles(state);
BuilderState.updateShapeSignature(
state,
- Debug.checkDefined(state.program),
+ state.program,
affectedFile,
cancellationToken,
host
@@ -128247,12 +129028,11 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken, host) {
removeSemanticDiagnosticsOf(state, path);
if (!state.changedFilesSet.has(path)) {
- const program = Debug.checkDefined(state.program);
- const sourceFile = program.getSourceFileByPath(path);
+ const sourceFile = state.program.getSourceFileByPath(path);
if (sourceFile) {
BuilderState.updateShapeSignature(
state,
- program,
+ state.program,
sourceFile,
cancellationToken,
host,
@@ -128260,9 +129040,17 @@ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken,
true
);
if (invalidateJsFiles) {
- addToAffectedFilesPendingEmit(state, path, getBuilderFileEmit(state.compilerOptions));
+ addToAffectedFilesPendingEmit(
+ state,
+ path,
+ getBuilderFileEmit(state.compilerOptions)
+ );
} else if (getEmitDeclarations(state.compilerOptions)) {
- addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */);
+ addToAffectedFilesPendingEmit(
+ state,
+ path,
+ state.compilerOptions.declarationMap ? 56 /* AllDts */ : 24 /* Dts */
+ );
}
}
}
@@ -128329,7 +129117,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
host
);
if (isChangedSignature(state, currentPath)) {
- const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
+ const currentSourceFile = state.program.getSourceFileByPath(currentPath);
queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
}
}
@@ -128375,38 +129163,79 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
);
return void 0;
}
-function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
+function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
+ if (state.compilerOptions.noCheck) return emptyArray;
return concatenate(
- getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken),
- Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile)
+ getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
+ state.program.getProgramDiagnostics(sourceFile)
);
}
-function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
+function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
+ semanticDiagnosticsPerFile ?? (semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile);
const path = sourceFile.resolvedPath;
- if (state.semanticDiagnosticsPerFile) {
- const cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path);
- if (cachedDiagnostics) {
- return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
- }
- }
- const diagnostics = Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
- if (state.semanticDiagnosticsPerFile) {
- state.semanticDiagnosticsPerFile.set(path, diagnostics);
+ const cachedDiagnostics = semanticDiagnosticsPerFile.get(path);
+ if (cachedDiagnostics) {
+ return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
}
+ const diagnostics = state.program.getBindAndCheckDiagnostics(sourceFile, cancellationToken);
+ semanticDiagnosticsPerFile.set(path, diagnostics);
+ state.buildInfoEmitPending = true;
return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
}
-function isProgramBundleEmitBuildInfo(info) {
+function isIncrementalBundleEmitBuildInfo(info) {
var _a;
return !!((_a = info.options) == null ? void 0 : _a.outFile);
}
+function isIncrementalBuildInfo(info) {
+ return !!info.fileNames;
+}
+function isNonIncrementalBuildInfo(info) {
+ return !isIncrementalBuildInfo(info) && !!info.root;
+}
+function ensureHasErrorsForState(state) {
+ if (state.hasErrors !== void 0) return;
+ if (isIncrementalCompilation(state.compilerOptions)) {
+ state.hasErrors = !some(state.program.getSourceFiles(), (f) => {
+ var _a, _b;
+ const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
+ return bindAndCheckDiagnostics === void 0 || // Missing semantic diagnostics in cache will be encoded in buildInfo
+ !!bindAndCheckDiagnostics.length || // cached semantic diagnostics will be encoded in buildInfo
+ !!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
+ }) && (hasSyntaxOrGlobalErrors(state) || some(state.program.getSourceFiles(), (f) => !!state.program.getProgramDiagnostics(f).length));
+ } else {
+ state.hasErrors = some(state.program.getSourceFiles(), (f) => {
+ var _a, _b;
+ const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
+ return !!(bindAndCheckDiagnostics == null ? void 0 : bindAndCheckDiagnostics.length) || // If has semantic diagnostics
+ !!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
+ }) || hasSyntaxOrGlobalErrors(state);
+ }
+}
+function hasSyntaxOrGlobalErrors(state) {
+ return !!state.program.getConfigFileParsingDiagnostics().length || !!state.program.getSyntacticDiagnostics().length || !!state.program.getOptionsDiagnostics().length || !!state.program.getGlobalDiagnostics().length;
+}
+function getBuildInfoEmitPending(state) {
+ ensureHasErrorsForState(state);
+ return state.buildInfoEmitPending ?? (state.buildInfoEmitPending = !!state.hasErrorsFromOldState !== !!state.hasErrors);
+}
function getBuildInfo2(state) {
var _a, _b;
- const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory();
+ const currentDirectory = state.program.getCurrentDirectory();
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
const fileNames = [];
const fileNameToFileId = /* @__PURE__ */ new Map();
const rootFileNames = new Set(state.program.getRootFileNames().map((f) => toPath(f, currentDirectory, state.program.getCanonicalFileName)));
+ ensureHasErrorsForState(state);
+ if (!isIncrementalCompilation(state.compilerOptions)) {
+ const buildInfo2 = {
+ root: arrayFrom(rootFileNames, (r) => relativeToBuildInfo(r)),
+ errors: state.hasErrors ? true : void 0,
+ checkPending: state.checkPending,
+ version
+ };
+ return buildInfo2;
+ }
const root = [];
if (state.compilerOptions.outFile) {
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
@@ -128414,12 +129243,15 @@ function getBuildInfo2(state) {
tryAddRoot(key, fileId);
return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
});
- const program2 = {
+ const buildInfo2 = {
fileNames,
fileInfos: fileInfos2,
root,
resolvedRoot: toResolvedRoot(),
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
+ options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
+ semanticDiagnosticsPerFile: !state.changedFilesSet.size ? toIncrementalBuildInfoDiagnostics() : void 0,
+ emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
+ changeFileSet: toChangeFileSet(),
outSignature: state.outSignature,
latestChangedDtsFile,
pendingEmit: !state.programEmitPending ? void 0 : (
@@ -128428,10 +129260,13 @@ function getBuildInfo2(state) {
// Pending emit is same as deteremined by compilerOptions
state.programEmitPending
)
- )
+ ),
// Actual value
+ errors: state.hasErrors ? true : void 0,
+ checkPending: state.checkPending,
+ version
};
- return createBuildInfo(program2);
+ return buildInfo2;
}
let fileIdsList;
let fileNamesToFileIdListId;
@@ -128486,7 +129321,7 @@ function getBuildInfo2(state) {
toFileIdListId(state.referencedMap.getValues(key))
]);
}
- const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics();
+ const semanticDiagnosticsPerFile = toIncrementalBuildInfoDiagnostics();
let affectedFilesPendingEmit;
if ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.size) {
const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -128500,7 +129335,7 @@ function getBuildInfo2(state) {
affectedFilesPendingEmit,
pendingEmit === fullEmitForOptions ? fileId : (
// Pending full emit per options
- pendingEmit === 8 /* Dts */ ? [fileId] : (
+ pendingEmit === 24 /* Dts */ ? [fileId] : (
// Pending on Dts only
[fileId, pendingEmit]
)
@@ -128510,29 +129345,25 @@ function getBuildInfo2(state) {
}
}
}
- let changeFileSet;
- if (state.changedFilesSet.size) {
- for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
- changeFileSet = append(changeFileSet, toFileId(path));
- }
- }
- const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
- const program = {
+ const buildInfo = {
fileNames,
+ fileIdsList,
fileInfos,
root,
resolvedRoot: toResolvedRoot(),
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
- fileIdsList,
+ options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
referencedMap,
semanticDiagnosticsPerFile,
- emitDiagnosticsPerFile,
+ emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
+ changeFileSet: toChangeFileSet(),
affectedFilesPendingEmit,
- changeFileSet,
emitSignatures,
- latestChangedDtsFile
+ latestChangedDtsFile,
+ errors: state.hasErrors ? true : void 0,
+ checkPending: state.checkPending,
+ version
};
- return createBuildInfo(program);
+ return buildInfo;
function relativeToBuildInfoEnsuringAbsolutePath(path) {
return relativeToBuildInfo(getNormalizedAbsolutePath(path, currentDirectory));
}
@@ -128580,13 +129411,13 @@ function getBuildInfo2(state) {
});
return result;
}
- function convertToProgramBuildInfoCompilerOptions(options) {
+ function toIncrementalBuildInfoCompilerOptions(options) {
let result;
const { optionsNameMap } = getOptionsNameMap();
for (const name of getOwnKeys(options).sort(compareStringsCaseSensitive)) {
const optionInfo = optionsNameMap.get(name.toLowerCase());
if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
+ (result || (result = {}))[name] = toReusableCompilerOptionValue(
optionInfo,
options[name]
);
@@ -128594,7 +129425,7 @@ function getBuildInfo2(state) {
}
return result;
}
- function convertToReusableCompilerOptionValue(option, value) {
+ function toReusableCompilerOptionValue(option, value) {
if (option) {
Debug.assert(option.type !== "listOrElement");
if (option.type === "list") {
@@ -128608,23 +129439,22 @@ function getBuildInfo2(state) {
}
return value;
}
- function convertToProgramBuildInfoDiagnostics() {
+ function toIncrementalBuildInfoDiagnostics() {
let result;
state.fileInfos.forEach((_value, key) => {
- var _a2;
- const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
+ const value = state.semanticDiagnosticsPerFile.get(key);
if (!value) {
if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
} else if (value.length) {
result = append(result, [
toFileId(key),
- convertToReusableDiagnostics(value, key)
+ toReusableDiagnostic(value, key)
]);
}
});
return result;
}
- function convertToProgramBuildInfoEmitDiagnostics() {
+ function toIncrementalBuildInfoEmitDiagnostics() {
var _a2;
let result;
if (!((_a2 = state.emitDiagnosticsPerFile) == null ? void 0 : _a2.size)) return result;
@@ -128632,55 +129462,64 @@ function getBuildInfo2(state) {
const value = state.emitDiagnosticsPerFile.get(key);
result = append(result, [
toFileId(key),
- convertToReusableDiagnostics(value, key)
+ toReusableDiagnostic(value, key)
]);
}
return result;
}
- function convertToReusableDiagnostics(diagnostics, diagnosticFilePath) {
+ function toReusableDiagnostic(diagnostics, diagnosticFilePath) {
Debug.assert(!!diagnostics.length);
return diagnostics.map((diagnostic) => {
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
+ const result = toReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
result.reportDeprecated = diagnostic.reportsDeprecated;
result.source = diagnostic.source;
result.skippedOn = diagnostic.skippedOn;
const { relatedInformation } = diagnostic;
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => toReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
return result;
});
}
- function convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
+ function toReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
const { file } = diagnostic;
return {
...diagnostic,
file: file ? file.resolvedPath === diagnosticFilePath ? void 0 : relativeToBuildInfo(file.resolvedPath) : false,
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : toReusableDiagnosticMessageChain(diagnostic.messageText)
};
}
- function convertToReusableDiagnosticMessageChain(chain) {
+ function toReusableDiagnosticMessageChain(chain) {
if (chain.repopulateInfo) {
return {
info: chain.repopulateInfo(),
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
+ next: toReusableDiagnosticMessageChainArray(chain.next)
};
}
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
+ const next = toReusableDiagnosticMessageChainArray(chain.next);
return next === chain.next ? chain : { ...chain, next };
}
- function convertToReusableDiagnosticMessageChainArray(array) {
+ function toReusableDiagnosticMessageChainArray(array) {
if (!array) return array;
return forEach(array, (chain, index) => {
- const reusable = convertToReusableDiagnosticMessageChain(chain);
+ const reusable = toReusableDiagnosticMessageChain(chain);
if (chain === reusable) return void 0;
const result = index > 0 ? array.slice(0, index - 1) : [];
result.push(reusable);
for (let i = index + 1; i < array.length; i++) {
- result.push(convertToReusableDiagnosticMessageChain(array[i]));
+ result.push(toReusableDiagnosticMessageChain(array[i]));
}
return result;
}) || array;
}
+ function toChangeFileSet() {
+ let changeFileSet;
+ if (state.changedFilesSet.size) {
+ for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
+ changeFileSet = append(changeFileSet, toFileId(path));
+ }
+ }
+ return changeFileSet;
+ }
}
var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -128744,25 +129583,27 @@ function computeSignature(text, host, data) {
return (host.createHash ?? generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
}
function createBuilderProgram(kind, { newProgram, host, oldProgram, configFileParsingDiagnostics }) {
- let oldState = oldProgram && oldProgram.getState();
+ let oldState = oldProgram && oldProgram.state;
if (oldState && newProgram === oldState.program && configFileParsingDiagnostics === newProgram.getConfigFileParsingDiagnostics()) {
newProgram = void 0;
oldState = void 0;
return oldProgram;
}
const state = createBuilderProgramState(newProgram, oldState);
- newProgram.getBuildInfo = () => getBuildInfo2(state);
+ newProgram.getBuildInfo = () => getBuildInfo2(toBuilderProgramStateWithDefinedProgram(state));
newProgram = void 0;
oldProgram = void 0;
oldState = void 0;
- const getState = () => state;
- const builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
- builderProgram.getState = getState;
- builderProgram.saveEmitState = () => backupBuilderProgramEmitState(state);
- builderProgram.restoreEmitState = (saved) => restoreBuilderProgramEmitState(state, saved);
+ const builderProgram = createRedirectedBuilderProgram(state, configFileParsingDiagnostics);
+ builderProgram.state = state;
builderProgram.hasChangedEmitSignature = () => !!state.hasChangedEmitSignature;
- builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(state, Debug.checkDefined(state.program), sourceFile);
+ builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
+ state,
+ Debug.checkDefined(state.program),
+ sourceFile
+ );
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
+ builderProgram.getDeclarationDiagnostics = getDeclarationDiagnostics2;
builderProgram.emit = emit;
builderProgram.releaseProgram = () => releaseCache(state);
if (kind === 0 /* SemanticDiagnosticsBuilderProgram */) {
@@ -128776,76 +129617,145 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
}
return builderProgram;
function emitBuildInfo(writeFile2, cancellationToken) {
- if (state.buildInfoEmitPending) {
- const result = Debug.checkDefined(state.program).emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
+ if (getBuildInfoEmitPending(state)) {
+ const result = state.program.emitBuildInfo(
+ writeFile2 || maybeBind(host, host.writeFile),
+ cancellationToken
+ );
state.buildInfoEmitPending = false;
return result;
}
return emitSkippedWithNoDiagnostics;
}
- function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
- var _a, _b, _c;
+ function emitNextAffectedFileOrDtsErrors(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers, isForDtsErrors) {
+ var _a, _b, _c, _d;
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
let affected = getNextAffectedFile(state, cancellationToken, host);
const programEmitKind = getBuilderFileEmit(state.compilerOptions);
- let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
+ let emitKind = !isForDtsErrors ? emitOnlyDtsFiles ? programEmitKind & 56 /* AllDts */ : programEmitKind : 8 /* DtsErrors */;
if (!affected) {
if (!state.compilerOptions.outFile) {
- const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
- if (!pendingAffectedFile) {
- const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
+ const pendingAffectedFile = getNextAffectedFilePendingEmit(
+ state,
+ emitOnlyDtsFiles,
+ isForDtsErrors
+ );
+ if (pendingAffectedFile) {
+ ({ affectedFile: affected, emitKind } = pendingAffectedFile);
+ } else {
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(
+ state,
+ isForDtsErrors
+ );
if (pendingForDiagnostics) {
- (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(
+ pendingForDiagnostics.affectedFile.resolvedPath,
+ pendingForDiagnostics.seenKind | getBuilderFileEmitAllDts(isForDtsErrors)
+ );
return {
result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
affected: pendingForDiagnostics.affectedFile
};
}
- if (!state.buildInfoEmitPending) return void 0;
- const affected2 = state.program;
- const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
- state.buildInfoEmitPending = false;
- return { result: result2, affected: affected2 };
}
- ({ affectedFile: affected, emitKind } = pendingAffectedFile);
} else {
- if (!state.programEmitPending) return void 0;
- emitKind = state.programEmitPending;
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
- if (!emitKind) return void 0;
- affected = state.program;
+ if (state.programEmitPending) {
+ emitKind = getPendingEmitKindWithSeen(
+ state.programEmitPending,
+ state.seenProgramEmit,
+ emitOnlyDtsFiles,
+ isForDtsErrors
+ );
+ if (emitKind) affected = state.program;
+ }
+ if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
+ const seenKind = state.seenProgramEmit || 0 /* None */;
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) {
+ state.seenProgramEmit = getBuilderFileEmitAllDts(isForDtsErrors) | seenKind;
+ const diagnostics = [];
+ state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
+ return {
+ result: { emitSkipped: true, diagnostics },
+ affected: state.program
+ };
+ }
+ }
+ }
+ if (!affected) {
+ if (isForDtsErrors || !getBuildInfoEmitPending(state)) return void 0;
+ const affected2 = state.program;
+ const result2 = affected2.emitBuildInfo(
+ writeFile2 || maybeBind(host, host.writeFile),
+ cancellationToken
+ );
+ state.buildInfoEmitPending = false;
+ return { result: result2, affected: affected2 };
}
}
let emitOnly;
if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
- if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
- if (affected === state.program) {
- state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
- }
- const result = state.program.emit(
+ if (emitKind & 56 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
+ const result = !isForDtsErrors ? state.program.emit(
affected === state.program ? void 0 : affected,
getWriteFileCallback(writeFile2, customTransformers),
cancellationToken,
emitOnly,
- customTransformers
- );
+ customTransformers,
+ /*forceDtsEmit*/
+ void 0,
+ /*skipBuildInfo*/
+ true
+ ) : {
+ emitSkipped: true,
+ diagnostics: state.program.getDeclarationDiagnostics(
+ affected === state.program ? void 0 : affected,
+ cancellationToken
+ )
+ };
if (affected !== state.program) {
const affectedSourceFile = affected;
state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
if (state.affectedFilesIndex !== void 0) state.affectedFilesIndex++;
state.buildInfoEmitPending = true;
- const existing = ((_a = state.seenEmittedFiles) == null ? void 0 : _a.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
+ const existing = ((_b = state.seenEmittedFiles) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
(state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, emitKind | existing);
- const existingPending = ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || programEmitKind;
+ const existingPending = ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.get(affectedSourceFile.resolvedPath)) || programEmitKind;
const pendingKind = getPendingEmitKind(existingPending, emitKind | existing);
if (pendingKind) (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
- else (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
+ else (_d = state.affectedFilesPendingEmit) == null ? void 0 : _d.delete(affectedSourceFile.resolvedPath);
if (result.diagnostics.length) (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
} else {
state.changedFilesSet.clear();
+ state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
+ state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
+ setEmitDiagnosticsPerFile(result.diagnostics);
+ state.buildInfoEmitPending = true;
}
return { result, affected };
}
+ function setEmitDiagnosticsPerFile(diagnostics) {
+ let emitDiagnosticsPerFile;
+ diagnostics.forEach((d) => {
+ if (!d.file) return;
+ let diagnostics2 = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
+ if (!diagnostics2) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics2 = []);
+ diagnostics2.push(d);
+ });
+ if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
+ }
+ function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
+ return emitNextAffectedFileOrDtsErrors(
+ writeFile2,
+ cancellationToken,
+ emitOnlyDtsFiles,
+ customTransformers,
+ /*isForDtsErrors*/
+ false
+ );
+ }
function getWriteFileCallback(writeFile2, customTransformers) {
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
if (!getEmitDeclarations(state.compilerOptions)) return writeFile2 || maybeBind(host, host.writeFile);
return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
var _a, _b, _c;
@@ -128880,7 +129790,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
if (state.compilerOptions.composite) {
const filePath = sourceFiles[0].resolvedPath;
emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
- if (!emitSignature) return;
+ if (!emitSignature) return data.skippedDtsWrite = true;
(state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
}
} else if (state.compilerOptions.composite) {
@@ -128889,7 +129799,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
/*newSignature*/
void 0
);
- if (!newSignature) return;
+ if (!newSignature) return data.skippedDtsWrite = true;
state.outSignature = newSignature;
}
}
@@ -128912,6 +129822,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
};
}
function emit(targetSourceFile, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
if (kind === 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
}
@@ -128924,7 +129835,12 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
let diagnostics;
let emittedFiles = [];
let affectedEmitResult;
- while (affectedEmitResult = emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
+ while (affectedEmitResult = emitNextAffectedFile(
+ writeFile2,
+ cancellationToken,
+ emitOnlyDtsFiles,
+ customTransformers
+ )) {
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics);
emittedFiles = addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
@@ -128937,23 +129853,82 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
sourceMaps
};
} else {
- clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles);
+ clearAffectedFilesPendingEmit(
+ state,
+ emitOnlyDtsFiles,
+ /*isForDtsErrors*/
+ false
+ );
}
}
- return Debug.checkDefined(state.program).emit(
+ const emitResult = state.program.emit(
targetSourceFile,
getWriteFileCallback(writeFile2, customTransformers),
cancellationToken,
emitOnlyDtsFiles,
customTransformers
);
+ handleNonEmitBuilderWithEmitOrDtsErrors(
+ targetSourceFile,
+ emitOnlyDtsFiles,
+ /*isForDtsErrors*/
+ false,
+ emitResult.diagnostics
+ );
+ return emitResult;
+ }
+ function handleNonEmitBuilderWithEmitOrDtsErrors(targetSourceFile, emitOnlyDtsFiles, isForDtsErrors, diagnostics) {
+ if (!targetSourceFile && kind !== 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
+ clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, isForDtsErrors);
+ setEmitDiagnosticsPerFile(diagnostics);
+ }
+ }
+ function getDeclarationDiagnostics2(sourceFile, cancellationToken) {
+ var _a;
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
+ if (kind === 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
+ assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
+ let affectedEmitResult;
+ let diagnostics;
+ while (affectedEmitResult = emitNextAffectedFileOrDtsErrors(
+ /*writeFile*/
+ void 0,
+ cancellationToken,
+ /*emitOnlyDtsFiles*/
+ void 0,
+ /*customTransformers*/
+ void 0,
+ /*isForDtsErrors*/
+ true
+ )) {
+ if (!sourceFile) diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics);
+ }
+ return (!sourceFile ? diagnostics : (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(sourceFile.resolvedPath)) || emptyArray;
+ } else {
+ const result = state.program.getDeclarationDiagnostics(sourceFile, cancellationToken);
+ handleNonEmitBuilderWithEmitOrDtsErrors(
+ sourceFile,
+ /*emitOnlyDtsFiles*/
+ void 0,
+ /*isForDtsErrors*/
+ true,
+ result
+ );
+ return result;
+ }
}
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
while (true) {
const affected = getNextAffectedFile(state, cancellationToken, host);
let result;
- if (!affected) return void 0;
- else if (affected !== state.program) {
+ if (!affected) {
+ if (state.checkPending && !state.compilerOptions.noCheck) {
+ state.checkPending = void 0;
+ state.buildInfoEmitPending = true;
+ }
+ return void 0;
+ } else if (affected !== state.program) {
const affectedSourceFile = affected;
if (!ignoreSourceFile || !ignoreSourceFile(affectedSourceFile)) {
result = getSemanticDiagnosticsOfFile(state, affectedSourceFile, cancellationToken);
@@ -128963,33 +129938,48 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
state.buildInfoEmitPending = true;
if (!result) continue;
} else {
- result = state.program.getSemanticDiagnostics(
- /*sourceFile*/
- void 0,
- cancellationToken
+ let diagnostics;
+ const semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
+ state.program.getSourceFiles().forEach(
+ (sourceFile) => diagnostics = addRange(
+ diagnostics,
+ getSemanticDiagnosticsOfFile(
+ state,
+ sourceFile,
+ cancellationToken,
+ semanticDiagnosticsPerFile
+ )
+ )
);
+ state.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile;
+ result = diagnostics || emptyArray;
state.changedFilesSet.clear();
state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
+ if (!state.compilerOptions.noCheck) state.checkPending = void 0;
+ state.buildInfoEmitPending = true;
}
return { result, affected };
}
}
function getSemanticDiagnostics(sourceFile, cancellationToken) {
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
- const compilerOptions = Debug.checkDefined(state.program).getCompilerOptions();
- if (compilerOptions.outFile) {
- Debug.assert(!state.semanticDiagnosticsPerFile);
- return Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
- }
if (sourceFile) {
return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
}
- while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) {
+ while (true) {
+ const affectedResult = getSemanticDiagnosticsOfNextAffectedFile(cancellationToken);
+ if (!affectedResult) break;
+ if (affectedResult.affected === state.program) return affectedResult.result;
}
let diagnostics;
- for (const sourceFile2 of Debug.checkDefined(state.program).getSourceFiles()) {
+ for (const sourceFile2 of state.program.getSourceFiles()) {
diagnostics = addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile2, cancellationToken));
}
+ if (state.checkPending && !state.compilerOptions.noCheck) {
+ state.checkPending = void 0;
+ state.buildInfoEmitPending = true;
+ }
return diagnostics || emptyArray;
}
}
@@ -129003,44 +129993,49 @@ function toBuilderStateFileInfoForMultiEmit(fileInfo) {
return isString(fileInfo) ? { version: fileInfo, signature: fileInfo, affectsGlobalScope: void 0, impliedFormat: void 0 } : isString(fileInfo.signature) ? fileInfo : { version: fileInfo.version, signature: fileInfo.signature === false ? void 0 : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
}
function toBuilderFileEmit(value, fullEmitForOptions) {
- return isNumber(value) ? fullEmitForOptions : value[1] || 8 /* Dts */;
+ return isNumber(value) ? fullEmitForOptions : value[1] || 24 /* Dts */;
}
function toProgramEmitPending(value, options) {
return !value ? getBuilderFileEmit(options || {}) : value;
}
-function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host) {
+function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath, host) {
var _a, _b, _c, _d;
- const program = buildInfo.program;
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
let state;
- const filePaths = (_a = program.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
+ const filePaths = (_a = buildInfo.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
let filePathsSetList;
- const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
- if (isProgramBundleEmitBuildInfo(program)) {
- const fileInfos = /* @__PURE__ */ new Map();
- program.fileInfos.forEach((fileInfo, index) => {
+ const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
+ const fileInfos = /* @__PURE__ */ new Map();
+ const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
+ if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
+ buildInfo.fileInfos.forEach((fileInfo, index) => {
const path = toFilePath(index + 1);
fileInfos.set(path, isString(fileInfo) ? { version: fileInfo, signature: void 0, affectsGlobalScope: void 0, impliedFormat: void 0 } : fileInfo);
});
state = {
fileInfos,
- compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
+ compilerOptions: buildInfo.options ? convertToOptionsWithAbsolutePaths(buildInfo.options, toAbsolutePath) : {},
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
+ hasReusableDiagnostic: true,
+ changedFilesSet,
latestChangedDtsFile,
- outSignature: program.outSignature,
- programEmitPending: program.pendingEmit === void 0 ? void 0 : toProgramEmitPending(program.pendingEmit, program.options)
+ outSignature: buildInfo.outSignature,
+ programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
+ hasErrors: buildInfo.errors,
+ checkPending: buildInfo.checkPending
};
} else {
- filePathsSetList = (_b = program.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
- const fileInfos = /* @__PURE__ */ new Map();
- const emitSignatures = ((_c = program.options) == null ? void 0 : _c.composite) && !program.options.outFile ? /* @__PURE__ */ new Map() : void 0;
- program.fileInfos.forEach((fileInfo, index) => {
+ filePathsSetList = (_b = buildInfo.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
+ const emitSignatures = ((_c = buildInfo.options) == null ? void 0 : _c.composite) && !buildInfo.options.outFile ? /* @__PURE__ */ new Map() : void 0;
+ buildInfo.fileInfos.forEach((fileInfo, index) => {
const path = toFilePath(index + 1);
const stateFileInfo = toBuilderStateFileInfoForMultiEmit(fileInfo);
fileInfos.set(path, stateFileInfo);
if (emitSignatures && stateFileInfo.signature) emitSignatures.set(path, stateFileInfo.signature);
});
- (_d = program.emitSignatures) == null ? void 0 : _d.forEach((value) => {
+ (_d = buildInfo.emitSignatures) == null ? void 0 : _d.forEach((value) => {
if (isNumber(value)) emitSignatures.delete(toFilePath(value));
else {
const key = toFilePath(value[0]);
@@ -129053,25 +130048,24 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
);
}
});
- const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
- const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
+ const fullEmitForOptions = buildInfo.affectedFilesPendingEmit ? getBuilderFileEmit(buildInfo.options || {}) : void 0;
state = {
fileInfos,
- compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
- referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
- semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
- emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
+ compilerOptions: buildInfo.options ? convertToOptionsWithAbsolutePaths(buildInfo.options, toAbsolutePath) : {},
+ referencedMap: toManyToManyPathMap(buildInfo.referencedMap, buildInfo.options ?? {}),
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
hasReusableDiagnostic: true,
- affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
changedFilesSet,
+ affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
latestChangedDtsFile,
- emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
+ emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
+ hasErrors: buildInfo.errors,
+ checkPending: buildInfo.checkPending
};
}
return {
- getState: () => state,
- saveEmitState: noop,
- restoreEmitState: noop,
+ state,
getProgram: notImplemented,
getProgramOrUndefined: returnUndefined,
releaseProgram: noop,
@@ -129111,7 +130105,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
return map2;
}
- function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
+ function toPerFileSemanticDiagnostics(diagnostics) {
const semanticDiagnostics = new Map(
mapDefinedIterator(
fileInfos.keys(),
@@ -129122,7 +130116,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
});
- return semanticDiagnostics.size ? semanticDiagnostics : void 0;
+ return semanticDiagnostics;
}
function toPerFileEmitDiagnostics(diagnostics) {
return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
@@ -129163,15 +130157,19 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
}
}
}
-function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
+function getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host) {
+ if (!isNonIncrementalBuildInfo(buildInfo)) return void 0;
+ const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
+ const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
+ return buildInfo.root.map((r) => toPath(r, buildInfoDirectory, getCanonicalFileName));
+}
+function createRedirectedBuilderProgram(state, configFileParsingDiagnostics) {
return {
- getState: notImplemented,
- saveEmitState: noop,
- restoreEmitState: noop,
+ state: void 0,
getProgram,
- getProgramOrUndefined: () => getState().program,
- releaseProgram: () => getState().program = void 0,
- getCompilerOptions: () => getState().compilerOptions,
+ getProgramOrUndefined: () => state.program,
+ releaseProgram: () => state.program = void 0,
+ getCompilerOptions: () => state.compilerOptions,
getSourceFile: (fileName) => getProgram().getSourceFile(fileName),
getSourceFiles: () => getProgram().getSourceFiles(),
getOptionsDiagnostics: (cancellationToken) => getProgram().getOptionsDiagnostics(cancellationToken),
@@ -129187,20 +130185,50 @@ function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics)
close: noop
};
function getProgram() {
- return Debug.checkDefined(getState().program);
+ return Debug.checkDefined(state.program);
}
}
// src/compiler/builderPublic.ts
function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
- return createBuilderProgram(0 /* SemanticDiagnosticsBuilderProgram */, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences));
+ return createBuilderProgram(
+ 0 /* SemanticDiagnosticsBuilderProgram */,
+ getBuilderCreationParameters(
+ newProgramOrRootNames,
+ hostOrOptions,
+ oldProgramOrHost,
+ configFileParsingDiagnosticsOrOldProgram,
+ configFileParsingDiagnostics,
+ projectReferences
+ )
+ );
}
function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
- return createBuilderProgram(1 /* EmitAndSemanticDiagnosticsBuilderProgram */, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences));
+ return createBuilderProgram(
+ 1 /* EmitAndSemanticDiagnosticsBuilderProgram */,
+ getBuilderCreationParameters(
+ newProgramOrRootNames,
+ hostOrOptions,
+ oldProgramOrHost,
+ configFileParsingDiagnosticsOrOldProgram,
+ configFileParsingDiagnostics,
+ projectReferences
+ )
+ );
}
function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
- const { newProgram, configFileParsingDiagnostics: newConfigFileParsingDiagnostics } = getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences);
- return createRedirectedBuilderProgram(() => ({ program: newProgram, compilerOptions: newProgram.getCompilerOptions() }), newConfigFileParsingDiagnostics);
+ const { newProgram, configFileParsingDiagnostics: newConfigFileParsingDiagnostics } = getBuilderCreationParameters(
+ newProgramOrRootNames,
+ hostOrOptions,
+ oldProgramOrHost,
+ configFileParsingDiagnosticsOrOldProgram,
+ configFileParsingDiagnostics,
+ projectReferences
+ );
+ return createRedirectedBuilderProgram(
+ { program: newProgram, compilerOptions: newProgram.getCompilerOptions() },
+ newConfigFileParsingDiagnostics
+ );
}
// src/compiler/resolutionCache.ts
@@ -129213,9 +130241,9 @@ function removeIgnoredPath(path) {
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
if (length2 <= 1) return 1;
let indexAfterOsRoot = 1;
- let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
+ let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
- pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
+ pathComponents2[1].search(/[a-z]\$$/i) === 0) {
if (length2 === 2) return 2;
indexAfterOsRoot = 2;
isDosStyle = true;
@@ -129250,7 +130278,7 @@ function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
function canWatchAffectingLocation(filePath) {
return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
}
-function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) {
+function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch) {
const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
const failedLookupComponents = getPathComponents(failedLookupLocation);
@@ -129282,10 +130310,11 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
perceivedOsRootLength,
nodeModulesIndex,
rootPathComponents,
- lastNodeModulesIndex
+ lastNodeModulesIndex,
+ preferNonRecursiveWatch
);
}
-function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex) {
+function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex, preferNonRecursiveWatch) {
if (nodeModulesIndex !== -1) {
return getDirectoryOfFailedLookupWatch(
dirComponents,
@@ -129296,11 +130325,13 @@ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dir
}
let nonRecursive = true;
let length2 = dirPathComponentsLength;
- for (let i = 0; i < dirPathComponentsLength; i++) {
- if (dirPathComponents[i] !== rootPathComponents[i]) {
- nonRecursive = false;
- length2 = Math.max(i + 1, perceivedOsRootLength + 1);
- break;
+ if (!preferNonRecursiveWatch) {
+ for (let i = 0; i < dirPathComponentsLength; i++) {
+ if (dirPathComponents[i] !== rootPathComponents[i]) {
+ nonRecursive = false;
+ length2 = Math.max(i + 1, perceivedOsRootLength + 1);
+ break;
+ }
}
}
return getDirectoryOfFailedLookupWatch(
@@ -129328,7 +130359,7 @@ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, lengt
packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
};
}
-function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
+function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
const typeRootPathComponents = getPathComponents(typeRootPath);
if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
return rootPath;
@@ -129341,7 +130372,8 @@ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootP
perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
typeRootPathComponents.indexOf("node_modules"),
rootPathComponents,
- typeRootPathComponents.lastIndexOf("node_modules")
+ typeRootPathComponents.lastIndexOf("node_modules"),
+ preferNonRecursiveWatch
);
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
}
@@ -129349,9 +130381,6 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
}
-function getRootPathSplitLength(rootPath) {
- return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
-}
function getModuleResolutionHost(resolutionHost) {
var _a;
return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
@@ -129400,7 +130429,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
let filesWithChangedSetOfUnresolvedImports;
let filesWithInvalidatedResolutions;
let filesWithInvalidatedNonRelativeUnresolvedImports;
- const nonRelativeExternalModuleResolutions = createMultiMap();
+ const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -129481,12 +130510,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
clear: clear2,
onChangesAffectModuleResolution
};
- function getResolvedModule(resolution) {
- return resolution.resolvedModule;
- }
- function getResolvedTypeReferenceDirective(resolution) {
- return resolution.resolvedTypeReferenceDirective;
- }
function clear2() {
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
@@ -129557,8 +130580,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
- nonRelativeExternalModuleResolutions.clear();
+ watchFailedLookupLocationOfNonRelativeModuleResolutions();
isSymlinkCache.clear();
}
function cleanupLibResolutionWatching(newProgram) {
@@ -129568,7 +130590,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
stopWatchFailedLookupLocationOfResolution(
resolution,
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
- getResolvedModule
+ getResolvedModuleFromResolution
);
resolvedLibraries.delete(libFileName);
}
@@ -129577,13 +130599,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
allModuleAndTypeResolutionsAreInvalidated = false;
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
- nonRelativeExternalModuleResolutions.clear();
+ watchFailedLookupLocationOfNonRelativeModuleResolutions();
if (newProgram !== oldProgram) {
cleanupLibResolutionWatching(newProgram);
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
var _a;
- const expected = isExternalOrCommonJsModule(newFile) ? ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0 : 0;
+ const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
for (let i = existing.length; i < expected; i++) {
createFileWatcherOfAffectingLocation(
@@ -129748,7 +130769,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
getModuleResolutionHost(resolutionHost),
typeReferenceDirectiveResolutionCache
),
- getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
+ getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution,
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
deferWatchingNonRelativeResolution: false
});
@@ -129769,7 +130790,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
resolutionHost,
moduleResolutionCache
),
- getResolutionWithResolvedFileName: getResolvedModule,
+ getResolutionWithResolvedFileName: getResolvedModuleFromResolution,
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
logChanges: logChangesWhenResolvingModule,
deferWatchingNonRelativeResolution: true
@@ -129787,17 +130808,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
libraryName,
resolution,
path,
- getResolvedModule,
+ getResolvedModuleFromResolution,
/*deferWatchingNonRelativeResolution*/
false
);
resolvedLibraries.set(libFileName, resolution);
if (existingResolution) {
- stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
+ stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModuleFromResolution);
}
} else {
if (isTraceEnabled(options, host)) {
- const resolved = getResolvedModule(resolution);
+ const resolved = getResolvedModuleFromResolution(resolution);
trace(
host,
(resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved,
@@ -129836,27 +130857,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
return endsWith(dirPath, "/node_modules/@types");
}
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
- var _a;
- if (resolution.refCount) {
- resolution.refCount++;
- Debug.assertIsDefined(resolution.files);
- } else {
- resolution.refCount = 1;
- Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
- if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
- watchFailedLookupLocationOfResolution(resolution);
- } else {
- nonRelativeExternalModuleResolutions.add(name, resolution);
- }
- const resolved = getResolutionWithResolvedFileName(resolution);
- if (resolved && resolved.resolvedFileName) {
- const key = resolutionHost.toPath(resolved.resolvedFileName);
- let resolutions = resolvedFileToResolution.get(key);
- if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
- resolutions.add(resolution);
- }
- }
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
+ if (resolution.files.size !== 1) return;
+ if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
+ watchFailedLookupLocationOfResolution(resolution);
+ } else {
+ nonRelativeExternalModuleResolutions.add(resolution);
+ }
+ const resolved = getResolutionWithResolvedFileName(resolution);
+ if (resolved && resolved.resolvedFileName) {
+ const key = resolutionHost.toPath(resolved.resolvedFileName);
+ let resolutions = resolvedFileToResolution.get(key);
+ if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
+ resolutions.add(resolution);
+ }
}
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
@@ -129866,7 +130880,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
rootDir,
rootPath,
rootPathComponents,
- getCurrentDirectory
+ getCurrentDirectory,
+ resolutionHost.preferNonRecursiveWatch
);
if (toWatch) {
const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
@@ -129881,7 +130896,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
return setAtRoot;
}
function watchFailedLookupLocationOfResolution(resolution) {
- Debug.assert(!!resolution.refCount);
+ var _a;
+ Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult) return;
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult) resolutionsWithFailedLookups.add(resolution);
@@ -129907,7 +130923,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
}
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
- Debug.assert(!!resolution.refCount);
+ var _a;
+ Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
const { affectingLocations } = resolution;
if (!(affectingLocations == null ? void 0 : affectingLocations.length)) return;
if (addToResolutionsWithOnlyAffectingLocations) resolutionsWithOnlyAffectingLocations.add(resolution);
@@ -129981,17 +130998,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
}
- function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
- const program = resolutionHost.getCurrentProgram();
- if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
- resolutions.forEach(watchFailedLookupLocationOfResolution);
- } else {
- resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
- resolution,
- /*addToResolutionsWithOnlyAffectingLocations*/
- true
- ));
- }
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
+ nonRelativeExternalModuleResolutions.clear();
}
function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
Debug.assert(!nonRecursive);
@@ -130011,11 +131020,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
);
} else if (packageDirWatcher.isSymlink !== isSymlink) {
packageDirWatcher.dirPathToWatcher.forEach((watcher) => {
- removeDirectoryWatcher(
- packageDirWatcher.isSymlink ? packageDirPath : dirPath,
- /*syncDirWatcherRemove*/
- false
- );
+ removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
watcher.watcher = createDirPathToWatcher();
});
packageDirWatcher.isSymlink = isSymlink;
@@ -130055,7 +131060,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
}
return dirWatcher;
}
- function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
+ function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
const toWatch = getDirectoryToWatchFailedLookupLocation(
failedLookupLocation,
@@ -130063,7 +131068,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
rootDir,
rootPath,
rootPathComponents,
- getCurrentDirectory
+ getCurrentDirectory,
+ resolutionHost.preferNonRecursiveWatch
);
if (toWatch) {
const { dirPath, packageDirPath } = toWatch;
@@ -130074,7 +131080,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
forDirPath.refCount--;
if (forDirPath.refCount === 0) {
- removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath, syncDirWatcherRemove);
+ removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
packageDirWatcher.dirPathToWatcher.delete(dirPath);
if (packageDirWatcher.isSymlink) {
const refCount = dirPathToSymlinkPackageRefCount.get(dirPath) - 1;
@@ -130084,20 +131090,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
dirPathToSymlinkPackageRefCount.set(dirPath, refCount);
}
}
- if (syncDirWatcherRemove) closePackageDirWatcher(packageDirWatcher, packageDirPath);
}
} else {
- removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
+ removeDirectoryWatcher(dirPath);
}
}
return removeAtRoot;
}
- function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
+ function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
Debug.checkDefined(resolution.files).delete(filePath);
- resolution.refCount--;
- if (resolution.refCount) {
- return;
- }
+ if (resolution.files.size) return;
+ resolution.files = void 0;
const resolved = getResolutionWithResolvedFileName(resolution);
if (resolved && resolved.resolvedFileName) {
const key = resolutionHost.toPath(resolved.resolvedFileName);
@@ -130109,11 +131112,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
let removeAtRoot = false;
if (failedLookupLocations) {
for (const failedLookupLocation of failedLookupLocations) {
- removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
+ removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
}
}
- if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot, syncDirWatcherRemove);
- if (removeAtRoot) removeDirectoryWatcher(rootPath, syncDirWatcherRemove);
+ if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot);
+ if (removeAtRoot) removeDirectoryWatcher(rootPath);
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
resolutionsWithOnlyAffectingLocations.delete(resolution);
}
@@ -130121,14 +131124,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
for (const affectingLocation of affectingLocations) {
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
watcher.resolutions--;
- if (syncDirWatcherRemove) closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
}
}
}
- function removeDirectoryWatcher(dirPath, syncDirWatcherRemove) {
+ function removeDirectoryWatcher(dirPath) {
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
dirWatcher.refCount--;
- if (syncDirWatcherRemove) closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
}
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
@@ -130139,15 +131140,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
}
- function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
+ function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
const resolutions = cache.get(filePath);
if (resolutions) {
resolutions.forEach(
(resolution) => stopWatchFailedLookupLocationOfResolution(
resolution,
filePath,
- getResolutionWithResolvedFileName,
- syncDirWatcherRemove
+ getResolutionWithResolvedFileName
)
);
cache.delete(filePath);
@@ -130161,9 +131161,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
if (!resolvedProjectReference) return;
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
}
- function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
- removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule, syncDirWatcherRemove);
- removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective, syncDirWatcherRemove);
+ function removeResolutionsOfFile(filePath) {
+ removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution);
+ removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution);
}
function invalidateResolutions(resolutions, canInvalidate) {
if (!resolutions) return false;
@@ -130293,6 +131293,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
rootPath,
rootPathComponents,
getCurrentDirectory,
+ resolutionHost.preferNonRecursiveWatch,
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
);
if (dirPath) {
@@ -130458,7 +131459,7 @@ function createTabularErrorsDisplay(filesInError, host) {
if (distinctFiles.length === 0) return "";
const numberLength = (num) => Math.log(num) * Math.LOG10E + 1;
const fileToErrorCount = distinctFiles.map((file) => [file, countWhere(filesInError, (fileInError) => fileInError.fileName === file.fileName)]);
- const maxErrors = fileToErrorCount.reduce((acc, value) => Math.max(acc, value[1] || 0), 0);
+ const maxErrors = maxBy(fileToErrorCount, 0, (value) => value[1]);
const headerRow = Diagnostics.Errors_Files.message;
const leftColumnHeadingLength = headerRow.split(" ")[0].length;
const leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors));
@@ -130475,13 +131476,13 @@ function createTabularErrorsDisplay(filesInError, host) {
});
return tabularData;
}
-function isBuilderProgram2(program) {
- return !!program.getState;
+function isBuilderProgram(program) {
+ return !!program.state;
}
function listFiles(program, write) {
const options = program.getCompilerOptions();
if (options.explainFiles) {
- explainFiles(isBuilderProgram2(program) ? program.getProgram() : program, write);
+ explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write);
} else if (options.listFiles || options.listFilesOnly) {
forEach(program.getSourceFiles(), (file) => {
write(file.fileName);
@@ -130495,10 +131496,10 @@ function explainFiles(program, write) {
for (const file of program.getSourceFiles()) {
write(`${toFileName(file, relativeFileName)}`);
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
- (_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
+ (_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
}
}
-function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
+function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
var _a;
let result;
if (file.path !== file.resolvedPath) {
@@ -130518,7 +131519,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
));
}
if (isExternalOrCommonJsModule(file)) {
- switch (file.impliedNodeFormat) {
+ switch (getImpliedNodeFormatForEmitWorker(file, options)) {
case 99 /* ESNext */:
if (file.packageJsonScope) {
(result ?? (result = [])).push(chainDiagnosticMessages(
@@ -130686,7 +131687,7 @@ function toFileName(file, fileNameConvertor) {
return fileNameConvertor ? fileNameConvertor(fileName) : fileName;
}
function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
- const isListFilesOnly = !!program.getCompilerOptions().listFilesOnly;
+ const options = program.getCompilerOptions();
const allDiagnostics = program.getConfigFileParsingDiagnostics().slice();
const configFileParsingDiagnosticsLength = allDiagnostics.length;
addRange(allDiagnostics, program.getSyntacticDiagnostics(
@@ -130696,7 +131697,7 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
));
if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
addRange(allDiagnostics, program.getOptionsDiagnostics(cancellationToken));
- if (!isListFilesOnly) {
+ if (!options.listFilesOnly) {
addRange(allDiagnostics, program.getGlobalDiagnostics(cancellationToken));
if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
addRange(allDiagnostics, program.getSemanticDiagnostics(
@@ -130705,9 +131706,16 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
cancellationToken
));
}
+ if (options.noEmit && getEmitDeclarations(options) && allDiagnostics.length === configFileParsingDiagnosticsLength) {
+ addRange(allDiagnostics, program.getDeclarationDiagnostics(
+ /*sourceFile*/
+ void 0,
+ cancellationToken
+ ));
+ }
}
}
- const emitResult = isListFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
+ const emitResult = options.listFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
/*targetSourceFile*/
void 0,
writeFile2,
@@ -130715,13 +131723,12 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
emitOnlyDtsFiles,
customTransformers
);
- const { emittedFiles, diagnostics: emitDiagnostics } = emitResult;
- addRange(allDiagnostics, emitDiagnostics);
+ addRange(allDiagnostics, emitResult.diagnostics);
const diagnostics = sortAndDeduplicateDiagnostics(allDiagnostics);
diagnostics.forEach(reportDiagnostic);
if (write) {
const currentDir = program.getCurrentDirectory();
- forEach(emittedFiles, (file) => {
+ forEach(emitResult.emittedFiles, (file) => {
const filepath = getNormalizedAbsolutePath(file, currentDir);
write(`TSFILE: ${filepath}`);
});
@@ -130762,7 +131769,8 @@ function createWatchHost(system = sys, reportWatchStatus2) {
watchFile: maybeBind(system, system.watchFile) || returnNoopFileWatcher,
watchDirectory: maybeBind(system, system.watchDirectory) || returnNoopFileWatcher,
setTimeout: maybeBind(system, system.setTimeout) || noop,
- clearTimeout: maybeBind(system, system.clearTimeout) || noop
+ clearTimeout: maybeBind(system, system.clearTimeout) || noop,
+ preferNonRecursiveWatch: system.preferNonRecursiveWatch
};
}
var WatchType = {
@@ -130981,8 +131989,8 @@ function readBuilderProgram(compilerOptions, host) {
if (!content) return void 0;
buildInfo = getBuildInfo(buildInfoPath, content);
}
- if (!buildInfo || buildInfo.version !== version || !buildInfo.program) return void 0;
- return createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host);
+ if (!buildInfo || buildInfo.version !== version || !isIncrementalBuildInfo(buildInfo)) return void 0;
+ return createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath, host);
}
function createIncrementalCompilerHost(options, system = sys) {
const host = createCompilerHostWorker(
@@ -131093,6 +132101,7 @@ function createWatchProgram(host) {
compilerHost.toPath = toPath3;
compilerHost.getCompilationSettings = () => compilerOptions;
compilerHost.useSourceOfProjectReferenceRedirect = maybeBind(host, host.useSourceOfProjectReferenceRedirect);
+ compilerHost.preferNonRecursiveWatch = host.preferNonRecursiveWatch;
compilerHost.watchDirectoryOfFailedLookupLocation = (dir, cb, flags) => watchDirectory(dir, cb, flags, watchOptions, WatchType.FailedLookupLocations);
compilerHost.watchAffectingFileLocation = (file, cb) => watchFile2(file, cb, 2e3 /* High */, watchOptions, WatchType.AffectingFileLocation);
compilerHost.watchTypeRootsDirectory = (dir, cb, flags) => watchDirectory(dir, cb, flags, watchOptions, WatchType.TypeRoots);
@@ -131404,22 +132413,17 @@ function createWatchProgram(host) {
updateProgram();
}
function updateProgram() {
- var _a, _b, _c, _d;
switch (updateLevel) {
case 1 /* RootNamesAndUpdate */:
- (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
reloadFileNamesFromConfigFile();
break;
case 2 /* Full */:
- (_b = perfLogger) == null ? void 0 : _b.logStartUpdateProgram("FullConfigReload");
reloadConfigFile();
break;
default:
- (_c = perfLogger) == null ? void 0 : _c.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
break;
}
- (_d = perfLogger) == null ? void 0 : _d.logStopUpdateProgram("Done");
return getCurrentBuilderProgram();
}
function reloadFileNamesFromConfigFile() {
@@ -131701,16 +132705,17 @@ var UpToDateStatusType = /* @__PURE__ */ ((UpToDateStatusType2) => {
UpToDateStatusType2[UpToDateStatusType2["ErrorReadingFile"] = 4] = "ErrorReadingFile";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
- UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
- UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 8] = "OutOfDateOptions";
- UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 9] = "OutOfDateRoots";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 10] = "UpstreamOutOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 11] = "UpstreamBlocked";
- UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 12] = "ComputingUpstream";
- UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 13] = "TsVersionOutputOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 14] = "UpToDateWithInputFileText";
- UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 15] = "ContainerOnly";
- UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 16] = "ForceBuild";
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfoWithPendingEmit"] = 7] = "OutOfDateBuildInfoWithPendingEmit";
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfoWithErrors"] = 8] = "OutOfDateBuildInfoWithErrors";
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 9] = "OutOfDateOptions";
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 10] = "OutOfDateRoots";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 11] = "UpstreamOutOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 12] = "UpstreamBlocked";
+ UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 13] = "ComputingUpstream";
+ UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 14] = "TsVersionOutputOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 15] = "UpToDateWithInputFileText";
+ UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 16] = "ContainerOnly";
+ UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 17] = "ForceBuild";
return UpToDateStatusType2;
})(UpToDateStatusType || {});
function resolveConfigFileProjectName(project) {
@@ -131722,7 +132727,6 @@ function resolveConfigFileProjectName(project) {
// src/compiler/tsbuildPublic.ts
var minimumDate = /* @__PURE__ */ new Date(-864e13);
-var maximumDate = /* @__PURE__ */ new Date(864e13);
function getOrCreateValueFromConfigFileMap(configFileMap, resolved, createT) {
const existingValue = configFileMap.get(resolved);
let newValue;
@@ -131777,6 +132781,7 @@ function getCompilerOptionsOfBuildOptions(buildOptions) {
commonOptionsWithBuild.forEach((option) => {
if (hasProperty(buildOptions, option.name)) result[option.name] = buildOptions[option.name];
});
+ result.tscBuild = true;
return result;
}
function createSolutionBuilder(host, rootNames, defaultOptions) {
@@ -132180,7 +133185,7 @@ function createUpdateOutputFileStampsProject(state, project, projectPath, config
}
};
}
-function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder) {
+function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, status, buildOrder) {
let step = 0 /* CreateProgram */;
let program;
let buildResult;
@@ -132231,17 +133236,13 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
}
);
}
- executeSteps(2 /* SemanticDiagnostics */, cancellationToken);
- if (step === 4 /* EmitBuildInfo */) {
- return emitBuildInfo(writeFile2, cancellationToken);
- }
- if (step !== 3 /* Emit */) return void 0;
+ executeSteps(0 /* CreateProgram */, cancellationToken);
return emit(writeFile2, cancellationToken, customTransformers);
},
done
};
function done(cancellationToken, writeFile2, customTransformers) {
- executeSteps(6 /* Done */, cancellationToken, writeFile2, customTransformers);
+ executeSteps(3 /* Done */, cancellationToken, writeFile2, customTransformers);
mark("SolutionBuilder::Projects built");
return doneInvalidatedProject(state, projectPath);
}
@@ -132258,14 +133259,14 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
if (state.options.dry) {
reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
buildResult = 1 /* Success */;
- step = 5 /* QueueReferencingProjects */;
+ step = 2 /* QueueReferencingProjects */;
return;
}
if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project);
if (config.fileNames.length === 0) {
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
buildResult = 0 /* None */;
- step = 5 /* QueueReferencingProjects */;
+ step = 2 /* QueueReferencingProjects */;
return;
}
const { host, compilerHost } = state;
@@ -132293,185 +133294,97 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
}
step++;
}
- function handleDiagnostics(diagnostics, errorFlags, errorType) {
- if (diagnostics.length) {
- ({ buildResult, step } = buildErrors(
- state,
- projectPath,
- program,
- config,
- diagnostics,
- errorFlags,
- errorType
- ));
- } else {
- step++;
- }
- }
- function getSyntaxDiagnostics(cancellationToken) {
- Debug.assertIsDefined(program);
- handleDiagnostics(
- [
- ...program.getConfigFileParsingDiagnostics(),
- ...program.getOptionsDiagnostics(cancellationToken),
- ...program.getGlobalDiagnostics(cancellationToken),
- ...program.getSyntacticDiagnostics(
- /*sourceFile*/
- void 0,
- cancellationToken
- )
- ],
- 8 /* SyntaxErrors */,
- "Syntactic"
- );
- }
- function getSemanticDiagnostics(cancellationToken) {
- handleDiagnostics(
- Debug.checkDefined(program).getSemanticDiagnostics(
- /*sourceFile*/
- void 0,
- cancellationToken
- ),
- 16 /* TypeErrors */,
- "Semantic"
- );
- }
function emit(writeFileCallback, cancellationToken, customTransformers) {
var _a, _b, _c;
Debug.assertIsDefined(program);
- Debug.assert(step === 3 /* Emit */);
- const saved = program.saveEmitState();
- let declDiagnostics;
- const reportDeclarationDiagnostics = (d) => (declDiagnostics || (declDiagnostics = [])).push(d);
- const outputFiles = [];
- const { emitResult } = emitFilesAndReportErrors(
+ Debug.assert(step === 1 /* Emit */);
+ const { host, compilerHost } = state;
+ const emittedOutputs = /* @__PURE__ */ new Map();
+ const options = program.getCompilerOptions();
+ const isIncremental = isIncrementalCompilation(options);
+ let outputTimeStampMap;
+ let now;
+ const { emitResult, diagnostics } = emitFilesAndReportErrors(
program,
- reportDeclarationDiagnostics,
- /*write*/
- void 0,
+ (d) => host.reportDiagnostic(d),
+ state.write,
/*reportSummary*/
void 0,
- (name, text, writeByteOrderMark, _onError, _sourceFiles, data) => outputFiles.push({ name, text, writeByteOrderMark, data }),
+ (name, text, writeByteOrderMark, onError, sourceFiles, data) => {
+ var _a2;
+ const path = toPath2(state, name);
+ emittedOutputs.set(toPath2(state, name), name);
+ if (data == null ? void 0 : data.buildInfo) {
+ now || (now = getCurrentTime(state.host));
+ const isChangedSignature2 = (_a2 = program.hasChangedEmitSignature) == null ? void 0 : _a2.call(program);
+ const existing = getBuildInfoCacheEntry(state, name, projectPath);
+ if (existing) {
+ existing.buildInfo = data.buildInfo;
+ existing.modifiedTime = now;
+ if (isChangedSignature2) existing.latestChangedDtsTime = now;
+ } else {
+ state.buildInfoCache.set(projectPath, {
+ path: toPath2(state, name),
+ buildInfo: data.buildInfo,
+ modifiedTime: now,
+ latestChangedDtsTime: isChangedSignature2 ? now : void 0
+ });
+ }
+ }
+ const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
+ (writeFileCallback || compilerHost.writeFile)(
+ name,
+ text,
+ writeByteOrderMark,
+ onError,
+ sourceFiles,
+ data
+ );
+ if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
+ else if (!isIncremental && state.watch) {
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
+ }
+ },
cancellationToken,
/*emitOnlyDtsFiles*/
- false,
+ void 0,
customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project))
);
- if (declDiagnostics) {
- program.restoreEmitState(saved);
- ({ buildResult, step } = buildErrors(
- state,
- projectPath,
- program,
- config,
- declDiagnostics,
- 32 /* DeclarationEmitErrors */,
- "Declaration file"
- ));
- return {
- emitSkipped: true,
- diagnostics: emitResult.diagnostics
- };
+ if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8 /* OutOfDateBuildInfoWithErrors */)) {
+ updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
}
- const { host, compilerHost } = state;
- const resultFlags = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 /* None */ : 2 /* DeclarationOutputUnchanged */;
- const emitterDiagnostics = createDiagnosticCollection();
- const emittedOutputs = /* @__PURE__ */ new Map();
- const options = program.getCompilerOptions();
- const isIncremental = isIncrementalCompilation(options);
- let outputTimeStampMap;
- let now;
- outputFiles.forEach(({ name, text, writeByteOrderMark, data }) => {
- const path = toPath2(state, name);
- emittedOutputs.set(toPath2(state, name), name);
- if (data == null ? void 0 : data.buildInfo) setBuildInfo(state, data.buildInfo, projectPath, options, resultFlags);
- const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
- writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
- if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
- else if (!isIncremental && state.watch) {
- (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
- }
- });
- finishEmit(
- emitterDiagnostics,
- emittedOutputs,
- outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()),
- resultFlags
- );
- return emitResult;
- }
- function emitBuildInfo(writeFileCallback, cancellationToken) {
- Debug.assertIsDefined(program);
- Debug.assert(step === 4 /* EmitBuildInfo */);
- const emitResult = program.emitBuildInfo((name, text, writeByteOrderMark, onError, sourceFiles, data) => {
- if (data == null ? void 0 : data.buildInfo) setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), 2 /* DeclarationOutputUnchanged */);
- if (writeFileCallback) writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
- else state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
- }, cancellationToken);
- if (emitResult.diagnostics.length) {
- reportErrors(state, emitResult.diagnostics);
- state.diagnostics.set(projectPath, [...state.diagnostics.get(projectPath), ...emitResult.diagnostics]);
- buildResult = 64 /* EmitErrors */ & buildResult;
- }
- if (emitResult.emittedFiles && state.write) {
- emitResult.emittedFiles.forEach((name) => listEmittedFile(state, config, name));
+ state.projectErrorsReported.set(projectPath, true);
+ buildResult = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 /* None */ : 2 /* DeclarationOutputUnchanged */;
+ if (!diagnostics.length) {
+ state.diagnostics.delete(projectPath);
+ state.projectStatus.set(projectPath, {
+ type: 1 /* UpToDate */,
+ oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(config, !host.useCaseSensitiveFileNames())
+ });
+ } else {
+ state.diagnostics.set(projectPath, diagnostics);
+ state.projectStatus.set(projectPath, { type: 0 /* Unbuildable */, reason: `it had errors` });
+ buildResult |= 4 /* AnyErrors */;
}
afterProgramDone(state, program);
- step = 5 /* QueueReferencingProjects */;
+ step = 2 /* QueueReferencingProjects */;
return emitResult;
}
- function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
- const emitDiagnostics = emitterDiagnostics.getDiagnostics();
- if (emitDiagnostics.length) {
- ({ buildResult, step } = buildErrors(
- state,
- projectPath,
- program,
- config,
- emitDiagnostics,
- 64 /* EmitErrors */,
- "Emit"
- ));
- return emitDiagnostics;
- }
- if (state.write) {
- emittedOutputs.forEach((name) => listEmittedFile(state, config, name));
- }
- updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
- state.diagnostics.delete(projectPath);
- state.projectStatus.set(projectPath, {
- type: 1 /* UpToDate */,
- oldestOutputFileName
- });
- afterProgramDone(state, program);
- step = 5 /* QueueReferencingProjects */;
- buildResult = resultFlags;
- return emitDiagnostics;
- }
function executeSteps(till, cancellationToken, writeFile2, customTransformers) {
- while (step <= till && step < 6 /* Done */) {
+ while (step <= till && step < 3 /* Done */) {
const currentStep = step;
switch (step) {
case 0 /* CreateProgram */:
createProgram2();
break;
- case 1 /* SyntaxDiagnostics */:
- getSyntaxDiagnostics(cancellationToken);
- break;
- case 2 /* SemanticDiagnostics */:
- getSemanticDiagnostics(cancellationToken);
- break;
- case 3 /* Emit */:
+ case 1 /* Emit */:
emit(writeFile2, cancellationToken, customTransformers);
break;
- case 4 /* EmitBuildInfo */:
- emitBuildInfo(writeFile2, cancellationToken);
- break;
- case 5 /* QueueReferencingProjects */:
+ case 2 /* QueueReferencingProjects */:
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
step++;
break;
- case 6 /* Done */:
+ case 3 /* Done */:
default:
assertType(step);
}
@@ -132521,7 +133434,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
}
continue;
}
- if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 14 /* UpToDateWithInputFileText */) {
+ if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 15 /* UpToDateWithInputFileText */) {
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
return {
kind: 1 /* UpdateOutputFileStamps */,
@@ -132533,7 +133446,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
};
}
}
- if (status.type === 11 /* UpstreamBlocked */) {
+ if (status.type === 12 /* UpstreamBlocked */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -132547,7 +133460,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
}
continue;
}
- if (status.type === 15 /* ContainerOnly */) {
+ if (status.type === 16 /* ContainerOnly */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -132572,6 +133485,7 @@ function createInvalidatedProjectWithInfo(state, info, buildOrder) {
info.projectPath,
info.projectIndex,
info.config,
+ info.status,
buildOrder
) : createUpdateOutputFileStampsProject(
state,
@@ -132586,11 +133500,6 @@ function getNextInvalidatedProject(state, buildOrder, reportQueue) {
if (!info) return info;
return createInvalidatedProjectWithInfo(state, info, buildOrder);
}
-function listEmittedFile({ write }, proj, file) {
- if (write && proj.options.listEmittedFiles) {
- write(`TSFILE: ${file}`);
- }
-}
function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed) {
if (options.force) return void 0;
const value = builderPrograms.get(proj);
@@ -132599,7 +133508,6 @@ function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed)
}
function afterProgramDone(state, program) {
if (program) {
- if (state.write) listFiles(program, state.write);
if (state.host.afterProgramEmitAndDiagnostics) {
state.host.afterProgramEmitAndDiagnostics(program);
}
@@ -132607,14 +133515,6 @@ function afterProgramDone(state, program) {
}
state.projectCompilerOptions = state.baseCompilerOptions;
}
-function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
- const canEmitBuildInfo = program && !program.getCompilerOptions().outFile;
- reportAndStoreErrors(state, resolvedPath, diagnostics);
- state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
- if (canEmitBuildInfo) return { buildResult, step: 4 /* EmitBuildInfo */ };
- afterProgramDone(state, program);
- return { buildResult, step: 5 /* QueueReferencingProjects */ };
-}
function isFileWatcherWithModifiedTime(value) {
return !!value.watcher;
}
@@ -132672,23 +133572,6 @@ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
if (!result) state.outputTimeStamps.set(resolvedConfigFilePath, result = /* @__PURE__ */ new Map());
return result;
}
-function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
- const existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
- const modifiedTime = getCurrentTime(state.host);
- if (existing) {
- existing.buildInfo = buildInfo;
- existing.modifiedTime = modifiedTime;
- if (!(resultFlags & 2 /* DeclarationOutputUnchanged */)) existing.latestChangedDtsTime = modifiedTime;
- } else {
- state.buildInfoCache.set(resolvedConfigPath, {
- path: toPath2(state, buildInfoPath),
- buildInfo,
- modifiedTime,
- latestChangedDtsTime: resultFlags & 2 /* DeclarationOutputUnchanged */ ? void 0 : modifiedTime
- });
- }
-}
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
const path = toPath2(state, buildInfoPath);
const existing = state.buildInfoCache.get(resolvedConfigPath);
@@ -132716,99 +133599,107 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
}
}
function getUpToDateStatusWorker(state, project, resolvedPath) {
- var _a, _b, _c, _d;
+ var _a, _b, _c, _d, _e;
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
return {
- type: 15 /* ContainerOnly */
+ type: 16 /* ContainerOnly */
};
}
let referenceStatuses;
const force = !!state.options.force;
if (project.projectReferences) {
- state.projectStatus.set(resolvedPath, { type: 12 /* ComputingUpstream */ });
+ state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ });
for (const ref of project.projectReferences) {
const resolvedRef = resolveProjectReferencePath(ref);
const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
const resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
const refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
- if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
+ if (refStatus.type === 13 /* ComputingUpstream */ || refStatus.type === 16 /* ContainerOnly */) {
continue;
}
- if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
+ if (state.options.stopBuildOnErrors && (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 12 /* UpstreamBlocked */)) {
return {
- type: 11 /* UpstreamBlocked */,
+ type: 12 /* UpstreamBlocked */,
upstreamProjectName: ref.path,
- upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
- };
- }
- if (refStatus.type !== 1 /* UpToDate */) {
- return {
- type: 10 /* UpstreamOutOfDate */,
- upstreamProjectName: ref.path
+ upstreamProjectBlocked: refStatus.type === 12 /* UpstreamBlocked */
};
}
if (!force) (referenceStatuses || (referenceStatuses = [])).push({ ref, refStatus, resolvedRefPath, resolvedConfig });
}
}
- if (force) return { type: 16 /* ForceBuild */ };
+ if (force) return { type: 17 /* ForceBuild */ };
const { host } = state;
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
- let oldestOutputFileName;
- let oldestOutputFileTime = maximumDate;
- let buildInfoTime;
- let buildInfoProgram;
- let buildInfoVersionMap;
- if (buildInfoPath) {
- const buildInfoCacheEntry2 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
- buildInfoTime = (buildInfoCacheEntry2 == null ? void 0 : buildInfoCacheEntry2.modifiedTime) || getModifiedTime(host, buildInfoPath);
- if (buildInfoTime === missingFileModifiedTime) {
- if (!buildInfoCacheEntry2) {
- state.buildInfoCache.set(resolvedPath, {
- path: toPath2(state, buildInfoPath),
- buildInfo: false,
- modifiedTime: buildInfoTime
- });
- }
+ const isIncremental = isIncrementalCompilation(project.options);
+ let buildInfoCacheEntry = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
+ const buildInfoTime = (buildInfoCacheEntry == null ? void 0 : buildInfoCacheEntry.modifiedTime) || getModifiedTime(host, buildInfoPath);
+ if (buildInfoTime === missingFileModifiedTime) {
+ if (!buildInfoCacheEntry) {
+ state.buildInfoCache.set(resolvedPath, {
+ path: toPath2(state, buildInfoPath),
+ buildInfo: false,
+ modifiedTime: buildInfoTime
+ });
+ }
+ return {
+ type: 3 /* OutputMissing */,
+ missingOutputFileName: buildInfoPath
+ };
+ }
+ const buildInfo = getBuildInfo3(state, buildInfoPath, resolvedPath, buildInfoTime);
+ if (!buildInfo) {
+ return {
+ type: 4 /* ErrorReadingFile */,
+ fileName: buildInfoPath
+ };
+ }
+ const incrementalBuildInfo = isIncremental && isIncrementalBuildInfo(buildInfo) ? buildInfo : void 0;
+ if ((incrementalBuildInfo || !isIncremental) && buildInfo.version !== version) {
+ return {
+ type: 14 /* TsVersionOutputOfDate */,
+ version: buildInfo.version
+ };
+ }
+ if (!project.options.noCheck && (buildInfo.errors || // TODO: syntax errors????
+ buildInfo.checkPending)) {
+ return {
+ type: 8 /* OutOfDateBuildInfoWithErrors */,
+ buildInfoFile: buildInfoPath
+ };
+ }
+ if (incrementalBuildInfo) {
+ if (!project.options.noCheck && (((_a = incrementalBuildInfo.changeFileSet) == null ? void 0 : _a.length) || ((_b = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _b.length) || getEmitDeclarations(project.options) && ((_c = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _c.length))) {
return {
- type: 3 /* OutputMissing */,
- missingOutputFileName: buildInfoPath
+ type: 8 /* OutOfDateBuildInfoWithErrors */,
+ buildInfoFile: buildInfoPath
};
}
- const buildInfo = getBuildInfo3(state, buildInfoPath, resolvedPath, buildInfoTime);
- if (!buildInfo) {
+ if (!project.options.noEmit && (((_d = incrementalBuildInfo.changeFileSet) == null ? void 0 : _d.length) || ((_e = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _e.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
return {
- type: 4 /* ErrorReadingFile */,
- fileName: buildInfoPath
+ type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
+ buildInfoFile: buildInfoPath
};
}
- if (buildInfo.program && buildInfo.version !== version) {
+ if ((!project.options.noEmit || project.options.noEmit && getEmitDeclarations(project.options)) && getPendingEmitKindWithSeen(
+ project.options,
+ incrementalBuildInfo.options || {},
+ /*emitOnlyDtsFiles*/
+ void 0,
+ !!project.options.noEmit
+ )) {
return {
- type: 13 /* TsVersionOutputOfDate */,
- version: buildInfo.version
+ type: 9 /* OutOfDateOptions */,
+ buildInfoFile: buildInfoPath
};
}
- if (buildInfo.program) {
- if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
- return {
- type: 7 /* OutOfDateBuildInfo */,
- buildInfoFile: buildInfoPath
- };
- }
- if (!project.options.noEmit && getPendingEmitKind(project.options, buildInfo.program.options || {})) {
- return {
- type: 8 /* OutOfDateOptions */,
- buildInfoFile: buildInfoPath
- };
- }
- buildInfoProgram = buildInfo.program;
- }
- oldestOutputFileTime = buildInfoTime;
- oldestOutputFileName = buildInfoPath;
}
+ let oldestOutputFileTime = buildInfoTime;
+ let oldestOutputFileName = buildInfoPath;
let newestInputFileName = void 0;
let newestInputFileTime = minimumDate;
let pseudoInputUpToDate = false;
const seenRoots = /* @__PURE__ */ new Set();
+ let buildInfoVersionMap;
for (const inputFile of project.fileNames) {
const inputTime = getModifiedTime2(state, inputFile);
if (inputTime === missingFileModifiedTime) {
@@ -132817,12 +133708,12 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
reason: `${inputFile} does not exist`
};
}
- const inputPath = buildInfoProgram ? toPath2(state, inputFile) : void 0;
- if (buildInfoTime && buildInfoTime < inputTime) {
+ const inputPath = toPath2(state, inputFile);
+ if (buildInfoTime < inputTime) {
let version2;
let currentVersion;
- if (buildInfoProgram) {
- if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
+ if (incrementalBuildInfo) {
+ if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
const resolvedInputPath = buildInfoVersionMap.roots.get(inputPath);
version2 = buildInfoVersionMap.fileInfos.get(resolvedInputPath ?? inputPath);
const text = version2 ? state.readFileWithCache(resolvedInputPath ?? inputFile) : void 0;
@@ -132841,27 +133732,34 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
newestInputFileName = inputFile;
newestInputFileTime = inputTime;
}
- if (buildInfoProgram) seenRoots.add(inputPath);
+ seenRoots.add(inputPath);
}
- if (buildInfoProgram) {
- if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
- const existingRoot = forEachEntry(
+ let existingRoot;
+ if (incrementalBuildInfo) {
+ if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
+ existingRoot = forEachEntry(
buildInfoVersionMap.roots,
// File was root file when project was built but its not any more
(_resolved, existingRoot2) => !seenRoots.has(existingRoot2) ? existingRoot2 : void 0
);
- if (existingRoot) {
- return {
- type: 9 /* OutOfDateRoots */,
- buildInfoFile: buildInfoPath,
- inputFile: existingRoot
- };
- }
+ } else {
+ existingRoot = forEach(
+ getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host),
+ (root) => !seenRoots.has(root) ? root : void 0
+ );
}
- if (!buildInfoPath) {
+ if (existingRoot) {
+ return {
+ type: 10 /* OutOfDateRoots */,
+ buildInfoFile: buildInfoPath,
+ inputFile: existingRoot
+ };
+ }
+ if (!isIncremental) {
const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
const outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
for (const output of outputs) {
+ if (output === buildInfoPath) continue;
const path = toPath2(state, output);
let outputTime = outputTimeStampMap == null ? void 0 : outputTimeStampMap.get(path);
if (!outputTime) {
@@ -132887,14 +133785,13 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
}
}
}
- const buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
let pseudoUpToDate = false;
if (referenceStatuses) {
for (const { ref, refStatus, resolvedConfig, resolvedRefPath } of referenceStatuses) {
if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
continue;
}
- if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
+ if (hasSameBuildInfo(state, buildInfoCacheEntry ?? (buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath)), resolvedRefPath)) {
return {
type: 6 /* OutOfDateWithUpstream */,
outOfDateOutputFileName: buildInfoPath,
@@ -132925,7 +133822,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
);
if (dependentPackageFileStatus) return dependentPackageFileStatus;
return {
- type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 14 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
+ type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 15 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
newestInputFileTime,
newestInputFileName,
oldestOutputFileName
@@ -132937,7 +133834,7 @@ function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
}
function getUpToDateStatus(state, project, resolvedPath) {
if (project === void 0) {
- return { type: 0 /* Unbuildable */, reason: "File deleted mid-build" };
+ return { type: 0 /* Unbuildable */, reason: "config file deleted mid-build" };
}
const prior = state.projectStatus.get(resolvedPath);
if (prior !== void 0) {
@@ -132954,7 +133851,8 @@ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage,
if (proj.options.noEmit) return;
let now;
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(proj.options);
- if (buildInfoPath) {
+ const isIncremental = isIncrementalCompilation(proj.options);
+ if (buildInfoPath && isIncremental) {
if (!(skipOutputs == null ? void 0 : skipOutputs.has(toPath2(state, buildInfoPath)))) {
if (!!state.options.verbose) reportStatus(state, verboseMessage, proj.options.configFilePath);
state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
@@ -132977,7 +133875,8 @@ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage,
reportStatus(state, verboseMessage, proj.options.configFilePath);
}
host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
- if (outputTimeStampMap) {
+ if (file === buildInfoPath) getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
+ else if (outputTimeStampMap) {
outputTimeStampMap.set(path, now);
modifiedOutputs.add(path);
}
@@ -132991,7 +133890,7 @@ function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
if (!options.composite) return void 0;
const entry = Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
if (entry.latestChangedDtsTime !== void 0) return entry.latestChangedDtsTime || void 0;
- const latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ? state.host.getModifiedTime(getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, getDirectoryPath(entry.path))) : void 0;
+ const latestChangedDtsTime = entry.buildInfo && isIncrementalBuildInfo(entry.buildInfo) && entry.buildInfo.latestChangedDtsFile ? state.host.getModifiedTime(getNormalizedAbsolutePath(entry.buildInfo.latestChangedDtsFile, getDirectoryPath(entry.path))) : void 0;
entry.latestChangedDtsTime = latestChangedDtsTime || false;
return latestChangedDtsTime;
}
@@ -133006,7 +133905,7 @@ function updateOutputTimestamps(state, proj, resolvedPath) {
});
}
function queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult) {
- if (buildResult & 124 /* AnyErrors */) return;
+ if (state.options.stopBuildOnErrors && buildResult & 4 /* AnyErrors */) return;
if (!config.options.composite) return;
for (let index = projectIndex + 1; index < buildOrder.length; index++) {
const nextProject = buildOrder[index];
@@ -133025,7 +133924,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
status.type = 2 /* UpToDateWithUpstreamTypes */;
break;
}
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
case 2 /* UpToDateWithUpstreamTypes */:
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
state.projectStatus.set(nextProjectPath, {
@@ -133035,7 +133934,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
});
}
break;
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
clearProjectStatus(state, nextProjectPath);
}
@@ -133454,21 +134353,28 @@ function reportUpToDateStatus(state, configFileName, status) {
relName(state, configFileName),
relName(state, status.fileName)
);
- case 7 /* OutOfDateBuildInfo */:
+ case 7 /* OutOfDateBuildInfoWithPendingEmit */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted,
relName(state, configFileName),
relName(state, status.buildInfoFile)
);
- case 8 /* OutOfDateOptions */:
+ case 8 /* OutOfDateBuildInfoWithErrors */:
+ return reportStatus(
+ state,
+ Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors,
+ relName(state, configFileName),
+ relName(state, status.buildInfoFile)
+ );
+ case 9 /* OutOfDateOptions */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions,
relName(state, configFileName),
relName(state, status.buildInfoFile)
);
- case 9 /* OutOfDateRoots */:
+ case 10 /* OutOfDateRoots */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
@@ -133493,20 +134399,20 @@ function reportUpToDateStatus(state, configFileName, status) {
Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,
relName(state, configFileName)
);
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
return reportStatus(
state,
Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
relName(state, configFileName)
);
- case 10 /* UpstreamOutOfDate */:
+ case 11 /* UpstreamOutOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
relName(state, configFileName),
relName(state, status.upstreamProjectName)
);
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
return reportStatus(
state,
status.upstreamProjectBlocked ? Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
@@ -133516,11 +134422,11 @@ function reportUpToDateStatus(state, configFileName, status) {
case 0 /* Unbuildable */:
return reportStatus(
state,
- Diagnostics.Failed_to_parse_file_0_Colon_1,
+ Diagnostics.Project_0_is_out_of_date_because_1,
relName(state, configFileName),
status.reason
);
- case 13 /* TsVersionOutputOfDate */:
+ case 14 /* TsVersionOutputOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,
@@ -133528,14 +134434,14 @@ function reportUpToDateStatus(state, configFileName, status) {
status.version,
version
);
- case 16 /* ForceBuild */:
+ case 17 /* ForceBuild */:
return reportStatus(
state,
Diagnostics.Project_0_is_being_forcibly_rebuilt,
relName(state, configFileName)
);
- case 15 /* ContainerOnly */:
- case 12 /* ComputingUpstream */:
+ case 16 /* ContainerOnly */:
+ case 13 /* ComputingUpstream */:
break;
default:
assertType(status);
@@ -133607,7 +134513,7 @@ function shouldBePretty(sys2, options) {
return options.pretty;
}
function getOptionsForHelp(commandLine) {
- return !!commandLine.options.all ? sort(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.slice(), (v) => !!v.showInSimplifiedHelpView);
+ return !!commandLine.options.all ? toSorted(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.slice(), (v) => !!v.showInSimplifiedHelpView);
}
function printVersion(sys2) {
sys2.write(getDiagnosticText(Diagnostics.Version_0, version) + sys2.newLine);
@@ -134780,7 +135686,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
return typeFromAccessor(parent2, context);
}
const declaredType = getEffectiveTypeAnnotationNode(node);
- const addUndefined = resolver.requiresAddingImplicitUndefined(node);
+ const addUndefined = resolver.requiresAddingImplicitUndefined(node, context.enclosingDeclaration);
let resultType;
if (declaredType) {
resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
@@ -134961,7 +135867,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
expression,
/*includeBigInt*/
false
- )) {
+ ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
context.tracker.reportInferenceFallback(prop.name);
result = false;
}
@@ -135088,7 +135994,6 @@ __export(ts_JsTyping_exports, {
nodeCoreModuleList: () => nodeCoreModuleList,
nodeCoreModules: () => nodeCoreModules,
nonRelativeModuleNameForTypingCache: () => nonRelativeModuleNameForTypingCache,
- prefixedNodeCoreModuleList: () => prefixedNodeCoreModuleList,
renderPackageNameValidationFailure: () => renderPackageNameValidationFailure,
validatePackageName: () => validatePackageName
});
@@ -137186,7 +138091,9 @@ function createModuleSpecifierResolutionHost(program, host) {
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
getFileIncludeReasons: () => program.getFileIncludeReasons(),
- getCommonSourceDirectory: () => program.getCommonSourceDirectory()
+ getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
+ getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
+ getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
};
}
function getModuleSpecifierResolverHost(program, host) {
@@ -137285,7 +138192,7 @@ function insertImports(changes, sourceFile, imports, blankLineBetween, preferenc
const importKindPredicate = decl.kind === 243 /* VariableStatement */ ? isRequireVariableStatement : isAnyImportSyntax;
const existingImportStatements = filter(sourceFile.statements, importKindPredicate);
const { comparer, isSorted } = ts_OrganizeImports_exports.getOrganizeImportsStringComparerWithDetection(existingImportStatements, preferences);
- const sortedNewImports = isArray(imports) ? stableSort(imports, (a, b) => ts_OrganizeImports_exports.compareImportsOrRequireStatements(a, b, comparer)) : [imports];
+ const sortedNewImports = isArray(imports) ? toSorted(imports, (a, b) => ts_OrganizeImports_exports.compareImportsOrRequireStatements(a, b, comparer)) : [imports];
if (!(existingImportStatements == null ? void 0 : existingImportStatements.length)) {
if (isFullSourceFile(sourceFile)) {
changes.insertNodesAtTopOfFile(sourceFile, sortedNewImports, blankLineBetween);
@@ -137648,13 +138555,6 @@ function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, f
);
});
}
-function nodeToDisplayParts(node, enclosingDeclaration) {
- const file = enclosingDeclaration.getSourceFile();
- return mapToDisplayParts((writer) => {
- const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
- printer.writeNode(4 /* Unspecified */, node, file, writer);
- });
-}
function isImportOrExportSpecifierName(location) {
return !!location.parent && isImportOrExportSpecifier(location.parent) && location.parent.propertyName === location;
}
@@ -137895,7 +138795,7 @@ function getTypeNodeIfAccessible(type, enclosingScope, program, host) {
const checker = program.getTypeChecker();
let typeIsAccessible = true;
const notAccessible = () => typeIsAccessible = false;
- const res = checker.typeToTypeNode(type, enclosingScope, 1 /* NoTruncation */, {
+ const res = checker.typeToTypeNode(type, enclosingScope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */, {
trackSymbol: (symbol, declaration, meaning) => {
typeIsAccessible = typeIsAccessible && checker.isSymbolAccessible(
symbol,
@@ -138124,7 +139024,7 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
let sourceFileCache;
return {
allowsImportingAmbientModule,
- allowsImportingSourceFile,
+ getSourceFileInfo,
allowsImportingSpecifier
};
function moduleSpecifierIsCoveredByPackageJson(specifier) {
@@ -138163,9 +139063,9 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
ambientModuleCache.set(moduleSymbol, result);
return result;
}
- function allowsImportingSourceFile(sourceFile, moduleSpecifierResolutionHost) {
+ function getSourceFileInfo(sourceFile, moduleSpecifierResolutionHost) {
if (!packageJsons.length) {
- return true;
+ return { importable: true, packageName: void 0 };
}
if (!sourceFileCache) {
sourceFileCache = /* @__PURE__ */ new Map();
@@ -138175,12 +139075,14 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
return cached;
}
}
- const moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
- if (!moduleSpecifier) {
- sourceFileCache.set(sourceFile, true);
- return true;
+ const packageName = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
+ if (!packageName) {
+ const result2 = { importable: true, packageName };
+ sourceFileCache.set(sourceFile, result2);
+ return result2;
}
- const result = moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
+ const importable = moduleSpecifierIsCoveredByPackageJson(packageName);
+ const result = { importable, packageName };
sourceFileCache.set(sourceFile, result);
return result;
}
@@ -138290,36 +139192,12 @@ function mapOneOrMany(valueOrArray, f, resultSelector = identity) {
function firstOrOnly(valueOrArray) {
return isArray(valueOrArray) ? first(valueOrArray) : valueOrArray;
}
-function getNamesForExportedSymbol(symbol, scriptTarget) {
- if (needsNameFromDeclaration(symbol)) {
- const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
- if (fromDeclaration) return fromDeclaration;
- const fileNameCase = moduleSymbolToValidIdentifier(
- getSymbolParentOrFail(symbol),
- scriptTarget,
- /*forceCapitalize*/
- false
- );
- const capitalized = moduleSymbolToValidIdentifier(
- getSymbolParentOrFail(symbol),
- scriptTarget,
- /*forceCapitalize*/
- true
- );
- if (fileNameCase === capitalized) return fileNameCase;
- return [fileNameCase, capitalized];
- }
- return symbol.name;
-}
function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
- if (needsNameFromDeclaration(symbol)) {
+ if (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */) {
return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
}
return symbol.name;
}
-function needsNameFromDeclaration(symbol) {
- return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
-}
function getDefaultLikeExportNameFromDeclaration(symbol) {
return firstDefined(symbol.declarations, (d) => {
var _a, _b, _c;
@@ -138387,16 +139265,6 @@ function stringContainsAt(haystack, needle, startIndex) {
function startsWithUnderscore(name) {
return name.charCodeAt(0) === 95 /* _ */;
}
-function isGlobalDeclaration(declaration) {
- return !isNonGlobalDeclaration(declaration);
-}
-function isNonGlobalDeclaration(declaration) {
- const sourceFile = declaration.getSourceFile();
- if (!sourceFile.externalModuleIndicator && !sourceFile.commonJsModuleIndicator) {
- return false;
- }
- return isInJSFile(declaration) || !findAncestor(declaration, (d) => isModuleDeclaration(d) && isGlobalScopeAugmentation(d));
-}
function isDeprecatedDeclaration(decl) {
return !!(getCombinedNodeFlagsAlwaysIncludeJSDoc(decl) & 65536 /* Deprecated */);
}
@@ -138492,9 +139360,13 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
if (!hasJSFileExtension(fileName)) {
return false;
}
- const compilerOptions = program.getCompilerOptions();
+ const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
const moduleKind = getEmitModuleKind(compilerOptions);
- const impliedNodeFormat = typeof file === "string" ? getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions) : file.impliedNodeFormat;
+ const sourceFileLike = typeof file === "string" ? {
+ fileName: file,
+ impliedNodeFormat: getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions)
+ } : file;
+ const impliedNodeFormat = getImpliedNodeFormatForEmitWorker(sourceFileLike, compilerOptions);
if (impliedNodeFormat === 99 /* ESNext */) {
return false;
}
@@ -138606,6 +139478,7 @@ function createCacheableExportInfoMap(host) {
const namedSymbol = isDefault && getLocalSymbolForExportDefault(symbol) || symbol;
const names = exportKind === 0 /* Named */ || isExternalModuleSymbol(namedSymbol) ? unescapeLeadingUnderscores(symbolTableKey) : getNamesForExportedSymbol(
namedSymbol,
+ checker,
/*scriptTarget*/
void 0
);
@@ -138755,7 +139628,7 @@ function isImportableFile(program, from, to, preferences, packageJsonFilter, mod
if (from === to) return false;
const cachedResult = moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {});
if ((cachedResult == null ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== void 0) {
- return !cachedResult.isBlockedByPackageJsonDependencies;
+ return !cachedResult.isBlockedByPackageJsonDependencies || !!cachedResult.packageName && fileContainsPackageImport(from, cachedResult.packageName);
}
const getCanonicalFileName = hostGetCanonicalFileName(moduleSpecifierResolutionHost);
const globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) == null ? void 0 : _a.call(moduleSpecifierResolutionHost);
@@ -138771,12 +139644,15 @@ function isImportableFile(program, from, to, preferences, packageJsonFilter, mod
}
);
if (packageJsonFilter) {
- const isAutoImportable = hasImportablePath && packageJsonFilter.allowsImportingSourceFile(to, moduleSpecifierResolutionHost);
- moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, !isAutoImportable);
- return isAutoImportable;
+ const importInfo = hasImportablePath ? packageJsonFilter.getSourceFileInfo(to, moduleSpecifierResolutionHost) : void 0;
+ moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, importInfo == null ? void 0 : importInfo.packageName, !(importInfo == null ? void 0 : importInfo.importable));
+ return !!(importInfo == null ? void 0 : importInfo.importable) || !!(importInfo == null ? void 0 : importInfo.packageName) && fileContainsPackageImport(from, importInfo.packageName);
}
return hasImportablePath;
}
+function fileContainsPackageImport(sourceFile, packageName) {
+ return sourceFile.imports && sourceFile.imports.some((i) => i.text === packageName || i.text.startsWith(packageName + "/"));
+}
function isImportablePath(fromPath, toPath3, getCanonicalFileName, globalCachePath) {
const toNodeModules = forEachAncestorDirectory(toPath3, (ancestor) => getBaseFileName(ancestor) === "node_modules" ? ancestor : void 0);
const toNodeModulesParent = toNodeModules && getDirectoryPath(getCanonicalFileName(toNodeModules));
@@ -138785,10 +139661,7 @@ function isImportablePath(fromPath, toPath3, getCanonicalFileName, globalCachePa
function forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, cb) {
var _a, _b;
const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host);
- const excludePatterns = preferences.autoImportFileExcludePatterns && mapDefined(preferences.autoImportFileExcludePatterns, (spec) => {
- const pattern = getSubPatternFromSpec(spec, "", "exclude");
- return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
- });
+ const excludePatterns = preferences.autoImportFileExcludePatterns && getIsExcludedPatterns(preferences, useCaseSensitiveFileNames2);
forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, host, (module2, file) => cb(
module2,
file,
@@ -138821,25 +139694,17 @@ function forEachExternalModuleToImportFrom(program, host, preferences, useAutoIm
(_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${timestamp() - start}`);
}
}
-function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, cb) {
- var _a, _b;
- const realpathsWithSymlinks = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
- const isExcluded = excludePatterns && (({ fileName, path }) => {
- if (excludePatterns.some((p) => p.test(fileName))) return true;
- if ((realpathsWithSymlinks == null ? void 0 : realpathsWithSymlinks.size) && pathContainsNodeModules(fileName)) {
- let dir = getDirectoryPath(fileName);
- return forEachAncestorDirectory(getDirectoryPath(path), (dirPath) => {
- const symlinks = realpathsWithSymlinks.get(ensureTrailingDirectorySeparator(dirPath));
- if (symlinks) {
- return symlinks.some((s) => excludePatterns.some((p) => p.test(fileName.replace(dir, s))));
- }
- dir = getDirectoryPath(dir);
- }) ?? false;
- }
- return false;
+function getIsExcludedPatterns(preferences, useCaseSensitiveFileNames2) {
+ return mapDefined(preferences.autoImportFileExcludePatterns, (spec) => {
+ const pattern = getSubPatternFromSpec(spec, "", "exclude");
+ return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
});
+}
+function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, cb) {
+ var _a;
+ const isExcluded = excludePatterns && getIsExcluded(excludePatterns, host);
for (const ambient of checker.getAmbientModules()) {
- if (!ambient.name.includes("*") && !(excludePatterns && ((_b = ambient.declarations) == null ? void 0 : _b.every((d) => isExcluded(d.getSourceFile()))))) {
+ if (!ambient.name.includes("*") && !(excludePatterns && ((_a = ambient.declarations) == null ? void 0 : _a.every((d) => isExcluded(d.getSourceFile()))))) {
cb(
ambient,
/*sourceFile*/
@@ -138853,6 +139718,28 @@ function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, c
}
}
}
+function getIsExcluded(excludePatterns, host) {
+ var _a;
+ const realpathsWithSymlinks = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
+ return ({ fileName, path }) => {
+ if (excludePatterns.some((p) => p.test(fileName))) return true;
+ if ((realpathsWithSymlinks == null ? void 0 : realpathsWithSymlinks.size) && pathContainsNodeModules(fileName)) {
+ let dir = getDirectoryPath(fileName);
+ return forEachAncestorDirectory(getDirectoryPath(path), (dirPath) => {
+ const symlinks = realpathsWithSymlinks.get(ensureTrailingDirectorySeparator(dirPath));
+ if (symlinks) {
+ return symlinks.some((s) => excludePatterns.some((p) => p.test(fileName.replace(dir, s))));
+ }
+ dir = getDirectoryPath(dir);
+ }) ?? false;
+ }
+ return false;
+ };
+}
+function getIsFileExcluded(host, preferences) {
+ if (!preferences.autoImportFileExcludePatterns) return () => false;
+ return getIsExcluded(getIsExcludedPatterns(preferences, hostUsesCaseSensitiveFileNames(host)), host);
+}
function getExportInfoMap(importingFile, host, program, preferences, cancellationToken) {
var _a, _b, _c, _d, _e;
const start = timestamp();
@@ -138930,9 +139817,18 @@ function getDefaultLikeExportInfo(moduleSymbol, checker) {
function isImportableSymbol(symbol, checker) {
return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
}
-function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
+function getNamesForExportedSymbol(defaultExport, checker, scriptTarget) {
+ let names;
+ forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, (name, capitalizedName) => {
+ names = capitalizedName ? [name, capitalizedName] : name;
+ return true;
+ });
+ return Debug.checkDefined(names);
+}
+function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
let chain;
let current = defaultExport;
+ const seen = /* @__PURE__ */ new Map();
while (current) {
const fromDeclaration = getDefaultLikeExportNameFromDeclaration(current);
if (fromDeclaration) {
@@ -138944,11 +139840,25 @@ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, pre
if (final) return final;
}
chain = append(chain, current);
+ if (!addToSeen(seen, current)) break;
current = current.flags & 2097152 /* Alias */ ? checker.getImmediateAliasedSymbol(current) : void 0;
}
for (const symbol of chain ?? emptyArray) {
if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
- const final = cb(moduleSymbolToValidIdentifier(symbol.parent, getEmitScriptTarget(compilerOptions), preferCapitalizedNames));
+ const final = cb(
+ moduleSymbolToValidIdentifier(
+ symbol.parent,
+ scriptTarget,
+ /*forceCapitalize*/
+ false
+ ),
+ moduleSymbolToValidIdentifier(
+ symbol.parent,
+ scriptTarget,
+ /*forceCapitalize*/
+ true
+ )
+ );
if (final) return final;
}
}
@@ -139614,8 +140524,8 @@ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)
}
}
function tryClassifyTripleSlashComment(start, width) {
- const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/im;
- const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/img;
+ const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/m;
+ const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/g;
const text = sourceFile.text.substr(start, width);
const match = tripleSlashXMLCommentRegEx.exec(text);
if (!match) {
@@ -140046,10 +140956,8 @@ var DocumentHighlights;
return [...nodes, container];
}
return nodes;
- case 210 /* ObjectLiteralExpression */:
- return void 0;
default:
- Debug.assertNever(container, "Invalid container kind.");
+ return void 0;
}
}
function pushKeywordIf(keywordList, token, ...expected) {
@@ -141330,7 +142238,7 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo
}
// src/services/sourcemaps.ts
-var base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+/=]+)$)?/;
+var base64UrlRegExp = /^data:(?:application\/json;charset=[uU][tT][fF]-8;base64,([A-Za-z0-9+/=]+)$)?/;
function getSourceMapper(host) {
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
const currentDirectory = host.getCurrentDirectory();
@@ -141382,7 +142290,7 @@ function getSourceMapper(host) {
}
const options = program.getCompilerOptions();
const outPath = options.outFile;
- const declarationPath = outPath ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), currentDirectory, program.getCommonSourceDirectory(), getCanonicalFileName);
+ const declarationPath = outPath ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), program);
if (declarationPath === void 0) return void 0;
const newLoc = getDocumentPositionMapper2(declarationPath, info.fileName).getGeneratedPosition(info);
return newLoc === info ? void 0 : newLoc;
@@ -141474,7 +142382,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
program.getSemanticDiagnostics(sourceFile, cancellationToken);
const diags = [];
const checker = program.getTypeChecker();
- const isCommonJSFile = sourceFile.impliedNodeFormat === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
+ const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
}
@@ -141495,7 +142403,8 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
}
addRange(diags, sourceFile.bindSuggestionDiagnostics);
addRange(diags, program.getSuggestionDiagnostics(sourceFile, cancellationToken));
- return diags.sort((d1, d2) => d1.start - d2.start);
+ diags.sort((d1, d2) => d1.start - d2.start);
+ return diags;
function check(node) {
if (isJsFile) {
if (canBeConvertedToClass(node, checker)) {
@@ -141741,6 +142650,7 @@ function transpileWorker(input, transpileOptions, declaration) {
options.isolatedDeclarations = true;
} else {
options.declaration = false;
+ options.declarationMap = false;
}
const newLine = getNewLineCharacter(options);
const compilerHost = {
@@ -141936,7 +142846,8 @@ function getContainers(declaration) {
}
container = getContainerNode(container);
}
- return containers.reverse();
+ containers.reverse();
+ return containers;
}
function compareNavigateToItems(i1, i2) {
return compareValues(i1.matchKind, i2.matchKind) || compareStringsCaseSensitiveUI(i1.name, i2.name);
@@ -142716,13 +143627,12 @@ function isFunctionOrClassExpression(node) {
}
function cleanText(text) {
text = text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
- return text.replace(/\\?(\r?\n|\r|\u2028|\u2029)/g, "");
+ return text.replace(/\\?(?:\r?\n|[\r\u2028\u2029])/g, "");
}
// src/services/_namespaces/ts.refactor.ts
var ts_refactor_exports = {};
__export(ts_refactor_exports, {
- addExportToChanges: () => addExportToChanges,
addExportsInOldFile: () => addExportsInOldFile,
addImportsForMovedSymbols: () => addImportsForMovedSymbols,
addNewFileToTsconfig: () => addNewFileToTsconfig,
@@ -142734,13 +143644,8 @@ __export(ts_refactor_exports, {
convertStringOrTemplateLiteral: () => ts_refactor_convertStringOrTemplateLiteral_exports,
convertToOptionalChainExpression: () => ts_refactor_convertToOptionalChainExpression_exports,
createNewFileName: () => createNewFileName,
- deleteMovedStatements: () => deleteMovedStatements,
- deleteUnusedImports: () => deleteUnusedImports,
- deleteUnusedOldImports: () => deleteUnusedOldImports,
doChangeNamedToNamespaceOrDefault: () => doChangeNamedToNamespaceOrDefault,
extractSymbol: () => ts_refactor_extractSymbol_exports,
- filterImport: () => filterImport,
- forEachImportInStatement: () => forEachImportInStatement,
generateGetAccessorAndSetAccessor: () => ts_refactor_generateGetAccessorAndSetAccessor_exports,
getApplicableRefactors: () => getApplicableRefactors,
getEditsForRefactor: () => getEditsForRefactor,
@@ -142748,16 +143653,11 @@ __export(ts_refactor_exports, {
getIdentifierForNode: () => getIdentifierForNode,
getNewStatementsAndRemoveFromOldFile: () => getNewStatementsAndRemoveFromOldFile,
getStatementsToMove: () => getStatementsToMove,
- getTopLevelDeclarationStatement: () => getTopLevelDeclarationStatement,
getUsageInfo: () => getUsageInfo,
inferFunctionReturnType: () => ts_refactor_inferFunctionReturnType_exports,
isRefactorErrorInfo: () => isRefactorErrorInfo,
- isTopLevelDeclaration: () => isTopLevelDeclaration,
- moduleSpecifierFromImport: () => moduleSpecifierFromImport,
- nameOfTopLevelDeclaration: () => nameOfTopLevelDeclaration,
refactorKindBeginsWith: () => refactorKindBeginsWith,
- registerRefactor: () => registerRefactor,
- updateImportsInOtherFiles: () => updateImportsInOtherFiles
+ registerRefactor: () => registerRefactor
});
// src/services/refactorProvider.ts
@@ -143191,9 +144091,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
const namespaceImportName = namespaceNameConflicts ? getUniqueName(preferredName, sourceFile) : preferredName;
const neededNamedImports = /* @__PURE__ */ new Set();
for (const element of toConvert.elements) {
- const propertyName = (element.propertyName || element.name).text;
+ const propertyName = element.propertyName || element.name;
ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => {
- const access = factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), propertyName);
+ const access = propertyName.kind === 11 /* StringLiteral */ ? factory.createElementAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)) : factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName));
if (isShorthandPropertyAssignment(id.parent)) {
changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access));
} else if (isExportSpecifier(id.parent)) {
@@ -143209,7 +144109,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
);
if (neededNamedImports.size && isImportDeclaration(importDecl)) {
- const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text)));
+ const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.cloneNode(element.propertyName), factory.cloneNode(element.name)));
changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
importDecl,
/*defaultImportName*/
@@ -143760,7 +144660,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(getNormalizedAbsolutePath(oldFile.fileName, program.getCurrentDirectory())), targetFileName);
if (getStringComparer(!program.useCaseSensitiveFileNames())(pathToTargetFileWithExtension, sourceFile.fileName) === 0 /* EqualTo */) return;
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
+ const newModuleSpecifier = ts_moduleSpecifiers_exports.getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
if (newImportDeclaration) changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
const ns = getNamespaceLikeImport(importNode);
@@ -144171,7 +145071,7 @@ function isPureImport(node) {
return false;
}
}
-function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PURE__ */ new Set()) {
+function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PURE__ */ new Set(), enclosingRange) {
var _a;
const movedSymbols = /* @__PURE__ */ new Set();
const oldImportsNeededByTargetFile = /* @__PURE__ */ new Map();
@@ -144187,7 +145087,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
}
const unusedImportsFromOldFile = /* @__PURE__ */ new Set();
for (const statement of toMove) {
- forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => {
+ forEachReference(statement, checker, enclosingRange, (symbol, isValidTypeOnlyUseSite) => {
if (!symbol.declarations || isGlobalType(checker, symbol)) {
return;
}
@@ -144217,7 +145117,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR
if (jsxNamespaceSymbol && !!(statement.transformFlags & 2 /* ContainsJsx */)) {
unusedImportsFromOldFile.delete(jsxNamespaceSymbol);
}
- forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => {
+ forEachReference(statement, checker, enclosingRange, (symbol, isValidTypeOnlyUseSite) => {
if (movedSymbols.has(symbol)) oldFileImportsFromTargetFile.set(symbol, isValidTypeOnlyUseSite);
unusedImportsFromOldFile.delete(symbol);
});
@@ -144259,9 +145159,12 @@ function makeUniqueFilename(proposedFilename, extension, inDirectory, host) {
function inferNewFileName(importsFromNewFile, movedSymbols) {
return forEachKey(importsFromNewFile, symbolNameNoDefault) || forEachKey(movedSymbols, symbolNameNoDefault) || "newFile";
}
-function forEachReference(node, checker, onReference) {
+function forEachReference(node, checker, enclosingRange, onReference) {
node.forEachChild(function cb(node2) {
if (isIdentifier(node2) && !isDeclarationName(node2)) {
+ if (enclosingRange && !rangeContainsRange(enclosingRange, node2)) {
+ return;
+ }
const sym = checker.getSymbolAtLocation(node2);
if (sym) onReference(sym, isValidTypeOnlyAliasUseSite(node2));
} else {
@@ -144424,12 +145327,18 @@ function getExistingLocals(sourceFile, statements, checker) {
}
}
for (const statement of statements) {
- forEachReference(statement, checker, (s) => {
- const symbol = skipAlias(s, checker);
- if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration).path === sourceFile.path) {
- existingLocals.add(symbol);
+ forEachReference(
+ statement,
+ checker,
+ /*enclosingRange*/
+ void 0,
+ (s) => {
+ const symbol = skipAlias(s, checker);
+ if (symbol.valueDeclaration && getSourceFileOfNode(symbol.valueDeclaration).path === sourceFile.path) {
+ existingLocals.add(symbol);
+ }
}
- });
+ );
}
return existingLocals;
}
@@ -144521,7 +145430,12 @@ registerRefactor(refactorName4, {
const { references, declaration, replacement } = info;
const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
for (const node of references) {
- tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
+ const closestStringIdentifierParent = isStringLiteral(replacement) && isIdentifier(node) && walkUpParenthesizedExpressions(node.parent);
+ if (closestStringIdentifierParent && isTemplateSpan(closestStringIdentifierParent) && !isTaggedTemplateExpression(closestStringIdentifierParent.parent.parent)) {
+ replaceTemplateStringVariableWithLiteral(tracker, file, closestStringIdentifierParent, replacement);
+ } else {
+ tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
+ }
}
tracker.delete(file, declaration);
});
@@ -144610,6 +145524,19 @@ function getReplacementExpression(reference, replacement) {
}
return replacement;
}
+function replaceTemplateStringVariableWithLiteral(tracker, sourceFile, reference, replacement) {
+ const templateExpression = reference.parent;
+ const index = templateExpression.templateSpans.indexOf(reference);
+ const prevNode = index === 0 ? templateExpression.head : templateExpression.templateSpans[index - 1];
+ tracker.replaceRangeWithText(
+ sourceFile,
+ {
+ pos: prevNode.getEnd() - 2,
+ end: reference.literal.getStart() + 1
+ },
+ replacement.text.replace(/\\/g, "\\\\").replace(/`/g, "\\`")
+ );
+}
// src/services/refactors/moveToNewFile.ts
var refactorName5 = "Move to a new file";
@@ -146818,7 +147745,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
if (!isJS) {
let type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node);
type = checker.getBaseTypeOfLiteralType(type);
- typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */);
+ typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
}
const paramDecl = factory.createParameterDeclaration(
/*modifiers*/
@@ -146838,8 +147765,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
callArguments.push(factory.createIdentifier(name));
});
const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
- const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
+ typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
+ const typeParameters = typeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(typeParametersAndDeclarations, ({ declaration }) => declaration);
const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
decl.name,
/*typeArguments*/
@@ -146847,7 +147774,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
)) : void 0;
if (isExpression(node) && !isJS) {
const contextualType = checker.getContextualType(node);
- returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */);
+ returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
}
const { body, returnValueProperty } = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & 1 /* HasReturn */));
suppressLeadingAndTrailingTrivia(body);
@@ -146887,7 +147814,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
checker.typeToTypeNode(
checker.getTypeAtLocation(range.thisNode),
scope,
- 1 /* NoTruncation */
+ 1 /* NoTruncation */,
+ 8 /* AllowUnresolvedNames */
),
/*initializer*/
void 0
@@ -146984,7 +147912,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
const variableType = checker.typeToTypeNode(
checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)),
scope,
- 1 /* NoTruncation */
+ 1 /* NoTruncation */,
+ 8 /* AllowUnresolvedNames */
);
typeElements.push(factory.createPropertySignature(
/*modifiers*/
@@ -147115,7 +148044,7 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
const file = scope.getSourceFile();
const localNameText = getIdentifierForNode(node, scope, checker, file);
const isJS = isInJSFile(scope);
- let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */);
+ let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
let initializer = transformConstantInitializer(skipParentheses(node), substitutions);
({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer));
suppressLeadingAndTrailingTrivia(initializer);
@@ -147240,13 +148169,13 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
} else {
const paramType = checker.getTypeAtLocation(p);
if (paramType === checker.getAnyType()) hasAny = true;
- parameters.push(factory.updateParameterDeclaration(p, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */), p.initializer));
+ parameters.push(factory.updateParameterDeclaration(p, p.modifiers, p.dotDotDotToken, p.name, p.questionToken, p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */), p.initializer));
}
}
if (hasAny) return { variableType: variableType2, initializer: initializer2 };
variableType2 = void 0;
if (isArrowFunction(initializer2)) {
- initializer2 = factory.updateArrowFunction(initializer2, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */), initializer2.equalsGreaterThanToken, initializer2.body);
+ initializer2 = factory.updateArrowFunction(initializer2, canHaveModifiers(node) ? getModifiers(node) : void 0, initializer2.typeParameters, parameters, initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */), initializer2.equalsGreaterThanToken, initializer2.body);
} else {
if (functionSignature && !!functionSignature.thisParameter) {
const firstParameter = firstOrUndefined(parameters);
@@ -147263,7 +148192,7 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
"this",
/*questionToken*/
void 0,
- checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */)
+ checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */)
)
);
}
@@ -147872,11 +148801,31 @@ function getInfo4(context) {
return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) };
}
const typeChecker = context.program.getTypeChecker();
- const returnType = tryGetReturnType(typeChecker, declaration);
+ let returnType;
+ if (typeChecker.isImplementationOfOverload(declaration)) {
+ const signatures = typeChecker.getTypeAtLocation(declaration).getCallSignatures();
+ if (signatures.length > 1) {
+ returnType = typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType()));
+ }
+ }
+ if (!returnType) {
+ const signature = typeChecker.getSignatureFromDeclaration(declaration);
+ if (signature) {
+ const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
+ if (typePredicate && typePredicate.type) {
+ const typePredicateTypeNode = typeChecker.typePredicateToTypePredicateNode(typePredicate, declaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
+ if (typePredicateTypeNode) {
+ return { declaration, returnTypeNode: typePredicateTypeNode };
+ }
+ } else {
+ returnType = typeChecker.getReturnTypeOfSignature(signature);
+ }
+ }
+ }
if (!returnType) {
return { error: getLocaleSpecificMessage(Diagnostics.Could_not_determine_function_return_type) };
}
- const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */);
+ const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
if (returnTypeNode) {
return { declaration, returnTypeNode };
}
@@ -147892,18 +148841,6 @@ function isConvertibleDeclaration(node) {
return false;
}
}
-function tryGetReturnType(typeChecker, node) {
- if (typeChecker.isImplementationOfOverload(node)) {
- const signatures = typeChecker.getTypeAtLocation(node).getCallSignatures();
- if (signatures.length > 1) {
- return typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType()));
- }
- }
- const signature = typeChecker.getSignatureFromDeclaration(node);
- if (signature) {
- return typeChecker.getReturnTypeOfSignature(signature);
- }
-}
// src/services/classifier2020.ts
var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
@@ -148201,9 +149138,9 @@ var NodeObject = class {
getChildAt(index, sourceFile) {
return this.getChildren(sourceFile)[index];
}
- getChildren(sourceFile) {
+ getChildren(sourceFile = getSourceFileOfNode(this)) {
this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine");
- return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile));
+ return getNodeChildren(this, sourceFile) ?? setNodeChildren(this, sourceFile, createChildren(this, sourceFile));
}
getFirstToken(sourceFile) {
this.assertHasRealPosition();
@@ -148284,7 +149221,7 @@ function createSyntaxList(nodes, parent2) {
pos = node.end;
}
addSyntheticNodes(children, pos, nodes.end, parent2);
- setNodeChildren(list, children);
+ list._children = children;
return list;
}
var TokenOrIdentifierObject = class {
@@ -149223,13 +150160,18 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
if (host.getParsedCommandLine) {
(_a3 = host.onReleaseParsedCommandLine) == null ? void 0 : _a3.call(host, configFileName, oldResolvedRef, oldOptions);
} else if (oldResolvedRef) {
- onReleaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions);
+ releaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions);
}
}
- function onReleaseOldSourceFile(oldSourceFile, oldOptions) {
+ function releaseOldSourceFile(oldSourceFile, oldOptions) {
const oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldOptions);
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, oldSettingsKey, oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
}
+ function onReleaseOldSourceFile(oldSourceFile, oldOptions, hasSourceFileByPath, newSourceFileByResolvedPath) {
+ var _a3;
+ releaseOldSourceFile(oldSourceFile, oldOptions);
+ (_a3 = host.onReleaseOldSourceFile) == null ? void 0 : _a3.call(host, oldSourceFile, oldOptions, hasSourceFileByPath, newSourceFileByResolvedPath);
+ }
function getOrCreateSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) {
return getOrCreateSourceFileByPath(fileName, toPath(fileName, currentDirectory, getCanonicalFileName), languageVersionOrOptions, onError, shouldCreateNewSourceFile);
}
@@ -149340,6 +150282,108 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken);
return [...semanticDiagnostics, ...declarationDiagnostics];
}
+ function getRegionSemanticDiagnostics(fileName, ranges) {
+ synchronizeHostData();
+ const sourceFile = getValidSourceFile(fileName);
+ const options = program.getCompilerOptions();
+ if (skipTypeChecking(sourceFile, options, program) || !canIncludeBindAndCheckDiagnostics(sourceFile, options) || program.getCachedSemanticDiagnostics(sourceFile)) {
+ return void 0;
+ }
+ const nodes = getNodesForRanges(sourceFile, ranges);
+ if (!nodes) {
+ return void 0;
+ }
+ const checkedSpans = normalizeSpans(nodes.map((node) => createTextSpanFromBounds(node.getFullStart(), node.getEnd())));
+ const semanticDiagnostics = program.getSemanticDiagnostics(sourceFile, cancellationToken, nodes);
+ return {
+ diagnostics: semanticDiagnostics.slice(),
+ spans: checkedSpans
+ };
+ }
+ function getNodesForRanges(file, ranges) {
+ const nodes = [];
+ const spans = normalizeSpans(ranges.map((range) => createTextSpanFromRange(range)));
+ for (const span of spans) {
+ const nodesForSpan = getNodesForSpan(file, span);
+ if (!nodesForSpan) {
+ return void 0;
+ }
+ nodes.push(...nodesForSpan);
+ }
+ if (!nodes.length) {
+ return void 0;
+ }
+ return nodes;
+ }
+ function getNodesForSpan(file, span) {
+ if (textSpanContainsTextRange(span, file)) {
+ return void 0;
+ }
+ const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file;
+ const enclosingNode = findAncestor(endToken, (node) => textRangeContainsTextSpan(node, span));
+ const nodes = [];
+ chooseOverlappingNodes(span, enclosingNode, nodes);
+ if (file.end === span.start + span.length) {
+ nodes.push(file.endOfFileToken);
+ }
+ if (some(nodes, isSourceFile)) {
+ return void 0;
+ }
+ return nodes;
+ }
+ function chooseOverlappingNodes(span, node, result) {
+ if (!nodeOverlapsWithSpan(node, span)) {
+ return false;
+ }
+ if (textSpanContainsTextRange(span, node)) {
+ addSourceElement(node, result);
+ return true;
+ }
+ if (isBlockLike(node)) {
+ return chooseOverlappingBlockLike(span, node, result);
+ }
+ if (isClassLike(node)) {
+ return chooseOverlappingClassLike(span, node, result);
+ }
+ addSourceElement(node, result);
+ return true;
+ }
+ function nodeOverlapsWithSpan(node, span) {
+ const spanEnd = span.start + span.length;
+ return node.pos < spanEnd && node.end > span.start;
+ }
+ function addSourceElement(node, result) {
+ while (node.parent && !isSourceElement(node)) {
+ node = node.parent;
+ }
+ result.push(node);
+ }
+ function chooseOverlappingBlockLike(span, node, result) {
+ const childResult = [];
+ const stmts = node.statements.filter((stmt) => chooseOverlappingNodes(span, stmt, childResult));
+ if (stmts.length === node.statements.length) {
+ addSourceElement(node, result);
+ return true;
+ }
+ result.push(...childResult);
+ return false;
+ }
+ function chooseOverlappingClassLike(span, node, result) {
+ var _a2, _b, _c;
+ const overlaps = (n) => textRangeIntersectsWithTextSpan(n, span);
+ if (((_a2 = node.modifiers) == null ? void 0 : _a2.some(overlaps)) || node.name && overlaps(node.name) || ((_b = node.typeParameters) == null ? void 0 : _b.some(overlaps)) || ((_c = node.heritageClauses) == null ? void 0 : _c.some(overlaps))) {
+ addSourceElement(node, result);
+ return true;
+ }
+ const childResult = [];
+ const members = node.members.filter((member) => chooseOverlappingNodes(span, member, childResult));
+ if (members.length === node.members.length) {
+ addSourceElement(node, result);
+ return true;
+ }
+ result.push(...childResult);
+ return false;
+ }
function getSuggestionDiagnostics(fileName) {
synchronizeHostData();
return computeSuggestionDiagnostics(getValidSourceFile(fileName), program, cancellationToken);
@@ -149694,6 +150738,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
synchronizeHostData();
Debug.assert(args.type === "file");
const sourceFile = getValidSourceFile(args.fileName);
+ if (containsParseError(sourceFile)) return emptyArray;
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
const mode = args.mode ?? (args.skipDestructiveCodeActions ? "SortAndCombine" /* SortAndCombine */ : "All" /* All */);
return ts_OrganizeImports_exports.organizeImports(sourceFile, formatContext, host, program, preferences, mode);
@@ -150036,7 +151081,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
}
function getTodoCommentsRegExp() {
- const singleLineCommentStart = /(?:\/\/+\s*)/.source;
+ const singleLineCommentStart = /(?:\/{2,}\s*)/.source;
const multiLineCommentStart = /(?:\/\*+\s*)/.source;
const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
@@ -150154,6 +151199,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
cleanupSemanticCache,
getSyntacticDiagnostics,
getSemanticDiagnostics,
+ getRegionSemanticDiagnostics,
getSuggestionDiagnostics,
getCompilerOptionsDiagnostics,
getSyntacticClassifications: getSyntacticClassifications2,
@@ -151316,19 +152362,16 @@ __export(ts_codefix_exports, {
createFileTextChanges: () => createFileTextChanges,
createImportAdder: () => createImportAdder,
createImportSpecifierResolver: () => createImportSpecifierResolver,
- createJsonPropertyAssignment: () => createJsonPropertyAssignment,
createMissingMemberNodes: () => createMissingMemberNodes,
createSignatureDeclarationFromCallExpression: () => createSignatureDeclarationFromCallExpression,
createSignatureDeclarationFromSignature: () => createSignatureDeclarationFromSignature,
createStubbedBody: () => createStubbedBody,
eachDiagnostic: () => eachDiagnostic,
findAncestorMatchingSpan: () => findAncestorMatchingSpan,
- findJsonProperty: () => findJsonProperty,
generateAccessorFromProperty: () => generateAccessorFromProperty,
getAccessorConvertiblePropertyAtPosition: () => getAccessorConvertiblePropertyAtPosition,
getAllFixes: () => getAllFixes,
getAllSupers: () => getAllSupers,
- getArgumentTypesAndTypeParameters: () => getArgumentTypesAndTypeParameters,
getFixes: () => getFixes,
getImportCompletionAction: () => getImportCompletionAction,
getImportKind: () => getImportKind,
@@ -151343,6 +152386,7 @@ __export(ts_codefix_exports, {
setJsonCompilerOptionValue: () => setJsonCompilerOptionValue,
setJsonCompilerOptionValues: () => setJsonCompilerOptionValues,
tryGetAutoImportableReferenceFromTypeNode: () => tryGetAutoImportableReferenceFromTypeNode,
+ typePredicateToAutoImportableTypeNode: () => typePredicateToAutoImportableTypeNode,
typeToAutoImportableTypeNode: () => typeToAutoImportableTypeNode
});
@@ -151729,7 +152773,7 @@ function isInsideAwaitableBody(node) {
function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) {
if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
const exprType = checker.getTypeAtLocation(insertionSite);
- const asyncIter = checker.getAsyncIterableType();
+ const asyncIter = checker.getAnyAsyncIterableType();
if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) {
const forOf = insertionSite.parent;
changeTracker.replaceNode(sourceFile, forOf, factory.updateForOfStatement(forOf, factory.createToken(135 /* AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement));
@@ -154086,7 +155130,7 @@ function getLeftAndRightSiblings(typedefNode) {
function findEndOfTextBetween(jsDocComment, from, to) {
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
for (let i = comment.length; i > 0; i--) {
- if (!/[*/\s]/g.test(comment.substring(i - 1, i))) {
+ if (!/[*/\s]/.test(comment.substring(i - 1, i))) {
return from + i;
}
}
@@ -154293,6 +155337,8 @@ function addMissingDeclarations(context, implementedTypeNode, sourceFile, classD
classDeclaration,
/*flags*/
void 0,
+ /*internalFlags*/
+ void 0,
getNoopSymbolTrackerWithResolver(context)
));
}
@@ -154412,7 +155458,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
addImport(first(info));
}
function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite, referenceImport) {
- var _a;
+ var _a, _b;
const moduleSymbol = Debug.checkDefined(exportedSymbol.parent);
const symbolName2 = getNameForExportedSymbol(exportedSymbol, getEmitScriptTarget(compilerOptions));
const checker = program.getTypeChecker();
@@ -154429,10 +155475,14 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
preferences,
cancellationToken
);
+ if (!exportInfo) {
+ Debug.assert((_a = preferences.autoImportFileExcludePatterns) == null ? void 0 : _a.length);
+ return;
+ }
const useRequire = shouldUseRequire(sourceFile, program);
let fix = getImportFixForSymbol(
sourceFile,
- Debug.checkDefined(exportInfo),
+ exportInfo,
program,
/*position*/
void 0,
@@ -154442,7 +155492,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
preferences
);
if (fix) {
- const localName = ((_a = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier)) == null ? void 0 : _a.text) ?? symbolName2;
+ const localName = ((_b = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier)) == null ? void 0 : _b.text) ?? symbolName2;
if (referenceImport && isTypeOnlyImportDeclaration(referenceImport) && (fix.kind === 3 /* AddNew */ || fix.kind === 2 /* AddToExisting */) && fix.addAsTypeOnly === 1 /* Allowed */) {
fix = { ...fix, addAsTypeOnly: 2 /* Required */ };
}
@@ -154479,9 +155529,10 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
sourceFile,
exportingFileName,
compilerOptions,
- createModuleSpecifierResolutionHost(program, host)
+ createModuleSpecifierResolutionHost(program, host),
+ preferences
);
- const importKind = getImportKind(futureExportingSourceFile, exportKind, compilerOptions);
+ const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
const addAsTypeOnly = getAddAsTypeOnly(
isImportUsageValidAsTypeOnly,
/*isForNewImportDeclaration*/
@@ -154821,7 +155872,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
}
function createImportSpecifierResolver(importingFile, program, host, preferences) {
const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
- const importMap = createExistingImportMap(program.getTypeChecker(), importingFile, program.getCompilerOptions());
+ const importMap = createExistingImportMap(importingFile, program);
return { getModuleSpecifierForBestExportInfo };
function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
const { fixes, computedWithoutCacheCount } = getImportFixes(
@@ -154891,8 +155942,12 @@ function codeFixActionToCodeAction({ description: description3, changes, command
}
function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
const getChecker = createGetChecker(program, host);
+ const isFileExcluded = preferences.autoImportFileExcludePatterns && getIsFileExcluded(host, preferences);
+ const mergedModuleSymbol = program.getTypeChecker().getMergedSymbol(moduleSymbol);
+ const moduleSourceFile = isFileExcluded && mergedModuleSymbol.declarations && getDeclarationOfKind(mergedModuleSymbol, 307 /* SourceFile */);
+ const moduleSymbolExcluded = moduleSourceFile && isFileExcluded(moduleSourceFile);
return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
+ if (getChecker(info[0].isFromPackageJson).getMergedSymbol(skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson))) === symbol && (moduleSymbolExcluded || info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol))) {
return info;
}
});
@@ -154924,7 +155979,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
}
}
}
-function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(program.getTypeChecker(), sourceFile, program.getCompilerOptions()) : void 0, fromCacheOnly) {
+function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
const checker = program.getTypeChecker();
const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
@@ -155039,7 +156094,8 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
};
}
}
-function createExistingImportMap(checker, importingFile, compilerOptions) {
+function createExistingImportMap(importingFile, program) {
+ const checker = program.getTypeChecker();
let importMap;
for (const moduleSpecifier of importingFile.imports) {
const i = importFromModuleSpecifier(moduleSpecifier);
@@ -155060,7 +156116,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
if (!matchingDeclarations) return emptyArray;
if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag)) return emptyArray;
- const importKind = getImportKind(importingFile, exportKind, compilerOptions);
+ const importKind = getImportKind(importingFile, exportKind, program);
return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
}
};
@@ -155075,8 +156131,8 @@ function shouldUseRequire(sourceFile, program) {
if (compilerOptions.configFile) {
return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
}
- if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) return true;
- if (sourceFile.impliedNodeFormat === 99 /* ESNext */) return false;
+ if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */) return true;
+ if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */) return false;
for (const otherFile of program.getSourceFiles()) {
if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue;
if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) return true;
@@ -155128,20 +156184,13 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
}
- const importKind = getImportKind(sourceFile, exportInfo2.exportKind, compilerOptions);
+ const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
let qualification;
if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
let namespacePrefix;
if (exportEquals !== exportInfo2.moduleSymbol) {
- namespacePrefix = forEachNameOfDefaultExport(
- exportEquals,
- checker,
- compilerOptions,
- /*preferCapitalizedNames*/
- false,
- identity
- );
+ namespacePrefix = forEachNameOfDefaultExport(exportEquals, checker, getEmitScriptTarget(compilerOptions), identity);
}
namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
exportInfo2.moduleSymbol,
@@ -155205,7 +156254,7 @@ function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
}
function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) {
const _toPath = (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
- return sort(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, preferences, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
+ return toSorted(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, preferences, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
}
function getFixInfosWithoutDiagnostic(context, symbolToken, useAutoImportProvider) {
const info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
@@ -155314,8 +156363,8 @@ function getUmdSymbol(token, checker) {
}
return void 0;
}
-function getImportKind(importingFile, exportKind, compilerOptions, forceImportKeyword) {
- if (compilerOptions.verbatimModuleSyntax && (getEmitModuleKind(compilerOptions) === 1 /* CommonJS */ || importingFile.impliedNodeFormat === 1 /* CommonJS */)) {
+function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
+ if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
return 3 /* CommonJS */;
}
switch (exportKind) {
@@ -155324,18 +156373,18 @@ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKe
case 1 /* Default */:
return 1 /* Default */;
case 2 /* ExportEquals */:
- return getExportEqualsImportKind(importingFile, compilerOptions, !!forceImportKeyword);
+ return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
case 3 /* UMD */:
- return getUmdImportKind(importingFile, compilerOptions, !!forceImportKeyword);
+ return getUmdImportKind(importingFile, program, !!forceImportKeyword);
default:
return Debug.assertNever(exportKind);
}
}
-function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
- if (getAllowSyntheticDefaultImports(compilerOptions)) {
+function getUmdImportKind(importingFile, program, forceImportKeyword) {
+ if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
return 1 /* Default */;
}
- const moduleKind = getEmitModuleKind(compilerOptions);
+ const moduleKind = getEmitModuleKind(program.getCompilerOptions());
switch (moduleKind) {
case 2 /* AMD */:
case 1 /* CommonJS */:
@@ -155354,7 +156403,7 @@ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
return 2 /* Namespace */;
case 100 /* Node16 */:
case 199 /* NodeNext */:
- return importingFile.impliedNodeFormat === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
+ return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
default:
return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
}
@@ -155427,7 +156476,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
});
function addSymbol(moduleSymbol, toFile, exportedSymbol, exportKind, program2, isFromPackageJson) {
const moduleSpecifierResolutionHost = getModuleSpecifierResolutionHost(isFromPackageJson);
- if (toFile && isImportableFile(program2, fromFile, toFile, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) || !toFile && packageJsonFilter.allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost)) {
+ if (toFile && isImportableFile(program2, fromFile, toFile, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) || (!toFile && packageJsonFilter.allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost) || fileContainsPackageImport(fromFile, stripQuotes(moduleSymbol.name)))) {
const checker = program2.getTypeChecker();
originalSymbolToExportInfos.add(getUniqueSymbolId(exportedSymbol, checker).toString(), { symbol: exportedSymbol, moduleSymbol, moduleFileName: toFile == null ? void 0 : toFile.fileName, exportKind, targetFlags: skipAlias(exportedSymbol, checker).flags, isFromPackageJson });
}
@@ -155437,7 +156486,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
cancellationToken.throwIfCancellationRequested();
const compilerOptions = program2.getCompilerOptions();
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
- if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions, isJsxTagName, (name) => name === symbolName2)) {
+ if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, getEmitScriptTarget(compilerOptions), (name, capitalizedName) => (isJsxTagName ? capitalizedName ?? name : name) === symbolName2)) {
addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
}
const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
@@ -155651,7 +156700,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
}
if (namedImports.length) {
const { specifierComparer, isSorted } = ts_OrganizeImports_exports.getNamedImportSpecifierComparerWithDetection(clause.parent, preferences, sourceFile);
- const newSpecifiers = stableSort(
+ const newSpecifiers = toSorted(
namedImports.map(
(namedImport) => factory.createImportSpecifier(
(!clause.isTypeOnly || promoteFromTypeOnly2) && shouldUseTypeOnly(namedImport, preferences),
@@ -155668,7 +156717,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
clause.namedBindings,
factory.updateNamedImports(
clause.namedBindings,
- stableSort([...existingSpecifiers.filter((s) => !removeExistingImportSpecifiers.has(s)), ...newSpecifiers], specifierComparer)
+ toSorted([...existingSpecifiers.filter((s) => !removeExistingImportSpecifiers.has(s)), ...newSpecifiers], specifierComparer)
)
);
} else if ((existingSpecifiers == null ? void 0 : existingSpecifiers.length) && isSorted !== false) {
@@ -155838,6 +156887,12 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
function symbolFlagsHaveMeaning(flags, meaning) {
return meaning === 7 /* All */ ? true : meaning & 1 /* Value */ ? !!(flags & 111551 /* Value */) : meaning & 2 /* Type */ ? !!(flags & 788968 /* Type */) : meaning & 4 /* Namespace */ ? !!(flags & 1920 /* Namespace */) : false;
}
+function getImpliedNodeFormatForEmit(file, program) {
+ return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
+}
+function getEmitModuleFormatOfFile(file, program) {
+ return isFullSourceFile(file) ? program.getEmitModuleFormatOfFile(file) : getEmitModuleFormatOfFileWorker(file, program.getCompilerOptions());
+}
// src/services/codefixes/fixAddMissingConstraint.ts
var fixId17 = "addMissingConstraint";
@@ -155916,6 +156971,8 @@ function addMissingConstraint(changes, program, preferences, host, sourceFile, i
scriptTarget,
/*flags*/
void 0,
+ /*internalFlags*/
+ void 0,
tracker
);
if (typeNode) {
@@ -156923,7 +157980,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
const moduleDeclaration = find(symbol.declarations, isModuleDeclaration);
const moduleDeclarationSourceFile = moduleDeclaration == null ? void 0 : moduleDeclaration.getSourceFile();
if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
- return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleDeclaration };
+ return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile: moduleDeclarationSourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleDeclaration };
}
const moduleSourceFile = find(symbol.declarations, isSourceFile);
if (sourceFile.commonJsModuleIndicator) return void 0;
@@ -157023,14 +158080,15 @@ function getTypeNode2(checker, node, token) {
const binaryExpression = token.parent.parent;
const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
- typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */);
+ typeNode = checker.typeToTypeNode(widenedType, node, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */);
} else {
const contextualType = checker.getContextualType(token.parent);
typeNode = contextualType ? checker.typeToTypeNode(
contextualType,
/*enclosingDeclaration*/
void 0,
- 1 /* NoTruncation */
+ 1 /* NoTruncation */,
+ 8 /* AllowUnresolvedNames */
) : void 0;
}
return typeNode || factory.createKeywordTypeNode(133 /* AnyKeyword */);
@@ -157352,7 +158410,9 @@ function createPropertyNameFromSymbol(symbol, target, quotePreference, checker)
111551 /* Value */,
/*enclosingDeclaration*/
void 0,
- 1073741824 /* WriteComputedProps */
+ /*flags*/
+ void 0,
+ 1 /* WriteComputedProps */
);
if (prop && isComputedPropertyName(prop)) return prop;
}
@@ -157525,7 +158585,7 @@ function tryGetName2(node) {
}
}
function typeToTypeNode(checker, type, enclosingDeclaration) {
- return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
+ return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
}
function doChange19(changes, program, preferences, host, declarations, newParameters) {
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
@@ -158828,7 +159888,8 @@ var canHaveTypeAnnotation = /* @__PURE__ */ new Set([
206 /* ObjectBindingPattern */,
207 /* ArrayBindingPattern */
]);
-var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */ | 1073741824 /* WriteComputedProps */;
+var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
+var declarationEmitInternalNodeBuilderFlags2 = 1 /* WriteComputedProps */;
registerCodeFix({
errorCodes: errorCodes47,
fixIds: [fixId36],
@@ -159421,7 +160482,25 @@ function withContext(context, typePrintMode, cb) {
if (typePrintMode === 1 /* Relative */) {
return relativeType(node);
}
- let type = isValueSignatureDeclaration(node) ? tryGetReturnType2(node) : typeChecker.getTypeAtLocation(node);
+ let type;
+ if (isValueSignatureDeclaration(node)) {
+ const signature = typeChecker.getSignatureFromDeclaration(node);
+ if (signature) {
+ const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
+ if (typePredicate) {
+ if (!typePredicate.type) {
+ return emptyInferenceResult;
+ }
+ return {
+ typeNode: typePredicateToTypeNode(typePredicate, findAncestor(node, isDeclaration) ?? sourceFile, getFlags(typePredicate.type)),
+ mutatedTarget: false
+ };
+ }
+ type = typeChecker.getReturnTypeOfSignature(signature);
+ }
+ } else {
+ type = typeChecker.getTypeAtLocation(node);
+ }
if (!type) {
return emptyInferenceResult;
}
@@ -159435,14 +160514,17 @@ function withContext(context, typePrintMode, cb) {
}
type = widenedType;
}
- if (isParameter(node) && typeChecker.requiresAddingImplicitUndefined(node)) {
+ const enclosingDeclaration = findAncestor(node, isDeclaration) ?? sourceFile;
+ if (isParameter(node) && typeChecker.requiresAddingImplicitUndefined(node, enclosingDeclaration)) {
type = typeChecker.getUnionType([typeChecker.getUndefinedType(), type], 0 /* None */);
}
- const flags = (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
return {
- typeNode: typeToTypeNode2(type, findAncestor(node, isDeclaration) ?? sourceFile, flags),
+ typeNode: typeToTypeNode2(type, enclosingDeclaration, getFlags(type)),
mutatedTarget: false
};
+ function getFlags(type2) {
+ return (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type2.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
+ }
}
function createTypeOfFromEntityNameExpression(node) {
return factory.createTypeQueryNode(getSynthesizedDeepClone(node));
@@ -159594,7 +160676,7 @@ function withContext(context, typePrintMode, cb) {
}
function typeToTypeNode2(type, enclosingDeclaration, flags = 0 /* None */) {
let isTruncated = false;
- const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
+ const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
moduleResolverHost: program,
trackSymbol() {
return true;
@@ -159605,11 +160687,18 @@ function withContext(context, typePrintMode, cb) {
});
return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
}
- function tryGetReturnType2(node) {
- const signature = typeChecker.getSignatureFromDeclaration(node);
- if (signature) {
- return typeChecker.getReturnTypeOfSignature(signature);
- }
+ function typePredicateToTypeNode(typePredicate, enclosingDeclaration, flags = 0 /* None */) {
+ let isTruncated = false;
+ const result2 = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
+ moduleResolverHost: program,
+ trackSymbol() {
+ return true;
+ },
+ reportTruncationError() {
+ isTruncated = true;
+ }
+ });
+ return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
}
function addTypeToVariableLike(decl) {
const { typeNode } = inferType(decl);
@@ -160927,7 +162016,7 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
case 172 /* PropertyDeclaration */:
let flags = 1 /* NoTruncation */;
flags |= quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0;
- let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
+ let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
if (importAdder) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
if (importableReference) {
@@ -160952,6 +162041,8 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
enclosingDeclaration,
/*flags*/
void 0,
+ /*internalFlags*/
+ void 0,
getNoopSymbolTrackerWithResolver(context)
);
const allAccessors = getAllAccessorDeclarations(declarations, declaration);
@@ -161007,6 +162098,9 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
break;
}
for (const signature of signatures) {
+ if (signature.declaration && signature.declaration.flags & 33554432 /* Ambient */) {
+ continue;
+ }
outputMethod(quotePreference, signature, modifiers, createName(declarationName));
}
if (!ambient) {
@@ -161081,7 +162175,7 @@ function createSignatureDeclarationFromSignature(kind, context, quotePreference,
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
const isJs = isInJSFile(enclosingDeclaration);
const flags = 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */ | 524288 /* AllowEmptyTuple */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
- const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
+ const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
if (!signatureDeclaration) {
return void 0;
}
@@ -161182,6 +162276,7 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
contextNode,
scriptTarget,
1 /* NoTruncation */,
+ 8 /* AllowUnresolvedNames */,
tracker
);
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0;
@@ -161200,6 +162295,8 @@ function createSignatureDeclarationFromCallExpression(kind, context, importAdder
contextNode,
/*flags*/
void 0,
+ /*internalFlags*/
+ void 0,
tracker
);
switch (kind) {
@@ -161269,8 +162366,8 @@ function createTypeParametersForArguments(checker, argumentTypeParameters, typeA
function createTypeParameterName(index) {
return 84 /* T */ + index <= 90 /* Z */ ? String.fromCharCode(84 /* T */ + index) : `T${index}`;
}
-function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, tracker) {
- let typeNode = checker.typeToTypeNode(type, contextNode, flags, tracker);
+function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, internalFlags, tracker) {
+ let typeNode = checker.typeToTypeNode(type, contextNode, flags, internalFlags, tracker);
if (typeNode && isImportTypeNode(typeNode)) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
if (importableReference) {
@@ -161280,13 +162377,24 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
}
return getSynthesizedDeepClone(typeNode);
}
+function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, internalFlags, tracker) {
+ let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, internalFlags, tracker);
+ if ((typePredicateNode == null ? void 0 : typePredicateNode.type) && isImportTypeNode(typePredicateNode.type)) {
+ const importableReference = tryGetAutoImportableReferenceFromTypeNode(typePredicateNode.type, scriptTarget);
+ if (importableReference) {
+ importSymbols(importAdder, importableReference.symbols);
+ typePredicateNode = factory.updateTypePredicateNode(typePredicateNode, typePredicateNode.assertsModifier, typePredicateNode.parameterName, importableReference.typeNode);
+ }
+ }
+ return getSynthesizedDeepClone(typePredicateNode);
+}
function typeContainsTypeParameter(type) {
if (type.isUnionOrIntersection()) {
return type.types.some(typeContainsTypeParameter);
}
return type.flags & 262144 /* TypeParameter */;
}
-function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, tracker) {
+function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, internalFlags, tracker) {
const argumentTypeNodes = [];
const argumentTypeParameters = /* @__PURE__ */ new Map();
for (let i = 0; i < instanceTypes.length; i += 1) {
@@ -161298,13 +162406,13 @@ function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes,
continue;
}
const widenedInstanceType = checker.getBaseTypeOfLiteralType(instanceType);
- const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, tracker);
+ const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, internalFlags, tracker);
if (!argumentTypeNode) {
continue;
}
argumentTypeNodes.push(argumentTypeNode);
const argumentTypeParameter = getFirstTypeParameterName(instanceType);
- const instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint) ? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, tracker) : void 0;
+ const instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint) ? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, internalFlags, tracker) : void 0;
if (argumentTypeParameter) {
argumentTypeParameters.set(argumentTypeParameter, { argumentType: instanceType, constraint: instanceTypeConstraint });
}
@@ -161404,7 +162512,7 @@ function createMethodImplementingSignatures(checker, context, enclosingDeclarati
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
if (length(signatures)) {
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
- return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
+ return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, 8 /* AllowUnresolvedNames */, getNoopSymbolTrackerWithResolver(context));
}
}
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
@@ -161492,6 +162600,14 @@ function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget)
function visit(node) {
if (isLiteralImportTypeNode(node) && node.qualifier) {
const firstIdentifier = getFirstIdentifier(node.qualifier);
+ if (!firstIdentifier.symbol) {
+ return visitEachChild(
+ node,
+ visit,
+ /*context*/
+ void 0
+ );
+ }
const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
const qualifier = name !== firstIdentifier.text ? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name)) : node.qualifier;
symbols = append(symbols, firstIdentifier.symbol);
@@ -161994,7 +163110,7 @@ var errorCodes54 = [Diagnostics.require_call_may_be_converted_to_an_import.code]
registerCodeFix({
errorCodes: errorCodes54,
getCodeActions(context) {
- const info = getInfo18(context.sourceFile, context.program, context.span.start);
+ const info = getInfo18(context.sourceFile, context.program, context.span.start, context.preferences);
if (!info) {
return void 0;
}
@@ -162003,14 +163119,14 @@ registerCodeFix({
},
fixIds: [fixId42],
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
- const info = getInfo18(diag2.file, context.program, diag2.start);
+ const info = getInfo18(diag2.file, context.program, diag2.start, context.preferences);
if (info) {
doChange35(changes, context.sourceFile, info);
}
})
});
function doChange35(changes, sourceFile, info) {
- const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
+ const { allowSyntheticDefaults, defaultImportName, namedImports, statement, moduleSpecifier } = info;
changes.replaceNode(
sourceFile,
statement,
@@ -162020,7 +163136,7 @@ function doChange35(changes, sourceFile, info) {
/*isTypeOnly*/
false,
defaultImportName,
- factory.createExternalModuleReference(required)
+ factory.createExternalModuleReference(moduleSpecifier)
) : factory.createImportDeclaration(
/*modifiers*/
void 0,
@@ -162030,13 +163146,13 @@ function doChange35(changes, sourceFile, info) {
defaultImportName,
namedImports
),
- required,
+ moduleSpecifier,
/*attributes*/
void 0
)
);
}
-function getInfo18(sourceFile, program, pos) {
+function getInfo18(sourceFile, program, pos, preferences) {
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
if (!isRequireCall(
parent2,
@@ -162046,15 +163162,17 @@ function getInfo18(sourceFile, program, pos) {
Debug.failBadSyntaxKind(parent2);
}
const decl = cast(parent2.parent, isVariableDeclaration);
+ const quotePreference = getQuotePreference(sourceFile, preferences);
const defaultImportName = tryCast(decl.name, isIdentifier);
const namedImports = isObjectBindingPattern(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0;
if (defaultImportName || namedImports) {
+ const moduleSpecifier = first(parent2.arguments);
return {
allowSyntheticDefaults: getAllowSyntheticDefaultImports(program.getCompilerOptions()),
defaultImportName,
namedImports,
statement: cast(decl.parent.parent, isVariableStatement),
- required: first(parent2.arguments)
+ moduleSpecifier: isNoSubstitutionTemplateLiteral(moduleSpecifier) ? factory.createStringLiteral(moduleSpecifier.text, quotePreference === 0 /* Single */) : moduleSpecifier
};
}
}
@@ -162588,6 +163706,7 @@ __export(ts_Completions_exports, {
getCompletionEntryDetails: () => getCompletionEntryDetails,
getCompletionEntrySymbol: () => getCompletionEntrySymbol,
getCompletionsAtPosition: () => getCompletionsAtPosition,
+ getDefaultCommitCharacters: () => getDefaultCommitCharacters,
getPropertiesForObjectExpression: () => getPropertiesForObjectExpression,
moduleSpecifierResolutionCacheAttemptLimit: () => moduleSpecifierResolutionCacheAttemptLimit,
moduleSpecifierResolutionLimit: () => moduleSpecifierResolutionLimit
@@ -162679,9 +163798,9 @@ function originIsComputedPropertyName(origin) {
return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
}
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
- var _a, _b, _c;
+ var _a, _b, _c, _d;
const start = timestamp();
- const needsFullResolution = isForImportStatementCompletion || moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(program.getCompilerOptions()));
+ const needsFullResolution = isForImportStatementCompletion || getResolvePackageJsonExports(program.getCompilerOptions()) || ((_a = preferences.autoImportSpecifierExcludeRegexes) == null ? void 0 : _a.length);
let skippedAny = false;
let ambientCount = 0;
let resolvedCount = 0;
@@ -162694,9 +163813,9 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
resolvedBeyondLimit: () => resolvedCount > moduleSpecifierResolutionLimit
});
const hitRateMessage = cacheAttemptCount ? ` (${(resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1)}% hit rate)` : "";
- (_a = host.log) == null ? void 0 : _a.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`);
- (_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`);
- (_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: ${timestamp() - start}`);
+ (_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`);
+ (_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`);
+ (_d = host.log) == null ? void 0 : _d.call(host, `${logPrefix}: ${timestamp() - start}`);
return result;
function tryResolve(exportInfo, isFromAmbientModule) {
if (isFromAmbientModule) {
@@ -162720,6 +163839,12 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
return result2 || (needsFullResolution ? "failed" : "skipped");
}
}
+function getDefaultCommitCharacters(isNewIdentifierLocation) {
+ if (isNewIdentifierLocation) {
+ return [];
+ }
+ return [".", ",", ";"];
+}
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
var _a;
const { previousToken } = getRelevantTokens(position, sourceFile);
@@ -162728,7 +163853,17 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
}
if (triggerCharacter === " ") {
if (preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
- return { isGlobalCompletion: true, isMemberCompletion: false, isNewIdentifierLocation: true, isIncomplete: true, entries: [] };
+ return {
+ isGlobalCompletion: true,
+ isMemberCompletion: false,
+ isNewIdentifierLocation: true,
+ isIncomplete: true,
+ entries: [],
+ defaultCommitCharacters: getDefaultCommitCharacters(
+ /*isNewIdentifierLocation*/
+ true
+ )
+ };
}
return void 0;
}
@@ -162882,7 +164017,16 @@ function continuePreviousIncompleteResponse(cache, file, location, program, host
return previousResponse;
}
function jsdocCompletionInfo(entries) {
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries };
+ return {
+ isGlobalCompletion: false,
+ isMemberCompletion: false,
+ isNewIdentifierLocation: false,
+ entries,
+ defaultCommitCharacters: getDefaultCommitCharacters(
+ /*isNewIdentifierLocation*/
+ false
+ )
+ };
}
function getJSDocParameterCompletions(sourceFile, position, checker, options, preferences, tagNameOnly) {
const currentToken = getTokenAtPosition(sourceFile, position);
@@ -163110,10 +164254,12 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
const printer = isSnippet ? createSnippetPrinter({
removeComments: true,
module: options.module,
+ moduleResolution: options.moduleResolution,
target: options.target
}) : createPrinter({
removeComments: true,
module: options.module,
+ moduleResolution: options.moduleResolution,
target: options.target
});
setEmitFlags(typeNode, 1 /* SingleLine */);
@@ -163153,7 +164299,8 @@ function specificKeywordCompletionInfo(entries, isNewIdentifierLocation) {
isGlobalCompletion: false,
isMemberCompletion: false,
isNewIdentifierLocation,
- entries: entries.slice()
+ entries: entries.slice(),
+ defaultCommitCharacters: getDefaultCommitCharacters(isNewIdentifierLocation)
};
}
function keywordCompletionData(keywordFilters, filterOutTsOnlyKeywords, isNewIdentifierLocation) {
@@ -163311,7 +164458,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
isMemberCompletion: isMemberCompletionKind(completionKind),
isNewIdentifierLocation,
optionalReplacementSpan: getOptionalReplacementSpan(location),
- entries
+ entries,
+ defaultCommitCharacters: getDefaultCommitCharacters(isNewIdentifierLocation)
};
}
function isCheckedFile(sourceFile, compilerOptions) {
@@ -163369,6 +164517,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
const printer = createSnippetPrinter({
removeComments: true,
module: options.module,
+ moduleResolution: options.moduleResolution,
target: options.target,
newLine: getNewLineKind(newLineChar)
});
@@ -163476,7 +164625,17 @@ function getJsxClosingTagCompletion(location, sourceFile) {
kindModifiers: void 0,
sortText: SortText.LocationPriority
};
- return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, optionalReplacementSpan: replacementSpan, entries: [entry] };
+ return {
+ isGlobalCompletion: false,
+ isMemberCompletion: true,
+ isNewIdentifierLocation: false,
+ optionalReplacementSpan: replacementSpan,
+ entries: [entry],
+ defaultCommitCharacters: getDefaultCommitCharacters(
+ /*isNewIdentifierLocation*/
+ false
+ )
+ };
}
return;
}
@@ -163493,7 +164652,8 @@ function getJSCompletionEntries(sourceFile, position, uniqueNames, target, entri
kind: "warning" /* warning */,
kindModifiers: "",
sortText: SortText.JavascriptIdentifiers,
- isFromUncheckedFile: true
+ isFromUncheckedFile: true,
+ commitCharacters: []
}, compareCompletionEntries);
}
});
@@ -163502,7 +164662,13 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
return typeof literal === "object" ? pseudoBigIntToString(literal) + "n" : isString(literal) ? quote(sourceFile, preferences, literal) : JSON.stringify(literal);
}
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
- return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
+ return {
+ name: completionNameForLiteral(sourceFile, preferences, literal),
+ kind: "string" /* string */,
+ kindModifiers: "" /* none */,
+ sortText: SortText.LocationPriority,
+ commitCharacters: []
+ };
}
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
var _a, _b;
@@ -163555,7 +164721,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
if (originIsResolvedExport(origin)) {
sourceDisplay = [textPart(origin.moduleSpecifier)];
if (importStatementCompletion) {
- ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences));
+ ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
}
}
@@ -163625,15 +164791,25 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
hasAction = !importStatementCompletion;
}
const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
- if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
- const possibleToken = stringToToken(name);
- if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
- insertText = `${name} as ${name}_`;
+ if (parentNamedImportOrExport) {
+ const languageVersion = getEmitScriptTarget(host.getCompilationSettings());
+ if (!isIdentifierText(name, languageVersion)) {
+ insertText = JSON.stringify(name);
+ if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
+ insertText += " as " + generateIdentifierForArbitraryString(name, languageVersion);
+ }
+ } else if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
+ const possibleToken = stringToToken(name);
+ if (possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
+ insertText = `${name} as ${name}_`;
+ }
}
}
+ const kind = ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location);
+ const commitCharacters = kind === "warning" /* warning */ || kind === "string" /* string */ ? [] : void 0;
return {
name,
- kind: ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location),
+ kind,
kindModifiers: ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol),
sortText,
source,
@@ -163648,9 +164824,27 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
isImportStatementCompletion: !!importStatementCompletion || void 0,
data,
+ commitCharacters,
...includeSymbol ? { symbol } : void 0
};
}
+function generateIdentifierForArbitraryString(text, languageVersion) {
+ let needsUnderscore = false;
+ let identifier = "";
+ let ch;
+ for (let i = 0; i < text.length; i += ch !== void 0 && ch >= 65536 ? 2 : 1) {
+ ch = text.codePointAt(i);
+ if (ch !== void 0 && (i === 0 ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
+ if (needsUnderscore) identifier += "_";
+ identifier += String.fromCodePoint(ch);
+ needsUnderscore = false;
+ } else {
+ needsUnderscore = true;
+ }
+ }
+ if (needsUnderscore) identifier += "_";
+ return identifier || "_";
+}
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
if (isInJSFile(location)) {
return false;
@@ -163671,6 +164865,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
const printer = createSnippetPrinter({
removeComments: true,
module: options.module,
+ moduleResolution: options.moduleResolution,
target: options.target,
omitTrailingSemicolon: false,
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163821,6 +165016,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
const printer = createSnippetPrinter({
removeComments: true,
module: options.module,
+ moduleResolution: options.moduleResolution,
target: options.target,
omitTrailingSemicolon: false,
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163841,6 +165037,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
const signaturePrinter = createPrinter({
removeComments: true,
module: options.module,
+ moduleResolution: options.moduleResolution,
target: options.target,
omitTrailingSemicolon: true
});
@@ -163890,7 +165087,14 @@ function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, pro
if (signatures.length !== 1) {
return void 0;
}
- const typeNode = checker.typeToTypeNode(effectiveType, enclosingDeclaration, builderFlags, ts_codefix_exports.getNoopSymbolTrackerWithResolver({ program, host }));
+ const typeNode = checker.typeToTypeNode(
+ effectiveType,
+ enclosingDeclaration,
+ builderFlags,
+ /*internalFlags*/
+ void 0,
+ ts_codefix_exports.getNoopSymbolTrackerWithResolver({ program, host })
+ );
if (!typeNode || !isFunctionTypeNode(typeNode)) {
return void 0;
}
@@ -164010,7 +165214,7 @@ function createSnippetPrinter(printerOptions) {
{ ...formatContext, options: formatOptions }
);
});
- const allChanges = escapes ? stableSort(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
+ const allChanges = escapes ? toSorted(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
return ts_textChanges_exports.applyChanges(syntheticFile.text, allChanges);
}
function printNode(hint, node, sourceFile) {
@@ -164046,7 +165250,7 @@ function createSnippetPrinter(printerOptions) {
0,
{ ...formatContext, options: formatOptions }
);
- const allChanges = escapes ? stableSort(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
+ const allChanges = escapes ? toSorted(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
return ts_textChanges_exports.applyChanges(syntheticFile.text, allChanges);
}
}
@@ -164102,7 +165306,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
};
return unresolvedOrigin;
}
-function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
+function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
const replacementSpan = importStatementCompletion.replacementSpan;
const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
@@ -164110,7 +165314,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
const importKind = ts_codefix_exports.getImportKind(
sourceFile,
exportKind,
- options,
+ program,
/*forceImportKeyword*/
true
);
@@ -164258,7 +165462,16 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
function getLabelCompletionAtPosition(node) {
const entries = getLabelStatementCompletions(node);
if (entries.length) {
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries };
+ return {
+ isGlobalCompletion: false,
+ isMemberCompletion: false,
+ isNewIdentifierLocation: false,
+ entries,
+ defaultCommitCharacters: getDefaultCommitCharacters(
+ /*isNewIdentifierLocation*/
+ false
+ )
+ };
}
}
function getLabelStatementCompletions(node) {
@@ -165237,7 +166450,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
if (ts_JsTyping_exports.nodeCoreModules.has(moduleName) && startsWith(moduleName, "node:") !== shouldUseUriStyleNodeCoreModules(sourceFile, program)) {
return false;
}
- return packageJsonFilter ? packageJsonFilter.allowsImportingAmbientModule(info.moduleSymbol, getModuleSpecifierResolutionHost(info.isFromPackageJson)) : true;
+ return ((packageJsonFilter == null ? void 0 : packageJsonFilter.allowsImportingAmbientModule(info.moduleSymbol, getModuleSpecifierResolutionHost(info.isFromPackageJson))) ?? true) || fileContainsPackageImport(sourceFile, moduleName);
}
return isImportableFile(
info.isFromPackageJson ? packageJsonAutoImportProvider : program,
@@ -165479,7 +166692,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
completionKind = 3 /* MemberLike */;
isNewIdentifierLocation = false;
const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
- const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => (n.propertyName || n.name).escapedText));
+ const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
symbols = concatenate(symbols, uniques);
if (!uniques.length) {
@@ -165970,6 +167183,9 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
if (isIdentifierText(name, target, jsxIdentifierExpected ? 1 /* JSX */ : 0 /* Standard */) || symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
return validNameResult;
}
+ if (symbol.flags & 2097152 /* Alias */) {
+ return { name, needsConvertPropertyAccess: true };
+ }
switch (kind) {
case 3 /* MemberLike */:
return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
@@ -166111,7 +167327,13 @@ function getJsDocTagAtPosition(node, position) {
}
function getPropertiesForObjectExpression(contextualType, completionsType, obj, checker) {
const hasCompletionsType = completionsType && completionsType !== contextualType;
- const type = hasCompletionsType && !(completionsType.flags & 3 /* AnyOrUnknown */) ? checker.getUnionType([contextualType, completionsType]) : contextualType;
+ const promiseFilteredContextualType = checker.getUnionType(
+ filter(
+ contextualType.flags & 1048576 /* Union */ ? contextualType.types : [contextualType],
+ (t) => !checker.getPromisedTypeOfPromise(t)
+ )
+ );
+ const type = hasCompletionsType && !(completionsType.flags & 3 /* AnyOrUnknown */) ? checker.getUnionType([promiseFilteredContextualType, completionsType]) : promiseFilteredContextualType;
const properties = getApparentProperties(type, obj, checker);
return type.isClass() && containsNonPublicProperties(properties) ? [] : hasCompletionsType ? filter(properties, hasDeclarationOtherThanSelf) : properties;
function hasDeclarationOtherThanSelf(member) {
@@ -166486,7 +167708,7 @@ function createNameAndKindSet() {
}
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
if (isInReferenceComment(sourceFile, position)) {
- const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
+ const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
return entries && convertPathCompletions(entries);
}
if (isInString(sourceFile, position, contextToken)) {
@@ -166544,7 +167766,14 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
void 0,
includeSymbol
);
- return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
+ return {
+ isGlobalCompletion: false,
+ isMemberCompletion: true,
+ isNewIdentifierLocation: completion.hasIndexSignature,
+ optionalReplacementSpan,
+ entries,
+ defaultCommitCharacters: getDefaultCommitCharacters(completion.hasIndexSignature)
+ };
}
case 2 /* Types */: {
const quoteChar = contextToken.kind === 15 /* NoSubstitutionTemplateLiteral */ ? 96 /* backtick */ : startsWith(getTextOfNode(contextToken), "'") ? 39 /* singleQuote */ : 34 /* doubleQuote */;
@@ -166553,9 +167782,17 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
kindModifiers: "" /* none */,
kind: "string" /* string */,
sortText: SortText.LocationPriority,
- replacementSpan: getReplacementSpanForContextToken(contextToken, position)
+ replacementSpan: getReplacementSpanForContextToken(contextToken, position),
+ commitCharacters: []
}));
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan, entries };
+ return {
+ isGlobalCompletion: false,
+ isMemberCompletion: false,
+ isNewIdentifierLocation: completion.isNewIdentifier,
+ optionalReplacementSpan,
+ entries,
+ defaultCommitCharacters: getDefaultCommitCharacters(completion.isNewIdentifier)
+ };
}
default:
return Debug.assertNever(completion);
@@ -166586,7 +167823,13 @@ function convertPathCompletions(pathCompletions) {
const isGlobalCompletion = false;
const isNewIdentifierLocation = true;
const entries = pathCompletions.map(({ name, kind, span, extension }) => ({ name, kind, kindModifiers: kindModifiersFromExtension(extension), sortText: SortText.LocationPriority, replacementSpan: span }));
- return { isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation, entries };
+ return {
+ isGlobalCompletion,
+ isMemberCompletion: false,
+ isNewIdentifierLocation,
+ entries,
+ defaultCommitCharacters: getDefaultCommitCharacters(isNewIdentifierLocation)
+ };
}
function kindModifiersFromExtension(extension) {
switch (extension) {
@@ -166665,6 +167908,21 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
}
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
+ case 276 /* ImportSpecifier */:
+ case 281 /* ExportSpecifier */:
+ const specifier = parent2;
+ if (specifier.propertyName && node !== specifier.propertyName) {
+ return;
+ }
+ const namedImportsOrExports = specifier.parent;
+ const { moduleSpecifier } = namedImportsOrExports.kind === 275 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent;
+ if (!moduleSpecifier) return;
+ const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier);
+ if (!moduleSpecifierSymbol) return;
+ const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
+ const existing = new Set(namedImportsOrExports.elements.map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
+ const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
+ return { kind: 1 /* Properties */, symbols: uniques, hasIndexSignature: false };
default:
return fromContextualType() || fromContextualType(0 /* None */);
}
@@ -166794,7 +168052,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
const compilerOptions = program.getCompilerOptions();
const typeChecker = program.getTypeChecker();
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
- return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
+ return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, program, host, extensionOptions);
}
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
return {
@@ -166805,14 +168063,15 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
resolutionMode
};
}
-function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) {
+function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
+ const compilerOptions = program.getCompilerOptions();
if (compilerOptions.rootDirs) {
return getCompletionEntriesForDirectoryFragmentWithRootDirs(
compilerOptions.rootDirs,
literalValue,
scriptDirectory,
extensionOptions,
- compilerOptions,
+ program,
host,
scriptPath
);
@@ -166821,6 +168080,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
literalValue,
scriptDirectory,
extensionOptions,
+ program,
host,
/*moduleSpecifierIsRelative*/
true,
@@ -166847,7 +168107,8 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
compareStringsCaseSensitive
);
}
-function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, compilerOptions, host, exclude) {
+function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
+ const compilerOptions = program.getCompilerOptions();
const basePath = compilerOptions.project || host.getCurrentDirectory();
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
@@ -166856,6 +168117,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
fragment,
baseDirectory,
extensionOptions,
+ program,
host,
/*moduleSpecifierIsRelative*/
true,
@@ -166864,7 +168126,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
(itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
);
}
-function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
+function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
var _a;
if (fragment === void 0) {
fragment = "";
@@ -166889,7 +168151,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
if (versionPaths) {
const packageDirectory = getDirectoryPath(packageJsonPath);
const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
- if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
+ if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
return result;
}
}
@@ -166915,7 +168177,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
}
const { name, extension } = getFilenameWithExtensionOption(
getBaseFileName(filePath),
- host.getCompilationSettings(),
+ program,
extensionOptions,
/*isExportsWildcard*/
false
@@ -166934,7 +168196,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
}
return result;
}
-function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
+function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
if (nonJsResult) {
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
@@ -166942,9 +168204,10 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
if (extensionOptions.referenceKind === 0 /* Filename */) {
return { name, extension: tryGetExtensionFromPath2(name) };
}
- let allowedEndings = getModuleSpecifierPreferences(
+ let allowedEndings = ts_moduleSpecifiers_exports.getModuleSpecifierPreferences(
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
- compilerOptions,
+ program,
+ program.getCompilerOptions(),
extensionOptions.importingSourceFile
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
if (isExportsWildcard) {
@@ -166954,16 +168217,16 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
return { name, extension: tryGetExtensionFromPath2(name) };
}
- const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
+ const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
}
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
}
- const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
+ const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
}
-function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
+function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
const getPatternsForKey = (key) => paths[key];
const comparePaths2 = (a, b) => {
const patternA = tryParsePattern(a);
@@ -166979,13 +168242,14 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
fragment,
baseDirectory,
extensionOptions,
+ program,
host,
getOwnKeys(paths),
getPatternsForKey,
comparePaths2
);
}
-function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
+function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
let pathResults = [];
let matchedPath;
for (const key of keys) {
@@ -167004,7 +168268,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
pathResults.push({
matchedPattern: isMatch,
- results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
+ results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
});
}
}
@@ -167012,7 +168276,9 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
return matchedPath !== void 0;
}
-function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, compilerOptions, host, extensionOptions, typeChecker) {
+function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
+ const typeChecker = program.getTypeChecker();
+ const compilerOptions = program.getCompilerOptions();
const { baseUrl, paths } = compilerOptions;
const result = createNameAndKindSet();
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
@@ -167022,6 +168288,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
fragment,
absolute,
extensionOptions,
+ program,
host,
/*moduleSpecifierIsRelative*/
false,
@@ -167032,7 +168299,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
}
if (paths) {
const absolute = getPathsBasePath(compilerOptions, host);
- addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
+ addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
}
const fragmentDirectory = getFragmentDirectory(fragment);
for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
@@ -167043,7 +168310,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
void 0
));
}
- getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, fragmentDirectory, extensionOptions, result);
+ getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
if (moduleResolutionUsesNodeModules(moduleResolution)) {
let foundGlobal = false;
if (fragmentDirectory === void 0) {
@@ -167068,6 +168335,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
fragment,
nodeModules,
extensionOptions,
+ program,
host,
/*moduleSpecifierIsRelative*/
false,
@@ -167112,6 +168380,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
fragmentSubpath,
packageDirectory,
extensionOptions,
+ program,
host,
keys,
(key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
@@ -167144,7 +168413,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
function getFragmentDirectory(fragment) {
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
}
-function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
+function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
if (!endsWith(path, "*")) {
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
}
@@ -167154,15 +168423,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
const starIsFullPathComponent = path[path.length - 2] === "/";
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
var _a;
- return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
+ return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
});
}
- return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
+ return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
function justPathMappingName(name, kind) {
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
}
}
-function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
+function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
if (!host.readDirectory) {
return void 0;
}
@@ -167195,7 +168464,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
if (containsSlash(trimmedWithPattern)) {
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
}
- const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
+ const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
return nameAndKind(name, "script" /* scriptElement */, extension);
}
});
@@ -167223,7 +168492,8 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
}
return nonRelativeModuleNames;
}
-function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
+function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
+ const compilerOptions = program.getCompilerOptions();
const token = getTokenAtPosition(sourceFile, position);
const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
@@ -167241,14 +168511,16 @@ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions
toComplete,
scriptPath,
getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
+ program,
host,
/*moduleSpecifierIsRelative*/
true,
sourceFile.path
- ) : kind === "types" ? getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
+ ) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
}
-function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
+function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
+ const options = program.getCompilerOptions();
const seen = /* @__PURE__ */ new Map();
const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
for (const root of typeRoots) {
@@ -167282,6 +168554,7 @@ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDire
remainingFragment,
baseDirectory,
extensionOptions,
+ program,
host,
/*moduleSpecifierIsRelative*/
false,
@@ -167352,11 +168625,9 @@ __export(ts_FindAllReferences_exports, {
getImplementationsAtPosition: () => getImplementationsAtPosition,
getImportOrExportSymbol: () => getImportOrExportSymbol,
getReferenceEntriesForNode: () => getReferenceEntriesForNode,
- getTextSpanOfEntry: () => getTextSpanOfEntry,
isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
isDeclarationOfSymbol: () => isDeclarationOfSymbol,
isWriteAccessForReference: () => isWriteAccessForReference,
- nodeEntry: () => nodeEntry,
toContextSpan: () => toContextSpan,
toHighlightSpan: () => toHighlightSpan,
toReferenceEntry: () => toReferenceEntry,
@@ -167620,12 +168891,12 @@ function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, c
}
for (const element of namedBindings.elements) {
const { name, propertyName } = element;
- if (!isNameMatch((propertyName || name).escapedText)) {
+ if (!isNameMatch(moduleExportNameTextEscaped(propertyName || name))) {
continue;
}
if (propertyName) {
singleReferences.push(propertyName);
- if (!isForRename || name.escapedText === exportSymbol.escapedName) {
+ if (!isForRename || moduleExportNameTextEscaped(name) === exportSymbol.escapedName) {
addSearch(name, checker.getSymbolAtLocation(name));
}
} else {
@@ -167883,7 +169154,7 @@ function getContainingModuleSymbol(importer, checker) {
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
}
function getSourceFileLikeForImportDeclaration(node) {
- if (node.kind === 213 /* CallExpression */) {
+ if (node.kind === 213 /* CallExpression */ || node.kind === 351 /* JSDocImportTag */) {
return node.getSourceFile();
}
const { parent: parent2 } = node;
@@ -168883,8 +170154,8 @@ var Core;
function shouldAddSingleReference(singleRef, state) {
if (!hasMatchingMeaning(singleRef, state)) return false;
if (state.options.use !== 2 /* Rename */) return true;
- if (!isIdentifier(singleRef)) return false;
- return !(isImportOrExportSpecifier(singleRef.parent) && singleRef.escapedText === "default" /* Default */);
+ if (!isIdentifier(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false;
+ return !(isImportOrExportSpecifier(singleRef.parent) && moduleExportNameIsDefault(singleRef));
}
function searchForImportedSymbol(symbol, state) {
if (!symbol.declarations) return;
@@ -169046,7 +170317,7 @@ var Core;
case 15 /* NoSubstitutionTemplateLiteral */:
case 11 /* StringLiteral */: {
const str = node;
- return (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node) && str.text.length === searchSymbolName.length;
+ return str.text.length === searchSymbolName.length && (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node || isImportOrExportSpecifier(node.parent));
}
case 9 /* NumericLiteral */:
return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
@@ -169112,7 +170383,7 @@ var Core;
return;
}
if (isExportSpecifier(parent2)) {
- Debug.assert(referenceLocation.kind === 80 /* Identifier */);
+ Debug.assert(referenceLocation.kind === 80 /* Identifier */ || referenceLocation.kind === 11 /* StringLiteral */);
getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent2, search, state, addReferencesHere);
return;
}
@@ -169162,7 +170433,7 @@ var Core;
return;
}
if (!propertyName) {
- if (!(state.options.use === 2 /* Rename */ && name.escapedText === "default" /* Default */)) {
+ if (!(state.options.use === 2 /* Rename */ && moduleExportNameIsDefault(name))) {
addRef();
}
} else if (referenceLocation === propertyName) {
@@ -169178,7 +170449,7 @@ var Core;
}
}
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
- const isDefaultExport = referenceLocation.escapedText === "default" || exportSpecifier.name.escapedText === "default";
+ const isDefaultExport = moduleExportNameIsDefault(referenceLocation) || moduleExportNameIsDefault(exportSpecifier.name);
const exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
const exportSymbol = Debug.checkDefined(exportSpecifier.symbol);
const exportInfo = getExportInfo(exportSymbol, exportKind, state.checker);
@@ -169778,7 +171049,6 @@ var Core;
var ts_GoToDefinition_exports = {};
__export(ts_GoToDefinition_exports, {
createDefinitionInfo: () => createDefinitionInfo,
- findReferenceInPosition: () => findReferenceInPosition,
getDefinitionAndBoundSpan: () => getDefinitionAndBoundSpan,
getDefinitionAtPosition: () => getDefinitionAtPosition,
getReferenceAtPosition: () => getReferenceAtPosition,
@@ -169893,12 +171163,13 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
const calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
if (calledDeclaration && !(isJsxOpeningLikeElement(node.parent) && isJsxConstructorLike(calledDeclaration))) {
const sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
+ let declarationFilter = (d) => d !== calledDeclaration;
if (typeChecker.getRootSymbols(symbol).some((s) => symbolMatchesSignature(s, calledDeclaration))) {
- return [sigInfo];
- } else {
- const defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || emptyArray;
- return node.kind === 108 /* SuperKeyword */ ? [sigInfo, ...defs] : [...defs, sigInfo];
+ if (!isConstructorDeclaration(calledDeclaration)) return [sigInfo];
+ declarationFilter = (d) => d !== calledDeclaration && (isClassDeclaration(d) || isClassExpression(d));
}
+ const defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, declarationFilter) || emptyArray;
+ return node.kind === 108 /* SuperKeyword */ ? [sigInfo, ...defs] : [...defs, sigInfo];
}
if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
const shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
@@ -170135,7 +171406,7 @@ function getSymbol(node, checker, stopAtAlias) {
return { symbol, failedAliasResolution };
}
function shouldSkipAlias(node, declaration) {
- if (node.kind !== 80 /* Identifier */) {
+ if (node.kind !== 80 /* Identifier */ && (node.kind !== 11 /* StringLiteral */ || !isImportOrExportSpecifier(node.parent))) {
return false;
}
if (node.parent === declaration) {
@@ -170155,9 +171426,9 @@ function isExpandoDeclaration(node) {
});
return !!containingAssignment && getAssignmentDeclarationKind(containingAssignment) === 5 /* Property */;
}
-function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
- const filteredDeclarations = filter(symbol.declarations, (d) => d !== excludeDeclaration);
- const signatureDefinition = getConstructSignatureDefinition() || getCallSignatureDefinition();
+function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, declarationFilter) {
+ const filteredDeclarations = declarationFilter !== void 0 ? filter(symbol.declarations, declarationFilter) : symbol.declarations;
+ const signatureDefinition = !declarationFilter && (getConstructSignatureDefinition() || getCallSignatureDefinition());
if (signatureDefinition) {
return signatureDefinition;
}
@@ -170563,6 +171834,14 @@ function provideInlayHints(context) {
if (!signature) {
return;
}
+ const typePredicate = checker.getTypePredicateOfSignature(signature);
+ if (typePredicate == null ? void 0 : typePredicate.type) {
+ const hintParts2 = typePredicateToInlayHintParts(typePredicate);
+ if (hintParts2) {
+ addTypeHints(hintParts2, getTypeAnnotationPosition(decl));
+ return;
+ }
+ }
const returnType = checker.getReturnTypeOfSignature(signature);
if (isModuleReferenceType(returnType)) {
return;
@@ -170631,6 +171910,26 @@ function provideInlayHints(context) {
);
});
}
+ function printTypePredicateInSingleLine(typePredicate) {
+ const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
+ const printer = createPrinterWithRemoveComments();
+ return usingSingleLineStringWriter((writer) => {
+ const typePredicateNode = checker.typePredicateToTypePredicateNode(
+ typePredicate,
+ /*enclosingDeclaration*/
+ void 0,
+ flags
+ );
+ Debug.assertIsDefined(typePredicateNode, "should always get typePredicateNode");
+ printer.writeNode(
+ 4 /* Unspecified */,
+ typePredicateNode,
+ /*sourceFile*/
+ file,
+ writer
+ );
+ });
+ }
function typeToInlayHintParts(type) {
if (!shouldUseInteractiveInlayHints(preferences)) {
return printTypeInSingleLine(type);
@@ -170642,29 +171941,46 @@ function provideInlayHints(context) {
void 0,
flags
);
+ Debug.assertIsDefined(typeNode, "should always get typeNode");
+ return getInlayHintDisplayParts(typeNode);
+ }
+ function typePredicateToInlayHintParts(typePredicate) {
+ if (!shouldUseInteractiveInlayHints(preferences)) {
+ return printTypePredicateInSingleLine(typePredicate);
+ }
+ const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
+ const typeNode = checker.typePredicateToTypePredicateNode(
+ typePredicate,
+ /*enclosingDeclaration*/
+ void 0,
+ flags
+ );
Debug.assertIsDefined(typeNode, "should always get typenode");
+ return getInlayHintDisplayParts(typeNode);
+ }
+ function getInlayHintDisplayParts(node) {
const parts = [];
- visitForDisplayParts(typeNode);
+ visitForDisplayParts(node);
return parts;
- function visitForDisplayParts(node) {
+ function visitForDisplayParts(node2) {
var _a, _b;
- if (!node) {
+ if (!node2) {
return;
}
- const tokenString = tokenToString(node.kind);
+ const tokenString = tokenToString(node2.kind);
if (tokenString) {
parts.push({ text: tokenString });
return;
}
- if (isLiteralExpression(node)) {
- parts.push({ text: getLiteralText2(node) });
+ if (isLiteralExpression(node2)) {
+ parts.push({ text: getLiteralText2(node2) });
return;
}
- switch (node.kind) {
+ switch (node2.kind) {
case 80 /* Identifier */:
- Debug.assertNode(node, isIdentifier);
- const identifierText = idText(node);
- const name = node.symbol && node.symbol.declarations && node.symbol.declarations.length && getNameOfDeclaration(node.symbol.declarations[0]);
+ Debug.assertNode(node2, isIdentifier);
+ const identifierText = idText(node2);
+ const name = node2.symbol && node2.symbol.declarations && node2.symbol.declarations.length && getNameOfDeclaration(node2.symbol.declarations[0]);
if (name) {
parts.push(getNodeDisplayPart(identifierText, name));
} else {
@@ -170672,331 +171988,331 @@ function provideInlayHints(context) {
}
break;
case 166 /* QualifiedName */:
- Debug.assertNode(node, isQualifiedName);
- visitForDisplayParts(node.left);
+ Debug.assertNode(node2, isQualifiedName);
+ visitForDisplayParts(node2.left);
parts.push({ text: "." });
- visitForDisplayParts(node.right);
+ visitForDisplayParts(node2.right);
break;
case 182 /* TypePredicate */:
- Debug.assertNode(node, isTypePredicateNode);
- if (node.assertsModifier) {
+ Debug.assertNode(node2, isTypePredicateNode);
+ if (node2.assertsModifier) {
parts.push({ text: "asserts " });
}
- visitForDisplayParts(node.parameterName);
- if (node.type) {
+ visitForDisplayParts(node2.parameterName);
+ if (node2.type) {
parts.push({ text: " is " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
}
break;
case 183 /* TypeReference */:
- Debug.assertNode(node, isTypeReferenceNode);
- visitForDisplayParts(node.typeName);
- if (node.typeArguments) {
+ Debug.assertNode(node2, isTypeReferenceNode);
+ visitForDisplayParts(node2.typeName);
+ if (node2.typeArguments) {
parts.push({ text: "<" });
- visitDisplayPartList(node.typeArguments, ", ");
+ visitDisplayPartList(node2.typeArguments, ", ");
parts.push({ text: ">" });
}
break;
case 168 /* TypeParameter */:
- Debug.assertNode(node, isTypeParameterDeclaration);
- if (node.modifiers) {
- visitDisplayPartList(node.modifiers, " ");
+ Debug.assertNode(node2, isTypeParameterDeclaration);
+ if (node2.modifiers) {
+ visitDisplayPartList(node2.modifiers, " ");
}
- visitForDisplayParts(node.name);
- if (node.constraint) {
+ visitForDisplayParts(node2.name);
+ if (node2.constraint) {
parts.push({ text: " extends " });
- visitForDisplayParts(node.constraint);
+ visitForDisplayParts(node2.constraint);
}
- if (node.default) {
+ if (node2.default) {
parts.push({ text: " = " });
- visitForDisplayParts(node.default);
+ visitForDisplayParts(node2.default);
}
break;
case 169 /* Parameter */:
- Debug.assertNode(node, isParameter);
- if (node.modifiers) {
- visitDisplayPartList(node.modifiers, " ");
+ Debug.assertNode(node2, isParameter);
+ if (node2.modifiers) {
+ visitDisplayPartList(node2.modifiers, " ");
}
- if (node.dotDotDotToken) {
+ if (node2.dotDotDotToken) {
parts.push({ text: "..." });
}
- visitForDisplayParts(node.name);
- if (node.questionToken) {
+ visitForDisplayParts(node2.name);
+ if (node2.questionToken) {
parts.push({ text: "?" });
}
- if (node.type) {
+ if (node2.type) {
parts.push({ text: ": " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
}
break;
case 185 /* ConstructorType */:
- Debug.assertNode(node, isConstructorTypeNode);
+ Debug.assertNode(node2, isConstructorTypeNode);
parts.push({ text: "new " });
- visitParametersAndTypeParameters(node);
+ visitParametersAndTypeParameters(node2);
parts.push({ text: " => " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
break;
case 186 /* TypeQuery */:
- Debug.assertNode(node, isTypeQueryNode);
+ Debug.assertNode(node2, isTypeQueryNode);
parts.push({ text: "typeof " });
- visitForDisplayParts(node.exprName);
- if (node.typeArguments) {
+ visitForDisplayParts(node2.exprName);
+ if (node2.typeArguments) {
parts.push({ text: "<" });
- visitDisplayPartList(node.typeArguments, ", ");
+ visitDisplayPartList(node2.typeArguments, ", ");
parts.push({ text: ">" });
}
break;
case 187 /* TypeLiteral */:
- Debug.assertNode(node, isTypeLiteralNode);
+ Debug.assertNode(node2, isTypeLiteralNode);
parts.push({ text: "{" });
- if (node.members.length) {
+ if (node2.members.length) {
parts.push({ text: " " });
- visitDisplayPartList(node.members, "; ");
+ visitDisplayPartList(node2.members, "; ");
parts.push({ text: " " });
}
parts.push({ text: "}" });
break;
case 188 /* ArrayType */:
- Debug.assertNode(node, isArrayTypeNode);
- visitForDisplayParts(node.elementType);
+ Debug.assertNode(node2, isArrayTypeNode);
+ visitForDisplayParts(node2.elementType);
parts.push({ text: "[]" });
break;
case 189 /* TupleType */:
- Debug.assertNode(node, isTupleTypeNode);
+ Debug.assertNode(node2, isTupleTypeNode);
parts.push({ text: "[" });
- visitDisplayPartList(node.elements, ", ");
+ visitDisplayPartList(node2.elements, ", ");
parts.push({ text: "]" });
break;
case 202 /* NamedTupleMember */:
- Debug.assertNode(node, isNamedTupleMember);
- if (node.dotDotDotToken) {
+ Debug.assertNode(node2, isNamedTupleMember);
+ if (node2.dotDotDotToken) {
parts.push({ text: "..." });
}
- visitForDisplayParts(node.name);
- if (node.questionToken) {
+ visitForDisplayParts(node2.name);
+ if (node2.questionToken) {
parts.push({ text: "?" });
}
parts.push({ text: ": " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
break;
case 190 /* OptionalType */:
- Debug.assertNode(node, isOptionalTypeNode);
- visitForDisplayParts(node.type);
+ Debug.assertNode(node2, isOptionalTypeNode);
+ visitForDisplayParts(node2.type);
parts.push({ text: "?" });
break;
case 191 /* RestType */:
- Debug.assertNode(node, isRestTypeNode);
+ Debug.assertNode(node2, isRestTypeNode);
parts.push({ text: "..." });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
break;
case 192 /* UnionType */:
- Debug.assertNode(node, isUnionTypeNode);
- visitDisplayPartList(node.types, " | ");
+ Debug.assertNode(node2, isUnionTypeNode);
+ visitDisplayPartList(node2.types, " | ");
break;
case 193 /* IntersectionType */:
- Debug.assertNode(node, isIntersectionTypeNode);
- visitDisplayPartList(node.types, " & ");
+ Debug.assertNode(node2, isIntersectionTypeNode);
+ visitDisplayPartList(node2.types, " & ");
break;
case 194 /* ConditionalType */:
- Debug.assertNode(node, isConditionalTypeNode);
- visitForDisplayParts(node.checkType);
+ Debug.assertNode(node2, isConditionalTypeNode);
+ visitForDisplayParts(node2.checkType);
parts.push({ text: " extends " });
- visitForDisplayParts(node.extendsType);
+ visitForDisplayParts(node2.extendsType);
parts.push({ text: " ? " });
- visitForDisplayParts(node.trueType);
+ visitForDisplayParts(node2.trueType);
parts.push({ text: " : " });
- visitForDisplayParts(node.falseType);
+ visitForDisplayParts(node2.falseType);
break;
case 195 /* InferType */:
- Debug.assertNode(node, isInferTypeNode);
+ Debug.assertNode(node2, isInferTypeNode);
parts.push({ text: "infer " });
- visitForDisplayParts(node.typeParameter);
+ visitForDisplayParts(node2.typeParameter);
break;
case 196 /* ParenthesizedType */:
- Debug.assertNode(node, isParenthesizedTypeNode);
+ Debug.assertNode(node2, isParenthesizedTypeNode);
parts.push({ text: "(" });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
parts.push({ text: ")" });
break;
case 198 /* TypeOperator */:
- Debug.assertNode(node, isTypeOperatorNode);
- parts.push({ text: `${tokenToString(node.operator)} ` });
- visitForDisplayParts(node.type);
+ Debug.assertNode(node2, isTypeOperatorNode);
+ parts.push({ text: `${tokenToString(node2.operator)} ` });
+ visitForDisplayParts(node2.type);
break;
case 199 /* IndexedAccessType */:
- Debug.assertNode(node, isIndexedAccessTypeNode);
- visitForDisplayParts(node.objectType);
+ Debug.assertNode(node2, isIndexedAccessTypeNode);
+ visitForDisplayParts(node2.objectType);
parts.push({ text: "[" });
- visitForDisplayParts(node.indexType);
+ visitForDisplayParts(node2.indexType);
parts.push({ text: "]" });
break;
case 200 /* MappedType */:
- Debug.assertNode(node, isMappedTypeNode);
+ Debug.assertNode(node2, isMappedTypeNode);
parts.push({ text: "{ " });
- if (node.readonlyToken) {
- if (node.readonlyToken.kind === 40 /* PlusToken */) {
+ if (node2.readonlyToken) {
+ if (node2.readonlyToken.kind === 40 /* PlusToken */) {
parts.push({ text: "+" });
- } else if (node.readonlyToken.kind === 41 /* MinusToken */) {
+ } else if (node2.readonlyToken.kind === 41 /* MinusToken */) {
parts.push({ text: "-" });
}
parts.push({ text: "readonly " });
}
parts.push({ text: "[" });
- visitForDisplayParts(node.typeParameter);
- if (node.nameType) {
+ visitForDisplayParts(node2.typeParameter);
+ if (node2.nameType) {
parts.push({ text: " as " });
- visitForDisplayParts(node.nameType);
+ visitForDisplayParts(node2.nameType);
}
parts.push({ text: "]" });
- if (node.questionToken) {
- if (node.questionToken.kind === 40 /* PlusToken */) {
+ if (node2.questionToken) {
+ if (node2.questionToken.kind === 40 /* PlusToken */) {
parts.push({ text: "+" });
- } else if (node.questionToken.kind === 41 /* MinusToken */) {
+ } else if (node2.questionToken.kind === 41 /* MinusToken */) {
parts.push({ text: "-" });
}
parts.push({ text: "?" });
}
parts.push({ text: ": " });
- if (node.type) {
- visitForDisplayParts(node.type);
+ if (node2.type) {
+ visitForDisplayParts(node2.type);
}
parts.push({ text: "; }" });
break;
case 201 /* LiteralType */:
- Debug.assertNode(node, isLiteralTypeNode);
- visitForDisplayParts(node.literal);
+ Debug.assertNode(node2, isLiteralTypeNode);
+ visitForDisplayParts(node2.literal);
break;
case 184 /* FunctionType */:
- Debug.assertNode(node, isFunctionTypeNode);
- visitParametersAndTypeParameters(node);
+ Debug.assertNode(node2, isFunctionTypeNode);
+ visitParametersAndTypeParameters(node2);
parts.push({ text: " => " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
break;
case 205 /* ImportType */:
- Debug.assertNode(node, isImportTypeNode);
- if (node.isTypeOf) {
+ Debug.assertNode(node2, isImportTypeNode);
+ if (node2.isTypeOf) {
parts.push({ text: "typeof " });
}
parts.push({ text: "import(" });
- visitForDisplayParts(node.argument);
- if (node.assertions) {
+ visitForDisplayParts(node2.argument);
+ if (node2.assertions) {
parts.push({ text: ", { assert: " });
- visitDisplayPartList(node.assertions.assertClause.elements, ", ");
+ visitDisplayPartList(node2.assertions.assertClause.elements, ", ");
parts.push({ text: " }" });
}
parts.push({ text: ")" });
- if (node.qualifier) {
+ if (node2.qualifier) {
parts.push({ text: "." });
- visitForDisplayParts(node.qualifier);
+ visitForDisplayParts(node2.qualifier);
}
- if (node.typeArguments) {
+ if (node2.typeArguments) {
parts.push({ text: "<" });
- visitDisplayPartList(node.typeArguments, ", ");
+ visitDisplayPartList(node2.typeArguments, ", ");
parts.push({ text: ">" });
}
break;
case 171 /* PropertySignature */:
- Debug.assertNode(node, isPropertySignature);
- if ((_a = node.modifiers) == null ? void 0 : _a.length) {
- visitDisplayPartList(node.modifiers, " ");
+ Debug.assertNode(node2, isPropertySignature);
+ if ((_a = node2.modifiers) == null ? void 0 : _a.length) {
+ visitDisplayPartList(node2.modifiers, " ");
parts.push({ text: " " });
}
- visitForDisplayParts(node.name);
- if (node.questionToken) {
+ visitForDisplayParts(node2.name);
+ if (node2.questionToken) {
parts.push({ text: "?" });
}
- if (node.type) {
+ if (node2.type) {
parts.push({ text: ": " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
}
break;
case 181 /* IndexSignature */:
- Debug.assertNode(node, isIndexSignatureDeclaration);
+ Debug.assertNode(node2, isIndexSignatureDeclaration);
parts.push({ text: "[" });
- visitDisplayPartList(node.parameters, ", ");
+ visitDisplayPartList(node2.parameters, ", ");
parts.push({ text: "]" });
- if (node.type) {
+ if (node2.type) {
parts.push({ text: ": " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
}
break;
case 173 /* MethodSignature */:
- Debug.assertNode(node, isMethodSignature);
- if ((_b = node.modifiers) == null ? void 0 : _b.length) {
- visitDisplayPartList(node.modifiers, " ");
+ Debug.assertNode(node2, isMethodSignature);
+ if ((_b = node2.modifiers) == null ? void 0 : _b.length) {
+ visitDisplayPartList(node2.modifiers, " ");
parts.push({ text: " " });
}
- visitForDisplayParts(node.name);
- if (node.questionToken) {
+ visitForDisplayParts(node2.name);
+ if (node2.questionToken) {
parts.push({ text: "?" });
}
- visitParametersAndTypeParameters(node);
- if (node.type) {
+ visitParametersAndTypeParameters(node2);
+ if (node2.type) {
parts.push({ text: ": " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
}
break;
case 179 /* CallSignature */:
- Debug.assertNode(node, isCallSignatureDeclaration);
- visitParametersAndTypeParameters(node);
- if (node.type) {
+ Debug.assertNode(node2, isCallSignatureDeclaration);
+ visitParametersAndTypeParameters(node2);
+ if (node2.type) {
parts.push({ text: ": " });
- visitForDisplayParts(node.type);
+ visitForDisplayParts(node2.type);
}
break;
case 207 /* ArrayBindingPattern */:
- Debug.assertNode(node, isArrayBindingPattern);
+ Debug.assertNode(node2, isArrayBindingPattern);
parts.push({ text: "[" });
- visitDisplayPartList(node.elements, ", ");
+ visitDisplayPartList(node2.elements, ", ");
parts.push({ text: "]" });
break;
case 206 /* ObjectBindingPattern */:
- Debug.assertNode(node, isObjectBindingPattern);
+ Debug.assertNode(node2, isObjectBindingPattern);
parts.push({ text: "{" });
- if (node.elements.length) {
+ if (node2.elements.length) {
parts.push({ text: " " });
- visitDisplayPartList(node.elements, ", ");
+ visitDisplayPartList(node2.elements, ", ");
parts.push({ text: " " });
}
parts.push({ text: "}" });
break;
case 208 /* BindingElement */:
- Debug.assertNode(node, isBindingElement);
- visitForDisplayParts(node.name);
+ Debug.assertNode(node2, isBindingElement);
+ visitForDisplayParts(node2.name);
break;
case 224 /* PrefixUnaryExpression */:
- Debug.assertNode(node, isPrefixUnaryExpression);
- parts.push({ text: tokenToString(node.operator) });
- visitForDisplayParts(node.operand);
+ Debug.assertNode(node2, isPrefixUnaryExpression);
+ parts.push({ text: tokenToString(node2.operator) });
+ visitForDisplayParts(node2.operand);
break;
case 203 /* TemplateLiteralType */:
- Debug.assertNode(node, isTemplateLiteralTypeNode);
- visitForDisplayParts(node.head);
- node.templateSpans.forEach(visitForDisplayParts);
+ Debug.assertNode(node2, isTemplateLiteralTypeNode);
+ visitForDisplayParts(node2.head);
+ node2.templateSpans.forEach(visitForDisplayParts);
break;
case 16 /* TemplateHead */:
- Debug.assertNode(node, isTemplateHead);
- parts.push({ text: getLiteralText2(node) });
+ Debug.assertNode(node2, isTemplateHead);
+ parts.push({ text: getLiteralText2(node2) });
break;
case 204 /* TemplateLiteralTypeSpan */:
- Debug.assertNode(node, isTemplateLiteralTypeSpan);
- visitForDisplayParts(node.type);
- visitForDisplayParts(node.literal);
+ Debug.assertNode(node2, isTemplateLiteralTypeSpan);
+ visitForDisplayParts(node2.type);
+ visitForDisplayParts(node2.literal);
break;
case 17 /* TemplateMiddle */:
- Debug.assertNode(node, isTemplateMiddle);
- parts.push({ text: getLiteralText2(node) });
+ Debug.assertNode(node2, isTemplateMiddle);
+ parts.push({ text: getLiteralText2(node2) });
break;
case 18 /* TemplateTail */:
- Debug.assertNode(node, isTemplateTail);
- parts.push({ text: getLiteralText2(node) });
+ Debug.assertNode(node2, isTemplateTail);
+ parts.push({ text: getLiteralText2(node2) });
break;
case 197 /* ThisType */:
- Debug.assertNode(node, isThisTypeNode);
+ Debug.assertNode(node2, isThisTypeNode);
parts.push({ text: "this" });
break;
default:
- Debug.failBadSyntaxKind(node);
+ Debug.failBadSyntaxKind(node2);
}
}
function visitParametersAndTypeParameters(signatureDeclaration) {
@@ -171010,22 +172326,22 @@ function provideInlayHints(context) {
parts.push({ text: ")" });
}
function visitDisplayPartList(nodes, separator) {
- nodes.forEach((node, index) => {
+ nodes.forEach((node2, index) => {
if (index > 0) {
parts.push({ text: separator });
}
- visitForDisplayParts(node);
+ visitForDisplayParts(node2);
});
}
- function getLiteralText2(node) {
- switch (node.kind) {
+ function getLiteralText2(node2) {
+ switch (node2.kind) {
case 11 /* StringLiteral */:
- return quotePreference === 0 /* Single */ ? `'${escapeString(node.text, 39 /* singleQuote */)}'` : `"${escapeString(node.text, 34 /* doubleQuote */)}"`;
+ return quotePreference === 0 /* Single */ ? `'${escapeString(node2.text, 39 /* singleQuote */)}'` : `"${escapeString(node2.text, 34 /* doubleQuote */)}"`;
case 16 /* TemplateHead */:
case 17 /* TemplateMiddle */:
case 18 /* TemplateTail */: {
- const rawText = node.rawText ?? escapeTemplateSubstitution(escapeString(node.text, 96 /* backtick */));
- switch (node.kind) {
+ const rawText = node2.rawText ?? escapeTemplateSubstitution(escapeString(node2.text, 96 /* backtick */));
+ switch (node2.kind) {
case 16 /* TemplateHead */:
return "`" + rawText + "${";
case 17 /* TemplateMiddle */:
@@ -171035,7 +172351,7 @@ function provideInlayHints(context) {
}
}
}
- return node.text;
+ return node2.text;
}
}
function isUndefined(name) {
@@ -171181,7 +172497,7 @@ function getJsDocCommentsFromDeclarations(declarations, checker) {
return flatten(intersperse(parts, [lineBreakPart()]));
}
function isIdenticalListOfDisplayParts(parts1, parts2) {
- return arraysEqual(parts1, parts2, (p1, p2) => p1.kind === p2.kind && p1.text === p2.text);
+ return arrayIsEqualTo(parts1, parts2, (p1, p2) => p1.kind === p2.kind && p1.text === p2.text);
}
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
@@ -171544,9 +172860,10 @@ ${content}
parsedNodes.push({ sourceFile: sourceFile2, body: bod });
}
}
- const { body } = parsedNodes.sort(
+ parsedNodes.sort(
(a, b) => a.sourceFile.parseDiagnostics.length - b.sourceFile.parseDiagnostics.length
- )[0];
+ );
+ const { body } = parsedNodes[0];
return body;
}
function placeNodeGroup(originalFile, changeTracker, changes, focusLocations) {
@@ -171695,7 +173012,6 @@ var ts_OrganizeImports_exports = {};
__export(ts_OrganizeImports_exports, {
compareImportsOrRequireStatements: () => compareImportsOrRequireStatements,
compareModuleSpecifiers: () => compareModuleSpecifiers2,
- getDetectionLists: () => getDetectionLists,
getImportDeclarationInsertionIndex: () => getImportDeclarationInsertionIndex,
getImportSpecifierInsertionIndex: () => getImportSpecifierInsertionIndex,
getNamedImportSpecifierComparerWithDetection: () => getNamedImportSpecifierComparerWithDetection,
@@ -171751,7 +173067,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
}
setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */);
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
- const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer.moduleSpecifierComparer ?? defaultComparer)) : oldImportGroups;
+ const sortedImportGroups = shouldSort ? toSorted(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer.moduleSpecifierComparer ?? defaultComparer)) : oldImportGroups;
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
if (newImportDecls.length === 0) {
changeTracker.deleteNodes(
@@ -171786,7 +173102,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
const processImportsOfSameModuleSpecifier = (importGroup) => {
if (shouldRemove) importGroup = removeUnusedImports(importGroup, sourceFile, program);
if (shouldCombine) importGroup = coalesceImportsWorker(importGroup, detectedModuleCaseComparer, specifierComparer, sourceFile);
- if (shouldSort) importGroup = stableSort(importGroup, (s1, s2) => compareImportsOrRequireStatements(s1, s2, detectedModuleCaseComparer));
+ if (shouldSort) importGroup = toSorted(importGroup, (s1, s2) => compareImportsOrRequireStatements(s1, s2, detectedModuleCaseComparer));
return importGroup;
};
organizeDeclsWorker(oldImportDecls, processImportsOfSameModuleSpecifier);
@@ -171962,7 +173278,7 @@ function coalesceImportsWorker(importGroup, comparer, specifierComparer, sourceF
const importGroupsByAttributes = groupBy(importGroup, (decl) => {
if (decl.attributes) {
let attrs = decl.attributes.token + " ";
- for (const x of sort(decl.attributes.elements, (x2, y) => compareStringsCaseSensitive(x2.name.text, y.name.text))) {
+ for (const x of toSorted(decl.attributes.elements, (x2, y) => compareStringsCaseSensitive(x2.name.text, y.name.text))) {
attrs += x.name.text + ":";
attrs += isStringLiteralLike(x.value) ? `"${x.value.text}"` : x.value.getText() + " ";
}
@@ -171987,7 +173303,7 @@ function coalesceImportsWorker(importGroup, comparer, specifierComparer, sourceF
);
continue;
}
- const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
+ const sortedNamespaceImports = toSorted(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
for (const namespaceImport of sortedNamespaceImports) {
coalescedImports.push(
updateImportDeclarationAndClause(
@@ -172022,7 +173338,7 @@ function coalesceImportsWorker(importGroup, comparer, specifierComparer, sourceF
}
newImportSpecifiers.push(...getNewImportSpecifiers(namedImports));
const sortedImportSpecifiers = factory.createNodeArray(
- stableSort(newImportSpecifiers, specifierComparer),
+ toSorted(newImportSpecifiers, specifierComparer),
firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings.elements.hasTrailingComma
);
const newNamedImports = sortedImportSpecifiers.length === 0 ? newDefaultImport ? void 0 : factory.createNamedImports(emptyArray) : firstNamedImport ? factory.updateNamedImports(firstNamedImport.importClause.namedBindings, sortedImportSpecifiers) : factory.createNamedImports(sortedImportSpecifiers);
@@ -172070,7 +173386,7 @@ function coalesceExportsWorker(exportGroup, specifierComparer) {
}
const newExportSpecifiers = [];
newExportSpecifiers.push(...flatMap(exportGroup2, (i) => i.exportClause && isNamedExports(i.exportClause) ? i.exportClause.elements : emptyArray));
- const sortedExportSpecifiers = stableSort(newExportSpecifiers, specifierComparer);
+ const sortedExportSpecifiers = toSorted(newExportSpecifiers, specifierComparer);
const exportDecl = exportGroup2[0];
coalescedExports.push(
factory.updateExportDeclaration(
@@ -172148,7 +173464,7 @@ function hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier) {
return isString(moduleSpecifierText) && some(sourceFile.moduleAugmentations, (moduleName) => isStringLiteral(moduleName) && moduleName.text === moduleSpecifierText);
}
function getNewImportSpecifiers(namedImports) {
- return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && importSpecifier.name.escapedText === importSpecifier.propertyName.escapedText ? factory.updateImportSpecifier(
+ return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && moduleExportNameTextEscaped(importSpecifier.name) === moduleExportNameTextEscaped(importSpecifier.propertyName) ? factory.updateImportSpecifier(
importSpecifier,
importSpecifier.isTypeOnly,
/*propertyName*/
@@ -172358,7 +173674,8 @@ function collectElements(sourceFile, cancellationToken) {
const res = [];
addNodeOutliningSpans(sourceFile, cancellationToken, res);
addRegionOutliningSpans(sourceFile, res);
- return res.sort((span1, span2) => span1.textSpan.start - span2.textSpan.start);
+ res.sort((span1, span2) => span1.textSpan.start - span2.textSpan.start);
+ return res;
}
function addNodeOutliningSpans(sourceFile, cancellationToken, out) {
let depthRemaining = 40;
@@ -172424,11 +173741,11 @@ function addRegionOutliningSpans(sourceFile, out) {
for (const currentLineStart of lineStarts) {
const lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
const lineText = sourceFile.text.substring(currentLineStart, lineEnd);
- const result = isRegionDelimiter(lineText);
+ const result = parseRegionDelimiter(lineText);
if (!result || isInComment(sourceFile, currentLineStart)) {
continue;
}
- if (!result[1]) {
+ if (result.isStart) {
const span = createTextSpanFromBounds(sourceFile.text.indexOf("//", currentLineStart), lineEnd);
regions.push(createOutliningSpan(
span,
@@ -172436,7 +173753,7 @@ function addRegionOutliningSpans(sourceFile, out) {
span,
/*autoCollapse*/
false,
- result[2] || "#region"
+ result.name || "#region"
));
} else {
const region = regions.pop();
@@ -172448,14 +173765,18 @@ function addRegionOutliningSpans(sourceFile, out) {
}
}
}
-var regionDelimiterRegExp = /^#(end)?region(?:\s+(.*))?(?:\r)?$/;
-function isRegionDelimiter(lineText) {
+var regionDelimiterRegExp = /^#(end)?region(.*)\r?$/;
+function parseRegionDelimiter(lineText) {
lineText = lineText.trimStart();
if (!startsWith(lineText, "//")) {
return null;
}
lineText = lineText.slice(2).trim();
- return regionDelimiterRegExp.exec(lineText);
+ const result = regionDelimiterRegExp.exec(lineText);
+ if (result) {
+ return { isStart: !result[1], name: result[2].trim() };
+ }
+ return void 0;
}
function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken, out) {
const comments = getLeadingCommentRanges(sourceFile.text, pos);
@@ -172469,7 +173790,7 @@ function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken
switch (kind) {
case 2 /* SingleLineCommentTrivia */:
const commentText = sourceText.slice(pos2, end);
- if (isRegionDelimiter(commentText)) {
+ if (parseRegionDelimiter(commentText)) {
combineAndAddMultipleSingleLineComments();
singleLineCommentCount = 0;
break;
@@ -173001,9 +174322,6 @@ function getArgumentOrParameterListInfo(node, position, sourceFile, checker) {
if (!info) return void 0;
const { list, argumentIndex } = info;
const argumentCount = getArgumentCount(checker, list);
- if (argumentIndex !== 0) {
- Debug.assertLessThan(argumentIndex, argumentCount);
- }
const argumentsSpan = getApplicableSpanForArguments(list, sourceFile);
return { list, argumentIndex, argumentCount, argumentsSpan };
}
@@ -173276,9 +174594,6 @@ function createSignatureHelpItems(candidates, resolvedSignature, { isTypeParamet
void 0
) : emptyArray;
const items = map(candidates, (candidateSignature) => getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, typeChecker, enclosingDeclaration, sourceFile));
- if (argumentIndex !== 0) {
- Debug.assertLessThan(argumentIndex, argumentCount);
- }
let selectedItemIndex = 0;
let itemsSeen = 0;
for (let i = 0; i < items.length; i++) {
@@ -175092,7 +176407,7 @@ var changesToText;
function getTextChangesFromChanges(changes, newLineCharacter, formatContext, validate) {
return mapDefined(group(changes, (c) => c.sourceFile.path), (changesInFile) => {
const sourceFile = changesInFile[0].sourceFile;
- const normalized = stableSort(changesInFile, (a, b) => a.range.pos - b.range.pos || a.range.end - b.range.end);
+ const normalized = toSorted(changesInFile, (a, b) => a.range.pos - b.range.pos || a.range.end - b.range.end);
for (let i = 0; i < normalized.length - 1; i++) {
Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", () => `${JSON.stringify(normalized[i].range)} and ${JSON.stringify(normalized[i + 1].range)}`);
}
@@ -178340,16 +179655,17 @@ function pasteEditsProvider(targetFile, pastedText, pasteLocations, copiedFrom,
function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changes) {
let actualPastedText;
if (pastedText.length !== pasteLocations.length) {
- actualPastedText = pastedText.length === 1 ? pastedText : [pastedText.join("\n")];
+ actualPastedText = pastedText.length === 1 ? pastedText[0] : pastedText.join(getNewLineOrDefaultFromHost(formatContext.host, formatContext.options));
}
const statements = [];
let newText = targetFile.text;
for (let i = pasteLocations.length - 1; i >= 0; i--) {
const { pos, end } = pasteLocations[i];
- newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
+ newText = actualPastedText ? newText.slice(0, pos) + actualPastedText + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
}
+ let importAdder;
Debug.checkDefined(host.runWithTemporaryFileUpdate).call(host, targetFile.fileName, newText, (updatedProgram, originalProgram, updatedFile) => {
- const importAdder = ts_codefix_exports.createImportAdder(updatedFile, updatedProgram, preferences, host);
+ importAdder = ts_codefix_exports.createImportAdder(updatedFile, updatedProgram, preferences, host);
if (copiedFrom == null ? void 0 : copiedFrom.range) {
Debug.assert(copiedFrom.range.length === pastedText.length);
copiedFrom.range.forEach((copy) => {
@@ -178362,7 +179678,7 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
}
statements.push(...statementsInSourceFile.slice(startNodeIndex, endNodeIndex === -1 ? statementsInSourceFile.length : endNodeIndex + 1));
});
- const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()));
+ const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()), { pos: copiedFrom.range[0].pos, end: copiedFrom.range[copiedFrom.range.length - 1].end });
Debug.assertIsDefined(originalProgram);
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
addExportsInOldFile(copiedFrom.file, usage.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
@@ -178376,31 +179692,49 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
preferences,
formatContext
};
- forEachChild(updatedFile, function cb(node) {
- if (isIdentifier(node) && !(originalProgram == null ? void 0 : originalProgram.getTypeChecker().resolveName(
- node.text,
- node,
- -1 /* All */,
- /*excludeGlobals*/
- false
- ))) {
- importAdder.addImportForUnresolvedIdentifier(
- context,
+ let offset = 0;
+ pasteLocations.forEach((location, i) => {
+ const oldTextLength = location.end - location.pos;
+ const textToBePasted = actualPastedText ?? pastedText[i];
+ const startPos = location.pos + offset;
+ const endPos = startPos + textToBePasted.length;
+ const range = { pos: startPos, end: endPos };
+ offset += textToBePasted.length - oldTextLength;
+ const enclosingNode = findAncestor(
+ getTokenAtPosition(context.sourceFile, range.pos),
+ (ancestorNode) => rangeContainsRange(ancestorNode, range)
+ );
+ if (!enclosingNode) return;
+ forEachChild(enclosingNode, function importUnresolvedIdentifiers(node) {
+ const isImportCandidate = isIdentifier(node) && rangeContainsPosition(range, node.getStart(updatedFile)) && !(updatedProgram == null ? void 0 : updatedProgram.getTypeChecker().resolveName(
+ node.text,
node,
- /*useAutoImportProvider*/
- true
- );
- }
- node.forEachChild(cb);
+ -1 /* All */,
+ /*excludeGlobals*/
+ false
+ ));
+ if (isImportCandidate) {
+ return importAdder.addImportForUnresolvedIdentifier(
+ context,
+ node,
+ /*useAutoImportProvider*/
+ true
+ );
+ }
+ node.forEachChild(importUnresolvedIdentifiers);
+ });
});
}
importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
});
+ if (!importAdder.hasFixes()) {
+ return;
+ }
pasteLocations.forEach((paste, i) => {
changes.replaceRangeWithText(
targetFile,
{ pos: paste.pos, end: paste.end },
- actualPastedText ? actualPastedText[0] : pastedText[i]
+ actualPastedText ?? pastedText[i]
);
});
}
@@ -178458,7 +179792,6 @@ __export(ts_exports2, {
GoToDefinition: () => ts_GoToDefinition_exports,
HighlightSpanKind: () => HighlightSpanKind,
IdentifierNameMap: () => IdentifierNameMap,
- IdentifierNameMultiMap: () => IdentifierNameMultiMap,
ImportKind: () => ImportKind,
ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
IndentStyle: () => IndentStyle,
@@ -178469,6 +179802,7 @@ __export(ts_exports2, {
InlayHintKind: () => InlayHintKind2,
InlayHints: () => ts_InlayHints_exports,
InternalEmitFlags: () => InternalEmitFlags,
+ InternalNodeBuilderFlags: () => InternalNodeBuilderFlags,
InternalSymbolName: () => InternalSymbolName,
IntersectionFlags: () => IntersectionFlags,
InvalidatedProjectKind: () => InvalidatedProjectKind,
@@ -178515,6 +179849,7 @@ __export(ts_exports2, {
PollingInterval: () => PollingInterval,
PollingWatchKind: () => PollingWatchKind,
PragmaKindFlags: () => PragmaKindFlags,
+ PredicateSemantics: () => PredicateSemantics,
PrivateIdentifierKind: () => PrivateIdentifierKind,
ProcessLevel: () => ProcessLevel,
ProgramUpdateLevel: () => ProgramUpdateLevel,
@@ -178545,7 +179880,6 @@ __export(ts_exports2, {
SymbolFlags: () => SymbolFlags,
SymbolFormatFlags: () => SymbolFormatFlags,
SyntaxKind: () => SyntaxKind,
- SyntheticSymbolKind: () => SyntheticSymbolKind,
Ternary: () => Ternary,
ThrottledCancellationToken: () => ThrottledCancellationToken,
TokenClass: () => TokenClass,
@@ -178568,7 +179902,6 @@ __export(ts_exports2, {
WatchLogLevel: () => WatchLogLevel,
WatchType: () => WatchType,
accessPrivateIdentifier: () => accessPrivateIdentifier,
- addDisposableResourceHelper: () => addDisposableResourceHelper,
addEmitFlags: () => addEmitFlags,
addEmitHelper: () => addEmitHelper,
addEmitHelpers: () => addEmitHelpers,
@@ -178591,23 +179924,15 @@ __export(ts_exports2, {
arrayFrom: () => arrayFrom,
arrayIsEqualTo: () => arrayIsEqualTo,
arrayIsHomogeneous: () => arrayIsHomogeneous,
- arrayIsSorted: () => arrayIsSorted,
arrayOf: () => arrayOf,
arrayReverseIterator: () => arrayReverseIterator,
arrayToMap: () => arrayToMap,
arrayToMultiMap: () => arrayToMultiMap,
arrayToNumericMap: () => arrayToNumericMap,
- arraysEqual: () => arraysEqual,
assertType: () => assertType,
assign: () => assign,
- assignHelper: () => assignHelper,
- asyncDelegator: () => asyncDelegator,
- asyncGeneratorHelper: () => asyncGeneratorHelper,
asyncSuperHelper: () => asyncSuperHelper,
- asyncValues: () => asyncValues,
attachFileToDiagnostics: () => attachFileToDiagnostics,
- awaitHelper: () => awaitHelper,
- awaiterHelper: () => awaiterHelper,
base64decode: () => base64decode,
base64encode: () => base64encode,
binarySearch: () => binarySearch,
@@ -178620,6 +179945,7 @@ __export(ts_exports2, {
buildOverload: () => buildOverload,
bundlerModuleNameResolver: () => bundlerModuleNameResolver,
canBeConvertedToAsync: () => canBeConvertedToAsync,
+ canEmitTsBuildInfo: () => canEmitTsBuildInfo,
canHaveDecorators: () => canHaveDecorators,
canHaveExportModifier: () => canHaveExportModifier,
canHaveFlowNode: () => canHaveFlowNode,
@@ -178630,8 +179956,9 @@ __export(ts_exports2, {
canHaveJSDoc: () => canHaveJSDoc,
canHaveLocals: () => canHaveLocals,
canHaveModifiers: () => canHaveModifiers,
+ canHaveModuleSpecifier: () => canHaveModuleSpecifier,
canHaveSymbol: () => canHaveSymbol,
- canIncludeBindAndCheckDiagnsotics: () => canIncludeBindAndCheckDiagnsotics,
+ canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
canProduceDiagnostics: () => canProduceDiagnostics,
canUsePropertyAccess: () => canUsePropertyAccess,
@@ -178648,16 +179975,13 @@ __export(ts_exports2, {
changeFullExtension: () => changeFullExtension,
changesAffectModuleResolution: () => changesAffectModuleResolution,
changesAffectingProgramStructure: () => changesAffectingProgramStructure,
- characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
+ characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
childIsDecorated: () => childIsDecorated,
classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
classHasClassThisAssignment: () => classHasClassThisAssignment,
classHasDeclaredOrExplicitlyAssignedName: () => classHasDeclaredOrExplicitlyAssignedName,
classHasExplicitlyAssignedName: () => classHasExplicitlyAssignedName,
classOrConstructorParameterIsDecorated: () => classOrConstructorParameterIsDecorated,
- classPrivateFieldGetHelper: () => classPrivateFieldGetHelper,
- classPrivateFieldInHelper: () => classPrivateFieldInHelper,
- classPrivateFieldSetHelper: () => classPrivateFieldSetHelper,
classicNameResolver: () => classicNameResolver,
classifier: () => ts_classifier_exports,
cleanExtendedConfigCache: () => cleanExtendedConfigCache,
@@ -178665,7 +179989,6 @@ __export(ts_exports2, {
clearMap: () => clearMap,
clearSharedExtendedConfigFileWatcher: () => clearSharedExtendedConfigFileWatcher,
climbPastPropertyAccess: () => climbPastPropertyAccess,
- climbPastPropertyOrElementAccess: () => climbPastPropertyOrElementAccess,
clone: () => clone,
cloneCompilerOptions: () => cloneCompilerOptions,
closeFileWatcher: () => closeFileWatcher,
@@ -178678,12 +180001,10 @@ __export(ts_exports2, {
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
commentPragmas: () => commentPragmas,
commonOptionsWithBuild: () => commonOptionsWithBuild,
- commonPackageFolders: () => commonPackageFolders,
compact: () => compact,
compareBooleans: () => compareBooleans,
compareDataObjects: () => compareDataObjects,
compareDiagnostics: () => compareDiagnostics,
- compareDiagnosticsSkipRelatedInformation: () => compareDiagnosticsSkipRelatedInformation,
compareEmitHelpers: () => compareEmitHelpers,
compareNumberOfDirectorySeparators: () => compareNumberOfDirectorySeparators,
comparePaths: () => comparePaths,
@@ -178697,26 +180018,21 @@ __export(ts_exports2, {
compareStringsCaseSensitiveUI: () => compareStringsCaseSensitiveUI,
compareTextSpans: () => compareTextSpans,
compareValues: () => compareValues,
- compileOnSaveCommandLineOption: () => compileOnSaveCommandLineOption,
compilerOptionsAffectDeclarationPath: () => compilerOptionsAffectDeclarationPath,
compilerOptionsAffectEmit: () => compilerOptionsAffectEmit,
compilerOptionsAffectSemanticDiagnostics: () => compilerOptionsAffectSemanticDiagnostics,
compilerOptionsDidYouMeanDiagnostics: () => compilerOptionsDidYouMeanDiagnostics,
compilerOptionsIndicateEsModules: () => compilerOptionsIndicateEsModules,
- compose: () => compose,
computeCommonSourceDirectoryOfFilenames: () => computeCommonSourceDirectoryOfFilenames,
computeLineAndCharacterOfPosition: () => computeLineAndCharacterOfPosition,
computeLineOfPosition: () => computeLineOfPosition,
computeLineStarts: () => computeLineStarts,
computePositionOfLineAndCharacter: () => computePositionOfLineAndCharacter,
- computeSignature: () => computeSignature,
computeSignatureWithDiagnostics: () => computeSignatureWithDiagnostics,
computeSuggestionDiagnostics: () => computeSuggestionDiagnostics,
computedOptions: () => computedOptions,
concatenate: () => concatenate,
concatenateDiagnosticMessageChains: () => concatenateDiagnosticMessageChains,
- configDirTemplateSubstitutionOptions: () => configDirTemplateSubstitutionOptions,
- configDirTemplateSubstitutionWatchOptions: () => configDirTemplateSubstitutionWatchOptions,
consumesNodeCoreModules: () => consumesNodeCoreModules,
contains: () => contains,
containsIgnoredPath: () => containsIgnoredPath,
@@ -178747,16 +180063,11 @@ __export(ts_exports2, {
createAccessorPropertySetRedirector: () => createAccessorPropertySetRedirector,
createBaseNodeFactory: () => createBaseNodeFactory,
createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
- createBindingHelper: () => createBindingHelper,
- createBuildInfo: () => createBuildInfo,
createBuilderProgram: () => createBuilderProgram,
- createBuilderProgramUsingProgramBuildInfo: () => createBuilderProgramUsingProgramBuildInfo,
+ createBuilderProgramUsingIncrementalBuildInfo: () => createBuilderProgramUsingIncrementalBuildInfo,
createBuilderStatusReporter: () => createBuilderStatusReporter,
- createCacheWithRedirects: () => createCacheWithRedirects,
createCacheableExportInfoMap: () => createCacheableExportInfoMap,
createCachedDirectoryStructureHost: () => createCachedDirectoryStructureHost,
- createClassNamedEvaluationHelperBlock: () => createClassNamedEvaluationHelperBlock,
- createClassThisAssignmentBlock: () => createClassThisAssignmentBlock,
createClassifier: () => createClassifier,
createCommentDirectivesMap: () => createCommentDirectivesMap,
createCompilerDiagnostic: () => createCompilerDiagnostic,
@@ -178808,6 +180119,7 @@ __export(ts_exports2, {
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
createModeAwareCache: () => createModeAwareCache,
createModeAwareCacheKey: () => createModeAwareCacheKey,
+ createModeMismatchDetails: () => createModeMismatchDetails,
createModuleNotFoundChain: () => createModuleNotFoundChain,
createModuleResolutionCache: () => createModuleResolutionCache,
createModuleResolutionLoader: () => createModuleResolutionLoader,
@@ -178878,9 +180190,7 @@ __export(ts_exports2, {
declarationNameToString: () => declarationNameToString,
decodeMappings: () => decodeMappings,
decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
- decorateHelper: () => decorateHelper,
deduplicate: () => deduplicate,
- defaultIncludeSpec: () => defaultIncludeSpec,
defaultInitCompilerOptions: () => defaultInitCompilerOptions,
defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
deno: () => deno_exports,
@@ -178892,27 +180202,22 @@ __export(ts_exports2, {
displayPart: () => displayPart,
displayPartsToString: () => displayPartsToString,
disposeEmitNodes: () => disposeEmitNodes,
- disposeResourcesHelper: () => disposeResourcesHelper,
documentSpansEqual: () => documentSpansEqual,
dumpTracingLegend: () => dumpTracingLegend,
elementAt: () => elementAt,
elideNodes: () => elideNodes,
- emitComments: () => emitComments,
emitDetachedComments: () => emitDetachedComments,
emitFiles: () => emitFiles,
emitFilesAndReportErrors: () => emitFilesAndReportErrors,
emitFilesAndReportErrorsAndGetExitStatus: () => emitFilesAndReportErrorsAndGetExitStatus,
emitModuleKindIsNonNodeESM: () => emitModuleKindIsNonNodeESM,
emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
- emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
- emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
emitResolverSkipsTypeChecking: () => emitResolverSkipsTypeChecking,
emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
emptyArray: () => emptyArray,
emptyFileSystemEntries: () => emptyFileSystemEntries,
emptyMap: () => emptyMap,
emptyOptions: () => emptyOptions,
- emptySet: () => emptySet,
endsWith: () => endsWith,
ensurePathIsNonModuleName: () => ensurePathIsNonModuleName,
ensureScriptKind: () => ensureScriptKind,
@@ -178923,7 +180228,6 @@ __export(ts_exports2, {
equateStringsCaseInsensitive: () => equateStringsCaseInsensitive,
equateStringsCaseSensitive: () => equateStringsCaseSensitive,
equateValues: () => equateValues,
- esDecorateHelper: () => esDecorateHelper,
escapeJsxAttributeString: () => escapeJsxAttributeString,
escapeLeadingUnderscores: () => escapeLeadingUnderscores,
escapeNonAsciiString: () => escapeNonAsciiString,
@@ -178937,15 +180241,14 @@ __export(ts_exports2, {
explainFiles: () => explainFiles,
explainIfFileIsRedirectAndImpliedFormat: () => explainIfFileIsRedirectAndImpliedFormat,
exportAssignmentIsAlias: () => exportAssignmentIsAlias,
- exportStarHelper: () => exportStarHelper,
expressionResultIsUnused: () => expressionResultIsUnused,
extend: () => extend,
- extendsHelper: () => extendsHelper,
extensionFromPath: () => extensionFromPath,
extensionIsTS: () => extensionIsTS,
extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
externalHelpersModuleNameText: () => externalHelpersModuleNameText,
factory: () => factory,
+ fileContainsPackageImport: () => fileContainsPackageImport,
fileExtensionIs: () => fileExtensionIs,
fileExtensionIsOneOf: () => fileExtensionIsOneOf,
fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
@@ -178967,7 +180270,6 @@ __export(ts_exports2, {
findLast: () => findLast,
findLastIndex: () => findLastIndex,
findListItemInfo: () => findListItemInfo,
- findMap: () => findMap,
findModifier: () => findModifier,
findNextToken: () => findNextToken,
findPackageJson: () => findPackageJson,
@@ -179015,7 +180317,6 @@ __export(ts_exports2, {
forEachTsConfigPropArray: () => forEachTsConfigPropArray,
forEachUnique: () => forEachUnique,
forEachYieldExpression: () => forEachYieldExpression,
- forSomeAncestorDirectory: () => forSomeAncestorDirectory,
formatColorAndReset: () => formatColorAndReset,
formatDiagnostic: () => formatDiagnostic,
formatDiagnostics: () => formatDiagnostics,
@@ -179026,11 +180327,8 @@ __export(ts_exports2, {
formatMessage: () => formatMessage,
formatStringFromArgs: () => formatStringFromArgs,
formatting: () => ts_formatting_exports,
- fullTripleSlashAMDReferencePathRegEx: () => fullTripleSlashAMDReferencePathRegEx,
- fullTripleSlashReferencePathRegEx: () => fullTripleSlashReferencePathRegEx,
generateDjb2Hash: () => generateDjb2Hash,
generateTSConfig: () => generateTSConfig,
- generatorHelper: () => generatorHelper,
getAdjustedReferenceLocation: () => getAdjustedReferenceLocation,
getAdjustedRenameLocation: () => getAdjustedRenameLocation,
getAliasDeclarationFromName: () => getAliasDeclarationFromName,
@@ -179049,7 +180347,6 @@ __export(ts_exports2, {
getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled,
getAssignedExpandoInitializer: () => getAssignedExpandoInitializer,
getAssignedName: () => getAssignedName,
- getAssignedNameOfIdentifier: () => getAssignedNameOfIdentifier,
getAssignmentDeclarationKind: () => getAssignmentDeclarationKind,
getAssignmentDeclarationPropertyAccessKind: () => getAssignmentDeclarationPropertyAccessKind,
getAssignmentTargetKind: () => getAssignmentTargetKind,
@@ -179090,7 +180387,6 @@ __export(ts_exports2, {
getContainingObjectLiteralElement: () => getContainingObjectLiteralElement,
getContextualTypeFromParent: () => getContextualTypeFromParent,
getContextualTypeFromParentOrAncestorTypeNode: () => getContextualTypeFromParentOrAncestorTypeNode,
- getCurrentTime: () => getCurrentTime,
getDeclarationDiagnostics: () => getDeclarationDiagnostics,
getDeclarationEmitExtensionForPath: () => getDeclarationEmitExtensionForPath,
getDeclarationEmitOutputFilePath: () => getDeclarationEmitOutputFilePath,
@@ -179108,6 +180404,7 @@ __export(ts_exports2, {
getDefaultLibFilePath: () => getDefaultLibFilePath,
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
+ getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
getDiagnosticText: () => getDiagnosticText,
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
getDirectoryPath: () => getDirectoryPath,
@@ -179138,6 +180435,7 @@ __export(ts_exports2, {
getEmitFlags: () => getEmitFlags,
getEmitHelpers: () => getEmitHelpers,
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
+ getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
getEmitModuleKind: () => getEmitModuleKind,
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
getEmitScriptTarget: () => getEmitScriptTarget,
@@ -179188,11 +180486,11 @@ __export(ts_exports2, {
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
+ getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
- getIndentSize: () => getIndentSize,
getIndentString: () => getIndentString,
getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom,
getInitializedVariables: () => getInitializedVariables,
@@ -179201,6 +180499,7 @@ __export(ts_exports2, {
getInterfaceBaseTypeNodes: () => getInterfaceBaseTypeNodes,
getInternalEmitFlags: () => getInternalEmitFlags,
getInvokedExpression: () => getInvokedExpression,
+ getIsFileExcluded: () => getIsFileExcluded,
getIsolatedModules: () => getIsolatedModules,
getJSDocAugmentsTag: () => getJSDocAugmentsTag,
getJSDocClassTag: () => getJSDocClassTag,
@@ -179229,7 +180528,6 @@ __export(ts_exports2, {
getJSDocSatisfiesExpressionType: () => getJSDocSatisfiesExpressionType,
getJSDocSatisfiesTag: () => getJSDocSatisfiesTag,
getJSDocTags: () => getJSDocTags,
- getJSDocTagsNoCache: () => getJSDocTagsNoCache,
getJSDocTemplateTag: () => getJSDocTemplateTag,
getJSDocThisTag: () => getJSDocThisTag,
getJSDocType: () => getJSDocType,
@@ -179253,7 +180551,6 @@ __export(ts_exports2, {
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
getLineInfo: () => getLineInfo,
getLineOfLocalPosition: () => getLineOfLocalPosition,
- getLineOfLocalPositionFromLineMap: () => getLineOfLocalPositionFromLineMap,
getLineStartPositionForPosition: () => getLineStartPositionForPosition,
getLineStarts: () => getLineStarts,
getLinesBetweenPositionAndNextNonWhitespaceCharacter: () => getLinesBetweenPositionAndNextNonWhitespaceCharacter,
@@ -179295,7 +180592,6 @@ __export(ts_exports2, {
getNameOfScriptTarget: () => getNameOfScriptTarget,
getNameOrArgument: () => getNameOrArgument,
getNameTable: () => getNameTable,
- getNamesForExportedSymbol: () => getNamesForExportedSymbol,
getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
getNewLineCharacter: () => getNewLineCharacter,
getNewLineKind: () => getNewLineKind,
@@ -179312,49 +180608,43 @@ __export(ts_exports2, {
getNonAssignmentOperatorForCompoundAssignment: () => getNonAssignmentOperatorForCompoundAssignment,
getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
+ getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots,
+ getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode,
getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
getNormalizedPathComponents: () => getNormalizedPathComponents,
getObjectFlags: () => getObjectFlags,
- getOperator: () => getOperator,
getOperatorAssociativity: () => getOperatorAssociativity,
getOperatorPrecedence: () => getOperatorPrecedence,
getOptionFromName: () => getOptionFromName,
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
getOptionsNameMap: () => getOptionsNameMap,
getOrCreateEmitNode: () => getOrCreateEmitNode,
- getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
getOrUpdate: () => getOrUpdate,
getOriginalNode: () => getOriginalNode,
getOriginalNodeId: () => getOriginalNodeId,
- getOriginalSourceFile: () => getOriginalSourceFile,
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
getOutputDeclarationFileNameWorker: () => getOutputDeclarationFileNameWorker,
getOutputExtension: () => getOutputExtension,
getOutputFileNames: () => getOutputFileNames,
getOutputJSFileNameWorker: () => getOutputJSFileNameWorker,
getOutputPathsFor: () => getOutputPathsFor,
- getOutputPathsForBundle: () => getOutputPathsForBundle,
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
getOwnKeys: () => getOwnKeys,
getOwnValues: () => getOwnValues,
- getPackageJsonInfo: () => getPackageJsonInfo,
getPackageJsonTypesVersionsPaths: () => getPackageJsonTypesVersionsPaths,
- getPackageJsonsVisibleToFile: () => getPackageJsonsVisibleToFile,
getPackageNameFromTypesPackageName: () => getPackageNameFromTypesPackageName,
getPackageScopeForPath: () => getPackageScopeForPath,
getParameterSymbolFromJSDoc: () => getParameterSymbolFromJSDoc,
- getParameterTypeNode: () => getParameterTypeNode,
getParentNodeInSpan: () => getParentNodeInSpan,
getParseTreeNode: () => getParseTreeNode,
getParsedCommandLineOfConfigFile: () => getParsedCommandLineOfConfigFile,
getPathComponents: () => getPathComponents,
- getPathComponentsRelativeTo: () => getPathComponentsRelativeTo,
getPathFromPathComponents: () => getPathFromPathComponents,
getPathUpdater: () => getPathUpdater,
getPathsBasePath: () => getPathsBasePath,
getPatternFromSpec: () => getPatternFromSpec,
- getPendingEmitKind: () => getPendingEmitKind,
+ getPendingEmitKindWithSeen: () => getPendingEmitKindWithSeen,
getPositionOfLineAndCharacter: () => getPositionOfLineAndCharacter,
getPossibleGenericSignatures: () => getPossibleGenericSignatures,
getPossibleOriginalInputExtensionForExtension: () => getPossibleOriginalInputExtensionForExtension,
@@ -179367,7 +180657,6 @@ __export(ts_exports2, {
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
- getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
getPropertyNameFromType: () => getPropertyNameFromType,
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
@@ -179391,13 +180680,14 @@ __export(ts_exports2, {
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
+ getResolvedModuleFromResolution: () => getResolvedModuleFromResolution,
+ getResolvedTypeReferenceDirectiveFromResolution: () => getResolvedTypeReferenceDirectiveFromResolution,
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
getRestParameterElementType: () => getRestParameterElementType,
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
getRootDeclaration: () => getRootDeclaration,
getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
getRootLength: () => getRootLength,
- getRootPathSplitLength: () => getRootPathSplitLength,
getScriptKind: () => getScriptKind,
getScriptKindFromFileName: () => getScriptKindFromFileName,
getScriptTargetFeatures: () => getScriptTargetFeatures,
@@ -179409,14 +180699,12 @@ __export(ts_exports2, {
getSetAccessorValueParameter: () => getSetAccessorValueParameter,
getSetExternalModuleIndicator: () => getSetExternalModuleIndicator,
getShebang: () => getShebang,
- getSingleInitializerOfVariableStatementOrPropertyDeclaration: () => getSingleInitializerOfVariableStatementOrPropertyDeclaration,
getSingleVariableOfVariableStatement: () => getSingleVariableOfVariableStatement,
getSnapshotText: () => getSnapshotText,
getSnippetElement: () => getSnippetElement,
getSourceFileOfModule: () => getSourceFileOfModule,
getSourceFileOfNode: () => getSourceFileOfNode,
getSourceFilePathInNewDir: () => getSourceFilePathInNewDir,
- getSourceFilePathInNewDirWorker: () => getSourceFilePathInNewDirWorker,
getSourceFileVersionAsHashFromText: () => getSourceFileVersionAsHashFromText,
getSourceFilesToEmit: () => getSourceFilesToEmit,
getSourceMapRange: () => getSourceMapRange,
@@ -179439,7 +180727,6 @@ __export(ts_exports2, {
getSwitchedType: () => getSwitchedType,
getSymbolId: () => getSymbolId,
getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
- getSymbolParentOrFail: () => getSymbolParentOrFail,
getSymbolTarget: () => getSymbolTarget,
getSyntacticClassifications: () => getSyntacticClassifications,
getSyntacticModifierFlags: () => getSyntacticModifierFlags,
@@ -179470,7 +180757,6 @@ __export(ts_exports2, {
getTouchingToken: () => getTouchingToken,
getTrailingCommentRanges: () => getTrailingCommentRanges,
getTrailingSemicolonDeferringWriter: () => getTrailingSemicolonDeferringWriter,
- getTransformFlagsSubtreeExclusions: () => getTransformFlagsSubtreeExclusions,
getTransformers: () => getTransformers,
getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
@@ -179498,7 +180784,6 @@ __export(ts_exports2, {
hasAccessorModifier: () => hasAccessorModifier,
hasAmbientModifier: () => hasAmbientModifier,
hasChangesInResolutions: () => hasChangesInResolutions,
- hasChildOfKind: () => hasChildOfKind,
hasContextSensitiveParameters: () => hasContextSensitiveParameters,
hasDecorators: () => hasDecorators,
hasDocComment: () => hasDocComment,
@@ -179507,6 +180792,7 @@ __export(ts_exports2, {
hasEffectiveModifiers: () => hasEffectiveModifiers,
hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
hasExtension: () => hasExtension,
+ hasImplementationTSFileExtension: () => hasImplementationTSFileExtension,
hasIndexSignature: () => hasIndexSignature,
hasInferredType: () => hasInferredType,
hasInitializer: () => hasInitializer,
@@ -179534,7 +180820,6 @@ __export(ts_exports2, {
hasType: () => hasType,
hasTypeArguments: () => hasTypeArguments,
hasZeroOrOneAsteriskCharacter: () => hasZeroOrOneAsteriskCharacter,
- helperString: () => helperString,
hostGetCanonicalFileName: () => hostGetCanonicalFileName,
hostUsesCaseSensitiveFileNames: () => hostUsesCaseSensitiveFileNames,
idText: () => idText,
@@ -179544,9 +180829,8 @@ __export(ts_exports2, {
identitySourceMapConsumer: () => identitySourceMapConsumer,
ignoreSourceNewlines: () => ignoreSourceNewlines,
ignoredPaths: () => ignoredPaths,
- importDefaultHelper: () => importDefaultHelper,
importFromModuleSpecifier: () => importFromModuleSpecifier,
- importStarHelper: () => importStarHelper,
+ importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
indexOfAnyCharCode: () => indexOfAnyCharCode,
indexOfNode: () => indexOfNode,
indicesOf: () => indicesOf,
@@ -179554,7 +180838,6 @@ __export(ts_exports2, {
injectClassNamedEvaluationHelperBlockIfMissing: () => injectClassNamedEvaluationHelperBlockIfMissing,
injectClassThisAssignmentIfMissing: () => injectClassThisAssignmentIfMissing,
insertImports: () => insertImports,
- insertLeadingStatement: () => insertLeadingStatement,
insertSorted: () => insertSorted,
insertStatementAfterCustomPrologue: () => insertStatementAfterCustomPrologue,
insertStatementAfterStandardPrologue: () => insertStatementAfterStandardPrologue,
@@ -179570,11 +180853,9 @@ __export(ts_exports2, {
isAccessibilityModifier: () => isAccessibilityModifier,
isAccessor: () => isAccessor,
isAccessorModifier: () => isAccessorModifier,
- isAliasSymbolDeclaration: () => isAliasSymbolDeclaration,
isAliasableExpression: () => isAliasableExpression,
isAmbientModule: () => isAmbientModule,
isAmbientPropertyDeclaration: () => isAmbientPropertyDeclaration,
- isAnonymousFunctionDefinition: () => isAnonymousFunctionDefinition,
isAnyDirectorySeparator: () => isAnyDirectorySeparator,
isAnyImportOrBareOrAccessedRequire: () => isAnyImportOrBareOrAccessedRequire,
isAnyImportOrReExport: () => isAnyImportOrReExport,
@@ -179610,6 +180891,7 @@ __export(ts_exports2, {
isAwaitKeyword: () => isAwaitKeyword,
isBigIntLiteral: () => isBigIntLiteral,
isBinaryExpression: () => isBinaryExpression,
+ isBinaryLogicalOperator: () => isBinaryLogicalOperator,
isBinaryOperatorToken: () => isBinaryOperatorToken,
isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
@@ -179631,7 +180913,7 @@ __export(ts_exports2, {
isBreakStatement: () => isBreakStatement,
isBuild: () => isBuild,
isBuildInfoFile: () => isBuildInfoFile,
- isBuilderProgram: () => isBuilderProgram2,
+ isBuilderProgram: () => isBuilderProgram,
isBundle: () => isBundle,
isCallChain: () => isCallChain,
isCallExpression: () => isCallExpression,
@@ -179650,7 +180932,6 @@ __export(ts_exports2, {
isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
- isChildOfNodeWithKind: () => isChildOfNodeWithKind,
isCircularBuildOrder: () => isCircularBuildOrder,
isClassDeclaration: () => isClassDeclaration,
isClassElement: () => isClassElement,
@@ -179662,7 +180943,6 @@ __export(ts_exports2, {
isClassOrTypeElement: () => isClassOrTypeElement,
isClassStaticBlockDeclaration: () => isClassStaticBlockDeclaration,
isClassThisAssignmentBlock: () => isClassThisAssignmentBlock,
- isCollapsedRange: () => isCollapsedRange,
isColonToken: () => isColonToken,
isCommaExpression: () => isCommaExpression,
isCommaListExpression: () => isCommaListExpression,
@@ -179705,16 +180985,13 @@ __export(ts_exports2, {
isDeleteTarget: () => isDeleteTarget,
isDeprecatedDeclaration: () => isDeprecatedDeclaration,
isDestructuringAssignment: () => isDestructuringAssignment,
- isDiagnosticWithLocation: () => isDiagnosticWithLocation,
isDiskPathRoot: () => isDiskPathRoot,
isDoStatement: () => isDoStatement,
isDocumentRegistryEntry: () => isDocumentRegistryEntry,
isDotDotDotToken: () => isDotDotDotToken,
isDottedName: () => isDottedName,
isDynamicName: () => isDynamicName,
- isESSymbolIdentifier: () => isESSymbolIdentifier,
isEffectiveExternalModule: () => isEffectiveExternalModule,
- isEffectiveModuleDeclaration: () => isEffectiveModuleDeclaration,
isEffectiveStrictModeSourceFile: () => isEffectiveStrictModeSourceFile,
isElementAccessChain: () => isElementAccessChain,
isElementAccessExpression: () => isElementAccessExpression,
@@ -179784,13 +181061,11 @@ __export(ts_exports2, {
isFunctionOrModuleBlock: () => isFunctionOrModuleBlock,
isFunctionSymbol: () => isFunctionSymbol,
isFunctionTypeNode: () => isFunctionTypeNode,
- isFutureReservedKeyword: () => isFutureReservedKeyword,
isGeneratedIdentifier: () => isGeneratedIdentifier,
isGeneratedPrivateIdentifier: () => isGeneratedPrivateIdentifier,
isGetAccessor: () => isGetAccessor,
isGetAccessorDeclaration: () => isGetAccessorDeclaration,
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
- isGlobalDeclaration: () => isGlobalDeclaration,
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
isGlobalSourceFile: () => isGlobalSourceFile,
isGrammarError: () => isGrammarError,
@@ -179838,6 +181113,8 @@ __export(ts_exports2, {
isInTemplateString: () => isInTemplateString,
isInTopLevelContext: () => isInTopLevelContext,
isInTypeQuery: () => isInTypeQuery,
+ isIncrementalBuildInfo: () => isIncrementalBuildInfo,
+ isIncrementalBundleEmitBuildInfo: () => isIncrementalBundleEmitBuildInfo,
isIncrementalCompilation: () => isIncrementalCompilation,
isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
@@ -179944,7 +181221,6 @@ __export(ts_exports2, {
isLabeledStatement: () => isLabeledStatement,
isLateVisibilityPaintedStatement: () => isLateVisibilityPaintedStatement,
isLeftHandSideExpression: () => isLeftHandSideExpression,
- isLeftHandSideOfAssignment: () => isLeftHandSideOfAssignment,
isLet: () => isLet,
isLineBreak: () => isLineBreak,
isLiteralComputedPropertyDeclarationName: () => isLiteralComputedPropertyDeclarationName,
@@ -179952,10 +181228,7 @@ __export(ts_exports2, {
isLiteralExpressionOfObject: () => isLiteralExpressionOfObject,
isLiteralImportTypeNode: () => isLiteralImportTypeNode,
isLiteralKind: () => isLiteralKind,
- isLiteralLikeAccess: () => isLiteralLikeAccess,
- isLiteralLikeElementAccess: () => isLiteralLikeElementAccess,
isLiteralNameOfPropertyDeclarationOrIndexAccess: () => isLiteralNameOfPropertyDeclarationOrIndexAccess,
- isLiteralTypeLikeExpression: () => isLiteralTypeLikeExpression,
isLiteralTypeLiteral: () => isLiteralTypeLiteral,
isLiteralTypeNode: () => isLiteralTypeNode,
isLocalName: () => isLocalName,
@@ -179980,6 +181253,7 @@ __export(ts_exports2, {
isModuleBlock: () => isModuleBlock,
isModuleBody: () => isModuleBody,
isModuleDeclaration: () => isModuleDeclaration,
+ isModuleExportName: () => isModuleExportName,
isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
isModuleIdentifier: () => isModuleIdentifier,
isModuleName: () => isModuleName,
@@ -179989,7 +181263,6 @@ __export(ts_exports2, {
isModuleWithStringLiteralName: () => isModuleWithStringLiteralName,
isNameOfFunctionDeclaration: () => isNameOfFunctionDeclaration,
isNameOfModuleDeclaration: () => isNameOfModuleDeclaration,
- isNamedClassElement: () => isNamedClassElement,
isNamedDeclaration: () => isNamedDeclaration,
isNamedEvaluation: () => isNamedEvaluation,
isNamedEvaluationSource: () => isNamedEvaluationSource,
@@ -180007,7 +181280,6 @@ __export(ts_exports2, {
isNewExpression: () => isNewExpression,
isNewExpressionTarget: () => isNewExpressionTarget,
isNoSubstitutionTemplateLiteral: () => isNoSubstitutionTemplateLiteral,
- isNode: () => isNode,
isNodeArray: () => isNodeArray,
isNodeArrayMultiLine: () => isNodeArrayMultiLine,
isNodeDescendantOf: () => isNodeDescendantOf,
@@ -180016,14 +181288,11 @@ __export(ts_exports2, {
isNodeModulesDirectory: () => isNodeModulesDirectory,
isNodeWithPossibleHoistedDeclaration: () => isNodeWithPossibleHoistedDeclaration,
isNonContextualKeyword: () => isNonContextualKeyword,
- isNonExportDefaultModifier: () => isNonExportDefaultModifier,
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
- isNonGlobalDeclaration: () => isNonGlobalDeclaration,
isNonNullAccess: () => isNonNullAccess,
isNonNullChain: () => isNonNullChain,
isNonNullExpression: () => isNonNullExpression,
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
- isNotEmittedOrPartiallyEmittedNode: () => isNotEmittedOrPartiallyEmittedNode,
isNotEmittedStatement: () => isNotEmittedStatement,
isNullishCoalesce: () => isNullishCoalesce,
isNumber: () => isNumber,
@@ -180039,7 +181308,6 @@ __export(ts_exports2, {
isObjectLiteralMethod: () => isObjectLiteralMethod,
isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor,
isObjectTypeDeclaration: () => isObjectTypeDeclaration,
- isOctalDigit: () => isOctalDigit,
isOmittedExpression: () => isOmittedExpression,
isOptionalChain: () => isOptionalChain,
isOptionalChainRoot: () => isOptionalChainRoot,
@@ -180073,7 +181341,6 @@ __export(ts_exports2, {
isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
- isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
isProgramUptoDate: () => isProgramUptoDate,
isPrologueDirective: () => isPrologueDirective,
isPropertyAccessChain: () => isPropertyAccessChain,
@@ -180086,7 +181353,6 @@ __export(ts_exports2, {
isPropertyName: () => isPropertyName,
isPropertyNameLiteral: () => isPropertyNameLiteral,
isPropertySignature: () => isPropertySignature,
- isProtoSetter: () => isProtoSetter,
isPrototypeAccess: () => isPrototypeAccess,
isPrototypePropertyAssignment: () => isPrototypePropertyAssignment,
isPunctuation: () => isPunctuation,
@@ -180096,7 +181362,6 @@ __export(ts_exports2, {
isQuestionOrExclamationToken: () => isQuestionOrExclamationToken,
isQuestionOrPlusOrMinusToken: () => isQuestionOrPlusOrMinusToken,
isQuestionToken: () => isQuestionToken,
- isRawSourceMap: () => isRawSourceMap,
isReadonlyKeyword: () => isReadonlyKeyword,
isReadonlyKeywordOrPlusOrMinusToken: () => isReadonlyKeywordOrPlusOrMinusToken,
isRecognizedTripleSlashComment: () => isRecognizedTripleSlashComment,
@@ -180118,24 +181383,22 @@ __export(ts_exports2, {
isRootedDiskPath: () => isRootedDiskPath,
isSameEntityName: () => isSameEntityName,
isSatisfiesExpression: () => isSatisfiesExpression,
- isScopeMarker: () => isScopeMarker,
isSemicolonClassElement: () => isSemicolonClassElement,
isSetAccessor: () => isSetAccessor,
isSetAccessorDeclaration: () => isSetAccessorDeclaration,
- isShebangTrivia: () => isShebangTrivia,
isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
+ isSideEffectImport: () => isSideEffectImport,
isSignedNumericLiteral: () => isSignedNumericLiteral,
isSimpleCopiableExpression: () => isSimpleCopiableExpression,
isSimpleInlineableExpression: () => isSimpleInlineableExpression,
- isSimpleParameter: () => isSimpleParameter,
isSimpleParameterList: () => isSimpleParameterList,
isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
+ isSourceElement: () => isSourceElement,
isSourceFile: () => isSourceFile,
isSourceFileFromLibrary: () => isSourceFileFromLibrary,
isSourceFileJS: () => isSourceFileJS,
- isSourceFileNotJS: () => isSourceFileNotJS,
isSourceFileNotJson: () => isSourceFileNotJson,
isSourceMapping: () => isSourceMapping,
isSpecialPropertyDeclaration: () => isSpecialPropertyDeclaration,
@@ -180148,7 +181411,6 @@ __export(ts_exports2, {
isStatic: () => isStatic,
isStaticModifier: () => isStaticModifier,
isString: () => isString,
- isStringAKeyword: () => isStringAKeyword,
isStringANonContextualKeyword: () => isStringANonContextualKeyword,
isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted: () => isStringDoubleQuoted,
@@ -180161,7 +181423,6 @@ __export(ts_exports2, {
isStringTextContainingNode: () => isStringTextContainingNode,
isSuperCall: () => isSuperCall,
isSuperKeyword: () => isSuperKeyword,
- isSuperOrSuperProperty: () => isSuperOrSuperProperty,
isSuperProperty: () => isSuperProperty,
isSupportedSourceFileName: () => isSupportedSourceFileName,
isSwitchStatement: () => isSwitchStatement,
@@ -180207,7 +181468,6 @@ __export(ts_exports2, {
isTypeDeclaration: () => isTypeDeclaration,
isTypeElement: () => isTypeElement,
isTypeKeyword: () => isTypeKeyword,
- isTypeKeywordToken: () => isTypeKeywordToken,
isTypeKeywordTokenOrIdentifier: () => isTypeKeywordTokenOrIdentifier,
isTypeLiteralNode: () => isTypeLiteralNode,
isTypeNode: () => isTypeNode,
@@ -180262,10 +181522,6 @@ __export(ts_exports2, {
libMap: () => libMap,
libs: () => libs,
lineBreakPart: () => lineBreakPart,
- linkNamePart: () => linkNamePart,
- linkPart: () => linkPart,
- linkTextPart: () => linkTextPart,
- listFiles: () => listFiles,
loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
loadWithModeAwareCache: () => loadWithModeAwareCache,
makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
@@ -180275,7 +181531,6 @@ __export(ts_exports2, {
map: () => map,
mapAllOrFail: () => mapAllOrFail,
mapDefined: () => mapDefined,
- mapDefinedEntries: () => mapDefinedEntries,
mapDefinedIterator: () => mapDefinedIterator,
mapEntries: () => mapEntries,
mapIterator: () => mapIterator,
@@ -180285,18 +181540,19 @@ __export(ts_exports2, {
matchPatternOrExact: () => matchPatternOrExact,
matchedText: () => matchedText,
matchesExclude: () => matchesExclude,
+ maxBy: () => maxBy,
maybeBind: () => maybeBind,
maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
memoize: () => memoize,
- memoizeCached: () => memoizeCached,
memoizeOne: () => memoizeOne,
- memoizeWeak: () => memoizeWeak,
- metadataHelper: () => metadataHelper,
min: () => min,
minAndMax: () => minAndMax,
missingFileModifiedTime: () => missingFileModifiedTime,
modifierToFlag: () => modifierToFlag,
modifiersToFlags: () => modifiersToFlags,
+ moduleExportNameIsDefault: () => moduleExportNameIsDefault,
+ moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
+ moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
moduleOptionDeclaration: () => moduleOptionDeclaration,
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
@@ -180336,11 +181592,11 @@ __export(ts_exports2, {
nodePosToString: () => nodePosToString,
nodeSeenTracker: () => nodeSeenTracker,
nodeStartsNewLexicalEnvironment: () => nodeStartsNewLexicalEnvironment,
- nodeToDisplayParts: () => nodeToDisplayParts,
noop: () => noop,
noopFileWatcher: () => noopFileWatcher,
normalizePath: () => normalizePath,
normalizeSlashes: () => normalizeSlashes,
+ normalizeSpans: () => normalizeSpans,
not: () => not,
notImplemented: () => notImplemented,
notImplementedResolver: () => notImplementedResolver,
@@ -180355,13 +181611,11 @@ __export(ts_exports2, {
optionsForBuild: () => optionsForBuild,
optionsForWatch: () => optionsForWatch,
optionsHaveChanges: () => optionsHaveChanges,
- optionsHaveModuleResolutionChanges: () => optionsHaveModuleResolutionChanges,
or: () => or,
orderedRemoveItem: () => orderedRemoveItem,
orderedRemoveItemAt: () => orderedRemoveItemAt,
packageIdToPackageName: () => packageIdToPackageName,
packageIdToString: () => packageIdToString,
- paramHelper: () => paramHelper,
parameterIsThisKeyword: () => parameterIsThisKeyword,
parameterNamePart: () => parameterNamePart,
parseBaseNodeFactory: () => parseBaseNodeFactory,
@@ -180392,10 +181646,8 @@ __export(ts_exports2, {
pathIsBareSpecifier: () => pathIsBareSpecifier,
pathIsRelative: () => pathIsRelative,
patternText: () => patternText,
- perfLogger: () => perfLogger,
performIncrementalCompilation: () => performIncrementalCompilation,
performance: () => ts_performance_exports,
- plainJSErrors: () => plainJSErrors,
positionBelongsToNode: () => positionBelongsToNode,
positionIsASICandidate: () => positionIsASICandidate,
positionIsSynthesized: () => positionIsSynthesized,
@@ -180408,7 +181660,6 @@ __export(ts_exports2, {
programContainsEsModules: () => programContainsEsModules,
programContainsModules: () => programContainsModules,
projectReferenceIsEqualTo: () => projectReferenceIsEqualTo,
- propKeyHelper: () => propKeyHelper,
propertyNamePart: () => propertyNamePart,
pseudoBigIntToString: () => pseudoBigIntToString,
punctuationPart: () => punctuationPart,
@@ -180431,7 +181682,6 @@ __export(ts_exports2, {
rangeStartPositionsAreOnSameLine: () => rangeStartPositionsAreOnSameLine,
readBuilderProgram: () => readBuilderProgram,
readConfigFile: () => readConfigFile,
- readHelper: () => readHelper,
readJson: () => readJson,
readJsonConfigFile: () => readJsonConfigFile,
readJsonOrUndefined: () => readJsonOrUndefined,
@@ -180442,7 +181692,7 @@ __export(ts_exports2, {
reducePathComponents: () => reducePathComponents,
refactor: () => ts_refactor_exports,
regExpEscape: () => regExpEscape,
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
relativeComplement: () => relativeComplement,
removeAllComments: () => removeAllComments,
removeEmitHelper: () => removeEmitHelper,
@@ -180450,7 +181700,6 @@ __export(ts_exports2, {
removeFileExtension: () => removeFileExtension,
removeIgnoredPath: () => removeIgnoredPath,
removeMinAndVersionNumbers: () => removeMinAndVersionNumbers,
- removeOptionality: () => removeOptionality,
removePrefix: () => removePrefix,
removeSuffix: () => removeSuffix,
removeTrailingDirectorySeparator: () => removeTrailingDirectorySeparator,
@@ -180469,20 +181718,16 @@ __export(ts_exports2, {
resolveTripleslashReference: () => resolveTripleslashReference,
resolveTypeReferenceDirective: () => resolveTypeReferenceDirective,
resolvingEmptyArray: () => resolvingEmptyArray,
- restHelper: () => restHelper,
returnFalse: () => returnFalse,
returnNoopFileWatcher: () => returnNoopFileWatcher,
returnTrue: () => returnTrue,
returnUndefined: () => returnUndefined,
returnsPromise: () => returnsPromise,
- runInitializersHelper: () => runInitializersHelper,
sameFlatMap: () => sameFlatMap,
sameMap: () => sameMap,
sameMapping: () => sameMapping,
- scanShebangTrivia: () => scanShebangTrivia,
scanTokenAtPosition: () => scanTokenAtPosition,
scanner: () => scanner,
- screenStartingMessageCodes: () => screenStartingMessageCodes,
semanticDiagnosticsOptionDeclarations: () => semanticDiagnosticsOptionDeclarations,
serializeCompilerOptions: () => serializeCompilerOptions,
server: () => ts_server_exports3,
@@ -180490,16 +181735,13 @@ __export(ts_exports2, {
setCommentRange: () => setCommentRange,
setConfigFileInOptions: () => setConfigFileInOptions,
setConstantValue: () => setConstantValue,
- setEachParent: () => setEachParent,
setEmitFlags: () => setEmitFlags,
- setFunctionNameHelper: () => setFunctionNameHelper,
setGetSourceFileAsHashVersioned: () => setGetSourceFileAsHashVersioned,
setIdentifierAutoGenerate: () => setIdentifierAutoGenerate,
setIdentifierGeneratedImportReference: () => setIdentifierGeneratedImportReference,
setIdentifierTypeArguments: () => setIdentifierTypeArguments,
setInternalEmitFlags: () => setInternalEmitFlags,
setLocalizedDiagnosticMessages: () => setLocalizedDiagnosticMessages,
- setModuleDefaultHelper: () => setModuleDefaultHelper,
setNodeChildren: () => setNodeChildren,
setNodeFlags: () => setNodeFlags,
setObjectAllocator: () => setObjectAllocator,
@@ -180528,7 +181770,6 @@ __export(ts_exports2, {
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
showModuleSpecifier: () => showModuleSpecifier,
- signatureHasLiteralTypes: () => signatureHasLiteralTypes,
signatureHasRestParameter: () => signatureHasRestParameter,
signatureToDisplayParts: () => signatureToDisplayParts,
single: () => single,
@@ -180537,18 +181778,17 @@ __export(ts_exports2, {
singleOrMany: () => singleOrMany,
singleOrUndefined: () => singleOrUndefined,
skipAlias: () => skipAlias,
- skipAssertions: () => skipAssertions,
skipConstraint: () => skipConstraint,
skipOuterExpressions: () => skipOuterExpressions,
skipParentheses: () => skipParentheses,
skipPartiallyEmittedExpressions: () => skipPartiallyEmittedExpressions,
skipTrivia: () => skipTrivia,
skipTypeChecking: () => skipTypeChecking,
+ skipTypeCheckingIgnoringNoCheck: () => skipTypeCheckingIgnoringNoCheck,
skipTypeParentheses: () => skipTypeParentheses,
skipWhile: () => skipWhile,
sliceAfter: () => sliceAfter,
some: () => some,
- sort: () => sort,
sortAndDeduplicate: () => sortAndDeduplicate,
sortAndDeduplicateDiagnostics: () => sortAndDeduplicateDiagnostics,
sourceFileAffectingCompilerOptions: () => sourceFileAffectingCompilerOptions,
@@ -180557,8 +181797,6 @@ __export(ts_exports2, {
sourceMapCommentRegExpDontCareLineStart: () => sourceMapCommentRegExpDontCareLineStart,
spacePart: () => spacePart,
spanMap: () => spanMap,
- spreadArrayHelper: () => spreadArrayHelper,
- stableSort: () => stableSort,
startEndContainsRange: () => startEndContainsRange,
startEndOverlapsWithStartEnd: () => startEndOverlapsWithStartEnd,
startOnNewLine: () => startOnNewLine,
@@ -180571,10 +181809,8 @@ __export(ts_exports2, {
stringToToken: () => stringToToken,
stripQuotes: () => stripQuotes,
supportedDeclarationExtensions: () => supportedDeclarationExtensions,
- supportedJSExtensions: () => supportedJSExtensions,
supportedJSExtensionsFlat: () => supportedJSExtensionsFlat,
supportedLocaleDirectories: () => supportedLocaleDirectories,
- supportedTSExtensions: () => supportedTSExtensions,
supportedTSExtensionsFlat: () => supportedTSExtensionsFlat,
supportedTSImplementationExtensions: () => supportedTSImplementationExtensions,
suppressLeadingAndTrailingTrivia: () => suppressLeadingAndTrailingTrivia,
@@ -180583,16 +181819,12 @@ __export(ts_exports2, {
symbolEscapedNameNoDefault: () => symbolEscapedNameNoDefault,
symbolName: () => symbolName,
symbolNameNoDefault: () => symbolNameNoDefault,
- symbolPart: () => symbolPart,
symbolToDisplayParts: () => symbolToDisplayParts,
- syntaxMayBeASICandidate: () => syntaxMayBeASICandidate,
- syntaxRequiresTrailingSemicolonOrASI: () => syntaxRequiresTrailingSemicolonOrASI,
sys: () => sys,
sysLog: () => sysLog,
tagNamesAreEquivalent: () => tagNamesAreEquivalent,
takeWhile: () => takeWhile,
targetOptionDeclaration: () => targetOptionDeclaration,
- templateObjectHelper: () => templateObjectHelper,
testFormatSettings: () => testFormatSettings,
textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
textChangeRangeNewSpan: () => textChangeRangeNewSpan,
@@ -180600,7 +181832,10 @@ __export(ts_exports2, {
textOrKeywordPart: () => textOrKeywordPart,
textPart: () => textPart,
textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
+ textRangeContainsTextSpan: () => textRangeContainsTextSpan,
+ textRangeIntersectsWithTextSpan: () => textRangeIntersectsWithTextSpan,
textSpanContainsPosition: () => textSpanContainsPosition,
+ textSpanContainsTextRange: () => textSpanContainsTextRange,
textSpanContainsTextSpan: () => textSpanContainsTextSpan,
textSpanEnd: () => textSpanEnd,
textSpanIntersection: () => textSpanIntersection,
@@ -180618,15 +181853,16 @@ __export(ts_exports2, {
toBuilderStateFileInfoForMultiEmit: () => toBuilderStateFileInfoForMultiEmit,
toEditorSettings: () => toEditorSettings,
toFileNameLowerCase: () => toFileNameLowerCase,
- toLowerCase: () => toLowerCase,
toPath: () => toPath,
toProgramEmitPending: () => toProgramEmitPending,
+ toSorted: () => toSorted,
tokenIsIdentifierOrKeyword: () => tokenIsIdentifierOrKeyword,
tokenIsIdentifierOrKeywordOrGreaterThan: () => tokenIsIdentifierOrKeywordOrGreaterThan,
tokenToString: () => tokenToString,
trace: () => trace,
tracing: () => tracing,
tracingEnabled: () => tracingEnabled,
+ transferSourceFileChildren: () => transferSourceFileChildren,
transform: () => transform,
transformClassFields: () => transformClassFields,
transformDeclarations: () => transformDeclarations,
@@ -180641,11 +181877,11 @@ __export(ts_exports2, {
transformESDecorators: () => transformESDecorators,
transformESNext: () => transformESNext,
transformGenerators: () => transformGenerators,
+ transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
transformJsx: () => transformJsx,
transformLegacyDecorators: () => transformLegacyDecorators,
transformModule: () => transformModule,
transformNamedEvaluation: () => transformNamedEvaluation,
- transformNodeModule: () => transformNodeModule,
transformNodes: () => transformNodes,
transformSystemModule: () => transformSystemModule,
transformTypeScript: () => transformTypeScript,
@@ -180672,7 +181908,6 @@ __export(ts_exports2, {
tryGetPropertyNameOfBindingOrAssignmentElement: () => tryGetPropertyNameOfBindingOrAssignmentElement,
tryGetSourceMappingURL: () => tryGetSourceMappingURL,
tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
- tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
tryParseJson: () => tryParseJson,
tryParsePattern: () => tryParsePattern,
tryParsePatterns: () => tryParsePatterns,
@@ -180694,7 +181929,6 @@ __export(ts_exports2, {
unescapeLeadingUnderscores: () => unescapeLeadingUnderscores,
unmangleScopedPackageName: () => unmangleScopedPackageName,
unorderedRemoveItem: () => unorderedRemoveItem,
- unorderedRemoveItemAt: () => unorderedRemoveItemAt,
unreachableCodeIsError: () => unreachableCodeIsError,
unsetNodeChildren: () => unsetNodeChildren,
unusedLabelIsError: () => unusedLabelIsError,
@@ -180707,11 +181941,9 @@ __export(ts_exports2, {
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
updateSourceFile: () => updateSourceFile,
updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories,
- usesExtensionsOnImports: () => usesExtensionsOnImports,
usingSingleLineStringWriter: () => usingSingleLineStringWriter,
utf16EncodeAsString: () => utf16EncodeAsString,
validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage,
- valuesHelper: () => valuesHelper,
version: () => version,
versionMajorMinor: () => versionMajorMinor,
visitArray: () => visitArray,
@@ -180724,7 +181956,6 @@ __export(ts_exports2, {
visitNodes: () => visitNodes2,
visitParameterList: () => visitParameterList,
walkUpBindingElementsAndPatterns: () => walkUpBindingElementsAndPatterns,
- walkUpLexicalEnvironments: () => walkUpLexicalEnvironments,
walkUpOuterExpressions: () => walkUpOuterExpressions,
walkUpParenthesizedExpressions: () => walkUpParenthesizedExpressions,
walkUpParenthesizedTypes: () => walkUpParenthesizedTypes,
@@ -180877,20 +182108,19 @@ __export(ts_server_exports3, {
LogLevel: () => LogLevel2,
Msg: () => Msg,
OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
- Project: () => Project3,
+ Project: () => Project2,
ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
ProjectKind: () => ProjectKind,
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
- ProjectService: () => ProjectService3,
+ ProjectService: () => ProjectService2,
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
ScriptInfo: () => ScriptInfo,
ScriptVersionCache: () => ScriptVersionCache,
Session: () => Session3,
TextStorage: () => TextStorage,
ThrottledOperations: () => ThrottledOperations,
- TypingsCache: () => TypingsCache,
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
@@ -180909,7 +182139,6 @@ __export(ts_server_exports3, {
createSortedArray: () => createSortedArray2,
emptyArray: () => emptyArray2,
findArgument: () => findArgument,
- forEachResolvedProjectReferenceProject: () => forEachResolvedProjectReferenceProject,
formatDiagnosticToProtocol: () => formatDiagnosticToProtocol,
formatMessage: () => formatMessage2,
getBaseConfigFileName: () => getBaseConfigFileName,
@@ -180935,7 +182164,6 @@ __export(ts_server_exports3, {
nullCancellationToken: () => nullCancellationToken,
nullTypingsInstaller: () => nullTypingsInstaller,
protocol: () => ts_server_protocol_exports,
- removeSorted: () => removeSorted,
stringifyIndented: () => stringifyIndented,
toEvent: () => toEvent,
toNormalizedPath: () => toNormalizedPath,
@@ -181002,7 +182230,6 @@ var TypingsInstaller = class {
this.missingTypingsSet = /* @__PURE__ */ new Set();
this.knownCachesSet = /* @__PURE__ */ new Set();
this.projectWatchers = /* @__PURE__ */ new Map();
- /** @internal */
this.pendingRunRequests = [];
this.installRunCount = 1;
this.inFlightRequestCount = 0;
@@ -181477,14 +182704,11 @@ var ThrottledOperations = class _ThrottledOperations {
return this.pendingTimeouts.delete(operationId);
}
static run(operationId, self, cb) {
- var _a, _b;
- (_a = perfLogger) == null ? void 0 : _a.logStartScheduledOperation(operationId);
self.pendingTimeouts.delete(operationId);
if (self.logger) {
self.logger.info(`Running: ${operationId}`);
}
cb();
- (_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
}
};
var GcTimer = class _GcTimer {
@@ -181500,9 +182724,7 @@ var GcTimer = class _GcTimer {
this.timerId = this.host.setTimeout(_GcTimer.run, this.delay, this);
}
static run(self) {
- var _a, _b;
self.timerId = void 0;
- (_a = perfLogger) == null ? void 0 : _a.logStartScheduledOperation("GC collect");
const log = self.logger.hasLevel(2 /* requestTime */);
const before = log && self.host.getMemoryUsage();
self.host.gc();
@@ -181510,26 +182732,12 @@ var GcTimer = class _GcTimer {
const after = self.host.getMemoryUsage();
self.logger.perftrc(`GC::before ${before}, after ${after}`);
}
- (_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
}
};
function getBaseConfigFileName(configFilePath) {
const base = getBaseFileName(configFilePath);
return base === "tsconfig.json" || base === "jsconfig.json" ? base : void 0;
}
-function removeSorted(array, remove, compare) {
- if (!array || array.length === 0) {
- return;
- }
- if (array[0] === remove) {
- array.splice(0, 1);
- return;
- }
- const removeIndex = binarySearch(array, remove, identity, compare);
- if (removeIndex >= 0) {
- array.splice(removeIndex, 1);
- }
-}
// src/server/_namespaces/ts.server.protocol.ts
var ts_server_protocol_exports = {};
@@ -181544,7 +182752,7 @@ __export(ts_server_protocol_exports, {
NewLineKind: () => NewLineKind2,
OrganizeImportsMode: () => OrganizeImportsMode,
PollingWatchKind: () => PollingWatchKind2,
- ScriptTarget: () => ScriptTarget10,
+ ScriptTarget: () => ScriptTarget11,
SemicolonPreference: () => SemicolonPreference,
WatchDirectoryKind: () => WatchDirectoryKind2,
WatchFileKind: () => WatchFileKind2
@@ -181735,24 +182943,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
NewLineKind3["Lf"] = "Lf";
return NewLineKind3;
})(NewLineKind2 || {});
-var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
- ScriptTarget11["ES3"] = "es3";
- ScriptTarget11["ES5"] = "es5";
- ScriptTarget11["ES6"] = "es6";
- ScriptTarget11["ES2015"] = "es2015";
- ScriptTarget11["ES2016"] = "es2016";
- ScriptTarget11["ES2017"] = "es2017";
- ScriptTarget11["ES2018"] = "es2018";
- ScriptTarget11["ES2019"] = "es2019";
- ScriptTarget11["ES2020"] = "es2020";
- ScriptTarget11["ES2021"] = "es2021";
- ScriptTarget11["ES2022"] = "es2022";
- ScriptTarget11["ES2023"] = "es2023";
- ScriptTarget11["ESNext"] = "esnext";
- ScriptTarget11["JSON"] = "json";
- ScriptTarget11["Latest"] = "esnext" /* ESNext */;
- return ScriptTarget11;
-})(ScriptTarget10 || {});
+var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
+ ScriptTarget12["ES3"] = "es3";
+ ScriptTarget12["ES5"] = "es5";
+ ScriptTarget12["ES6"] = "es6";
+ ScriptTarget12["ES2015"] = "es2015";
+ ScriptTarget12["ES2016"] = "es2016";
+ ScriptTarget12["ES2017"] = "es2017";
+ ScriptTarget12["ES2018"] = "es2018";
+ ScriptTarget12["ES2019"] = "es2019";
+ ScriptTarget12["ES2020"] = "es2020";
+ ScriptTarget12["ES2021"] = "es2021";
+ ScriptTarget12["ES2022"] = "es2022";
+ ScriptTarget12["ES2023"] = "es2023";
+ ScriptTarget12["ESNext"] = "esnext";
+ ScriptTarget12["JSON"] = "json";
+ ScriptTarget12["Latest"] = "esnext" /* ESNext */;
+ return ScriptTarget12;
+})(ScriptTarget11 || {});
{
}
@@ -182237,102 +183445,6 @@ function failIfInvalidLocation(location) {
Debug.assert(location.offset > 0, `Expected offset to be non-${location.offset === 0 ? "zero" : "negative"}`);
}
-// src/server/typingsCache.ts
-var nullTypingsInstaller = {
- isKnownTypesPackageName: returnFalse,
- // Should never be called because we never provide a types registry.
- installPackage: notImplemented,
- enqueueInstallTypingsRequest: noop,
- attach: noop,
- onProjectClosed: noop,
- globalTypingsCacheLocation: void 0
- // TODO: GH#18217
-};
-function setIsEqualTo(arr1, arr2) {
- if (arr1 === arr2) {
- return true;
- }
- if ((arr1 || emptyArray2).length === 0 && (arr2 || emptyArray2).length === 0) {
- return true;
- }
- const set = /* @__PURE__ */ new Map();
- let unique = 0;
- for (const v of arr1) {
- if (set.get(v) !== true) {
- set.set(v, true);
- unique++;
- }
- }
- for (const v of arr2) {
- const isSet = set.get(v);
- if (isSet === void 0) {
- return false;
- }
- if (isSet === true) {
- set.set(v, false);
- unique--;
- }
- }
- return unique === 0;
-}
-function typeAcquisitionChanged(opt1, opt2) {
- return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude);
-}
-function compilerOptionsChanged(opt1, opt2) {
- return getAllowJSCompilerOption(opt1) !== getAllowJSCompilerOption(opt2);
-}
-function unresolvedImportsChanged(imports1, imports2) {
- if (imports1 === imports2) {
- return false;
- }
- return !arrayIsEqualTo(imports1, imports2);
-}
-var TypingsCache = class {
- constructor(installer) {
- this.installer = installer;
- this.perProjectCache = /* @__PURE__ */ new Map();
- }
- isKnownTypesPackageName(name) {
- return this.installer.isKnownTypesPackageName(name);
- }
- installPackage(options) {
- return this.installer.installPackage(options);
- }
- enqueueInstallTypingsForProject(project, unresolvedImports, forceRefresh) {
- const typeAcquisition = project.getTypeAcquisition();
- if (!typeAcquisition || !typeAcquisition.enable) {
- return;
- }
- const entry = this.perProjectCache.get(project.getProjectName());
- if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilationSettings(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) {
- this.perProjectCache.set(project.getProjectName(), {
- compilerOptions: project.getCompilationSettings(),
- typeAcquisition,
- typings: entry ? entry.typings : emptyArray2,
- unresolvedImports,
- poisoned: true
- });
- this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
- }
- }
- updateTypingsForProject(projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) {
- const typings = sort(newTypings);
- this.perProjectCache.set(projectName, {
- compilerOptions,
- typeAcquisition,
- typings,
- unresolvedImports,
- poisoned: false
- });
- return !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : typings;
- }
- onProjectClosed(project) {
- if (this.perProjectCache.delete(project.getProjectName())) {
- this.installer.onProjectClosed(project);
- }
- }
-};
-
// src/server/project.ts
var ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
ProjectKind2[ProjectKind2["Inferred"] = 0] = "Inferred";
@@ -182407,7 +183519,46 @@ function hasNoTypeScriptSource(fileNames) {
function isGeneratedFileWatcher(watch) {
return watch.generatedFilePath !== void 0;
}
-var Project3 = class _Project {
+function setIsEqualTo(arr1, arr2) {
+ if (arr1 === arr2) {
+ return true;
+ }
+ if ((arr1 || emptyArray2).length === 0 && (arr2 || emptyArray2).length === 0) {
+ return true;
+ }
+ const set = /* @__PURE__ */ new Map();
+ let unique = 0;
+ for (const v of arr1) {
+ if (set.get(v) !== true) {
+ set.set(v, true);
+ unique++;
+ }
+ }
+ for (const v of arr2) {
+ const isSet = set.get(v);
+ if (isSet === void 0) {
+ return false;
+ }
+ if (isSet === true) {
+ set.set(v, false);
+ unique--;
+ }
+ }
+ return unique === 0;
+}
+function typeAcquisitionChanged(opt1, opt2) {
+ return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude);
+}
+function compilerOptionsChanged(opt1, opt2) {
+ return getAllowJSCompilerOption(opt1) !== getAllowJSCompilerOption(opt2);
+}
+function unresolvedImportsChanged(imports1, imports2) {
+ if (imports1 === imports2) {
+ return false;
+ }
+ return !arrayIsEqualTo(imports1, imports2);
+}
+var Project2 = class _Project {
/** @internal */
constructor(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, watchOptions, directoryStructureHost, currentDirectory) {
this.projectKind = projectKind;
@@ -182427,9 +183578,7 @@ var Project3 = class _Project {
* @internal
*/
this.cachedUnresolvedImportsPerFile = /* @__PURE__ */ new Map();
- /** @internal */
this.hasAddedorRemovedFiles = false;
- /** @internal */
this.hasAddedOrRemovedSymlinks = false;
/**
* Last version that was reported.
@@ -182454,7 +183603,6 @@ var Project3 = class _Project {
this.dirty = false;
/** @internal */
this.typingFiles = emptyArray2;
- /** @internal */
this.moduleSpecifierCache = createModuleSpecifierCache(this);
/** @internal */
this.createHash = maybeBind(this.projectService.host, this.projectService.host.createHash);
@@ -182500,6 +183648,7 @@ var Project3 = class _Project {
this.trace = (s) => host.trace(s);
}
this.realpath = maybeBind(host, host.realpath);
+ this.preferNonRecursiveWatch = this.projectService.canUseWatchEvents || host.preferNonRecursiveWatch;
this.resolutionCache = createResolutionCache(
this,
this.currentDirectory,
@@ -182573,18 +183722,15 @@ var Project3 = class _Project {
return { pluginConfigEntry, resolvedModule, errorLogs };
}
isKnownTypesPackageName(name) {
- return this.typingsCache.isKnownTypesPackageName(name);
+ return this.projectService.typingsInstaller.isKnownTypesPackageName(name);
}
installPackage(options) {
- return this.typingsCache.installPackage({ ...options, projectName: this.projectName, projectRootPath: this.toPath(this.currentDirectory) });
+ return this.projectService.typingsInstaller.installPackage({ ...options, projectName: this.projectName, projectRootPath: this.toPath(this.currentDirectory) });
}
/** @internal */
getGlobalTypingsCacheLocation() {
return this.getGlobalCache();
}
- get typingsCache() {
- return this.projectService.typingsCache;
- }
/** @internal */
getSymlinkCache() {
if (!this.symlinks) {
@@ -182689,7 +183835,7 @@ var Project3 = class _Project {
}
fileExists(file) {
const path = this.toPath(file);
- return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
+ return !!this.projectService.getScriptInfoForPath(path) || !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
}
/** @internal */
resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
@@ -182956,13 +184102,13 @@ var Project3 = class _Project {
return this.projectName;
}
removeLocalTypingsFromTypeAcquisition(newTypeAcquisition) {
- if (!newTypeAcquisition || !newTypeAcquisition.include) {
+ if (!newTypeAcquisition.enable || !newTypeAcquisition.include) {
return newTypeAcquisition;
}
return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
}
getExternalFiles(updateLevel) {
- return sort(flatMap(this.plugins, (plugin) => {
+ return toSorted(flatMap(this.plugins, (plugin) => {
if (typeof plugin.module.getExternalFiles !== "function") return;
try {
return plugin.module.getExternalFiles(this, updateLevel || 0 /* Update */);
@@ -182987,7 +184133,8 @@ var Project3 = class _Project {
}
close() {
var _a;
- this.projectService.typingsCache.onProjectClosed(this);
+ if (this.typingsCache) this.projectService.typingsInstaller.onProjectClosed(this);
+ this.typingsCache = void 0;
this.closeWatchingTypingLocations();
this.cleanupProgram();
forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
@@ -183229,6 +184376,12 @@ var Project3 = class _Project {
this.hasAddedOrRemovedSymlinks = true;
}
/** @internal */
+ onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath, newSourceFileByResolvedPath) {
+ if (!newSourceFileByResolvedPath || oldSourceFile.resolvedPath === oldSourceFile.path && newSourceFileByResolvedPath.resolvedPath !== oldSourceFile.path) {
+ this.detachScriptInfoFromProject(oldSourceFile.fileName, hasSourceFileByPath);
+ }
+ }
+ /** @internal */
updateFromProject() {
updateProjectIfDirty(this);
}
@@ -183237,9 +184390,8 @@ var Project3 = class _Project {
* @returns: true if set of files in the project stays the same and false - otherwise.
*/
updateGraph() {
- var _a, _b, _c, _d;
+ var _a, _b;
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "updateGraph", { name: this.projectName, kind: ProjectKind[this.projectKind] });
- (_b = perfLogger) == null ? void 0 : _b.logStartUpdateGraph();
this.resolutionCache.startRecordingFilesWithChangedResolutions();
const hasNewProgram = this.updateGraphWorker();
const hasAddedorRemovedFiles = this.hasAddedorRemovedFiles;
@@ -183253,7 +184405,7 @@ var Project3 = class _Project {
if (hasNewProgram || changedFiles.length) {
this.lastCachedUnresolvedImportsList = getUnresolvedImports(this.program, this.cachedUnresolvedImportsPerFile);
}
- this.projectService.typingsCache.enqueueInstallTypingsForProject(this, this.lastCachedUnresolvedImportsList, hasAddedorRemovedFiles);
+ this.enqueueInstallTypingsForProject(hasAddedorRemovedFiles);
} else {
this.lastCachedUnresolvedImportsList = void 0;
}
@@ -183267,12 +184419,33 @@ var Project3 = class _Project {
if (isFirstProgramLoad) {
this.getPackageJsonAutoImportProvider();
}
- (_c = perfLogger) == null ? void 0 : _c.logStopUpdateGraph();
- (_d = tracing) == null ? void 0 : _d.pop();
+ (_b = tracing) == null ? void 0 : _b.pop();
return !hasNewProgram;
}
/** @internal */
- updateTypingFiles(typingFiles) {
+ enqueueInstallTypingsForProject(forceRefresh) {
+ const typeAcquisition = this.getTypeAcquisition();
+ if (!typeAcquisition || !typeAcquisition.enable || this.projectService.typingsInstaller === nullTypingsInstaller) {
+ return;
+ }
+ const entry = this.typingsCache;
+ if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(this.getCompilationSettings(), entry.compilerOptions) || unresolvedImportsChanged(this.lastCachedUnresolvedImportsList, entry.unresolvedImports)) {
+ this.typingsCache = {
+ compilerOptions: this.getCompilationSettings(),
+ typeAcquisition,
+ unresolvedImports: this.lastCachedUnresolvedImportsList
+ };
+ this.projectService.typingsInstaller.enqueueInstallTypingsRequest(this, typeAcquisition, this.lastCachedUnresolvedImportsList);
+ }
+ }
+ /** @internal */
+ updateTypingFiles(compilerOptions, typeAcquisition, unresolvedImports, newTypings) {
+ this.typingsCache = {
+ compilerOptions,
+ typeAcquisition,
+ unresolvedImports
+ };
+ const typingFiles = !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : toSorted(newTypings);
if (enumerateInsertsAndDeletes(
typingFiles,
this.typingFiles,
@@ -183286,12 +184459,10 @@ var Project3 = class _Project {
this.projectService.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(this);
}
}
- /** @internal */
closeWatchingTypingLocations() {
if (this.typingWatchers) clearMap(this.typingWatchers, closeFileWatcher);
this.typingWatchers = void 0;
}
- /** @internal */
onTypingInstallerWatchInvoke() {
this.typingWatchers.isInvoked = true;
this.projectService.updateTypingsForProject({ projectName: this.getProjectName(), kind: ActionInvalidate });
@@ -183369,8 +184540,9 @@ var Project3 = class _Project {
return this.program;
}
removeExistingTypings(include) {
+ if (!include.length) return include;
const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this.directoryStructureHost);
- return include.filter((i) => !existing.includes(i));
+ return filter(include, (i) => !existing.includes(i));
}
updateGraphWorker() {
var _a, _b;
@@ -183394,30 +184566,6 @@ var Project3 = class _Project {
let hasNewProgram = false;
if (this.program && (!oldProgram || this.program !== oldProgram && this.program.structureIsReused !== 2 /* Completely */)) {
hasNewProgram = true;
- if (oldProgram) {
- for (const f of oldProgram.getSourceFiles()) {
- const newFile = this.program.getSourceFileByPath(f.resolvedPath);
- if (!newFile || f.resolvedPath === f.path && newFile.resolvedPath !== f.path) {
- this.detachScriptInfoFromProject(
- f.fileName,
- !!this.program.getSourceFileByPath(f.path),
- /*syncDirWatcherRemove*/
- true
- );
- }
- }
- oldProgram.forEachResolvedProjectReference((resolvedProjectReference) => {
- if (!this.program.getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
- this.detachScriptInfoFromProject(
- resolvedProjectReference.sourceFile.fileName,
- /*noRemoveResolution*/
- void 0,
- /*syncDirWatcherRemove*/
- true
- );
- }
- });
- }
this.rootFilesMap.forEach((value, path) => {
var _a2;
const file = this.program.getSourceFileByPath(path);
@@ -183449,7 +184597,7 @@ var Project3 = class _Project {
this.generatedFilesMap.forEach((watcher, source) => {
const sourceFile = this.program.getSourceFileByPath(source);
if (!sourceFile || sourceFile.resolvedPath !== source || !this.isValidGeneratedFileWatcher(
- getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.currentDirectory, this.program.getCommonSourceDirectory(), this.getCanonicalFileName),
+ getDeclarationEmitOutputFilePathWorker(sourceFile.fileName, this.compilerOptions, this.program),
watcher
)) {
closeFileWatcherOf(watcher);
@@ -183542,12 +184690,12 @@ var Project3 = class _Project {
sendPerformanceEvent(kind, durationMs) {
this.projectService.sendPerformanceEvent(kind, durationMs);
}
- detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution, syncDirWatcherRemove) {
+ detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution) {
const scriptInfoToDetach = this.projectService.getScriptInfo(uncheckedFileName);
if (scriptInfoToDetach) {
scriptInfoToDetach.detachFromProject(this);
if (!noRemoveResolution) {
- this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path, syncDirWatcherRemove);
+ this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path);
}
}
}
@@ -183647,7 +184795,6 @@ var Project3 = class _Project {
false
);
}
- /** @internal */
filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
if (this.isInitialLoadPending()) return " Files (0) InitialLoadPending\n";
if (!this.program) return " Files (0) NoProgram\n";
@@ -183981,7 +185128,6 @@ var Project3 = class _Project {
(_c = tracing) == null ? void 0 : _c.pop();
}
}
- /** @internal */
isDefaultProjectForOpenFiles() {
return !!forEachEntry(
this.projectService.openFiles,
@@ -184013,16 +185159,15 @@ var Project3 = class _Project {
var _a, _b, _c, _d;
const originalProgram = this.program;
const rootSourceFile = Debug.checkDefined((_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile), "Expected file to be part of program");
- const originalText = Debug.checkDefined(rootSourceFile.getText());
+ const originalText = Debug.checkDefined(rootSourceFile.getFullText());
(_b = this.getScriptInfo(rootFile)) == null ? void 0 : _b.editContent(0, originalText.length, updatedText);
this.updateGraph();
try {
cb(this.program, originalProgram, (_c = this.program) == null ? void 0 : _c.getSourceFile(rootFile));
} finally {
- (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
+ (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, updatedText.length, originalText);
}
}
- /** @internal */
getCompilerOptionsForNoDtsResolutionProject() {
return {
...this.getCompilerOptions(),
@@ -184063,7 +185208,7 @@ function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, c
return unresolvedImports || emptyArray2;
});
}
-var InferredProject2 = class extends Project3 {
+var InferredProject2 = class extends Project2 {
/** @internal */
constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory, typeAcquisition) {
super(
@@ -184157,7 +185302,7 @@ var InferredProject2 = class extends Project3 {
};
}
};
-var AuxiliaryProject = class extends Project3 {
+var AuxiliaryProject = class extends Project2 {
constructor(projectService, documentRegistry, compilerOptions, currentDirectory) {
super(
projectService.newAuxiliaryProjectName(),
@@ -184184,7 +185329,7 @@ var AuxiliaryProject = class extends Project3 {
return;
}
};
-var _AutoImportProviderProject = class _AutoImportProviderProject extends Project3 {
+var _AutoImportProviderProject = class _AutoImportProviderProject extends Project2 {
/** @internal */
constructor(hostProject, initialRootNames, documentRegistry, compilerOptions) {
super(
@@ -184440,7 +185585,6 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
return (_a = this.hostProject.getCurrentProgram()) == null ? void 0 : _a.getModuleResolutionCache();
}
};
-/** @internal */
_AutoImportProviderProject.maxDependencies = 10;
/** @internal */
_AutoImportProviderProject.compilerOptionsOverrides = {
@@ -184452,7 +185596,7 @@ _AutoImportProviderProject.compilerOptionsOverrides = {
noLib: true
};
var AutoImportProviderProject = _AutoImportProviderProject;
-var ConfiguredProject2 = class extends Project3 {
+var ConfiguredProject2 = class extends Project2 {
/** @internal */
constructor(configFileName, canonicalConfigFilePath, projectService, documentRegistry, cachedDirectoryStructureHost, pendingUpdateReason) {
super(
@@ -184515,7 +185659,6 @@ var ConfiguredProject2 = class extends Project3 {
onReleaseParsedCommandLine(fileName) {
this.releaseParsedConfig(asNormalizedPath(this.projectService.toCanonicalFileName(asNormalizedPath(normalizePath(fileName)))));
}
- /** @internal */
releaseParsedConfig(canonicalConfigFilePath) {
this.projectService.stopWatchingWildCards(canonicalConfigFilePath, this);
this.projectService.releaseParsedConfig(canonicalConfigFilePath, this);
@@ -184658,7 +185801,7 @@ var ConfiguredProject2 = class extends Project3 {
updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile.configFileSpecs, this.projectErrors, this.canConfigFileJsonReportNoInputFiles);
}
};
-var ExternalProject = class extends Project3 {
+var ExternalProject = class extends Project2 {
/** @internal */
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
super(
@@ -184865,6 +186008,16 @@ function findProjectByName(projectName, projects) {
}
}
}
+var nullTypingsInstaller = {
+ isKnownTypesPackageName: returnFalse,
+ // Should never be called because we never provide a types registry.
+ installPackage: notImplemented,
+ enqueueInstallTypingsRequest: noop,
+ attach: noop,
+ onProjectClosed: noop,
+ globalTypingsCacheLocation: void 0
+ // TODO: GH#18217
+};
var noopConfigFileWatcher = { close: noop };
function getConfigFileNameFromCache(info, cache) {
if (!cache || isAncestorConfigFileInfo(info)) return void 0;
@@ -185063,8 +186216,11 @@ function createProjectNameFactoryWithCounter(nameFactory) {
function getHostWatcherMap() {
return { idToCallbacks: /* @__PURE__ */ new Map(), pathToId: /* @__PURE__ */ new Map() };
}
+function getCanUseWatchEvents(service, canUseWatchEvents) {
+ return !!canUseWatchEvents && !!service.eventHandler && !!service.session;
+}
function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
- if (!canUseWatchEvents || !service.eventHandler || !service.session) return void 0;
+ if (!getCanUseWatchEvents(service, canUseWatchEvents)) return void 0;
const watchedFiles = getHostWatcherMap();
const watchedDirectories = getHostWatcherMap();
const watchedDirectoriesRecursive = getHostWatcherMap();
@@ -185222,9 +186378,7 @@ var _ProjectService = class _ProjectService {
this.pendingEnsureProjectForOpenFiles = false;
/** Tracks projects that we have already sent telemetry for. */
this.seenProjects = /* @__PURE__ */ new Map();
- /** @internal */
this.sharedExtendedConfigFileWatchers = /* @__PURE__ */ new Map();
- /** @internal */
this.extendedConfigCache = /* @__PURE__ */ new Map();
/** @internal */
this.baseline = noop;
@@ -185268,7 +186422,6 @@ var _ProjectService = class _ProjectService {
this.logger.info("No types map provided; using the default");
}
this.typingsInstaller.attach(this);
- this.typingsCache = new TypingsCache(this.typingsInstaller);
this.hostConfiguration = {
formatCodeOptions: getDefaultFormatCodeSettings(this.host.newLine),
preferences: emptyOptions,
@@ -185288,6 +186441,7 @@ var _ProjectService = class _ProjectService {
log,
getDetailWatchInfo
);
+ this.canUseWatchEvents = getCanUseWatchEvents(this, opts.canUseWatchEvents);
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
}
toPath(fileName) {
@@ -185361,12 +186515,15 @@ var _ProjectService = class _ProjectService {
}
switch (response.kind) {
case ActionSet:
- project.updateTypingFiles(this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings));
+ project.updateTypingFiles(
+ response.compilerOptions,
+ response.typeAcquisition,
+ response.unresolvedImports,
+ response.typings
+ );
return;
case ActionInvalidate:
- this.typingsCache.enqueueInstallTypingsForProject(
- project,
- project.lastCachedUnresolvedImportsList,
+ project.enqueueInstallTypingsForProject(
/*forceRefresh*/
true
);
@@ -185679,65 +186836,17 @@ var _ProjectService = class _ProjectService {
}
/**
* This is to watch whenever files are added or removed to the wildcard directories
- *
- * @internal
*/
watchWildcardDirectory(directory, flags, configFileName, config) {
let watcher = this.watchFactory.watchDirectory(
directory,
- (fileOrDirectory) => {
- const fileOrDirectoryPath = this.toPath(fileOrDirectory);
- const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
- if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
- const file = this.getNormalizedAbsolutePath(fileOrDirectory);
- this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
- this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
- this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
- }
- const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
- if (isIgnoredFileFromWildCardWatching({
- watchedDirPath: this.toPath(directory),
- fileOrDirectory,
- fileOrDirectoryPath,
- configFileName,
- extraFileExtensions: this.hostConfiguration.extraFileExtensions,
- currentDirectory: this.currentDirectory,
- options: config.parsedCommandLine.options,
- program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config.parsedCommandLine.fileNames,
- useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
- writeLog: (s) => this.logger.info(s),
- toPath: (s) => this.toPath(s),
- getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
- })) return;
- if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */;
- config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
- var _a;
- if (!watchWildcardDirectories) return;
- const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
- if (!project) return;
- if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
- const path = this.toPath(configFileName);
- if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
- project.markAutoImportProviderAsDirty();
- }
- }
- const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
- if (project.pendingUpdateLevel > updateLevel) return;
- if (this.openFiles.has(fileOrDirectoryPath)) {
- const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
- if (info.isAttached(project)) {
- const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
- project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
- } else {
- project.pendingUpdateLevel = updateLevel;
- this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
- }
- } else {
- project.pendingUpdateLevel = updateLevel;
- this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
- }
- });
- },
+ (fileOrDirectory) => this.onWildCardDirectoryWatcherInvoke(
+ directory,
+ configFileName,
+ config,
+ result,
+ fileOrDirectory
+ ),
flags,
this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine.watchOptions, getDirectoryPath(configFileName)),
WatchType.WildcardDirectory,
@@ -185760,7 +186869,62 @@ var _ProjectService = class _ProjectService {
};
return result;
}
- /** @internal */
+ onWildCardDirectoryWatcherInvoke(directory, configFileName, config, wildCardWatcher, fileOrDirectory) {
+ const fileOrDirectoryPath = this.toPath(fileOrDirectory);
+ const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
+ const file = this.getNormalizedAbsolutePath(fileOrDirectory);
+ this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
+ this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
+ this.watchPackageJsonFile(file, fileOrDirectoryPath, wildCardWatcher);
+ }
+ if (!(fsResult == null ? void 0 : fsResult.fileExists)) {
+ this.sendSourceFileChange(fileOrDirectoryPath);
+ }
+ const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
+ if (isIgnoredFileFromWildCardWatching({
+ watchedDirPath: this.toPath(directory),
+ fileOrDirectory,
+ fileOrDirectoryPath,
+ configFileName,
+ extraFileExtensions: this.hostConfiguration.extraFileExtensions,
+ currentDirectory: this.currentDirectory,
+ options: config.parsedCommandLine.options,
+ program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config.parsedCommandLine.fileNames,
+ useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
+ writeLog: (s) => this.logger.info(s),
+ toPath: (s) => this.toPath(s),
+ getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
+ })) return;
+ if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */;
+ config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
+ var _a;
+ if (!watchWildcardDirectories) return;
+ const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
+ if (!project) return;
+ if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
+ const path = this.toPath(configFileName);
+ if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
+ project.markAutoImportProviderAsDirty();
+ }
+ }
+ const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
+ if (project.pendingUpdateLevel > updateLevel) return;
+ if (this.openFiles.has(fileOrDirectoryPath)) {
+ const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
+ if (info.isAttached(project)) {
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
+ project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
+ } else {
+ project.pendingUpdateLevel = updateLevel;
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
+ }
+ } else {
+ project.pendingUpdateLevel = updateLevel;
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
+ }
+ });
+ }
delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config)) return false;
@@ -185788,7 +186952,6 @@ var _ProjectService = class _ProjectService {
});
return scheduledAnyProjectUpdate;
}
- /** @internal */
onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind) {
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
const project = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
@@ -186010,7 +187173,6 @@ var _ProjectService = class _ProjectService {
this.configFileExistenceInfoCache.set(canonicalConfigFilePath, { exists, openFilesImpactedByConfigFile });
return exists;
}
- /** @internal */
createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, forProject) {
var _a, _b;
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
@@ -186351,8 +187513,6 @@ var _ProjectService = class _ProjectService {
}
/**
* Read the config file of the project, and update the project root file names.
- *
- * @internal
*/
loadConfiguredProject(project, reason) {
var _a, _b;
@@ -186604,7 +187764,6 @@ var _ProjectService = class _ProjectService {
project.markAsDirty();
return project.updateGraph();
}
- /** @internal */
reloadFileNamesOfParsedConfig(configFileName, config) {
if (config.updateLevel === void 0) return config.parsedCommandLine.fileNames;
Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
@@ -186649,7 +187808,6 @@ var _ProjectService = class _ProjectService {
true
);
}
- /** @internal */
clearSemanticCache(project) {
project.originalConfiguredProjects = void 0;
project.resolutionCache.clear();
@@ -187226,7 +188384,6 @@ Dynamic files must always be opened with service's current directory or service
getWatchOptions(project) {
return this.getWatchOptionsFromProjectWatchOptions(project.getWatchOptions(), project.getCurrentDirectory());
}
- /** @internal */
getWatchOptionsFromProjectWatchOptions(projectOptions, basePath) {
const hostWatchOptions = !this.hostConfiguration.beforeSubstitution ? this.hostConfiguration.watchOptions : handleWatchOptionsConfigDirTemplateSubstitution(
this.hostConfiguration.beforeSubstitution,
@@ -187237,20 +188394,34 @@ Dynamic files must always be opened with service's current directory or service
closeLog() {
this.logger.close();
}
- /**
- * This function rebuilds the project for every file opened by the client
- * This does not reload contents of open files from disk. But we could do that if needed
- */
- reloadProjects() {
- this.logger.info("reload projects.");
+ sendSourceFileChange(inPath) {
this.filenameToScriptInfo.forEach((info) => {
if (this.openFiles.has(info.path)) return;
if (!info.fileWatcher) return;
+ const eventKind = memoize(
+ () => this.host.fileExists(info.fileName) ? info.deferredDelete ? 0 /* Created */ : 1 /* Changed */ : 2 /* Deleted */
+ );
+ if (inPath) {
+ if (isScriptInfoWatchedFromNodeModules(info) || !info.path.startsWith(inPath)) return;
+ if (eventKind() === 2 /* Deleted */ && info.deferredDelete) return;
+ this.logger.info(`Invoking sourceFileChange on ${info.fileName}:: ${eventKind()}`);
+ }
this.onSourceFileChanged(
info,
- this.host.fileExists(info.fileName) ? info.deferredDelete ? 0 /* Created */ : 1 /* Changed */ : 2 /* Deleted */
+ eventKind()
);
});
+ }
+ /**
+ * This function rebuilds the project for every file opened by the client
+ * This does not reload contents of open files from disk. But we could do that if needed
+ */
+ reloadProjects() {
+ this.logger.info("reload projects.");
+ this.sendSourceFileChange(
+ /*inPath*/
+ void 0
+ );
this.pendingProjectUpdates.forEach((_project, projectName) => {
this.throttledOperations.cancel(projectName);
this.pendingProjectUpdates.delete(projectName);
@@ -187599,12 +188770,12 @@ Dynamic files must always be opened with service's current directory or service
}
/** @internal */
loadAncestorProjectTree(forProjects) {
- forProjects = forProjects || mapDefinedEntries(
- this.configuredProjects,
- (key, project) => !project.isInitialLoadPending() ? [key, true] : void 0
- );
+ forProjects ?? (forProjects = new Set(
+ mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.isInitialLoadPending() ? key : void 0)
+ ));
const seenProjects = /* @__PURE__ */ new Set();
- for (const project of arrayFrom(this.configuredProjects.values())) {
+ const currentConfiguredProjects = arrayFrom(this.configuredProjects.values());
+ for (const project of currentConfiguredProjects) {
if (forEachPotentialProjectReference(project, (potentialRefPath) => forProjects.has(potentialRefPath))) {
updateProjectIfDirty(project);
}
@@ -187650,8 +188821,38 @@ Dynamic files must always be opened with service's current directory or service
}
this.removeOrphanScriptInfos();
}
+ tryInvokeWildCardDirectories(info) {
+ this.configFileExistenceInfoCache.forEach((configFileExistenceInfo, config) => {
+ var _a, _b;
+ if (!((_a = configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) || contains(
+ configFileExistenceInfo.config.parsedCommandLine.fileNames,
+ info.fileName,
+ !this.host.useCaseSensitiveFileNames ? equateStringsCaseInsensitive : equateStringsCaseSensitive
+ )) {
+ return;
+ }
+ (_b = configFileExistenceInfo.config.watchedDirectories) == null ? void 0 : _b.forEach((watcher, directory) => {
+ if (containsPath(directory, info.fileName, !this.host.useCaseSensitiveFileNames)) {
+ this.logger.info(`Invoking ${config}:: wildcard for open scriptInfo:: ${info.fileName}`);
+ this.onWildCardDirectoryWatcherInvoke(
+ directory,
+ config,
+ configFileExistenceInfo.config,
+ watcher.watcher,
+ info.fileName
+ );
+ }
+ });
+ });
+ }
openClientFileWithNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
+ const existing = this.getScriptInfoForPath(normalizedPathToPath(
+ fileName,
+ projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory,
+ this.toCanonicalFileName
+ ));
const info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
+ if (!existing && info && !info.isDynamic) this.tryInvokeWildCardDirectories(info);
const { retainProjects, ...result } = this.assignProjectToOpenedScriptInfo(info);
this.cleanupProjectsAndScriptInfos(
retainProjects,
@@ -187798,10 +188999,16 @@ Dynamic files must always be opened with service's current directory or service
}
/** @internal */
applyChangesInOpenFiles(openFiles, changedFiles, closedFiles) {
+ let existingOpenScriptInfos;
let openScriptInfos;
let assignOrphanScriptInfosToInferredProject = false;
if (openFiles) {
for (const file of openFiles) {
+ (existingOpenScriptInfos ?? (existingOpenScriptInfos = [])).push(this.getScriptInfoForPath(normalizedPathToPath(
+ toNormalizedPath(file.fileName),
+ file.projectRootPath ? this.getNormalizedAbsolutePath(file.projectRootPath) : this.currentDirectory,
+ this.toCanonicalFileName
+ )));
const info = this.getOrCreateOpenScriptInfo(
toNormalizedPath(file.fileName),
file.content,
@@ -187829,6 +189036,10 @@ Dynamic files must always be opened with service's current directory or service
}
}
let retainProjects;
+ forEach(
+ existingOpenScriptInfos,
+ (existing, index) => !existing && openScriptInfos[index] && !openScriptInfos[index].isDynamic ? this.tryInvokeWildCardDirectories(openScriptInfos[index]) : void 0
+ );
openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
var _a;
return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
@@ -188071,12 +189282,12 @@ Dynamic files must always be opened with service's current directory or service
return;
}
this.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
- if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?($|[\\/])/.test(pluginConfigEntry.name)) {
+ if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?(?:$|[\\/])/.test(pluginConfigEntry.name)) {
this.logger.info(`Skipped loading plugin ${pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)} because only package name is allowed plugin name`);
return;
}
if (this.host.importPlugin) {
- const importPromise = Project3.importServicePluginAsync(
+ const importPromise = Project2.importServicePluginAsync(
pluginConfigEntry,
searchPaths,
this.host,
@@ -188090,7 +189301,7 @@ Dynamic files must always be opened with service's current directory or service
}
this.endEnablePlugin(
project,
- Project3.importServicePluginSync(
+ Project2.importServicePluginSync(
pluginConfigEntry,
searchPaths,
this.host,
@@ -188100,7 +189311,6 @@ Dynamic files must always be opened with service's current directory or service
}
/**
* Performs the remaining steps of enabling a plugin after its module has been instantiated.
- * @internal
*/
endEnablePlugin(project, { pluginConfigEntry, resolvedModule, errorLogs }) {
var _a;
@@ -188216,7 +189426,6 @@ Dynamic files must always be opened with service's current directory or service
}
});
}
- /** @internal */
watchPackageJsonFile(file, path, project) {
Debug.assert(project !== void 0);
let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
@@ -188257,7 +189466,6 @@ Dynamic files must always be opened with service's current directory or service
result.projects.add(project);
(project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
}
- /** @internal */
onPackageJsonChange(result) {
result.projects.forEach((project) => {
var _a;
@@ -188282,7 +189490,7 @@ Dynamic files must always be opened with service's current directory or service
};
/** Makes a filename safe to insert in a RegExp */
_ProjectService.filenameEscapeRegexp = /[-/\\^$*+?.()|[\]{}]/g;
-var ProjectService3 = _ProjectService;
+var ProjectService2 = _ProjectService;
function createIncompleteCompletionsCache() {
let info;
return {
@@ -188326,6 +189534,8 @@ function createModuleSpecifierCache(host) {
kind,
modulePaths,
moduleSpecifiers,
+ /*packageName*/
+ void 0,
/*isBlockedByPackageJsonDependencies*/
false
));
@@ -188356,16 +189566,19 @@ function createModuleSpecifierCache(host) {
modulePaths,
/*moduleSpecifiers*/
void 0,
+ /*packageName*/
+ void 0,
/*isBlockedByPackageJsonDependencies*/
void 0
));
}
},
- setBlockedByPackageJsonDependencies(fromFileName, toFileName2, preferences, options, isBlockedByPackageJsonDependencies) {
+ setBlockedByPackageJsonDependencies(fromFileName, toFileName2, preferences, options, packageName, isBlockedByPackageJsonDependencies) {
const cache2 = ensureCache(fromFileName, preferences, options);
const info = cache2.get(toFileName2);
if (info) {
info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
+ info.packageName = packageName;
} else {
cache2.set(toFileName2, createInfo(
/*kind*/
@@ -188374,6 +189587,7 @@ function createModuleSpecifierCache(host) {
void 0,
/*moduleSpecifiers*/
void 0,
+ packageName,
isBlockedByPackageJsonDependencies
));
}
@@ -188403,8 +189617,8 @@ function createModuleSpecifierCache(host) {
function key(fromFileName, preferences, options) {
return `${fromFileName},${preferences.importModuleSpecifierEnding},${preferences.importModuleSpecifierPreference},${options.overrideImportMode}`;
}
- function createInfo(kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
- return { kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies };
+ function createInfo(kind, modulePaths, moduleSpecifiers, packageName, isBlockedByPackageJsonDependencies) {
+ return { kind, modulePaths, moduleSpecifiers, packageName, isBlockedByPackageJsonDependencies };
}
}
@@ -188556,11 +189770,12 @@ var MultistepOperation = class {
}
complete() {
if (this.requestId !== void 0) {
- this.operationHost.sendRequestCompletedEvent(this.requestId);
+ this.operationHost.sendRequestCompletedEvent(this.requestId, this.performanceData);
this.requestId = void 0;
}
this.setTimerHandle(void 0);
this.setImmediateId(void 0);
+ this.performanceData = void 0;
}
immediate(actionType, action) {
const requestId = this.requestId;
@@ -188568,7 +189783,7 @@ var MultistepOperation = class {
this.setImmediateId(
this.operationHost.getServerHost().setImmediate(() => {
this.immediateId = void 0;
- this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
+ this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action), this.performanceData);
}, actionType)
);
}
@@ -188579,7 +189794,7 @@ var MultistepOperation = class {
this.operationHost.getServerHost().setTimeout(
() => {
this.timerHandle = void 0;
- this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
+ this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action), this.performanceData);
},
ms,
actionType
@@ -188608,6 +189823,7 @@ var MultistepOperation = class {
this.operationHost.logError(e, `delayed processing of request ${this.requestId}`);
}
}
+ this.performanceData = this.operationHost.getPerformanceData();
if (stop || !this.hasPendingWork()) {
this.complete();
}
@@ -188961,6 +190177,9 @@ var invalidSyntacticModeCommands = [
var Session3 = class _Session {
constructor(opts) {
this.changeSeq = 0;
+ // Minimum number of lines for attempting to use region diagnostics for a file.
+ /** @internal */
+ this.regionDiagLineCountThreshold = 500;
this.handlers = new Map(Object.entries({
// TODO(jakebailey): correctly type the handlers
["status" /* Status */]: () => {
@@ -189061,7 +190280,10 @@ var Session3 = class _Session {
},
["exit" /* Exit */]: () => {
this.exit();
- return this.notRequired();
+ return this.notRequired(
+ /*request*/
+ void 0
+ );
},
["definition" /* Definition */]: (request) => {
return this.requiredResponse(this.getDefinition(
@@ -189153,7 +190375,7 @@ var Session3 = class _Session {
// TODO: GH#18217
request.arguments.projectRootPath ? toNormalizedPath(request.arguments.projectRootPath) : void 0
);
- return this.notRequired();
+ return this.notRequired(request);
},
["quickinfo" /* Quickinfo */]: (request) => {
return this.requiredResponse(this.getQuickInfoWorker(
@@ -189303,41 +190525,39 @@ var Session3 = class _Session {
},
["geterr" /* Geterr */]: (request) => {
this.errorCheck.startNew((next) => this.getDiagnostics(next, request.arguments.delay, request.arguments.files));
- return this.notRequired();
+ return this.notRequired(
+ /*request*/
+ void 0
+ );
},
["geterrForProject" /* GeterrForProject */]: (request) => {
this.errorCheck.startNew((next) => this.getDiagnosticsForProject(next, request.arguments.delay, request.arguments.file));
- return this.notRequired();
+ return this.notRequired(
+ /*request*/
+ void 0
+ );
},
["change" /* Change */]: (request) => {
this.change(request.arguments);
- return this.notRequired();
+ return this.notRequired(request);
},
["configure" /* Configure */]: (request) => {
this.projectService.setHostConfiguration(request.arguments);
- this.doOutput(
- /*info*/
- void 0,
- "configure" /* Configure */,
- request.seq,
- /*success*/
- true
- );
- return this.notRequired();
+ return this.notRequired(request);
},
["reload" /* Reload */]: (request) => {
- this.reload(request.arguments, request.seq);
+ this.reload(request.arguments);
return this.requiredResponse({ reloadFinished: true });
},
["saveto" /* Saveto */]: (request) => {
const savetoArgs = request.arguments;
this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
- return this.notRequired();
+ return this.notRequired(request);
},
["close" /* Close */]: (request) => {
const closeArgs = request.arguments;
this.closeClientFile(closeArgs.file);
- return this.notRequired();
+ return this.notRequired(request);
},
["navto" /* Navto */]: (request) => {
return this.requiredResponse(this.getNavigateToItems(
@@ -189419,9 +190639,9 @@ var Session3 = class _Session {
["projectInfo" /* ProjectInfo */]: (request) => {
return this.requiredResponse(this.getProjectInfo(request.arguments));
},
- ["reloadProjects" /* ReloadProjects */]: () => {
+ ["reloadProjects" /* ReloadProjects */]: (request) => {
this.projectService.reloadProjects();
- return this.notRequired();
+ return this.notRequired(request);
},
["jsxClosingTag" /* JsxClosingTag */]: (request) => {
return this.requiredResponse(this.getJsxClosingTag(request.arguments));
@@ -189516,15 +190736,7 @@ var Session3 = class _Session {
},
["configurePlugin" /* ConfigurePlugin */]: (request) => {
this.configurePlugin(request.arguments);
- this.doOutput(
- /*info*/
- void 0,
- "configurePlugin" /* ConfigurePlugin */,
- request.seq,
- /*success*/
- true
- );
- return this.notRequired();
+ return this.notRequired(request);
},
["selectionRange" /* SelectionRange */]: (request) => {
return this.requiredResponse(this.getSmartSelectionRange(
@@ -189624,11 +190836,12 @@ var Session3 = class _Session {
const { throttleWaitMilliseconds } = opts;
this.eventHandler = this.canUseEvents ? opts.eventHandler || ((event) => this.defaultEventHandler(event)) : void 0;
const multistepOperationHost = {
- executeWithRequestId: (requestId, action) => this.executeWithRequestId(requestId, action),
+ executeWithRequestId: (requestId, action, performanceData) => this.executeWithRequestId(requestId, action, performanceData),
getCurrentRequestId: () => this.currentRequestId,
+ getPerformanceData: () => this.performanceData,
getServerHost: () => this.host,
logError: (err, cmd) => this.logError(err, cmd),
- sendRequestCompletedEvent: (requestId) => this.sendRequestCompletedEvent(requestId),
+ sendRequestCompletedEvent: (requestId, performanceData) => this.sendRequestCompletedEvent(requestId, performanceData),
isCancellationRequested: () => this.cancellationToken.isCancellationRequested()
};
this.errorCheck = new MultistepOperation(multistepOperationHost);
@@ -189651,7 +190864,7 @@ var Session3 = class _Session {
canUseWatchEvents: opts.canUseWatchEvents,
incrementalVerifier: opts.incrementalVerifier
};
- this.projectService = new ProjectService3(settings);
+ this.projectService = new ProjectService2(settings);
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
this.gcTimer = new GcTimer(
this.host,
@@ -189680,8 +190893,14 @@ var Session3 = class _Session {
Debug.assertNever(this.projectService.serverMode);
}
}
- sendRequestCompletedEvent(requestId) {
- this.event({ request_seq: requestId }, "requestCompleted");
+ sendRequestCompletedEvent(requestId, performanceData) {
+ this.event(
+ {
+ request_seq: requestId,
+ performanceData: performanceData && toProtocolPerformanceData(performanceData)
+ },
+ "requestCompleted"
+ );
}
addPerformanceData(key, value) {
if (!this.performanceData) {
@@ -189689,6 +190908,15 @@ var Session3 = class _Session {
}
this.performanceData[key] = (this.performanceData[key] ?? 0) + value;
}
+ addDiagnosticsPerformanceData(file, kind, duration) {
+ var _a, _b;
+ if (!this.performanceData) {
+ this.performanceData = {};
+ }
+ let fileDiagnosticDuration = (_a = this.performanceData.diagnosticsDuration) == null ? void 0 : _a.get(file);
+ if (!fileDiagnosticDuration) ((_b = this.performanceData).diagnosticsDuration ?? (_b.diagnosticsDuration = /* @__PURE__ */ new Map())).set(file, fileDiagnosticDuration = {});
+ fileDiagnosticDuration[kind] = duration;
+ }
performanceEventHandler(event) {
switch (event.kind) {
case "UpdateGraph":
@@ -189831,23 +191059,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
this.writeMessage(msg);
}
writeMessage(msg) {
- var _a;
const msgText = formatMessage2(msg, this.logger, this.byteLength, this.host.newLine);
- (_a = perfLogger) == null ? void 0 : _a.logEvent(`Response message size: ${msgText.length}`);
this.host.write(msgText);
}
event(body, eventName) {
this.send(toEvent(eventName, body));
}
/** @internal */
- doOutput(info, cmdName, reqSeq, success, message) {
+ doOutput(info, cmdName, reqSeq, success, performanceData, message) {
const res = {
seq: 0,
type: "response",
command: cmdName,
request_seq: reqSeq,
success,
- performanceData: this.performanceData
+ performanceData: performanceData && toProtocolPerformanceData(performanceData)
};
if (success) {
let metadata;
@@ -189877,32 +191103,70 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
}
semanticCheck(file, project) {
var _a, _b;
+ const diagnosticsStartTime = timestamp();
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray2 : project.getLanguageService().getSemanticDiagnostics(file).filter((d) => !!d.file);
- this.sendDiagnosticsEvent(file, project, diags, "semanticDiag");
+ this.sendDiagnosticsEvent(file, project, diags, "semanticDiag", diagnosticsStartTime);
(_b = tracing) == null ? void 0 : _b.pop();
}
syntacticCheck(file, project) {
var _a, _b;
+ const diagnosticsStartTime = timestamp();
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "syntacticCheck", { file, configFilePath: project.canonicalConfigFilePath });
- this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag");
+ this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag", diagnosticsStartTime);
(_b = tracing) == null ? void 0 : _b.pop();
}
suggestionCheck(file, project) {
var _a, _b;
+ const diagnosticsStartTime = timestamp();
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "suggestionCheck", { file, configFilePath: project.canonicalConfigFilePath });
- this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag");
+ this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag", diagnosticsStartTime);
(_b = tracing) == null ? void 0 : _b.pop();
}
- sendDiagnosticsEvent(file, project, diagnostics, kind) {
+ regionSemanticCheck(file, project, ranges) {
+ var _a, _b, _c;
+ const diagnosticsStartTime = timestamp();
+ (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
+ let diagnosticsResult;
+ if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) {
+ (_b = tracing) == null ? void 0 : _b.pop();
+ return;
+ }
+ this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsStartTime, diagnosticsResult.spans);
+ (_c = tracing) == null ? void 0 : _c.pop();
+ return;
+ }
+ // We should only do the region-based semantic check if we think it would be
+ // considerably faster than a whole-file semantic check.
+ /** @internal */
+ shouldDoRegionCheck(file) {
+ var _a;
+ const lineCount = (_a = this.projectService.getScriptInfoForNormalizedPath(file)) == null ? void 0 : _a.textStorage.getLineInfo().getLineCount();
+ return !!(lineCount && lineCount >= this.regionDiagLineCountThreshold);
+ }
+ sendDiagnosticsEvent(file, project, diagnostics, kind, diagnosticsStartTime, spans) {
try {
- this.event({ file, diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)) }, kind);
+ const scriptInfo = Debug.checkDefined(project.getScriptInfo(file));
+ const duration = timestamp() - diagnosticsStartTime;
+ const body = {
+ file,
+ diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)),
+ spans: spans == null ? void 0 : spans.map((span) => toProtocolTextSpan(span, scriptInfo))
+ };
+ this.event(
+ body,
+ kind
+ );
+ this.addDiagnosticsPerformanceData(file, kind, duration);
} catch (err) {
this.logError(err, kind);
}
}
/** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */
updateErrorCheck(next, checkList, ms, requireOpen = true) {
+ if (checkList.length === 0) {
+ return;
+ }
Debug.assert(!this.suppressDiagnosticEvents);
const seq = this.changeSeq;
const followMs = Math.min(ms, 200);
@@ -189910,20 +191174,36 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
const goNext = () => {
index++;
if (checkList.length > index) {
- next.delay("checkOne", followMs, checkOne);
+ return next.delay("checkOne", followMs, checkOne);
+ }
+ };
+ const doSemanticCheck = (fileName, project) => {
+ this.semanticCheck(fileName, project);
+ if (this.changeSeq !== seq) {
+ return;
+ }
+ if (this.getPreferences(fileName).disableSuggestions) {
+ return goNext();
}
+ next.immediate("suggestionCheck", () => {
+ this.suggestionCheck(fileName, project);
+ goNext();
+ });
};
const checkOne = () => {
if (this.changeSeq !== seq) {
return;
}
+ let ranges;
let item = checkList[index];
if (isString(item)) {
item = this.toPendingErrorCheck(item);
- if (!item) {
- goNext();
- return;
- }
+ } else if ("ranges" in item) {
+ ranges = item.ranges;
+ item = this.toPendingErrorCheck(item.file);
+ }
+ if (!item) {
+ return goNext();
}
const { fileName, project } = item;
updateProjectIfDirty(project);
@@ -189935,23 +191215,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
return;
}
if (project.projectService.serverMode !== 0 /* Semantic */) {
- goNext();
- return;
+ return goNext();
}
- next.immediate("semanticCheck", () => {
- this.semanticCheck(fileName, project);
- if (this.changeSeq !== seq) {
- return;
- }
- if (this.getPreferences(fileName).disableSuggestions) {
- goNext();
- return;
- }
- next.immediate("suggestionCheck", () => {
- this.suggestionCheck(fileName, project);
- goNext();
+ if (ranges) {
+ return next.immediate("regionSemanticCheck", () => {
+ const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(fileName);
+ if (scriptInfo) {
+ this.regionSemanticCheck(fileName, project, ranges.map((range) => this.getRange({ file: fileName, ...range }, scriptInfo)));
+ }
+ if (this.changeSeq !== seq) {
+ return;
+ }
+ next.immediate("semanticCheck", () => doSemanticCheck(fileName, project));
});
- });
+ }
+ next.immediate("semanticCheck", () => doSemanticCheck(fileName, project));
};
if (checkList.length > index && this.changeSeq === seq) {
next.delay("checkOne", ms, checkOne);
@@ -190188,7 +191466,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
const packageJsonCache = (_a2 = project.getModuleResolutionCache()) == null ? void 0 : _a2.getPackageJsonInfoCache();
const compilerOptions = project.getCompilationSettings();
- const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory + "/package.json", project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
+ const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory, project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
if (!packageJson) return void 0;
const entrypoints = getEntrypointsFromPackageJsonInfo(
packageJson,
@@ -190872,42 +192150,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
const prefix = args.prefix || "";
const entries = mapDefined(completions.entries, (entry) => {
if (completions.isMemberCompletion || startsWith(entry.name.toLowerCase(), prefix.toLowerCase())) {
- const {
- name,
- kind: kind2,
- kindModifiers,
- sortText,
- insertText,
- filterText,
- replacementSpan,
- hasAction,
- source,
- sourceDisplay,
- labelDetails,
- isSnippet,
- isRecommended,
- isPackageJsonImport,
- isImportStatementCompletion,
- data
- } = entry;
- const convertedSpan = replacementSpan ? toProtocolTextSpan(replacementSpan, scriptInfo) : void 0;
+ const convertedSpan = entry.replacementSpan ? toProtocolTextSpan(entry.replacementSpan, scriptInfo) : void 0;
return {
- name,
- kind: kind2,
- kindModifiers,
- sortText,
- insertText,
- filterText,
+ ...entry,
replacementSpan: convertedSpan,
- isSnippet,
- hasAction: hasAction || void 0,
- source,
- sourceDisplay,
- labelDetails,
- isRecommended,
- isPackageJsonImport,
- isImportStatementCompletion,
- data
+ hasAction: entry.hasAction || void 0,
+ symbol: void 0
};
}
});
@@ -191030,12 +192278,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
const project = this.projectService.tryGetDefaultProjectForFile(fileName);
return project && { fileName, project };
}
- getDiagnostics(next, delay, fileNames) {
+ getDiagnostics(next, delay, fileArgs) {
if (this.suppressDiagnosticEvents) {
return;
}
- if (fileNames.length > 0) {
- this.updateErrorCheck(next, fileNames, delay);
+ if (fileArgs.length > 0) {
+ this.updateErrorCheck(next, fileArgs, delay);
}
}
change(args) {
@@ -191056,22 +192304,13 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
);
}
}
- reload(args, reqSeq) {
+ reload(args) {
const file = toNormalizedPath(args.file);
const tempFileName = args.tmpfile === void 0 ? void 0 : toNormalizedPath(args.tmpfile);
const info = this.projectService.getScriptInfoForNormalizedPath(file);
if (info) {
this.changeSeq++;
- if (info.reloadFromFile(tempFileName)) {
- this.doOutput(
- /*info*/
- void 0,
- "reload" /* Reload */,
- reqSeq,
- /*success*/
- true
- );
- }
+ info.reloadFromFile(tempFileName);
}
}
saveToTmp(fileName, tempFileName) {
@@ -191620,11 +192859,20 @@ ${e.message}`;
}
exit() {
}
- notRequired() {
- return { responseRequired: false };
+ notRequired(request) {
+ if (request) this.doOutput(
+ /*info*/
+ void 0,
+ request.command,
+ request.seq,
+ /*success*/
+ true,
+ this.performanceData
+ );
+ return { responseRequired: false, performanceData: this.performanceData };
}
requiredResponse(response) {
- return { response, responseRequired: true };
+ return { response, responseRequired: true, performanceData: this.performanceData };
}
addProtocolHandler(command, handler) {
if (this.handlers.has(command)) {
@@ -191642,18 +192890,27 @@ ${e.message}`;
this.currentRequestId = void 0;
this.cancellationToken.resetRequest(requestId);
}
- executeWithRequestId(requestId, f) {
+ // eslint-disable-line @typescript-eslint/unified-signatures
+ executeWithRequestId(requestId, f, perfomanceData) {
+ const currentPerformanceData = this.performanceData;
try {
+ this.performanceData = perfomanceData;
this.setCurrentRequest(requestId);
return f();
} finally {
this.resetCurrentRequest(requestId);
+ this.performanceData = currentPerformanceData;
}
}
executeCommand(request) {
const handler = this.handlers.get(request.command);
if (handler) {
- const response = this.executeWithRequestId(request.seq, () => handler(request));
+ const response = this.executeWithRequestId(
+ request.seq,
+ () => handler(request),
+ /*perfomanceData*/
+ void 0
+ );
this.projectService.enableRequestedPlugins();
return response;
} else {
@@ -191665,16 +192922,18 @@ ${e.message}`;
request.seq,
/*success*/
false,
+ /*performanceData*/
+ void 0,
`Unrecognized JSON command: ${request.command}`
);
return { responseRequired: false };
}
}
onMessage(message) {
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
+ var _a, _b, _c, _d, _e, _f, _g;
this.gcTimer.scheduleCollect();
- this.performanceData = void 0;
let start;
+ const currentPerformanceData = this.performanceData;
if (this.logger.hasLevel(2 /* requestTime */)) {
start = this.hrtime();
if (this.logger.hasLevel(3 /* verbose */)) {
@@ -191687,16 +192946,15 @@ ${e.message}`;
request = this.parseMessage(message);
relevantFile = request.arguments && request.arguments.file ? request.arguments : void 0;
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.Session, "request", { seq: request.seq, command: request.command });
- (_b = perfLogger) == null ? void 0 : _b.logStartCommand("" + request.command, this.toStringMessage(message).substring(0, 100));
- (_c = tracing) == null ? void 0 : _c.push(
+ (_b = tracing) == null ? void 0 : _b.push(
tracing.Phase.Session,
"executeCommand",
{ seq: request.seq, command: request.command },
/*separateBeginAndEnd*/
true
);
- const { response, responseRequired } = this.executeCommand(request);
- (_d = tracing) == null ? void 0 : _d.pop();
+ const { response, responseRequired, performanceData } = this.executeCommand(request);
+ (_c = tracing) == null ? void 0 : _c.pop();
if (this.logger.hasLevel(2 /* requestTime */)) {
const elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4);
if (responseRequired) {
@@ -191705,15 +192963,15 @@ ${e.message}`;
this.logger.perftrc(`${request.seq}::${request.command}: async elapsed time (in milliseconds) ${elapsedTime}`);
}
}
- (_e = perfLogger) == null ? void 0 : _e.logStopCommand("" + request.command, "Success");
- (_f = tracing) == null ? void 0 : _f.instant(tracing.Phase.Session, "response", { seq: request.seq, command: request.command, success: !!response });
+ (_d = tracing) == null ? void 0 : _d.instant(tracing.Phase.Session, "response", { seq: request.seq, command: request.command, success: !!response });
if (response) {
this.doOutput(
response,
request.command,
request.seq,
/*success*/
- true
+ true,
+ performanceData
);
} else if (responseRequired) {
this.doOutput(
@@ -191723,26 +192981,26 @@ ${e.message}`;
request.seq,
/*success*/
false,
+ performanceData,
"No content available."
);
}
} catch (err) {
- (_g = tracing) == null ? void 0 : _g.popAll();
+ (_e = tracing) == null ? void 0 : _e.popAll();
if (err instanceof OperationCanceledException) {
- (_h = perfLogger) == null ? void 0 : _h.logStopCommand("" + (request && request.command), "Canceled: " + err);
- (_i = tracing) == null ? void 0 : _i.instant(tracing.Phase.Session, "commandCanceled", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command });
+ (_f = tracing) == null ? void 0 : _f.instant(tracing.Phase.Session, "commandCanceled", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command });
this.doOutput(
{ canceled: true },
request.command,
request.seq,
/*success*/
- true
+ true,
+ this.performanceData
);
return;
}
this.logErrorWorker(err, this.toStringMessage(message), relevantFile);
- (_j = perfLogger) == null ? void 0 : _j.logStopCommand("" + (request && request.command), "Error: " + err);
- (_k = tracing) == null ? void 0 : _k.instant(tracing.Phase.Session, "commandError", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command, message: err.message });
+ (_g = tracing) == null ? void 0 : _g.instant(tracing.Phase.Session, "commandError", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command, message: err.message });
this.doOutput(
/*info*/
void 0,
@@ -191750,8 +193008,11 @@ ${e.message}`;
request ? request.seq : 0,
/*success*/
false,
+ this.performanceData,
"Error processing request. " + err.message + "\n" + err.stack
);
+ } finally {
+ this.performanceData = currentPerformanceData;
}
}
parseMessage(message) {
@@ -191773,6 +193034,10 @@ ${e.message}`;
return this.projectService.getHostPreferences();
}
};
+function toProtocolPerformanceData(performanceData) {
+ const diagnosticsDuration = performanceData.diagnosticsDuration && arrayFrom(performanceData.diagnosticsDuration, ([file, data]) => ({ ...data, file }));
+ return { ...performanceData, diagnosticsDuration };
+}
function toProtocolTextSpan(textSpan, scriptInfo) {
return {
start: scriptInfo.positionToLineOffset(textSpan.start),
@@ -192753,20 +194018,19 @@ __export(ts_server_exports4, {
LogLevel: () => LogLevel2,
Msg: () => Msg,
OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
- Project: () => Project3,
+ Project: () => Project2,
ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
ProjectKind: () => ProjectKind,
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
- ProjectService: () => ProjectService3,
+ ProjectService: () => ProjectService2,
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
ScriptInfo: () => ScriptInfo,
ScriptVersionCache: () => ScriptVersionCache,
Session: () => Session3,
TextStorage: () => TextStorage,
ThrottledOperations: () => ThrottledOperations,
- TypingsCache: () => TypingsCache,
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
@@ -192785,7 +194049,6 @@ __export(ts_server_exports4, {
createSortedArray: () => createSortedArray2,
emptyArray: () => emptyArray2,
findArgument: () => findArgument,
- forEachResolvedProjectReferenceProject: () => forEachResolvedProjectReferenceProject,
formatDiagnosticToProtocol: () => formatDiagnosticToProtocol,
formatMessage: () => formatMessage2,
getBaseConfigFileName: () => getBaseConfigFileName,
@@ -192811,7 +194074,6 @@ __export(ts_server_exports4, {
nullCancellationToken: () => nullCancellationToken,
nullTypingsInstaller: () => nullTypingsInstaller,
protocol: () => ts_server_protocol_exports,
- removeSorted: () => removeSorted,
stringifyIndented: () => stringifyIndented,
toEvent: () => toEvent,
toNormalizedPath: () => toNormalizedPath,
@@ -192889,7 +194151,6 @@ if (typeof console !== "undefined") {
GoToDefinition,
HighlightSpanKind,
IdentifierNameMap,
- IdentifierNameMultiMap,
ImportKind,
ImportsNotUsedAsValues,
IndentStyle,
@@ -192900,6 +194161,7 @@ if (typeof console !== "undefined") {
InlayHintKind,
InlayHints,
InternalEmitFlags,
+ InternalNodeBuilderFlags,
InternalSymbolName,
IntersectionFlags,
InvalidatedProjectKind,
@@ -192946,6 +194208,7 @@ if (typeof console !== "undefined") {
PollingInterval,
PollingWatchKind,
PragmaKindFlags,
+ PredicateSemantics,
PrivateIdentifierKind,
ProcessLevel,
ProgramUpdateLevel,
@@ -192976,7 +194239,6 @@ if (typeof console !== "undefined") {
SymbolFlags,
SymbolFormatFlags,
SyntaxKind,
- SyntheticSymbolKind,
Ternary,
ThrottledCancellationToken,
TokenClass,
@@ -192999,7 +194261,6 @@ if (typeof console !== "undefined") {
WatchLogLevel,
WatchType,
accessPrivateIdentifier,
- addDisposableResourceHelper,
addEmitFlags,
addEmitHelper,
addEmitHelpers,
@@ -193022,23 +194283,15 @@ if (typeof console !== "undefined") {
arrayFrom,
arrayIsEqualTo,
arrayIsHomogeneous,
- arrayIsSorted,
arrayOf,
arrayReverseIterator,
arrayToMap,
arrayToMultiMap,
arrayToNumericMap,
- arraysEqual,
assertType,
assign,
- assignHelper,
- asyncDelegator,
- asyncGeneratorHelper,
asyncSuperHelper,
- asyncValues,
attachFileToDiagnostics,
- awaitHelper,
- awaiterHelper,
base64decode,
base64encode,
binarySearch,
@@ -193051,6 +194304,7 @@ if (typeof console !== "undefined") {
buildOverload,
bundlerModuleNameResolver,
canBeConvertedToAsync,
+ canEmitTsBuildInfo,
canHaveDecorators,
canHaveExportModifier,
canHaveFlowNode,
@@ -193061,8 +194315,9 @@ if (typeof console !== "undefined") {
canHaveJSDoc,
canHaveLocals,
canHaveModifiers,
+ canHaveModuleSpecifier,
canHaveSymbol,
- canIncludeBindAndCheckDiagnsotics,
+ canIncludeBindAndCheckDiagnostics,
canJsonReportNoInputFiles,
canProduceDiagnostics,
canUsePropertyAccess,
@@ -193079,16 +194334,13 @@ if (typeof console !== "undefined") {
changeFullExtension,
changesAffectModuleResolution,
changesAffectingProgramStructure,
- characterToRegularExpressionFlag,
+ characterCodeToRegularExpressionFlag,
childIsDecorated,
classElementOrClassElementParameterIsDecorated,
classHasClassThisAssignment,
classHasDeclaredOrExplicitlyAssignedName,
classHasExplicitlyAssignedName,
classOrConstructorParameterIsDecorated,
- classPrivateFieldGetHelper,
- classPrivateFieldInHelper,
- classPrivateFieldSetHelper,
classicNameResolver,
classifier,
cleanExtendedConfigCache,
@@ -193096,7 +194348,6 @@ if (typeof console !== "undefined") {
clearMap,
clearSharedExtendedConfigFileWatcher,
climbPastPropertyAccess,
- climbPastPropertyOrElementAccess,
clone,
cloneCompilerOptions,
closeFileWatcher,
@@ -193109,12 +194360,10 @@ if (typeof console !== "undefined") {
commandLineOptionOfCustomType,
commentPragmas,
commonOptionsWithBuild,
- commonPackageFolders,
compact,
compareBooleans,
compareDataObjects,
compareDiagnostics,
- compareDiagnosticsSkipRelatedInformation,
compareEmitHelpers,
compareNumberOfDirectorySeparators,
comparePaths,
@@ -193128,26 +194377,21 @@ if (typeof console !== "undefined") {
compareStringsCaseSensitiveUI,
compareTextSpans,
compareValues,
- compileOnSaveCommandLineOption,
compilerOptionsAffectDeclarationPath,
compilerOptionsAffectEmit,
compilerOptionsAffectSemanticDiagnostics,
compilerOptionsDidYouMeanDiagnostics,
compilerOptionsIndicateEsModules,
- compose,
computeCommonSourceDirectoryOfFilenames,
computeLineAndCharacterOfPosition,
computeLineOfPosition,
computeLineStarts,
computePositionOfLineAndCharacter,
- computeSignature,
computeSignatureWithDiagnostics,
computeSuggestionDiagnostics,
computedOptions,
concatenate,
concatenateDiagnosticMessageChains,
- configDirTemplateSubstitutionOptions,
- configDirTemplateSubstitutionWatchOptions,
consumesNodeCoreModules,
contains,
containsIgnoredPath,
@@ -193178,16 +194422,11 @@ if (typeof console !== "undefined") {
createAccessorPropertySetRedirector,
createBaseNodeFactory,
createBinaryExpressionTrampoline,
- createBindingHelper,
- createBuildInfo,
createBuilderProgram,
- createBuilderProgramUsingProgramBuildInfo,
+ createBuilderProgramUsingIncrementalBuildInfo,
createBuilderStatusReporter,
- createCacheWithRedirects,
createCacheableExportInfoMap,
createCachedDirectoryStructureHost,
- createClassNamedEvaluationHelperBlock,
- createClassThisAssignmentBlock,
createClassifier,
createCommentDirectivesMap,
createCompilerDiagnostic,
@@ -193239,6 +194478,7 @@ if (typeof console !== "undefined") {
createMemberAccessForPropertyName,
createModeAwareCache,
createModeAwareCacheKey,
+ createModeMismatchDetails,
createModuleNotFoundChain,
createModuleResolutionCache,
createModuleResolutionLoader,
@@ -193309,9 +194549,7 @@ if (typeof console !== "undefined") {
declarationNameToString,
decodeMappings,
decodedTextSpanIntersectsWith,
- decorateHelper,
deduplicate,
- defaultIncludeSpec,
defaultInitCompilerOptions,
defaultMaximumTruncationLength,
deno,
@@ -193323,27 +194561,22 @@ if (typeof console !== "undefined") {
displayPart,
displayPartsToString,
disposeEmitNodes,
- disposeResourcesHelper,
documentSpansEqual,
dumpTracingLegend,
elementAt,
elideNodes,
- emitComments,
emitDetachedComments,
emitFiles,
emitFilesAndReportErrors,
emitFilesAndReportErrorsAndGetExitStatus,
emitModuleKindIsNonNodeESM,
emitNewLineBeforeLeadingCommentOfPosition,
- emitNewLineBeforeLeadingComments,
- emitNewLineBeforeLeadingCommentsOfPosition,
emitResolverSkipsTypeChecking,
emitSkippedWithNoDiagnostics,
emptyArray,
emptyFileSystemEntries,
emptyMap,
emptyOptions,
- emptySet,
endsWith,
ensurePathIsNonModuleName,
ensureScriptKind,
@@ -193354,7 +194587,6 @@ if (typeof console !== "undefined") {
equateStringsCaseInsensitive,
equateStringsCaseSensitive,
equateValues,
- esDecorateHelper,
escapeJsxAttributeString,
escapeLeadingUnderscores,
escapeNonAsciiString,
@@ -193368,15 +194600,14 @@ if (typeof console !== "undefined") {
explainFiles,
explainIfFileIsRedirectAndImpliedFormat,
exportAssignmentIsAlias,
- exportStarHelper,
expressionResultIsUnused,
extend,
- extendsHelper,
extensionFromPath,
extensionIsTS,
extensionsNotSupportingExtensionlessResolution,
externalHelpersModuleNameText,
factory,
+ fileContainsPackageImport,
fileExtensionIs,
fileExtensionIsOneOf,
fileIncludeReasonToDiagnostics,
@@ -193398,7 +194629,6 @@ if (typeof console !== "undefined") {
findLast,
findLastIndex,
findListItemInfo,
- findMap,
findModifier,
findNextToken,
findPackageJson,
@@ -193446,7 +194676,6 @@ if (typeof console !== "undefined") {
forEachTsConfigPropArray,
forEachUnique,
forEachYieldExpression,
- forSomeAncestorDirectory,
formatColorAndReset,
formatDiagnostic,
formatDiagnostics,
@@ -193457,11 +194686,8 @@ if (typeof console !== "undefined") {
formatMessage,
formatStringFromArgs,
formatting,
- fullTripleSlashAMDReferencePathRegEx,
- fullTripleSlashReferencePathRegEx,
generateDjb2Hash,
generateTSConfig,
- generatorHelper,
getAdjustedReferenceLocation,
getAdjustedRenameLocation,
getAliasDeclarationFromName,
@@ -193480,7 +194706,6 @@ if (typeof console !== "undefined") {
getAreDeclarationMapsEnabled,
getAssignedExpandoInitializer,
getAssignedName,
- getAssignedNameOfIdentifier,
getAssignmentDeclarationKind,
getAssignmentDeclarationPropertyAccessKind,
getAssignmentTargetKind,
@@ -193521,7 +194746,6 @@ if (typeof console !== "undefined") {
getContainingObjectLiteralElement,
getContextualTypeFromParent,
getContextualTypeFromParentOrAncestorTypeNode,
- getCurrentTime,
getDeclarationDiagnostics,
getDeclarationEmitExtensionForPath,
getDeclarationEmitOutputFilePath,
@@ -193539,6 +194763,7 @@ if (typeof console !== "undefined") {
getDefaultLibFilePath,
getDefaultLikeExportInfo,
getDefaultLikeExportNameFromDeclaration,
+ getDefaultResolutionModeForFileWorker,
getDiagnosticText,
getDiagnosticsWithinSpan,
getDirectoryPath,
@@ -193569,6 +194794,7 @@ if (typeof console !== "undefined") {
getEmitFlags,
getEmitHelpers,
getEmitModuleDetectionKind,
+ getEmitModuleFormatOfFileWorker,
getEmitModuleKind,
getEmitModuleResolutionKind,
getEmitScriptTarget,
@@ -193619,11 +194845,11 @@ if (typeof console !== "undefined") {
getIdentifierGeneratedImportReference,
getIdentifierTypeArguments,
getImmediatelyInvokedFunctionExpression,
+ getImpliedNodeFormatForEmitWorker,
getImpliedNodeFormatForFile,
getImpliedNodeFormatForFileWorker,
getImportNeedsImportDefaultHelper,
getImportNeedsImportStarHelper,
- getIndentSize,
getIndentString,
getInferredLibraryNameResolveFrom,
getInitializedVariables,
@@ -193632,6 +194858,7 @@ if (typeof console !== "undefined") {
getInterfaceBaseTypeNodes,
getInternalEmitFlags,
getInvokedExpression,
+ getIsFileExcluded,
getIsolatedModules,
getJSDocAugmentsTag,
getJSDocClassTag,
@@ -193660,7 +194887,6 @@ if (typeof console !== "undefined") {
getJSDocSatisfiesExpressionType,
getJSDocSatisfiesTag,
getJSDocTags,
- getJSDocTagsNoCache,
getJSDocTemplateTag,
getJSDocThisTag,
getJSDocType,
@@ -193684,7 +194910,6 @@ if (typeof console !== "undefined") {
getLineAndCharacterOfPosition,
getLineInfo,
getLineOfLocalPosition,
- getLineOfLocalPositionFromLineMap,
getLineStartPositionForPosition,
getLineStarts,
getLinesBetweenPositionAndNextNonWhitespaceCharacter,
@@ -193726,7 +194951,6 @@ if (typeof console !== "undefined") {
getNameOfScriptTarget,
getNameOrArgument,
getNameTable,
- getNamesForExportedSymbol,
getNamespaceDeclarationNode,
getNewLineCharacter,
getNewLineKind,
@@ -193743,49 +194967,43 @@ if (typeof console !== "undefined") {
getNonAssignmentOperatorForCompoundAssignment,
getNonAugmentationDeclaration,
getNonDecoratorTokenPosOfNode,
+ getNonIncrementalBuildInfoRoots,
+ getNonModifierTokenPosOfNode,
getNormalizedAbsolutePath,
getNormalizedAbsolutePathWithoutRoot,
getNormalizedPathComponents,
getObjectFlags,
- getOperator,
getOperatorAssociativity,
getOperatorPrecedence,
getOptionFromName,
getOptionsForLibraryResolution,
getOptionsNameMap,
getOrCreateEmitNode,
- getOrCreateExternalHelpersModuleNameIfNeeded,
getOrUpdate,
getOriginalNode,
getOriginalNodeId,
- getOriginalSourceFile,
getOutputDeclarationFileName,
getOutputDeclarationFileNameWorker,
getOutputExtension,
getOutputFileNames,
getOutputJSFileNameWorker,
getOutputPathsFor,
- getOutputPathsForBundle,
getOwnEmitOutputFilePath,
getOwnKeys,
getOwnValues,
- getPackageJsonInfo,
getPackageJsonTypesVersionsPaths,
- getPackageJsonsVisibleToFile,
getPackageNameFromTypesPackageName,
getPackageScopeForPath,
getParameterSymbolFromJSDoc,
- getParameterTypeNode,
getParentNodeInSpan,
getParseTreeNode,
getParsedCommandLineOfConfigFile,
getPathComponents,
- getPathComponentsRelativeTo,
getPathFromPathComponents,
getPathUpdater,
getPathsBasePath,
getPatternFromSpec,
- getPendingEmitKind,
+ getPendingEmitKindWithSeen,
getPositionOfLineAndCharacter,
getPossibleGenericSignatures,
getPossibleOriginalInputExtensionForExtension,
@@ -193798,7 +195016,6 @@ if (typeof console !== "undefined") {
getPropertyArrayElementValue,
getPropertyAssignmentAliasLikeExpression,
getPropertyNameForPropertyNameNode,
- getPropertyNameForUniqueESSymbol,
getPropertyNameFromType,
getPropertyNameOfBindingOrAssignmentElement,
getPropertySymbolFromBindingElement,
@@ -193822,13 +195039,14 @@ if (typeof console !== "undefined") {
getResolvePackageJsonExports,
getResolvePackageJsonImports,
getResolvedExternalModuleName,
+ getResolvedModuleFromResolution,
+ getResolvedTypeReferenceDirectiveFromResolution,
getRestIndicatorOfBindingOrAssignmentElement,
getRestParameterElementType,
getRightMostAssignedExpression,
getRootDeclaration,
getRootDirectoryOfResolutionCache,
getRootLength,
- getRootPathSplitLength,
getScriptKind,
getScriptKindFromFileName,
getScriptTargetFeatures,
@@ -193840,14 +195058,12 @@ if (typeof console !== "undefined") {
getSetAccessorValueParameter,
getSetExternalModuleIndicator,
getShebang,
- getSingleInitializerOfVariableStatementOrPropertyDeclaration,
getSingleVariableOfVariableStatement,
getSnapshotText,
getSnippetElement,
getSourceFileOfModule,
getSourceFileOfNode,
getSourceFilePathInNewDir,
- getSourceFilePathInNewDirWorker,
getSourceFileVersionAsHashFromText,
getSourceFilesToEmit,
getSourceMapRange,
@@ -193870,7 +195086,6 @@ if (typeof console !== "undefined") {
getSwitchedType,
getSymbolId,
getSymbolNameForPrivateIdentifier,
- getSymbolParentOrFail,
getSymbolTarget,
getSyntacticClassifications,
getSyntacticModifierFlags,
@@ -193901,7 +195116,6 @@ if (typeof console !== "undefined") {
getTouchingToken,
getTrailingCommentRanges,
getTrailingSemicolonDeferringWriter,
- getTransformFlagsSubtreeExclusions,
getTransformers,
getTsBuildInfoEmitOutputFilePath,
getTsConfigObjectLiteralExpression,
@@ -193929,7 +195143,6 @@ if (typeof console !== "undefined") {
hasAccessorModifier,
hasAmbientModifier,
hasChangesInResolutions,
- hasChildOfKind,
hasContextSensitiveParameters,
hasDecorators,
hasDocComment,
@@ -193938,6 +195151,7 @@ if (typeof console !== "undefined") {
hasEffectiveModifiers,
hasEffectiveReadonlyModifier,
hasExtension,
+ hasImplementationTSFileExtension,
hasIndexSignature,
hasInferredType,
hasInitializer,
@@ -193965,7 +195179,6 @@ if (typeof console !== "undefined") {
hasType,
hasTypeArguments,
hasZeroOrOneAsteriskCharacter,
- helperString,
hostGetCanonicalFileName,
hostUsesCaseSensitiveFileNames,
idText,
@@ -193975,9 +195188,8 @@ if (typeof console !== "undefined") {
identitySourceMapConsumer,
ignoreSourceNewlines,
ignoredPaths,
- importDefaultHelper,
importFromModuleSpecifier,
- importStarHelper,
+ importSyntaxAffectsModuleResolution,
indexOfAnyCharCode,
indexOfNode,
indicesOf,
@@ -193985,7 +195197,6 @@ if (typeof console !== "undefined") {
injectClassNamedEvaluationHelperBlockIfMissing,
injectClassThisAssignmentIfMissing,
insertImports,
- insertLeadingStatement,
insertSorted,
insertStatementAfterCustomPrologue,
insertStatementAfterStandardPrologue,
@@ -194001,11 +195212,9 @@ if (typeof console !== "undefined") {
isAccessibilityModifier,
isAccessor,
isAccessorModifier,
- isAliasSymbolDeclaration,
isAliasableExpression,
isAmbientModule,
isAmbientPropertyDeclaration,
- isAnonymousFunctionDefinition,
isAnyDirectorySeparator,
isAnyImportOrBareOrAccessedRequire,
isAnyImportOrReExport,
@@ -194041,6 +195250,7 @@ if (typeof console !== "undefined") {
isAwaitKeyword,
isBigIntLiteral,
isBinaryExpression,
+ isBinaryLogicalOperator,
isBinaryOperatorToken,
isBindableObjectDefinePropertyCall,
isBindableStaticAccessExpression,
@@ -194081,7 +195291,6 @@ if (typeof console !== "undefined") {
isCatchClauseVariableDeclaration,
isCatchClauseVariableDeclarationOrBindingElement,
isCheckJsEnabledForFile,
- isChildOfNodeWithKind,
isCircularBuildOrder,
isClassDeclaration,
isClassElement,
@@ -194093,7 +195302,6 @@ if (typeof console !== "undefined") {
isClassOrTypeElement,
isClassStaticBlockDeclaration,
isClassThisAssignmentBlock,
- isCollapsedRange,
isColonToken,
isCommaExpression,
isCommaListExpression,
@@ -194136,16 +195344,13 @@ if (typeof console !== "undefined") {
isDeleteTarget,
isDeprecatedDeclaration,
isDestructuringAssignment,
- isDiagnosticWithLocation,
isDiskPathRoot,
isDoStatement,
isDocumentRegistryEntry,
isDotDotDotToken,
isDottedName,
isDynamicName,
- isESSymbolIdentifier,
isEffectiveExternalModule,
- isEffectiveModuleDeclaration,
isEffectiveStrictModeSourceFile,
isElementAccessChain,
isElementAccessExpression,
@@ -194215,13 +195420,11 @@ if (typeof console !== "undefined") {
isFunctionOrModuleBlock,
isFunctionSymbol,
isFunctionTypeNode,
- isFutureReservedKeyword,
isGeneratedIdentifier,
isGeneratedPrivateIdentifier,
isGetAccessor,
isGetAccessorDeclaration,
isGetOrSetAccessorDeclaration,
- isGlobalDeclaration,
isGlobalScopeAugmentation,
isGlobalSourceFile,
isGrammarError,
@@ -194269,6 +195472,8 @@ if (typeof console !== "undefined") {
isInTemplateString,
isInTopLevelContext,
isInTypeQuery,
+ isIncrementalBuildInfo,
+ isIncrementalBundleEmitBuildInfo,
isIncrementalCompilation,
isIndexSignatureDeclaration,
isIndexedAccessTypeNode,
@@ -194375,7 +195580,6 @@ if (typeof console !== "undefined") {
isLabeledStatement,
isLateVisibilityPaintedStatement,
isLeftHandSideExpression,
- isLeftHandSideOfAssignment,
isLet,
isLineBreak,
isLiteralComputedPropertyDeclarationName,
@@ -194383,10 +195587,7 @@ if (typeof console !== "undefined") {
isLiteralExpressionOfObject,
isLiteralImportTypeNode,
isLiteralKind,
- isLiteralLikeAccess,
- isLiteralLikeElementAccess,
isLiteralNameOfPropertyDeclarationOrIndexAccess,
- isLiteralTypeLikeExpression,
isLiteralTypeLiteral,
isLiteralTypeNode,
isLocalName,
@@ -194411,6 +195612,7 @@ if (typeof console !== "undefined") {
isModuleBlock,
isModuleBody,
isModuleDeclaration,
+ isModuleExportName,
isModuleExportsAccessExpression,
isModuleIdentifier,
isModuleName,
@@ -194420,7 +195622,6 @@ if (typeof console !== "undefined") {
isModuleWithStringLiteralName,
isNameOfFunctionDeclaration,
isNameOfModuleDeclaration,
- isNamedClassElement,
isNamedDeclaration,
isNamedEvaluation,
isNamedEvaluationSource,
@@ -194438,7 +195639,6 @@ if (typeof console !== "undefined") {
isNewExpression,
isNewExpressionTarget,
isNoSubstitutionTemplateLiteral,
- isNode,
isNodeArray,
isNodeArrayMultiLine,
isNodeDescendantOf,
@@ -194447,14 +195647,11 @@ if (typeof console !== "undefined") {
isNodeModulesDirectory,
isNodeWithPossibleHoistedDeclaration,
isNonContextualKeyword,
- isNonExportDefaultModifier,
isNonGlobalAmbientModule,
- isNonGlobalDeclaration,
isNonNullAccess,
isNonNullChain,
isNonNullExpression,
isNonStaticMethodOrAccessorWithPrivateName,
- isNotEmittedOrPartiallyEmittedNode,
isNotEmittedStatement,
isNullishCoalesce,
isNumber,
@@ -194470,7 +195667,6 @@ if (typeof console !== "undefined") {
isObjectLiteralMethod,
isObjectLiteralOrClassExpressionMethodOrAccessor,
isObjectTypeDeclaration,
- isOctalDigit,
isOmittedExpression,
isOptionalChain,
isOptionalChainRoot,
@@ -194504,7 +195700,6 @@ if (typeof console !== "undefined") {
isPrivateIdentifierClassElementDeclaration,
isPrivateIdentifierPropertyAccessExpression,
isPrivateIdentifierSymbol,
- isProgramBundleEmitBuildInfo,
isProgramUptoDate,
isPrologueDirective,
isPropertyAccessChain,
@@ -194517,7 +195712,6 @@ if (typeof console !== "undefined") {
isPropertyName,
isPropertyNameLiteral,
isPropertySignature,
- isProtoSetter,
isPrototypeAccess,
isPrototypePropertyAssignment,
isPunctuation,
@@ -194527,7 +195721,6 @@ if (typeof console !== "undefined") {
isQuestionOrExclamationToken,
isQuestionOrPlusOrMinusToken,
isQuestionToken,
- isRawSourceMap,
isReadonlyKeyword,
isReadonlyKeywordOrPlusOrMinusToken,
isRecognizedTripleSlashComment,
@@ -194549,24 +195742,22 @@ if (typeof console !== "undefined") {
isRootedDiskPath,
isSameEntityName,
isSatisfiesExpression,
- isScopeMarker,
isSemicolonClassElement,
isSetAccessor,
isSetAccessorDeclaration,
- isShebangTrivia,
isShiftOperatorOrHigher,
isShorthandAmbientModuleSymbol,
isShorthandPropertyAssignment,
+ isSideEffectImport,
isSignedNumericLiteral,
isSimpleCopiableExpression,
isSimpleInlineableExpression,
- isSimpleParameter,
isSimpleParameterList,
isSingleOrDoubleQuote,
+ isSourceElement,
isSourceFile,
isSourceFileFromLibrary,
isSourceFileJS,
- isSourceFileNotJS,
isSourceFileNotJson,
isSourceMapping,
isSpecialPropertyDeclaration,
@@ -194579,7 +195770,6 @@ if (typeof console !== "undefined") {
isStatic,
isStaticModifier,
isString,
- isStringAKeyword,
isStringANonContextualKeyword,
isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted,
@@ -194592,7 +195782,6 @@ if (typeof console !== "undefined") {
isStringTextContainingNode,
isSuperCall,
isSuperKeyword,
- isSuperOrSuperProperty,
isSuperProperty,
isSupportedSourceFileName,
isSwitchStatement,
@@ -194638,7 +195827,6 @@ if (typeof console !== "undefined") {
isTypeDeclaration,
isTypeElement,
isTypeKeyword,
- isTypeKeywordToken,
isTypeKeywordTokenOrIdentifier,
isTypeLiteralNode,
isTypeNode,
@@ -194693,10 +195881,6 @@ if (typeof console !== "undefined") {
libMap,
libs,
lineBreakPart,
- linkNamePart,
- linkPart,
- linkTextPart,
- listFiles,
loadModuleFromGlobalCache,
loadWithModeAwareCache,
makeIdentifierFromModuleName,
@@ -194706,7 +195890,6 @@ if (typeof console !== "undefined") {
map,
mapAllOrFail,
mapDefined,
- mapDefinedEntries,
mapDefinedIterator,
mapEntries,
mapIterator,
@@ -194716,18 +195899,19 @@ if (typeof console !== "undefined") {
matchPatternOrExact,
matchedText,
matchesExclude,
+ maxBy,
maybeBind,
maybeSetLocalizedDiagnosticMessages,
memoize,
- memoizeCached,
memoizeOne,
- memoizeWeak,
- metadataHelper,
min,
minAndMax,
missingFileModifiedTime,
modifierToFlag,
modifiersToFlags,
+ moduleExportNameIsDefault,
+ moduleExportNameTextEscaped,
+ moduleExportNameTextUnescaped,
moduleOptionDeclaration,
moduleResolutionIsEqualTo,
moduleResolutionNameAndModeGetter,
@@ -194767,11 +195951,11 @@ if (typeof console !== "undefined") {
nodePosToString,
nodeSeenTracker,
nodeStartsNewLexicalEnvironment,
- nodeToDisplayParts,
noop,
noopFileWatcher,
normalizePath,
normalizeSlashes,
+ normalizeSpans,
not,
notImplemented,
notImplementedResolver,
@@ -194786,13 +195970,11 @@ if (typeof console !== "undefined") {
optionsForBuild,
optionsForWatch,
optionsHaveChanges,
- optionsHaveModuleResolutionChanges,
or,
orderedRemoveItem,
orderedRemoveItemAt,
packageIdToPackageName,
packageIdToString,
- paramHelper,
parameterIsThisKeyword,
parameterNamePart,
parseBaseNodeFactory,
@@ -194823,10 +196005,8 @@ if (typeof console !== "undefined") {
pathIsBareSpecifier,
pathIsRelative,
patternText,
- perfLogger,
performIncrementalCompilation,
performance,
- plainJSErrors,
positionBelongsToNode,
positionIsASICandidate,
positionIsSynthesized,
@@ -194839,7 +196019,6 @@ if (typeof console !== "undefined") {
programContainsEsModules,
programContainsModules,
projectReferenceIsEqualTo,
- propKeyHelper,
propertyNamePart,
pseudoBigIntToString,
punctuationPart,
@@ -194862,7 +196041,6 @@ if (typeof console !== "undefined") {
rangeStartPositionsAreOnSameLine,
readBuilderProgram,
readConfigFile,
- readHelper,
readJson,
readJsonConfigFile,
readJsonOrUndefined,
@@ -194873,7 +196051,7 @@ if (typeof console !== "undefined") {
reducePathComponents,
refactor,
regExpEscape,
- regularExpressionFlagToCharacter,
+ regularExpressionFlagToCharacterCode,
relativeComplement,
removeAllComments,
removeEmitHelper,
@@ -194881,7 +196059,6 @@ if (typeof console !== "undefined") {
removeFileExtension,
removeIgnoredPath,
removeMinAndVersionNumbers,
- removeOptionality,
removePrefix,
removeSuffix,
removeTrailingDirectorySeparator,
@@ -194900,20 +196077,16 @@ if (typeof console !== "undefined") {
resolveTripleslashReference,
resolveTypeReferenceDirective,
resolvingEmptyArray,
- restHelper,
returnFalse,
returnNoopFileWatcher,
returnTrue,
returnUndefined,
returnsPromise,
- runInitializersHelper,
sameFlatMap,
sameMap,
sameMapping,
- scanShebangTrivia,
scanTokenAtPosition,
scanner,
- screenStartingMessageCodes,
semanticDiagnosticsOptionDeclarations,
serializeCompilerOptions,
server,
@@ -194921,16 +196094,13 @@ if (typeof console !== "undefined") {
setCommentRange,
setConfigFileInOptions,
setConstantValue,
- setEachParent,
setEmitFlags,
- setFunctionNameHelper,
setGetSourceFileAsHashVersioned,
setIdentifierAutoGenerate,
setIdentifierGeneratedImportReference,
setIdentifierTypeArguments,
setInternalEmitFlags,
setLocalizedDiagnosticMessages,
- setModuleDefaultHelper,
setNodeChildren,
setNodeFlags,
setObjectAllocator,
@@ -194959,7 +196129,6 @@ if (typeof console !== "undefined") {
shouldPreserveConstEnums,
shouldUseUriStyleNodeCoreModules,
showModuleSpecifier,
- signatureHasLiteralTypes,
signatureHasRestParameter,
signatureToDisplayParts,
single,
@@ -194968,18 +196137,17 @@ if (typeof console !== "undefined") {
singleOrMany,
singleOrUndefined,
skipAlias,
- skipAssertions,
skipConstraint,
skipOuterExpressions,
skipParentheses,
skipPartiallyEmittedExpressions,
skipTrivia,
skipTypeChecking,
+ skipTypeCheckingIgnoringNoCheck,
skipTypeParentheses,
skipWhile,
sliceAfter,
some,
- sort,
sortAndDeduplicate,
sortAndDeduplicateDiagnostics,
sourceFileAffectingCompilerOptions,
@@ -194988,8 +196156,6 @@ if (typeof console !== "undefined") {
sourceMapCommentRegExpDontCareLineStart,
spacePart,
spanMap,
- spreadArrayHelper,
- stableSort,
startEndContainsRange,
startEndOverlapsWithStartEnd,
startOnNewLine,
@@ -195002,10 +196168,8 @@ if (typeof console !== "undefined") {
stringToToken,
stripQuotes,
supportedDeclarationExtensions,
- supportedJSExtensions,
supportedJSExtensionsFlat,
supportedLocaleDirectories,
- supportedTSExtensions,
supportedTSExtensionsFlat,
supportedTSImplementationExtensions,
suppressLeadingAndTrailingTrivia,
@@ -195014,16 +196178,12 @@ if (typeof console !== "undefined") {
symbolEscapedNameNoDefault,
symbolName,
symbolNameNoDefault,
- symbolPart,
symbolToDisplayParts,
- syntaxMayBeASICandidate,
- syntaxRequiresTrailingSemicolonOrASI,
sys,
sysLog,
tagNamesAreEquivalent,
takeWhile,
targetOptionDeclaration,
- templateObjectHelper,
testFormatSettings,
textChangeRangeIsUnchanged,
textChangeRangeNewSpan,
@@ -195031,7 +196191,10 @@ if (typeof console !== "undefined") {
textOrKeywordPart,
textPart,
textRangeContainsPositionInclusive,
+ textRangeContainsTextSpan,
+ textRangeIntersectsWithTextSpan,
textSpanContainsPosition,
+ textSpanContainsTextRange,
textSpanContainsTextSpan,
textSpanEnd,
textSpanIntersection,
@@ -195049,15 +196212,16 @@ if (typeof console !== "undefined") {
toBuilderStateFileInfoForMultiEmit,
toEditorSettings,
toFileNameLowerCase,
- toLowerCase,
toPath,
toProgramEmitPending,
+ toSorted,
tokenIsIdentifierOrKeyword,
tokenIsIdentifierOrKeywordOrGreaterThan,
tokenToString,
trace,
tracing,
tracingEnabled,
+ transferSourceFileChildren,
transform,
transformClassFields,
transformDeclarations,
@@ -195072,11 +196236,11 @@ if (typeof console !== "undefined") {
transformESDecorators,
transformESNext,
transformGenerators,
+ transformImpliedNodeFormatDependentModule,
transformJsx,
transformLegacyDecorators,
transformModule,
transformNamedEvaluation,
- transformNodeModule,
transformNodes,
transformSystemModule,
transformTypeScript,
@@ -195103,7 +196267,6 @@ if (typeof console !== "undefined") {
tryGetPropertyNameOfBindingOrAssignmentElement,
tryGetSourceMappingURL,
tryGetTextOfPropertyName,
- tryIOAndConsumeErrors,
tryParseJson,
tryParsePattern,
tryParsePatterns,
@@ -195125,7 +196288,6 @@ if (typeof console !== "undefined") {
unescapeLeadingUnderscores,
unmangleScopedPackageName,
unorderedRemoveItem,
- unorderedRemoveItemAt,
unreachableCodeIsError,
unsetNodeChildren,
unusedLabelIsError,
@@ -195138,11 +196300,9 @@ if (typeof console !== "undefined") {
updateSharedExtendedConfigFileWatcher,
updateSourceFile,
updateWatchingWildcardDirectories,
- usesExtensionsOnImports,
usingSingleLineStringWriter,
utf16EncodeAsString,
validateLocaleAndSetLanguage,
- valuesHelper,
version,
versionMajorMinor,
visitArray,
@@ -195155,7 +196315,6 @@ if (typeof console !== "undefined") {
visitNodes,
visitParameterList,
walkUpBindingElementsAndPatterns,
- walkUpLexicalEnvironments,
walkUpOuterExpressions,
walkUpParenthesizedExpressions,
walkUpParenthesizedTypes,