Skip to content

Commit e217733

Browse files
committed
chore: upgrade bufout to v1.0.0 and drop defaultMaxListeners bumps
bufout v1.0.0 keeps the number of listeners on the process and on the output streams constant regardless of how many children are spawned concurrently: a single shared exit/SIGINT listener is attached only while children are running, and every child pipes into one shared pass-through per destination stream. That removes the reason the CLIs raised EventEmitter.defaultMaxListeners to 100, so those assignments (and the now-unused node:events / node:stream imports) are gone and Node's default limit applies again, restoring the leak warning it exists to give. Verified with 80 concurrent children in both "inherit" and "buffered" mode, plus the SpawnFailure flush path, at the default limit of 10: no MaxListenersExceededWarning, and process listener counts return to zero. The public API is unchanged from 0.3.x — the major bump reflects the 1.0.0 milestone, not a breaking change to spawn/SpawnFailure. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BAjP89a9VA9EtQsVBxGcto
1 parent d9ab417 commit e217733

6 files changed

Lines changed: 22 additions & 19 deletions

File tree

.changeset/bufout-one-point-oh.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"@react-native-node-api/cli-utils": patch
3+
"react-native-node-api": patch
4+
"cmake-rn": patch
5+
"ferric-cli": patch
6+
---
7+
8+
Upgrade `bufout` to v1.0.0, which keeps the number of listeners on the process
9+
and the output streams constant regardless of how many children are spawned
10+
concurrently: a single shared `exit`/`SIGINT` listener is attached only while
11+
children are running, and every child pipes into one shared pass-through per
12+
destination stream.
13+
14+
That removes the reason for the CLIs to raise `EventEmitter.defaultMaxListeners`
15+
to 100, so those assignments are gone and Node's default limit again applies —
16+
restoring the leak warning it exists to give.

packages/cli-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@commander-js/extra-typings": "^14.0.0",
14-
"bufout": "^0.3.2",
14+
"bufout": "^1.0.0",
1515
"chalk": "^5.4.1",
1616
"commander": "^14.0.1",
1717
"ora": "^8.2.0",

packages/cmake-rn/src/cli.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import assert from "node:assert/strict";
22
import path from "node:path";
33
import fs from "node:fs";
4-
import { EventEmitter } from "node:events";
54

65
import {
76
chalk,
@@ -22,9 +21,6 @@ import {
2221
import { Platform } from "./platforms/types.js";
2322
import { getCcachePath } from "./ccache.js";
2423

25-
// We're attaching a lot of listeners when spawning in parallel
26-
EventEmitter.defaultMaxListeners = 100;
27-
2824
const verboseOption = new Option(
2925
"--verbose",
3026
"Print more output during the build",

packages/ferric/src/run.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import EventEmitter from "node:events";
2-
31
import { program } from "./program.js";
42

5-
// We're attaching a lot of listeners when spawning in parallel
6-
EventEmitter.defaultMaxListeners = 100;
7-
83
program.parseAsync(process.argv).catch(console.error);

packages/host/src/node/cli/program.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import assert from "node:assert/strict";
22
import path from "node:path";
3-
import { EventEmitter } from "node:stream";
43

54
import {
65
Command,
@@ -28,9 +27,6 @@ import { linkModules, pruneLinkedModules, ModuleLinker } from "./link-modules";
2827
import { ensureXcodeBuildPhase, createAppleLinker } from "./apple";
2928
import { linkAndroidDir } from "./android";
3029

31-
// We're attaching a lot of listeners when spawning in parallel
32-
EventEmitter.defaultMaxListeners = 100;
33-
3430
export const program = new Command("react-native-node-api").addCommand(
3531
vendorHermes,
3632
);

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)