Skip to content

Commit

Permalink
Remove knowledge of fbjs from the packager
Browse files Browse the repository at this point in the history
Summary:Follow-up to facebook#5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes facebook#5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
  • Loading branch information
davidaurelio authored and pglotov committed Mar 15, 2016
1 parent a1fd382 commit e554ac6
Show file tree
Hide file tree
Showing 98 changed files with 232 additions and 402 deletions.
8 changes: 5 additions & 3 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/Promise.js
.*/node_modules/fbjs/lib/fetch.js
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
.*/node_modules/fbjs/lib/isEmpty.js
.*/node_modules/fbjs/lib/crc32.js
.*/node_modules/fbjs/lib/ErrorUtils.js

# Flow has a built-in definition for the 'react' module which we prefer to use
Expand All @@ -28,6 +25,11 @@
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js

.*/__mocks__/.*
.*/__tests__/.*

.*/commoner/test/source/widget/share.js

# Ignore commoner tests
.*/node_modules/commoner/test/.*

Expand Down
2 changes: 1 addition & 1 deletion Examples/Movies/SearchScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var {
} = React;
var TimerMixin = require('react-timer-mixin');

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var dismissKeyboard = require('dismissKeyboard');

var MovieCell = require('./MovieCell');
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/createExamplePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var ReactNative = require('ReactNative');
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

import type { Example, ExampleModule } from 'ExampleTypes';

Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/IntegrationTestHarnessTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
'use strict';

var requestAnimationFrame = require('requestAnimationFrame');
var requestAnimationFrame = require('fbjs/lib/requestAnimationFrame');
var React = require('react-native');
var {
Text,
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/LoggingTestModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

var BatchedBridge = require('BatchedBridge');

var warning = require('warning');
var invariant = require('invariant');
var warning = require('fbjs/lib/warning');
var invariant = require('fbjs/lib/invariant');

var LoggingTestModule = {
logToConsole: function(str) {
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/SimpleSnapshotTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'use strict';

var React = require('react-native');
var requestAnimationFrame = require('requestAnimationFrame');
var requestAnimationFrame = require('fbjs/lib/requestAnimationFrame');

var {
StyleSheet,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ActionSheetIOS/ActionSheetIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

var RCTActionSheetManager = require('NativeModules').ActionSheetManager;

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var processColor = require('processColor');

var ActionSheetIOS = {
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ var SpringConfig = require('SpringConfig');
var ViewStylePropTypes = require('ViewStylePropTypes');

var flattenStyle = require('flattenStyle');
var invariant = require('invariant');
var requestAnimationFrame = require('requestAnimationFrame');
var invariant = require('fbjs/lib/invariant');
var requestAnimationFrame = require('fbjs/lib/requestAnimationFrame');

import type { InterpolationConfigType } from 'Interpolation';

Expand Down
2 changes: 1 addition & 1 deletion Libraries/AppRegistry/AppRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
var BatchedBridge = require('BatchedBridge');
var ReactNative = require('ReactNative');

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var renderApplication = require('renderApplication');

if (__DEV__) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/AppState/AppState.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
var RCTAppState = NativeModules.AppState;

var logError = require('logError');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

var _eventHandlers = {
change: new Map(),
Expand Down
2 changes: 1 addition & 1 deletion Libraries/AppStateIOS/AppStateIOS.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var warning = require('warning');
var warning = require('fbjs/lib/warning');

class AppStateIOS {

Expand Down
2 changes: 1 addition & 1 deletion Libraries/AppStateIOS/AppStateIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
var RCTAppState = NativeModules.AppState;

var logError = require('logError');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

var _eventHandlers = {
change: new Map(),
Expand Down
2 changes: 1 addition & 1 deletion Libraries/CameraRoll/CameraRoll.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var RCTCameraRollManager = require('NativeModules').CameraRollManager;
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
var deepFreezeAndThrowOnMutationInDev =
require('deepFreezeAndThrowOnMutationInDev');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

var GROUP_TYPES_OPTIONS = [
'Album',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var warning = require('warning');
var warning = require('fbjs/lib/warning');

const DatePickerAndroid = {
async open(options: Object): Promise<Object> {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Intent/IntentAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'use strict';

var Linking = require('Linking');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

/**
* NOTE: `IntentAndroid` is being deprecated. Use `Linking` instead.
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Navigation/NavigatorIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var StaticContainer = require('StaticContainer.react');
var StyleSheet = require('StyleSheet');
var View = require('View');

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var logError = require('logError');
var requireNativeComponent = require('requireNativeComponent');
var resolveAssetSource = require('resolveAssetSource');
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/ScrollResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var UIManager = require('UIManager');

var { ScrollViewManager } = require('NativeModules');

var invariant = require('invariant');
var warning = require('warning');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');

import type ReactComponent from 'ReactComponent';

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var deprecatedPropType = require('deprecatedPropType');
var dismissKeyboard = require('dismissKeyboard');
var flattenStyle = require('flattenStyle');
var insetsDiffer = require('insetsDiffer');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var pointsDiffer = require('pointsDiffer');
var requireNativeComponent = require('requireNativeComponent');
var processDecelerationRate = require('processDecelerationRate');
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ var UIManager = require('UIManager');
var View = require('View');

var createReactNativeComponentClass = require('createReactNativeComponentClass');
var emptyFunction = require('emptyFunction');
var invariant = require('invariant');
var emptyFunction = require('fbjs/lib/emptyFunction');
var invariant = require('fbjs/lib/invariant');
var requireNativeComponent = require('requireNativeComponent');

var onlyMultiline = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var warning = require('warning');
var warning = require('fbjs/lib/warning');

const TimePickerAndroid = {
async open(options: Object): Promise<Object> {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/ToastAndroid/ToastAndroid.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var warning = require('warning');
var warning = require('fbjs/lib/warning');

var ToastAndroid = {

Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/Touchable/Touchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

var BoundingDimensions = require('BoundingDimensions');
var Position = require('Position');
var TouchEventUtils = require('TouchEventUtils');
var TouchEventUtils = require('fbjs/lib/TouchEventUtils');

var keyMirror = require('keyMirror');
var keyMirror = require('fbjs/lib/keyMirror');
var queryLayoutByID = require('queryLayoutByID');

/**
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Touchable/TouchableHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var View = require('View');

var ensureComponentIsNative = require('ensureComponentIsNative');
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
var keyOf = require('keyOf');
var keyOf = require('fbjs/lib/keyOf');
var merge = require('merge');
var onlyChild = require('onlyChild');

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Touchable/TouchableWithoutFeedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var TimerMixin = require('react-timer-mixin');
var Touchable = require('Touchable');
var View = require('View');
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var onlyChild = require('onlyChild');

type Event = Object;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Touchable/ensureComponentIsNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

var ensureComponentIsNative = function(component: any) {
invariant(
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/Touchable/ensurePositiveDelayProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

var ensurePositiveDelayProps = function(props: any) {
invariant(
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/View/ReactNativeStyleAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var ImageStylePropTypes = require('ImageStylePropTypes');
var TextStylePropTypes = require('TextStylePropTypes');
var ViewStylePropTypes = require('ViewStylePropTypes');

var keyMirror = require('keyMirror');
var keyMirror = require('fbjs/lib/keyMirror');
var matricesDiffer = require('matricesDiffer');
var processColor = require('processColor');
var processTransform = require('processTransform');
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/WebView/WebView.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var UIManager = require('UIManager');
var View = require('View');

var deprecatedPropType = require('deprecatedPropType');
var keyMirror = require('keyMirror');
var keyMirror = require('fbjs/lib/keyMirror');
var merge = require('merge');
var requireNativeComponent = require('requireNativeComponent');
var resolveAssetSource = require('resolveAssetSource');
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/WebView/WebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var View = require('View');
var ScrollView = require('ScrollView');

var deprecatedPropType = require('deprecatedPropType');
var invariant = require('invariant');
var keyMirror = require('keyMirror');
var invariant = require('fbjs/lib/invariant');
var keyMirror = require('fbjs/lib/keyMirror');
var processDecelerationRate = require('processDecelerationRate');
var requireNativeComponent = require('requireNativeComponent');
var resolveAssetSource = require('resolveAssetSource');
Expand Down
4 changes: 2 additions & 2 deletions Libraries/CustomComponents/ListView/ListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var ScrollResponder = require('ScrollResponder');
var StaticRenderer = require('StaticRenderer');
var TimerMixin = require('react-timer-mixin');

var isEmpty = require('isEmpty');
var isEmpty = require('fbjs/lib/isEmpty');
var merge = require('merge');

var PropTypes = React.PropTypes;
Expand Down Expand Up @@ -247,7 +247,7 @@ var ListView = React.createClass({
},

setNativeProps: function(props) {
this.refs[SCROLLVIEW_REF] &&
this.refs[SCROLLVIEW_REF] &&
this.refs[SCROLLVIEW_REF].setNativeProps(props);
},

Expand Down
6 changes: 3 additions & 3 deletions Libraries/CustomComponents/ListView/ListViewDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
*/
'use strict';

var invariant = require('invariant');
var isEmpty = require('isEmpty');
var warning = require('warning');
var invariant = require('fbjs/lib/invariant');
var isEmpty = require('fbjs/lib/isEmpty');
var warning = require('fbjs/lib/warning');

function defaultGetRowData(
dataBlob: any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ var NavigationTreeNode = require('NavigationTreeNode');

var Set = require('Set');

var emptyFunction = require('emptyFunction');
var invariant = require('invariant');
var emptyFunction = require('fbjs/lib/emptyFunction');
var invariant = require('fbjs/lib/invariant');

import type EventSubscription from 'EventSubscription';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
'use strict';

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

class NavigationEventPool {
_list: Array<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'use strict';

var immutable = require('immutable');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');

type IterationCallback = (route: any, index: number, key: string) => void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var immutable = require('immutable');

var {List} = immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

jest
.dontMock('NavigationEvent')
.dontMock('invariant');
.dontMock('fbjs/lib/invariant');

var NavigationEvent = require('NavigationEvent');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

jest
.dontMock('EmitterSubscription')
.dontMock('EventSubscription')
.dontMock('EventEmitter')
.dontMock('EventSubscriptionVendor')
.dontMock('NavigationEvent')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

jest
.dontMock('NavigationTreeNode')
.dontMock('invariant')
.dontMock('fbjs/lib/invariant')
.dontMock('immutable');

var NavigationTreeNode = require('NavigationTreeNode');
Expand Down
2 changes: 1 addition & 1 deletion Libraries/CustomComponents/Navigator/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var View = require('View');
var clamp = require('clamp');
var deprecatedPropType = require('deprecatedPropType');
var flattenStyle = require('flattenStyle');
var invariant = require('invariant');
var invariant = require('fbjs/lib/invariant');
var rebound = require('rebound');

var PropTypes = React.PropTypes;
Expand Down
Loading

0 comments on commit e554ac6

Please sign in to comment.