-
Notifications
You must be signed in to change notification settings - Fork 40
Correctly set extraneous flag on extraneous dependency cycles #20
Conversation
It looks like There are some style fixups that are probably rather straightforward. Also, I think I grok the algorithm here, but it'd be good to write up in pseudocode how this is working. Would you mind adding that to the commit message? You don't need to do a new pull request or branch. You can just make all the changes and then do this:
This will open it up in a text editor, where you'll see some instructions. Then you can use the Thanks! |
The readInstalled_ function sets extraneous=true for every dependency not required by its direct parent and leaves it to undefined for others. After the dependency tree has been built, the markExtraneous function will walk it depth-first and set extraneous=false on dependencies that are not extraneous and then recurse until all dependencies have been flagged: for d in dependencies: if d.parent is not extraneous: set d.extraneous = false execute recursively on d.dependencies This will ensure that extraneous dependencies will not be marked as extraneous=false incorrectly because of a dependency cycle.
Struggled a little bit with the rebasing, but it's done. |
Failing tests:
|
Weird, I can't reproduce (I'm on windows, if it's relevant...):
|
Just to be sure that I was testing the right thing, I did the following:
Not really sure what's going on here... |
Yeah, definitely failing here.
|
Huh, apparently there was something weird going on with my node_modules folder. I removed it and re-installed deps, and now it works. |
Fixes #16 and hopefully doesn't break anything else ;-)
At least all tests still pass.