From e6c4c8b63d72eeb0daa6b9d1cd37a3658ebb3320 Mon Sep 17 00:00:00 2001 From: Lyu Jason Date: Thu, 16 Jul 2020 22:35:17 +0800 Subject: [PATCH] wrap template with callback --- packages/svelte2tsx/src/svelte2tsx.ts | 9 ++++++++- packages/svelte2tsx/test/sourcemaps/let.html | 4 ++-- packages/svelte2tsx/test/sourcemaps/repl.html | 4 ++-- .../svelte2tsx/samples/array-binding-export/expected.tsx | 2 +- .../test/svelte2tsx/samples/ast-offset-none/expected.tsx | 4 ++-- .../test/svelte2tsx/samples/ast-offset-some/expected.tsx | 4 ++-- .../svelte2tsx/samples/await-with-$store/expected.tsx | 6 +++--- .../samples/circle-drawer-example/expected.tsx | 6 +++--- .../samples/component-default-slot/expected.tsx | 6 +++--- .../samples/component-multiple-slots/expected.tsx | 6 +++--- .../samples/component-slot-crazy-attributes/expected.tsx | 6 +++--- .../samples/export-arrow-function/expected.tsx | 2 +- .../test/svelte2tsx/samples/export-const/expected.tsx | 2 +- .../test/svelte2tsx/samples/export-has-type/expected.tsx | 2 +- .../svelte2tsx/samples/export-js-strictMode/expected.tsx | 2 +- .../test/svelte2tsx/samples/export-list/expected.tsx | 2 +- .../samples/export-references-local/expected.tsx | 2 +- .../svelte2tsx/samples/export-ts-strictMode/expected.tsx | 2 +- .../samples/export-with-default-multi/expected.tsx | 2 +- .../svelte2tsx/samples/import-single-quote/expected.tsx | 6 +++--- .../test/svelte2tsx/samples/imports/expected.tsx | 6 +++--- .../module-script-and-script-in-line/expected.tsx | 4 ++-- .../module-script-and-script-in-line2/expected.tsx | 4 ++-- .../samples/module-script-and-script/expected.tsx | 6 +++--- .../samples/module-script-and-script2/expected.tsx | 6 +++--- .../test/svelte2tsx/samples/multiple-export/expected.tsx | 4 ++-- .../samples/nested-$-variables-script/expected.tsx | 4 ++-- .../samples/object-binding-export/expected.tsx | 2 +- .../test/svelte2tsx/samples/reactive-block/expected.tsx | 2 +- .../samples/reactive-declare-object/expected.tsx | 2 +- .../svelte2tsx/samples/reactive-declare/expected.tsx | 2 +- .../test/svelte2tsx/samples/renamed-exports/expected.tsx | 2 +- .../samples/script-and-module-script/expected.tsx | 6 +++--- .../expected.tsx | 6 +++--- .../svelte2tsx/samples/script-on-bottom/expected.tsx | 6 +++--- .../samples/script-style-like-component/expected.tsx | 6 +++--- .../samples/self-closing-component/expected.tsx | 6 +++--- .../test/svelte2tsx/samples/single-export/expected.tsx | 4 ++-- .../samples/typed-export-with-default/expected.tsx | 2 +- .../svelte2tsx/samples/uses-$$props-script/expected.tsx | 4 ++-- .../samples/uses-$$props-ts-strictMode/expected.tsx | 4 ++-- .../samples/uses-$$restProps-script/expected.tsx | 4 ++-- .../uses-$store-with-assignment-operators/expected.tsx | 6 +++--- .../uses-$store-with-exclamation-mark/expected.tsx | 6 +++--- .../samples/uses-$store-with-increments/expected.tsx | 6 +++--- .../test/svelte2tsx/samples/uses-$store/expected.tsx | 6 +++--- 46 files changed, 101 insertions(+), 94 deletions(-) diff --git a/packages/svelte2tsx/src/svelte2tsx.ts b/packages/svelte2tsx/src/svelte2tsx.ts index 2e7604bed..56334575c 100644 --- a/packages/svelte2tsx/src/svelte2tsx.ts +++ b/packages/svelte2tsx/src/svelte2tsx.ts @@ -918,7 +918,8 @@ function createRenderFunction( str.overwrite(scriptTag.start + 1, scriptTagEnd, `function render() {${propsDecl}\n`); const scriptEndTagStart = htmlx.lastIndexOf('<', scriptTag.end - 1); - str.overwrite(scriptEndTagStart, scriptTag.end, ';\n<>', { + // wrap template with callback + str.overwrite(scriptEndTagStart, scriptTag.end, ';\n() => (<>', { contentOnly: true, }); } else { @@ -940,6 +941,12 @@ function createRenderFunction( const returnString = `\nreturn { props: ${createPropsStr( exportedNames, )}, slots: ${slotsAsDef} }}`; + + // wrap template with callback + if (scriptTag) { + str.append(');'); + } + str.append(returnString); } diff --git a/packages/svelte2tsx/test/sourcemaps/let.html b/packages/svelte2tsx/test/sourcemaps/let.html index 1e35cf458..fbf18a0d2 100644 --- a/packages/svelte2tsx/test/sourcemaps/let.html +++ b/packages/svelte2tsx/test/sourcemaps/let.html @@ -2,8 +2,8 @@ ;let selected; $: selected = __sveltets_invalidate(() => lookup.get(slug)); ; -<> - +() => (<> +); return { props: {}, slots: {} }} export default class { diff --git a/packages/svelte2tsx/test/sourcemaps/repl.html b/packages/svelte2tsx/test/sourcemaps/repl.html index 761ea5f09..3ea4b947e 100644 --- a/packages/svelte2tsx/test/sourcemaps/repl.html +++ b/packages/svelte2tsx/test/sourcemaps/repl.html @@ -111,7 +111,7 @@ }); } ; -<> +() => (<> @@ -175,7 +175,7 @@ }}} - +); return { props: {slug: slug , chapter: chapter}, slots: {} }} export default class { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/array-binding-export/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/array-binding-export/expected.tsx index f93ef3752..97c434d8d 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/array-binding-export/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/array-binding-export/expected.tsx @@ -2,7 +2,7 @@ let [a,b,c] = [1,2,3]; ; -<> +() => (<>); return { props: {a: a , b: b , c: c}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-none/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-none/expected.tsx index 0a284a3e9..250ffb0e8 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-none/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-none/expected.tsx @@ -1,9 +1,9 @@ <>;function render() { __sveltets_store_get(var); -<> +() => (<>); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-some/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-some/expected.tsx index abbdb131f..ee169a2dd 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-some/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/ast-offset-some/expected.tsx @@ -1,9 +1,9 @@ <>;function render() { __sveltets_store_get(var); -<> +() => (<>); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/await-with-$store/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/await-with-$store/expected.tsx index e403978ab..edcff2454 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/await-with-$store/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/await-with-$store/expected.tsx @@ -4,16 +4,16 @@ function render() { const store = readable(Promise.resolve('test'), () => {}); ; -<> +() => (<> {() => {let _$$p = (__sveltets_store_get(store)); <>

loading

; _$$p.then((data) => {<> {data} -})}} +})}}); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expected.tsx index 806bf201e..3089b4ba4 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/circle-drawer-example/expected.tsx @@ -57,7 +57,7 @@ return circles.map(({ cx, cy, r }) => ({ cx, cy, r })); } ; -<> +() => (<> @@ -86,10 +86,10 @@

adjust diameter of circle at {selected.cx}, {selected.cy}

-}}} +}}}); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/component-default-slot/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/component-default-slot/expected.tsx index a25f2b30e..af1a864cc 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/component-default-slot/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/component-default-slot/expected.tsx @@ -2,13 +2,13 @@ let b = 7; ; -<> +() => (<>
Hello -
+); return { props: {}, slots: {default: {a:b}} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/component-multiple-slots/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/component-multiple-slots/expected.tsx index 5535a70c0..ef5299ab2 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/component-multiple-slots/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/component-multiple-slots/expected.tsx @@ -4,14 +4,14 @@ let d = 5; let e = 5; ; -<> +() => (<>
Hello -
+); return { props: {}, slots: {default: {a:b}, test: {c:d, e:e}} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-crazy-attributes/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-crazy-attributes/expected.tsx index 844b9f608..4dc60e3e2 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-crazy-attributes/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/component-slot-crazy-attributes/expected.tsx @@ -2,13 +2,13 @@ let b = 7; ; -<> +() => (<>
Hello -
+); return { props: {}, slots: {default: {a:b, b:b, c:"b", d:"__svelte_ts_string", e:b}} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-arrow-function/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-arrow-function/expected.tsx index 726965c91..a9030b29d 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-arrow-function/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-arrow-function/expected.tsx @@ -5,7 +5,7 @@ return c; } ; -<> +() => (<>); return { props: {f: f}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-const/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-const/expected.tsx index deed22e9a..e10d2ccd4 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-const/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-const/expected.tsx @@ -2,7 +2,7 @@ const name: string = "world"; ; -<> +() => (<>); return { props: {name: name} as {name?: string}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-has-type/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-has-type/expected.tsx index 5bf4f3ee1..d70804bfc 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-has-type/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-has-type/expected.tsx @@ -4,7 +4,7 @@ let a: A; let b: A = {};b = __sveltets_any(b);; ; -<> +() => (<>); return { props: {a: a , b: b} as {a: A, b?: A}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-js-strictMode/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-js-strictMode/expected.tsx index 025ed99f9..b3d838ced 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-js-strictMode/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-js-strictMode/expected.tsx @@ -4,7 +4,7 @@ let b: number | undefined; let c: number = 123;c = __sveltets_any(c);; ; -<> +() => (<>); return { props: {a: a , b: b , c: c} as {a: number, b: number | undefined, c?: number}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-list/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-list/expected.tsx index 9fb1c29d2..2d014e707 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-list/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-list/expected.tsx @@ -4,7 +4,7 @@ let name2 = "world" ; -<> +() => (<>); return { props: {name: name , name2: name2}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-references-local/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-references-local/expected.tsx index 276b6ce44..bc19f0732 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-references-local/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-references-local/expected.tsx @@ -3,7 +3,7 @@ let world = "world"; let name = world; ; -<> +() => (<>); return { props: {name: name}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-ts-strictMode/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-ts-strictMode/expected.tsx index 39ba3111c..5cbe38894 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-ts-strictMode/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-ts-strictMode/expected.tsx @@ -4,7 +4,7 @@ let b: number | undefined; let c: number = 123;c = __sveltets_any(c);; ; -<> +() => (<>); return { props: {a: a , b: b , c: c} as {a: number, b: number | undefined, c?: number}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/export-with-default-multi/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/export-with-default-multi/expected.tsx index 14f6fc067..a3dacc2ad 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/export-with-default-multi/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/export-with-default-multi/expected.tsx @@ -4,7 +4,7 @@ let name = "world";name = __sveltets_any(name);;let world = ''; ; -<> +() => (<>); return { props: {name: name , world: world}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/import-single-quote/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/import-single-quote/expected.tsx index 2568e480a..014c7bbdc 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/import-single-quote/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/import-single-quote/expected.tsx @@ -3,11 +3,11 @@ function render() { ; -<> - +() => (<> +); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/imports/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/imports/expected.tsx index 02a484da7..fcac2556e 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/imports/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/imports/expected.tsx @@ -7,11 +7,11 @@ function render() { let world = "name" ; -<>

hello {world}

- +() => (<>

hello {world}

+); return { props: {world: world}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line/expected.tsx index b8ed82fca..adb08af35 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line/expected.tsx @@ -1,9 +1,9 @@ <>;let b = 5;;<>;function render() { let world = "name"; -<>

hello {world}

+() => (<>

hello {world}

); return { props: {world: world}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line2/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line2/expected.tsx index b8ed82fca..adb08af35 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line2/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script-in-line2/expected.tsx @@ -1,9 +1,9 @@ <>;let b = 5;;<>;function render() { let world = "name"; -<>

hello {world}

+() => (<>

hello {world}

); return { props: {world: world}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script/expected.tsx index 96b8a4048..d1876e41a 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script/expected.tsx @@ -5,12 +5,12 @@ let world = "name" ; -<> +() => (<> -

hello {world}

+

hello {world}

); return { props: {world: world}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script2/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script2/expected.tsx index a64af37d8..848512e92 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script2/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script2/expected.tsx @@ -5,12 +5,12 @@ let world = "name" ; -<>

hello {world}

+() => (<>

hello {world}

- +); return { props: {world: world}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/multiple-export/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/multiple-export/expected.tsx index 5868d2b48..26c160205 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/multiple-export/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/multiple-export/expected.tsx @@ -3,8 +3,8 @@ let number1: number let number2: number ; -<> -

{number1} + {number2} = {number1 + number2}

+() => (<> +

{number1} + {number2} = {number1 + number2}

); return { props: {number1: number1 , number2: number2} as {number1: number, number2: number}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/nested-$-variables-script/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/nested-$-variables-script/expected.tsx index 9defec493..1f4ffde20 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/nested-$-variables-script/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/nested-$-variables-script/expected.tsx @@ -21,10 +21,10 @@ function test3() { const test4 = ({a, b: { $top1: $top2 }}) => $top2 && __sveltets_store_get(top1) ; -<> +() => (<>); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/object-binding-export/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/object-binding-export/expected.tsx index 987d9fd47..19772d338 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/object-binding-export/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/object-binding-export/expected.tsx @@ -2,7 +2,7 @@ let { name: rename } = { name: "world" }; ; -<> +() => (<>); return { props: {rename: rename}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/reactive-block/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/reactive-block/expected.tsx index f10242e7c..218d22852 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/reactive-block/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/reactive-block/expected.tsx @@ -5,7 +5,7 @@ let a: 1 | 2 = 1; console.log(a + 1); }} ; -<> +() => (<>); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare-object/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare-object/expected.tsx index 7912a03ea..c84c43fd6 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare-object/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare-object/expected.tsx @@ -3,7 +3,7 @@ ;let b; $: b = __sveltets_invalidate(() => ({ a: 1 })); ; -<> +() => (<>); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare/expected.tsx index 85c1a6353..2f6d0e58e 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/reactive-declare/expected.tsx @@ -6,7 +6,7 @@ let a; $: a = __sveltets_invalidate(() => 5); ; -<> +() => (<>); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/renamed-exports/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/renamed-exports/expected.tsx index 8b33dcc87..d5e5f7fbc 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/renamed-exports/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/renamed-exports/expected.tsx @@ -4,7 +4,7 @@ let name2 = "world" ; -<> +() => (<>); return { props: {name3: name , name4: name2}, slots: {} }} export default class Input__SvelteComponent_ { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/script-and-module-script/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/script-and-module-script/expected.tsx index ab8f5fbe3..958702953 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/script-and-module-script/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/script-and-module-script/expected.tsx @@ -5,12 +5,12 @@ let world = "name" ; -<> +() => (<>

hello {world}

- +); return { props: {world: world}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/script-inside-head-after-toplevel-script/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/script-inside-head-after-toplevel-script/expected.tsx index 5c35cce07..86338a9d6 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/script-inside-head-after-toplevel-script/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/script-inside-head-after-toplevel-script/expected.tsx @@ -2,7 +2,7 @@ let b = 'top level'; ; -<>
+() => (<>
@@ -11,10 +11,10 @@ - +); return { props: {}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/script-on-bottom/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/script-on-bottom/expected.tsx index abbc7df49..aeee45975 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/script-on-bottom/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/script-on-bottom/expected.tsx @@ -2,11 +2,11 @@ let world = "name" ; -<>

hello {world}

- +() => (<>

hello {world}

+); return { props: {world: world}, slots: {} }} export default class Input__SvelteComponent_ { $$prop_def = __sveltets_partial(render().props) $$slot_def = render().slots -} \ No newline at end of file +} diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/script-style-like-component/expected.tsx b/packages/svelte2tsx/test/svelte2tsx/samples/script-style-like-component/expected.tsx index 04ca65825..643ee9fee 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/script-style-like-component/expected.tsx +++ b/packages/svelte2tsx/test/svelte2tsx/samples/script-style-like-component/expected.tsx @@ -2,15 +2,15 @@ let Script, Style; ; -<> +() => (<> -