Instead of watching files in typing installer, forward it to projectService (#54028)

This commit is contained in:
Sheetal Nandi
2023-04-26 13:31:36 -07:00
committed by GitHub
parent f22898d577
commit a956bbc831
86 changed files with 1098 additions and 1040 deletions

View File

@@ -10,6 +10,7 @@ export type EventTypesRegistry = "event::typesRegistry";
export type EventBeginInstallTypes = "event::beginInstallTypes";
export type EventEndInstallTypes = "event::endInstallTypes";
export type EventInitializationFailed = "event::initializationFailed";
export type ActionWatchTypingLocations = "action::watchTypingLocations";
/** @internal */
export const ActionSet: ActionSet = "action::set";
/** @internal */
@@ -24,6 +25,8 @@ export const EventBeginInstallTypes: EventBeginInstallTypes = "event::beginInsta
export const EventEndInstallTypes: EventEndInstallTypes = "event::endInstallTypes";
/** @internal */
export const EventInitializationFailed: EventInitializationFailed = "event::initializationFailed";
/** @internal */
export const ActionWatchTypingLocations: ActionWatchTypingLocations = "action::watchTypingLocations";
/** @internal */
export namespace Arguments {

View File

@@ -1,19 +1,16 @@
import {
CompilerOptions,
DirectoryWatcherCallback,
FileWatcher,
FileWatcherCallback,
JsTyping,
MapLike,
Path,
SortedReadonlyArray,
TypeAcquisition,
WatchOptions,
} from "./_namespaces/ts";
import {
ActionInvalidate,
ActionPackageInstalled,
ActionSet,
ActionWatchTypingLocations,
EventBeginInstallTypes,
EventEndInstallTypes,
EventInitializationFailed,
@@ -21,7 +18,7 @@ import {
} from "./_namespaces/ts.server";
export interface TypingInstallerResponse {
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed | ActionWatchTypingLocations;
}
export interface TypingInstallerRequestWithProjectName {
@@ -35,7 +32,6 @@ export interface DiscoverTypings extends TypingInstallerRequestWithProjectName {
readonly fileNames: string[];
readonly projectRootPath: Path;
readonly compilerOptions: CompilerOptions;
readonly watchOptions?: WatchOptions;
readonly typeAcquisition: TypeAcquisition;
readonly unresolvedImports: SortedReadonlyArray<string>;
readonly cachePath?: string;
@@ -104,8 +100,6 @@ export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
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;
}
export interface SetTypings extends ProjectResponse {
@@ -116,5 +110,11 @@ export interface SetTypings extends ProjectResponse {
readonly kind: ActionSet;
}
export interface WatchTypingLocations extends ProjectResponse {
/** if files is undefined, retain same set of watchers */
readonly files: readonly string[] | undefined;
readonly kind: ActionWatchTypingLocations;
}
/** @internal */
export type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse;
export type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse | WatchTypingLocations;