@jsenv/filesystem 4.10.6 → 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.6",
3
+ "version": "4.10.8",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -252,10 +252,9 @@ export const registerDirectoryLifecycle = (
252
252
  entryNameArray = readdirSync(directoryUrlObject);
253
253
  } catch (e) {
254
254
  if (e.code === "ENOENT") {
255
- entryNameArray = [];
256
- } else {
257
- throw e;
255
+ return;
258
256
  }
257
+ throw e;
259
258
  }
260
259
  for (const entryName of entryNameArray) {
261
260
  const childEntryUrl = new URL(entryName, directoryUrl).href;
@@ -266,22 +265,29 @@ export const registerDirectoryLifecycle = (
266
265
  }
267
266
  // we must watch manually every directory we find
268
267
  if (!fsWatchSupportsRecursive) {
269
- const watcher = createWatcher(urlToFileSystemPath(entryInfo.url), {
270
- persistent: keepProcessAlive,
271
- });
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,
268
+ try {
269
+ const watcher = createWatcher(urlToFileSystemPath(entryInfo.url), {
270
+ persistent: keepProcessAlive,
271
+ });
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
+ });
283
284
  });
284
- });
285
+ } catch (e) {
286
+ if (e.code === "ENOENT") {
287
+ return;
288
+ }
289
+ throw e;
290
+ }
285
291
  }
286
292
  }
287
293
  if (added && entryInfo.patternValue && notify) {