Skip to content

Conversation

@kpdecker
Copy link
Contributor

Fixes a variety of fine-grained issues with source map generation, both globally and within the commonjs importer (as mentioned here).

Largest changes are:

  • Rework the mark end behavior to "re-enter" the parent node. This avoids emitting a mostly useless end tag that does nothing to restore the previous state.
  • Avoid emitting duplicate mappings in either generated or original. Avoiding duplicates in the original source reduces the size and processing time for the source map. Avoiding duplicates in the generated avoids a few potential error cases where a number of AST nodes all end on the same generated line of code.
  • Treat imported identifier references as generated code, removing their source location
  • Fixes for aux comment termination in function calls and joined code

@codecov-io
Copy link

Current coverage is 84.78%

Merging #3183 into master will decrease coverage by -0.27% as of b2ae74b

@@            master   #3183   diff @@
======================================
  Files          215     215       
  Stmts        15619   15633    +14
  Branches      3336    3341     +5
  Methods          0       0       
======================================
- Hit          13284   13254    -30
- Partial        683     732    +49
+ Missed        1652    1647     -5

Review entire Coverage Diff as of b2ae74b

Powered by Codecov. Updated on successful CI builds.

@jamiebuilds
Copy link
Contributor

looks good to me

Copy link
Member

Choose a reason for hiding this comment

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

it says excluding _private but that doesn't seem to be the case. Also, if this functions is used once, consider using it inline. This is a public API and we should be careful with adding more thing to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clone excludes the private properties. Would adding an options field to clone be a better option vs. a separate named function? I suspect that there are other places where this without location method will be needed, I just don't have time to identify all of the cases.

@amasad
Copy link
Member

amasad commented Dec 24, 2015

@sebmck can you take a look?

@kpdecker
Copy link
Contributor Author

kpdecker commented Jan 6, 2016

Any chance on getting this in? I see it's conflicting now, glad to rebase if there is interest in this PR.

@jeromu
Copy link

jeromu commented Jan 8, 2016

+1 to get it fixed, please.

The problem described in T6851 (https://phabricator.babeljs.io/T6851) makes my debugging almost impossible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why's the line here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This forces any after comments to be output prior to the ( in a call. The diff below has test coverage for this:

-/*before*/(0, _foo4. /*after*/bar)( /*before*/_foo2.default) /*after*/;
+/*before*/(0, _foo4.bar) /*after*/( /*before*/_foo2.default /*after*/, /*before*/_foo5.foo /*after*/);

This is a bit of whack-a-mole and is not a complete fix for the handling of aux after but helps fix one of the identified cases.

@sebmck
Copy link
Contributor

sebmck commented Jan 8, 2016

I think it's clear from some of the source map issues that the tests aren't exhaustive enough to catch a lot of these problems. These changes look good to me but I'm not confident giving this a 👍 without some additional tests.

@kpdecker
Copy link
Contributor Author

kpdecker commented Jan 9, 2016

@kittens is there a baseline that you'd like to see in order to get this in? I'm all for expanded test coverage for source maps, but I only have so much time to focus on open source work versus trying to ship and need to balance my time.

@kpdecker
Copy link
Contributor Author

@kittens @amasad @thejameskyle a month later I'm still having to guess where my tests are failing due to this and this is causing a fair amount of pain for me. I am glad to make changes needed to get this in but it's a bit disheartening that we can't get this issue resolved or at least rejected if it won't be accepted. I had invested the time to fix this issue (along with many other open source project issues that directly impact me) in an attempt to not treat the maintainers as a commodity and in a selfish attempt to fix my own problems but now it's just leading to frustration as no one with the keys is willing to pull the trigger or provide feedback on what needs to be done to move forward.

@amasad
Copy link
Member

amasad commented Jan 18, 2016

I'm sorry for the delay, it's a big change and apparently none of us are that comfortable with that part of the codebase to be able to accept this with confidence. I think we left the conversation around adding more tests. Is this something you are able to do?

@kittens did you have suggestions as to what additional tests you'd like to be added?

@sebmck sebmck merged commit 9e382b1 into babel:master Jan 18, 2016
@sebmck
Copy link
Contributor

sebmck commented Jan 18, 2016

Extremely sorry for the delay @kpdecker. We're just starting to get new contributors ramped up but there's still large parts of the codebase that only I understand. After reviewing the changes this looks good. I've manually merged as there was a conflict due to some generator print stack work by @amasad. Sorry for not being very responsive.

@kpdecker
Copy link
Contributor Author

Thanks, hopefully my post from 3am my time wasn't too whiny. As always glad to help out however I can. If I get some time away from the race to release our v1 I'll see if I can get some broader source-map test coverage outside of this one case.

@hzoo hzoo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jan 19, 2016
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants