@sveltejs/kit 2.0.8 → 2.1.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 +1 -1
- package/src/exports/public.d.ts +1 -0
- package/src/exports/vite/dev/index.js +1 -1
- package/src/exports/vite/index.js +3 -3
- package/src/runtime/app/forms.js +3 -17
- package/src/runtime/app/navigation.js +13 -142
- package/src/runtime/app/stores.js +5 -5
- package/src/runtime/client/client.js +1801 -1617
- package/src/runtime/client/entry.js +3 -0
- package/src/runtime/client/fetcher.js +5 -4
- package/src/runtime/client/types.d.ts +0 -41
- package/src/utils/routing.js +3 -6
- package/src/utils/url.js +5 -3
- package/src/version.js +1 -1
- package/types/index.d.ts +56 -48
- package/types/index.d.ts.map +6 -6
- package/src/runtime/client/singletons.js +0 -59
- package/src/runtime/client/start.js +0 -28
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { DEV } from 'esm-env';
|
|
1
|
+
import { BROWSER, DEV } from 'esm-env';
|
|
2
2
|
import { hash } from '../hash.js';
|
|
3
3
|
|
|
4
4
|
let loading = 0;
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/** @type {typeof fetch} */
|
|
7
|
+
export const native_fetch = BROWSER ? window.fetch : /** @type {any} */ (() => {});
|
|
7
8
|
|
|
8
9
|
export function lock_fetch() {
|
|
9
10
|
loading += 1;
|
|
@@ -13,7 +14,7 @@ export function unlock_fetch() {
|
|
|
13
14
|
loading -= 1;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
if (DEV) {
|
|
17
|
+
if (DEV && BROWSER) {
|
|
17
18
|
let can_inspect_stack_trace = false;
|
|
18
19
|
|
|
19
20
|
const check_stack_trace = async () => {
|
|
@@ -61,7 +62,7 @@ if (DEV) {
|
|
|
61
62
|
|
|
62
63
|
return native_fetch(input, init);
|
|
63
64
|
};
|
|
64
|
-
} else {
|
|
65
|
+
} else if (BROWSER) {
|
|
65
66
|
window.fetch = (input, init) => {
|
|
66
67
|
const method = input instanceof Request ? input.method : init?.method || 'GET';
|
|
67
68
|
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import { applyAction } from '../app/forms.js';
|
|
2
|
-
import {
|
|
3
|
-
afterNavigate,
|
|
4
|
-
beforeNavigate,
|
|
5
|
-
onNavigate,
|
|
6
|
-
goto,
|
|
7
|
-
invalidate,
|
|
8
|
-
invalidateAll,
|
|
9
|
-
preloadCode,
|
|
10
|
-
preloadData,
|
|
11
|
-
pushState,
|
|
12
|
-
replaceState
|
|
13
|
-
} from '../app/navigation.js';
|
|
14
1
|
import { SvelteComponent } from 'svelte';
|
|
15
2
|
import { ClientHooks, CSRPageNode, CSRPageNodeLoader, CSRRoute, TrailingSlash, Uses } from 'types';
|
|
16
3
|
import { Page, ParamMatcher } from '@sveltejs/kit';
|
|
@@ -42,34 +29,6 @@ export interface SvelteKitApp {
|
|
|
42
29
|
root: typeof SvelteComponent;
|
|
43
30
|
}
|
|
44
31
|
|
|
45
|
-
export interface Client {
|
|
46
|
-
// public API, exposed via $app/navigation
|
|
47
|
-
after_navigate: typeof afterNavigate;
|
|
48
|
-
before_navigate: typeof beforeNavigate;
|
|
49
|
-
on_navigate: typeof onNavigate;
|
|
50
|
-
disable_scroll_handling(): void;
|
|
51
|
-
goto: typeof goto;
|
|
52
|
-
invalidate: typeof invalidate;
|
|
53
|
-
invalidate_all: typeof invalidateAll;
|
|
54
|
-
preload_code: typeof preloadCode;
|
|
55
|
-
preload_data: typeof preloadData;
|
|
56
|
-
push_state: typeof pushState;
|
|
57
|
-
replace_state: typeof replaceState;
|
|
58
|
-
apply_action: typeof applyAction;
|
|
59
|
-
|
|
60
|
-
// private API
|
|
61
|
-
_hydrate(opts: {
|
|
62
|
-
status: number;
|
|
63
|
-
error: App.Error | null;
|
|
64
|
-
node_ids: number[];
|
|
65
|
-
params: Record<string, string>;
|
|
66
|
-
route: { id: string | null };
|
|
67
|
-
data: Array<import('types').ServerDataNode | null>;
|
|
68
|
-
form: Record<string, any> | null;
|
|
69
|
-
}): Promise<void>;
|
|
70
|
-
_start_router(): void;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
32
|
export type NavigationIntent = {
|
|
74
33
|
/** `url.pathname + url.search` */
|
|
75
34
|
id: string;
|
package/src/utils/routing.js
CHANGED
|
@@ -62,12 +62,9 @@ export function parse_route_id(id) {
|
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
if
|
|
67
|
-
|
|
68
|
-
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
65
|
+
// We know the match cannot be null because manifest generation would have
|
|
66
|
+
// if we hit an invalid param/matcher name with non-alphanumeric character.
|
|
67
|
+
const match = /** @type {RegExpExecArray} */ (param_pattern.exec(content));
|
|
71
68
|
|
|
72
69
|
const [, is_optional, is_rest, name, matcher] = match;
|
|
73
70
|
// It's assumed that the following invalid route id cases are already checked
|
package/src/utils/url.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BROWSER } from 'esm-env';
|
|
1
|
+
import { BROWSER, DEV } from 'esm-env';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Matches a URI scheme. See https://www.rfc-editor.org/rfc/rfc3986#section-3.1
|
|
@@ -146,7 +146,9 @@ export function make_trackable(url, callback, search_params_callback) {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
if (DEV || !BROWSER) {
|
|
150
|
+
disable_hash(tracked);
|
|
151
|
+
}
|
|
150
152
|
|
|
151
153
|
return tracked;
|
|
152
154
|
}
|
|
@@ -155,7 +157,7 @@ export function make_trackable(url, callback, search_params_callback) {
|
|
|
155
157
|
* Disallow access to `url.hash` on the server and in `load`
|
|
156
158
|
* @param {URL} url
|
|
157
159
|
*/
|
|
158
|
-
|
|
160
|
+
function disable_hash(url) {
|
|
159
161
|
allow_nodejs_console_log(url);
|
|
160
162
|
|
|
161
163
|
Object.defineProperty(url, 'hash', {
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -331,6 +331,7 @@ declare module '@sveltejs/kit' {
|
|
|
331
331
|
};
|
|
332
332
|
/**
|
|
333
333
|
* Whether or not the app is embedded inside a larger app. If `true`, SvelteKit will add its event listeners related to navigation etc on the parent of `%sveltekit.body%` instead of `window`, and will pass `params` from the server rather than inferring them from `location.pathname`.
|
|
334
|
+
* Note that it is generally not supported to embed multiple SvelteKit apps on the same page and use client-side SvelteKit features within them (things such as pushing to the history state assume a single instance).
|
|
334
335
|
* @default false
|
|
335
336
|
*/
|
|
336
337
|
embedded?: boolean;
|
|
@@ -1884,11 +1885,6 @@ declare module '$app/environment' {
|
|
|
1884
1885
|
}
|
|
1885
1886
|
|
|
1886
1887
|
declare module '$app/forms' {
|
|
1887
|
-
/**
|
|
1888
|
-
* This action updates the `form` property of the current page with the given data and updates `$page.status`.
|
|
1889
|
-
* In case of an error, it redirects to the nearest error page.
|
|
1890
|
-
* */
|
|
1891
|
-
export function applyAction<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: import("@sveltejs/kit").ActionResult<Success, Failure>): Promise<void>;
|
|
1892
1888
|
/**
|
|
1893
1889
|
* Use this function to deserialize the response from a form submission.
|
|
1894
1890
|
* Usage:
|
|
@@ -1931,14 +1927,47 @@ declare module '$app/forms' {
|
|
|
1931
1927
|
export function enhance<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(form_element: HTMLFormElement, submit?: import("@sveltejs/kit").SubmitFunction<Success, Failure>): {
|
|
1932
1928
|
destroy(): void;
|
|
1933
1929
|
};
|
|
1930
|
+
/**
|
|
1931
|
+
* This action updates the `form` property of the current page with the given data and updates `$page.status`.
|
|
1932
|
+
* In case of an error, it redirects to the nearest error page.
|
|
1933
|
+
* */
|
|
1934
|
+
export function applyAction<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: import("@sveltejs/kit").ActionResult<Success, Failure>): Promise<void>;
|
|
1934
1935
|
}
|
|
1935
1936
|
|
|
1936
1937
|
declare module '$app/navigation' {
|
|
1938
|
+
/**
|
|
1939
|
+
* A lifecycle function that runs the supplied `callback` when the current component mounts, and also whenever we navigate to a new URL.
|
|
1940
|
+
*
|
|
1941
|
+
* `afterNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
|
|
1942
|
+
* */
|
|
1943
|
+
export function afterNavigate(callback: (navigation: import('@sveltejs/kit').AfterNavigate) => void): void;
|
|
1944
|
+
/**
|
|
1945
|
+
* A navigation interceptor that triggers before we navigate to a new URL, whether by clicking a link, calling `goto(...)`, or using the browser back/forward controls.
|
|
1946
|
+
*
|
|
1947
|
+
* Calling `cancel()` will prevent the navigation from completing. If `navigation.type === 'leave'` — meaning the user is navigating away from the app (or closing the tab) — calling `cancel` will trigger the native browser unload confirmation dialog. In this case, the navigation may or may not be cancelled depending on the user's response.
|
|
1948
|
+
*
|
|
1949
|
+
* When a navigation isn't to a SvelteKit-owned route (and therefore controlled by SvelteKit's client-side router), `navigation.to.route.id` will be `null`.
|
|
1950
|
+
*
|
|
1951
|
+
* If the navigation will (if not cancelled) cause the document to unload — in other words `'leave'` navigations and `'link'` navigations where `navigation.to.route === null` — `navigation.willUnload` is `true`.
|
|
1952
|
+
*
|
|
1953
|
+
* `beforeNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
|
|
1954
|
+
* */
|
|
1955
|
+
export function beforeNavigate(callback: (navigation: import('@sveltejs/kit').BeforeNavigate) => void): void;
|
|
1956
|
+
/**
|
|
1957
|
+
* A lifecycle function that runs the supplied `callback` immediately before we navigate to a new URL except during full-page navigations.
|
|
1958
|
+
*
|
|
1959
|
+
* If you return a `Promise`, SvelteKit will wait for it to resolve before completing the navigation. This allows you to — for example — use `document.startViewTransition`. Avoid promises that are slow to resolve, since navigation will appear stalled to the user.
|
|
1960
|
+
*
|
|
1961
|
+
* If a function (or a `Promise` that resolves to a function) is returned from the callback, it will be called once the DOM has updated.
|
|
1962
|
+
*
|
|
1963
|
+
* `onNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
|
|
1964
|
+
* */
|
|
1965
|
+
export function onNavigate(callback: (navigation: import('@sveltejs/kit').OnNavigate) => MaybePromise<void>): void;
|
|
1937
1966
|
/**
|
|
1938
1967
|
* If called when the page is being updated following a navigation (in `onMount` or `afterNavigate` or an action, for example), this disables SvelteKit's built-in scroll handling.
|
|
1939
1968
|
* This is generally discouraged, since it breaks user expectations.
|
|
1940
1969
|
* */
|
|
1941
|
-
export
|
|
1970
|
+
export function disableScrollHandling(): void;
|
|
1942
1971
|
/**
|
|
1943
1972
|
* Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`.
|
|
1944
1973
|
* For external URLs, use `window.location = url` instead of calling `goto(url)`.
|
|
@@ -1946,13 +1975,13 @@ declare module '$app/navigation' {
|
|
|
1946
1975
|
* @param url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app.
|
|
1947
1976
|
* @param {Object} opts Options related to the navigation
|
|
1948
1977
|
* */
|
|
1949
|
-
export
|
|
1950
|
-
replaceState?: boolean;
|
|
1951
|
-
noScroll?: boolean;
|
|
1952
|
-
keepFocus?: boolean;
|
|
1953
|
-
invalidateAll?: boolean;
|
|
1954
|
-
state?: App.PageState;
|
|
1955
|
-
})
|
|
1978
|
+
export function goto(url: string | URL, opts?: {
|
|
1979
|
+
replaceState?: boolean | undefined;
|
|
1980
|
+
noScroll?: boolean | undefined;
|
|
1981
|
+
keepFocus?: boolean | undefined;
|
|
1982
|
+
invalidateAll?: boolean | undefined;
|
|
1983
|
+
state?: App.PageState | undefined;
|
|
1984
|
+
} | undefined): Promise<void>;
|
|
1956
1985
|
/**
|
|
1957
1986
|
* Causes any `load` functions belonging to the currently active page to re-run if they depend on the `url` in question, via `fetch` or `depends`. Returns a `Promise` that resolves when the page is subsequently updated.
|
|
1958
1987
|
*
|
|
@@ -1968,13 +1997,13 @@ declare module '$app/navigation' {
|
|
|
1968
1997
|
*
|
|
1969
1998
|
* invalidate((url) => url.pathname === '/path');
|
|
1970
1999
|
* ```
|
|
1971
|
-
* @param
|
|
2000
|
+
* @param resource The invalidated URL
|
|
1972
2001
|
* */
|
|
1973
|
-
export
|
|
2002
|
+
export function invalidate(resource: string | URL | ((url: URL) => boolean)): Promise<void>;
|
|
1974
2003
|
/**
|
|
1975
2004
|
* Causes all `load` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated.
|
|
1976
2005
|
* */
|
|
1977
|
-
export
|
|
2006
|
+
export function invalidateAll(): Promise<void>;
|
|
1978
2007
|
/**
|
|
1979
2008
|
* Programmatically preloads the given page, which means
|
|
1980
2009
|
* 1. ensuring that the code for the page is loaded, and
|
|
@@ -1986,7 +2015,14 @@ declare module '$app/navigation' {
|
|
|
1986
2015
|
*
|
|
1987
2016
|
* @param href Page to preload
|
|
1988
2017
|
* */
|
|
1989
|
-
export
|
|
2018
|
+
export function preloadData(href: string): Promise<{
|
|
2019
|
+
type: 'loaded';
|
|
2020
|
+
status: number;
|
|
2021
|
+
data: Record<string, any>;
|
|
2022
|
+
} | {
|
|
2023
|
+
type: 'redirect';
|
|
2024
|
+
location: string;
|
|
2025
|
+
}>;
|
|
1990
2026
|
/**
|
|
1991
2027
|
* Programmatically imports the code for routes that haven't yet been fetched.
|
|
1992
2028
|
* Typically, you might call this to speed up subsequent navigation.
|
|
@@ -1997,45 +2033,17 @@ declare module '$app/navigation' {
|
|
|
1997
2033
|
* Returns a Promise that resolves when the modules have been imported.
|
|
1998
2034
|
*
|
|
1999
2035
|
* */
|
|
2000
|
-
export
|
|
2001
|
-
/**
|
|
2002
|
-
* A navigation interceptor that triggers before we navigate to a new URL, whether by clicking a link, calling `goto(...)`, or using the browser back/forward controls.
|
|
2003
|
-
*
|
|
2004
|
-
* Calling `cancel()` will prevent the navigation from completing. If `navigation.type === 'leave'` — meaning the user is navigating away from the app (or closing the tab) — calling `cancel` will trigger the native browser unload confirmation dialog. In this case, the navigation may or may not be cancelled depending on the user's response.
|
|
2005
|
-
*
|
|
2006
|
-
* When a navigation isn't to a SvelteKit-owned route (and therefore controlled by SvelteKit's client-side router), `navigation.to.route.id` will be `null`.
|
|
2007
|
-
*
|
|
2008
|
-
* If the navigation will (if not cancelled) cause the document to unload — in other words `'leave'` navigations and `'link'` navigations where `navigation.to.route === null` — `navigation.willUnload` is `true`.
|
|
2009
|
-
*
|
|
2010
|
-
* `beforeNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
|
|
2011
|
-
* */
|
|
2012
|
-
export const beforeNavigate: (callback: (navigation: import('@sveltejs/kit').BeforeNavigate) => void) => void;
|
|
2013
|
-
/**
|
|
2014
|
-
* A lifecycle function that runs the supplied `callback` immediately before we navigate to a new URL except during full-page navigations.
|
|
2015
|
-
*
|
|
2016
|
-
* If you return a `Promise`, SvelteKit will wait for it to resolve before completing the navigation. This allows you to — for example — use `document.startViewTransition`. Avoid promises that are slow to resolve, since navigation will appear stalled to the user.
|
|
2017
|
-
*
|
|
2018
|
-
* If a function (or a `Promise` that resolves to a function) is returned from the callback, it will be called once the DOM has updated.
|
|
2019
|
-
*
|
|
2020
|
-
* `onNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
|
|
2021
|
-
* */
|
|
2022
|
-
export const onNavigate: (callback: (navigation: import('@sveltejs/kit').OnNavigate) => MaybePromise<(() => void) | void>) => void;
|
|
2023
|
-
/**
|
|
2024
|
-
* A lifecycle function that runs the supplied `callback` when the current component mounts, and also whenever we navigate to a new URL.
|
|
2025
|
-
*
|
|
2026
|
-
* `afterNavigate` must be called during a component initialization. It remains active as long as the component is mounted.
|
|
2027
|
-
* */
|
|
2028
|
-
export const afterNavigate: (callback: (navigation: import('@sveltejs/kit').AfterNavigate) => void) => void;
|
|
2036
|
+
export function preloadCode(pathname: string): Promise<void>;
|
|
2029
2037
|
/**
|
|
2030
2038
|
* Programmatically create a new history entry with the given `$page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://kit.svelte.dev/docs/shallow-routing).
|
|
2031
2039
|
*
|
|
2032
2040
|
* */
|
|
2033
|
-
export
|
|
2041
|
+
export function pushState(url: string | URL, state: App.PageState): void;
|
|
2034
2042
|
/**
|
|
2035
2043
|
* Programmatically replace the current history entry with the given `$page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://kit.svelte.dev/docs/shallow-routing).
|
|
2036
2044
|
*
|
|
2037
2045
|
* */
|
|
2038
|
-
export
|
|
2046
|
+
export function replaceState(url: string | URL, state: App.PageState): void;
|
|
2039
2047
|
type MaybePromise<T> = T | Promise<T>;
|
|
2040
2048
|
}
|
|
2041
2049
|
|
package/types/index.d.ts.map
CHANGED
|
@@ -89,18 +89,18 @@
|
|
|
89
89
|
"sveltekit",
|
|
90
90
|
"browser",
|
|
91
91
|
"dev",
|
|
92
|
-
"applyAction",
|
|
93
92
|
"deserialize",
|
|
94
93
|
"enhance",
|
|
94
|
+
"applyAction",
|
|
95
|
+
"afterNavigate",
|
|
96
|
+
"beforeNavigate",
|
|
97
|
+
"onNavigate",
|
|
95
98
|
"disableScrollHandling",
|
|
96
99
|
"goto",
|
|
97
100
|
"invalidate",
|
|
98
101
|
"invalidateAll",
|
|
99
102
|
"preloadData",
|
|
100
103
|
"preloadCode",
|
|
101
|
-
"beforeNavigate",
|
|
102
|
-
"onNavigate",
|
|
103
|
-
"afterNavigate",
|
|
104
104
|
"pushState",
|
|
105
105
|
"replaceState",
|
|
106
106
|
"resolveRoute",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"../src/exports/vite/index.js",
|
|
123
123
|
"../src/runtime/app/environment.js",
|
|
124
124
|
"../src/runtime/app/forms.js",
|
|
125
|
-
"../src/runtime/
|
|
125
|
+
"../src/runtime/client/client.js",
|
|
126
126
|
"../src/runtime/app/paths.js",
|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;;;;;;;;;;iBAcXC,QAAQA;;;;;iBAaRC,UAAUA;;;;;;iBASVC,IAAIA;;;;;;iBA8BJC,IAAIA;;;;;;;;;;;;aApI6CC,QAAQA;aAMVC,YAAYA;cCX9DC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCiEJC,QAAQA;;;;iBC+BFC,UAAUA;;;;;;iBAeVC,WAAWA;;;;;;;;;iBChGjBC,gBAAgBA;;;;;;;iBCyHVC,SAASA;;;;;;;;cCrIlBC,OAAOA;;;;cAKPC,GAAGA;;;;;;;;;;;;;;;;;;;;;;iBCkBAC,WAAWA;;;;;;;;;;;;;;;;;;;;;iBAyCXC,OAAOA;;;;;;;iBCouDDC,WAAWA;;;;;;;;;iBA5RjBC,aAAaA;;;;;;;;;;;;iBAiBbC,cAAcA;;;;;;;;;;iBAedC,UAAUA;;;;;iBASVC,qBAAqBA;;;;;;;;iBA2BrBC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;iBAsCJC,UAAUA;;;;iBAmBVC,aAAaA;;;;;;;;;;;;iBAqBPC,WAAWA;;;;;;;;;;;;;;;;;;iBAoCjBC,WAAWA;;;;;iBA2BXC,SAASA;;;;;iBAuCTC,YAAYA;MV1mDhBxD,YAAYA;;;;;;;;;;;;;;;;;;iBWxIRyD,YAAYA;;;;iBCZfC,SAASA;;;;;;;;;;;;;;cAwBTC,IAAIA;;;;;;;;cAeJC,UAAUA;;;;;;cAaVC,OAAOA"
|
|
147
147
|
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { writable } from 'svelte/store';
|
|
2
|
-
import { create_updated_store, notifiable_store } from './utils.js';
|
|
3
|
-
import { BROWSER } from 'esm-env';
|
|
4
|
-
|
|
5
|
-
/** @type {import('./types.js').Client} */
|
|
6
|
-
export let client;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {{
|
|
10
|
-
* client: import('./types.js').Client;
|
|
11
|
-
* }} opts
|
|
12
|
-
*/
|
|
13
|
-
export function init(opts) {
|
|
14
|
-
client = opts.client;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @template {keyof typeof client} T
|
|
19
|
-
* @param {T} key
|
|
20
|
-
* @returns {typeof client[T]}
|
|
21
|
-
*/
|
|
22
|
-
export function client_method(key) {
|
|
23
|
-
if (!BROWSER) {
|
|
24
|
-
if (
|
|
25
|
-
key === 'before_navigate' ||
|
|
26
|
-
key === 'after_navigate' ||
|
|
27
|
-
key === 'on_navigate' ||
|
|
28
|
-
key === 'push_state' ||
|
|
29
|
-
key === 'replace_state'
|
|
30
|
-
) {
|
|
31
|
-
// @ts-expect-error doesn't recognize that both keys here return void so expects a async function
|
|
32
|
-
return () => {};
|
|
33
|
-
} else {
|
|
34
|
-
/** @type {Record<string, string>} */
|
|
35
|
-
const name_lookup = {
|
|
36
|
-
disable_scroll_handling: 'disableScrollHandling',
|
|
37
|
-
preload_data: 'preloadData',
|
|
38
|
-
preload_code: 'preloadCode',
|
|
39
|
-
invalidate_all: 'invalidateAll'
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return () => {
|
|
43
|
-
throw new Error(`Cannot call ${name_lookup[key] ?? key}(...) on the server`);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
// @ts-expect-error
|
|
48
|
-
return (...args) => client[key](...args);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const stores = {
|
|
53
|
-
url: /* @__PURE__ */ notifiable_store({}),
|
|
54
|
-
page: /* @__PURE__ */ notifiable_store({}),
|
|
55
|
-
navigating: /* @__PURE__ */ writable(
|
|
56
|
-
/** @type {import('@sveltejs/kit').Navigation | null} */ (null)
|
|
57
|
-
),
|
|
58
|
-
updated: /* @__PURE__ */ create_updated_store()
|
|
59
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { DEV } from 'esm-env';
|
|
2
|
-
import { create_client } from './client.js';
|
|
3
|
-
import { init } from './singletons.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {import('./types.js').SvelteKitApp} app
|
|
7
|
-
* @param {HTMLElement} target
|
|
8
|
-
* @param {Parameters<import('./types.js').Client['_hydrate']>[0]} [hydrate]
|
|
9
|
-
*/
|
|
10
|
-
export async function start(app, target, hydrate) {
|
|
11
|
-
if (DEV && target === document.body) {
|
|
12
|
-
console.warn(
|
|
13
|
-
'Placing %sveltekit.body% directly inside <body> is not recommended, as your app may break for users who have certain browser extensions installed.\n\nConsider wrapping it in an element:\n\n<div style="display: contents">\n %sveltekit.body%\n</div>'
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const client = create_client(app, target);
|
|
18
|
-
|
|
19
|
-
init({ client });
|
|
20
|
-
|
|
21
|
-
if (hydrate) {
|
|
22
|
-
await client._hydrate(hydrate);
|
|
23
|
-
} else {
|
|
24
|
-
client.goto(location.href, { replaceState: true });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
client._start_router();
|
|
28
|
-
}
|