Skip to content

Commit 969da7f

Browse files
committed
more concise
1 parent bfa094e commit 969da7f

File tree

14 files changed

+334
-340
lines changed

14 files changed

+334
-340
lines changed

packages/svelte/scripts/process-messages/templates/client-errors.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ import { DEV } from 'esm-env';
77
*/
88
export function CODE(PARAMETER) {
99
if (DEV) {
10-
const error = new Error(
11-
`${'CODE'}\n${MESSAGE}\nSee https://svelte.dev/e/${'CODE'} for more info`
12-
);
10+
const error = new Error(`${'CODE'}\n${MESSAGE}\nhttps://svelte.dev/e/${'CODE'}`);
1311
error.name = 'Svelte error';
1412
throw error;
1513
} else {
16-
throw new Error(`${'CODE'} (https://svelte.dev/e/${'CODE'})`);
14+
throw new Error(`https://svelte.dev/e/${'CODE'}`);
1715
}
1816
}

packages/svelte/scripts/process-messages/templates/client-warnings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ var normal = 'font-weight: normal';
1010
export function CODE(PARAMETER) {
1111
if (DEV) {
1212
console.warn(
13-
`%c[svelte] ${'CODE'}\n%c${MESSAGE}\nSee https://svelte.dev/e/${'CODE'} for more info`,
13+
`%c[svelte] ${'CODE'}\n%c${MESSAGE}\nhttps://svelte.dev/e/${'CODE'}`,
1414
bold,
1515
normal
1616
);
1717
} else {
18-
console.warn(`${'CODE'} (https://svelte.dev/e/${'CODE'})`);
18+
console.warn(`https://svelte.dev/e/${'CODE'}`);
1919
}
2020
}

packages/svelte/scripts/process-messages/templates/compile-errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ function e(node, code, message) {
5656
* @returns {never}
5757
*/
5858
export function CODE(node, PARAMETER) {
59-
e(node, 'CODE', `${MESSAGE}\nSee https://svelte.dev/e/${'CODE'} for more info`);
59+
e(node, 'CODE', `${MESSAGE}\nhttps://svelte.dev/e/${'CODE'}`);
6060
}

packages/svelte/scripts/process-messages/templates/compile-warnings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ export const codes = CODES;
4747
* @param {string} PARAMETER
4848
*/
4949
export function CODE(node, PARAMETER) {
50-
w(node, 'CODE', `${MESSAGE}\nSee https://svelte.dev/e/${'CODE'} for more info`);
50+
w(node, 'CODE', `${MESSAGE}\nhttps://svelte.dev/e/${'CODE'}`);
5151
}

packages/svelte/scripts/process-messages/templates/server-errors.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
* @returns {never}
55
*/
66
export function CODE(PARAMETER) {
7-
const error = new Error(
8-
`${'CODE'}\n${MESSAGE}\nSee https://svelte.dev/e/${'CODE'} for more info`
9-
);
7+
const error = new Error(`${'CODE'}\n${MESSAGE}\nhttps://svelte.dev/e/${'CODE'}`);
108
error.name = 'Svelte error';
119
throw error;
1210
}

packages/svelte/scripts/process-messages/templates/shared-errors.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ import { DEV } from 'esm-env';
77
*/
88
export function CODE(PARAMETER) {
99
if (DEV) {
10-
const error = new Error(
11-
`${'CODE'}\n${MESSAGE}\nSee https://svelte.dev/e/${'CODE'} for more info`
12-
);
10+
const error = new Error(`${'CODE'}\n${MESSAGE}\nhttps://svelte.dev/e/${'CODE'}`);
1311
error.name = 'Svelte error';
1412
throw error;
1513
} else {
1614
// TODO print a link to the documentation
17-
throw new Error(`${'CODE'} (https://svelte.dev/e/${'CODE'})`);
15+
throw new Error(`https://svelte.dev/e/${'CODE'}`);
1816
}
1917
}

packages/svelte/scripts/process-messages/templates/shared-warnings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ var normal = 'font-weight: normal';
1010
export function CODE(PARAMETER) {
1111
if (DEV) {
1212
console.warn(
13-
`%c[svelte] ${'CODE'}\n%c${MESSAGE}\nSee https://svelte.dev/e/${'CODE'} for more info`,
13+
`%c[svelte] ${'CODE'}\n%c${MESSAGE}\nhttps://svelte.dev/e/${'CODE'}`,
1414
bold,
1515
normal
1616
);
1717
} else {
1818
// TODO print a link to the documentation
19-
console.warn(`${'CODE'} (https://svelte.dev/e/${'CODE'})`);
19+
console.warn(`https://svelte.dev/e/${'CODE'}`);
2020
}
2121
}

packages/svelte/src/compiler/errors.js

Lines changed: 162 additions & 162 deletions
Large diffs are not rendered by default.

packages/svelte/src/compiler/warnings.js

Lines changed: 78 additions & 78 deletions
Large diffs are not rendered by default.

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

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ var normal = 'font-weight: normal';
1212
*/
1313
export function assignment_value_stale(property, location) {
1414
if (DEV) {
15-
console.warn(`%c[svelte] assignment_value_stale\n%cAssignment to \`${property}\` property (${location}) will evaluate to the right-hand side, not the value of \`${property}\` following the assignment. This may result in unexpected behaviour.\nSee https://svelte.dev/e/assignment_value_stale for more info`, bold, normal);
15+
console.warn(`%c[svelte] assignment_value_stale\n%cAssignment to \`${property}\` property (${location}) will evaluate to the right-hand side, not the value of \`${property}\` following the assignment. This may result in unexpected behaviour.\nhttps://svelte.dev/e/assignment_value_stale`, bold, normal);
1616
} else {
17-
console.warn(`assignment_value_stale (https://svelte.dev/e/assignment_value_stale)`);
17+
console.warn(`https://svelte.dev/e/assignment_value_stale`);
1818
}
1919
}
2020

@@ -25,9 +25,9 @@ export function assignment_value_stale(property, location) {
2525
*/
2626
export function binding_property_non_reactive(binding, location) {
2727
if (DEV) {
28-
console.warn(`%c[svelte] binding_property_non_reactive\n%c${location ? `\`${binding}\` (${location}) is binding to a non-reactive property` : `\`${binding}\` is binding to a non-reactive property`}\nSee https://svelte.dev/e/binding_property_non_reactive for more info`, bold, normal);
28+
console.warn(`%c[svelte] binding_property_non_reactive\n%c${location ? `\`${binding}\` (${location}) is binding to a non-reactive property` : `\`${binding}\` is binding to a non-reactive property`}\nhttps://svelte.dev/e/binding_property_non_reactive`, bold, normal);
2929
} else {
30-
console.warn(`binding_property_non_reactive (https://svelte.dev/e/binding_property_non_reactive)`);
30+
console.warn(`https://svelte.dev/e/binding_property_non_reactive`);
3131
}
3232
}
3333

@@ -37,9 +37,9 @@ export function binding_property_non_reactive(binding, location) {
3737
*/
3838
export function console_log_state(method) {
3939
if (DEV) {
40-
console.warn(`%c[svelte] console_log_state\n%cYour \`console.${method}\` contained \`$state\` proxies. Consider using \`$inspect(...)\` or \`$state.snapshot(...)\` instead\nSee https://svelte.dev/e/console_log_state for more info`, bold, normal);
40+
console.warn(`%c[svelte] console_log_state\n%cYour \`console.${method}\` contained \`$state\` proxies. Consider using \`$inspect(...)\` or \`$state.snapshot(...)\` instead\nhttps://svelte.dev/e/console_log_state`, bold, normal);
4141
} else {
42-
console.warn(`console_log_state (https://svelte.dev/e/console_log_state)`);
42+
console.warn(`https://svelte.dev/e/console_log_state`);
4343
}
4444
}
4545

@@ -50,9 +50,9 @@ export function console_log_state(method) {
5050
*/
5151
export function event_handler_invalid(handler, suggestion) {
5252
if (DEV) {
53-
console.warn(`%c[svelte] event_handler_invalid\n%c${handler} should be a function. Did you mean to ${suggestion}?\nSee https://svelte.dev/e/event_handler_invalid for more info`, bold, normal);
53+
console.warn(`%c[svelte] event_handler_invalid\n%c${handler} should be a function. Did you mean to ${suggestion}?\nhttps://svelte.dev/e/event_handler_invalid`, bold, normal);
5454
} else {
55-
console.warn(`event_handler_invalid (https://svelte.dev/e/event_handler_invalid)`);
55+
console.warn(`https://svelte.dev/e/event_handler_invalid`);
5656
}
5757
}
5858

@@ -64,9 +64,9 @@ export function event_handler_invalid(handler, suggestion) {
6464
*/
6565
export function hydration_attribute_changed(attribute, html, value) {
6666
if (DEV) {
67-
console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${attribute}\` attribute on \`${html}\` changed its value between server and client renders. The client value, \`${value}\`, will be ignored in favour of the server value\nSee https://svelte.dev/e/hydration_attribute_changed for more info`, bold, normal);
67+
console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${attribute}\` attribute on \`${html}\` changed its value between server and client renders. The client value, \`${value}\`, will be ignored in favour of the server value\nhttps://svelte.dev/e/hydration_attribute_changed`, bold, normal);
6868
} else {
69-
console.warn(`hydration_attribute_changed (https://svelte.dev/e/hydration_attribute_changed)`);
69+
console.warn(`https://svelte.dev/e/hydration_attribute_changed`);
7070
}
7171
}
7272

@@ -76,9 +76,9 @@ export function hydration_attribute_changed(attribute, html, value) {
7676
*/
7777
export function hydration_html_changed(location) {
7878
if (DEV) {
79-
console.warn(`%c[svelte] hydration_html_changed\n%c${location ? `The value of an \`{@html ...}\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value` : "The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value"}\nSee https://svelte.dev/e/hydration_html_changed for more info`, bold, normal);
79+
console.warn(`%c[svelte] hydration_html_changed\n%c${location ? `The value of an \`{@html ...}\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value` : "The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value"}\nhttps://svelte.dev/e/hydration_html_changed`, bold, normal);
8080
} else {
81-
console.warn(`hydration_html_changed (https://svelte.dev/e/hydration_html_changed)`);
81+
console.warn(`https://svelte.dev/e/hydration_html_changed`);
8282
}
8383
}
8484

@@ -88,9 +88,9 @@ export function hydration_html_changed(location) {
8888
*/
8989
export function hydration_mismatch(location) {
9090
if (DEV) {
91-
console.warn(`%c[svelte] hydration_mismatch\n%c${location ? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}` : "Hydration failed because the initial UI does not match what was rendered on the server"}\nSee https://svelte.dev/e/hydration_mismatch for more info`, bold, normal);
91+
console.warn(`%c[svelte] hydration_mismatch\n%c${location ? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}` : "Hydration failed because the initial UI does not match what was rendered on the server"}\nhttps://svelte.dev/e/hydration_mismatch`, bold, normal);
9292
} else {
93-
console.warn(`hydration_mismatch (https://svelte.dev/e/hydration_mismatch)`);
93+
console.warn(`https://svelte.dev/e/hydration_mismatch`);
9494
}
9595
}
9696

@@ -99,9 +99,9 @@ export function hydration_mismatch(location) {
9999
*/
100100
export function invalid_raw_snippet_render() {
101101
if (DEV) {
102-
console.warn(`%c[svelte] invalid_raw_snippet_render\n%cThe \`render\` function passed to \`createRawSnippet\` should return HTML for a single element\nSee https://svelte.dev/e/invalid_raw_snippet_render for more info`, bold, normal);
102+
console.warn(`%c[svelte] invalid_raw_snippet_render\n%cThe \`render\` function passed to \`createRawSnippet\` should return HTML for a single element\nhttps://svelte.dev/e/invalid_raw_snippet_render`, bold, normal);
103103
} else {
104-
console.warn(`invalid_raw_snippet_render (https://svelte.dev/e/invalid_raw_snippet_render)`);
104+
console.warn(`https://svelte.dev/e/invalid_raw_snippet_render`);
105105
}
106106
}
107107

@@ -111,9 +111,9 @@ export function invalid_raw_snippet_render() {
111111
*/
112112
export function legacy_recursive_reactive_block(filename) {
113113
if (DEV) {
114-
console.warn(`%c[svelte] legacy_recursive_reactive_block\n%cDetected a migrated \`$:\` reactive block in \`${filename}\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \`$effect\`.\nSee https://svelte.dev/e/legacy_recursive_reactive_block for more info`, bold, normal);
114+
console.warn(`%c[svelte] legacy_recursive_reactive_block\n%cDetected a migrated \`$:\` reactive block in \`${filename}\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \`$effect\`.\nhttps://svelte.dev/e/legacy_recursive_reactive_block`, bold, normal);
115115
} else {
116-
console.warn(`legacy_recursive_reactive_block (https://svelte.dev/e/legacy_recursive_reactive_block)`);
116+
console.warn(`https://svelte.dev/e/legacy_recursive_reactive_block`);
117117
}
118118
}
119119

@@ -122,9 +122,9 @@ export function legacy_recursive_reactive_block(filename) {
122122
*/
123123
export function lifecycle_double_unmount() {
124124
if (DEV) {
125-
console.warn(`%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nSee https://svelte.dev/e/lifecycle_double_unmount for more info`, bold, normal);
125+
console.warn(`%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount`, bold, normal);
126126
} else {
127-
console.warn(`lifecycle_double_unmount (https://svelte.dev/e/lifecycle_double_unmount)`);
127+
console.warn(`https://svelte.dev/e/lifecycle_double_unmount`);
128128
}
129129
}
130130

@@ -136,9 +136,9 @@ export function lifecycle_double_unmount() {
136136
*/
137137
export function ownership_invalid_binding(parent, child, owner) {
138138
if (DEV) {
139-
console.warn(`%c[svelte] ownership_invalid_binding\n%c${parent} passed a value to ${child} with \`bind:\`, but the value is owned by ${owner}. Consider creating a binding between ${owner} and ${parent}\nSee https://svelte.dev/e/ownership_invalid_binding for more info`, bold, normal);
139+
console.warn(`%c[svelte] ownership_invalid_binding\n%c${parent} passed a value to ${child} with \`bind:\`, but the value is owned by ${owner}. Consider creating a binding between ${owner} and ${parent}\nhttps://svelte.dev/e/ownership_invalid_binding`, bold, normal);
140140
} else {
141-
console.warn(`ownership_invalid_binding (https://svelte.dev/e/ownership_invalid_binding)`);
141+
console.warn(`https://svelte.dev/e/ownership_invalid_binding`);
142142
}
143143
}
144144

@@ -149,9 +149,9 @@ export function ownership_invalid_binding(parent, child, owner) {
149149
*/
150150
export function ownership_invalid_mutation(component, owner) {
151151
if (DEV) {
152-
console.warn(`%c[svelte] ownership_invalid_mutation\n%c${component ? `${component} mutated a value owned by ${owner}. This is strongly discouraged. Consider passing values to child components with \`bind:\`, or use a callback instead` : "Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead"}\nSee https://svelte.dev/e/ownership_invalid_mutation for more info`, bold, normal);
152+
console.warn(`%c[svelte] ownership_invalid_mutation\n%c${component ? `${component} mutated a value owned by ${owner}. This is strongly discouraged. Consider passing values to child components with \`bind:\`, or use a callback instead` : "Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead"}\nhttps://svelte.dev/e/ownership_invalid_mutation`, bold, normal);
153153
} else {
154-
console.warn(`ownership_invalid_mutation (https://svelte.dev/e/ownership_invalid_mutation)`);
154+
console.warn(`https://svelte.dev/e/ownership_invalid_mutation`);
155155
}
156156
}
157157

@@ -161,9 +161,9 @@ export function ownership_invalid_mutation(component, owner) {
161161
*/
162162
export function reactive_declaration_non_reactive_property(location) {
163163
if (DEV) {
164-
console.warn(`%c[svelte] reactive_declaration_non_reactive_property\n%cA \`$:\` statement (${location}) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour of this code will change if you migrate it to runes mode\nSee https://svelte.dev/e/reactive_declaration_non_reactive_property for more info`, bold, normal);
164+
console.warn(`%c[svelte] reactive_declaration_non_reactive_property\n%cA \`$:\` statement (${location}) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour of this code will change if you migrate it to runes mode\nhttps://svelte.dev/e/reactive_declaration_non_reactive_property`, bold, normal);
165165
} else {
166-
console.warn(`reactive_declaration_non_reactive_property (https://svelte.dev/e/reactive_declaration_non_reactive_property)`);
166+
console.warn(`https://svelte.dev/e/reactive_declaration_non_reactive_property`);
167167
}
168168
}
169169

@@ -173,8 +173,8 @@ export function reactive_declaration_non_reactive_property(location) {
173173
*/
174174
export function state_proxy_equality_mismatch(operator) {
175175
if (DEV) {
176-
console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${operator}\` will produce unexpected results\nSee https://svelte.dev/e/state_proxy_equality_mismatch for more info`, bold, normal);
176+
console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${operator}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);
177177
} else {
178-
console.warn(`state_proxy_equality_mismatch (https://svelte.dev/e/state_proxy_equality_mismatch)`);
178+
console.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);
179179
}
180180
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @returns {never}
77
*/
88
export function lifecycle_function_unavailable(name) {
9-
const error = new Error(`lifecycle_function_unavailable\n\`${name}(...)\` is not available on the server\nSee https://svelte.dev/e/lifecycle_function_unavailable for more info`);
9+
const error = new Error(`lifecycle_function_unavailable\n\`${name}(...)\` is not available on the server\nhttps://svelte.dev/e/lifecycle_function_unavailable`);
1010

1111
error.name = 'Svelte error';
1212
throw error;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import { DEV } from 'esm-env';
88
*/
99
export function invalid_default_snippet() {
1010
if (DEV) {
11-
const error = new Error(`invalid_default_snippet\nCannot use \`{@render children(...)}\` if the parent component uses \`let:\` directives. Consider using a named snippet instead\nSee https://svelte.dev/e/invalid_default_snippet for more info`);
11+
const error = new Error(`invalid_default_snippet\nCannot use \`{@render children(...)}\` if the parent component uses \`let:\` directives. Consider using a named snippet instead\nhttps://svelte.dev/e/invalid_default_snippet`);
1212

1313
error.name = 'Svelte error';
1414
throw error;
1515
} else {
1616
// TODO print a link to the documentation
17-
throw new Error(`invalid_default_snippet (https://svelte.dev/e/invalid_default_snippet)`);
17+
throw new Error(`https://svelte.dev/e/invalid_default_snippet`);
1818
}
1919
}
2020

@@ -25,13 +25,13 @@ export function invalid_default_snippet() {
2525
*/
2626
export function lifecycle_outside_component(name) {
2727
if (DEV) {
28-
const error = new Error(`lifecycle_outside_component\n\`${name}(...)\` can only be used during component initialisation\nSee https://svelte.dev/e/lifecycle_outside_component for more info`);
28+
const error = new Error(`lifecycle_outside_component\n\`${name}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);
2929

3030
error.name = 'Svelte error';
3131
throw error;
3232
} else {
3333
// TODO print a link to the documentation
34-
throw new Error(`lifecycle_outside_component (https://svelte.dev/e/lifecycle_outside_component)`);
34+
throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
3535
}
3636
}
3737

@@ -42,13 +42,13 @@ export function lifecycle_outside_component(name) {
4242
*/
4343
export function store_invalid_shape(name) {
4444
if (DEV) {
45-
const error = new Error(`store_invalid_shape\n\`${name}\` is not a store with a \`subscribe\` method\nSee https://svelte.dev/e/store_invalid_shape for more info`);
45+
const error = new Error(`store_invalid_shape\n\`${name}\` is not a store with a \`subscribe\` method\nhttps://svelte.dev/e/store_invalid_shape`);
4646

4747
error.name = 'Svelte error';
4848
throw error;
4949
} else {
5050
// TODO print a link to the documentation
51-
throw new Error(`store_invalid_shape (https://svelte.dev/e/store_invalid_shape)`);
51+
throw new Error(`https://svelte.dev/e/store_invalid_shape`);
5252
}
5353
}
5454

@@ -58,12 +58,12 @@ export function store_invalid_shape(name) {
5858
*/
5959
export function svelte_element_invalid_this_value() {
6060
if (DEV) {
61-
const error = new Error(`svelte_element_invalid_this_value\nThe \`this\` prop on \`<svelte:element>\` must be a string, if defined\nSee https://svelte.dev/e/svelte_element_invalid_this_value for more info`);
61+
const error = new Error(`svelte_element_invalid_this_value\nThe \`this\` prop on \`<svelte:element>\` must be a string, if defined\nhttps://svelte.dev/e/svelte_element_invalid_this_value`);
6262

6363
error.name = 'Svelte error';
6464
throw error;
6565
} else {
6666
// TODO print a link to the documentation
67-
throw new Error(`svelte_element_invalid_this_value (https://svelte.dev/e/svelte_element_invalid_this_value)`);
67+
throw new Error(`https://svelte.dev/e/svelte_element_invalid_this_value`);
6868
}
6969
}

0 commit comments

Comments
 (0)