support legacyAst on REPL

feat/support-modern-ast-flag-on-repl
baseballyama 7 months ago
parent c42bb04276
commit a979152135

@ -23,6 +23,12 @@
<Checkbox bind:checked={$compile_options.dev} />
<span class="boolean">{$compile_options.dev}</span>,
</label>
<label class="option">
<span class="key">modernAst:</span>
<Checkbox bind:checked={$compile_options.modernAst} />
<span class="boolean">{$compile_options.modernAst}</span>,
</label>
});
</div>

@ -77,7 +77,8 @@
/** @type {import('svelte/compiler').CompileOptions} */
const DEFAULT_COMPILE_OPTIONS = {
generate: 'client',
dev: false
dev: false,
modernAst: true
};
/** @type {Map<string, import('@codemirror/state').EditorState>} */

@ -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,

Loading…
Cancel
Save