Closed kitten closed 1 month ago
Latest commit: bdc32bd41d30e9cbf4a30b28b349f05d7e585fcf
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
It seems that ts.sys.watchFile
watchers are not unrefed. Opposite to fs.watch
watcher that are created with persistent: false
.
The unrefed watchers do not allow process to exit. That is fine for TypeScript language service, but that is troublesome in cases where gql.tada
is used as stand alone package.
I bumped into this limitation while debugging this issue: https://github.com/tstyche/tstyche/pull/276
Reproduction repo can be found here: https://github.com/tstyche/tstyche/pull/276#issuecomment-2267647218
Not sure what could be the solution. Just wanted to draw your attention.
Generally, there are some conditions under which the built-in file watcher in Node fails. It's suspected that swap-writing in some editors breaks the file watcher, for example.
@kitten The other difference previous implementation was using the async version of fs.watch
. In contrary TypeScript's watchers are wrapped around sync fs.watch
. I was experimenting with both of them while implementing watch mode for TSTyche. Indeed sometimes events were missing in the async fs.watch
.
I was wondering if you tried using the sync fs.watch
implementation instead?
Resolves #339
Summary
TODO
ts.sys.watchFile
that TypeScript itself uses (as default options were broken out of the box on macOS)This switches the SDL loader over to using
ts.sys.watchFile
in favour of other, similar file watchers that work around some issues. Generally, there are some conditions under which the built-in file watcher in Node fails. It's suspected that swap-writing in some editors breaks the file watcher, for example.Instead of working around this ourselves, we can use TypeScript's implementation, which implements all known workarounds and approaches, including polling fallbacks.
Set of changes
ts.sys.watchFile
in SDL file loader's watcher