Commit Graph

1039 Commits

Author SHA1 Message Date
Rafael Oleza 2529f81018 Bump metro@0.35.0
Reviewed By: mjesun

Differential Revision: D7759224

fbshipit-source-id: d21a371c196ff5c6e691fb7cce8c73dade02d385
2018-04-26 06:44:31 -07:00
Rafael Oleza 373ec95b2b Expose customTransformOptions param on the buildGraph command
Reviewed By: mjesun

Differential Revision: D7759324

fbshipit-source-id: b1f8af7ecb992f97d41b7212467ed95658d88bed
2018-04-26 06:44:31 -07:00
Miguel Jimenez Esun 7f8ee6daa8 Expose all dependency information as a "data" object in the graph
Reviewed By: rafeca

Differential Revision: D7757483

fbshipit-source-id: b0313ab8aeb61edc3cfa2bba20f381fccd264e4a
2018-04-26 04:14:13 -07:00
Peter van der Zee 05c715bda9 Major fixup to private class property transform
Reviewed By: mjesun

Differential Revision: D7757633

fbshipit-source-id: d0b065b6398df2753b4ca99610c8692d4335aab3
2018-04-26 02:54:26 -07:00
David Aurelio 9433e01377 React Native Default Setup: Make Babel 7 work
Summary: Makes it so that the default transformer loads babel-preset-react-native again if no project `.babelrc` is defined. This makes tests like `react-native/scripts/run-android-local-integration-tests.sh` work again.

Reviewed By: mjesun

Differential Revision: D7766134

fbshipit-source-id: fa12a6e2a535c9f4b35e4b2b954b5be9d455a9cb
2018-04-26 01:10:19 -07:00
Miguel Jimenez Esun 2264fd9215 Make HTTP cache errors return null, warn, and log the error
Reviewed By: davidaurelio

Differential Revision: D7757419

fbshipit-source-id: 24b33995a9ddfe7aa3d4bef9e5fbbfbd5af5d533
2018-04-25 08:46:28 -07:00
Jean Lauliac 4a118ee69c react-native-github: remove old fs mock implementation
Reviewed By: rafeca

Differential Revision: D7652914

fbshipit-source-id: 5494305750e7616b5120169266c519f460ae7e6d
2018-04-25 07:21:27 -07:00
Miguel Jimenez Esun 3bf01f272f Refactor re-order dependencies: remove hybrid pseudo-module
Reviewed By: rafeca

Differential Revision: D7744414

fbshipit-source-id: 36995be791327e792c773482a331f00618cfb4ff
2018-04-25 05:30:02 -07:00
Miguel Jimenez Esun 884d2ca248 Pass the full dependencies object
Reviewed By: jeanlauliac

Differential Revision: D7731623

fbshipit-source-id: 070ab5f9909525102e19f782e8a26e79d7b880cc
2018-04-24 09:44:37 -07:00
Miguel Jimenez Esun 2efc8bef2f Make test use snapshots instead of hardcoded objects
Reviewed By: jeanlauliac

Differential Revision: D7731938

fbshipit-source-id: 497f1f5cb301b9e867b8f1af7fe6ad2fa8634202
2018-04-24 09:44:37 -07:00
Miguel Jimenez Esun 6708136b76 Revert D7729796: Enforce by default a local FileStore cache
Differential Revision:
D7729796

Original commit changeset: 03100516973f

fbshipit-source-id: c9cc5210ac8559ff4878e27d5a5e3133408637c8
2018-04-24 06:29:55 -07:00
Miguel Jimenez Esun c26e7b7ce2 Enforce by default a local FileStore cache
Reviewed By: davidaurelio

Differential Revision: D7729796

fbshipit-source-id: 03100516973f42a654f849a688e6cbf104c63a68
2018-04-24 04:31:38 -07:00
David Aurelio 6b7bffe653 Move `buildRegExps` from `react-native` to `metro-babel-register`
Summary: Moves the `buildRegExps` function from `react-native` to `metro-babel-register`. This way, it is easier to reuse, and we can remove FB-specific logic from React Native.

Reviewed By: jeanlauliac, mjesun

Differential Revision: D7727483

fbshipit-source-id: 0f7773ff044033c465f0712c523a0aef61bf8444
2018-04-23 13:53:03 -07:00
Miguel Jimenez Esun 2a029e05e8 Use the result of the cache key function
Reviewed By: rafeca

Differential Revision: D7729279

fbshipit-source-id: 1684576cf18dc62a0f4de6249bc3dcd92f7f6c2f
2018-04-23 10:53:06 -07:00
Miguel Jimenez Esun e32c71dc36 Make FileStore fully generic
Reviewed By: rafeca

Differential Revision: D7714699

fbshipit-source-id: 7886f99015a88fe4c92c104627aff995ea3dba42
2018-04-23 08:03:04 -07:00
David Aurelio bce317701b Move worker protocol and babelRegisterOnly into their own packages
Summary: Moves the implementation of Buck’s worker protocol into its own package and babelRegisterOnly for better reusability.

Reviewed By: rafeca

Differential Revision: D7666896

fbshipit-source-id: ae297494ced3b8dd1f9d90983a640643d6ce7896
2018-04-23 04:00:51 -07:00
Miguel Jimenez Esun c398cd99a1 Use "getSha1" from HasteFS
Reviewed By: cpojer

Differential Revision: D7721378

fbshipit-source-id: 441666df325c60d94eb6e14b50c3c4cde76b3dfe
2018-04-21 11:31:07 -07:00
Miguel Jimenez Esun d9f857e966 Upgrade Jest to 23.0.0-beta.1
Reviewed By: cpojer

Differential Revision: D7722547

fbshipit-source-id: 711617c5c88fced5a38067a66fda86d2b281c0a2
2018-04-21 11:31:07 -07:00
Miguel Jimenez Esun 186376b2d9 Enforce Buffer encoding
Reviewed By: cpojer

Differential Revision: D7721212

fbshipit-source-id: 0e42609cca653e4051c6a91801963decd8464a7d
2018-04-21 10:24:13 -07:00
David Aurelio 18507aecc9 require implementations: Make module map an array, preset length, if number of modules is known
Summary: For specific cases, Metro will write the number of modules to the bundle. The require implementation can take advantage of that, and construct an array with the target size.

Reviewed By: mjesun

Differential Revision: D7696290

fbshipit-source-id: a7be74c02960dc089e4d3c1accd7c732b762c8b5
2018-04-21 02:58:50 -07:00
Rafael Oleza 8aa96e6a3e Bump metro@0.34.0
Differential Revision: D7708906

fbshipit-source-id: 3d8cdfd2745baf73c92f90e0960f7cd73a289f77
2018-04-20 14:18:58 -07:00
Rafael Oleza e11dddd141 Expose the asyncRequireModulePath param
Reviewed By: mjesun

Differential Revision: D7709569

fbshipit-source-id: 871dd9c178b1e5c81163558201ef983315561211
2018-04-20 14:18:58 -07:00
Rafael Oleza 87e3ce281a Upgrade to babel-preset-react-native@5.0.0
Differential Revision: D7709120

fbshipit-source-id: e4919024b46d5533aee97f97c76f4165b0a46c26
2018-04-20 14:18:58 -07:00
Nat Mote faaf681ca2 Remove non-top-level export from module.js
Reviewed By: davidaurelio

Differential Revision: D7705454

fbshipit-source-id: 73e09dde208828a22b514228cc55b5cd940ea859
2018-04-20 09:51:16 -07:00
Rafael Oleza 3adbf01ea2 Expose minify param to the buildGraph method
Summary: Now that the minifier is integrated inside the transformer, we can expose the param in the `buildGraph` method

Reviewed By: davidaurelio

Differential Revision: D7707542

fbshipit-source-id: 0125172b2ac90c7ceb477d5c55e9aea3c3867e02
2018-04-20 09:51:16 -07:00
Rafael Oleza a6b61554ec Export the hmr plugin directly
Summary: This will allow to configure the HMR plugin directly from `.babelrc` again, instead of having to create a bridge file: https://github.com/rafeca/metro-sample-app/blob/master/metro-babel7-plugin-react-transform.js#L3

Reviewed By: davidaurelio

Differential Revision: D7707314

fbshipit-source-id: 4c5612e1e5d27874807f2dce50d99ec0f6354bbc
2018-04-20 09:51:16 -07:00
Rafael Oleza a8ce776044 Fix minification of JSON files
Summary:
When moving the minification to the worker, I forgot to also minify JSON files (they have an early return).

This diff fixes this :)

Reviewed By: davidaurelio

Differential Revision: D7707317

fbshipit-source-id: 1114017b811861a6f2caebe79e1d79e6ad9a7b1e
2018-04-20 09:51:16 -07:00
Miguel Jimenez Esun df53fb3de5 Remove GlobalTransformCache.js
Reviewed By: davidaurelio

Differential Revision: D7628728

fbshipit-source-id: 6b0c54e3e84e74cf531c17b4644da382e35f3ed4
2018-04-20 07:36:10 -07:00
Miguel Jimenez Esun 084ac30863 Clean buildBundle.js, index.js and Flow types
Reviewed By: davidaurelio

Differential Revision: D7628725

fbshipit-source-id: 3873e5c7a0c9b988335dcf9b8a11fcf0598a9f50
2018-04-20 07:36:10 -07:00
Miguel Jimenez Esun 910a71ba1a Clean server.js and runServer.js
Reviewed By: davidaurelio

Differential Revision: D7628734

fbshipit-source-id: 3788b35b0f9b5034d9152c5c3b297313fbec231a
2018-04-20 07:36:10 -07:00
Peter van der Zee a334fd85d2 Lock down more @babel packages
Reviewed By: davidaurelio

Differential Revision: D7687595

fbshipit-source-id: 839be2c7d8aed392a6b5b398b72d2255a16111b4
2018-04-20 05:30:14 -07:00
Maël Nison 2f9ba4b57a Adds react-transform-hmr to Metro dependencies
Reviewed By: davidaurelio

Differential Revision: D7707139

fbshipit-source-id: e271db39fda3bf257d5126a7a5734d8565f809d0
2018-04-20 04:22:19 -07:00
Miguel Jimenez Esun 585a0def32 Clean DependencyGraph.js
Reviewed By: cpojer

Differential Revision: D7628731

fbshipit-source-id: 653d0ebc7b506fb19df15874aad7877c981f1979
2018-04-19 18:41:32 -07:00
Miguel Jimenez Esun b88d8d1f99 Clean ModuleCache.js
Reviewed By: cpojer

Differential Revision: D7628729

fbshipit-source-id: 0c9d617cfdb6f1e514e2bc61fe393ef1b589bd97
2018-04-19 18:41:32 -07:00
Miguel Jimenez Esun fecc8d3508 Clean Bundler.js
Reviewed By: rafeca

Differential Revision: D7628724

fbshipit-source-id: 75256551bfcaf3729882b76eaade2979d8a85c64
2018-04-19 18:41:32 -07:00
Miguel Jimenez Esun 01827a0fab Simplify Module.js
Reviewed By: rafeca

Differential Revision: D7628732

fbshipit-source-id: 50f5612d94727190c372148eba1a01f245f21d73
2018-04-19 09:13:50 -07:00
Peter van der Zee 16e843ef98 Lock down Babel 7 in metro to beta.40
Summary:
Since Babel is still in beta and breaking changes may happen between beta versions we need to lock this down and carefully consider upgrades.

For example, between .40 and .44 there seem to be at least two new mandatory options and who knows what else.

Once Babel 7 leaves beta we can go back to the caret (^).

Reviewed By: rafeca

Differential Revision: D7685783

fbshipit-source-id: ff6e19f5716b4c7fdfb8778c650309bb92966ff7
2018-04-19 06:23:34 -07:00
Peter van der Zee 91568c8e5c Upgrade Prettier to v1.12.1 on fbsource
Reviewed By: benjaffe, ryanmce, yungsters

Differential Revision: D7652946

fbshipit-source-id: 396d45c675e93f2298cd2920d927630c81867447
2018-04-19 03:04:48 -07:00
Rafael Oleza e023342d24 Bump metro@0.33.0
Reviewed By: davidaurelio

Differential Revision: D7661486

fbshipit-source-id: 5186a853eaff139948622e93d851deb9577567dc
2018-04-18 12:25:03 -07:00
Rafael Oleza 380ad7105a Move minification to the transformation phase
Reviewed By: mjesun

Differential Revision: D7670710

fbshipit-source-id: 8a55de0d3a1ee4879d21391d47fd0acd66482f44
2018-04-18 12:25:03 -07:00
Rafael Oleza 310c096671 Expose type parameter on the buildGraph command
Reviewed By: davidaurelio

Differential Revision: D7654256

fbshipit-source-id: c3d97a1564ed06561b071ca412b14655f46cbc4f
2018-04-18 12:25:03 -07:00
Rafael Oleza 47793c25a5 Rename edge to module in DeltaBundler
Reviewed By: jeanlauliac

Differential Revision: D7652219

fbshipit-source-id: 88922711eaccd0a6bff1a0f3cc9bfaa770f4c275
2018-04-18 12:25:02 -07:00
Rafael Oleza 2446fe2211 Decouple the dependency traversal logic from Bundler/Dependencygraph/Module
Summary:
This commit refactors the metro bundling logic to make the traversal of dependencies much more generic, to not depend on any assumption regarding dependency resolution, haste, or even about the transformer/caching system.

So, the actual API of the `DeltaBundler` module (which will be extracted as a separate package in the near future) ends up being like this:

```
const graph = await deltaBundler.buildGraph(
  ['/root/entryPoint1.js', '/root/entryPoint2.js', /* ... */],
  {
    dependencyResolver: (from, to) => require('resolve').sync(to, {from}), // Use the standard nodejs resolver
    transformFn: filePath => await transformFileUsingWhateverIPrefer(filePath),
  },
);
```

The only part that is still coupled with the `DependencyGraph` is the file listener (which is tied to JestHasteMap via `DependencyGraph`), which is going to be decoupled soon.

From here, and once we have the new caching system fully rolled out and the old cache logic removed, we'll incorporate `jest-worker` and the caching system directly into the build graph logic, to end up extracting the whole `DeltaBundler` logic into its own package.

From there we can potentially reuse it to create simpler/more focused bundlers for web/etc.

Reviewed By: davidaurelio

Differential Revision: D7617143

fbshipit-source-id: b7e1a71cd95043f6232b07f2e8c45dcd49f089f2
2018-04-18 12:25:02 -07:00
Rafael Oleza 7cdbdffa96 Fix incremental builds when minify=true
Reviewed By: jeanlauliac

Differential Revision: D7615597

fbshipit-source-id: ab0985ed1954d8916e2f9c89c88465be196edd5f
2018-04-17 18:45:55 -07:00
Avik Chaudhuri c82456d8e0 @allow-large-files clean up xplat/js for flow 0.70.0
Reviewed By: fishythefish

Differential Revision: D7643236

fbshipit-source-id: 1d9a95f1e249ce3fdc552a4ca92a6c63b267dae4
2018-04-17 05:50:48 -07:00
Miguel Jimenez Esun c67b6317fa Improve error reporting for SHA-1 retrieval
Reviewed By: rafeca

Differential Revision: D7642401

fbshipit-source-id: b04610abcfbb33629db640c7d97083722db1fe17
2018-04-16 16:09:05 -07:00
Miguel Jimenez Esun c56e414560 Implement "clear" method in "metro-cache" stores
Reviewed By: rubennorte

Differential Revision: D7628735

fbshipit-source-id: a129bd32f30be968116e0efa065badc6a7d55d51
2018-04-16 12:59:57 -07:00
Rafael Oleza 8fcc40edf2 Clean not found/error requests from nodejs HTTP agent
Differential Revision: D7635421

fbshipit-source-id: 2a825a99ce57857354f17496239a9537bf068bc2
2018-04-16 04:52:18 -07:00
Miguel Jimenez Esun f5e93c6e91 Remove PersistedMapStore
Reviewed By: cpojer

Differential Revision: D7628723

fbshipit-source-id: 0efb8d42da621870e46ab57a2c23775d5f0e373c
2018-04-14 05:33:45 -07:00
Jean Lauliac 9922584f45 metro: remove fs mock completely
Reviewed By: mjesun

Differential Revision: D7627213

fbshipit-source-id: cc68b46ef93e2da78d34f1561b2c65a5f1682b06
2018-04-14 00:01:00 -07:00