Skip to content

Commit 041d6fc

Browse files
committed
remove enableSourcemap option
1 parent 917f9c5 commit 041d6fc

File tree

12 files changed

+13
-97
lines changed

12 files changed

+13
-97
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ export interface CompileOptions extends ModuleCompileOptions {
178178
* @default null
179179
*/
180180
cssOutputFilename?: string;
181-
182-
// Other Svelte 4 compiler options:
183-
// enableSourcemap?: EnableSourcemap; // TODO bring back? https://github.com/sveltejs/svelte/pull/6835
184-
// legacy?: boolean; // TODO compiler error noting the new purpose?
185181
}
186182

187183
export interface ModuleCompileOptions {

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export const validate_component_options =
8787

8888
namespace: list(['html', 'svg', 'foreign']),
8989

90-
// TODO this is a sourcemap option, would be good to put under a sourcemap namespace
9190
outputFilename: string(undefined),
9291

9392
preserveComments: boolean(false),
@@ -96,16 +95,15 @@ export const validate_component_options =
9695

9796
runes: boolean(undefined),
9897

99-
sourcemap: validator(undefined, (input, keypath) => {
100-
// TODO
101-
return input;
102-
}),
103-
104-
enableSourcemap: validator(undefined, (input, keypath) => {
105-
// TODO decide if we want to keep this
98+
sourcemap: validator(undefined, (input) => {
99+
// Source maps can take on a variety of values, including string, JSON, map objects from magic-string and source-map,
100+
// so there's no good way to check type validity here
106101
return input;
107102
}),
108103

104+
enableSourcemap: warn_removed(
105+
'The enableSourcemap option has been removed. Source maps are always generated now, and tooling can choose to ignore them.'
106+
),
109107
hydratable: warn_removed(
110108
'The hydratable option has been removed. Svelte components are always hydratable now.'
111109
),

packages/svelte/tests/sourcemaps/samples/no-sourcemap/_config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/svelte/tests/sourcemaps/samples/no-sourcemap/input.svelte

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/svelte/tests/sourcemaps/samples/only-css-sourcemap/_config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/svelte/tests/sourcemaps/samples/only-css-sourcemap/input.svelte

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/svelte/tests/sourcemaps/samples/only-css-sourcemap/test.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/svelte/tests/sourcemaps/samples/only-js-sourcemap/_config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/svelte/tests/sourcemaps/samples/only-js-sourcemap/input.svelte

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/svelte/tests/sourcemaps/samples/only-js-sourcemap/test.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/svelte/types/index.d.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,6 @@ declare module 'svelte/compiler' {
672672
* @default null
673673
*/
674674
cssOutputFilename?: string;
675-
676-
// Other Svelte 4 compiler options:
677-
// enableSourcemap?: EnableSourcemap; // TODO bring back? https://github.com/sveltejs/svelte/pull/6835
678-
// legacy?: boolean; // TODO compiler error noting the new purpose?
679675
}
680676

681677
interface ModuleCompileOptions {
@@ -754,8 +750,11 @@ declare module 'svelte/compiler' {
754750
legacy_dependencies: Binding[];
755751
/** Legacy props: the `class` in `{ export klass as class}` */
756752
prop_alias: string | null;
757-
/** If this is set, all references should use this expression instead of the identifier name */
758-
expression: Expression | null;
753+
/**
754+
* If this is set, all references should use this expression instead of the identifier name.
755+
* If a function is given, it will be called with the identifier at that location and should return the new expression.
756+
*/
757+
expression: Expression | ((id: Identifier) => Expression) | null;
759758
/** If this is set, all mutations should use this expression */
760759
mutation: ((assignment: AssignmentExpression, context: Context<any, any>) => Expression) | null;
761760
}
@@ -1407,7 +1406,7 @@ declare module 'svelte/compiler' {
14071406
/** Set if something in the array expression is shadowed within the each block */
14081407
array_name: Identifier | null;
14091408
index: Identifier;
1410-
item_name: string;
1409+
item: Identifier;
14111410
declarations: Map<string, Binding>;
14121411
/** List of bindings that are referenced within the expression */
14131412
references: Binding[];
@@ -2403,10 +2402,6 @@ declare module 'svelte/types/compiler/interfaces' {
24032402
* @default null
24042403
*/
24052404
cssOutputFilename?: string;
2406-
2407-
// Other Svelte 4 compiler options:
2408-
// enableSourcemap?: EnableSourcemap; // TODO bring back? https://github.com/sveltejs/svelte/pull/6835
2409-
// legacy?: boolean; // TODO compiler error noting the new purpose?
24102405
}
24112406

24122407
interface ModuleCompileOptions {

sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Svelte now use Mutation Observers instead of IFrames to measure dimensions for `
6161
- The `false`/`true` (already deprecated previously) and the `"none"` values were removed as valid values from the `css` option
6262
- The `legacy` option was repurposed
6363
- The `hydratable` option has been removed. Svelte components are always hydratable now
64+
- The `enableSourcemap` option has been removed. Source maps are always generated now, tooling can choose to ignore it
6465
- The `tag` option was removed. Use `<svelte:options customElement="tag-name" />` inside the component instead
6566
- The `loopGuardTimeout`, `format`, `sveltePath`, `errorMode` and `varsReport` options were removed
6667

0 commit comments

Comments
 (0)