-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
add define.exports #121
add define.exports #121
Conversation
Where does |
I would move it to the caller, which would detect |
* backfill some readme stuff
acbfb5f
to
928e18f
Compare
Some numbers (note the benchmarks only test runtime cost Benchmark
file: ./benchmarks/scenarios/define-many.js
total: 73ms
per op: 7.3ms
Benchmark
file: ./benchmarks/scenarios/define-many-exports.js
total: 47ms
per op: 4.7ms File size for a single small template (post gzip). t/size cat before.js | gzip -9 | wc -c
318
t/size cat after.js | gzip -9 | wc -c
223 // before.js
define("my-foo-app/templates/application", ["exports"], function (exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Ember.HTMLBars.template({ "id": "VVZNWoRm", "block": "{\"statements\":[[1,[26,[\"welcome-page\"]],false],[0,\"\\n\"],[0,\"\\n\"],[1,[26,[\"outlet\"]],false]],\"locals\":[],\"named\":[],\"yields\":[],\"hasPartials\":false}", "meta": { "moduleName": "my-foo-app/templates/application.hbs" } });
}); // after.js
define.exports('my-app/templates/my-template.hbs', { hbs: true, "id": "VVZNWoRm", "block": "{\"statements\":[[1,[26,[\"welcome-page\"]],false],[0,\"\\n\"],[0,\"\\n\"],[1,[26,[\"outlet\"]],false]],\"locals\":[],\"named\":[],\"yields\":[],\"hasPartials\":false}", "meta": { "moduleName": "my-foo-app/templates/application.hbs" }}); |
Maybe, but if we do this, then it needs to include version info or something. Should be easy to put into the meta though... |
totally agree. I'll run more thorough tests to confirm/deny my intuition (before we proceed with the required plumbing) |
Another issue that we will have to address is how the templates get instantiated. In older Ember versions, templates were not instantiated but as of Ember 2.10 they are instantiated (and receive injections). Today, We could swap lookup to use |
Ya, I think we can wrap on the caller side for this as well. |
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 like this!
README.md
Outdated
* no reification step | ||
* no need to juggle pre-parse voodoo. | ||
|
||
### `require.unsee('foo'); |
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.
Missing a closing `
README.md
Outdated
|
||
### `require.unsee('foo'); | ||
|
||
`require.unsee` allows one to unload a given module. *note* The side-affects of that module cannot be unloaded. |
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.
Nit: Should be side-effects
+1 to 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.
I'm in favor but this is going to require opt in from the caller side, one thing, the meta is extensible on the compilation side and present on the factory as well, so in the old and new world you can check the meta on the export.
released as v4.5.0 🎉 |
Opens the door to (template compiler and ember/glimmer need to learn about this next):
instead of:
benefits:
TODO: