-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededlet's do it
Description
Description
Since net._setSimultaneousAccepts()
is deprecated (DEP0121) and has reached End-of-Life status, we should provide a codemod to replace it.
- The codemod should remove calls to
net._setSimultaneousAccepts()
as it was an internal API. - The codemod should handle both CommonJS and ESM imports.
- The codemod should suggest alternative approaches for connection handling if needed.
- The codemod should remove this internal API usage completely.
Additional Information
Note that net._setSimultaneousAccepts()
was removed in Node.js v24.0.0. The function was deprecated because it was an internal API that was never intended for public use. This function controlled how many connections could be accepted simultaneously on Windows, but this behavior is now handled automatically by Node.js.
The net._setSimultaneousAccepts()
function was part of the internal networking implementation and its usage was not recommended or documented for public consumption.
Examples
Example 1: Remove internal API call
Before:
const net = require("node:net");
net._setSimultaneousAccepts(false);
const server = net.createServer();
After:
const net = require("node:net");
const server = net.createServer();
Example 2: Remove from server initialization
Before:
const net = require("node:net");
function createServer() {
net._setSimultaneousAccepts(true);
return net.createServer((socket) => {
// handle connection
});
}
After:
const net = require("node:net");
function createServer() {
return net.createServer((socket) => {
// handle connection
});
}
Example 3: Remove from module setup
Before:
const net = require("node:net");
net._setSimultaneousAccepts(false);
module.exports = {
createServer: () => net.createServer()
};
After:
const net = require("node:net");
module.exports = {
createServer: () => net.createServer()
};
Example 4: Remove from application startup
Before:
const net = require("node:net");
function initializeApp() {
net._setSimultaneousAccepts(true);
const server = net.createServer();
server.listen(3000);
}
After:
const net = require("node:net");
function initializeApp() {
const server = net.createServer();
server.listen(3000);
}
Example 5: ESM import cleanup
Before:
import net from "node:net";
net._setSimultaneousAccepts(false);
const server = net.createServer();
After:
import net from "node:net";
const server = net.createServer();
Example 6: Remove from configuration
Before:
const net = require("node:net");
const config = {
simultaneousAccepts: false,
port: 8080
};
function setupServer(config) {
net._setSimultaneousAccepts(config.simultaneousAccepts);
return net.createServer().listen(config.port);
}
After:
const net = require("node:net");
const config = {
port: 8080
};
function setupServer(config) {
return net.createServer().listen(config.port);
}
Refs
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededlet's do it
Type
Projects
Status
🔖 Todo