mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-10-25 14:00:40 +00:00
b454f17928
SvelteKit 3 refuses svelte.config.js, and kit 2.62+ already takes its config
through sveltekit({...}), so the move lands on kit 2.70.3 first. Kit's own
keys (adapter) stay with kit; dynamicCompileOptions is forwarded to
vite-plugin-svelte.
The vitest jsdom project used a bare svelte(), which got runes mode only by
loading svelte.config.js itself. Both configs now import dynamicCompileOptions
from one module, svelteCompileOptions.ts, and the jsdom plugin passes
configFile: false. Deleting the file without that would have dropped runes
mode from component tests silently.
Proofs:
- runesMode.svelte.test.ts: importing a component with a legacy $: statement
is refused in the jsdom project; red without the vitest change.
- svelteCompileOptions.test.ts: resolving the real vite.config.ts yields
vite-plugin-svelte options carrying the forcing ({runes: true} for ours,
undefined for node_modules) and configFile false; red without the forward.
The unused @sveltejs/adapter-auto is removed.
Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS
18 lines
1022 B
TypeScript
18 lines
1022 B
TypeScript
// The Svelte compile options every .svelte file in this app is built with,
|
|
// shared by the two configs that compile Svelte (TASK-3423):
|
|
//
|
|
// - vite.config.ts passes them to `sveltekit({...})`, which forwards them to
|
|
// vite-plugin-svelte for the app build and the dev server;
|
|
// - vitest.config.ts passes them to the jsdom project's own `svelte()`.
|
|
//
|
|
// They used to live in svelte.config.js, which vite-plugin-svelte loads by
|
|
// itself, and that is how the jsdom project got them without naming them.
|
|
// SvelteKit 3 refuses that file, and deleting it would have dropped runes mode
|
|
// from component tests silently. Both consumers now import them from here, and
|
|
// runesMode.svelte.test.ts / svelteCompileOptions.test.ts fail if either stops.
|
|
|
|
/** Every file of ours compiles in runes mode; dependencies decide for themselves. */
|
|
export function dynamicCompileOptions({ filename }: { filename: string }): { runes: true } | undefined {
|
|
return filename.includes('node_modules') ? undefined : { runes: true };
|
|
}
|