@sveltejs/kit 2.0.1 → 2.0.3
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
|
@@ -18,6 +18,7 @@ export const disableScrollHandling = /* @__PURE__ */ client_method('disable_scro
|
|
|
18
18
|
* @param {boolean} [opts.noScroll] If `true`, the browser will maintain its scroll position rather than scrolling to the top of the page after navigation
|
|
19
19
|
* @param {boolean} [opts.keepFocus] If `true`, the currently focused element will retain focus after navigation. Otherwise, focus will be reset to the body
|
|
20
20
|
* @param {boolean} [opts.invalidateAll] If `true`, all `load` functions of the page will be rerun. See https://kit.svelte.dev/docs/load#rerunning-load-functions for more info on invalidation.
|
|
21
|
+
* @param {App.PageState} [opts.state] An optional object that will be available on the `$page.state` store
|
|
21
22
|
* @returns {Promise<void>}
|
|
22
23
|
*/
|
|
23
24
|
export const goto = /* @__PURE__ */ client_method('goto');
|
|
@@ -302,7 +302,7 @@ export function create_client(app, target) {
|
|
|
302
302
|
|
|
303
303
|
/**
|
|
304
304
|
* @param {string | URL} url
|
|
305
|
-
* @param {{ replaceState?: boolean; noScroll?: boolean; keepFocus?: boolean; invalidateAll?: boolean; }} options
|
|
305
|
+
* @param {{ replaceState?: boolean; noScroll?: boolean; keepFocus?: boolean; invalidateAll?: boolean; state?: Record<string, any> }} options
|
|
306
306
|
* @param {number} redirect_count
|
|
307
307
|
* @param {{}} [nav_token]
|
|
308
308
|
*/
|
|
@@ -314,6 +314,7 @@ export function create_client(app, target) {
|
|
|
314
314
|
noscroll: options.noScroll,
|
|
315
315
|
replace_state: options.replaceState,
|
|
316
316
|
redirect_count,
|
|
317
|
+
state: options.state,
|
|
317
318
|
nav_token,
|
|
318
319
|
accept: () => {
|
|
319
320
|
if (options.invalidateAll) {
|
|
@@ -1107,6 +1108,7 @@ export function create_client(app, target) {
|
|
|
1107
1108
|
* keepfocus?: boolean;
|
|
1108
1109
|
* noscroll?: boolean;
|
|
1109
1110
|
* replace_state?: boolean;
|
|
1111
|
+
* state?: Record<string, any>;
|
|
1110
1112
|
* redirect_count?: number;
|
|
1111
1113
|
* nav_token?: {};
|
|
1112
1114
|
* accept?: () => void;
|
|
@@ -1120,6 +1122,7 @@ export function create_client(app, target) {
|
|
|
1120
1122
|
keepfocus,
|
|
1121
1123
|
noscroll,
|
|
1122
1124
|
replace_state,
|
|
1125
|
+
state = {},
|
|
1123
1126
|
redirect_count = 0,
|
|
1124
1127
|
nav_token = {},
|
|
1125
1128
|
accept = noop,
|
|
@@ -1213,7 +1216,7 @@ export function create_client(app, target) {
|
|
|
1213
1216
|
url.pathname = navigation_result.props.page.url.pathname;
|
|
1214
1217
|
}
|
|
1215
1218
|
|
|
1216
|
-
|
|
1219
|
+
state = popped ? popped.state : state;
|
|
1217
1220
|
|
|
1218
1221
|
if (!popped) {
|
|
1219
1222
|
// this is a new navigation, rather than a popstate
|
|
@@ -1533,14 +1536,6 @@ export function create_client(app, target) {
|
|
|
1533
1536
|
goto: (url, opts = {}) => {
|
|
1534
1537
|
url = resolve_url(url);
|
|
1535
1538
|
|
|
1536
|
-
// @ts-expect-error
|
|
1537
|
-
if (DEV && opts.state) {
|
|
1538
|
-
// TOOD 3.0 remove
|
|
1539
|
-
throw new Error(
|
|
1540
|
-
'Passing `state` to `goto` is no longer supported. Use `pushState` and `replaceState` from `$app/navigation` instead.'
|
|
1541
|
-
);
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
1539
|
if (url.origin !== origin) {
|
|
1545
1540
|
return Promise.reject(
|
|
1546
1541
|
new Error(
|
|
@@ -2118,16 +2113,21 @@ async function load_data(url, invalid) {
|
|
|
2118
2113
|
|
|
2119
2114
|
const res = await native_fetch(data_url.href);
|
|
2120
2115
|
|
|
2121
|
-
// if `__data.json` doesn't exist or the server has an internal error,
|
|
2122
|
-
// fallback to native navigation so we avoid parsing the HTML error page as a JSON
|
|
2123
|
-
if (res.headers.get('content-type')?.includes('text/html')) {
|
|
2124
|
-
await native_navigation(url);
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
2116
|
if (!res.ok) {
|
|
2128
2117
|
// error message is a JSON-stringified string which devalue can't handle at the top level
|
|
2129
2118
|
// turn it into a HttpError to not call handleError on the client again (was already handled on the server)
|
|
2130
|
-
|
|
2119
|
+
// if `__data.json` doesn't exist or the server has an internal error,
|
|
2120
|
+
// avoid parsing the HTML error page as a JSON
|
|
2121
|
+
/** @type {string | undefined} */
|
|
2122
|
+
let message;
|
|
2123
|
+
if (res.headers.get('content-type')?.includes('application/json')) {
|
|
2124
|
+
message = await res.json();
|
|
2125
|
+
} else if (res.status === 404) {
|
|
2126
|
+
message = 'Not Found';
|
|
2127
|
+
} else if (res.status === 500) {
|
|
2128
|
+
message = 'Internal Error';
|
|
2129
|
+
}
|
|
2130
|
+
throw new HttpError(res.status, message);
|
|
2131
2131
|
}
|
|
2132
2132
|
|
|
2133
2133
|
// TODO: fix eslint error / figure out if it actually applies to our situation
|
package/src/runtime/control.js
CHANGED
|
@@ -33,6 +33,7 @@ export class Redirect {
|
|
|
33
33
|
/**
|
|
34
34
|
* An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404.
|
|
35
35
|
* `SvelteKitError` goes through `handleError`.
|
|
36
|
+
* @extends Error
|
|
36
37
|
*/
|
|
37
38
|
export class SvelteKitError extends Error {
|
|
38
39
|
/**
|
package/src/version.js
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
null,
|
|
144
144
|
null
|
|
145
145
|
],
|
|
146
|
-
"mappings": ";;;;;;;;;kBA2BiBA,OAAOA;;;;;;;;;;;;aAYZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;;;;;;;;kBAeTC,aAAaA;;;;;;;;;;;;;;;;kBAgBbC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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