Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/svelte.dev/content/tutorial/+assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"preview": "./node_modules/vite/bin/vite.js preview"
},
"devDependencies": {
"@rollup/wasm-node": "^4.18.0",
"@sveltejs/kit": "^2",
"@rollup/wasm-node": "^4.25.0",
"@sveltejs/kit": "^2.5",
"esbuild-wasm": "^0.21.5",
"svelte": "^5.0.0-next.160",
"vite": "^5"
"svelte": "^5.0.0-next.243",
"vite": "^5.4"
},
"type": "module"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script context="module">
<script module>
let current;
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ In all the examples we've seen so far, the `<script>` block contains code that r

Very occasionally, you'll need to run some code outside of an individual component instance. For example: returning to our custom audio player from a [previous exercise](media-elements), you can play all four tracks simultaneously. It would be better if playing one stopped all the others.

We can do that by declaring a `<script context="module">` block. Code contained inside it will run once, when the module first evaluates, rather than when a component is instantiated. Place this at the top of `AudioPlayer.svelte` (note that this is a _separate_ script tag):
We can do that by declaring a `<script module>` block. Code contained inside it will run once, when the module first evaluates, rather than when a component is instantiated. Place this at the top of `AudioPlayer.svelte` (note that this is a _separate_ script tag):

```svelte
/// file: AudioPlayer.svelte
+++<script context="module">
+++<script module>
let current;
</script>+++
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script context="module">
<script module>
let current;
export function stopAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Exports
---

Anything exported from a `context="module"` script block becomes an export from the module itself. Let's export a `stopAll` function:
Anything exported from a `module` script block becomes an export from the module itself. Let's export a `stopAll` function:

```svelte
/// file: AudioPlayer.svelte
<script context="module">
<script module>
let current;

+++ export function stopAll() {
Expand Down
22 changes: 11 additions & 11 deletions apps/svelte.dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@
},
"devDependencies": {
"@resvg/resvg-js": "^2.6.2",
"@sveltejs/adapter-vercel": "^5.3.1",
"@sveltejs/enhanced-img": "^0.3.0",
"@sveltejs/kit": "^2.5.15",
"@sveltejs/adapter-vercel": "^5.4.3",
"@sveltejs/enhanced-img": "^0.3.4",
"@sveltejs/kit": "^2.5.25",
"@sveltejs/site-kit": "workspace:*",
"@sveltejs/vite-plugin-svelte": "4.0.0-next.3",
"@sveltejs/vite-plugin-svelte": "4.0.0-next.6",
"@types/cookie": "^0.6.0",
"@types/node": "^20.14.2",
"@vercel/speed-insights": "^1.0.0",
"browserslist": "^4.23.1",
"degit": "^2.8.4",
"dotenv": "^16.4.5",
"esbuild": "^0.20.2",
"esbuild": "^0.21.5",
"jimp": "^1.1.1",
"lightningcss": "^1.25.1",
"magic-string": "^0.30.10",
"magic-string": "^0.30.11",
"marked": "^12.0.2",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.4",
Expand All @@ -83,12 +83,12 @@
"shelljs": "^0.8.5",
"shiki": "^1.6.4",
"shiki-twoslash": "^3.1.2",
"svelte": "5.0.0-next.160",
"svelte-check": "^3.8.2",
"svelte": "5.0.0-next.243",
"svelte-check": "^4.0.0",
"svelte-preprocess": "^5.1.4",
"tiny-glob": "^0.2.9",
"typescript": "^5.4.5",
"vite": "^5.2.13",
"vite-imagetools": "^7.0.2"
"typescript": "^5.5.4",
"vite": "^5.4.3",
"vite-imagetools": "^7.0.4"
}
}
Loading
Loading