From cb2c3cac95b4eb7dbb483fcd39baa59157e31d7a Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 24 Mar 2021 02:00:03 +0000 Subject: [PATCH] Move root tags to /constants --- .../react-noop-renderer/src/createReactNoop.js | 7 +++++-- packages/react-reconciler/constants.js | 2 +- .../src/ReactReconcilerConstants.js | 18 ++++++++++++++++++ scripts/rollup/modules.js | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 packages/react-reconciler/src/ReactReconcilerConstants.js diff --git a/packages/react-noop-renderer/src/createReactNoop.js b/packages/react-noop-renderer/src/createReactNoop.js index 0475088a0a838..1f90af7bac00f 100644 --- a/packages/react-noop-renderer/src/createReactNoop.js +++ b/packages/react-noop-renderer/src/createReactNoop.js @@ -21,8 +21,11 @@ import type {RootTag} from 'react-reconciler/src/ReactRootTags'; import * as Scheduler from 'scheduler/unstable_mock'; import {REACT_FRAGMENT_TYPE, REACT_ELEMENT_TYPE} from 'shared/ReactSymbols'; -import {ConcurrentRoot, LegacyRoot} from 'react-reconciler/src/ReactRootTags'; -import {DefaultEventPriority} from 'react-reconciler/constants'; +import { + DefaultEventPriority, + ConcurrentRoot, + LegacyRoot, +} from 'react-reconciler/constants'; import ReactSharedInternals from 'shared/ReactSharedInternals'; import enqueueTask from 'shared/enqueueTask'; diff --git a/packages/react-reconciler/constants.js b/packages/react-reconciler/constants.js index fba59ba132ec2..c98f17cf9cc07 100644 --- a/packages/react-reconciler/constants.js +++ b/packages/react-reconciler/constants.js @@ -9,4 +9,4 @@ 'use strict'; -export * from './src/ReactEventPriorities'; +export * from './src/ReactReconcilerConstants'; diff --git a/packages/react-reconciler/src/ReactReconcilerConstants.js b/packages/react-reconciler/src/ReactReconcilerConstants.js new file mode 100644 index 0000000000000..ce41e42dc0b2f --- /dev/null +++ b/packages/react-reconciler/src/ReactReconcilerConstants.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +// These are semi-public constants exposed to any third-party renderers. +// Only expose the minimal subset necessary to implement a host config. + +export { + DiscreteEventPriority, + ContinuousEventPriority, + DefaultEventPriority, +} from './ReactEventPriorities'; +export {ConcurrentRoot, LegacyRoot} from './ReactRootTags'; diff --git a/scripts/rollup/modules.js b/scripts/rollup/modules.js index 80c0a6c2cddbe..1585e307aa7b4 100644 --- a/scripts/rollup/modules.js +++ b/scripts/rollup/modules.js @@ -16,6 +16,7 @@ const importSideEffects = Object.freeze({ 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface': HAS_NO_SIDE_EFFECTS_ON_IMPORT, scheduler: HAS_NO_SIDE_EFFECTS_ON_IMPORT, 'scheduler/tracing': HAS_NO_SIDE_EFFECTS_ON_IMPORT, + react: HAS_NO_SIDE_EFFECTS_ON_IMPORT, 'react-dom/server': HAS_NO_SIDE_EFFECTS_ON_IMPORT, 'react/jsx-dev-runtime': HAS_NO_SIDE_EFFECTS_ON_IMPORT, 'react-fetch/node': HAS_NO_SIDE_EFFECTS_ON_IMPORT,