Compare commits

...
Author SHA1 Message Date
React Native Bot d2168e9415 Release 0.80.0-rc.1
#publish-packages-to-npm&next
2025-05-12 16:16:21 +00:00
Riccardo CipolleschiandGitHub 79e2298230 [RN][Release] Fix set-rn-version to consider also the codegen snapshot tests (#51156) 2025-05-12 15:17:36 +01:00
Jakub PiaseckiandReact Native Bot 619a0db17f Update transform types to preserve behavior in TypeScript (#51115)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51115

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74229819

fbshipit-source-id: 08e363ae58c29ca910601b2f078153b8ff30103c
2025-05-12 14:14:01 +00:00
Dawid MałeckiandReact Native Bot 241b1a6462 Add transform that moves comments for default exported variable declarations (#51135)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51135

In generated types default exported variables are re-declared which shadows attached tags and doc blocks. This transform moves necessary comments on top of re-declarations to keep them accessible.

Example output for SafeAreaView:

```ts
import type { ViewProps } from "../View/ViewPropTypes";
import View from "../View/View";
import * as React from "react";
declare const exported: (props: Omit<ViewProps, keyof {
  ref?: React.Ref<React.ComponentRef<typeof View>>;
}> & {
  ref?: React.Ref<React.ComponentRef<typeof View>>;
}) => React.ReactNode;
/**
 * Renders nested content and automatically applies paddings reflect the portion
 * of the view that is not covered by navigation bars, tab bars, toolbars, and
 * other ancestor views.
 *
 * Moreover, and most importantly, Safe Area's paddings reflect physical
 * limitation of the screen, such as rounded corners or camera notches (aka
 * sensor housing area on iPhone X).
 */
declare const SafeAreaView_DEFAULT: typeof exported;
declare type SafeAreaView_DEFAULT = typeof SafeAreaView_DEFAULT;
export default SafeAreaView_DEFAULT;
```

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D74249424

fbshipit-source-id: 5cdd1c746e7fed99e3d3427d6ebf4c0e7ba3f3fd
2025-05-12 13:52:49 +00:00
Dawid MałeckiandReact Native Bot e8b14c7b06 Attach @deprecated tag and doc block to ProgressBarAndroid (#51136)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51136

This diff attaches doc block to ProgressBarAndroid copied from the manual TS types.

Generated types result:

```ts
import * as React from "react";
import type $$IMPORT_TYPEOF_1$$ from "./ProgressBarAndroidNativeComponent";
type ProgressBarAndroidNativeComponentType = typeof $$IMPORT_TYPEOF_1$$;
import type { ProgressBarAndroidProps } from "./ProgressBarAndroidTypes";
export type { ProgressBarAndroidProps };
declare let ProgressBarAndroid: (props: Omit<ProgressBarAndroidProps, keyof {
  ref?: React.Ref<React.ComponentRef<ProgressBarAndroidNativeComponentType>>;
}> & {
  ref?: React.Ref<React.ComponentRef<ProgressBarAndroidNativeComponentType>>;
}) => React.ReactNode;
/**
 * ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
 * It can now be installed and imported from `react-native-community/progress-bar-android` instead of 'react-native'.
 * see https://github.com/react-native-community/progress-bar-android
 * deprecated
 */
declare const $$ProgressBarAndroid: typeof ProgressBarAndroid;
declare type $$ProgressBarAndroid = typeof $$ProgressBarAndroid;
export default $$ProgressBarAndroid;

```

Changelog:
[Internal]

Reviewed By: robhogan

Differential Revision: D73855212

fbshipit-source-id: c6c09ea68c9f61f305f96c0954370bb938fc59d9
2025-05-12 13:51:37 +00:00
Dawid MałeckiandReact Native Bot 8b8e1055ae Move imported types from @react-native/assets-registry and @react-native/js-polyfills to react-native repo (#51192)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51192

The `build-types` script cannot currently resolve `react-native/assets-registry` and `react-native/js-polyfills`. This diff moves imported types from these packages to `react-native` to include them in generated types.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D74392568

fbshipit-source-id: cbce977b710f54dc53ce1b0fc080704b420490d4
2025-05-12 13:50:13 +00:00
Riccardo CipolleschiandGitHub cdf7d76101 [RN][Releases] Fix draft creation (#51158) 2025-05-12 14:49:17 +01:00
Kacper RożniataandReact Native Bot 1c22a46cf6 fix(iOS): enable DEFINES_MODULE in React-jsc (#51160)
Summary:
Enables `DEFINES_MODULE` in `React-jsc.podspec`

After upgrading app to RN `0.79`, when installing pods with JSC enabled there is an error being thrown that

`The following Swift pods cannot yet be integrated as static libraries`
`The Swift pod 'RNFlashList' depends upon 'React-jsc', which does not define modules. ...`
when installing packages that use Swift

## Changelog:

[IOS] [CHANGED] -  enable `DEFINES_MODULE` in `React-jsc.podspec`

Pull Request resolved: https://github.com/facebook/react-native/pull/51160

Test Plan: RNTester runs and builds correctly

Reviewed By: huntie

Differential Revision: D74325357

Pulled By: cipolleschi

fbshipit-source-id: b994b7e678633440d5e362ae6965b2d5188d34f1
2025-05-12 13:41:22 +00:00
ismarbesicandReact Native Bot 7ce8f12549 Exclude selectively disabled libraries from codegen generation (#51078)
Summary:
Selectively disabling autolinking of a native dependency with components registered in the codegen configuration in react-native.config.js causes builds to crash upon launch on iOS. This is because the generated `RCTThirdPartyComponentsProvider.mm` file contains references to the excluded library using `NSClassFromString` causing the returned NSDictionary from `+[RCTThirdPartyComponentsProvider thirdPartyFabricComponents]` to be populated with nil values and therefore crashing the app. This has been confirmed in 0.78.2 and 0.79.2 but probably exists in 0.77.x as well.

The issue has been further described in https://github.com/facebook/react-native/issues/51077.

## Changelog:

[IOS][FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js

Pull Request resolved: https://github.com/facebook/react-native/pull/51078

Test Plan:
1. Install a library that has the componentProvider field set in the codegen config (see reproducer) and install the iOS pods.
2. Build the app.
3. App should run successfully without any crashes.

Reviewed By: cortinico

Differential Revision: D74248371

Pulled By: cipolleschi

fbshipit-source-id: 1ff7b477ed3d94ca45616ae243d3d2d30bd897db
2025-05-12 13:39:24 +00:00
Jakub PiaseckiandReact Native Bot ce4d7e5d52 Fix generated types in @react-native/virtualized-lists being used without opt-in (#51246)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51246

Changelog: [General][Fixed] Fix generated types in react-native/virtualized-lists being used without opt-in

D71969602 introduces `exports` field to `package.json` files in `react-native` and `virtualized-lists`. In that diff, the `types` in `virtualized-lists` by default pointed to the new generated types without requiring the opt-in.

This fixes that by requiring the opt-in before using the generated types.

Reviewed By: huntie

Differential Revision: D74573321

fbshipit-source-id: fe05b0204a7200c1c91aac2614aa786bbbced2a5
2025-05-12 13:34:50 +00:00
Dawid MałeckiandReact Native Bot d5c6afaae0 Fix suggesting components from types_generated directory (#51101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51101

TS LSP suggests importing/using components from `types_generated` directory which are exported under slightly different name than root exports. Prefixing default exports with `$$` fixes the issue.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D74177107

fbshipit-source-id: 86a6869c2aa7a113915184e4857a7882710b1db4
2025-05-12 13:18:20 +00:00
React Native Bot f70a146699 [LOCAL] Bump Podfile.lock 2025-05-07 11:41:41 +00:00
React Native Bot d9c2857e59 Release 0.80.0-rc.0
#publish-packages-to-npm&next
2025-05-07 10:17:06 +00:00
Jorge Cohen cbf1710fd5 Bump hermes version 2025-05-06 11:21:57 +01:00
56 changed files with 862 additions and 467 deletions
+1 -1
View File
@@ -24,6 +24,6 @@ jobs:
with:
script: |
const {createDraftRelease} = require('./.github/workflow-scripts/createDraftRelease.js');
const version = ${{ github.ref_name }}';
const version = '${{ github.ref_name }}';
const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js');
await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}');
+10
View File
@@ -0,0 +1,10 @@
## Summary:
This change fixes the script that updates the RN Version to also update the Codegen snapshots so that they are in sync with the current version of React Native.
It also updates the Snapshot as it was failing in rc.0
## Changelog:
[Internal] - Fixed script that updates the react native versions
## Test Plan:
Tested locally by running `node ./scripts/releases/set-rn-artifacts-version --built-type release --to-version 0.80.0-rc.0` and verifying that the snapshot file was getting updated. I then run the `yarn test
generate-artifacts-executor-test.js` command to verify that the tests were passing.
+2 -2
View File
@@ -52,8 +52,8 @@
"@babel/preset-flow": "^7.24.7",
"@definitelytyped/dtslint": "^0.0.127",
"@jest/create-cache-key-function": "^29.7.0",
"@react-native/metro-babel-transformer": "0.80.0-main",
"@react-native/metro-config": "0.80.0-main",
"@react-native/metro-babel-transformer": "0.80.0-rc.1",
"@react-native/metro-config": "0.80.0-rc.1",
"@tsconfig/node18": "1.0.1",
"@types/react": "^19.0.0",
"@typescript-eslint/parser": "^7.1.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/assets-registry",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Asset support code for React Native.",
"license": "MIT",
"repository": {
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-plugin-codegen",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Babel plugin to generate native module and view manager code for React Native.",
"license": "MIT",
"repository": {
@@ -26,7 +26,7 @@
],
"dependencies": {
"@babel/traverse": "^7.25.3",
"@react-native/codegen": "0.80.0-main"
"@react-native/codegen": "0.80.0-rc.1"
},
"devDependencies": {
"@babel/core": "^7.25.2"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/community-cli-plugin",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Core CLI commands for React Native",
"keywords": [
"react-native",
@@ -22,7 +22,7 @@
"dist"
],
"dependencies": {
"@react-native/dev-middleware": "0.80.0-main",
"@react-native/dev-middleware": "0.80.0-rc.1",
"chalk": "^4.0.0",
"debug": "^4.4.0",
"invariant": "^2.2.4",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/core-cli-utils",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "React Native CLI library for Frameworks to build on",
"license": "MIT",
"main": "./src/index.flow.js",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/debugger-frontend",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Debugger frontend for React Native based on Chrome DevTools",
"keywords": [
"react-native",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/dev-middleware",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Dev server middleware for React Native",
"keywords": [
"react-native",
@@ -23,7 +23,7 @@
],
"dependencies": {
"@isaacs/ttlcache": "^1.4.1",
"@react-native/debugger-frontend": "0.80.0-main",
"@react-native/debugger-frontend": "0.80.0-rc.1",
"chrome-launcher": "^0.15.2",
"chromium-edge-launcher": "^0.2.0",
"connect": "^3.6.5",
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-config",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "ESLint config for React Native",
"license": "MIT",
"repository": {
@@ -22,7 +22,7 @@
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@react-native/eslint-plugin": "0.80.0-main",
"@react-native/eslint-plugin": "0.80.0-rc.1",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint-config-prettier": "^8.5.0",
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "ESLint rules for @react-native/eslint-config",
"license": "MIT",
"repository": {
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin-specs",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "ESLint rules to validate NativeModule and Component Specs",
"license": "MIT",
"repository": {
@@ -26,7 +26,7 @@
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
"@react-native/codegen": "0.80.0-main",
"@react-native/codegen": "0.80.0-rc.1",
"make-dir": "^2.1.0",
"pirates": "^4.0.1",
"source-map-support": "0.5.0"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/gradle-plugin",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Gradle Plugin for React Native",
"license": "MIT",
"repository": {
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "helloworld",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"private": true,
"scripts": {
"bootstrap": "node ./cli.js bootstrap",
@@ -13,16 +13,16 @@
},
"dependencies": {
"react": "19.1.0",
"react-native": "1000.0.0"
"react-native": "0.80.0-rc.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native/babel-preset": "0.80.0-main",
"@react-native/core-cli-utils": "0.80.0-main",
"@react-native/eslint-config": "0.80.0-main",
"@react-native/metro-config": "0.80.0-main",
"@react-native/babel-preset": "0.80.0-rc.1",
"@react-native/core-cli-utils": "0.80.0-rc.1",
"@react-native/eslint-config": "0.80.0-rc.1",
"@react-native/metro-config": "0.80.0-rc.1",
"chalk": "^4.1.2",
"commander": "^12.0.0",
"eslint": "^8.19.0",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-config",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Metro configuration for React Native.",
"license": "MIT",
"repository": {
@@ -26,8 +26,8 @@
"dist"
],
"dependencies": {
"@react-native/js-polyfills": "0.80.0-main",
"@react-native/metro-babel-transformer": "0.80.0-main",
"@react-native/js-polyfills": "0.80.0-rc.1",
"@react-native/metro-babel-transformer": "0.80.0-rc.1",
"metro-config": "^0.82.2",
"metro-runtime": "^0.82.2"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/new-app-screen",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "NewAppScreen component for React Native",
"keywords": [
"react-native"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/normalize-colors",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Color normalization for React Native.",
"license": "MIT",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/js-polyfills",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Polyfills for React Native.",
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-preset",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Babel preset for React Native applications",
"repository": {
"type": "git",
@@ -66,7 +66,7 @@
"@babel/plugin-transform-typescript": "^7.25.2",
"@babel/plugin-transform-unicode-regex": "^7.24.7",
"@babel/template": "^7.25.0",
"@react-native/babel-plugin-codegen": "0.80.0-main",
"@react-native/babel-plugin-codegen": "0.80.0-rc.1",
"babel-plugin-syntax-hermes-parser": "0.28.1",
"babel-plugin-transform-flow-enums": "^0.0.2",
"react-refresh": "^0.14.0"
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-babel-transformer",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Babel transformer for React Native applications.",
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
],
"dependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.80.0-main",
"@react-native/babel-preset": "0.80.0-rc.1",
"hermes-parser": "0.28.1",
"nullthrows": "^1.1.1"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@react-native/bots",
"description": "React Native Bots",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"private": true,
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen-typescript-test",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"private": true,
"description": "TypeScript related unit test for @react-native/codegen",
"license": "MIT",
@@ -19,7 +19,7 @@
"prepare": "yarn run build"
},
"dependencies": {
"@react-native/codegen": "0.80.0-main"
"@react-native/codegen": "0.80.0-rc.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Code generation tools for React Native",
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/compatibility-check",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Check a React Native app's boundary between JS and Native for incompatibilities",
"license": "MIT",
"repository": {
@@ -29,7 +29,7 @@
"dist"
],
"dependencies": {
"@react-native/codegen": "0.80.0-main"
"@react-native/codegen": "0.80.0-rc.1"
},
"devDependencies": {
"flow-remove-types": "^2.237.2",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@react-native/fantom",
"private": true,
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"main": "src/index.js",
"description": "Internal integration testing and benchmarking tool for React Native",
"peerDependencies": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/popup-menu-android",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "PopupMenu for the Android platform",
"main": "index.js",
"files": [
@@ -21,7 +21,7 @@
},
"license": "MIT",
"devDependencies": {
"@react-native/codegen": "0.80.0-main"
"@react-native/codegen": "0.80.0-rc.1"
},
"peerDependencies": {
"@types/react": "^19.0.0",
@@ -1,6 +1,6 @@
{
"name": "@react-native/oss-library-example",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"private": true,
"description": "Package that includes native module exapmle, native component example, targets both the old and the new architecture. It should serve as an example of a real-world OSS library.",
"license": "MIT",
@@ -26,8 +26,8 @@
],
"devDependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.80.0-main",
"react-native": "1000.0.0"
"@react-native/babel-preset": "0.80.0-rc.1",
"react-native": "0.80.0-rc.1"
},
"peerDependencies": {
"react": "*",
@@ -17,6 +17,12 @@ import Platform from '../../Utilities/Platform';
export type {ProgressBarAndroidProps};
/**
* ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
* @see https://github.com/react-native-community/progress-bar-android
* @deprecated
*/
let ProgressBarAndroid: component(
ref?: React.RefSetter<
React.ElementRef<ProgressBarAndroidNativeComponentType>,
+3 -3
View File
@@ -14,8 +14,8 @@ export const version: $ReadOnly<{
patch: number,
prerelease: string | null,
}> = {
major: 1000,
minor: 0,
major: 0,
minor: 80,
patch: 0,
prerelease: null,
prerelease: 'rc.1',
};
@@ -18,10 +18,23 @@ export type ResolvedAssetSource = {
+scale: number,
};
import type {
AssetDestPathResolver,
PackagerAsset,
} from '@react-native/assets-registry/registry';
// From @react-native/assets-registry
type AssetDestPathResolver = 'android' | 'generic';
// From @react-native/assets-registry
type PackagerAsset = $ReadOnly<{
__packager_asset: boolean,
fileSystemLocation: string,
httpServerLocation: string,
width: ?number,
height: ?number,
scales: Array<number>,
hash: string,
name: string,
type: string,
resolver?: AssetDestPathResolver,
...
}>;
const PixelRatio = require('../Utilities/PixelRatio').default;
const Platform = require('../Utilities/Platform').default;
@@ -10,6 +10,25 @@
import type AnimatedNode from '../../Animated/nodes/AnimatedNode';
// Helper types to enforce that a single key is used in a transform object
// after generating a TypeScript definition file from the Flow types.
// $FlowExpectedError[unclear-type]
type KeysOfUnion<T> = T extends any ? $Keys<T> : empty;
// $FlowExpectedError[unclear-type]
type ValueOfUnion<T, K> = T extends any
? K extends $Keys<T>
? T[K]
: empty
: empty;
type MergeUnion<T> = {
[K in KeysOfUnion<T>]?: ValueOfUnion<T, K>,
};
type MaximumOneOf<T: {...}> = $Values<{
[K in keyof T]: $Exact<{
[P in keyof T]?: P extends K ? T[P] : empty,
}>,
}>;
export type ____TransformStyle_Internal = $ReadOnly<{
/**
* `transform` accepts an array of transformation objects. Each object specifies
@@ -29,27 +48,36 @@ export type ____TransformStyle_Internal = $ReadOnly<{
*/
transform?:
| $ReadOnlyArray<
| {+perspective: number | AnimatedNode}
| {+rotate: string | AnimatedNode}
| {+rotateX: string | AnimatedNode}
| {+rotateY: string | AnimatedNode}
| {+rotateZ: string | AnimatedNode}
| {+scale: number | AnimatedNode}
| {+scaleX: number | AnimatedNode}
| {+scaleY: number | AnimatedNode}
| {+translateX: number | string | AnimatedNode}
| {+translateY: number | string | AnimatedNode}
| {
+translate:
| [number | string | AnimatedNode, number | string | AnimatedNode]
| AnimatedNode,
}
| {+skewX: string | AnimatedNode}
| {+skewY: string | AnimatedNode}
// TODO: what is the actual type it expects?
| {
+matrix: $ReadOnlyArray<number | AnimatedNode> | AnimatedNode,
},
$ReadOnly<
MaximumOneOf<
MergeUnion<
| {+perspective: number | AnimatedNode}
| {+rotate: string | AnimatedNode}
| {+rotateX: string | AnimatedNode}
| {+rotateY: string | AnimatedNode}
| {+rotateZ: string | AnimatedNode}
| {+scale: number | AnimatedNode}
| {+scaleX: number | AnimatedNode}
| {+scaleY: number | AnimatedNode}
| {+translateX: number | string | AnimatedNode}
| {+translateY: number | string | AnimatedNode}
| {
+translate:
| [
number | string | AnimatedNode,
number | string | AnimatedNode,
]
| AnimatedNode,
}
| {+skewX: string | AnimatedNode}
| {+skewY: string | AnimatedNode}
// TODO: what is the actual type it expects?
| {
+matrix: $ReadOnlyArray<number | AnimatedNode> | AnimatedNode,
},
>,
>,
>,
>
| string,
/**
@@ -4202,6 +4202,19 @@ exports[`public API should not change unintentionally Libraries/Image/AssetSourc
+uri: string,
+scale: number,
};
type AssetDestPathResolver = \\"android\\" | \\"generic\\";
type PackagerAsset = $ReadOnly<{
fileSystemLocation: string,
httpServerLocation: string,
width: ?number,
height: ?number,
scales: Array<number>,
hash: string,
name: string,
type: string,
resolver?: AssetDestPathResolver,
...
}>;
declare class AssetSourceResolver {
serverUrl: ?string;
jsbundleUrl: ?string;
@@ -7580,29 +7593,52 @@ export type ____ViewStyle_InternalOverrides = $ReadOnly<{}>;
`;
exports[`public API should not change unintentionally Libraries/StyleSheet/private/_TransformStyle.js 1`] = `
"export type ____TransformStyle_Internal = $ReadOnly<{
"type KeysOfUnion<T> = T extends any ? $Keys<T> : empty;
type ValueOfUnion<T, K> = T extends any
? K extends $Keys<T>
? T[K]
: empty
: empty;
type MergeUnion<T> = {
[K in KeysOfUnion<T>]?: ValueOfUnion<T, K>,
};
type MaximumOneOf<T: { ... }> = $Values<{
[K in keyof T]: $Exact<{
[P in keyof T]?: P extends K ? T[P] : empty,
}>,
}>;
export type ____TransformStyle_Internal = $ReadOnly<{
transform?:
| $ReadOnlyArray<
| { +perspective: number | AnimatedNode }
| { +rotate: string | AnimatedNode }
| { +rotateX: string | AnimatedNode }
| { +rotateY: string | AnimatedNode }
| { +rotateZ: string | AnimatedNode }
| { +scale: number | AnimatedNode }
| { +scaleX: number | AnimatedNode }
| { +scaleY: number | AnimatedNode }
| { +translateX: number | string | AnimatedNode }
| { +translateY: number | string | AnimatedNode }
| {
+translate:
| [number | string | AnimatedNode, number | string | AnimatedNode]
| AnimatedNode,
}
| { +skewX: string | AnimatedNode }
| { +skewY: string | AnimatedNode }
| {
+matrix: $ReadOnlyArray<number | AnimatedNode> | AnimatedNode,
},
$ReadOnly<
MaximumOneOf<
MergeUnion<
| { +perspective: number | AnimatedNode }
| { +rotate: string | AnimatedNode }
| { +rotateX: string | AnimatedNode }
| { +rotateY: string | AnimatedNode }
| { +rotateZ: string | AnimatedNode }
| { +scale: number | AnimatedNode }
| { +scaleX: number | AnimatedNode }
| { +scaleY: number | AnimatedNode }
| { +translateX: number | string | AnimatedNode }
| { +translateY: number | string | AnimatedNode }
| {
+translate:
| [
number | string | AnimatedNode,
number | string | AnimatedNode,
]
| AnimatedNode,
}
| { +skewX: string | AnimatedNode }
| { +skewY: string | AnimatedNode }
| {
+matrix: $ReadOnlyArray<number | AnimatedNode> | AnimatedNode,
},
>,
>,
>,
>
| string,
transformOrigin?:
@@ -8892,8 +8928,33 @@ declare export default typeof rejectionTrackingOptions;
`;
exports[`public API should not change unintentionally Libraries/vendor/core/ErrorUtils.js 1`] = `
"export type ErrorUtils = ErrorUtilsT;
declare export default ErrorUtilsT;
"type ErrorHandler = (error: mixed, isFatal: boolean) => void;
type Fn<Args, Return> = (...Args) => Return;
export type ErrorUtils = {
applyWithGuard<TArgs: $ReadOnlyArray<mixed>, TOut>(
fun: Fn<TArgs, TOut>,
context?: mixed,
args?: ?TArgs,
unused_onError?: null,
unused_name?: ?string
): ?TOut,
applyWithGuardIfNeeded<TArgs: $ReadOnlyArray<mixed>, TOut>(
fun: Fn<TArgs, TOut>,
context?: mixed,
args?: ?TArgs
): ?TOut,
getGlobalHandler(): ErrorHandler,
guard<TArgs: $ReadOnlyArray<mixed>, TOut>(
fun: Fn<TArgs, TOut>,
name?: ?string,
context?: mixed
): ?(...TArgs) => ?TOut,
inGuard(): boolean,
reportError(error: mixed): void,
reportFatalError(error: mixed): void,
setGlobalHandler(fun: ErrorHandler): void,
};
declare export default ErrorUtils;
"
`;
+28 -4
View File
@@ -8,9 +8,33 @@
* @flow strict
*/
import type {ErrorUtilsT} from '@react-native/js-polyfills/error-guard';
export type ErrorUtils = ErrorUtilsT;
// From @react-native/js-polyfills
type ErrorHandler = (error: mixed, isFatal: boolean) => void;
type Fn<Args, Return> = (...Args) => Return;
export type ErrorUtils = {
applyWithGuard<TArgs: $ReadOnlyArray<mixed>, TOut>(
fun: Fn<TArgs, TOut>,
context?: mixed,
args?: ?TArgs,
unused_onError?: null,
unused_name?: ?string,
): ?TOut,
applyWithGuardIfNeeded<TArgs: $ReadOnlyArray<mixed>, TOut>(
fun: Fn<TArgs, TOut>,
context?: mixed,
args?: ?TArgs,
): ?TOut,
getGlobalHandler(): ErrorHandler,
guard<TArgs: $ReadOnlyArray<mixed>, TOut>(
fun: Fn<TArgs, TOut>,
name?: ?string,
context?: mixed,
): ?(...TArgs) => ?TOut,
inGuard(): boolean,
reportError(error: mixed): void,
reportFatalError(error: mixed): void,
setGlobalHandler(fun: ErrorHandler): void,
};
/**
* The particular require runtime that we are using looks for a global
@@ -24,4 +48,4 @@ export type ErrorUtils = ErrorUtilsT;
* that use it aren't just using a global variable, so simply export the global
* variable here. ErrorUtils is originally defined in a file named error-guard.js.
*/
export default (global.ErrorUtils: ErrorUtilsT);
export default global.ErrorUtils as ErrorUtils;
@@ -21,10 +21,10 @@ NSDictionary* RCTGetReactNativeVersion(void)
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^(void){
__rnVersion = @{
RCTVersionMajor: @(1000),
RCTVersionMinor: @(0),
RCTVersionMajor: @(0),
RCTVersionMinor: @(80),
RCTVersionPatch: @(0),
RCTVersionPrerelease: [NSNull null],
RCTVersionPrerelease: @"rc.1",
};
});
return __rnVersion;
@@ -1,4 +1,4 @@
VERSION_NAME=1000.0.0
VERSION_NAME=0.80.0-rc.1
react.internal.publishingGroup=com.facebook.react
android.useAndroidX=true
@@ -12,9 +12,9 @@ package com.facebook.react.modules.systeminfo
public object ReactNativeVersion {
@JvmField
public val VERSION: Map<String, Any?> = mapOf(
"major" to 1000,
"minor" to 0,
"major" to 0,
"minor" to 80,
"patch" to 0,
"prerelease" to null
"prerelease" to "rc.1"
)
}
@@ -12,17 +12,17 @@
#include <cstdint>
#include <string_view>
#define REACT_NATIVE_VERSION_MAJOR 1000
#define REACT_NATIVE_VERSION_MINOR 0
#define REACT_NATIVE_VERSION_MAJOR 0
#define REACT_NATIVE_VERSION_MINOR 80
#define REACT_NATIVE_VERSION_PATCH 0
namespace facebook::react {
constexpr struct {
int32_t Major = 1000;
int32_t Minor = 0;
int32_t Major = 0;
int32_t Minor = 80;
int32_t Patch = 0;
std::string_view Prerelease = "";
std::string_view Prerelease = "rc.1";
} ReactNativeVersion;
} // namespace facebook::react
@@ -32,6 +32,6 @@ Pod::Spec.new do |s|
s.dependency "React-jsi", version
s.subspec "Fabric" do |ss|
ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited)" }
ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited)", "DEFINES_MODULE" => "YES" }
end
end
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "react-native",
"version": "1000.0.0",
"version": "0.80.0-rc.1",
"description": "A framework for building native apps using React",
"license": "MIT",
"repository": {
@@ -154,13 +154,13 @@
},
"dependencies": {
"@jest/create-cache-key-function": "^29.7.0",
"@react-native/assets-registry": "0.80.0-main",
"@react-native/codegen": "0.80.0-main",
"@react-native/community-cli-plugin": "0.80.0-main",
"@react-native/gradle-plugin": "0.80.0-main",
"@react-native/js-polyfills": "0.80.0-main",
"@react-native/normalize-colors": "0.80.0-main",
"@react-native/virtualized-lists": "0.80.0-main",
"@react-native/assets-registry": "0.80.0-rc.1",
"@react-native/codegen": "0.80.0-rc.1",
"@react-native/community-cli-plugin": "0.80.0-rc.1",
"@react-native/gradle-plugin": "0.80.0-rc.1",
"@react-native/js-polyfills": "0.80.0-rc.1",
"@react-native/normalize-colors": "0.80.0-rc.1",
"@react-native/virtualized-lists": "0.80.0-rc.1",
"abort-controller": "^3.0.0",
"anser": "^1.4.9",
"ansi-regex": "^5.0.0",
@@ -363,7 +363,7 @@ exports[`execute "ReactAppDependencyProvider.podspec" should match snapshot 1`]
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
version = \\"1000.0.0\\"
version = \\"0.80.0-rc.1\\"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which were presumably in.
@@ -401,7 +401,7 @@ exports[`execute "ReactCodegen.podspec" should match snapshot 1`] = `
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
version = \\"1000.0.0\\"
version = \\"0.80.0-rc.1\\"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which were presumably in.
@@ -503,4 +503,4 @@ SCRIPT
end
"
`;
`;
@@ -35,8 +35,10 @@ const {
cleanupEmptyFilesAndFolders,
codegenLog,
findCodegenEnabledLibraries,
findDisabledLibrariesByPlatform,
pkgJsonIncludesGeneratedCode,
readPkgJsonInDirectory,
readReactNativeConfig,
} = require('./utils');
const path = require('path');
@@ -83,9 +85,14 @@ function execute(
buildCodegenIfNeeded();
}
const libraries = findCodegenEnabledLibraries(pkgJson, projectRoot);
const reactNativeConfig = readReactNativeConfig(projectRoot);
const codegenEnabledLibraries = findCodegenEnabledLibraries(
pkgJson,
projectRoot,
reactNativeConfig,
);
if (libraries.length === 0) {
if (codegenEnabledLibraries.length === 0) {
codegenLog('No codegen-enabled libraries found.', true);
return;
}
@@ -94,6 +101,18 @@ function execute(
targetPlatform === 'all' ? supportedPlatforms : [targetPlatform];
for (const platform of platforms) {
const disabledLibraries = findDisabledLibrariesByPlatform(
reactNativeConfig,
platform,
);
const libraries = codegenEnabledLibraries.filter(
({name}) => !disabledLibraries.includes(name),
);
if (!libraries.length) {
continue;
}
const outputPath = computeOutputPath(
projectRoot,
baseOutputPath,
@@ -94,10 +94,20 @@ function cleanupEmptyFilesAndFolders(filepath) {
}
}
function readReactNativeConfig(projectRoot) {
const rnConfigFilePath = path.resolve(projectRoot, 'react-native.config.js');
if (!fs.existsSync(rnConfigFilePath)) {
return {};
}
return require(rnConfigFilePath);
}
/**
* Finding libraries!
*/
function findCodegenEnabledLibraries(pkgJson, projectRoot) {
function findCodegenEnabledLibraries(pkgJson, projectRoot, reactNativeConfig) {
const projectLibraries = findProjectRootLibraries(pkgJson, projectRoot);
if (pkgJsonIncludesGeneratedCode(pkgJson)) {
return projectLibraries;
@@ -105,7 +115,7 @@ function findCodegenEnabledLibraries(pkgJson, projectRoot) {
return [
...projectLibraries,
...findExternalLibraries(pkgJson, projectRoot),
...findLibrariesFromReactNativeConfig(projectRoot),
...findLibrariesFromReactNativeConfig(projectRoot, reactNativeConfig),
];
}
}
@@ -128,22 +138,13 @@ function findProjectRootLibraries(pkgJson, projectRoot) {
return extractLibrariesFromJSON(pkgJson, projectRoot);
}
function findLibrariesFromReactNativeConfig(projectRoot) {
const rnConfigFileName = 'react-native.config.js';
function findLibrariesFromReactNativeConfig(projectRoot, rnConfig) {
codegenLog(
`Searching for codegen-enabled libraries in ${rnConfigFileName}`,
`Searching for codegen-enabled libraries in react-native.config.js`,
true,
);
const rnConfigFilePath = path.resolve(projectRoot, rnConfigFileName);
if (!fs.existsSync(rnConfigFilePath)) {
return [];
}
const rnConfig = require(rnConfigFilePath);
if (rnConfig.dependencies == null) {
if (!rnConfig.dependencies) {
return [];
}
return Object.keys(rnConfig.dependencies).flatMap(name => {
@@ -366,6 +367,19 @@ function getLibraryName(library) {
).name;
}
/**
* Finds all disabled libraries by platform based the react native config.
*
* This is needed when selectively disabling libraries in react-native.config.js since codegen should exclude those libraries as well.
*/
function findDisabledLibrariesByPlatform(reactNativeConfig, platform) {
const dependencies = reactNativeConfig.dependencies ?? {};
return Object.keys(dependencies).filter(
dependency => dependencies[dependency].platforms?.[platform] === null,
);
}
module.exports = {
buildCodegenIfNeeded,
pkgJsonIncludesGeneratedCode,
@@ -377,4 +391,6 @@ module.exports = {
findProjectRootLibraries,
extractLibrariesFromJSON,
parseiOSAnnotations,
readReactNativeConfig,
findDisabledLibrariesByPlatform,
};
@@ -0,0 +1 @@
hermes-2025-05-06-RNv0.80.0-4eb6132a5bf0450bf4c6c91987675381d7ac8bca
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/tester",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"private": true,
"description": "React Native tester app.",
"license": "MIT",
@@ -26,9 +26,9 @@
"e2e-test-ios": "./scripts/maestro-test-ios.sh"
},
"dependencies": {
"@react-native/oss-library-example": "0.80.0-main",
"@react-native/new-app-screen": "0.80.0-main",
"@react-native/popup-menu-android": "0.80.0-main",
"@react-native/oss-library-example": "0.80.0-rc.1",
"@react-native/new-app-screen": "0.80.0-rc.1",
"@react-native/popup-menu-android": "0.80.0-rc.1",
"flow-enums-runtime": "^0.0.6",
"invariant": "^2.2.4",
"nullthrows": "^1.1.1"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/typescript-config",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Default TypeScript configuration for React Native apps",
"license": "MIT",
"repository": {
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/virtualized-lists",
"version": "0.80.0-main",
"version": "0.80.0-rc.1",
"description": "Virtualized lists for React Native.",
"license": "MIT",
"repository": {
@@ -21,7 +21,8 @@
},
"exports": {
".": {
"types": "./types_generated/index.d.ts",
"react-native-strict-api": "./types_generated/index.d.ts",
"types": "./index.d.ts",
"default": "./index.js"
},
"./*": {
@@ -0,0 +1,87 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/
const reattachDocComments = require('../reattachDocComments.js');
const {parse, print} = require('hermes-transform');
const prettierOptions = {parser: 'babel'};
async function translate(code: string): Promise<string> {
const parsed = await parse(code);
const result = await reattachDocComments(parsed);
return print(result.ast, result.mutatedCode, prettierOptions);
}
describe('reattachDocComments', () => {
test('should move component doc block', async () => {
const code = `
import Bar from './Bar';
/**
* Foo documentation
*/
let Foo: component(
ref?: React.RefSetter<
React.ElementRef<FooType>,
>,
...props: FooProps
);
export default Foo;
`;
const result = await translate(code);
expect(result).toMatchInlineSnapshot(`
"import Bar from \\"./Bar\\";
let Foo: component(
ref?: React.RefSetter<React.ElementRef<FooType>>,
...props: FooProps
);
/**
* Foo documentation
*/
export default Foo;
"
`);
});
test('should move variable doc block', async () => {
const code = `
const bar = 'bar';
/**
* Foo documentation
*/
const Foo: component(
ref?: React.RefSetter<
React.ElementRef<FooType>,
>,
...props: FooProps
) = () => {};
export default Foo;
`;
const result = await translate(code);
expect(result).toMatchInlineSnapshot(`
"const bar = \\"bar\\";
const Foo: component(
ref?: React.RefSetter<React.ElementRef<FooType>>,
...props: FooProps
) = () => {};
/**
* Foo documentation
*/
export default Foo;
"
`);
});
});
@@ -35,9 +35,9 @@ describe('replaceDefaultExportName', () => {
const code = `export default Foo;`;
const result = await translate(code, 'mock/path/to/module/Foo.js');
expect(result).toMatchInlineSnapshot(`
"declare const Foo_DEFAULT: typeof Foo;
declare type Foo_DEFAULT = typeof Foo_DEFAULT;
export default Foo_DEFAULT;"
"declare const $$Foo: typeof Foo;
declare type $$Foo = typeof $$Foo;
export default $$Foo;"
`);
});
});
@@ -0,0 +1,66 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import type {ExportDefaultDeclaration, Program} from 'hermes-estree/dist';
import type {TransformVisitor} from 'hermes-transform';
import type {ParseResult} from 'hermes-transform/dist/transform/parse';
import type {TransformASTResult} from 'hermes-transform/dist/transform/transformAST';
const {transformAST} = require('hermes-transform/dist/transform/transformAST');
const visitors: TransformVisitor = context => ({
Program(node): void {
const getExportDefaultDeclaration = (
programNode: Program,
): [ExportDefaultDeclaration, string] | null => {
for (const bodyNode of programNode.body) {
if (bodyNode.type === 'ExportDefaultDeclaration') {
if (bodyNode.declaration.type === 'Identifier') {
return [bodyNode, bodyNode.declaration.name];
}
}
}
return null;
};
const exportDefaultDeclResult = getExportDefaultDeclaration(node);
if (exportDefaultDeclResult == null) {
return;
}
const [exportDefaultDecl, exportDefaultDeclName] = exportDefaultDeclResult;
for (const bodyNode of node.body) {
if (bodyNode.type === 'VariableDeclaration') {
for (const decl of bodyNode.declarations) {
if (
decl.id.type === 'Identifier' &&
decl.id.name === exportDefaultDeclName
) {
const comments = context.getComments(bodyNode);
if (comments != null) {
context.addLeadingComments(exportDefaultDecl, comments);
context.removeComments(comments);
}
}
}
}
}
},
});
async function reattachDocComments(
source: ParseResult,
): Promise<TransformASTResult> {
return transformAST(source, visitors);
}
module.exports = reattachDocComments;
@@ -19,7 +19,10 @@ function createReplaceDefaultExportName(filePath: string): PluginObj<mixed> {
const moduleName = fileName.split('.')[0];
if (node.node.name === '$$EXPORT_DEFAULT_DECLARATION$$') {
node.node.name = `${moduleName}_DEFAULT`;
// Prefixing with $$ prevents the TS LSP server from (incorrectly)
// discovering identifiers outside of package.json "exports" in
// autocomplete.
node.node.name = `$$${moduleName}`;
}
},
},
@@ -27,6 +27,7 @@ const preTransforms: Array<PreTransformFn> = [
require('./transforms/replaceEmptyWithNever'),
require('./transforms/replaceStringishWithString'),
require('./transforms/replaceNullablePropertiesWithUndefined'),
require('./transforms/reattachDocComments'),
];
const postTransforms: Array<PluginObj<mixed>> = [];
const prettierOptions = {parser: 'babel'};
@@ -121,6 +121,12 @@ constexpr struct {
"
`;
exports[`updateReactNativeArtifacts should set nightly version: packages/react-native/scripts/codegen/__tests__/__snapshots__/generate-artifacts-executor-test.js.snap 1`] = `
"version = \\"0.81.0-nightly-29282302-abcd1234\\\\
other text
version = \\"0.81.0-nightly-29282302-abcd1234\\\\"
`;
exports[`updateReactNativeArtifacts should set release version: packages/react-native/Libraries/Core/ReactNativeVersion.js 1`] = `
"/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -241,3 +247,9 @@ constexpr struct {
} // namespace facebook::react
"
`;
exports[`updateReactNativeArtifacts should set release version: packages/react-native/scripts/codegen/__tests__/__snapshots__/generate-artifacts-executor-test.js.snap 1`] = `
"version = \\"0.81.0\\\\
other text
version = \\"0.81.0\\\\"
`;
@@ -1,5 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`setVersion updates monorepo for nightly: ../../../../packages/react-native/scripts/codegen/__tests__/__snapshots__/generate-artifacts-executor-test.js.snap 1`] = `"[omitted]"`;
exports[`setVersion updates monorepo for nightly: set-version/package.json 1`] = `
"{
\\"name\\": \\"@react-native/monorepo\\",
@@ -81,6 +83,8 @@ exports[`setVersion updates monorepo for nightly: set-version/packages/react-nat
"
`;
exports[`setVersion updates monorepo for release-candidate: ../../../../packages/react-native/scripts/codegen/__tests__/__snapshots__/generate-artifacts-executor-test.js.snap 1`] = `"[omitted]"`;
exports[`setVersion updates monorepo for release-candidate: set-version/package.json 1`] = `
"{
\\"name\\": \\"@react-native/monorepo\\",
@@ -162,6 +166,8 @@ exports[`setVersion updates monorepo for release-candidate: set-version/packages
"
`;
exports[`setVersion updates monorepo for stable version: ../../../../packages/react-native/scripts/codegen/__tests__/__snapshots__/generate-artifacts-executor-test.js.snap 1`] = `"[omitted]"`;
exports[`setVersion updates monorepo for stable version: set-version/package.json 1`] = `
"{
\\"name\\": \\"@react-native/monorepo\\",
@@ -37,6 +37,20 @@ describe('updateReactNativeArtifacts', () => {
) {
return 'VERSION_NAME=1000.0.0\n';
}
if (
filePath ===
path.join(
REPO_ROOT,
'packages/react-native/scripts/codegen/__tests__/__snapshots__/generate-artifacts-executor-test.js.snap',
)
) {
return `
version = "1000.0.0\\
other text
version = "1000.0.0\\
`;
}
});
});
@@ -79,6 +79,7 @@ async function updateReactNativeArtifacts(
const versionInfo = parseVersion(version, buildType);
await updateSourceFiles(versionInfo);
await updateTestFiles(versionInfo);
await updateGradleFile(versionInfo.version);
}
@@ -116,6 +117,40 @@ function updateSourceFiles(
]);
}
function updateTestFiles(
versionInfo /*: Version */,
) /*: Promise<Array<void>>*/ {
const oldVersion = /"\d+\.\d+\.\d+(-rc\.\d+)?\\/g;
const newVersion = `"${versionInfo.version}\\`;
const snapshotTestPath = path.join(
__dirname,
'..',
'..',
'packages',
'react-native',
'scripts',
'codegen',
'__tests__',
'__snapshots__',
'generate-artifacts-executor-test.js.snap',
);
const promise /*: Promise<void> */ = new Promise(async (resolve, reject) => {
try {
let snapshot = String(await fs.readFile(snapshotTestPath, 'utf8')).trim();
// Replace all occurrences of the old version pattern with the new version
snapshot = snapshot.replaceAll(oldVersion, newVersion);
await fs.writeFile(snapshotTestPath, snapshot, {encoding: 'utf8'});
resolve();
} catch (error) {
reject(error);
}
});
return Promise.all([promise]);
}
async function updateGradleFile(version /*: string */) /*: Promise<void> */ {
const contents = await fs.readFile(GRADLE_FILE_PATH, 'utf-8');