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

Migrate files in Libraries/Inspector to use export syntax #48931

Closed
wants to merge 1 commit into from
Closed
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-native/Libraries/Inspector/BorderBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ function BorderBox({children, box, style}: Props): React.Node {
return <View style={[borderStyle, style]}>{children}</View>;
}

module.exports = BorderBox;
export default BorderBox;
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/Inspector/BoxInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React from 'react';
const View = require('../Components/View/View');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Text = require('../Text/Text');
const resolveBoxStyle = require('./resolveBoxStyle');
const resolveBoxStyle = require('./resolveBoxStyle').default;

const blank = {
top: 0,
Expand Down Expand Up @@ -124,4 +124,4 @@ const styles = StyleSheet.create({
},
});

module.exports = BoxInspector;
export default BoxInspector;
6 changes: 3 additions & 3 deletions packages/react-native/Libraries/Inspector/ElementBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ 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 BorderBox = require('./BorderBox').default;
const resolveBoxStyle = require('./resolveBoxStyle').default;

type Props = $ReadOnly<{
frame: InspectedElementFrame,
Expand Down Expand Up @@ -147,4 +147,4 @@ function resolveSizeInPlace(
}
}

module.exports = ElementBox;
export default ElementBox;
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const flattenStyle = require('../StyleSheet/flattenStyle');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Text = require('../Text/Text');
const mapWithSeparator = require('../Utilities/mapWithSeparator');
const BoxInspector = require('./BoxInspector');
const StyleInspector = require('./StyleInspector');
const BoxInspector = require('./BoxInspector').default;
const StyleInspector = require('./StyleInspector').default;

type Props = $ReadOnly<{
hierarchy: ?InspectorData['hierarchy'],
Expand Down Expand Up @@ -120,4 +120,4 @@ const styles = StyleSheet.create({
},
});

module.exports = ElementProperties;
export default ElementProperties;
9 changes: 5 additions & 4 deletions packages/react-native/Libraries/Inspector/Inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ 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');
const InspectorPanel = require('./InspectorPanel');
const getInspectorDataForViewAtPoint =
require('./getInspectorDataForViewAtPoint').default;
const InspectorOverlay = require('./InspectorOverlay').default;
const InspectorPanel = require('./InspectorPanel').default;

const {useState} = React;

Expand Down Expand Up @@ -203,4 +204,4 @@ const styles = StyleSheet.create({
},
});

module.exports = Inspector;
export default Inspector;
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/Inspector/InspectorOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import React from 'react';

const View = require('../Components/View/View');
const StyleSheet = require('../StyleSheet/StyleSheet');
const ElementBox = require('./ElementBox');
const ElementBox = require('./ElementBox').default;

type Props = $ReadOnly<{
inspected?: ?InspectedElement,
Expand Down Expand Up @@ -63,4 +63,4 @@ const styles = StyleSheet.create({
},
});

module.exports = InspectorOverlay;
export default InspectorOverlay;
8 changes: 4 additions & 4 deletions packages/react-native/Libraries/Inspector/InspectorPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const TouchableHighlight =
const View = require('../Components/View/View');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Text = require('../Text/Text');
const ElementProperties = require('./ElementProperties');
const NetworkOverlay = require('./NetworkOverlay');
const PerformanceOverlay = require('./PerformanceOverlay');
const ElementProperties = require('./ElementProperties').default;
const NetworkOverlay = require('./NetworkOverlay').default;
const PerformanceOverlay = require('./PerformanceOverlay').default;

type Props = $ReadOnly<{
devtoolsIsOpen: boolean,
Expand Down Expand Up @@ -162,4 +162,4 @@ const styles = StyleSheet.create({
},
});

module.exports = InspectorPanel;
export default InspectorPanel;
Original file line number Diff line number Diff line change
Expand Up @@ -611,4 +611,4 @@ const styles = StyleSheet.create({
},
});

module.exports = NetworkOverlay;
export default NetworkOverlay;
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ const styles = StyleSheet.create({
},
});

module.exports = PerformanceOverlay;
export default PerformanceOverlay;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import StyleSheet from '../StyleSheet/StyleSheet';
import ElementBox from './ElementBox';
import * as React from 'react';

const getInspectorDataForViewAtPoint = require('./getInspectorDataForViewAtPoint');
const getInspectorDataForViewAtPoint =
require('./getInspectorDataForViewAtPoint').default;

const {useEffect, useState, useCallback} = React;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ const styles = StyleSheet.create({
},
});

module.exports = StyleInspector;
export default StyleInspector;
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function validateRenderers(): void {
);
}

module.exports = function getInspectorDataForViewAtPoint(
function getInspectorDataForViewAtPoint(
inspectedView: ?HostInstance,
locationX: number,
locationY: number,
Expand Down Expand Up @@ -78,4 +78,6 @@ module.exports = function getInspectorDataForViewAtPoint(
);
}
}
};
}

export default getInspectorDataForViewAtPoint;
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ function resolveBoxStyle(
return hasParts ? result : null;
}

module.exports = resolveBoxStyle;
export default resolveBoxStyle;
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const InspectorDeferred = ({
}: InspectorDeferredProps) => {
// D39382967 adds a require cycle: InitializeCore -> AppContainer -> Inspector -> InspectorPanel -> ScrollView -> InitializeCore
// We can't remove it yet, fallback to dynamic require for now. This is the only reason why this logic is in a separate function.
const Inspector = require('../Inspector/Inspector');
const Inspector = require('../Inspector/Inspector').default;

return (
<Inspector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5113,7 +5113,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/Border
style?: ViewStyleProp,
}>;
declare function BorderBox(Props): React.Node;
declare module.exports: BorderBox;
declare export default typeof BorderBox;
"
`;

Expand All @@ -5123,7 +5123,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/BoxIns
frame: ?InspectedElementFrame,
}>;
declare function BoxInspector(BoxInspectorProps): React.Node;
declare module.exports: BoxInspector;
declare export default typeof BoxInspector;
"
`;

Expand All @@ -5133,7 +5133,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/Elemen
style?: ?ViewStyleProp,
}>;
declare function ElementBox(Props): React.Node;
declare module.exports: ElementBox;
declare export default typeof ElementBox;
"
`;

Expand All @@ -5148,7 +5148,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/Elemen
declare class ElementProperties extends React.Component<Props> {
render(): React.Node;
}
declare module.exports: ElementProperties;
declare export default typeof ElementProperties;
"
`;

Expand All @@ -5165,7 +5165,7 @@ type Props = {
reactDevToolsAgent?: ReactDevToolsAgent,
};
declare function Inspector(Props): React.Node;
declare module.exports: Inspector;
declare export default typeof Inspector;
"
`;

Expand All @@ -5175,7 +5175,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/Inspec
onTouchPoint: (locationX: number, locationY: number) => void,
}>;
declare function InspectorOverlay(Props): React.Node;
declare module.exports: InspectorOverlay;
declare export default typeof InspectorOverlay;
"
`;

Expand All @@ -5199,7 +5199,7 @@ declare class InspectorPanel extends React.Component<Props> {
renderWaiting(): React.Node;
render(): React.Node;
}
declare module.exports: InspectorPanel;
declare export default typeof InspectorPanel;
"
`;

Expand Down Expand Up @@ -5256,15 +5256,15 @@ declare class NetworkOverlay extends React.Component<Props, State> {
_getRequestIndexByXHRID(index: number): number;
render(): React.Node;
}
declare module.exports: NetworkOverlay;
declare export default typeof NetworkOverlay;
"
`;

exports[`public API should not change unintentionally Libraries/Inspector/PerformanceOverlay.js 1`] = `
"declare class PerformanceOverlay extends React.Component<{ ... }> {
render(): React.Node;
}
declare module.exports: PerformanceOverlay;
declare export default typeof PerformanceOverlay;
"
`;

Expand All @@ -5282,7 +5282,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/StyleI
style?: ?____FlattenStyleProp_Internal<ViewStyleProp>,
}>;
declare function StyleInspector(Props): React.Node;
declare module.exports: StyleInspector;
declare export default typeof StyleInspector;
"
`;

Expand All @@ -5298,12 +5298,13 @@ exports[`public API should not change unintentionally Libraries/Inspector/getIns
...
},
};
declare module.exports: (
declare function getInspectorDataForViewAtPoint(
inspectedView: ?HostInstance,
locationX: number,
locationY: number,
callback: (viewData: TouchedViewDataAtPoint) => boolean
) => void;
): void;
declare export default typeof getInspectorDataForViewAtPoint;
"
`;

Expand All @@ -5317,7 +5318,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/resolv
right: number,
top: number,
}>;
declare module.exports: resolveBoxStyle;
declare export default typeof resolveBoxStyle;
"
`;

Expand Down
Loading