Fsa watch bridge improvements#1268
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the fs.watch bridging behavior across the in-memory Volume implementation and the FSA-to-Node adapter, adding better option parity (ignore patterns, abort signals, and missing-path behavior) and extending CI coverage.
Changes:
- Centralizes
watch()ignore-pattern handling into@jsonjoy.com/fs-node-utilsand uses it from bothfs-nodeandfs-fsa-to-node. - Enhances watch cancellation semantics via
AbortSignal(including improvedfs.promises.watch()AbortError behavior) and addsthrowIfNoEntrysupport for the FSA adapter. - Extends GitHub Actions checks to include Node.js
26.x.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Records the added glob-to-regex.js dependency. |
| packages/fs-node/src/volume.ts | Updates watch() overloads/options handling and reuses shared ignore matcher. |
| packages/fs-node/src/FsPromises.ts | Adjusts promises.watch() abort semantics and tests expectations. |
| packages/fs-node/src/tests/volume.test.ts | Removes as any casts now that watch() is properly overloaded. |
| packages/fs-node/src/tests/promises.test.ts | Adds stronger coverage for abort behavior and queued-event discard semantics. |
| packages/fs-node-utils/src/watchIgnore.ts | Introduces shared ignore-pattern-to-matcher utilities. |
| packages/fs-node-utils/src/types/FsCallbackApi.ts | Updates watch typing to proper overload signatures. |
| packages/fs-node-utils/src/index.ts | Exports the new watchIgnore utilities. |
| packages/fs-node-utils/package.json | Adds glob-to-regex.js dependency to support ignore patterns. |
| packages/fs-fsa-to-node/src/FsaNodeFsWatcher.ts | Adds ignore filtering and throwIfNoEntry behavior in watcher startup. |
| packages/fs-fsa-to-node/src/FsaNodeFs.ts | Wires signal, ignore, and throwIfNoEntry options through to the watcher. |
| packages/fs-fsa-to-node/src/tests/watch.test.ts | Adds coverage for signal, throwIfNoEntry, and ignore behaviors. |
| packages/fs-core/src/Node.ts | Marks Node.changes as deprecated in favor of volume-level mechanisms. |
| packages/fs-core/src/Link.ts | Marks Link.changes as deprecated in favor of volume-level mechanisms. |
| .github/workflows/checks.yml | Adds Node.js 26.x to the CI matrix. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
packages/fs-fsa-to-node/src/FsaNodeFs.ts:893
- This
watchimplementation and its option/listener function types declarefilename: string, but the watcher can emit aBufferwhenencoding: 'buffer'is selected. Align the callback types withmisc.TDataOutto match runtime behavior and the updatedFsCallbackApioverloads.
public readonly watch: FsCallbackApi['watch'] = (
path: misc.PathLike,
options?: opts.IWatchOptions | string | ((eventType: string, filename: string) => void),
listener?: (eventType: string, filename: string) => void,
): misc.IFSWatcher => {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.