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

Publishing specs for Buffer and EventEmitter #1176

Closed
jasnell opened this issue Feb 22, 2022 · 7 comments
Closed

Publishing specs for Buffer and EventEmitter #1176

jasnell opened this issue Feb 22, 2022 · 7 comments

Comments

@jasnell
Copy link
Member

jasnell commented Feb 22, 2022

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.

@ljharb
Copy link
Member

ljharb commented Feb 22, 2022

It would be awesome if node also published a conformance test suite, so other implementations can verify their correctness.

@mcollina
Copy link
Member

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.

@mhdawson
Copy link
Member

+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.

@mhdawson
Copy link
Member

Discussed in last TSC meeting, removing agenda tag

@jasnell
Copy link
Member Author

jasnell commented Apr 14, 2022

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.

@mhdawson
Copy link
Member

@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 jasnell closed this as completed Apr 19, 2023
@arhart
Copy link

arhart commented Apr 19, 2023

@jasnell Was a draft published or a repo for API specifications created?

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

No branches or pull requests

5 participants