Bump version to 5.1.1-rc and LKG.

This commit is contained in:
Daniel Rosenwasser 2023-05-14 20:39:24 +00:00
parent 704e7661e2
commit fdd5cf2fa6
10 changed files with 22111 additions and 19083 deletions

18
lib/lib.es5.d.ts vendored
View File

@ -4329,12 +4329,21 @@ interface Float64Array {
sort(compareFn?: (a: number, b: number) => number): this;
/**
* Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements
* at begin, inclusive, up to end, exclusive.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin?: number, end?: number): Float64Array;
/**
* Converts a number to a string by using the current locale.
*/
toLocaleString(): string;
/**
* Returns a string representation of an array.
*/
toString(): string;
/** Returns the primitive value of the specified object. */
@ -4383,11 +4392,12 @@ declare var Float64Array: Float64ArrayConstructor;
declare namespace Intl {
interface CollatorOptions {
usage?: string | undefined;
localeMatcher?: string | undefined;
usage?: "sort" | "search" | undefined;
localeMatcher?: "lookup" | "best fit" | undefined;
numeric?: boolean | undefined;
caseFirst?: string | undefined;
sensitivity?: string | undefined;
caseFirst?: "upper" | "lower" | "false" | undefined;
sensitivity?: "base" | "accent" | "case" | "variant" | undefined;
collation?: "big5han" | "compat" | "dict" | "direct" | "ducet" | "emoji" | "eor" | "gb2312" | "phonebk" | "phonetic" | "pinyin" | "reformed" | "searchjl" | "stroke" | "trad" | "unihan" | "zhuyin" | undefined;
ignorePunctuation?: boolean | undefined;
}

1806
lib/tsc.js

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,9 @@ declare namespace ts {
type EventBeginInstallTypes = "event::beginInstallTypes";
type EventEndInstallTypes = "event::endInstallTypes";
type EventInitializationFailed = "event::initializationFailed";
type ActionWatchTypingLocations = "action::watchTypingLocations";
interface TypingInstallerResponse {
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed | ActionWatchTypingLocations;
}
interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
@ -32,7 +33,6 @@ declare namespace ts {
readonly fileNames: string[];
readonly projectRootPath: Path;
readonly compilerOptions: CompilerOptions;
readonly watchOptions?: WatchOptions;
readonly typeAcquisition: TypeAcquisition;
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly cachePath?: string;
@ -84,8 +84,6 @@ declare namespace ts {
writeFile(path: string, content: string): void;
createDirectory(path: string): void;
getCurrentDirectory?(): string;
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
}
interface SetTypings extends ProjectResponse {
readonly typeAcquisition: TypeAcquisition;
@ -94,6 +92,11 @@ declare namespace ts {
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly kind: ActionSet;
}
interface WatchTypingLocations extends ProjectResponse {
/** if files is undefined, retain same set of watchers */
readonly files: readonly string[] | undefined;
readonly kind: ActionWatchTypingLocations;
}
namespace protocol {
enum CommandTypes {
JsxClosingTag = "jsxClosingTag",
@ -155,6 +158,7 @@ declare namespace ts {
GetSupportedCodeFixes = "getSupportedCodeFixes",
GetApplicableRefactors = "getApplicableRefactors",
GetEditsForRefactor = "getEditsForRefactor",
GetMoveToRefactoringFileSuggestions = "getMoveToRefactoringFileSuggestions",
OrganizeImports = "organizeImports",
GetEditsForFileRename = "getEditsForFileRename",
ConfigurePlugin = "configurePlugin",
@ -501,6 +505,14 @@ declare namespace ts {
type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & {
triggerReason?: RefactorTriggerReason;
kind?: string;
/**
* Include refactor actions that require additional arguments to be passed when
* calling 'GetEditsForRefactor'. When true, clients should inspect the
* `isInteractive` property of each returned `RefactorActionInfo`
* and ensure they are able to collect the appropriate arguments for any
* interactive refactor before offering it.
*/
includeInteractiveActions?: boolean;
};
type RefactorTriggerReason = "implicit" | "invoked";
/**
@ -510,6 +522,26 @@ declare namespace ts {
interface GetApplicableRefactorsResponse extends Response {
body?: ApplicableRefactorInfo[];
}
/**
* Request refactorings at a given position or selection area to move to an existing file.
*/
interface GetMoveToRefactoringFileSuggestionsRequest extends Request {
command: CommandTypes.GetMoveToRefactoringFileSuggestions;
arguments: GetMoveToRefactoringFileSuggestionsRequestArgs;
}
type GetMoveToRefactoringFileSuggestionsRequestArgs = FileLocationOrRangeRequestArgs & {
kind?: string;
};
/**
* Response is a list of available files.
* Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring
*/
interface GetMoveToRefactoringFileSuggestions extends Response {
body: {
newFileName: string;
files: string[];
};
}
/**
* A set of one or more available refactoring actions, grouped under a parent refactoring.
*/
@ -557,6 +589,11 @@ declare namespace ts {
* The hierarchical dotted name of the refactor action.
*/
kind?: string;
/**
* Indicates that the action requires additional arguments to be passed
* when calling 'GetEditsForRefactor'.
*/
isInteractive?: boolean;
}
interface GetEditsForRefactorRequest extends Request {
command: CommandTypes.GetEditsForRefactor;
@ -569,6 +606,7 @@ declare namespace ts {
type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & {
refactor: string;
action: string;
interactiveRefactorArguments?: InteractiveRefactorArguments;
};
interface GetEditsForRefactorResponse extends Response {
body?: RefactorEditInfo;
@ -3009,8 +3047,6 @@ declare namespace ts {
private readonly knownCachesSet;
private readonly projectWatchers;
private safeList;
private readonly toCanonicalFileName;
private readonly globalCachePackageJsonPath;
private installRunCount;
private inFlightRequestCount;
abstract readonly typesRegistry: Map<string, MapLike<string>>;
@ -3029,7 +3065,7 @@ declare namespace ts {
private installTypingsAsync;
private executeWithThrottling;
protected abstract installWorker(requestId: number, packageNames: string[], cwd: string, onRequestCompleted: RequestCompletedAction): void;
protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes): void;
protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | WatchTypingLocations): void;
protected readonly latestDistTag = "latest";
}
}
@ -3241,7 +3277,7 @@ declare namespace ts {
private readonly cancellationToken;
isNonTsProject(): boolean;
isJsOnlyProject(): boolean;
static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined;
static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined;
isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
private get typingsCache();
@ -3328,9 +3364,8 @@ declare namespace ts {
setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void;
getTypeAcquisition(): ts.TypeAcquisition;
protected removeRoot(info: ScriptInfo): void;
protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map<string, any> | undefined): void;
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<string, any> | undefined): void;
private enableProxy;
protected enableGlobalPlugins(options: CompilerOptions): void;
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[]): void;
/** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */
refreshDiagnostics(): void;
}
@ -3554,7 +3589,7 @@ declare namespace ts {
cancellationToken: HostCancellationToken;
useSingleInferredProject: boolean;
useInferredProjectPerProjectRoot: boolean;
typingsInstaller: ITypingsInstaller;
typingsInstaller?: ITypingsInstaller;
eventHandler?: ProjectServiceEventHandler;
suppressDiagnosticEvents?: boolean;
throttleWaitMilliseconds?: number;
@ -3631,7 +3666,6 @@ declare namespace ts {
readonly globalPlugins: readonly string[];
readonly pluginProbeLocations: readonly string[];
readonly allowLocalPluginLoads: boolean;
private currentPluginConfigOverrides;
readonly typesMapLocation: string | undefined;
readonly serverMode: LanguageServiceMode;
/** Tracks projects that we have already sent telemetry for. */
@ -3826,7 +3860,7 @@ declare namespace ts {
cancellationToken: ServerCancellationToken;
useSingleInferredProject: boolean;
useInferredProjectPerProjectRoot: boolean;
typingsInstaller: ITypingsInstaller;
typingsInstaller?: ITypingsInstaller;
byteLength: (buf: string, encoding?: BufferEncoding) => number;
hrtime: (start?: [
number,
@ -3976,6 +4010,7 @@ declare namespace ts {
private getRange;
private getApplicableRefactors;
private getEditsForRefactor;
private getMoveToRefactoringFileSuggestions;
private organizeImports;
private getEditsForFileRename;
private getCodeFixes;
@ -4419,10 +4454,8 @@ declare namespace ts {
NotEmittedStatement = 358,
PartiallyEmittedExpression = 359,
CommaListExpression = 360,
MergeDeclarationMarker = 361,
EndOfDeclarationMarker = 362,
SyntheticReferenceExpression = 363,
Count = 364,
SyntheticReferenceExpression = 361,
Count = 362,
FirstAssignment = 64,
LastAssignment = 79,
FirstCompoundAssignment = 65,
@ -4564,7 +4597,7 @@ declare namespace ts {
interface FlowContainer extends Node {
_flowContainerBrand: any;
}
type HasJSDoc = AccessorDeclaration | ArrowFunction | BinaryExpression | Block | BreakStatement | CallSignatureDeclaration | CaseClause | ClassLikeDeclaration | ClassStaticBlockDeclaration | ConstructorDeclaration | ConstructorTypeNode | ConstructSignatureDeclaration | ContinueStatement | DebuggerStatement | DoStatement | ElementAccessExpression | EmptyStatement | EndOfFileToken | EnumDeclaration | EnumMember | ExportAssignment | ExportDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeNode | Identifier | IfStatement | ImportDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | InterfaceDeclaration | JSDocFunctionType | JSDocSignature | LabeledStatement | MethodDeclaration | MethodSignature | ModuleDeclaration | NamedTupleMember | NamespaceExportDeclaration | ObjectLiteralExpression | ParameterDeclaration | ParenthesizedExpression | PropertyAccessExpression | PropertyAssignment | PropertyDeclaration | PropertySignature | ReturnStatement | ShorthandPropertyAssignment | SpreadAssignment | SwitchStatement | ThrowStatement | TryStatement | TypeAliasDeclaration | TypeParameterDeclaration | VariableDeclaration | VariableStatement | WhileStatement | WithStatement;
type HasJSDoc = AccessorDeclaration | ArrowFunction | BinaryExpression | Block | BreakStatement | CallSignatureDeclaration | CaseClause | ClassLikeDeclaration | ClassStaticBlockDeclaration | ConstructorDeclaration | ConstructorTypeNode | ConstructSignatureDeclaration | ContinueStatement | DebuggerStatement | DoStatement | ElementAccessExpression | EmptyStatement | EndOfFileToken | EnumDeclaration | EnumMember | ExportAssignment | ExportDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeNode | Identifier | IfStatement | ImportDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | InterfaceDeclaration | JSDocFunctionType | JSDocSignature | LabeledStatement | MethodDeclaration | MethodSignature | ModuleDeclaration | NamedTupleMember | NamespaceExportDeclaration | ObjectLiteralExpression | ParameterDeclaration | ParenthesizedExpression | PropertyAccessExpression | PropertyAssignment | PropertyDeclaration | PropertySignature | ReturnStatement | SemicolonClassElement | ShorthandPropertyAssignment | SpreadAssignment | SwitchStatement | ThrowStatement | TryStatement | TypeAliasDeclaration | TypeParameterDeclaration | VariableDeclaration | VariableStatement | WhileStatement | WithStatement;
type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
@ -4658,7 +4691,7 @@ declare namespace ts {
type EntityName = Identifier | QualifiedName;
type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
type MemberName = Identifier | PrivateIdentifier;
type DeclarationName = Identifier | PrivateIdentifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern | EntityNameExpression;
type DeclarationName = PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression;
interface Declaration extends Node {
_declarationBrand: any;
}
@ -4843,7 +4876,7 @@ declare namespace ts {
readonly body?: FunctionBody | undefined;
}
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
interface SemicolonClassElement extends ClassElement {
interface SemicolonClassElement extends ClassElement, JSDocContainer {
readonly kind: SyntaxKind.SemicolonClassElement;
readonly parent: ClassLikeDeclaration;
}
@ -5005,7 +5038,7 @@ declare namespace ts {
readonly kind: SyntaxKind.StringLiteral;
}
type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral;
type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName;
interface TemplateLiteralTypeNode extends TypeNode {
kind: SyntaxKind.TemplateLiteralType;
readonly head: TemplateHead;
@ -5364,14 +5397,14 @@ declare namespace ts {
type JsxAttributeName = Identifier | JsxNamespacedName;
type JsxTagNameExpression = Identifier | ThisExpression | JsxTagNamePropertyAccess | JsxNamespacedName;
interface JsxTagNamePropertyAccess extends PropertyAccessExpression {
readonly expression: JsxTagNameExpression;
readonly expression: Identifier | ThisExpression | JsxTagNamePropertyAccess;
}
interface JsxAttributes extends PrimaryExpression, Declaration {
readonly properties: NodeArray<JsxAttributeLike>;
readonly kind: SyntaxKind.JsxAttributes;
readonly parent: JsxOpeningLikeElement;
}
interface JsxNamespacedName extends PrimaryExpression {
interface JsxNamespacedName extends Node {
readonly kind: SyntaxKind.JsxNamespacedName;
readonly name: Identifier;
readonly namespace: Identifier;
@ -7513,9 +7546,8 @@ declare namespace ts {
ReuseTempVariableScope = 1048576,
CustomPrologue = 2097152,
NoHoisting = 4194304,
HasEndOfDeclarationMarker = 8388608,
Iterator = 16777216,
NoAsciiEscaping = 33554432
Iterator = 8388608,
NoAsciiEscaping = 16777216
}
interface EmitHelperBase {
readonly name: string;
@ -8786,6 +8818,26 @@ declare namespace ts {
parent: ConstructorDeclaration;
name: Identifier;
};
/**
* This function checks multiple locations for JSDoc comments that apply to a host node.
* At each location, the whole comment may apply to the node, or only a specific tag in
* the comment. In the first case, location adds the entire {@link JSDoc} object. In the
* second case, it adds the applicable {@link JSDocTag}.
*
* For example, a JSDoc comment before a parameter adds the entire {@link JSDoc}. But a
* `@param` tag on the parent function only adds the {@link JSDocTag} for the `@param`.
*
* ```ts
* /** JSDoc will be returned for `a` *\/
* const a = 0
* /**
* * Entire JSDoc will be returned for `b`
* * @param c JSDocTag will be returned for `c`
* *\/
* function b(/** JSDoc will be returned for `c` *\/ c) {}
* ```
*/
function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[];
/** @deprecated */
function createUnparsedSourceFile(text: string): UnparsedSource;
/** @deprecated */
@ -9234,7 +9286,7 @@ declare namespace ts {
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): ModuleResolutionCache;
function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache;
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations;
@ -10084,6 +10136,8 @@ declare namespace ts {
getRenameInfo(fileName: string, position: number, preferences: UserPreferences): RenameInfo;
/** @deprecated Use the signature with `UserPreferences` instead. */
getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences: UserPreferences): readonly RenameLocation[] | undefined;
/** @deprecated Pass `providePrefixAndSuffixTextForRename` as part of a `UserPreferences` parameter. */
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): readonly RenameLocation[] | undefined;
getSmartSelectionRange(fileName: string, position: number): SelectionRange;
getDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined;
@ -10129,8 +10183,18 @@ declare namespace ts {
applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
/** @deprecated `fileName` will be ignored */
applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
/**
* @param includeInteractiveActions Include refactor actions that require additional arguments to be
* passed when calling `getEditsForRefactor`. When true, clients should inspect the `isInteractive`
* property of each returned `RefactorActionInfo` and ensure they are able to collect the appropriate
* arguments for any interactive action before offering it.
*/
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, includeInteractiveActions?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
newFileName: string;
files: string[];
};
organizeImports(args: OrganizeImportsArgs, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): EmitOutput;
@ -10401,6 +10465,11 @@ declare namespace ts {
* The hierarchical dotted name of the refactor action.
*/
kind?: string;
/**
* Indicates that the action requires additional arguments to be passed
* when calling `getEditsForRefactor`.
*/
isInteractive?: boolean;
}
/**
* A set of edits to make in response to a refactor action, plus an optional
@ -10633,6 +10702,9 @@ declare namespace ts {
interface DocCommentTemplateOptions {
readonly generateReturnInDocTemplate?: boolean;
}
interface InteractiveRefactorArguments {
targetFile: string;
}
interface SignatureHelpParameter {
name: string;
documentation: SymbolDisplayPart[];

File diff suppressed because it is too large Load Diff

80
lib/typescript.d.ts vendored
View File

@ -407,10 +407,8 @@ declare namespace ts {
NotEmittedStatement = 358,
PartiallyEmittedExpression = 359,
CommaListExpression = 360,
MergeDeclarationMarker = 361,
EndOfDeclarationMarker = 362,
SyntheticReferenceExpression = 363,
Count = 364,
SyntheticReferenceExpression = 361,
Count = 362,
FirstAssignment = 64,
LastAssignment = 79,
FirstCompoundAssignment = 65,
@ -552,7 +550,7 @@ declare namespace ts {
interface FlowContainer extends Node {
_flowContainerBrand: any;
}
type HasJSDoc = AccessorDeclaration | ArrowFunction | BinaryExpression | Block | BreakStatement | CallSignatureDeclaration | CaseClause | ClassLikeDeclaration | ClassStaticBlockDeclaration | ConstructorDeclaration | ConstructorTypeNode | ConstructSignatureDeclaration | ContinueStatement | DebuggerStatement | DoStatement | ElementAccessExpression | EmptyStatement | EndOfFileToken | EnumDeclaration | EnumMember | ExportAssignment | ExportDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeNode | Identifier | IfStatement | ImportDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | InterfaceDeclaration | JSDocFunctionType | JSDocSignature | LabeledStatement | MethodDeclaration | MethodSignature | ModuleDeclaration | NamedTupleMember | NamespaceExportDeclaration | ObjectLiteralExpression | ParameterDeclaration | ParenthesizedExpression | PropertyAccessExpression | PropertyAssignment | PropertyDeclaration | PropertySignature | ReturnStatement | ShorthandPropertyAssignment | SpreadAssignment | SwitchStatement | ThrowStatement | TryStatement | TypeAliasDeclaration | TypeParameterDeclaration | VariableDeclaration | VariableStatement | WhileStatement | WithStatement;
type HasJSDoc = AccessorDeclaration | ArrowFunction | BinaryExpression | Block | BreakStatement | CallSignatureDeclaration | CaseClause | ClassLikeDeclaration | ClassStaticBlockDeclaration | ConstructorDeclaration | ConstructorTypeNode | ConstructSignatureDeclaration | ContinueStatement | DebuggerStatement | DoStatement | ElementAccessExpression | EmptyStatement | EndOfFileToken | EnumDeclaration | EnumMember | ExportAssignment | ExportDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeNode | Identifier | IfStatement | ImportDeclaration | ImportEqualsDeclaration | IndexSignatureDeclaration | InterfaceDeclaration | JSDocFunctionType | JSDocSignature | LabeledStatement | MethodDeclaration | MethodSignature | ModuleDeclaration | NamedTupleMember | NamespaceExportDeclaration | ObjectLiteralExpression | ParameterDeclaration | ParenthesizedExpression | PropertyAccessExpression | PropertyAssignment | PropertyDeclaration | PropertySignature | ReturnStatement | SemicolonClassElement | ShorthandPropertyAssignment | SpreadAssignment | SwitchStatement | ThrowStatement | TryStatement | TypeAliasDeclaration | TypeParameterDeclaration | VariableDeclaration | VariableStatement | WhileStatement | WithStatement;
type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
@ -646,7 +644,7 @@ declare namespace ts {
type EntityName = Identifier | QualifiedName;
type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
type MemberName = Identifier | PrivateIdentifier;
type DeclarationName = Identifier | PrivateIdentifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern | EntityNameExpression;
type DeclarationName = PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression;
interface Declaration extends Node {
_declarationBrand: any;
}
@ -831,7 +829,7 @@ declare namespace ts {
readonly body?: FunctionBody | undefined;
}
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
interface SemicolonClassElement extends ClassElement {
interface SemicolonClassElement extends ClassElement, JSDocContainer {
readonly kind: SyntaxKind.SemicolonClassElement;
readonly parent: ClassLikeDeclaration;
}
@ -993,7 +991,7 @@ declare namespace ts {
readonly kind: SyntaxKind.StringLiteral;
}
type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral;
type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName;
interface TemplateLiteralTypeNode extends TypeNode {
kind: SyntaxKind.TemplateLiteralType;
readonly head: TemplateHead;
@ -1352,14 +1350,14 @@ declare namespace ts {
type JsxAttributeName = Identifier | JsxNamespacedName;
type JsxTagNameExpression = Identifier | ThisExpression | JsxTagNamePropertyAccess | JsxNamespacedName;
interface JsxTagNamePropertyAccess extends PropertyAccessExpression {
readonly expression: JsxTagNameExpression;
readonly expression: Identifier | ThisExpression | JsxTagNamePropertyAccess;
}
interface JsxAttributes extends PrimaryExpression, Declaration {
readonly properties: NodeArray<JsxAttributeLike>;
readonly kind: SyntaxKind.JsxAttributes;
readonly parent: JsxOpeningLikeElement;
}
interface JsxNamespacedName extends PrimaryExpression {
interface JsxNamespacedName extends Node {
readonly kind: SyntaxKind.JsxNamespacedName;
readonly name: Identifier;
readonly namespace: Identifier;
@ -3501,9 +3499,8 @@ declare namespace ts {
ReuseTempVariableScope = 1048576,
CustomPrologue = 2097152,
NoHoisting = 4194304,
HasEndOfDeclarationMarker = 8388608,
Iterator = 16777216,
NoAsciiEscaping = 33554432
Iterator = 8388608,
NoAsciiEscaping = 16777216
}
interface EmitHelperBase {
readonly name: string;
@ -4774,6 +4771,26 @@ declare namespace ts {
parent: ConstructorDeclaration;
name: Identifier;
};
/**
* This function checks multiple locations for JSDoc comments that apply to a host node.
* At each location, the whole comment may apply to the node, or only a specific tag in
* the comment. In the first case, location adds the entire {@link JSDoc} object. In the
* second case, it adds the applicable {@link JSDocTag}.
*
* For example, a JSDoc comment before a parameter adds the entire {@link JSDoc}. But a
* `@param` tag on the parent function only adds the {@link JSDocTag} for the `@param`.
*
* ```ts
* /** JSDoc will be returned for `a` *\/
* const a = 0
* /**
* * Entire JSDoc will be returned for `b`
* * @param c JSDocTag will be returned for `c`
* *\/
* function b(/** JSDoc will be returned for `c` *\/ c) {}
* ```
*/
function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[];
/** @deprecated */
function createUnparsedSourceFile(text: string): UnparsedSource;
/** @deprecated */
@ -5222,7 +5239,7 @@ declare namespace ts {
* this list is only the set of defaults that are implicitly included.
*/
function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): ModuleResolutionCache;
function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache;
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations;
@ -5876,8 +5893,9 @@ declare namespace ts {
type EventBeginInstallTypes = "event::beginInstallTypes";
type EventEndInstallTypes = "event::endInstallTypes";
type EventInitializationFailed = "event::initializationFailed";
type ActionWatchTypingLocations = "action::watchTypingLocations";
interface TypingInstallerResponse {
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed | ActionWatchTypingLocations;
}
interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
@ -5886,7 +5904,6 @@ declare namespace ts {
readonly fileNames: string[];
readonly projectRootPath: Path;
readonly compilerOptions: CompilerOptions;
readonly watchOptions?: WatchOptions;
readonly typeAcquisition: TypeAcquisition;
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly cachePath?: string;
@ -5938,8 +5955,6 @@ declare namespace ts {
writeFile(path: string, content: string): void;
createDirectory(path: string): void;
getCurrentDirectory?(): string;
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
}
interface SetTypings extends ProjectResponse {
readonly typeAcquisition: TypeAcquisition;
@ -5948,6 +5963,11 @@ declare namespace ts {
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly kind: ActionSet;
}
interface WatchTypingLocations extends ProjectResponse {
/** if files is undefined, retain same set of watchers */
readonly files: readonly string[] | undefined;
readonly kind: ActionWatchTypingLocations;
}
}
function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatCodeSettings;
/**
@ -6153,6 +6173,8 @@ declare namespace ts {
getRenameInfo(fileName: string, position: number, preferences: UserPreferences): RenameInfo;
/** @deprecated Use the signature with `UserPreferences` instead. */
getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences: UserPreferences): readonly RenameLocation[] | undefined;
/** @deprecated Pass `providePrefixAndSuffixTextForRename` as part of a `UserPreferences` parameter. */
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): readonly RenameLocation[] | undefined;
getSmartSelectionRange(fileName: string, position: number): SelectionRange;
getDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined;
@ -6198,8 +6220,18 @@ declare namespace ts {
applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
/** @deprecated `fileName` will be ignored */
applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
/**
* @param includeInteractiveActions Include refactor actions that require additional arguments to be
* passed when calling `getEditsForRefactor`. When true, clients should inspect the `isInteractive`
* property of each returned `RefactorActionInfo` and ensure they are able to collect the appropriate
* arguments for any interactive action before offering it.
*/
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, includeInteractiveActions?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
newFileName: string;
files: string[];
};
organizeImports(args: OrganizeImportsArgs, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): EmitOutput;
@ -6470,6 +6502,11 @@ declare namespace ts {
* The hierarchical dotted name of the refactor action.
*/
kind?: string;
/**
* Indicates that the action requires additional arguments to be passed
* when calling `getEditsForRefactor`.
*/
isInteractive?: boolean;
}
/**
* A set of edits to make in response to a refactor action, plus an optional
@ -6702,6 +6739,9 @@ declare namespace ts {
interface DocCommentTemplateOptions {
readonly generateReturnInDocTemplate?: boolean;
}
interface InteractiveRefactorArguments {
targetFile: string;
}
interface SignatureHelpParameter {
name: string;
documentation: SymbolDisplayPart[];

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ var path = __toESM(require("path"));
// src/compiler/corePublic.ts
var versionMajorMinor = "5.1";
var version = "5.1.0-beta";
var version = "5.1.1-rc";
// src/compiler/core.ts
var emptyArray = [];
@ -2854,10 +2854,8 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
SyntaxKind4[SyntaxKind4["NotEmittedStatement"] = 358] = "NotEmittedStatement";
SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 359] = "PartiallyEmittedExpression";
SyntaxKind4[SyntaxKind4["CommaListExpression"] = 360] = "CommaListExpression";
SyntaxKind4[SyntaxKind4["MergeDeclarationMarker"] = 361] = "MergeDeclarationMarker";
SyntaxKind4[SyntaxKind4["EndOfDeclarationMarker"] = 362] = "EndOfDeclarationMarker";
SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 363] = "SyntheticReferenceExpression";
SyntaxKind4[SyntaxKind4["Count"] = 364] = "Count";
SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 361] = "SyntheticReferenceExpression";
SyntaxKind4[SyntaxKind4["Count"] = 362] = "Count";
SyntaxKind4[SyntaxKind4["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
SyntaxKind4[SyntaxKind4["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
SyntaxKind4[SyntaxKind4["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@ -3304,9 +3302,8 @@ var EmitFlags = /* @__PURE__ */ ((EmitFlags3) => {
EmitFlags3[EmitFlags3["ReuseTempVariableScope"] = 1048576] = "ReuseTempVariableScope";
EmitFlags3[EmitFlags3["CustomPrologue"] = 2097152] = "CustomPrologue";
EmitFlags3[EmitFlags3["NoHoisting"] = 4194304] = "NoHoisting";
EmitFlags3[EmitFlags3["HasEndOfDeclarationMarker"] = 8388608] = "HasEndOfDeclarationMarker";
EmitFlags3[EmitFlags3["Iterator"] = 16777216] = "Iterator";
EmitFlags3[EmitFlags3["NoAsciiEscaping"] = 33554432] = "NoAsciiEscaping";
EmitFlags3[EmitFlags3["Iterator"] = 8388608] = "Iterator";
EmitFlags3[EmitFlags3["NoAsciiEscaping"] = 16777216] = "NoAsciiEscaping";
return EmitFlags3;
})(EmitFlags || {});
var commentPragmas = {
@ -3692,9 +3689,6 @@ var curSysLog = noop;
function sysLog(s) {
return curSysLog(s);
}
function setSysLog(logger) {
curSysLog = logger;
}
function createDirectoryWatcherSupportingRecursive({
watchDirectory,
useCaseSensitiveFileNames,
@ -6351,6 +6345,7 @@ var Diagnostics = {
List_of_folders_to_include_type_definitions_from: diag(6161, 3 /* Message */, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."),
Disable_size_limitations_on_JavaScript_projects: diag(6162, 3 /* Message */, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."),
The_character_set_of_the_input_files: diag(6163, 3 /* Message */, "The_character_set_of_the_input_files_6163", "The character set of the input files."),
Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1: diag(6164, 3 /* Message */, "Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1_6164", "Skipping module '{0}' that looks like an absolute URI, target file types: {1}."),
Do_not_truncate_error_messages: diag(6165, 3 /* Message */, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."),
Output_directory_for_generated_declaration_files: diag(6166, 3 /* Message */, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."),
A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: diag(6167, 3 /* Message */, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."),
@ -6830,6 +6825,7 @@ var Diagnostics = {
You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag: diag(8039, 1 /* Error */, "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039", "A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"),
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@ -7081,6 +7077,7 @@ var Diagnostics = {
Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@ -9807,7 +9804,6 @@ function isLeftHandSideExpressionKind(kind) {
case 283 /* JsxElement */:
case 284 /* JsxSelfClosingElement */:
case 287 /* JsxFragment */:
case 294 /* JsxNamespacedName */:
case 214 /* TaggedTemplateExpression */:
case 208 /* ArrayLiteralExpression */:
case 216 /* ParenthesizedExpression */:
@ -9906,7 +9902,7 @@ function isDeclarationStatementKind(kind) {
return kind === 261 /* FunctionDeclaration */ || kind === 281 /* MissingDeclaration */ || kind === 262 /* ClassDeclaration */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 276 /* ExportAssignment */ || kind === 269 /* NamespaceExportDeclaration */;
}
function isStatementKindButNotDeclarationKind(kind) {
return kind === 251 /* BreakStatement */ || kind === 250 /* ContinueStatement */ || kind === 258 /* DebuggerStatement */ || kind === 245 /* DoStatement */ || kind === 243 /* ExpressionStatement */ || kind === 241 /* EmptyStatement */ || kind === 248 /* ForInStatement */ || kind === 249 /* ForOfStatement */ || kind === 247 /* ForStatement */ || kind === 244 /* IfStatement */ || kind === 255 /* LabeledStatement */ || kind === 252 /* ReturnStatement */ || kind === 254 /* SwitchStatement */ || kind === 256 /* ThrowStatement */ || kind === 257 /* TryStatement */ || kind === 242 /* VariableStatement */ || kind === 246 /* WhileStatement */ || kind === 253 /* WithStatement */ || kind === 358 /* NotEmittedStatement */ || kind === 362 /* EndOfDeclarationMarker */ || kind === 361 /* MergeDeclarationMarker */;
return kind === 251 /* BreakStatement */ || kind === 250 /* ContinueStatement */ || kind === 258 /* DebuggerStatement */ || kind === 245 /* DoStatement */ || kind === 243 /* ExpressionStatement */ || kind === 241 /* EmptyStatement */ || kind === 248 /* ForInStatement */ || kind === 249 /* ForOfStatement */ || kind === 247 /* ForStatement */ || kind === 244 /* IfStatement */ || kind === 255 /* LabeledStatement */ || kind === 252 /* ReturnStatement */ || kind === 254 /* SwitchStatement */ || kind === 256 /* ThrowStatement */ || kind === 257 /* TryStatement */ || kind === 242 /* VariableStatement */ || kind === 246 /* WhileStatement */ || kind === 253 /* WithStatement */ || kind === 358 /* NotEmittedStatement */;
}
function isDeclaration(node) {
if (node.kind === 167 /* TypeParameter */) {
@ -10007,10 +10003,15 @@ function createSingleLineStringWriter() {
clear: () => str = ""
};
}
function copyEntries(source, target) {
source.forEach((value, key) => {
target.set(key, value);
});
function forEachKey(map2, callback) {
const iterator = map2.keys();
for (const key of iterator) {
const result = callback(key);
if (result) {
return result;
}
}
return void 0;
}
function getFullWidth(node) {
return node.end - node.pos;
@ -10109,6 +10110,8 @@ function tryGetTextOfPropertyName(name) {
if (isStringOrNumericLiteralLike(name.expression))
return escapeLeadingUnderscores(name.expression.text);
return void 0;
case 294 /* JsxNamespacedName */:
return getEscapedTextOfJsxNamespacedName(name);
default:
return Debug.assertNever(name);
}
@ -10493,6 +10496,7 @@ function canHaveJSDoc(node) {
case 171 /* PropertyDeclaration */:
case 170 /* PropertySignature */:
case 252 /* ReturnStatement */:
case 239 /* SemicolonClassElement */:
case 177 /* SetAccessor */:
case 303 /* ShorthandPropertyAssignment */:
case 304 /* SpreadAssignment */:
@ -10579,7 +10583,7 @@ function isDynamicName(name) {
return !isStringOrNumericLiteralLike(expr) && !isSignedNumericLiteral(expr);
}
function getTextOfIdentifierOrLiteral(node) {
return isMemberName(node) ? idText(node) : node.text;
return isMemberName(node) ? idText(node) : isJsxNamespacedName(node) ? getTextOfJsxNamespacedName(node) : node.text;
}
function nodeIsSynthesized(range) {
return positionIsSynthesized(range.pos) || positionIsSynthesized(range.end);
@ -10971,10 +10975,6 @@ function directoryProbablyExists(directoryName, host) {
function closeFileWatcher(watcher) {
watcher.close();
}
function clearMap(map2, onDeleteValue) {
map2.forEach(onDeleteValue);
map2.clear();
}
function getLastChild(node) {
let lastChild;
forEachChild(
@ -11483,7 +11483,7 @@ function getScriptKindFromFileName(fileName) {
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */];
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
@ -11662,6 +11662,12 @@ function isJsxAttributeName(node) {
const kind = node.kind;
return kind === 80 /* Identifier */ || kind === 294 /* JsxNamespacedName */;
}
function getEscapedTextOfJsxNamespacedName(node) {
return `${node.namespace.escapedText}:${idText(node.name)}`;
}
function getTextOfJsxNamespacedName(node) {
return `${idText(node.namespace)}:${idText(node.name)}`;
}
// src/compiler/factory/baseNodeFactory.ts
function createBaseNodeFactory() {
@ -12747,8 +12753,6 @@ function createNodeFactory(flags, baseFactory2) {
updatePartiallyEmittedExpression,
createCommaListExpression,
updateCommaListExpression,
createEndOfDeclarationMarker,
createMergeDeclarationMarker,
createSyntheticReferenceExpression,
updateSyntheticReferenceExpression,
cloneNode,
@ -15816,20 +15820,8 @@ function createNodeFactory(flags, baseFactory2) {
function updateCommaListExpression(node, elements) {
return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
}
function createEndOfDeclarationMarker(original) {
const node = createBaseNode(362 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
}
function createMergeDeclarationMarker(original) {
const node = createBaseNode(361 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
}
function createSyntheticReferenceExpression(expression, thisArg) {
const node = createBaseNode(363 /* SyntheticReferenceExpression */);
const node = createBaseNode(361 /* SyntheticReferenceExpression */);
node.expression = expression;
node.thisArg = thisArg;
node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@ -16221,8 +16213,8 @@ function createNodeFactory(flags, baseFactory2) {
function inlineExpressions(expressions) {
return expressions.length > 10 ? createCommaListExpression(expressions) : reduceLeft(expressions, factory2.createComma);
}
function getName(node, allowComments, allowSourceMaps, emitFlags = 0) {
const nodeName = getNameOfDeclaration(node);
function getName(node, allowComments, allowSourceMaps, emitFlags = 0, ignoreAssignedName) {
const nodeName = ignoreAssignedName ? node && getNonAssignedNameOfDeclaration(node) : getNameOfDeclaration(node);
if (nodeName && isIdentifier(nodeName) && !isGeneratedIdentifier(nodeName)) {
const name = setParent(setTextRange(cloneNode(nodeName), nodeName), nodeName.parent);
emitFlags |= getEmitFlags(nodeName);
@ -16239,8 +16231,8 @@ function createNodeFactory(flags, baseFactory2) {
function getInternalName(node, allowComments, allowSourceMaps) {
return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */ | 65536 /* InternalName */);
}
function getLocalName(node, allowComments, allowSourceMaps) {
return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */);
function getLocalName(node, allowComments, allowSourceMaps, ignoreAssignedName) {
return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */, ignoreAssignedName);
}
function getExportName(node, allowComments, allowSourceMaps) {
return getName(node, allowComments, allowSourceMaps, 16384 /* ExportName */);
@ -17123,6 +17115,9 @@ function isJsxClosingFragment(node) {
function isJsxAttributes(node) {
return node.kind === 291 /* JsxAttributes */;
}
function isJsxNamespacedName(node) {
return node.kind === 294 /* JsxNamespacedName */;
}
function isDefaultClause(node) {
return node.kind === 296 /* DefaultClause */;
}
@ -19221,8 +19216,13 @@ var Parser;
return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
case 14 /* JsxChildren */:
return true;
case 25 /* JSDocComment */:
return true;
case 26 /* Count */:
return Debug.fail("ParsingContext.Count used as a context");
default:
Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
}
return Debug.fail("Non-exhaustive case in 'isListElement'.");
}
function isValidHeritageClauseObjectLiteral() {
Debug.assert(token() === 19 /* OpenBraceToken */);
@ -19316,7 +19316,8 @@ var Parser;
return false;
}
function isInSomeParsingContext() {
for (let kind = 0; kind < 25 /* Count */; kind++) {
Debug.assert(parsingContext, "Missing parsing context");
for (let kind = 0; kind < 26 /* Count */; kind++) {
if (parsingContext & 1 << kind) {
if (isListElement(
kind,
@ -19575,7 +19576,9 @@ var Parser;
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
case 24 /* AssertEntries */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
case 25 /* Count */:
case 25 /* JSDocComment */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
case 26 /* Count */:
return Debug.fail("ParsingContext.Count used as a context");
default:
Debug.assertNever(context);
@ -21626,7 +21629,11 @@ var Parser;
}
function parseJsxElementName() {
const pos = getNodePos();
let expression = parseJsxTagName();
const initialExpression = parseJsxTagName();
if (isJsxNamespacedName(initialExpression)) {
return initialExpression;
}
let expression = initialExpression;
while (parseOptional(25 /* DotToken */)) {
expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
@ -23156,11 +23163,11 @@ var Parser;
}
function parseClassElement() {
const pos = getNodePos();
const hasJSDoc = hasPrecedingJSDocComment();
if (token() === 27 /* SemicolonToken */) {
nextToken();
return finishNode(factory2.createSemicolonClassElement(), pos);
return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc);
}
const hasJSDoc = hasPrecedingJSDocComment();
const modifiers = parseModifiers(
/*allowDecorators*/
true,
@ -23707,7 +23714,8 @@ var Parser;
ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries";
ParsingContext2[ParsingContext2["Count"] = 25] = "Count";
ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment";
ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
})(ParsingContext || (ParsingContext = {}));
let Tristate;
((Tristate2) => {
@ -23829,6 +23837,8 @@ var Parser;
PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
})(PropertyLikeParse || (PropertyLikeParse = {}));
function parseJSDocCommentWorker(start = 0, length2) {
const saveParsingContext = parsingContext;
parsingContext |= 1 << 25 /* JSDocComment */;
const content = sourceText;
const end = length2 === void 0 ? content.length : start + length2;
length2 = end - start;
@ -23845,7 +23855,10 @@ var Parser;
let commentsPos;
let comments = [];
const parts = [];
return scanner.scanRange(start + 3, length2 - 5, () => {
const result = scanner.scanRange(start + 3, length2 - 5, doJSDocScan);
parsingContext = saveParsingContext;
return result;
function doJSDocScan() {
let state = 1 /* SawAsterisk */;
let margin;
let indent2 = start - (content.lastIndexOf("\n", start) + 1) + 4;
@ -23941,7 +23954,7 @@ var Parser;
Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set");
const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd);
return finishNode(factory2.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : trimmedComments.length ? trimmedComments : void 0, tagsArray), start, end);
});
}
function removeLeadingNewlines(comments2) {
while (comments2.length && (comments2[0] === "\n" || comments2[0] === "\r")) {
comments2.shift();
@ -24300,8 +24313,8 @@ var Parser;
typeExpression = nestedTypeLiteral;
isNameFirst = true;
}
const result = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
return finishNode(result, start2);
const result2 = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment);
return finishNode(result2, start2);
}
function parseNestedTypeLiteral(typeExpression, name, target, indent2) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
@ -24311,6 +24324,8 @@ var Parser;
while (child = tryParse(() => parseChildParameterOrPropertyTag(target, indent2, name))) {
if (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) {
children = append(children, child);
} else if (child.kind === 351 /* JSDocTemplateTag */) {
parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
}
}
if (children) {
@ -24398,7 +24413,9 @@ var Parser;
const usedBrace = parseOptional(19 /* OpenBraceToken */);
const pos = getNodePos();
const expression = parsePropertyAccessEntityNameExpression();
scanner.setInJSDocType(true);
const typeArguments = tryParseTypeArguments();
scanner.setInJSDocType(false);
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
const res = finishNode(node, pos);
if (usedBrace) {
@ -24447,6 +24464,9 @@ var Parser;
let jsDocPropertyTags;
let hasChildren = false;
while (child = tryParse(() => parseChildPropertyTag(indent2))) {
if (child.kind === 351 /* JSDocTemplateTag */) {
break;
}
hasChildren = true;
if (child.kind === 350 /* JSDocTypeTag */) {
if (childTypeTag) {
@ -24506,6 +24526,10 @@ var Parser;
let child;
let parameters;
while (child = tryParse(() => parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent2))) {
if (child.kind === 351 /* JSDocTemplateTag */) {
parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag);
break;
}
parameters = append(parameters, child);
}
return createNodeArray(parameters || [], pos);
@ -24600,7 +24624,7 @@ var Parser;
const start2 = scanner.getTokenFullStart();
nextTokenJSDoc();
const tagName = parseJSDocIdentifierName();
skipWhitespace();
const indentText = skipWhitespaceOrAsterisk();
let t;
switch (tagName.escapedText) {
case "type":
@ -24614,6 +24638,8 @@ var Parser;
case "param":
t = 2 /* Parameter */ | 4 /* CallbackParameter */;
break;
case "template":
return parseTemplateTag(start2, tagName, indent2, indentText);
default:
return false;
}
@ -24701,9 +24727,9 @@ var Parser;
const end2 = scanner.getTokenEnd();
const originalKeywordKind = token();
const text = internIdentifier(scanner.getTokenValue());
const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start2, end2);
const result2 = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start2, end2);
nextTokenJSDoc();
return result;
return result2;
}
}
})(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {}));
@ -27607,8 +27633,6 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
const diagnosticState = {
...state,
features: state.features & ~8 /* Exports */,
failedLookupLocations: [],
affectingLocations: [],
reportDiagnostic: noop
};
const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState);
@ -27648,6 +27672,12 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
}
if (!resolved2) {
if (moduleName.indexOf(":") > -1) {
if (traceEnabled) {
trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
}
return void 0;
}
if (traceEnabled) {
trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
}
@ -27734,22 +27764,22 @@ var nodeModulesPathPart = "/node_modules/";
function pathContainsNodeModules(path2) {
return stringContains(path2, nodeModulesPathPart);
}
function parseNodeModuleFromPath(resolved) {
function parseNodeModuleFromPath(resolved, isFolder) {
const path2 = normalizePath(resolved);
const idx = path2.lastIndexOf(nodeModulesPathPart);
if (idx === -1) {
return void 0;
}
const indexAfterNodeModules = idx + nodeModulesPathPart.length;
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterNodeModules);
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterNodeModules, isFolder);
if (path2.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterPackageName);
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterPackageName, isFolder);
}
return path2.slice(0, indexAfterPackageName);
}
function moveToNextDirectorySeparatorIfAvailable(path2, prevSeparatorIndex) {
function moveToNextDirectorySeparatorIfAvailable(path2, prevSeparatorIndex, isFolder) {
const nextSeparatorIndex = path2.indexOf(directorySeparator, prevSeparatorIndex + 1);
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
return nextSeparatorIndex === -1 ? isFolder ? path2.length : prevSeparatorIndex : nextSeparatorIndex;
}
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
@ -28564,7 +28594,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
return withPackageId(packageInfo, fromDirectory);
}
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
let pathAndExtension = (rest || !(state2.features & 32 /* EsmMode */)) && loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
extensions2,
candidate2,
onlyRecordFailures,
@ -30478,104 +30508,6 @@ function createBracketsMap() {
}
// src/compiler/watchUtilities.ts
function getWatchFactory(host, watchLogLevel, log2, getDetailWatchInfo2) {
setSysLog(watchLogLevel === 2 /* Verbose */ ? log2 : noop);
const plainInvokeFactory = {
watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
watchDirectory: (directory, callback, flags, options) => host.watchDirectory(directory, callback, (flags & 1 /* Recursive */) !== 0, options)
};
const triggerInvokingFactory = watchLogLevel !== 0 /* None */ ? {
watchFile: createTriggerLoggingAddWatch("watchFile"),
watchDirectory: createTriggerLoggingAddWatch("watchDirectory")
} : void 0;
const factory2 = watchLogLevel === 2 /* Verbose */ ? {
watchFile: createFileWatcherWithLogging,
watchDirectory: createDirectoryWatcherWithLogging
} : triggerInvokingFactory || plainInvokeFactory;
const excludeWatcherFactory = watchLogLevel === 2 /* Verbose */ ? createExcludeWatcherWithLogging : returnNoopFileWatcher;
return {
watchFile: createExcludeHandlingAddWatch("watchFile"),
watchDirectory: createExcludeHandlingAddWatch("watchDirectory")
};
function createExcludeHandlingAddWatch(key) {
return (file, cb, flags, options, detailInfo1, detailInfo2) => {
var _a;
return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call(
/*thisArgs*/
void 0,
file,
cb,
flags,
options,
detailInfo1,
detailInfo2
) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2);
};
}
function useCaseSensitiveFileNames() {
return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
}
function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
log2(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
return {
close: () => log2(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
};
}
function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
log2(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
return {
close: () => {
log2(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
watcher.close();
}
};
}
function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
log2(watchInfo);
const start = timestamp();
const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
const elapsed = timestamp() - start;
log2(`Elapsed:: ${elapsed}ms ${watchInfo}`);
return {
close: () => {
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
log2(watchInfo2);
const start2 = timestamp();
watcher.close();
const elapsed2 = timestamp() - start2;
log2(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
}
};
}
function createTriggerLoggingAddWatch(key) {
return (file, cb, flags, options, detailInfo1, detailInfo2) => plainInvokeFactory[key].call(
/*thisArgs*/
void 0,
file,
(...args) => {
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
log2(triggerredInfo);
const start = timestamp();
cb.call(
/*thisArg*/
void 0,
...args
);
const elapsed = timestamp() - start;
log2(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
},
flags,
options,
detailInfo1,
detailInfo2
);
}
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
}
}
function getFallbackOptions(options) {
const fallbackPolling = options == null ? void 0 : options.fallbackPolling;
return {
@ -31154,8 +31086,6 @@ var screenStartingMessageCodes = [
Diagnostics.Starting_compilation_in_watch_mode.code,
Diagnostics.File_change_detected_Starting_incremental_compilation.code
];
var noopFileWatcher = { close: noop };
var returnNoopFileWatcher = () => noopFileWatcher;
// src/jsTyping/_namespaces/ts.JsTyping.ts
var ts_JsTyping_exports = {};
@ -31480,11 +31410,11 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
// src/jsTyping/shared.ts
var ActionSet = "action::set";
var ActionInvalidate = "action::invalidate";
var ActionPackageInstalled = "action::packageInstalled";
var EventTypesRegistry = "event::typesRegistry";
var EventBeginInstallTypes = "event::beginInstallTypes";
var EventEndInstallTypes = "event::endInstallTypes";
var ActionWatchTypingLocations = "action::watchTypingLocations";
var Arguments;
((Arguments2) => {
Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation";
@ -31544,19 +31474,6 @@ function getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remainin
}
return { command, remaining: remaining - toSlice };
}
function endsWith2(str, suffix, caseSensitive) {
const expectedPos = str.length - suffix.length;
return expectedPos >= 0 && (str.indexOf(suffix, expectedPos) === expectedPos || !caseSensitive && compareStringsCaseInsensitive(str.substr(expectedPos), suffix) === 0 /* EqualTo */);
}
function isPackageOrBowerJson(fileName, caseSensitive) {
return endsWith2(fileName, "/package.json", caseSensitive) || endsWith2(fileName, "/bower.json", caseSensitive);
}
function sameFiles(a, b, caseSensitive) {
return a === b || !caseSensitive && compareStringsCaseInsensitive(a, b) === 0 /* EqualTo */;
}
function getDetailWatchInfo(projectName, watchers) {
return `Project: ${projectName} watcher already invoked: ${watchers == null ? void 0 : watchers.isInvoked}`;
}
var TypingsInstaller = class {
constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation2, throttleLimit, log2 = nullLog) {
this.installTypingHost = installTypingHost;
@ -31574,13 +31491,10 @@ var TypingsInstaller = class {
this.installRunCount = 1;
this.inFlightRequestCount = 0;
this.latestDistTag = "latest";
this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
this.globalCachePackageJsonPath = combinePaths(globalCachePath, "package.json");
const isLoggingEnabled = this.log.isEnabled();
if (isLoggingEnabled) {
this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation2}`);
}
this.watchFactory = getWatchFactory(this.installTypingHost, isLoggingEnabled ? 2 /* Verbose */ : 0 /* None */, (s) => this.log.writeLine(s), getDetailWatchInfo);
this.processCacheLocation(this.globalCachePath);
}
closeProject(req) {
@ -31597,8 +31511,8 @@ var TypingsInstaller = class {
}
return;
}
clearMap(watchers, closeFileWatcher);
this.projectWatchers.delete(projectName);
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: [] });
if (this.log.isEnabled()) {
this.log.writeLine(`Closing file watchers for project '${projectName}' - done.`);
}
@ -31631,7 +31545,7 @@ var TypingsInstaller = class {
if (this.log.isEnabled()) {
this.log.writeLine(`Finished typings discovery: ${JSON.stringify(discoverTypingsResult)}`);
}
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch, req.projectRootPath, req.watchOptions);
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch);
if (discoverTypingsResult.newTypingNames.length) {
this.installTypings(req, req.cachePath || this.globalCachePath, discoverTypingsResult.cachedTypingPaths, discoverTypingsResult.newTypingNames);
} else {
@ -31832,75 +31746,19 @@ var TypingsInstaller = class {
host.createDirectory(directory);
}
}
watchFiles(projectName, files, projectRootPath, options) {
watchFiles(projectName, files) {
if (!files.length) {
this.closeWatchers(projectName);
return;
}
let watchers = this.projectWatchers.get(projectName);
const toRemove = /* @__PURE__ */ new Map();
if (!watchers) {
watchers = /* @__PURE__ */ new Map();
this.projectWatchers.set(projectName, watchers);
const existing = this.projectWatchers.get(projectName);
const newSet = new Set(files);
if (!existing || forEachKey(newSet, (s) => !existing.has(s)) || forEachKey(existing, (s) => !newSet.has(s))) {
this.projectWatchers.set(projectName, newSet);
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files });
} else {
copyEntries(watchers, toRemove);
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: void 0 });
}
watchers.isInvoked = false;
const isLoggingEnabled = this.log.isEnabled();
const createProjectWatcher = (path2, projectWatcherType) => {
const canonicalPath = this.toCanonicalFileName(path2);
toRemove.delete(canonicalPath);
if (watchers.has(canonicalPath)) {
return;
}
if (isLoggingEnabled) {
this.log.writeLine(`${projectWatcherType}:: Added:: WatchInfo: ${path2}`);
}
const watcher = projectWatcherType === "FileWatcher" /* FileWatcher */ ? this.watchFactory.watchFile(path2, () => {
if (!watchers.isInvoked) {
watchers.isInvoked = true;
this.sendResponse({ projectName, kind: ActionInvalidate });
}
}, 2e3 /* High */, options, projectName, watchers) : this.watchFactory.watchDirectory(path2, (f) => {
if (watchers.isInvoked || !fileExtensionIs(f, ".json" /* Json */)) {
return;
}
if (isPackageOrBowerJson(f, this.installTypingHost.useCaseSensitiveFileNames) && !sameFiles(f, this.globalCachePackageJsonPath, this.installTypingHost.useCaseSensitiveFileNames)) {
watchers.isInvoked = true;
this.sendResponse({ projectName, kind: ActionInvalidate });
}
}, 1 /* Recursive */, options, projectName, watchers);
watchers.set(canonicalPath, isLoggingEnabled ? {
close: () => {
this.log.writeLine(`${projectWatcherType}:: Closed:: WatchInfo: ${path2}`);
watcher.close();
}
} : watcher);
};
for (const file of files) {
if (file.endsWith("/package.json") || file.endsWith("/bower.json")) {
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
continue;
}
if (containsPath(projectRootPath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
const subDirectory = file.indexOf(directorySeparator, projectRootPath.length + 1);
if (subDirectory !== -1) {
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
} else {
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
}
continue;
}
if (containsPath(this.globalCachePath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
createProjectWatcher(this.globalCachePath, "DirectoryWatcher" /* DirectoryWatcher */);
continue;
}
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
}
toRemove.forEach((watch, path2) => {
watch.close();
watchers.delete(path2);
});
}
createSetTypings(request, typings) {
return {

View File

@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "5.1.0-beta",
"version": "5.1.1-rc",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [

View File

@ -4,7 +4,7 @@ export const versionMajorMinor = "5.1";
// The following is baselined as a literal template type without intervention
/** The version of the TypeScript compiler release */
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
export const version = "5.1.0-beta" as string;
export const version = "5.1.1-rc" as string;
/**
* Type of objects whose values are all of the same type.