braidfs 0.0.107 → 0.0.108
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/index.js +12 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -297,6 +297,8 @@ async function watch_files() {
|
|
|
297
297
|
on('unlink', x => chokidar_handler(x, 'unlink'))
|
|
298
298
|
|
|
299
299
|
async function chokidar_handler(fullpath, event) {
|
|
300
|
+
console.log(`file event "${event}": ${fullpath}`)
|
|
301
|
+
|
|
300
302
|
// Make sure the path is within sync_base..
|
|
301
303
|
if (!fullpath.startsWith(sync_base))
|
|
302
304
|
return on_watcher_miss(`path ${fullpath} outside ${sync_base}`)
|
|
@@ -309,8 +311,6 @@ async function watch_files() {
|
|
|
309
311
|
if (event != 'unlink' && (await require('fs').promises.stat(fullpath)).isDirectory())
|
|
310
312
|
return on_watcher_miss(`expected file, got: ${fullpath}`)
|
|
311
313
|
|
|
312
|
-
console.log(`file event: ${path}, event: ${event}`)
|
|
313
|
-
|
|
314
314
|
var sync = await sync_url.cache[normalize_url(path)]
|
|
315
315
|
|
|
316
316
|
if (sync && event != 'add') sync.signal_file_needs_reading()
|
|
@@ -330,6 +330,16 @@ async function scan_files() {
|
|
|
330
330
|
'en-US', {minute: '2-digit', second: '2-digit', hour: '2-digit'}
|
|
331
331
|
)
|
|
332
332
|
console.log(`scan files.. `, timestamp)
|
|
333
|
+
|
|
334
|
+
// this can be removed in the future;
|
|
335
|
+
// some debug information about chokidar:
|
|
336
|
+
var internal = 'unknown'
|
|
337
|
+
for (var k in watch_files?.watcher ?? {}) {
|
|
338
|
+
if (k.startsWith('_fsEvents')) internal = "_fsEvents"
|
|
339
|
+
if (k.startsWith('_nodeFs')) internal = "_nodeFs"
|
|
340
|
+
}
|
|
341
|
+
console.log(`chokidar info: FSEvents=${watch_files?.watcher?.options?.useFsEvents}, polling=${watch_files?.watcher?.options?.usePolling}, internal=${internal}`)
|
|
342
|
+
|
|
333
343
|
if (await f(sync_base))
|
|
334
344
|
on_watcher_miss(`scanner picked up a change that the watcher should have gotten`, false)
|
|
335
345
|
}
|