From 5023b105e4306d2e7a4087098897bf9b58b2ac9b Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Mon, 10 Sep 2018 01:33:52 -0700 Subject: [PATCH] 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 --- Libraries/Components/RefreshControl/RefreshControl.js | 2 +- Libraries/Components/ScrollResponder.js | 2 +- Libraries/Experimental/WindowedListView.js | 2 +- Libraries/Text/Text.js | 2 +- flow/fbjs.js | 4 ---- package.json | 2 +- 6 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index 9b287cc4a..57d381d4e 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -15,7 +15,7 @@ const React = require('React'); const {NativeComponent} = require('ReactNative'); const requireNativeComponent = require('requireNativeComponent'); -const nullthrows = require('fbjs/lib/nullthrows'); +const nullthrows = require('nullthrows'); import type {ColorValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; diff --git a/Libraries/Components/ScrollResponder.js b/Libraries/Components/ScrollResponder.js index 548efba80..08d627513 100644 --- a/Libraries/Components/ScrollResponder.js +++ b/Libraries/Components/ScrollResponder.js @@ -19,7 +19,7 @@ const TextInputState = require('TextInputState'); const UIManager = require('UIManager'); const invariant = require('fbjs/lib/invariant'); -const nullthrows = require('fbjs/lib/nullthrows'); +const nullthrows = require('nullthrows'); const performanceNow = require('fbjs/lib/performanceNow'); const warning = require('fbjs/lib/warning'); diff --git a/Libraries/Experimental/WindowedListView.js b/Libraries/Experimental/WindowedListView.js index 15f1d0b4a..36573558c 100644 --- a/Libraries/Experimental/WindowedListView.js +++ b/Libraries/Experimental/WindowedListView.js @@ -24,7 +24,7 @@ const clamp = require('clamp'); const deepDiffer = require('deepDiffer'); const infoLog = require('infoLog'); const invariant = require('fbjs/lib/invariant'); -const nullthrows = require('fbjs/lib/nullthrows'); +const nullthrows = require('nullthrows'); import type {NativeMethodsMixinType} from 'ReactNativeTypes'; diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index 1974dbeab..749183c3e 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -18,7 +18,7 @@ const Touchable = require('Touchable'); const UIManager = require('UIManager'); const createReactNativeComponentClass = require('createReactNativeComponentClass'); -const nullthrows = require('fbjs/lib/nullthrows'); +const nullthrows = require('nullthrows'); const processColor = require('processColor'); import type {PressEvent} from 'CoreEventTypes'; diff --git a/flow/fbjs.js b/flow/fbjs.js index 9106e436d..35ef6a98e 100644 --- a/flow/fbjs.js +++ b/flow/fbjs.js @@ -14,7 +14,3 @@ declare module 'fbjs/lib/invariant' { ...args: Array ) => void; } - -declare module 'fbjs/lib/nullthrows' { - declare module.exports: (value: ?T) => T; -} diff --git a/package.json b/package.json index 6d65d7d36..9767f7543 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "node_modules/fbjs/lib/flattenArray.js", "node_modules/fbjs/lib/forEachObject.js", "node_modules/fbjs/lib/isEmpty.js", - "node_modules/fbjs/lib/nullthrows.js", "node_modules/fbjs/lib/removeFromArray.js", "node_modules/fbjs/lib/resolveImmediate.js", "node_modules/fbjs/lib/someObject.js", @@ -181,6 +180,7 @@ "node-fetch": "^2.2.0", "node-notifier": "^5.2.1", "npmlog": "^2.0.4", + "nullthrows": "^1.1.0", "opn": "^3.0.2", "optimist": "^0.6.1", "plist": "^3.0.0",