You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/svelte/src/internal/client/errors.js
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ import { DEV } from 'esm-env';
8
8
*/
9
9
exportfunctionbind_invalid_checkbox_value(){
10
10
if(DEV){
11
-
consterror=newError(`${"bind_invalid_checkbox_value"}\n${"Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead"}`);
11
+
consterror=newError(`bind_invalid_checkbox_value\nUsing \`bind:value\` together with a checkbox input is not allowed. Use \`bind:checked\` instead`);
12
12
13
13
error.name='Svelte error';
14
14
throwerror;
@@ -27,7 +27,7 @@ export function bind_invalid_checkbox_value() {
consterror=newError(`${"bind_invalid_export"}\n${`Component${component} has an export named \`${key}\` that a consumer component is trying to access using \`bind:${key}\`, which is disallowed. Instead, use \`bind:this\` (e.g. \`<${name} bind:this={component} />\`) and then access the property on the bound component instance (e.g. \`component.${key}\`)`}`);
30
+
consterror=newError(`bind_invalid_export\nComponent${component} has an export named \`${key}\` that a consumer component is trying to access using \`bind:${key}\`, which is disallowed. Instead, use \`bind:this\` (e.g. \`<${name} bind:this={component} />\`) and then access the property on the bound component instance (e.g. \`component.${key}\`)`);
31
31
32
32
error.name='Svelte error';
33
33
throwerror;
@@ -46,7 +46,7 @@ export function bind_invalid_export(component, key, name) {
consterror=newError(`${"bind_not_bindable"}\n${`A component is attempting to bind to a non-bindable property \`${key}\` belonging to ${component} (i.e. \`<${name} bind:${key}={...}>\`). To mark a property as bindable: \`let { ${key} = $bindable() } = $props()\``}`);
49
+
consterror=newError(`bind_not_bindable\nA component is attempting to bind to a non-bindable property \`${key}\` belonging to ${component} (i.e. \`<${name} bind:${key}={...}>\`). To mark a property as bindable: \`let { ${key} = $bindable() } = $props()\``);
50
50
51
51
error.name='Svelte error';
52
52
throwerror;
@@ -65,7 +65,7 @@ export function bind_not_bindable(key, component, name) {
consterror=newError(`${"component_api_changed"}\n${`${parent} called \`${method}\` on an instance of ${component}, which is no longer valid in Svelte 5. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information`}`);
68
+
consterror=newError(`component_api_changed\n${parent} called \`${method}\` on an instance of ${component}, which is no longer valid in Svelte 5. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information`);
69
69
70
70
error.name='Svelte error';
71
71
throwerror;
@@ -83,7 +83,7 @@ export function component_api_changed(parent, method, component) {
consterror=newError(`${"component_api_invalid_new"}\n${`Attempted to instantiate ${component} with \`new ${name}\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \`legacy.componentApi\` compiler option to keep it working. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information`}`);
86
+
consterror=newError(`component_api_invalid_new\nAttempted to instantiate ${component} with \`new ${name}\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \`legacy.componentApi\` compiler option to keep it working. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information`);
87
87
88
88
error.name='Svelte error';
89
89
throwerror;
@@ -102,7 +102,7 @@ export function component_api_invalid_new(component, name) {
102
102
*/
103
103
exportfunctioneach_key_duplicate(a,b,value){
104
104
if(DEV){
105
-
consterror=newError(`${"each_key_duplicate"}\n${value ? `Keyed each block has duplicate key \`${value}\` at indexes ${a} and ${b}` : `Keyed each block has duplicate key at indexes ${a} and ${b}`}`);
105
+
consterror=newError(`each_key_duplicate\n${value ? `Keyed each block has duplicate key \`${value}\` at indexes ${a} and ${b}` : `Keyed each block has duplicate key at indexes ${a} and ${b}`}`);
106
106
107
107
error.name='Svelte error';
108
108
throwerror;
@@ -119,7 +119,7 @@ export function each_key_duplicate(a, b, value) {
119
119
*/
120
120
exportfunctioneffect_in_teardown(rune){
121
121
if(DEV){
122
-
consterror=newError(`${"effect_in_teardown"}\n${`\`${rune}\` cannot be used inside an effect cleanup function`}`);
122
+
consterror=newError(`effect_in_teardown\n\`${rune}\` cannot be used inside an effect cleanup function`);
123
123
124
124
error.name='Svelte error';
125
125
throwerror;
@@ -135,7 +135,7 @@ export function effect_in_teardown(rune) {
135
135
*/
136
136
exportfunctioneffect_in_unowned_derived(){
137
137
if(DEV){
138
-
consterror=newError(`${"effect_in_unowned_derived"}\n${"Effect cannot be created inside a `$derived` value that was not itself created inside an effect"}`);
138
+
consterror=newError(`effect_in_unowned_derived\nEffect cannot be created inside a \`$derived\` value that was not itself created inside an effect`);
139
139
140
140
error.name='Svelte error';
141
141
throwerror;
@@ -152,7 +152,7 @@ export function effect_in_unowned_derived() {
152
152
*/
153
153
exportfunctioneffect_orphan(rune){
154
154
if(DEV){
155
-
consterror=newError(`${"effect_orphan"}\n${`\`${rune}\` can only be used inside an effect (e.g. during component initialisation)`}`);
155
+
consterror=newError(`effect_orphan\n\`${rune}\` can only be used inside an effect (e.g. during component initialisation)`);
156
156
157
157
error.name='Svelte error';
158
158
throwerror;
@@ -168,7 +168,7 @@ export function effect_orphan(rune) {
168
168
*/
169
169
exportfunctioneffect_update_depth_exceeded(){
170
170
if(DEV){
171
-
consterror=newError(`${"effect_update_depth_exceeded"}\n${"Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops"}`);
171
+
consterror=newError(`effect_update_depth_exceeded\nMaximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops`);
172
172
173
173
error.name='Svelte error';
174
174
throwerror;
@@ -184,7 +184,7 @@ export function effect_update_depth_exceeded() {
184
184
*/
185
185
exportfunctionhydration_failed(){
186
186
if(DEV){
187
-
consterror=newError(`${"hydration_failed"}\n${"Failed to hydrate the application"}`);
187
+
consterror=newError(`hydration_failed\nFailed to hydrate the application`);
188
188
189
189
error.name='Svelte error';
190
190
throwerror;
@@ -201,7 +201,7 @@ export function hydration_failed() {
201
201
*/
202
202
exportfunctionlifecycle_legacy_only(name){
203
203
if(DEV){
204
-
consterror=newError(`${"lifecycle_legacy_only"}\n${`\`${name}(...)\` cannot be used in runes mode`}`);
204
+
consterror=newError(`lifecycle_legacy_only\n\`${name}(...)\` cannot be used in runes mode`);
205
205
206
206
error.name='Svelte error';
207
207
throwerror;
@@ -218,7 +218,7 @@ export function lifecycle_legacy_only(name) {
218
218
*/
219
219
exportfunctionprops_invalid_value(key){
220
220
if(DEV){
221
-
consterror=newError(`${"props_invalid_value"}\n${`Cannot do \`bind:${key}={undefined}\` when \`${key}\` has a fallback value`}`);
221
+
consterror=newError(`props_invalid_value\nCannot do \`bind:${key}={undefined}\` when \`${key}\` has a fallback value`);
222
222
223
223
error.name='Svelte error';
224
224
throwerror;
@@ -235,7 +235,7 @@ export function props_invalid_value(key) {
235
235
*/
236
236
exportfunctionprops_rest_readonly(property){
237
237
if(DEV){
238
-
consterror=newError(`${"props_rest_readonly"}\n${`Rest element properties of \`$props()\` such as \`${property}\` are readonly`}`);
238
+
consterror=newError(`props_rest_readonly\nRest element properties of \`$props()\` such as \`${property}\` are readonly`);
239
239
240
240
error.name='Svelte error';
241
241
throwerror;
@@ -252,7 +252,7 @@ export function props_rest_readonly(property) {
252
252
*/
253
253
exportfunctionrune_outside_svelte(rune){
254
254
if(DEV){
255
-
consterror=newError(`${"rune_outside_svelte"}\n${`The \`${rune}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files`}`);
255
+
consterror=newError(`rune_outside_svelte\nThe \`${rune}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files`);
256
256
257
257
error.name='Svelte error';
258
258
throwerror;
@@ -268,7 +268,7 @@ export function rune_outside_svelte(rune) {
268
268
*/
269
269
exportfunctionstate_prototype_fixed(){
270
270
if(DEV){
271
-
consterror=newError(`${"state_prototype_fixed"}\n${"Cannot set prototype of `$state` object"}`);
271
+
consterror=newError(`state_prototype_fixed\nCannot set prototype of \`$state\` object`);
272
272
273
273
error.name='Svelte error';
274
274
throwerror;
@@ -284,7 +284,7 @@ export function state_prototype_fixed() {
284
284
*/
285
285
exportfunctionstate_unsafe_mutation(){
286
286
if(DEV){
287
-
consterror=newError(`${"state_unsafe_mutation"}\n${"Updating state inside a derived is forbidden. If the value should not be reactive, declare it without `$state`"}`);
287
+
consterror=newError(`state_unsafe_mutation\nUpdating state inside a derived is forbidden. If the value should not be reactive, declare it without \`$state\``);
288
288
289
289
error.name='Svelte error';
290
290
throwerror;
@@ -300,7 +300,7 @@ export function state_unsafe_mutation() {
consterror=newError(`${"svelte_component_invalid_this_value"}\n${"The `this={...}` property of a `<svelte:component>` must be a Svelte component, if defined"}`);
303
+
consterror=newError(`svelte_component_invalid_this_value\nThe \`this={...}\` property of a \`<svelte:component>\` must be a Svelte component, if defined`);
console.warn(`%c[svelte] ${"hydration_attribute_changed"}\n%c${`The \`${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`}`,bold,normal);
16
+
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`,bold,normal);
17
17
}else{
18
18
// TODO print a link to the documentation
19
19
console.warn("hydration_attribute_changed");
@@ -26,7 +26,7 @@ export function hydration_attribute_changed(attribute, html, value) {
26
26
*/
27
27
exportfunctionhydration_mismatch(location){
28
28
if(DEV){
29
-
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"}`,bold,normal);
29
+
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"}`,bold,normal);
30
30
}else{
31
31
// TODO print a link to the documentation
32
32
console.warn("hydration_mismatch");
@@ -38,7 +38,7 @@ export function hydration_mismatch(location) {
38
38
*/
39
39
exportfunctionlifecycle_double_unmount(){
40
40
if(DEV){
41
-
console.warn(`%c[svelte] ${"lifecycle_double_unmount"}\n%c${"Tried to unmount a component that was not mounted"}`,bold,normal);
41
+
console.warn(`%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted`,bold,normal);
42
42
}else{
43
43
// TODO print a link to the documentation
44
44
console.warn("lifecycle_double_unmount");
@@ -53,7 +53,7 @@ export function lifecycle_double_unmount() {
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}`}`,bold,normal);
56
+
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}`,bold,normal);
57
57
}else{
58
58
// TODO print a link to the documentation
59
59
console.warn("ownership_invalid_binding");
@@ -67,7 +67,7 @@ export function ownership_invalid_binding(parent, child, owner) {
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"}`,bold,normal);
70
+
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"}`,bold,normal);
71
71
}else{
72
72
// TODO print a link to the documentation
73
73
console.warn("ownership_invalid_mutation");
@@ -80,7 +80,7 @@ export function ownership_invalid_mutation(component, owner) {
console.warn(`%c[svelte] ${"state_proxy_equality_mismatch"}\n%c${`Reactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${operator}\` will produce unexpected results. Consider using \`$state.is(a, b)\` instead`}`,bold,normal);
83
+
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. Consider using \`$state.is(a, b)\` instead`,bold,normal);
Copy file name to clipboardExpand all lines: packages/svelte/src/internal/shared/errors.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ import { DEV } from 'esm-env';
9
9
*/
10
10
exportfunctionlifecycle_outside_component(name){
11
11
if(DEV){
12
-
consterror=newError(`${"lifecycle_outside_component"}\n${`\`${name}(...)\` can only be used during component initialisation`}`);
12
+
consterror=newError(`lifecycle_outside_component\n\`${name}(...)\` can only be used during component initialisation`);
13
13
14
14
error.name='Svelte error';
15
15
throwerror;
@@ -25,7 +25,7 @@ export function lifecycle_outside_component(name) {
25
25
*/
26
26
exportfunctionrender_tag_invalid_argument(){
27
27
if(DEV){
28
-
consterror=newError(`${"render_tag_invalid_argument"}\n${"The argument to `{@render ...}` must be a snippet function, not a component or some other kind of function. If you want to dynamically render one snippet or another, use `$derived` and pass its result to `{@render ...}`"}`);
28
+
consterror=newError(`render_tag_invalid_argument\nThe argument to \`{@render ...}\` must be a snippet function, not a component or some other kind of function. If you want to dynamically render one snippet or another, use \`$derived\` and pass its result to \`{@render ...}\``);
29
29
30
30
error.name='Svelte error';
31
31
throwerror;
@@ -41,7 +41,7 @@ export function render_tag_invalid_argument() {
41
41
*/
42
42
exportfunctionsnippet_used_as_component(){
43
43
if(DEV){
44
-
consterror=newError(`${"snippet_used_as_component"}\n${"A snippet must be rendered with `{@render ...}`"}`);
44
+
consterror=newError(`snippet_used_as_component\nA snippet must be rendered with \`{@render ...}\``);
45
45
46
46
error.name='Svelte error';
47
47
throwerror;
@@ -58,7 +58,7 @@ export function snippet_used_as_component() {
58
58
*/
59
59
exportfunctionstore_invalid_shape(name){
60
60
if(DEV){
61
-
consterror=newError(`${"store_invalid_shape"}\n${`\`${name}\` is not a store with a \`subscribe\` method`}`);
61
+
consterror=newError(`store_invalid_shape\n\`${name}\` is not a store with a \`subscribe\` method`);
62
62
63
63
error.name='Svelte error';
64
64
throwerror;
@@ -74,7 +74,7 @@ export function store_invalid_shape(name) {
Copy file name to clipboardExpand all lines: packages/svelte/src/internal/shared/warnings.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ var normal = 'font-weight: normal';
11
11
*/
12
12
exportfunctiondynamic_void_element_content(tag){
13
13
if(DEV){
14
-
console.warn(`%c[svelte] ${"dynamic_void_element_content"}\n%c${`\`<svelte:element this="${tag}">\` is a void element — it cannot have content`}`,bold,normal);
14
+
console.warn(`%c[svelte] dynamic_void_element_content\n%c\`<svelte:element this="${tag}">\` is a void element — it cannot have content`,bold,normal);
0 commit comments