Skip to content

Commit 10c7757

Browse files
authored
Merge branch 'main' into escape-tags-llms-txt
2 parents 87164b0 + c4be25b commit 10c7757

File tree

22 files changed

+57
-64
lines changed

22 files changed

+57
-64
lines changed

apps/svelte.dev/content/docs/cli/20-commands/20-sv-add.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can select multiple space-separated add-ons from [the list below](#Official-
2020
## Options
2121

2222
- `-C`, `--cwd` — path to the root of your Svelte(Kit) project
23-
- `--no-preconditions`skip checking preconditions <!-- TODO what does this mean? -->
23+
- `--no-git-check`even if some files are dirty, no prompt will be shown
2424
- `--install` — installs dependencies with a specified package manager
2525
- `--no-install` — prevents installing dependencies
2626

apps/svelte.dev/content/docs/kit/10-getting-started/20-creating-a-project.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ The easiest way to start building a SvelteKit app is to run `npx sv create`:
88
```sh
99
npx sv create my-app
1010
cd my-app
11-
npm install
1211
npm run dev
1312
```
1413

15-
The first command will scaffold a new project in the `my-app` directory asking you if you'd like to set up some basic tooling such as TypeScript. See [integrations](./integrations) for pointers on setting up additional tooling. The subsequent commands will then install its dependencies and start a server on [localhost:5173](http://localhost:5173).
14+
The first command will scaffold a new project in the `my-app` directory asking if you'd like to set up some basic tooling such as TypeScript. See [the CLI docs](/docs/cli/overview) for information about these options and [the integrations page](./integrations) for pointers on setting up additional tooling. `npm run dev` will then start the development server on [localhost:5173](http://localhost:5173) - make sure you install dependencies before running this if you didn't do so during project creation.
1615

1716
There are two basic concepts:
1817

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
@@ -189,7 +189,7 @@ Conceptually, they're the same thing, but there are some important differences t
189189

190190
Server `load` functions _always_ run on the server.
191191

192-
By default, universal `load` functions run on the server during SSR when the user first visits your page. They will then run again during hydration, reusing any responses from [fetch requests](#Making-fetch-requests). All subsequent invocations of universal `load` functions happen in the browser. You can customize the behavior through [page options](page-options). If you disable [server side rendering](page-options#ssr), you'll get an SPA and universal `load` functions _always_ run on the client.
192+
By default, universal `load` functions run on the server during SSR when the user first visits your page. They will then run again during hydration, reusing any responses from [fetch requests](#Making-fetch-requests). All subsequent invocations of universal `load` functions happen in the browser. You can customize the behavior through [page options](page-options). If you disable [server-side rendering](page-options#ssr), you'll get an SPA and universal `load` functions _always_ run on the client.
193193

194194
If a route contains both universal and server `load` functions, the server `load` runs first.
195195

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Remote functions
77
<p>Available since 2.27</p>
88
</blockquote>
99

10-
Remote functions are a tool for type-safe communication between client and server. They can be _called_ anywhere in your app, but always _run_ on the server, and as such can safely access [server-only modules](server-only-modules) containing things like environment variables and database clients.
10+
Remote functions are a tool for type-safe communication between client and server. They can be _called_ anywhere in your app, but always _run_ on the server, meaning they can safely access [server-only modules](server-only-modules) containing things like environment variables and database clients.
1111

1212
Combined with Svelte's experimental support for [`await`](/docs/svelte/await-expressions), it allows you to load and manipulate data directly inside your components.
1313

@@ -26,7 +26,7 @@ export default {
2626

2727
## Overview
2828

29-
Remote functions are exported from a `.remote.js` or `.remote.ts` file, and come in four flavours: `query`, `form`, `command` and `prerender`. On the client, the exported functions are transformed to `fetch` wrappers that invoke their counterparts on the server via a generated HTTP endpoint.
29+
Remote functions are exported from a `.remote.js` or `.remote.ts` file, and come in four flavours: `query`, `form`, `command` and `prerender`. On the client, the exported functions are transformed to `fetch` wrappers that invoke their counterparts on the server via a generated HTTP endpoint. Remote files must be placed in the `lib` or `routes` directory.
3030

3131
## query
3232

@@ -114,7 +114,7 @@ Query functions can accept an argument, such as the `slug` of an individual post
114114

115115
let { params } = $props();
116116

117-
const post = getPost(params.slug);
117+
const post = $derived(await getPost(params.slug));
118118
</script>
119119

120120
<h1>{post.title}</h1>
@@ -161,7 +161,7 @@ Any query can be updated via its `refresh` method:
161161
</button>
162162
```
163163
164-
> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() === getPosts()`. As such, you don't need a reference like `const posts = getPosts()` in order to refresh the query.
164+
> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() === getPosts()`. This means you don't need a reference like `const posts = getPosts()` in order to refresh the query.
165165
166166
## form
167167
@@ -271,7 +271,7 @@ export const createPost = form(async (data) => {
271271

272272
// Refresh `getPosts()` on the server, and send
273273
// the data back with the result of `createPost`
274-
+++getPosts().refresh();+++
274+
+++await getPosts().refresh();+++
275275

276276
// Redirect to the newly created page
277277
redirect(303, `/blog/${slug}`);
@@ -657,7 +657,7 @@ export const getPost = prerender(
657657
);
658658
```
659659
660-
> [!NOTE] Svelte does not yet support asynchronous server-side rendering, and as such it's likely that you're only calling remote functions from the browser, rather than during prerendering. Because of this you will need to use `inputs`, for now. We're actively working on this roadblock.
660+
> [!NOTE] Svelte does not yet support asynchronous server-side rendering, so it's likely that you're only calling remote functions from the browser, rather than during prerendering. Because of this, you will need to use `inputs`, for now. We're actively working on this roadblock.
661661
662662
By default, prerender functions are excluded from your server bundle, which means that you cannot call them with any arguments that were _not_ prerendered. You can set `dynamic: true` to change this behaviour:
663663

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ When deploying your application, the server generated by SvelteKit is bundled in
185185

186186
### Accessing the file system
187187

188-
You can't use `fs` in Cloudflare Workers — you must [prerender](page-options#prerender) the routes in question.
188+
You can't use `fs` in Cloudflare Workers.
189+
190+
Instead, use the [`read`]($app-server#read) function from `$app/server` to access your files. It works by fetching the file from the deployed public assets location.
191+
192+
Alternatively, you can [prerender](page-options#prerender) the routes in question.
189193

190194
## Migrating from Workers Sites
191195

apps/svelte.dev/content/docs/kit/25-build-and-deploy/80-adapter-netlify.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ Additionally, you can add your own Netlify functions by creating a directory for
118118

119119
You can't use `fs` in edge deployments.
120120

121-
You _can_ use it in serverless deployments, but it won't work as expected, since files are not copied from your project into your deployment. Instead, use the [`read`]($app-server#read) function from `$app/server` to access your files. `read` does not work inside edge deployments (this may change in future).
121+
You _can_ use it in serverless deployments, but it won't work as expected, since files are not copied from your project into your deployment. Instead, use the [`read`]($app-server#read) function from `$app/server` to access your files. It also works inside edge deployments by fetching the file from the deployed public assets location.
122122

123123
Alternatively, you can [prerender](page-options#prerender) the routes in question.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ Projects created before a certain date may default to using an older Node versio
195195

196196
You can't use `fs` in edge functions.
197197

198-
You _can_ use it in serverless functions, but it won't work as expected, since files are not copied from your project into your deployment. Instead, use the [`read`]($app-server#read) function from `$app/server` to access your files. `read` does not work inside routes deployed as edge functions (this may change in future).
198+
You _can_ use it in serverless functions, but it won't work as expected, since files are not copied from your project into your deployment. Instead, use the [`read`]($app-server#read) function from `$app/server` to access your files. It also works inside routes deployed as edge functions by fetching the file from the deployed public assets location.
199199

200200
Alternatively, you can [prerender](page-options#prerender) the routes in question.

apps/svelte.dev/content/docs/kit/30-advanced/40-service-workers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ navigator.serviceWorker.register('/service-worker.js', {
127127

128128
Setting up proper types for service workers requires some manual setup. Inside your `service-worker.js`, add the following to the top of your file:
129129

130-
```original-js
130+
```js
131131
/// <reference types="@sveltejs/kit" />
132132
/// <reference no-default-lib="true"/>
133133
/// <reference lib="esnext" />
134134
/// <reference lib="webworker" />
135135

136136
const sw = /** @type {ServiceWorkerGlobalScope} */ (/** @type {unknown} */ (self));
137137
```
138-
```generated-ts
138+
```ts
139139
/// <reference types="@sveltejs/kit" />
140140
/// <reference no-default-lib="true"/>
141141
/// <reference lib="esnext" />

apps/svelte.dev/content/docs/kit/60-appendix/30-migrating-to-sveltekit-2.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ This inconsistency is fixed in version 2. Paths are either always relative or al
9191

9292
## Server fetches are not trackable anymore
9393

94-
Previously it was possible to track URLs from `fetch`es on the server in order to rerun load functions. This poses a possible security risk (private URLs leaking), and as such it was behind the `dangerZone.trackServerFetches` setting, which is now removed.
94+
Previously it was possible to track URLs from `fetch`es on the server in order to rerun load functions. This poses a possible security risk (private URLs leaking), and for this reason it was behind the `dangerZone.trackServerFetches` setting, which is now removed.
9595

9696
## `preloadCode` arguments must be prefixed with `base`
9797

@@ -105,7 +105,7 @@ Additionally, `preloadCode` now takes a single argument rather than _n_ argument
105105

106106
SvelteKit 1 included a function called `resolvePath` which allows you to resolve a route ID (like `/blog/[slug]`) and a set of parameters (like `{ slug: 'hello' }`) to a pathname. Unfortunately the return value didn't include the `base` path, limiting its usefulness in cases where `base` was set.
107107

108-
As such, SvelteKit 2 replaces `resolvePath` with a (slightly better named) function called `resolveRoute`, which is imported from `$app/paths` and which takes `base` into account.
108+
For this reason, SvelteKit 2 replaces `resolvePath` with a (slightly better named) function called `resolveRoute`, which is imported from `$app/paths` and which takes `base` into account.
109109

110110
```js
111111
---import { resolvePath } from '@sveltejs/kit';
@@ -128,7 +128,7 @@ SvelteKit 2 cleans this up by calling `handleError` hooks with two new propertie
128128

129129
The `$env/dynamic/public` and `$env/dynamic/private` modules provide access to _run time_ environment variables, as opposed to the _build time_ environment variables exposed by `$env/static/public` and `$env/static/private`.
130130

131-
During prerendering in SvelteKit 1, they are one and the same. As such, prerendered pages that make use of 'dynamic' environment variables are really 'baking in' build time values, which is incorrect. Worse, `$env/dynamic/public` is populated in the browser with these stale values if the user happens to land on a prerendered page before navigating to dynamically-rendered pages.
131+
During prerendering in SvelteKit 1, they are one and the same. This means that prerendered pages that make use of 'dynamic' environment variables are really 'baking in' build time values, which is incorrect. Worse, `$env/dynamic/public` is populated in the browser with these stale values if the user happens to land on a prerendered page before navigating to dynamically-rendered pages.
132132

133133
Because of this, dynamic environment variables can no longer be read during prerendering in SvelteKit 2 — you should use the `static` modules instead. If the user lands on a prerendered page, SvelteKit will request up-to-date values for `$env/dynamic/public` from the server (by default from a module called `/_app/env.js`) instead of reading them from the server-rendered HTML.
134134

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Checks whether this is an error thrown by `error`.
151151
```dts
152152
function isHttpError<T extends number>(
153153
e: unknown,
154-
status?: T | undefined
154+
status?: T
155155
): e is HttpError_1 & {
156156
status: T extends undefined ? never : T;
157157
};
@@ -182,10 +182,7 @@ Create a JSON `Response` object from the supplied data.
182182
<div class="ts-block">
183183

184184
```dts
185-
function json(
186-
data: any,
187-
init?: ResponseInit | undefined
188-
): Response;
185+
function json(data: any, init?: ResponseInit): Response;
189186
```
190187

191188
</div>
@@ -268,10 +265,7 @@ Create a `Response` object from the supplied body.
268265
<div class="ts-block">
269266

270267
```dts
271-
function text(
272-
body: string,
273-
init?: ResponseInit | undefined
274-
): Response;
268+
function text(body: string, init?: ResponseInit): Response;
275269
```
276270

277271
</div>

0 commit comments

Comments
 (0)