Commit Graph

66 Commits

Author SHA1 Message Date
Rafael Oleza 04fa721ed5 Bump metro@0.40.0
Summary:
@public

This new version of metro replaces the `getProjectRoots()` config param by `getProjectRoot()` (which is used as the main folder for calculating relative paths of files, etc) and `getWatchFolders()` (which is used to know which files/folder to crawl when starting metro).

More info: 3bdf386d14

[skip-ci]

Reviewed By: yungsters, mmmulani

Differential Revision: D8538986

fbshipit-source-id: 2afc33950334a278364debb39f34ef0fe0535894
2018-06-20 11:02:40 -07:00
Peter van der Zee b8402852a2 Bump Metro dep in RN preset to 39.1, preset to 5.0.2
Reviewed By: rubennorte

Differential Revision: D8445528

fbshipit-source-id: e8937509bb1384a2d62e880c860306d8c86dab92
2018-06-15 07:22:09 -07:00
Rafael Oleza 30320f1fed Bump metro@0.38.1
Reviewed By: jeanlauliac

Differential Revision: D8248753

fbshipit-source-id: aa6d0da4e96e8b4109b6b5bca050614ec1860fc2
2018-06-04 03:13:04 -07:00
Peter van der Zee 7014a30baa Upgrade babel to beta.47 across xplat
Summary:
Upgrade Babel from beta.40 to beta.47

There are two important breaking changes here.

- If you want an AST from the Babel `transform` functions you must pass on `ast:true` in the options.
- The `sourceType` is now the only source of truth on whether to parse with the Script or Module goal. It defaults to `script` and can also be `module` or `unambiguous`. In the `unambiguous` case it will first try to parse with the Module goal and only if it crashes it will try again with the Script goal.

Beyond that there were some fixes and some smaller changes that may affect you. See the Babel changelogs for details (https://github.com/babel/babel/tags).

Also updated the way we generate the babel helpers file.

Reviewed By: rubennorte

Differential Revision: D8075280

fbshipit-source-id: 2bb902690e8a4b19d9cada2b7b0c94812b3d4f0f
2018-05-23 06:16:01 -07:00
Peter van der Zee 67ec8498f7 Bump rn babel preset to 5.0.1
Reviewed By: rafeca

Differential Revision: D8047460

fbshipit-source-id: b666266a5e9162383bc807d5bf2d7d3ffa7b19d6
2018-05-18 09:11:11 -07:00
Eli White 36fcbaa56d Prettier the rest of ReactNative
Reviewed By: yungsters

Differential Revision: D7974340

fbshipit-source-id: 5fe457a8a9be4bd360fc3af9acb5c1136b2be0d7
2018-05-11 13:52:30 -07:00
Eli White 86b6f5d39e Add Prettier to some files
Reviewed By: sahrens

Differential Revision: D7958196

fbshipit-source-id: 05a04380a4a1f3abd4cc3a9034fc70deaa4a444b
2018-05-10 16:16:35 -07:00
Peter van der Zee aa6f394c42 Enable `?.` plugins in RN
Summary: Enable the optional chaining operator plugins for React Native.

Reviewed By: rafeca

Differential Revision: D7828244

fbshipit-source-id: 659a8a82ff6d656a5cb2f33377d85b668b93a9ea
2018-05-02 07:41:50 -07:00
Rafael Oleza 57919a3edd Bump metro@0.34.0
Differential Revision: D7708906

fbshipit-source-id: 3d8cdfd2745baf73c92f90e0960f7cd73a289f77
2018-04-20 14:23:23 -07:00
Rafael Oleza cf1569c556 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:19:52 -07:00
Peter van der Zee 2e7dfd5213 Lock down Babel to 7-beta.40
Summary: This will lock down the plugins to babel version 7-beta.40

Reviewed By: davidaurelio

Differential Revision: D7707160

fbshipit-source-id: 6aec7f98348cac6ddd680c73ea4e36e0fb23e2a8
2018-04-20 05:22:49 -07:00
Peter van der Zee d408de0438 Drop confusing comment
Summary:
Just removing a comment

As per f8d6b97140 (r28569388)

While the comment was more to notify about this in general, I suppose it doesn't matter.

Reviewed By: rafeca

Differential Revision: D7685277

fbshipit-source-id: 2d526aeccc2e89b42ae25cbce21af5fe96f1348d
2018-04-19 09:16:48 -07:00
Peter van der Zee 34bd776af2 Bump babel-preset-react-native version to 5.0.0 for Babel 7
Reviewed By: rafeca

Differential Revision: D7685340

fbshipit-source-id: f229fb5da71f2f1d277d3d55eaa0f400aa76471b
2018-04-19 04:12:14 -07:00
Peter van der Zee 6de4ff36b0 Fix babel-preset-react-native, bump it to babel 7
Reviewed By: yungsters

Differential Revision: D7635490

fbshipit-source-id: 9f32f4389178904c68e0a03fee0485372ec10900
2018-04-17 05:16:15 -07:00
Peter van der Zee f8d6b97140 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 16:47:18 -07:00
Matt Mahoney c9a6b8560f 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:25:17 -07:00
Peter van der Zee ebd12fa09f 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:02:43 -07:00
Peter van der Zee b961ac3eff Depend on local version of babel-plugin-react-transform
Reviewed By: arcanis

Differential Revision: D7337432

fbshipit-source-id: 3729359da0ccfd3161546ab3ea9331ad30fb6e8d
2018-03-21 09:33:34 -07:00
Naor Matania ad6938cda1 Revert D7319513: Depend on local version of babel-plugin-react-transform
Differential Revision:
D7319513

Original commit changeset: 4945ec753087

fbshipit-source-id: 98de6a0fda19732c02ad780953497f9d9b451dea
2018-03-20 06:46:58 -07:00
Peter van der Zee fa7c322af4 Depend on local version of babel-plugin-react-transform
Reviewed By: jeanlauliac

Differential Revision: D7319513

fbshipit-source-id: 4945ec753087206cd01eca4ba9464672d5fb05ba
2018-03-20 04:55:39 -07:00
Peter van der Zee 6b1dc71740 Refactor resolvePlugins out to prepare for babel 7
Reviewed By: BYK

Differential Revision: D7287074

fbshipit-source-id: ec703f7292b63b679dbad055a6e43ac907729bfe
2018-03-15 07:23:13 -07:00
Héctor Ramos f2ad77f90a Update additional license headers
Reviewed By: sophiebits

Differential Revision: D7196607

fbshipit-source-id: 9e6452f583b2b5616f5bb38f26f2ae33c14bb820
2018-03-08 12:10:14 -08:00
Peter van der Zee 2dc559d1fb Add possibility to add custom plugin prefix
Summary: The problem with a fixed prefix is that babel 7 uses a scoped packages and every (standard) plugin is now part of that scope so the prefix is no longer `babel-plugin-` but instead `babel/plugin-`. There are more changes. This one will at least fix most of them.

Reviewed By: davidaurelio

Differential Revision: D7085102

fbshipit-source-id: b927998c611b71b3265e1cb3f6df537b14f9cb25
2018-02-27 13:16:59 -08:00
Sophie Alpert 26684cf3ad Update to MIT license
Summary: Manual changes.

Reviewed By: TheSavior, yungsters

Differential Revision: D7012152

fbshipit-source-id: de7459be3db13c687868b45059856f125c4f2eb1
2018-02-16 18:31:53 -08:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
David Aurelio df6c48cf36 `babel-preset-react-native`: only require plugins once
Reviewed By: cpojer

Differential Revision: D6795591

fbshipit-source-id: 30b689e2cf72a4bf4bdae49113369ef536ed81d6
2018-01-25 02:45:43 -08:00
Jean Lauliac 7f3090e453 react-native: move out the hardcoded import() transform
Reviewed By: davidaurelio

Differential Revision: D6196869

fbshipit-source-id: 237cd269a2f382851102e3e1ba3208f1460f8c0a
2017-11-01 05:34:40 -07:00
Dylan Vann 30b057fa9c Add babel-plugin-transform-exponentiation-operator to babel-preset-react-native
Summary:
Adds the dependency to the Babel preset's package.json and enables the plugin only when `**` exists in a source file.

This is https://github.com/facebook/react-native/pull/12339 with merge conflicts resolved and putting the plugin behind a cheaper heuristic.
Closes https://github.com/facebook/react-native/pull/16191

Differential Revision: D6023857

Pulled By: hramos

fbshipit-source-id: 16f4a5f14780c27d2ef95fa7e8d8b611fa992aa0
2017-10-18 16:46:49 -07:00
Rafael Oleza f568090ae2 Upgrade babel-plugin-react-transform to v3.x
Summary: babel-plugin-react-transform@3 includes support for HMR on `React.PureComponent`: https://github.com/gaearon/babel-plugin-react-transform/pull/106

Reviewed By: davidaurelio

Differential Revision: D5814322

fbshipit-source-id: 36e83ffa00f9d4ff079665aec1e8341725811a8e
2017-09-14 07:36:43 -07:00
Matt Oakes 2172bb4acb Revert "Add a new babel transformer for inlining regenerator-runtime per file"
Summary:
This reverts commit e7c1cf5b7d.

Fixes #14838.

Test using the steps in #14838.
Closes https://github.com/facebook/react-native/pull/15584

Reviewed By: jeanlauliac

Differential Revision: D5670640

Pulled By: mjesun

fbshipit-source-id: e7c4c4cfdd0d3142561847aefb35b8a8b33e5ffa
2017-08-23 08:06:11 -07:00
Jean Lauliac e0634531d8 react-native: release new babel-preset version
Summary:
The `3.0.0` contained syntax errors for older versions of Node.

See also https://github.com/facebook/react-native/issues/15496

Reviewed By: cpojer

Differential Revision: D5677965

fbshipit-source-id: cae07fdce7e887c6fb1d6087791db8307f6f72f3
2017-08-22 06:47:49 -07:00
Nicolas Charpentier f69638b56f Fix Unexpected token ) in babel-preset-react-native
Summary:
Fixes #15513

cc jeanlauliac
Closes https://github.com/facebook/react-native/pull/15517

Differential Revision: D5644626

Pulled By: TheSavior

fbshipit-source-id: f90b35c29a1e7cd5a829ae44237deb050f9a29e2
2017-08-16 16:42:16 -07:00
Jean Lauliac aaae99e7cd metro-bundler: transform import() to basic require()
Reviewed By: mjesun

Differential Revision: D5631078

fbshipit-source-id: a8d4955a723c1846b9406e734c3e3fa2c0df3fb7
2017-08-16 04:38:16 -07:00
Jean Lauliac ab9c788c2c RN babel preset: add import() syntax
Summary:
Allows us to parse the `import()` syntax. For now it's not transformed, so it would crash at runtime (or at minification with UglifyJS). However I want to release this under a new major version, so this wouldn't be allowed in OSS right away.

Also we bump to version 3.0.0 before release. D5443966 possibly introduced breaking changes, so it needs a major bump.

Reviewed By: cpojer

Differential Revision: D5630084

fbshipit-source-id: b271bbb8577ba7184e975f996ec415a915e869d9
2017-08-15 08:19:27 -07:00
Christoph Nakazawa 4caf79471b Improve transform speed by 8.5%
Reviewed By: jeanlauliac

Differential Revision: D5443966

fbshipit-source-id: 06a151f44b7b9f8307be2ea47ce35deb3663869f
2017-07-21 09:40:15 -07:00
Miguel Jimenez Esun 737abe3b76 Revert D5388655: BREAKING: Add regenerator-runtime on demand, based on the files
Differential Revision: D5388655

fbshipit-source-id: 2f92d6ae69f4772195aeca7493f53209388b3ad0
2017-07-19 12:08:38 -07:00
Miguel Jimenez Esun 3103258ca0 BREAKING: Add regenerator-runtime on demand, based on the files
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.

The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.

Reviewed By: davidaurelio

Differential Revision: D5388655

fbshipit-source-id: dc403f3d5e2d807529eb8569a85c45fec36a6a3e
2017-07-19 11:04:33 -07:00
Eli White aafccdf622 Revert D5409825: [RN] Convert easy files to Prettier
Differential Revision: D5409825

fbshipit-source-id: f797a40b58bc6bcc6ae53ed820a10ab49d3f10f5
2017-07-12 19:23:58 -07:00
Eli White c198911561 Convert easy files to Prettier
Reviewed By: zertosh

Differential Revision: D5409825

fbshipit-source-id: 81f67be174cc8ecfcd0955dfec83955ebdc84622
2017-07-12 16:08:22 -07:00
Christoph Nakazawa e0eee0bb49 Revert D5321193: BREAKING: Add regenerator-runtime on demand, based on the files
Differential Revision: D5321193

fbshipit-source-id: 9113ed78e59ae9e9f3f86ca2fda2db3bd8c0dd7c
2017-07-07 10:48:37 -07:00
Miguel Jimenez Esun 361f03badb BREAKING: Add regenerator-runtime on demand, based on the files
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.

The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.

Reviewed By: davidaurelio

Differential Revision: D5321193

fbshipit-source-id: fd4805b28c8a2b986842e23570a64003370d2067
2017-07-07 07:47:13 -07:00
Miguel Jimenez Esun e7c1cf5b7d Add a new babel transformer for inlining regenerator-runtime per file
Reviewed By: davidaurelio

Differential Revision: D5364134

fbshipit-source-id: 45aae705f961819d5a8e3a8a23c2e8b9300d3cb5
2017-07-03 10:04:22 -07:00
David Aurelio bc22a4da7e Make preset a function to account for different dev settings
Summary: Makes `babel-preset-react-native` a factory function that allows to include/exclude dev tool transforms per transform.

Reviewed By: jeanlauliac

Differential Revision: D5237158

fbshipit-source-id: aa7be0fc0f471575b4ee1c5a0e266e2ed2477fc6
2017-06-14 09:32:37 -07:00
David Aurelio 5c57601769 Remove `retainLines` and `sourceMaps` options
Summary:
`retainLines` is no longer necessary with the much improved source map generation.
`sourceMaps` is handled by the transformer itself.

Reviewed By: cpojer

Differential Revision: D5237103

fbshipit-source-id: e5c6bf5aa9d553fce9c3f4d59b3ea0057d45cfdc
2017-06-14 09:32:37 -07:00
Dan Abramov 7210a060e6 Enable JSX source plugin in DEV and integrate it with React DevTools
Summary:
The `env` option has been broken in Babel for a while (https://github.com/babel/babel/issues/4539), and will be deprecated (https://github.com/babel/babel/issues/5276).

I am changing this code to the way Babel < 6.10 interpreted the `env` option. This should fix the `__source` JSX transform which was applied in DEV in the past, but stopped getting applied because of the Babel bug.

I also changed the `filename` passed by Babel to be relative (currently, to `fbsource` but open to other options). This way DEV builds are still reproducible.

This still needs some help from davidaurelio to make the root location more foolproof. I'd also appreciate zertosh taking a look in case there's a better way to "anchor" the relative path. All I need is to for `react-third-party/react-devtools/react-devtools` and `babelTransformer.js` to agree on what the relative path base is.

Closes https://github.com/facebook/react-native/pull/13893

Reviewed By: gaearon

Differential Revision: D5035892

Pulled By: davidaurelio

fbshipit-source-id: 19ffeb867d7ed5928e9de05dcec9ba85bf961dd5
2017-05-12 08:50:11 -07:00
Nicholas Young 2121527cb8 Update babel-preset, filter path by identifiers.
Summary:
This PR contains [the fix](https://github.com/facebook/react-native/issues/6063#issuecomment-189416771) from #6063, which resolves the issue with rxjs 5. Is there a reason to not include these proposed changes in the repo?
Closes https://github.com/facebook/react-native/pull/10815

Differential Revision: D4226835

fbshipit-source-id: bfaeaebbe308c45bce814469ef0f75283f050d18
2016-11-23 09:28:27 -08:00
Robert Rose 98dd91825f Fixing Issue #7526
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

Fixing a bug detailed in Issue #7526 where Android app was crashing when using a binary number.

**Test plan:**
- Build & Run UIExplorer
- Build & Run UIExplorer with `const binaryNumber = 0b101010` inserted into UIExplorerApp.android.js
- Use `react-native init` to create a new blank project, then replace files in node_modules and insert `const binaryNumber = 0b101010` into index.android.js.
Closes https://github.com/facebook/react-native/pull/7730

Reviewed By: avaly

Differential Revision: D3353119

Pulled By: bestander

fbshipit-source-id: 098442da32a29c369f5932b7a4004e8d7f4cb91f
2016-05-26 13:43:29 -07:00
Alex Kotliarskyi 858643dbdf Add transform-react-jsx-source to react-native preset
Summary:
Putting this up as request for comments.

The PR adds [transform-react-jsx-source](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source) to the list of plugins that come by default with the `react-native` preset. It will enable the use of a bunch of really cool tooling around JSX, however those are generally useful only in development mode. Is changing `react-native` preset the right thing to do in this case? Is there a way to enable this transform only in DEV? Should I add this somewhere else?
Closes https://github.com/facebook/react-native/pull/6351

Differential Revision: D3302906

Pulled By: frantic

fbshipit-source-id: 012d3a4142168f9f90d30d1686115d4dc3996eb9
2016-05-18 12:43:24 -07:00
Kelvin Sherlock 46ba1532fd babel-preset - transform-es2015-constants was replaced by check-es2015-constants.
Summary:
The babel plugin transform-es2015-constants was replaced by check-es2015-constants.

References:

T2970
rBW0a3b3b03dbcfc8d1e809a0eaf6270eec8de80763
T3053

This patch updates the babel preset to use check-es2015-constants which should be more future-proof and will receive bug fixes.
Closes https://github.com/facebook/react-native/pull/6943

Reviewed By: davidaurelio

Differential Revision: D3189222

Pulled By: bestander

fb-gh-sync-id: a5ec23e297e1d3591d51641dd567049f4310b107
fbshipit-source-id: a5ec23e297e1d3591d51641dd567049f4310b107
2016-05-03 06:43:27 -07:00
Konstantin Raev a2ee5bd307 Fixed HMR for React Native Android
Summary:Needs to be published to npm and version be updated in RN
Closes https://github.com/facebook/react-native/pull/7208

Differential Revision: D3218870

Pulled By: davidaurelio

fb-gh-sync-id: 1caac6eb79be16f2e3ed230f413835341c7291dc
fbshipit-source-id: 1caac6eb79be16f2e3ed230f413835341c7291dc
2016-04-25 06:31:25 -07:00