Skip to content

Commit 5a3b8f6

Browse files
github-actions[bot]svelte-docs-bot[bot]Rich-Harris
authored
Sync kit docs (#1465)
* sync kit docs * bump deps * lint --------- Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com> Co-authored-by: Rich Harris <[email protected]>
1 parent f5a7cc5 commit 5a3b8f6

File tree

9 files changed

+48
-39
lines changed

9 files changed

+48
-39
lines changed

apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,11 @@ Now simply call `addLike`, from (for example) an event handler:
504504
505505
> [!NOTE] Commands cannot be called during render.
506506
507-
### Single-flight mutations
507+
### Updating queries
508+
509+
To update `getLikes(item.id)`, or any other query, we need to tell SvelteKit _which_ queries need to be refreshed (unlike `form`, which by default invalidates everything, to approximate the behaviour of a native form submission).
508510
509-
As with forms, any queries on the page (such as `getLikes(item.id)` in the example above) will automatically be refreshed following a successful command. But we can make things more efficient by telling SvelteKit which queries will be affected by the command, either inside the command itself...
511+
We either do that inside the command itself...
510512
511513
```js
512514
/// file: likes.remote.js

apps/svelte.dev/content/docs/kit/25-build-and-deploy/40-adapter-node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ The parameter `reason` has one of the following values:
210210

211211
## Socket activation
212212

213-
Most Linux operating systems today use a modern process manager called systemd to start the server and run and manage services. You can configure your server to allocate a socket and start and scale your app on demand. This is called [socket activation](http://0pointer.de/blog/projects/socket-activated-containers.html). In this case, the OS will pass two environment variables to your app — `LISTEN_PID` and `LISTEN_FDS`. The adapter will then listen on file descriptor 3 which refers to a systemd socket unit that you will have to create.
213+
Most Linux operating systems today use a modern process manager called systemd to start the server and run and manage services. You can configure your server to allocate a socket and start and scale your app on demand. This is called [socket activation](https://0pointer.de/blog/projects/socket-activated-containers.html). In this case, the OS will pass two environment variables to your app — `LISTEN_PID` and `LISTEN_FDS`. The adapter will then listen on file descriptor 3 which refers to a systemd socket unit that you will have to create.
214214

215215
> [!NOTE] You can still use [`envPrefix`](#Options-envPrefix) with systemd socket activation. `LISTEN_PID` and `LISTEN_FDS` are always read without a prefix.
216216

apps/svelte.dev/content/docs/kit/25-build-and-deploy/50-adapter-static.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
cache: npm
140140

141141
- name: Install dependencies
142-
run: npm install
142+
run: npm i
143143

144144
- name: build
145145
env:

apps/svelte.dev/content/docs/kit/40-best-practices/07-images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Doing this manually is tedious. There are a variety of techniques you can use, d
3434
Install:
3535

3636
```sh
37-
npm install --save-dev @sveltejs/enhanced-img
37+
npm i -D @sveltejs/enhanced-img
3838
```
3939

4040
Adjust `vite.config.js`:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ See [sveltesociety.dev](https://sveltesociety.dev/) for a full listing of [packa
4242

4343
`svelte-preprocess` has some additional functionality not found in `vitePreprocess` such as support for Pug, Babel, and global styles. However, `vitePreprocess` may be faster and require less configuration, so it is used by default. Note that CoffeeScript is [not supported](https://github.com/sveltejs/kit/issues/2920#issuecomment-996469815) by SvelteKit.
4444

45-
You will need to install `svelte-preprocess` with `npm install --save-dev svelte-preprocess` and [add it to your `svelte.config.js`](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/usage.md#with-svelte-config). After that, you will often need to [install the corresponding library](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/getting-started.md) such as `npm install -D sass` or `npm install -D less`.
45+
You will need to install `svelte-preprocess` with `npm i -D svelte-preprocess` and [add it to your `svelte.config.js`](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/usage.md#with-svelte-config). After that, you will often need to [install the corresponding library](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/getting-started.md) such as `npm i -D sass` or `npm i -D less`.
4646

4747
## Vite plugins
4848

apps/svelte.dev/content/docs/kit/98-reference/[email protected]

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,13 +1600,17 @@ Information about the target of a specific navigation.
16001600
<div class="ts-block">
16011601

16021602
```dts
1603-
interface NavigationTarget {/*…*/}
1603+
interface NavigationTarget<
1604+
Params extends
1605+
AppLayoutParams<'/'> = AppLayoutParams<'/'>,
1606+
RouteId extends AppRouteId | null = AppRouteId | null
1607+
> {/*…*/}
16041608
```
16051609

16061610
<div class="ts-block-property">
16071611

16081612
```dts
1609-
params: Record<string, string> | null;
1613+
params: Params | null;
16101614
```
16111615

16121616
<div class="ts-block-property-details">
@@ -1630,7 +1634,7 @@ Info about the target route
16301634
<div class="ts-block-property-children"><div class="ts-block-property">
16311635

16321636
```dts
1633-
id: string | null;
1637+
id: RouteId | null;
16341638
```
16351639

16361640
<div class="ts-block-property-details">
@@ -1928,14 +1932,16 @@ The return value of a remote `command` function. See [Remote functions](/docs/ki
19281932
<div class="ts-block">
19291933

19301934
```dts
1931-
type RemoteCommand<Input, Output> = (arg: Input) => Promise<
1932-
Awaited<Output>
1933-
> & {
1934-
updates(
1935-
...queries: Array<
1936-
RemoteQuery<any> | RemoteQueryOverride
1937-
>
1938-
): Promise<Awaited<Output>>;
1935+
type RemoteCommand<Input, Output> = {
1936+
(arg: Input): Promise<Awaited<Output>> & {
1937+
updates(
1938+
...queries: Array<
1939+
RemoteQuery<any> | RemoteQueryOverride
1940+
>
1941+
): Promise<Awaited<Output>>;
1942+
};
1943+
/** The number of pending command executions */
1944+
get pending(): number;
19391945
};
19401946
```
19411947

@@ -1991,6 +1997,8 @@ type RemoteForm<Result> = {
19911997
): Omit<RemoteForm<Result>, 'for'>;
19921998
/** The result of the form submission */
19931999
get result(): Result | undefined;
2000+
/** The number of pending submissions */
2001+
get pending(): number;
19942002
/** Spread this onto a `<button>` or `<input type="submit">` */
19952003
buttonProps: {
19962004
type: 'submit';
@@ -2016,6 +2024,8 @@ type RemoteForm<Result> = {
20162024
formaction: string;
20172025
onclick: (event: Event) => void;
20182026
};
2027+
/** The number of pending submissions */
2028+
get pending(): number;
20192029
};
20202030
};
20212031
```
@@ -2050,7 +2060,7 @@ type RemoteQuery<T> = RemoteResource<T> & {
20502060
*/
20512061
refresh(): Promise<void>;
20522062
/**
2053-
* Temporarily override the value of a query. This is used with the `updates` method of a [command](https://svelte.dev/docs/kit/remote-functions#command-Single-flight-mutations) or [enhanced form submission](https://svelte.dev/docs/kit/remote-functions#form-enhance) to provide optimistic updates.
2063+
* Temporarily override the value of a query. This is used with the `updates` method of a [command](https://svelte.dev/docs/kit/remote-functions#command-Updating-queries) or [enhanced form submission](https://svelte.dev/docs/kit/remote-functions#form-enhance) to provide optimistic updates.
20542064
*
20552065
* ```svelte
20562066
* <script>

apps/svelte.dev/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@supabase/supabase-js": "^2.43.4",
5353
"@sveltejs/adapter-vercel": "^5.7.2",
5454
"@sveltejs/enhanced-img": "^0.4.3",
55-
"@sveltejs/kit": "https://pkg.pr.new/sveltejs/kit/@sveltejs/kit@e19e9be",
55+
"@sveltejs/kit": "^2.28.0",
5656
"@sveltejs/site-kit": "workspace:*",
5757
"@sveltejs/vite-plugin-svelte": "^6.0.0",
5858
"@types/cookie": "^0.6.0",

packages/site-kit/src/lib/docs/DocsContents.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
afterNavigate(({ from, to }) => {
1616
// TODO the fact that we're referencing route IDs from the app indicates
1717
// that this doesn't belong in site-kit, but that's a problem for another day
18+
// @ts-ignore
1819
if (from?.route.id !== '/docs/[...path]') {
1920
return;
2021
}
2122
22-
const from_package = from.params!.path.split('/')[0];
23-
const to_package = to!.params!.path.split('/')[0];
23+
const from_package = from.params!.path!.split('/')[0];
24+
const to_package = to!.params!.path!.split('/')[0];
2425
2526
if (from_package !== to_package) {
2627
nav.scrollTo(0, 0);

pnpm-lock.yaml

Lines changed: 14 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)