From a9791521355872d156719c21826652aee213c9ca Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sat, 29 Jun 2024 14:03:10 +0900 Subject: [PATCH] support legacyAst on REPL --- .../svelte-5-preview/src/lib/Output/CompilerOptions.svelte | 6 ++++++ sites/svelte-5-preview/src/lib/Repl.svelte | 3 ++- sites/svelte-5-preview/src/lib/workers/compiler/index.js | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte b/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte index 60504c5052..5d6cb85ff6 100644 --- a/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte +++ b/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte @@ -23,6 +23,12 @@ {$compile_options.dev}, + + }); diff --git a/sites/svelte-5-preview/src/lib/Repl.svelte b/sites/svelte-5-preview/src/lib/Repl.svelte index 80a2b7ff61..fc26fef373 100644 --- a/sites/svelte-5-preview/src/lib/Repl.svelte +++ b/sites/svelte-5-preview/src/lib/Repl.svelte @@ -77,7 +77,8 @@ /** @type {import('svelte/compiler').CompileOptions} */ const DEFAULT_COMPILE_OPTIONS = { generate: 'client', - dev: false + dev: false, + modernAst: true }; /** @type {Map} */ diff --git a/sites/svelte-5-preview/src/lib/workers/compiler/index.js b/sites/svelte-5-preview/src/lib/workers/compiler/index.js index 83dffe1856..6031c09378 100644 --- a/sites/svelte-5-preview/src/lib/workers/compiler/index.js +++ b/sites/svelte-5-preview/src/lib/workers/compiler/index.js @@ -70,7 +70,7 @@ function compile({ id, source, options, return_ast }) { const { js, css, warnings, metadata } = compiled; - const ast = return_ast ? svelte.parse(source, { modern: true }) : undefined; + const ast = return_ast ? svelte.parse(source, { modern: options.modernAst }) : undefined; return { id,