Skip to content

Commit 2c2ef11

Browse files
committed
Merge branch 'main' into class-enhancements
2 parents 9f2a257 + 999b92d commit 2c2ef11

File tree

29 files changed

+353
-26
lines changed

29 files changed

+353
-26
lines changed

.changeset/modern-colts-drive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: treeshake `$inspect.trace` code if unused in modules

.changeset/three-suits-pay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: Improve typescript DX for $inspect, $props, $bindable, and $host

.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
```

packages/svelte/CHANGELOG.md

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

3+
## 5.14.5
4+
5+
### Patch Changes
6+
7+
- fix: bump esrap dependency ([#14765](https://github.com/sveltejs/svelte/pull/14765))
8+
9+
- fix: ensure svg namespace for `<a>` elements is correct ([#14756](https://github.com/sveltejs/svelte/pull/14756))
10+
11+
- fix: treeshake `$inspect.trace` code if unused ([#14770](https://github.com/sveltejs/svelte/pull/14770))
12+
313
## 5.14.4
414

515
### Patch 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: 5 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.4",
5+
"version": "5.14.5",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {
@@ -56,6 +56,9 @@
5656
"./internal/flags/legacy": {
5757
"default": "./src/internal/flags/legacy.js"
5858
},
59+
"./internal/flags/tracing": {
60+
"default": "./src/internal/flags/tracing.js"
61+
},
5962
"./internal/server": {
6063
"default": "./src/internal/server/index.js"
6164
},
@@ -148,7 +151,7 @@
148151
"axobject-query": "^4.1.0",
149152
"clsx": "^2.1.1",
150153
"esm-env": "^1.2.1",
151-
"esrap": "^1.3.1",
154+
"esrap": "^1.3.2",
152155
"is-reference": "^3.0.3",
153156
"locate-character": "^3.0.0",
154157
"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)];

0 commit comments

Comments
 (0)