Commit Graph

1986 Commits

Author SHA1 Message Date
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
Peter van der Zee 243fe983b7 Improve Flow typing for @babel/template
Summary:
The current typing is incorrectly marking the second parameter as required. The options object is optional.

Also added the special defaults for clarity.

Reviewed By: davidaurelio

Differential Revision: D7168409

fbshipit-source-id: e01b651f92b33175b750d188f9e6db99bdc4ab64
2018-03-07 04:36:33 -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