diff --git a/packages/core/src/common/externals/BrowserExternals.ts b/packages/core/src/common/externals/BrowserExternals.ts index f14d0e3ad..bea1dc54e 100644 --- a/packages/core/src/common/externals/BrowserExternals.ts +++ b/packages/core/src/common/externals/BrowserExternals.ts @@ -6,13 +6,7 @@ import type { ExternalDownloaderOptions, RemoteUriString, } from './downloader.js' -import type { - ExternalEventEmitter, - ExternalFileSystem, - Externals, - FsLocation, - FsWatcher, -} from './index.js' +import type { ExternalEventEmitter, ExternalFileSystem, Externals, FsLocation } from './index.js' type Listener = (...args: unknown[]) => unknown class BrowserEventEmitter implements ExternalEventEmitter { diff --git a/packages/core/src/common/externals/index.ts b/packages/core/src/common/externals/index.ts index 789999b3b..5bdaabb54 100644 --- a/packages/core/src/common/externals/index.ts +++ b/packages/core/src/common/externals/index.ts @@ -86,29 +86,3 @@ export interface ExternalFileSystem { * A file URI string or a URI object. */ export type FsLocation = string | Uri - -/** - * A file system watcher that reports additions, changes, and deletions of files. - * Changes to directories should not be reported. - */ -export interface FsWatcher { - get isReady(): boolean - get watchedFiles(): Set - - on(eventName: 'ready', listener: () => unknown): this - once(eventName: 'ready', listener: () => unknown): this - - on(eventName: 'add', listener: (uri: string) => unknown): this - once(eventName: 'add', listener: (uri: string) => unknown): this - - on(eventName: 'change', listener: (uri: string) => unknown): this - once(eventName: 'change', listener: (uri: string) => unknown): this - - on(eventName: 'unlink', listener: (uri: string) => unknown): this - once(eventName: 'unlink', listener: (uri: string) => unknown): this - - on(eventName: 'error', listener: (error: Error) => unknown): this - once(eventName: 'error', listener: (error: Error) => unknown): this - - close(): Promise -} diff --git a/packages/core/src/service/FsWatcher.ts b/packages/core/src/service/FsWatcher.ts new file mode 100644 index 000000000..6b88d8bb2 --- /dev/null +++ b/packages/core/src/service/FsWatcher.ts @@ -0,0 +1,25 @@ +/** + * A file system watcher that reports additions, changes, and deletions of files. + * Changes to directories should not be reported. + */ +export interface FsWatcher { + get isReady(): boolean + get watchedFiles(): Set + + on(eventName: 'ready', listener: () => unknown): this + once(eventName: 'ready', listener: () => unknown): this + + on(eventName: 'add', listener: (uri: string) => unknown): this + once(eventName: 'add', listener: (uri: string) => unknown): this + + on(eventName: 'change', listener: (uri: string) => unknown): this + once(eventName: 'change', listener: (uri: string) => unknown): this + + on(eventName: 'unlink', listener: (uri: string) => unknown): this + once(eventName: 'unlink', listener: (uri: string) => unknown): this + + on(eventName: 'error', listener: (error: Error) => unknown): this + once(eventName: 'error', listener: (error: Error) => unknown): this + + close(): Promise +} diff --git a/packages/core/src/service/Project.ts b/packages/core/src/service/Project.ts index d766db2dd..458e6f019 100644 --- a/packages/core/src/service/Project.ts +++ b/packages/core/src/service/Project.ts @@ -2,7 +2,7 @@ import type { Ignore } from 'ignore' import ignore from 'ignore' import type { TextDocumentContentChangeEvent } from 'vscode-languageserver-textdocument' import { TextDocument } from 'vscode-languageserver-textdocument' -import type { ExternalEventEmitter, Externals, FsWatcher, IntervalId } from '../common/index.js' +import type { ExternalEventEmitter, Externals, IntervalId } from '../common/index.js' import { bufferToString, Logger, @@ -34,6 +34,7 @@ import { LinterErrorReporter } from './ErrorReporter.js' import { ArchiveUriSupporter, FileService, FileUriSupporter } from './FileService.js' import type { RootUriString } from './fileUtil.js' import { fileUtil } from './fileUtil.js' +import type { FsWatcher } from './FsWatcher.js' import { MetaRegistry } from './MetaRegistry.js' import { ProfilerFactory } from './Profiler.js' diff --git a/packages/core/src/service/index.ts b/packages/core/src/service/index.ts index 05abf06ae..a2e431b06 100644 --- a/packages/core/src/service/index.ts +++ b/packages/core/src/service/index.ts @@ -8,6 +8,7 @@ export * from './Downloader.js' export * from './ErrorReporter.js' export { FileService, UriProtocolSupporter } from './FileService.js' export * from './fileUtil.js' +export * from './FsWatcher.js' export * from './Hover.js' export * from './MetaRegistry.js' export * from './Profiler.js'