Summary:
Metro does not need to use babel to parse JSON files, it only needs to wrap the stringified JSON directly into the `define` function.
This makes the transformation of JSON files much faster, plus prevent out of memory exceptions when having huge JSON files.
This diff fixes https://github.com/facebook/metro/issues/146
Reviewed By: mjesun
Differential Revision: D7227095
fbshipit-source-id: 5d1a9cb2d1c7162a403c00dc43e46f781fbd1514
Summary:
The traverse dependencies logic was using the absolute path of the resolved dependency to group the module dependencies, so for example if there's a module like:
```
const a = require('./a');
const a1 = require('./a.js');
```
The traversal dependencies logic was just outputting a single dependency for that module.
Since we're transforming each `require()` call to replace the relative path by a dependencyMap, the code from above was transformed to:
```
const a = require(_dependencyMap[0]);
const a1 = require(_dependencyMap[1]);
```
But since the traverse dependencies logic could only find a single dependency, `_dependencyMap[1]` was undefined, causing a runtime error.
This fixes https://github.com/facebook/metro/issues/152 (more info in the task)
Reviewed By: jeanlauliac
Differential Revision: D7258093
fbshipit-source-id: 65c42b87e589430ecc96b906230dd7c4c55c2146
Summary:
When running `yarn` it compiles all the packages files into `build` folders. We should probably ignore this to avoid them ending up checked-in on the repo.
Closes https://github.com/facebook/metro/pull/149
Reviewed By: rafeca
Differential Revision: D7229013
Pulled By: jeanlauliac
fbshipit-source-id: fbbc478fa1cda78231620e2ff0fa8e02539f30ed
Summary:
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->
**Summary**
Remove `request` from `metro`. It doesn't seem to be used.
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
**Test plan**
Everything works as it did before.
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->
Closes https://github.com/facebook/metro/pull/151
Differential Revision: D7226502
Pulled By: rafeca
fbshipit-source-id: fc353292ba55ea9f98eba67f05f8f8f82794dd82
Summary:
In Node v6 there is no `final` function: https://nodejs.org/docs/v6.13.1/api/stream.html#stream_simplified_construction.
It's not a problem however because we can preferentially use the `finish` event, that makes it more consistent with how `createReadStream` is implemented. I also added closing the fs on `error` events, as specified in the docs.
**Test plan**
yarn jest
Closes https://github.com/facebook/metro/pull/150
Reviewed By: rafeca
Differential Revision: D7215708
Pulled By: jeanlauliac
fbshipit-source-id: 80921a245c8c87085a2ba83b84b1156a60aa1fb3
Summary:
The current typing is incorrectly marking the second parameter as required. The options object is optional.
Also added the special defaults for clarity.
Reviewed By: davidaurelio
Differential Revision: D7168409
fbshipit-source-id: e01b651f92b33175b750d188f9e6db99bdc4ab64
Summary:
This adds the babel register package for babel 7 to Metro
All changes are caused by yarn
Reviewed By: davidaurelio
Differential Revision: D7102279
fbshipit-source-id: a8a6db5600207b868bb10217884eb659de9778f4
Summary: Turns out we need an updated version of the babel 7 stack because the runtime depends on something in the newest version. This commit bumps various main package versions to beta.40
Reviewed By: davidaurelio
Differential Revision: D7104132
fbshipit-source-id: ff7db16f6ad82ea2a728ead63fe19b1c9dbd708c