deno
a865b211 - fix(transpile): preserve newlines after multi-line block comments (#34357)

Commit
152 days ago
fix(transpile): preserve newlines after multi-line block comments (#34357) SWC's code generator always writes a single space after a block comment's closing `*/`, regardless of what the original source had there. For multi-line JSDoc this collapses the comment onto the same line as the following statement, producing awkward output like `*/ export function greet(...)`. Restore the newline (plus the comment's leading indentation) as a post-process pass on the emitted text. The pass uses a small state machine that tracks string, template-literal, and substitution contexts so `*/` appearing inside literals is left untouched. It is skipped when `--source-map` is requested, since inserting newlines would shift line numbers in the generated output without a corresponding adjustment to the mappings. Fixes #34317
Author
Parents
Loading