TSC
TSC copied to clipboard
Publishing specs for `Buffer` and `EventEmitter`
The Buffer and EventEmitter objects in Node.js are quite possibly the most used APIs in the npm ecosystem. The buffer polyfill on npm sees over 45 million downloads per week. Deno has decided to implement an entire Node.js compatibility layer that includes both Buffer and EventEmitter. Other JavaScript runtimes (like Cloudflare Workers) that seek to support the existing ecosystem of npm modules have to make a decision about implementing these non-standard Node.js specific APIs. If they don't, they end up restricting themselves and what their users can do. While there are standardize alternatives (e.g. typed arrays and EventTarget), Buffer and EventEmitter are so broadly used as to qualify as de facto standards.
What I'd like to propose is that we publish specifications for the EventEmitter and Buffer APIs such that they can (a) be reliably implemented in other platforms with compatible semantics and (most importantly) ... (b) won't have any breaking changes made to the APIs decided unilaterally only by Node.js without seeking input from other implementing runtimes.
I'd like to get this on the TSC agenda for discussion.
It would be awesome if node also published a conformance test suite, so other implementations can verify their correctness.
I'd be very supporting for this initiative. Both Buffer and EventEmitter are so widespread in usage that a polyfill for them in browsers is often needed as well.
+1 from me as well.
For
(b) won't have any breaking changes made to the APIs decided unilaterally only by Node.js without seeking input from other implementing runtimes.
I think we'll have to define/document the review process needed for changes that would be considered breaking.
Discussed in last TSC meeting, removing agenda tag
Overall there were no objections raised on the TSC call but obviously there are many details to work through. My next step will be to draft a proposed spec for the Buffer API as a starting point, with a proposal to add a new repo to the node.js org that can be the home of API specifications. The key goal will be a stable specification for the Buffer API that can serve as a stable source of truth for that API for implementers.
@jasnell since I think this was mostly an FYI which has been accomplished a year ago, do we need the open issue in the TSC repo (just doing some cleanup). I assume any drarft specs etc. may be in a different repo/covered in other PRs.
@jasnell Was a draft published or a repo for API specifications created?