Skip to content

Commit e1b2d29

Browse files
authored
chore: add hmr compiler flag (#11112)
* chore: add hmr compiler flag * lint
1 parent 3bb2311 commit e1b2d29

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ export interface CompileOptions extends ModuleCompileOptions {
178178
* @default null
179179
*/
180180
cssOutputFilename?: string;
181+
/**
182+
* If `true`, compiles components with hot reloading support.
183+
*
184+
* @default false
185+
*/
186+
hmr?: boolean;
181187
}
182188

183189
export interface ModuleCompileOptions {
@@ -225,6 +231,7 @@ export type ValidatedCompileOptions = ValidatedModuleCompileOptions &
225231
legacy: Required<Required<CompileOptions>['legacy']>;
226232
runes: CompileOptions['runes'];
227233
customElementOptions: SvelteOptions['customElement'];
234+
hmr: CompileOptions['hmr'];
228235
};
229236

230237
export type DeclarationKind =

packages/svelte/src/compiler/validate-options.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ export const validate_component_options =
9595

9696
runes: boolean(undefined),
9797

98+
hmr: boolean(false),
99+
98100
sourcemap: validator(undefined, (input) => {
99101
// Source maps can take on a variety of values, including string, JSON, map objects from magic-string and source-map,
100102
// so there's no good way to check type validity here

packages/svelte/types/index.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,12 @@ declare module 'svelte/compiler' {
670670
* @default null
671671
*/
672672
cssOutputFilename?: string;
673+
/**
674+
* If `true`, compiles components with hot reloading support.
675+
*
676+
* @default false
677+
*/
678+
hmr?: boolean;
673679
}
674680

675681
interface ModuleCompileOptions {
@@ -2449,6 +2455,12 @@ declare module 'svelte/types/compiler/interfaces' {
24492455
* @default null
24502456
*/
24512457
cssOutputFilename?: string;
2458+
/**
2459+
* If `true`, compiles components with hot reloading support.
2460+
*
2461+
* @default false
2462+
*/
2463+
hmr?: boolean;
24522464
}
24532465

24542466
interface ModuleCompileOptions {

0 commit comments

Comments
 (0)