add as _comments to legacy ast

pull/17671/head
Simon H 5 months ago committed by GitHub
parent b93ff4bbbc
commit b47ba90664
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -102,7 +102,11 @@ export function convert(source, ast) {
instance,
module,
css: ast.css ? visit(ast.css) : undefined,
comments: ast.comments?.length > 0 ? ast.comments : undefined
// put it on _comments not comments because the latter is checked by prettier and then fails
// if we don't adjust stuff accordingly in our prettier plugin, and so it would be kind of an
// indirect breaking change for people updating their Svelte version but not their prettier plugin version.
// We can keep it as comments for the modern AST because the modern AST is not used in the plugin yet.
_comments: ast.comments?.length > 0 ? ast.comments : undefined
};
},
AnimateDirective(node) {

@ -881,7 +881,7 @@
"sourceType": "module"
}
},
"comments": [
"_comments": [
{
"type": "Line",
"value": " a leading comment",

@ -52,7 +52,7 @@
]
}
},
"comments": [
"_comments": [
{
"type": "Line",
"value": " TODO write some code",

Loading…
Cancel
Save