@sveltejs/kit 1.0.0-next.31 → 1.0.0-next.310

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +12 -9
  2. package/assets/app/env.js +20 -0
  3. package/assets/app/navigation.js +24 -0
  4. package/assets/app/paths.js +1 -0
  5. package/assets/app/stores.js +97 -0
  6. package/assets/client/singletons.js +13 -0
  7. package/assets/client/start.js +1655 -0
  8. package/assets/components/error.svelte +18 -2
  9. package/assets/env.js +8 -0
  10. package/assets/paths.js +13 -0
  11. package/assets/server/index.js +2862 -0
  12. package/dist/chunks/amp_hook.js +56 -0
  13. package/dist/chunks/cert.js +28154 -0
  14. package/dist/chunks/constants.js +663 -0
  15. package/dist/chunks/filesystem.js +110 -0
  16. package/dist/chunks/index.js +515 -0
  17. package/dist/chunks/index2.js +1326 -0
  18. package/dist/chunks/index3.js +118 -0
  19. package/dist/chunks/index4.js +185 -0
  20. package/dist/chunks/index5.js +251 -0
  21. package/dist/chunks/index6.js +15585 -0
  22. package/dist/chunks/index7.js +4207 -0
  23. package/dist/chunks/misc.js +78 -0
  24. package/dist/chunks/multipart-parser.js +449 -0
  25. package/dist/chunks/object.js +83 -0
  26. package/dist/chunks/sync.js +983 -0
  27. package/dist/chunks/url.js +56 -0
  28. package/dist/cli.js +1023 -91
  29. package/dist/hooks.js +28 -0
  30. package/dist/install-fetch.js +6518 -0
  31. package/dist/node.js +94 -0
  32. package/package.json +92 -54
  33. package/svelte-kit.js +2 -0
  34. package/types/ambient.d.ts +298 -0
  35. package/types/index.d.ts +258 -0
  36. package/types/internal.d.ts +314 -0
  37. package/types/private.d.ts +269 -0
  38. package/CHANGELOG.md +0 -344
  39. package/assets/runtime/app/navigation.js +0 -23
  40. package/assets/runtime/app/navigation.js.map +0 -1
  41. package/assets/runtime/app/paths.js +0 -2
  42. package/assets/runtime/app/paths.js.map +0 -1
  43. package/assets/runtime/app/stores.js +0 -78
  44. package/assets/runtime/app/stores.js.map +0 -1
  45. package/assets/runtime/internal/singletons.js +0 -15
  46. package/assets/runtime/internal/singletons.js.map +0 -1
  47. package/assets/runtime/internal/start.js +0 -591
  48. package/assets/runtime/internal/start.js.map +0 -1
  49. package/assets/runtime/utils-85ebcc60.js +0 -18
  50. package/assets/runtime/utils-85ebcc60.js.map +0 -1
  51. package/dist/api.js +0 -44
  52. package/dist/api.js.map +0 -1
  53. package/dist/cli.js.map +0 -1
  54. package/dist/create_app.js +0 -580
  55. package/dist/create_app.js.map +0 -1
  56. package/dist/index.js +0 -375
  57. package/dist/index.js.map +0 -1
  58. package/dist/index2.js +0 -12205
  59. package/dist/index2.js.map +0 -1
  60. package/dist/index3.js +0 -549
  61. package/dist/index3.js.map +0 -1
  62. package/dist/index4.js +0 -74
  63. package/dist/index4.js.map +0 -1
  64. package/dist/index5.js +0 -468
  65. package/dist/index5.js.map +0 -1
  66. package/dist/index6.js +0 -735
  67. package/dist/index6.js.map +0 -1
  68. package/dist/renderer.js +0 -2425
  69. package/dist/renderer.js.map +0 -1
  70. package/dist/standard.js +0 -103
  71. package/dist/standard.js.map +0 -1
  72. package/dist/utils.js +0 -58
  73. package/dist/utils.js.map +0 -1
  74. package/svelte-kit +0 -3
package/dist/node.js ADDED
@@ -0,0 +1,94 @@
1
+ import { Readable } from 'stream';
2
+
3
+ /** @param {import('http').IncomingMessage} req */
4
+ function get_raw_body(req) {
5
+ return new Promise((fulfil, reject) => {
6
+ const h = req.headers;
7
+
8
+ if (!h['content-type']) {
9
+ return fulfil(null);
10
+ }
11
+
12
+ req.on('error', reject);
13
+
14
+ const length = Number(h['content-length']);
15
+
16
+ // https://github.com/jshttp/type-is/blob/c1f4388c71c8a01f79934e68f630ca4a15fffcd6/index.js#L81-L95
17
+ if (isNaN(length) && h['transfer-encoding'] == null) {
18
+ return fulfil(null);
19
+ }
20
+
21
+ let data = new Uint8Array(length || 0);
22
+
23
+ if (length > 0) {
24
+ let offset = 0;
25
+ req.on('data', (chunk) => {
26
+ const new_len = offset + Buffer.byteLength(chunk);
27
+
28
+ if (new_len > length) {
29
+ return reject({
30
+ status: 413,
31
+ reason: 'Exceeded "Content-Length" limit'
32
+ });
33
+ }
34
+
35
+ data.set(chunk, offset);
36
+ offset = new_len;
37
+ });
38
+ } else {
39
+ req.on('data', (chunk) => {
40
+ const new_data = new Uint8Array(data.length + chunk.length);
41
+ new_data.set(data, 0);
42
+ new_data.set(chunk, data.length);
43
+ data = new_data;
44
+ });
45
+ }
46
+
47
+ req.on('end', () => {
48
+ fulfil(data);
49
+ });
50
+ });
51
+ }
52
+
53
+ /** @type {import('@sveltejs/kit/node').getRequest} */
54
+ async function getRequest(base, req) {
55
+ let headers = /** @type {Record<string, string>} */ (req.headers);
56
+ if (req.httpVersionMajor === 2) {
57
+ // we need to strip out the HTTP/2 pseudo-headers because node-fetch's
58
+ // Request implementation doesn't like them
59
+ headers = Object.assign({}, headers);
60
+ delete headers[':method'];
61
+ delete headers[':path'];
62
+ delete headers[':authority'];
63
+ delete headers[':scheme'];
64
+ }
65
+ return new Request(base + req.url, {
66
+ method: req.method,
67
+ headers,
68
+ body: await get_raw_body(req) // TODO stream rather than buffer
69
+ });
70
+ }
71
+
72
+ /** @type {import('@sveltejs/kit/node').setResponse} */
73
+ async function setResponse(res, response) {
74
+ const headers = Object.fromEntries(response.headers);
75
+
76
+ if (response.headers.has('set-cookie')) {
77
+ // @ts-expect-error (headers.raw() is non-standard)
78
+ headers['set-cookie'] = response.headers.raw()['set-cookie'];
79
+ }
80
+
81
+ res.writeHead(response.status, headers);
82
+
83
+ if (response.body instanceof Readable) {
84
+ response.body.pipe(res);
85
+ } else {
86
+ if (response.body) {
87
+ res.write(await response.arrayBuffer());
88
+ }
89
+
90
+ res.end();
91
+ }
92
+ }
93
+
94
+ export { getRequest, setResponse };
package/package.json CHANGED
@@ -1,55 +1,93 @@
1
1
  {
2
- "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.31",
4
- "dependencies": {
5
- "cheap-watch": "^1.0.3",
6
- "http-proxy": "^1.18.1",
7
- "rollup": "^2.38.3",
8
- "rollup-plugin-css-chunks": "^2.0.2",
9
- "rollup-plugin-terser": "^7.0.2",
10
- "sade": "^1.7.4",
11
- "scorta": "^1.0.0",
12
- "snowpack": "^3.0.11",
13
- "source-map": "^0.7.3"
14
- },
15
- "devDependencies": {
16
- "@sveltejs/app-utils": "1.0.0-next.0",
17
- "@types/node": "^14.14.22",
18
- "@types/rimraf": "^3.0.0",
19
- "@types/sade": "^1.7.2",
20
- "amphtml-validator": "^1.0.34",
21
- "eslint": "^7.19.0",
22
- "esm": "^3.2.25",
23
- "estree-walker": "^2.0.2",
24
- "is-reference": "^1.2.1",
25
- "kleur": "^4.1.4",
26
- "magic-string": "^0.25.7",
27
- "meriyah": "^3.1.6",
28
- "node-fetch": "^2.6.1",
29
- "periscopic": "^2.0.3",
30
- "port-authority": "^1.1.2",
31
- "require-relative": "^0.8.7",
32
- "rimraf": "^3.0.2",
33
- "sirv": "^1.0.11",
34
- "source-map-support": "^0.5.19",
35
- "svelte": "^3.32.1",
36
- "tiny-glob": "^0.2.8"
37
- },
38
- "bin": {
39
- "svelte-kit": "svelte-kit"
40
- },
41
- "files": [
42
- "assets",
43
- "dist",
44
- "client"
45
- ],
46
- "scripts": {
47
- "dev": "rollup -cw",
48
- "build": "rollup -c",
49
- "lint": "eslint --ignore-path .gitignore \"**/*.{ts,mjs,js,svelte}\" && npm run check-format",
50
- "format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore",
51
- "check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
52
- "prepublishOnly": "npm run build",
53
- "test": "uvu src \"(spec.js|test/index.js)\" -r esm"
54
- }
55
- }
2
+ "name": "@sveltejs/kit",
3
+ "version": "1.0.0-next.310",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/sveltejs/kit",
7
+ "directory": "packages/kit"
8
+ },
9
+ "license": "MIT",
10
+ "homepage": "https://kit.svelte.dev",
11
+ "type": "module",
12
+ "dependencies": {
13
+ "@sveltejs/vite-plugin-svelte": "^1.0.0-next.32",
14
+ "sade": "^1.7.4",
15
+ "vite": "^2.9.0"
16
+ },
17
+ "devDependencies": {
18
+ "@playwright/test": "^1.20.2",
19
+ "@rollup/plugin-replace": "^4.0.0",
20
+ "@types/amphtml-validator": "^1.0.1",
21
+ "@types/cookie": "^0.4.1",
22
+ "@types/marked": "^4.0.1",
23
+ "@types/mime": "^2.0.3",
24
+ "@types/node": "^16.11.11",
25
+ "@types/sade": "^1.7.3",
26
+ "amphtml-validator": "^1.0.35",
27
+ "cookie": "^0.4.1",
28
+ "cross-env": "^7.0.3",
29
+ "devalue": "^2.0.1",
30
+ "eslint": "^8.3.0",
31
+ "kleur": "^4.1.4",
32
+ "locate-character": "^2.0.5",
33
+ "marked": "^4.0.5",
34
+ "mime": "^3.0.0",
35
+ "node-fetch": "^3.1.0",
36
+ "port-authority": "^1.1.2",
37
+ "rollup": "^2.60.2",
38
+ "selfsigned": "^2.0.0",
39
+ "sirv": "^2.0.0",
40
+ "svelte": "^3.44.2",
41
+ "svelte-check": "^2.2.10",
42
+ "svelte-preprocess": "^4.9.8",
43
+ "svelte2tsx": "~0.5.0",
44
+ "tiny-glob": "^0.2.9",
45
+ "uvu": "^0.5.2"
46
+ },
47
+ "peerDependencies": {
48
+ "svelte": "^3.44.0"
49
+ },
50
+ "bin": {
51
+ "svelte-kit": "svelte-kit.js"
52
+ },
53
+ "files": [
54
+ "assets",
55
+ "dist",
56
+ "types",
57
+ "svelte-kit.js"
58
+ ],
59
+ "exports": {
60
+ "./package.json": "./package.json",
61
+ ".": {
62
+ "types": "./types/index.d.ts"
63
+ },
64
+ "./node": {
65
+ "import": "./dist/node.js"
66
+ },
67
+ "./hooks": {
68
+ "import": "./dist/hooks.js"
69
+ },
70
+ "./install-fetch": {
71
+ "import": "./dist/install-fetch.js"
72
+ }
73
+ },
74
+ "types": "types/index.d.ts",
75
+ "engines": {
76
+ "node": ">=14.13"
77
+ },
78
+ "scripts": {
79
+ "build": "rollup -c && node scripts/cp.js src/runtime/components assets/components && npm run types",
80
+ "dev": "rollup -cw",
81
+ "lint": "eslint --ignore-path .gitignore --ignore-pattern \"src/packaging/test/**\" \"{src,test}/**/*.{ts,mjs,js,svelte}\" && npm run check-format",
82
+ "check": "tsc",
83
+ "check:all": "tsc && pnpm run -r check --filter ./",
84
+ "format": "npm run check-format -- --write",
85
+ "check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
86
+ "test": "npm run test:unit && npm run test:typings && npm run test:packaging",
87
+ "test:all": "pnpm run -r test --workspace-concurrency 1 --filter ./",
88
+ "test:unit": "uvu src \"(spec\\.js|test[\\\\/]index\\.js)\" -i packaging",
89
+ "test:typings": "tsc --project test/typings",
90
+ "test:packaging": "uvu src/packaging \"(spec\\.js|test[\\\\/]index\\.js)\"",
91
+ "types": "node scripts/extract-types.js"
92
+ }
93
+ }
package/svelte-kit.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './dist/cli.js';
@@ -0,0 +1,298 @@
1
+ /**
2
+ * It's possible to tell SvelteKit how to type objects inside your app by declaring the `App` namespace. By default, a new project will have a file called `src/app.d.ts` containing the following:
3
+ *
4
+ * ```ts
5
+ * /// <reference types="@sveltejs/kit" />
6
+ *
7
+ * declare namespace App {
8
+ * interface Locals {}
9
+ *
10
+ * interface Platform {}
11
+ *
12
+ * interface Session {}
13
+ *
14
+ * interface Stuff {}
15
+ * }
16
+ * ```
17
+ *
18
+ * By populating these interfaces, you will gain type safety when using `event.locals`, `event.platform`, `session` and `stuff`:
19
+ */
20
+ declare namespace App {
21
+ /**
22
+ * The interface that defines `event.locals`, which can be accessed in [hooks](/docs/hooks) (`handle`, `handleError` and `getSession`) and [endpoints](/docs/routing#endpoints).
23
+ */
24
+ export interface Locals {}
25
+
26
+ /**
27
+ * If your adapter provides [platform-specific context](/docs/adapters#supported-environments-platform-specific-context) via `event.platform`, you can specify it here.
28
+ */
29
+ export interface Platform {}
30
+
31
+ /**
32
+ * The interface that defines `session`, both as an argument to [`load`](/docs/loading) functions and the value of the [session store](/docs/modules#$app-stores).
33
+ */
34
+ export interface Session {}
35
+
36
+ /**
37
+ * The interface that defines `stuff`, as input or output to [`load`](/docs/loading) or as the value of the `stuff` property of the [page store](/docs/modules#$app-stores).
38
+ */
39
+ export interface Stuff {}
40
+ }
41
+
42
+ /**
43
+ * ```ts
44
+ * import { amp, browser, dev, mode, prerendering } from '$app/env';
45
+ * ```
46
+ */
47
+ declare module '$app/env' {
48
+ /**
49
+ * Whether or not the app is running in [AMP mode](/docs/seo#manual-setup-amp).
50
+ */
51
+ export const amp: boolean;
52
+ /**
53
+ * Whether the app is running in the browser or on the server.
54
+ */
55
+ export const browser: boolean;
56
+ /**
57
+ * `true` in development mode, `false` in production.
58
+ */
59
+ export const dev: boolean;
60
+ /**
61
+ * `true` when prerendering, `false` otherwise.
62
+ */
63
+ export const prerendering: boolean;
64
+ /**
65
+ * The Vite.js mode the app is running in. Configure in `config.kit.vite.mode`.
66
+ * Vite.js loads the dotenv file associated with the provided mode, `.env.[mode]` or `.env.[mode].local`.
67
+ * By default, `svelte-kit dev` runs with `mode=development` and `svelte-kit build` runs with `mode=production`.
68
+ */
69
+ export const mode: string;
70
+ }
71
+
72
+ /**
73
+ * ```ts
74
+ * import {
75
+ * afterNavigate,
76
+ * beforeNavigate,
77
+ * disableScrollHandling,
78
+ * goto,
79
+ * invalidate,
80
+ * prefetch,
81
+ * prefetchRoutes
82
+ * } from '$app/navigation';
83
+ * ```
84
+ */
85
+ declare module '$app/navigation' {
86
+ /**
87
+ * If called when the page is being updated following a navigation (in `onMount` or an action, for example), this disables SvelteKit's built-in scroll handling.
88
+ * This is generally discouraged, since it breaks user expectations.
89
+ */
90
+ export function disableScrollHandling(): void;
91
+ /**
92
+ * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `href`.
93
+ *
94
+ * @param href Where to navigate to
95
+ * @param opts.replaceState If `true`, will replace the current `history` entry rather than creating a new one with `pushState`
96
+ * @param opts.noscroll If `true`, the browser will maintain its scroll position rather than scrolling to the top of the page after navigation
97
+ * @param opts.keepfocus If `true`, the currently focused element will retain focus after navigation. Otherwise, focus will be reset to the body
98
+ * @param opts.state The state of the new/updated history entry
99
+ */
100
+ export function goto(
101
+ href: string,
102
+ opts?: { replaceState?: boolean; noscroll?: boolean; keepfocus?: boolean; state?: any }
103
+ ): Promise<void>;
104
+ /**
105
+ * Causes any `load` functions belonging to the currently active page to re-run if they `fetch` the resource in question. Returns a `Promise` that resolves when the page is subsequently updated.
106
+ * @param href The invalidated resource
107
+ */
108
+ export function invalidate(href: string): Promise<void>;
109
+ /**
110
+ * Programmatically prefetches the given page, which means
111
+ * 1. ensuring that the code for the page is loaded, and
112
+ * 2. calling the page's load function with the appropriate options.
113
+ *
114
+ * This is the same behaviour that SvelteKit triggers when the user taps or mouses over an `<a>` element with `sveltekit:prefetch`.
115
+ * If the next navigation is to `href`, the values returned from load will be used, making navigation instantaneous.
116
+ * Returns a Promise that resolves when the prefetch is complete.
117
+ *
118
+ * @param href Page to prefetch
119
+ */
120
+ export function prefetch(href: string): Promise<void>;
121
+ /**
122
+ * Programmatically prefetches the code for routes that haven't yet been fetched.
123
+ * Typically, you might call this to speed up subsequent navigation.
124
+ *
125
+ * If no argument is given, all routes will be fetched, otherwise you can specify routes by any matching pathname
126
+ * such as `/about` (to match `src/routes/about.svelte`) or `/blog/*` (to match `src/routes/blog/[slug].svelte`).
127
+ *
128
+ * Unlike prefetch, this won't call load for individual pages.
129
+ * Returns a Promise that resolves when the routes have been prefetched.
130
+ */
131
+ export function prefetchRoutes(routes?: string[]): Promise<void>;
132
+
133
+ /**
134
+ * A navigation interceptor that triggers before we navigate to a new URL (internal or external) whether by clicking a link, calling `goto`, or using the browser back/forward controls.
135
+ * This is helpful if we want to conditionally prevent a navigation from completing or lookup the upcoming url.
136
+ */
137
+ export function beforeNavigate(
138
+ fn: (navigation: { from: URL; to: URL | null; cancel: () => void }) => void
139
+ ): void;
140
+
141
+ /**
142
+ * A lifecycle function that runs when the page mounts, and also whenever SvelteKit navigates to a new URL but stays on this component.
143
+ */
144
+ export function afterNavigate(fn: (navigation: { from: URL | null; to: URL }) => void): void;
145
+ }
146
+
147
+ /**
148
+ * ```ts
149
+ * import { base, assets } from '$app/paths';
150
+ * ```
151
+ */
152
+ declare module '$app/paths' {
153
+ /**
154
+ * A string that matches [`config.kit.paths.base`](/docs/configuration#paths). It must begin, but not end, with a `/`.
155
+ */
156
+ export const base: `/${string}`;
157
+ /**
158
+ * An absolute path that matches [`config.kit.paths.assets`](/docs/configuration#paths).
159
+ *
160
+ * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during [`svelte-kit dev`](/docs/cli#svelte-kit-dev) or [`svelte-kit preview`](/docs/cli#svelte-kit-preview), since the assets don't yet live at their eventual URL.
161
+ */
162
+ export const assets: `https://${string}` | `http://${string}`;
163
+ }
164
+
165
+ /**
166
+ * ```ts
167
+ * import { getStores, navigating, page, session, updated } from '$app/stores';
168
+ * ```
169
+ *
170
+ * Stores are _contextual_ — they are added to the [context](https://svelte.dev/tutorial/context-api) of your root component. This means that `session` and `page` are unique to each request on the server, rather than shared between multiple requests handled by the same server simultaneously, which is what makes it safe to include user-specific data in `session`.
171
+ *
172
+ * Because of that, you must subscribe to the stores during component initialization (which happens automatically if you reference the store value, e.g. as `$page`, in a component) before you can use them.
173
+ */
174
+ declare module '$app/stores' {
175
+ import { Readable, Writable } from 'svelte/store';
176
+ import { Navigation, Page } from '@sveltejs/kit';
177
+
178
+ /**
179
+ * A convenience function around `getContext`. Must be called during component initialization.
180
+ * Only use this if you need to defer store subscription until after the component has mounted, for some reason.
181
+ */
182
+ export function getStores(): {
183
+ navigating: typeof navigating;
184
+ page: typeof page;
185
+ session: typeof session;
186
+ updated: typeof updated;
187
+ };
188
+
189
+ /**
190
+ * A readable store whose value contains page data.
191
+ */
192
+ export const page: Readable<Page>;
193
+ /**
194
+ * A readable store.
195
+ * When navigating starts, its value is `{ from: URL, to: URL }`,
196
+ * When navigating finishes, its value reverts to `null`.
197
+ */
198
+ export const navigating: Readable<Navigation | null>;
199
+ /**
200
+ * A writable store whose initial value is whatever was returned from [`getSession`](/docs/hooks#getsession).
201
+ * It can be written to, but this will not cause changes to persist on the server — this is something you must implement yourself.
202
+ */
203
+ export const session: Writable<App.Session>;
204
+ /**
205
+ * A readable store whose initial value is `false`. If [`version.pollInterval`](/docs/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.
206
+ */
207
+ export const updated: Readable<boolean> & { check: () => boolean };
208
+ }
209
+
210
+ /**
211
+ * ```ts
212
+ * import { build, files, prerendered, version } from '$service-worker';
213
+ * ```
214
+ *
215
+ * This module is only available to [service workers](/docs/service-workers).
216
+ */
217
+ declare module '$service-worker' {
218
+ /**
219
+ * An array of URL strings representing the files generated by Vite, suitable for caching with `cache.addAll(build)`.
220
+ */
221
+ export const build: string[];
222
+ /**
223
+ * An array of URL strings representing the files in your static directory, or whatever directory is specified by `config.kit.files.assets`. You can customize which files are included from `static` directory using [`config.kit.serviceWorker.files`](/docs/configuration)
224
+ */
225
+ export const files: string[];
226
+ /**
227
+ * An array of pathnames corresponding to prerendered pages and endpoints.
228
+ */
229
+ export const prerendered: string[];
230
+ /**
231
+ * See [`config.kit.version`](/docs/configuration#version). It's useful for generating unique cache names inside your service worker, so that a later deployment of your app can invalidate old caches.
232
+ */
233
+ export const version: string;
234
+ }
235
+
236
+ declare module '@sveltejs/kit/hooks' {
237
+ import { Handle } from '@sveltejs/kit';
238
+
239
+ /**
240
+ * A helper function for sequencing multiple `handle` calls in a middleware-like manner.
241
+ *
242
+ * ```js
243
+ * /// file: src/hooks.js
244
+ * import { sequence } from '@sveltejs/kit/hooks';
245
+ *
246
+ * /** @type {import('@sveltejs/kit').Handle} *\/
247
+ * async function first({ event, resolve }) {
248
+ * console.log('first pre-processing');
249
+ * const result = await resolve(event);
250
+ * console.log('first post-processing');
251
+ * return result;
252
+ * }
253
+ *
254
+ * /** @type {import('@sveltejs/kit').Handle} *\/
255
+ * async function second({ event, resolve }) {
256
+ * console.log('second pre-processing');
257
+ * const result = await resolve(event);
258
+ * console.log('second post-processing');
259
+ * return result;
260
+ * }
261
+ *
262
+ * export const handle = sequence(first, second);
263
+ * ```
264
+ *
265
+ * The example above would print:
266
+ *
267
+ * ```
268
+ * first pre-processing
269
+ * second pre-processing
270
+ * second post-processing
271
+ * first post-processing
272
+ * ```
273
+ *
274
+ * @param handlers The chain of `handle` functions
275
+ */
276
+ export function sequence(...handlers: Handle[]): Handle;
277
+ }
278
+
279
+ /**
280
+ * A polyfill for `fetch` and its related interfaces, used by adapters for environments that don't provide a native implementation.
281
+ */
282
+ declare module '@sveltejs/kit/install-fetch' {
283
+ /**
284
+ * Make `fetch`, `Headers`, `Request` and `Response` available as globals, via `node-fetch`
285
+ */
286
+ export function installFetch(): void;
287
+ }
288
+
289
+ /**
290
+ * Utilities used by adapters for Node-like environments.
291
+ */
292
+ declare module '@sveltejs/kit/node' {
293
+ export function getRequest(
294
+ base: string,
295
+ request: import('http').IncomingMessage
296
+ ): Promise<Request>;
297
+ export function setResponse(res: import('http').ServerResponse, response: Response): void;
298
+ }