diff --git a/packages/language-server/test/plugins/typescript/TypescriptPlugin.test.ts b/packages/language-server/test/plugins/typescript/TypescriptPlugin.test.ts index c7ad1ba3c..ddd984fc8 100644 --- a/packages/language-server/test/plugins/typescript/TypescriptPlugin.test.ts +++ b/packages/language-server/test/plugins/typescript/TypescriptPlugin.test.ts @@ -203,7 +203,7 @@ function test(useNewTransformation: boolean) { }, { name: 'foo', - kind: 14, + kind: 13, location: { uri: getUri('documentsymbols.svelte'), range: { diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/EachBlock.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/EachBlock.ts index b3bc07d0f..0af1981d5 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/EachBlock.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/EachBlock.ts @@ -34,13 +34,13 @@ export function handleEach(str: MagicString, eachBlock: BaseNode): void { transforms = [ `{ const $$_each = __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, [eachBlock.expression.start, eachBlock.expression.end], - `${containsComma ? ')' : ''}); for(const `, + `${containsComma ? ')' : ''}); for(let `, [eachBlock.context.start, eachBlock.context.end], ' of $$_each){' ]; } else { transforms = [ - 'for(const ', + 'for(let ', [eachBlock.context.start, eachBlock.context.end], ` of __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, [eachBlock.expression.start, eachBlock.expression.end], diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/blocks-without-whitespace-inbetween/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/blocks-without-whitespace-inbetween/expectedv2.js index 13efb020b..fcdd24ae1 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/blocks-without-whitespace-inbetween/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/blocks-without-whitespace-inbetween/expectedv2.js @@ -1 +1 @@ -if(name == "world"){ } for(const y of __sveltets_2_ensureArray(x)){ } { const $$_value = await (x);{ const y = $$_value; }}if(bla){ } \ No newline at end of file +if(name == "world"){ } for(let y of __sveltets_2_ensureArray(x)){ } { const $$_value = await (x);{ const y = $$_value; }}if(bla){ } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic-sequence/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic-sequence/expectedv2.js index 4dc15acf5..915d75222 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic-sequence/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic-sequence/expectedv2.js @@ -1,3 +1,3 @@ - for(const item of __sveltets_2_ensureArray((true, items))){ + for(let item of __sveltets_2_ensureArray((true, items))){ { svelteHTML.createElement("div", {});item; } } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic/expectedv2.js index cfc79a8ff..fae8223ce 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-basic/expectedv2.js @@ -1,3 +1,3 @@ - for(const item of __sveltets_2_ensureArray(items)){ + for(let item of __sveltets_2_ensureArray(items)){ { svelteHTML.createElement("div", {});item; } } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-index/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-index/expectedv2.js index b58cfffb6..bbfd903fa 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-index/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-index/expectedv2.js @@ -1,3 +1,3 @@ - for(const item of __sveltets_2_ensureArray(items)){let i = 1; + for(let item of __sveltets_2_ensureArray(items)){let i = 1; { svelteHTML.createElement("div", {});item;i; } } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key-else/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key-else/expectedv2.js index 75e69611d..0a2b43cd8 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key-else/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key-else/expectedv2.js @@ -1,4 +1,4 @@ - for(const item of __sveltets_2_ensureArray(items)){let i = 1;item.id; + for(let item of __sveltets_2_ensureArray(items)){let i = 1;item.id; { svelteHTML.createElement("div", {});item;i; } } { svelteHTML.createElement("div", {}); } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key/expectedv2.js index 04cc98512..851462a40 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-key/expectedv2.js @@ -1,3 +1,3 @@ - for(const item of __sveltets_2_ensureArray(items)){let i = 1;item.id; + for(let item of __sveltets_2_ensureArray(items)){let i = 1;item.id; { svelteHTML.createElement("div", {});item;i; } } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-nullish-coalescing/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-nullish-coalescing/expectedv2.js index 85fbdc6e6..b910227b5 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-nullish-coalescing/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-nullish-coalescing/expectedv2.js @@ -1,3 +1,3 @@ - for(const item of __sveltets_2_ensureArray(items ?? [])){ + for(let item of __sveltets_2_ensureArray(items ?? [])){ { svelteHTML.createElement("div", {});item; } } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-optional-chaining/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-optional-chaining/expectedv2.js index 4d5eed95c..2627ebdea 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-optional-chaining/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/each-block-optional-chaining/expectedv2.js @@ -1,3 +1,3 @@ - for(const item of __sveltets_2_ensureArray(someObject?.items)){ + for(let item of __sveltets_2_ensureArray(someObject?.items)){ { svelteHTML.createElement("div", {});item; } } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/editing-animation/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/editing-animation/expectedv2.js index 76b198473..b5f63b642 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/editing-animation/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/editing-animation/expectedv2.js @@ -1,3 +1,3 @@ - for(const item of __sveltets_2_ensureArray(list)){item; + for(let item of __sveltets_2_ensureArray(list)){item; { svelteHTML.createElement("li", { });__sveltets_2_ensureAnimation(flip(svelteHTML.mapElementTag('li'),__sveltets_2_AnimationMove,(opt?.)));item; } } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/editing-const/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/editing-const/expectedv2.js index d2b8c0c59..06115798a 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/editing-const/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/editing-const/expectedv2.js @@ -1,3 +1,3 @@ - for(const str of __sveltets_2_ensureArray([''])){ + for(let str of __sveltets_2_ensureArray([''])){ const lower = str.; } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block-shadowed/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block-shadowed/expectedv2.js index 58188d750..d051b7dbe 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block-shadowed/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block-shadowed/expectedv2.js @@ -1,13 +1,13 @@ if(hello){ - for(const hello of __sveltets_2_ensureArray(items)){let i = 1;hello.id; + for(let hello of __sveltets_2_ensureArray(items)){let i = 1;hello.id; { svelteHTML.createElement("div", {});hello;i; } if(hello){ - for(const hello of __sveltets_2_ensureArray(items)){ + for(let hello of __sveltets_2_ensureArray(items)){ if(hello){ hello; } } - for(const foo of __sveltets_2_ensureArray(items)){ + for(let foo of __sveltets_2_ensureArray(items)){ const hello = foo; if(hello){ hello; @@ -20,7 +20,7 @@ if(hello){ } if(hi && bye){ - for(const bye of __sveltets_2_ensureArray(items)){ + for(let bye of __sveltets_2_ensureArray(items)){ { svelteHTML.createElement("div", {});bye; } } if(bye){ @@ -28,17 +28,17 @@ if(hello){ } } else if (cool){ - for(const item of __sveltets_2_ensureArray(items)){let cool = 1; + for(let item of __sveltets_2_ensureArray(items)){let cool = 1; { svelteHTML.createElement("div", {});item;cool; } } }else{ - for(const hello of __sveltets_2_ensureArray(items)){ + for(let hello of __sveltets_2_ensureArray(items)){ { svelteHTML.createElement("div", {});hello; } } } } - for(const hello of __sveltets_2_ensureArray(items)){let i = 1; + for(let hello of __sveltets_2_ensureArray(items)){let i = 1; if(hello && i && bye){ hello; i; bye; } else if (hello && i && bye){ diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block/expectedv2.js index fbea60812..fb12d6d44 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/if-nested-each-block/expectedv2.js @@ -1,19 +1,19 @@ if(hello){ - for(const item of __sveltets_2_ensureArray(items)){let i = 1;item.id; + for(let item of __sveltets_2_ensureArray(items)){let i = 1;item.id; { svelteHTML.createElement("div", {});item;i; } } if(hi && bye){ - for(const item of __sveltets_2_ensureArray(items)){ + for(let item of __sveltets_2_ensureArray(items)){ { svelteHTML.createElement("div", {});item; } } { svelteHTML.createElement("p", {}); } } else if (cool){ - for(const item of __sveltets_2_ensureArray(items)){let i = 1; + for(let item of __sveltets_2_ensureArray(items)){let i = 1; { svelteHTML.createElement("div", {});item;i; } } }else{ - for(const item of __sveltets_2_ensureArray(items)){ + for(let item of __sveltets_2_ensureArray(items)){ { svelteHTML.createElement("div", {});item; } } } diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/nested-if-else-if-and-each-block/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/nested-if-else-if-and-each-block/expectedv2.js index cd383cd1f..45ffe209d 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/nested-if-else-if-and-each-block/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/nested-if-else-if-and-each-block/expectedv2.js @@ -1,5 +1,5 @@ if(true){ if(true){} else if (true){} }else{ - for(const _ of __sveltets_2_ensureArray([])){} + for(let _ of __sveltets_2_ensureArray([])){} } \ No newline at end of file diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expectedv2.ts index 37f1ef048..f680890fa 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expectedv2.ts @@ -70,7 +70,7 @@ async () => { } { svelteHTML.createElement("svg", { "on:click":handleClick,}); - for(const circle of __sveltets_2_ensureArray(circles)){ + for(let circle of __sveltets_2_ensureArray(circles)){ { svelteHTML.createElement("circle", { "cx":circle.cx,"cy":circle.cy,"r":circle.r,"on:click":event => select(circle, event),"on:contextmenu":() => { adjusting = !adjusting; if (adjusting) selected = circle; diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-inside-each/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-inside-each/expectedv2.ts index 83939d49b..db173a02c 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-inside-each/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-inside-each/expectedv2.ts @@ -1,10 +1,10 @@ /// ;function render() { /*Ωignore_startΩ*/;const __sveltets_createSlot = __sveltets_2_createCreateSlot();/*Ωignore_endΩ*/ -async () => { for(const item of __sveltets_2_ensureArray(items)){ +async () => { for(let item of __sveltets_2_ensureArray(items)){ { __sveltets_createSlot("default", { "a":item,}); } } - for(const { a } of __sveltets_2_ensureArray(items2)){ + for(let { a } of __sveltets_2_ensureArray(items2)){ { __sveltets_createSlot("second", { a,}); } }}; return { props: {}, slots: {'default': {a:__sveltets_1_unwrapArr(items)}, 'second': {a:(({ a }) => a)(__sveltets_1_unwrapArr(items2))}}, getters: {}, events: {} }} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-nest-scope/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-nest-scope/expectedv2.ts index d949f8f60..51c0c7c62 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-nest-scope/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-nest-scope/expectedv2.ts @@ -1,8 +1,8 @@ /// ;function render() { /*Ωignore_startΩ*/;const __sveltets_createSlot = __sveltets_2_createCreateSlot();/*Ωignore_endΩ*/ -async () => { for(const item of __sveltets_2_ensureArray(items)){ - for(const { a } of __sveltets_2_ensureArray(item)){ +async () => { for(let item of __sveltets_2_ensureArray(items)){ + for(let { a } of __sveltets_2_ensureArray(item)){ { __sveltets_createSlot("default", {a,}); } } { __sveltets_createSlot("second", { a,}); } diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-object-key/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-object-key/expectedv2.ts index 851744736..083c92d94 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-object-key/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-object-key/expectedv2.ts @@ -1,7 +1,7 @@ /// ;function render() { /*Ωignore_startΩ*/;const __sveltets_createSlot = __sveltets_2_createCreateSlot();/*Ωignore_endΩ*/ -async () => { for(const item of __sveltets_2_ensureArray(items)){ +async () => { for(let item of __sveltets_2_ensureArray(items)){ { __sveltets_createSlot("default", { "a":item,"b":{ item },"c":{ item: 'abc' }.item,"d":{ item: item },"e":$item,"f":$item,...g,...item,}); } }}; return { props: {}, slots: {'default': {a:__sveltets_1_unwrapArr(items), b:{ item:__sveltets_1_unwrapArr(items) }, c:{ item: 'abc' }.item, d:{ item: __sveltets_1_unwrapArr(items) }, e:$item, f:$item, ...g, ...__sveltets_1_unwrapArr(items)}}, getters: {}, events: {} }} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-var-shadowing/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-var-shadowing/expectedv2.ts index 23e60a6f6..3e2a87ff1 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-var-shadowing/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-var-shadowing/expectedv2.ts @@ -1,7 +1,7 @@ /// ;function render() { /*Ωignore_startΩ*/;const __sveltets_createSlot = __sveltets_2_createCreateSlot();/*Ωignore_endΩ*/ -async () => { { const $$_each = __sveltets_2_ensureArray(items); for(const items of $$_each){ +async () => { { const $$_each = __sveltets_2_ensureArray(items); for(let items of $$_each){ { __sveltets_createSlot("default", { "a":items,}); } }}}; return { props: {}, slots: {'default': {a:__sveltets_1_unwrapArr(items)}}, getters: {}, events: {} }} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each-destructure/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each-destructure/expectedv2.ts index 6c22dbf79..683c3bcc9 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each-destructure/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each-destructure/expectedv2.ts @@ -14,7 +14,7 @@ ; async () => { - for(const { width, height } of __sveltets_2_ensureArray(boxes)){ + for(let { width, height } of __sveltets_2_ensureArray(boxes)){ const {area, volume} = calculate(width, height, constant); const perimeter = (width + height) * constant; const [_width, _height, sum] = [width * constant, height, width * constant + height]; diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each/expectedv2.ts index 0878fceff..ef3faa977 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/const-tag-each/expectedv2.ts @@ -14,7 +14,7 @@ ; async () => { - for(const box of __sveltets_2_ensureArray(boxes)){ + for(let box of __sveltets_2_ensureArray(boxes)){ const {area, volume} = calculate(box.width, box.height, constant); const perimeter = (box.width + box.height) * constant; const [width, height, sum] = [box.width * constant, box.height, box.width * constant + box.height];