-
Notifications
You must be signed in to change notification settings - Fork 157
new Macro: appEmberSatisfies(range)
#2550
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
base: main
Are you sure you want to change the base?
Conversation
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.
I noticed a few things when I had a quick look. I know it's draft but I thought I would share 😂
try { | ||
let root = state.packageCache.get(state.packageCache.appRoot); | ||
|
||
if (!root?.hasDependency(packageName)) { |
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.
I thought this was a copyPasta error 🍝 because the packageName is in module scope.. . it's only used in this try block so we could just make it a const in here 🤔
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.
why spend the cost of re-defining a variable every function evaluation?
it makes more sense for consts to remain in module space
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.
I mean that's premature optimisation right there, v8 will 100% inline it if it's a const 🤷
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.
yea, i mean, the activation energy to change it is worth more than anything the computer would do.
(and what energy is spent discussing such changes).
Additionally to my prior point, I use consts like this to avoid typos in strings.
I hate debugging string typos. So if I only write the word once, I can't have mismatches. 🎉
Co-authored-by: Chris Manson <[email protected]>
Co-authored-by: Chris Manson <[email protected]>
Co-authored-by: Chris Manson <[email protected]>
Why?:
This library is now a partial-polyfill for RFC#1068 tracked-tools/tracked-built-ins#440
I ran in to an issue where
dependencySatisfies
was always returning false (because the peerDep was not declared). We can't declare the peerDep because then we force all consumers oftracked-built-ins
to forward the peer. We've already learned that we can't successfully manage a fully correct package.json-declared dep graph. It's been best to just not declare peers, and rely on the resolve algo, as well as the assumption that the host app must provide ember-source.