-
-
Notifications
You must be signed in to change notification settings - Fork 407
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 Namespaces #309
Conversation
This was discussed in the Friday core meeting today. Highlights of what we covered and some notes:
I will make updates the the RFC today and leave a note when I do. |
Was this always the case? I'm currently developing an internal addon which will expose some models. There's no blueprint for it in Ember CLI but I can manually create them myself. It works but I'm worried if I should abandon that approach. If it should continue to work, will the invocation also change? e.g. My use-case is that I have multiple apps that uses a single database. The models are mostly equivalent for each app so I believe that moving the models in an addon would be our best bet to keep things DRY. |
@rmmmp Regarding your specific use case: I do not suggest any change to Ember Data here. The RFC provides very specific examples of where the This RFC does outline support at the low level ( However it also doesn't rush to add that support. First, it would be basically impossible to make all of Ember and it's various libraries work with |
The RFC has been updated:
|
I think the reasoning behind this should be explicitly explained and added to the RFC. I think there are many use cases for this: Some addons add new type(s) that must be automatically resolved. A prominent example is A major enterprise company I used to work for chose to extend the DSL for routing. In order to implement, they created a custom resolver with virtual types which resolved to "cards" rather than routes. With this limitation, they could not combine this approach with namespaces. Glimmer Components and other template invoked types that have not yet been fully specified may also require this. |
I'm a bit worried about an idea to write in a such verbose way on a regular base: {{#package-name::component-name as |smth|}}
...
{{/package-name::component-name}} I think the most annoying part is a closing tag: One of the regular build error I get is related to an invalid closing tag. With a package name it becomes even more complicated/error-prone to write. Maybe good tooling may help here. Which may be a hypothetical angle bracket syntax? <some-package::MyCoolComponent>
</some-package::MyCoolComponent> I'm cool with a necessity to be specific in js but I'd prefer to leave templates ergonomic. If I have an ability to Fallback to main may reduce a verbosity. But I think there always will be "UI components" packages like "ember-bootstrap" which have a rich set of components. |
@mixonic Will there be an easy way of importing a package, say In other words, are we forced to use the NPM package name, or can we 'rename' them on import (something akin to JS modules |
We have a large library of components in several npm-scoped addons, and it's very frequent in our apps' templates to see, given a component called
Under module unification, it appears that we'd have to invoke this as:
I think it's safe to say nobody on our team is going to be happy to have to do this. @sandstrom's suggestion would be very helpful for us. For example, if we could globally map
|
I second @csantero's concern. We're going to have the same issues in our apps and I can definitely say that it's not gonna be a fun experience for us. |
I want to thank people for their feedback here and I encourage others to continue adding their reviews. EmberConf has kept me a bit busy 😬 but I have updates I want to make this weekend and I'll reply to comments as well. Thanks for your patience. |
Would it make sense to remove the npm scope if the app is in the same npm scope? For example, at Condé Nast, we have a bunch of npm packages published with the My concern is less that the My suggestion above may not be appropriate, and have clarity issues for developers. Am I thinking that there may be an cf {{#import '@condenast/ember-ui' as |ui|}}
{{#ui::button}}button{{/ui::button}}
{{/import}} |
@tim-evans That wouldn't actually work for our use-case since our apps (unlike our addons) don't use an npm scope. I guess we could change it but that would involve modifying a lot of files, as every ES6 import of app-defined modules would have to be rewritten. |
With all this explicitely I have strong tendency we are heading into a world where we are forced to read and write idiotic templates. MU and angle brackets for me are about clarity (file/folder-wise) and catching up to web components of just writing
then this is not a world, where I just can go with The question for myself will rise, if I develop a MU or classic addon? MU for developing clarity of the new file structure or classic addon for an enjoyable consume of my addon/components of it? In order to keep up DX and joy, while also denying auto-imported components and keep a bit of explicity by manually declaring imported components (helpers, services, ..., ?) with the chance of aliasing them (in case I depend on two addons that both have a component of the same name). In a slack discussion with @knownasilya @lifeart and @ef4 this could be at // config/aliases.js
module.exports = {
'@myorg/myaddon': 'sausage',
'@myorg/myaddon/components': {
'my-component': 'MyComponent',
'my-other-component': 'SomethingCompletelyDifferent'
}
} So you can still do Also @ef4 suggested, this could be an addon at first, though required APIs should exist then. |
Another option for what @gossi is describing (whether as an addon or an eventually first-class feature) would be to create a preamble template. A preamble template would be an This has the benefit of not introducing a second syntax for doing the same thing. Your preamble would be able to just say This can obviously be abused, and I would be more comfortable shipping it as an addon first and seeing how people use it in real projects before making it a standard feature. |
A no sense suggestionI think today we have concept which looks similar to {{#my-addon as |i|}}
{{i.header}}
{{i.body}}
{{i.footer}}
{{/my-addon}} It may be a bad idea but what if in MU world default components are supplied with a namespaced components? The only thing I don't like about the current way to access context is a reliance on order, so there is an imagined destruction syntax with angle bracket: <SomeAddon as { A } >
<A>
</SomeAddon> or even an inline(simple) form: <SomeAddon as { A } />
<AnotherAddon as { B } />
<A />
<B /> I feel there are lots of edges but I like this syntax. Just realized my examples are wrong in a different ways(sorry for the noise). Collapsed it to not pollute the thread. |
Closed in favor of #367 |
Rendered