Summary:
This vars should be let instead of const because they are reassigned.
Closes https://github.com/facebook/react-native/pull/10818
Differential Revision: D4179219
Pulled By: javache
fbshipit-source-id: b09959c5ff31ad1a896d454011dffd915a0a44c4
Summary:
Solving this issue https://github.com/facebook/react-native/issues/10364
In development when assets are requested from AssetServer, it tries to find them with URI-friendly filenames. I added a single line to decode these filenames.
Tests are passing. Couldn't find any discussion regarding whether this is a good idea. This was causing some members of my team a bit of grief earlier.
Closes https://github.com/facebook/react-native/pull/10365
Differential Revision: D4168401
Pulled By: hramos
fbshipit-source-id: 9ed3606392d8a6f170998caaf0f9254ba4879b49
Summary:
This PR tells babel where the babelrc file is if it has been found in the project root. I know you guys are relying on babel to find it when you tell babel the filename and sourceFilename, this works fine in normal js/node projects, here is an example where this will not work.
We have a big repo that can contain a few react-native / js projects. Our build system is similar to BUCK and we keep our third party dependencies in a separate folder (having a global package.json at the project route is not feasible as everyone will have to install every apps dependencies even when they don't need them), the structure looks a bit like this:
`third_party/js/.` packages from node_modules
`common/js/` common code used by numerous apps, common components, services etc.
`my_app/native` the app
What's happening is something from `my_app/native` (where the .babelrc file is) is requiring something from `common/js` which is then requiring something from `third_party/js` and so babel has no idea what .babelrc file to use and
Closes https://github.com/facebook/react-native/pull/8131
Differential Revision: D4167844
Pulled By: hramos
fbshipit-source-id: 3569981e26ff8f8c632d8ae365a1f43a3483b13b
Summary:
- Put `isPolyfill` parameter into `options` object
- Save information whether a file is a polyfill
- Sort properties alphabetically
- Rename parameters
Reviewed By: cpojer
Differential Revision: D4153203
fbshipit-source-id: 67da97546a15c899112b74da6072acdea18d10e8
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?
Provides better documentation for a confusing (and common) error message. Solves https://github.com/facebook/react-native/issues/3634
> **Test plan (required)**
This is just an error message shown in dev environment. I ran the tests and they pass.
Closes https://github.com/facebook/react-native/pull/10472
Differential Revision: D4053818
Pulled By: hramos
fbshipit-source-id: e80dc6ab787a8d8cabbcb442c438c07269401ff7
Summary: This adds support to wrap polyfills differently from regular modules (`(function(global){ ... }(this))` instead of `__d(function...)`.
Reviewed By: cpojer
Differential Revision: D4147031
fbshipit-source-id: c19e968c1498cac653ab2649e3089d8c29571926
Summary: Use native Promises in React Native Packager. Remove all the non-standard `Promise.done()` calls throughout the codebase & replace `Promise.denodeify` with the stand-alone `denodeify` module.
Reviewed By: davidaurelio
Differential Revision: D4146965
fbshipit-source-id: 1730531c914863ac3c52626801d9f91c28eed717
Summary: In addition to adding flow in that file, I also had to fix `Module.js` and others to make everything compatible together.
Reviewed By: davidaurelio
Differential Revision: D4118829
fbshipit-source-id: 4f6dbc515741c38817cc4c9757e981fabb03915a
Summary:
The new Packager/Buck integration passes module factory functions as first argument, so that the complete call can be amended at the end safely at a later point in time.
The call expression as a whole is covered perfectly by the created source map. Appending to that code later won’t break mappings.
`__d` now also accepts an additional `dependencyMap` parameter, which so far is only used by the new Packager/Buck integration. It enables module-local dependency IDs, thus eliminating the need to insert `correct` module IDs when building a bundle. Advantages are that source maps are no longer affected, and that builds can be quicker.
Reviewed By: cpojer
Differential Revision: D4124333
fbshipit-source-id: 12eba15d0b9d8c6624280a2ba1e7e4bc654bc83d
Summary:
increase the `MAX_WAIT_TIME` in FileWatcher since live reloading doesn't work for a lot of users on windows when developing android. There may be a better timeout than arbitrarily tripling it, I'm sure the original developer would be able to pick out a good one, but many of us have used this change to finally be able to use RN here on windows.
fixes https://github.com/facebook/react-native/issues/8784https://github.com/facebook/react-native/issues/7257
Closes https://github.com/facebook/react-native/pull/10690
Differential Revision: D4126110
Pulled By: mkonicek
fbshipit-source-id: 9b6f188fe9d39bcdcc2b38392dfc644a518296b2
Summary: Correctly generate log entries for file transforms and ping telemetry using the new Logger API.
Reviewed By: bestander, cpojer
Differential Revision: D4081325
fbshipit-source-id: 7d50d54eb673a0276512db6ad5ff21c344495612
Summary: Adds the Console agent which we hook from our console polyfill. It captures the stack and strips the frames of the polyfill.
Reviewed By: davidaurelio
Differential Revision: D4021502
fbshipit-source-id: 49cb700a139270485b7595e85e52d50c9a620db6
Summary: We actually use the AST, not regexes. Fix comment.
Reviewed By: davidaurelio
Differential Revision: D4104797
fbshipit-source-id: e37d168bd541d9d222667d0d168aa6b6099c1275
Summary:
This change is related to https://github.com/facebook/react-native/issues/9677 that can happen when trying to get an Xcode release build, which in turn calls `react-native-xcode.sh` and if one has a non-standard file setup, ex:
```
ios/
|_ (iOS related code)
js/
|
|_ index.ios.js
node_modules
package.json
(other React Native JS code)
```
The error output in this case is:
```
+ DEST=/Users/caabernathy/Library/Developer/Xcode/DerivedData/Mixer-ffglwypovddbciahtlducaeuqxqa/Build/Products/Release-iphonesimulator/Mixer.app
+ [[ Release = \D\e\b\u\g ]]
+ BUNDLE_FILE=/Users/caabernathy/Library/Developer/Xcode/DerivedData/Mixer-ffglwypovddbciahtlducaeuqxqa/Build/Products/Release-iphonesimulator/Mixer.app/main.jsbundle
+ node /Users/caabernathy/Facebook/OpenSource/Apps/RWMixer/Sample/Build/Mixer-Challenge/js/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --reset-cache --bundle-output /Users/caabernathy/Library/Developer/X
Closes https://github.com/facebook/react-native/pull/10262
Differential Revision: D4100083
Pulled By: lacker
fbshipit-source-id: 476f38990d09d5c26c22df77630b1a71b42959e2
Summary: Add session ID to be appended to every event in the current Packager session.
Reviewed By: davidaurelio
Differential Revision: D4029580
fbshipit-source-id: 8c34c1f44ee63f845d15f8f89e491ab5c936fb21
Summary: In order to make `Config` and defaults available to our new code, I’ve added flow types and put default values into one shared modile
Reviewed By: cpojer
Differential Revision: D4044600
fbshipit-source-id: 875ed3ade69c5b22bb3c1b177e7bad732834d476
Summary:
This makes ResolutionRequest stop calling `dirname` when arriving at `"."`, not only at `parse(path).root`.
Needed for Buck integration, as we are using relative paths there
Reviewed By: cpojer
Differential Revision: D4058723
fbshipit-source-id: d1856043193cfad3f750577ba0f63f03f8effe7a
Summary: I originally added fastpath to node-haste to speed up `path` operations by an order of magnitude. Now we are exclusively using Node 6 at FB so we don't need to ship this thing any more.
Reviewed By: bestander
Differential Revision: D4029092
fbshipit-source-id: 064cf67f4f79ce4f2774fb4e430d22eef4a95434
Summary:
This creates flow types for the module resolution code in node-haste, and implementations of types used by that code.
The idea is to use that code until we can replace it with something leaner, and provide objects that don’t touch the file system. These objects will be initialized with the static data provided by ModuleGraph/worker.
Reviewed By: cpojer
Differential Revision: D4037372
fbshipit-source-id: 2698dbb630f4122fc1d839d06e414d0963bd6ff2
Summary: Removes code that is no longer used
Reviewed By: matryoshcow
Differential Revision: D4021932
fbshipit-source-id: d73dc8450478288afd71eab451a30a505e7de945
Summary: Update Activity API to allow adding more details to events for telemetry purposes.
Reviewed By: davidaurelio
Differential Revision: D3982691
fbshipit-source-id: 07f3ed5d1ec4eddbbdeb00feb02ea75e1168705e
Summary:
* Motivation *
Second PR for Apple TV support.
* Test plan *
Apple TV tests have been added to scripts/objc-test.sh
Closes https://github.com/facebook/react-native/pull/10227
Differential Revision: D3974064
Pulled By: javache
fbshipit-source-id: 36dffb4517efa489e40fa713a30655d1d76ef646
Summary:
Context: I'm trying to add support for sending packager progress events to the client that is downloading the bundle over HTTP multipart response.
The idea is for the client to send `Accept: multipart/mixed` header, and if present the server will stream progress events to the client. This will ensure the change is backwards-compatible - the clients who don't know about progress events won't receive them.
In the future we can use this approach to download RAM bundle modules in one request.
Reviewed By: davidaurelio
Differential Revision: D3926984
fbshipit-source-id: 39a6e38e40a79f7a2f2cf40765a0655fb13b7918
Summary:
Context: I'm trying to add support for sending packager progress events to the client that is downloading the bundle over HTTP multipart response.
In order to do that I need the server to know about these events. Currently the bundler doesn't expose any hooks for monitoring the progress, so this diff introduces `onProgress` option for that.
Reviewed By: davidaurelio
Differential Revision: D3926806
fbshipit-source-id: b7d9c649df4f94ddf5082791209844610650325e
Summary: Modified `node-haste` implementation to use the much faster `jest-haste-map` under the hood. The underlying `fastfs` now gets passed the entire file list from the `jest-haste-map` rather than crawl the filesystem.
Reviewed By: cpojer
Differential Revision: D3724387
fbshipit-source-id: 447d58ea0edf283662ec23d1e2deee992cf8d240
Summary: Changed “Finding dependencies” and “Building Module Graph” to “Transforming modules” and “Initializing Packager” for more clarity
Reviewed By: matryoshcow
Differential Revision: D3950811
fbshipit-source-id: 7a2e655ef7e1655244ce427e7adc8c1e5afa7329
Summary:
React native's reload javascript option doesn't always work on iOS devices since version 0.29, as described in https://github.com/facebook/react-native/issues/9617
It only doesn't work when you have a mac on a wireless connection, because react-native-xcode.sh can't find your IP address correctly in this case and will just fallback to use the pre-bundling option on your app.
This small change in react-native-xcode.sh fixed this issue for our project and should fix this issue for all mac users that use wireless connection and that will run a debug version of the app on a real iOS device.
Closes https://github.com/facebook/react-native/pull/9964
Differential Revision: D3923035
fbshipit-source-id: 436cfa2103e10221270034233552ce34720505d3
Summary: File platform identifiers (`fileName.<platform>.js`) are no longer part of the blacklist regular expression. This allows the upcoming `jest-haste-map` to include all files for all platforms, therefore enabling Packager to build bundles for different platforms using the same `HasteMap`(jest-haste-map) instance.
Reviewed By: davidaurelio
Differential Revision: D3907508
fbshipit-source-id: d7d7f3bd93287a634a1ef0590a736d021be2aaa5
Summary:
The current test checks whether the target platform is `'ios'`. When building with windows, errors will also be swallowed silently.
This adds a check whether the target platform is `'android'`, where we have to avoid throwing for FB-internal reasons.
Reviewed By: martinbigio
Differential Revision: D3907025
fbshipit-source-id: 5abeb06b9121265fe1aa3932ad1785f148f04ddf
Summary:
We could probably relieve a lot of pain (in [this issue](https://github.com/facebook/react-native/issues/4968) specifically) by fixing the error message for when a module cannot be resolved after trying every relevant `node_modules` directory.
Currently, you get a confusing error message that only gives you the last `node_modules` directory checked. By creating the error message where we can access the `searchQueue`, we're able to provide all of the attempted `node_modules` directories.
Here's an example error message:
```
Unable to resolve module leftpad from /Users/aleclarson/ReactProject/src/stuff/index.js:
Module does not exist in the module map or as these directories:
/Users/aleclarson/ReactProject/src/stuff/node_modules/leftpad
/Users/aleclarson/ReactProject/src/node_modules/leftpad
/Users/aleclarson/ReactProject/node_modules/leftpad
/Users/aleclarson/node_modules/leftpad
/Users/node_modules/leftpad
```
Closes https://github.com/facebook/react-native/pull/9832
Differential Revision: D3895408
Pulled By: davidaurelio
fbshipit-source-id: 872c9a3bb3633f751ec69b586a261616578ed511
Summary:
Adds a new URL option to the packager server called "assetPlugin". This can be a name of a Node module or multiple Node modules (`assetPlugin=module1&assetPlugin=module2`). Each plugin is loaded using `require()` and is expected to export a function. Each plugin function is invoked with an asset as the argument. The plugins may be async functions; the packager will properly wait for them to settle and will chain them.
A plugin may be used to add extra metadata to an asset. For example it may add an array of hashes for all of the files belonging to an asset, or it may add the duration of a sound clip asset.
Closes https://github.com/facebook/react-native/pull/9993
Differential Revision: D3895384
Pulled By: davidaurelio
fbshipit-source-id: 0afe24012fc54b6d18d9b2df5f5675d27ea58320
Summary:
We can keep the `searchQueue` cleaner by using `this._fastfs.dirExists` on the potential `node_modules` directory. In addition to avoiding useless lookups, this also makes the error message provided by #9832 much more understandable.
/cc davidaurelio
Closes https://github.com/facebook/react-native/pull/9973
Differential Revision: D3887053
Pulled By: davidaurelio
fbshipit-source-id: 6a5a488bb4217dd0f9db1c9c9f988b498c746ca9
Summary:
Hi,
This PR fixes the problem described by chrisnojima in https://github.com/facebook/react-native/issues/9581#issuecomment-243766310
**Test plan**
In development mode,
- Run an app with an image: `<Image source={ require('./logo.png') }/>`
- Notice that you see the following in packager console:
```txt
6:46:42 PM] <START> processing asset request logo.png
[6:46:42 PM] <END> processing asset request logo.png (1ms)
```
- Reload the app, or navigate to another page of the app with the same image
- Notice that you see again:
```txt
6:47:23 PM] <START> processing asset request logo.png
[6:47:23 PM] <END> processing asset request logo.png (1ms)
```
Now wih the fix applied,
notice that you only see `logo.png` fetched once, even if you reload or show the same image in a different part of the app.
Let me know what you think.
Closes https://github.com/facebook/react-native/pull/9795
Differential Revision: D3876945
Pulled By: davidaurelio
fbshipit-source-id: f41f4719e87644692a690123fd6e54eead9cc87d
Summary:
The introduction of groups for random access bundles broke hot module reloading, because HMR uses a different Bundle class. And that didn’t have the `setRamGroups()` method.
This just adds an empty method on the base class.
**Test plan (required)**
I ran `node scripts/run-ci-e2e-tests.js --android`
Closes https://github.com/facebook/react-native/pull/9982
Differential Revision: D3886096
Pulled By: bestander
fbshipit-source-id: 46e6183607b0275d3cfe0d892360248b7b2154e9
Summary:
Adds the possibility to specify an array of files (group roots) that are used to bundle modules outside of the “startup section” into bigger groups by colocating their code.
A require call for any grouped module will load all modules in that group.
Files contained by multiple groups are deoptimized (i.e. bundled as individual script)
Reviewed By: martinbigio
Differential Revision: D3841780
fbshipit-source-id: 8d37782792efd66b5f557c7567489f68c9b229d8