Skip to content

Commit

Permalink
chore: add hmr compiler flag (sveltejs#11112)
Browse files Browse the repository at this point in the history
* chore: add hmr compiler flag

* lint
  • Loading branch information
trueadm authored Apr 10, 2024
1 parent 3bb2311 commit e1b2d29
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/svelte/src/compiler/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ export interface CompileOptions extends ModuleCompileOptions {
* @default null
*/
cssOutputFilename?: string;
/**
* If `true`, compiles components with hot reloading support.
*
* @default false
*/
hmr?: boolean;
}

export interface ModuleCompileOptions {
Expand Down Expand Up @@ -225,6 +231,7 @@ export type ValidatedCompileOptions = ValidatedModuleCompileOptions &
legacy: Required<Required<CompileOptions>['legacy']>;
runes: CompileOptions['runes'];
customElementOptions: SvelteOptions['customElement'];
hmr: CompileOptions['hmr'];
};

export type DeclarationKind =
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/compiler/validate-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export const validate_component_options =

runes: boolean(undefined),

hmr: boolean(false),

sourcemap: validator(undefined, (input) => {
// Source maps can take on a variety of values, including string, JSON, map objects from magic-string and source-map,
// so there's no good way to check type validity here
Expand Down
12 changes: 12 additions & 0 deletions packages/svelte/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,12 @@ declare module 'svelte/compiler' {
* @default null
*/
cssOutputFilename?: string;
/**
* If `true`, compiles components with hot reloading support.
*
* @default false
*/
hmr?: boolean;
}

interface ModuleCompileOptions {
Expand Down Expand Up @@ -2449,6 +2455,12 @@ declare module 'svelte/types/compiler/interfaces' {
* @default null
*/
cssOutputFilename?: string;
/**
* If `true`, compiles components with hot reloading support.
*
* @default false
*/
hmr?: boolean;
}

interface ModuleCompileOptions {
Expand Down

0 comments on commit e1b2d29

Please sign in to comment.