-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
Transform logic to extract signal debug names #57348
Conversation
packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/debug_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/debug_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/debug_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/debug_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/debug_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/debug_transform.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
c3d0bf5
to
fbbc8c0
Compare
packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Outdated
Show resolved
Hide resolved
]), | ||
undefined, | ||
ts.factory.createArrayLiteralExpression([ | ||
ts.factory.createObjectLiteralExpression(existingArgument.properties), |
There was a problem hiding this comment.
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*
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/transform/src/implicit_signal_debug_name_transform.ts
Outdated
Show resolved
Hide resolved
252d2cd
to
5f59f91
Compare
af1f967
to
f05cdea
Compare
f05cdea
to
780dab1
Compare
780dab1
to
6c5f302
Compare
f034848
to
52c3eb0
Compare
52c3eb0
to
e8acd3f
Compare
ad1b0ad
to
57eaa4e
Compare
TGP still looking good: http://test/OCL:758440362:BASE:758744767:1747244383957:e4a093db |
0a905d2
to
a4a24df
Compare
66dee1d
to
909a547
Compare
909a547
to
1b129b3
Compare
1b129b3
to
a97f7fb
Compare
…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.
a97f7fb
to
b7c9b39
Compare
This PR was merged into the repository by commit 3a9a70d. The changes were merged into the following branches: main |
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