Commit Graph

38 Commits

Author SHA1 Message Date
Tim Yung f8b4850425 Jest: Upgrade Flow Definition in RN + Metro
Reviewed By: sahrens

Differential Revision: D8371076

fbshipit-source-id: 12d03c545ca190a5fda1ff319e5ea906173d2241
2018-06-11 17:49:25 -07:00
Eli White 4aeefa5484 Open source Flow definition for Jest
Reviewed By: sahrens

Differential Revision: D8347198

fbshipit-source-id: 0b6194bfd14bad09db7dcd462f0bf342c9c6fe44
2018-06-10 22:38:39 -07:00
Eli White 053c7b2a84 Adding a Stringish type
Reviewed By: yungsters

Differential Revision: D7984925

fbshipit-source-id: b58bff2fa172f8127d70986accb45af1afca4d68
2018-05-13 02:01:05 -07:00
Eli White 36fcbaa56d Prettier the rest of ReactNative
Reviewed By: yungsters

Differential Revision: D7974340

fbshipit-source-id: 5fe457a8a9be4bd360fc3af9acb5c1136b2be0d7
2018-05-11 13:52:30 -07:00
Eli White 86b6f5d39e Add Prettier to some files
Reviewed By: sahrens

Differential Revision: D7958196

fbshipit-source-id: 05a04380a4a1f3abd4cc3a9034fc70deaa4a444b
2018-05-10 16:16:35 -07:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Sam Goldman 632f1202ab Switch `declare function exports` to `declare module.exports`
Reviewed By: calebmer

Differential Revision: D6579552

fbshipit-source-id: a46f27cca8065e9f3c46739f6a874dfb346c0c7d
2017-12-18 17:25:08 -08:00
Sam Goldman 5f8d8e90c2 Switch to `declare module.exports` syntax
Reviewed By: gabelevi

Differential Revision: D6571796

fbshipit-source-id: 6a6d98b05953f40b825a260f44765689e91269a8
2017-12-14 16:31:14 -08:00
Uts Sikder dd2fc4022e remove unnecessary and error inducing method from Map flow type
Reviewed By: mroch

Differential Revision: D6198877

fbshipit-source-id: 77a058072f439339a92fa07702a0429c4ca3282f
2017-11-01 16:32:19 -07:00
Jimmy Mayoukou 4eccb16935 Add finally method to Promise flow definition
Summary:
The `finally` method definition was missing, while it really exists causing a flow error when using it.

Added the method definition and make sure flow doesn't throw any error anymore on a real-life example.
Closes https://github.com/facebook/react-native/pull/16115

Differential Revision: D6017950

Pulled By: shergin

fbshipit-source-id: 296f3467152eb6eedac817a89cf075e9f906a389
2017-10-09 22:02:09 -07:00
Caleb Meredith 292b19d339 Update typings for Promise.all() for D5827319
Reviewed By: samwgoldman

Differential Revision: D5830645

fbshipit-source-id: db2bb0715aab58d3601712ee0b080abaa9f8f131
2017-09-26 11:38:31 -07:00
Caleb Meredith 90eaeb019b Upgrade fbsource/xplat/js to Flow v0.53.0
Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
2017-08-17 18:45:01 -07:00
Eli White d9f98191eb Removing @nolint from flow files
Reviewed By: zertosh

Differential Revision: D5407058

fbshipit-source-id: 54e9cbc1a9739bcf104752f3421cc7cba41730cc
2017-07-12 14:09:54 -07:00
Eli White fc86f25f9a Run eslint on all js files
Reviewed By: zertosh

Differential Revision: D5405047

fbshipit-source-id: 5ade9d8beb3688d8bb08a208709c0dbf1ec671b2
2017-07-12 14:09:53 -07:00
David Aurelio 4990c5c5b3 Move type definitions used for metro bundler from React Native
Summary: Moves type definitions for uglify and babel from React Native to Metro Bundler. We need it there.

Reviewed By: cpojer

Differential Revision: D5217795

fbshipit-source-id: 9ec349cd8caf077eaa3c6fa3d090ffd47893e967
2017-06-09 14:02:05 -07:00
Gabe Levi 3ddc7d47d5 Fix react-native function call arity errors
Reviewed By: zertosh

Differential Revision: D5081816

fbshipit-source-id: 5978770c30a69fb287d03aa7511999ce30f856a1
2017-05-18 16:55:55 -07:00
David Aurelio f1a220b3cf Fixes issues with uglify.js usage
Summary: Adds flow type defs for uglify, and fixes the two issues found

Reviewed By: jeanlauliac

Differential Revision: D5029190

fbshipit-source-id: eb5947b051844938da241e002b727edc1384e3a6
2017-05-10 05:16:06 -07:00
David Aurelio 73fc439bc0 Stronger typing for transformers
Reviewed By: jeanlauliac

Differential Revision: D5006679

fbshipit-source-id: 795c60db363fb53bc74697e4befe50995e9b97a7
2017-05-09 08:02:36 -07:00
David Aurelio 58ba7fc075 Unify source map types
Summary: deduplicates / unifies types for source maps across the code base

Reviewed By: jeanlauliac

Differential Revision: D4955924

fbshipit-source-id: 25cb71031dce835dd7d2bc1c27d6b20050906e81
2017-04-28 12:35:23 -07:00
Andres Suarez ae7edff707 Update flow/Set.js definition
Summary: Sync the `Set` definition with the latest flow. https://github.com/facebook/flow/blob/879aa351/lib/core.js#L605-L618

Reviewed By: yungsters

Differential Revision: D4960310

fbshipit-source-id: f7546197e9ebeadbbcc21fa17ad40735659d27df
2017-04-27 18:45:24 -07:00
Brian Vaughn 5fa33d4936 Add create-react-class package
Reviewed By: sebmarkbage

Differential Revision: D4917270

fbshipit-source-id: 3a490eaaa31cb0f4a4f39065bf09a1f30f43c4e1
2017-04-19 20:05:33 -07:00
Brian Vaughn 00330987c8 Adding prop-types package and disabling auto-mock for Jest
Reviewed By: spicyj

Differential Revision: D4874587

fbshipit-source-id: 5c4c3d96a003d271fd5755191681ea7f729db235
2017-04-12 10:02:05 -07:00
David Aurelio cec787563a amend babel definitions to allow inline plugins without configuration
Summary: Updates babel flow defs to allow for inline plugins without configuration arguments.

Reviewed By: jeanlauliac

Differential Revision: D4442217

fbshipit-source-id: 1b4392bf13977d97984c72cff65b28e62f602300
2017-01-20 10:43:29 -08:00
David Aurelio 0849f84df2 create better debuggable source maps
Summary:
Introduces a new mechanism to build source maps that allows us to use real mapping segments instead of just mapping line-by-line.

This mechanism is only used when building development bundles to improve the debugging experience in Chrome.

The new mechanism takes advantage of a new feature in babel-generator that exposes raw mapping objects. These raw mapping objects are converted to arrays with 2, 4, or 5 for the most compact representation possible.
We no longer generate a source map for the bundle that maps each line to itself in conjunction with configuring babel generator to retain lines.

Instead, we create a source map with a large mappings object produced from the mappings of each individual file in conjunction with a “carry over” – the number of preceding lines in the bundle.

The implementation makes a couple of assumptions that hold true for babel transform results, e.g. mappings being in the order of the generated code, and that a block of mappings always belongs to the same source file. In addition, the implementation avoids allocation of objects and strings at all costs. All calculations are purely numeric, and base64 vlq produces numeric ascii character codes. These are written to a preallocated buffer objects, which is turned to a string only at the end of the building process. This implementation is ~5x faster than using the source-map library.

In addition to providing development source maps that work better, we can now also produce individual high-quality source maps for production builds and combine them to an “index source map”. This approach is unfeasable for development source maps, because index source map consistently crash Chrome.

Better production source maps are useful to get precise information about source location and symbol names when symbolicating stack traces from crashes in production.

Reviewed By: jeanlauliac

Differential Revision: D4382290

fbshipit-source-id: 365a176fa142729d0a4cef43edeb81084361e54d
2017-01-12 14:28:41 -08:00
Jean Lauliac f0ca55aee8 packager: Resolver&co: @flow
Reviewed By: davidaurelio

Differential Revision: D4285448

fbshipit-source-id: ec9bc6fd3c6d6eae89347762bff8b5b24662394b
2016-12-08 05:13:40 -08:00
David Aurelio 6786cbd3e4 Add fbjs definitions to flow config
Reviewed By: zertosh

Differential Revision: D4291805

fbshipit-source-id: 3dcb8ffe6132bd04a3048edae64e9d273c2dcae4
2016-12-08 02:43:25 -08:00
Andres Suarez 29dce56b90 Remove requestIdleCallback/cancelIdleCallback flow lib
Summary: As of flow 0.36.0, `requestIdleCallback` and `cancelIdleCallback` are part of the builtin lib defs. https://github.com/facebook/flow/pull/2800

Reviewed By: yungsters

Differential Revision: D4280306

fbshipit-source-id: 30328675c7dbfe12f603321f1196c87800a19ba8
2016-12-07 13:13:39 -08:00
David Aurelio f3779502d3 Add flow types for output modules
Summary: Adds flow types for output functionality for easier maintenance and interop with new code

Reviewed By: matryoshcow

Differential Revision: D4211863

fbshipit-source-id: 591407d3a6d49536054ae94ba31125c18a1e1fa1
2016-11-21 13:28:30 -08:00
Tim Yung 23331df5a4 RN: Cleanup OSS JS & Flow Declarations
Reviewed By: vjeux

Differential Revision: D4210763

fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252
2016-11-20 17:58:29 -08:00
David Aurelio c8b463f3b6 add flow
Summary: This adds flow types to new code written for the Buck/Packager integration.

Reviewed By: cpojer

Differential Revision: D4175156

fbshipit-source-id: 38c3d2c9176c7b3cf22b8baed7d445a75d033d04
2016-11-17 08:58:55 -08:00
Jean Lauliac 79822ea9d3 packager worker: more @flow
Reviewed By: matryoshcow

Differential Revision: D4160528

fbshipit-source-id: 5f43cb47717288c5344c1204cf435ec727ca752e
2016-11-16 10:43:25 -08:00
David Aurelio 77401b15e0 Add flow declarations for `babel-core`
Reviewed By: zertosh

Differential Revision: D4166844

fbshipit-source-id: 5ee67b6629179c195dcdeacf87121a3fcd75a738
2016-11-11 10:13:30 -08:00
Jeff Morrison 1a9853da37 fbobjc
Reviewed By: gabelevi

Differential Revision: D3949455

fbshipit-source-id: 1cbce4a85fe5b8798496752863bbca64b078aa9c
2016-10-01 11:16:21 -07:00
Gant Laborde c6024f6391 - Add ability to detect if location was mocked
Summary:
Since API 18, Android locations have had the `isFromMockProvider()` function, to verify the validity of a provided location.  This was one of many methods one could verify location data, but as of Marshmallow, the other ways of detecting if "Mock Locations" is on in developer settings has been deprecated or defunct.

This means some devices can only detect location mocking by exposing the method on the location object.

This change provides that exposure.
Closes https://github.com/facebook/react-native/pull/9390

Differential Revision: D3858205

Pulled By: bestander

fbshipit-source-id: 3bae429cc0596ea01926c5be204f4403e4a2414f
2016-09-20 05:59:04 -07:00
David Aurelio 24736d1188 module graph
Summary:
This piece of code can assemble all transitive dependencies of a set of entry modules. It is supposed to replace `ResolutionRequest.getOrderedDependencies`.

It has the following advantages:
- has minimal API surface to other components of the system (uses two functions, exposes one function)
- allows to separate concerns into loading + transforming files, resolving dependencies, gathering all modules belonging to a bundle (this code), and bundling
- allows to specify multiple entry points
- allows to use any kind of dependency ID as entry point (haste IDs, node module IDs, relative paths, absolute paths – depends on the resolver)
- allows to skip files, which allows callers to incrementally update previously retrieved collections of modules

Reviewed By: cpojer

Differential Revision: D3627346

fbshipit-source-id: 84b7aa693ca6e89ba3c1ab2af9a004e2e0aaed3d
2016-09-14 10:28:34 -07:00
Janic Duplessis 18394fb179 Initial implementation of requestIdleCallback on Android
Summary:
This is a follow up of the work by brentvatne in #5052. This addresses the feedback by astreet.

- Uses ReactChoreographer with a new callback type
- Callback dispatch logic moved to JS
- Only calls into JS when needed, when there are pending callbacks, it even removes the Choreographer listener when no JS context listen for idle events.

** Test plan **
Tested by running a background task that burns all remaining idle time (see new UIExplorer example) and made sure that UI and JS fps stayed near 60 on a real device (Nexus 6) with dev mode disabled. Also tried adding a JS driven animation and it stayed smooth.

Tested that native only calls into JS when there are pending idle callbacks.

Also tested that timers are executed before idle callback.
```
requestIdleCallback(() => console.log(1));
setTimeout(() => console.log(2), 100);
burnCPU(1000);
// 2
// 1
```

I did *not* test with webworkers but it should work as I'm using executor tokens.
Closes https://github.com/facebook/react-native/pull/8569

Differential Revision: D3558869

Pulled By: astreet

fbshipit-source-id: 61fa82eb26001d2b8c2ea69c35bf3eb5ce5454ba
2016-07-13 18:58:20 -07:00
Gabe Levi b02d411dbf Deploy v0.23.0
Reviewed By: mroch

Differential Revision: D3179969

fb-gh-sync-id: e0513a17d565ff1ae5c6e58c49ce82b6b0d5db86
fbshipit-source-id: e0513a17d565ff1ae5c6e58c49ce82b6b0d5db86
2016-04-14 16:18:41 -07:00
Jeff Morrison b473d496c4 Update FBSource to use Flow 0.22
Reviewed By: gabelevi

Differential Revision: D3021265

fb-gh-sync-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
shipit-source-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
2016-03-08 12:39:29 -08:00