)
})
+ test('should extract comment for import or type declarations', () => {
+ assertCode(
+ compile(`<script setup>
+import a from 'a' // comment
+import b from 'b'
+</script>`).content
+ )
+ })
+
test('explicit setup signature', () => {
assertCode(
compile(`<script setup="props, { emit }">emit('foo')</script>`).content
const start = node.start! + startOffset
let end = node.end! + startOffset
// import or type declarations: move to top
+ // locate comment
+ if (node.trailingComments && node.trailingComments.length > 0) {
+ const lastCommentNode =
+ node.trailingComments[node.trailingComments.length - 1]
+ end = lastCommentNode.end + startOffset
+ }
// locate the end of whitespace between this statement and the next
while (end <= source.length) {
if (!/\s/.test(source.charAt(end))) {