Summary:
Continuation of https://github.com/facebook/react-native/pull/22174 with an exception that `local-cli` folder is left in React Native repository to keep Facebook internal and React Native calls still working.
Separate strategy should be developed to remove all uses of `local-cli` in favor of dedicated utilities.
Pull Request resolved: https://github.com/facebook/react-native/pull/22337
Reviewed By: TheSavior
Differential Revision: D13172898
Pulled By: cpojer
fbshipit-source-id: 0217867f9944648307475ebe629eb729da7bfaaf
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
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
Summary: This change drops the year from the copyright headers and the LICENSE file.
Reviewed By: yungsters
Differential Revision: D9727774
fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
Summary:
@public
While debugging a RN 0.57 blocking issue, we found that the `--reset-cache` cli arg is not being passed to Metro (more info: https://github.com/facebook/react-native/issues/20567#issuecomment-412513942).
This diff fixes this issue
Reviewed By: mjesun
Differential Revision: D9295634
fbshipit-source-id: a53ec7abff2b7e684a1fd88c3b53ff0b54a1c3c4
Summary:
The `hmrEnabled` flag was not passed to the metro runServer config which caused HMR to be broken.
Pull Request resolved: https://github.com/facebook/react-native/pull/20605
Differential Revision: D9272070
Pulled By: hramos
fbshipit-source-id: 3765031d9e7806be11781fba92663ce7c4ff2ffb
Summary: Change the internals of Metro to use the new configuration instead of `ServerOptions`.
Reviewed By: rafeca
Differential Revision: D8734685
fbshipit-source-id: 1215f799419fcaa0e5fb7814683da1cbba96795c
Summary: Change the public react-native CLI to use the new configuration of Metro.
Reviewed By: rafeca
Differential Revision: D8801217
fbshipit-source-id: 112e4812b430ebee1ed41489f803b90c182ccdb4
Summary: In this diff I change the internal react-native cli to use our new configuration. Another change here is that Metro starts using the new configuration already as its entry points (like `metro#runMetro`).
Reviewed By: rafeca
Differential Revision: D8728612
fbshipit-source-id: 9f43dee31ebaccd35cf6274d5c4dec0a227a6eec
Summary:
This fixes some regressions with local-cli introduced in c4a66a89a2.
- We didn't pass `assetRegistryPath` which caused the following error when loading the bundle:
```
error: bundling failed: Error: Unable to resolve module `missing-asset-registry-path` from `/Users/janic/Developer/react-native/RNTester/js/uie_thumb_normal@2x.png`: Module `missing-asset-registry-path` does not exist in the Haste module map
```
- The middlewares were not added to the metro server. This causes some packager server features to fail. The one I noticed is that the /status endpoint didn't exist anymore which causes CI to fail and also Android to not load the bundle from the packager initially. The remote debugging feature was also broken.
Pull Request resolved: https://github.com/facebook/react-native/pull/20162
Differential Revision: D8867610
Pulled By: hramos
fbshipit-source-id: 8a08b7f3175692ab6ee73c0a7c25075091ae4792
Summary: No new errors in this version. Just removed a bunch of unused suppressions
Reviewed By: TheSavior
Differential Revision: D8754160
fbshipit-source-id: 2f02240b6d65edecba5d9ed603c7703462547a7f
Summary: `morgan` produces non-json output, which affects `js1 run` when ran with the `--json` flag.
Reviewed By: Kureev
Differential Revision: D8724830
fbshipit-source-id: 11377f6ef39341c658a7f905383398423a721630
Summary:
Scope of the diff:
1. Middleware
`react-native-github/local-cli` and `react-native-internal-cli` uses a very similar set of middlewares (internal cli extends github version), so I decided to move it to a standalone file (middleware manager) in order to remove duplications and increase readability.
2. Types
Seems that after Flow upgrade to version 0.68 there were many type issues to resolve, so all of them were auto-mocked. This is fine, but I'd like to see Flow assists me with `Metro.createServer` -> `Metro.runServer` migration. Hence, I decided to resolve flow mocks, related to runServer.
3. `runServer` signature
In `react-native-github` repo I cleaned up `runServer` signature by removing `startCallback` and `readyCallback` from the function parameters and moved them to `runServer` instead.
4. Replace `createServer` by `runServer`
In `react-native-github` repo, `createServer` has been replaced by `runServer`. __Some of arguments are not mapped__.
Note that this diff will partially break argument mapping. This is intentional. @[100000044482482:ives] will fix it with a new config package.
Reviewed By: mjesun
Differential Revision: D8711717
fbshipit-source-id: a843ab576360ff7242099910d8f25a9cb0a388c0
Summary:
This diff tries to fix an issue that started appearing in RN master when the latest metro version is used (more info here: c5ce762697 (commitcomment-29443117)).
The problem is that RN is still reading `projectRoots` from the Metro config and trying to call `concat()` on them. Latest Metro sets the default `projectRoots` to null, so this fails.
Also, a couple other things have been done:
* Make sure that the `projectRoot` and `watchFolder` objects from args are passed to Metro (so they contain the overrides from the CLI arguments).
* Add a `--projectRoot` CLI arg, replacing the `--root` one (this is not actually needed, since it does the same as `--watchFolders`
Differential Revision: D8567229
fbshipit-source-id: 3b76fd8e23d201a4097e9dfba3a512d64f348cb0
Summary:
We use projectRoots to limit crawling of jest-haste-map in large codebases. Since this implies multiple projects roots, it makes it very hard (or impossible) to reliably cache dependency resolutions.
If we can replace this with a single project root and a set of watch roots, we can have relative path resolutions for all dependencies which van be cached.
Reviewed By: rafeca
Differential Revision: D8450498
fbshipit-source-id: 830c21e847c3236e42d5414a8587508cb73864bd
Summary:
Add ignores for these requires, some of them mistakenly removed by da3424c929.
```
yarn flow
```
CircleCI should be green again.
Closes https://github.com/facebook/react-native/pull/18021
Differential Revision: D7025304
Pulled By: jeanlauliac
fbshipit-source-id: 731232093ae3ab39b3eff6fb2004ff4e7090d5ae
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
Summary: Tries to adress https://github.com/facebook/metro/issues/65. We need a reasonnable workaround to support modules like `moment.js` that do dynamic requires but only in some cases. By replacing the call by a function that throws, we move the exception at runtime instead of happening at compile time. We don't want to do that for non-node_modules file because they are fixable directly, while `node_modules` are not fixable by people and they get completely blocked by the error at compile time.
Reviewed By: rafeca
Differential Revision: D6736989
fbshipit-source-id: a6e1fd9b56fa83907400884efd8f8594018b7c37
Summary:
`metro-bundler` v0.21 contains a rewritten bundling mechanism, with simplified logic and much faster rebuild times, called delta bundler. This release contains a couple of breaking changes:
* Now, when using a custom transformer, the list of additional babel plugins to apply are passed to the `transform()` method. These are used in non-dev mode for optimization purposes (Check 367a5f5db8 (diff-40653f0c822ac59a5af13d5b4ab31d84) to see how to handle them from the transformer).
* Now, when using a custom transformer outputting `rawMappings`, the transformer does not need to call the `compactMappings` method before returning (check d74685fd1d (diff-40653f0c822ac59a5af13d5b4ab31d84) for more info).
* We've removed support for two config parameters: `postProcessModules` and `postProcessBundleSourcemap`.
Reviewed By: davidaurelio
Differential Revision: D6186035
fbshipit-source-id: 242c5c2a954c6b9b6f339d345f888eaa44704579
Summary: makes flow typing for the entry point more sound and fixes two issues
Reviewed By: BYK
Differential Revision: D5507650
fbshipit-source-id: 6b03f7de792ffcece4d0d61950e136a61ea7db2e
Summary:
This adds support to RN's configuration file to let people turn off Babel's behavior of looking up .babelrc files. Most of the support for this feature is in Metro (https://github.com/facebook/metro-bundler/pull/31).
Closes https://github.com/facebook/react-native/pull/15136
Differential Revision: D5483241
Pulled By: jeanlauliac
fbshipit-source-id: c78096c1574c9f844c9f34aff73e6f97cb0b5e45