-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
module unification feature flag #15350
Comments
Feature flag with local lookup landed in #15368. |
Using the module unification feature flags we've run into an issue using
Adding empty routes/controller files for auto-generated objects acts as a workaround. For the routes I traced it back to |
@kevinansfield I believe that was an un-related regression in canary. We should confirm. |
Next steps for addons: ember-cli/ember-resolver#214 Add tests and support for namespaces. Presume
In this repo we should add tests and support for calling factoryFor(lookupString, {
referrer,
literalString
});
lookup(lookupString, {
referrer,
literalString
}); |
resolver.resolve now takes a third argument `rawString` which is the string used at the invocation site of the lookup. For example for: ``` {{ember-power-select::option}} ``` The lookup should be: ``` resolver.resolve('template:component/', null, 'ember-power-select::option') `` And for a service example: ``` Ember.service.inject('auth-addon::main-service') ``` The lookup would be: ``` resolver.resolve('service', null, 'auth-addon::main-service') ``` Refs: #214 Refs: emberjs/ember.js#15350 (comment)
resolver.resolve can accept a namespace denoted by a double colon in the first argument, for example: - `service:other-namespace::i18n` - `template:components/other-namespace::my-component` For example for: ``` {{ember-power-select::option}} ``` The lookup should be: ``` resolver.resolve('template:component/ember-power-select::option’) `` And for a service example: ``` Ember.service.inject('auth-addon::main-service') ``` The lookup would be: ``` resolver.resolve('service:auth-addon::main-service’) ``` Refs: ember-cli#214 Refs: emberjs/ember.js#15350 (comment)
resolver.resolve can accept a namespace denoted by a double colon in the first argument, for example: - `service:other-namespace::i18n` - `template:components/other-namespace::my-component` For example for: ``` {{ember-power-select::option}} ``` The lookup should be: ``` resolver.resolve('template:component/ember-power-select::option’) `` And for a service example: ``` Ember.service.inject('auth-addon::main-service') ``` The lookup would be: ``` resolver.resolve('service:auth-addon::main-service’) ``` Refs: ember-cli#214 Refs: emberjs/ember.js#15350 (comment)
resolver.resolve now takes a third argument `rawString` which is the string used at the invocation site of the lookup. For example for: ``` {{ember-power-select::option}} ``` The lookup should be: ``` resolver.resolve('template:component/', null, 'ember-power-select::option') `` And for a service example: ``` Ember.service.inject('auth-addon::main-service') ``` The lookup would be: ``` resolver.resolve('service', null, 'auth-addon::main-service') ``` Refs: ember-cli#214 Refs: emberjs/ember.js#15350 (comment)
We have some changes to the implementation, but the basic implementation is behind a feature flag! |
@kevinansfield @mixonic @rwjblue I just had the same link-to bug on Module unification app: {{link-to "New Post" "admin.posts.new"}}
Ember v3.3.1, ember-resolver 5.0.1 Assertion Failed: You attempted to define a |
Same here with with latest canary. This works this.route('uploads', { path: '/' }, function() {
this.route('show', { path: 'uploads/:id' })
}) This doesn't this.route('uploads', { path: '/' }, function() {
this.route('show', { path: 'uploads/:id' }, function () {})
}) I get
|
This issue has grown stale, so we're closing it for now (see the blog post for more details). |
Basic support for module unification already exists in Ember. However there are two parts to the functionality that will require minor changes.
Eventually, we want glimmer-di to replace Ember's container, however blocking module unification on that task seems unwise. Instead, this feature flag is an iterative step that should unblock progress even if the implementation isn't the exact final form we want it to be in.
This feature flag will exist to flag two pieces of functionality:
{{my-addon::some-component}}
or adding a service dependency assession: Ember.inject.service('my-addon::session')
.Supporting MU namespaces
Given a component invoked like so:
What do we call
lookup
with? Today this codepath is blocked by an assertion, but if that assertion is removed Ember would call:This is pretty much nonsense. It could be parsed, but avoiding string parsing and re-mangling is to be avoided. Additionally, adding any other special sigils or syntax to the lookup strings is not desired especially since
lookup
is itself public API. Once glimmer-di lands, it would be ideal to simply pass a partial specifier. For example:However the goal of this feature flag is to continue using the Ember container as it exists today. To avoid adding any public API and avoid messing with strings, a private API on the container is proposed. Something like:
This API can do whatever internal machinations required to get the namespaced
my-addon::date-picker
string to be a property lookup in the container, and let us move forward with addon support for module unification without adding public API. The serialized path passed to the resolver can be the absolute specifier serialized:This requires some knowledge in Ember about the module unification config, but that temporary abstraction leak will be eventually plugged by glimmer-di supporting partial specifiers as lookups.
Lastly, whatever current assertions for using
::
in component and service names that exist must be moved out of the main Ember codebase. Existing resolvers (Ember's default resolver and the ember-resolver classic resolver) may need to have assertions added regarding their lack of support for namespaces.The text was updated successfully, but these errors were encountered: