The Ember Times - Issue No. 47

안녕하세요 Emberistas!

Again you can enjoy reading The Ember Times in both the e-mail and the blog format to share it even better with your Ember friends.

This week we have several RFCs from the Ember Data 📟 project for you, as well as an #EmberJS2018 countdown, a new way to cast some template transform magic 🎩 and a recap of what has happened in Readers' Questions for you:


This backwards compatible Request for Comments (RFC) allows ember-data users to associate optional meta and links on records alongside the top-level document meta (mandatory) and links (optional). Sadly, ember-data currently stores this information only on relationships and not individual records.

The RFC design is pretty straightforward and proposes that all meta and links:

  • will be honored in any resource that is part of a JSON API compliant document
  • when defined on resource identifiers (e.g. links inside a relationhip that link to other resources) will be ignored
  • when defined on relationship objects will continue to function as they do today
  • will be exposed as getters on instances of DS.Model and will default to null if nothing has been provided

Similarly, meta and links will be exposed on instances of DS.Snapshot. Although meta and links are getters on DS.Models, they will be exposed on DS.Snapshot as methods:

class Snapshot {
  links() {}
  meta() {}
}

Interestingly, some apps have inadvertently achieved what this RFC purposes by moving meta and links into attributes during serialization and then exposing each of them via DS.attr. Therefore, this RFC gives ember-data an even more complete "out of the box experience" and will likely be a very welcomed addition to the library.

Think differently? Tell @runspired what you think on the original proposal.


Only 12 more days of #EmberJS2018 ✍️💨

12 months in a year. 12 eggs in a dozen. 12 days to submit your blog posts for the #EmberJS2018 Roadmap RFC! 📝

Need to beat writer's block? Listen to Ember Core team member Chad Hietala on The Changelog podcast, discussing Ember four years later. And you can peruse blog posts from the community on @zinyado's repo or the #EmberJS2018 hashtag on Twitter. Get your two cents in by May 30th.


More Ember Data: RFC for removing Ember.Evented

There's an RFC on removing usage of the Ember.Evented mixin in Ember Data specifically. This would also lead to the future removal of several lifecycle hooks and methods on Models and other Ember Data classes.

The use of Ember.Evented is mostly a legacy from pre 1.0 of Ember Data and is not needed anymore. You can follow the discussion and read all about the implications of this change on the RFC pull request.


Recasting Call 🎬 for Templates

Handlebars Logo Fading

Are you an Ember addon author who wants to be able to transform the template of host apps? Or are you an Ember developer who tinkers with templates or template-related codemods? Then, the new Ember addon ember-template-recast is just for you.

Ember Template Recast will allow you to transform templates easily in a non-destructive manner - this means, that you can modify specific parts of your templates while preserving everything else - incl. whitespace formatting and linebreaks - from your original template.

The templateRecast API offers you methods for creating abstract syntax trees (AST) from your templates and vice versa and a way to traverse your templates and modify them along the way.

See it in action:

const { transform } = require('ember-template-recast');

const template = `
{{my-component
  title="I less than 3 ember-template-recast"
}}
`;

let { code } = transform(template, env => {
  let { builders: b } = env.syntax;

  return {
    MustacheStatement() {
      return b.mustache(b.path('wat-wat'));
    },
  };
});

// ...et voilà, enjoy a modified template string 💁🏻
console.log(code); // => {{wat-wat}}

The project is still cutting-edge experimental 👨🏾‍🔬, but and therefore pretty exciting! Try it out for yourself here and transform your templates today.✨


Contributors' Corner

A big thank you goes to the people who contributed to Ember core projects this week: @csantero, @krisselden, @miguelcobain, @locks, @amyrlam, @kennethlarsen, @jessica-jordan, @jimenglish81, @josemarluedke, @Turbo87, @twokul, @kellyselden, @dcombslinkedin, @kategengler, @sivakumar-kailasam, @efx and @mansona. 💕


More Questions & more Answers for Readers' Questions

Office Hours Tomster Mascot

With learning team efforts concentrating on 🚢 something pretty exciting very soon, we want to take the chance to recap some of the previous, great answers to previous, great questions by Ember.js Times readers:

Submit your own short and sweet question under bit.ly/ask-ember-core. And don’t worry, there are no silly questions, we appreciate them all - promise! 🤞


That's another wrap! ✨

Be kind,

Tobias Bieniek, Robert Jackson, Kenneth Larsen, Sivakumar Kailasam, Amy Lam, Ryan Mark, Jessica Jordan and the Learning Team