Skip to content

Commit 2a45896

Browse files
committed
Merge remote-tracking branch 'upstream/main' into structuredclone-patch
2 parents 865ac6d + 1d773ef commit 2a45896

File tree

48 files changed

+1397
-164
lines changed

Some content is hidden

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

48 files changed

+1397
-164
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: pnpm lint
6060
- name: build and check generated types
6161
if: (${{ success() }} || ${{ failure() }}) # ensures this step runs even if previous steps fail
62-
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }
62+
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally with `cd packages/svelte && pnpm generate:types` and commit the changes after you have reviewed them"; git diff; exit 1); }
6363
Benchmarks:
6464
runs-on: ubuntu-latest
6565
timeout-minutes: 15

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: pnpm install --frozen-lockfile
3434

3535
- name: Build
36-
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }
36+
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally with `cd packages/svelte && pnpm generate:types` and commit the changes after you have reviewed them"; git diff; exit 1); }
3737

3838
- name: Create Release Pull Request or Publish to npm
3939
id: changesets

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,32 @@ In some situations a selector may target an element that is not 'visible' to the
630630
Self-closing HTML tags for non-void elements are ambiguous — use `<%name% ...></%name%>` rather than `<%name% ... />`
631631
```
632632

633+
In HTML, there's [no such thing as a self-closing tag](https://jakearchibald.com/2023/against-self-closing-tags-in-html/). While this _looks_ like a self-contained element with some text next to it...
634+
635+
```html
636+
<div>
637+
<span class="icon" /> some text!
638+
</div>
639+
```
640+
641+
...a spec-compliant HTML parser (such as a browser) will in fact parse it like this, with the text _inside_ the icon:
642+
643+
```html
644+
<div>
645+
<span class="icon"> some text! </span>
646+
</div>
647+
```
648+
649+
Some templating languages (including Svelte) will 'fix' HTML by turning `<span />` into `<span></span>`. Others adhere to the spec. Both result in ambiguity and confusion when copy-pasting code between different contexts, and as such Svelte prompts you to resolve the ambiguity directly by having an explicit closing tag.
650+
651+
To automate this, run the dedicated migration:
652+
653+
```bash
654+
npx sv migrate self-closing-tags
655+
```
656+
657+
In a future version of Svelte, self-closing tags may be upgraded from a warning to an error.
658+
633659
### event_directive_deprecated
634660

635661
```

documentation/docs/99-legacy/30-legacy-svelte-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: <svelte:component>
33
---
44

5-
In runes mode, `<MyComponent>` will re-render if the value of `MyComponent` changes.
5+
In runes mode, `<MyComponent>` will re-render if the value of `MyComponent` changes. See the [Svelte 5 migration guide](/docs/svelte/v5-migration-guide#Breaking-changes-in-runes-mode-svelte:component-is-no-longer-necessary) for an example.
66

77
In legacy mode, it won't — we must use `<svelte:component>`, which destroys and recreates the component instance when the value of its `this` expression changes:
88

packages/svelte/CHANGELOG.md

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

3+
## 5.15.0
4+
5+
### Minor Changes
6+
7+
- feat: add "worker" exports condition to better support bundling for worker-based environments ([#14779](https://github.com/sveltejs/svelte/pull/14779))
8+
9+
## 5.14.6
10+
11+
### Patch Changes
12+
13+
- fix: treeshake `$inspect.trace` code if unused in modules ([#14774](https://github.com/sveltejs/svelte/pull/14774))
14+
15+
- fix: Improve typescript DX for $inspect, $props, $bindable, and $host ([#14777](https://github.com/sveltejs/svelte/pull/14777))
16+
17+
## 5.14.5
18+
19+
### Patch Changes
20+
21+
- fix: bump esrap dependency ([#14765](https://github.com/sveltejs/svelte/pull/14765))
22+
23+
- fix: ensure svg namespace for `<a>` elements is correct ([#14756](https://github.com/sveltejs/svelte/pull/14756))
24+
25+
- fix: treeshake `$inspect.trace` code if unused ([#14770](https://github.com/sveltejs/svelte/pull/14770))
26+
27+
## 5.14.4
28+
29+
### Patch Changes
30+
31+
- fix: remove implements from class declarations ([#14749](https://github.com/sveltejs/svelte/pull/14749))
32+
33+
- fix: remove unwanted properties from both replaced and unreplaced nodes ([#14744](https://github.com/sveltejs/svelte/pull/14744))
34+
35+
## 5.14.3
36+
37+
### Patch Changes
38+
39+
- fix: bump esrap, prevent malformed AST ([#14742](https://github.com/sveltejs/svelte/pull/14742))
40+
41+
- fix: compare array contents for equality mismatch detections, not the arrays themselves ([#14738](https://github.com/sveltejs/svelte/pull/14738))
42+
43+
## 5.14.2
44+
45+
### Patch Changes
46+
47+
- fix: correctly highlight first rerun of `$inspect.trace` ([#14734](https://github.com/sveltejs/svelte/pull/14734))
48+
49+
- chore: more loose parser improvements ([#14733](https://github.com/sveltejs/svelte/pull/14733))
50+
51+
## 5.14.1
52+
53+
### Patch Changes
54+
55+
- fix: improve unowned derived performance ([#14724](https://github.com/sveltejs/svelte/pull/14724))
56+
357
## 5.14.0
458

559
### Minor Changes

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,32 @@
3434

3535
> Self-closing HTML tags for non-void elements are ambiguous — use `<%name% ...></%name%>` rather than `<%name% ... />`
3636
37+
In HTML, there's [no such thing as a self-closing tag](https://jakearchibald.com/2023/against-self-closing-tags-in-html/). While this _looks_ like a self-contained element with some text next to it...
38+
39+
```html
40+
<div>
41+
<span class="icon" /> some text!
42+
</div>
43+
```
44+
45+
...a spec-compliant HTML parser (such as a browser) will in fact parse it like this, with the text _inside_ the icon:
46+
47+
```html
48+
<div>
49+
<span class="icon"> some text! </span>
50+
</div>
51+
```
52+
53+
Some templating languages (including Svelte) will 'fix' HTML by turning `<span />` into `<span></span>`. Others adhere to the spec. Both result in ambiguity and confusion when copy-pasting code between different contexts, and as such Svelte prompts you to resolve the ambiguity directly by having an explicit closing tag.
54+
55+
To automate this, run the dedicated migration:
56+
57+
```bash
58+
npx sv migrate self-closing-tags
59+
```
60+
61+
In a future version of Svelte, self-closing tags may be upgraded from a warning to an error.
62+
3763
## event_directive_deprecated
3864

3965
> Using `on:%name%` to listen to the %name% event is deprecated. Use the event attribute `on%name%` instead

packages/svelte/package.json

Lines changed: 9 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.14.0",
5+
"version": "5.15.0",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {
@@ -21,6 +21,7 @@
2121
"exports": {
2222
".": {
2323
"types": "./types/index.d.ts",
24+
"worker": "./src/index-server.js",
2425
"browser": "./src/index-client.js",
2526
"default": "./src/index-server.js"
2627
},
@@ -56,11 +57,15 @@
5657
"./internal/flags/legacy": {
5758
"default": "./src/internal/flags/legacy.js"
5859
},
60+
"./internal/flags/tracing": {
61+
"default": "./src/internal/flags/tracing.js"
62+
},
5963
"./internal/server": {
6064
"default": "./src/internal/server/index.js"
6165
},
6266
"./legacy": {
6367
"types": "./types/index.d.ts",
68+
"worker": "./src/legacy/legacy-server.js",
6469
"browser": "./src/legacy/legacy-client.js",
6570
"default": "./src/legacy/legacy-server.js"
6671
},
@@ -70,6 +75,7 @@
7075
},
7176
"./reactivity": {
7277
"types": "./types/index.d.ts",
78+
"worker": "./src/reactivity/index-server.js",
7379
"browser": "./src/reactivity/index-client.js",
7480
"default": "./src/reactivity/index-server.js"
7581
},
@@ -83,6 +89,7 @@
8389
},
8490
"./store": {
8591
"types": "./types/index.d.ts",
92+
"worker": "./src/store/index-server.js",
8693
"browser": "./src/store/index-client.js",
8794
"default": "./src/store/index-server.js"
8895
},
@@ -147,7 +154,7 @@
147154
"aria-query": "^5.3.1",
148155
"axobject-query": "^4.1.0",
149156
"esm-env": "^1.2.1",
150-
"esrap": "^1.2.3",
157+
"esrap": "^1.3.2",
151158
"is-reference": "^3.0.3",
152159
"locate-character": "^3.0.0",
153160
"magic-string": "^0.30.11",

packages/svelte/scripts/check-treeshakeability.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ for (const key in pkg.exports) {
5858
if (key === './internal') continue;
5959
if (key === './internal/disclose-version') continue;
6060
if (key === './internal/flags/legacy') continue;
61+
if (key === './internal/flags/tracing') continue;
6162

6263
for (const type of ['browser', 'default']) {
6364
if (!pkg.exports[key][type]) continue;
@@ -91,6 +92,7 @@ const bundle = await bundle_code(
9192
</script>
9293
9394
<svelte:head><title>hi</title></svelte:head>
95+
<input bind:value={foo} />
9496
9597
<a href={foo} class={foo}>a</a>
9698
<a {...foo}>a</a>
@@ -134,6 +136,15 @@ if (!bundle.includes('component_context.l')) {
134136
console.error(`❌ Legacy code not treeshakeable`);
135137
}
136138

139+
if (!bundle.includes(`'CreatedAt'`)) {
140+
// eslint-disable-next-line no-console
141+
console.error(`✅ $inspect.trace code treeshakeable`);
142+
} else {
143+
failed = true;
144+
// eslint-disable-next-line no-console
145+
console.error(`❌ $inspect.trace code not treeshakeable`);
146+
}
147+
137148
if (failed) {
138149
// eslint-disable-next-line no-console
139150
console.error(bundle);

packages/svelte/scripts/generate-types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ await createBundle({
4646
}
4747
});
4848

49+
fs.appendFileSync(`${dir}/types/index.d.ts`, '\n');
50+
4951
const types = fs.readFileSync(`${dir}/types/index.d.ts`, 'utf-8');
5052

5153
const bad_links = [...types.matchAll(/\]\((\/[^)]+)\)/g)];

packages/svelte/scripts/process-messages/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ function transform(name, dest) {
389389
ast.body.push(clone);
390390
}
391391

392-
// @ts-expect-error
393392
const module = esrap.print(ast);
394393

395394
fs.writeFileSync(

0 commit comments

Comments
 (0)