@@ -18,7 +18,8 @@ import {
18
18
type ErrorWithDetail ,
19
19
default as processImpl ,
20
20
} from 'node-internal:process' ;
21
- import type processType from 'node-internal:public_process' ;
21
+ import type publicProcessType from 'node-internal:public_process' ;
22
+ import type legacyProcessType from 'node-internal:legacy_process' ;
22
23
23
24
export const platform = processImpl . platform ;
24
25
@@ -304,7 +305,9 @@ export function emitWarning(
304
305
// Emit the warning event on the process object
305
306
// Use nextTick to ensure the warning is emitted asynchronously
306
307
queueMicrotask ( ( ) => {
307
- process . emit ( 'warning' , err ) ;
308
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
309
+ if ( ( process as typeof publicProcessType ) . emit )
310
+ ( process as typeof publicProcessType ) . emit ( 'warning' , err ) ;
308
311
} ) ;
309
312
}
310
313
@@ -313,7 +316,9 @@ export function emitWarning(
313
316
// process module regardless of whether legacy_process or public_process was selected,
314
317
// since these are different process modules and implementations.
315
318
// Internal APIs using process should therefore import this binding.
316
- export let process : typeof processType ;
317
- export function _setProcess ( _process : typeof processType ) {
319
+ export let process : typeof legacyProcessType | typeof publicProcessType ;
320
+ export function _setProcess (
321
+ _process : typeof legacyProcessType | typeof publicProcessType
322
+ ) : void {
318
323
process = _process ;
319
324
}
0 commit comments