Skip to content

perf: Use lighter traversal for jsx __source,__self#17555

Merged
nicolo-ribaudo merged 3 commits intobabel:mainfrom
liuxingbaoyu:perf-__source
Oct 24, 2025
Merged

perf: Use lighter traversal for jsx __source,__self#17555
nicolo-ribaudo merged 3 commits intobabel:mainfrom
liuxingbaoyu:perf-__source

Conversation

@liuxingbaoyu
Copy link
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@liuxingbaoyu liuxingbaoyu changed the title perf: Use lighter traversal for jsx perf: Use lighter traversal for jsx __source,__self Oct 22, 2025
@babel-bot
Copy link
Collaborator

babel-bot commented Oct 22, 2025

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/60110

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 22, 2025

Open in StackBlitz

commit: 951b058

ObjectExpression,
Program,
} from "@babel/types";
import { traverse } from "@babel/types";
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Since we already imported types from @babel/core, can we use t.traverse or t.traverseFast instead?

@liuxingbaoyu liuxingbaoyu added area: jsx PR: Performance 🏃‍♀️ A type of pull request used for our changelog categories labels Oct 23, 2025
Comment on lines +316 to +320
return template.expression.ast`{
fileName: ${fileNameIdentifier},
lineNumber: ${fileLineLiteral},
columnNumber: ${fileColumnLiteral},
}`;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: could you indent this? :)

@nicolo-ribaudo nicolo-ribaudo merged commit c84daa0 into babel:main Oct 24, 2025
74 checks passed
if (!t.isJSXOpeningElement(node)) {
return;
}
set.add(node);
Copy link
Contributor

Choose a reason for hiding this comment

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

The node was added to a set here but we are missing the set.has(node) usage.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Feb 20, 2026
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: jsx outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Performance 🏃‍♀️ A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants