(path, recursive = true, options = kEmptyObject)
| 114 | } |
| 115 | |
| 116 | watchPath(path, recursive = true, options = kEmptyObject) { |
| 117 | if (this.#isPathWatched(path)) { |
| 118 | return; |
| 119 | } |
| 120 | const { allowMissing = false } = options; |
| 121 | |
| 122 | const watcher = watch(path, { recursive, signal: this.#signal, throwIfNoEntry: !allowMissing }); |
| 123 | watcher.on('change', (eventType, fileName) => { |
| 124 | // `fileName` can be `null` if it cannot be determined. See |
| 125 | // https://github.com/nodejs/node/pull/49891#issuecomment-1744673430. |
| 126 | this.#onChange(recursive ? resolve(path, fileName ?? '') : path, eventType); |
| 127 | }); |
| 128 | this.#watchers.set(path, { handle: watcher, recursive }); |
| 129 | if (recursive) { |
| 130 | this.#removeWatchedChildren(path); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | filterFile(file, owner, options = kEmptyObject) { |
| 135 | if (!file) return; |
no test coverage detected