turbowatch
Advanced tools
Comparing version 2.4.4 to 2.4.5
import { FileWatchingBackend } from './FileWatchingBackend'; | ||
export declare class FSWatcher extends FileWatchingBackend { | ||
private fsWatchers; | ||
private closed; | ||
constructor(project: string); | ||
@@ -5,0 +6,0 @@ close(): Promise<void>; |
@@ -22,5 +22,17 @@ "use strict"; | ||
for (const filename of filenames) { | ||
const stats = await (0, promises_1.lstat)(filename); | ||
let stats; | ||
try { | ||
stats = await (0, promises_1.lstat)(filename); | ||
} | ||
catch (_a) { | ||
continue; | ||
} | ||
if (stats.isSymbolicLink()) { | ||
const fileRealpath = await (0, promises_1.realpath)(filename); | ||
let fileRealpath; | ||
try { | ||
fileRealpath = await (0, promises_1.realpath)(filename); | ||
} | ||
catch (_b) { | ||
continue; | ||
} | ||
if (!symlinks.some((symlink) => symlink.symlink === fileRealpath)) { | ||
@@ -40,2 +52,3 @@ symlinks.push({ | ||
this.fsWatchers = []; | ||
this.closed = false; | ||
// eslint-disable-next-line unicorn/consistent-function-scoping | ||
@@ -55,2 +68,5 @@ const watchPath = (target) => { | ||
findSymlinks(project).then((symlinks) => { | ||
if (this.closed) { | ||
return; | ||
} | ||
for (const symlink of symlinks) { | ||
@@ -72,2 +88,3 @@ this.fsWatchers.push((0, node_fs_1.watch)(symlink.realpath, { | ||
async close() { | ||
this.closed = true; | ||
for (const fsWatcher of this.fsWatchers) { | ||
@@ -74,0 +91,0 @@ fsWatcher.close(); |
@@ -65,3 +65,3 @@ { | ||
"types": "./dist/index.d.ts", | ||
"version": "2.4.4" | ||
"version": "2.4.5" | ||
} |
@@ -23,7 +23,19 @@ /* eslint-disable canonical/filename-match-regex */ | ||
for (const filename of filenames) { | ||
const stats = await lstat(filename); | ||
let stats; | ||
try { | ||
stats = await lstat(filename); | ||
} catch { | ||
continue; | ||
} | ||
if (stats.isSymbolicLink()) { | ||
const fileRealpath = await realpath(filename); | ||
let fileRealpath; | ||
try { | ||
fileRealpath = await realpath(filename); | ||
} catch { | ||
continue; | ||
} | ||
if (!symlinks.some((symlink) => symlink.symlink === fileRealpath)) { | ||
@@ -44,2 +56,4 @@ symlinks.push({ | ||
private closed = false; | ||
public constructor(project: string) { | ||
@@ -68,2 +82,6 @@ super(); | ||
findSymlinks(project).then((symlinks) => { | ||
if (this.closed) { | ||
return; | ||
} | ||
for (const symlink of symlinks) { | ||
@@ -97,2 +115,4 @@ this.fsWatchers.push( | ||
public async close() { | ||
this.closed = true; | ||
for (const fsWatcher of this.fsWatchers) { | ||
@@ -99,0 +119,0 @@ fsWatcher.close(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
178992
2940