adjust-boundary-error-message
S. Elliott Johnson 3 weeks ago
parent c5b639c108
commit 0cb62125c1

@ -242,7 +242,7 @@ export function server_component(analysis, options) {
b.call( b.call(
'$$payload.child', '$$payload.child',
b.arrow( b.arrow(
[], [b.object_pattern([b.init('$$payload', b.id('$$payload'))])],
b.block([ b.block([
.../** @type {Statement[]} */ (instance.body), .../** @type {Statement[]} */ (instance.body),
.../** @type {Statement[]} */ (template.body) .../** @type {Statement[]} */ (template.body)

@ -12,8 +12,18 @@ export function SnippetBlock(node, context) {
let fn = b.function_declaration( let fn = b.function_declaration(
node.expression, node.expression,
[b.id('$$payload'), ...node.parameters], [b.id('$$payload'), ...node.parameters],
b.block([
b.stmt(
b.call(
'$$payload.child',
b.arrow(
[b.object_pattern([b.init('$$payload', b.id('$$payload'))])],
/** @type {BlockStatement} */ (context.visit(node.body)), /** @type {BlockStatement} */ (context.visit(node.body)),
node.metadata.has_await context.state.analysis.suspends
)
)
)
])
); );
// @ts-expect-error - TODO remove this hack once $$render_inner for legacy bindings is gone // @ts-expect-error - TODO remove this hack once $$render_inner for legacy bindings is gone

@ -237,7 +237,11 @@ export function build_inline_component(node, expression, context) {
b.stmt( b.stmt(
b.call( b.call(
'$$payload.child', '$$payload.child',
b.arrow([], b.block(block.body), context.state.analysis.suspends) b.arrow(
[b.object_pattern([b.init('$$payload', b.id('$$payload'))])],
b.block(block.body),
context.state.analysis.suspends
)
) )
) )
]) ])

@ -1,6 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Await_block_scope($$payload) { export default function Await_block_scope($$payload) {
$$payload.child(({ $$payload }) => {
let counter = { count: 0 }; let counter = { count: 0 };
const promise = Promise.resolve(counter); const promise = Promise.resolve(counter);
@ -11,4 +12,5 @@ export default function Await_block_scope($$payload) {
$$payload.out.push(`<button>clicks: ${$.escape(counter.count)}</button> `); $$payload.out.push(`<button>clicks: ${$.escape(counter.count)}</button> `);
$.await($$payload, promise, () => {}, (counter) => {}); $.await($$payload, promise, () => {}, (counter) => {});
$$payload.out.push(`<!--]--> ${$.escape(counter.count)}`); $$payload.out.push(`<!--]--> ${$.escape(counter.count)}`);
});
} }

@ -2,10 +2,13 @@ import * as $ from 'svelte/internal/server';
import TextInput from './Child.svelte'; import TextInput from './Child.svelte';
function snippet($$payload) { function snippet($$payload) {
$$payload.child(({ $$payload }) => {
$$payload.out.push(`<!---->Something`); $$payload.out.push(`<!---->Something`);
});
} }
export default function Bind_component_snippet($$payload) { export default function Bind_component_snippet($$payload) {
$$payload.child(({ $$payload }) => {
let value = ''; let value = '';
const _snippet = snippet; const _snippet = snippet;
let $$settled = true; let $$settled = true;
@ -33,4 +36,5 @@ export default function Bind_component_snippet($$payload) {
} while (!$$settled); } while (!$$settled);
$.assign_payload($$payload, $$inner_payload); $.assign_payload($$payload, $$inner_payload);
});
} }

@ -1,5 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Bind_this($$payload) { export default function Bind_this($$payload) {
$$payload.child(({ $$payload }) => {
Foo($$payload, {}); Foo($$payload, {});
});
} }

@ -3,6 +3,7 @@ import * as $ from 'svelte/internal/server';
export default function Class_state_field_constructor_assignment($$payload, $$props) { export default function Class_state_field_constructor_assignment($$payload, $$props) {
$.push(); $.push();
$$payload.child(({ $$payload }) => {
class Foo { class Foo {
a = 0; a = 0;
#b; #b;
@ -33,6 +34,7 @@ export default function Class_state_field_constructor_assignment($$payload, $$pr
this.bar = 4; this.bar = 4;
} }
} }
});
$.pop(); $.pop();
} }

@ -1,6 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Delegated_locally_declared_shadowed($$payload) { export default function Delegated_locally_declared_shadowed($$payload) {
$$payload.child(({ $$payload }) => {
const each_array = $.ensure_array_like({ length: 1 }); const each_array = $.ensure_array_like({ length: 1 });
$$payload.out.push(`<!--[-->`); $$payload.out.push(`<!--[-->`);
@ -10,4 +11,5 @@ export default function Delegated_locally_declared_shadowed($$payload) {
} }
$$payload.out.push(`<!--]-->`); $$payload.out.push(`<!--]-->`);
});
} }

@ -1,10 +1,10 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Main($$payload) { export default function Main($$payload) {
// needs to be a snapshot test because jsdom does auto-correct the attribute casing $$payload.child(({ $$payload }) => {
let x = 'test'; let x = 'test';
let y = () => 'test'; let y = () => 'test';
$$payload.out.push(`<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.push(`<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>`);
});
} }

@ -1,6 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Each_index_non_null($$payload) { export default function Each_index_non_null($$payload) {
$$payload.child(({ $$payload }) => {
const each_array = $.ensure_array_like(Array(10)); const each_array = $.ensure_array_like(Array(10));
$$payload.out.push(`<!--[-->`); $$payload.out.push(`<!--[-->`);
@ -10,4 +11,5 @@ export default function Each_index_non_null($$payload) {
} }
$$payload.out.push(`<!--]-->`); $$payload.out.push(`<!--]-->`);
});
} }

@ -1,6 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Each_string_template($$payload) { export default function Each_string_template($$payload) {
$$payload.child(({ $$payload }) => {
const each_array = $.ensure_array_like(['foo', 'bar', 'baz']); const each_array = $.ensure_array_like(['foo', 'bar', 'baz']);
$$payload.out.push(`<!--[-->`); $$payload.out.push(`<!--[-->`);
@ -12,4 +13,5 @@ export default function Each_string_template($$payload) {
} }
$$payload.out.push(`<!--]-->`); $$payload.out.push(`<!--]-->`);
});
} }

@ -1,6 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Function_prop_no_getter($$payload) { export default function Function_prop_no_getter($$payload) {
$$payload.child(({ $$payload }) => {
let count = 0; let count = 0;
function onmouseup() { function onmouseup() {
@ -15,9 +16,12 @@ export default function Function_prop_no_getter($$payload) {
onmouseenter: () => count = plusOne(count), onmouseenter: () => count = plusOne(count),
children: ($$payload) => { children: ($$payload) => {
$$payload.child(({ $$payload }) => {
$$payload.out.push(`<!---->clicks: ${$.escape(count)}`); $$payload.out.push(`<!---->clicks: ${$.escape(count)}`);
});
}, },
$$slots: { default: true } $$slots: { default: true }
}); });
});
} }

@ -1,5 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Functional_templating($$payload) { export default function Functional_templating($$payload) {
$$payload.child(({ $$payload }) => {
$$payload.out.push(`<h1>hello</h1> <div class="potato"><p>child element</p> <p>another child element</p></div>`); $$payload.out.push(`<h1>hello</h1> <div class="potato"><p>child element</p> <p>another child element</p></div>`);
});
} }

@ -1,5 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Hello_world($$payload) { export default function Hello_world($$payload) {
$$payload.child(({ $$payload }) => {
$$payload.out.push(`<h1>hello world</h1>`); $$payload.out.push(`<h1>hello world</h1>`);
});
} }

@ -1,5 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Hmr($$payload) { export default function Hmr($$payload) {
$$payload.child(({ $$payload }) => {
$$payload.out.push(`<h1>hello world</h1>`); $$payload.out.push(`<h1>hello world</h1>`);
});
} }

@ -1,4 +1,6 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
import { random } from './module.svelte'; import { random } from './module.svelte';
export default function Imports_in_modules($$payload) {} export default function Imports_in_modules($$payload) {
$$payload.child(({ $$payload }) => {});
}

@ -1,8 +1,10 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Nullish_coallescence_omittance($$payload) { export default function Nullish_coallescence_omittance($$payload) {
$$payload.child(({ $$payload }) => {
let name = 'world'; let name = 'world';
let count = 0; let count = 0;
$$payload.out.push(`<h1>Hello, world!</h1> <b>123</b> <button>Count is ${$.escape(count)}</button> <h1>Hello, world</h1>`); $$payload.out.push(`<h1>Hello, world!</h1> <b>123</b> <button>Count is ${$.escape(count)}</button> <h1>Hello, world</h1>`);
});
} }

@ -3,6 +3,7 @@ import * as $ from 'svelte/internal/server';
export default function Props_identifier($$payload, $$props) { export default function Props_identifier($$payload, $$props) {
$.push(); $.push();
$$payload.child(({ $$payload }) => {
let { $$slots, $$events, ...props } = $$props; let { $$slots, $$events, ...props } = $$props;
props.a; props.a;
@ -12,5 +13,7 @@ export default function Props_identifier($$payload, $$props) {
props.a = true; props.a = true;
props[a] = true; props[a] = true;
props; props;
});
$.pop(); $.pop();
} }

@ -1,7 +1,9 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Purity($$payload) { export default function Purity($$payload) {
$$payload.child(({ $$payload }) => {
$$payload.out.push(`<p>0</p> <p>${$.escape(location.href)}</p> `); $$payload.out.push(`<p>0</p> <p>${$.escape(location.href)}</p> `);
Child($$payload, { prop: encodeURIComponent('hello') }); Child($$payload, { prop: encodeURIComponent('hello') });
$$payload.out.push(`<!---->`); $$payload.out.push(`<!---->`);
});
} }

@ -1,7 +1,9 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Skip_static_subtree($$payload, $$props) { export default function Skip_static_subtree($$payload, $$props) {
$$payload.child(({ $$payload }) => {
let { title, content } = $$props; let { title, content } = $$props;
$$payload.out.push(`<header><nav><a href="/">Home</a> <a href="/away">Away</a></nav></header> <main><h1>${$.escape(title)}</h1> <div class="static"><p>we don't need to traverse these nodes</p></div> <p>or</p> <p>these</p> <p>ones</p> ${$.html(content)} <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 with="attributes"></custom-elements></cant-skip> <div><input autofocus/></div> <div><source muted/></div> <select><option value="a"${$.maybe_selected($$payload, 'a')}>a</option></select> <img src="..." alt="" loading="lazy"/> <div><img src="..." alt="" loading="lazy"/></div>`); $$payload.out.push(`<header><nav><a href="/">Home</a> <a href="/away">Away</a></nav></header> <main><h1>${$.escape(title)}</h1> <div class="static"><p>we don't need to traverse these nodes</p></div> <p>or</p> <p>these</p> <p>ones</p> ${$.html(content)} <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 with="attributes"></custom-elements></cant-skip> <div><input autofocus/></div> <div><source muted/></div> <select><option value="a"${$.maybe_selected($$payload, 'a')}>a</option></select> <img src="..." alt="" loading="lazy"/> <div><img src="..." alt="" loading="lazy"/></div>`);
});
} }

@ -1,6 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function State_proxy_literal($$payload) { export default function State_proxy_literal($$payload) {
$$payload.child(({ $$payload }) => {
let str = ''; let str = '';
let tpl = ``; let tpl = ``;
@ -12,4 +13,5 @@ export default function State_proxy_literal($$payload) {
} }
$$payload.out.push(`<input${$.attr('value', str)}/> <input${$.attr('value', tpl)}/> <button>reset</button>`); $$payload.out.push(`<input${$.attr('value', str)}/> <input${$.attr('value', tpl)}/> <button>reset</button>`);
});
} }

@ -1,7 +1,9 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Svelte_element($$payload, $$props) { export default function Svelte_element($$payload, $$props) {
$$payload.child(({ $$payload }) => {
let { tag = 'hr' } = $$props; let { tag = 'hr' } = $$props;
$.element($$payload, tag); $.element($$payload, tag);
});
} }

@ -1,6 +1,7 @@
import * as $ from 'svelte/internal/server'; import * as $ from 'svelte/internal/server';
export default function Text_nodes_deriveds($$payload) { export default function Text_nodes_deriveds($$payload) {
$$payload.child(({ $$payload }) => {
let count1 = 0; let count1 = 0;
let count2 = 0; let count2 = 0;
@ -13,4 +14,5 @@ export default function Text_nodes_deriveds($$payload) {
} }
$$payload.out.push(`<p>${$.escape(text1())}${$.escape(text2())}</p>`); $$payload.out.push(`<p>${$.escape(text1())}${$.escape(text2())}</p>`);
});
} }
Loading…
Cancel
Save