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
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: 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
Summary: This version should be more stable and has the `moduleNameMapper` feature that frantic was asking for - I will send a follow-up diff for that. I also fixed an issue with `module.parent` and a module inside of yeoman that thought it was owning the universe.
See https://github.com/facebook/jest/blob/master/CHANGELOG.md#061 for a changelog since 0.5.6.
public
allow-crlf-text
Reviewed By: javache
Differential Revision: D2579041
fb-gh-sync-id: cb918875557f219239f49fc0ad49ac61d0884173
Summary: @public
We've been forgiving unresolved modules errors in the past but we've realized that doing so makes the codebase a bit unstable as people don't make sure to fix these errors. From now on we'll early fail and stop the packager when any module cannot be resolved (including assets)
Reviewed By: @amasad
Differential Revision: D2518076
fb-gh-sync-id: e170d95b905cc29afbe46e24b65425ddd887f77c
Summary: @public
The legacy 'isStatic' property for image sources is no longer used anywhere in our codebase, but was still being generated by the packager and referenced in the JS in various places.
This diff removes all the remaining references.
Reviewed By: @frantic
Differential Revision: D2531263
fb-gh-sync-id: 0bba0bb8473b1baa908ef7507cbf6d83efb0d9ee
Summary: @public
This was a hard one, bare with me on the full story of what happened.
We recently started writting additional JS scripts in ES6 for the cli. These code needs to be transformed by babel before we execute it as we don't run node with `--harmony`. To do so we removed the `only` attribute on the `babel-register`. Turns out this broke the packager on oss as if no `only` not `ignore` parameter is specified babel will ignore `node_modules`. Since on oss when a project is created `react-native-github` is located inside of `node_modules` we started getting syntax errors.
The fix is to include separately all the different paths we need to make sure babel transforms each of them. We cannot simply have a single `babel-core/register` as we need to include paths that belong both to oss and internal only. So, we need to have multiple `register` invocations. Since babel does not accumulate the `only` you send on every invocation we need to build a small wrapper to do so.
Reviewed By: @frantic
Differential Revision: D2522426
fb-gh-sync-id: 379a7bb169c7d5cb3002268742de269238bba766
Summary: @public
The source maps generated by uglify are already stringified, and therefore were
being stringified twice.
Reviewed By: @martinbigio
Differential Revision: D2498242
Summary: @public
Dead-lock trying to read package.json because it's both a "module" and a "package". in `Module.getName` it uses the cache key "name" and tries to call `Package.getName` which uses the same cache key and we end up returning the same promise that we're trying to resolve resulting in a dead-lock.
This changes the cache keys for the packages that adds a prefix "package-".
Reviewed By: @vjeux
Differential Revision: D2506979
Summary: *This is a PR to fix#1939 (DependencyResolver fails to handle ES6 modules import statements with new lines)*
**This PR includes:**
- A fix to the problematic regular expression
- Updated tests that support the new line style.
**Summary:**
We found out that while the packager does its module wrapping thing for lines like this:
```js
import theDefault, { named1, named2 } from 'src/mylib';
```
It fails to do the same for multi line imports:
```js
import theDefault, {
named1,
named2
} from 'src/mylib';
```
We've tracked done the issue to a [faulty regular expression in replacePatterns.js](https://github.com/facebook/react-native/blob/master/packager/react-packager/src/DependencyResolver/replacePatterns.js#L12)
You can see various import statements with the problematic regular expression [here](http://regexr.com/3bc8m)
We've figure out a better regular expression (you can play around with it [here](http://regexr.com/3bd3s))Closes https://github.com/facebook/react-native/pull/1940
Reviewed By: @svcscm
Differential Revision: D2498519
Pulled By: @vjeux
Summary: This is an updated copy of #1993, which was approved by @vjeux but hasn't been rebased. It whitelists the es6 module syntax and updates the JS Environment docs to match. cc @ide @hkjorgensenCloses https://github.com/facebook/react-native/pull/3175
Reviewed By: @svcscm
Differential Revision: D2498360
Pulled By: @vjeux
Summary: @public
This moves us from warnings on name collisions to errors. If the error happens in initialization it will fatal out.
However, if the error happens while working (after initialization) then I did my best to make it recoverable. The rational behind this is that if you're working and you're changing names, you may introduce a duplication while moving things around. It will suck if you have to restart the server every time you do that.
Reviewed By: @frantic
Differential Revision: D2493098