Summary: Rejected promises in the cache would prevent the cache from persisting. This removes rejected promises from the cache, so that subsequent successful cache updates can be persisted.
Reviewed By: cpojer
Differential Revision: D3726691
fbshipit-source-id: ddec03676a7a89264fe64b4af4b183cbead638fb
Summary:
This clears the packager server cache for potential changes of module resolutions.
We will make this a lot better in the future, but for now this crude mechanism will have to do.
Reviewed By: cpojer
Differential Revision: D3713143
fbshipit-source-id: 7c81f40e8ec71404c3369211b29f63928d6634b9
Summary:
This is a very hacky solution to make reloads from packager faster for simple file changes.
Simple means that no dependencies have changed, otherwise packager will abort the attempt to update and fall back to the usual rebuilding method.
In principle, this change avoids re-walking and analyzing the whole dependency tree, and just updates modules in existing bundles.
Reviewed By: bestander
Differential Revision: D3713704
fbshipit-source-id: ba182325c4f4003c0a7402ea87444a94c75ebaf8
Summary:
This is a very hacky solution to make reloads from packager faster for simple file changes.
Simple means that no dependencies have changed, otherwise packager will abort the attempt to update and fall back to the usual rebuilding method.
In principle, this change avoids re-walking and analyzing the whole dependency tree, and just updates modules in existing bundles.
Reviewed By: bestander
Differential Revision: D3703896
fbshipit-source-id: abc2a41144536baf969d346522a17044c1c9558b
Summary:
This is a very hacky solution to make reloads from packager faster for simple file changes.
Simple means that no dependencies have changed, otherwise packager will abort the attempt to update and fall back to the usual rebuilding method.
In principle, this change avoids re-walking and analyzing the whole dependency tree, and just updates modules in existing bundles.
Reviewed By: bestander
Differential Revision: D3703896
fbshipit-source-id: 671206618dc093965822aed7161e3a99db69a529
Summary:
We have a weak build machine for React Native app: a poor Mac Book Air with HDD, which is very slow.
So, fs operations sometimes fail because of timeout.
We likely don't care about build time, but it's pretty annoying to restart builds sometimes.
In this PR I make timeout injectable via environment variable.
__USAGE__:
export this variable into environment. It's measured in miliseconds.
Example, for 1 minute timeout:
`export REACT_NATIVE_FSOP_TIMEOUT=60000`
If you don't specify it, it will remain default value: `15000`
This should not break anything, but repair slow builds.
Related to : #9373 , #8794 (I think so)
This PR should handle case of issue and close#9373
Closes https://github.com/facebook/react-native/pull/9374
Differential Revision: D3709325
Pulled By: bestander
fbshipit-source-id: b00c89e10d05362314546faea7a4524f3d327c97
Summary: This removes asset data that is not used at runtime from the bundle.
Reviewed By: javache
Differential Revision: D3628486
fbshipit-source-id: 33cd579c904e0b0e29502df39a4ff92cad43367c
Summary:
https://github.com/facebook/react-native/pull/8219 adds range requests to the asset server, but there was an off-by-one-error that made responses end prematurely. This made (for example) react-native-video not work for video assets. This change fixes the off-by-one error and react-native-video works with assets.
**Test plan (required)**
Try the test in the original pull request for range requests: https://github.com/facebook/react-native/pull/8219
Closes https://github.com/facebook/react-native/pull/9254
Differential Revision: D3680070
fbshipit-source-id: 3f2a18ba9f35b45b340f4a1046bc099b8444eb7d
Summary: Looks like react-addons-perf is sometimes missing entries. This prevents it from crashing.
Reviewed By: davidaurelio
Differential Revision: D3669007
fbshipit-source-id: 18a1102b5ad8dcfd9b80d39e1172ba85ad0e9dd2
Summary:
Since jest stopped using node-haste a while ago, we are the only client left.
This brings back node-haste back to fbsource to allow us to iterate faster.
Reviewed By: bestander
Differential Revision: D3641341
fbshipit-source-id: a859f8834765723a3515e2cf265581b9dd83997c
Summary: This shows at max 5 progress updates per second on the terminal, which results in a minor speedup of reloads.
Reviewed By: bestander
Differential Revision: D3620164
fbshipit-source-id: d1a30f2f29f7088602d276b8ad3fc8ff1b74c79d
Summary:
This changes the jest preprocessor so that files targetet at node.js will be run with the node-specific transform.
It also adapts tests that relied on inline requires.
Benefit: packager tests run faster now.
Reviewed By: cpojer
Differential Revision: D3562007
fbshipit-source-id: e06c86d545926a5c546458025f505dca115e7ea8
Summary:
This PR solves a problem when video assets are used from third-party React Native components (e.g. [react-native-video](https://github.com/brentvatne/react-native-video). The video will not work while the assets are served from the react native packager because the used video component (iOS) relies on HTTP range requests.
I added a small fix that allows ranged requests (e.g. mp4) to be served in ranges.
To test this:
1. make new react native project
1. add [react-native-video](https://github.com/brentvatne/react-native-video) to xcode project
1. add video component to your project
```
import Video from 'react-native-video';
var resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
/* ... /*
render() {
let source = resolveAssetSource(require('./someVideoFile.mp4')) || {};
return <Video /*....*/ source={source} />;
}
```
That should not work (if video is smaller than a few megabytes, open app a few times). Then add my fix, that should do the trick.
Closes https://github.com/facebook/react-native/pull/8219
Reviewed By: davidaurelio
Differential Revision: D3542485
Pulled By: frantic
fbshipit-source-id: e4f2e4d3aaafa8445e965259bf04ad107dba8a4f
Summary:
This pull request fixes a small typo when a module fails being transformed through the React Packager.
Closes https://github.com/facebook/react-native/pull/8596
Differential Revision: D3522272
Pulled By: mkonicek
fbshipit-source-id: e117a26bab5a99573ac68fb0e7618df0a14325a4
Summary:
Looks like spaces in function names can happen, but the lib we use for parsing stacktraces doesn't support that. As result, when error is thrown in global scope, new JSC puts "global code" as function name, our parser chokes on it and thinks "global code@http://...." is a file name and sends it to packager. The packager can't resolve that URL and fails the whole symbolication request.
Longer term fix here: https://github.com/errwischt/stacktrace-parser/pull/5
Reviewed By: astreet
Differential Revision: D3516741
fbshipit-source-id: 7f14b52a50a118dc95a3463aee842941e904e984
Summary:
Looks like spaces in function names can happen, but the lib we use for parsing stacktraces doesn't support that. As result, when error is thrown in global scope, new JSC puts "global code" as function name, our parser chokes on it and thinks "global code@http://...." is a file name and sends it to packager. The packager can't resolve that URL and fails the whole symbolication request.
Longer term fix here: https://github.com/errwischt/stacktrace-parser/pull/5
Reviewed By: astreet
Differential Revision: D3516741
fbshipit-source-id: 4f2bb70084437ed9d37495cd775622a8c981fad1
Summary: This removes `node_modules/react` from the list of directories that are used for haste module resolutions. Modules required from React are now imported with `require('react/lib/…')`.
Reviewed By: astreet
Differential Revision: D3509863
fbshipit-source-id: 32cd34e2b8496f0a6676dbe6bb1eacc18124c01e
Summary:
* Next version of Jest doesn't allow non test files in __tests__ folders.
* I'm trying to switch all tests off of jsdom on react-native. This should save 500ms of time when running a single test because jsdom is slow to load and react-native is also not supposed to run in a DOM environment, so let's not pretend we are providing the DOM in tests.
* Make the bridge config configurable so that when we disable automocking and we reset the registry we can redefine the value.
Oh also, stop using lodash in Server.js. First off, lodash 3 doesn't work in Jest's node env because it does some crazy stuff, second because we don't need to load all of lodash for debounce.
Reviewed By: davidaurelio
Differential Revision: D3502886
fbshipit-source-id: 1da1cfba9ed12264d81945b702e7a429d5f84424
Summary:
When an asset is included in a module, and the directory for that asset can't be found in any of the roots, it is hard to debug that, because the error message contains neither the name of the requested file, the sub directory it is located in, nor the roots that have been searched for it. It becomes more difficult, because that exception is created asynchronously. It contains the calling promise code.
This diff makes the error message more useful by including the name of the file, the sub directory, and the roots.
Reviewed By: bestander
Differential Revision: D3456738
fbshipit-source-id: 60b81f04626ad386f7120247c5f5361c81c52968
Summary:
This makes sure that `getModuleId` is called on modules in the order returned by `node-haste`, rather than waiting for a couple of promises to resolve before calling the function.
Related: #7758
Reviewed By: frantic
Differential Revision: D3450853
fbshipit-source-id: 7f26590b39b94ade32c73a8db9fd31d283d57549
Summary:
When trying to access the debug dependency graph through the `/debug/graph` endpoint of the packager server (documented in the packager README and listed as well when hitting the root `/debug` endpoint), all I am getting back is a nasty HTTP 500 error :'(
What triggers this HTTP 500 is a `TypeError` being thrown while trying to access a function that doesn't exists (anymore). Here is the error log of the packager when trying to access this endpoint :
```
TypeError: this._depGraph.getDebugInfo is not a function
at Resolver.getDebugInfo (index.js:270:27)
at Bundler.getGraphDebugInfo (index.js:575:27)
at Server._processDebugRequest (index.js:369:28)
at Server.processRequest (index.js:423:12)
at next (/Users/blemair/Code/DependencyGraphTest/node_modules/connect/lib/proto.js:174:15)
at Object.module.exports [as handle] (cpuProfilerMiddleware.js:17:5)
at next (/Users/blemair/Code/DependencyGraphTest/node_modules/connect/lib/proto.js:174:15)
at Object.module.exports [as
Closes https://github.com/facebook/react-native/pull/8117
Differential Revision: D3445582
fbshipit-source-id: cf5af8bbba293f39773f32814a3b388b7ff67bf7
Summary:
When remote debugging is enabled, stack traces start at `/debuggerWorker.js`. Since this is not a valid bundle URL, the packager fails to decipher it to find its sourcemap.
This changes the packager to skip the `/debuggerWorker.js` stack frame if one exists.
Reviewed By: frantic
Differential Revision: D3418341
fbshipit-source-id: 7434aa45dea7d120d9d77c060101dd9403989d0c
Summary: We are already inlining `Platform.OS`. This diff adds support to inline calls to `Platform.select` with an object literal as first argument. The transform will replace the call with the property value corresponding to the platform, or `undefined` if it does not exist.
Reviewed By: frantic
Differential Revision: D3385391
fbshipit-source-id: bb068d17948ed84e381707faeaa0450399c2f306
Summary:
Update to node-haste 2.12.0 to support pass through configuration of supported platforms.
Closes https://github.com/facebook/react-native/pull/7660
Differential Revision: D3335034
Pulled By: mkonicek
fbshipit-source-id: d238b90a90d51654301d61251ceb26d183fef57a
Summary:
The way we currently symbolicate JS stack traces in RN during development time
(e.g. inside the RedBox) is the following: we download the source map from RN,
parse it and use `source-map` find original file/line numbers. All happens
inside running JSC VM in a simulator.
The problem with this approach is that the source map size is pretty big and it
is very expensive to load/parse.
Before we load sourcemaps:
{F60869250}
After we load sourcemaps:
{F60869249}
In the past it wasn't a big problem, however the sourcemap file is only getting
larger and soon we will be loading it for yellow boxes too: https://github.com/facebook/react-native/pull/7459
Moving stack trace symbolication to server side will let us:
- save a bunch of memory on device
- improve performance (no need to JSON serialize/deserialize and transfer sourcemap via HTTP and bridge)
- remove ugly workaround with `RCTExceptionsManager.updateExceptionMessage`
- we will be able to symbolicate from native by simply sending HTTP request, which means symbolication
can be more robust (no need to depend on crashed JS to do symbolication) and we can pause JSC to
avoid getting too many redboxes that hide original error.
- reduce the bundle by ~65KB (the size of source-map parsing library we ship, see SourceMap module)
Reviewed By: davidaurelio
Differential Revision: D3291793
fbshipit-source-id: 29dce5f40100259264f57254e6715ace8ea70174
Summary:
This pull request is a prerequisite to enabling the react-native-windows platform extension.
In the Resolver component, we need to add 'windows' to the list of platforms that are allowed in the DependencyGraph. We also need to add 'react-native-windows' (the name of the Windows platform extension NPM module) to the `providesModuleNodeModules` option. This allows the node_module folder check in the DependencyGraphHelper from node-haste to be bypassed for *.windows.js files in the Windows NPM package.
For good measure, I also included a change to blacklist.js to ensure .windows.js files are ignored when the packager is parameterized on a platform.
Closes https://github.com/facebook/react-native/pull/7639
Differential Revision: D3327771
Pulled By: mkonicek
fbshipit-source-id: d1080b045ff6aa0cbf05d8070ceb0eb4cdb6dceb
Summary:
This got broken recently. As a result of this, when a module throws while being required, either by regular load or hot reload, the module object is marked as `hasError`. Form that point all subsequent HMR updates will fail because it will think the module failed while executing the factory but the failure could have been on an old run of an old factory.
The fix is very simple: just reset `hasError` to false when accepting a module.
Closes https://github.com/facebook/react-native/pull/7567
Differential Revision: D3310685
fbshipit-source-id: 2f0b48ab7432b7c221d0c88a019a28969a8862b2
Summary:
grabbou pointed out this issue.
We recently started cleaning out the factory function after module are required to save some memory. This broke HMR on some edge cases because sometimes the factory function may need to be re-executed. This PR just wraps the optimization into `__DEV__` to make sure we don't use it while developing.
Closes https://github.com/facebook/react-native/pull/7568
Differential Revision: D3305120
Pulled By: martinbigio
fbshipit-source-id: 741cffbb327d118f0bd0ec34dc1af53d4f94880e
Summary:
The code to require modules by their name (rather than their numeric ID) was buggy, because it didn’t check whether the module factory was already executed and the module already existed.
This diff checks the already loaded modules, too, when loading modules by name.
Reviewed By: lexs
Differential Revision: D3281350
fbshipit-source-id: cef236e152fe5484f21c877d6cee37433fa11c76
Summary:
This intends to make the devx story better after switching to numeric module IDs:
- `require('<verbose-name>)` works again for dev builds
- In dev builds, Systrace will use the verbose names of modules for markers
Reviewed By: bestander
Differential Revision: D3253318
fb-gh-sync-id: 3425d5086ce28634653a6c8c7f5f11afa1614902
fbshipit-source-id: 3425d5086ce28634653a6c8c7f5f11afa1614902
Summary: Apparently what we're using for console.trace is not really the same as what Chrome does (we don't log a stacktrace). Add `console.debug` with the same functionality as `console.trace`, just so we don't crash between browser and local execution.
Reviewed By: davidaurelio
Differential Revision: D3235053
fb-gh-sync-id: 4bed17ac8aa4c8c100f15cf0aabbc25101c913c1
fbshipit-source-id: 4bed17ac8aa4c8c100f15cf0aabbc25101c913c1