-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Deprecate Fallback Lookup Paths in ember-resolver #683
base: master
Are you sure you want to change the base?
Conversation
0fae510
to
0cb29d4
Compare
I generally think this is a good idea, my two cents to this:
|
@mydea thanks for your reply!
|
The main issues I encountered were:
For reference, here is the extended strict resolver that ended up working with our application. There is for sure some room for improvement, but it shows the steps I took to make it work at least: |
Thanks for doing this @mydea
I think the biggest advantage of having less logic in the resolver is that it feels less magical. The thing that you want is the thing you get and teaching becomes incredibly straightforward. My favorite part of ember is that there is convention over configuration and this feels very conventionally as we lay out a 1:1 one of doing things instead of a many:1. |
Having nested components be at
Makes it much easier to see all parts belonging together than e.g.
Regarding the services, not sure I follow. All our services are already referenced in dasherized form, but I still need to map them in the resolver as they are somehow internally (?) looked up in camelcase form. |
@mydea service lookups should not be transformed in the strict resolver case. If you are getting camel case lookups it is coming from having code that doesn't explicitly set the service name in the inject method.
Instead it should be referenced like:
This was hard to track down until we enabled an internal eslint rule that enforced inject calls to ensure a value was provided as a dasherized string. |
Ah OK, that was absolutely not clear to me, and to be honest also is rather surprising. That kind of feels like just adding more friction to every service definition. I guess it is more explicit, but I haven't seen this as a recommendation/best practice so far. |
Just to be clear, it is only required for multi-word services. |
@rwjblue is there anyone who would be able to review this? |
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.
Overall, I'm definitely in favor of moving in this direction. Thanks for working on this!
|
||
The major difference between the two resolvers can be easily linted against: | ||
|
||
_It is important to call out that app re-exports are necessary when referencing components coming from an external source or using Wall Street Syntax._ |
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.
Probably should not mention "wall street syntax"
> on the integration of this feature with other existing and planned features, | ||
> on the impact of the API churn on existing apps, etc. | ||
|
||
A reason to not move the ecosystem forward in this regard is to prioritize technologies that will remove the need for the registry as a sub-system of Ember all-together. Technologies like template imports and reworking the service injection system to not require a resolution mechanic to function. |
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.
We are moving in this direction, but template imports itself doesn't really solve the issue for all pieces of the system.
transition phase estimated difference -42ms [-57ms to -27ms] | ||
render phase estimated difference -23ms [-37ms to -9ms] | ||
|
||
## Detailed design |
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.
This section needs to explicitly state what is being proposed. As far as I can tell "strict resolution" is never defined. What does it mean? What would issue a deprecation? What would resolve to various files on disk?
| Lookup | Ember-resolver | ember-strict-resolver | | ||
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | | ||
| service/foo | service:foo | service:foo | | ||
| service/foo-bar | service:foo-bar, service:fooBar | service:foo-bar | | ||
| (external-module-name)/addon/services/foo-bar | service:(external-module-name)@foo-bar service:(external-module-name)@fooBar | service:(external-module-name)@foo-bar | | ||
| controller/foo/bar | this.controllerFor(‘foo.bar’), this.controllerFor(‘foo/bar’) | this.controllerFor(‘foo.bar’) | | ||
| component/foo/bar | {{foo/bar}} | {{foo/bar}} | | ||
| component/foo/bar-baz | {{foo/bar-baz}}, {{foo/bar_baz}} | {{foo/bar-baz}} | | ||
| (external-module-name)/addon/components/foo/bar-baz | {{component “(external-module-name)/foo/bar-baz”}} {{component “(external-module-name)/foo/bar_baz”}} {{component “(external-module-name)/foo/barBaz”}} | {{component “(external-module-name)/foo/bar-baz”}} | |
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 don't fully understand this table. What are the three columns trying to show?
I think it would be best to talk about it from the perspective of the service:foo
calls (since those are constant from the framework perspective). So for service:fooBar
(which is what is used when you do fooBar: injectService()
) the strict resolver would literally look for app/services/fooBar.js
and the current resolver would look for app/services/foo-bar.js
.
|
||
As libraries migrate to the new use strict format older applications will not be negatively affected as the strict subset resolution is backwards compatible from libraries to applications. | ||
|
||
The major difference between the two resolvers can be easily linted against: |
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.
Linted against how? Is it limited to confirming that any injectService
calls for camelcase property names have an argument?
Co-authored-by: Robert Jackson <[email protected]>
Co-authored-by: Robert Jackson <[email protected]>
Co-authored-by: Robert Jackson <[email protected]>
Co-authored-by: Robert Jackson <[email protected]>
Co-authored-by: Robert Jackson <[email protected]>
I'm going to try to bring this up with the core team and see if we can move it to a conclusion. |
@chriskrycho should this be part of #832? |
@wagenet I don’t think so; this is probably still worth doing if @gabrielcsapo wants to drive it forward, but separately from the Classic stuff. The resolver has its own path to slowly being replaced, but is separate from Classic issues. |
@ef4 Is this in any way related to the RFCs you're currently working on? Also seems Embroider related. Do you have any thoughts to add here? |
Yes, #938 wants to introduce a new resolver implementation. That makes it a good time to drop deprecated resolver features. So if this RFC can land, we can make the new resolver in 938 not support the things this RFC deprecates. One bit of feedback for this RFC is that we can probably avoid using an optional feature, in favor of making ember-resolver a V2 addon and having dedicated import paths for the different implementations. |
We agreed to move this to exploring at the RFC Review Meeting. |
This is a follow up rfc created based on the feedback from issue #661.
rendered text