diff --git a/.changeset/bright-lemons-fry.md b/.changeset/bright-lemons-fry.md new file mode 100644 index 000000000..aca40f65f --- /dev/null +++ b/.changeset/bright-lemons-fry.md @@ -0,0 +1,5 @@ +--- +'@astrojs/compiler': patch +--- + +Fix TSX output prefixing output with unnecessary jsdoc comment diff --git a/internal/printer/print-to-tsx.go b/internal/printer/print-to-tsx.go index 908d8d11d..00b9bcc60 100644 --- a/internal/printer/print-to-tsx.go +++ b/internal/printer/print-to-tsx.go @@ -17,7 +17,7 @@ import ( ) func getTSXPrefix() string { - return "/** @jsxImportSource astro */\n\n" + return "/* @jsxImportSource astro */\n\n" } func PrintToTSX(sourcetext string, n *Node, opts transform.TransformOptions, h *handler.Handler) PrintResult { diff --git a/packages/compiler/test/tsx/basic.ts b/packages/compiler/test/tsx/basic.ts index 3ac6ab2ec..e5f705f6d 100644 --- a/packages/compiler/test/tsx/basic.ts +++ b/packages/compiler/test/tsx/basic.ts @@ -251,12 +251,12 @@ test('return ranges', async () => { assert.equal(metaRanges, { frontmatter: { - start: 31, - end: 55, + start: 30, + end: 54, }, body: { - start: 69, - end: 81, + start: 68, + end: 80, }, }); }); @@ -267,12 +267,12 @@ test('return ranges - no frontmatter', async () => { assert.equal(metaRanges, { frontmatter: { - start: 31, - end: 31, + start: 30, + end: 30, }, body: { - start: 42, - end: 54, + start: 41, + end: 53, }, }); }); diff --git a/packages/compiler/test/utils.ts b/packages/compiler/test/utils.ts index b38f92798..e377f7d5e 100644 --- a/packages/compiler/test/utils.ts +++ b/packages/compiler/test/utils.ts @@ -78,4 +78,4 @@ export async function testJSSourcemap(input: string, snippet: string) { return originalPosition; } -export const TSXPrefix = '/** @jsxImportSource astro */\n\n'; +export const TSXPrefix = '/* @jsxImportSource astro */\n\n';