Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41341
* Extends `dev-middleware`'s test utilities to enable testing against an HTTPS server with a self-signed cert.
* Runs the CDP transport integration tests (D51002261) using both HTTP and HTTPS.
* Adds a test to explicitly cover the `ws=...` / `wss=...` variation in `devtoolsFrontendUrl` first introduced in D49158227.
Changelog: [Internal]
Reviewed By: blakef
Differential Revision: D51006835
fbshipit-source-id: df3db8cd865898248cd0d8f307f75949a7f313fd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41343
Changelog: [Internal]
Adds basic tests for two-way communication between a debugger (frontend) and a target (backend) using CDP over `inspector-proxy`.
Reviewed By: blakef
Differential Revision: D51002261
fbshipit-source-id: 44e571f89437c26e76ef6e6192b2bf6244665cf0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39036
Changelog: [General][Changed] Use `hermes-parser` instead of `flow-parser` to parse Flow Codegen specs.
`hermes-parser` is a WASM build of the Hermes parser (plus supporting code), maintained by the Flow and Hermes teams. It is the recommended way of parsing Flow code in Node and its benefits (compared to `flow-parser`) include better performance and improved type safety.
Here we update `react-native/codegen` to use `hermes-parser` instead of `flow-parser`. Both parsers produce ASTs that conform to the ESTree spec so this is mostly a drop-in replacement.
In future work we should be able to use the improved AST types available in `hermes-estree` to improve type safety within `react-native/codegen` itself.
Reviewed By: huntie
Differential Revision: D48384078
fbshipit-source-id: 310ad150ec62671ba395b0e2f6415ccae97ac04d
Summary:
Though not currently in use in the RN code, when `react-native-windows` tried to integrate changes up to 7/28/23 (see PR https://github.com/microsoft/react-native-windows/pull/11970) there happened to be a `??=` operator in the `virtualized-lists` package (see [diff here](ccc50ddd2...c168a4f88 (diff-abeff2daf5909e54a23562e43569de1d5b8db1d7170119eed485b618cdf04ec7R322))). (The offending line was removed in a later commit).
The default RNW engine is still Chakra and it couldn't handle the syntax. It looks like the `babel/plugin-proposal-nullish-coalescing-operator` plugin only handles `??`, so to handle `??=` I've added `babel/plugin-proposal-logical-assignment-operators`, which also happens to handle the logical assignment operators `||=` and `&&=`.
Closes https://github.com/facebook/react-native/issues/31704
## Changelog:
[GENERAL] [FIXED] - Add detection of logical assignment operators to `react-native-babel-preset`
Pull Request resolved: https://github.com/facebook/react-native/pull/39186
Test Plan: We started using these plugins in RNW's babel config to resolve the issue in our integrate PR.
Reviewed By: motiz88
Differential Revision: D50936554
Pulled By: rozele
fbshipit-source-id: 0a924b6085524d8c9551a158b91195b1f7448c19
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41219
Bump to the latest Metro release. This includes minor breaking changes to Metro subpackages that should *not* be visible to RN users.
Metro release notes: https://github.com/facebook/metro/releases/tag/v0.80.0
## Moving to unpinned versioning
Metro is a multi-package project, and not pinning to an exact version means multiple versions of `metro*` packages may appear in an RN project.
This isn't unusual in the NPM ecosystem and *shouldn't* be a problem, but historically has caused issues (eg https://github.com/facebook/react-native/issues/34714, https://github.com/facebook/metro/issues/1017). The root cause of all of these issues, as far as we know, was fixed in 6d46078e74, a bug where Node hierarchical resolution was effectively sidestepped via a relative worker path, resulting in a mismatch between transformer and host process.
In addition, the fact that `react-refresh`, `metro-react-native-babel-transformer` and `metro-react-native-babel-preset` are now fully moved into the `react-native/` scope and versioned with React Native means there are no circular dependencies between React Native and Metro, explicit or implicit, and we're much more clearly decoupled.
So, we're moving to caret versioning to allow React Native users to pick up Metro fixes and features without requiring React Native releases and user upgrades.
Changelog:
[General][Changed] - Update Metro to ^v0.80.0, stop pinning to an exact version
Reviewed By: GijsWeterings
Differential Revision: D50731999
fbshipit-source-id: 57b07bf73c0b31f392c4d36376ca48b48a8bd598
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41067
Bump `hermes-parser` packages to the latest released version.
Changelog: https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md
Notable changes:
- Added parsing support for `as` expressions as well as `renders*` and renders?`.
- Updated internal prettier version to `3.0.3`.
Changelog: [Internal]
Reviewed By: SamChou19815
Differential Revision: D50395762
fbshipit-source-id: 8a9131ea1b0683e79c7bc74b4df9deafac7450f9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40869
Bumps DRNPT to v5 - the significant change is that this one depends on `react-native/normalize-color: ^0.73.0`, instead of `*`, so is protected from future breaking changes to that package.
NOTE: We can't safely include `react-native/normalize-color: ^0.74.0` in the dependency range of DRNPT because `0.74.0` isn't a semver-compliant release (0.74 isn't cut yet), so this will pull 0.73.2 from NPM, which is fine. We may need to publish DRNPT@6 if 0.74 final turns out to contain breaking changes (eg, a Node 20 bump).
Changelog:
[General][Fixed] Update `deprecated-react-native-prop-types` to remove fragile transitive `*` dependencies.
Reviewed By: huntie
Differential Revision: D50228564
fbshipit-source-id: 01aafafad40d9a93d00de2b5f45d2796620b9b5d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40766
This changeset allows users to opt into the new debugger frontend experience by passing `--experimental-debugger` to `react-native start`. **We are defaulting this option to `true`** for now, but will continue to evaluate this feature before 0.73 ships. It restores Flipper (via `flipper://`) as the default handling for `/open-debugger` (matching 0.72 behaviour) when this flag is not enabled.
Detailed changes:
- Replaces `enableCustomDebuggerFrontend` experiment in `dev-middleware` with `enableNewDebugger`. The latter now hard-swaps between the Flipper and new launch flows.
- Removes now-unused switching of `devtoolsFrontendUrl`.
- Implements `deprecated_openFlipperMiddleware` (matching previous RN CLI implementation).
- Disables "`j` to debug" key handler by default.
- Marks "`j` to debug" and `/open-debugger` console logs as experimental.
Changelog:
[Changed][General] Gate new debugger frontend behind `--experimental-debugger` flag, restore Flipper as base launch flow
Reviewed By: motiz88
Differential Revision: D50084590
fbshipit-source-id: 5234634f20110cb7933b1787bd2c86f645411fff
Summary:
When upgrading ESLint to latest, the RN plugin fails to run because of a deprecated API:
```
Error: Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.
```
## Changelog:
- [GENERAL] [FIXED] Updated ESLint version to fix `originalKeywordKind` deprecation error
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/39654
Test Plan: Run CI and Lint
Reviewed By: NickGerleman
Differential Revision: D49634978
Pulled By: robhogan
fbshipit-source-id: f65f0d56053acf1c877fe0f368a7f4e13c8c57d1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39819
Bump `hermes-parser` packages to the latest released version.
Changelog: https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md
Notable changes:
- Upgraded to the lastest version of emscripten for the parser.
- The babel interop logic now more closely matches babel's AST.
- The biggest change is we now add the `extra.raw` properties to literal nodes, which results in Babel more closely outputting literal sources. e.g. previously the following would happen `1.0` -> `1`, `'foo'` -> `"foo"` and `1n` -> `1` but now the raw source value is preserved.
- Upgraded `prettier-plugin-hermes-parser` to use the latest prettier formatting logic, which causes some minor formatting changes.
- `hermes-parser` no longer fails when the `component` name is used within a function type, e.g. `type Foo = (component: string) => void`.
Changelog: [Internal]
Reviewed By: SamChou19815
Differential Revision: D49935231
fbshipit-source-id: a905838396fdd7281442c211970e0caa773a1256
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39791
Bump `hermes-parser` packages to the latest released version.
Changelog: https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md
Notable changes:
- Upgraded to the lastest version of emscripten for the parser.
- The babel interop logic now more closely matches babel's AST.
- The biggest change is we now add the `extra.raw` properties to literal nodes, which results in Babel more closely outputting literal sources. e.g. previously the following would happen `1.0` -> `1`, `'foo'` -> `"foo"` and `1n` -> `1` but now the raw source value is preserved.
- Upgraded `prettier-plugin-hermes-parser` to use the latest prettier formatting logic, which causes some minor formatting changes.
- `hermes-parser` no longer fails when the `component` name is used within a function type, e.g. `type Foo = (component: string) => void`.
Changelog: [Internal]
Reviewed By: SamChou19815
Differential Revision: D49838842
fbshipit-source-id: ebfd2f89852d1bd3b1671ce77f58240d7e17cfbb
Summary:
- Companion PR to https://github.com/facebook/metro/pull/1085
- The Fast Refresh changes appear to be required for using static rendering and React DOM. In frameworks like Expo Router which support both native and web, this causes users to not be able to use Fast Refresh on web.
## Changelog:
[GENERAL] [CHANGED] - Upgrade React Refresh package from 0.4.0 to 0.14.0
Pull Request resolved: https://github.com/facebook/react-native/pull/39486
Test Plan:
1. In a React Native project's `package.json`:
```json
"resolutions": {
"react-refresh": "~0.14.0"
},
```
2. Start the server with a clear Metro cache.
3. Changes should update while preserving React state.
Reviewed By: huntie
Differential Revision: D49348078
Pulled By: robhogan
fbshipit-source-id: ac3dcb096c35c6c29c6e6a919cf263559bceaa7c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39273
Upgrade Metro dependencies to 0.79.1 in `react-native`
This includes Metro breaking changes for disabling global package resolution by default and adds features like: Haste packages, enable resolution through symlinks and passing custom customTransformOptions and customResolverOptions to bundle_build_started log event so as to refine the bundling message. It also fixes arbitrary transformation of Babel plugins during registration in `metro-babel-register` and fixes "unexpected null" crash when handling a batch of file changes and symlinks with indirections.
**Full Metro Changelog:** https://github.com/facebook/metro/releases/tag/v0.79.1https://github.com/facebook/metro/releases/tag/v0.79.0
Changelog:
[General][Changed] Upgraded Metro to 0.79.1
Reviewed By: motiz88, mdvacca
Differential Revision: D48922815
fbshipit-source-id: 37aea6194fe587e0d094c96ceec1122c588f0fbb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39456
**Fixes new debugger launch flow on Android:**
D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator.
https://pxl.cl/3mVmR
This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option.
**Changes**
- Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`.
- This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly.
- Updates call site in `community-cli-plugin`.
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D49276125
fbshipit-source-id: 2b6a8507073649832993971aa9d0870f54c9bd44
Summary:
Right now we're fetching latests versions of drivers which isn't the best, we should always download the same versions.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[INTERNAL] - Add versions when installing Appium drivers.
Pull Request resolved: https://github.com/facebook/react-native/pull/39275
Test Plan: CI Green - (side note: if jobs `test_e2e_ios` and `test_e2e_android` are green it doesn't mean that they passed.)
Reviewed By: cipolleschi
Differential Revision: D49248778
Pulled By: NickGerleman
fbshipit-source-id: 5b114b7dc1172993afc4b02e9d3380afa9f03c40
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
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39161
Changelog: [Internal]
Creates a new stub package named `react-native/debugger-frontend`, which will contain a minimal build of the Chrome DevTools frontend adapted for React Native. Initially, the compiled frontend assets will be checked into the React Native repo, but we intend to replace this with a fully automated build in CI at a later date.
Reviewed By: huntie
Differential Revision: D48680624
fbshipit-source-id: a24c8b019881187963d0be88e773bc0a97a2437d
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
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