Skip to content

Apply preset defaults without a Babel API - #58254

Closed
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/default-preset-without-babel-api
Closed

Apply preset defaults without a Babel API#58254
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/default-preset-without-babel-api

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary:

The preset's Babel-API accesses are optional, but invoking it without the Babel API still has two incomplete fallback paths: preset() can read properties from an undefined options object, and getPreset(code, {dev: false}) receives no transform profile and silently falls back to legacy class transforms instead of the normal hermes-stable default.

Default options to an empty object, consistently rely on that non-null invariant throughout the configuration builder, and apply hermes-stable when neither explicit options nor babel.caller provides a profile. Explicit options and caller-provided profiles retain precedence.

Changelog:

[GENERAL] [FIXED] - Apply normal preset defaults when invoked without a Babel API or options object.

Test Plan:

  • Added a regression proving preset() builds without options or a Babel API.
  • Added a transform regression proving no-API invocation preserves classes under the default hermes-stable profile; exact baseline lowers the class to helpers.
  • Full preset Jest passes: 4/4 suites, 112/112 tests, 16 snapshots.
  • Fresh Flow check reports 0 errors.
  • Targeted no-ignore ESLint, Prettier, and git diff --check pass.

No breaking change: explicit profiles/caller behavior are unchanged, while standalone invocation now matches the preset's documented default path.

@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 Aug 30, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 31, 2026
@meta-codesync

meta-codesync Bot commented Sep 2, 2026

Copy link
Copy Markdown

@vzaidman has imported this pull request. If you are a Meta employee, you can view this in D118438065.

@meta-codesync meta-codesync Bot closed this in 9ad8c83 Sep 2, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Sep 2, 2026
@meta-codesync

meta-codesync Bot commented Sep 2, 2026

Copy link
Copy Markdown

@vzaidman merged this pull request in 9ad8c83.

@facebook-github-tools

Copy link
Copy Markdown

This pull request has been reverted by 6306c4a.

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. Reverted Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant