Commit Graph

2051 Commits

Author SHA1 Message Date
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
Rafael Oleza c35f1a2c01 Remove .meta files generation from metro
Reviewed By: davidaurelio

Differential Revision: D7347623

fbshipit-source-id: 29c8b79771566178ea8f720a93bd73df678c7807
2018-04-10 09:44:32 -07:00
Peter van der Zee b05f9692e7 Fix non-existing babel types
Reviewed By: jeanlauliac

Differential Revision: D7534831

fbshipit-source-id: ff5d068596a42c560ee926155889bdd8710b0208
2018-04-09 17:58:00 -07:00
Miguel Jimenez Esun 9045aad7e4 Use SHA-1 on experimental caches
Reviewed By: jeanlauliac

Differential Revision: D7399785

fbshipit-source-id: c8e842390e27d7954ca78dcd5c4b7e2a115d1b9d
2018-04-09 16:12:06 -07:00
Jean Lauliac caf4fe379f metro: inline-plugin-test: does not replace local variables
Reviewed By: fromcelticpark

Differential Revision: D7533450

fbshipit-source-id: 5f1d37ad3cd8ecd585d627edd501f732837f12c5
2018-04-06 06:29:24 -07:00
Maël Nison 203bb0ddfd Adds an experimental hook for custom resolutions
Reviewed By: mjesun

Differential Revision: D7337022

fbshipit-source-id: fea1ee345e4d3b5713fed6cdc33869fbba6f21e2
2018-04-05 08:59:51 -07:00
Peter van der Zee 5714c450f7 Rename the `accept` local function to `metroAccept`
Reviewed By: rubennorte

Differential Revision: D7487829

fbshipit-source-id: f9055d7c42542124cf8db2652638973f6dfef63f
2018-04-05 06:29:53 -07:00
Jean Lauliac 7e523b21e5 metro-memory-fs: add unlinkSync()
Reviewed By: rubennorte

Differential Revision: D7443805

fbshipit-source-id: 53368103f9230622250be62cde2474c21a930be8
2018-04-04 03:10:49 -07:00
Jean Lauliac 6d8b06dcd9 metro-memory-fs: add watch()
Reviewed By: rubennorte

Differential Revision: D7443797

fbshipit-source-id: 2ffdfb3649caf057c42313e36e9ff35e70f4f759
2018-04-04 03:10:49 -07:00
Jean Lauliac 72a66fa8e4 xplat/js/metro: DependencyGraph: reject on duplicate modules
Reviewed By: davidaurelio

Differential Revision: D7398617

fbshipit-source-id: eaac785d94b827502c2c50d8ec53ae251547a8a5
2018-04-03 09:30:23 -07:00
David Aurelio 01599ed55e Send `X-Metro-Delta-ID` header
Summary:
Adds additional headers to delta responses:
- The next delta ID. This helps to defer parsing the delta payload to a different layer.
- The size of the delta. This can be used as a hint for memory allocation

Reviewed By: jeanlauliac

Differential Revision: D7428603

fbshipit-source-id: 1d5e840991ec8cb490d33b3bc97444b0d7a3a0f3
2018-03-29 09:18:48 -07:00
glevi@fb.com a15a515f37 Upgrade to Flow v0.69.0
Reviewed By: panagosg7

Differential Revision: D7437630

fbshipit-source-id: db9627afed89049c07a121296fbd52e2bfbf39bf
2018-03-29 06:42:18 -07:00
Peter van der Zee 77a5cbdd33 Rename the `require` local var in the require "polyfill"
Reviewed By: mjesun

Differential Revision: D7399735

fbshipit-source-id: 1daa1aee112f47bc87cc5b156a48919f8da8fa4f
2018-03-28 10:16:29 -07:00
Miguel Jimenez Esun a36195a0fd Upgrade Jest to 23.0.0-alpha.4
Reviewed By: cpojer

Differential Revision: D7397960

fbshipit-source-id: 40984ff1ebfccdcba58f898abf8c52e2ed337221
2018-03-27 12:29:38 -07:00
Peter van der Zee 22b5fef24d Move package resolution error to its own file
Reviewed By: rafeca

Differential Revision: D7180926

fbshipit-source-id: 24f14a662bbfc776c02093339f571db32af0be90
2018-03-25 13:42:31 -07:00
Peter van der Zee 94028f16c1 Move the ambiguous error to its own file
Reviewed By: davidaurelio

Differential Revision: D7180925

fbshipit-source-id: 4b92397a768e0d9cda102d4b237bc39d2b38b443
2018-03-25 13:42:31 -07:00
Peter van der Zee 094489f6e1 Add the skeleton for abstracting error classes
Reviewed By: rafeca

Differential Revision: D7180927

fbshipit-source-id: 9acc77e761433845009367faea28b1c8dbbcc114
2018-03-25 13:42:31 -07:00
Miguel Jimenez Esun debe429690 Organize a bit metro-cache
Reviewed By: jeanlauliac

Differential Revision: D7350100

fbshipit-source-id: bc5ce7ca4f264f523a18be84e390c6a19ac74374
2018-03-21 10:43:20 -07:00
Peter van der Zee e42b126485 Inject imports through external babel api for babel 7
Reviewed By: arcanis

Differential Revision: D7337424

fbshipit-source-id: 9bbaea34759475d2bbd95615e6715fcacda59c3a
2018-03-21 09:30:47 -07:00
Peter van der Zee 5a7fa7e2dd Add babel-helper-module-imports to prepare react transform
Reviewed By: arcanis

Differential Revision: D7337427

fbshipit-source-id: caf2b2df2b506378b820302374ad9be523283da7
2018-03-21 09:30:47 -07:00
Peter van der Zee b3619fc838 Workaround for babel7
Reviewed By: arcanis

Differential Revision: D7337431

fbshipit-source-id: f25a576b1ead75cba32cdffd3341a89380665d7a
2018-03-21 09:30:47 -07:00
Peter van der Zee 9b90096a2a Depend on local version of babel-plugin-react-transform
Reviewed By: arcanis

Differential Revision: D7337432

fbshipit-source-id: 3729359da0ccfd3161546ab3ea9331ad30fb6e8d
2018-03-21 09:30:47 -07:00
Peter van der Zee ad2d99512b Create a local package of babel-plugin-transform-react
Reviewed By: arcanis

Differential Revision: D7337425

fbshipit-source-id: c70c27921faacb4f39674d0fbc14a2052fe9eac3
2018-03-21 09:30:47 -07:00