Skip to content

Commit 59c1623

Browse files
authored
Merge pull request #2 from tomoam/sync-fork
2024-10-24 迄の更新に追従
2 parents f1a9f42 + feb2ae3 commit 59c1623

File tree

71 files changed

+409
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+409
-287
lines changed

.github/workflows/release.yml

-45
This file was deleted.

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ dist
55
pnpm-lock.yaml
66
.vercel
77
_generated.md
8-
land-110m.json
8+
land-110m.json
9+
/apps/svelte.dev/content/docs

apps/kit.svelte.dev/vercel.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
},
99
{
1010
"source": "/docs/modules",
11-
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit",
12-
"permanent": true
11+
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit"
1312
},
1413
{
1514
"source": "/docs/types",
16-
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit",
15+
"destination": "https://svelte.dev/docs/kit/@sveltejs-kit"
16+
},
17+
{
18+
"source": "/docs",
19+
"destination": "https://svelte.dev/docs/kit",
1720
"permanent": true
1821
},
1922
{

apps/svelte.dev/content/docs/kit/10-getting-started/10-introduction.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ title: イントロダクション
44

55
## Before we begin
66

7-
> [!NOTE] Svelte や SvelteKit が初めてなら、こちらの[インタラクティブなチュートリアル](/tutorial)をチェックしてみることをおすすめします。
7+
> [!NOTE] Svelte や SvelteKit が初めてなら、こちらの[インタラクティブなチュートリアル](/tutorial/kit)をチェックしてみることをおすすめします。
88
>
99
> 行き詰まったら、[Discord chatroom](https://svelte.dev/chat) でヘルプを求めてください。
1010
1111
## What is SvelteKit?
1212

13-
SvelteKit は、[Svelte](https://svelte.dev/) を使用して堅牢でハイパフォーマンスな web アプリケーションを迅速に開発するためのフレームワークです。もしあなたが React 界隈から来たのであれば、SvelteKit は Next に似ているものです。Vue 界隈から来たのであれば、Nuxt に似ています。
13+
SvelteKit は、[Svelte](../svelte) を使用して堅牢でハイパフォーマンスな web アプリケーションを迅速に開発するためのフレームワークです。もしあなたが React 界隈から来たのであれば、SvelteKit は Next に似ているものです。Vue 界隈から来たのであれば、Nuxt に似ています。
1414

1515
SvelteKit で構築することのできるアプリケーションの種類については、[FAQ](faq#What-can-I-make-with-SvelteKit) をご覧ください。
1616

1717
## What is Svelte?
1818

19-
In short, Svelte is a way of writing user interface components — like a navigation bar, comment section, or contact form — that users see and interact with in their browsers. The Svelte compiler converts your components to JavaScript that can be run to render the HTML for the page and to CSS that styles the page. You don't need to know Svelte to understand the rest of this guide, but it will help. If you'd like to learn more, check out [the Svelte tutorial](https://svelte.dev/tutorial).
19+
In short, Svelte is a way of writing user interface components — like a navigation bar, comment section, or contact form — that users see and interact with in their browsers. The Svelte compiler converts your components to JavaScript that can be run to render the HTML for the page and to CSS that styles the page. You don't need to know Svelte to understand the rest of this guide, but it will help. If you'd like to learn more, check out [the Svelte tutorial](/tutorial).
2020

2121
## SvelteKit vs Svelte
2222

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The first command will scaffold a new project in the `my-app` directory asking y
1515

1616
There are two basic concepts:
1717

18-
- Each page of your app is a [Svelte](https://svelte.dev) component
18+
- Each page of your app is a [Svelte](../svelte) component
1919
- You create pages by adding files to the `src/routes` directory of your project. These will be server-rendered so that a user's first visit to your app is as fast as possible, then a client-side app takes over
2020

2121
Try editing the files to get a feel for how everything works.

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ In turn, annotating the `load` function with `PageLoad`, `PageServerLoad`, `Layo
384384
385385
If you're using VS Code or any IDE that supports the language server protocol and TypeScript plugins then you can omit these types _entirely_! Svelte's IDE tooling will insert the correct types for you, so you'll get type checking without writing them yourself. It also works with our command line tool `svelte-check`.
386386
387-
You can read more about omitting `$types` in our [blog post](https://svelte.dev/blog/zero-config-type-safety) about it.
387+
You can read more about omitting `$types` in our [blog post](/blog/zero-config-type-safety) about it.
388388
389389
## Other files
390390
@@ -394,6 +394,6 @@ If components and modules are needed by multiple routes, it's a good idea to put
394394
395395
## Further reading
396396
397-
- [Tutorial: Routing](https://learn.svelte.dev/tutorial/pages)
398-
- [Tutorial: API routes](https://learn.svelte.dev/tutorial/get-handlers)
397+
- [Tutorial: Routing](/tutorial/kit/pages)
398+
- [Tutorial: API routes](/tutorial/kit/get-handlers)
399399
- [Docs: Advanced routing](advanced-routing)

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function load({ params }) {
3434

3535
Thanks to the generated `$types` module, we get full type safety.
3636

37-
A `load` function in a `+page.js` file runs both on the server and in the browser (unless combined with `export const ssr = false`, in which case it will [only run in the browser](https://kit.svelte.dev/docs/page-options#ssr)). If your `load` function should _always_ run on the server (because it uses private environment variables, for example, or accesses a database) then it would go in a `+page.server.js` instead.
37+
A `load` function in a `+page.js` file runs both on the server and in the browser (unless combined with `export const ssr = false`, in which case it will [only run in the browser](page-options#ssr)). If your `load` function should _always_ run on the server (because it uses private environment variables, for example, or accesses a database) then it would go in a `+page.server.js` instead.
3838

3939
A more realistic version of your blog post's `load` function, that only runs on the server and pulls data from a database, might look like this:
4040

@@ -120,8 +120,8 @@ Data returned from layout `load` functions is available to child `+layout.svelte
120120
121121
+++ // we can access `data.posts` because it's returned from
122122
// the parent layout `load` function
123-
$: index = data.posts.findIndex(post => post.slug === $page.params.slug);
124-
$: next = data.posts[index - 1];+++
123+
let index = $derived(data.posts.findIndex(post => post.slug === $page.params.slug));
124+
let next = $derived(data.posts[index - 1];)+++
125125
</script>
126126
127127
<h1>{data.post.title}</h1>
@@ -675,7 +675,7 @@ To summarize, a `load` function will rerun in the following situations:
675675

676676
`params` and `url` can change in response to a `<a href="..">` link click, a [`<form>` interaction](form-actions#GET-vs-POST), a [`goto`]($app-navigation#goto) invocation, or a [`redirect`](@sveltejs-kit#redirect).
677677

678-
Note that rerunning a `load` function will update the `data` prop inside the corresponding `+layout.svelte` or `+page.svelte`; it does _not_ cause the component to be recreated. As a result, internal state is preserved. If this isn't what you want, you can reset whatever you need to reset inside an [`afterNavigate`]($app-navigation#afterNavigate) callback, and/or wrap your component in a [`{#key ...}`](https://svelte.dev/docs#template-syntax-key) block.
678+
Note that rerunning a `load` function will update the `data` prop inside the corresponding `+layout.svelte` or `+page.svelte`; it does _not_ cause the component to be recreated. As a result, internal state is preserved. If this isn't what you want, you can reset whatever you need to reset inside an [`afterNavigate`]($app-navigation#afterNavigate) callback, and/or wrap your component in a [`{#key ...}`](../svelte/key) block.
679679

680680
## Implications for authentication
681681

@@ -693,6 +693,6 @@ Putting an auth guard in `+layout.server.js` requires all child pages to call `a
693693

694694
## Further reading
695695

696-
- [Tutorial: Loading data](https://learn.svelte.dev/tutorial/page-data)
697-
- [Tutorial: Errors and redirects](https://learn.svelte.dev/tutorial/error-basics)
698-
- [Tutorial: Advanced loading](https://learn.svelte.dev/tutorial/await-parent)
696+
- [Tutorial: Loading data](/tutorial/kit/page-data)
697+
- [Tutorial: Errors and redirects](/tutorial/kit/error-basics)
698+
- [Tutorial: Advanced loading](/tutorial/kit/await-parent)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,4 +518,4 @@ Submitting this form will navigate to `/search?q=...` and invoke your load funct
518518
519519
## Further reading
520520
521-
- [Tutorial: Forms](https://learn.svelte.dev/tutorial/the-form-element)
521+
- [Tutorial: Forms](/tutorial/kit/the-form-element)

apps/svelte.dev/content/docs/kit/20-core-concepts/40-page-options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,4 @@ export const config = {
219219

220220
## Further reading
221221

222-
- [Tutorial: Page options](https://learn.svelte.dev/tutorial/page-options)
222+
- [Tutorial: Page options](/tutorial/kit/page-options)

apps/svelte.dev/content/docs/kit/20-core-concepts/50-state-management.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ If you're not using SSR, then there's no risk of accidentally exposing one user'
8282

8383
## Using stores with context
8484

85-
You might wonder how we're able to use `$page.data` and other [app stores]($app-stores) if we can't use our own stores. The answer is that app stores on the server use Svelte's [context API](https://learn.svelte.dev/tutorial/context-api) — the store is attached to the component tree with `setContext`, and when you subscribe you retrieve it with `getContext`. We can do the same thing with our own stores:
85+
You might wonder how we're able to use `$page.data` and other [app stores]($app-stores) if we can't use our own stores. The answer is that app stores on the server use Svelte's [context API](/tutorial/svelte/context-api) — the store is attached to the component tree with `setContext`, and when you subscribe you retrieve it with `getContext`. We can do the same thing with our own stores:
8686

8787
```svelte
8888
<!--- file: src/routes/+layout.svelte --->
@@ -143,16 +143,16 @@ When you navigate around your application, SvelteKit reuses existing layout and
143143

144144
...then navigating from `/blog/my-short-post` to `/blog/my-long-post` won't cause the layout, page and any other components within to be destroyed and recreated. Instead the `data` prop (and by extension `data.title` and `data.content`) will update (as it would with any other Svelte component) and, because the code isn't rerunning, lifecycle methods like `onMount` and `onDestroy` won't rerun and `estimatedReadingTime` won't be recalculated.
145145

146-
Instead, we need to make the value [_reactive_](https://learn.svelte.dev/tutorial/reactive-assignments):
146+
Instead, we need to make the value [_reactive_](/tutorial/svelte/state):
147147

148148
```svelte
149149
/// file: src/routes/blog/[slug]/+page.svelte
150150
<script>
151151
/** @type {import('./$types').PageData} */
152152
export let data;
153153
154-
+++ $: wordCount = data.content.split(' ').length;
155-
$: estimatedReadingTime = wordCount / 250;+++
154+
+++ let wordCount = $state(data.content.split(' ').length);
155+
let estimatedReadingTime = $derived(wordCount / 250);+++
156156
</script>
157157
```
158158

apps/svelte.dev/content/docs/kit/25-build-and-deploy/30-adapter-auto.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ When you create a new SvelteKit project with `npx sv create`, it installs [`adap
99
- [`@sveltejs/adapter-vercel`](adapter-vercel) for [Vercel](https://vercel.com/)
1010
- [`svelte-adapter-azure-swa`](https://github.com/geoffrich/svelte-adapter-azure-swa) for [Azure Static Web Apps](https://docs.microsoft.com/en-us/azure/static-web-apps/)
1111
- [`svelte-kit-sst`](https://github.com/sst/sst/tree/master/packages/svelte-kit-sst) for [AWS via SST](https://sst.dev/docs/start/aws/svelte)
12-
- [`@sveltejs/adapter-node`](https://kit.svelte.dev/docs/adapter-node) for [Google Cloud Run](https://cloud.google.com/run)
12+
- [`@sveltejs/adapter-node`](adapter-node) for [Google Cloud Run](https://cloud.google.com/run)
1313

1414
It's recommended to install the appropriate adapter to your `devDependencies` once you've settled on a target environment, since this will add the adapter to your lockfile and slightly improve install times on CI.
1515

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ For testing the build, you should use [wrangler](https://developers.cloudflare.c
108108

109109
## Notes
110110

111-
Functions contained in the `/functions` directory at the project's root will _not_ be included in the deployment, which is compiled to a [single `_worker.js` file](https://developers.cloudflare.com/pages/platform/functions/#advanced-mode). Functions should be implemented as [server endpoints](https://kit.svelte.dev/docs/routing#server) in your SvelteKit app.
111+
Functions contained in the `/functions` directory at the project's root will _not_ be included in the deployment, which is compiled to a [single `_worker.js` file](https://developers.cloudflare.com/pages/platform/functions/#advanced-mode). Functions should be implemented as [server endpoints](routing#server) in your SvelteKit app.
112112

113113
The `_headers` and `_redirects` files specific to Cloudflare Pages can be used for static asset responses (like images) by putting them into the `/static` folder.
114114

115-
However, they will have no effect on responses dynamically rendered by SvelteKit, which should return custom headers or redirect responses from [server endpoints](https://kit.svelte.dev/docs/routing#server) or with the [`handle`](https://kit.svelte.dev/docs/hooks#Server-hooks-handle) hook.
115+
However, they will have no effect on responses dynamically rendered by SvelteKit, which should return custom headers or redirect responses from [server endpoints](routing#server) or with the [`handle`](hooks#Server-hooks-handle) hook.
116116

117117
## Troubleshooting
118118

@@ -122,4 +122,4 @@ You may wish to refer to [Cloudflare's documentation for deploying a SvelteKit s
122122

123123
### Accessing the file system
124124

125-
You can't use `fs` in Cloudflare Workers — you must [prerender](https://kit.svelte.dev/docs/page-options#prerender) the routes in question.
125+
You can't use `fs` in Cloudflare Workers — you must [prerender](page-options#prerender) the routes in question.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@ When deploying to workers, the server generated by SvelteKit is bundled into a s
135135

136136
### Accessing the file system
137137

138-
You can't use `fs` in Cloudflare Workers — you must [prerender](https://kit.svelte.dev/docs/page-options#prerender) the routes in question.
138+
You can't use `fs` in Cloudflare Workers — you must [prerender](page-options#prerender) the routes in question.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ During compilation, redirect rules are automatically appended to your `_redirect
8080
### Netlify Forms
8181

8282
1. Create your Netlify HTML form as described [here](https://docs.netlify.com/forms/setup/#html-forms), e.g. as `/routes/contact/+page.svelte`. (Don't forget to add the hidden `form-name` input element!)
83-
2. Netlify's build bot parses your HTML files at deploy time, which means your form must be [prerendered](https://kit.svelte.dev/docs/page-options#prerender) as HTML. You can either add `export const prerender = true` to your `contact.svelte` to prerender just that page or set the `kit.prerender.force: true` option to prerender all pages.
83+
2. Netlify's build bot parses your HTML files at deploy time, which means your form must be [prerendered](page-options#prerender) as HTML. You can either add `export const prerender = true` to your `contact.svelte` to prerender just that page or set the `kit.prerender.force: true` option to prerender all pages.
8484
3. If your Netlify form has a [custom success message](https://docs.netlify.com/forms/setup/#success-messages) like `<form netlify ... action="/success">` then ensure the corresponding `/routes/success/+page.svelte` exists and is prerendered.
8585

8686
### Netlify Functions
@@ -115,4 +115,4 @@ You can't use `fs` in edge deployments.
115115

116116
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` function from `$app/server` to access your files. `read` does not work inside edge deployments (this may change in future).
117117

118-
Alternatively, you can [prerender](https://kit.svelte.dev/docs/page-options#prerender) the routes in question.
118+
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Cookie-based skew protection comes with one caveat: if a user has multiple versi
161161

162162
### Vercel functions
163163

164-
If you have Vercel functions contained in the `api` directory at the project's root, any requests for `/api/*` will _not_ be handled by SvelteKit. You should implement these as [API routes](https://kit.svelte.dev/docs/routing#server) in your SvelteKit app instead, unless you need to use a non-JavaScript language in which case you will need to ensure that you don't have any `/api/*` routes in your SvelteKit app.
164+
If you have Vercel functions contained in the `api` directory at the project's root, any requests for `/api/*` will _not_ be handled by SvelteKit. You should implement these as [API routes](routing#server) in your SvelteKit app instead, unless you need to use a non-JavaScript language in which case you will need to ensure that you don't have any `/api/*` routes in your SvelteKit app.
165165

166166
### Node version
167167

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,4 @@ export function load(event) {
287287
288288
## Further reading
289289
290-
- [Tutorial: Advanced Routing](https://learn.svelte.dev/tutorial/optional-params)
290+
- [Tutorial: Advanced Routing](/tutorial/kit/optional-params)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,4 @@ Using `reroute` will _not_ change the contents of the browser's address bar, or
270270

271271
## Further reading
272272

273-
- [Tutorial: Hooks](https://learn.svelte.dev/tutorial/handle)
273+
- [Tutorial: Hooks](/tutorial/kit/handle)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,5 @@ This interface always includes a `message: string` property.
144144

145145
## Further reading
146146

147-
- [Tutorial: Errors and redirects](https://learn.svelte.dev/tutorial/error-basics)
148-
- [Tutorial: Hooks](https://learn.svelte.dev/tutorial/handle)
147+
- [Tutorial: Errors and redirects](/tutorial/kit/error-basics)
148+
- [Tutorial: Hooks](/tutorial/kit/handle)

apps/svelte.dev/content/docs/kit/30-advanced/50-server-only-modules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ This feature also works with dynamic imports, even interpolated ones like ``awai
6161
6262
## Further reading
6363

64-
- [Tutorial: Environment variables](https://learn.svelte.dev/tutorial/env-static-private)
64+
- [Tutorial: Environment variables](/tutorial/kit/env-static-private)

0 commit comments

Comments
 (0)