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
refactor(spm-package) resolve pkg dep from current to root #28
Conversation
if (version || !pkg.father) { | ||
break; | ||
} | ||
pkg = pkg.father; |
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.
这块逻辑还是跟原来一样吧,现在扁平化的目录父级模块并不是上一层目录,所以只要两层判断就好了。
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.
从上往下找还有个潜在的问题。问了邵帅,在他的使用中也是有些场景的。
以下依赖链:
a -> b -> c@0.1.0
-> c@0.1.0
然后在 a 中 link b,在 b 中 link c 。如果从上往下找,那么 b 的依赖 c 会取 a 下面的 c ,则会出现 c 的修改在调试 b 时有效,而调试 a 时无效的问题。
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.
从下往上我同意,但只要两层就够了
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.
逻辑这样?
从下往上找两层,然后如果不是 rootPkg 的话,再找一遍 rootPkg 的 spm_modules。
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.
是啊,把原来的顺序颠倒下
0122b60
to
c13c308
Compare
逻辑更新了。
|
+1 |
refactor(spm-package) resolve pkg dep from current to root
0.10.6 |
Close spmjs/spm#1100
依赖查找改成由下往上查找,感觉这样更合乎逻辑,多出来的性能消耗理论上应该是比较少的。