miscellaneous documentation adjustments
MODIFY
documentation/docs/04-hooks.md
documentation/docs/04-hooks.md
@@ -8,7 +8,7 @@ An optional `src/hooks.js` (or `src/hooks.ts`, or `src/hooks/index.js`) file exp
### getContext
-This function runs on every incoming request. It generates the `context` object that is available to [endpoint handlers](#routing-endpoints) as `request.context`, and used to derive the [`session`](#hooks-getsession) object available in the browser.
+This function runs on every incoming request. It generates the `context` object that is available to [endpoint handlers](#routing-endpoints) as `request.context` and that is used to derive the [`session`](#hooks-getsession) object available in the browser.
If unimplemented, context is `{}`.
@@ -43,7 +43,7 @@ export async function getContext({ headers }) {
### getSession
-This function takes the [`context`](#hooks-getcontext) object and returns a `session` object that is safe to expose to the browser. It runs whenever SvelteKit renders a page.
+This function takes the [`context`](#hooks-getcontext) object and returns a `session` object that is safe to expose to the browser. It runs whenever SvelteKit server-renders a page.
If unimplemented, session is `{}`.

MODIFY
documentation/docs/09-amp.md
documentation/docs/09-amp.md
@@ -4,6 +4,6 @@ title: AMP
An unfortunate reality of modern web development is that it is sometimes necessary to create an [AMP](https://amp.dev/) version of your site. In SvelteKit this can be done by setting the [`amp`](#configuration-amp) config option, which has the following effects:
-* Client-side JavaScript, including the router, is disabled
-* Styles are concatenated into `<style amp-custom>`, and the [AMP boilerplate](https://amp.dev/boilerplate/) is injected
-* In development, requests are checked against the [AMP validator](https://validator.ampproject.org/) so you get early warning of any errors
\ No newline at end of file
+- Client-side JavaScript, including the router, is disabled
+- Styles are concatenated into `<style amp-custom>`, and the [AMP boilerplate](https://amp.dev/boilerplate/) is injected
+- In development, requests are checked against the [AMP validator](https://validator.ampproject.org/) so you get early warning of any errors

MODIFY
documentation/docs/99-troubleshooting.md
documentation/docs/99-troubleshooting.md
@@ -8,4 +8,4 @@ Please see the [FAQ](/faq) for solutions to common issues and helpful tips and t
### Support
-You can ask for help on [Discord](https://svelte.dev/chat) and [StackOverlow](https://stackoverflow.com/questions/tagged/svelte). Please first search for information related to your issue in the FAQ, Google or another search engine, issue tracker, and Discord chat history in order to be respectful of others' time. There are many more people asking questions than answering them, so this will help in allowing the community to grow in a scalable fashion.
+You can ask for help on [Discord](https://svelte.dev/chat) and [StackOverflow](https://stackoverflow.com/questions/tagged/svelte). Please first search for information related to your issue in the FAQ, Google or another search engine, issue tracker, and Discord chat history in order to be respectful of others' time. There are many more people asking questions than answering them, so this will help in allowing the community to grow in a scalable fashion.

MODIFY
documentation/faq/20-hmr.md
documentation/faq/20-hmr.md
question: How do I use HMR with SvelteKit?
---
-SvelteKit has HMR enabled by default powered by [svelte-hmr](https://github.com/rixo/svelte-hmr). If you saw, [Rich's presentation at the 2020 Svelte Summit](https://svelte.dev/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 behavior 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/rixo/svelte-hmr) page.
+SvelteKit has HMR enabled by default powered by [svelte-hmr](https://github.com/rixo/svelte-hmr). If you saw [Rich's presentation at the 2020 Svelte Summit](https://svelte.dev/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/rixo/svelte-hmr) page.

MODIFY
documentation/faq/30-fallthrough.md
documentation/faq/30-fallthrough.md
question: Why am I getting a 404?
---
-Please make sure you're returning something from your page's `load` function. See the section about [fallthrough routes](../docs#routing-advanced-fallthrough-routes) for more details.
+Please make sure you're returning something from your page's `load` function. See the section about [fallthrough routes](/docs#routing-advanced-fallthrough-routes) for more details.

MODIFY
documentation/faq/80-integrations.md
documentation/faq/80-integrations.md
@@ -10,7 +10,7 @@ Please see [sveltejs/integrations](https://github.com/sveltejs/integrations#svel
Adding [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) to your [`svelte.config.cjs`](#configuration) is the first step. For many of the tools listed above, you only need to install the corresponding library such as `npm install -D sass`or `npm install -D less`. See the svelte-preprocess docs for full details.
-Also see [the examples above](/faq#how-do-i-use-x-with-sveltekit-how-do-i-setup-library-x) of setting up these and similar libraries.
+Also see [the examples above](#how-do-i-use-x-with-sveltekit-how-do-i-setup-library-x) of setting up these and similar libraries.
### How do I use a client-side only library that depends on `document` or `window`?
@@ -31,22 +31,19 @@ You can also run code in `onMount` if you'd like to run it after the component h
```html
<script>
import { onMount } from 'svelte';
- import { browser } from '$app/env';
let awkward;
onMount(async () => {
- if (browser) {
const module = await import('some-browser-only-library');
awkward = module.default;
- }
});
</script>
```
### How do I setup a database?
-Put the code to query your database in [endpoints](../docs#routing-endpoints) - don't query the database in .svelte files. You can create a `db.js` or similar that sets up a connection immediately and makes the client accessible throughout the app as a singleton. You can execute any one-time setup code in `hooks.js` and import your database helpers into any endpoint that needs them.
+Put the code to query your database in [endpoints](/docs#routing-endpoints) - don't query the database in .svelte files. You can create a `db.js` or similar that sets up a connection immediately and makes the client accessible throughout the app as a singleton. You can execute any one-time setup code in `hooks.js` and import your database helpers into any endpoint that needs them.
### How do I use Axios?

MODIFY
documentation/migrating/01-migrating.md
documentation/migrating/01-migrating.md
@@ -5,4 +5,3 @@ title: Migrating from Sapper
SvelteKit is the successor to Sapper and shares many elements of its design.
If you have an existing Sapper app that you plan to migrate to SvelteKit, however, there are a number of changes you will need to make. You may find it helpful to view the [examples](https://github.com/sveltejs/kit/tree/master/examples) while migrating.
-

MODIFY
documentation/migrating/02-pkg.md
documentation/migrating/02-pkg.md
@@ -18,7 +18,7 @@ Remove `sapper` from your `devDependencies` and replace it with `@sveltejs/kit`,
Any scripts that reference `sapper` should be updated:
-* `sapper build` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the Node [adapter](/docs#adapters)
-* `sapper export` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the static [adapter](/docs#adapters)
-* `sapper dev` should become [`svelte-kit dev`](/docs#command-line-interface-svelte-kit-dev)
-* `node __sapper__/build` should become `node build`
+- `sapper build` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the Node [adapter](/docs#adapters)
+- `sapper export` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the static [adapter](/docs#adapters)
+- `sapper dev` should become [`svelte-kit dev`](/docs#command-line-interface-svelte-kit-dev)
+- `node __sapper__/build` should become `node build`

miscellaneous documentation adjustments (#1204)