fix(SmartFsProviderNode): Fix Node provider watch path handling and remove main test entry

This commit is contained in:
2025-11-29 21:01:51 +00:00
parent 381680f2e7
commit 6308e198c7
4 changed files with 14 additions and 9 deletions

View File

@@ -266,6 +266,10 @@ export class SmartFsProviderNode implements ISmartFsProvider {
// --- Watch Operations ---
public async watch(path: string, callback: TWatchCallback, options?: IWatchOptions): Promise<IWatcherHandle> {
// Check once at start if we're watching a file or directory
const watchedStats = await fs.stat(path);
const isWatchingFile = watchedStats.isFile();
const watcher = fsSync.watch(
path,
{
@@ -274,7 +278,8 @@ export class SmartFsProviderNode implements ISmartFsProvider {
async (eventType, filename) => {
if (!filename) return;
const fullPath = pathModule.join(path, filename);
// For file watching, path IS the file; for directory, join with filename
const fullPath = isWatchingFile ? path : pathModule.join(path, filename);
// Apply filter
if (options?.filter && !this.matchesPathFilter(fullPath, options.filter)) {