Skip to content

Commit a0fa599

Browse files
committed
Merge branch 'main' into teardown-props
2 parents fcb1112 + cd56c1d commit a0fa599

File tree

45 files changed

+430
-166
lines changed

Some content is hidden

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

45 files changed

+430
-166
lines changed

.changeset/fast-pants-decide.md

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

.changeset/lemon-cougars-buy.md

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

.changeset/spotty-drinks-tan.md

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

.changeset/two-dragons-camp.md

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

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ Attribute values containing `{...}` must be enclosed in quote marks, unless the
8484
`bind:group` can only bind to an Identifier or MemberExpression
8585
```
8686

87+
### bind_group_invalid_snippet_parameter
88+
89+
```
90+
Cannot `bind:group` to a snippet parameter
91+
```
92+
8793
### bind_invalid_expression
8894

8995
```

packages/svelte/CHANGELOG.md

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

3+
## 5.22.1
4+
5+
### Patch Changes
6+
7+
- chore: switch acorn-typescript plugin ([#15393](https://github.com/sveltejs/svelte/pull/15393))
8+
9+
## 5.22.0
10+
11+
### Minor Changes
12+
13+
- feat: Add `idPrefix` option to `render` ([#15428](https://github.com/sveltejs/svelte/pull/15428))
14+
15+
### Patch Changes
16+
17+
- fix: make dialog element and role interactive ([#15429](https://github.com/sveltejs/svelte/pull/15429))
18+
19+
## 5.21.0
20+
21+
### Minor Changes
22+
23+
- chore: Reduce hydration comment for {:else if} ([#15250](https://github.com/sveltejs/svelte/pull/15250))
24+
25+
### Patch Changes
26+
27+
- fix: disallow `bind:group` to snippet parameters ([#15401](https://github.com/sveltejs/svelte/pull/15401))
28+
29+
## 5.20.5
30+
31+
### Patch Changes
32+
33+
- fix: allow double hyphen css selector names ([#15384](https://github.com/sveltejs/svelte/pull/15384))
34+
35+
- fix: class:directive not working with $restProps #15386 ([#15389](https://github.com/sveltejs/svelte/pull/15389))
36+
fix: spread add an useless cssHash on non-scoped element
37+
38+
- fix: catch error on @const tag in svelte:boundary in DEV mode ([#15369](https://github.com/sveltejs/svelte/pull/15369))
39+
40+
- fix: allow for duplicate `var` declarations ([#15382](https://github.com/sveltejs/svelte/pull/15382))
41+
42+
- fix : bug "$0 is not defined" on svelte:element with a function call on class ([#15396](https://github.com/sveltejs/svelte/pull/15396))
43+
344
## 5.20.4
445

546
### Patch Changes

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

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

5555
> `bind:group` can only bind to an Identifier or MemberExpression
5656
57+
## bind_group_invalid_snippet_parameter
58+
59+
> Cannot `bind:group` to a snippet parameter
60+
5761
## bind_invalid_expression
5862

5963
> Can only bind to an Identifier or MemberExpression or a `{get, set}` pair

packages/svelte/package.json

Lines changed: 2 additions & 2 deletions
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.20.4",
5+
"version": "5.22.1",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {
@@ -150,7 +150,7 @@
150150
"@jridgewell/sourcemap-codec": "^1.5.0",
151151
"@types/estree": "^1.0.5",
152152
"acorn": "^8.12.1",
153-
"acorn-typescript": "^1.4.13",
153+
"@sveltejs/acorn-typescript": "^1.0.5",
154154
"aria-query": "^5.3.1",
155155
"axobject-query": "^4.1.0",
156156
"clsx": "^2.1.1",

packages/svelte/src/compiler/errors.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,15 @@ export function bind_group_invalid_expression(node) {
752752
e(node, 'bind_group_invalid_expression', `\`bind:group\` can only bind to an Identifier or MemberExpression\nhttps://svelte.dev/e/bind_group_invalid_expression`);
753753
}
754754

755+
/**
756+
* Cannot `bind:group` to a snippet parameter
757+
* @param {null | number | NodeLike} node
758+
* @returns {never}
759+
*/
760+
export function bind_group_invalid_snippet_parameter(node) {
761+
e(node, 'bind_group_invalid_snippet_parameter', `Cannot \`bind:group\` to a snippet parameter\nhttps://svelte.dev/e/bind_group_invalid_snippet_parameter`);
762+
}
763+
755764
/**
756765
* Can only bind to an Identifier or MemberExpression or a `{get, set}` pair
757766
* @param {null | number | NodeLike} node

packages/svelte/src/compiler/phases/1-parse/acorn.js

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
/** @import { Comment, Program } from 'estree' */
2-
/** @import { Node } from 'acorn' */
32
import * as acorn from 'acorn';
43
import { walk } from 'zimmerframe';
5-
import { tsPlugin } from 'acorn-typescript';
6-
import { locator } from '../../state.js';
4+
import { tsPlugin } from '@sveltejs/acorn-typescript';
75

8-
const ParserWithTS = acorn.Parser.extend(tsPlugin({ allowSatisfies: true }));
6+
const ParserWithTS = acorn.Parser.extend(tsPlugin());
97

108
/**
119
* @param {string} source
@@ -48,7 +46,6 @@ export function parse(source, typescript, is_script) {
4846
}
4947
}
5048

51-
if (typescript) amend(source, ast);
5249
add_comments(ast);
5350

5451
return /** @type {Program} */ (ast);
@@ -71,7 +68,6 @@ export function parse_expression_at(source, typescript, index) {
7168
locations: true
7269
});
7370

74-
if (typescript) amend(source, ast);
7571
add_comments(ast);
7672

7773
return ast;
@@ -173,42 +169,3 @@ function get_comment_handlers(source) {
173169
}
174170
};
175171
}
176-
177-
/**
178-
* Tidy up some stuff left behind by acorn-typescript
179-
* @param {string} source
180-
* @param {Node} node
181-
*/
182-
function amend(source, node) {
183-
return walk(node, null, {
184-
_(node, context) {
185-
// @ts-expect-error
186-
delete node.loc.start.index;
187-
// @ts-expect-error
188-
delete node.loc.end.index;
189-
190-
if (typeof node.loc?.end === 'number') {
191-
const loc = locator(node.loc.end);
192-
if (loc) {
193-
node.loc.end = {
194-
line: loc.line,
195-
column: loc.column
196-
};
197-
}
198-
}
199-
200-
if (
201-
/** @type {any} */ (node).typeAnnotation &&
202-
(node.end === undefined || node.end < node.start)
203-
) {
204-
// i think there might be a bug in acorn-typescript that prevents
205-
// `end` from being assigned when there's a type annotation
206-
let end = /** @type {any} */ (node).typeAnnotation.start;
207-
while (/\s/.test(source[end - 1])) end -= 1;
208-
node.end = end;
209-
}
210-
211-
context.next();
212-
}
213-
});
214-
}

0 commit comments

Comments
 (0)