Commit Graph

1111 Commits

Author SHA1 Message Date
tarunrajput 849470702f Codegen 118: add throwIfBubblingTypeisNull in error-utils and use it in events (#37191)
Summary:
part of codegen Issue https://github.com/facebook/react-native/issues/34872

> Extract the code that throws if argumentProps are null in a throwIfBubblingTypeisNull function in the error-utils.js file. Use it in the [flow/components/events.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/flow/components/events.js#L244-L246) and in the [typescript/components/event.js](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/components/events.js#L232-L233) files

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal][Changed]: Add throwIfBubblingTypeisNull in error-utils and use it in events

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

Test Plan: `yarn jest react-native-codegen`

Reviewed By: cipolleschi

Differential Revision: D45478073

Pulled By: dmytrorykun

fbshipit-source-id: f70ce3f32d93170cafcea9c8b8c2ba06e760fa37
2023-05-02 09:12:10 -07:00
Pranav Yadav 14316bd635 Add missing READMEs & Update package.json in all RN packages (#37090)
Summary:
This diff adds _missing_ README files for all public RN packages.

#### Changes:
For all public RN packages:
- Add _Missing_ READMEs

Update package.json in all RN packages to add:
- Issues, Bugs urls
- Keywords and Homepage urls to respective pkgs

## Changelog:

[GENERAL][ADDED] - Add missing README files for all public RN packages.
[GENERAL][CHANGED] - Update package.json in all RN packages to add required fields.

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

Test Plan: - `yarn lint && yarn flow && yarn test-ci` --> _should be green_

Reviewed By: cortinico

Differential Revision: D45390861

Pulled By: hoxyq

fbshipit-source-id: 524a92de56a7cb553573d9f54ccf40a998dfd35f
2023-04-28 04:26:20 -07:00
Pranav Yadav a58dea1e9e Update Node.js to v16 in all RN packages (#37073)
Summary:
**NOTE**: This is a **BREAKING** change.
TLDR; Enforce minimum Node.js v16 in all RN packages.

This diff **Updates Node.js to v16** across all RN packages.

#### Context:

- For RN development and new project created; bump to node 16 was in https://github.com/facebook/react-native/pull/36217
- Recently `react-native-windows` also; updated node to v16, https://github.com/microsoft/react-native-windows/pull/11500

#### Changes:

- [BREAKING] Update Node.js to v16 across all RN packages under 'packages/' dir

## Changelog:

[GENERAL][BREAKING] - Update Node.js to v16 in all RN packages

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

Test Plan: - `yarn lint && yarn flow && yarn test-ci` --> _should be green_

Reviewed By: cipolleschi

Differential Revision: D45306108

Pulled By: jacdebug

fbshipit-source-id: e3ba7d0151b86a6a0a3d63fb29c2bd887e1ac1e7
2023-04-26 08:24:06 -07:00
Siddarth Kumar c937162cd5 move extendsForProp into parsers-commons (#37052)
Summary:
[Codegen 94] This PR attempts to extracts the logic of `extendsForProp` function from the following locations :
- `parsers/flow/components/extends.js`
- `parsers/typescript/components/props.js`
since they are the same and move the function to `parsers/parsers-commons.js` as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[Internal] [Changed] - Move `extendsForProp` to parser-commons and update usages.

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

Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: cipolleschi

Differential Revision: D45225880

Pulled By: rshest

fbshipit-source-id: 45199089746d58d9e9494b28040b34c2a0eb31fe
2023-04-26 04:25:54 -07:00
Samuel Susla fc5a7f7567 Remove use of JSI_EXPORT from codegen (#37085)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37085

changelog: [internal]

Props and event emitter does not need to use JSI_EXPORT. Therefore we can remove include of jsi.h as well.

Reviewed By: cortinico, rshest

Differential Revision: D45274824

fbshipit-source-id: dd756258767f787e49d86dc31e18ce581f444362
2023-04-25 12:39:37 -07:00
tarunrajput c65ab4d097 extract throwIfEventHasNoName into error-utils (#37071)
Summary:
Part of Codegen ☂️ Issue: https://github.com/facebook/react-native/issues/34872

> Extract the typeAnnotation doesn't have a name error ([Flow](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/flow/components/events.js#L120-L122); [TypeScript](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/components/events.js#L138-L140)) in throwIfEventHasNoName function which takes a typeAnnotation and a parser as parameters. Use it in place of the if in the above call sites.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Extract throwIfEventHasNoName error from parsers components events in error-utils

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

Test Plan:
`yarn jest react-native-codegen`
<img width="810" alt="image" src="https://user-images.githubusercontent.com/34857453/234091461-67ec4187-1f38-43e0-a4ae-eb3716377665.png">

Reviewed By: cipolleschi

Differential Revision: D45247751

Pulled By: rshest

fbshipit-source-id: ad286bfbb5c9471477981ec26da77a2b0f827732
2023-04-25 04:17:10 -07:00
Pranav Yadav efc6e147f9 merge getExtendsProps & getProps fns - Flow (#36891)
Summary:
[Codegen 102] This PR is subtask of umbrella https://github.com/facebook/react-native/issues/34872. It extracts the code to compute the `extendsProps` and the props properties in Flow in a `getProps() -> {extendsProps, props}` function into the same `index.js` file. This will help unifying the `buildComponentSchema` functions between Flow and TS so we can factor it out in a later step.

## Changelog:

[INTERNAL][CHANGED] - merge `getExtendsProps` & `getProps` fns into `getProps` fn - Flow.

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

Test Plan: - `yarn flow && yarn test react-native-codegen`  --> *should be green.*

Reviewed By: rshest

Differential Revision: D45044653

Pulled By: cipolleschi

fbshipit-source-id: 9fcdaef60dfbc3332d880b19c6e575d948d21986
2023-04-24 10:46:21 -07:00
Nicola Corti 50553f4e81 Re-sync repo after ShipIt change - Removal of BUCK files (#36955) 2023-04-19 12:12:04 +01:00
Genki Kondo b68f53d44f Support events with mixed payloads in codegen (#36942)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36942

Changelog:
[General][Changed] - Support mixed props for events in codegen

Reviewed By: javache

Differential Revision: D44580879

fbshipit-source-id: 52f3b12795af767c038e2db7a4faf46cf2906b95
2023-04-18 13:35:45 -07:00
gabrieldonadel e962d43233 chore: Extract logic to compute codegen TS extendsProps and props in getProps function (#36889)
Summary:
[Codegen 103] This PR extracts the logic to compute the `extendsProps` and `props` properties in TypeScript Codegen in a `getProps()` function as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[Internal] [Added] - Extract logic to compute codegen TS `extendsProps` and `props` properties in a single `getProps` function

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

Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: rshest

Differential Revision: D44952664

Pulled By: cipolleschi

fbshipit-source-id: fd51f0b8767efbb0071b6391e0852c19b5a984c6
2023-04-14 04:40:49 -07:00
Nicola Corti 3b4037e379 Cleanup the IS_OSS_BUILD logic from Buck files (#36899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36899

We don't need this logic anymore as `IS_OSS_BUILD` is always false.

Changelog:
[Internal] [Changed] - Cleanup the `IS_OSS_BUILD` logic from Buck files

Reviewed By: cipolleschi

Differential Revision: D44958368

fbshipit-source-id: 1b56758879fcd7193417c5b04a819a9d72a7f1f7
2023-04-14 00:49:36 -07:00
Christoph Purrer 95dabeb53c code-gen: Enable opt-in to mobile dependencies when building for Apple Catalyst (#36851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36851

Changelog:
[Internal]

Differential Revision: D44795138

fbshipit-source-id: 4d667531a50d41b8da8146be3c0a9b8854eb6bd1
2023-04-07 12:46:03 -07:00
Shawn Dempsey 247a913af0 Refactor react native codegen to export macOS specific deps (#36805)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36805

**Changelog:** Export macOS specific dependencies for react-native-codgen

[Internal][Changed] - RN macOS uses an older version of React Native (0.68) so we need to specify macOS specific dependencies when running codegen for RN Desktop

Reviewed By: christophpurrer

Differential Revision: D44687704

fbshipit-source-id: 9dcabc88d4abf17845db0844c952f1cb4a13e3ad
2023-04-06 17:37:53 -07:00
Zihan Chen (MSFT) 9bb71650c9 Add @react-native/codegen-typescript-test to verify .d.ts files in @react-native/codegen (1) (#36562)
Summary:
- Add a typescript project to test `CodegenSchema.d.ts`. More tests for other .d.ts files will be added in future pull requests.
- The build script scans all snapshots from `react-native/codegen`'s typescript frontend and generates .ts files for each snapshot, but they are .gitignore-ed.
- `npm run build` will build these .ts files against `CodegenSchema.d.ts` after generating them.
- A failed jest case is included to ensure CI catch it, it will be removed before merged.

bypass-github-export-checks

## Changelog:

[General] [Added] - Add react-native/codegen-typescript-test to verify .d.ts files in react-native/codegen (1)

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

Test Plan:
`npm run build` in `packages/react-native-codegen-typescript-test` and see all test files appear in `__generated__`.

## Screenshot

![Untitled](https://user-images.githubusercontent.com/53799235/226757755-cab4cb29-7d22-46a1-9ecb-d6732122ed38.png)

Reviewed By: rshest

Differential Revision: D44292277

Pulled By: cipolleschi

fbshipit-source-id: 8d79fe913f9563d64c92aae7c4f4e97a24ae9a21
2023-04-05 07:38:25 -07:00
Antoine Doubovetzky 8fbcfcea8d Extract throwIfConfigNotfound and throwIfMoreThanOneConfig from findComponentConfig function (#36719)
Summary:
This PR contains tasks 96 and 97 from https://github.com/facebook/react-native/issues/34872:

>[Codegen 96 - assigned to AntoineDoubovetzky] Create a throwIfConfigNotfound in the error-utils.js file and extract the error code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L61-L63) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L62-L64)
 [Codegen 97 - assigned to AntoineDoubovetzky] Create a throwIfMoreThanOneConfig in the error-utils.js file and extract the error code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L64-L66) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L65-L67)

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - Extract throwIfConfigNotfound and throwIfMoreThanOneConfig from findComponentConfig function

bypass-github-export-checks

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D44539681

Pulled By: cipolleschi

fbshipit-source-id: c778ad1620d1c3f60b10c25c51efcb11173b3037
2023-04-05 06:55:47 -07:00
Ruslan Lesiutin 8a18b53bcd bump packages for 0.73 (#36556)
Summary:
Changelog: [Internal]

Publishing to check CI if bumping and aligning in the same commit will work, since these new versions are not available on npm yet, but maybe our new monorepo setup will resolve this

**Adding back `react-native/virtualized-lists` as a workspace to `xplat/js` so that it won't be resolved from npm**

#publish-packages-to-npm

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

Reviewed By: cipolleschi

Differential Revision: D44255353

Pulled By: hoxyq

fbshipit-source-id: 21372487d6e9c0b2382b7cd9af835beed46b8ce1
2023-03-30 15:55:58 -07:00
gabrieldonadel 66ae98e4a4 chore: Expand Codegen emitCommonTypes function adding the remaining basic types (#36706)
Summary:
[Codegen 81] This PR expands the  `emitCommonTypes` function adding support for the remaining basic types and adding
a `convertKeywordToTypeannotation` function to the codegen Parser class and implementing it in the Flow and TypeScript parsers as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[Internal] [Added] - Expand Codegen emitCommonTypes function adding the remaining basic types

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

Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: christophpurrer

Differential Revision: D44504571

Pulled By: cipolleschi

fbshipit-source-id: 220d9bc0cc39614002a67dafd626e5a4878a1447
2023-03-30 03:46:47 -07:00
Phillip Pan a4fe9b2b6d deprecate ReactModuleWithSpec (#36673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36673

Changelog: [Android][Deprecated]

in this change, we deprecate ReactModuleWithSpec because it can be replaced with the TurboModule interface which better describes our generated modules.

Reviewed By: cortinico

Differential Revision: D44450959

fbshipit-source-id: adab192593843926f35bdbeb346ef374dd80e615
2023-03-29 12:06:52 -07:00
Kyaw Thura 969a8d0799 Enrich getCommandProperties with the parser object (#36500)
Summary:
> [Codegen 101] The code of getCommandProperties is almost identical in [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L128) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L129). There are small differences between flow/ts, so we need for it to accept a Parser object. Enrich the parser object with the required methods if necessary.

## Changelog:

[Internal] [Changed] - Enrich getCommandProperties with the parser object

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

Test Plan: `yarn test react-native-codegen`

Reviewed By: cortinico

Differential Revision: D44415265

Pulled By: cipolleschi

fbshipit-source-id: ed13b553a6f782beb0f1aec79bd17d865a96fac9
2023-03-29 09:28:00 -07:00
MaeIg 5ff01bc1d2 Extract getCommandTypeNameAndOptionsExpression from component folders into parsers-common (#36640)
Summary:
This PR aims to remove the duplicated logic in [flow|typescript]/components/index.js files to move it in parsers-commons. It is a task of https://github.com/facebook/react-native/issues/34872:
> [Codegen 98 - assigned to MaeIg] Extract the namedExports.map(statement => ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L76-L108), [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L77-L109)) function in parser-commons, so that it accept a Parser parameter to unify the behaviors between flow and typescript. The Parser object needs to be enriched with all the methods to extract the required information from the Node, if they are not there yet.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Extract getCommandTypeNameAndOptionsExpression from component folders into parsers-common

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

Test Plan:
yarn flow:
<img width="151" alt="image" src="https://user-images.githubusercontent.com/40902940/227719831-1a67f588-3bb2-48d7-8a43-4c5c8972155e.png">

yarn lint:
<img width="499" alt="image" src="https://user-images.githubusercontent.com/40902940/227719839-e5b591c3-9f3a-4da4-b3a5-67275c58584f.png">

yarn test
<img width="389" alt="image" src="https://user-images.githubusercontent.com/40902940/227719849-f3adfc4a-9215-4b1a-8807-c01801c54628.png">

Reviewed By: cipolleschi

Differential Revision: D44416032

Pulled By: rshest

fbshipit-source-id: eb682834d3da7a89661612667d9fc1df99ff3df0
2023-03-27 06:59:04 -07:00
Pieter De Baets 3759a26214 Avoid property name conflicts in event-emitter codegen (#36591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36591

If any of the properties used in event-emitter codegen conflict with `event` or `payload`, the generated code will fail to build, even if this generated code isn't used. Since these are quite common keys, prefix them with `$` (still valid C++) to avoid conflicts.

Changelog: [General][Fixed] Resolved property name conflicts in event-emitter codegen

Reviewed By: cipolleschi

Differential Revision: D44274619

fbshipit-source-id: 45e67850c49e082d8f9b1f85bb632d45a9fd4f1d
2023-03-23 09:05:16 -07:00
Pieter De Baets 0a8164d993 Fix off-by-one error in cxx codegen (#36574)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36574

We would previously generate the following codegen for optional args

```
return static_cast<NativeAudioModuleCxxSpecJSI *>(&turboModule)->playAudio(
    rt,
    args[0].asString(rt),
    args[1].isNull() || args[1].isUndefined() ? std::nullopt : std::make_optional(args[1].asString(rt)),
    args[2].isNull() || args[2].isUndefined() ? std::nullopt : std::make_optional(args[2].asString(rt)),
    args[3].asNumber(),
    count < 4 || args[4].isNull() || args[4].isUndefined() ? std::nullopt : std::make_optional(args[4].asObject(rt)),
    count < 5 || args[5].isNull() || args[5].isUndefined() ? std::nullopt : std::make_optional(args[5].asObject(rt)),
    count < 6 || args[6].isNull() || args[6].isUndefined() ? std::nullopt : std::make_optional(args[6].asBool())
);
```

However, the counts checked are off-by-one, causing us to incorrectly process args.

Changelog: [General][Fixed] Issue with TurboModule C++ codegen with optional args

Differential Revision: D44299193

fbshipit-source-id: f00b9f5e09c2f524f9393137346c256d8b6b2979
2023-03-22 16:57:40 -07:00
Kyaw Thura 4a15f90208 Convert the emitCommonTypes implementation from a switch based implementation to a dictionary based one (#36549)
Summary:
Task from https://github.com/facebook/react-native/issues/34872
> [Codegen 80] Convert the emitCommonTypes implementation from a switch based implementation to a dictionary based one

## Changelog:

[Internal] [Changed] - Convert the emitCommonTypes implementation from a switch based implementation to a dictionary based one

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

Test Plan: `yarn test react-native-codegen`

Reviewed By: NickGerleman

Differential Revision: D44244901

Pulled By: rshest

fbshipit-source-id: 50712724c72aad3bd1dae3e7c381242c4913a236
2023-03-22 13:51:39 -07:00
Tarun Chauhan 221aacd72d Move getCommandOptions and getOptions to parsers commons (#36413)
Summary:
> [Codegen 92] The getCommandOptions function in parsers/typescript/components/options.js and parsers/flow/components/options.js is the same. move it in parser-commons and use it in the original files. If the file two options.js files are empty, delete them.

> [Codegen 93] The getOptions function in parsers/typescript/components/options.js and parsers/flow/components/options.js is the same. move it in parser-commons and use it in the original files. If the file two options.js files are empty, delete them.

Part of Issue https://github.com/facebook/react-native/issues/34872

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal][Changed] - Move getCommandOptions and getOptions to parsers commons from parsers components options

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

Test Plan: `yarn jest react-native-codegen`

Reviewed By: rshest

Differential Revision: D43957023

Pulled By: cipolleschi

fbshipit-source-id: 4f8bf6f8fe69b20d0fb976afee7da244ef634e12
2023-03-20 07:32:14 -07:00
Pranav Yadav 2f25261b88 Merge TS & Flow parsers' logic for Partial case to emitPartial fn & commonTypes cases into emitCommonTypes fn (#36450)
Summary:
> [Codegen 78 - Assigned to Pranav-yadav] It depends on [Codegen 75][Codegen 76][Codegen 77] Extract the logic that emits Partial values in an emitPartial function, which takes the Parsers as parameter.

>[Codegen 79 - Assigned to Pranav-yadav] It depends on [Codegen 78] Extract the basic cases logics (case Stringish, case Int32, case Double, ..., case Partial. `Flow` lines and `TypeScript` lines into a function emitCommonTypes in `parsers-primitives.js`. Make sure that the default case returns `null`. Call this function in the default: case `Flow`, `TypeScript` of the `index.js` file: if the function return something, return that from the default case; otherwise if the `emitCommonTypes` returns `null`, keep the current default implementation (throw the error).

### Changes

- merged TS & Flow parsers' logic for `Partial` case to `emitPatial` fn
- merged TS & Flow parsers' logic for below cases:
  - `Stringish`
  - `Int32`
  - `Double`
  - `Float`
  - `UnsafeObject`
  - `Object`
  - `Partial`
- into an `emitCommonTypes` fn into `parsers-primitives.js`
- add **_tests_** for `emitPartial` and `emitCommonTypes` fn's
- add `getAnnotatedElementProperties` fn to parser & impl to both TS & Flow parsers

## Changelog:

[INTERNAL] [CHANGED] - Merge TS & Flow parsers' logic for `Partial` case to `emitPatial` fn & `commonTypes` cases into `emitCommonTypes` fn

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

Test Plan: - `yarn lint && yarn run flow && yarn jest react-native` ⇒ �

Reviewed By: rshest

Differential Revision: D44132308

Pulled By: cipolleschi

fbshipit-source-id: f965e85ecc5d94e57ad85334ce565a55c512fde4
2023-03-20 07:32:14 -07:00
Genki Kondo 0ae5e50e37 Support mixed props for components
Summary:
Changelog:
[Changed][General] - Support mixed props for components in codegen

Reviewed By: rickhanlonii

Differential Revision: D43894460

fbshipit-source-id: e5faf2f83e6829170cdce550e923c3c09ddff0b0
2023-03-19 16:47:22 -07:00
Ruslan Lesiutin 714b502b0c | RN Monorepo | Migrate to package (#36434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36434

Changelog: [Internal]

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

allow-large-files

Reviewed By: cortinico

Differential Revision: D43977381

fbshipit-source-id: 0da552ddb85f2f61a0be0ef071915b35f3f8555c
2023-03-17 05:03:25 -07:00
Pranav Yadav c0a46c696b Merge defaultExports.forEach(statement => ... (Flow, TS) to findNativeComponentType fn in parser-commons.js (#36466)
Summary:
>[Codegen 95] Extract the `defaultExports.forEach(statement =>` (Flow, TS) function in `parser-commons`, so that it accept a Parser parameter to unify the behaviors between flow and typescript. The Parser object needs to be enriched with all the methods to extract the required information from the Node, if they are not there yet.

### Changes

- merged TS & Flow parsers' logic for `defaultExports.forEach(statement =>` of `/components/index.js:findComponentConfig()` into;
- `findNativeComponentType` fn to `parsers-commons.js`
- add `getTypeArgumentParamsFromDeclaration` & `getNativeComponentType` fn's
- add **_tests_** for getTypeArgumentParamsFromDeclaration & `getNativeComponentType` fn's

## Changelog

[INTERNAL] [CHANGED] - Merge `defaultExports.forEach(statement => ...` (Flow, TS) to `findNativeComponentType` fn in `parser-commons.js`

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

Test Plan: - `yarn lint && yarn run flow && yarn jest react-native` ⇒ �

Reviewed By: rshest

Differential Revision: D44088862

Pulled By: cipolleschi

fbshipit-source-id: 91bf0edcd53b2e054160af34d7c128355c178b26
2023-03-16 09:47:31 -07:00
yux-m 94f505ba2b Extract inner switch case 'TSTypereference' to function translateTypeReferenceAnnotation() (#36463)
Summary:
> [Codegen 91] Extract the inner switch in typescript/modules/index.js at line to parse the case TSTypereference ([lines](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L194-L275))into a function translateTypeReferenceAnnotation() (the goal is to try and get a simpler switch statement and to spot structural similiarities between the flow and typescript index.js files)

Part of Issue https://github.com/facebook/react-native/issues/34872

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [CHANGED] - Extract inner switch case 'TSTypereference' to function translateTypeReferenceAnnotation().

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

Test Plan:
- yarn lint
- yarn run flow
- yarn test react-native-codegen

Reviewed By: cortinico

Differential Revision: D44027755

Pulled By: cipolleschi

fbshipit-source-id: b32d6adc56fcd0e1b42c255b16828b2306941d57
2023-03-16 09:47:31 -07:00
Gabriel Tomitsuka dc2cbed07c Improve error messages for invalid function types in react-native-codegen (#36498)
Summary:
The supported `CodegenTypes` aren't provided in the docs, which leads to many issues for developers working to transition native components to support Fabric.
However, explicit error messages are provided in many cases (e.g., to use specific numeric types instead of `number` attributes or to remove nested optionals in arrays).
This isn't the case for the common use case of TypeScript functions, which are very commonly used for event handlers in native components (such as `onChange`), forcing devs to search their way through the `react-native` codebase until they find [this file](https://github.com/facebook/react-native/blob/681d7f8113d2b5e9d6966255ee6c72b50a7d488a/Libraries/Types/CodegenTypes.js#L18).

By providing an explicit error message, we can significantly improve developer experience for those working to transition libraries/components, leading to higher Fabric adoption.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[GENERAL] [ADDED] - Create explicit error message for TypeScript functions used as props in Codegen components, redirecting devs to the supported function types `BubblingEventHandler` and `DirectEventHandler`.

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

Test Plan:
* `yarn run lint` shows no errors
* no impact on `yarn && yarn jest react-native-codegen`, which failed 362 tests before and after my changes.

Reviewed By: cipolleschi, sshic

Differential Revision: D44132960

Pulled By: dmytrorykun

fbshipit-source-id: d805ec8403613bf4e070cbd2904ff5a2648ec5fc
2023-03-16 08:17:45 -07:00
Zihan Chen (MSFT) ac5aec3f5c Add minimum necessary .d.ts files to react-native-codegen (2) (#36397)
Summary:
- Add .d.ts files for generators
- export each generators because `react-native-windows` need its own selection of generators.

## Changelog

[GENERAL] [CHANGED] - Add minimum necessary .d.ts files to react-native-codegen (2)

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

Test Plan:
`npm run build` in `packages/react-native-codegen` and see all .d.ts files appear in `lib`.
Checked .d.ts file in typescript playground.

Reviewed By: rshest

Differential Revision: D43941811

Pulled By: cipolleschi

fbshipit-source-id: 28f5bd56f27531ecf25223620a580358018b779d
2023-03-16 03:32:27 -07:00
George Zahariev 7fee407564 Update React Native codegen to support Partial as alias of $Partial
Summary:
`Partial` is the new name of `$Partial`

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D43993220

fbshipit-source-id: 38e8a6bcfa559857b2ab88efee6b904b387bdc0d
2023-03-15 12:13:36 -07:00
MaeIg 26b22a6827 Remove hardcoded language from modules/index.js (#36435)
Summary:
This PR aims to remove the hardcoded language constants to use common parser instead. It is a task of https://github.com/facebook/react-native/issues/34872:
> [Codegen 89 - Assigned to MaeIg] Remove the const language variable from flow/modules/index.js and replace its usage with parser.language()
> [Codegen 90 - Assigned to MaeIg] Remove the const language variable from typescript/modules/index.js and replace its usage with parser.language()

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Remove hardcoded language from modules/index.js to use common parser instead

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

Test Plan:
yarn flow:
<img width="145" alt="image" src="https://user-images.githubusercontent.com/40902940/224333480-600cefd0-9dc6-4142-8e88-db20785e49e6.png">

yarn lint:
<img width="504" alt="image" src="https://user-images.githubusercontent.com/40902940/224333852-d510594f-053e-4866-8ceb-5e3e3d074bc2.png">

yarn test
<img width="383" alt="image" src="https://user-images.githubusercontent.com/40902940/224333600-8c772829-2362-4943-895d-1949a0d88918.png">

Reviewed By: cortinico

Differential Revision: D43979030

Pulled By: cipolleschi

fbshipit-source-id: 39c5b99fc628620f1831ed8c4ee531eec0e866c4
2023-03-15 07:14:26 -07:00
Tarun Chauhan d9f2cbe455 extract Visitor to parsers primitives (#36459)
Summary:
Part of Codegen Issue https://github.com/facebook/react-native/issues/34872
> [Codegen 88] Move the Visitor.js file from parsers/flow/Visitor.js to parser-promitives.js. Copy the TSInterfaceDeclaration(node: $FlowFixMe) function and add it to the Visitor.js just copied. Remove the parsers/typescript/Visitor.js. Make sure we use the same Visitor in both parsers. (We will end up with a Visitor that is the union of the two, being able to handle both Flow and TS. In this specific case, this trade-off make sense as it allows us to remove one file, several duplicated lines for a small price.)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal][Changed] - Extract Visitor function to parsers primitives and remove both parsers visitor files

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

Test Plan:
```
yarn jest
yarn flow
yarn lint
yarn format-check
```

Reviewed By: cortinico

Differential Revision: D44021825

Pulled By: cipolleschi

fbshipit-source-id: ea465404830402c44081143ee0539107dc75776c
2023-03-15 07:14:26 -07:00
Tarun Chauhan 347d6f8d89 Extract throwIfMoreThanOneCodegenNativecommands error in error-utils (#36407)
Summary:
Part of Codegen Umbrella Issue: https://github.com/facebook/react-native/issues/34872
> [Codegen 99] Extract the throwIfMoreThanOneCodegenNativecommands error in the error-utils.js file and extract the error code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L111-L133) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L112-L114)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Extract throwIfMoreThanOneCodegenNativecommands error in error-utils

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

Test Plan: `yarn jest react-native-codegen`

Reviewed By: christophpurrer

Differential Revision: D43912403

Pulled By: cipolleschi

fbshipit-source-id: 1c51fc01465a1baa5f06ccea09c3342584bb82cc
2023-03-15 07:14:26 -07:00
gabrieldonadel 43986e8c72 chore: Add functionTypeAnnotation to codegen Parser class (#36468)
Summary:
This PR adds a  `functionTypeAnnotation`  function to the codegen Parser class and implements it in the Flow and TypeScript parsers as requested on https://github.com/facebook/react-native/issues/34872, refactoring the `throwIfModuleTypeIsUnsupported`  function to accept a `Parser` instead of a `ParserType` and use the newly created function instead of the `if (language)` logic.

## Changelog

[Internal] [Added] - Add `functionTypeAnnotation` to codegen Parser class

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

Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

![image](https://user-images.githubusercontent.com/11707729/224882017-2c31f326-047d-4c21-91e0-3396203ce1c5.png)

Reviewed By: cipolleschi

Differential Revision: D44056853

Pulled By: rshest

fbshipit-source-id: f22b9efe53df16f7916eb1a9cea8b9531f1194f5
2023-03-15 05:44:57 -07:00
Marco Caldera 320e51f4c4 Unify findComponentConfig return statement (#36446)
Summary:
> [Codegen 100] Create a createComponentConfig function in the parser-commons.js file. It takes the foundConfig and the commandTypeNames as parameters and returns the component config object. Extract the return statements ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L115-L126) [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L116-L127)) and use those implementations in that function.

Part of Issue https://github.com/facebook/react-native/issues/34872

In case I should already add better typing I can update the PR while clarifying the type definitions.

## Changelog

[INTERNAL] [CHANGED] - Move the return statement of `findComponentConfig` to `parsers-commons.js` merging Flow and TS implementation.

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

Test Plan: `yarn lint && yarn run flow && yarn test react-native-codegen`

Reviewed By: cortinico

Differential Revision: D44005899

Pulled By: rshest

fbshipit-source-id: 19a4a05476156cbc2d824c9c32a7909c06a382ff
2023-03-14 05:30:39 -07:00
Tarun Chauhan 3cd97e4994 extract buildModuleSchema to parsers-commons (#36330)
Summary:
> Extract the buildModuleSchema function ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L571), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L584))in the parsers-commons.js function. The two functions are almost identical except for the filter(property =>) at the end of the function, which is different based on the language.

Part of Codegen Issue https://github.com/facebook/react-native/issues/34872
Depends on Codegen 74, Codegen 84.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [CHANGED] - Extract buildModuleSchema from Flow and TypeScript parsers modules to parsers-commons

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

Test Plan:
`yarn lint && yarn run flow && yarn test react-native-codegen
`

Reviewed By: christophpurrer

Differential Revision: D43833653

Pulled By: cipolleschi

fbshipit-source-id: 4d67cb5ef746ecd7ace4b91eb30d36e96252e779
2023-03-10 07:58:32 -08:00
Nick Gerleman 7858a2147f Enforce compatibility with exactOptionalPropertyTypes (#36345)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36345

`exactOptionalPropertyTypes` is a TypeScript 4.4+ option set by users which changes behavior of optional properties, to disable accepting explicit `undefined`.

This is not enabled when using `--strict`, and is stricter than Flow, leading to most of the typings having an `| undefined` unique to TypeScript (added with https://github.com/DefinitelyTyped/DefinitelyTyped/commit/694c663a9486dbe7794d5eb894a691ee9ded318a).

We have not always followed this (I have myself previously assumed the two are equivalent). We can enforce that the convention is followed with a plugin `eslint-plugin-redundant-undefined`. This forces us to declare that every optional property accepts an explicit undefined (which Flow would allow). Alternatively, if we do not want to support this, we can enable the existing dtslint rule `no-redundant-undefined`.

Changelog:
[General][Fixed] - Enforce compatibility with `exactOptionalPropertyTypes`

Reviewed By: lunaleaps

Differential Revision: D43700862

fbshipit-source-id: 996094762b28918177521a9471d868ba87f0f263
2023-03-08 00:14:56 -08:00
MaeIg a448c6d80f Extract the functions to compute partial properties in the Flow and TypeScript parsers. (#36373)
Summary:
This PR aims to extract  the switch(configType) block from the buildSchema function into a separate function in a shared file between typescript and flow. It is a task of https://github.com/facebook/react-native/issues/34872:
> [Codegen 77 - assigned to MaeIg] Extract the functions to compute partial properties from the index.js file ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L180-L194) and [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L261-L278))in the Flow and TypeScript parsers.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Extract the functions to compute partial properties in the Flow and TypeScript parsers.

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

Test Plan:
yarn flow:
<img width="560" alt="image" src="https://user-images.githubusercontent.com/40902940/222934040-97e88691-c1d6-44a1-b7ee-e500b4698cd2.png">

yarn lint:
<img width="509" alt="image" src="https://user-images.githubusercontent.com/40902940/222934137-05b6f1fd-a755-4323-baac-5954d36fd613.png">

yarn test
<img width="388" alt="image" src="https://user-images.githubusercontent.com/40902940/222934145-76a2bc38-7469-4c30-9301-bc21cfadded4.png">

Reviewed By: cipolleschi

Differential Revision: D43867937

Pulled By: rshest

fbshipit-source-id: f78fe399ff7d7d2cf8f44d1165418566b0a25628
2023-03-07 03:15:52 -08:00
Marshall Roch b044ece594 presuppress Flow v0.201 errors
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D43720099

fbshipit-source-id: 6931548c90deb82cfc7e3d8173ccfc6aa7f0e1c8
2023-03-02 08:43:56 -08:00
Pranav Yadav 05454fa866 Merge Parse-Module-Name anon fn of Flow & TS parsers' (#36297)
Summary:
Part of Umbrella https://github.com/facebook/react-native/issues/34872
> [**Codegen 84** - assigned to Pranav-yadav] It depends on [Codegen 83] export the parseModuleName anonymous function (Flow, TypeScript) in a common parseModuleName function in the parsers-commons.js file.

- merged Parse Module-Name _**anon**_ fn of `Flow` & `TS` parsers; into a common `parseModuleName` fn in the `parsers-commons.js`
- added **tests** for `parseModuleName` fn from `parsers-commons.js`
- added `callExpressionTypeParameters` method to **_parsers_**
- added **tests** for `callExpressionTypeParameters` method of _parsers_
- used `parser.callExpressionTypeParameters` method in `parseModuleName` fn

PS: fixed merge conflicts several times :(

Overall :)

## Changelog

[INTERNAL] [CHANGED] - Merge Parse-Module-Name anon fn of `Flow` & `TS` and add `callExpressionTypeParameters` method to **_parsers_**

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

Test Plan: - `yarn lint && yarn run flow && yarn test react-native-codegen`  ==> 

Reviewed By: rshest

Differential Revision: D43694563

Pulled By: cipolleschi

fbshipit-source-id: 99cf40ada0a567cd9ff91078f66fd4ac3684f7cc
2023-03-02 08:28:49 -08:00
Nicola Corti b0863e1239 Bumping all the changes we have on main (#36355)
Summary:
This will publish several changes we have pending on main, specifically changes to React Native Gradle Plugin which are needed to unblock nightlies.

#publish-packages-to-npm

## Changelog

[INTERNAL] - Bumping all the changes we have on main

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

Test Plan: n/a

Reviewed By: hoxyq

Differential Revision: D43733634

Pulled By: cortinico

fbshipit-source-id: 9c041f7557cd8e494dfc942ae89e13e55353bb48
2023-03-02 07:11:43 -08:00
Antoine Doubovetzky f23f7f4c0f Replace getTypes functions with parser specific methods (#36225)
Summary:
This PR is task 74 from https://github.com/facebook/react-native/issues/34872:
> Move getTypes functions from utils.js to specific Parsers. Right now we have two Parser classes that takes care of the language specific details and two utils files that contains similar logic. We would like to move everything under the Parsers classes for better OOP architecture and to encourage code-reuse.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - Replace getTypes functions with parser specific methods

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D43453454

Pulled By: cipolleschi

fbshipit-source-id: 0eebcb55e1af3319e2c35bb462980046329a2c09
2023-03-01 06:13:57 -08:00
gabrieldonadel 5ff8895c27 chore: Create Codegen throwIfPartialWithMoreParameter function (#36300)
Summary:
This PR creates a Codegen `throwIfPartialWithMoreParameter` function and extracts the error-emitting code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L165-L169) and [Typescript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L246-L250) index files as requested on https://github.com/facebook/react-native/issues/34872. This also adds unit tests to the new function.

## Changelog

[Internal] [Changed]  - Create codegen `throwIfPartialWithMoreParameter` function and extract the `error-emitting` code from Flow and Typescript index files.

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

Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green
![image](https://user-images.githubusercontent.com/11707729/221445922-b2c21ad2-012e-4266-9456-6c781b0de7f0.png)

Reviewed By: cipolleschi

Differential Revision: D43616254

Pulled By: rshest

fbshipit-source-id: 4742aec56598be6bac895809b96d0879c37fcfe1
2023-02-27 03:24:55 -08:00
Tarun Chauhan 371e263847 create throwIfPartialNotAnnotatingTypeParameter and add extractAnnotatedElement method in parsers (#36272)
Summary:
> Create a throwIfPartialNotAnnotatingTypeParameter function in the error-utils.js file and extract the error-emitting code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L174-L178) and [Typescript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L252-L259) index files. Notice that the way in which the annotatedElement is computed is different, therefore we should add an extractAnnotatedElement function to the Flow and TypeScript parsers.

Part of the Codegen ☂️ Issue https://github.com/facebook/react-native/issues/34872

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - create throwIfPartialNotAnnotatingTypeParameter and add extractAnnotatedElement method in parsers

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

Test Plan: `yarn jest react-native-codegen`

Reviewed By: cipolleschi

Differential Revision: D43564134

Pulled By: rshest

fbshipit-source-id: 89a6567340a560d7b6c353cfff8a43e2dd0f76cc
2023-02-24 08:00:20 -08:00
Pranav Yadav 13628203ab Merge Flow and TS Parsers' IncorrectModuleRegistryCallArgumentTypeParserError error-emitting code (#36252)
Summary:
> [Codegen 83 - assigned to Pranav-yadav] Create a function throwIfIncorrectModuleRegistryCallArgumnent function in the errors.js file and factor together the code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L407-L415) and [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L513-L521). Update the Parsers to return the right Literl type

Merged `Flow` and `TS` Parsers' `IncorrectModuleRegistryCallArgumentTypeParserError` error-emitting code

- into `throwIfIncorrectModuleRegistryCallArgument` fun in `error-utils.js`

## Changelog

[INTERNAL] [CHANGED] -  Merge `Flow` and `TS` Parsers' `IncorrectModuleRegistryCallArgumentTypeParserError` error-emitting code

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

Test Plan: - `yarn test`

Reviewed By: rshest

Differential Revision: D43502843

Pulled By: cipolleschi

fbshipit-source-id: eb63b40d433f90134a80c02c8f750257c82104a3
2023-02-24 02:56:34 -08:00
Kyaw Thura 85245af880 Move isModuleInterface function (Flow, TypeScript) to the Flow and TypeScript parsers. (#36268)
Summary:
Task from https://github.com/facebook/react-native/issues/34872

> [Codegen 82] Move isModuleInterface function (Flow, TypeScript) to the Flow and TypeScript parsers.

## Changelog

[INTERNAL] [CHANGED] - Moved isModuleInterface function to to the Flow and TypeScript parsers.

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

Test Plan: ` yarn test react-native-codegen`

Reviewed By: christophpurrer

Differential Revision: D43535948

Pulled By: rshest

fbshipit-source-id: 7a2db05008783499168b0ce3fa58fedbac2b4e79
2023-02-23 13:20:05 -08:00
Tarun Chauhan 8be9dbfcc1 consolidate parsers component schema to common root (#36219)
Summary:
> [Codegen 85] The parses/flow/components/schema.js and parses/typescript/components/schema.js are the same. Move the schema.js from the one of the two folders to the parsers common root. Delete the other. Update the references to use the shared file.

Part of the Codegen ☂️ Issue https://github.com/facebook/react-native/issues/34872

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Consolidated the schema.js files for parses/flow/components and parses/typescript/components to a common root.

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

Test Plan: Run ```yarn jest react-native-codegen```

Reviewed By: christophpurrer

Differential Revision: D43444666

Pulled By: cipolleschi

fbshipit-source-id: 24d791fd3a8110730d3f6054497ea3a31549a5a5
2023-02-21 03:46:38 -08:00
Nicola Corti e42dd1593d bump package versions (#36184)
Summary:
We do have a lot of changes on `main` to ship to nightlies. This change bump all the packages with pending changes.

## Changelog

[INTERNAL] [CHANGED] - [ci][monorepo] bump package versions

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

Test Plan: Will rely on CI run.

Reviewed By: hoxyq

Differential Revision: D43363981

Pulled By: cortinico

fbshipit-source-id: eba5152dbe007eb3fad43f9088d145b3741fd94e
2023-02-17 06:19:37 -08:00