Commit Graph

1044 Commits

Author SHA1 Message Date
Rafael Oleza 5c6bdd35f0 Deprecate postProcessModules config param
Reviewed By: mjesun

Differential Revision: D7320671

fbshipit-source-id: 979108f0931f9ee0dd820025782137d4c726d19f
2018-03-20 07:12:53 -07:00
Rafael Oleza 2d77ecc6c0 Expose the buildGraph method as a public metro api
Reviewed By: mjesun

Differential Revision: D7320672

fbshipit-source-id: 251874edc28483d5ac6f810dcda77e04e4729049
2018-03-20 07:12:53 -07:00
Rafael Oleza add2826ebe Support concurrent bundle requests on the Server
Reviewed By: mjesun

Differential Revision: D7320670

fbshipit-source-id: 02090f85bf1b5376e9af879d17898bf31c31ce3a
2018-03-20 07:12:53 -07:00
Rafael Oleza 9bae90b2b8 Use the new Graph object for generating HMR bundles
Reviewed By: jeanlauliac

Differential Revision: D7275598

fbshipit-source-id: 912a60ebce7ccc291d138c6f1ef8b0fea2d5712b
2018-03-20 07:12:53 -07:00
Rafael Oleza 395e0494a6 Use the new Graph object for generating delta bundles
Reviewed By: mjesun

Differential Revision: D7275600

fbshipit-source-id: 29579594b88ea19ff81c6e4c1936611f8ecc42f7
2018-03-20 07:12:53 -07:00
Rafael Oleza 2a107aaafc Use the new Graph object for returning the RAM bundle info
Reviewed By: mjesun

Differential Revision: D7275597

fbshipit-source-id: 5a30c83f9ce756f457796a08d10034d03cbc3b75
2018-03-20 07:12:53 -07:00
Rafael Oleza 1b3d2e126d Use the new Graph object for symbolicating errors
Reviewed By: jeanlauliac

Differential Revision: D7275603

fbshipit-source-id: 94a127647f22f7deaaffe649bba6a7ec9353fc03
2018-03-20 07:12:53 -07:00
Rafael Oleza b9b541542b Use the new Graph object for generating dev bundle/sourcemaps
Reviewed By: mjesun

Differential Revision: D7275599

fbshipit-source-id: 4889d259005b3df19977925a6729805b9df68113
2018-03-20 07:12:52 -07:00
Rafael Oleza 12fe345e1b Use the new Graph object for returning bundle dependencies
Reviewed By: mjesun

Differential Revision: D7275602

fbshipit-source-id: 9c07d85b085c297ed5efe958e3b7efe001f3542f
2018-03-20 07:12:52 -07:00
Rafael Oleza 0520fb254b Use the new Graph object for generating assets
Reviewed By: mjesun

Differential Revision: D7275601

fbshipit-source-id: b7c03ec35ea1994e2441da2889a44466e9e2aa0f
2018-03-20 07:12:52 -07:00
Naor Matania ce2ee5a19c Revert D7319514: Create a local package of babel-plugin-transform-react
Differential Revision:
D7319514

Original commit changeset: bcad3dded2b2

fbshipit-source-id: 3aae57ba660846508ea06fe5a540f4adf5b0088e
2018-03-20 06:35:11 -07:00
Naor Matania 13a7535d31 Revert D7319513: Depend on local version of babel-plugin-react-transform
Differential Revision:
D7319513

Original commit changeset: 4945ec753087

fbshipit-source-id: 98de6a0fda19732c02ad780953497f9d9b451dea
2018-03-20 06:35:11 -07:00
Naor Matania 045cf843d1 Revert D7305051: Work around babel7 issue with duplicate declarations
Differential Revision:
D7305051

Original commit changeset: ac9a0130dc61

fbshipit-source-id: 6489a2385477be5c37e63387bf6367dd3ae97be1
2018-03-20 06:35:11 -07:00
Naor Matania 94c03a6cd3 Revert D7264205: Add babel-helper-module-imports to prepare react transform
Differential Revision:
D7264205

Original commit changeset: 515fc85739c6

fbshipit-source-id: f6c8cc8c36e939228dcdcbc4babd76b74a54df7f
2018-03-20 06:35:11 -07:00
Naor Matania 1864a83e6e Revert D7257551: Fix the react transform to work in babel 7
Differential Revision:
D7257551

Original commit changeset: 408104df411e

fbshipit-source-id: 5128bc475ae4d4cc02f6b6825a697bbb3ed1e6a3
2018-03-20 06:35:11 -07:00
Peter van der Zee 226e59a7e2 Fix the react transform to work in babel 7
Reviewed By: jeanlauliac

Differential Revision: D7257551

fbshipit-source-id: 408104df411e6f7011c148d0f5146341d7e90125
2018-03-20 05:19:38 -07:00
Peter van der Zee df5b71ec39 Add babel-helper-module-imports to prepare react transform
Reviewed By: rafeca

Differential Revision: D7264205

fbshipit-source-id: 515fc85739c6131bb8f61612e37af5042c7e3c06
2018-03-20 05:19:38 -07:00
Peter van der Zee 9f1bf87c22 Work around babel7 issue with duplicate declarations
Reviewed By: rafeca

Differential Revision: D7305051

fbshipit-source-id: ac9a0130dc616a87dcc0cdd02dd829e995cfc92f
2018-03-20 05:19:38 -07:00
Peter van der Zee 84f2e6f3a3 Depend on local version of babel-plugin-react-transform
Reviewed By: jeanlauliac

Differential Revision: D7319513

fbshipit-source-id: 4945ec753087206cd01eca4ba9464672d5fb05ba
2018-03-20 05:19:38 -07:00
Peter van der Zee b5f1b4ae25 Create a local package of babel-plugin-transform-react
Reviewed By: rafeca

Differential Revision: D7319514

fbshipit-source-id: bcad3dded2b2141f8a1c12b6a526335da6d6e8a1
2018-03-20 05:19:38 -07:00
Sam Goldman 8dd921a5d6 Upgrade to Flow v0.68.0
Reviewed By: gabelevi

Differential Revision: D7310349

fbshipit-source-id: 70d29815dd7912704aec8a015c970be3fafeeba3
2018-03-19 18:42:30 -07:00
Rafael Oleza d8eed45c37 Use Graph traversal logic for building polyfills
Reviewed By: mjesun

Differential Revision: D7240946

fbshipit-source-id: 5af729878cdf31831b15867c296cf89025ab6f58
2018-03-19 10:29:52 -07:00
Rafael Oleza 6be6b0805d Refactor production serializers to use directly the graph information
Reviewed By: mjesun

Differential Revision: D7158632

fbshipit-source-id: 91fad2e3ca617ea5f3b283e335c0d70edbb6ff3b
2018-03-19 10:29:52 -07:00
Rafael Oleza 3ac0bb47d9 Add new plainJSSerializer that uses directly the Graph object
Reviewed By: mjesun

Differential Revision: D7211546

fbshipit-source-id: 7e6a0a0123f46a9037ecae845d29daea43e1ebed
2018-03-19 10:29:52 -07:00
Rafael Oleza a4afdcb2e8 Move serializers test to the correct folder
Reviewed By: mjesun

Differential Revision: D7210700

fbshipit-source-id: 4d1cc709ffabb46f244ab66d96467f4cb1c90eaf
2018-03-19 10:29:52 -07:00
Rafael Oleza 40cce3b120 Convert entryPoint paths to absolute in the Server
Reviewed By: davidaurelio

Differential Revision: D7196392

fbshipit-source-id: a1927d66fd67e35382a5ac418896dc5a902a5a5c
2018-03-19 10:29:52 -07:00
Rafael Oleza ab25e7c475 Simplify the parameters needed to call the delta calculator
Reviewed By: BYK

Differential Revision: D7185274

fbshipit-source-id: 0bb4040556dfa96f288c9d4aef2314ded44bcd0d
2018-03-19 10:29:52 -07:00
Rafael Oleza 45123d822b Add multiple entrypoint support to the dependency traversal logic
Reviewed By: davidaurelio

Differential Revision: D7180692

fbshipit-source-id: 65b1992abbf10e753b6895623824ff90d7cadc24
2018-03-19 10:29:52 -07:00
Rafael Oleza 5e9cf9ec4b Start using the Graph object in the traverse dependencies logic
Reviewed By: davidaurelio

Differential Revision: D7180698

fbshipit-source-id: a7c39b73a7673f450e3a147e7feff4cfcc3061bf
2018-03-19 10:29:52 -07:00
Rafael Oleza 935b6b5e32 Expose Graph object from the delta bundler
Reviewed By: davidaurelio

Differential Revision: D7158629

fbshipit-source-id: bb10ad8449cc8f1566f02568adaaecbc54c76d2e
2018-03-19 10:29:52 -07:00
Miguel Jimenez Esun 21ccd2b269 Remove things that contain absolute paths
Reviewed By: rafeca

Differential Revision: D7306933

fbshipit-source-id: 497b0f6f71243180870a297d6ea8b09164112649
2018-03-19 05:13:00 -07:00
Miguel Jimenez Esun b581a3e2bb Add logging into cache class
Reviewed By: rafeca

Differential Revision: D7307863

fbshipit-source-id: 0365c5598cd8e56580ebab953dfdcf2d27a59276
2018-03-18 07:12:49 -07:00
Jean Lauliac 23bd78220b metro-memory-fs: add lstat() and fstat()
Reviewed By: mjesun

Differential Revision: D7257967

fbshipit-source-id: 56c59ca088bfd71fc111efdfda2f5393d6abbd9b
2018-03-16 09:00:22 -07:00
Rafael Oleza bfecccd180 Avoid parsing JSON files with babel
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
2018-03-16 01:44:09 -07:00
Rafael Oleza f2b6232c5d Bump metro@0.30.2
Reviewed By: BYK

Differential Revision: D7292431

fbshipit-source-id: 2d81e502e060ecd278977b838e0ef2db7e13b0e3
2018-03-15 18:41:36 -07:00
Rafael Oleza f231396260 Fix HMR connection issues when the client gets reconnects
Reviewed By: BYK

Differential Revision: D7288613

fbshipit-source-id: ac8b5800af0bfaf1c2a25108b564092e3a47273c
2018-03-15 15:37:41 -07:00
Peter van der Zee 9185eeb04b Refactoring resolvePlugin out
Reviewed By: BYK

Differential Revision: D7257553

fbshipit-source-id: 1abffa3606f1d342a571d7b22ee34272a995bf9f
2018-03-15 07:00:02 -07:00
Burak Yigit Kaya 7c4b7da523 Fix flaky Transformer test
Reviewed By: rafeca

Differential Revision: D7279027

fbshipit-source-id: 2e2be997259eae3fcb2b6a3a74ad22e1daa218d9
2018-03-15 05:51:56 -07:00
Jean Lauliac 43ab7ab811 metro-memory-fs: clean up createWriteStream()
Reviewed By: rafeca

Differential Revision: D7257022

fbshipit-source-id: 30598f2dd24a66bf07d75133ca10fb6b9082010a
2018-03-14 09:29:45 -07:00
Rafael Oleza 167117fe36 Bump metro@0.30.1
Reviewed By: BYK

Differential Revision: D7259632

fbshipit-source-id: ef713d35a953cd829d6a8684d2fa9cfa30e69ac4
2018-03-14 09:08:31 -07:00
Rafael Oleza 233b00e836 Handle correctly multiple requires to the same file with different forms
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
2018-03-14 09:08:27 -07:00
Rafael Oleza 6a587db117 Allow to configure the name of the require in the traverseDependency tests
Reviewed By: jeanlauliac

Differential Revision: D7258095

fbshipit-source-id: 3cf11148ed58ba0b8802513db0731787a4d83773
2018-03-14 09:08:22 -07:00
Miguel Jimenez Esun cf5a431388 Use a single file delimited with null characters
Reviewed By: rafeca

Differential Revision: D7232425

fbshipit-source-id: c51387b94cd990ed3ba9be5c82b14c2a7773c7e7
2018-03-13 07:09:17 -07:00
Miguel Jimenez Esun 601f718dd6 Make a common hash of all the bundler information
Reviewed By: davidaurelio

Differential Revision: D7196792

fbshipit-source-id: dc1e0b399d1d5ff9c0956facd69be4279cc4f5c3
2018-03-12 03:53:41 -07:00
wtgtybhertgeghgtwtg e985b6e6ec Remove `request`.
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
2018-03-10 13:14:03 -08:00
Rafael Oleza ee497c61b6 Bump metro@0.30.0
Reviewed By: BYK

Differential Revision: D7214924

fbshipit-source-id: 4f50ec27e2dceb18e9ef82e741675df295235d74
2018-03-09 16:53:58 -08:00
Rafael Oleza 13f9ea7d3a Completely clean the bundler once a client gets disconnected
Reviewed By: BYK

Differential Revision: D7211827

fbshipit-source-id: 4490d2f520b24595a1d5833b69ecca3e408ba3c5
2018-03-09 16:53:58 -08:00
Rafael Oleza c26a68e5c7 Pass the added modules to the client before the modified ones through HMR
Reviewed By: davidaurelio

Differential Revision: D7206085

fbshipit-source-id: 055dc4f90950c46845b49249106cda64c4bd4f6e
2018-03-09 16:53:58 -08:00
Jean Lauliac d9e3d21922 metro-memory-fs: fix createWriteStream autoClose behavior
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
2018-03-09 13:37:44 -08:00
Jean Lauliac de35a73798 metro: collapse name verification into getHasteName()
Reviewed By: rafeca, mjesun

Differential Revision: D7196246

fbshipit-source-id: 425573f61148ac3a4e85bbcf4fb1033f3e560dab
2018-03-09 10:45:20 -08:00
Peter van der Zee 091815ea81 Minor refactor moving a line
Reviewed By: rafeca

Differential Revision: D7180929

fbshipit-source-id: 94dd062ffd05f22e67c7d913f6d6e04c24a4c8ec
2018-03-08 05:01:29 -08:00
Miguel Jimenez Esun a4c417a1c5 Fine-tune adjustments to experimental caches
Reviewed By: jeanlauliac

Differential Revision: D7185544

fbshipit-source-id: b4b6c363910a80f906260afe49a72d476609ae14
2018-03-08 04:35:11 -08:00
Rafael Oleza 8fd56bf2e5 Bump metro@0.29.0
Reviewed By: BYK

Differential Revision: D7181876

fbshipit-source-id: a1b567303b8024b832bf43dd6be56ccebffaf39c
2018-03-07 15:00:27 -08:00
Miguel Jimenez Esun aaedb99ac4 Get rid of unused methods
Reviewed By: davidaurelio

Differential Revision: D7169707

fbshipit-source-id: 8b29791e15631a3ee4674a6cb5046e675c2c3727
2018-03-07 07:03:44 -08:00
Miguel Jimenez Esun 0e9e2505dd Type transformCode
Reviewed By: davidaurelio

Differential Revision: D7169708

fbshipit-source-id: b886ea7b3e694ada4d930df9fa6aec1cdc188d98
2018-03-06 18:07:27 -08:00
Miguel Jimenez Esun 8a10127b58 Enforce object strictness at runtime
Reviewed By: jeanlauliac

Differential Revision: D7153674

fbshipit-source-id: a7f68d26430d04dc36360199ffcb243f8e2e09cf
2018-03-06 04:51:38 -08:00
Jean Lauliac 08283058ec metro: switch Assets-test to the new memory-fs
Reviewed By: mjesun

Differential Revision: D7135767

fbshipit-source-id: dd7998b8aca87391ec2081770645ba73d11cf859
2018-03-05 07:53:53 -08:00
Jean Lauliac e565f10a30 metro-memory-fs: implement createReadStream()
Reviewed By: mjesun

Differential Revision: D7124071

fbshipit-source-id: a267e35bb32d540cec915ac38f5ab11e2096f33e
2018-03-05 07:53:53 -08:00
Miguel Jimenez Esun b7e3e046cd Tweaks to experimental caches
Reviewed By: jeanlauliac

Differential Revision: D7123128

fbshipit-source-id: 2f838d66c51ef5faef261a6ad474cefd9ac7e8ad
2018-03-05 04:05:48 -08:00
Miguel Jimenez Esun 3bd7ef1d74 Remove "projectRoot" as an option
Reviewed By: jeanlauliac

Differential Revision: D7123052

fbshipit-source-id: be57635187c7e9c4bed2a62eca23bfe8346bc4f3
2018-03-05 04:05:48 -08:00
Jean Lauliac a4d1bf21b3 metro: switch Bundler-test to the new memory-fs
Reviewed By: rafeca

Differential Revision: D7111251

fbshipit-source-id: dfba2c3e7d17cc90c329785736b7c5a30816305b
2018-03-02 12:05:49 -08:00
Rafael Oleza cc392c699a Make the chrome debugger handle dynamic delta ids
Differential Revision: D7112419

fbshipit-source-id: 1d80c0c13144dd19bbcd5535383befc6567cacf7
2018-03-02 03:18:52 -08:00
Burak Yigit Kaya edacc36cb4 Implement `dispose` for HMR
Reviewed By: rafeca

Differential Revision: D7111433

fbshipit-source-id: 3ae8b6abc08328ea178965bfa60ec6af91dcc2cf
2018-03-01 09:36:44 -08:00
Miguel Jimenez Esun df399aa8c5 Make caches not to update beyond the hit
Reviewed By: davidaurelio

Differential Revision: D7098171

fbshipit-source-id: 2e934054fd265c40887a9ff5458bf294b2a61132
2018-03-01 07:10:41 -08:00
Rafael Oleza cd13bb80eb Reduce memory in the traverse dependencies logic by reusing objects
Reviewed By: BYK

Differential Revision: D7110823

fbshipit-source-id: 575da43e99bc2ba82b6e7bdcf61e933e95535710
2018-03-01 06:07:40 -08:00
Christoph Nakazawa 5bec7748e4 Tweaks to error reporting
Reviewed By: mjesun

Differential Revision: D7110894

fbshipit-source-id: cd4b10bb423c14519acb930192cfc3d9932fa091
2018-03-01 06:07:40 -08:00
Christoph Nakazawa 240711313c Enable colors to syntax highlight code in errors
Reviewed By: mjesun

Differential Revision: D7110895

fbshipit-source-id: 1ec1a2147258de44fe65453e1df25afb72c2c6a4
2018-03-01 06:07:40 -08:00
Rafael Oleza 59cfe85cca Make eslint rules more strict
Reviewed By: cpojer

Differential Revision: D7123137

fbshipit-source-id: 68f82124ed565f223c6bf546c22e55ca401f1996
2018-03-01 06:07:40 -08:00
Miguel Jimenez Esun cfb8516925 Only capture "ENOENT"s in "FileStore"
Reviewed By: jeanlauliac

Differential Revision: D7111352

fbshipit-source-id: 97525051e58482d7f0604cd9c3e50183db83d455
2018-03-01 06:07:40 -08:00
Miguel Jimenez Esun 123f1cfd42 Use "writeFileSync" instead of "writeFile"
Reviewed By: cpojer

Differential Revision: D7110494

fbshipit-source-id: 3024227431317a446ec23d2c78cde8a66c49d41f
2018-03-01 06:07:40 -08:00
Miguel Jimenez Esun da45d64c76 Use global cache getter with Metro's experimental caches
Reviewed By: davidaurelio

Differential Revision: D7084356

fbshipit-source-id: e5960c8981e7157efb58294d722067000d285497
2018-03-01 06:07:40 -08:00
Miguel Jimenez Esun f583f81254 Remove optional parameter from server and enforce empty list everywhere
Reviewed By: jeanlauliac

Differential Revision: D6999448

fbshipit-source-id: 39a6b9333e3c3ec05bae5423fcc84ad17e1fdc06
2018-03-01 06:07:40 -08:00
Peter van der Zee f8b0a77dd3 Don't import, yet
Reviewed By: mjesun

Differential Revision: D7110450

fbshipit-source-id: fa31566443e976df13313f05ed8775c31863d6e5
2018-03-01 02:22:22 -08:00
Peter van der Zee d08682472b Add @babel/register to Metro
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
2018-03-01 02:22:22 -08:00
Peter van der Zee 4946945215 Bump Babel 7 beta versions
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
2018-02-28 16:53:22 -08:00
Jean Lauliac bc4c233a1e metro: fix dep over memory-fs in OSS
Reviewed By: rafeca

Differential Revision: D7111222

fbshipit-source-id: 1aca3836e1c55a60ec77c22c8f38aabf9ba5cbb2
2018-02-28 10:56:59 -08:00
Rafael Oleza d7165e5cbb Add extraneous dependencies eslint plugin to metro
Reviewed By: davidaurelio

Differential Revision: D7084893

fbshipit-source-id: f1726fc189174bde8fc6f32ed6b0125764fe5093
2018-02-28 04:34:15 -08:00
Rafael Oleza 2f98a6ee61 Remove nested package.json files
Reviewed By: cpojer

Differential Revision: D7097285

fbshipit-source-id: 66b107632e3b84edf4f2c099b03ca590a7c6bb7b
2018-02-28 04:34:15 -08:00
Rafael Oleza f5bb45ffdd Do not transform Platform.select() calls using dynamic properties
Reviewed By: davidaurelio

Differential Revision: D7085775

fbshipit-source-id: 348e43312ecb8298c14b202f209850b54d9b7b12
2018-02-28 04:34:15 -08:00
David Aurelio 36cee35684 Remove `getOptions()` from `DeltaBundler`
Summary: More cleanup of `DeltaBundler` in order to move from `Bundler` to `ModuleGraph`. I am trying to remove all unrelated functionality to make the transition easier.

Reviewed By: rafeca

Differential Revision: D7100153

fbshipit-source-id: 2e0c2d4957dece27bd28d3cf7e4ff2e178c60fb2
2018-02-28 04:04:33 -08:00
Jean Lauliac 50356b7408 metro-resolver: simplify API with exceptions
Reviewed By: mjesun

Differential Revision: D7098249

fbshipit-source-id: 5eea3dfdc54a98d295b756296398fd3a1dd3890b
2018-02-28 03:08:23 -08:00
Jean Lauliac a66a231dfc metro: DeltaBundler-test: use memory-fs
Reviewed By: rafeca

Differential Revision: D7098504

fbshipit-source-id: 5c2c7b88b2a9b41f3c7d75613c7ab290622176ea
2018-02-28 02:29:26 -08:00
Rafael Oleza 2b32b08b13 Pass the sourcemap variable correctly to the transformer
Reviewed By: Hypuk

Differential Revision: D7102063

fbshipit-source-id: b6162e6f9052099afec02a67e3ea44da2a6ea8be
2018-02-27 14:37:55 -08:00
Jean Lauliac 019622ce50 metro: extract MemoryFS into its own package
Reviewed By: mjesun

Differential Revision: D7098381

fbshipit-source-id: 0ac9d71b7912c9d448468b64969d04a8cc9c853d
2018-02-27 10:51:13 -08:00
David Aurelio 4f35a6d8a1 Remove unused type import
Summary: Removes an unused type from `Bundler`

Reviewed By: jeanlauliac

Differential Revision: D7084608

fbshipit-source-id: 213a49466c9745c4bb85b8b16a8b2e4309b5a524
2018-02-27 09:31:47 -08:00
David Aurelio 958a147162 less mocks in `Serializer-test`
Summary: now that RAM bundle info building is an implementation detail, we make it part of the test rather than mocking it out.

Reviewed By: rafeca

Differential Revision: D7084580

fbshipit-source-id: edbb7b3d1aaca5513ea81d8d2c62b4b5c8e97756
2018-02-27 09:31:47 -08:00
David Aurelio 356d896c01 remove `getRamOptions` from `DeltaTransformer` and `Bundler`
Summary: Removes `getRamOptions` from `DeltaTransformer` and `Bundler` for better separation of concerns, and ultimately, porting delta functionality to `ModuleGraph`

Reviewed By: rafeca

Differential Revision: D7084487

fbshipit-source-id: e8a7ea4addbad9057e7d55627f77ebd01e64786b
2018-02-27 09:31:47 -08:00
Rafael Oleza 2393f849e3 Bump metro@0.28.0
Reviewed By: davidaurelio

Differential Revision: D7085296

fbshipit-source-id: 76032af022d37a28976b33176f9a573e39861a39
2018-02-26 09:59:01 -08:00
Rafael Oleza a645c21862 Add metro-minify-uglify dependency
Differential Revision: D7084802

fbshipit-source-id: bdc1eb1389f9caeb067240e221ebef7ceeb78cda
2018-02-26 09:01:10 -08:00
Peter van der Zee 2303f3b18d Make constant folding plugin use context for babel types
Summary: This makes the plugin use the passed on babel api rather than hardcoded pulling in babel 6 or 7. This is important since they are different packages now and we need to work with them side-by-side.

Reviewed By: mjesun

Differential Revision: D7083873

fbshipit-source-id: 2ce89e0627005bb29ff8d3e0e1ac51fe8ee4eabd
2018-02-26 07:58:33 -08:00
Christoph Nakazawa f179352292 Add `close` event to MetroClient
Reviewed By: rafeca

Differential Revision: D7083989

fbshipit-source-id: 7a4d4913d32e58a1efc6210dd7118b03b6ad6b2b
2018-02-26 07:19:54 -08:00
Christoph Nakazawa 063a6867b1 Cleanup HMR code, rename to MetroClient, add test
Reviewed By: BYK

Differential Revision: D7083982

fbshipit-source-id: ac8193b8025e8ff37d7316e11cafc09b58b7d358
2018-02-26 05:57:05 -08:00
Peter van der Zee 45dfd925fc Enable @flow in the inline tests
Summary: Enable the flow directive for the inline tests. Changes are related to getting Flow to green.

Reviewed By: jeanlauliac

Differential Revision: D7083814

fbshipit-source-id: f5efa35181663b30d9da437ffa727b3fa8f99b5a
2018-02-26 04:54:39 -08:00
Peter van der Zee 56e7aed7cb Let the inline plugin use the babel types from arg
Summary:
Before the inline plugin was explicitly requiring babel itself. With the babel upgrade path that's a problem since it will try to pull in babel 6 even when we want babel 7 (because it's a different package name). To remedy this the plugin is now a function which will use the `types` api from the given context rather than the required global.

I also moved out the `inline` function that only seems to be used in tests. They're now just living in the tests.

Had to add some flow annotations to generic objects since Flow was complaining about missing types and that would require adding the full babel api which is outside of the scope of this task.

Reviewed By: jeanlauliac

Differential Revision: D7083815

fbshipit-source-id: 59b8365d8c3c3dc00b23a3735037dcc9483c0b2c
2018-02-26 04:54:39 -08:00
Miguel Jimenez Esun 8292958c00 Allow passing custom configs through the CLI ("js1 run")
Reviewed By: jeanlauliac

Differential Revision: D7081913

fbshipit-source-id: f5952599c840f2c65213bd2928b21f0c1d84f510
2018-02-26 03:39:24 -08:00
Miguel Jimenez Esun d83903f614 Add "PersistedMapStore" cache
Reviewed By: davidaurelio

Differential Revision: D7050539

fbshipit-source-id: 78191ae25c7b28869ebedb4b0f90300bac52c580
2018-02-25 16:35:45 -08:00
Miguel Jimenez Esun 5edc2acc80 Add "FileStore" cache
Reviewed By: davidaurelio

Differential Revision: D7037483

fbshipit-source-id: b7517f2b3c8df3e5653dd1a756dfbee5bb2bd656
2018-02-25 16:35:45 -08:00
Rafael Oleza a62eaa0d3b Make the inline platform transform support string keys
Summary:
This diff makes the platform inline transformer support string keys, for example:

```
Platform.select({
  'ios': 'ios',
  'default': 'default',
});
```

This fixes https://github.com/facebook/metro/issues/134

Reviewed By: mjesun

Differential Revision: D7079013

fbshipit-source-id: 3e47bb4a28f2ac776475842982e089d5954d6521
2018-02-25 11:05:46 -08:00
Vladimir Timofeev 886c9b986c Fix npm deps
Summary:
**Summary**

This should fix install of the metro with npm (issue #142).
We can't have both babylon@6 and babylon@7 as deps for metro package, so as jeanlauliac suggested in https://github.com/facebook/metro/issues/142#issuecomment-368217279 lets create wrapper-package `metro-babylon7` and reexport babylon@7 from it.

**Test plan**

I do manually `yarn && yarn test` - all checks passed.
Closes https://github.com/facebook/metro/pull/143

Differential Revision: D7079144

Pulled By: rafeca

fbshipit-source-id: eeb4f6a01ad92d84dc14702dee07975e253bcf88
2018-02-24 09:21:43 -08:00
Rafael Oleza 41e7aa6f4a Improve readability of the traverse dependencies tests
Reviewed By: davidaurelio

Differential Revision: D7055471

fbshipit-source-id: dfac739159de0591d453511d4f4d7882beacb9bf
2018-02-24 04:29:24 -08:00
Rafael Oleza ff6f6ef1cf Make the delta protocol more robust by detecting when a client misses a delta
Reviewed By: davidaurelio

Differential Revision: D7031664

fbshipit-source-id: 22985ba45aa330780c8ddc44c07f5557e9e0d9c4
2018-02-24 04:29:24 -08:00
Burak Yigit Kaya a7fdc0f3c1 Add missing metro-cache dependency to metro
Reviewed By: rafeca, mjesun

Differential Revision: D7067918

fbshipit-source-id: 1d096dc3dc98c9ef7d6b47eee3b00e31a2427ec8
2018-02-23 10:45:41 -08:00
Jean Lauliac 0154fb32eb ModuleGraph/node-haste: remove dep over ResolutionRequest
Reviewed By: mjesun

Differential Revision: D7040976

fbshipit-source-id: 93d43342ee23b7f3496afbb532bbc12fefd6e61e
2018-02-23 10:36:52 -08:00
Burak Yigit Kaya 4670c08206 Bring metro-cache to 0.27.0 again
Reviewed By: rafeca

Differential Revision: D7067873

fbshipit-source-id: fa8d377c042f289c807160b8bb78392d00c8e1f4
2018-02-23 09:00:51 -08:00
Burak Yigit Kaya 4e33e7aa85 Release Metro 0.27.0
Reviewed By: davidaurelio

Differential Revision: D7067140

fbshipit-source-id: a2ae64a8049e5ef883c08f4abbe108401427b0aa
2018-02-23 07:51:31 -08:00
Miguel Jimenez Esun bd91fcf131 Add an "experimentalCaches" flag all the way down to Module
Reviewed By: jeanlauliac

Differential Revision: D6976974

fbshipit-source-id: fea0a3655fec924798567d690e2ee4f24465d5c5
2018-02-23 03:52:45 -08:00
Miguel Jimenez Esun 7486444a0a Pass cacheStores
Reviewed By: davidaurelio

Differential Revision: D7023425

fbshipit-source-id: 84d0d6585af4075bd7ac11ac3c97520caeae7b01
2018-02-23 03:52:44 -08:00
Miguel Jimenez Esun eab7030b2e Initial version of caches
Reviewed By: davidaurelio

Differential Revision: D7023408

fbshipit-source-id: 3411a34d7551f8c2e13087af6dae389c3468b1ee
2018-02-23 03:52:44 -08:00
Burak Yigit Kaya 3d061b34f7 Upgrade Jest to 22.4.2
Reviewed By: mjesun

Differential Revision: D7060484

fbshipit-source-id: 91cc7b6d66a2bb99242c144e011eef4393f87e9e
2018-02-23 03:52:44 -08:00
Miguel Jimenez Esun e4b1e773b1 Pass cache keys instead of cache props when talking to the GlobalTransformCache
Reviewed By: jeanlauliac

Differential Revision: D7031064

fbshipit-source-id: a99fb2775b84ce6b866c80be68f966dcd4ea57ca
2018-02-22 09:39:51 -08:00
Rafael Oleza 6da4bc4d30 Make sure that files that have been modified and deleted afterwards are marked as deleted
Reviewed By: davidaurelio

Differential Revision: D7030986

fbshipit-source-id: e00fc80ff6f5cb7bb49714d35c91361cb795ad0b
2018-02-22 09:39:51 -08:00
Michal Glaus 40c2449eec Pass numWorkers instead of maxWorkers to jest-worker
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**

Jest Worker accepts parameter `numWorkers`, not `maxWorkers`, see:
https://github.com/facebook/jest/tree/master/packages/jest-worker#numworkers-number-optional

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

**Test plan**

<!-- 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/136

Reviewed By: mjesun

Differential Revision: D7036411

Pulled By: rafeca

fbshipit-source-id: 5528ca4a9abe5a8e3668e83b214e10d97ba7a827
2018-02-22 08:31:07 -08:00
Burak Yigit Kaya a984719eef Upgrade Jest to 22.4.0 to pull fixes for jest-haste-map
Reviewed By: mjesun

Differential Revision: D7041111

fbshipit-source-id: 6dbd0cbf7b62a54d0b5f16bbf2fa81332542f14e
2018-02-22 06:15:23 -08:00
Maël Nison b354a81427 Uses Yargs instead of Command
Summary: This diff allows Metro to throw an error when a configuration file cannot be found, by using a new strict: true option.

Reviewed By: rafeca

Differential Revision: D6998613

fbshipit-source-id: b704633be18d5c007f1a022fa811d0a74c636fc9
2018-02-22 06:08:20 -08:00
Maël Nison eb72ad3794 Makes the Metro CLI commands injectable
Summary: This diff makes the Metro CLI commands injectable into any Yargs object, so that we can override various aspects of it, add extra commands, etc.

Reviewed By: davidaurelio

Differential Revision: D6988250

fbshipit-source-id: 217c661e4c1b05282b6cdbf4d745d1b29f5cbbe0
2018-02-22 06:08:20 -08:00
Peter van der Zee 60f16aafc2 Version bump babel-plugin-external-helpers
Reviewed By: cpojer

Differential Revision: D7054249

fbshipit-source-id: 5cb5619ab700e61a9f4feeceac0a5b803ddfdc15
2018-02-22 04:14:23 -08:00
Miguel Jimenez Esun 0f3f7daa4f Move mocking inside beforeEach for Transformer test
Reviewed By: rafeca

Differential Revision: D7040798

fbshipit-source-id: eece8c42e1368ead476c6d1495dad7e0abb4b0e3
2018-02-21 04:53:06 -08:00
Jean Lauliac d110c7b9ea metro: extract metro-resolver package
Reviewed By: rafeca

Differential Revision: D7011526

fbshipit-source-id: 523c54792cef1c31eef281e6e39bc25b20e2ceec
2018-02-21 04:53:06 -08:00
Peter van der Zee 5aa19c7626 Add minifier-path option to Metro
Summary:
This exposes the `minifierPath` externally and allows it to be adjusted through the `--minifier-path` argument.

This works for both the server (when starting the server) and running a single build through the CLI.

In server mode, this can not be used per file request yet, though that should also be doable if need be.

Reviewed By: rafeca

Differential Revision: D6998562

fbshipit-source-id: 669b876c24fe117ec88b2200d48aa82658f568b4
2018-02-20 04:22:00 -08:00
Peter van der Zee c080d70699 Start making the minifier an option for Metro
Reviewed By: jeanlauliac

Differential Revision: D6998187

fbshipit-source-id: 32e6fbb756ff119ed8a3070585e9f6c39fab1baa
2018-02-20 04:22:00 -08:00
Peter van der Zee e9e3a986c7 Add a minifier path option to the ModuleGraph path
Reviewed By: mjesun

Differential Revision: D6998189

fbshipit-source-id: 4876de98b9970088161d78e1b462688307ef477f
2018-02-20 04:22:00 -08:00
Rafael Oleza 25b201148b Refactor the traversal of dependencies logic
Reviewed By: jeanlauliac

Differential Revision: D7009928

fbshipit-source-id: a56e4d3b5a3b2c91f14affbc56cbca56c8526d06
2018-02-19 06:52:36 -08:00
Rafael Oleza cfe175254a Do not do unnecessary work when re-adding a file after deleting it
Reviewed By: mjesun

Differential Revision: D7009760

fbshipit-source-id: 18a93443226bdec4decb69f75539e27f528c128c
2018-02-19 06:52:36 -08:00
Rafael Oleza a5307e986e Make metro rely much less in the ModuleCache system
Reviewed By: jeanlauliac

Differential Revision: D6949157

fbshipit-source-id: cb5ef25aa582935f7c624375392be7fceefd87b6
2018-02-19 06:52:36 -08:00
Miguel Jimenez Esun 03c3b3d219 Fix JSTransformer/index test
Reviewed By: jeanlauliac

Differential Revision: D7019771

fbshipit-source-id: cbf232dc22f55d75dced3206b3c4ef1a472a7102
2018-02-19 04:59:47 -08:00
Peter van der Zee dd48bb1fa3 Improve Flow coverage
Reviewed By: mjesun

Differential Revision: D6999089

fbshipit-source-id: 5dfaef91909060b5a2bec0030048e97c2c2c3698
2018-02-19 04:24:08 -08:00
Sophie Alpert 2a327fb19d Update to MIT license
Summary: Manual changes.

Reviewed By: TheSavior, yungsters

Differential Revision: D7012152

fbshipit-source-id: de7459be3db13c687868b45059856f125c4f2eb1
2018-02-16 18:30:48 -08:00
Sophie Alpert 8242229b59 Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:30:48 -08:00
Miguel Jimenez Esun e651b81881 Move "transformFile" to "transform" to match worker interface
Reviewed By: cpojer

Differential Revision: D6968803

fbshipit-source-id: 7dee92d5a58e18bb1ee0d5cd5748acd44cde5b18
2018-02-16 11:49:30 -08:00
Miguel Jimenez Esun b129827fa2 Move Buck-specific config into its own types.flow
Reviewed By: rafeca

Differential Revision: D6949488

fbshipit-source-id: aa26b3cb51809569ea2123d9a24cb99506b2b52b
2018-02-16 11:49:30 -08:00
Jean Lauliac 0386ef17e9 metro: ModuleResolution: extract resolveDependency
Reviewed By: rafeca

Differential Revision: D6999063

fbshipit-source-id: 2568d996f7403fcd6f8b9a9311f5bdfa36b25b52
2018-02-16 09:24:43 -08:00
Rafael Oleza 29115f729c Make the getTransformCacheKeyFn-test not dependant on the metro version
Reviewed By: davidaurelio

Differential Revision: D6976235

fbshipit-source-id: 8ba5a0413c3c96224a91d6972beda5a413557646
2018-02-16 05:53:06 -08:00
Peter van der Zee 5b383fce16 Cleanup lint errors
Summary:
Argument was no longer used and is causing lint errors.
Dropping it simplifies the debounce function as well.

Reviewed By: davidaurelio

Differential Revision: D6999567

fbshipit-source-id: 8856ed40feb0fa23155c9d18e20c43550aac876b
2018-02-15 10:07:45 -08:00
Andres Suarez 581623ed11 Fold .eslintrc's into the root eslintrc
Reviewed By: davidaurelio

Differential Revision: D6996960

fbshipit-source-id: f05c76b7356b21ecb8db4489920fd3a1fc34f1d9
2018-02-15 08:24:07 -08:00
Miguel Jimenez Esun b958c400f0 Upgrade Jest to 22.3.0
Reviewed By: BYK

Differential Revision: D6978514

fbshipit-source-id: 3c6be52d38fedbe849dee6319bb2e4d7a97297c9
2018-02-15 03:38:41 -08:00
Peter van der Zee 084dbcef30 Move the minifier to its own package
Reviewed By: davidaurelio

Differential Revision: D6988462

fbshipit-source-id: 437b8a2fda3f25d7ace73d548602356de319a99d
2018-02-15 03:38:41 -08:00
Rafael Oleza d9b6fd7102 Pass cacheVersion param via the new API
Reviewed By: BYK

Differential Revision: D6980337

fbshipit-source-id: 72c01136b6720390ffec8593f0375c8756dc1d4a
2018-02-14 08:46:56 -08:00
Rafael Oleza afa3307659 Fix enableBabelRCLookup option in new CLI + global cache script
Reviewed By: BYK

Differential Revision: D6977885

fbshipit-source-id: 50245e046c7639f9fb4022a9cc5974d50831524c
2018-02-14 08:46:56 -08:00
Rafael Oleza 33e93dcde3 Bump metro@0.26.0
Reviewed By: cpojer

Differential Revision: D6976161

fbshipit-source-id: 0cf20f4b2372997a8aac41cc07a9bdd641a93ad4
2018-02-13 07:15:04 -08:00
Rafael Oleza c955b65b22 Remove flaky babel 7 test + some small lint fixes
Differential Revision: D6976119

fbshipit-source-id: 0315511e8835e7dcfc796ac7133b24346d805853
2018-02-13 06:31:03 -08:00
Christoph Nakazawa 892b4ac9de Expose getDependencies when using RAM bundles
Reviewed By: rafeca

Differential Revision: D6965192

fbshipit-source-id: 8f4178aa4c38c03beab6da8bcaf4dc193c02b044
2018-02-12 10:16:19 -08:00
Andres Suarez 7d5a120fe9 Namespace custom ESLint rules through eslint-plugin-lint
Reviewed By: mzlee

Differential Revision: D6934651

fbshipit-source-id: 3cb0c3550ad628e3b5c0bdaec8cde9d5579ea0af
2018-02-09 11:14:55 -08:00
Peter van der Zee eacd27ecaa Remove log
Reviewed By: jeanlauliac

Differential Revision: D6948396

fbshipit-source-id: 5c9286b47257820bd4ec0da3068c5b21dbaff663
2018-02-09 04:32:23 -08:00
Maël Nison f12b07101e Refactors option forwarding from RN-cli to Metro
Reviewed By: jeanlauliac

Differential Revision: D6936821

fbshipit-source-id: aeaad43ca056cf0cb26255e426695f3bfb396368
2018-02-09 04:32:23 -08:00
Jean Lauliac 07a79853ef metro: ModuleResolution: extract resolveModulePath
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
2018-02-08 10:14:25 -08:00
Jean Lauliac 1498c4ba6b metro-buck: getLibrary: precompute asset hashes
Reviewed By: davidaurelio

Differential Revision: D6937279

fbshipit-source-id: 328f06b2b66eeed6fd2f767dab1a03854c4dd28c
2018-02-08 10:06:29 -08:00
Jean Lauliac 01a92f3c2f asyncRequire: wrap result in default
Reviewed By: cpojer

Differential Revision: D6911464

fbshipit-source-id: 44953e0716e076e50d551738059435697d064733
2018-02-08 09:15:55 -08:00
Rafael Oleza 6f6890505e Bump metro@0.25.1
Reviewed By: cpojer

Differential Revision: D6924028

fbshipit-source-id: f643bd912b201a5333778f124b0c21acf84814df
2018-02-07 09:29:50 -08:00
Maël Nison cbaf70ce99 Ensures that the Metro server is closed when an exception happens in runBuild
Differential Revision: D6924180

fbshipit-source-id: 80f5bf60aa357ce8df0598e8fdac92776c4af601
2018-02-07 09:23:04 -08:00
Miguel Jimenez Esun be528451f5 Upgrade Jest to v22.2.1
Reviewed By: rafeca

Differential Revision: D6923664

fbshipit-source-id: 0751ee6f0eb72193b0b22bb38d0398b3d83592a3
2018-02-07 08:45:48 -08:00