Repository navigation
fix(cloudflare): Detect decorated Agent classes after Babel memoizes their superclass - #26975
Conversation
size-limit report 📦Compared: b38dd06 (PR test merge using develop at 57fa96a) Against: 57fa96a (develop) · base run #68304 ✅ Baseline matches: this diff contains only this PR's changes.
|
Optional E2E testsAll optional checks were successful. 40 successful. See the run. Successful checks
|
|
junior rebase and check what is still needed to fix the CI on develop |
…their superclass Co-Authored-By: Martin Sonnberger <26038247+msonnb@users.noreply.github.com>
31cfa68 to
47a9abc
Compare
|
Rebased onto On the latest One optional check, |
What
The Cloudflare Vite plugin detects Agent and WorkerEntrypoint subclasses again when one of their members has a decorator, such as
@callable(). Before this fix, those classes got the plain Durable Object wrapper and no agent spans.Why
@babel/core8.1.4 now memoizes the superclass of a decorated class, soexport class MyAgent extends Agentreaches our transform asexport class MyAgent extends (_Agent = Agent).agents/viteruns that Babel transform before our plugin, and superclass detection only understood an identifier or a member expression. That's why the cloudflare-autoinstrument E2E app broke ondevelopwithout a code change. Classes that are only imported or re-exported into the entry weren't affected, because their base class is read from the untransformed source.The fix unwraps a plain
=assignment around the superclass before resolving it. WorkerEntrypoint detection reads the superclass the same way and had the same gap, so it uses the same helper.via @msonnb.
--
View Session [Sentry]