Skip to content

Commit 7a8fa4d

Browse files
Sync kit docs (#1116)
sync kit docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
1 parent e7c091a commit 7a8fa4d

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ If your functions need to access data in a specific region, it's recommended tha
7070
You may set the `images` config to control how Vercel builds your images. See the [image configuration reference](https://vercel.com/docs/build-output-api/v3/configuration#images) for full details. As an example, you may set:
7171

7272
```js
73-
// @errors: 2300 2842 7031 1181 1005 1136 1128
7473
/// file: svelte.config.js
7574
import adapter from '@sveltejs/adapter-vercel';
7675

7776
export default {
7877
kit: {
79-
adapter({
78+
adapter: adapter({
8079
images: {
8180
sizes: [640, 828, 1200, 1920, 3840],
8281
formats: ['image/avif', 'image/webp'],
@@ -125,16 +124,16 @@ Making a `GET` or `HEAD` request with `x-prerender-revalidate: <token>` will for
125124

126125
Note that the `BYPASS_TOKEN` string must be at least 32 characters long. You could generate one using the JavaScript console like so:
127126

128-
```console
129-
btoa(Math.random().toString()).substring(0,32);
127+
```js
128+
crypto.randomUUID();
130129
```
131130

132131
Set this string as an environment variable on Vercel by logging in and going to your project then Settings > Environment Variables. For "Key" put `BYPASS_TOKEN` and for "value" use the string generated above, then hit "Save".
133132

134133
To get this key known about for local development, you can use the [Vercel CLI](https://vercel.com/docs/cli/env) by running the `vercel env pull` command locally like so:
135134

136-
```console
137-
$ vercel env pull .env.development.local
135+
```sh
136+
vercel env pull .env.development.local
138137
```
139138

140139
### allowQuery

apps/svelte.dev/content/docs/kit/30-advanced/20-hooks.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ export async function handle({ event, resolve }) {
6868
event.locals.user = await getUserInformation(event.cookies.get('sessionid'));
6969

7070
const response = await resolve(event);
71+
72+
// Note that modifying response headers isn't always safe.
73+
// Response objects can have immutable headers
74+
// (e.g. Response.redirect() returned from an endpoint).
75+
// Modifying immutable headers throws a TypeError.
76+
// In that case, clone the response or avoid creating a
77+
// response object with immutable headers.
7178
response.headers.set('x-custom-header', 'potato');
7279

7380
return response;

apps/svelte.dev/content/docs/kit/30-advanced/70-packaging.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,23 @@ You should think carefully about whether or not the changes you make to your pac
219219
}
220220
```
221221

222+
## Source maps
223+
224+
You can create so-called declaration maps (`d.ts.map` files) by setting `"declarationMap": true` in your `tsconfig.json`. This will allow editors such as VS Code to go to the original `.ts` or `.svelte` file when using features like _Go to Definition_. This means you also need to publish your source files alongside your dist folder in a way that the relative path inside the declaration files leads to a file on disk. Assuming that you have all your library code inside `src/lib` as suggested by Svelte's CLI, this is as simple as adding `src/lib` to `files` in your `package.json`:
225+
226+
```json
227+
{
228+
"files": [
229+
"dist",
230+
"!dist/**/*.test.*",
231+
"!dist/**/*.spec.*",
232+
+++"src/lib",
233+
"!src/lib/**/*.test.*",
234+
"!src/lib/**/*.spec.*"+++
235+
]
236+
}
237+
```
238+
222239
## Options
223240

224241
`svelte-package` accepts the following options:

apps/svelte.dev/content/docs/kit/40-best-practices/03-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ Auth [cookies](@sveltejs-kit#Cookies) can be checked inside [server hooks](hooks
1919

2020
## Guides
2121

22-
[Lucia](https://lucia-auth.com/) is a reference for session-based web app auth. It contains example code snippets and projects for implementing session-based auth within SvelteKit and other JS projects. You can add code which follows the Lucia guide to your project with `npx sv create` when creating a new project or `npx sv add lucia` for an existing project.
22+
[Lucia](https://lucia-auth.com/) is a good reference for session-based web app auth. It contains example code snippets and projects for implementing session-based auth within SvelteKit and other JS projects. You can add code which follows the Lucia guide to your project with `npx sv create` when creating a new project or `npx sv add lucia` for an existing project.
2323

2424
An auth system is tightly coupled to a web framework because most of the code lies in validating user input, handling errors, and directing users to the appropriate next page. As a result, many of the generic JS auth libraries include one or more web frameworks within them. For this reason, many users will find it preferrable to follow a SvelteKit-specific guide such as the examples found in [Lucia](https://lucia-auth.com/) rather than having multiple web frameworks inside their project.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,6 +2351,14 @@ routes: SSRRoute[];
23512351
</div>
23522352
<div class="ts-block-property">
23532353

2354+
```dts
2355+
prerendered_routes: Set<string>;
2356+
```
2357+
2358+
<div class="ts-block-property-details"></div>
2359+
</div>
2360+
<div class="ts-block-property">
2361+
23542362
```dts
23552363
matchers: () => Promise<Record<string, ParamMatcher>>;
23562364
```

0 commit comments

Comments
 (0)