@sveltejs/kit 1.0.0-next.283 → 1.0.0-next.286

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.
@@ -8,7 +8,7 @@ import { init } from './singletons.js';
8
8
 
9
9
  /**
10
10
  * @param {string} path
11
- * @param {'always' | 'never' | 'ignore'} trailing_slash
11
+ * @param {import('types').TrailingSlash} trailing_slash
12
12
  */
13
13
  function normalize_path(path, trailing_slash) {
14
14
  if (path === '/' || trailing_slash === 'ignore') return path;
@@ -200,6 +200,7 @@ class Router {
200
200
 
201
201
  if (!a.href) return;
202
202
 
203
+ const is_svg_a_element = a instanceof SVGAElement;
203
204
  const url = get_href(a);
204
205
  const url_string = url.toString();
205
206
  if (url_string === location.href) {
@@ -207,6 +208,11 @@ class Router {
207
208
  return;
208
209
  }
209
210
 
211
+ // Ignore if url does not have origin (e.g. `mailto:`, `tel:`.)
212
+ // MEMO: Without this condition, firefox will open mailer twice.
213
+ // See: https://github.com/sveltejs/kit/issues/4045
214
+ if (!is_svg_a_element && url.origin === 'null') return;
215
+
210
216
  // Ignore if tag has
211
217
  // 1. 'download' attribute
212
218
  // 2. 'rel' attribute includes external
@@ -217,7 +223,7 @@ class Router {
217
223
  }
218
224
 
219
225
  // Ignore if <a> has a target
220
- if (a instanceof SVGAElement ? a.target.baseVal : a.target) return;
226
+ if (is_svg_a_element ? a.target.baseVal : a.target) return;
221
227
 
222
228
  // Check if new url only differs by hash and use the browser default behavior in that case
223
229
  // This will ensure the `hashchange` event is fired
@@ -439,20 +445,13 @@ class Router {
439
445
 
440
446
  accepted();
441
447
 
442
- if (!this.navigating) {
443
- dispatchEvent(new CustomEvent('sveltekit:navigation-start'));
444
- }
445
448
  this.navigating++;
446
449
 
447
450
  const pathname = normalize_path(url.pathname, this.trailing_slash);
448
451
 
449
452
  info.url = new URL(url.origin + pathname + url.search + url.hash);
450
453
 
451
- if (details) {
452
- const change = details.replaceState ? 0 : 1;
453
- details.state['sveltekit:index'] = this.current_history_index += change;
454
- history[details.replaceState ? 'replaceState' : 'pushState'](details.state, '', info.url);
455
- }
454
+ const token = (this.navigating_token = {});
456
455
 
457
456
  await this.renderer.handle_navigation(info, chain, false, {
458
457
  scroll,
@@ -460,12 +459,19 @@ class Router {
460
459
  });
461
460
 
462
461
  this.navigating--;
463
- if (!this.navigating) {
464
- dispatchEvent(new CustomEvent('sveltekit:navigation-end'));
465
462
 
463
+ // navigation was aborted
464
+ if (this.navigating_token !== token) return;
465
+ if (!this.navigating) {
466
466
  const navigation = { from, to: url };
467
467
  this.callbacks.after_navigate.forEach((fn) => fn(navigation));
468
468
  }
469
+
470
+ if (details) {
471
+ const change = details.replaceState ? 0 : 1;
472
+ details.state['sveltekit:index'] = this.current_history_index += change;
473
+ history[details.replaceState ? 'replaceState' : 'pushState'](details.state, '', info.url);
474
+ }
469
475
  }
470
476
  }
471
477
 
@@ -892,11 +898,10 @@ class Renderer {
892
898
  });
893
899
  } else {
894
900
  if (this.router) {
895
- this.router.goto(
896
- new URL(navigation_result.redirect, info.url).href,
897
- { replaceState: true },
898
- [...chain, info.url.pathname]
899
- );
901
+ this.router.goto(new URL(navigation_result.redirect, info.url).href, {}, [
902
+ ...chain,
903
+ info.url.pathname
904
+ ]);
900
905
  } else {
901
906
  location.href = new URL(navigation_result.redirect, location.href).href;
902
907
  }
@@ -1305,7 +1305,7 @@ async function render_response({
1305
1305
  }
1306
1306
  }
1307
1307
 
1308
- if (state.prerender) {
1308
+ if (state.prerender && !options.amp) {
1309
1309
  const http_equiv = [];
1310
1310
 
1311
1311
  const csp_headers = csp.get_meta();
@@ -1491,7 +1491,7 @@ function is_root_relative(path) {
1491
1491
 
1492
1492
  /**
1493
1493
  * @param {string} path
1494
- * @param {'always' | 'never' | 'ignore'} trailing_slash
1494
+ * @param {import('types').TrailingSlash} trailing_slash
1495
1495
  */
1496
1496
  function normalize_path(path, trailing_slash) {
1497
1497
  if (path === '/' || trailing_slash === 'ignore') return path;
@@ -1637,8 +1637,6 @@ async function load_node({
1637
1637
  }
1638
1638
  }
1639
1639
 
1640
- opts.headers.set('referer', event.url.href);
1641
-
1642
1640
  const resolved = resolve(event.url.pathname, requested.split('?')[0]);
1643
1641
 
1644
1642
  /** @type {Response} */
@@ -144,6 +144,24 @@ async function create_plugin(config, cwd) {
144
144
  };
145
145
  }
146
146
 
147
+ /** @param {Error} error */
148
+ function fix_stack_trace(error) {
149
+ // TODO https://github.com/vitejs/vite/issues/7045
150
+
151
+ // ideally vite would expose ssrRewriteStacktrace, but
152
+ // in lieu of that, we can implement it ourselves. we
153
+ // don't want to mutate the error object, because
154
+ // the stack trace could be 'fixed' multiple times,
155
+ // and Vite will fix stack traces before we even
156
+ // see them if they occur during ssrLoadModule
157
+ const original = error.stack;
158
+ vite.ssrFixStacktrace(error);
159
+ const fixed = error.stack;
160
+ error.stack = original;
161
+
162
+ return fixed;
163
+ }
164
+
147
165
  update_manifest();
148
166
 
149
167
  vite.watcher.on('add', update_manifest);
@@ -248,13 +266,19 @@ async function create_plugin(config, cwd) {
248
266
  dev: true,
249
267
  floc: config.kit.floc,
250
268
  get_stack: (error) => {
251
- vite.ssrFixStacktrace(error);
252
- return error.stack;
269
+ return fix_stack_trace(error);
253
270
  },
254
271
  handle_error: (error, event) => {
255
- vite.ssrFixStacktrace(error);
256
272
  hooks.handleError({
257
- error,
273
+ error: new Proxy(error, {
274
+ get: (target, property) => {
275
+ if (property === 'stack') {
276
+ return fix_stack_trace(error);
277
+ }
278
+
279
+ return Reflect.get(target, property, target);
280
+ }
281
+ }),
258
282
  event,
259
283
 
260
284
  // TODO remove for 1.0
@@ -57,7 +57,7 @@ function is_root_relative(path) {
57
57
 
58
58
  /**
59
59
  * @param {string} path
60
- * @param {'always' | 'never' | 'ignore'} trailing_slash
60
+ * @param {import('types').TrailingSlash} trailing_slash
61
61
  */
62
62
  function normalize_path(path, trailing_slash) {
63
63
  if (path === '/' || trailing_slash === 'ignore') return path;
package/dist/cli.js CHANGED
@@ -422,7 +422,7 @@ function get_mime_lookup(manifest_data) {
422
422
  return mime;
423
423
  }
424
424
 
425
- /** @param {import('@sveltejs/kit').ValidatedConfig} config */
425
+ /** @param {import('types').ValidatedConfig} config */
426
426
  function get_aliases(config) {
427
427
  const alias = {
428
428
  __GENERATED__: path__default.posix.resolve(`${SVELTE_KIT}/generated`),
@@ -998,7 +998,7 @@ async function launch(port, https) {
998
998
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
999
999
  }
1000
1000
 
1001
- const prog = sade('svelte-kit').version('1.0.0-next.283');
1001
+ const prog = sade('svelte-kit').version('1.0.0-next.286');
1002
1002
 
1003
1003
  prog
1004
1004
  .command('dev')
@@ -1156,7 +1156,7 @@ async function check_port(port) {
1156
1156
  function welcome({ port, host, https, open, loose, allow, cwd }) {
1157
1157
  if (open) launch(port, https);
1158
1158
 
1159
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.283'}\n`));
1159
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.286'}\n`));
1160
1160
 
1161
1161
  const protocol = https ? 'https:' : 'http:';
1162
1162
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/dist/node.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Readable } from 'stream';
2
2
 
3
- /** @type {import('@sveltejs/kit/node').GetRawBody} */
3
+ /** @param {import('http').IncomingMessage} req */
4
4
  function get_raw_body(req) {
5
5
  return new Promise((fulfil, reject) => {
6
6
  const h = req.headers;
@@ -50,7 +50,7 @@ function get_raw_body(req) {
50
50
  });
51
51
  }
52
52
 
53
- /** @type {import('@sveltejs/kit/node').GetRequest} */
53
+ /** @type {import('@sveltejs/kit/node').getRequest} */
54
54
  async function getRequest(base, req) {
55
55
  let headers = /** @type {Record<string, string>} */ (req.headers);
56
56
  if (req.httpVersionMajor === 2) {
@@ -69,9 +69,8 @@ async function getRequest(base, req) {
69
69
  });
70
70
  }
71
71
 
72
- /** @type {import('@sveltejs/kit/node').SetResponse} */
72
+ /** @type {import('@sveltejs/kit/node').setResponse} */
73
73
  async function setResponse(res, response) {
74
- /** @type {import('types').ResponseHeaders} */
75
74
  const headers = Object.fromEntries(response.headers);
76
75
 
77
76
  if (response.headers.has('set-cookie')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.283",
3
+ "version": "1.0.0-next.286",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -1,15 +1,52 @@
1
- /* eslint-disable import/no-duplicates */
2
-
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
+ */
3
20
  declare namespace App {
4
- interface Locals {}
5
- interface Platform {}
6
- interface Session {}
7
- interface Stuff {}
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 {}
8
40
  }
9
41
 
42
+ /**
43
+ * ```ts
44
+ * import { amp, browser, dev, mode, prerendering } from '$app/env';
45
+ * ```
46
+ */
10
47
  declare module '$app/env' {
11
48
  /**
12
- * Whether or not app is in AMP mode.
49
+ * Whether or not the app is running in [AMP mode](/docs/seo#manual-setup-amp).
13
50
  */
14
51
  export const amp: boolean;
15
52
  /**
@@ -32,14 +69,27 @@ declare module '$app/env' {
32
69
  export const mode: string;
33
70
  }
34
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
+ */
35
85
  declare module '$app/navigation' {
36
86
  /**
37
- * Disable SvelteKit's built-in scroll handling for the current navigation, in case you need to manually control the scroll position.
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.
38
88
  * This is generally discouraged, since it breaks user expectations.
39
89
  */
40
90
  export function disableScrollHandling(): void;
41
91
  /**
42
- * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified href.
92
+ * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `href`.
43
93
  *
44
94
  * @param href Where to navigate to
45
95
  * @param opts.replaceState If `true`, will replace the current `history` entry rather than creating a new one with `pushState`
@@ -50,12 +100,12 @@ declare module '$app/navigation' {
50
100
  export function goto(
51
101
  href: string,
52
102
  opts?: { replaceState?: boolean; noscroll?: boolean; keepfocus?: boolean; state?: any }
53
- ): Promise<any>;
103
+ ): Promise<void>;
54
104
  /**
55
- * Returns a Promise that resolves when SvelteKit re-runs any current `load` functions that depend on `href`
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.
56
106
  * @param href The invalidated resource
57
107
  */
58
- export function invalidate(href: string): Promise<any>;
108
+ export function invalidate(href: string): Promise<void>;
59
109
  /**
60
110
  * Programmatically prefetches the given page, which means
61
111
  * 1. ensuring that the code for the page is loaded, and
@@ -67,7 +117,7 @@ declare module '$app/navigation' {
67
117
  *
68
118
  * @param href Page to prefetch
69
119
  */
70
- export function prefetch(href: string): Promise<any>;
120
+ export function prefetch(href: string): Promise<void>;
71
121
  /**
72
122
  * Programmatically prefetches the code for routes that haven't yet been fetched.
73
123
  * Typically, you might call this to speed up subsequent navigation.
@@ -78,92 +128,108 @@ declare module '$app/navigation' {
78
128
  * Unlike prefetch, this won't call preload for individual pages.
79
129
  * Returns a Promise that resolves when the routes have been prefetched.
80
130
  */
81
- export function prefetchRoutes(routes?: string[]): Promise<any>;
131
+ export function prefetchRoutes(routes?: string[]): Promise<void>;
82
132
 
83
133
  /**
84
- * A navigation interceptor that triggers before we navigate to a new route.
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.
85
135
  * This is helpful if we want to conditionally prevent a navigation from completing or lookup the upcoming url.
86
136
  */
87
137
  export function beforeNavigate(
88
- fn: ({ from, to, cancel }: { from: URL; to: URL | null; cancel: () => void }) => void
89
- ): any;
138
+ fn: (navigation: { from: URL; to: URL | null; cancel: () => void }) => void
139
+ ): void;
90
140
 
91
141
  /**
92
142
  * A lifecycle function that runs when the page mounts, and also whenever SvelteKit navigates to a new URL but stays on this component.
93
143
  */
94
- export function afterNavigate(fn: ({ from, to }: { from: URL | null; to: URL }) => void): any;
144
+ export function afterNavigate(fn: (navigation: { from: URL | null; to: URL }) => void): void;
95
145
  }
96
146
 
147
+ /**
148
+ * ```ts
149
+ * import { base, assets } from '$app/paths';
150
+ * ```
151
+ */
97
152
  declare module '$app/paths' {
98
153
  /**
99
- * A root-relative (i.e. begins with a `/`) string that matches `config.kit.paths.base` in your project configuration.
154
+ * A string that matches [`config.kit.paths.base`](/docs/configuration#paths). It must begin, but not end, with a `/`.
100
155
  */
101
- export const base: string;
156
+ export const base: `/${string}`;
102
157
  /**
103
- * A root-relative or absolute path that matches `config.kit.paths.assets` (after it has been resolved against base).
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.
104
161
  */
105
- export const assets: string;
162
+ export const assets: `https://${string}` | `http://${string}`;
106
163
  }
107
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
+ */
108
174
  declare module '$app/stores' {
109
175
  import { Readable, Writable } from 'svelte/store';
110
- type Navigating = { from: URL; to: URL };
176
+ import { Navigation, Page } from '@sveltejs/kit';
111
177
 
112
178
  /**
113
- * A convenience function around `getContext` that returns `{ navigating, page, session }`.
114
- * Most of the time, you won't need to use it.
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.
115
181
  */
116
182
  export function getStores(): {
117
183
  navigating: typeof navigating;
118
184
  page: typeof page;
119
- session: Writable<App.Session>;
185
+ session: typeof session;
120
186
  updated: typeof updated;
121
187
  };
188
+
122
189
  /**
123
190
  * A readable store whose value contains page data.
124
191
  */
125
- export const page: Readable<{
126
- url: URL;
127
- params: Record<string, string>;
128
- stuff: App.Stuff;
129
- status: number;
130
- error: Error | null;
131
- }>;
192
+ export const page: Readable<Page>;
132
193
  /**
133
194
  * A readable store.
134
- * When navigating starts, its value is `{ from: URL, to: URL }`
195
+ * When navigating starts, its value is `{ from: URL, to: URL }`,
135
196
  * When navigating finishes, its value reverts to `null`.
136
197
  */
137
- export const navigating: Readable<Navigating | null>;
198
+ export const navigating: Readable<Navigation | null>;
138
199
  /**
139
- * A writable store whose initial value is whatever was returned from `getSession`.
200
+ * A writable store whose initial value is whatever was returned from [`getSession`](/docs/hooks#getsession).
140
201
  * It can be written to, but this will not cause changes to persist on the server — this is something you must implement yourself.
141
202
  */
142
203
  export const session: Writable<App.Session>;
143
204
  /**
144
- * A writable store indicating if the site was updated since the store was created.
145
- * It can be written to when custom logic is required to detect updates.
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.
146
206
  */
147
207
  export const updated: Readable<boolean> & { check: () => boolean };
148
208
  }
149
209
 
210
+ /**
211
+ * This is a simple alias to `src/lib`, or whatever directory is specified as [`config.kit.files.lib`](/docs/configuration#files). It allows you to access common components and utility modules without `../../../../` nonsense.
212
+ */
213
+ declare module '$lib' {}
214
+
215
+ /**
216
+ * ```ts
217
+ * import { build, files, timestamp } from '$service-worker';
218
+ * ```
219
+ *
220
+ * This module is only available to [service workers](/docs/service-workers).
221
+ */
150
222
  declare module '$service-worker' {
151
223
  /**
152
224
  * An array of URL strings representing the files generated by Vite, suitable for caching with `cache.addAll(build)`.
153
- * This is only available to service workers.
154
225
  */
155
226
  export const build: string[];
156
227
  /**
157
- * An array of URL strings representing the files in your static directory,
158
- * or whatever directory is specified by `config.kit.files.assets`.
159
- * This is only available to service workers.
228
+ * 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)
160
229
  */
161
230
  export const files: string[];
162
231
  /**
163
- * The result of calling `Date.now()` at build time.
164
- * It's useful for generating unique cache names inside your service worker,
165
- * so that a later deployment of your app can invalidate old caches.
166
- * This is only available to service workers.
232
+ * The result of calling `Date.now()` at build time. It's useful for generating unique cache names inside your service worker, so that a later deployment of your app can invalidate old caches.
167
233
  */
168
234
  export const timestamp: number;
169
235
  }
@@ -172,33 +238,48 @@ declare module '@sveltejs/kit/hooks' {
172
238
  import { Handle } from '@sveltejs/kit';
173
239
 
174
240
  /**
175
- * Utility function that allows chaining `handle` functions in a
176
- * middleware-like manner.
241
+ * A helper function for sequencing multiple `handle` calls in a middleware-like manner.
242
+ *
243
+ * ```js
244
+ * /// file: src/hooks.js
245
+ * import { sequence } from '@sveltejs/kit/hooks';
246
+ *
247
+ * /** @type {import('@sveltejs/kit').Handle} *\/
248
+ * async function first({ event, resolve }) {
249
+ * console.log('first pre-processing');
250
+ * const result = await resolve(event);
251
+ * console.log('first post-processing');
252
+ * return result;
253
+ * }
254
+ *
255
+ * /** @type {import('@sveltejs/kit').Handle} *\/
256
+ * async function second({ event, resolve }) {
257
+ * console.log('second pre-processing');
258
+ * const result = await resolve(event);
259
+ * console.log('second post-processing');
260
+ * return result;
261
+ * }
262
+ *
263
+ * export const handle = sequence(first, second);
264
+ * ```
265
+ *
266
+ * The example above would print:
267
+ *
268
+ * ```
269
+ * first pre-processing
270
+ * second pre-processing
271
+ * second post-processing
272
+ * first post-processing
273
+ * ```
177
274
  *
178
275
  * @param handlers The chain of `handle` functions
179
276
  */
180
277
  export function sequence(...handlers: Handle[]): Handle;
181
278
  }
182
279
 
183
- declare module '@sveltejs/kit/node' {
184
- import { IncomingMessage, ServerResponse } from 'http';
185
-
186
- export interface GetRawBody {
187
- (request: IncomingMessage): Promise<Uint8Array | null>;
188
- }
189
- export const getRawBody: GetRawBody;
190
-
191
- export interface GetRequest {
192
- (base: string, request: IncomingMessage): Promise<Request>;
193
- }
194
- export const getRequest: GetRequest;
195
-
196
- export interface SetResponse {
197
- (res: ServerResponse, response: Response): void;
198
- }
199
- export const setResponse: SetResponse;
200
- }
201
-
280
+ /**
281
+ * A polyfill for `fetch` and its related interfaces, used by adapters for environments that don't provide a native implementation.
282
+ */
202
283
  declare module '@sveltejs/kit/install-fetch' {
203
284
  import fetch, { Headers, Request, Response } from 'node-fetch';
204
285
 
@@ -206,3 +287,14 @@ declare module '@sveltejs/kit/install-fetch' {
206
287
 
207
288
  export { fetch, Headers, Request, Response };
208
289
  }
290
+
291
+ /**
292
+ * Utilities used by adapters for Node-like environments.
293
+ */
294
+ declare module '@sveltejs/kit/node' {
295
+ export function getRequest(
296
+ base: string,
297
+ request: import('http').IncomingMessage
298
+ ): Promise<Request>;
299
+ export function setResponse(res: import('http').ServerResponse, response: Response): void;
300
+ }