Commit Graph

2160 Commits

Author SHA1 Message Date
Rafael Oleza adce40d38d Do not use spread operator in require.js implementation
Reviewed By: jeanlauliac

Differential Revision: D8074917

fbshipit-source-id: e7c4dca7955f7aeda8b59d2039e857f79168410b
2018-05-22 08:02:48 -07:00
Miguel Jimenez Esun 1b15c47c93 Bump Metro to 0.37.1
Reviewed By: rafeca

Differential Revision: D8038396

fbshipit-source-id: 33fe5499825653f205bdb588ff4c7fa232602f24
2018-05-21 08:32:07 -07:00
Miguel Jimenez Esun 5841122d27 Recursively traverse every time we strip a block
Summary:
It turns out that block removal can create dead variables, which can in turn further process and improve other block removal. This diff takes care of ensuring that this process happens iteratively until no further blocks can be removed.

It also moves block removal to `Program.exit`. This is important to avoid removing "unused" blocks, which are non-atomically added by other plugins (e.g. Babel's class plugin first adds a `function` that will later be used as a helper, but the dead code removal was kicked-in before adding its usage, and was getting removed).

Reviewed By: davidaurelio

Differential Revision: D8069299

fbshipit-source-id: d86c9be2a76fced9a6529a1d5aaaad4430d0f194
2018-05-21 08:32:07 -07:00
Miguel Jimenez Esun 263118c84b Make constant folding remove unused functions
Summary:
Patterns like:

```
function x() {
  require('foo');
}

const y = function() {
  require('bar');
}

module.exports = 'potato';
```

Are registering as dependencies `foo` and `bar`, because `x` and `y` are not stripped. This change detects both expressions and declarations, and if the binding is not referenced, the function is dropped.

Reviewed By: davidaurelio

Differential Revision: D8043063

fbshipit-source-id: a1deb2bcea4db6bdbe6b5ac569cbbebd0f4b1c3c
2018-05-21 08:32:06 -07:00
Miguel Jimenez Esun 4a75826683 Make constant folding more powerful
Reviewed By: davidaurelio

Differential Revision: D8038008

fbshipit-source-id: 06c81ccf4e816ceefeb6673f247fd0bac41429a6
2018-05-21 08:32:06 -07:00
Peter van der Zee 54828cce35 Add automated script to update the babelHelpers file
Reviewed By: cpojer

Differential Revision: D8025371

fbshipit-source-id: 4811f16d882196bc32be7471b6a3ab4d834651c2
2018-05-18 06:26:05 -07:00
Abhinav Batra 88ffb77729 Fix symbolication for frames without filename
Summary: Metro server would fail when frame.file would be null. This can happen when the frame is not in js.

Reviewed By: davidaurelio

Differential Revision: D8055637

fbshipit-source-id: eed5abe0cacef68b72a1cd47db23426b5c594727
2018-05-18 05:23:36 -07:00
Rafael Oleza 68807f0a56 Fix issue in the delta bundler when both a file and one of its dependencies have been deleted
Reviewed By: mjesun

Differential Revision: D8037251

fbshipit-source-id: 3b9f2153ad1f21bbd2e35d9b31c84e276543efae
2018-05-17 08:43:35 -07:00
Miguel Jimenez Esun 814182edb1 Verify the everstore_handles hash against the file one
Reviewed By: jeanlauliac

Differential Revision: D7994855

fbshipit-source-id: b51c6923b6cc87fbef84001367ffe45546979131
2018-05-15 10:51:40 -07:00
Miguel Jimenez Esun 082f070c22 Upgrade Jest to 23.0.0-charlie.2
Reviewed By: jeanlauliac

Differential Revision: D8003994

fbshipit-source-id: 29dce0bac329e17499e86aa46e2e9015145e6e04
2018-05-15 06:27:56 -07:00
Peter van der Zee a107dc3f57 Add `sourceType` to babylon parse calls
Reviewed By: rafeca

Differential Revision: D8004409

fbshipit-source-id: 85573296fec6e849508d88848c1bc1afb81921cf
2018-05-15 06:27:56 -07:00
Rafael Oleza f4999c87e4 Bump metro@0.37.0
Reviewed By: jeanlauliac

Differential Revision: D7988114

fbshipit-source-id: aeaed94cb89a929ab5079af957bfccd9fd7ebd83
2018-05-15 02:49:53 -07:00
Rafael Oleza 56cc291561 Expose runMetro command
Reviewed By: mjesun

Differential Revision: D7994492

fbshipit-source-id: 1af342b772fa609927bba98513b254229a861d2a
2018-05-15 02:49:53 -07:00
Coby White 1c43bd841b Metro: Keep from naively seeing all requires as commonjs requires.
Reviewed By: mjesun

Differential Revision: D7992887

fbshipit-source-id: b54f910d0c3430e067660c32ab8df04c59999b21
2018-05-14 17:16:04 -07:00
Miguel Jimenez Esun 4a1e4f7646 Make "browser" field work with the destination too
Reviewed By: rafeca

Differential Revision: D7974989

fbshipit-source-id: f1a14dbd44a82c1929525416b56f455a6a685bcd
2018-05-14 08:56:12 -07:00
Panagiotis Vekris 2b9a8fdc30 v0.72.0 in xplat/js
Reviewed By: gabelevi

Differential Revision: D7956747

fbshipit-source-id: b1993de405c273b3cc1ed74f994e8e75bda0a985
2018-05-11 18:03:04 -07:00
Rafael Oleza 35c5abf3ee Make transformer result flow types generic all over the place
Reviewed By: jeanlauliac

Differential Revision: D7895095

fbshipit-source-id: df47f4b3e7a08e194fa1a2f874be87ead64ac198
2018-05-11 15:17:22 -07:00
Rafael Oleza 06c8b6b7a6 Move DeltaBundler flow types to a single file
Reviewed By: mjesun

Differential Revision: D7895075

fbshipit-source-id: 0b9754b4b2a8210e6a8f3d74b0eae83bf6472b52
2018-05-11 15:17:22 -07:00
Rafael Oleza bb9bfc261b More cleanup to unused method/props on Module/ModuleCache
Reviewed By: jeanlauliac

Differential Revision: D7894078

fbshipit-source-id: 74616cdb6ff1bd71a34a5a53fb5ab031adf23f5a
2018-05-11 15:17:22 -07:00
Rafael Oleza 058c2ac117 Remove AssetModule
Reviewed By: jeanlauliac

Differential Revision: D7894081

fbshipit-source-id: ca1d91dbd45dd2862e2e72724756965a5a60fa60
2018-05-11 15:17:22 -07:00
Rafael Oleza e47fdf6f59 Clean-up Module methods/properties
Reviewed By: jeanlauliac

Differential Revision: D7894084

fbshipit-source-id: 1a4826d272da51f8beea44ba9b82fa685d254fbe
2018-05-11 15:17:22 -07:00
Rafael Oleza 9a1bfe6388 Stop using Module.read() for transforming files
Reviewed By: jeanlauliac

Differential Revision: D7894083

fbshipit-source-id: 27685280cca1d6eb219bd7cbfc33b8b05a580296
2018-05-11 15:17:22 -07:00
Rafael Oleza 51dd867f45 Always read the module source code from the worker
Reviewed By: jeanlauliac

Differential Revision: D7894133

fbshipit-source-id: bf5c366d31e6e30d0cc82bd32fa9668040aea081
2018-05-11 15:17:22 -07:00
Rafael Oleza 42652b1ed8 Decouple the Worker options from the Babel Transformer options
Reviewed By: jeanlauliac

Differential Revision: D7894079

fbshipit-source-id: 40cbd991690f25f8c0f045c42a0105d74d516803
2018-05-11 15:17:22 -07:00
Rafael Oleza cdbacc96b7 Make output types from Delta Bundler generic
Reviewed By: jeanlauliac

Differential Revision: D7894080

fbshipit-source-id: 0f560c4600b4931bcc8f32ded10a7933d1ead984
2018-05-11 15:17:21 -07:00
Rafael Oleza 095426d038 Change the worker response to return an array of outputs
Reviewed By: davidaurelio

Differential Revision: D7877462

fbshipit-source-id: 94dba306c7a7f8611df5e5f59d0147e38ef89f0e
2018-05-11 15:17:21 -07:00
Rafael Oleza 5c8b86aed5 Change the Graph data structure to support multiple transform output types
Reviewed By: davidaurelio

Differential Revision: D7877461

fbshipit-source-id: 02a7bf2273768fed567aa931ecb8e65b3dd74502
2018-05-11 15:17:21 -07:00
Rafael Oleza f9a0767498 Namespace the transformer output types
Reviewed By: davidaurelio

Differential Revision: D7877463

fbshipit-source-id: 00c23ef6418621ec0829ddbb793e131ae30279c3
2018-05-11 15:17:21 -07:00
Rafael Oleza 94f531ad79 Move type calculation to the worker
Reviewed By: davidaurelio

Differential Revision: D7877465

fbshipit-source-id: b5b444e383363ae3b80f5fe099d99203435b8d69
2018-05-11 15:17:21 -07:00
Jean Lauliac 192e1080ab metro-buck: add script to auto-gen source maps and stacks
Reviewed By: davidaurelio

Differential Revision: D7952999

fbshipit-source-id: 267dec03b5b60786355d33856bba46a9e367b275
2018-05-11 04:18:53 -07:00
Peter van der Zee 99598062ef Swap out metro-babylon7 for babylon in metro
Reviewed By: mjesun

Differential Revision: D7948314

fbshipit-source-id: e9f16cae195a5aecba3c33bd3ae528935f792e2f
2018-05-10 08:06:34 -07:00
Peter van der Zee 95e2b064df Bump babylon on xplat/js to version 7 beta40
Reviewed By: mjesun

Differential Revision: D7948316

fbshipit-source-id: 6932db71d8abb8b739559a0f785962d2d5b39f50
2018-05-10 08:06:34 -07:00
David Aurelio 3984db5a88 Use `require.resolve` rather than `path.resolve(__dirname, ...)` to find files
Summary:
Here, we change the mechanism of finding files from `path.resolve(__dirname, ...)` to `require.resolve(...)`. The latter depends on the location of one file rather than two, and is usually more readable and intention revealing.

Originally landed as D7858479

Reviewed By: mjesun

Differential Revision: D7908400

fbshipit-source-id: f0ed6db9458ed89708d8b441e3a2a325c457d614
2018-05-09 09:09:55 -07:00
Jean Lauliac de68d129f7 metro-memory-fs: add some very basic 'mode' handling
Reviewed By: rafeca

Differential Revision: D7890886

fbshipit-source-id: 2c9cfac43b745614cdf149ed242a324fc45077b1
2018-05-08 13:01:01 -07:00
Jean Lauliac bfcf4e32d9 metro-memory-fs: implement watcher persistent option
Reviewed By: mjesun

Differential Revision: D7890835

fbshipit-source-id: b6a4e9aea1095dedd44e5ea341ad5fcf0ebd136e
2018-05-08 13:01:01 -07:00
David Aurelio 5f6ada9e8b Back out stack D7846453..D7858549
Differential Revision: D7888839

fbshipit-source-id: 872969ab2f92abae0a8bb5472779a46ffe85e2a7
2018-05-05 14:06:37 -07:00
Maël Nison 2af0396ffe Bumps Jest to 23.0.0-charlie.1 [fbsource]
Differential Revision: D7859604

fbshipit-source-id: 6a2d74679f5eae3cb0102f461272b7cbd5716cba
2018-05-03 14:42:56 -07:00
David Aurelio c157c9a1f3 Use `require.resolve` rather than `path.resolve(__dirname, ...)` to find files
Summary: Here, we change the mechanism of finding files from `path.resolve(__dirname, ...)` to `require.resolve(...)`. The latter depends on the location of one file rather than two, and is usually more readable and intention revealing.

Reviewed By: cpojer

Differential Revision: D7858479

fbshipit-source-id: 98373cc0860faa791e60d5f11502d762fd22a409
2018-05-03 06:21:01 -07:00
Peter van der Zee 81b49fa89b Move hmr config generator into its own file, burn the bridge
Reviewed By: mjesun

Differential Revision: D7788847

fbshipit-source-id: 481a457abe58b41f5e7001601c126adc457cd28c
2018-05-02 10:47:20 -07:00
Peter van der Zee 6ddbbfbae1 Stop pulling getPreset from babel-bridge
Reviewed By: mjesun

Differential Revision: D7788849

fbshipit-source-id: 8db2b69f7d82b9feb9d339dc40363ba25c49d0ee
2018-05-02 10:47:20 -07:00
Peter van der Zee cfbb4377f3 Stop pulling resolvePlugins from babel-bridge
Reviewed By: mjesun

Differential Revision: D7788851

fbshipit-source-id: 8b2a5f9927a434042b1c0a8f27e40acfe2600820
2018-05-02 10:47:20 -07:00
Peter van der Zee e4198ec268 Stop pulling inlineRequiresPlugin from babel-bridge
Reviewed By: mjesun

Differential Revision: D7788850

fbshipit-source-id: 1a401f626a2e32ffeb68c6126e040f29a8507697
2018-05-02 10:47:20 -07:00
Peter van der Zee 6b222c394f Stop pulling externalHelpersPlugin from babel-bridge
Reviewed By: mjesun

Differential Revision: D7788848

fbshipit-source-id: 0c8787f097c9526de49a95554c2e28782cc4a077
2018-05-02 10:47:19 -07:00
Peter van der Zee dfc30f0352 Refactor the babel config generator function to what it actually does
Reviewed By: rubennorte

Differential Revision: D7788527

fbshipit-source-id: 4daed4d75b44b9c55a676881982cdab0034a27cc
2018-05-02 10:47:19 -07:00
Peter van der Zee 7ab8d08f89 Add `optionalChaining` as a valid babylon plugin option to flow typing
Reviewed By: rafeca

Differential Revision: D7828243

fbshipit-source-id: 8b3cbaa8efb0f91263b3b09cbe012f8a5d8bfdbe
2018-05-02 07:39:15 -07:00
Peter van der Zee f64ed1369e Move the getBabelRegisterConfig function to the one file that uses it
Reviewed By: rubennorte

Differential Revision: D7788532

fbshipit-source-id: 1d08d159574247366492c036f5c530c982ec67b3
2018-04-30 04:20:28 -07:00
Mayank Patke 86e1a086aa v0.71.0 in xplat/js
Reviewed By: yungsters

Differential Revision: D7787035

fbshipit-source-id: 07defbbaa6fdc8f3016727fe6d6b1640efbf8ab6
2018-04-28 02:24:33 -07:00
Miguel Jimenez Esun 199a5503c5 Upgrade Jest to 23.0.0-beta.2
Reviewed By: davidaurelio

Differential Revision: D7789525

fbshipit-source-id: 0d0ebe30d66dbc5cd07c7517a513ac7be2c1e128
2018-04-27 20:33:49 -07:00
Peter van der Zee ec4bad47e0 Stop pulling babylon from babel-bridge
Reviewed By: rubennorte

Differential Revision: D7788535

fbshipit-source-id: 243824de7cecc32fbf47c57df6009178ca57f5fd
2018-04-27 09:30:15 -07:00
Peter van der Zee de30633c37 Stop pulling @babel/types stuff from babel-bridge
Reviewed By: rubennorte

Differential Revision: D7788528

fbshipit-source-id: 6df623741be7ec0f9cd6879456faa8c2147fcd29
2018-04-27 09:30:15 -07:00