Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor React Server entrypoint to not depend on the client one #27940

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react/index.classic.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ export {
useSyncExternalStore,
useTransition,
version,
} from './src/React';
} from './src/ReactClient';
export {jsx, jsxs, jsxDEV} from './src/jsx/ReactJSX';
4 changes: 2 additions & 2 deletions packages/react/index.experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export {
useSyncExternalStore,
useTransition,
version,
} from './src/React';
} from './src/ReactClient';

import {useOptimistic} from './src/React';
import {useOptimistic} from './src/ReactClient';

export function experimental_useOptimistic<S, A>(
passthrough: S,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ export {
useState,
useTransition,
version,
} from './src/React';
} from './src/ReactClient';
2 changes: 1 addition & 1 deletion packages/react/index.modern.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ export {
useSyncExternalStore,
useTransition,
version,
} from './src/React';
} from './src/ReactClient';
export {jsx, jsxs, jsxDEV} from './src/jsx/ReactJSX';
2 changes: 1 addition & 1 deletion packages/react/index.stable.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ export {
useSyncExternalStore,
useTransition,
version,
} from './src/React';
} from './src/ReactClient';
23 changes: 4 additions & 19 deletions packages/react/src/React.js → packages/react/src/ReactClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {Component, PureComponent} from './ReactBaseClasses';
import {createRef} from './ReactCreateRef';
import {forEach, map, count, toArray, only} from './ReactChildren';
import {
createElement as createElementProd,
createFactory as createFactoryProd,
cloneElement as cloneElementProd,
createElement,
createFactory,
cloneElement,
isValidElement,
} from './ReactElement';
import {createContext} from './ReactContext';
Expand Down Expand Up @@ -61,27 +61,12 @@ import {
useMemoCache,
useOptimistic,
} from './ReactHooks';
import {
createElementWithValidation,
createFactoryWithValidation,
cloneElementWithValidation,
} from './ReactElementValidator';

import {createServerContext} from './ReactServerContext';
import ReactSharedInternals from './ReactSharedInternalsClient';
import {startTransition} from './ReactStartTransition';
import {act} from './ReactAct';

// TODO: Move this branching into the other module instead and just re-export.
const createElement: any = __DEV__
? createElementWithValidation
: createElementProd;
const cloneElement: any = __DEV__
? cloneElementWithValidation
: cloneElementProd;
const createFactory: any = __DEV__
? createFactoryWithValidation
: createFactoryProd;

const Children = {
map,
forEach,
Expand Down
Loading