File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 46
46
"version:ci" : " env-cmd -e version-ci pnpm run build:meta && changeset version"
47
47
},
48
48
"peerDependencies" : {
49
- "svelte" : " ^3.37.0 || ^4.0.0 || ^5.0.0-next.10 "
49
+ "svelte" : " ^3.37.0 || ^4.0.0 || ^5.0.0-next.15 "
50
50
},
51
51
"peerDependenciesMeta" : {
52
52
"svelte" : {
104
104
"prettier-plugin-svelte" : " ^3.0.0" ,
105
105
"rimraf" : " ^5.0.1" ,
106
106
"semver" : " ^7.5.1" ,
107
- "svelte" : " ^5.0.0-next.10 " ,
107
+ "svelte" : " ^5.0.0-next.15 " ,
108
108
"svelte2tsx" : " ^0.6.25" ,
109
109
"typescript" : " ~5.1.3" ,
110
110
"typescript-eslint-parser-for-extra-files" : " ^0.5.0"
Original file line number Diff line number Diff line change @@ -243,11 +243,11 @@ export class ScriptLetContext {
243
243
}
244
244
245
245
public addVariableDeclarator (
246
- expression : ESTree . AssignmentExpression ,
246
+ declarator : ESTree . VariableDeclarator | ESTree . AssignmentExpression ,
247
247
parent : SvelteNode ,
248
248
...callbacks : ScriptLetCallback < ESTree . VariableDeclarator > [ ]
249
249
) : ScriptLetCallback < ESTree . VariableDeclarator > [ ] {
250
- const range = getNodeRange ( expression ) ;
250
+ const range = getNodeRange ( declarator ) ;
251
251
const part = this . ctx . code . slice ( ...range ) ;
252
252
this . appendScript (
253
253
`const ${ part } ;` ,
Original file line number Diff line number Diff line change @@ -204,7 +204,6 @@ export function getThenFromAwaitBlock(
204
204
}
205
205
return then . skip ? null : then ;
206
206
}
207
-
208
207
export function getCatchFromAwaitBlock (
209
208
block : SvAST . AwaitBlock | Compiler . AwaitBlock ,
210
209
) : Compiler . Fragment | SvAST . CatchBlock | null {
@@ -217,3 +216,15 @@ export function getCatchFromAwaitBlock(
217
216
}
218
217
return catchFragment . skip ? null : catchFragment ;
219
218
}
219
+
220
+ // ConstTag
221
+ export function getDeclaratorFromConstTag (
222
+ node : SvAST . ConstTag | Compiler . ConstTag ,
223
+ ) :
224
+ | ESTree . AssignmentExpression
225
+ | Compiler . ConstTag [ "declaration" ] [ "declarations" ] [ 0 ] {
226
+ return (
227
+ ( node as Compiler . ConstTag ) . declaration ?. declarations ?. [ 0 ] ??
228
+ ( node as SvAST . ConstTag ) . expression
229
+ ) ;
230
+ }
Original file line number Diff line number Diff line change 1
1
import type { SvelteConstTag } from "../../ast" ;
2
2
import type { Context } from "../../context" ;
3
+ import { getDeclaratorFromConstTag } from "../compat" ;
3
4
import type * as SvAST from "../svelte-ast-types" ;
5
+ import type * as Compiler from "svelte/compiler" ;
4
6
5
7
/** Convert for ConstTag */
6
8
export function convertConstTag (
7
- node : SvAST . ConstTag ,
9
+ node : SvAST . ConstTag | Compiler . ConstTag ,
8
10
parent : SvelteConstTag [ "parent" ] ,
9
11
ctx : Context ,
10
12
) : SvelteConstTag {
@@ -15,7 +17,7 @@ export function convertConstTag(
15
17
...ctx . getConvertLocation ( node ) ,
16
18
} ;
17
19
ctx . scriptLet . addVariableDeclarator (
18
- node . expression ,
20
+ getDeclaratorFromConstTag ( node ) ,
19
21
mustache ,
20
22
( declaration ) => {
21
23
mustache . declaration = declaration ;
You can’t perform that action at this time.
0 commit comments