@jsenv/filesystem 4.10.7 → 4.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/filesystem",
3
- "version": "4.10.7",
3
+ "version": "4.10.8",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -265,22 +265,29 @@ export const registerDirectoryLifecycle = (
265
265
  }
266
266
  // we must watch manually every directory we find
267
267
  if (!fsWatchSupportsRecursive) {
268
- const watcher = createWatcher(urlToFileSystemPath(entryInfo.url), {
269
- persistent: keepProcessAlive,
270
- });
271
- tracker.registerCleanupCallback(() => {
272
- watcher.close();
273
- });
274
- watcher.on("change", (eventType, filename) => {
275
- handleDirectoryEvent({
276
- directoryRelativeUrl: entryInfo.relativeUrl,
277
- filename: filename
278
- ? // replace back slashes with slashes
279
- filename.replace(/\\/g, "/")
280
- : "",
281
- eventType,
268
+ try {
269
+ const watcher = createWatcher(urlToFileSystemPath(entryInfo.url), {
270
+ persistent: keepProcessAlive,
282
271
  });
283
- });
272
+ tracker.registerCleanupCallback(() => {
273
+ watcher.close();
274
+ });
275
+ watcher.on("change", (eventType, filename) => {
276
+ handleDirectoryEvent({
277
+ directoryRelativeUrl: entryInfo.relativeUrl,
278
+ filename: filename
279
+ ? // replace back slashes with slashes
280
+ filename.replace(/\\/g, "/")
281
+ : "",
282
+ eventType,
283
+ });
284
+ });
285
+ } catch (e) {
286
+ if (e.code === "ENOENT") {
287
+ return;
288
+ }
289
+ throw e;
290
+ }
284
291
  }
285
292
  }
286
293
  if (added && entryInfo.patternValue && notify) {