From 94d9b52a73d97da9cdd8061f8704ab23335ecd03 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Sat, 19 Oct 2024 15:40:10 +0200 Subject: [PATCH] chore: add comments --- packages/svelte/src/compiler/migrate/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/compiler/migrate/index.js b/packages/svelte/src/compiler/migrate/index.js index 67cf8c20b7..5ce56f687b 100644 --- a/packages/svelte/src/compiler/migrate/index.js +++ b/packages/svelte/src/compiler/migrate/index.js @@ -1283,9 +1283,13 @@ function extract_type_and_comment(declarator, str, path) { .map((line) => line .trim() + // replace `// ` for one liners .replace(/^\/\/\s*/g, '') - .replace(/^\/\*\*\s*/g, '') + // replace `\**` for the initial JSDoc + .replace(/^\/\*\*?\s*/g, '') + // migrate `*/` for the end of JSDoc .replace(/\s*\*\/$/g, '') + // remove any initial `* ` to clean the comment .replace(/^\*\s*/g, '') ) .filter(Boolean);