Skip to content

Commit 2ea2be3

Browse files
authored
docs: explain runes compiler option behavior (#12578)
closes #11523
1 parent cf8df0b commit 2ea2be3

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

packages/svelte/src/compiler/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ export interface CompileOptions extends ModuleCompileOptions {
129129
* Set to `undefined` (the default) to infer runes mode from the component code.
130130
* Is always `true` for JS/TS modules compiled with Svelte.
131131
* Will be `true` by default in Svelte 6.
132+
* Note that setting this to `true` in your `svelte.config.js` will force runes mode for your entire project, including components in `node_modules`,
133+
* which is likely not what you want. If you're using Vite, consider using [dynamicCompileOptions](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions) instead.
132134
* @default undefined
133135
*/
134136
runes?: boolean | undefined;

packages/svelte/src/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// This should contain all the public interfaces (not all of them are actually importable, check current Svelte for which ones are).
22

3-
import type { Getters } from '#shared';
43
import './ambient.js';
54

65
/**

packages/svelte/types/index.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,6 @@ declare module 'svelte' {
303303
: [type: Type, parameter: EventMap[Type], options?: DispatchOptions]
304304
): boolean;
305305
}
306-
type Getters<T> = {
307-
[K in keyof T]: () => T[K];
308-
};
309306
/**
310307
* The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
311308
* It must be called during the component's initialisation (but doesn't need to live *inside* the component;
@@ -470,6 +467,9 @@ declare module 'svelte' {
470467
* https://svelte.dev/docs/svelte#getallcontexts
471468
* */
472469
export function getAllContexts<T extends Map<any, any> = Map<any, any>>(): T;
470+
type Getters<T> = {
471+
[K in keyof T]: () => T[K];
472+
};
473473

474474
export {};
475475
}
@@ -810,6 +810,8 @@ declare module 'svelte/compiler' {
810810
* Set to `undefined` (the default) to infer runes mode from the component code.
811811
* Is always `true` for JS/TS modules compiled with Svelte.
812812
* Will be `true` by default in Svelte 6.
813+
* Note that setting this to `true` in your `svelte.config.js` will force runes mode for your entire project, including components in `node_modules`,
814+
* which is likely not what you want. If you're using Vite, consider using [dynamicCompileOptions](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions) instead.
813815
* @default undefined
814816
*/
815817
runes?: boolean | undefined;
@@ -2628,6 +2630,8 @@ declare module 'svelte/types/compiler/interfaces' {
26282630
* Set to `undefined` (the default) to infer runes mode from the component code.
26292631
* Is always `true` for JS/TS modules compiled with Svelte.
26302632
* Will be `true` by default in Svelte 6.
2633+
* Note that setting this to `true` in your `svelte.config.js` will force runes mode for your entire project, including components in `node_modules`,
2634+
* which is likely not what you want. If you're using Vite, consider using [dynamicCompileOptions](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions) instead.
26312635
* @default undefined
26322636
*/
26332637
runes?: boolean | undefined;

0 commit comments

Comments
 (0)