chore: Replace events npm package with native ESM EventEmitter implementation#3657
Closed
marshallswain wants to merge 2 commits intov6from
Closed
chore: Replace events npm package with native ESM EventEmitter implementation#3657marshallswain wants to merge 2 commits intov6from
marshallswain wants to merge 2 commits intov6from
Conversation
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.
Replaces the
eventsnpm package (a CJS browserify polyfill) with a lightweight, pure ESMEventEmitterwritten in TypeScript. This fixes compatibility issues with Node 24's stricter ESM/CJS interop.Problem:
The
[email protected]npm package is CommonJS. In Node 24, the tightened CJS named export detection causesimport { EventEmitter } from 'events'to fail when it resolves to the npm polyfill instead of the Node built-in.Solution:
EventEmitterimplementation directly inevents.tsObject.assignmixin pattern continues to work__eventsinitialization supports both class inheritance and mixin usageeventsnpm dependency frompackage.jsonChannelinterface now extendsEventEmitterfor proper typingAPI surface implemented:
on,addListener,once,off,removeListener,removeAllListeners,emit,listenerCount,listenersFiles changed (8):
packages/feathers/src/events.ts— EventEmitter implementation + existing event hookspackages/feathers/src/events.test.ts— 18 new EventEmitter unit tests merged with existing service event testspackages/feathers/src/application.ts— import updatepackages/feathers/src/channel/base.ts— import updatepackages/feathers/src/declarations.ts— import update,Channelinterface extendsEventEmitterpackages/feathers/src/service.ts— inlined emitter method names inprotectedMethodspackages/feathers/src/index.ts— exportsEventEmitterpackages/feathers/package.json— removedeventsdependencyTests: 371 passed, 1 skipped (pre-existing). TypeScript clean.