Skip to content

Commit

Permalink
Revert ESM imports
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lunaleaps authored and facebook-github-bot committed Feb 28, 2023
1 parent 4b8b9cc commit d504fb4
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Libraries/ActionSheetIOS/ActionSheetIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Image/AssetSourceResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Inspector/ElementBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Inspector/Inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Inspector/InspectorOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Network/XMLHttpRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 1 addition & 2 deletions Libraries/ReactNative/getNativeComponentAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Share/Share.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
3 changes: 1 addition & 2 deletions Libraries/StyleSheet/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down
3 changes: 1 addition & 2 deletions Libraries/StyleSheet/__tests__/processColor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@

'use strict';

import processColor from '../processColor';

const {OS} = require('../../Utilities/Platform');
const PlatformColorAndroid =
require('../PlatformColorValueTypes.android').PlatformColor;
const PlatformColorIOS =
require('../PlatformColorValueTypes.ios').PlatformColor;
const DynamicColorIOS =
require('../PlatformColorValueTypesIOS.ios').DynamicColorIOS;
const processColor = require('../processColor').default;

const platformSpecific =
OS === 'android'
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/PixelRatio.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

import Dimensions from './Dimensions';
const Dimensions = require('./Dimensions').default;

/**
* PixelRatio class gives access to the device pixel density.
Expand Down
3 changes: 1 addition & 2 deletions Libraries/YellowBox/YellowBoxDeprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<{||}>;
Expand Down
3 changes: 1 addition & 2 deletions Libraries/YellowBox/__tests__/YellowBoxDeprecated-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

'use strict';

import LogBox from '../../LogBox/LogBox';

const LogBox = require('../../LogBox/LogBox').default;
const YellowBox = require('../YellowBoxDeprecated');

describe('YellowBox', () => {
Expand Down
3 changes: 2 additions & 1 deletion jest/mockScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';"
`;
Expand Down

0 comments on commit d504fb4

Please sign in to comment.