Skip to content

Commit c94f131

Browse files
committed
fixup! EventEmitter APIs implemented in v2
1 parent 01ab839 commit c94f131

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

packages/unenv-preset/src/runtime/node/process.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,32 +73,18 @@ export const {
7373
_startProfilerIdleNotifier,
7474
_stopProfilerIdleNotifier,
7575
_tickCallback,
76-
addListener,
7776
assert,
7877
availableMemory,
7978
constrainedMemory,
8079
cpuUsage,
8180
disconnect,
8281
domain,
8382
emit, // not exported from workerd but used internally
84-
eventNames,
8583
execPath,
86-
getMaxListeners,
87-
listenerCount,
88-
listeners,
8984
mainModule,
9085
moduleLoadList,
91-
off,
92-
on,
93-
once,
9486
openStdin,
95-
prependListener,
96-
prependOnceListener,
97-
rawListeners,
9887
reallyExit,
99-
removeListener,
100-
setMaxListeners,
101-
removeAllListeners,
10288
} = unenvProcess;
10389

10490
// APIs that are not implemented in `workerd` v1 and `undefined` in v2.
@@ -128,9 +114,10 @@ export const {
128114
unref,
129115
} = unenvProcess;
130116

131-
// API that are only implemented starting from v2 or workerd process
117+
// API that are only implemented starting from v2 of workerd process
132118
export const {
133119
abort,
120+
addListener,
134121
allowedNodeEnvironmentFlags,
135122
arch,
136123
argv,
@@ -139,21 +126,34 @@ export const {
139126
config,
140127
cwd,
141128
emitWarning,
129+
eventNames,
142130
execArgv,
143131
getegid,
144132
geteuid,
145133
getgid,
146134
getgroups,
135+
getMaxListeners,
147136
getuid,
148137
// @ts-expect-error `initgroups` is missing typings
149138
initgroups,
139+
listenerCount,
140+
listeners,
150141
loadEnvFile,
142+
off,
143+
on,
144+
once,
151145
pid,
152146
ppid,
147+
prependListener,
148+
prependOnceListener,
149+
rawListeners,
150+
removeAllListeners,
151+
removeListener,
153152
setegid,
154153
seteuid,
155154
setgid,
156155
setgroups,
156+
setMaxListeners,
157157
setSourceMapsEnabled,
158158
setuid,
159159
stderr,

packages/wrangler/e2e/unenv-preset/worker/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,21 @@ export const WorkerdTests: Record<string, () => void> = {
525525

526526
assert.doesNotThrow(() => p.chdir("/tmp"));
527527
assert.equal(typeof p.cwd(), "string");
528+
529+
assert.equal(typeof p.addListener, "function");
530+
assert.equal(typeof p.eventNames, "function");
531+
assert.equal(typeof p.getMaxListeners, "function");
532+
assert.equal(typeof p.listenerCount, "function");
533+
assert.equal(typeof p.listeners, "function");
534+
assert.equal(typeof p.off, "function");
535+
assert.equal(typeof p.on, "function");
536+
assert.equal(typeof p.once, "function");
537+
assert.equal(typeof p.prependListener, "function");
538+
assert.equal(typeof p.prependOnceListener, "function");
539+
assert.equal(typeof p.rawListeners, "function");
540+
assert.equal(typeof p.removeAllListeners, "function");
541+
assert.equal(typeof p.removeListener, "function");
542+
assert.equal(typeof p.setMaxListeners, "function");
528543
}
529544
},
530545
};

0 commit comments

Comments
 (0)