Comments (11)
glimmer vm is also probably passing it as the only template information. captureRenderTree items has a property ``template` which is the same as moduleName
from rfcs.
Isn’t the scope closure good enough?
from rfcs.
Sorry I should be more specific, I was responding to the need for a function to “point at” for jumping to the definition; scopeFn could serve that purpose rather than introducing one specifically for debug purposes only, right?
from rfcs.
Copying my comment from emberjs/ember-inspector#2425 (comment) here:
Wee may still need moduleName
to support hot module replacement for components (in vite), at the moment we map changed component files to rendered components by moduleName
resolved from getComponentTemplate
or component itself. (https://github.com/lifeart/demo-ember-vite/blob/master/plugins/hot-reload.ts#L169)
from rfcs.
Today in the tooling meeting we discussed this and are generally in favor of trying to eliminate moduleName
from <template>
tag by default.
I looked around it seems like most places already assume moduleName
could be undefined and generally have fallbacks like ?? (unknown module)
I propose that
- we add a
{ moduleName = undefined }
option totemplate()
- for
<template>
, depending on how we feel about using the "attributes space", eitheror<template moduleName="...">...</template>
(to be consistent with #982)// moduleName ... <template>...</template>
- if it seems like it is important to have this for dev mode and/or backwards compatibility, we ship a babel plugin that adds back the above in a best-effort compatible way
from rfcs.
I don't think HMR should be using moduleName
at all, it should just replace the imported value.
import Foo from "./foo";
import bar from "./bar";
<template>
<Foo @foo="..." />
{{bar "some" "args"}}
</template>
Should be transformed into something like
import { tracked } from "@glimmer/tracking";
import Foo from "./foo";
import bar from "./bar";
// TODO eliminate this when not import.meta.hot
const __imports__ = new (class {
@tracked Foo = Foo;
@tracked bar = bar;
})();
if (import.meta.hot) {
import.meta.hot.accept('./foo', (Foo) => __imports__.Foo = Foo);
import.meta.hot.accept('./bar', (bar) => __imports__.bar = bar);
}
<template>
<__imports__.Foo @foo="..." />
{{__imports__.bar "some" "args"}}
</template>
Then everything should just work.
from rfcs.
what about just "name"?
export const Foo = <template>
</template>;
gets transpiled to:
// ...
export const Foo = template('...', { name: 'Foo', /* ... */ });
no user-land customization?
from rfcs.
The point of the feature is for backwards compatibility anyway and I think we either try to preserve existing behavior as much as possible or not do it at all
from rfcs.
if you want it name
-ed for some reason, just use a class:
class Foo { <template>...</template> }
That would naturally give you the .name
property and you can use the normal pragma to tell the minifier to leave it alone (or not)
from rfcs.
it's just <template ...attribute space>
would require more syntax work for some editors / tools, so my preference would be to only add something to attribute space if it's going to be a future-facing feature, rather than a backcompat one
from rfcs.
I think that space is spec-ed/reserved for content-tag
, so it may need to happen anyway (e.g. depending on #982), but I agree I wouldn't do it just for this. So, IMO if we are using it for other things, then we should use it for this, otherwise the anything is fine.
That being said it does have its issues: e.g. what if you want to make it conditional based on import.meta.DEBUG
. However, content-tag
probably has to support that in general anyway.
from rfcs.
Related Issues (20)
- Deprecate all of Ember Classic HOT 16
- Build-time configuration of index.html HOT 3
- Deprecate support for Travis CI HOT 6
- Deprecate `ember-mocha`? HOT 2
- Deprecate `ember-export-application-global` addon? HOT 4
- Run Prettier separately in `app` blueprint HOT 9
- Deprecate `app.import`
- Thoughts on this more ergonomic way to wire up the owner + destroyable association? HOT 2
- Explore "official" pod deprecation HOT 19
- {{else}} should render a value rather than be a control-flow keyword. HOT 5
- new primitive: transition, similar to modifiers, except they block certain render events HOT 2
- Numbers in PR titles affect automation
- Asset import spec RFC HOT 2
- Implement import spec RFC HOT 1
- Simplified imports for common built-in modules HOT 2
- Pre-RFC: Add `aria-current` attribute to Ember's `LinkTo` component HOT 1
- Whitespace handling for `<template>` tag HOT 4
- Add LICENSE
- NVP todos
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rfcs.