Skip to content

Commit 64b4dc4

Browse files
authored
docs(platform): clarify FileSystem.watch recursive option behavior (#5792)
1 parent b234af9 commit 64b4dc4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/platform-node/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@
515515

516516
Added a `recursive` option to `FileSystem.watch` that allows watching for changes in subdirectories. When set to `true`, the watcher will monitor changes in all nested directories.
517517

518-
Note: The recursive option is only supported on macOS and Windows. On other platforms, it will be ignored.
518+
Note: The `recursive` option behavior depends on the backend implementation. When using the default Node.js `fs.watch()` backend, the `recursive` option is supported on all platforms (Node.js v20+). When using `@parcel/watcher` (via `NodeFileSystem/ParcelWatcher` layer), watching is always recursive on all platforms and this option is ignored.
519519

520520
Example:
521521

packages/platform/src/FileSystem.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,11 @@ export interface FileSystem {
235235
* By default, only changes to the direct children of the directory are reported.
236236
* Set the `recursive` option to `true` to watch for changes in subdirectories as well.
237237
*
238-
* Note: The `recursive` option is only supported on macOS and Windows.
239-
* On other platforms, it will be ignored.
238+
* Note: The `recursive` option behavior depends on the backend implementation:
239+
* - When using the default Node.js `fs.watch()` backend: The `recursive`
240+
* option is supported on all platforms (Node.js v20+).
241+
* - When using `@parcel/watcher` (via `NodeFileSystem/ParcelWatcher` layer):
242+
* Watching is always recursive on all platforms. This option is ignored.
240243
*/
241244
readonly watch: (path: string, options?: WatchOptions) => Stream<WatchEvent, PlatformError>
242245
/**

0 commit comments

Comments
 (0)