Skip to content

Commit 1b686b8

Browse files
Sync kit docs (#828)
sync kit docs Co-authored-by: Rich-Harris <[email protected]>
1 parent e80d79d commit 1b686b8

File tree

11 files changed

+15
-17
lines changed

11 files changed

+15
-17
lines changed

apps/svelte.dev/content/docs/kit/20-core-concepts/10-routing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ By exporting `POST`/`PUT`/`PATCH`/`DELETE`/`OPTIONS`/`HEAD` handlers, `+server.j
330330
<input type="number" bind:value={b}> =
331331
{total}
332332

333-
<button on:click={add}>Calculate</button>
333+
<button onclick={add}>Calculate</button>
334334
```
335335
336336
```js

apps/svelte.dev/content/docs/kit/20-core-concepts/20-load.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ export async function load({ fetch, depends }) {
661661
</script>
662662
663663
<p>random number: {data.number}</p>
664-
<button on:click={rerunLoadFunction}>Update random number</button>
664+
<button onclick={rerunLoadFunction}>Update random number</button>
665665
```
666666

667667
### When do load functions rerun?

apps/svelte.dev/content/docs/kit/20-core-concepts/30-form-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ We can also implement progressive enhancement ourselves, without `use:enhance`,
451451
}
452452
</script>
453453

454-
<form method="POST" on:submit|preventDefault={handleSubmit}>
454+
<form method="POST" onsubmit|preventDefault={handleSubmit}>
455455
<!-- content -->
456456
</form>
457457
```
@@ -484,7 +484,7 @@ Form actions are the preferred way to send data to the server, since they can be
484484
}
485485
</script>
486486

487-
<button on:click={rerun}>Rerun CI</button>
487+
<button onclick={rerun}>Rerun CI</button>
488488
```
489489
490490
```js

apps/svelte.dev/content/docs/kit/25-build-and-deploy/60-adapter-cloudflare.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function POST({ request, platform }) {
8484
8585
To include type declarations for your bindings, reference them in your `src/app.d.ts`:
8686

87-
```dts
87+
```ts
8888
/// file: src/app.d.ts
8989
declare global {
9090
namespace App {

apps/svelte.dev/content/docs/kit/25-build-and-deploy/70-adapter-cloudflare-workers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export async function POST({ request, platform }) {
105105
106106
To include type declarations for your bindings, reference them in your `src/app.d.ts`:
107107

108-
```dts
108+
```ts
109109
/// file: src/app.d.ts
110110
declare global {
111111
namespace App {

apps/svelte.dev/content/docs/kit/25-build-and-deploy/90-adapter-vercel.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ export const config = {
4444
/// file: admin/+layout.js
4545
/** @type {import('@sveltejs/adapter-vercel').Config} */
4646
export const config = {
47-
runtime: 'nodejs18.x'
47+
runtime: 'nodejs22.x'
4848
};
4949
```
5050

5151
The following options apply to all functions:
5252

53-
- `runtime`: `'edge'`, `'nodejs18.x'` or `'nodejs20.x'`. By default, the adapter will select the `'nodejs<version>.x'` corresponding to the Node version your project is configured to use on the Vercel dashboard
53+
- `runtime`: `'edge'`, `'nodejs18.x'`, `'nodejs20.x'` or `'nodejs22.x'`. By default, the adapter will select the `'nodejs<version>.x'` corresponding to the Node version your project is configured to use on the Vercel dashboard
5454
- `regions`: an array of [edge network regions](https://vercel.com/docs/concepts/edge-network/regions) (defaulting to `["iad1"]` for serverless functions) or `'all'` if `runtime` is `edge` (its default). Note that multiple regions for serverless functions are only supported on Enterprise plans
5555
- `split`: if `true`, causes a route to be deployed as an individual function. If `split` is set to `true` at the adapter level, all routes will be deployed as individual functions
5656

apps/svelte.dev/content/docs/kit/30-advanced/25-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ The exception is when the error occurs inside the root `+layout.js` or `+layout.
126126

127127
If you're using TypeScript and need to customize the shape of errors, you can do so by declaring an `App.Error` interface in your app (by convention, in `src/app.d.ts`, though it can live anywhere that TypeScript can 'see'):
128128

129-
```dts
129+
```ts
130130
/// file: src/app.d.ts
131131
declare global {
132132
namespace App {

apps/svelte.dev/content/docs/kit/30-advanced/67-shallow-routing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ For this to work, you need to load the data that the `+page.svelte` expects. A c
5757
{#each data.thumbnails as thumbnail}
5858
<a
5959
href="/photos/{thumbnail.id}"
60-
on:click={async (e) => {
60+
onclick={async (e) => {
6161
if (innerWidth < 640 // bail if the screen is too small
6262
|| e.shiftKey // or the link is opened in a new window
6363
|| e.metaKey || e.ctrlKey // or a new tab (mac: metaKey, win/linux: ctrlKey)
@@ -86,7 +86,7 @@ For this to work, you need to load the data that the `+page.svelte` expects. A c
8686
{/each}
8787
8888
{#if $page.state.selected}
89-
<Modal on:close={() => history.back()}>
89+
<Modal onclose={() => history.back()}>
9090
<!-- pass page data to the +page.svelte component,
9191
just like SvelteKit would on navigation -->
9292
<PhotoPage data={$page.state.selected} />

apps/svelte.dev/content/docs/kit/60-appendix/10-faq.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ In order to support SSR, a JS backend — such as Node.js or Deno-based server,
2727

2828
It is also possible to write custom adapters or leverage community adapters to deploy SvelteKit to more platforms such as specialized server environments, browser extensions, or native applications. See [integrations](./integrations) for more examples and integrations.
2929

30-
## How do I use HMR with SvelteKit?
31-
32-
SvelteKit has HMR enabled by default powered by [svelte-hmr](https://github.com/sveltejs/svelte-hmr). If you saw [Rich's presentation at the 2020 Svelte Summit](/blog/whats-the-deal-with-sveltekit), you may have seen a more powerful-looking version of HMR presented. This demo had `svelte-hmr`'s `preserveLocalState` flag on. This flag is now off by default because it may lead to unexpected behaviour and edge cases. But don't worry, you are still getting HMR with SvelteKit! If you'd like to preserve local state you can use the `@hmr:keep` or `@hmr:keep-all` directives as documented on the [svelte-hmr](https://github.com/sveltejs/svelte-hmr) page.
33-
3430
## How do I include details from package.json in my application?
3531

3632
You cannot directly require JSON files, since SvelteKit expects [`svelte.config.js`](./configuration) to be an ES module. If you'd like to include your application's version number or other information from `package.json` in your application, you can load JSON like so:

apps/svelte.dev/content/docs/kit/60-appendix/20-integrations.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Integrations
44

55
## `vitePreprocess`
66

7-
Including [`vitePreprocess`](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md) in your project will allow you to use the various flavors of JS and CSS that Vite supports: TypeScript, PostCSS, SCSS, Less, Stylus, and SugarSS. If you set your project up with TypeScript it will be included by default:
7+
Including [`vitePreprocess`](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md) in your project will allow you to use the various flavors of CSS that Vite supports: PostCSS, SCSS, Less, Stylus, and SugarSS. If you set your project up with TypeScript it will be included by default:
88

99
```js
1010
// svelte.config.js
@@ -15,6 +15,8 @@ export default {
1515
};
1616
```
1717

18+
You will also need to use a preprocessor if you're using TypeScript with Svelte 4. TypeScript is supported natively in Svelte 5 if you're using only the type syntax. To use more complex TypeScript syntax in Svelte 5, you will need still need a preprocessor and can use `vitePreprocess({ script: true })`.
19+
1820
## Adders
1921

2022
Run `npx sv add` to setup many different complex integrations with a single command including:

apps/svelte.dev/content/docs/kit/98-reference/54-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To solve this problem, SvelteKit generates `.d.ts` files for each of your endpoi
2525

2626
```ts
2727
/// file: .svelte-kit/types/src/routes/[foo]/[bar]/[baz]/$types.d.ts
28-
/// link: false
28+
/// link: true
2929
import type * as Kit from '@sveltejs/kit';
3030

3131
type RouteParams = {

0 commit comments

Comments
 (0)