feat: add support for loading svelte config with .ts or .mts
#2804extension in runtimes that support it.
Should .cjs be removed? The --experimental-modules flag is probably not required anymore either.
TODO: tests
Question: why is the config loader using find-up? As far as i am aware svelte config isn't discovered that way by other tools like sveltekit or vite-plugin-svelte, leading to potential mismatches if there is a stray svelte.config.js file deeper down in the source tree
The reason why it's a find-up is that the original version, before ESM support, is handled by cosmiconfig. Not sure if there is anyone actually using it.
What do you mean by find-up? The reason we go up/down the tree is that we need to discover the config file before a potential typescript language service is instantiated, whose setting might be influenced by what's in the Svelte config.
in these situations, language-tools might use a svelte.config.js file that sveltekit or vite-plugin-svelte would ignore:
no svelte.config.js inside app/ but outside there is one
svelte.config.js
app/package.json
app/vite.config.js
app/src/App.svelte
extra svelte config inside src is closer than the one in app/
app/package.json
app/vite.config.js
app/svelte.config.js
app/src/foo/App.svelte
app/src/svelte.config.js
ideally it would be able to discover svelte app root by some kind of heuristic, eg .git or package manager lock, package.json and svelte.config.js in same dir and package.json has svelte in deps?