Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5-alpha: massive rewrite #1342

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

v5-alpha: massive rewrite #1342

wants to merge 1 commit into from

Conversation

paulmillr
Copy link
Owner

No description provided.

// How it works now (except readdir):
// - we process first event (first change)
// - there is multiple parallel changes which we throw away
// - all changes which happened when we processed first event is lost
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing this would probably also solve the windows bug

just a recap of what that is/was:

writing a file in windows often fires two events, while it fires one on linux/mac

@43081j
Copy link
Collaborator

43081j commented Aug 21, 2024

how are things going with this @paulmillr?

will be out travelling soon but if you need a hand with anything, shout up and ill try chip in

@paulmillr
Copy link
Owner Author

I will upload new commit soon and then pause for a bit. It's too complicated. Feel free to code it.

@43081j
Copy link
Collaborator

43081j commented Aug 21, 2024

ill take a look once you push 👍

if you can leave any comments where you think stuff needs figuring out too, that'd be helpful

would be so nice for us to get this over the line some day

@paulmillr
Copy link
Owner Author

@43081j I think we should release current work as v4 and then the further refactor in this pull request as v5 when it's ready.

I want to make chokidar massively compatible for v4. Could you help me to understand what's the lowest version we support and why? Perhaps we'll use commonjs + esm hybrid for v4.

@43081j
Copy link
Collaborator

43081j commented Aug 24, 2024

that makes sense

we really should fix the windows bug at least, though. since it is an actual bug

to remind you what that is:

  • write a file
  • we start a readdirp stream and start adding children
  • meanwhile, windows fires a second event
  • the readdirp didn't finish yet, so this second event thinks the file hasn't yet been seen and fires extra events

something along the lines of that. if we can fix it, i think v4 is all good

as for lowest node version - it should still work fine on anything >=18. if we want to support lower, we could try. i guess the limitation will be what node features we use, though maybe we're not relying on any newer ones yet

@paulmillr
Copy link
Owner Author

It seems like readdirp is used with depth: 0 which means it's not recursive. So we don't even need it directly. Maybe we should just remove it.

@43081j
Copy link
Collaborator

43081j commented Aug 24, 2024

I noticed this too and have a branch where I switched to using node's recursive flag instead (if at all). But it had a few failures since it switches the logic from streams to promises so is a chunky rewrite

I agree we probably should do it at some point though

@paulmillr
Copy link
Owner Author

readdirp provides a bunch of features:

  • fileFilter, dirFilter
  • lstat
  • maybe something else

just keep this in mind. I think we can do it quickly.

@paulmillr
Copy link
Owner Author

we really should fix the windows bug at least, though. since it is an actual bug

Did it also happen in v3?

@paulmillr paulmillr changed the title v4: Massive rewrite Massive rewrite Aug 24, 2024
@43081j
Copy link
Collaborator

43081j commented Aug 25, 2024

I'm pretty sure it did since we haven't changed the logic around there

We changed tests that started to pick it up but it existed before afaict

@paulmillr
Copy link
Owner Author

paulmillr commented Aug 27, 2024

@43081j can you do a sanity check on main branch? I want to release it. Perhaps i've missed something? The tests seem to be randomly failing again.

Also, what were the improvements that you've added for the rewrite?

@43081j
Copy link
Collaborator

43081j commented Aug 28, 2024

I'll have a look. seems a fair few things changed since the last working CI run but mostly looks like formatting and types

as for what changed in the v4 work, most of it was removing the need for fsevents. we also changed it to account for inodes changing in macos (it was only Linux before, but both OSes do it). then a few changes to how ignore logic works, to simplify it

@paulmillr
Copy link
Owner Author

The CI seems to be failing because of timeouts, need to fix that as well

@paulmillr paulmillr changed the title Massive rewrite v5: massive rewrite Oct 4, 2024
@paulmillr paulmillr changed the title v5: massive rewrite v5-alpha: massive rewrite Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants