Commit Graph

2073 Commits

Author SHA1 Message Date
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
Sunny Luo f16bbae30d Fix a typo in GettingStarted.md
Summary: Closes https://github.com/facebook/metro/pull/164

Differential Revision: D7706952

Pulled By: cpojer

fbshipit-source-id: 397788508cb3a8202730f58f5d1a2b794ff46d14
2018-04-20 02:30:06 -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
Peter van der Zee ef7c0a869d Add missing plugin for node 6/7
Reviewed By: mjesun

Differential Revision: D7610367

fbshipit-source-id: 5797bd713c0dc81d627e3eec72913c5100700369
2018-04-12 20:28:54 -07:00
Miguel Jimenez Esun 305669e716 Add HTTP store
Reviewed By: jeanlauliac

Differential Revision: D7382414

fbshipit-source-id: 2c6cdb9330137718f49771bafdabe2b6d24e7ba8
2018-04-12 15:28:03 -07:00
Miguel Jimenez Esun b278e42155 Lazily access source all the way up
Reviewed By: jeanlauliac

Differential Revision: D7602299

fbshipit-source-id: e3787d164a691350cb37183b4738947902cc85cf
2018-04-12 14:43:39 -07:00
Jean Lauliac 55e7e50232 metro: traverseDependencies-integration-test: switch to the memory FS
Reviewed By: rafeca

Differential Revision: D7257733

fbshipit-source-id: a82583bfed0921a69e4518bf32bcdb4515f50c94
2018-04-11 18:14:34 -07:00
Jean Lauliac 13e0844dcf metro-memory-fs: add support for win32
Reviewed By: rafeca

Differential Revision: D7545983

fbshipit-source-id: 1fa8ae6c773e933a73fa525c191599b35d85c604
2018-04-11 18:14:34 -07:00
Peter van der Zee 0349db8654 BREAKING CHANGE: UPGRADE REACT NATIVE TO BABEL 7!
Summary:
BREAKING CHANGE
This change upgrades the React Native build pipeline from Babel 6 to Babel 7

If you use a `.babelrc` then you'll need to update it to Babel 7 (note that some plugins are no longer relevant, some plugins are automatically upgraded, and some will need some manual love).

Note that you may also need to upgrade your dev env, tests etc, to make sure they work with Babel 7.

Reviewed By: mjesun

Differential Revision: D7591303

fbshipit-source-id: 29cef21f6466633a9c366d1f3c0d3cf874c714db
2018-04-11 17:14:14 -07:00
David Aurelio 2a2b54555e Move `.../<name>/index.js` to `.../<name>.js`
Summary:
Here, we move `index.js` files in directories one level up, and rename them to `<dirname>.js`.

This makes for a more pleasant development experience, as files are easier to identify even when only seeing the file name.
It also eliminates quite some `../` segments in imports.

Reviewed By: mjesun

Differential Revision: D7587186

fbshipit-source-id: cf7e6b417085435d731c5b6830309068035bcd19
2018-04-11 13:46:37 -07:00
Rafael Oleza 5f0117e27a Bump metro@0.32.0
Reviewed By: mjesun

Differential Revision: D7586296

fbshipit-source-id: 72407851366c5c2de15d4b3c7fe6311281d697bf
2018-04-11 10:53:54 -07:00
Rafael Oleza ab73426926 Add NPM_TOKEN to the npmrc configuration to be able to publish the npm package from circleci
Reviewed By: mjesun

Differential Revision: D7586241

fbshipit-source-id: eaba25453c1aca00c07bf0eae961878e1de2e391
2018-04-11 10:53:53 -07:00
Rafael Oleza d54a7044f2 Support passing multiple entryPoints to the public buildGraph() method
Reviewed By: mjesun

Differential Revision: D7365288

fbshipit-source-id: 1d1b94858d2ad31307157839808b9a6c01c00365
2018-04-11 10:53:53 -07:00
Rafael Oleza d0fdca73cd metro-memory-fs: Do not report a file change when reading a file
Reviewed By: jeanlauliac

Differential Revision: D7584517

fbshipit-source-id: 55f87d15c723f697ea00c357da1d36f5d31accbb
2018-04-11 10:04:08 -07:00
Rafael Oleza bd5d776a2f metro-memory-fs: Allow to also listen directly to files
Reviewed By: jeanlauliac

Differential Revision: D7584516

fbshipit-source-id: 4362b148a59f11b7cc1ccb27e4c1a9ebf042e52c
2018-04-11 10:04:08 -07:00
Matt Mahoney 76a9a21369 Revert D7097279: BREAKING CHANGE: UPGRADE REACT NATIVE TO BABEL 7!
Differential Revision:
D7097279

Original commit changeset: 9fb204cae733

fbshipit-source-id: bbbb20b5dbed5dc01ae5557686a07d987b9a6cc6
2018-04-11 08:32:08 -07:00
David Aurelio 1c3adf5d21 Fix source map generation with experimental caches
Summary: Fixes a typo with a property name that flow did not catch.

Reviewed By: mjesun

Differential Revision: D7582300

fbshipit-source-id: 039550dffb0f22ed8d2820e7fdcbe35c1d012c68
2018-04-10 22:02:06 -07:00
Peter van der Zee 11d36cd985 BREAKING CHANGE: UPGRADE REACT NATIVE TO BABEL 7!
Summary:
BREAKING CHANGE
This change upgrades the React Native build pipeline from Babel 6 to Babel 7

If you use a `.babelrc` then you'll need to update it to Babel 7 (note that some plugins are no longer relevant, some plugins are automatically upgraded, and some will need some manual love).

Note that you may also need to upgrade your dev env, tests etc, to make sure they work with Babel 7.

Reviewed By: cpojer

Differential Revision: D7097279

fbshipit-source-id: 9fb204cae733174a1c155669b7c17ddb70f7aecc
2018-04-10 21:14:56 -07:00
Miguel Jimenez Esun e49c7a350c Do not read file on the main process when using SHA-1 + experimental caches
Reviewed By: jeanlauliac

Differential Revision: D7443476

fbshipit-source-id: 4363b35ee5cbf988758b249c9a9c3d5ca606f317
2018-04-10 18:57:45 -07:00
Peter van der Zee 8073bdaa08 Tiny refactor; use `== null`
Reviewed By: davidaurelio

Differential Revision: D7575286

fbshipit-source-id: a9e0fc7ee5a15ce1eabb84759cf584df2acca008
2018-04-10 18:02:06 -07:00
Spencer Ahrens 11cc6a7f65 add new hooks to print require paths
Reviewed By: jingc

Differential Revision: D7545569

fbshipit-source-id: 57fa6fef45805c74682dd9897570a89c82ce0b23
2018-04-10 12:36:45 -07:00
Peter van der Zee 6ab9e7d09c Change the name JSFileWrapping uses for `require`
Reviewed By: jeanlauliac

Differential Revision: D7502266

fbshipit-source-id: 23457eba7321fccb6d9a1f2d3d950e75cdc8a26a
2018-04-10 10:30:18 -07:00