Commit Graph

949 Commits

Author SHA1 Message Date
Ely Alvarado ce860803a4 Prepend passed sourceExts to default ones and pass them to metro (#21855)
Summary:
Fixes react-native start not using passed --sourceExts #21854
Pull Request resolved: https://github.com/facebook/react-native/pull/21855

Differential Revision: D12840358

Pulled By: rafeca

fbshipit-source-id: 4ee09341b5128d83274a39d8d01c13749efaa78b
2018-10-30 15:18:34 -07:00
Alexandre Kirszenberg 1eedf05651 Update the Delta/HMR format
Summary:
Makes the delta bundle data structures more consistent.

The changes are as follows:
* There are now two types of JSON bundles that can be downloaded from the delta endpoint. Base bundles (`Bundle` type), and Delta bundles (`DeltaBundle` type).
* The `reset` boolean is renamed to `base`.
* `pre` and `post` properties are now strings.
* Only `Bundle` can define `pre` and `post` properties.
* The `delta` property is renamed to `modules`.
* Deleted modules are now listed inside of the `deleted` property, which is only defined by `DeltaBundle`.

Reviewed By: mjesun

Differential Revision: D10446831

fbshipit-source-id: 40e229a2811d48950f0bad8dd341ece189089e9b
2018-10-29 08:58:30 -07:00
Avik Chaudhuri 11552a7a7a @allow-large-files flow 0.84 xplat deploy
Reviewed By: samwgoldman

Differential Revision: D10851695

fbshipit-source-id: 951c628844bbbc7331d4e75f62485db88e5ba7c4
2018-10-25 18:16:30 -07:00
Sunny Luo 88981a8e12 Make google repo priority higher than jcenter (#21910)
Summary:
Fixes https://github.com/facebook/react-native/issues/21907#issuecomment-432319128 and prevent similar issues happening again
Pull Request resolved: https://github.com/facebook/react-native/pull/21910

Differential Revision: D10842256

Pulled By: hramos

fbshipit-source-id: f4abaa1c8ff8df6f0fb57b1bad745f4df9da7143
2018-10-24 14:45:21 -07:00
Michał Pierzchała 5e997f9d51 use requireActual and requireMock from jest instead of require (#21849)
Summary:
A while back Jest introduced `jest.requireActual` and `jest.requireMock` which are aliases to `require.requireActual` and `require.requireMock`. We believe that users should use official Jest API and are planning to deprecate the latter.
Pull Request resolved: https://github.com/facebook/react-native/pull/21849

Differential Revision: D10448849

Pulled By: TheSavior

fbshipit-source-id: 34fffde97f48c26098c74ee222a56d99071703a6
2018-10-18 15:32:15 -07:00
Marc Horowitz 3341adac40 Ensure HelloWorld xcodeproj template works
Summary: The only thing extra that we need to do is to include `JavaScriptCore.framework` inside the HelloWorld.xcodeproj file.

Reviewed By: hramos

Differential Revision: D9893035

fbshipit-source-id: 2a29d1fd645eafa2e09109ad14d09f812dfa2601
2018-10-18 01:06:25 -07:00
Ely Alvarado 0fab27cbac Allow specifying iOS version for run-ios with simulator option (#19079)
Summary:
Fixes #19069

The --simulator option for the run-ios command now can take an optional
iOS version between parenthesis to further match the desired simulator.
This is useful if you have installed simulators for different iOS
versions and you want to run the app in an especific one. Example:

react-native run-ios --simulator "iPhone 6s (9.3)"

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

Updated tests for the findMatchingSimulator function to include test cases specifying iOS version, and tested on the command line in my app to make sure it has the expected behavior.

[CLI] [ENHANCEMENT] [{/runIOS/findMatchingSimulator.js}] - run-ios command with the --simulator option now allows specifying the iOS version to run an specific simulator if you have multiple versions of the simulator installed. Example: `react-native run-ios --simulator "iPhone 6s (9.3)"`.
Pull Request resolved: https://github.com/facebook/react-native/pull/19079

Differential Revision: D10432487

Pulled By: hramos

fbshipit-source-id: efa50d798b79d83bfe357ee17967a56c7c003bee
2018-10-17 13:25:39 -07:00
Marshall Roch 7b150690b6 @allow-large-files [flow] update to v0.83
Reviewed By: fishythefish

Differential Revision: D10362346

fbshipit-source-id: 0f4cc9977cfaa947e3b23112dd1cf482642e2319
2018-10-13 01:32:48 -07:00
Rafael Oleza e7b0590f18 Remove sinon dependency
Summary:
This diff removes the `sinon` dependency from `metro` and `react-native-github`. It was only used in a handful of tests and having to learn and remember another mocking API just for these cases was not worth it IMO.

While doing the migration, most of the things that `sinon` provides can be done with `jest` in a very similar (and user friendly) way.

I've found, though, two small things that are more user friendly with `sinon`. I'm documenting them here because it may be worth adding them to jest:

With `sinon`:

```
stub.throws(new Error('foo'));
```

With `jest`:

```
mock.mockImplementation(() => {
  throw new Error('foo');
});
```

Taking into account that `jest` has a `mockRejectedValue` method for mocks (to return a rejected promise) I don't see any reason why it does not have a `mockThrowError` method.

With `sinon`:

```
expect(mock1.calledBefore(mock2)).toBeTruthy();
```

With `jest`:

```
expect(mock1.mock.invocationCallOrder[0]).toBeLessThan(
  mock2.mock.invocationCallOrder[0],
);
```

There's a community matcher that adds this matcher in `jest-extended`: https://github.com/jest-community/jest-extended#tohavebeencalledbefore, but we're not using `jest-extended` in `xplat/js`.

Reviewed By: jeanlauliac

Differential Revision: D10238331

fbshipit-source-id: 5441125b69596ad85bf8f56d203cfd20759bc358
2018-10-10 13:02:12 -07:00
Jean Lauliac 3184cab60f react-native: fix path module use in writePlist test
Summary:
@public

Partly fixes https://github.com/facebook/react-native/issues/20260

Reviewed By: rafeca

Differential Revision: D10302150

fbshipit-source-id: 2d9a63b263c9e27c22989c447ce884934f1e4430
2018-10-10 10:45:57 -07:00
Antony Chan 1031872784 check isAvailable key on simulator object (#21557)
Summary:
With the new xcode command line tools (10.1 beta2), running `xcrun simctl list --json devices` seems to gives us a slightly different format than what we were expecting. More specifically, the `availability` key is changed to `isAvailable` and returns `'YES'` if the simulator is available:

Before:
```js
devices: {
  'iOS 9.2': [
    {
      state: 'Shutdown',
      availability: '(unavailable, runtime profile not found)',
      name: 'iPhone 4s',
      udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6',
    },
    {
      state: 'Shutdown',
      availability: '(unavailable, runtime profile not found)',
      name: 'iPhone 5',
      udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB',
    },
    ...
   ]
}
```
After:
```js
devices: {
  'iOS 12.1': [
    {
      state: 'Shutdown',
      isAvailable: 'YES',
      name: 'iPhone 6s',
      udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508',
    },
    {
      state: 'Shutdown',
      isAvailable: 'YES',
      name: 'iPhone 6',
      udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C',
    },
    ...
   ]
}
```

Without this fix, `npm run ios` is not able to launch the simulator correctly and returns the following error:

```
Could not find iPhone 6 simulator

Error: Could not find iPhone 6 simulator
    at resolve (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/runIOS/runIOS.js:148:13)
    at new Promise (<anonymous>)
    at runOnSimulator (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at Promise.resolve.then (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/cliEntry.js:117:22)
```
Pull Request resolved: https://github.com/facebook/react-native/pull/21557

Differential Revision: D10248115

Pulled By: TheSavior

fbshipit-source-id: 37197bbf828e4a6e254270d46411a6716a91afe3
2018-10-08 23:17:37 -07:00
Sam Goldman 8a4975051e Upgrade xplat/js to Flow v0.82
Reviewed By: yungsters

Differential Revision: D10139929

fbshipit-source-id: ae44a8af7cab28c4acfd7c97e636467e44adcf37
2018-10-01 22:23:18 -07:00
Héctor Ramos e28d8f6eeb Fix copyright headers
Summary:
Update several files to use the proper copyright header:

```
//  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.
```

In the case of Xcode project files, I used the shortform version, `Copyright (c) Facebook, Inc. and its affiliates.`

Reviewed By: axe-fb

Differential Revision: D10114529

fbshipit-source-id: a1f2d5a46d04797c1cf281ea9ab80d3a2caa6fb4
2018-09-28 17:33:12 -07:00
Jordan Brown 0ee23d0beb Remove unused suppressions in xplat/js
Summary:
There were approximately 350 unused suppressions in xplat/js when checking with .flowconfig.android

The flow team is partially responsible for this, since our release process hasn't changed since we added the flowconfig. In the diff beneath this one, I added the functionality necessary for us to not add any more unused suppressions. To test it, I made this diff. The steps were:

1. Start iOS server
2. Start android server
3. remove unused ios suppressions
4. remove unused android suppressions
5. add ios suppressions with site=react_native_ios_fb
6. add android suppressions with site=react_native_android_fb
7. remove unused ios suppressions. The ones that are unused are ones where an android comment was inserted as well, since the ios comment no longer is next to the error
8. add suppressions using ios flowconfig with site=react_native_fb
9. remove unused android suppressions. The unused ones are ones that were moved up when the cross-platform suppressions were inserted.

I'm going to make this into a script to make sure we don't contribute anymore unused suppressions from our side.

The controller you requested could not be found. nolint

Reviewed By: TheSavior

Differential Revision: D10053893

fbshipit-source-id: 7bee212062f8b2153c6ba906a30cf40df2224019
2018-09-27 11:47:04 -07:00
Rafael Oleza 2c1057062e Make config object read-only
Summary: This makes the Metro config type readonly, only a couple of things inside Metro needed to be tweaked :)

Reviewed By: mjesun

Differential Revision: D10028083

fbshipit-source-id: 15f5d957a8ee7384d6156c973639d86240fd251f
2018-09-26 16:48:48 -07:00
empyrical 2da60a8f45 Prettify remaining unprettified files (#21327)
Summary:
This PR is the result of running `yarn prettify` on the codebase - which caught a few files that were not prettified. This will make instructing people to run prettify a bit less complicated, since unrelated files will not show up in diffs.
Pull Request resolved: https://github.com/facebook/react-native/pull/21327

Differential Revision: D10046057

Pulled By: TheSavior

fbshipit-source-id: 2c771a3c758c72816c707e32ee2f4587e466f277
2018-09-25 19:50:08 -07:00
gengjiawen 0a2825f8b3 add x86_64 arm64-v8a support. Fixes #2814 (#18754)
Summary:
add arm64 support, related issue : https://github.com/facebook/react-native/issues/2814.
If we are okay with binary aar android-jsc, then the pr can be directly merged. Otherwise merge facebook/android-jsc#30 first and do a new release.

RNTester all variant works. You can also test the apk from here: https://github.com/gengjiawen/react-native/releases/tag/v0.56beta.

https://github.com/facebook/android-jsc/pull/30.

 [ANDROID] [ENHANCEMENT] [ABI] - add x86_64 arm64-v8a support.

Differential Revision: D9491481

Pulled By: hramos

fbshipit-source-id: d6ec6992768eb0c0866a0317273e09fae5b8935e
2018-09-24 11:32:56 -07:00
Jean Lauliac 9c242c8a2f react-native-github: set path mock to posix by default
Summary:
@public

Otherwise tests using `path` but not `fs` have an empty mock, as it happens on https://github.com/facebook/metro/issues/235#issuecomment-423722747

Reviewed By: mjesun

Differential Revision: D10008513

fbshipit-source-id: 673e2ca79c8105a68818985dc08fe7ccd5d13881
2018-09-24 06:32:24 -07:00
Héctor Ramos 5068dfcad3 Use Android SDK 27 in React Native
Summary:
Upgrade React Native to Android SDK 27 again, following the reversal in D9886607 (68c7999c25).

The SDK 27 is actually available internally in an alternate location that is suitable for use cases like React Native's. For future reference, SDK 28 is also available for use in this location.

Reviewed By: axe-fb

Differential Revision: D9929066

fbshipit-source-id: 9413f891d5587293a30544351340e9407a2dce55
2018-09-20 07:56:23 -07:00
gengjiawen 58fe324163 fix ci path problem on Windows (#21203)
Summary:
fix ci path problem on Windows
pass all current ci.
none
 [GENERAL] [INTERNAL] [CI] - fix ci path problem on Windows
Pull Request resolved: https://github.com/facebook/react-native/pull/21203

Differential Revision: D9943608

Pulled By: hramos

fbshipit-source-id: 66e3e196a6c0015e0472851abeee32de9fef140c
2018-09-19 10:47:41 -07:00
Vitor Capretz 6d09df5b72 ios-simulator: change default iphone version (#21148)
Summary:
this is just a suggestion, but as the iPhone 6 is discontinued by Apple
and the new iPhone line will match the X version, it could be good to update the default simulator.

it could also be the iPhone 8, feel free to suggest other changes!

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull Request resolved: https://github.com/facebook/react-native/pull/21148

Differential Revision: D9928120

Pulled By: hramos

fbshipit-source-id: 005faa3a8e00b67f98a778c92ecc01b064e14199
2018-09-18 20:57:45 -07:00
Joel Arvidsson 9fca769e76 Fix ignored --projectRoot/watchFolders arguments (#21165)
Summary:
Due to Kureev's cleanup in c4a66a89a2 some arguments are no longer properly passed to metro, but just the default values. This broke the `--projectRoot` and `--watchFolders` arguments used by storybook to change the bundle entrypoint.

This PR simply fixes the regression by assigning these values from argv instead of reading config defaults.

Related: the undocumented `REACT_NATIVE_APP_ROOT` env var is broken, not sure for how long, but I can fix it as a part of this PR or make a new one.
Pull Request resolved: https://github.com/facebook/react-native/pull/21165

Differential Revision: D9929642

Pulled By: hramos

fbshipit-source-id: 00485a0429bd4301de03e5cb455e928878c4ba8f
2018-09-18 19:03:04 -07:00
Nat Mote b118f4ec3d Upgrade xplat/js to Flow v0.81
Reviewed By: dsainati1, pakoito

Differential Revision: D9920018

fbshipit-source-id: 208fa08109d307dc09f0e0357f5caa6dfcfa5ddf
2018-09-18 13:47:57 -07:00
Rafael Oleza 7a69f1aa27 Pass the maxWorkers config param correctly to Metro
Summary:
@public

The React Native CLI is not passing the default `maxWorkers` param to Metro, making it run in a single thread and making the development process really slow.

This fixes https://github.com/facebook/metro/issues/253

Reviewed By: mjesun

Differential Revision: D9915500

fbshipit-source-id: d15030af582e99fe20535c07e751cfe12e444f2f
2018-09-18 08:19:38 -07:00
Héctor Ramos 68c7999c25 Downgrade to compileSdkVersion 26
Summary:
Go back to using compileSdkVersion 26 and targetSdkVersion 26, temporarily. We can re-add this once Android SDK 27 becomes available in Facebook's internal repository.

The Android SDK Build Tools 27.0.3 **are** available, so we can continue using those.

Reviewed By: axe-fb

Differential Revision: D9886607

fbshipit-source-id: 6c1c9c1e1309c3a0483cc4c0bd8dcb4a5f29fc7e
2018-09-18 08:02:50 -07:00
Martin Konicek 52dd7dbbcf Remove built-in navigation template (#21155)
Summary:
This is an updated (rebased) version of the very old #16579.

I added a [template](https://github.com/facebook/react-native/tree/master/local-cli/templates/HelloNavigation) for react-navigation directly into the React Native repo a long time ago. The feature `react-native init --template foo` supports both:
- Remote templates (`react-native-template-foo` in npm as well as HTTP URLs)
- Local templates that ship with react-native itself

In retrospect, adding the local template wasn't a good idea. Templates should live outside of the React Native repo and be versioned independently. This way templates can be fixed independently of React Native releases, and people can use new templates without having to upgrade React Native.
Pull Request resolved: https://github.com/facebook/react-native/pull/21155

Differential Revision: D9885719

Pulled By: hramos

fbshipit-source-id: d2982f374d3c451c09e348ce5fcdca9d0be5a474
2018-09-17 15:17:58 -07:00
Jean Lauliac e327f88f02 react-native: make automated fs-based tests platform-independent
Summary:
@public

These tests are using a mock memory FS to start with, so there is no reason at all they should depend on the host OS or filesystem details. This changeset fixes that so that we fully mock the `fs` and `path` modules dependending on the mock platform (not the host platform). I also added an example of how we can test both platforms (regardless of the host platform) in `findPackageClassName`. Follow up changeset will be to do the same for all the other affected tests.

Related to https://github.com/facebook/react-native/issues/20260.

Reviewed By: mjesun

Differential Revision: D9771024

fbshipit-source-id: b368b43e8e54292d33b6183eec9a9ea69f2e6e76
2018-09-17 05:46:47 -07:00
gengjiawen 4f49404e15 bump android target version to 27 (#20843)
Summary:
bump target version to 27
pass all current ci.
none
[GENERAL] [ANDROID] [FEATURE] - bump android target version to 27
Pull Request resolved: https://github.com/facebook/react-native/pull/20843

Differential Revision: D9845999

Pulled By: hramos

fbshipit-source-id: 3c532a2d5a2b7d201bacab54cf3d60e1efffb653
2018-09-15 05:47:09 -07:00
empyrical 4b106be477 Give RNPM the ability to look for plugins in `@scoped` modules (#21082)
Summary:
This PR gives RNPM the ability to look for plugins in `scoped` modules.

The regexes for finding RNPM plugins will match these hypothetical examples:

 * `rnpm-plugin-foo`
 * `org/rnpm-plugin-foo`

The regexes for finding React Native plugins will match these hypothetical examples:

 * `react-native-foo`
 * `org/react-native-foo`
 * `The controller you requested could not be found./module` (will be useful in the slimmening)
 * `The controller you requested could not be found./module`

RNPM plugins will be able to benefit from this immediately, but React Native plugins will run into this Metro issue currently:

https://github.com/facebook/metro/issues/241
Pull Request resolved: https://github.com/facebook/react-native/pull/21082

Differential Revision: D9809094

Pulled By: hramos

fbshipit-source-id: 4b0694ad4119b37dd5664af52c48e48ebe4d7404
2018-09-13 04:31:38 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Michael Lee c5daf3fed9 Reformat BUCK files to follow new buildifier format
Summary: buildifier was updated and now we sort loads!

Reviewed By: zertosh

Differential Revision: D9771824

fbshipit-source-id: 0001aa5f656d4aa40b3498d5bfd792a3d14e56e1
2018-09-11 15:20:48 -07:00
Kræn Hansen d14922e5c9 Fixed status code when run-android fails (#21012)
Summary:
Fixes #21011
Pull Request resolved: https://github.com/facebook/react-native/pull/21012

Differential Revision: D9721471

Pulled By: hramos

fbshipit-source-id: 91f24c6009bd4f5399cffad960feed7213516145
2018-09-11 13:02:29 -07:00
Mike Grabowski 5d55f0368e Fix Metro preset version (#21034)
Summary: This pull request removes the hard-coded version of the `metro-react-native-babel-preset` as defined in the `init` command. That way, the version always matches React Native version specified in its `package.json`, making it match Metro version.

Differential Revision: D9759540

Pulled By: hramos

fbshipit-source-id: 90835442e2db1900851cbfb8c3c625229184d851
2018-09-10 16:19:11 -07:00
Matei Radu 4dfdec9b28 Update link command for Android project (#20853)
Summary:
Motivation:
--------------
PR #20767 bumped the version of the Android Gradle Plugin to v3 which uses the newer Gradle dependency configurations `implementation` and `api` which make `compile` obsolete.

While the PR updated the template Gradle configuration, it did not cover the `link` command which will still link native modules using `compile` resulting in a warning message beeing displayed during an app build.

Since `compile` will be eventually removed by Gradle, this commit updates the `link` command to attach native modules using `implementation`.
Pull Request resolved: https://github.com/facebook/react-native/pull/20853

Differential Revision: D9733888

Pulled By: hramos

fbshipit-source-id: 22853480d7ba7be65e3387effda2fd6c72b6906a
2018-09-08 04:31:37 -07:00
Jean Lauliac e8551520b5 local-cli: remove 'unbundle' naming in CLI (#21013)
Summary:
This also relink the require() onto `RamBundle.js` from Metro so we can remove `unbundle.js` from there completely.
Pull Request resolved: https://github.com/facebook/react-native/pull/21013

Reviewed By: hramos

Differential Revision: D9721443

Pulled By: jeanlauliac

fbshipit-source-id: 3e42ebde4cb2c735ef0934ba3b1e20f1054440df
2018-09-07 12:48:01 -07:00
Peter Keller d985b2e661 Fix orientation change issue in HelloWord template (#20945)
Summary:
This commit is related to issue #16060
Tested through the iOS simulator. Solution came from https://moduscreate.com/blog/changing-the-react-native-rootview-background-color-ios-and-android/
Pull Request resolved: https://github.com/facebook/react-native/pull/20945

Differential Revision: D9661761

Pulled By: hramos

fbshipit-source-id: ca8dd3fd09a0b0e89e1598a8114800808efa7d21
2018-09-05 13:22:07 -07:00
Ranjan Shrestha 27a07cf13c Use the round launcher icon available since 7.1 (#20968)
Summary:
The default react-native template has ic_launcher_round icons on the resources but has not been used.

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull Request resolved: https://github.com/facebook/react-native/pull/20968

Differential Revision: D9661731

Pulled By: hramos

fbshipit-source-id: ad8f2f952df2c32aea2a8d3e69c445ed27387aa6
2018-09-05 13:02:22 -07:00
Peter Keller e30ec0fcba Fix typo in comment (#20947)
Summary:
Overwrite instead of owerwrite

Release Notes:
--------------
[CLI] [MINOR] [local-cli/upgrade/upgrade.js] - Typo in comment fixed
Pull Request resolved: https://github.com/facebook/react-native/pull/20947

Differential Revision: D9661739

Pulled By: hramos

fbshipit-source-id: 378b44599313ab535af55981ddd80b0fcdbee448
2018-09-05 12:49:02 -07:00
Gabe Levi 66bd4992b8 Deploy v0.80.0 to xplat/js
Reviewed By: samwgoldman

Differential Revision: D9646704

fbshipit-source-id: d5a19f653785c81929337876936ba5069fc0abc3
2018-09-05 08:48:31 -07:00
Andrew Clark 9862a77b6a Use file name whitelist to prevent RCE
Summary:
Use a whitelist to validate user-provided file names. This doesn't cover the entire range of valid filenames but should cover almost all of them in practice. Allows letters, numbers, periods, dashes, and underscores. Opting to use a whitelist instead of a blacklist because getting this wrong leaves us vulnerable to a RCE attack.

This is the same patch I submitted to create-react-app: https://github.com/facebook/create-react-app/pull/4866

See s163726 for more details

Reviewed By: LukasReschke

Differential Revision: D9504148

fbshipit-source-id: e3c7587f1b7f93bec90a58a38d5f6d58f1f59275
2018-09-04 11:32:51 -07:00
Héctor Ramos 792cd0902e Bump lodash dependency (#20892)
Summary:
Per [CVE](https://nvd.nist.gov/vuln/detail/CVE-2018-3721) warning.
Pull Request resolved: https://github.com/facebook/react-native/pull/20892

Differential Revision: D9616099

Pulled By: hramos

fbshipit-source-id: 245c09ca32934c5e5464f87bfca213f1b10f8fec
2018-08-31 12:19:04 -07:00
George Zahariev 2f745ec2c2 Fix future sketchy-null errors after bug fix in '@flow strict' files
Reviewed By: wcheng86

Differential Revision: D9599872

fbshipit-source-id: dabcfd6fb7b6ec5a13801e84fe55d7d3c7ba9adb
2018-08-30 21:01:55 -07:00
empyrical 03476a225e Add support for out-of-tree platform plugins (#20825)
Summary:
This pull request adds the ability for a platform developer to provide a `"haste"` key under the `"rnpm"` key in their `package.json` which allows the packager to pick up that platform's javascript files. The intent is to remove the need to have custom platforms hardcoded in. This is inspired by the `"jest": { "haste": {} }` key used by jest.

For example, React Native Dom would have an entry like:

```json
{
  "rnpm": {
    "haste": {
      "providesModuleNodeModules": [
        "react-native-dom"
      ],
      "platforms": [
        "dom"
      ]
    }
  }
}
```

Support for more keys (path blacklists perhaps?) could be added in the future.

This succeeds #20662, as per a discussion I had with matthargett.

I've got an open discussion over here as well: https://github.com/react-native-community/discussions-and-proposals/issues/21
Pull Request resolved: https://github.com/facebook/react-native/pull/20825

Differential Revision: D9596429

Pulled By: hramos

fbshipit-source-id: a02f0da0bea8870bdc45d55e23da8ccbc36249f2
2018-08-30 16:38:07 -07:00
Rafael Oleza f661e0fb6e End metro server gracefully when there are some edge errors
Summary: This diff fixes a couple of edge cases that caused Metro to keep the process running when there were some specific errors (specially around the `dependencies` command and the transformer path).

Reviewed By: jrwats

Differential Revision: D9551834

fbshipit-source-id: 959cefcec9e2687dff89c94a871ae74c50d2dd77
2018-08-30 03:33:03 -07:00
Rafael Oleza f8f1870248 Make the --transformer CLI argument override the babelTransformerPath
Summary: D9070810 introduced a breaking change, making the `--transformer` CLI argument able to override the generic transformer instead of `babelTransformer`. Since we still have some scripts that assume `--transformer` is being used for overriding the babelTransformer path, we cannot do this breaking change yet, so this diff reverts the CLI handling to the old behaviour.

Reviewed By: jrwats

Differential Revision: D9550157

fbshipit-source-id: 8b4e26fcb5bca6e4b2f63b1e1a014bce23a31452
2018-08-28 19:01:57 -07:00
Lars Graubner 8dc209a523 improve contrast ratio in debugger-ui dark mode (#20559)
Summary:
The font colors in the debugger-ui dark mode are not accessible. This PR ensures [Level AAA Conformance to Web Content Accessibility Guidelines 2.0](https://www.w3.org/WAI/WCAG2AAA-Conformance) which makes it better to read for everyone.
Pull Request resolved: https://github.com/facebook/react-native/pull/20559

Differential Revision: D9495584

Pulled By: hramos

fbshipit-source-id: 1a9bdd015935fb27e2d74d2399e687787282a987
2018-08-24 02:32:29 -07:00
Rafael Oleza e4621f4ce1 Expose the actual transformer in the config
Summary:
This diff exposes the new more generic way to configure transformers in `Metro` via the config parameter `transformerPath`.

The new generic transformers can be used to transform any kind of file, since they don't call any JS-specific method and their API is generic. They only need to implement a single `transform` method:

```
async function transform(
  absolutePath: string,
  relativePath: string,
  fileContents: Buffer,
  options: TransformOptions, // very soon these will be configurable
): Promise<{
  output: Array<mixed>,
  dependencies: Array<{
    name: string,
    data: mixed, // very soon
  }>,
}> {
  // ...
}
```

Metro already had a `transformModulePath` config param, which was used to configure how babel was called in order to generate the AST. In order to avoid confusion, but keep the current open source transformer worker, I've renamed this param to `babelTransformerPath`. We can add a layer of compatibility and detect old config params in order to show a deprecation warning.

Reviewed By: pvdz

Differential Revision: D9070810

fbshipit-source-id: aebde879736026c09537f5d236eae24c06640abf
2018-08-23 15:48:04 -07:00
gengjiawen e2f2e41f09 refine android config (#20731)
Summary:
By this change we can unify version early, like we can make kotlin version share in buildscript and app dependency the same time ([butterknife](https://github.com/JakeWharton/butterknife/blob/master/build.gradle) use the same).
pass all current ci and one of my project https://github.com/gengjiawen/ReactNative64bitDemo.
none
 [GENERAL] [ANDROID] [TEMPLATE] - refine android config
Pull Request resolved: https://github.com/facebook/react-native/pull/20731

Differential Revision: D9482954

Pulled By: hramos

fbshipit-source-id: d864adbdbc624bc311ccc5f44a15d0334d2d8a59
2018-08-23 12:17:57 -07:00
gengjiawen 6e356895e7 bump android gradle to 3.1.4 (#20767)
Summary:
Bump android gradle plugin to 3.1.4. We have been stay to 2.x too long. With 3.x we can have instant run and great performance and new features brought by google.

Also thanks to CFKevinRef great pr to make this possible.
pass all current ci. I have also tested RNTester release version works without crash.
https://github.com/facebook/react-native/pull/17967.
 [GENERAL] [ANDROID] [FEATURE] - bump android gradle to 3.1.4
Pull Request resolved: https://github.com/facebook/react-native/pull/20767

Differential Revision: D9437576

Pulled By: hramos

fbshipit-source-id: 6084056a1390582a75a879918f2538b0480f6299
2018-08-22 23:19:42 -07:00
Dulmandakh 044b399e65 Bump compileSdkVersion to 27 and buildToolsVersion to 27.0.3 (#20777)
Summary:
I found that android support library 27.x (874cca1ac2) requires compileSdkVersion to be 27. Also found that many FB projects use SDK 27.
Pull Request resolved: https://github.com/facebook/react-native/pull/20777

Differential Revision: D9478431

Pulled By: hramos

fbshipit-source-id: ca100f6b5b39e7d112926124423f9510a0efc291
2018-08-22 23:19:42 -07:00