Skip to content

Lower property escapes without removing Unicode flags (#59633) - #59633

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
andrewdacenko:export-D128332799
Oct 30, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
andrewdacenko:export-D128332799

Conversation

@andrewdacenko

@andrewdacenko andrewdacenko commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Why

Hermes builds can support Unicode regex mode without enabling Unicode property escapes. Leaving property escapes in the generated code then causes invalid-escape compilation errors. Lowering the entire Unicode regex instead also removes code-point semantics, which can make a valid astral letter match the surrogate category.

What

The stable and canary presets expand Unicode property escapes in regex literals while retaining the Unicode flag. Ordinary Unicode regexes, class syntax and other profile options stay intact. Other profiles retain their existing transforms. Matching maps are generated normally from the transformed AST; no profile or source-map subtarget is changed.

How

Select Babel's property-escape transform using its default Unicode-flag mode for the Hermes V1 profiles, declare its direct dependency and regenerate the preset expectations. Regression tests exercise the actual transformer and Metro's source-map consumer, including astral letters, property complements, emoji, Unicode categories, normalization and the original position of a call after an expanded regex.

Changelog:
[General][Fixed] - Retain Unicode regex semantics while lowering property escapes for Hermes builds

Reviewed By: javache

Differential Revision: D128332799

@meta-cla meta-cla 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 Oct 29, 2026
@meta-codesync

meta-codesync Bot commented Oct 29, 2026

Copy link
Copy Markdown

@andrewdacenko has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128332799.

@javache javache left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@javache javache left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

Summary:

## Why

Hermes builds can support Unicode regex mode without enabling Unicode property escapes. Leaving property escapes in the generated code then causes invalid-escape compilation errors. Lowering the entire Unicode regex instead also removes code-point semantics, which can make a valid astral letter match the surrogate category.

## What

The stable and canary presets expand Unicode property escapes in regex literals while retaining the Unicode flag. Ordinary Unicode regexes, class syntax and other profile options stay intact. Other profiles retain their existing transforms. Matching maps are generated normally from the transformed AST; no profile or source-map subtarget is changed.

## How

Select Babel's property-escape transform using its default Unicode-flag mode for the Hermes V1 profiles, declare its direct dependency and regenerate the preset expectations. Regression tests exercise the actual transformer and Metro's source-map consumer, including astral letters, property complements, emoji, Unicode categories, normalization and the original position of a call after an expanded regex.

Changelog:
[General][Fixed] - Retain Unicode regex semantics while lowering property escapes for Hermes builds

Reviewed By: javache

Differential Revision: D128332799
@meta-codesync meta-codesync Bot changed the title Lower property escapes without removing Unicode flags Lower property escapes without removing Unicode flags (#59633) Oct 30, 2026
@meta-codesync
meta-codesync Bot merged commit 6e22123 into react:main Oct 30, 2026
96 of 97 checks passed
@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 30, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @andrewdacenko in 6e22123

When will my fix make it into a release? | How to file a pick request?

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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants