JS: Switch to `nullthrows` Package [1/4]

Summary:
Switches to the `nullthrows` package instead of using `fbjs/lib/nullthrows`.

The version of `nullthrows` in `fbjs` is outdated and already missing features that exist in the standalone `nullthrows` package.

Also, this mitigates the inevitable collision between `nullthrows` (as a Haste module) and `nullthrows` (as a `node_modules` dependency).

Reviewed By: zertosh

Differential Revision: D9733178

fbshipit-source-id: 1b589d48c1ed57cebf2088b796ad72e212534c0a
This commit is contained in:
Tim Yung 2018-09-10 01:33:52 -07:00 committed by Facebook Github Bot
parent 1830f9baae
commit 5023b105e4
6 changed files with 5 additions and 9 deletions

View File

@ -15,7 +15,7 @@ const React = require('React');
const {NativeComponent} = require('ReactNative'); const {NativeComponent} = require('ReactNative');
const requireNativeComponent = require('requireNativeComponent'); const requireNativeComponent = require('requireNativeComponent');
const nullthrows = require('fbjs/lib/nullthrows'); const nullthrows = require('nullthrows');
import type {ColorValue} from 'StyleSheetTypes'; import type {ColorValue} from 'StyleSheetTypes';
import type {ViewProps} from 'ViewPropTypes'; import type {ViewProps} from 'ViewPropTypes';

View File

@ -19,7 +19,7 @@ const TextInputState = require('TextInputState');
const UIManager = require('UIManager'); const UIManager = require('UIManager');
const invariant = require('fbjs/lib/invariant'); const invariant = require('fbjs/lib/invariant');
const nullthrows = require('fbjs/lib/nullthrows'); const nullthrows = require('nullthrows');
const performanceNow = require('fbjs/lib/performanceNow'); const performanceNow = require('fbjs/lib/performanceNow');
const warning = require('fbjs/lib/warning'); const warning = require('fbjs/lib/warning');

View File

@ -24,7 +24,7 @@ const clamp = require('clamp');
const deepDiffer = require('deepDiffer'); const deepDiffer = require('deepDiffer');
const infoLog = require('infoLog'); const infoLog = require('infoLog');
const invariant = require('fbjs/lib/invariant'); const invariant = require('fbjs/lib/invariant');
const nullthrows = require('fbjs/lib/nullthrows'); const nullthrows = require('nullthrows');
import type {NativeMethodsMixinType} from 'ReactNativeTypes'; import type {NativeMethodsMixinType} from 'ReactNativeTypes';

View File

@ -18,7 +18,7 @@ const Touchable = require('Touchable');
const UIManager = require('UIManager'); const UIManager = require('UIManager');
const createReactNativeComponentClass = require('createReactNativeComponentClass'); const createReactNativeComponentClass = require('createReactNativeComponentClass');
const nullthrows = require('fbjs/lib/nullthrows'); const nullthrows = require('nullthrows');
const processColor = require('processColor'); const processColor = require('processColor');
import type {PressEvent} from 'CoreEventTypes'; import type {PressEvent} from 'CoreEventTypes';

View File

@ -14,7 +14,3 @@ declare module 'fbjs/lib/invariant' {
...args: Array<any> ...args: Array<any>
) => void; ) => void;
} }
declare module 'fbjs/lib/nullthrows' {
declare module.exports: <T>(value: ?T) => T;
}

View File

@ -68,7 +68,6 @@
"node_modules/fbjs/lib/flattenArray.js", "node_modules/fbjs/lib/flattenArray.js",
"node_modules/fbjs/lib/forEachObject.js", "node_modules/fbjs/lib/forEachObject.js",
"node_modules/fbjs/lib/isEmpty.js", "node_modules/fbjs/lib/isEmpty.js",
"node_modules/fbjs/lib/nullthrows.js",
"node_modules/fbjs/lib/removeFromArray.js", "node_modules/fbjs/lib/removeFromArray.js",
"node_modules/fbjs/lib/resolveImmediate.js", "node_modules/fbjs/lib/resolveImmediate.js",
"node_modules/fbjs/lib/someObject.js", "node_modules/fbjs/lib/someObject.js",
@ -181,6 +180,7 @@
"node-fetch": "^2.2.0", "node-fetch": "^2.2.0",
"node-notifier": "^5.2.1", "node-notifier": "^5.2.1",
"npmlog": "^2.0.4", "npmlog": "^2.0.4",
"nullthrows": "^1.1.0",
"opn": "^3.0.2", "opn": "^3.0.2",
"optimist": "^0.6.1", "optimist": "^0.6.1",
"plist": "^3.0.0", "plist": "^3.0.0",