Skip to content

Commit 7a0ce2d

Browse files
authored
fix: correctly process empty lines in message markdown (#12057)
1 parent 909f882 commit 7a0ce2d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.changeset/loud-penguins-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: correctly process empty lines in messages

packages/svelte/scripts/process-messages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ for (const category of fs.readdirSync('messages')) {
4343

4444
seen.add(code);
4545
messages[category][code] = {
46-
messages: sections.map((section) => section.replace(/^> /gm, '')),
46+
messages: sections.map((section) => section.replace(/^> /gm, '').replace(/^>\n/gm, '\n')),
4747
details
4848
};
4949
}

packages/svelte/src/internal/client/errors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,13 @@ export function state_prototype_fixed() {
280280

281281
/**
282282
* 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.
283-
* >
283+
*
284284
* If the object is not meant to be reactive, declare it without `$state`
285285
* @returns {never}
286286
*/
287287
export function state_unsafe_mutation() {
288288
if (DEV) {
289-
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`"}`);
289+
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`"}`);
290290

291291
error.name = 'Svelte error';
292292
throw error;

0 commit comments

Comments
 (0)