Skip to content

Commit 78d238c

Browse files
chore: revert version check in migrate (#15583)
1 parent 33d118f commit 78d238c

File tree

1 file changed

+1
-16
lines changed
  • packages/svelte/src/compiler/migrate

1 file changed

+1
-16
lines changed

packages/svelte/src/compiler/migrate/index.js

+1-16
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { migrate_svelte_ignore } from '../utils/extract_svelte_ignore.js';
1919
import { validate_component_options } from '../validate-options.js';
2020
import { is_reserved, is_svg, is_void } from '../../utils.js';
2121
import { regex_is_valid_identifier } from '../phases/patterns.js';
22-
import { VERSION } from 'svelte/compiler';
2322

2423
const regex_style_tags = /(<style[^>]+>)([\S\s]*?)(<\/style>)/g;
2524
const style_placeholder = '/*$$__STYLE_CONTENT__$$*/';
@@ -114,16 +113,6 @@ function find_closing_parenthesis(start, code) {
114113
return end;
115114
}
116115

117-
function check_support_writable_deriveds() {
118-
const [major, minor, patch] = VERSION.split('.');
119-
120-
if (+major < 5) return false;
121-
if (+minor < 25) return false;
122-
return true;
123-
}
124-
125-
const support_writable_derived = check_support_writable_deriveds();
126-
127116
/**
128117
* Does a best-effort migration of Svelte code towards using runes, event attributes and render tags.
129118
* May throw an error if the code is too complex to migrate automatically.
@@ -963,11 +952,7 @@ const instance_script = {
963952
const reassigned_bindings = bindings.filter((b) => b?.reassigned);
964953

965954
if (
966-
// on version 5.25.0 deriveds are writable so we can use them even if
967-
// reassigned (but if the right side is a literal we want to use `$state`)
968-
(support_writable_derived
969-
? node.body.expression.right.type !== 'Literal'
970-
: reassigned_bindings.length === 0) &&
955+
node.body.expression.right.type !== 'Literal' &&
971956
!bindings.some((b) => b?.kind === 'store_sub') &&
972957
node.body.expression.left.type !== 'MemberExpression'
973958
) {

0 commit comments

Comments
 (0)