I found that, as of December 2024, there is no standard way to to this.
I opened an issue at Svelte repo, and I will update this answer if the Svelte team publishes something.