The Ember mission is worked up to announce the discharge of Ember v7.1. It is a customary minor launch as a part of the Ember Launch Practice course of.
This launch accommodates some severe enhancements to the Developer Expertise for folks utilizing GJS recordsdata, provides some new built-in helpers, and furthers our dedication to scale back the variety of deprecated npm bundle warnings seen when producing a brand new Ember software.
Ember.js 7.1
Ember 7.1 introduces a variety of long-awaited new built-in helpers ({{factor}}, {{and}}, {{or}}, {{lt}} {{lte}}, {{gt}}, {{gte}}, {{eq}}, and {{neq}}) and a big enchancment to the Developer Expertise of utilizing some usually used helpers and modifiers in GJS recordsdata. Additionally, the API documentation has been up to date so that every one the template examples have all been up to date to make use of <template /> tag format.
Ingredient Helper
This launch is the primary time that the {{factor}} helper has been included in Ember.js itself. This helper was initially proposed in RFC #389 – again in 2018! The factor helper is a useful gizmo when you could generate a selected DOM factor primarily based on dynamic knowledge. For instance, should you had a part that wanted to selected to render a <div> or a <span> primarily based on some knowledge handed to your part, you possibly can do one thing like this:
{{#if (eq @renderTag 'div')}}
<div ...attributes>{{@textual content}}</div>
{{else if (eq @renderTag 'span')}}
<span ...attributes>{{@textual content}}</span>
{{/if}}
As you may think about this could get a bit onerous to handle when needing to cater for a lot of totally different tag varieties. However now you need to use the {{factor}} helper to dynamically generate the tag and use it immediately in your code:
{Tag}
<Tag ...attributes>
{{@textual content}}
</Tag>
{{/let}}
For the reason that RFC was proposed, Ember builders have been immediately consuming the reference implementation for the RFC that was revealed as an addon, so with this launch that addon is not wanted. With it being accessible from Ember.js immediately that implies that it may be included within the set of “Constructed-in helpers” which you’ll be taught extra about should you preserve studying 😉
Logical, Equality, and Numeric Comparability Operators
ember-truth-helpers is without doubt one of the hottest Ember Addons within the wider ecosystem, and most Ember apps have put in it both immediately or not directly by way of different Ember Addons relying on it. It’s so in style that RFC #562 proposed that the {{and}}, {{or}}, and {{not}} helpers offered by ember-truth-helpers must be included in Ember.js by default. Additionally, RFC #561 proposed the inclusion of the {{lt}}, {{lte}}, {{gt}}, and {{gte}} helpers into Ember.js and RFC #560 proposed the inclusion of the {{eq}} and {{neq}} helpers.
As a result of ember-truth-helpers was such a preferred (and helpful) addon, there was little motivation to do the work and embrace these helpers in Ember.js by default. However just like the {{factor}} helper above, now that we’ve the flexibility to offer “Constructed-in helpers” for templates we will considerably enhance the ergonomics for Ember builders by lastly implementing these RFCs and making the helpers part of Ember.js by default. With that, I suppose it is time to clarify what I imply by “Constructed-in helpers” 😂
Constructed-in Modifiers and Helpers
Within the blueprints shipped with Ember 6.8 we made the new GJS template format the default expertise for the turbines in apps, so while you generate a part or a route template you’ll get a .gjs file as an alternative of what was beforehand a .hbs file. You may learn extra about the advantages of GJS recordsdata in RFC #779, however a really brief abstract of the largest distinction is that you could import every little thing that you just use in a GJS file earlier than you utilize it. That is achieved by compiling GJS recordsdata with “strict mode”, which implies that templates not depend on the Ember Resolver to lookup Invokables (Elements, Helpers, and Modifiers) by identify, however as an alternative it checks native scope of the file to seek out the Invokable earlier than including it to the template scope.
This one easy change has helped Ember templates really feel quite a bit much less “magical” for builders who’re new to Ember, not having to guess which (doubtlessly nested) addon a random <FancyButton /> part is coming from, however this transformation did include a slight price. Now that you could import every little thing that you’re utilizing in template, you immediately want to begin importing issues that Ember.js routinely supplies for you such because the {{on}} modifier, the {{fn}} helper, or the <LinkTo /> part. And to make it much more difficult every of those Invokables are imported from totally different locations: @ember/modifier, @ember/helper, and @ember/routing respectively. Whereas there was some efforts to enhance tooling in order that while you use one among these Invokables in a template your editor would provide help to to auto-complete the import assertion for you, this does not characterize a full repair for the issue and can not help anybody growing in an atmosphere that may’t make use of the fashionable Glint toolchain.
In RFC #997 it was proposed that the {{on}} helper could be routinely imported for you while you use it in a strict template (e.g. GJS) and Ember.js 7.1 is the primary model the place this RFC has been carried out. This launch additionally consists of the implementation for RFC #998 to make the {{fn}} helper be routinely imported into strict templates, RFC #999 for the {{hash}} helper, and RFC #1000 for the {{array}} helper. What’s extra because the Ingredient helper and the Logical, Equality, and Numeric Comparability Operators described above have been added within the Ember.js model that launched the idea of auto-importing Invokables, they’ve additionally been added to the checklist 🎉
Because of this should you had the next (barely contrived) instance of a GJS part template in Ember.js 7.0:
import { on } from '@ember/modifier';
import { fn } from '@ember/helper';
perform say(message) { alert(message); }
<template>
<button {{on "click on" (fn say "howdy there")}}>Say howdy</button>
</template>
could be up to date to:
perform say(message) { alert(message); }
<template>
<button {{on "click on" (fn say "howdy there")}}>Say howdy</button>
</template>
which I feel we will all agree is quite a bit higher 😍.
Updating API documentation to GJS
For the reason that new RFC Phases RFC was adopted, we’ve had a really clear definition of when an RFC is taken into account carried out, and the required code to implement a brand new characteristic being written is just step 3 of 5! As soon as one thing is launched (Stage 4) we proceed to trace the work till it turns into Advisable (Stage 5). The exact definition of Advisable is totally different for each RFC, however it’s protected to imagine that updating the all of the documentation round modifications proposed in an RFC shall be a prerequisite earlier than an RFC could be marked as Advisable i.e. totally and fully carried out.
This launch consists of one of many final modifications essential earlier than RFC #779 (the RFC that launched GJS recordsdata) may very well be marked as Advisable. All of the API documentation embedded within the Ember.js supply code (and that will get extracted into the Ember API Docs app) has been up to date to make use of <template> tag syntax fairly than “naked templates” that depend on the resolver to seek out Invokables.
Ember CLI 7.1
This launch of ember-cli brings a brand new library that extracts frequent deprecation behaviour, a small however essential enchancment to quest to scale back npm deprecation warnings, and a bugfix to the blueprint system that helps trendy JS tooling.
Extract customized semver behaviour into new bundle
In case you are used to Ember’s launch course of you’ll know that we do semver just a little bit in a different way to most different initiatives. We add new options in minor variations in such a manner that you need to use each the outdated and the brand new options side-by-side, providing you with time emigrate to the brand new paradigm. Then once we wish to take away code, we add a brand new deprecation (at the very least 2 minors earlier than the following main) with clear directions on easy methods to take away the deprecation earlier than the following main. Then, if you’re operating your app and all of its checks on the model proper earlier than the following main launch with no deprecations being thrown, it must be protected to improve your Ember model with none issues.
We constructed this idea into our deprecate() perform in order that it was conscious of what the present model of Ember.js or ember-cli you’re utilizing and we made it throw an error should you had handed the model that the code was as a result of be eliminated in. Because of this we could be sure that no software is counting on this code path, and we will safely take away the code as a part of a cleanup with out breaking our semver commitments.
For classy inner monorepo causes (which ought to hopefully characteristic in future releases!) we wanted to extract the code that manages these deprecations right into a separate library, and this launch is the primary time we’re consuming our personal new library. If you happen to just like the “Ember manner” of doing deprecations you may be happy to begin utilizing this library too!
Replace many dependencies throughout majors
We made an essential structural change to the ember-cli launch course of that implies that updating dependencies throughout main boundaries will occur naturally as a part of the ember-cli launch prepare. That is the primary model the place that structural change is paying off, and we up to date 6 dependencies (each in ember-cli and the blueprint) throughout main boundaries (and in some circumstances throughout a number of majors!)
Backported assist for blueprints written in ESM
Each ember generate name in Ember is backed by a blueprint offered by an Ember Addon. Every blueprint has a “Blueprint index” file that gives some extention factors for the blueprint to preform totally different actions, or customise template variables whereas the blueprint is being generated. Up till ember-cli 7.1 the Blueprint index recordsdata wanted to be written as a CJS module utilizing the outdated module.exports syntax:
'use strict';
module.exports = {
description: 'An excellent fancy blueprint',
// locals(choices) {
// // Return customized template variables right here.
// return {
// foo: choices.entity.choices.foo
// };
// }
// afterInstall(choices) {
// // Carry out further work right here.
// }
};
We’ve mounted this now, so you may write your Blueprint index recordsdata as true ESM modules:
export default {
description: 'An excellent fancy blueprint',
// locals(choices) {
// // Return customized template variables right here.
// return {
// foo: choices.entity.choices.foo
// };
// }
// afterInstall(choices) {
// // Carry out further work right here.
// }
};
This will likely not appear to be a serious change, however this represents one of many last obstacles to setting kind=module within the bundle.json subject of ember-source (which we could also be listening to extra about within the subsequent launch!). If you happen to aren’t conscious of kind=module then you may learn extra about it within the Node.js documentation web page on ESM modules.
This repair was additionally backported to ember-cli v7.0.1.
Thank You!
As a community-driven open-source mission with an formidable scope, every of those releases serves as a reminder that the Ember mission wouldn’t have been doable with out your continued assist. We’re extraordinarily grateful to our contributors for his or her efforts.

