Ember.js 7.0
Ember.js 7.0

原始链接: https://blog.emberjs.com/ember-released-7-0/

Ember.js 已发布 7.0 版本,这是一次主要更新,重点在于移除已弃用的功能并修复关键漏洞。按照 Ember 的版本发布政策,新功能仅在次要版本(minor releases)中引入,以确保平滑升级。因此,Ember 6.12 已被指定为新的长期支持(LTS)版本。 6.x 系列是该框架的转型期,引入了 Embroider/Vite 构建系统、严格模式组件编写以及原生跟踪集合类型(tracked collection types)作为默认设置。这些变化极大地优化了开发体验。 若要升级至 7.0,开发者应确保应用程序首先运行在最新的 6.12 版本上,且没有任何弃用警告。升级流程包括解决这些警告,例如移除 `import Ember from 'ember'`、AMD 包支持以及特定的服务注入语法。 Ember 7.0 侧重于移除遗留代码而非增加新 API,为未来的改进奠定了基础。建议开发者使用 `ember-cli-update` 来管理迁移。得益于活跃的社区和贡献者,该项目持续繁荣,他们的付出对于框架的发展至关重要。

最近 Hacker News 上关于 Ember.js 7.0 的讨论凸显了该框架日益式微的现状以及维护它的现实挑战。 一位资深开发者表示,尽管他曾非常喜爱 Ember,并成功用它维护了一个代码库十年之久,但现在决定将其弃用。他提到,聘请负担得起的顾问极其困难,因为人才市场被大型企业所主导,这种“小众化”的处境使得小型团队难以维持其开发工作。因此,他已转向 React 等主流工具,以避免陷入类似的厂商锁定。 另一方面,也有用户欣赏 Ember 的持续存在,认为它为前端开发提供了架构多样性。一些人推测,AI 驱动的编程代理的兴起或许能降低入门门槛,因为 AI 可以轻松处理该框架冗长的样板代码,这可能使 Ember 有望再次成为一种可行的选择。总的来说,这些观点反映了人们在对 Ember 设计的认可与生态系统萎缩的残酷现实之间所产生的矛盾。
相关文章

原文

The Ember project is excited to announce the release of Ember v7.0. Following Ember's Major Version Policy, the major includes only the removal of features that were deprecated until 7.0 as well as other bugfixes. This release of Ember.js means the previous version, 6.12, is now an LTS (Long Term Support) version.

When it comes to introducing new features, Ember generally aims to ship new features in minor releases, offering backwards compatibility for existing code at the same time as giving developers the chance to try out new capabilities. This approach reduces the challenges that teams face for major upgrades, compared to producing big, breaking, splashy major versions with lots of new features.

Looking back at improvements in the 6.x series

In Ember 6.x minor releases, we landed many notable features:

  • In Ember 6.1 we began publishing ember-source as a v2 addon, which enabled Embroider to consume ember-source directly.
  • In Ember 6.3 we added support for template-tag components as route templates per RFC #1046.
  • In Ember 6.8 we landed a new app blueprint with Embroider and Vite-based build system as the default.
  • Also in Ember 6.8 we moved to strict-mode (aka template-tag) component authoring format as the default.
  • Also in Ember 6.8 we added the renderComponent API that allows rendering individual components without a full project.
  • Also in Ember 6.8 we built in tracked versions of JavaScript's native collection types: trackedArray, trackedObject, trackedMap, trackedSet, trackedWeakMap, and trackedWeakSet.

Ember v6.8 was the biggest change to how an Ember project is built in recent memory. The Ember Core Teams have been working on the Embroider+Vite build system and the strict-mode-templates (a.k.a template-tag) for literal years, and this is the first version that we made them the default experience for newly generated Ember apps. Early adopters have been opting into these features for quite some time, but generating an app with Ember v6.8 (or newer) now gives you an incredibly modern developer experience 🎉

Along with these features, countless bugfixes, deprecations that cleared the way for future improvements, RFCs setting the stage for new features, in 6.x the community also:

  • Merged the glimmer-vm monorepo into ember.js to faciliate faster iteration on the rendering engine and the integration with ember.js.
  • Merged the router.js repo into the ember.js repo to prepare for experimentation with a new router architecture and the implementation of the Route Manager RFC
  • Updated our packages to publish via OIDC.
  • Updated broccoli and other dependencies in an ongoing effort to reduce the number of security vulnerabilities. Current vulnerability warnings are only a concern in development mode and should not be exploitable but are annoying.
  • Strived to reduce the number of deprecation warnings when generating a new Ember App. This is an ongoing task.
  • The v2 of Glint was released. This enabled us to make the template-tag component authoring format the default.
  • Created the template tag codemod to help migration to the new authoring format.
  • Created the Vite codemod to help migration to the new build system.
  • Created a legacy Classic Blueprint (@ember-tooling/classic-build-app-blueprint) and supported it in ember-cli-update so that projects can update without moving to the new build system, if necessary.

Thank you to all the contributors that helped make this major-version cycle possible!

How to upgrade to Ember 7.0

The most common approach for upgrading to 7.0 is to upgrade your app to the last version of Ember 6, which is 6.12, resolve all deprecation warnings, and then upgrade to 7.0. If your app or addon runs with no deprecations in the latest release of 6.12, you should be able to upgrade to Ember 7 with no additional changes. Step-by-step directions are below.

If your app is at a much earlier version in the 6.x series, we recommend upgrading in steps across the LTS versions: 6.4, 6.8, and then 6.12.

Follow these steps in order:

  1. Consider upgrading addons used in your app to the latest version that you can. This will reduce the uses of deprecated APIs in your dependencies.

  2. Upgrade your project to the latest patch version of Ember 6.12. Many projects can do this by running npx ember-cli-update --to 6.12.

    When upgrading across the 6.8 boundary, due to changes in the build system, you need to adjust the configuration for ember-cli.

  3. Make sure your app builds successfully.

  4. Resolve all deprecation warnings. These Deprecated APIs are removed in Ember 7.0. You may need to upgrade some of your addon dependencies if they are using deprecated APIs. See the Ember Deprecation Guide for more details about specific deprecations and how to resolve them. Applications that need to upgrade through several versions may want to consider isolating individual deprecations by using ember-cli-deprecation-workflow.

  5. Make sure your app builds successfully and your test suite passes with no deprecations.

  6. Upgrade your app to Ember 7.0. Again, many developers can do this by running npx ember-cli-update --to 7.0.

For help or advice along the way, visit Ember's forums or chat groups.

Ember.js 7.0

Ember.js 7.0 introduces no new public API. Instead, it comprises bug fixes and the breakage of previously deprecated public API from the 6.x cycle.

Deprecations

Ember.js 7.0 introduced no new deprecations. It removed all deprecations that were introduced before 6.10 and slated for removal in 7.0.

Ember 7.0 removes the following features deprecated during 6.x:

  • Removes import Ember from 'ember'. See the RFC or deprecations in your project for a guide on replacement APIs.
  • Removes the publication of AMD bundles by ember-source. This can be opted-into before 7.0 by using an optional feature: see the deprecation guide for more details. This also requires certain dependency updates.
  • Removes importing inject from @ember/service. It is now import { service } from '@ember/service'.

For more details on how to resolve these deprecations in your app, see the deprecations guide.

Bug Fixes

Ember.js 7.0 includes many bug fixes, the following are some of the more notable ones:

  • #21076 Support default globals for strict mode with the runtime template compiler per RFC #1070.
  • #21098 Add support for this in explicit scope for the runtime template compiler.
  • #21107 Fix LinkTo inside inline SVG reloads your application
  • #21109 Fix missing value attribute on radio/checkbox inputs bound to empty string
  • #21122 Fix tracked collections delete() returning true for non-existent entries
  • #21124 Fix {{#each}} runtime crash when array contains null/undefined items with key
  • #21125 Fix crash when accessing negative index of helper positional args
  • #21128 Fix trackedMap and trackedWeakMap reactivity for existing keys
  • #21139 Port BrandedArray fix for Array-as-parent bug in destroyables
  • #21168 Fix EmberArray.reduce to match native behavior
  • #21189 Clear stale metadata references after destruction to allow GC
  • #21202 Fix <LinkTo>'s @current-when argument with nested routes containing dynamic segments

Ember CLI v7.0

Ember CLI 7.0 introduces no new public API, adds no new deprecations, and adds no new bugfixes. This release only adds an automatic breakage to previously deprecated public API from the 6.x cycle. This code will be cleaned up in future releases. You can read more about the deprecations in the deprecation guide

Thank You!

As a community-driven open-source project with an ambitious scope, each of these releases serves as a reminder that the Ember project would not have been possible without your continued support. We are extremely grateful to our contributors for their efforts.

联系我们 contact @ memedata.com