Skip to content

[Codegen 84] Merge Parse-Module-Name anon fn of Flow & TS parsers'#36297

Closed
Pranav-yadav wants to merge 7 commits intofacebook:mainfrom
Pranav-yadav:codegen-84-parseModuleName
Closed

[Codegen 84] Merge Parse-Module-Name anon fn of Flow & TS parsers'#36297
Pranav-yadav wants to merge 7 commits intofacebook:mainfrom
Pranav-yadav:codegen-84-parseModuleName

Conversation

@Pranav-yadav
Copy link
Copy Markdown
Contributor

@Pranav-yadav Pranav-yadav commented Feb 26, 2023

Summary

Part of Umbrella #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

Test Plan

  • yarn lint && yarn run flow && yarn test react-native-codegen ==> ✅

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 26, 2023
Comment thread packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js Outdated
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Feb 26, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,477,095 +0
android hermes armeabi-v7a 7,799,079 +0
android hermes x86 8,953,089 +0
android hermes x86_64 8,810,587 +0
android jsc arm64-v8a 9,108,176 +0
android jsc armeabi-v7a 8,304,844 +0
android jsc x86 9,159,032 +0
android jsc x86_64 9,418,319 +0

Base commit: a49446b
Branch: main

Copy link
Copy Markdown
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pranav-yadav, thank you so much and great job!

I left a couple of comments that should be addressed before merging this PR.

Thank you again for the work you are putting into this!

Comment thread packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js Outdated
Comment thread packages/react-native-codegen/src/parsers/parsers-commons.js Outdated
Copy link
Copy Markdown
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the commented test (see my comment for the why). I'll import and merge the PR.

Thank you for this work!

Comment thread packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js Outdated
@Pranav-yadav
Copy link
Copy Markdown
Contributor Author

Let's remove the commented test (see my comment for the why). I'll import and merge the PR.
Thank you for this work!

aaah... Exactly... I've spent hours debugging it (the generated ASTs 😞) and going through the base test cases but they couldn't help as they use fake manually created ASTs and not the actual one created by parser. PS: was going to add counter for "hours wasted here :(", jk

Thanks. I'll rm that test.

Copy link
Copy Markdown
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for taking care of this!

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@Pranav-yadav
Copy link
Copy Markdown
Contributor Author

Pranav-yadav commented Mar 1, 2023

I see conflicts again... :(

Rebasing quickly to fix :)
Edit: rebased and fixed

@cipolleschi

- into a common `parseModuleName` fun in the `parsers-commons.js`
- in `parsers-commons-test.js`
- related to: [Codegen 84]
…ror` in `parseModuleName` fn

- reason: The problem here is that;

```flow
export default TurboModuleRegistry.getEnforcing('SampleTurboModule');
```

this result in an `UntypedModuleRegistryCallParserError`, because it is "not generic".

The problem is that, to get a type for it, it "must" be a generic.
I can't think of any other way for `getEnforcing` to be typed with a different type rather than generic. 🤔

I don't think there is a way to create a valid Flow code which is typed with something that is not a generic.
I looked at the base test for that throw and they are manually creating an AST that satisfy that requirement,
but that AST probably can't be actually generated. 🤔

-- @cipolleschi
@Pranav-yadav Pranav-yadav force-pushed the codegen-84-parseModuleName branch from aa19750 to 2b6a831 Compare March 1, 2023 16:40
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 2, 2023
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi merged this pull request in 05454fa.

@Pranav-yadav Pranav-yadav deleted the codegen-84-parseModuleName branch March 2, 2023 17:04
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 17, 2026
…ow (facebook#36297)

Summary:
## Summary

PR facebook#36285 deleted the Paper (legacy) renderer, including the shim file
`scripts/rollup/shims/react-native/ReactNative.js`. However, the
`runtime_commit_artifacts` workflow still tries to `rm` this file after
moving build artifacts into `compiled-rn/`. Since the file no longer
exists in the build output, `rm` (without `-f`) fails and kills the
entire step.

This has caused **every run of the Commit Artifacts workflow to fail
since facebook#36285 landed on April 16**, blocking both `builds/facebook-www`
and `builds/facebook-fbsource` branches from receiving new build
artifacts. This in turn blocks DiffTrain from syncing React changes into
Meta's internal monorepo.

DiffTrain build for [bf45a68dd35ed08860b6a70fed641dfe6d7d290d](facebook/react@bf45a68)

Reviewed By: zeyap

Differential Revision: D101329586
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 17, 2026
…ow (facebook#36297) (facebook#56483)

Summary:

## Summary

PR facebook#36285 deleted the Paper (legacy) renderer, including the shim file
`scripts/rollup/shims/react-native/ReactNative.js`. However, the
`runtime_commit_artifacts` workflow still tries to `rm` this file after
moving build artifacts into `compiled-rn/`. Since the file no longer
exists in the build output, `rm` (without `-f`) fails and kills the
entire step.

This has caused **every run of the Commit Artifacts workflow to fail
since facebook#36285 landed on April 16**, blocking both `builds/facebook-www`
and `builds/facebook-fbsource` branches from receiving new build
artifacts. This in turn blocks DiffTrain from syncing React changes into
Meta's internal monorepo.

DiffTrain build for [bf45a68dd35ed08860b6a70fed641dfe6d7d290d](facebook/react@bf45a68)

Reviewed By: zeyap

Differential Revision: D101329586
meta-codesync Bot pushed a commit that referenced this pull request Apr 17, 2026
…ow (#36297) (#56483)

Summary:
Pull Request resolved: #56483

## Summary

PR #36285 deleted the Paper (legacy) renderer, including the shim file
`scripts/rollup/shims/react-native/ReactNative.js`. However, the
`runtime_commit_artifacts` workflow still tries to `rm` this file after
moving build artifacts into `compiled-rn/`. Since the file no longer
exists in the build output, `rm` (without `-f`) fails and kills the
entire step.

This has caused **every run of the Commit Artifacts workflow to fail
since #36285 landed on April 16**, blocking both `builds/facebook-www`
and `builds/facebook-fbsource` branches from receiving new build
artifacts. This in turn blocks DiffTrain from syncing React changes into
Meta's internal monorepo.

DiffTrain build for [bf45a68dd35ed08860b6a70fed641dfe6d7d290d](facebook/react@bf45a68)

Reviewed By: zeyap

Differential Revision: D101329586

fbshipit-source-id: d38877d5cc964c46257cb73678f80d0a7c729d90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants