From 2837a1b30ce7bb75ddeb45fa33e610be2459f3e9 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 21 Apr 2024 17:16:51 -0400 Subject: [PATCH] fix: mark `accessors` and `immutable` as deprecated --- .changeset/tiny-meals-deliver.md | 5 +++++ packages/svelte/src/compiler/types/index.d.ts | 2 ++ packages/svelte/src/compiler/validate-options.js | 7 +++++-- packages/svelte/types/index.d.ts | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .changeset/tiny-meals-deliver.md diff --git a/.changeset/tiny-meals-deliver.md b/.changeset/tiny-meals-deliver.md new file mode 100644 index 0000000000..94969362d0 --- /dev/null +++ b/.changeset/tiny-meals-deliver.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: mark `accessors` and `immutable` as deprecated diff --git a/packages/svelte/src/compiler/types/index.d.ts b/packages/svelte/src/compiler/types/index.d.ts index d94a80a77c..1b4a09d989 100644 --- a/packages/svelte/src/compiler/types/index.d.ts +++ b/packages/svelte/src/compiler/types/index.d.ts @@ -94,6 +94,7 @@ export interface CompileOptions extends ModuleCompileOptions { * If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`. * * @default false + * @deprecated This will have no effect in runes mode */ accessors?: boolean; /** @@ -107,6 +108,7 @@ export interface CompileOptions extends ModuleCompileOptions { * This allows it to be less conservative about checking whether values have changed. * * @default false + * @deprecated This will have no effect in runes mode */ immutable?: boolean; /** diff --git a/packages/svelte/src/compiler/validate-options.js b/packages/svelte/src/compiler/validate-options.js index 6c12a43e2b..e0d5f8bd2b 100644 --- a/packages/svelte/src/compiler/validate-options.js +++ b/packages/svelte/src/compiler/validate-options.js @@ -40,7 +40,10 @@ export const validate_component_options = object({ ...common, - accessors: boolean(false), + accessors: deprecate( + 'The accessors option has been deprecated. It will have no effect in runes mode.', + boolean(false) + ), css: validator('external', (input) => { if (input === true || input === false) { @@ -73,7 +76,7 @@ export const validate_component_options = discloseVersion: boolean(true), immutable: deprecate( - 'The immutable option has been deprecated. It has no effect in runes mode.', + 'The immutable option has been deprecated. It will have no effect in runes mode.', boolean(false) ), diff --git a/packages/svelte/types/index.d.ts b/packages/svelte/types/index.d.ts index 900bee5a76..44b0fa88a4 100644 --- a/packages/svelte/types/index.d.ts +++ b/packages/svelte/types/index.d.ts @@ -585,6 +585,7 @@ declare module 'svelte/compiler' { * If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`. * * @default false + * @deprecated This will have no effect in runes mode */ accessors?: boolean; /** @@ -598,6 +599,7 @@ declare module 'svelte/compiler' { * This allows it to be less conservative about checking whether values have changed. * * @default false + * @deprecated This will have no effect in runes mode */ immutable?: boolean; /** @@ -2395,6 +2397,7 @@ declare module 'svelte/types/compiler/interfaces' { * If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`. * * @default false + * @deprecated This will have no effect in runes mode */ accessors?: boolean; /** @@ -2408,6 +2411,7 @@ declare module 'svelte/types/compiler/interfaces' { * This allows it to be less conservative about checking whether values have changed. * * @default false + * @deprecated This will have no effect in runes mode */ immutable?: boolean; /**