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

35 Коммитов

Автор SHA1 Сообщение Дата
Alex Hunt 196b3f9ef9 Improve start command interactive behaviour (#39544)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39544

Misc improvements to `npx react-native start` interactive behaviour:

- Attaches key handlers on Metro `initialize_done` event — printing key command info earlier (once the server starts listening to bundle requests).
- Shutdown behaviour:
    - Awaits closing of Metro's HTTP server.
    - Pauses key listener while awaiting shutdown (dependency on `cli-tools` `addInteractionListener` dropped).
    - Now observes `ctrl+d` (`ctrl+z` pause behaviour removed).
- Updates reload handler message to 'Reloading connected app(s)...' (since ).
- Adds newline below key commands printout (even spacing).

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D49422206

fbshipit-source-id: 8963b22ddb182df7a1116906fc63cc65bfe982fc
2023-09-20 03:47:13 -07:00
Moti Zilberman 3ec22c1e69 Add option to enable experimental debugger frontend (#39227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39227

Changelog: [Internal]

1. Adds an `unstable_experiments` option to `createDevMiddleware` in `react-native/dev-middleware`.
2. Adds `enableCustomDebuggerFrontend` (default `false` for now) as an experiment flag controlling whether the new debugger frontend (D48680624, D48682302) is in use. We plan to enable this by default in RN 0.73 after additional testing.

If enabled, the new debugger frontend will only be used for the `/open-debugger` flow

Reviewed By: huntie

Differential Revision: D48602725

fbshipit-source-id: 598865b559478df1f19420daf3633ee6c233362a
2023-09-04 12:21:47 -07:00
Alex Hunt 4cb9706331 Add Microsoft Edge support for opening debugger (#39146)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39146

Adds Microsoft Edge fallback for the `/open-debugger` endpoint when no Chrome installation is found.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48563386

fbshipit-source-id: 74baba7c03a062bd769b2f9ac0cc35bac0b2ae65
2023-08-24 10:57:39 -07:00
Alex Hunt 13eda31d43 Simplify occupied port handling in start command (#39078)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39078

Simplifies and hardens behaviour for detecting other processes / dev server instances when running `react-native start`.

- New flow:
    - Exits with error message if port is taken by another process (*no longer suggests next port*).
    - Exits with info message if port is taken by another instance of this dev server (**unchanged**).
    - Continues if result unknown.
    - *(No longer logs dedicated message for another RN server running in a different project root.)*
- This now checks if the TCP port is in use before attempting an HTTP fetch.

Previous behaviour: [`handlePortUnavailable`](7342221187/packages/cli-tools/src/handlePortUnavailable.ts (L8)). This decouples us from some lower-level `react-native-community/cli-tools` utils, which remain reused by the `android` and `ios` commands.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48433285

fbshipit-source-id: 7056001d5fe2f90faf52143f2777c9e2bdf0646e
2023-08-22 12:56:19 -07:00
Moti Zilberman d10a8098b2 Log debugger command latency and status (#39107)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39107

Augments D48466760 to report debugger commands (request/response pairs) through `EventReporter`. With the appropriate backend integration, this can help validate the correctness/completeness of the CDP implementation (in the client, proxy and server) and measure the latency of debugger commands - more accurately, the time between the proxy receiving a command from the client and receiving the corresponding response from the server.

Most of the new logic here is in the `DeviceEventReporter` class, which is responsible for associating responses with requests. Requests are kept in a buffer with a 10s TTL which serves as a timeout in case of an unresponsive server.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D48480372

fbshipit-source-id: 55360a14bbea05ef8ad1622e0d54f18b47483809
2023-08-22 11:11:50 -07:00
Alex Hunt c82cf64a22 Move metro-inspector-proxy into dev-middleware (#39045)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39045

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

- Relocates `metro-inspector-proxy` source from the Metro repo into the React Native repo as part of the `react-native/dev-middleware` package.
    - Drops the `runInspectorProxy` entry point.
- Attaches the Inspector Proxy to the `createDevMiddleware()` API as the new integration point for this functionality.
- Documents migrated endpoints + usage of `createDevMiddleware()` in README.

Changelog: [Internal]
Metro changelog: None (`metro-inspector-proxy` is now an internal component of `react-native`, covered in the [release notes for 0.78.1](https://github.com/facebook/metro/releases/tag/v0.78.1))

Reviewed By: motiz88, blakef

Differential Revision: D48066213

fbshipit-source-id: 3fbef5d881f6f451cb5955dcbbc362c53347437e
2023-08-18 01:38:10 -07:00
Alex Hunt 39a41fa2a0 Convert community-cli-plugin to Flow strict (#38961)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38961

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48066180

fbshipit-source-id: 72b8b25a70062a71ab13aa1d62f3418582e99013
2023-08-15 02:33:22 -07:00
Alex Hunt 164133cada Sync latest cli-plugin-metro changes (#38944)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38944

- Update `cli-commands` package to reflect latest source `react-native-community/cli-plugin-metro` changes.
	- https://github.com/react-native-community/cli/pull/2021
	- https://github.com/react-native-community/cli/pull/2024
	- https://github.com/react-native-community/cli/pull/2043
	- https://github.com/react-native-community/cli/pull/2047

### To do

WARNING: ~~This PR is non-functional until the next CLI alpha is published and bumped in `package.json` — since it depends on corresponding new APIs in `react-native-community/cli-tools` (https://github.com/react-native-community/cli/pull/2021). This package (and the upcoming work which integrates it) has been tested against locally linked copies of latest CLI.~~

- [x] Bump CLI dependencies when next alpha published.
- [x] Ensure Metro bump from `0.77.0` to `0.78.0` is consistently applied with this.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48066179

fbshipit-source-id: b3dc8891cf33e537788f942dcaddff4d2f11a31f
2023-08-15 02:33:22 -07:00
Alex Hunt a978d343a6 Add auto-generation of TypeScript definitions on build (#38990)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38990

This PR adds auto-generation of Typescript definitions from Flow source code for packages using the shared monorepo build setup (https://github.com/facebook/react-native/pull/38718).

Today, these are the following Node.js packages:

- `packages/community-cli-plugin`
- `packages/dev-middleware` (⬅️ `emitTypeScriptDefs` enabled)

This also improves emitted Flow definitions (`.js.flow`), by using [`flow-api-translator`](https://www.npmjs.com/package/flow-api-translator) to strip implementations.

**All changes**

- Include `flow-api-translator` and configure this to emit type definitions as part of `yarn build`.
    - Add translation from Flow source to TypeScript definitions (`.d.ts`) adjacent to each built file.
    - Improve emitted Flow definitions (`.js.flow`), by using `flow-api-translator` to strip implementations (previously, source files were copied). The Flow and TS defs now mirror each other.
-  Add `emitFlowDefs` and `emitTypeScriptDefs` options to build config to configure the above.
- Integrate TypeScript compiler to perform program validation on emitted `.d.ts` files.
     - This is based on this guide: https://github.com/microsoft/TypeScript-wiki/blob/main/Using-the-Compiler-API.md#a-minimal-compiler.
- Throw an exception on the `rewritePackageExports` step if a package does not define an `"exports"` field.
- Add minimal `flow-typed` definitions for `typescript` 😄.

**Notes on [`flow-api-translator`](https://www.npmjs.com/package/flow-api-translator)**

This project is experimental but is in a more mature state than when we evaluated it earlier in 2023.
- It's now possible to run this tool on our new Node.js packages, since they are exclusively authored using `import`/`export` syntax (a requirement of the tool).
- As a safety net, we run the TypeScript compiler against the generated program, which will fail the build.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D48312463

fbshipit-source-id: 817edb35f911f52fa987946f2d8fc1a319078c9d
2023-08-14 12:12:10 -07:00
Alex Hunt e1998806b7 Migrate cli-plugin-metro into repo (#38795)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38795

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

Inits new package `react-native/community-cli-plugin`. This migrates [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro) into the React Native repo, to enable faster iteration by the React Native core team. Specifically:

- This package contains several `metro` dependencies, which when removed from CLI will no longer require us to ship new CLI releases to get Metro patches and features to users.
- This package contains the `start`, `bundle`, and `ram-bundle` commands (central to the React Native development experience), for which we have incoming debugging-related changes.
- This package now **only** exports commands to be attached via a RN CLI plugin. With this move, we're aiming to **internalise** the default implementations of these dev commands within React Native — other RN CLI plugins can continue to override these, but must do so wholesale. (See also the recent fix for this: https://github.com/react-native-community/cli/pull/1999.)

In V15:
- (Microsoft feedback) Re-export  `unstable_buildBundleWithConfig`, marking as unstable. This gives us a time buffer to consider how we repackage this functionality in future.

The package source has been converted from TypeScript to Flow, with a number of new `flow-typed/` defs added to meet type coverage requirements.

## To dos

- For now, we aren't removing the existing [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro) source — until later PRs consolidate this move by changing dependencies in the `react-native` package.
- **Exported API is reduced!**: I'm working with szymonrybczak to decouple references from RN CLI packages https://github.com/react-native-community/cli/pull/2021.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D46801501

fbshipit-source-id: 7f6b72941a69f487fb437768cdba125a9aa3418d
2023-08-10 11:34:36 -07:00
Alex Hunt cd8f5d176a Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718

> NOTE: Replaces https://github.com/facebook/react-native/pull/38240

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.

The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:

- `yarn build` — Builds all configured packages. Functionally, this:
  - Outputs a `dist/` directory with built files.
  - Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)

Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.

```
const buildConfig /*: BuildConfig */ = {
  // The packages to include for build and their build options
  packages: {
    'dev-middleware': {target: 'node'},
  },
};
```

For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.

 {F1043312771}

**Differences from the Metro setup**

- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.

## Current integration points

- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.

**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).

### Alternative designs

**Per-package config file**

Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](1f019afdcd/packages/jest-cli/package.json (L87C3-L89C4)).

```
"buildConfig": {
  "type": "node"
},
```

This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.

**Rollup**

More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).

**Lerna and Nx**

- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D47760330

fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 04:42:30 -07:00
Alex Hunt aab52859a4 Add Flow libdef for @babel/register (#38691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38691

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D47835803

fbshipit-source-id: 05d8379568862ae882f950d22f3b922d91f0460c
2023-07-31 06:04:09 -07:00
Rob Hogan 5cf66bda1d Update Babel Flow lib defs (#38515)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38515

Regenerate `babel/traverse` and `babel/types` Flow library definitions from the runtime code at the current lockfile versions, using Metro's `yarn update-babel-flow-lib-defs`.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D47588687

fbshipit-source-id: 065a741ce4a9d765427455a26d23892ea6401f9a
2023-07-25 11:37:04 -07:00
Rob Hogan 0f85be8f66 Sync RN-Metro Babel Flow lib defs (#38287)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38287

Enable automatic (within Meta) sync checks between these duplicated definitions across the RN and Metro repositories, by using a common naming convention.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D47361815

fbshipit-source-id: bb55e5a1c21bf44be9016150a56a9eaa3b33078b
2023-07-11 06:19:20 -07:00
Rob Hogan 9022c59820 Update Yargs flow lib def to allow .fail(false) (#38273)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38273

Update Flow types for Yargs `.fail()` to match [Yargs docs](https://github.com/yargs/yargs/blob/v17.6.2/docs/api.md#failfn--boolean).

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D47337206

fbshipit-source-id: 693bf8ba81a20e1860d6b271182e3c839ff6028b
2023-07-10 13:09:01 -07:00
Alex Hunt a991ff3837 Create dev-middleware package (#38194)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38194

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

Inits the `react-native/dev-middleware` package. Contains an initial implementation of `/open-debugger`, migrated from 2535dbe234.

## Attribution

This implementation is greatly inspired by `expo/dev-server`: 1120c716f3/packages/%40expo/dev-server/src/JsInspector.ts (L18)

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D46283818

fbshipit-source-id: 7b38ad2f6d7346366a7c599d16e289e04b7bd88d
2023-07-07 09:22:09 -07:00
Rob Hogan 1202d394a9 Add Babel Flow lib defs to React Native repo (#38145)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38145

Add Babel type definitions ahead of moving `metro-react-native-babel-transformer` under `react-natve`.

These are mostly duplicated from https://github.com/facebook/metro, adapted for RN's naming conventions and lint rules.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D47154206

fbshipit-source-id: a44703f6926507732f2f1c65a17e5d4ac590c724
2023-07-03 06:58:20 -07:00
Moti Zilberman cd56347dca Prevent LogBox from crashing on long messages (#38005)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38005

Fixes https://github.com/facebook/react-native/issues/32093 by guarding the expensive `BABEL_CODE_FRAME_ERROR_FORMAT` regex with a cheaper initial scan. (Longer term, we should reduce our reliance on string parsing and propagate more structured errors.)

Changelog: [General][Fixed] Prevent LogBox from crashing on very long messages

Reviewed By: GijsWeterings

Differential Revision: D46892454

fbshipit-source-id: 3afadcdd75969c2589bbb06f47d1c4c1c2690abd
2023-06-22 02:09:45 -07:00
Alex Hunt 4540668c15 Move flow-typed definitions to repo root (#37636)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37636

Moves `flow-typed/` directory from `packages/react-native/flow-typed/` to the repo root.

- This is a more suitable location for `flow-typed` definitions for 3P dependencies to be used across React Native packages.
- **Breaking**: We no longer publish these 3P libdefs as part of the `react-native` package (assuming that external use of React Native with Flow is extremely rare, and that these projects can manage their own package libdefs).

Changelog:
[General][Breaking] Remove included `flow-typed/` directory from the `react-native` package

- **Upgrade instructions**: Projects using Flow should install or replicate third party `flow-typed` definitions for React Native dependencies — see https://github.com/facebook/react-native/tree/main/flow-typed and [#37636](https://github.com/facebook/react-native/pull/37636).

Reviewed By: hoxyq

Differential Revision: D46313482

fbshipit-source-id: 3d97d5408e44dd43132664c4933f3ff1075f90a1
2023-06-07 13:44:13 -07:00
Ruslan Lesiutin 714b502b0c | RN Monorepo | Migrate to package (#36434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36434

Changelog: [Internal]

This is a squashed stack of 18 commits, starting from D43202126

allow-large-files

Reviewed By: cortinico

Differential Revision: D43977381

fbshipit-source-id: 0da552ddb85f2f61a0be0ef071915b35f3f8555c
2023-03-17 05:03:25 -07:00
Tim Yung b846849f69 RN: Normalize `flow-typed` Definitions
Summary:
Normalizes the `flow-typed` definitions to reflect what is actually intsalled.

Changelog:
[Internal]

Reviewed By: rickhanlonii

Differential Revision: D39868081

fbshipit-source-id: 85e903bf78f49a9d21e1956ff41c425df0491305
2022-09-30 14:28:48 -07:00
Tim Yung 5d2a400e99 JS: Update Flow Definitions for `yargs` to v17
Summary:
Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D39677869

fbshipit-source-id: 4495b0c6c5e245d20034906fff4547265c7cc157
2022-09-23 18:00:18 -07:00
Tim Yung 23717c6381 RN: Remove DeprecatedPropTypes
Summary:
Removes all of the `DeprecatedPropTypes` modules from React Native.

Any call sites that were deep-linking to these modules and still requires them can instead import them from the `deprecated-react-native-prop-types` package.

Since this also removes the last reference to `prop-types`, this diff also removes the `prop-types` dependency from `react-native`. 🥳

Changelog:
[General][Removed] DeprecatedPropTypes (deep-link) modules removed from React Native.

Reviewed By: kacieb

Differential Revision: D33671645

fbshipit-source-id: 91829a556b272bbd17ee94806fc548af753593db
2022-01-20 18:17:03 -08:00
Tim Yung 9ac03361e6 RN: Add `glob` Flow Definition
Summary:
Adds the `glob` type definition via `flow-typed` so that the `combine-js-to-schema-cli.js` script does not need a Flow suppression.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D31800809

fbshipit-source-id: 3e01a096d2153639a619a7152bd06332df57f06b
2021-10-20 19:25:45 -07:00
Tim Yung 4fb371b53a RN: Add `react-test-renderer` Flow Definition
Summary:
Adds the `react-test-renderer` Flow definition (via `flow-typed`) so it can be used from tests with Flow enabled.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D28922375

fbshipit-source-id: 9b1be69f1b281bb3c248ca272cf2527baf154e2a
2021-06-06 17:08:55 -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
Héctor Ramos 5fae86fb96 Remove license header from third-party code
Summary:
The `flow-typed/npm` path contains third-party code. The propietary Facebook license header should not be included in these files.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24082894

fbshipit-source-id: 34928c7a6a3d1fdf8d91b4cdd86eb72ca6341545
2020-10-02 18:04:21 -07:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Christoph Nakazawa 2ad827be38 Remove outdated metro type definitions
Summary:
RN itself does not depend on Metro any longer, which is abstracted away into the CLI. I don't think we need those type definitions any longer as we have proper Metro definitions internally. I'm removing them because they keep showing up in biggrep when I look for things.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D21089924

fbshipit-source-id: 2845277af12dae0f0baefaf85adefffb6ef9f2a5
2020-04-22 04:06:15 -07:00
Jordan Brown 93c4c248ef add react-dom libdef to xplat/js
Summary:
Flow is moving the react-dom libdef to flow-typed. To prepare for that, we should add `react-dom_v16.x.x` to the react-native library definitions

Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D19726257

fbshipit-source-id: b2dcbc938b482b73947cc2683b87229873b573dd
2020-02-04 16:19:13 -08:00
REDMOND\acoates 1947e1684f create-react-class is no longer used by RN, so it can be removed (#27861)
Summary:
Now that react-native has got rid of all the uses of create-react-class, it doesn't need to be listed as a dependency.

## Changelog

[General] [Removed] - Removed create-react-class from dependencies
Pull Request resolved: https://github.com/facebook/react-native/pull/27861

Test Plan: Will hit build break when building bundle if its still needed.  Other risks are if community packages are relying on create-react-class in their code, but not declaring it in their dependencies. -- But those packages should fix their dependencies.

Differential Revision: D19568065

Pulled By: cpojer

fbshipit-source-id: be26c3376aaebfa829def12983b04349ba9907ae
2020-01-29 06:10:52 -08:00
Eli White e362470305 Convert easy files to flow strict-local
Summary:
This diff was generated by this script used by WWW
https://our.intern.facebook.com/intern/diffusion/WWW/browse/master/scripts/flow/upgrade_to_flow_strict_local.sh?lines=0

Changelog:
[Internal] Upgrade flow to flow strict-local

Reviewed By: zackargyle, rickhanlonii

Differential Revision: D18833630

fbshipit-source-id: e64d4e9a49a0db5e6bf70a0c489567862b578d7f
2019-12-05 16:06:46 -08:00
Jordan Brown 48cb80892d Manually fix places the codemod doesnt hit
Summary:
Generating this diff was difficult. We _will_ fix the issues with jscodeshift, but i don't want to block the syntax change on that.

To get this diff, I first codemodded all of xplat to use exact-by-default. Then i turned on implicit-inexact-object:error enforcement to get a list of errors showing places that violated the lint. With that, I used this to generate a list of `sed` commands to add `...`:

```
flow --json | jq '.errors | .[] | .message | .[] | .loc | {source, "line": .end."line", "column": .end."column"} | "\(.column),\(.line),\(.source)"' | sort -n -r | sed 's/"//g' | while read -r line; do echo $line; awk -F',' "{ print \"sed -i '\"\$2\"s/./...&/\"\$1\"' \" \$3 }"; done
```

Then I ran prettier, reverted generated files, and manually fixed up suppressions that got messed up.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18516431

fbshipit-source-id: 6cf940dce411fb179e7ebaff764bd5113a07989f
2019-11-19 13:38:18 -08:00
Daniel Sainati 2a479a6953 remove deprecated utilities
Summary: Remove `$Subtype` and `$Supertype` utilities. Replacement was done on a best-effort basis. In many cases it sufficed to replace `$Supertype<T>` and `$Subtype<T>` with `T`, but when this was not possible `any | T` and `any & T` were used instead.

Reviewed By: jbrown215

Differential Revision: D13624765

fbshipit-source-id: 82ee9d43cfc318ed4bd2d84e0f4c5c1d8f488a9c
2019-01-15 13:59:31 -08:00
Nicolas Charpentier 5d06c7495d Replace our local types by flow-typed (#20320)
Summary:
These comments were confusing since we don't use flow-typed.

cc bvaughn.

I have replaced our local types by flow-typed, removed metro custom stub and deleted `flow-github` directory.

As result, createReactClass, PropTypes and Metro types won't be distributed to RN users. If you need it, you should relay on flow-typed.
Pull Request resolved: https://github.com/facebook/react-native/pull/20320

Reviewed By: TheSavior

Differential Revision: D13517157

Pulled By: rickhanlonii

fbshipit-source-id: e52c0b6114114a706f6152b2031c600e3dece0d2
2018-12-20 04:42:34 -08:00