Summary: Continue cleaning up the resolution algo. By removing the class completely as well as the `TModule` type, and providing options via the `context`, we'll be able to identify clearly the inputs of the resolution algorithm, and reuse it eventually for Jest. This changeset extract one more function in this fashion. Next steps: extract the rest of the stateful code into functions, or into `ResolutionRequest`.
Reviewed By: davidaurelio
Differential Revision: D6937569
fbshipit-source-id: bab0bcd280be32a11f23174b0591dd0cc7dee7ab
Summary:
**Summary**
The cache dir name now starts with `metro-bundler-cache-` but the message still refers to `react-`.
This just wasted a bit of my time before I realized and that's not the first time this happens either.
Also I don't have `$TMPDIR` defined on vanilla ubuntu, I think using that instead of `/tmp` creates more confusion than helps.
**Test plan**
Just a change in a string constant.
I signed the CLA.
Closes https://github.com/facebook/metro/pull/131
Differential Revision: D6923347
Pulled By: rafeca
fbshipit-source-id: 4e816e5d0c75b0d2ee5ddf4d92d2d7397011d4e4
Summary: For React's new fragment syntax (`<>Foo</>`) to work, we need to upgrade from Babylon 6.
Reviewed By: dwwoelfel
Differential Revision: D6888282
fbshipit-source-id: 5212cc9439a2f79febc72e0f9eef1a7f6b700266
Summary:
I think the default value for the `--source-map` option is true, although it's not defined that way explicitly. Regardless, when it's explicitly set to `false` I would expect Metro to at least listen to that. Currently that's not the case. This diff attempts to improve that situation.
Note that it's still not perfect since there are more places where sourcemaps are still being touched when this flag is `false`. It turns out adding a proper flag for this leads to a lot of cascading type problems and so I ended up with this fix instead.
Reviewed By: rafeca
Differential Revision: D6884423
fbshipit-source-id: 7fe10045d9d9f73c7841588627ba41b14c2e412b
Summary: Don't bother to work on the source map if it won't be used anyways
Reviewed By: rafeca
Differential Revision: D6884244
fbshipit-source-id: ac014bf982e33c669a1e79f16dd06149e758a797
Summary:
This function was working on a source map object inline and then returning the same reference.
For clarity it's better if it either clones the whole thing (that would be a waste) or not return the reference at all. Also renamed the function (but not the file) for clarity.
Dropped the unused check and updated callsites instead.
Reviewed By: mjesun
Differential Revision: D6884241
fbshipit-source-id: 33aa7a1ad7096510903bbb74dd6b9c675b81aff5
Summary: Don't bother to work on the source map if it won't be used anyways
Reviewed By: mjesun
Differential Revision: D6884247
fbshipit-source-id: 811409313e7ac1a7255ddd0eed665ed92020241e
Summary: Don't bother to work on the source map if it won't be used anyways
Reviewed By: mjesun
Differential Revision: D6884243
fbshipit-source-id: 483664ad32a72a8e6e3de3e0cc224b3a6ea67d46
Summary: This prevents unnecessary JSON.stringify/JSON.parse when the operation is noop anyways.
Reviewed By: mjesun
Differential Revision: D6884246
fbshipit-source-id: 3370caac1e01cb79f86af95f0dd06285150c5d95
Summary:
An Ast consists of `Node` elements and the one Babel uses is specific to Babel (incompatible with Astree spec by default) so `BabelNode` seems more appropriate.
Keeping the other `ast` names for now to reduce the footprint of this diff.
Also makes sure `babel-core` properly exports the same node type as what the api returns making fixes to this type in the future easier to implement.
Reviewed By: davidaurelio
Differential Revision: D6834291
fbshipit-source-id: 4cb0eb2ee280a4988071b8412539edfad12cf56f
Summary: This test can be simplified.
Reviewed By: davidaurelio
Differential Revision: D6834289
fbshipit-source-id: 23072230ce844c39b5fba30cfe7ad51e5a879bed
Summary:
This bridge pulls in the various babel things and exports them again.
In a future update this bridge will also pull in babel 7 versions of the same thing and an env var will determine which sources to use so you can switch between using babel 6 or 7 through ENV.
Reviewed By: davidaurelio
Differential Revision: D6844862
fbshipit-source-id: 610a60eaf7bf368eddcd015e37f228651e2fd78b
Summary: The type was not imported and this escaped the attention of Flow somehow.
Reviewed By: davidaurelio
Differential Revision: D6834292
fbshipit-source-id: 8a9b5f2ac56fca2d0ff298b52f54935327eb2686
Summary: The type was not imported and this escaped the attention of Flow somehow.
Reviewed By: davidaurelio
Differential Revision: D6834298
fbshipit-source-id: 96f754d5aae9fda661cb18bbbb30ccfd033598a1