-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
blueprint changes. You can preview those changes for [applications](https://github.com/ember-cli/ember-new-output/compare/v3.0.0...v3.1.0) | ||
and [addons](https://github.com/ember-cli/ember-addon-output/compare/v3.0.0...v3.1.0). | ||
|
||
### Changes in Ember CLI 3.1 |
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.
test
will run ember test
now (like in apps), test:all
will use ember-try
to run tests in all configured scenarios
- #7492 Use yarn instead of npm when part of a yarn workspace root @thetimothyp
yarn.lock
file detection improved
Fixes issues with the Glimmer blueprints
- #7586 add feature flag to project.isModuleUnification @GavinJoyce
- #7541 Add
project.isModuleUnification()
@GavinJoyce
Module Unification continues...
Two new deprecations are introduces in Ember CLI 3.1: | ||
|
||
* TODO | ||
* TODO |
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.
no new deprecations
For more details on the changes in Ember CLI 3.1 and detailed upgrade | ||
instructions, please review the [Ember CLI 3.1.0 release page](https://github.com/ember-cli/ember-cli/releases/tag/v3.1.0). | ||
|
||
### Upcoming Changes in Ember CLI 3.2 |
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.
qunit-dom
will be added by default to all apps and addons, if you don't (plan to) use it you don't have to add it.
https://github.com/simplabs/qunit-dom-codemod exists to ease migration.
- #7501 add delayed transpilation @kellyselden
- #7650 compile all addons at once optimization @kellyselden
experiments with more efficient transpilation
- #7637 More comprehensive detect if ember-cli is being run within CI or not. @ember-cli
see https://github.com/watson/ci-info/
- #7658 Module Unification Addon blueprint @cibernox
- #7490 Module Unification Addons @ember-cli
- #7660 improve logic for if addon is module-unification @iezer
- #7667 MU addons must generate a MU dummy app @cibernox
- #7678 Use a recent release of Ember canary for MU @ember-cli
Module Unification continues...
|
||
### Upcoming Changes in Ember CLI 3.2 | ||
|
||
#### Deprecations in Ember CLI 3.2 |
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.
|
||
Two new deprecations are introduces in Ember.js 3.1: | ||
|
||
* TODO |
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.
- Calling
array.get('@each')
is deprecated.@each
may only be used as dependency key. - The private APIs
propertyWillChange
andpropertyDidChange
will be removed after the first LTS of the 3.x cycle. You should remove any calls topropertyWillChange
and replace any calls topropertyDidChange
withnotifyPropertyChange
. This applies to both the Ember global version and the EmberObject method version.
For example, the following:
Ember.propertyWillChange(object, 'someProperty');
doStuff(object);
Ember.propertyDidChange(object, 'someProperty');
object.propertyWillChange('someProperty');
doStuff(object);
object.propertyDidChange('someProperty');
Should be changed to:
doStuff(object);
Ember.notifyPropertyChange(object, 'someProperty');
doStuff(object);
object.notifyPropertyChange('someProperty');
If you are an addon author and need to support both Ember applications greater than 3.1 and less than 3.1 you can use the polyfill ember-notify-property-change-polyfill
#### Deprecations in Ember.js 3.2 | ||
|
||
Two new deprecations are introduces in Ember.js 3.2: | ||
|
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.
- Use of
Ember.Logger
is deprecated. You should replace any calls toEmber.Logger
with calls toconsole
. Read more about this deprecation on the deprecation page. - The
Router#route
private API has been renamed toRouter#_route
to avoid collisions with user-defined
properties or methods. Read more about this deprecation on the deprecation page. - Use defineProperty to define computed properties. Read more about this deprecation on the deprecation page.
|
||
#### Deprecations in Ember.js 3.2 | ||
|
||
Two new deprecations are introduces in Ember.js 3.2: |
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.
Three
|
||
Ember.js 3.1 is an incremental, backwards compatible release of Ember with | ||
bugfixes, performance improvements, and minor deprecations. | ||
|
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.
Ember 3.1 is a minor release containing several new features and bug fixes. It includes a bump of Glimmer VM, Ember's rendering implementation, to version 0.30.5.
ES5 Getters for Computed Properties
Ember's object system has long used set
and get
to access properties. These APIs came from the codebase's origins in SproutCore, and predated ES5'sdefineProperty
. In recent years native JavaScript setter and getter implementations have become fast and mature.
Starting in Ember 3.1 (and described in RFC281) you are now able to read the value of a computed property using a native ES5 getter. For example, this component which uses computed properties:
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
name: computed('firstName', 'lastName', function() {
return `${this.get('firstName')} ${this.get('lastName')}`;
}),
message: computed('name', function() {
return `Hello ${this.get('name')}!`;
});
});
Can be re-written using ES5 getters:
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
name: computed('firstName', 'lastName', function() {
return `${this.firstName} ${this.lastName}`;
}),
message: computed('name', function() {
return `Hello ${this.name}!`;
})
});
Legacy get
features are not deprecated or removed in 3.1. In fact there are
several cases where you must still use get
:
- If you are calling
get
with a chained path. For example inthis.get('a.b.c')
ifb
isundefined
the return value isundefined
. Converting this
tothis.a.b.c
whenb
isundefined
would instead raise an exception. - If your object is using
unknownProperty
you must continue to useget
. Using an ES5 getter on an object withunknownProperty
will cause an assertion failure in development. - Ember Data returns promise proxy objects when you read an async relationship and from other API. Ember proxy objects, including promise proxies, still require that you call
get
to read values.
With these caveats in mind, how should you know if you can convert a get
call to a native getter? If you have code where get
is called on this
you likely can convert it. If you have a get
on another object, anything.get('foo')
, you should exercise caution when converting to a native getter.
The community-provided es5-getter-ember-codemod is a great way to convert your existing codebase to ES5 getters. It follows the conservative guidelines and only converts this.get
. Note that it cannot make all possible conversions to the new API, nor can it ensure 100% of the conversions it makes are correct. If your app has poor test coverage or you lack any confidence in your ability to make regression checks, a manual and gradual conversion process may be more appropriate.
Thanks to Chris Garrett for pushing forward work on ES5 getters with support from Godfrey Chan, Robert Jackson, and Kris Selden). Thanks to Jonathan Jackson for his work on the codemod.
Introducing Optional Features
Because major releases of Ember are not supposed to make breaking changes without prior deprecation, the project has been extremely conservative about changing behaviors that don't have a clear deprecation path. As a result, we've had several quirks of the framework linger into the 3.x series.
To give the project a path forward when a breaking change is mandatory, we've released the @ember/optional-features
addon. Today this addon is opt-in via installation as an NPM dependency. In a future release of Ember it will become part of the default application blueprint.
This addon does nothing by default, but provides a command-line interface to enable and disable breaking changes in Ember. Two optional features are being introduced in Ember 3.1.
To install ember-optional-features:
ember install @ember/optional-features
Thanks to Godfrey Chan and Robert Jackson for their work on the optional features system.
New Optional Feature: Application Template Wrapper
Ember applications have long created a wrapping div
around their rendered content: <div class="ember-view">
. With ember-optional-features, this functionality can now be disabled:
ember feature:disable application-template-wrapper
Disabling this feature will stop Ember from creating a div
around the application. This change may require alterations to your application's CSS, or to any other code that depends upon the presence of the div
.
Additionally, enabling this feature will prompt you to optionally run a codemod to add the application div
to the application.hbs
of your application.
Although disabling this feature will eventually be the default for Ember, leaving the feature enabled is not deprecated in this release. You can read more details about this optional feature and the motivations for introducing it in RFC #280.
New Optional Feature: Template-only Glimmer Components
Ember components implicitly create an element in the DOM where they are invoked, and the contents of their templates are then treated as "innerHTML" inside that DOM element. For example, this component template:
Hello World!
When invoked as:
<section>
{{hello-world}}
</section>
Would render with an implicit div
:
<section>
<div class="ember-view">
Hello World!
</div>
</section>
The treatment of templates as "innerHTML" in Ember makes several parts of the framework's API harder to learn. For example, setting a class on an element in a template is straight forward, and any developer comfortable with HTML should be comfortable doing so. However adding a class to the implicit component div
is more difficult, requiring the developer to create a JavaScript file for the component and use the classNames
property.
To resolve this tension, Glimmer components shift templates to be treated as "outerHTML". There is no implicit div
. All the DOM elements created by the renderer are in a template.
The "Template-only Glimmer Component" feature provides a first practical step in this direction. You can enable this feature by running:
ember feature:enable template-only-glimmer-components
Once enabled, any component template file without a corresponding JavaScript file will behave like "outerHTML". For example the component file:
Hello World!
Without any corresponding JavaScript file, and invoked as:
<section>
{{hello-world}}
</section>
Would render without an implicit div, as follows:
<section>
Hello World!
</section>
Enabling this feature may require changes to your application's CSS, or to any other code dependent upon the presence of div
s for JavaScript-free components. In practice, most applications and nearly all addons use the Ember CLI generators for new components, which include a JavaScript file. If your application has template-only components which rely on a backing EmberComponent
class, for example, if they have an injected-by-type service, note that they would also lose access to that backing class.
However, enabling this feature will prompt you to optionally run a codemod which creates backing classes for all template-only components, meaning both the implicit div
and backing class are retained.
Although enabling this feature will eventually be the default for Ember, leaving the feature disabled is not deprecated in this release. You can read more details about this optional feature and the motivations for introducing it in RFC #278.
Positional Params Bug Fix
Ember introduced contextual components in Ember 2.3. Contextual components close over arguments and are intended to do so in a manner consistent with closures in JavaScript.
As the implementation of contextual components has been refined in the Glimmer VM, a notable discrepancy has been noticed in how they handle positional params. Given the following template:
{{#with (component 'x-foo' 1 2 3) as |comp|}}
{{component comp 4 5 6}}
{{/with}}
The params of 4, 5, 6
would override those of 1, 2, 3
. Normal closure implementations would instead have appended the arguments to result in a positional argument list of 1, 2, 3, 4, 5, 6
.
In Ember 3.1 we've corrected the implementation to act like a proper closure. In researching the impact of this breaking bug fix we found no known public addons or applications which would be impacted.
For more information about this change see
emberjs/ember.js#15287.
Ember Data is the official data persistence library for Ember.js applications. | ||
|
||
### Changes in Ember Data 3.1 | ||
|
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.
#5273 client-side-delete semantics unloadRecord
|
||
|
||
### Upcoming changes in Ember Data 3.2 | ||
|
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.
#5230 [BUGFIX] enable lazy-relationship payloads to work with polymorphic relationships
|
||
Two new deprecations are introduces in Ember Data 3.1: | ||
|
||
* TODO |
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.
Ember.Map
was a private API provided by Ember (for quite some time). Unfortunately, ember-data madeEmber.Map
part of its public API surface via documentation blocks.Ember.Map
will be deprecated and removed from Ember "soon" (Remove Ember.Map, Ember.MapWithDefault and Ember.OrderedSet rfcs#237) and we would like to confirm that Ember Data will work without deprecation before and after that happens.Ember.Map
differs from nativeMap
in a few ways:Ember.Map
has customcopy
andisEmpty
methods which are not present in nativeMap
Ember.Map
adds a staticcreate
method (which simply instantiates itself withnew Ember.Map()
)Ember.Map
does not accept constructor argumentsEmber.Map
does not have:@@species
@@iterator
entries
values
This implementation adds a deprecated backwards compatibility for:
copy
isEmpty
This is needed because Map
requires instantiation with new
and by default Babel transpilation will do superConstructor.apply(this, arguments)
which throws an error with native Map
. The desired code (if we lived in an "only native class" world) would be:
export default class MapWithDeprecations extends Map {
constructor(options) {
super();
this.defaultValue = options.defaultValue;
}
get(key) {
let hasValue = this.has(key);
if (hasValue) {
return super.get(key);
} else {
let defaultValue = this.defaultValue(key);
this.set(key, defaultValue);
return defaultValue;
}
}
}
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.
values
This implementation adds a deprecated backwards compatibility for:copy
isEmpty
is "This" referring to values
?
For more details on the upcoming changes in Ember Data 3.2, please review the | ||
[Ember Data 3.2.0-beta.1 release page](https://github.com/emberjs/data/releases/tag/v3.2.0-beta.1). | ||
|
||
--- |
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.
No deprecations
title: Ember 3.1 and 3.2 Beta Released | ||
author: Ricardo Mendes | ||
tags: Releases | ||
--- |
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.
can you add responsive: true
please.
(per @locks request) Merged more comments into the draft. @Turbo87 @kennethlarsen please review though- I've updated some of the outline numbering in the sections to enhance readability. |
@MelSumner we should probably turn my list of PRs into prose though before publishing 😉 |
|
||
#### New Features | ||
|
||
1. Updates to blueprints & addons- replace `test` with `test:all`. The command `test` will now run `ember test` (like it does in apps); the `test:all` command will use `ember-try` to run tests in all configured scenarios [(#7601)](https://github.com/ember-cli/ember-cli/pull/7601). |
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 newline after "blueprints & addons"
|
||
### Upcoming Changes in Ember CLI 3.2 | ||
|
||
1. Qunit-dom |
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.
all lowercase please 🙏
thanks for working on this @MelSumner!! ❤️ |
Sign-offs
Checklist
See https://github.com/emberjs/website/pull/2824/files for inspiration.