Skip to content

Commit

Permalink
Merge branch 'master' into boyeborg/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Aug 15, 2022
2 parents cf0271e + 9adc18c commit e745544
Show file tree
Hide file tree
Showing 930 changed files with 7,099 additions and 7,354 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-pens-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[breaking] Overhaul filesystem-based router (https://github.com/sveltejs/kit/discussions/5774)
5 changes: 5 additions & 0 deletions .changeset/honest-pandas-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Update templates
5 changes: 5 additions & 0 deletions .changeset/odd-trees-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Allow actions to return undefined
5 changes: 5 additions & 0 deletions .changeset/orange-ties-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-migrate': patch
---

Rewrite type names
7 changes: 6 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"@sveltejs/amp": "1.0.0-next.0",
"prerendering-test-disabled": "0.0.2-next.0",
"test-writes": "0.0.2-next.0",
"svelte-migrate": "1.0.0-next.0"
"svelte-migrate": "1.0.0-next.0",
"skeleton-template": "0.0.1-next.0"
},
"changesets": [
"afraid-eels-tease",
Expand Down Expand Up @@ -98,6 +99,7 @@
"brown-mangos-tie",
"brown-nails-wait",
"brown-peas-worry",
"brown-pens-glow",
"calm-pans-peel",
"calm-pens-prove",
"calm-pots-turn",
Expand Down Expand Up @@ -391,6 +393,7 @@
"honest-cows-notice",
"honest-islands-flash",
"honest-jars-report",
"honest-pandas-joke",
"honest-rats-double",
"honest-rice-cry",
"honest-singers-guess",
Expand Down Expand Up @@ -625,6 +628,7 @@
"olive-socks-thank",
"olive-vans-talk",
"orange-boats-love",
"orange-ties-tell",
"orange-wolves-fly",
"perfect-ears-explain",
"perfect-experts-hammer",
Expand Down Expand Up @@ -981,6 +985,7 @@
"thin-avocados-visit",
"thin-bats-protect",
"thin-beans-travel",
"thin-carrots-sin",
"thin-coins-move",
"thin-grapes-dance",
"thin-planets-obey",
Expand Down
5 changes: 5 additions & 0 deletions .changeset/rare-deers-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] avoid manifest collisions
5 changes: 5 additions & 0 deletions .changeset/thin-carrots-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[breaking] Change load API (https://github.com/sveltejs/kit/discussions/5774)
2 changes: 1 addition & 1 deletion documentation/docs/01-project-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The `src` directory contains the meat of your project.

- `lib` contains your library code, which can be imported via the [`$lib`](/docs/modules#$lib) alias, or packaged up for distribution using [`svelte-kit package`](/docs/packaging)
- `params` contains any [param matchers](/docs/routing#advanced-routing-matching) your app needs
- `routes` contains the [pages](/docs/routing#pages) and [endpoints](/docs/routing#endpoints) of your application
- `routes` contains the [routes](/docs/routing) of your application
- `app.html` is your page template — an HTML document containing the following placeholders:
- `%sveltekit.head%``<link>` and `<script>` elements needed by the app, plus any `<svelte:head>` content
- `%sveltekit.body%` — the markup for a rendered page
Expand Down
20 changes: 10 additions & 10 deletions documentation/docs/02-web-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In particular, you'll get comfortable with the following:

SvelteKit uses [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) for getting data from the network. It's available in [hooks](/docs/hooks) and [endpoints](/docs/routing#endpoints) as well as in the browser.

> A special version of `fetch` is available in [`load`](/docs/loading) functions for invoking endpoints directly during server-side rendering, without making an HTTP call, while preserving credentials. (To make credentialled fetches in server-side code outside `load`, you must explicitly pass `cookie` and/or `authorization` headers.) It also allows you to make relative requests, whereas server-side `fetch` normally requires a fully qualified URL.
> A special version of `fetch` is available in [`load`](/docs/load) functions for invoking endpoints directly during server-side rendering, without making an HTTP call, while preserving credentials. (To make credentialled fetches in server-side code outside `load`, you must explicitly pass `cookie` and/or `authorization` headers.) It also allows you to make relative requests, whereas server-side `fetch` normally requires a fully qualified URL.
Besides `fetch` itself, the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) includes the following interfaces:

Expand All @@ -22,26 +22,26 @@ An instance of [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Requ

#### Response

An instance of [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) is returned from `await fetch(...)`. Fundamentally, a SvelteKit app is a machine for turning a `Request` into a `Response`.
An instance of [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) is returned from `await fetch(...)` and handlers in `+server.js` files. Fundamentally, a SvelteKit app is a machine for turning a `Request` into a `Response`.

#### Headers

The [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) interface allows you to read incoming `request.headers` and set outgoing `response.headers`:

```js
// @errors: 2461
/// file: src/routes/what-is-my-user-agent.js
/** @type {import('@sveltejs/kit').RequestHandler} */
/// file: src/routes/what-is-my-user-agent/+server.js
import { json } from '@sveltejs/kit';

/** @type {import('./$types').RequestHandler} */
export function GET(event) {
// log all headers
console.log(...event.request.headers);

return {
body: {
// retrieve a specific header
userAgent: event.request.headers.get('user-agent')
}
};
return json({
// retrieve a specific header
userAgent: event.request.headers.get('user-agent')
});
}
```

Expand Down
Loading

0 comments on commit e745544

Please sign in to comment.