Commit Graph

2124 Commits

Author SHA1 Message Date
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