@file-services/types
Advanced tools
Comparing version 9.1.0 to 9.2.0
@@ -9,2 +9,3 @@ import type { IFileSystemStats, BufferEncoding, CallbackFnVoid, CallbackFn, WriteFileOptions, ReadFileOptions, IDirectoryEntry, RmOptions } from "./common-fs-types"; | ||
export interface IBaseFileSystemAsync extends IBaseFileSystemCallbackActions, IFileSystemPath { | ||
/** @deprecated use `fs.watch()` instead. */ | ||
watchService: IWatchService; | ||
@@ -11,0 +12,0 @@ caseSensitive: boolean; |
@@ -1,2 +0,2 @@ | ||
import type { IFileSystemStats, BufferEncoding, WriteFileOptions, ReadFileOptions, IDirectoryEntry, StatSyncOptions, RmOptions } from "./common-fs-types"; | ||
import type { BufferEncoding, FSWatcher, IDirectoryEntry, IFileSystemStats, ReadFileOptions, RmOptions, StatSyncOptions, WatchOptions, WriteFileOptions } from "./common-fs-types"; | ||
import type { IFileSystemPath } from "./path"; | ||
@@ -9,2 +9,3 @@ import type { IWatchService } from "./watch-api"; | ||
export interface IBaseFileSystemSync extends IBaseFileSystemSyncActions, IFileSystemPath { | ||
/** @deprecated use `fs.watch()` instead. */ | ||
watchService: IWatchService; | ||
@@ -130,3 +131,5 @@ caseSensitive: boolean; | ||
chmodSync(path: string, mode: number | string): void; | ||
/** Watch a file or a directory (optionally recursively). */ | ||
watch(path: string, options?: WatchOptions): FSWatcher; | ||
} | ||
//# sourceMappingURL=base-api-sync.d.ts.map |
@@ -123,2 +123,22 @@ export type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; | ||
} | ||
export interface WatchOptions { | ||
/** | ||
* When watching a directory, also watch deeply nested children. | ||
* @default false | ||
*/ | ||
recursive?: boolean; | ||
} | ||
export type WatchChangeEventListener = (eventType: "change" | "rename", relativePath: string) => void; | ||
export interface FSWatcher { | ||
/** | ||
* Stop watching for changes on the given `FSWatcher`. Once stopped, the `FSWatcher` object is no longer usable. | ||
*/ | ||
close(): void; | ||
on(event: "change", listener: WatchChangeEventListener): this; | ||
on(event: "close", listener: () => void): this; | ||
on(event: "error", listener: (error: Error) => void): this; | ||
off(event: "change", listener: WatchChangeEventListener): this; | ||
off(event: "close", listener: () => void): this; | ||
off(event: "error", listener: (error: Error) => void): this; | ||
} | ||
//# sourceMappingURL=common-fs-types.d.ts.map |
@@ -5,2 +5,3 @@ import type { IFileSystemStats } from "./common-fs-types"; | ||
* Emits naive watch events containing path and latest stats. | ||
* @deprecated use `fs.watch()` instead. | ||
*/ | ||
@@ -7,0 +8,0 @@ export interface IWatchService { |
{ | ||
"name": "@file-services/types", | ||
"description": "Common file system interfaces", | ||
"version": "9.1.0", | ||
"version": "9.2.0", | ||
"main": "./dist/fs-types.cjs", | ||
@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts", |
@@ -19,2 +19,3 @@ import type { | ||
export interface IBaseFileSystemAsync extends IBaseFileSystemCallbackActions, IFileSystemPath { | ||
/** @deprecated use `fs.watch()` instead. */ | ||
watchService: IWatchService; | ||
@@ -21,0 +22,0 @@ caseSensitive: boolean; |
import type { | ||
BufferEncoding, | ||
FSWatcher, | ||
IDirectoryEntry, | ||
IFileSystemStats, | ||
BufferEncoding, | ||
WriteFileOptions, | ||
ReadFileOptions, | ||
IDirectoryEntry, | ||
RmOptions, | ||
StatSyncOptions, | ||
RmOptions, | ||
WatchOptions, | ||
WriteFileOptions, | ||
} from "./common-fs-types"; | ||
@@ -18,2 +20,3 @@ import type { IFileSystemPath } from "./path"; | ||
export interface IBaseFileSystemSync extends IBaseFileSystemSyncActions, IFileSystemPath { | ||
/** @deprecated use `fs.watch()` instead. */ | ||
watchService: IWatchService; | ||
@@ -139,2 +142,5 @@ caseSensitive: boolean; | ||
chmodSync(path: string, mode: number | string): void; | ||
/** Watch a file or a directory (optionally recursively). */ | ||
watch(path: string, options?: WatchOptions): FSWatcher; | ||
} |
@@ -160,1 +160,26 @@ export type BufferEncoding = | ||
} | ||
export interface WatchOptions { | ||
/** | ||
* When watching a directory, also watch deeply nested children. | ||
* @default false | ||
*/ | ||
recursive?: boolean; | ||
} | ||
export type WatchChangeEventListener = (eventType: "change" | "rename", relativePath: string) => void; | ||
export interface FSWatcher { | ||
/** | ||
* Stop watching for changes on the given `FSWatcher`. Once stopped, the `FSWatcher` object is no longer usable. | ||
*/ | ||
close(): void; | ||
on(event: "change", listener: WatchChangeEventListener): this; | ||
on(event: "close", listener: () => void): this; | ||
on(event: "error", listener: (error: Error) => void): this; | ||
off(event: "change", listener: WatchChangeEventListener): this; | ||
off(event: "close", listener: () => void): this; | ||
off(event: "error", listener: (error: Error) => void): this; | ||
} |
@@ -6,2 +6,3 @@ import type { IFileSystemStats } from "./common-fs-types"; | ||
* Emits naive watch events containing path and latest stats. | ||
* @deprecated use `fs.watch()` instead. | ||
*/ | ||
@@ -8,0 +9,0 @@ export interface IWatchService { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86073
1671