Граф коммитов

66 Коммитов

Автор SHA1 Сообщение Дата
Rob Hogan 3c9d915330 Internal Jest setup - improve workaround for Babel registration (#36838)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36838

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D44715939

fbshipit-source-id: fe3cbd934a39666e5590962941b1927b0f8e2610
2023-04-11 10:08:53 -07:00
Alex Hunt c5a47abaf8 Bump RN CLI, add @react-native/metro-config to template (#36623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36623

Changelog:
[General][Changed] - The default `metro.config.js` in apps now extends `react-native/metro-config`, and should be updated in existing apps.

~~`react-native/rn-get-polyfills.js` is removed and should be updated to `react-native/js-polyfills` in existing apps (this is part of the new default config).~~

#publish-packages-to-npm

## Context

### React Native Metro config → React Native repo (https://github.com/facebook/react-native/pull/36502)

We (the React Native team) are aiming to relocate the default Metro config for React Native out of `react-native-community/cli-plugin-metro` and **into the React Native repo + app template** as a new `react-native/metro-config` package.

This is the first (and minimum viable) phase we can ship to separate the release process of Metro from RN CLI in order to reduce coupling and iterate faster for our users.

**See full motivation, design, and test plan (which previewed the CLI bump) here: https://github.com/facebook/react-native/pull/36502**

## Changes

NOTE: This PR is pending the inclusion of a bump to `react-native-community/cli`, and will be sequenced after https://github.com/react-native-community/cli/pull/1875 is merged.

- Upgrade `react-native-community/cli` to `11.0.0`, upgrade all `metro` packages to `0.76.0` (version distributed in this CLI release).
- Update the `metro.config.js` file in `packages/react-native/template/`.
    - Now merges defaults from `react-native/metro-config`, and can be used with CLI >= 11.0.0.
- Update the `metro.config.js` files for `packages/react-native/` and `packages/rn-tester/` (these are integration test locations).
    - Now merges defaults from `react-native/metro-config`, and can be used with CLI >= 11.0.0.

Changes to `react-native/metro-config` — `0.72.1` (prepared but not depended on yet):

- Export `mergeConfig` util (removing direct `metro-config` dependency in consuming projects).
- Explicitly depend on `metro-react-native-babel-transformer` and `metro-runtime` (transitively included today).

Reviewed By: cortinico, blakef

Differential Revision: D44099691

fbshipit-source-id: 405635dd69fd50a1e9548279eaeda3c932b5b167
2023-03-30 07:30:54 -07:00
Rob Hogan a0fa3c736e Move Jest preprocessor up to workspace root, remove public metro-react-native-babel-transformer dep (#36523)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36523

`jest/private/preprocessor.js` is only used to run tests on the workspace itself, it's not part of our exported Jest preset and is specifically excluded from publication in the `react-native` package.

Now that we have the monorepo setup, this belongs at the workspace root.

 - `metro-react-native-babel-transformer` moved from RN `dependencies` to root `devDependencies` because it's only used by the preprocessor
 - `jest/create-cache-key-function` added to `devDependencies` - it's also used by the `assetTransformer` in the public preset.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D44197879

fbshipit-source-id: 0bbd9e2f500f53fa4f16562f05374dc601b67df6
2023-03-20 05:44:34 -07:00
Moti Zilberman 0301cb285b Stop publishing jest/preprocessor.js to npm
Summary:
Changelog:
[Breaking][General] Remove jest/preprocessor from the react-native package

Using `react-native/jest/preprocessor` outside of the React Native repo has been deprecated since D34820086 (c1e9aa9a27). Here, we make this file private and stop publishing it to npm.

The supported method of using Jest in React Native projects is using the [Jest preset](https://jestjs.io/docs/tutorial-react-native) shipped as part of the `react-native` package.

NOTE: We could probably make some of the other files under `jest/` private as well, but we should go through a separate deprecation cycle with those, in case they are also being used externally by some projects. I'm leaving that for future followup at the moment.

Reviewed By: GijsWeterings

Differential Revision: D36132939

fbshipit-source-id: 300ffa6cf16232573cd3a79a34c14daaafd7aa43
2022-05-06 04:43:09 -07:00
Moti Zilberman c1e9aa9a27 Deprecate jest/preprocessor.js
Summary:
Changelog:
[General][Deprecated] Deprecate the use of `react-native/jest/preprocessor.js` by external projects

The supported method of using Jest in React Native projects is using the [Jest preset](https://jestjs.io/docs/tutorial-react-native) shipped as part of the `react-native` package. Some projects are directly using `preprocessor.js` which is part of the testing setup for the React Native repo itself.

In a future release of React Native, we will stop publishing this file to npm and require projects to switch to the supported preset (or a custom Jest config if necessary).

Reviewed By: GijsWeterings

Differential Revision: D34820086

fbshipit-source-id: 197c33726639e66c6916a244117252e6af11f2f6
2022-03-14 07:40:05 -07:00
Rob Hogan 89c3aac6e1 Remove `@babel/plugin-transform-object-assign` from preprocessor
Summary:
React Native has an *implicit* dev dependency on this transform via `metro-react-native-babel-transformer`. The transform replaces `Object.assign` with `babelHelpers.extend`, but `Object.assign` has been available natively since node 4.

We intend remove it from metro (https://github.com/facebook/metro/pull/745) as it's no longer needed by any supported runtime - removing RN's small dependency in advance so RN's tests won't break when we do.

Changelog:
[Internal][Changed] - Remove `babel/plugin-transform-object-assign` from jest preprocessor

Reviewed By: motiz88

Differential Revision: D34110208

fbshipit-source-id: 064f8241461fb338de1cd8b53077e8660301aa77
2022-02-11 06:11:05 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Rubén Norte 74b91c5073 Revert changes in RN preprocessor
Summary: Changelog: [General][Fixed] Revert changes in Jest preprocessor to fix tests in external projects

Reviewed By: yungsters

Differential Revision: D32250044

fbshipit-source-id: 0ed4c9f7bcfa82349b5c2ec7af2ccda970bbb0ef
2021-11-09 01:15:14 -08:00
Tim Yung 77ecc7ede1 JS: Format with Prettier v2.4.1 [3/n]
Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
2021-11-02 22:14:16 -07:00
Rubén Norte 249b8d21c4 Fix inline requires for ESM in react-native-github
Summary:
This fixes how ES modules are handled in Jest tests in the react-native codebase.

They caused some problems before because `import` statements weren't inlined as `require` calls were, so there were some errors in tests when migrating from CommonJS to ESM.

This changes the transform that Jest uses to inline import statements the same way, so we can migrate everything without issues in tests.

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D28899692

fbshipit-source-id: 027690f57ca3b5613c261a1089c0635af76662b2
2021-06-04 13:05:11 -07:00
Panagiotis Vekris d9c84f078d misc Flow library fixes & suppressions
Summary:
The current version of Flow fails to report some errors in library definitions. I'm
working on a Flow fix that would surface these errors. In preparation for this, this diff:

* replaces `FbtErrorListener` (missing) with `IFbtErrorListener` in fbt.js
* fixes typos in several files
* suppresses missing names with `[cannot-resolve-name]`
* adds `sourceMapTarget` option in babel-generator

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D25839533

fbshipit-source-id: 947207db9238aa10663616d59080440d2ac6f243
2021-01-19 11:55:09 -08:00
Christoph Nakazawa fd9787ecc0 Remove `fbjs-scripts` in favor of `@jest/create-cache-key-function`
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D24129817

fbshipit-source-id: fe1c4a8abdb1cc73b031120b1f8f9722d04ba620
2020-10-06 18:22:58 -07:00
Moti Zilberman c9f869f9c7 Use globalPrefix for babelHelpers
Summary:
Passes the `globalPrefix` option from the Metro config object into `metro-babel-transformer`. This currently has no effect in OSS.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D22594663

fbshipit-source-id: 668b71cd6bec988313e9286b316f9006d61ad871
2020-07-23 12:03:36 -07:00
Daniel Sainati 1beef1e18d deploy 120 to xplat
Summary:
Changelog: [Internal]

bypass-lint
allow-large-files

Reviewed By: mroch

Differential Revision: D20290164

fbshipit-source-id: 6f8633b1a8685b0551757fc4841b82eab77525c5
2020-03-06 11:09:08 -08:00
Jordan Brown 688900342b exact-by-default in xplat/js
Summary:
Turns on the exact-by-default flag in xplat/js and gets rid of the implicit inexact object lint, which has no effect when exact-by-default is on.

Will land this on Monday along with an announcement post.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18863276

fbshipit-source-id: 07a31e957bea1d1e053e8fa5975fdb1b6da1bdc4
2019-12-09 11:03:21 -08:00
Logan Daniels 91f139b941 xplat/js/react-native-github
Reviewed By: panagosg7

Differential Revision: D16657770

fbshipit-source-id: 4e260842c838a35317515044c54ccf55a083da33
2019-08-09 10:11:15 -07:00
George Zahariev 35d2dfcabf Deploy 0.94 to xplat
Summary:
Update Flow version in xplat (https://our.intern.facebook.com/intern/wiki/Flow/Flow_Release_Process/#update-xplat-js)

allow-large-files
bypass-lint

Reviewed By: nmote

Differential Revision: D14317820

fbshipit-source-id: 07ec22c0745321db036f4e10a502009a4b640652
2019-03-06 14:57:30 -08:00
Mike Grabowski 1af390be19 Update references to the CLI (#23052)
Summary:
This updates React Native to use latest CLI. We also create Metro configuration, because CLI looks for React Native in "node_modules" by default. Since we are running React Native from source, it will fail to find required files.

To avoid hacky logic to detect if we are running from source backed into the CLI, I decided to leverage the Metro configuration instead.
Pull Request resolved: https://github.com/facebook/react-native/pull/23052

Reviewed By: rickhanlonii

Differential Revision: D13719938

Pulled By: cpojer

fbshipit-source-id: 1f40a40b3cdbb07ccd42daf75feb457556d3e40f
2019-01-21 09:13:08 -08:00
Rafael Oleza f5cb4b68eb Remove metro dependency from react native
Summary:
This diff removes the dependency of `metro` on `react-native` by using the newly created `metro-react-native-babel-transformer` package.

This package does not depend on any other internal metro logic and this will decouple RN from metro a bit more.

Reviewed By: cpojer

Differential Revision: D13434949

fbshipit-source-id: a02a3b327c71cef53111514b797f7d6bc9f9d71c
2018-12-14 08:15:09 -08:00
Christoph Nakazawa 63a6bb7637 Remove remaining references to local-cli
Summary: This removes the remaining references to `local-cli`. We already have a `cli.js` file on the root that was just forwarding to the local-cli folder, so I removed that. It also seems that `setupBabel.js` is no longer necessary in RN.

Reviewed By: TheSavior

Differential Revision: D13396218

fbshipit-source-id: a945cb91dae39c4b58c5cabcca6b0f0328fc4717
2018-12-10 19:08:10 -08:00
Panagiotis Vekris ef2084c6bd 0.87.0 in xplat/js
Summary: allow-large-files

Reviewed By: samwgoldman

Differential Revision: D13230018

fbshipit-source-id: f07e2371a3b7382de0592cc7c7b20e7f4faa6889
2018-11-28 17:32:50 -08:00
Gary Borton 0b314960aa Adds support for `publicPath` to enable serving assets from different locations. (#299)
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**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

This is an updated followup from https://github.com/facebook/metro/pull/280, which we would still need to address the following assumptions about `/assets/`:

e7deea1900/packages/metro/src/Server.js (L332)

e7deea1900/packages/metro/src/Server.js (L379)

e7deea1900/packages/metro/src/Server.js (L385)

As pointed out by gdborton, there isn't currently a way to make this a configurable option. I am not certain how to find a proper workaround for `processRequest`.

We found a temporary solution to have our express app pick up serving the assets from a publicPath as a middleware. But the change in this PR is still necessary to get it working fully.

**Test plan**

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

- Will add tests once we figure out a comprehensive solution
Pull Request resolved: https://github.com/facebook/metro/pull/299

Reviewed By: rafeca

Differential Revision: D12939229

Pulled By: mjesun

fbshipit-source-id: 769c23468c5ac434f8319e5e7caaf46dd6453f2d
2018-11-09 05:51:06 -08:00
Rafael Oleza 89a358f347 Expose enableBabelRuntime config param externally
Summary:
Up until now the `enableBabelRuntime` option in the `metro-react-native-preset` package was hardcoded in the transformer: our internal transformer set it to `false` and the opensource one was `true`.

This diff now exposes this param out to the config of Metro (now that it's quite easy to expose things) so anybody can set it to false or true.

This allows our end to end tests to set it to false to not have to deal with requires to `babel/runtime`.

Reviewed By: davidaurelio

Differential Revision: D10123776

fbshipit-source-id: 97e744eeb567c8e86ab3c613ac71970d226ed2ca
2018-10-05 11:33:38 -07:00
Rafael Oleza 28dedfb6d6 Cleanup the transformer flow types
Summary:
Since the options that are passed to the `babelTransformer` are not exactly the same ones as the `transformer` receives, we need to have a specific object for them.

This allows us to make the transformer options object strict (since unfortunately the `babeltransformer` options object comes from many places and needs a bit of work to be able to be strict...

Reviewed By: mjesun

Differential Revision: D9309173

fbshipit-source-id: 0a92381968f17e5eb6c4740c1ca89580fa7ee4d3
2018-09-24 10:22:23 -07:00
Rafael Oleza 2e0d5c87e9 Remove absolute path parameter from transformers
Summary:
Up until now, transformers in Metro received the absolute path of a file, the relative path of a file and the projectRoot.

This diff gets rid of the absolute path sent to the worker, since by having the projectRoot and the relative path, the absolute path can be easily calculated.

This has been done to avoid having absolute paths as transform options, since we need to have custom logic to filter them out from the cache key generation, which is dangerous.

Reviewed By: mjesun

Differential Revision: D9195147

fbshipit-source-id: e95c5c29272eec7f1a48af7cede4c6d6b4a8ffb7
2018-09-24 10:22:23 -07:00
Janic Duplessis 36033bd0ed Use babel runtime instead of relying on global babelHelpers and regenerator (#198)
Summary:
**Summary**

The RN transformer currently relies on the enviroment providing babelHelpers and regeneratorRuntime as globals by using 'babel-external-helpers'. This wasn't really a problem before since helpers were stable and we could maintain our copy easily but it seems like there are more now with babel 7 and it makes sense to include only those used by the app.

This is exactly what babel/transform-runtime does. It will alias all helpers and calls to regeneratorRuntime to files in the babel/runtime package.

This will solve issues like this https://github.com/facebook/react-native/issues/20150 caused by missing babelHelpers. This solution also avoids bloating babelHelpers to fix OSS issues like the one linked before.

**Test plan**

- Updated tests so they all pass.
- Tested that it actually works by applying the changes locally in an RN app.
- Added a test for async functions, to make sure regenerator is aliased properly and doesn't depend on the global.
- Made sure require-test.js still fails if the require implementation contains babel helpers (by adding an empty class in the file).
Pull Request resolved: https://github.com/facebook/metro/pull/198

Reviewed By: mjesun

Differential Revision: D8833903

Pulled By: rafeca

fbshipit-source-id: 7081f769f288ab358ba89ae8ee72a513bb12e225
2018-09-21 16:17:40 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Rafael Oleza dd0900a03a Standarize options passed to the transformer
Summary:
This is the first step to make transformers fully customizable (and not be tied to JS, or RN). In order to do that, I'm changing the signature of the transformers, which currently is:

```
function transformCode(
  filename: string,
  localPath: LocalPath,
  transformerPath: string,
  options: WorkerOptions,
  assetExts: $ReadOnlyArray<string>,
  assetRegistryPath: string,
  minifierPath: string,
  asyncRequireModulePath: string,
  dynamicDepsInPackages: DynamicRequiresBehavior,
)
```

to be:

```
async function transformCode(
  filename: string,
  localPath: LocalPath,
  options: WorkerOptions,
)
```

(so basically, all the RN-custom properties are moved to `WorkerOptions`, which in the future will be a generic to allow anybody pass any random option to their transformers).

In order to make all this work, I've had to get rid of the logic that calculates the base cache key hash based on a subset of worker options (the ones that Metro knows that are not going to change between runs).

This could potentially cause a perf regression (since we're now making the hash calculation a bit more costly), and in fact I could measure a ~400ms regression on the worse case scenario (which happens when restarting Metro and re-transforming a Wilde from a warm local cache).

I've benchmarked this regression and could find that it's caused by the array of `assetExtensions` (which is potentially large). I have a followup diff to improve this, which is able to remove the regression completely.

Reviewed By: pvdz

Differential Revision: D8695766

fbshipit-source-id: eccd18a4cbc91854f34d5c9ba7f95088f19483a1
2018-08-23 15:48:03 -07:00
Kohei TAKATA 88be0cefac Fix eslint errors and warnings in preprocessor.js
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/20632

Differential Revision: D9367291

Pulled By: hramos

fbshipit-source-id: bdb823db132dcbb07ad02389a3246e5314de2b17
2018-08-22 13:48:53 -07:00
Héctor Ramos 1081560d86 Add missing trailing comma
Summary: Adds missing comma, following up on https://github.com/facebook/react-native/pull/20178. Thanks to LinusU for pointing out the error.

Reviewed By: TheSavior

Differential Revision: D9242887

fbshipit-source-id: 4b547396722d0e37dc5c8eb3439b9a441c3c0ac2
2018-08-13 12:01:57 -07:00
Umair Ansari 9d5bd50737 - Invalid use of destructuring
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/20178

Differential Revision: D8860733

Pulled By: TheSavior

fbshipit-source-id: ec4aa3050755652106dec9ea245394314c862e97
2018-07-16 11:07:23 -07:00
Rafael Oleza b90cbd195a Rename default RN transformer
Differential Revision: D8235001

fbshipit-source-id: 59a4b2f13185dd9be0d33f01589d907d49493a26
2018-06-01 07:16:42 -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
Rafael Oleza b762f5293e Decouple the Worker options from the Babel Transformer options
Reviewed By: jeanlauliac

Differential Revision: D7894079

fbshipit-source-id: 40cbd991690f25f8c0f045c42a0105d74d516803
2018-05-11 15:18:53 -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
David Aurelio 2690ba5e59 Move worker protocol and babelRegisterOnly into their own packages
Summary: Moves the implementation of Buck’s worker protocol into its own package and babelRegisterOnly for better reusability.

Reviewed By: rafeca

Differential Revision: D7666896

fbshipit-source-id: ae297494ced3b8dd1f9d90983a640643d6ce7896
2018-04-23 04:00:00 -07:00
Peter van der Zee 3aa453d975 Add sourceType as a new mandatory option
Summary:
The `sourceType` option is a new mandatory option for Babel which determines whether to parse the file with the module or script goal. The value "disambiguous" determines this state by parsing.

See https://github.com/babel/babel/pull/7417

Reviewed By: mjesun

Differential Revision: D7685610

fbshipit-source-id: 3958c5ad396592bb1d790e2df4ce315737421a2f
2018-04-19 10:11:25 -07:00
Peter van der Zee da57ae740d Add `ast: true` to transform options for jest
Summary:
This should (at least partially) fix testing for OSS as per f8d6b97140 (r28647044)

Might be related to not locking down the Babel version, will do that in a different commit.

Reviewed By: mjesun

Differential Revision: D7685279

fbshipit-source-id: f00febfad2cec31b7e11996ee8efa2c96b44477b
2018-04-19 09:16:48 -07:00
Peter van der Zee c18684a293 Fix the metro paths for files detected as nodejs
Summary: Fix the path lookup for files to be considered to run in nodejs.

Reviewed By: mjesun

Differential Revision: D7685278

fbshipit-source-id: c921d40b60d795820448842aec464e7ff82b6eab
2018-04-19 09:16:48 -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 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
Jean Lauliac 4454fdc219 fix Flow typing for OSS
Summary:
Add ignores for these requires, some of them mistakenly removed by da3424c929.

```
yarn flow
```

CircleCI should be green again.
Closes https://github.com/facebook/react-native/pull/18021

Differential Revision: D7025304

Pulled By: jeanlauliac

fbshipit-source-id: 731232093ae3ab39b3eff6fb2004ff4e7090d5ae
2018-02-19 10:41:33 -08:00
Caleb Meredith da3424c929 @allow-large-files Upgrade xplat/js to Flow v0.66
Reviewed By: gabelevi

Differential Revision: D7016717

fbshipit-source-id: 2bd2fd67074ba5d405ecd63a1aeb37354f8634c9
2018-02-16 20:24:57 -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
James Ide af6450c660 Add back support for the assetPlugin option
Summary:
**Summary**
Metro used to have support for "asset plugins", which allowed developers to specify arbitrary JS modules that could export a function for adding more fields to asset data objects. Some of this functionality was removed in the delta bundler work -- this PR adds it back.

**Test plan**
Made existing unit tests pass and added unit tests to test asset plugin behavior. Also tested E2E in a React Native project by adding `assetPlugin=/path/to/pluginModule` to a JS bundle URL and ensuring that the plugin ran.
Closes https://github.com/facebook/metro/pull/118

Differential Revision: D6711094

Pulled By: rafeca

fbshipit-source-id: f42c54cfd11bac5103194f85083084eef25fa3cd
2018-01-12 05:52:16 -08:00
Christoph Nakazawa 654fed46f4 Rename metro-bundler to metro
Reviewed By: davidaurelio

Differential Revision: D6413420

fbshipit-source-id: f13184b8157de2c3aeaa7f2647becc175f62cdbb
2017-11-29 03:35:29 -08:00
Rafael Oleza d5b59517c2 Simplify transform options + pass minify to the transformer
Reviewed By: mjesun

Differential Revision: D6406614

fbshipit-source-id: 722e8e209c7b7c922139f0777b9b3bd2a77bf735
2017-11-24 13:07:24 -08:00
Rafael Oleza 2ae255a6ea Update jest preprocessors to use the ast from the transformers
Reviewed By: jeanlauliac

Differential Revision: D6390677

fbshipit-source-id: e023fc32188c2d601b35d7a2e3f0f6f8af067962
2017-11-22 13:41:57 -08:00