59 lines
1.1 KiB
TypeScript
59 lines
1.1 KiB
TypeScript
export {}
|
|
declare global {
|
|
namespace VitePluginTypes {
|
|
|
|
/**
|
|
* 添加文件、添加目录、修改文件、删除文件、删除目录
|
|
*/
|
|
type FileWatcherEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'
|
|
|
|
interface FileWatcherProcessParam {
|
|
/**
|
|
* 事件
|
|
*/
|
|
event: FileWatcherEvent
|
|
/**
|
|
* 路径
|
|
*/
|
|
filePath: string
|
|
/**
|
|
* 是否为目录
|
|
*/
|
|
isDir: boolean
|
|
/**
|
|
* 获取文件内容
|
|
*/
|
|
getContent: () => string
|
|
}
|
|
|
|
interface FileWatcherAcceptParam {
|
|
/**
|
|
* 事件
|
|
*/
|
|
event: FileWatcherEvent
|
|
/**
|
|
* 路径
|
|
*/
|
|
filePath: string
|
|
/**
|
|
* 是否为目录
|
|
*/
|
|
isDir: boolean
|
|
}
|
|
|
|
interface FileWatcherOptions {
|
|
/**
|
|
* 处理函数
|
|
* @param data
|
|
*/
|
|
process: (data: FileWatcherProcessParam) => void
|
|
/**
|
|
* 是否处理
|
|
* @param data
|
|
*/
|
|
isAccept: (data: FileWatcherAcceptParam) => boolean
|
|
}
|
|
}
|
|
}
|
|
|