Summary:
Adds support for multiple packager servers, which could be used to hot-reload dependencies in response to a change in the `cacheVersion`.
Currently, there is no way to:
- Create multiple `ReactPackager` servers.
- Instantiate more than one `FileWatcher` constructor (due to the "single instance" invariant).
public
Reviewed By: martinbigio
Differential Revision: D2713455
fb-gh-sync-id: 9be0f0cb2b846baf088d0cf14650cc8b9e950815
Summary: fixes https://github.com/facebook/react-native/issues/3997
the root cause is in
Mon, 09 Nov 2015 13:22:47 GMT ReactNativePackager:SocketServer uncaught error Error: listen EACCES C:\Users\donald\AppData\Local\Temp\react-packager-9248a9803ac72b509b389b456696850d
This means that the socket server cannot create the socket.
cfr https://gist.github.com/domenic/2790533 the socket name is not a valid windows socket name.
Closes https://github.com/facebook/react-native/pull/4071
Reviewed By: mkonicek
Differential Revision: D2699546
Pulled By: davidaurelio
fb-gh-sync-id: 6c6494c14c42bb17506b8559001419c9f85e91e3
Summary: Extracts the module system from the list of dependencies and adds it back to the bundling process.
Unbundling and Prepack has their own module systems. jest does as well. This is not normally part of the resolver, nor polyfills.
In fact, I think we'll eventually start treating polyfills as normal modules just like core-js.
The prelude is the weird part right now but I think that we'll eventually move the DEV flag to be module level instead of global and we can just get rid of this prelude.
public
Reviewed By: davidaurelio
Differential Revision: D2693701
fb-gh-sync-id: a59ccda0fa15fcfcda52897e8290805eed1b92b3
Summary: React Native is a lot more powerful an environment than the browser, so we need an alternate mapping, as specified [here](https://github.com/defunctzombie/node-browser-resolve#browser-field)
An example:
```js
{
"browser": {
"./lib/server": false
},
"react-native": {
"dgram": "react-native-udp",
"fs": "react-native-level-fs"
},
"chromeapp": {
"dgram": "chrome-dgram",
"fs": "level-filesystem"
}
}
```
on the other hand, if "react-native" is not present in package.json, you should fall back to "browser"
other than the one (nesting) test added, the tests are unchanged, just done for both "react-native" and "browser"
(I've implemented [react-native-udp](https://npmjs.org/package/react-native-udp) and [react-native-level-fs](https://npmjs.org/package/react-native-level-fs), but they obviously don't belong in the traditional "browser" field as they won't run anywhere except in React Native.)
Closes https://github.com/facebook/react-native/pull/2208
Reviewed By: svcscm
Differential Revision: D2691236
Pulled By: vjeux
fb-gh-sync-id: 34041ed50bda4ec07f31d1dc50dcdfa428af2512
Summary: public
Adding the babel helpers that are necessary to support ES2015 imports.
Fixes: https://gist.github.com/ehd/49cb2465df9da6b39710
Reviewed By: mkonicek
Differential Revision: D2690772
fb-gh-sync-id: b1b6c0c048bad809a5c58cdd0a2cbeaa11c72ea7
Summary: public
Show modules' dependencies and time to load.
Reviewed By: davidaurelio
Differential Revision: D2603245
fb-gh-sync-id: a1d5067a8522b908b87fdfdd51ff4c4fdbc2edfc
Summary: This adds a build option for using Prepack (an experimental packager) to
build a bundle. It doesn't actually take on the npm package dependency
because it's not published/open source (yet).
This will be used while we experiment and should be maintained as the
build system changes so that we can continue getting fresh builds.
I found that saveBundleAndMap and processBundle were over abstracted and
got in my way so I inlined it and removed the unit tests because the unit
test was testing trivial code that is likely to change interface.
I went with a separate build phase and a separate Bundle class even though
there are a lot of commonalities. I imagine that the requirements for
Prepack will continue to diverge. Especially for source maps but a larger
refactor could try to unify these a bit more. The fact that modules are
wrapped before the write phase seems to be an unfortunate architecture
that makes this difficult.
Closes https://github.com/facebook/react-native/pull/4226
Reviewed By: amasad
Differential Revision: D2673760
Pulled By: sebmarkbage
fb-gh-sync-id: 299ccc42e4be1d9dee19ade443ea3388db2e39a8
Summary: Manually resolve all default Babel plugins. `babel.transform` will attempt to resolve all base plugins relative to the file it's compiling. This makes sure that we're using the plugins installed in the react-native package.
**NOTE:** Haven't tested this. Please don't merge until Travis has done CI.
Closes https://github.com/facebook/react-native/pull/4248
Reviewed By: svcscm
Differential Revision: D2679651
Pulled By: davidaurelio
fb-gh-sync-id: 0cdef1e738ba28c09c811432a71047f80540ed7b
Summary: public
RFC: The minifier haven't been stripping dead-code, and it also can't kill unused
modules, so as a temporary solution this inlines `__DEV__`, kill dead branches
and kill dead modules. For now I'm just white-listing the dev variable, but we
could definitely do better than that, but as a temporary fix this should be
helpful.
I also intend to kill some dead variables, so we can kill unused requires,
although inline-requires can also fix it.
Reviewed By: vjeux
Differential Revision: D2605454
fb-gh-sync-id: 50acb9dcbded07a43080b93ac826a5ceda695936
Summary: public
The recent change to move babelhelpers out of the module broke the extends method.
Reviewed By: spicyj
Differential Revision: D2656448
fb-gh-sync-id: 633433deea00ecb140afbb732bff0599e67b4d41
Summary: public
The inline-requires transform (from `fbjs-scripts`) is only used for oss tests, and wasn't updated, fix it.
Reviewed By: mkonicek
Differential Revision: D2641711
fb-gh-sync-id: 90a084082b9c55c5bcb776346f4655451a8a61f7
Summary: public
Fixes#4055
Babel is failing to find the plugins when running scripts with the full path,
cd into the folder before starting the packager as a workaround.
Reviewed By: vjeux
Differential Revision: D2638529
fb-gh-sync-id: b57151d3091d56a2c070692fb6296184a8fc62de
Summary: public
Move all the transforms that had been previously upgraded to be the default now.
Reviewed By: vjeux
Differential Revision: D2631308
fb-gh-sync-id: a2120a9850c98ce65784b77598baa123121246ab
Summary: The previous version of `performanceNow` used to reassign to a `require(...)` alias, which our inline requires transform guarded against. Before the update to React 0.14, we were pulling `performanceNow` from a hardcoded `react-tools` version (b4e74e38e4/src/shared/vendor/performance/performanceNow.js), so we couldn't just fix the file and had to special case it. Now that we've updated to React 0.14, `performanceNow` is pulled from fbjs and no longer needs to be special cased.
public
Reviewed By: cpojer
Differential Revision: D2634940
fb-gh-sync-id: 7085cde3179c04f9ecfd87bdd472b19e370ee73c
Summary: When Node is installed with nvm, scripts invoked from Xcode need to set up nvm. This can be done either by sourcing .profile/.bash_profile/.bashrc/etc... or by sourcing nvm.sh directly -- this diff does the latter and handles the case where nvm may have been installed the official way (under ~/.nvm/nvm.sh AFAIK) or via homebrew.
Closes https://github.com/facebook/react-native/pull/4015
Reviewed By: svcscm
Differential Revision: D2633301
Pulled By: frantic
fb-gh-sync-id: 3c2b9b0d21887ba21d6f85f5d279314d50c1db28
Summary: Unfortunately ReactTestUtils requires ReactDOM (for renderIntoDocument), and ReactTestUtils is required by ReactNative. This worked internally because we already shimmed ReactDOM for Relay; now we shim it externally too, at least until we figure out a better solution for this in React.
public
Reviewed By: vjeux
Differential Revision: D2629811
fb-gh-sync-id: 94aac2c4eda39d039fdcedd88295e7afb0f5c5b2
Summary: All minor changes since we were already on the beta: most notable is that destructors are required in pooling to help prevent memory leaks.
public
Reviewed By: sebmarkbage
Differential Revision: D2608692
fb-gh-sync-id: acdad38768f7f48c0f0e7e44cbff6f0db316f4ca
Summary: Log level 'log' from JS should be equivalent to 'info'. Also added knowledge of 'trace' log level in RCTLog.
public
Reviewed By: vjeux
Differential Revision: D2615500
fb-gh-sync-id: 7a02f49bf7953c1a075741c21e984470c44b5551
Summary: I'm planning to split up `DependencyResolver` into the react-native specific implementation of it and a new, generic resolver that is going to replace `node-haste` for jest and other places where we might need JS dependency resolution.
The plan is to split the two folders up so that:
* `Resolver` is the folder for all the react-native specific resolver code
* `DependencyResolver` will become a standalone library, eventually moving into a package called `node-haste`.
There is still a lot to be figured out. This is just the first diff of likely many. The current goal is to make `DependencyResolver` standalone to be able to create an instance of a resolver and resolve all dependencies for a file. This is when I can start integrating it more seriously with jest.
This diff simply moves a bunch of things around and turns `HasteModuleResolver` into an ES2015 class ( :) ).
bypass-lint
public
Reviewed By: davidaurelio
Differential Revision: D2614151
fb-gh-sync-id: ff4e434c4747d2fb032d34dc19fb85e0b0c553ac
Summary: public
Aparently this used to work on 0.11, lets fix it :)
Reviewed By: foghina
Differential Revision: D2557719
fb-gh-sync-id: dcbca077431c1356c89dfc55b71eecff64c7ad3d
Summary: public
We're seeing intermittent errors on the packager when rebasing. Since this is very hard to repro lets add more logging to the warning we show just before starting to rebuild the entire haste map again
Reviewed By: frantic
Differential Revision: D2585427
fb-gh-sync-id: fbfa953f6c8ae78cbee2f3ab19ad494b084165c8