Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Transform logic to extract signal debug names #57348

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

Conversation

AleksanderBodurri
Copy link
Member

@AleksanderBodurri AleksanderBodurri commented Aug 12, 2024

Implements a compiler transform that attempts to statically analyze variable names and apply them to usages of signal functions like signal, computed, effect, etc as debug names.

Related: #57074

Depends on: #57073

@AleksanderBodurri AleksanderBodurri added state: blocked area: compiler Issues related to `ngc`, Angular's template compiler labels Aug 12, 2024
@ngbot ngbot bot modified the milestone: Backlog Aug 12, 2024
@pullapprove pullapprove bot added requires: TGP This PR requires a passing TGP before merging is allowed labels Aug 12, 2024
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime labels Aug 12, 2024
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from c3d0bf5 to fbbc8c0 Compare August 26, 2024 05:57
Copy link
Member

@alxhub alxhub left a comment

Choose a reason for hiding this comment

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

First round of comments!

Additionally, in the commit history, use refactor commits for implementation details. A given feature (debug names for example) should have exactly 1 feat commit, which is the commit which actually makes the feature available for end users to use.

]),
undefined,
ts.factory.createArrayLiteralExpression([
ts.factory.createObjectLiteralExpression(existingArgument.properties),
Copy link
Member

Choose a reason for hiding this comment

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

Same comment about ts.factory.update*.

Copy link
Member

Choose a reason for hiding this comment

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

This is still a bit sketchy to me. This creates a node without any context (e.g. sourcemaps).

Ideally, we wouldn't have to copy the user's code like this, but we should still use ts.update* instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed this briefly in the DevTools sync today. We can definitely update this object literal to just be existingArgument. How should this work for the duplicated node though?

We're effectively converting signal(0, { equals }) to signal(0, ...(ngDevMode ? [{ debugName: 'test', equals }] : [{ equals }])). That moves { equals } to the false case, but also duplicate its in the true case. I presume we just need to ts.factory.create*(...) for the true case and can't update the existing one because we need it for the false case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tested over the weekend with ng new and the compiler cli code with the transform. Source maps are working as expected even with the transformation applied. I think this is working as expected now

@angular-robot angular-robot bot added area: core Issues related to the framework runtime and removed area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels Sep 30, 2024
@ngbot ngbot bot modified the milestone: Backlog Sep 30, 2024
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from 252d2cd to 5f59f91 Compare October 19, 2024 19:34
@angular-robot angular-robot bot added area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Oct 19, 2024
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch 4 times, most recently from af1f967 to f05cdea Compare March 31, 2025 17:55
@dgp1130 dgp1130 force-pushed the signal-debug-name-transform branch from f05cdea to 780dab1 Compare April 2, 2025 17:49
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from 780dab1 to 6c5f302 Compare April 7, 2025 15:10
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch 2 times, most recently from f034848 to 52c3eb0 Compare April 21, 2025 05:31
@dgp1130
Copy link
Contributor

dgp1130 commented Apr 23, 2025

@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from 52c3eb0 to e8acd3f Compare April 23, 2025 21:54
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from ad1b0ad to 57eaa4e Compare May 12, 2025 16:08
@dgp1130
Copy link
Contributor

dgp1130 commented May 14, 2025

@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch 3 times, most recently from 0a905d2 to a4a24df Compare May 20, 2025 16:21
@thePunderWoman thePunderWoman marked this pull request as draft May 21, 2025 15:28
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from 66dee1d to 909a547 Compare May 22, 2025 16:14
@dgp1130 dgp1130 marked this pull request as ready for review May 22, 2025 16:17
@AleksanderBodurri AleksanderBodurri added the target: minor This PR is targeted for the next minor release label May 22, 2025
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from 909a547 to 1b129b3 Compare May 28, 2025 14:59
@dgp1130 dgp1130 removed the request for review from ellenyuan June 2, 2025 22:44
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from 1b129b3 to a97f7fb Compare June 3, 2025 21:52
…om signal functions

Implements a compiler transform that attempts to statically analyze variable names and apply them to usages of signal functions like signal, computed, effect, etc.
@AleksanderBodurri AleksanderBodurri force-pushed the signal-debug-name-transform branch from a97f7fb to b7c9b39 Compare June 3, 2025 22:02
@dgp1130 dgp1130 added the action: merge The PR is ready for merge by the caretaker label Jun 3, 2025
@kirjs
Copy link
Contributor

kirjs commented Jun 4, 2025

This PR was merged into the repository by commit 3a9a70d.

The changes were merged into the following branches: main

@kirjs kirjs closed this in 3a9a70d Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler area: devtools target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants