mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2168e9415 | ||
|
|
79e2298230 | ||
|
|
619a0db17f | ||
|
|
241b1a6462 | ||
|
|
e8b14c7b06 | ||
|
|
8b8e1055ae | ||
|
|
cdf7d76101 | ||
|
|
1c22a46cf6 | ||
|
|
7ce8f12549 | ||
|
|
ce4d7e5d52 | ||
|
|
d5c6afaae0 | ||
|
|
f70a146699 | ||
|
|
d9c2857e59 | ||
|
|
cbf1710fd5 |
@@ -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}}');
|
||||
|
||||
@@ -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
@@ -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,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": {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,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,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",
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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,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": {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,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,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,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,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,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,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": "*",
|
||||
|
||||
+6
@@ -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>,
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
+3
-3
@@ -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 we’re 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 we’re presumably in.
|
||||
@@ -503,4 +503,4 @@ SCRIPT
|
||||
|
||||
end
|
||||
"
|
||||
`;
|
||||
`;
|
||||
+21
-2
@@ -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,
|
||||
|
||||
+30
-14
@@ -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
|
||||
+307
-315
File diff suppressed because it is too large
Load Diff
@@ -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,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": {
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user