Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"axobject-query": "^4.1.0",
"clsx": "^2.1.1",
"esm-env": "^1.2.1",
"esrap": "^1.3.2",
"esrap": "^1.4.2",
"is-reference": "^3.0.3",
"locate-character": "^3.0.0",
"magic-string": "^0.30.11",
Expand Down
330 changes: 165 additions & 165 deletions packages/svelte/src/compiler/errors.js

Large diffs are not rendered by default.

312 changes: 156 additions & 156 deletions packages/svelte/src/compiler/warnings.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/svelte/src/internal/client/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function hydration_attribute_changed(attribute, html, value) {
*/
export function hydration_html_changed(location) {
if (DEV) {
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);
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);
} else {
console.warn(`https://svelte.dev/e/hydration_html_changed`);
}
Expand All @@ -88,7 +88,7 @@ export function hydration_html_changed(location) {
*/
export function hydration_mismatch(location) {
if (DEV) {
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);
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);
} else {
console.warn(`https://svelte.dev/e/hydration_mismatch`);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ export function ownership_invalid_binding(parent, child, owner) {
*/
export function ownership_invalid_mutation(component, owner) {
if (DEV) {
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);
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);
} else {
console.warn(`https://svelte.dev/e/ownership_invalid_mutation`);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/internal/shared/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function state_snapshot_uncloneable(properties) {
? `The following properties cannot be cloned with \`$state.snapshot\` — the return value contains the originals:

${properties}`
: "Value cannot be cloned with `$state.snapshot` — the original value was returned"}\nhttps://svelte.dev/e/state_snapshot_uncloneable`, bold, normal);
: 'Value cannot be cloned with `$state.snapshot` — the original value was returned'}\nhttps://svelte.dev/e/state_snapshot_uncloneable`, bold, normal);
} else {
console.warn(`https://svelte.dev/e/state_snapshot_uncloneable`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

function increment(_, counter) {
counter.count += 1;
Expand All @@ -26,11 +26,11 @@ export default function Await_block_scope($$anchor) {
var text_1 = $.sibling(node);

$.template_effect(() => {
$.set_text(text, `clicks: ${counter.count ?? ""}`);
$.set_text(text_1, ` ${counter.count ?? ""}`);
$.set_text(text, `clicks: ${counter.count ?? ''}`);
$.set_text(text_1, ` ${counter.count ?? ''}`);
});

$.append($$anchor, fragment);
}

$.delegate(["click"]);
$.delegate(['click']);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Await_block_scope($$payload) {
let counter = { count: 0 };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';
import TextInput from './Child.svelte';

const snippet = ($$anchor) => {
$.next();

var text = $.text("Something");
var text = $.text('Something');

$.append($$anchor, text);
};
Expand All @@ -29,6 +29,6 @@ export default function Bind_component_snippet($$anchor) {

var text_1 = $.sibling(node);

$.template_effect(() => $.set_text(text_1, ` value: ${$.get(value) ?? ""}`));
$.template_effect(() => $.set_text(text_1, ` value: ${$.get(value) ?? ''}`));
$.append($$anchor, fragment);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';
import TextInput from './Child.svelte';

function snippet($$payload) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "svelte/internal/disclose-version";
import "svelte/internal/flags/legacy";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';

export default function Bind_this($$anchor) {
$.bind_this(Foo($$anchor, { $$legacy: true }), ($$value) => foo = $$value, () => foo);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Bind_this($$payload) {
Foo($$payload, {});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

export default function Class_state_field_constructor_assignment($$anchor, $$props) {
$.push($$props, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Class_state_field_constructor_assignment($$payload, $$props) {
$.push();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* index.svelte.js generated by Svelte VERSION */
import * as $ from "svelte/internal/client";
import * as $ from 'svelte/internal/client';

let a = $.state(1);
let b = $.state(2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* index.svelte.js generated by Svelte VERSION */
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

let a = 1;
let b = 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

var root = $.template(`<div></div> <svg></svg> <custom-element></custom-element> <div></div> <svg></svg> <custom-element></custom-element>`, 3);

Expand All @@ -13,20 +13,20 @@ export default function Main($$anchor) {
var custom_element = $.sibling(svg, 2);
var div_1 = $.sibling(custom_element, 2);

$.template_effect(() => $.set_attribute(div_1, "foobar", y()));
$.template_effect(() => $.set_attribute(div_1, 'foobar', y()));

var svg_1 = $.sibling(div_1, 2);

$.template_effect(() => $.set_attribute(svg_1, "viewBox", y()));
$.template_effect(() => $.set_attribute(svg_1, 'viewBox', y()));

var custom_element_1 = $.sibling(svg_1, 2);

$.template_effect(() => $.set_custom_element_data(custom_element_1, "fooBar", y()));
$.template_effect(() => $.set_custom_element_data(custom_element_1, 'fooBar', y()));

$.template_effect(() => {
$.set_attribute(div, "foobar", x);
$.set_attribute(svg, "viewBox", x);
$.set_custom_element_data(custom_element, "fooBar", x);
$.set_attribute(div, 'foobar', x);
$.set_attribute(svg, 'viewBox', x);
$.set_custom_element_data(custom_element, 'fooBar', x);
});

$.append($$anchor, fragment);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Main($$payload) {
// needs to be a snapshot test because jsdom does auto-correct the attribute casing
let x = 'test';
let y = () => 'test';

$$payload.out += `<div${$.attr("foobar", x)}></div> <svg${$.attr("viewBox", x)}></svg> <custom-element${$.attr("foobar", x)}></custom-element> <div${$.attr("foobar", y())}></div> <svg${$.attr("viewBox", y())}></svg> <custom-element${$.attr("foobar", y())}></custom-element>`;
$$payload.out += `<div${$.attr('foobar', x)}></div> <svg${$.attr('viewBox', x)}></svg> <custom-element${$.attr('foobar', x)}></custom-element> <div${$.attr('foobar', y())}></div> <svg${$.attr('viewBox', y())}></svg> <custom-element${$.attr('foobar', y())}></custom-element>`;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "svelte/internal/disclose-version";
import "svelte/internal/flags/legacy";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';

export default function Each_string_template($$anchor) {
var fragment = $.comment();
Expand All @@ -11,7 +11,7 @@ export default function Each_string_template($$anchor) {

var text = $.text();

$.template_effect(() => $.set_text(text, `${thing ?? ""}, `));
$.template_effect(() => $.set_text(text, `${thing ?? ''}, `));
$.append($$anchor, text);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Each_string_template($$payload) {
const each_array = $.ensure_array_like(['foo', 'bar', 'baz']);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* index.svelte.js generated by Svelte VERSION */
import * as $ from "svelte/internal/client";
import * as $ from 'svelte/internal/client';

export const object = $.proxy({ ok: true });
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* index.svelte.js generated by Svelte VERSION */
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export const object = { ok: true };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

export default function Function_prop_no_getter($$anchor) {
let count = $.state(0);
Expand All @@ -19,7 +19,7 @@ export default function Function_prop_no_getter($$anchor) {

var text = $.text();

$.template_effect(() => $.set_text(text, `clicks: ${$.get(count) ?? ""}`));
$.template_effect(() => $.set_text(text, `clicks: ${$.get(count) ?? ''}`));
$.append($$anchor, text);
},
$$slots: { default: true }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Function_prop_no_getter($$payload) {
let count = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "svelte/internal/disclose-version";
import "svelte/internal/flags/legacy";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';

var root = $.template(`<h1>hello world</h1>`);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Hello_world($$payload) {
$$payload.out += `<h1>hello world</h1>`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "svelte/internal/disclose-version";
import "svelte/internal/flags/legacy";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';

var root = $.template(`<h1>hello world</h1>`);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Hmr($$payload) {
$$payload.out += `<h1>hello world</h1>`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "svelte/internal/disclose-version";
import "svelte/internal/flags/legacy";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import { random } from './module.svelte';

export default function Imports_in_modules($$anchor) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* module.svelte.js generated by Svelte VERSION */
import * as $ from "svelte/internal/client";
import * as $ from 'svelte/internal/client';
import { random } from './export';

export { random };
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';
import { random } from './module.svelte';

export default function Imports_in_modules($$payload) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* module.svelte.js generated by Svelte VERSION */
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';
import { random } from './export';

export { random };
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

export default function Props_identifier($$anchor, $$props) {
$.push($$props, true);

let props = $.rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
let props = $.rest_props($$props, ['$$slots', '$$events', '$$legacy']);

$$props.a;
props[a];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Props_identifier($$payload, $$props) {
$.push();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "svelte/internal/disclose-version";
import "svelte/internal/flags/legacy";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';

var root = $.template(`<p></p> <p></p> <!>`, 1);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Purity($$payload) {
$$payload.out += `<p>${$.escape(Math.max(0, Math.min(0, 100)))}</p> <p>${$.escape(location.href)}</p> `;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

var root = $.template(`<header><nav><a href="/">Home</a> <a href="/away">Away</a></nav></header> <main><h1> </h1> <div class="static"><p>we don't need to traverse these nodes</p></div> <p>or</p> <p>these</p> <p>ones</p> <!> <p>these</p> <p>trailing</p> <p>nodes</p> <p>can</p> <p>be</p> <p>completely</p> <p>ignored</p></main> <cant-skip><custom-elements></custom-elements></cant-skip> <div><input></div> <div><source></div> <select><option>a</option></select> <img src="..." alt="" loading="lazy"> <div><img src="..." alt="" loading="lazy"></div>`, 3);

Expand All @@ -20,7 +20,7 @@ export default function Skip_static_subtree($$anchor, $$props) {
var cant_skip = $.sibling(main, 2);
var custom_elements = $.child(cant_skip);

$.set_custom_element_data(custom_elements, "with", "attributes");
$.set_custom_element_data(custom_elements, 'with', 'attributes');
$.reset(cant_skip);

var div = $.sibling(cant_skip, 2);
Expand All @@ -38,7 +38,7 @@ export default function Skip_static_subtree($$anchor, $$props) {
var select = $.sibling(div_1, 2);
var option = $.child(select);

option.value = null == (option.__value = "a") ? "" : "a";
option.value = null == (option.__value = 'a') ? '' : 'a';
$.reset(select);

var img = $.sibling(select, 2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as $ from "svelte/internal/server";
import * as $ from 'svelte/internal/server';

export default function Skip_static_subtree($$payload, $$props) {
let { title, content } = $$props;
Expand Down
Loading
Loading