Refactor: merge duplicate imports (#25489)

Co-authored-by: Jan Kassens <jan@kassens.net>
This commit is contained in:
c0dedance 2022-10-17 09:58:58 +08:00 committed by GitHub
parent bc358362a6
commit 9fb581c7cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 78 additions and 78 deletions

View File

@ -41,9 +41,9 @@ import {
LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY,
LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE,
} from './constants';
import {ElementTypeRoot} from 'react-devtools-shared/src/types';
import {ComponentFilterElementType, ElementTypeHostComponent} from './types';
import {
ElementTypeRoot,
ElementTypeClass,
ElementTypeForwardRef,
ElementTypeFunction,

View File

@ -7,7 +7,7 @@
* @flow
*/
import type {ReactContext} from 'shared/ReactTypes';
import type {ReactContext, RefObject} from 'shared/ReactTypes';
import * as React from 'react';
import {
@ -27,7 +27,6 @@ import type {
ViewState,
ReactEventInfo,
} from './types';
import type {RefObject} from 'shared/ReactTypes';
export type Context = {
file: File | null,

View File

@ -7,7 +7,7 @@
* @flow
*/
import type {Size, IntrinsicSize} from './geometry';
import type {Size, IntrinsicSize, Rect} from './geometry';
import type {
Interaction,
MouseDownInteraction,
@ -16,7 +16,6 @@ import type {
WheelPlainInteraction,
WheelWithShiftInteraction,
} from './useCanvasInteraction';
import type {Rect} from './geometry';
import type {ScrollState} from './utils/scrollState';
import type {ViewRefs} from './Surface';
import type {ViewState} from '../types';

View File

@ -7,7 +7,7 @@
* @flow
*/
import type {Size, IntrinsicSize} from './geometry';
import type {Size, IntrinsicSize, Rect} from './geometry';
import type {
Interaction,
MouseDownInteraction,
@ -15,7 +15,6 @@ import type {
MouseUpInteraction,
WheelWithShiftInteraction,
} from './useCanvasInteraction';
import type {Rect} from './geometry';
import type {ScrollState} from './utils/scrollState';
import type {ViewRefs} from './Surface';
import type {ViewState} from '../types';

View File

@ -7,10 +7,10 @@
* @flow
*/
import type {Interaction} from '../useCanvasInteraction';
import type {Rect} from '../geometry';
import type {Surface, ViewRefs} from '../Surface';
import type {
Interaction,
ClickInteraction,
MouseDownInteraction,
MouseMoveInteraction,

View File

@ -24,8 +24,8 @@ import {
getFiberFromScopeInstance,
getInstanceFromNode as getInstanceFromNodeDOMTree,
isContainerMarkedAsRoot,
detachDeletedInstance,
} from './ReactDOMComponentTree';
import {detachDeletedInstance} from './ReactDOMComponentTree';
export {detachDeletedInstance};
import {hasRole} from './DOMAccessibilityRoles';
import {

View File

@ -8,12 +8,7 @@
*/
import type {DOMEventName} from './DOMEventNames';
import {
type EventSystemFlags,
SHOULD_NOT_DEFER_CLICK_FOR_FB_SUPPORT_MODE,
IS_LEGACY_FB_SUPPORT_MODE,
SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS,
} from './EventSystemFlags';
import type {EventSystemFlags} from './EventSystemFlags';
import type {AnyNativeEvent} from './PluginModuleType';
import type {
KnownReactSyntheticEvent,
@ -23,6 +18,9 @@ import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import {allNativeEvents} from './EventRegistry';
import {
SHOULD_NOT_DEFER_CLICK_FOR_FB_SUPPORT_MODE,
IS_LEGACY_FB_SUPPORT_MODE,
SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS,
IS_CAPTURE_PHASE,
IS_EVENT_HANDLE_NON_MANAGED_NODE,
IS_NON_DELEGATED,
@ -45,7 +43,7 @@ import {
getEventListenerSet,
getEventHandlerListeners,
} from '../client/ReactDOMComponentTree';
import {COMMENT_NODE} from '../shared/HTMLNodeType';
import {COMMENT_NODE, DOCUMENT_NODE} from '../shared/HTMLNodeType';
import {batchedUpdates} from './ReactDOMUpdateBatching';
import getListener from './getListener';
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
@ -61,7 +59,6 @@ import {
invokeGuardedCallbackAndCatchFirstError,
rethrowCaughtError,
} from 'shared/ReactErrorUtils';
import {DOCUMENT_NODE} from '../shared/HTMLNodeType';
import {createEventListenerWrapperWithPriority} from './ReactDOMEventListener';
import {
removeEventListener,

View File

@ -43,10 +43,12 @@ import {
accumulateSinglePhaseListeners,
accumulateEventHandleNonManagedNodeListeners,
} from '../DOMPluginEventSystem';
import {IS_EVENT_HANDLE_NON_MANAGED_NODE} from '../EventSystemFlags';
import {
IS_EVENT_HANDLE_NON_MANAGED_NODE,
IS_CAPTURE_PHASE,
} from '../EventSystemFlags';
import getEventCharCode from '../getEventCharCode';
import {IS_CAPTURE_PHASE} from '../EventSystemFlags';
import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';

View File

@ -18,7 +18,12 @@ const {Dispatcher} = ReactDOMSharedInternals;
import {ReactDOMClientDispatcher} from 'react-dom-bindings/src/client/ReactDOMFloatClient';
import {queueExplicitHydrationTarget} from 'react-dom-bindings/src/events/ReactDOMEventReplaying';
import {REACT_ELEMENT_TYPE} from 'shared/ReactSymbols';
import {enableFloat, enableHostSingletons} from 'shared/ReactFeatureFlags';
import {
enableFloat,
enableHostSingletons,
allowConcurrentByDefault,
disableCommentsAsDOMContainers,
} from 'shared/ReactFeatureFlags';
export type RootType = {
render(children: ReactNodeList): void,
@ -73,10 +78,6 @@ import {
isAlreadyRendering,
} from 'react-reconciler/src/ReactFiberReconciler';
import {ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
import {
allowConcurrentByDefault,
disableCommentsAsDOMContainers,
} from 'shared/ReactFeatureFlags';
/* global reportError */
const defaultOnRecoverableError =

View File

@ -23,10 +23,9 @@ import {
rethrowCaughtError,
invokeGuardedCallbackAndCatchFirstError,
} from 'shared/ReactErrorUtils';
import {enableFloat} from 'shared/ReactFeatureFlags';
import {enableFloat, enableHostSingletons} from 'shared/ReactFeatureFlags';
import assign from 'shared/assign';
import isArray from 'shared/isArray';
import {enableHostSingletons} from 'shared/ReactFeatureFlags';
// Keep in sync with ReactDOM.js:
const SecretInternals =

View File

@ -23,7 +23,6 @@ import {
injectIntoDevTools,
getPublicRootInstance,
} from 'react-reconciler/src/ReactFiberReconciler';
import {getInspectorDataForInstance} from './ReactNativeFiberInspector';
import {createPortal as createPortalImpl} from 'react-reconciler/src/ReactPortal';
import {setBatchingImplementation} from './legacy-events/ReactGenericBatching';
@ -39,6 +38,7 @@ import {getClosestInstanceFromNode} from './ReactFabricComponentTree';
import {
getInspectorDataForViewTag,
getInspectorDataForViewAtPoint,
getInspectorDataForInstance,
} from './ReactNativeFiberInspector';
import {LegacyRoot, ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
import ReactSharedInternals from 'shared/ReactSharedInternals';

View File

@ -7,20 +7,24 @@
* @flow
*/
import type {AnyNativeEvent} from './legacy-events/PluginModuleType';
import type {
AnyNativeEvent,
LegacyPluginModule,
} from './legacy-events/PluginModuleType';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {LegacyPluginModule} from './legacy-events/PluginModuleType';
import type {ReactSyntheticEvent} from './legacy-events/ReactSyntheticEventType';
import type {
RNTopLevelEventType,
TopLevelType,
} from './legacy-events/TopLevelEventTypes';
import {registrationNameModules} from './legacy-events/EventPluginRegistry';
import {
registrationNameModules,
plugins,
} from './legacy-events/EventPluginRegistry';
import {batchedUpdates} from './legacy-events/ReactGenericBatching';
import accumulateInto from './legacy-events/accumulateInto';
import {plugins} from './legacy-events/EventPluginRegistry';
import getListeners from './ReactNativeGetListeners';
import {runEventsInBatch} from './legacy-events/EventBatching';

View File

@ -7,16 +7,20 @@
* @flow
*/
import type {AnyNativeEvent} from './legacy-events/PluginModuleType';
import type {
AnyNativeEvent,
LegacyPluginModule,
} from './legacy-events/PluginModuleType';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {LegacyPluginModule} from './legacy-events/PluginModuleType';
import type {ReactSyntheticEvent} from './legacy-events/ReactSyntheticEventType';
import type {TopLevelType} from './legacy-events/TopLevelEventTypes';
import {registrationNameModules} from './legacy-events/EventPluginRegistry';
import {
registrationNameModules,
plugins,
} from './legacy-events/EventPluginRegistry';
import {batchedUpdates} from './legacy-events/ReactGenericBatching';
import {runEventsInBatch} from './legacy-events/EventBatching';
import {plugins} from './legacy-events/EventPluginRegistry';
import getListeners from './ReactNativeGetListeners';
import accumulateInto from './legacy-events/accumulateInto';

View File

@ -36,12 +36,12 @@ import {
UIManager,
legacySendAccessibilityEvent,
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
import {getInspectorDataForInstance} from './ReactNativeFiberInspector';
import {getClosestInstanceFromNode} from './ReactNativeComponentTree';
import {
getInspectorDataForViewTag,
getInspectorDataForViewAtPoint,
getInspectorDataForInstance,
} from './ReactNativeFiberInspector';
import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
import ReactSharedInternals from 'shared/ReactSharedInternals';

View File

@ -11,12 +11,12 @@ import type {
ReactProviderType,
ReactContext,
ReactNodeList,
MutableSource,
} from 'shared/ReactTypes';
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {TypeOfMode} from './ReactTypeOfMode';
import type {Lanes, Lane} from './ReactFiberLane.new';
import type {MutableSource} from 'shared/ReactTypes';
import type {
SuspenseState,
SuspenseListRenderState,

View File

@ -11,12 +11,12 @@ import type {
ReactProviderType,
ReactContext,
ReactNodeList,
MutableSource,
} from 'shared/ReactTypes';
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {TypeOfMode} from './ReactTypeOfMode';
import type {Lanes, Lane} from './ReactFiberLane.old';
import type {MutableSource} from 'shared/ReactTypes';
import type {
SuspenseState,
SuspenseListRenderState,

View File

@ -15,8 +15,11 @@ import type {
ChildSet,
UpdatePayload,
} from './ReactFiberHostConfig';
import type {Fiber} from './ReactInternalTypes';
import type {FiberRoot, EventFunctionWrapper} from './ReactInternalTypes';
import type {
Fiber,
FiberRoot,
EventFunctionWrapper,
} from './ReactInternalTypes';
import type {Lanes} from './ReactFiberLane.new';
import type {SuspenseState} from './ReactFiberSuspenseComponent.new';
import type {UpdateQueue} from './ReactFiberClassUpdateQueue.new';

View File

@ -15,8 +15,11 @@ import type {
ChildSet,
UpdatePayload,
} from './ReactFiberHostConfig';
import type {Fiber} from './ReactInternalTypes';
import type {FiberRoot, EventFunctionWrapper} from './ReactInternalTypes';
import type {
Fiber,
FiberRoot,
EventFunctionWrapper,
} from './ReactInternalTypes';
import type {Lanes} from './ReactFiberLane.old';
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
import type {UpdateQueue} from './ReactFiberClassUpdateQueue.old';

View File

@ -7,7 +7,7 @@
* @flow
*/
import type {Fiber} from './ReactInternalTypes';
import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {RootState} from './ReactFiberRoot.new';
import type {Lanes, Lane} from './ReactFiberLane.new';
import type {
@ -15,7 +15,6 @@ import type {
ReactContext,
Wakeable,
} from 'shared/ReactTypes';
import type {FiberRoot} from './ReactInternalTypes';
import type {
Instance,
Type,
@ -34,6 +33,12 @@ import {
enableSuspenseAvoidThisFallback,
enableLegacyHidden,
enableHostSingletons,
enableSuspenseCallback,
enableScopeAPI,
enableProfilerTimer,
enableCache,
enableTransitionTracing,
enableFloat,
} from 'shared/ReactFeatureFlags';
import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.new';
@ -144,14 +149,6 @@ import {
hasUnhydratedTailNodes,
upgradeHydrationErrorsToRecoverable,
} from './ReactFiberHydrationContext.new';
import {
enableSuspenseCallback,
enableScopeAPI,
enableProfilerTimer,
enableCache,
enableTransitionTracing,
enableFloat,
} from 'shared/ReactFeatureFlags';
import {
renderDidSuspend,
renderDidSuspendDelayIfPossible,

View File

@ -7,7 +7,7 @@
* @flow
*/
import type {Fiber} from './ReactInternalTypes';
import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {RootState} from './ReactFiberRoot.old';
import type {Lanes, Lane} from './ReactFiberLane.old';
import type {
@ -15,7 +15,6 @@ import type {
ReactContext,
Wakeable,
} from 'shared/ReactTypes';
import type {FiberRoot} from './ReactInternalTypes';
import type {
Instance,
Type,
@ -34,6 +33,12 @@ import {
enableSuspenseAvoidThisFallback,
enableLegacyHidden,
enableHostSingletons,
enableSuspenseCallback,
enableScopeAPI,
enableProfilerTimer,
enableCache,
enableTransitionTracing,
enableFloat,
} from 'shared/ReactFeatureFlags';
import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.old';
@ -144,14 +149,6 @@ import {
hasUnhydratedTailNodes,
upgradeHydrationErrorsToRecoverable,
} from './ReactFiberHydrationContext.old';
import {
enableSuspenseCallback,
enableScopeAPI,
enableProfilerTimer,
enableCache,
enableTransitionTracing,
enableFloat,
} from 'shared/ReactFeatureFlags';
import {
renderDidSuspend,
renderDidSuspendDelayIfPossible,

View File

@ -22,6 +22,7 @@ import type {OffscreenInstance} from './ReactFiberOffscreenComponent';
import {
warnAboutUpdateOnNotYetMountedFiberInDEV,
throwIfInfiniteUpdateLoopDetected,
getWorkInProgressRoot,
} from './ReactFiberWorkLoop.new';
import {
NoLane,
@ -32,7 +33,6 @@ import {
import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
import {HostRoot, OffscreenComponent} from './ReactWorkTags';
import {OffscreenVisible} from './ReactFiberOffscreenComponent';
import {getWorkInProgressRoot} from './ReactFiberWorkLoop.new';
export type ConcurrentUpdate = {
next: ConcurrentUpdate,

View File

@ -22,6 +22,7 @@ import type {OffscreenInstance} from './ReactFiberOffscreenComponent';
import {
warnAboutUpdateOnNotYetMountedFiberInDEV,
throwIfInfiniteUpdateLoopDetected,
getWorkInProgressRoot,
} from './ReactFiberWorkLoop.old';
import {
NoLane,
@ -32,7 +33,6 @@ import {
import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
import {HostRoot, OffscreenComponent} from './ReactWorkTags';
import {OffscreenVisible} from './ReactFiberOffscreenComponent';
import {getWorkInProgressRoot} from './ReactFiberWorkLoop.old';
export type ConcurrentUpdate = {
next: ConcurrentUpdate,

View File

@ -18,6 +18,7 @@ import type {
} from 'shared/ReactTypes';
import type {
Fiber,
FiberRoot,
Dispatcher,
HookType,
MemoCache,
@ -25,7 +26,6 @@ import type {
} from './ReactInternalTypes';
import type {Lanes, Lane} from './ReactFiberLane.new';
import type {HookFlags} from './ReactHookEffectTags';
import type {FiberRoot} from './ReactInternalTypes';
import type {Flags} from './ReactFiberFlags';
import ReactSharedInternals from 'shared/ReactSharedInternals';

View File

@ -18,6 +18,7 @@ import type {
} from 'shared/ReactTypes';
import type {
Fiber,
FiberRoot,
Dispatcher,
HookType,
MemoCache,
@ -25,7 +26,6 @@ import type {
} from './ReactInternalTypes';
import type {Lanes, Lane} from './ReactFiberLane.old';
import type {HookFlags} from './ReactHookEffectTags';
import type {FiberRoot} from './ReactInternalTypes';
import type {Flags} from './ReactFiberFlags';
import ReactSharedInternals from 'shared/ReactSharedInternals';

View File

@ -7,10 +7,9 @@
* @flow
*/
import type {Fiber} from './ReactInternalTypes';
import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {ReactElement} from '../../shared/ReactElementType';
import type {Instance} from './ReactFiberHostConfig';
import type {FiberRoot} from './ReactInternalTypes';
import type {ReactNodeList} from 'shared/ReactTypes';
import {enableNewReconciler} from 'shared/ReactFeatureFlags';

View File

@ -9,18 +9,18 @@
import type {
Fiber,
FiberRoot,
SuspenseHydrationCallbacks,
TransitionTracingCallbacks,
} from './ReactInternalTypes';
import type {FiberRoot} from './ReactInternalTypes';
import type {RootTag} from './ReactRootTags';
import type {
Instance,
TextInstance,
Container,
PublicInstance,
RendererInspectionConfig,
} from './ReactFiberHostConfig';
import type {RendererInspectionConfig} from './ReactFiberHostConfig';
import type {ReactNodeList} from 'shared/ReactTypes';
import type {Lane} from './ReactFiberLane.new';
import type {SuspenseState} from './ReactFiberSuspenseComponent.new';

View File

@ -9,18 +9,18 @@
import type {
Fiber,
FiberRoot,
SuspenseHydrationCallbacks,
TransitionTracingCallbacks,
} from './ReactInternalTypes';
import type {FiberRoot} from './ReactInternalTypes';
import type {RootTag} from './ReactRootTags';
import type {
Instance,
TextInstance,
Container,
PublicInstance,
RendererInspectionConfig,
} from './ReactFiberHostConfig';
import type {RendererInspectionConfig} from './ReactFiberHostConfig';
import type {ReactNodeList} from 'shared/ReactTypes';
import type {Lane} from './ReactFiberLane.old';
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';

View File

@ -7,8 +7,7 @@
* @flow
*/
import type {Fiber} from './ReactInternalTypes';
import type {FiberRoot} from './ReactInternalTypes';
import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {Lane, Lanes} from './ReactFiberLane.new';
import type {CapturedValue} from './ReactCapturedValue';
import type {Update} from './ReactFiberClassUpdateQueue.new';

View File

@ -7,8 +7,7 @@
* @flow
*/
import type {Fiber} from './ReactInternalTypes';
import type {FiberRoot} from './ReactInternalTypes';
import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {Lane, Lanes} from './ReactFiberLane.old';
import type {CapturedValue} from './ReactCapturedValue';
import type {Update} from './ReactFiberClassUpdateQueue.old';

View File

@ -7,8 +7,7 @@
* @flow
*/
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
import type {Fiber, FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
import type {
PublicInstance,
Instance,