Deprecate Evented and @ember/object/events per RFC 1111 - #21542
Deprecate Evented and @ember/object/events per RFC 1111#21542NullVoxPopuli wants to merge 1 commit into
Conversation
📊 Size reportTarball size — dist/dev 0.4%↑
dist/prod 0.5%↑
smoke-tests/v2-app-template/dist 0.5%↑
smoke-tests/v2-app-hello-world-template/dist 0%↑
🤖 This report was automatically generated by wyvox/pkg-size |
0a61954 to
c97c54e
Compare
|
Where each RFC 1111 deprecation is handled:
Follow-ups outside this repo: ember-learn/deprecation-app#1404 needs |
| } | ||
|
|
||
| [`@test (new) lifecycle hooks during component append`](assert) { | ||
| [`${testUnless(DEPRECATIONS.DEPRECATE_EVENTED.isRemoved)} @test (new) lifecycle hooks during component append`]( |
There was a problem hiding this comment.
Shouldn't this test continue to exist after the deprecation is removed? It sounds like it is testing more than the deprecated behavior
There was a problem hiding this comment.
ya, -- this'll be removed with the ember/component deprecation later
| }).create(); | ||
| if (!DEPRECATIONS.DEPRECATE_EVENTED.isRemoved) { | ||
| moduleFor( | ||
| 'Syntax test: {{#each}} with array proxies, content is updated after init', |
There was a problem hiding this comment.
This test also doesn't seem dependent upon the deprecated behavior?
There was a problem hiding this comment.
it uses on -- and observers use Evented
There was a problem hiding this comment.
Are you saying that deprecating Evented soft-deprecates observers?
I meant that I felt this test should continue to exist after the removal of Evented. But that's going from the title of the test. init continues to exist without on
There was a problem hiding this comment.
not exactly -- it's specifically the on decorator from @ember/object/evented that is deprecated, and since that's used in the test, I suppose we could just define init rather than use the event for init -- I'll update to that so tha test can stay around (or rather, have a more precise deprecation later, since I think emberA is supposed to be deprecated, but that deprecation is not shipped)
There was a problem hiding this comment.
👍 exactly what I was trying to say
2078983 to
f7e5b7f
Compare
| } | ||
|
|
||
| [`@test lifecycle hooks during component append`](assert) { | ||
| [`${testUnless(DEPRECATIONS.DEPRECATE_EVENTED.isRemoved)} @test lifecycle hooks during component append`]( |
There was a problem hiding this comment.
Shouldn't this test remain even after this deprecation is removed?
There was a problem hiding this comment.
yes, thank you
| }).create(); | ||
| if (!DEPRECATIONS.DEPRECATE_EVENTED.isRemoved) { | ||
| moduleFor( | ||
| 'Syntax test: {{#each}} with array proxies, content is updated after init', |
There was a problem hiding this comment.
Are you saying that deprecating Evented soft-deprecates observers?
I meant that I felt this test should continue to exist after the removal of Evented. But that's going from the title of the test. init continues to exist without on
42ac66c to
1a4065b
Compare
Squashed from PR #20970 by Peter Wagenet, rebased onto current main. Co-authored-by: Peter Wagenet <peter@wagenet.us> Finish RFC 1111 implementation: id/versions, deep imports, main compatibility - Register the deprecation as `deprecate-evented` (since 7.3.0, until 8.0.0), matching the current DEPRECATIONS id conventions - Use deep module imports per current main conventions - Drop the resurrected packages/ember/barrel.ts (deleted on main) - Drop the mixin-deprecation re-exports from the eager utils barrel Teach the side-effect probe that setDeprecation is metadata association setDeprecation(mixin, value) only writes onto its first argument, so when the mixin is file-local (as in @ember/object/evented) the association is unobservable unless the module's bindings are imported — same category as setClassicDecorator and friends. Restore Function-based signatures in internal event plumbing The Function -> ((...args: any[]) => void) narrowing in metal/meta only served the internal signatures and forced casts at every call site. Keep the this-aware overloads on the public deprecated surface (@ember/object/events, RouterService) and leave the internal plumbing typed as it was on main, so the diff only carries the deprecation work. Inline Evented methods on framework classes instead of applying the mixin CoreView, Route, and EmberRouter now define on/one/off/trigger/has as native class methods delegating to shared standalone implementations (metal/lib/evented-methods), the same shape RouterService already uses. The framework no longer applies the deprecated Evented mixin anywhere, which removes the machinery that existed only to silence internal applications: - utils/lib/mixin-deprecation.ts (setDeprecation/findDeprecation/ disableDeprecations) and the Mixin#reopen DEBUG hook are gone; the deprecation is communicated by the methods themselves. - CoreView's init-time trigger/has swap hack is unnecessary now that the overrides are ordinary class methods. - @ember/object/evented no longer has a top-level setDeprecation call, so the module is side-effect free again and the tree-shakability probe no longer needs to know about setDeprecation. Tests that expected the definition-time "Evented is deprecated" warning now create their objects without a wrapper; method-call deprecations are unchanged. Keep Evented.detect true for framework classes CoreView, Route, and EmberRouter no longer apply the Evented mixin, but their instances still provide its methods. Record Evented in each prototype's meta from a class static block so Mixin#detect keeps answering true for instances and subclasses, exactly as it did when the mixin was applied.
1a4065b to
7c50755
Compare
RFC advancement PR: emberjs/rfcs#1139
Supersedes:
I haven't been able to get the deprecations to show -- which I feel like is a workflow / skill issue on my part.
my apps also don't use any of the deprecated apis I think.
I did test router/router-service, and there are no deprecations there, which is good
Deprecation Guide
PR Description from #21491
Implements RFC 1111: Deprecating
Ember.Eventedand@ember/object/events.This finishes the work started in #20970 (the squashed original work is preserved with @wagenet as author; a follow-up commit rebases it onto current
mainand resolves the open questions).What this deprecates
All under the single id
deprecate-evented(since: { available: '7.3.0' },until: '8.0.0', staged as available only since the RFC is at the Accepted stage):Eventedmixin (via a new internal mixin-deprecation mechanism:setDeprecation/findDeprecationfire inMixin#reopenwhen a deprecated mixin — or a mixin containing one — is applied,DEBUG-only)Eventedmethodson/one/off/trigger/has(including on framework classes like classicComponent,Route, andEmberRouter)addListener/removeListener/sendEventimported from@ember/object/events(deprecating wrappers; the internal@ember/-internals/metalimplementations remain silent)on()event decorator from@ember/object/eventedRouterService exemption
Per the RFC,
RouterService's event methods are not deprecated: it no longer extendsEventedand instead implementson/one/off/trigger/hasdirectly on top of the internal (non-deprecating) listener functions, withrouteWillChange/routeDidChangedocumented types.Framework internals fire no deprecations
CoreView,Route,EmberRouter) are wrapped indisableDeprecations()didInsertElement,willRender, …) andEventDispatcherdispatch now go through new internalsendCoreViewEvent/hasCoreViewListenerhelpers instead ofview.trigger()/view.has()Routeactivate/deactivateandEmberRouterrouteWillChange/routeDidChangeuse internalsendEventdirectlyaddListener/removeListenerThis is proven by the
ALL_DEPRECATIONS_ENABLED=truesuite run: any unexpected deprecation fails a test, and all 9427 tests pass.Differences from #20970
deprecate-evented(was placeholderember-evented), versions updated from 6.12.0 to 7.3.0; the guide in Add deprecation guide for Ember.Evented and @ember/object/events ember-learn/deprecation-app#1404 (evented.md) should be renamed todeprecate-evented.mdand its versions updated to matchmain: deep-path imports (ember-local/no-barrel-imports), the removedpackages/emberbarrel, and the reorganized glimmer internalsVerified locally
ALL_DEPRECATIONS_ENABLED=true,OVERRIDE_DEPRECATION_VERSION=15.0.0, production — 0 failuresOVERRIDE_DEPRECATION_VERSION=15.0.0type-check:internals,type-check:types, eslint, prettier, node tests, docs coverage🤖 Generated with Claude Code