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

js: de-class-ify node:net.Socket #17997

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

js: de-class-ify node:net.Socket #17997

wants to merge 1 commit into from

Conversation

nektro
Copy link
Member

@nektro nektro commented Mar 8, 2025

No description provided.

@robobun
Copy link

robobun commented Mar 8, 2025

Updated 12:19 AM PT - Mar 8th, 2025

@nektro, your commit 4203c0c has 4 failures in Build #12897:


🧪   try this PR locally:

bunx bun-pr 17997

if (typeof onread !== "object") {
throw new TypeError("onread must be an object");
}
if (typeof onread.callback !== "function") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should it be validateFunction

}
if (
// TLSSocket already created a socket and is forwarding it here. This is a private API.
!(socket && $isObject(socket) && socket instanceof Duplex) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a way to avoid the instanceof

return this;
};

Object.defineProperty(Socket.prototype, "remoteAddress", {
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these also read only in node?

@@ -1470,7 +1452,7 @@ Server.prototype.listen = function listen(port, hostname, onListen) {
tls.rejectUnauthorized = false;
}
} else {
options.InternalSocketClass = SocketClass;
options.InternalSocketClass = Socket;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a real thing? InternalSocketClass? If this was ment as an internal api, can we use a symbol?

@@ -1726,7 +1708,7 @@ export default {
isIPv4,
isIPv6,
Socket,
[Symbol.for("::bunternal::")]: SocketClass,
[Symbol.for("::bunternal::")]: Socket,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we remove this symbol now that we have private symbols?

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.

3 participants