-
Notifications
You must be signed in to change notification settings - Fork 159
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
Parse destructuring of assignment statements. #5483
Parse destructuring of assignment statements. #5483
Conversation
#12371 Bundle Size — 62.48MiB (+0.03%).
Warning Bundle contains 58 duplicate packages – View duplicate packages Bundle metrics
|
Current #12371 |
Baseline #12344 |
|
---|---|---|
Initial JS | 45.54MiB (+0.01% ) |
45.54MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 22.23% |
21.69% |
Chunks | 31 |
31 |
Assets | 34 |
34 |
Modules | 4374 |
4374 |
Duplicate Modules | 504 |
504 |
Duplicate Code | 30.83% (+0.03% ) |
30.82% |
Packages | 468 |
468 |
Duplicate Packages | 58 |
58 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #12371 |
Baseline #12344 |
|
---|---|---|
JS | 62.47MiB (+0.03% ) |
62.45MiB |
HTML | 10.94KiB (-0.34% ) |
10.97KiB |
Bundle analysis report Branch feature/parse-destructuring-of-a... Project dashboard
…g-of-assignment-statements
…g-of-assignment-statements
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.
the code looks good, I'd add a test to the data tracing test suite that uses the new functionality (starting from here
// let's try to find "const { <identifier>, ...somethingElse } = <expression>" shaped statements |
- Prevent tracing through spread objects or arrays. - Widen `hookCallRegex` a little.
Problem:
We need more detail in the assignment statements so that we can track destructuring.
Fix:
We already have
Param
and some associated types which handle the destructuring for function parameters and the TypeScript compiler uses the same underlying representation in both cases (function parameters and variable declarations). As a result in this we use that existing functionality to handle the same type of parsing for the variable declarations.Commit Details:
JSAssignment.leftHandSide
to be an instance ofBoundParam
.Param
related fields fromJSExpressionMapOrOtherJavascript
toJSExpression
.clearArbitraryJSBlockSourceMaps
,clearDestructuredArrayPartSourceMaps
,clearDestructuredParamPartSourceMaps
,clearParamSourceMaps
,clearBoundParamSourceMaps
,clearBoundParamUniqueIDsAndSourceMaps
,clearTopLevelElementSourceMaps
,clearJSAssignmentSourceMaps
,clearJSArbitraryStatementSourceMaps
,clearParseResultSourceMapsUniqueIDsAndEmptyBlocks
andclearTopLevelElementSourceMapsUniqueIDsAndEmptyBlocks
utility functions.parseDeclaration
now usesparseBindingName
to produce the expected representation forJSAssignment
values.lookupIntoComponentScope
.Manual Tests:
I hereby swear that: