Merge branch 'adjust-boundary-error-message' into remove-metadata-pending

pull/16764/head
Rich Harris 11 months ago committed by GitHub
commit fda96e2aef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,21 +1,5 @@
<!-- This file is generated by scripts/process-messages/index.js. Do not edit! -->
### await_outside_boundary
```
Cannot await outside a `<svelte:boundary>`.
```
The `await` keyword can only appear in a `$derived(...)` or template expression, or at the top level of a component's `<script>` block, if it is inside a [`<svelte:boundary>`](/docs/svelte/svelte-boundary):
```svelte
<svelte:boundary>
<p>{await getData()}</p>
</svelte:boundary>
```
This restriction may be lifted in a future version of Svelte.
### invalid_default_snippet
```

@ -1,17 +1,3 @@
## await_outside_boundary
> Cannot await outside a `<svelte:boundary>`.
The `await` keyword can only appear in a `$derived(...)` or template expression, or at the top level of a component's `<script>` block, if it is inside a [`<svelte:boundary>`](/docs/svelte/svelte-boundary):
```svelte
<svelte:boundary>
<p>{await getData()}</p>
</svelte:boundary>
```
This restriction may be lifted in a future version of Svelte.
## invalid_default_snippet
> Cannot use `{@render children(...)}` if the parent component uses `let:` directives. Consider using a named snippet instead

@ -304,7 +304,6 @@ export function analyze_module(source, options) {
options: /** @type {ValidatedCompileOptions} */ (options),
fragment: null,
title: null,
boundary: null,
parent_element: null,
reactive_statement: null
},
@ -696,7 +695,6 @@ export function analyze_component(root, source, options) {
ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module',
fragment: ast === template.ast ? ast : null,
title: null,
boundary: null,
parent_element: null,
has_props_rune: false,
component_slots: new Set(),
@ -764,7 +762,6 @@ export function analyze_component(root, source, options) {
options,
fragment: ast === template.ast ? ast : null,
title: null,
boundary: null,
parent_element: null,
has_props_rune: false,
ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module',

@ -10,7 +10,6 @@ export interface AnalysisState {
ast_type: 'instance' | 'template' | 'module';
fragment: AST.Fragment | null;
title: AST.TitleElement | null;
boundary: AST.SvelteBoundary | null;
/**
* Tag name of the parent element. `null` if the parent is `svelte:element`, `#snippet`, a component or the root.
* Parent doesn't necessarily mean direct path predecessor because there could be `#each`, `#if` etc in-between.

@ -23,5 +23,5 @@ export function SvelteBoundary(node, context) {
}
}
context.next({ ...context.state, boundary: node });
context.next();
}

@ -437,13 +437,7 @@ function move_effect(effect, fragment) {
}
export function get_boundary() {
var boundary = /** @type {Effect} */ (active_effect).b;
if (boundary === null) {
e.await_outside_boundary();
}
return boundary;
return /** @type {Boundary} */ (/** @type {Effect} */ (active_effect).b);
}
export function pending() {

@ -605,8 +605,6 @@ export {
export { escape_html as escape };
export { await_outside_boundary } from '../shared/errors.js';
/**
* @template T
* @param {()=>T} fn

@ -2,22 +2,6 @@
import { DEV } from 'esm-env';
/**
* Cannot await outside a `<svelte:boundary>`.
* @returns {never}
*/
export function await_outside_boundary() {
if (DEV) {
const error = new Error(`await_outside_boundary\nCannot await outside a \`<svelte:boundary>\`.\nhttps://svelte.dev/e/await_outside_boundary`);
error.name = 'Svelte error';
throw error;
} else {
throw new Error(`https://svelte.dev/e/await_outside_boundary`);
}
}
/**
* Cannot use `{@render children(...)}` if the parent component uses `let:` directives. Consider using a named snippet instead
* @returns {never}

Loading…
Cancel
Save