events: extract events file to a separate files
The reason I did this is that I want to create another PR to add a fast event emitter for the common cases and the events file is already large enough, if you want I can extract this PR to multiple PRs one for each file
Before merging needs git squash to avoid having commits in main that not working by themself
I extracted the following:
-
EventEmittertolib/internal/events/event_emitter.js -
on,once, andgetEventListenerstointernal/events/event_emitter_helpers.js -
EventEmitterAsyncResourcetolib/internal/events/event_emitter_async_resource.js
Failed to start CI
⚠ No approving reviews found ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/8861715452
CI: https://ci.nodejs.org/job/node-test-pull-request/58757/
I'm a fan of this idea, but IMO the file names could drop the event_emitter_<...> prefix, but that's only my opinion.
This would penalize startup, make back porting harder, and make git blame and git log less useful. Unless it’s getting completely rewritten I would suggest avoid moving files for moving files’ sake.
It's not for moving files' sake if the goal is to open another PR later that uses the extracted internals.
I'm working on another PR that creates a fast and slow EventEmitter after talking to @benjamingr and currently the events file is really hard to work with