Reviewed By: sahrens

Differential Revision: D7958196

fbshipit-source-id: 05a04380a4a1f3abd4cc3a9034fc70deaa4a444b
This commit is contained in:
Eli White 2018-05-10 15:44:53 -07:00 коммит произвёл Facebook Github Bot
Родитель 8f5ebe5952
Коммит 86b6f5d39e
10 изменённых файлов: 71 добавлений и 44 удалений

Просмотреть файл

@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';
@ -13,8 +15,8 @@ var transformPath = require.resolve(hmrTransform);
module.exports = function(options, filename) {
var transform = filename
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
: hmrTransform;
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
: hmrTransform;
// Fix the module path to use '/' on Windows.
if (path.sep === '\\') {
@ -26,13 +28,15 @@ module.exports = function(options, filename) {
[
require('metro-babel7-plugin-react-transform'),
{
transforms: [{
transform: transform,
imports: ['react'],
locals: ['module'],
}]
transforms: [
{
transform: transform,
imports: ['react'],
locals: ['module'],
},
],
},
]
]
],
],
};
};

Просмотреть файл

@ -3,6 +3,8 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';
@ -31,7 +33,7 @@ const defaultPlugins = [
require('@babel/plugin-transform-modules-commonjs'),
{
strict: false,
strictMode : false, // prevent "use strict" injections
strictMode: false, // prevent "use strict" injections
allowTopLevelThis: true, // dont rewrite global `this` -> `undefined`
},
],

Просмотреть файл

@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
declare module 'metro' {

Просмотреть файл

@ -5,23 +5,29 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
// These annotations are copy/pasted from the built-in Flow definitions for
// Native Map.
declare module "Map" {
declare module 'Map' {
// Use the name "MapPolyfill" so that we don't get confusing error
// messages about "Using Map instead of Map".
declare class MapPolyfill<K, V> {
@@iterator(): Iterator<[K, V]>;
constructor<Key, Value>(_: void): MapPolyfill<Key, Value>;
constructor<Key, Value>(_: null): MapPolyfill<Key, Value>;
constructor<Key, Value>(iterable: Iterable<[Key, Value]>): MapPolyfill<Key, Value>;
constructor<Key, Value>(
iterable: Iterable<[Key, Value]>,
): MapPolyfill<Key, Value>;
clear(): void;
delete(key: K): boolean;
entries(): Iterator<[K, V]>;
forEach(callbackfn: (value: V, index: K, map: MapPolyfill<K, V>) => mixed, thisArg?: any): void;
forEach(
callbackfn: (value: V, index: K, map: MapPolyfill<K, V>) => mixed,
thisArg?: any,
): void;
get(key: K): V | void;
has(key: K): boolean;
keys(): Iterator<K>;

Просмотреть файл

@ -6,10 +6,11 @@
*
* @flow
* @nolint
* @format
*/
declare class Position {
coords: Coordinates,
timestamp: number,
mocked: boolean,
coords: Coordinates;
timestamp: number;
mocked: boolean;
}

Просмотреть файл

@ -5,41 +5,42 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
// These annotations are copy/pasted from the built-in Flow definitions for
// Native Promises with some non-standard APIs added in
declare class Promise<+R> {
constructor(callback: (
resolve: (result?: Promise<R> | R) => void,
reject: (error?: any) => void
) => mixed): void;
constructor(
callback: (
resolve: (result?: Promise<R> | R) => void,
reject: (error?: any) => void,
) => mixed,
): void;
then<U>(
onFulfill?: ?(value: R) => Promise<U> | ?U,
onReject?: ?(error: any) => Promise<U> | ?U
onReject?: ?(error: any) => Promise<U> | ?U,
): Promise<U>;
catch<U>(
onReject?: (error: any) => ?Promise<U> | U
): Promise<U>;
catch<U>(onReject?: (error: any) => ?Promise<U> | U): Promise<U>;
static resolve<T>(object?: Promise<T> | T): Promise<T>;
static reject<T>(error?: any): Promise<T>;
static all<T: Iterable<mixed>>(promises: T): Promise<$TupleMap<T, typeof $await>>;
static all<T: Iterable<mixed>>(
promises: T,
): Promise<$TupleMap<T, typeof $await>>;
static race<T>(promises: Array<Promise<T>>): Promise<T>;
// Non-standard APIs
// See https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/Promise.native.js#L21
finally<U>(
onFinally?: ?(value: any) => Promise<U> | U
): Promise<U>;
finally<U>(onFinally?: ?(value: any) => Promise<U> | U): Promise<U>;
done<U>(
onFulfill?: ?(value: R) => mixed,
onReject?: ?(error: any) => mixed
onReject?: ?(error: any) => mixed,
): void;
static cast<T>(object?: T): Promise<T>;

Просмотреть файл

@ -6,12 +6,13 @@
*
* @flow
* @nolint
* @format
*/
// These annotations are copy/pasted from the built-in Flow definitions for
// Native Set.
declare module "Set" {
declare module 'Set' {
// Use the name "SetPolyfill" so that we don't get confusing error
// messages about "Using Set instead of Set".
declare class SetPolyfill<T> {
@ -21,7 +22,10 @@ declare module "Set" {
clear(): void;
delete(value: T): boolean;
entries(): Iterator<[T, T]>;
forEach(callbackfn: (value: T, index: T, set: SetPolyfill<T>) => mixed, thisArg?: any): void;
forEach(
callbackfn: (value: T, index: T, set: SetPolyfill<T>) => mixed,
thisArg?: any,
): void;
has(value: T): boolean;
keys(): Iterator<T>;
size: number;

Просмотреть файл

@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
declare module 'console' {
@ -22,17 +23,17 @@ declare module 'console' {
declare function warn(...data: any): void;
declare class Console {
constructor(stdout: stream$Writable, stdin?: stream$Writable): void;
assert(value: any, ...message: any): void,
assert(value: any, ...message: any): void;
dir(
obj: Object,
options: {showHidden: boolean, depth: number, colors: boolean},
): void,
error(...data: any): void,
info(...data: any): void,
log(...data: any): void,
time(label: any): void,
timeEnd(label: any): void,
trace(first: any, ...rest: any): void,
warn(...data: any): void,
): void;
error(...data: any): void;
info(...data: any): void;
log(...data: any): void;
time(label: any): void;
timeEnd(label: any): void;
trace(first: any, ...rest: any): void;
warn(...data: any): void;
}
}

Просмотреть файл

@ -3,10 +3,16 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
declare module 'fbjs/lib/invariant' {
declare module.exports: <T>(condition: any, message: string, ...args: Array<any>) => void;
declare module.exports: <T>(
condition: any,
message: string,
...args: Array<any>
) => void;
}
declare module 'fbjs/lib/nullthrows' {

Просмотреть файл

@ -6,6 +6,7 @@
*
* @flow
* @nolint
* @format
*/
// TODO (bvaughn) Remove this file once flowtype/flow-typed/pull/773 is merged
@ -14,7 +15,7 @@ type $npm$propTypes$ReactPropsCheckType = (
props: any,
propName: string,
componentName: string,
href?: string
href?: string,
) => ?Error;
declare module 'prop-types' {
@ -39,6 +40,6 @@ declare module 'prop-types' {
values: V,
location: string,
componentName: string,
getStack: ?(() => ?string)
) : void;
getStack: ?() => ?string,
): void;
}