You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* start fiddling about with code-split server code
* generate build data
* working, minus adapters
* prerendering
* WIP
* tidy some stuff up
* fix prefixes
* adapter-node working
* tidy up
* tidy
* make copy opts optional
* tidy
* netlify working albeit with single function
* expose route data to adapters
* some progress
* lint
* remove sandbox example from PR
* implement createEntries API
* fix some tests
* AMP fix
* tests all passing
* update gitignore
* disable adapter-node tests for now
* typechecking
* always create prerendered output directory
* manifest -> generateManifest, add utils-level method
* spread -> rest
* finesse return value of copy helper
* no need to pass config through to adapter
* Update packages/kit/src/core/build/index.js
Co-authored-by: Ben McCann <[email protected]>
* fix
* refactor out method extraction
* add comment to resolve separate routes/components entry point detection
* remove out of date comment
* nicer rollup output types
* actually that caused chaos, doing this instead
* fix tests
* update adapter-cloudflare
* refactor build functions into client/server/service worker modules
* make build_server more readable
* oops
* gah
* windows fix
* split manifest into public and private parts, so we can use manifest.assets in adapters
* lint
* prevent duplication of asset list in functions
* exclude prerendered pages from functions
* lint
* get vercel adapter working (with v1 filesystem API)
* target node14
* rename utils -> builder
* add methods for getting directories instead of hardcoding .svelte-kit etc
* fix lockfile
* update cloudflare adapters
* update readmes
* tidy up
* tweak docs
* remove sandbox from workspace
* try pinning version
* Update packages/kit/src/core/build/build_server.js
Co-authored-by: Ben McCann <[email protected]>
* remove redundant strict fs stuff
* remove sandbox from gitignore
* lint
* fix cloudflare pages handling of prerendered pages
* support esm and cjs manifests
* force createEntries to follow prerender
* fix types
* fix adapter-netlify
* separate App from InternalApp
* Update packages/kit/types/internal.d.ts
Co-authored-by: Ben McCann <[email protected]>
* expose SSRManifest
* fall back to HTTP fetch if endpoint is missing
* app.render should not be passed a host string
* default hostHeader to host in config
* fix types
* replace page.host with page.origin
* fix host stuff
* make SSR route splitting optional
* simplify createEntries
* these are no longer generic
* implement .json heuristic
* lint
* changesets
* changeset
* Update packages/adapter-netlify/index.js
Co-authored-by: Ben McCann <[email protected]>
* Update packages/adapter-node/README.md
Co-authored-by: Ben McCann <[email protected]>
* this.server -> this.vite
* give a bare-bones description of createEntries
* lint
* add missing origin
* remove TODO
* replace ts-ignore with ts-expect-error
* Update packages/kit/src/core/adapt/builder.js
Co-authored-by: Ben McCann <[email protected]>
* document AdapterEntry
* Update packages/kit/types/config.d.ts
Co-authored-by: Ben McCann <[email protected]>
* oops
* manifest -> vite_manifest
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Rich Harris <[email protected]>
For example, our hypothetical blog page, `/blog/cool-article`, might request data from `/blog/cool-article.json`, which could be represented by a `src/routes/blog/[slug].json.js` endpoint:
99
+
For example, our hypothetical blog page, `/blog/cool-article`, might request data from `/blog/cool-article.json`, which could be represented by a `src/routes/blog/[slug].json.js` endpoint:
Copy file name to clipboardExpand all lines: documentation/docs/03-loading.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ export interface LoadInput<
14
14
Session=any
15
15
> {
16
16
page: {
17
-
host:string;
17
+
origin:string;
18
18
path:string;
19
19
params:PageParams;
20
20
query:URLSearchParams;
@@ -92,11 +92,11 @@ The `load` function receives an object containing four fields — `page`, `fetch
92
92
93
93
#### page
94
94
95
-
`page` is a`{ host, path, params, query }` object where `host` is the URL's host, `path` is its pathname, `params` is derived from `path` and the route filename, and `query` is an instance of [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). Mutating `page` does not update the current URL; you should instead navigate using [`goto`](#modules-$app-navigation).
95
+
`page` is an`{ origin, path, params, query }` object where `origin` is the URL's origin, `path` is its pathname, `params` is derived from `path` and the route filename, and `query` is an instance of [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). Mutating `page` does not update the current URL; you should instead navigate using [`goto`](#modules-$app-navigation).
96
96
97
97
So if the example above was `src/routes/blog/[slug].svelte` and the URL was `https://example.com/blog/some-post?foo=bar&baz&bizz=a&bizz=b`, the following would be true:
Copy file name to clipboardExpand all lines: documentation/docs/05-modules.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ Because of that, the stores are not free-floating objects: they must be accessed
57
57
The stores themselves attach to the correct context at the point of subscription, which means you can import and use them directly in components without boilerplate. However, it still needs to be called synchronously on component or page initialisation when `$`-prefix isn't used. Use `getStores` to safely `.subscribe` asynchronously instead.
58
58
59
59
-`navigating` is a [readable store](https://svelte.dev/tutorial/readable-stores). When navigating starts, its value is `{ from, to }`, where `from` and `to` both mirror the `page` store value. When navigating finishes, its value reverts to `null`.
60
-
-`page` is a readable store whose value reflects the object passed to `load` functions — it contains `host`, `path`, `params` and `query`. See the [`page` section](#loading-input-page) above for more details.
60
+
-`page` is a readable store whose value reflects the object passed to `load` functions — it contains `origin`, `path`, `params` and `query`. See the [`page` section](#loading-input-page) above for more details.
61
61
-`session` is a [writable store](https://svelte.dev/tutorial/writable-stores) whose initial value is whatever was returned from [`getSession`](#hooks-getsession). It can be written to, but this will _not_ cause changes to persist on the server — this is something you must implement yourself.
62
62
63
63
### $lib
@@ -84,12 +84,12 @@ This module provides a helper function to sequence multiple `handle` calls.
-Instantiates the app with a manifest generated with `builder.generateManifest({ relativePath })`
94
95
- Listens for requests from the platform, converts them to a a [SvelteKit request](#hooks-handle), calls the `render` function to generate a [SvelteKit response](#hooks-handle) and responds with it
95
96
- Globally shims `fetch` to work on the target platform, if necessary. SvelteKit provides a `@sveltejs/kit/install-fetch` helper for platforms that can use `node-fetch`
96
-
- Bundle the output to avoid needing to install dependencies on the target platform, if desired
97
-
- Call `utils.prerender`
97
+
- Bundle the output to avoid needing to install dependencies on the target platform, if necessary
98
98
- Put the user's static files and the generated JS/CSS in the correct location for the target platform
99
99
100
-
If possible, we recommend putting the adapter output under the `build/` directory with any intermediate output placed under `.svelte-kit/[adapter-name]`.
100
+
Where possible, we recommend putting the adapter output under the `build/` directory with any intermediate output placed under `.svelte-kit/[adapter-name]`.
> This only applies to server-rendered responses — headers for prerendered pages (e.g. created with [adapter-static](https://github.com/sveltejs/kit/tree/master/packages/adapter-static)) are determined by the hosting platform.
105
109
106
-
### host
107
-
108
-
A value that overrides the `Host` header when populating `page.host`
110
+
### headers
109
111
110
-
### hostHeader
112
+
The [`page.origin`] property is derived from the request protocol (normally `https`) and the host, which is taken from the `Host` header by default.
111
113
112
-
If your app is behind a reverse proxy (think load balancers and CDNs) then the `Host` header will be incorrect. In most cases, the underlying host is exposed via the [`X-Forwarded-Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host)header and you should specify this in your config if you need to access `page.host`:
114
+
If your app is behind a reverse proxy (think load balancers and CDNs) then the `Host` header will be incorrect. In most cases, the underlying protocol and host are exposed via the [`X-Forwarded-Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host) and [`X-Forwarded-Proto`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto) headers, which can be specified in your config:
113
115
114
116
```js
115
117
// svelte.config.js
116
118
exportdefault {
117
119
kit: {
118
-
hostHeader:'X-Forwarded-Host'
120
+
headers: {
121
+
host:'X-Forwarded-Host',
122
+
protocol:'X-Forwarded-Proto'
123
+
}
119
124
}
120
125
};
121
126
```
122
127
123
128
**You should only do this if you trust the reverse proxy**, which is why it isn't the default.
124
129
130
+
### host
131
+
132
+
A value that overrides the one derived from [`config.kit.headers.host`](#configuration-headers-host).
133
+
125
134
### hydrate
126
135
127
136
Whether to [hydrate](#ssr-and-javascript-hydrate) the server-rendered HTML with a client-side app. (It's rare that you would set this to `false` on an app-wide basis.)
@@ -194,6 +203,10 @@ See [Prerendering](#ssr-and-javascript-prerender). An object containing zero or
194
203
};
195
204
```
196
205
206
+
### protocol
207
+
208
+
Theprotocolisassumedtobe`'https'` (unlessyou're developing locally without the `--https` flag) unless [`config.kit.headers.protocol`](#configuration-headers-protocol) is set. If necessary, you can override it here.
Copy file name to clipboardExpand all lines: packages/adapter-auto/index.js
+4-6
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,10 @@ export default function () {
5
5
return{
6
6
name: '@sveltejs/adapter-auto',
7
7
8
-
asyncadapt(options){
8
+
asyncadapt(builder){
9
9
for(constcandidateofadapters){
10
10
if(candidate.test()){
11
-
options.utils.log.info(
12
-
`Detected environment: ${candidate.name}. Using ${candidate.module}`
13
-
);
11
+
builder.log.info(`Detected environment: ${candidate.name}. Using ${candidate.module}`);
14
12
15
13
letmodule;
16
14
@@ -30,11 +28,11 @@ export default function () {
30
28
}
31
29
32
30
constadapter=module.default();
33
-
returnadapter.adapt(options);
31
+
returnadapter.adapt(builder);
34
32
}
35
33
}
36
34
37
-
options.utils.log.warn(
35
+
builder.log.warn(
38
36
'Could not detect a supported production environment. See https://kit.svelte.dev/docs#adapters to learn how to configure your app to run on the platform of your choosing'
Copy file name to clipboardExpand all lines: packages/adapter-cloudflare-workers/README.md
-33
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,6 @@
2
2
3
3
SvelteKit adapter that creates a Cloudflare Workers site using a function for dynamic server rendering.
4
4
5
-
This is very experimental; the adapter API isn't at all fleshed out, and things will definitely change.
6
-
7
5
_**Comparisons**_
8
6
9
7
-`adapter-cloudflare` – supports all SvelteKit features; builds for
@@ -86,37 +84,6 @@ npm run build && wrangler publish
86
84
87
85
More info on configuring a cloudflare worker site can be found [here](https://developers.cloudflare.com/workers/platform/sites/start-from-existing)
88
86
89
-
## Advanced Configuration
90
-
91
-
### esbuild
92
-
93
-
As an escape hatch, you may optionally specify a function which will receive the final esbuild options generated by this adapter and returns a modified esbuild configuration. The result of this function will be passed as-is to esbuild. The function can be async.
94
-
95
-
For example, you may wish to add a plugin:
96
-
97
-
```js
98
-
adapterCfw({
99
-
esbuild(options) {
100
-
return {
101
-
...options,
102
-
plugins: []
103
-
};
104
-
}
105
-
});
106
-
```
107
-
108
-
The default options for this version are as follows:
[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare-workers/CHANGELOG.md).
0 commit comments