Skip to content

Commit a187226

Browse files
committed
Remove async_hook from global indirection
We're not going to use this.
1 parent 3ee11d4 commit a187226

8 files changed

+1
-51
lines changed

packages/react-server/src/ReactFlightServerConfigDebugNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
} from './ReactFlightAsyncSequence';
1616

1717
import {IO_NODE, PROMISE_NODE, AWAIT_NODE} from './ReactFlightAsyncSequence';
18-
import {createAsyncHook, executionAsyncId} from './ReactFlightServerConfig';
18+
import {createAsyncHook, executionAsyncId} from 'async_hooks';
1919
import {enableAsyncDebugInfo} from 'shared/ReactFeatureFlags';
2020

2121
const pendingOperations: Map<number, AsyncSequence> =

packages/react-server/src/forks/ReactFlightServerConfig.dom-edge-parcel.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ export const supportsComponentStorage: boolean =
2222
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
2323
supportsComponentStorage ? new AsyncLocalStorage() : (null: any);
2424

25-
// We use the Node version but get access to async_hooks from a global.
26-
import type {HookCallbacks, AsyncHook} from 'async_hooks';
27-
export const createAsyncHook: HookCallbacks => AsyncHook =
28-
typeof async_hooks === 'object'
29-
? async_hooks.createHook
30-
: function () {
31-
return ({
32-
enable() {},
33-
disable() {},
34-
}: any);
35-
};
36-
export const executionAsyncId: () => number =
37-
typeof async_hooks === 'object' ? async_hooks.executionAsyncId : (null: any);
38-
3925
export * from '../ReactFlightServerConfigDebugNoop';
4026

4127
export * from '../ReactFlightStackConfigV8';

packages/react-server/src/forks/ReactFlightServerConfig.dom-edge-turbopack.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ export const supportsComponentStorage: boolean =
2222
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
2323
supportsComponentStorage ? new AsyncLocalStorage() : (null: any);
2424

25-
// We use the Node version but get access to async_hooks from a global.
26-
import type {HookCallbacks, AsyncHook} from 'async_hooks';
27-
export const createAsyncHook: HookCallbacks => AsyncHook =
28-
typeof async_hooks === 'object'
29-
? async_hooks.createHook
30-
: function () {
31-
return ({
32-
enable() {},
33-
disable() {},
34-
}: any);
35-
};
36-
export const executionAsyncId: () => number =
37-
typeof async_hooks === 'object' ? async_hooks.executionAsyncId : (null: any);
38-
3925
export * from '../ReactFlightServerConfigDebugNoop';
4026

4127
export * from '../ReactFlightStackConfigV8';

packages/react-server/src/forks/ReactFlightServerConfig.dom-edge.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,6 @@ export const supportsComponentStorage: boolean =
2323
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
2424
supportsComponentStorage ? new AsyncLocalStorage() : (null: any);
2525

26-
// We use the Node version but get access to async_hooks from a global.
27-
import type {HookCallbacks, AsyncHook} from 'async_hooks';
28-
export const createAsyncHook: HookCallbacks => AsyncHook =
29-
typeof async_hooks === 'object'
30-
? async_hooks.createHook
31-
: function () {
32-
return ({
33-
enable() {},
34-
disable() {},
35-
}: any);
36-
};
37-
export const executionAsyncId: () => number =
38-
typeof async_hooks === 'object' ? async_hooks.executionAsyncId : (null: any);
39-
4026
export * from '../ReactFlightServerConfigDebugNoop';
4127

4228
export * from '../ReactFlightStackConfigV8';

packages/react-server/src/forks/ReactFlightServerConfig.dom-node-esm.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export const supportsComponentStorage = __DEV__;
2323
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
2424
supportsComponentStorage ? new AsyncLocalStorage() : (null: any);
2525

26-
export {createHook as createAsyncHook, executionAsyncId} from 'async_hooks';
27-
2826
export * from '../ReactFlightServerConfigDebugNode';
2927

3028
export * from '../ReactFlightStackConfigV8';

packages/react-server/src/forks/ReactFlightServerConfig.dom-node-parcel.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export const supportsComponentStorage = __DEV__;
2323
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
2424
supportsComponentStorage ? new AsyncLocalStorage() : (null: any);
2525

26-
export {createHook as createAsyncHook, executionAsyncId} from 'async_hooks';
27-
2826
export * from '../ReactFlightServerConfigDebugNode';
2927

3028
export * from '../ReactFlightStackConfigV8';

packages/react-server/src/forks/ReactFlightServerConfig.dom-node-turbopack.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export const supportsComponentStorage = __DEV__;
2323
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
2424
supportsComponentStorage ? new AsyncLocalStorage() : (null: any);
2525

26-
export {createHook as createAsyncHook, executionAsyncId} from 'async_hooks';
27-
2826
export * from '../ReactFlightServerConfigDebugNode';
2927

3028
export * from '../ReactFlightStackConfigV8';

packages/react-server/src/forks/ReactFlightServerConfig.dom-node.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export const supportsComponentStorage = __DEV__;
2323
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
2424
supportsComponentStorage ? new AsyncLocalStorage() : (null: any);
2525

26-
export {createHook as createAsyncHook, executionAsyncId} from 'async_hooks';
27-
2826
export * from '../ReactFlightServerConfigDebugNode';
2927

3028
export * from '../ReactFlightStackConfigV8';

0 commit comments

Comments
 (0)