Skip to content

Commit

Permalink
[change] Organize unimplemented modules in directories
Browse files Browse the repository at this point in the history
Creates a {path}/index.js for each module that has no web
implementation. This enables the babel preset to rewrite all paths and
prevent apps from bundling unused modules.

Fix #1281
Close #1282
  • Loading branch information
EvanBacon authored and necolas committed Mar 12, 2019
1 parent 5e9449e commit 2a418be
Show file tree
Hide file tree
Showing 32 changed files with 107 additions and 33 deletions.
30 changes: 30 additions & 0 deletions packages/babel-plugin-react-native-web/src/moduleMap.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,95 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
module.exports = {
AccessibilityInfo: true,
ActionSheetIOS: true,
ActivityIndicator: true,
Alert: true,
AlertIOS: true,
Animated: true,
AppRegistry: true,
AppState: true,
AsyncStorage: true,
BackHandler: true,
Button: true,
CameraRoll: true,
CheckBox: true,
Clipboard: true,
ColorPropType: true,
DatePickerAndroid: true,
DatePickerIOS: true,
DeviceInfo: true,
Dimensions: true,
DrawerLayoutAndroid: true,
Easing: true,
EdgeInsetsPropType: true,
FlatList: true,
I18nManager: true,
Image: true,
ImageBackground: true,
ImageEditor: true,
ImagePickerIOS: true,
ImageStore: true,
InputAccessoryView: true,
InteractionManager: true,
Keyboard: true,
KeyboardAvoidingView: true,
LayoutAnimation: true,
Linking: true,
ListView: true,
MaskedViewIOS: true,
Modal: true,
NativeEventEmitter: true,
NativeModules: true,
NavigatorIOS: true,
NetInfo: true,
PanResponder: true,
PermissionsAndroid: true,
Picker: true,
PickerIOS: true,
PixelRatio: true,
Platform: true,
PointPropType: true,
ProgressBar: true,
ProgressBarAndroid: true,
ProgressViewIOS: true,
PushNotificationIOS: true,
RefreshControl: true,
SafeAreaView: true,
ScrollView: true,
SectionList: true,
SegmentedControlIOS: true,
Settings: true,
Share: true,
Slider: true,
SnapshotViewIOS: true,
StatusBar: true,
StatusBarIOS: true,
StyleSheet: true,
SwipeableFlatList: true,
SwipeableListView: true,
Switch: true,
Systrace: true,
TVEventHandler: true,
TabBarIOS: true,
Text: true,
TextInput: true,
TextPropTypes: true,
TimePickerAndroid: true,
ToastAndroid: true,
ToolbarAndroid: true,
Touchable: true,
TouchableHighlight: true,
TouchableNativeFeedback: true,
TouchableOpacity: true,
TouchableWithoutFeedback: true,
UIManager: true,
Vibration: true,
VibrationIOS: true,
View: true,
ViewPagerAndroid: true,
ViewPropTypes: true,
VirtualizedList: true,
WebView: true,
YellowBox: true,
createElement: true,
findNodeHandle: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/AlertIOS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/CameraRoll/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/DatePickerIOS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/ImageEditor/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/ImageStore/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/MaskedViewIOS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/NavigatorIOS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/PickerIOS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/Settings/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/Systrace/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/TabBarIOS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/ToastAndroid/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/ToolbarAndroid/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/WebView/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UnimplementedView from '../../modules/UnimplementedView';
export default UnimplementedView;
63 changes: 30 additions & 33 deletions packages/react-native-web/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import UnimplementedView from './modules/UnimplementedView';

import createElement from './exports/createElement';
import findNodeHandle from './exports/findNodeHandle';
import processColor from './exports/processColor';
Expand Down Expand Up @@ -73,39 +71,38 @@ import ColorPropType from './exports/ColorPropType';
import EdgeInsetsPropType from './exports/EdgeInsetsPropType';
import PointPropType from './exports/PointPropType';

const emptyObject = {};
// compat (components)
const DatePickerIOS = UnimplementedView;
const DrawerLayoutAndroid = UnimplementedView;
const ImageEditor = UnimplementedView;
const ImageStore = UnimplementedView;
const InputAccessoryView = UnimplementedView;
const MaskedViewIOS = UnimplementedView;
const NavigatorIOS = UnimplementedView;
const PickerIOS = Picker;
const ProgressBarAndroid = UnimplementedView;
const ProgressViewIOS = UnimplementedView;
const SegmentedControlIOS = UnimplementedView;
const SnapshotViewIOS = UnimplementedView;
const TabBarIOS = UnimplementedView;
const ToastAndroid = UnimplementedView;
const ToolbarAndroid = UnimplementedView;
const ViewPagerAndroid = UnimplementedView;
const WebView = UnimplementedView;
import DatePickerIOS from './exports/DatePickerIOS';
import DrawerLayoutAndroid from './exports/DrawerLayoutAndroid';
import ImageEditor from './exports/ImageEditor';
import ImageStore from './exports/ImageStore';
import InputAccessoryView from './exports/InputAccessoryView';
import MaskedViewIOS from './exports/MaskedViewIOS';
import NavigatorIOS from './exports/NavigatorIOS';
import PickerIOS from './exports/PickerIOS';
import ProgressBarAndroid from './exports/ProgressBarAndroid';
import ProgressViewIOS from './exports/ProgressViewIOS';
import SegmentedControlIOS from './exports/SegmentedControlIOS';
import SnapshotViewIOS from './exports/SnapshotViewIOS';
import TabBarIOS from './exports/TabBarIOS';
import ToastAndroid from './exports/ToastAndroid';
import ToolbarAndroid from './exports/ToolbarAndroid';
import ViewPagerAndroid from './exports/ViewPagerAndroid';
import WebView from './exports/WebView';
// compat (apis)
const ActionSheetIOS = emptyObject;
const AlertIOS = emptyObject;
const CameraRoll = emptyObject;
const DatePickerAndroid = emptyObject;
const ImagePickerIOS = emptyObject;
const PermissionsAndroid = emptyObject;
const PushNotificationIOS = emptyObject;
const Settings = emptyObject;
const StatusBarIOS = emptyObject;
const Systrace = emptyObject;
const TimePickerAndroid = emptyObject;
const TVEventHandler = emptyObject;
const VibrationIOS = emptyObject;
import ActionSheetIOS from './exports/ActionSheetIOS';
import AlertIOS from './exports/AlertIOS';
import CameraRoll from './exports/CameraRoll';
import DatePickerAndroid from './exports/DatePickerAndroid';
import ImagePickerIOS from './exports/ImagePickerIOS';
import PermissionsAndroid from './exports/PermissionsAndroid';
import PushNotificationIOS from './exports/PushNotificationIOS';
import Settings from './exports/Settings';
import StatusBarIOS from './exports/StatusBarIOS';
import Systrace from './exports/Systrace';
import TimePickerAndroid from './exports/TimePickerAndroid';
import TVEventHandler from './exports/TVEventHandler';
import VibrationIOS from './exports/VibrationIOS';

export {
// top-level API
Expand Down

0 comments on commit 2a418be

Please sign in to comment.