Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57752
## Rationale
Flow lib defs that declare global types (available anywhere, without an `import`) must be referenced in `.flowconfig` and can't be maintained incrementally. That's not too bad for very stable APIs and it's necessary for environment/runtime globals, but for 3P libraries it makes the lib defs much more difficult to maintain for little benefit (we have to import the runtime APIs anyway). Secondarily, it's a problem for generating TypeScript types, as TS doesn't declare any 3P library globally.
Babel is one of few cases where a library declares Flow globals - every one has an importable equivalent.
## This diff
Replaces usages of Babel global types across xplat/js with their `babel/types` equivalents
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D113574665
fbshipit-source-id: be668d968345a60e76a3515d19d8eaa002d53274
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57596
The original implementation used `NSMutableData` for both directions of the
JSI<->ObjC ArrayBuffer conversion. That is the wrong contract on the argument
(JS -> ObjC/Native) side: an inbound buffer is owned by the caller, not the
native module, and `NSMutableData` must own a resizable backing store it can
`realloc`/`free`, so it cannot durably alias a foreign buffer.
This diff keeps `NSMutableData` for the ObjC/Native -> JS (return) path, but
switches the JS -> ObjC/Native (argument) path to the immutable `NSData`:
- Codegen: `getParamObjCType` now maps `ArrayBufferTypeAnnotation` params to
`NSData *` (return type stays `NSMutableData *`).
- Runtime: `convertJSIArrayBufferToNSMutableData` is renamed to
`convertJSIArrayBufferToNSData` and returns an immutable `NSData`. The bytes
are still eagerly copied, which keeps the result safe to retain, store, or
dispatch to another thread regardless of whether the source bytes were owned
by JS or by a native `MutableBuffer`.
- Updated the ObjC unit tests and the codegen `GenerateModuleHObjCpp` snapshot.
Changelog: [INTERNAL]
Reviewed By: javache
Differential Revision: D112582384
fbshipit-source-id: 8ed2dfb3f23e7f39677dfb1824c5530f378705bc
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57611
Directly follows D112733139 (Metro).
**Motivation**
- New Node builtins are *only* available under the prefix (e.g. `node:sqlite`), as this allows Node to introduce them without ecosystem-breaking changes, so this is the direction of travel and the only choice that'll allow consistency.
- Encouraging them and grouping them separately makes it easier to reason about a module's 3rd party dependencies.
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D112803684
fbshipit-source-id: 40668d746a7151b3aa4800ff8af997902a18d198
Summary:
Adds ArrayBuffer support to ObjC TurboModules, following the C++ ArrayBuffer PR ([`226ef2e`](https://github.com/facebook/react-native/commit/226ef2e7c5d1928d5696dc23efc1b8950ba00e37)).
- Codegen support for `ArrayBufferTypeAnnotation` in ObjC module specs (`NSMutableData *` params/returns, new `ArrayBufferKind`)
- JSI↔ObjC conversion wraps native-backed buffers zero-copy via `-[NSMutableData initWithBytesNoCopy:length:deallocator:]`; the deallocator retains the backing store so the bytes stay valid even if the `NSMutableData` escapes the call or the source ArrayBuffer is garbage-collected
- JS-backed buffers are copied, which is safe on both the synchronous and asynchronous paths
This PR is iOS-only; Android support follows in a separate PR.
## Changelog:
[IOS] [ADDED] - Add ArrayBuffer support to ObjC TurboModules
X-link: https://github.com/facebook/react-native/pull/56986
Reviewed By: javache
Differential Revision: D106846249
Pulled By: christophpurrer
fbshipit-source-id: 3393d5d6f31a1412f5d52328c90e51205aa6b153
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57034
With D107165685, it should work this time.
Changelog: [Internal]
Reviewed By: gkz
Differential Revision: D107111468
fbshipit-source-id: 326b2911088d7c87c3564a578125eeaab9d0b8cc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56998
Reverts the recent Flow syntax codemods applied across `packages/`, `private/`, and `scripts/` in react-native-github. Specifically restores the previous form for:
- `+T` / `+Instance` style variance annotations on generic type parameters that had been converted to the newer `out T` / `in T` keyword form.
- `+field:` covariant object/interface properties that had been converted to the `readonly field:` modifier form.
- `+[K in keyof T]:` mapped-type covariance that had been converted to `readonly [K in keyof T]:`.
These are purely Flow type-annotation changes with no runtime behavior impact, restoring the form that the rest of the toolchain (in particular Fantom) already supports.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D106813102
fbshipit-source-id: 6bf915d530e130eba9c9d96a2b6c3dc8853594d1
Summary:
Adds `ArrayBuffer` support to C++ TurboModules. This includes:
- Codegen support for `ArrayBufferTypeAnnotation` in module specs
- `AsyncArrayBuffer` — a move-only bridging type for holding ArrayBuffer data off the JS thread
- `Bridging<AsyncArrayBuffer>::toJs` for resolving promises with native-backed or owned-bytes buffers
iOS and Android support will follow in separate PRs. The new codegen type is currently restricted to C++ TurboModules via `excludedPlatforms: ['iOS', 'android']`.
## Changelog:
[GENERAL] [ADDED] - Add `ArrayBuffer` support to C++ TurboModules
Pull Request resolved: https://github.com/facebook/react-native/pull/56729
Test Plan:
- JS parser/generators tests added.
- New bridging unit tests in `BridgingTest.cpp` cover `AsyncArrayBuffer` construction and JS bridging.
- `rn-tester`: `getArrayBuffer`, `processAsyncBuffer`, and `getAsyncBuffer` methods added to `NativeCxxModuleExample` in demo app.
```
[chpurrer@54913.od /data/sandcastle/boxes/fbsource (a00a9a84e7)]$ buck test //xplat/js/react-native-github/packages/react-native/ReactCommon/react/bridging:tests
↷ Skip: fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/react/bridging:tests - BridgingTest.asyncArrayBufferBorrowNativeBackedTest (0.0s)
Note: Google Test filter = BridgingTest.asyncArrayBufferBorrowNativeBackedTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from BridgingTest
[ RUN ] BridgingTest.asyncArrayBufferBorrowNativeBackedTest
xplat/js/react-native-github/packages/react-native/ReactCommon/react/bridging/tests/BridgingTest.cpp:865: Skipped
Runtime does not expose tryGetMutableBuffer; borrow always throws
[ SKIPPED ] BridgingTest.asyncArrayBufferBorrowNativeBackedTest (7 ms)
[----------] 1 test from BridgingTest (7 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (7 ms total)
[ PASSED ] 0 tests.
[ SKIPPED ] 1 test, listed below:
[ SKIPPED ] BridgingTest.asyncArrayBufferBorrowNativeBackedTest
Buck UI: https://www.internalfb.com/buck2/4a7fa180-4ce6-4dcf-b685-45d183bd4091
Test UI: https://www.internalfb.com/intern/testinfra/testrun/30680772470375729
Network: Up: 0B Down: 0B (reSessionID-9a7e839f-b20c-4d94-944f-8d1720e694f8)
Command: test.
Time elapsed: 3.0s
Buck UI: https://www.internalfb.com/buck2/4a7fa180-4ce6-4dcf-b685-45d183bd4091
Tests finished: Pass 31. Fail 0. Timeout 0. Fatal 0. Skip 1. Omit 0. Infra Failure 0. Build failure 0
[chpurrer@54913.od /data/sandcastle/boxes/fbsource (a00a9a84e7)]$
```
## RNTester-ios
```
buck install -r rntester-ios
```
https://pxl.cl/9TgTf
Reviewed By: javache
Differential Revision: D105629442
Pulled By: christophpurrer
fbshipit-source-id: 91f6e3d16f69ba792469e02d6e539794e70b7101
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56489
C++ enums cannot have float values - they must be int or long. This removes the invalid FloatEnum example (with values 0.0, 0.1, 0.2) from the react-native-codegen test fixtures and the corresponding enumFloat parameter reference. All affected test snapshots have been regenerated.
Changelog: [Internal]
Reviewed By: shwanton
Differential Revision: D101433764
fbshipit-source-id: eff21d3fa9c48ab11dfb8ef861ac0b8122ff5602
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56258
According to my understanding, the codegen already outputs the modern casting syntax. Only these fixtures are stuck on the old syntax. This diff fixes them all.
Changelog: [Internal]
Reviewed By: gkz
Differential Revision: D98537137
fbshipit-source-id: 0d4a19e8eeece771881ed793ec994da25297de50
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56049
Reduce duplication and inconsistency across codegen generators by centralizing reserved primitive type mappings into a single `ReservedPrimitiveTypes.js` registry, making future type support and fixes a single-source change and lowering bug risk.
Additionally, standardize identifier capitalization via a shared `toSafeIdentifier` helper in `Utils.js` to prevent divergent string handling across C++/Java helpers.
Also removes dead TODO comments and obsolete commented-out code from `RNCodegen.js`, `GenerateModuleH.js`, and parser files.
Changelog: [Internal]
Reviewed By: alanleedev
Differential Revision: D95711348
fbshipit-source-id: 3f541f91f8dcc21e8e8b75cf2f0e402807d18f8a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56050
Removes ~75 lines of duplicated `toObjCType` logic between `serializeConstantsStruct.js` and `serializeRegularStruct.js` by extracting it into a new shared module `serializeStructUtils.js`. The two implementations were identical except for array wrapper types (`std::vector` vs `facebook::react::LazyVector`) and type alias suffixes (`::Builder` vs none), which are now handled via a `structContext` parameter that distinguishes between `CONSTANTS` and `REGULAR` contexts.
Changelog: [internal]
Reviewed By: philIip
Differential Revision: D95908134
fbshipit-source-id: c511958c40bf62fd970036f40f6575d8150c32df
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56051
When parsing custom struct types in RN TurboModule flow specs for C++ (cxxOnly) codegen, the `getObjectTypeAnnotations` function in `parsers-commons.js` silently dropped types wrapped in `$ReadOnly<{...}>` or `Readonly<{...}>`.
The root cause: `parser.nextNodeForTypeAlias(value)` returns the raw right-hand side of a type alias. For `export type Foo = Readonly<{...}>`, this returns a `GenericTypeAnnotation` node (the `Readonly<...>` wrapper), not an `ObjectTypeAnnotation`. The existing guard check (`parent.type !== 'ObjectTypeAnnotation'`) then rejects the type, causing it to be silently skipped from the alias map.
The fix unwraps `$ReadOnly`/`Readonly` `GenericTypeAnnotation` wrappers (Flow) and `Readonly` `TSTypeReference` wrappers (TypeScript) before performing the type check, then obtains properties directly from the unwrapped node.
Also updates `NativeCxxModuleExample.js` to use `Readonly<{...}>` on `ConstantsStruct` as a demonstration and build-time validation of the fix.
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D96044884
fbshipit-source-id: 811ecb878ce573a2250b9e8ac54345bac42c7e07
Summary:
This PR fixes simple typos found in error messages:
- **apple.js**: Fixed "boostrap" -> "bootstrap" in error messages (lines 67, 169)
- **CppHelpers.js**: Fixed "informations" -> "information" in error messages (lines 75, 87, 101)
Note: "information" is an uncountable noun in English and should not be pluralized.
Changelog:
[Internal] [Changed] -
Pull Request resolved: https://github.com/facebook/react-native/pull/55849
Test Plan: These are typo fixes in error message strings. No code behavior changes.
Reviewed By: cipolleschi
Differential Revision: D94905006
Pulled By: cortinico
fbshipit-source-id: a6a7185cf3aeb8739212a06115100ede097b0b4c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55676
Change `GenerateViewConfigJs.js` to emit `require('.../ReactNativeStyleAttributes').colorAttribute` for `ColorPrimitive` props instead of the inline `{process: require('.../processColor').default}`. This ensures generated ViewConfigs use the same gated attribute as handwritten ones.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D94052698
fbshipit-source-id: aa4821364062807b0ae862379d236a2f458c9c53
Summary:
I was upgrading bare react native project to expo sdk 54 and stumbled upon
```
"TurboModule system assumes returnType == void iff the method is synchronous."
```
error from `turbomodule/core/TurboModuleInteropUtils.kt`
I thought that `iff` with double `f` was a typo and wanted to submit a pr with fix - I learned that it means `if and only if` - decided to scan the repo for any other typos anywany - submitting the ones that I've found.
## Changelog:
[Internal]
<!-- 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
Pull Request resolved: https://github.com/facebook/react-native/pull/55651
Reviewed By: cipolleschi
Differential Revision: D93876470
Pulled By: cortinico
fbshipit-source-id: 43fc905bda14e77b27cdeda568bde1e2299d9d0f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55484
This change adds content validation to ensure module names only contain safe identifier characters (alphanumeric and underscores, matching `^[a-zA-Z_][a-zA-Z0-9_]*$`). A new error class `IncorrectModuleRegistryCallArgumentValueParserError` provides a clear error message when an unsafe module name is detected.
Changelog: [Android][Fixed] - Validate module names in codegen
Reviewed By: CalixTang
Differential Revision: D92736956
fbshipit-source-id: 29b2c603bf97f9a2c30c8350d29b468d315765f0
Summary:
Changelog: [Internal] support flow 'unknown' syntax
Pull Request resolved: https://github.com/facebook/react-native/pull/54941
`buck build --flagfile fbcode//mode/opt fbcode//cathode/modules/react/lib/tests:app_delegate_test` crashed with
```javascript
Buck build failed for this target, and is likely caused by your changes.
Error message:
[New Failure] Target failed to build.
Action failed: fbsource//xplat/js/RKJSModules/Libraries/CathodeMessaging:FBReactNativeCathodeMessagingSpec-flow-types-ota-safety (cfg:opt-linux-x86_64-fbcode-platform010-clang19-no-san#3224936a2623a72b) (genrule)
Remote command returned non-zero exit code 1
Remote action, reproduce with: `frecli cas download-action 0c073e461a3ae239aa7e24c8a99b39543d365414405d1be1caa2196d7f55a18e:148`
Stdout: <empty>
Stderr:
UnsupportedGenericParserError: Module NativeCathodeMessagingModuleCxx: Unrecognized generic type 'unknown' in NativeModule spec.
at translateTypeAnnotation (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/flow/modules/index.js:154:23)
at /re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:343:7
at guard (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/utils.js:50:14)
at translateFunctionTypeAnnotation (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:334:25)
at emitFunction (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-primitives.js:149:3)
at translateTypeAnnotation (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/flow/modules/index.js:236:16)
at /re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:343:7
at guard (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/utils.js:50:14)
at translateFunctionTypeAnnotation (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:334:25)
at buildPropertySchema (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:461:5)
at /re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:845:16
at guard (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/utils.js:50:14)
at /re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:825:12
at Array.map (<anonymous>)
at buildModuleSchema (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:811:3)
at /re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:583:9
at guard (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/utils.js:50:14)
at buildSchemaFromConfigType (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:582:24)
at buildSchema (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/parsers-commons.js:648:10)
at FlowParser.parseString (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/react-native/codegen/src/parsers/flow/parser.js:131:12)
at getSchemasForFiles (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/fb-tools/flow-schema/schema/getSchemasForFiles.js:101:51)
at TypegenSchemaBuilder.addHackyInputsForReactNativeOnly (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/fb-tools/flow-schema/schema/TypegenSchema.js:94:5)
at createTypegenSchema (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/fb-tools/flow-schema/commands/ota-safety.js:158:42)
at Object.handler (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/fb-tools/flow-schema/commands/ota-safety.js:222:25)
at /re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/yargs/build/index.cjs:1:8993
at j (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/yargs/build/index.cjs:1:4956)
at _.handleValidationAndGetResult (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/yargs/build/index.cjs:1:8962)
at _.applyMiddlewareAndGetResult (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/yargs/build/index.cjs:1:9604)
at _.runCommand (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/yargs/build/index.cjs:1:7231)
at [runYargsParserAndExecuteCommands] (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/yargs/build/index.cjs:1:58544)
at te.parse (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/node_modules/yargs/build/index.cjs:1:40483)
at run (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/fb-tools/flow-schema/index.js:22:3)
at Object.<anonymous> (/re_cwd/buck-out/v2/gen/fbsource/xplat/js/tools/flow-schema/__flow-schema__bin_build__/0a63598ffadb2c1e/out/flow-schema__bin_build.zip/fb-tools/flow-schema/index.js:42:1)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
at Object.run (/re_cwd/buck-out/v2/gen/fbsource/xplat/third-party/node/node-zip/__module__/84c2dad32661840d/out/run.js:202:10)
at Object.<anonymous> (/re_cwd/buck-out/v2/gen/fbsource/xplat/third-party/node/node-zip/__module__/84c2dad32661840d/out/run.js:210:11)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24) {
nodes: [
{
type: 'GenericTypeAnnotation',
loc: [Object],
id: [Object],
typeParameters: null,
range: [Array]
}
]
}
```
Fixing it in this diff
Reviewed By: SamChou19815
Differential Revision: D89519620
fbshipit-source-id: 5adcc305e9a7c2277122ccf3f446e0e5488fedae
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54925
The lint is triggered in D89415612. Not sure what those file do but it seems a good fix
Changelog: [General][Added] Support parsing `Readonly` for the new Flow utility types
Reviewed By: SamChou19815
Differential Revision: D89418629
fbshipit-source-id: 34a2776711155dbd52046d55af18104e2eb32322
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54924
The lint is triggered in D89415612. Not sure what those file do but it seems a good fix
Changelog: [General][Added] Support parsing `ReadonlyArray` for the new Flow utility types
Reviewed By: SamChou19815
Differential Revision: D89418033
fbshipit-source-id: ef227b344a693ec47dea86bbf34e0af17bad25fd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54919
Add a new `ResultT` to codegen and some C++ trickery so that `ModuleConstants<Type::Builder>` is equal to ModuleConstants<Type> and existing overrides of the module spec remain compatible.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D89373357
fbshipit-source-id: ac192e99e424a829668722722cf0c374172de48b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54718
The cast in `constantsToExport` is unnecessary if we actually use the right type here, without the `Builder` suffix.
Not a breaking change, since Objective-C seemingly doesn't enforce these parameter constraints.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D87980865
fbshipit-source-id: c9052e219fdf44d012583fcaa94b10b7c189b510
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54726
Add support for generating native optional object properties for custom types. This also updates the serialization of the custom type instances to only include properties that are defined on the object.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D87843979
fbshipit-source-id: c99179d7b48df62e836ab66dfad99f0723516af7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54724
Add support to codegen to generate native optional props for component properties that are defined as optional and have no default value.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D87843978
fbshipit-source-id: 9ad7436e2d518364b80b0e00ab7ec47eff476acd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54489
Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing `StringLiteralUnionTypeAnnotation`.
Changelog: [Internal]
**NOTE:** In case this needs to be reverted for any breakage to OTA Compat Checker v2, consider disabling it with D88289605 instead of reverting this change.
Reviewed By: RSNara
Differential Revision: D86501597
fbshipit-source-id: 6ea0d42c27f8f6b40fa607e7b671e599f25a94bc
Summary:
This replaces `glob@^7.0.0` with `tinyglobby@^0.2.15`. `glob@7` has been deprecated for a while and some versions after had security notices released for them. The plan is to backport this PR to `0.81.x` and onwards.
> [!NOTE]
> This is a stopgap solution until `fs.glob` becomes generally available with the EOL of Node v20
Succeeds:
- https://github.com/facebook/react-native/issues/54669
- https://github.com/facebook/react-native/issues/48875
## Changelog:
[GENERAL] [SECURITY] - Replace `glob@^7.0.0` with `tinyglobby@^0.2.15`
Pull Request resolved: https://github.com/facebook/react-native/pull/54737
Test Plan:
- Ran all modified commands manually and `pod install in `rn-tester`
- NOTE: `ios-prebuild`-related scripts haven't been run manually yet
Reviewed By: robhogan
Differential Revision: D88069145
Pulled By: huntie
fbshipit-source-id: 0c455342a4c6d1d6605fd09fe47b418e5d751491
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54590
Introduce `BooleanLiteralTypeAnnotation` in Flow & TypeScript to match the existing `StringLiteralTypeAnnotation` & `NumberLiteralTypeAnnotation` since Unions will be supporting Booleans along with String & Number
Changelog: [Internal]
Reviewed By: elicwhite
Differential Revision: D87384473
fbshipit-source-id: 6b8265914c7884ac99ae69e8992bc9dc6a9e52bc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54587
Adding the generic type T UnionTypeAnnotation. This will be used later to create Unions of types String, Number & Boolean.
Changelog: [Internal]
Reviewed By: elicwhite
Differential Revision: D87374445
fbshipit-source-id: 7844f969111af14e42d2b57891e4c0935a0dce53
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54586
Adding NumberTypeAnnotation to the Codegen Schema in order to obtain parity with String & Boolean which will be the Union types
Changelog: [Internal]
Reviewed By: elicwhite
Differential Revision: D87374063
fbshipit-source-id: aa17f13736075ea753b078e0f9ee3c0d24eec534