@sveltejs/kit 2.4.3 → 2.5.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "2.4.3",
3
+ "version": "2.5.1",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,10 +33,10 @@
33
33
  "@types/set-cookie-parser": "^2.4.7",
34
34
  "dts-buddy": "^0.4.3",
35
35
  "rollup": "^4.9.5",
36
- "svelte": "^4.2.8",
36
+ "svelte": "^4.2.10",
37
37
  "svelte-preprocess": "^5.1.3",
38
38
  "typescript": "^5.3.3",
39
- "vite": "^5.0.11",
39
+ "vite": "^5.1.0",
40
40
  "vitest": "^1.2.0"
41
41
  },
42
42
  "peerDependencies": {
@@ -19,7 +19,8 @@ export async function adapt(
19
19
  log,
20
20
  vite_config
21
21
  ) {
22
- const { name, adapt } = config.kit.adapter;
22
+ // This is only called when adapter is truthy, so the cast is safe
23
+ const { name, adapt } = /** @type {import('@sveltejs/kit').Adapter} */ (config.kit.adapter);
23
24
 
24
25
  console.log(colors.bold().cyan(`\n> Using ${name}`));
25
26
 
@@ -92,6 +92,8 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
92
92
  /** @type {import('types').ValidatedKitConfig} */
93
93
  const config = (await load_config()).kit;
94
94
 
95
+ const emulator = await config.adapter?.emulate?.();
96
+
95
97
  /** @type {import('types').Logger} */
96
98
  const log = logger({ verbose });
97
99
 
@@ -211,7 +213,8 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
211
213
 
212
214
  // stuff in `static`
213
215
  return readFileSync(join(config.files.assets, file));
214
- }
216
+ },
217
+ emulator
215
218
  });
216
219
 
217
220
  const encoded_id = response.headers.get('x-sveltekit-routeid');
@@ -3,6 +3,7 @@ import { BROWSER, DEV } from 'esm-env';
3
3
 
4
4
  export { VERSION } from '../version.js';
5
5
 
6
+ // TODO 3.0: remove these types as they are not used anymore (we can't remove them yet because that would be a breaking change)
6
7
  /**
7
8
  * @template {number} TNumber
8
9
  * @template {any[]} [TArray=[]]
@@ -15,6 +16,9 @@ export { VERSION } from '../version.js';
15
16
  * @typedef {Exclude<TEnd | LessThan<TEnd>, LessThan<TStart>>} NumericRange
16
17
  */
17
18
 
19
+ // Keep the status codes as `number` because restricting to certain numbers makes it unnecessarily hard to use compared to the benefits
20
+ // (we have runtime errors already to check for invalid codes). Also see https://github.com/sveltejs/kit/issues/11780
21
+
18
22
  // we have to repeat the JSDoc because the display for function overloads is broken
19
23
  // see https://github.com/microsoft/TypeScript/issues/55056
20
24
 
@@ -23,10 +27,10 @@ export { VERSION } from '../version.js';
23
27
  * When called during request handling, this will cause SvelteKit to
24
28
  * return an error response without invoking `handleError`.
25
29
  * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
26
- * @param {NumericRange<400, 599>} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
30
+ * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
27
31
  * @param {App.Error} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
28
32
  * @overload
29
- * @param {NumericRange<400, 599>} status
33
+ * @param {number} status
30
34
  * @param {App.Error} body
31
35
  * @return {never}
32
36
  * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
@@ -37,10 +41,10 @@ export { VERSION } from '../version.js';
37
41
  * When called during request handling, this will cause SvelteKit to
38
42
  * return an error response without invoking `handleError`.
39
43
  * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
40
- * @param {NumericRange<400, 599>} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
44
+ * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
41
45
  * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body] An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
42
46
  * @overload
43
- * @param {NumericRange<400, 599>} status
47
+ * @param {number} status
44
48
  * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body]
45
49
  * @return {never}
46
50
  * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
@@ -51,7 +55,7 @@ export { VERSION } from '../version.js';
51
55
  * When called during request handling, this will cause SvelteKit to
52
56
  * return an error response without invoking `handleError`.
53
57
  * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
54
- * @param {NumericRange<400, 599>} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
58
+ * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
55
59
  * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
56
60
  * @return {never}
57
61
  * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
@@ -80,7 +84,7 @@ export function isHttpError(e, status) {
80
84
  /**
81
85
  * Redirect a request. When called during request handling, SvelteKit will return a redirect response.
82
86
  * Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it.
83
- * @param {NumericRange<300, 308>} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
87
+ * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number)} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
84
88
  * @param {string | URL} location The location to redirect to.
85
89
  * @throws {Redirect} This error instructs SvelteKit to redirect to the specified location.
86
90
  * @throws {Error} If the provided status is invalid.
@@ -91,7 +95,11 @@ export function redirect(status, location) {
91
95
  throw new Error('Invalid status code');
92
96
  }
93
97
 
94
- throw new Redirect(status, location.toString());
98
+ throw new Redirect(
99
+ // @ts-ignore
100
+ status,
101
+ location.toString()
102
+ );
95
103
  }
96
104
 
97
105
  /**
@@ -45,6 +45,11 @@ export interface Adapter {
45
45
  */
46
46
  read?: (details: { config: any; route: { id: string } }) => boolean;
47
47
  };
48
+ /**
49
+ * Creates an `Emulator`, which allows the adapter to influence the environment
50
+ * during dev, build and prerendering
51
+ */
52
+ emulate?(): MaybePromise<Emulator>;
48
53
  }
49
54
 
50
55
  export type LoadProperties<input extends Record<string, any> | void> = input extends void
@@ -74,11 +79,12 @@ export interface ActionFailure<T extends Record<string, unknown> | undefined = u
74
79
  [uniqueSymbol]: true; // necessary or else UnpackValidationError could wrongly unpack objects with the same shape as ActionFailure
75
80
  }
76
81
 
77
- type UnpackValidationError<T> = T extends ActionFailure<infer X>
78
- ? X
79
- : T extends void
80
- ? undefined // needs to be undefined, because void will corrupt union type
81
- : T;
82
+ type UnpackValidationError<T> =
83
+ T extends ActionFailure<infer X>
84
+ ? X
85
+ : T extends void
86
+ ? undefined // needs to be undefined, because void will corrupt union type
87
+ : T;
82
88
 
83
89
  /**
84
90
  * This object is passed to the `adapt` function of adapters.
@@ -260,6 +266,17 @@ export interface Cookies {
260
266
  ): string;
261
267
  }
262
268
 
269
+ /**
270
+ * A collection of functions that influence the environment during dev, build and prerendering
271
+ */
272
+ export interface Emulator {
273
+ /**
274
+ * A function that is called with the current route `config` and `prerender` option
275
+ * and returns an `App.Platform` object
276
+ */
277
+ platform?(details: { config: any; prerender: PrerenderOption }): MaybePromise<App.Platform>;
278
+ }
279
+
263
280
  export interface KitConfig {
264
281
  /**
265
282
  * Your [adapter](https://kit.svelte.dev/docs/adapters) is run when executing `vite build`. It determines how the output is converted for different platforms.
@@ -8,7 +8,7 @@ import { isCSSRequest, loadEnv, buildErrorMessage } from 'vite';
8
8
  import { createReadableStream, getRequest, setResponse } from '../../../exports/node/index.js';
9
9
  import { installPolyfills } from '../../../exports/node/polyfills.js';
10
10
  import { coalesce_to_error } from '../../../utils/error.js';
11
- import { posixify, resolve_entry, to_fs } from '../../../utils/filesystem.js';
11
+ import { from_fs, posixify, resolve_entry, to_fs } from '../../../utils/filesystem.js';
12
12
  import { load_error_page } from '../../../core/config/index.js';
13
13
  import { SVELTE_KIT_ASSETS } from '../../../constants.js';
14
14
  import * as sync from '../../../core/sync/sync.js';
@@ -87,7 +87,7 @@ export async function dev(vite, vite_config, svelte_config) {
87
87
 
88
88
  /** @param {string} id */
89
89
  async function resolve(id) {
90
- const url = id.startsWith('..') ? `/@fs${path.posix.resolve(id)}` : `/${id}`;
90
+ const url = id.startsWith('..') ? to_fs(path.posix.resolve(id)) : `/${id}`;
91
91
 
92
92
  const module = await loud_ssr_load_module(url);
93
93
 
@@ -137,8 +137,8 @@ export async function dev(vite, vite_config, svelte_config) {
137
137
  server_assets: new Proxy(
138
138
  {},
139
139
  {
140
- has: (_, /** @type {string} */ file) => fs.existsSync(file.replace(/^\/@fs/, '')),
141
- get: (_, /** @type {string} */ file) => fs.statSync(file.replace(/^\/@fs/, '')).size
140
+ has: (_, /** @type {string} */ file) => fs.existsSync(from_fs(file)),
141
+ get: (_, /** @type {string} */ file) => fs.statSync(from_fs(file)).size
142
142
  }
143
143
  ),
144
144
  nodes: manifest_data.nodes.map((node, index) => {
@@ -419,6 +419,7 @@ export async function dev(vite, vite_config, svelte_config) {
419
419
  });
420
420
 
421
421
  const env = loadEnv(vite_config.mode, svelte_config.kit.env.dir, '');
422
+ const emulator = await svelte_config.kit.adapter?.emulate?.();
422
423
 
423
424
  return () => {
424
425
  const serve_static_middleware = vite.middlewares.stack.find(
@@ -490,7 +491,7 @@ export async function dev(vite, vite_config, svelte_config) {
490
491
 
491
492
  await server.init({
492
493
  env,
493
- read: (file) => createReadableStream(file.replace(/^\/@fs/, ''))
494
+ read: (file) => createReadableStream(from_fs(file))
494
495
  });
495
496
 
496
497
  const request = await getRequest({
@@ -529,7 +530,8 @@ export async function dev(vite, vite_config, svelte_config) {
529
530
  read: (file) => fs.readFileSync(path.join(svelte_config.kit.files.assets, file)),
530
531
  before_handle: (event, config, prerender) => {
531
532
  async_local_storage.enterWith({ event, config, prerender });
532
- }
533
+ },
534
+ emulator
533
535
  });
534
536
 
535
537
  if (rendered.status === 404) {
@@ -164,7 +164,6 @@ export async function sveltekit() {
164
164
  preprocess,
165
165
  onwarn: svelte_config.onwarn,
166
166
  compilerOptions: {
167
- // @ts-expect-error SvelteKit requires hydratable true by default
168
167
  hydratable: isSvelte5Plus() ? undefined : true,
169
168
  ...svelte_config.compilerOptions
170
169
  },
@@ -51,6 +51,8 @@ export async function preview(vite, vite_config, svelte_config) {
51
51
  read: (file) => createReadableStream(`${dir}/${file}`)
52
52
  });
53
53
 
54
+ const emulator = await svelte_config.kit.adapter?.emulate?.();
55
+
54
56
  return () => {
55
57
  // Remove the base middleware. It screws with the URL.
56
58
  // It also only lets through requests beginning with the base path, so that requests beginning
@@ -191,7 +193,8 @@ export async function preview(vite, vite_config, svelte_config) {
191
193
  if (remoteAddress) return remoteAddress;
192
194
  throw new Error('Could not determine clientAddress');
193
195
  },
194
- read: (file) => fs.readFileSync(join(svelte_config.kit.files.assets, file))
196
+ read: (file) => fs.readFileSync(join(svelte_config.kit.files.assets, file)),
197
+ emulator
195
198
  })
196
199
  );
197
200
  });
@@ -67,6 +67,8 @@ const snapshots = storage.get(SNAPSHOT_KEY) ?? {};
67
67
  if (DEV && BROWSER) {
68
68
  let warned = false;
69
69
 
70
+ const current_module_url = import.meta.url.split('?')[0]; // remove query params that vite adds to the URL when it is loaded from node_modules
71
+
70
72
  const warn = () => {
71
73
  if (warned) return;
72
74
 
@@ -76,7 +78,8 @@ if (DEV && BROWSER) {
76
78
  if (!stack) return;
77
79
  if (!stack[0].includes('https:') && !stack[0].includes('http:')) stack = stack.slice(1); // Chrome includes the error message in the stack
78
80
  stack = stack.slice(2); // remove `warn` and the place where `warn` was called
79
- if (stack[0].includes(import.meta.url)) return;
81
+ // Can be falsy if was called directly from an anonymous function
82
+ if (stack[0]?.includes(current_module_url)) return;
80
83
 
81
84
  warned = true;
82
85
 
@@ -305,20 +308,23 @@ async function _invalidate() {
305
308
 
306
309
  const nav_token = (token = {});
307
310
  const navigation_result = intent && (await load_route(intent));
308
- if (nav_token !== token) return;
311
+ if (!navigation_result || nav_token !== token) return;
309
312
 
310
- if (navigation_result) {
311
- if (navigation_result.type === 'redirect') {
312
- await _goto(new URL(navigation_result.location, current.url).href, {}, 1, nav_token);
313
- } else {
314
- if (navigation_result.props.page !== undefined) {
315
- page = navigation_result.props.page;
316
- }
317
- root.$set(navigation_result.props);
318
- }
313
+ if (navigation_result.type === 'redirect') {
314
+ return _goto(new URL(navigation_result.location, current.url).href, {}, 1, nav_token);
315
+ }
316
+
317
+ if (navigation_result.props.page) {
318
+ page = navigation_result.props.page;
319
319
  }
320
+ current = navigation_result.state;
321
+ reset_invalidation();
322
+ root.$set(navigation_result.props);
323
+ }
320
324
 
325
+ function reset_invalidation() {
321
326
  invalidated.length = 0;
327
+ force_invalidation = false;
322
328
  }
323
329
 
324
330
  /** @param {number} index */
@@ -1089,6 +1095,9 @@ async function load_root_error_page({ status, error, url, route }) {
1089
1095
  }
1090
1096
 
1091
1097
  /**
1098
+ * Resolve the full info (which route, params, etc.) for a client-side navigation from the URL,
1099
+ * taking the reroute hook into account. If this isn't a client-side-navigation (or the URL is undefined),
1100
+ * returns undefined.
1092
1101
  * @param {URL | undefined} url
1093
1102
  * @param {boolean} invalidating
1094
1103
  */
@@ -1278,8 +1287,7 @@ async function navigate({
1278
1287
 
1279
1288
  // reset invalidation only after a finished navigation. If there are redirects or
1280
1289
  // additional invalidations, they should get the same invalidation treatment
1281
- invalidated.length = 0;
1282
- force_invalidation = false;
1290
+ reset_invalidation();
1283
1291
 
1284
1292
  updating = true;
1285
1293
 
@@ -1818,6 +1826,7 @@ export function pushState(url, state) {
1818
1826
  };
1819
1827
 
1820
1828
  history.pushState(opts, '', resolve_url(url));
1829
+ has_navigated = true;
1821
1830
 
1822
1831
  page = { ...page, state };
1823
1832
  root.$set({ page });
@@ -271,7 +271,7 @@ export async function respond(request, options, manifest, state) {
271
271
  }
272
272
  }
273
273
 
274
- if (DEV && state.before_handle) {
274
+ if (state.before_handle || state.emulator?.platform) {
275
275
  let config = {};
276
276
 
277
277
  /** @type {import('types').PrerenderOption} */
@@ -283,11 +283,17 @@ export async function respond(request, options, manifest, state) {
283
283
  prerender = node.prerender ?? prerender;
284
284
  } else if (route.page) {
285
285
  const nodes = await load_page_nodes(route.page, manifest);
286
- config = get_page_config(nodes);
286
+ config = get_page_config(nodes) ?? config;
287
287
  prerender = get_option(nodes, 'prerender') ?? false;
288
288
  }
289
289
 
290
- state.before_handle(event, config, prerender);
290
+ if (state.before_handle) {
291
+ state.before_handle(event, config, prerender);
292
+ }
293
+
294
+ if (state.emulator?.platform) {
295
+ event.platform = await state.emulator.platform({ config, prerender });
296
+ }
291
297
  }
292
298
  }
293
299
 
@@ -15,7 +15,9 @@ import {
15
15
  HandleClientError,
16
16
  Reroute,
17
17
  RequestEvent,
18
- SSRManifest
18
+ SSRManifest,
19
+ Emulator,
20
+ Adapter
19
21
  } from '@sveltejs/kit';
20
22
  import {
21
23
  HttpMethod,
@@ -128,6 +130,7 @@ export class InternalServer extends Server {
128
130
  read: (file: string) => Buffer;
129
131
  /** A hook called before `handle` during dev, so that `AsyncLocalStorage` can be populated */
130
132
  before_handle?: (event: RequestEvent, config: any, prerender: PrerenderOption) => void;
133
+ emulator?: Emulator;
131
134
  }
132
135
  ): Promise<Response>;
133
136
  }
@@ -418,6 +421,7 @@ export interface SSRState {
418
421
  prerender_default?: PrerenderOption;
419
422
  read?: (file: string) => Buffer;
420
423
  before_handle?: (event: RequestEvent, config: any, prerender: PrerenderOption) => void;
424
+ emulator?: Emulator;
421
425
  }
422
426
 
423
427
  export type StrictBody = string | ArrayBufferView;
@@ -431,9 +435,14 @@ export interface Uses {
431
435
  search_params: Set<string>;
432
436
  }
433
437
 
434
- export type ValidatedConfig = RecursiveRequired<Config>;
438
+ export type ValidatedConfig = Config & {
439
+ kit: ValidatedKitConfig;
440
+ extensions: string[];
441
+ };
435
442
 
436
- export type ValidatedKitConfig = RecursiveRequired<KitConfig>;
443
+ export type ValidatedKitConfig = Omit<RecursiveRequired<KitConfig>, 'adapter'> & {
444
+ adapter?: Adapter;
445
+ };
437
446
 
438
447
  export * from '../exports/index.js';
439
448
  export * from './private.js';
@@ -148,6 +148,19 @@ export function to_fs(str) {
148
148
  }${str}`;
149
149
  }
150
150
 
151
+ /**
152
+ * Removes `/@fs` prefix from given path and posixifies it
153
+ * @param {string} str
154
+ */
155
+ export function from_fs(str) {
156
+ str = posixify(str);
157
+ if (!str.startsWith('/@fs')) return str;
158
+
159
+ str = str.slice(4);
160
+ // Windows/Linux separation - Windows starts with a drive letter, we need to strip the additional / here
161
+ return str[2] === ':' && /[A-Z]/.test(str[1]) ? str.slice(1) : str;
162
+ }
163
+
151
164
  /**
152
165
  * Given an entry point like [cwd]/src/hooks, returns a filename like [cwd]/src/hooks.js or [cwd]/src/hooks/index.js
153
166
  * @param {string} entry
@@ -16,5 +16,6 @@ export function get_page_config(nodes) {
16
16
  };
17
17
  }
18
18
 
19
+ // TODO 3.0 always return `current`? then we can get rid of `?? {}` in other places
19
20
  return Object.keys(current).length ? current : undefined;
20
21
  }
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // generated during release, do not modify
2
2
 
3
3
  /** @type {string} */
4
- export const VERSION = '2.4.3';
4
+ export const VERSION = '2.5.1';
package/types/index.d.ts CHANGED
@@ -27,6 +27,11 @@ declare module '@sveltejs/kit' {
27
27
  */
28
28
  read?: (details: { config: any; route: { id: string } }) => boolean;
29
29
  };
30
+ /**
31
+ * Creates an `Emulator`, which allows the adapter to influence the environment
32
+ * during dev, build and prerendering
33
+ */
34
+ emulate?(): MaybePromise<Emulator>;
30
35
  }
31
36
 
32
37
  export type LoadProperties<input extends Record<string, any> | void> = input extends void
@@ -56,11 +61,12 @@ declare module '@sveltejs/kit' {
56
61
  [uniqueSymbol]: true; // necessary or else UnpackValidationError could wrongly unpack objects with the same shape as ActionFailure
57
62
  }
58
63
 
59
- type UnpackValidationError<T> = T extends ActionFailure<infer X>
60
- ? X
61
- : T extends void
62
- ? undefined // needs to be undefined, because void will corrupt union type
63
- : T;
64
+ type UnpackValidationError<T> =
65
+ T extends ActionFailure<infer X>
66
+ ? X
67
+ : T extends void
68
+ ? undefined // needs to be undefined, because void will corrupt union type
69
+ : T;
64
70
 
65
71
  /**
66
72
  * This object is passed to the `adapt` function of adapters.
@@ -242,6 +248,17 @@ declare module '@sveltejs/kit' {
242
248
  ): string;
243
249
  }
244
250
 
251
+ /**
252
+ * A collection of functions that influence the environment during dev, build and prerendering
253
+ */
254
+ export interface Emulator {
255
+ /**
256
+ * A function that is called with the current route `config` and `prerender` option
257
+ * and returns an `App.Platform` object
258
+ */
259
+ platform?(details: { config: any; prerender: PrerenderOption }): MaybePromise<App.Platform>;
260
+ }
261
+
245
262
  export interface KitConfig {
246
263
  /**
247
264
  * Your [adapter](https://kit.svelte.dev/docs/adapters) is run when executing `vite build`. It determines how the output is converted for different platforms.
@@ -1732,7 +1749,14 @@ declare module '@sveltejs/kit' {
1732
1749
  endpoint_id?: string;
1733
1750
  }
1734
1751
 
1735
- type ValidatedConfig = RecursiveRequired<Config>;
1752
+ type ValidatedConfig = Config & {
1753
+ kit: ValidatedKitConfig;
1754
+ extensions: string[];
1755
+ };
1756
+
1757
+ type ValidatedKitConfig = Omit<RecursiveRequired<KitConfig>, 'adapter'> & {
1758
+ adapter?: Adapter;
1759
+ };
1736
1760
  /**
1737
1761
  * Throws an error with a HTTP status code and an optional message.
1738
1762
  * When called during request handling, this will cause SvelteKit to
@@ -1743,7 +1767,7 @@ declare module '@sveltejs/kit' {
1743
1767
  * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
1744
1768
  * @throws {Error} If the provided status is invalid (not between 400 and 599).
1745
1769
  */
1746
- export function error(status: NumericRange<400, 599>, body: App.Error): never;
1770
+ export function error(status: number, body: App.Error): never;
1747
1771
  /**
1748
1772
  * Throws an error with a HTTP status code and an optional message.
1749
1773
  * When called during request handling, this will cause SvelteKit to
@@ -1754,7 +1778,7 @@ declare module '@sveltejs/kit' {
1754
1778
  * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
1755
1779
  * @throws {Error} If the provided status is invalid (not between 400 and 599).
1756
1780
  */
1757
- export function error(status: NumericRange<400, 599>, body?: {
1781
+ export function error(status: number, body?: {
1758
1782
  message: string;
1759
1783
  } extends App.Error ? App.Error | string | undefined : never): never;
1760
1784
  /**
@@ -1772,7 +1796,7 @@ declare module '@sveltejs/kit' {
1772
1796
  * @throws {Redirect} This error instructs SvelteKit to redirect to the specified location.
1773
1797
  * @throws {Error} If the provided status is invalid.
1774
1798
  * */
1775
- export function redirect(status: NumericRange<300, 308>, location: string | URL): never;
1799
+ export function redirect(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number), location: string | URL): never;
1776
1800
  /**
1777
1801
  * Checks whether this is a redirect thrown by {@link redirect}.
1778
1802
  * @param e The object to check.
@@ -9,6 +9,7 @@
9
9
  "Builder",
10
10
  "Config",
11
11
  "Cookies",
12
+ "Emulator",
12
13
  "KitConfig",
13
14
  "Handle",
14
15
  "HandleServerError",
@@ -75,6 +76,7 @@
75
76
  "SSREndpoint",
76
77
  "SSRRoute",
77
78
  "ValidatedConfig",
79
+ "ValidatedKitConfig",
78
80
  "isHttpError",
79
81
  "redirect",
80
82
  "isRedirect",
@@ -152,5 +154,5 @@
152
154
  null,
153
155
  null
154
156
  ],
155
- "mappings": ";;;;;;;;;kBA2BiBA,OAAOA;;;;;;;;;;;;;;;;;;;;;;aAsBZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;;;;;;;;kBAeTC,aAAaA;;;;;;;;;;;;;;;;kBAgBbC,OAAOA;;;;;;;;;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