diff --git a/.changeset/loud-penguins-unite.md b/.changeset/loud-penguins-unite.md new file mode 100644 index 000000000000..36e437515558 --- /dev/null +++ b/.changeset/loud-penguins-unite.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: correctly process empty lines in messages diff --git a/packages/svelte/scripts/process-messages/index.js b/packages/svelte/scripts/process-messages/index.js index d88e5c728efe..71a979d516a6 100644 --- a/packages/svelte/scripts/process-messages/index.js +++ b/packages/svelte/scripts/process-messages/index.js @@ -43,7 +43,7 @@ for (const category of fs.readdirSync('messages')) { seen.add(code); messages[category][code] = { - messages: sections.map((section) => section.replace(/^> /gm, '')), + messages: sections.map((section) => section.replace(/^> /gm, '').replace(/^>\n/gm, '\n')), details }; } diff --git a/packages/svelte/src/internal/client/errors.js b/packages/svelte/src/internal/client/errors.js index 981f40a218cf..232cc2eeee2c 100644 --- a/packages/svelte/src/internal/client/errors.js +++ b/packages/svelte/src/internal/client/errors.js @@ -280,13 +280,13 @@ export function state_prototype_fixed() { /** * Unsafe mutations during Svelte's render or derived phase are not permitted in runes mode. This can lead to unexpected errors and possibly cause infinite loops. - * > + * * If the object is not meant to be reactive, declare it without `$state` * @returns {never} */ export function state_unsafe_mutation() { if (DEV) { - const error = new Error(`${"state_unsafe_mutation"}\n${"Unsafe mutations during Svelte's render or derived phase are not permitted in runes mode. This can lead to unexpected errors and possibly cause infinite loops.\n>\nIf the object is not meant to be reactive, declare it without `$state`"}`); + const error = new Error(`${"state_unsafe_mutation"}\n${"Unsafe mutations during Svelte's render or derived phase are not permitted in runes mode. This can lead to unexpected errors and possibly cause infinite loops.\n\nIf the object is not meant to be reactive, declare it without `$state`"}`); error.name = 'Svelte error'; throw error;