Skip to content

Commit b423b5c

Browse files
committed
update errors
1 parent 28e05ed commit b423b5c

File tree

4 files changed

+13
-32
lines changed

4 files changed

+13
-32
lines changed

documentation/docs/98-reference/.generated/compile-errors.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ Expected whitespace
442442
Imports of `svelte/internal/*` are forbidden. It contains private runtime code which is subject to change without notice. If you're importing from `svelte/internal/*` to work around a limitation of Svelte, please open an issue at https://github.com/sveltejs/svelte and explain your use case
443443
```
444444

445+
### inspect_trace_invalid_placement
446+
447+
```
448+
`$inspect.trace(...)` must be the first statement of a function body
449+
```
450+
445451
### invalid_arguments_usage
446452

447453
```
@@ -970,18 +976,6 @@ A `<textarea>` can have either a value attribute or (equivalently) child content
970976
`<title>` can only contain text and {tags}
971977
```
972978

973-
### trace_rune_invalid_argument
974-
975-
```
976-
`$inspect.trace` requires a string argument for the trace name
977-
```
978-
979-
### trace_rune_invalid_location
980-
981-
```
982-
`$inspect.trace(...)` must be the first statement of a function body
983-
```
984-
985979
### transition_conflict
986980

987981
```

packages/svelte/messages/compile-errors/script.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454

5555
> Imports of `svelte/internal/*` are forbidden. It contains private runtime code which is subject to change without notice. If you're importing from `svelte/internal/*` to work around a limitation of Svelte, please open an issue at https://github.com/sveltejs/svelte and explain your use case
5656
57+
## inspect_trace_invalid_placement
58+
59+
> `$inspect.trace(...)` must be the first statement of a function body
60+
5761
## invalid_arguments_usage
5862

5963
> The arguments keyword cannot be used within the template or at the top level of a component
@@ -186,14 +190,6 @@ It's possible to export a snippet from a `<script module>` block, but only if it
186190
187191
Using a `$` prefix to refer to the value of a store is only possible inside `.svelte` files, where Svelte can automatically create subscriptions when a component is mounted and unsubscribe when the component is unmounted. Consider migrating to runes instead.
188192

189-
## trace_rune_invalid_argument
190-
191-
> `$inspect.trace` requires a string argument for the trace name
192-
193-
## trace_rune_invalid_location
194-
195-
> `$inspect.trace(...)` must be the first statement of a function body
196-
197193
## typescript_invalid_feature
198194

199195
> TypeScript language features like %feature% are not natively supported, and their use is generally discouraged. Outside of `<script>` tags, these features are not supported. For use within `<script>` tags, you will need to use a preprocessor to convert it to JavaScript before it gets passed to the Svelte compiler. If you are using `vitePreprocess`, make sure to specifically enable preprocessing script tags (`vitePreprocess({ script: true })`)

packages/svelte/src/compiler/errors.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -469,22 +469,13 @@ export function store_invalid_subscription_module(node) {
469469
e(node, "store_invalid_subscription_module", `Cannot reference store value outside a \`.svelte\` file\nhttps://svelte.dev/e/store_invalid_subscription_module`);
470470
}
471471

472-
/**
473-
* `$inspect.trace` requires a string argument for the trace name
474-
* @param {null | number | NodeLike} node
475-
* @returns {never}
476-
*/
477-
export function trace_rune_invalid_argument(node) {
478-
e(node, "trace_rune_invalid_argument", `\`$inspect.trace\` requires a string argument for the trace name\nhttps://svelte.dev/e/trace_rune_invalid_argument`);
479-
}
480-
481472
/**
482473
* `$inspect.trace(...)` must be the first statement of a function body
483474
* @param {null | number | NodeLike} node
484475
* @returns {never}
485476
*/
486-
export function trace_rune_invalid_location(node) {
487-
e(node, "trace_rune_invalid_location", `\`$inspect.trace(...)\` must be the first statement of a function body\nhttps://svelte.dev/e/trace_rune_invalid_location`);
477+
export function inspect_trace_invalid_placement(node) {
478+
e(node, "inspect_trace_invalid_placement", `\`$inspect.trace(...)\` must be the first statement of a function body\nhttps://svelte.dev/e/inspect_trace_invalid_placement`);
488479
}
489480

490481
/**

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function CallExpression(node, context) {
155155
) ||
156156
grand_parent.body[0] !== parent
157157
) {
158-
e.trace_rune_invalid_location(node);
158+
e.inspect_trace_invalid_placement(node);
159159
}
160160

161161
if (dev) {

0 commit comments

Comments
 (0)