Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiler][patch] Fix jsx non-ascii regex pattern #30382

Merged
merged 7 commits into from
Jul 18, 2024

Conversation

Copy link

vercel bot commented Jul 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2024 7:42pm

mofeiZ added a commit that referenced this pull request Jul 18, 2024
ghstack-source-id: 1312951393065d04f5569c877e110c925a0252f0
Pull Request resolved: #30382
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jul 18, 2024
@react-sizebot
Copy link

react-sizebot commented Jul 18, 2024

Comparing: 512b09b...f1f0aaf

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 499.44 kB 499.44 kB = 89.59 kB 89.59 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 504.26 kB 504.26 kB = 90.30 kB 90.30 kB
facebook-www/ReactDOM-prod.classic.js = 599.20 kB 599.20 kB = 105.79 kB 105.79 kB
facebook-www/ReactDOM-prod.modern.js = 573.37 kB 573.37 kB = 101.68 kB 101.68 kB
test_utils/ReactAllWarnings.js Deleted 64.07 kB 0.00 kB Deleted 15.86 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 64.07 kB 0.00 kB Deleted 15.86 kB 0.00 kB

Generated by 🚫 dangerJS against f1f0aaf

## Error

```
Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer"
Copy link
Contributor Author

@mofeiZ mofeiZ Jul 18, 2024

Choose a reason for hiding this comment

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

This error is not caught and handled by Forget as it occurs in babel-plugin-fbt. Going to go back to hack in a check in MemoizeFbtAndMacroOperandsInSameScope for now, but ideally we would have some type / annotation on Identifier instances to know which strings are fbt operands

EDIT: moved this fixture to #30386

mofeiZ added a commit that referenced this pull request Jul 18, 2024
ghstack-source-id: 19aa7901306dc2b6e8e67a4782677a92256a9476
Pull Request resolved: #30382
mofeiZ added a commit that referenced this pull request Jul 18, 2024
ghstack-source-id: e0668730759801f9c80baa30c193a8b8251f7e79
Pull Request resolved: #30382
mofeiZ added a commit that referenced this pull request Jul 18, 2024
ghstack-source-id: 19aa7901306dc2b6e8e67a4782677a92256a9476
Pull Request resolved: #30382
@@ -2206,7 +2206,7 @@ function codegenInstructionValue(
* https://en.wikipedia.org/wiki/List_of_Unicode_characters#Control_codes
*/
const STRING_REQUIRES_EXPR_CONTAINER_PATTERN =
/[\u{0000}-\u{001F}|\u{007F}|\u{0080}-\u{FFFF}]|"/u;
/[\u{0000}-\u{001F}\u{007F}\u{0080}-\u{FFFF}]|"/u;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, we were matching | literals

Copy link
Member

Choose a reason for hiding this comment

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

I can't recall why we needed to escape the u{..., does it work without them?

Copy link
Contributor Author

@mofeiZ mofeiZ Jul 18, 2024

Choose a reason for hiding this comment

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

According to the docs, 1 and 2, I think \u{HHHH} and \uHHHH both work

@mofeiZ mofeiZ marked this pull request as ready for review July 18, 2024 18:39
@@ -2206,7 +2206,7 @@ function codegenInstructionValue(
* https://en.wikipedia.org/wiki/List_of_Unicode_characters#Control_codes
*/
const STRING_REQUIRES_EXPR_CONTAINER_PATTERN =
/[\u{0000}-\u{001F}|\u{007F}|\u{0080}-\u{FFFF}]|"/u;
/[\u{0000}-\u{001F}\u{007F}\u{0080}-\u{FFFF}]|"/u;
Copy link
Member

Choose a reason for hiding this comment

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

I can't recall why we needed to escape the u{..., does it work without them?

@mofeiZ mofeiZ merged commit f1f0aaf into gh/mofeiZ/10/base Jul 18, 2024
24 checks passed
mofeiZ added a commit that referenced this pull request Jul 18, 2024
ghstack-source-id: 97ed49112453c2ca3165361e758b6f31fbd0da20
Pull Request resolved: #30382
@mofeiZ mofeiZ deleted the gh/mofeiZ/10/head branch July 18, 2024 20:18
felixshiftellecon added a commit to felixshiftellecon/react that referenced this pull request Jul 24, 2024
ghstack-source-id: 97ed49112453c2ca3165361e758b6f31fbd0da20
Pull Request resolved: facebook#30382
felixshiftellecon added a commit to felixshiftellecon/react that referenced this pull request Jul 24, 2024
ghstack-source-id: 97ed49112453c2ca3165361e758b6f31fbd0da20
Pull Request resolved: facebook#30382
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants