@sveltejs/kit 2.7.4 → 2.7.6
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 +1 -1
- package/src/exports/public.d.ts +3 -3
- package/src/exports/vite/index.js +16 -0
- package/src/runtime/server/cookie.js +13 -0
- package/src/types/ambient.d.ts +1 -1
- package/src/version.js +1 -1
- package/types/index.d.ts +4 -4
package/package.json
CHANGED
package/src/exports/public.d.ts
CHANGED
|
@@ -689,7 +689,7 @@ export type Handle = (input: {
|
|
|
689
689
|
}) => MaybePromise<Response>;
|
|
690
690
|
|
|
691
691
|
/**
|
|
692
|
-
* The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#
|
|
692
|
+
* The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) hook runs when an unexpected error is thrown while responding to a request.
|
|
693
693
|
*
|
|
694
694
|
* If an unexpected error is thrown during loading or rendering, this function will be called with the error and the event.
|
|
695
695
|
* Make sure that this function _never_ throws an error.
|
|
@@ -702,7 +702,7 @@ export type HandleServerError = (input: {
|
|
|
702
702
|
}) => MaybePromise<void | App.Error>;
|
|
703
703
|
|
|
704
704
|
/**
|
|
705
|
-
* The client-side [`handleError`](https://svelte.dev/docs/kit/hooks#
|
|
705
|
+
* The client-side [`handleError`](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) hook runs when an unexpected error is thrown while navigating.
|
|
706
706
|
*
|
|
707
707
|
* If an unexpected error is thrown during loading or the following render, this function will be called with the error and the event.
|
|
708
708
|
* Make sure that this function _never_ throws an error.
|
|
@@ -715,7 +715,7 @@ export type HandleClientError = (input: {
|
|
|
715
715
|
}) => MaybePromise<void | App.Error>;
|
|
716
716
|
|
|
717
717
|
/**
|
|
718
|
-
* The [`handleFetch`](https://svelte.dev/docs/kit/hooks#
|
|
718
|
+
* The [`handleFetch`](https://svelte.dev/docs/kit/hooks#Server-hooks-handleFetch) hook allows you to modify (or replace) a `fetch` request that happens inside a `load` function that runs on the server (or during pre-rendering)
|
|
719
719
|
*/
|
|
720
720
|
export type HandleFetch = (input: {
|
|
721
721
|
event: RequestEvent;
|
|
@@ -349,6 +349,22 @@ async function kit({ svelte_config }) {
|
|
|
349
349
|
* Stores the final config.
|
|
350
350
|
*/
|
|
351
351
|
configResolved(config) {
|
|
352
|
+
// we search for this plugin by name because we can't detect it
|
|
353
|
+
// since it doesn't directly modify the https config unlike the mkcert plugin
|
|
354
|
+
const vite_basic_ssl = config.plugins.find(({ name }) => name === 'vite:basic-ssl');
|
|
355
|
+
|
|
356
|
+
// by default, when enabling HTTPS in Vite, it also enables HTTP/2
|
|
357
|
+
// however, undici has not yet enabled HTTP/2 by default: https://github.com/nodejs/undici/issues/2750
|
|
358
|
+
// we set a no-op proxy config to force Vite to downgrade to TLS-only
|
|
359
|
+
// see https://vitejs.dev/config/#server-https
|
|
360
|
+
if ((config.server.https || vite_basic_ssl) && !config.server.proxy) {
|
|
361
|
+
config.server.proxy = {};
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if ((config.preview.https || vite_basic_ssl) && !config.preview.proxy) {
|
|
365
|
+
config.preview.proxy = {};
|
|
366
|
+
}
|
|
367
|
+
|
|
352
368
|
vite_config = config;
|
|
353
369
|
}
|
|
354
370
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { parse, serialize } from 'cookie';
|
|
2
2
|
import { add_data_suffix, normalize_path, resolve } from '../../utils/url.js';
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line no-control-regex -- control characters are invalid in cookie names
|
|
5
|
+
const INVALID_COOKIE_CHARACTER_REGEX = /[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/;
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* Tracks all cookies set during dev mode so we can emit warnings
|
|
6
9
|
* when we detect that there's likely cookie misusage due to wrong paths
|
|
@@ -113,6 +116,16 @@ export function get_cookies(request, url, trailing_slash) {
|
|
|
113
116
|
* @param {import('./page/types.js').Cookie['options']} options
|
|
114
117
|
*/
|
|
115
118
|
set(name, value, options) {
|
|
119
|
+
// TODO: remove this check in 3.0
|
|
120
|
+
const illegal_characters = name.match(INVALID_COOKIE_CHARACTER_REGEX);
|
|
121
|
+
if (illegal_characters) {
|
|
122
|
+
console.warn(
|
|
123
|
+
`The cookie name "${name}" will be invalid in SvelteKit 3.0 as it contains ${illegal_characters.join(
|
|
124
|
+
' and '
|
|
125
|
+
)}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
116
129
|
validate_options(options);
|
|
117
130
|
set_internal(name, value, { ...defaults, ...options });
|
|
118
131
|
},
|
package/src/types/ambient.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ declare namespace App {
|
|
|
46
46
|
export interface PageState {}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* If your adapter provides [platform-specific context](https://svelte.dev/docs/kit/adapters#
|
|
49
|
+
* If your adapter provides [platform-specific context](https://svelte.dev/docs/kit/adapters#Platform-specific-context) via `event.platform`, you can specify it here.
|
|
50
50
|
*/
|
|
51
51
|
export interface Platform {}
|
|
52
52
|
}
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -671,7 +671,7 @@ declare module '@sveltejs/kit' {
|
|
|
671
671
|
}) => MaybePromise<Response>;
|
|
672
672
|
|
|
673
673
|
/**
|
|
674
|
-
* The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#
|
|
674
|
+
* The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) hook runs when an unexpected error is thrown while responding to a request.
|
|
675
675
|
*
|
|
676
676
|
* If an unexpected error is thrown during loading or rendering, this function will be called with the error and the event.
|
|
677
677
|
* Make sure that this function _never_ throws an error.
|
|
@@ -684,7 +684,7 @@ declare module '@sveltejs/kit' {
|
|
|
684
684
|
}) => MaybePromise<void | App.Error>;
|
|
685
685
|
|
|
686
686
|
/**
|
|
687
|
-
* The client-side [`handleError`](https://svelte.dev/docs/kit/hooks#
|
|
687
|
+
* The client-side [`handleError`](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) hook runs when an unexpected error is thrown while navigating.
|
|
688
688
|
*
|
|
689
689
|
* If an unexpected error is thrown during loading or the following render, this function will be called with the error and the event.
|
|
690
690
|
* Make sure that this function _never_ throws an error.
|
|
@@ -697,7 +697,7 @@ declare module '@sveltejs/kit' {
|
|
|
697
697
|
}) => MaybePromise<void | App.Error>;
|
|
698
698
|
|
|
699
699
|
/**
|
|
700
|
-
* The [`handleFetch`](https://svelte.dev/docs/kit/hooks#
|
|
700
|
+
* The [`handleFetch`](https://svelte.dev/docs/kit/hooks#Server-hooks-handleFetch) hook allows you to modify (or replace) a `fetch` request that happens inside a `load` function that runs on the server (or during pre-rendering)
|
|
701
701
|
*/
|
|
702
702
|
export type HandleFetch = (input: {
|
|
703
703
|
event: RequestEvent;
|
|
@@ -2287,7 +2287,7 @@ declare namespace App {
|
|
|
2287
2287
|
export interface PageState {}
|
|
2288
2288
|
|
|
2289
2289
|
/**
|
|
2290
|
-
* If your adapter provides [platform-specific context](https://svelte.dev/docs/kit/adapters#
|
|
2290
|
+
* If your adapter provides [platform-specific context](https://svelte.dev/docs/kit/adapters#Platform-specific-context) via `event.platform`, you can specify it here.
|
|
2291
2291
|
*/
|
|
2292
2292
|
export interface Platform {}
|
|
2293
2293
|
}
|