Skip to content

Commit 0010a26

Browse files
authored
Merge branch 'main' into fix-ssr-boundary-in-async
2 parents 06049a9 + da00abe commit 0010a26

File tree

54 files changed

+307
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+307
-175
lines changed

.changeset/small-geckos-camp.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ This restriction only applies when using the `experimental.async` option, which
149149
### fork_discarded
150150

151151
```
152-
Cannot commit a fork that was already committed or discarded
152+
Cannot commit a fork that was already discarded
153153
```
154154

155155
### fork_timing

packages/svelte/CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# svelte
22

3+
## 5.42.2
4+
5+
### Patch Changes
6+
7+
- fix: better error message for global variable assignments ([#17036](https://github.com/sveltejs/svelte/pull/17036))
8+
9+
- chore: tweak memoizer logic ([#17042](https://github.com/sveltejs/svelte/pull/17042))
10+
11+
## 5.42.1
12+
13+
### Patch Changes
14+
15+
- fix: ignore fork `discard()` after `commit()` ([#17034](https://github.com/sveltejs/svelte/pull/17034))
16+
17+
## 5.42.0
18+
19+
### Minor Changes
20+
21+
- feat: experimental `fork` API ([#17004](https://github.com/sveltejs/svelte/pull/17004))
22+
23+
### Patch Changes
24+
25+
- fix: always allow `setContext` before first await in component ([#17031](https://github.com/sveltejs/svelte/pull/17031))
26+
27+
- fix: less confusing names for inspect errors ([#17026](https://github.com/sveltejs/svelte/pull/17026))
28+
329
## 5.41.4
430

531
### Patch Changes

packages/svelte/messages/client-errors/errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ This restriction only applies when using the `experimental.async` option, which
114114

115115
## fork_discarded
116116

117-
> Cannot commit a fork that was already committed or discarded
117+
> Cannot commit a fork that was already discarded
118118
119119
## fork_timing
120120

packages/svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svelte",
33
"description": "Cybernetically enhanced web apps",
44
"license": "MIT",
5-
"version": "5.41.4",
5+
"version": "5.42.2",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {

packages/svelte/src/compiler/phases/1-parse/state/element.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import { decode_character_references } from '../utils/html.js';
99
import * as e from '../../../errors.js';
1010
import * as w from '../../../warnings.js';
1111
import { create_fragment } from '../utils/create.js';
12-
import { create_attribute, create_expression_metadata, is_element_node } from '../../nodes.js';
12+
import { create_attribute, ExpressionMetadata, is_element_node } from '../../nodes.js';
1313
import { get_attribute_expression, is_expression_attribute } from '../../../utils/ast.js';
1414
import { closing_tag_omitted } from '../../../../html-tree-validation.js';
1515
import { list } from '../../../utils/string.js';
16-
import { regex_whitespace } from '../../patterns.js';
1716

1817
const regex_invalid_unquoted_attribute_value = /^(\/>|[\s"'=<>`])/;
1918
const regex_closing_textarea_tag = /^<\/textarea(\s[^>]*)?>/i;
@@ -297,7 +296,7 @@ export default function element(parser) {
297296
element.tag = get_attribute_expression(definition);
298297
}
299298

300-
element.metadata.expression = create_expression_metadata();
299+
element.metadata.expression = new ExpressionMetadata();
301300
}
302301

303302
if (is_top_level_script_or_style) {
@@ -508,7 +507,7 @@ function read_attribute(parser) {
508507
end: parser.index,
509508
expression,
510509
metadata: {
511-
expression: create_expression_metadata()
510+
expression: new ExpressionMetadata()
512511
}
513512
};
514513

@@ -528,7 +527,7 @@ function read_attribute(parser) {
528527
end: parser.index,
529528
expression,
530529
metadata: {
531-
expression: create_expression_metadata()
530+
expression: new ExpressionMetadata()
532531
}
533532
};
534533

@@ -568,7 +567,7 @@ function read_attribute(parser) {
568567
name
569568
},
570569
metadata: {
571-
expression: create_expression_metadata()
570+
expression: new ExpressionMetadata()
572571
}
573572
};
574573

@@ -628,7 +627,7 @@ function read_attribute(parser) {
628627
modifiers: /** @type {Array<'important'>} */ (modifiers),
629628
value,
630629
metadata: {
631-
expression: create_expression_metadata()
630+
expression: new ExpressionMetadata()
632631
}
633632
};
634633
}
@@ -658,7 +657,7 @@ function read_attribute(parser) {
658657
name: directive_name,
659658
expression,
660659
metadata: {
661-
expression: create_expression_metadata()
660+
expression: new ExpressionMetadata()
662661
}
663662
};
664663

@@ -824,7 +823,7 @@ function read_sequence(parser, done, location) {
824823
end: parser.index,
825824
expression,
826825
metadata: {
827-
expression: create_expression_metadata()
826+
expression: new ExpressionMetadata()
828827
}
829828
};
830829

packages/svelte/src/compiler/phases/1-parse/state/tag.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/** @import { Parser } from '../index.js' */
44
import { walk } from 'zimmerframe';
55
import * as e from '../../../errors.js';
6-
import { create_expression_metadata } from '../../nodes.js';
6+
import { ExpressionMetadata } from '../../nodes.js';
77
import { parse_expression_at } from '../acorn.js';
88
import read_pattern from '../read/context.js';
99
import read_expression, { get_loose_identifier } from '../read/expression.js';
@@ -42,7 +42,7 @@ export default function tag(parser) {
4242
end: parser.index,
4343
expression,
4444
metadata: {
45-
expression: create_expression_metadata()
45+
expression: new ExpressionMetadata()
4646
}
4747
});
4848
}
@@ -65,7 +65,7 @@ function open(parser) {
6565
consequent: create_fragment(),
6666
alternate: null,
6767
metadata: {
68-
expression: create_expression_metadata()
68+
expression: new ExpressionMetadata()
6969
}
7070
});
7171

@@ -249,7 +249,7 @@ function open(parser) {
249249
then: null,
250250
catch: null,
251251
metadata: {
252-
expression: create_expression_metadata()
252+
expression: new ExpressionMetadata()
253253
}
254254
});
255255

@@ -334,7 +334,7 @@ function open(parser) {
334334
expression,
335335
fragment: create_fragment(),
336336
metadata: {
337-
expression: create_expression_metadata()
337+
expression: new ExpressionMetadata()
338338
}
339339
});
340340

@@ -477,7 +477,7 @@ function next(parser) {
477477
consequent: create_fragment(),
478478
alternate: null,
479479
metadata: {
480-
expression: create_expression_metadata()
480+
expression: new ExpressionMetadata()
481481
}
482482
});
483483

@@ -643,7 +643,7 @@ function special(parser) {
643643
end: parser.index,
644644
expression,
645645
metadata: {
646-
expression: create_expression_metadata()
646+
expression: new ExpressionMetadata()
647647
}
648648
});
649649

@@ -721,7 +721,7 @@ function special(parser) {
721721
end: parser.index - 1
722722
},
723723
metadata: {
724-
expression: create_expression_metadata()
724+
expression: new ExpressionMetadata()
725725
}
726726
});
727727
}
@@ -748,7 +748,7 @@ function special(parser) {
748748
end: parser.index,
749749
expression: /** @type {AST.RenderTag['expression']} */ (expression),
750750
metadata: {
751-
expression: create_expression_metadata(),
751+
expression: new ExpressionMetadata(),
752752
dynamic: false,
753753
arguments: [],
754754
path: [],

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @import { Expression, Node, Program } from 'estree' */
1+
/** @import * as ESTree from 'estree' */
22
/** @import { Binding, AST, ValidatedCompileOptions, ValidatedModuleCompileOptions } from '#compiler' */
33
/** @import { AnalysisState, Visitors } from './types' */
44
/** @import { Analysis, ComponentAnalysis, Js, ReactiveStatement, Template } from '../types' */
@@ -206,7 +206,7 @@ const visitors = {
206206
* @returns {Js}
207207
*/
208208
function js(script, root, allow_reactive_declarations, parent) {
209-
/** @type {Program} */
209+
/** @type {ESTree.Program} */
210210
const ast = script?.content ?? {
211211
type: 'Program',
212212
sourceType: 'module',
@@ -289,7 +289,7 @@ export function analyze_module(source, options) {
289289
});
290290

291291
walk(
292-
/** @type {Node} */ (ast),
292+
/** @type {ESTree.Node} */ (ast),
293293
{
294294
scope,
295295
scopes,
@@ -347,7 +347,7 @@ export function analyze_component(root, source, options) {
347347

348348
const store_name = name.slice(1);
349349
const declaration = instance.scope.get(store_name);
350-
const init = /** @type {Node | undefined} */ (declaration?.initial);
350+
const init = /** @type {ESTree.Node | undefined} */ (declaration?.initial);
351351

352352
// If we're not in legacy mode through the compiler option, assume the user
353353
// is referencing a rune and not a global store.
@@ -407,7 +407,7 @@ export function analyze_component(root, source, options) {
407407
/** @type {number} */ (node.start) > /** @type {number} */ (module.ast.start) &&
408408
/** @type {number} */ (node.end) < /** @type {number} */ (module.ast.end) &&
409409
// const state = $state(0) is valid
410-
get_rune(/** @type {Node} */ (path.at(-1)), module.scope) === null
410+
get_rune(/** @type {ESTree.Node} */ (path.at(-1)), module.scope) === null
411411
) {
412412
e.store_invalid_subscription(node);
413413
}
@@ -636,7 +636,7 @@ export function analyze_component(root, source, options) {
636636
// @ts-expect-error
637637
_: set_scope,
638638
Identifier(node, context) {
639-
const parent = /** @type {Expression} */ (context.path.at(-1));
639+
const parent = /** @type {ESTree.Expression} */ (context.path.at(-1));
640640

641641
if (is_reference(node, parent)) {
642642
const binding = context.state.scope.get(node.name);

packages/svelte/src/compiler/phases/2-analyze/types.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Scope } from '../scope.js';
22
import type { ComponentAnalysis, ReactiveStatement } from '../types.js';
3-
import type { AST, ExpressionMetadata, StateField, ValidatedCompileOptions } from '#compiler';
3+
import type { AST, StateField, ValidatedCompileOptions } from '#compiler';
4+
import type { ExpressionMetadata } from '../nodes.js';
45

56
export interface AnalysisState {
67
scope: Scope;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { get_parent } from '../../../utils/ast.js';
77
import { is_pure, is_safe_identifier } from './shared/utils.js';
88
import { dev, locate_node, source } from '../../../state.js';
99
import * as b from '#compiler/builders';
10-
import { create_expression_metadata } from '../../nodes.js';
10+
import { ExpressionMetadata } from '../../nodes.js';
1111

1212
/**
1313
* @param {CallExpression} node
@@ -243,7 +243,7 @@ export function CallExpression(node, context) {
243243

244244
// `$inspect(foo)` or `$derived(foo) should not trigger the `static-state-reference` warning
245245
if (rune === '$derived') {
246-
const expression = create_expression_metadata();
246+
const expression = new ExpressionMetadata();
247247

248248
context.next({
249249
...context.state,

0 commit comments

Comments
 (0)