From 54e19a6b7f217ffc0611e660f2a6b1a8ad14775b Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Fri, 28 Aug 2020 12:13:47 -0700 Subject: [PATCH] RN: Remove `fbjs` Dependency Summary: Removes `fbjs` dependency from `react-native` because it is no longer referenced. Changelog: [General][Changed] - Removed `fbjs` dependency from `react-native`. Reviewed By: cpojer Differential Revision: D23358201 fbshipit-source-id: 1945590d2e7ea853434c716a151fc1058718d471 --- .flowconfig | 4 - .flowconfig.android | 4 - Libraries/Lists/FillRateHelper.js | 2 - flow/fbjs.js | 258 ------------------------------ jest.config.js | 1 - package.json | 1 - template/_flowconfig | 4 - 7 files changed, 274 deletions(-) delete mode 100644 flow/fbjs.js diff --git a/.flowconfig b/.flowconfig index 6e5fef3567bdf2..0cdac64d51d3cd 100644 --- a/.flowconfig +++ b/.flowconfig @@ -11,10 +11,6 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; These should not be required directly -; require from fbjs/lib instead: require('fbjs/lib/warning') -.*/node_modules/warning/.* - ; Flow doesn't support platforms .*/Libraries/Utilities/LoadingView.js diff --git a/.flowconfig.android b/.flowconfig.android index 96869fca459db9..4093d3710700ed 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -11,10 +11,6 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; These should not be required directly -; require from fbjs/lib instead: require('fbjs/lib/warning') -.*/node_modules/warning/.* - ; Flow doesn't support platforms .*/Libraries/Utilities/LoadingView.js diff --git a/Libraries/Lists/FillRateHelper.js b/Libraries/Lists/FillRateHelper.js index 671d61a37dc6de..5c4aa005fef344 100644 --- a/Libraries/Lists/FillRateHelper.js +++ b/Libraries/Lists/FillRateHelper.js @@ -10,8 +10,6 @@ 'use strict'; -const warning = require('fbjs/lib/warning'); - export type FillRateInfo = Info; class Info { diff --git a/flow/fbjs.js b/flow/fbjs.js deleted file mode 100644 index 15f3e0d399548d..00000000000000 --- a/flow/fbjs.js +++ /dev/null @@ -1,258 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - * @nolint - */ - -declare module 'fbjs/lib/countDistinct' { - declare module.exports: {| - (iter: Iterable, selector: (item: T1) => T2): number, - |}; -} - -declare module 'fbjs/lib/warning' { - declare module.exports: {| - (condition: mixed, format: string, ...args: $ReadOnlyArray): void, - |}; -} - -declare module 'fbjs/lib/shallowEqual' { - declare module.exports: {| - (objA: mixed, objB: mixed): boolean, - |}; -} - -declare module 'fbjs/lib/EventListener' { - declare module.exports: {| - listen( - target: EventTarget, - eventType: string, - callback: any, - ): {remove(): void, ...}, - capture( - target: EventTarget, - eventType: string, - callback: any, - ): {remove(): void, ...}, - |}; -} - -declare module 'fbjs/lib/ExecutionEnvironment' { - declare module.exports: {| - +canUseDOM: boolean, - +canUseWorkers: boolean, - +canUseEventListeners: boolean, - +canUseViewport: boolean, - +isInWorker: boolean, - |}; -} - -declare module 'fbjs/lib/UserAgentData' { - declare module.exports: {| - +browserArchitecture: string, - +browserFullVersion: string, - +browserMinorVersion: string, - +browserName: string, - +browserVersion: string, - +deviceName: string, - +engineName: string, - +engineVersion: string, - +platformArchitecture: string, - +platformName: string, - +platformVersion: string, - +platformFullVersion: string, - |}; -} - -declare module 'fbjs/lib/VersionRange' { - declare module.exports: {| - contains(range: string, version: string): boolean, - |}; -} - -declare module 'fbjs/lib/base62' { - declare module.exports: {| - (number: number): string, - |}; -} - -declare module 'fbjs/lib/compactArray' { - declare module.exports: {| - (array: Array): Array, - |}; -} - -declare module 'fbjs/lib/concatAllArray' { - declare module.exports: any; -} - -declare module 'fbjs/lib/crc32' { - declare module.exports: {| - (str: string): number, - |}; -} - -declare module 'fbjs/lib/distinctArray' { - declare module.exports: {| - (xs: Iterable): Array, - |}; -} - -declare module 'fbjs/lib/emptyObject' { - declare module.exports: {||}; -} - -declare module 'fbjs/lib/equalsSet' { - declare module.exports: {| - (one: Set, two: Set): boolean, - |}; -} - -declare module 'fbjs/lib/everyObject' { - declare module.exports: {| - ( - object: mixed, - callback: (value: any, name: string, object: mixed) => any, - context?: any, - ): boolean, - |}; -} - -declare module 'fbjs/lib/everySet' { - declare module.exports: {| - ( - object: ?Set, - callback: (value: any, name: string, object: Set) => any, - context?: any, - ): boolean, - |}; -} - -declare module 'fbjs/lib/filterObject' { - declare module.exports: any; -} - -declare module 'fbjs/lib/forEachObject' { - declare module.exports: any; -} - -declare module 'fbjs/lib/groupArray' { - declare module.exports: any; -} - -declare module 'fbjs/lib/joinClasses' { - declare module.exports: {| - (className: mixed): string, - |}; -} - -declare module 'fbjs/lib/keyMirrorRecursive' { - declare module.exports: any; -} - -declare module 'fbjs/lib/keyOf' { - declare module.exports: any; -} - -declare module 'fbjs/lib/maxBy' { - declare module.exports: {| - ( - as: Iterable, - f: (a: A) => B, - compare?: ?(u: B, v: B) => number, - ): ?A, - |}; -} - -declare module 'fbjs/lib/memoizeStringOnly' { - declare module.exports: {| - (callback: (s: string) => T): (s: string) => T, - |}; -} - -declare module 'fbjs/lib/minBy' { - declare module.exports: {| - ( - as: Iterable, - f: (a: A) => B, - compare?: ?(u: B, v: B) => number, - ): ?A, - |}; -} - -declare module 'fbjs/lib/partitionArray' { - declare module.exports: {| - ( - array: Array, - predicate: (value: Tv, index: number, array: Array) => boolean, - context?: any, - ): [Array, Array], - |}; -} - -declare module 'fbjs/lib/partitionObject' { - declare module.exports: {| - ( - object: {[key: string]: Tv, ...}, - callback: ( - value: Tv, - key: string, - object: {[key: string]: Tv, ...}, - ) => boolean, - context?: any, - ): [{[key: string]: Tv, ...}, {[key: string]: Tv, ...}], - |}; -} - -declare module 'fbjs/lib/partitionObjectByKey' { - declare module.exports: any; -} - -declare module 'fbjs/lib/performance' { - declare module.exports: any; -} - -declare module 'fbjs/lib/performanceNow' { - declare module.exports: any; -} - -declare module 'fbjs/lib/requestAnimationFrame' { - declare module.exports: any; -} - -declare module 'fbjs/lib/someObject' { - declare module.exports: {| - ( - object: mixed, - callback: (value: any, name: string, object: mixed) => any, - context?: any, - ): boolean, - |}; -} - -declare module 'fbjs/lib/someSet' { - declare module.exports: {| - ( - set: Set, - callback: (value: T, key: T, set: Set) => boolean, - context?: any, - ): boolean, - |}; -} - -declare module 'fbjs/lib/keyMirror' { - declare module.exports: {| - (obj: T): $ObjMapi(K) => K>, - |}; -} - -declare module 'fbjs/lib/invariant' { - declare module.exports: {| - (condition: mixed, format: string, ...args: Array): void, - |}; -} diff --git a/jest.config.js b/jest.config.js index c5a093a6b48173..eb798365a9386e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -36,7 +36,6 @@ module.exports = { 'source-map', 'fastpath', 'denodeify', - 'fbjs', ], testEnvironment: 'node', collectCoverageFrom: ['Libraries/**/*.js'], diff --git a/package.json b/package.json index f95f03006ccf99..98757ed0375887 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,6 @@ "anser": "^1.4.9", "base64-js": "^1.1.2", "event-target-shim": "^5.0.1", - "fbjs": "^1.0.0", "fbjs-scripts": "^1.1.0", "hermes-engine": "~0.6.0", "invariant": "^2.2.4", diff --git a/template/_flowconfig b/template/_flowconfig index 569c6378fd6fe2..c015239056caf0 100644 --- a/template/_flowconfig +++ b/template/_flowconfig @@ -8,10 +8,6 @@ ; Ignore polyfills node_modules/react-native/Libraries/polyfills/.* -; These should not be required directly -; require from fbjs/lib instead: require('fbjs/lib/warning') -node_modules/warning/.* - ; Flow doesn't support platforms .*/Libraries/Utilities/LoadingView.js