Revert ESM imports

Summary:
Changelog: [Internal] - Remove all imports back to CJS for changelog in 0.72

We are reverting these imports as it may regress perf as we don't have a recommended inlining solution for ES modules at the current time.

Reviewed By: NickGerleman

Differential Revision: D43630911

fbshipit-source-id: ff3bb80009f327c4d51dad21f2cd287ce46d5964
This commit is contained in:
Luna Wei 2023-02-28 10:23:36 -08:00 committed by Facebook GitHub Bot
parent 4b8b9cc838
commit d504fb4145
16 changed files with 17 additions and 25 deletions

View File

@ -11,9 +11,9 @@
import type {ProcessedColorValue} from '../StyleSheet/processColor';
import type {ColorValue} from '../StyleSheet/StyleSheet';
import processColor from '../StyleSheet/processColor';
import RCTActionSheetManager from './NativeActionSheetManager';
const processColor = require('../StyleSheet/processColor').default;
const invariant = require('invariant');
/**

View File

@ -20,8 +20,7 @@ export type ResolvedAssetSource = {|
import type {PackagerAsset} from '@react-native/assets-registry/registry';
import PixelRatio from '../Utilities/PixelRatio';
const PixelRatio = require('../Utilities/PixelRatio').default;
const Platform = require('../Utilities/Platform');
const {pickScale} = require('./AssetUtils');
const {

View File

@ -10,11 +10,10 @@
'use strict';
import Dimensions from '../Utilities/Dimensions';
const View = require('../Components/View/View');
const flattenStyle = require('../StyleSheet/flattenStyle');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Dimensions = require('../Utilities/Dimensions').default;
const BorderBox = require('./BorderBox');
const resolveBoxStyle = require('./resolveBoxStyle');
const React = require('react');

View File

@ -13,13 +13,12 @@
import type {TouchedViewDataAtPoint} from '../Renderer/shims/ReactNativeTypes';
import type {HostRef} from './getInspectorDataForViewAtPoint';
import Dimensions from '../Utilities/Dimensions';
const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
const View = require('../Components/View/View');
const PressabilityDebug = require('../Pressability/PressabilityDebug');
const {findNodeHandle} = require('../ReactNative/RendererProxy');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Dimensions = require('../Utilities/Dimensions').default;
const Platform = require('../Utilities/Platform');
const getInspectorDataForViewAtPoint = require('./getInspectorDataForViewAtPoint');
const InspectorOverlay = require('./InspectorOverlay');

View File

@ -13,10 +13,9 @@
import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
import type {PressEvent} from '../Types/CoreEventTypes';
import Dimensions from '../Utilities/Dimensions';
const View = require('../Components/View/View');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Dimensions = require('../Utilities/Dimensions').default;
const ElementBox = require('./ElementBox');
const React = require('react');

View File

@ -13,10 +13,10 @@
import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
import RCTNetworking from './RCTNetworking';
const BlobManager = require('../Blob/BlobManager');
const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
const RCTNetworking = require('./RCTNetworking').default;
const base64 = require('base64-js');
const EventTarget = require('event-target-shim');
const invariant = require('invariant');

View File

@ -10,10 +10,9 @@
'use strict';
import processColor from '../StyleSheet/processColor';
const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
const resolveAssetSource = require('../Image/resolveAssetSource');
const processColor = require('../StyleSheet/processColor').default;
const processColorArray = require('../StyleSheet/processColorArray');
const insetsDiffer = require('../Utilities/differ/insetsDiffer');
const matricesDiffer = require('../Utilities/differ/matricesDiffer');

View File

@ -9,9 +9,9 @@
*/
import NativeActionSheetManager from '../ActionSheetIOS/NativeActionSheetManager';
import processColor from '../StyleSheet/processColor';
import NativeShareModule from './NativeShareModule';
const processColor = require('../StyleSheet/processColor').default;
const Platform = require('../Utilities/Platform');
const invariant = require('invariant');

View File

@ -23,9 +23,8 @@ import type {
____ViewStyleProp_Internal,
} from './StyleSheetTypes';
import PixelRatio from '../Utilities/PixelRatio';
const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
const PixelRatio = require('../Utilities/PixelRatio').default;
const flatten = require('./flattenStyle');
/**

View File

@ -10,8 +10,6 @@
'use strict';
import processColor from '../processColor';
const {OS} = require('../../Utilities/Platform');
const PlatformColorAndroid =
require('../PlatformColorValueTypes.android').PlatformColor;
@ -19,6 +17,7 @@ const PlatformColorIOS =
require('../PlatformColorValueTypes.ios').PlatformColor;
const DynamicColorIOS =
require('../PlatformColorValueTypesIOS.ios').DynamicColorIOS;
const processColor = require('../processColor').default;
const platformSpecific =
OS === 'android'

View File

@ -10,7 +10,7 @@
'use strict';
import Dimensions from './Dimensions';
const Dimensions = require('./Dimensions').default;
/**
* PixelRatio class gives access to the device pixel density.

View File

@ -12,8 +12,7 @@
import type {IgnorePattern} from '../LogBox/Data/LogBoxData';
import LogBox from '../LogBox/LogBox';
const LogBox = require('../LogBox/LogBox').default;
const React = require('react');
type Props = $ReadOnly<{||}>;

View File

@ -11,8 +11,7 @@
'use strict';
import LogBox from '../../LogBox/LogBox';
const LogBox = require('../../LogBox/LogBox').default;
const YellowBox = require('../YellowBoxDeprecated');
describe('YellowBox', () => {

View File

@ -15,7 +15,8 @@
const React = require('react');
const View = require('../Libraries/Components/View/View');
import requireNativeComponent from '../Libraries/ReactNative/requireNativeComponent';
const requireNativeComponent =
require('../Libraries/ReactNative/requireNativeComponent').default;
const RCTScrollView: $FlowFixMe = requireNativeComponent('RCTScrollView');
function mockScrollView(BaseComponent: $FlowFixMe) {

View File

@ -10,7 +10,7 @@
'use strict';
const NOT_A_NATIVE_COMPONENT = `
import requireNativeComponent from 'requireNativeComponent';
const requireNativeComponent = require('requireNativeComponent').default;
export default 'Not a view config'
`;

View File

@ -127,7 +127,7 @@ export const Commands = {
`;
exports[`Babel plugin inline view configs can inline config for NotANativeComponent.js 1`] = `
"import requireNativeComponent from 'requireNativeComponent';
"const requireNativeComponent = require('requireNativeComponent').default;
export default 'Not a view config';"
`;