vike 0.4.244-commit-aae383f → 0.4.245-commit-4d0629e
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/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +6 -0
- package/dist/esm/client/runtime-client-routing/initOnPopState.js +3 -3
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +7 -1
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +4 -2
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -0
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -0
- package/dist/esm/node/runtime/renderPage/html/serializeContext.js +8 -0
- package/dist/esm/shared/route/resolveRouteFunction.d.ts +1 -1
- package/dist/esm/shared/route/resolveRouteFunction.js +1 -2
- package/dist/esm/types/Config.d.ts +92 -23
- package/dist/esm/types/PageContext.d.ts +18 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
|
@@ -89,6 +89,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
|
|
|
89
89
|
url: string;
|
|
90
90
|
} & import("../../shared/page-configs/resolveVikeConfigPublic.js").GlobalConfigPublic & {
|
|
91
91
|
isBackwardNavigation: boolean | null;
|
|
92
|
+
isHistoryNavigation: boolean;
|
|
92
93
|
isClientSideNavigation: boolean;
|
|
93
94
|
isHydration: boolean;
|
|
94
95
|
previousPageContext: ({
|
|
@@ -144,6 +145,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
|
|
|
144
145
|
} & {
|
|
145
146
|
isHydration: boolean;
|
|
146
147
|
isBackwardNavigation: boolean | null;
|
|
148
|
+
isHistoryNavigation: boolean;
|
|
147
149
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
148
150
|
globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
|
|
149
151
|
} & {
|
|
@@ -209,6 +211,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
|
|
|
209
211
|
} & {
|
|
210
212
|
isHydration: boolean;
|
|
211
213
|
isBackwardNavigation: boolean | null;
|
|
214
|
+
isHistoryNavigation: boolean;
|
|
212
215
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
213
216
|
globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
|
|
214
217
|
} & {
|
|
@@ -310,6 +313,7 @@ declare function getPageContextFromClientHooks(pageContext: {
|
|
|
310
313
|
url: string;
|
|
311
314
|
} & import("../../shared/page-configs/resolveVikeConfigPublic.js").GlobalConfigPublic & {
|
|
312
315
|
isBackwardNavigation: boolean | null;
|
|
316
|
+
isHistoryNavigation: boolean;
|
|
313
317
|
isClientSideNavigation: boolean;
|
|
314
318
|
isHydration: boolean;
|
|
315
319
|
previousPageContext: ({
|
|
@@ -365,6 +369,7 @@ declare function getPageContextFromClientHooks(pageContext: {
|
|
|
365
369
|
} & {
|
|
366
370
|
isHydration: boolean;
|
|
367
371
|
isBackwardNavigation: boolean | null;
|
|
372
|
+
isHistoryNavigation: boolean;
|
|
368
373
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
369
374
|
globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
|
|
370
375
|
} & {
|
|
@@ -428,6 +433,7 @@ declare function getPageContextFromClientHooks(pageContext: {
|
|
|
428
433
|
} & {
|
|
429
434
|
isHydration: boolean;
|
|
430
435
|
isBackwardNavigation: boolean | null;
|
|
436
|
+
isHistoryNavigation: boolean;
|
|
431
437
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
432
438
|
globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
|
|
433
439
|
} & {
|
|
@@ -39,10 +39,10 @@ async function onPopState() {
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
await
|
|
42
|
+
await handleHistoryNavigation(previous, current);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
async function
|
|
45
|
+
async function handleHistoryNavigation(previous, current) {
|
|
46
46
|
const scrollTarget = current.state.scrollPosition || undefined;
|
|
47
47
|
const isHashNavigation = removeHash(current.url) === removeHash(previous.url) && current.url !== previous.url;
|
|
48
48
|
if (isHashNavigation) {
|
|
@@ -53,7 +53,7 @@ async function handleBackForwardNavigation(previous, current) {
|
|
|
53
53
|
const isUserPushStateNavigation = current.state.triggeredBy === 'user' || previous.state.triggeredBy === 'user';
|
|
54
54
|
const doNotRenderIfSamePage = isUserPushStateNavigation;
|
|
55
55
|
const isBackwardNavigation = !current.state.timestamp || !previous.state.timestamp ? null : current.state.timestamp < previous.state.timestamp;
|
|
56
|
-
await renderPageClientSide({ scrollTarget, isBackwardNavigation, doNotRenderIfSamePage });
|
|
56
|
+
await renderPageClientSide({ scrollTarget, isBackwardNavigation, doNotRenderIfSamePage, isHistoryNavigation: true });
|
|
57
57
|
}
|
|
58
58
|
function removeHash(url) {
|
|
59
59
|
return url.split('#')[0];
|
|
@@ -20,6 +20,7 @@ type PageContextBegin = Awaited<ReturnType<typeof getPageContextBegin>>;
|
|
|
20
20
|
type RenderArgs = {
|
|
21
21
|
scrollTarget: ScrollTarget;
|
|
22
22
|
isBackwardNavigation: boolean | null;
|
|
23
|
+
isHistoryNavigation?: true;
|
|
23
24
|
urlOriginal?: string;
|
|
24
25
|
overwriteLastHistoryEntry?: boolean;
|
|
25
26
|
pageContextsFromRewrite?: PageContextFromRewrite[];
|
|
@@ -103,6 +104,7 @@ declare function renderPageClientSide(renderArgs: RenderArgs): Promise<({
|
|
|
103
104
|
url: string;
|
|
104
105
|
} & import("../../shared/page-configs/resolveVikeConfigPublic.js").GlobalConfigPublic & {
|
|
105
106
|
isBackwardNavigation: boolean | null;
|
|
107
|
+
isHistoryNavigation: boolean;
|
|
106
108
|
isClientSideNavigation: boolean;
|
|
107
109
|
isHydration: boolean;
|
|
108
110
|
previousPageContext: ({
|
|
@@ -155,6 +157,7 @@ declare function renderPageClientSide(renderArgs: RenderArgs): Promise<({
|
|
|
155
157
|
} & {
|
|
156
158
|
isHydration: boolean;
|
|
157
159
|
isBackwardNavigation: boolean | null;
|
|
160
|
+
isHistoryNavigation: boolean;
|
|
158
161
|
previousPageContext: PageContextClient<unknown> | null;
|
|
159
162
|
globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
|
|
160
163
|
} & {
|
|
@@ -174,9 +177,10 @@ declare function renderPageClientSide(renderArgs: RenderArgs): Promise<({
|
|
|
174
177
|
urlPathname: string;
|
|
175
178
|
_hasPageContextFromServer: boolean;
|
|
176
179
|
} & PageContextRouted) | undefined>;
|
|
177
|
-
declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isBackwardNavigation, pageContextsFromRewrite, isClientSideNavigation, pageContextInitClient, isFirstRender, }: {
|
|
180
|
+
declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isBackwardNavigation, isHistoryNavigation, pageContextsFromRewrite, isClientSideNavigation, pageContextInitClient, isFirstRender, }: {
|
|
178
181
|
urlOriginal: string;
|
|
179
182
|
isBackwardNavigation: boolean | null;
|
|
183
|
+
isHistoryNavigation: boolean;
|
|
180
184
|
pageContextsFromRewrite: PageContextFromRewrite[];
|
|
181
185
|
isClientSideNavigation: boolean;
|
|
182
186
|
pageContextInitClient: Record<string, unknown> | undefined;
|
|
@@ -250,6 +254,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
|
|
|
250
254
|
url: string;
|
|
251
255
|
} & import("../../shared/page-configs/resolveVikeConfigPublic.js").GlobalConfigPublic & {
|
|
252
256
|
isBackwardNavigation: boolean | null;
|
|
257
|
+
isHistoryNavigation: boolean;
|
|
253
258
|
isClientSideNavigation: boolean;
|
|
254
259
|
isHydration: boolean;
|
|
255
260
|
previousPageContext: ({
|
|
@@ -302,6 +307,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
|
|
|
302
307
|
} & {
|
|
303
308
|
isHydration: boolean;
|
|
304
309
|
isBackwardNavigation: boolean | null;
|
|
310
|
+
isHistoryNavigation: boolean;
|
|
305
311
|
previousPageContext: PageContextClient<unknown> | null;
|
|
306
312
|
globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
|
|
307
313
|
} & {
|
|
@@ -36,7 +36,7 @@ const globalObject = getGlobalObject('runtime-client-routing/renderPageClientSid
|
|
|
36
36
|
const { firstRenderStartPromise } = globalObject;
|
|
37
37
|
async function renderPageClientSide(renderArgs) {
|
|
38
38
|
catchInfiniteLoop('renderPageClientSide()');
|
|
39
|
-
const { urlOriginal = getCurrentUrl(), overwriteLastHistoryEntry = false, isBackwardNavigation, pageContextsFromRewrite = [], redirectCount = 0, doNotRenderIfSamePage, isClientSideNavigation = true, pageContextInitClient, } = renderArgs;
|
|
39
|
+
const { urlOriginal = getCurrentUrl(), overwriteLastHistoryEntry = false, isBackwardNavigation, isHistoryNavigation = false, pageContextsFromRewrite = [], redirectCount = 0, doNotRenderIfSamePage, isClientSideNavigation = true, pageContextInitClient, } = renderArgs;
|
|
40
40
|
let { scrollTarget } = renderArgs;
|
|
41
41
|
const { previousPageContext } = globalObject;
|
|
42
42
|
addLinkPrefetchHandlers_unwatch();
|
|
@@ -45,6 +45,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
45
45
|
const pageContextBeginArgs = {
|
|
46
46
|
urlOriginal,
|
|
47
47
|
isBackwardNavigation,
|
|
48
|
+
isHistoryNavigation,
|
|
48
49
|
pageContextsFromRewrite,
|
|
49
50
|
isClientSideNavigation,
|
|
50
51
|
pageContextInitClient,
|
|
@@ -476,11 +477,12 @@ async function renderPageClientSide(renderArgs) {
|
|
|
476
477
|
return pageContext;
|
|
477
478
|
}
|
|
478
479
|
}
|
|
479
|
-
async function getPageContextBegin(isForErrorPage, { urlOriginal, isBackwardNavigation, pageContextsFromRewrite, isClientSideNavigation, pageContextInitClient, isFirstRender, }) {
|
|
480
|
+
async function getPageContextBegin(isForErrorPage, { urlOriginal, isBackwardNavigation, isHistoryNavigation, pageContextsFromRewrite, isClientSideNavigation, pageContextInitClient, isFirstRender, }) {
|
|
480
481
|
const previousPageContext = globalObject.previousPageContext ?? null;
|
|
481
482
|
const pageContext = await createPageContextClientSide(urlOriginal);
|
|
482
483
|
objectAssign(pageContext, {
|
|
483
484
|
isBackwardNavigation,
|
|
485
|
+
isHistoryNavigation,
|
|
484
486
|
isClientSideNavigation,
|
|
485
487
|
isHydration: isFirstRender && !isForErrorPage,
|
|
486
488
|
previousPageContext,
|
|
@@ -18,6 +18,7 @@ async function createPageContextClientSide() {
|
|
|
18
18
|
_globalContext: globalContext,
|
|
19
19
|
_pageFilesAll: globalContext._pageFilesAll, // TO-DO/next-major-release: remove
|
|
20
20
|
isBackwardNavigation: null,
|
|
21
|
+
isHistoryNavigation: null,
|
|
21
22
|
_hasPageContextFromServer: true,
|
|
22
23
|
});
|
|
23
24
|
objectAssign(pageContextCreated, getPageContextSerializedInHtml());
|
|
@@ -10,6 +10,7 @@ import { NOT_SERIALIZABLE } from '../../../../shared/NOT_SERIALIZABLE.js';
|
|
|
10
10
|
import { pageContextInitIsPassedToClient } from '../../../../shared/misc/pageContextInitIsPassedToClient.js';
|
|
11
11
|
import { isServerSideError } from '../../../../shared/misc/isServerSideError.js';
|
|
12
12
|
import { getPropKeys, getPropVal, setPropVal } from './propKeys.js';
|
|
13
|
+
import { assertRouteParams } from '../../../../shared/route/resolveRouteFunction.js';
|
|
13
14
|
const passToClientBuiltInPageContext = [
|
|
14
15
|
'abortReason',
|
|
15
16
|
'_urlRewrite',
|
|
@@ -123,6 +124,7 @@ function serializeValue(value, isHtmlJsonScript, varName) {
|
|
|
123
124
|
});
|
|
124
125
|
}
|
|
125
126
|
function getPassToClientPageContext(pageContext) {
|
|
127
|
+
assertPageContext(pageContext);
|
|
126
128
|
let passToClient = [...pageContext._passToClient, ...passToClientBuiltInPageContext];
|
|
127
129
|
if (isErrorPage(pageContext.pageId, pageContext._globalContext._pageConfigs)) {
|
|
128
130
|
assert(hasProp(pageContext, 'is404', 'boolean'));
|
|
@@ -182,3 +184,9 @@ function applyPassToClient(passToClient, obj) {
|
|
|
182
184
|
});
|
|
183
185
|
return { objClient, objClientProps };
|
|
184
186
|
}
|
|
187
|
+
// Ensure the following client-side assert() don't fail:
|
|
188
|
+
// https://github.com/vikejs/vike/blob/a33b6e6319a9a0e34ea78e23c5aa156022e3745c/packages/vike/client/shared/getJsonSerializedInHtml.ts#L15-L16
|
|
189
|
+
function assertPageContext(pageContext) {
|
|
190
|
+
assertUsage(hasProp(pageContext, 'pageId', 'string'), `${pc.bold('pageContext.pageId')} should be a ${pc.bold('string')}`);
|
|
191
|
+
assertRouteParams(pageContext, `${pc.bold('pageContext.routeParams')} should`);
|
|
192
|
+
}
|
|
@@ -9,6 +9,6 @@ declare function resolveRouteFunction(routeFunction: (arg: unknown) => unknown,
|
|
|
9
9
|
}>;
|
|
10
10
|
declare function assertSyncRouting(res: unknown, errPrefix: string): void;
|
|
11
11
|
declare function warnDeprecatedAllowKey(): void;
|
|
12
|
-
declare function assertRouteParams<T>(result: T, errPrefix: string): asserts result is T & {
|
|
12
|
+
declare function assertRouteParams<T>(result: T, errPrefix: `${string} should`): asserts result is T & {
|
|
13
13
|
routeParams?: Record<string, string>;
|
|
14
14
|
};
|
|
@@ -63,6 +63,5 @@ function assertRouteParams(result, errPrefix) {
|
|
|
63
63
|
if (!hasProp(result, 'routeParams')) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
assertUsage(hasProp(result, 'routeParams', 'string{}'), `${errPrefix} be an object holding string values.`);
|
|
66
|
+
assertUsage(hasProp(result, 'routeParams', 'string{}'), `${errPrefix} be ${pc.bold('Record<string, string>')}`);
|
|
68
67
|
}
|
|
@@ -55,37 +55,64 @@ type HookNameOldDesign = 'render' | 'prerender' | 'onBeforePrerender';
|
|
|
55
55
|
type ConfigNameBuiltIn = Exclude<keyof ConfigBuiltIn, keyof VikeVitePluginOptions | 'onBeforeRoute' | 'onPrerenderStart' | 'vite' | 'redirects'> | 'prerender' | 'hasServerOnlyHook' | 'isClientRuntimeLoaded' | 'onBeforeRenderEnv' | 'dataEnv' | 'hooksTimeout' | 'clientHooks' | 'middleware';
|
|
56
56
|
type ConfigNameGlobal = 'onPrerenderStart' | 'onBeforeRoute' | 'prerender' | 'disableAutoFullBuild' | 'includeAssetsImportedByServer' | 'baseAssets' | 'baseServer' | 'redirects' | 'trailingSlash' | 'disableUrlNormalization' | 'vite';
|
|
57
57
|
type Config = ConfigBuiltIn & Vike.Config;
|
|
58
|
-
/** @deprecated This type is deprecated, see
|
|
58
|
+
/** @deprecated This type is deprecated, see:
|
|
59
|
+
* - https://vike.dev/migration/hook-types
|
|
60
|
+
* - https://vike.dev/data
|
|
61
|
+
*/
|
|
59
62
|
type DataAsync<Data = unknown> = (pageContext: PageContextServer) => Promise<Data>;
|
|
60
|
-
/** @deprecated This type is deprecated, see
|
|
63
|
+
/** @deprecated This type is deprecated, see:
|
|
64
|
+
* - https://vike.dev/migration/hook-types
|
|
65
|
+
* - https://vike.dev/data
|
|
66
|
+
*/
|
|
61
67
|
type DataSync<Data = unknown> = (pageContext: PageContextServer) => Data;
|
|
62
|
-
/** @deprecated This type is deprecated, see
|
|
68
|
+
/** @deprecated This type is deprecated, see:
|
|
69
|
+
* - https://vike.dev/migration/hook-types
|
|
70
|
+
* - https://vike.dev/guard
|
|
71
|
+
*/
|
|
63
72
|
type GuardAsync = (pageContext: PageContextServer) => Promise<void>;
|
|
64
|
-
/** @deprecated This type is deprecated, see
|
|
73
|
+
/** @deprecated This type is deprecated, see:
|
|
74
|
+
* - https://vike.dev/migration/hook-types
|
|
75
|
+
* - https://vike.dev/guard
|
|
76
|
+
*/
|
|
65
77
|
type GuardSync = (pageContext: PageContextServer) => void;
|
|
66
|
-
/** @deprecated This type is deprecated, see
|
|
78
|
+
/** @deprecated This type is deprecated, see:
|
|
79
|
+
* - https://vike.dev/migration/hook-types
|
|
80
|
+
* - https://vike.dev/onBeforePrerenderStart
|
|
81
|
+
*/
|
|
67
82
|
type OnBeforePrerenderStartAsync<Data = unknown> = () => Promise<(string | {
|
|
68
83
|
url: string;
|
|
69
84
|
pageContext: Partial<Vike.PageContext & {
|
|
70
85
|
data: Data;
|
|
71
86
|
}>;
|
|
72
87
|
})[]>;
|
|
73
|
-
/** @deprecated This type is deprecated, see
|
|
88
|
+
/** @deprecated This type is deprecated, see:
|
|
89
|
+
* - https://vike.dev/migration/hook-types
|
|
90
|
+
* - https://vike.dev/onBeforePrerenderStart
|
|
91
|
+
*/
|
|
74
92
|
type OnBeforePrerenderStartSync<Data = unknown> = () => (string | {
|
|
75
93
|
url: string;
|
|
76
94
|
pageContext: Partial<Vike.PageContext & {
|
|
77
95
|
data: Data;
|
|
78
96
|
}>;
|
|
79
97
|
})[];
|
|
80
|
-
/** @deprecated This type is deprecated, see
|
|
98
|
+
/** @deprecated This type is deprecated, see:
|
|
99
|
+
* - https://vike.dev/migration/hook-types
|
|
100
|
+
* - https://vike.dev/onBeforeRender
|
|
101
|
+
*/
|
|
81
102
|
type OnBeforeRenderAsync = (pageContext: PageContextServer) => Promise<{
|
|
82
103
|
pageContext: Partial<Vike.PageContext>;
|
|
83
104
|
} | void>;
|
|
84
|
-
/** @deprecated This type is deprecated, see
|
|
105
|
+
/** @deprecated This type is deprecated, see:
|
|
106
|
+
* - https://vike.dev/migration/hook-types
|
|
107
|
+
* - https://vike.dev/onBeforeRender
|
|
108
|
+
*/
|
|
85
109
|
type OnBeforeRenderSync = (pageContext: PageContextServer) => {
|
|
86
110
|
pageContext: Partial<Vike.PageContext>;
|
|
87
111
|
} | void;
|
|
88
|
-
/** @deprecated This type is deprecated, see
|
|
112
|
+
/** @deprecated This type is deprecated, see:
|
|
113
|
+
* - https://vike.dev/migration/hook-types
|
|
114
|
+
* - https://vike.dev/onBeforeRoute
|
|
115
|
+
*/
|
|
89
116
|
type OnBeforeRouteAsync = (pageContext: PageContextServer) => Promise<{
|
|
90
117
|
pageContext: Partial<{
|
|
91
118
|
/** The URL you provided to Vike when calling `renderPage({ urlOriginal })` in your server middleware.
|
|
@@ -95,7 +122,10 @@ type OnBeforeRouteAsync = (pageContext: PageContextServer) => Promise<{
|
|
|
95
122
|
urlOriginal: string;
|
|
96
123
|
} | Vike.PageContext>;
|
|
97
124
|
}>;
|
|
98
|
-
/** @deprecated This type is deprecated, see
|
|
125
|
+
/** @deprecated This type is deprecated, see:
|
|
126
|
+
* - https://vike.dev/migration/hook-types
|
|
127
|
+
* - https://vike.dev/onBeforeRoute
|
|
128
|
+
*/
|
|
99
129
|
type OnBeforeRouteSync = (pageContext: PageContextServer) => {
|
|
100
130
|
pageContext: Partial<{
|
|
101
131
|
/** The URL you provided to Vike when calling `renderPage({ urlOriginal })` in your server middleware.
|
|
@@ -105,19 +135,40 @@ type OnBeforeRouteSync = (pageContext: PageContextServer) => {
|
|
|
105
135
|
urlOriginal: string;
|
|
106
136
|
} | Vike.PageContext>;
|
|
107
137
|
};
|
|
108
|
-
/** @deprecated This type is deprecated, see
|
|
138
|
+
/** @deprecated This type is deprecated, see:
|
|
139
|
+
* - https://vike.dev/migration/hook-types
|
|
140
|
+
* - https://vike.dev/onHydrationEnd
|
|
141
|
+
*/
|
|
109
142
|
type OnHydrationEndAsync = (pageContext: PageContextClient) => Promise<void>;
|
|
110
|
-
/** @deprecated This type is deprecated, see
|
|
143
|
+
/** @deprecated This type is deprecated, see:
|
|
144
|
+
* - https://vike.dev/migration/hook-types
|
|
145
|
+
* - https://vike.dev/onHydrationEnd
|
|
146
|
+
*/
|
|
111
147
|
type OnHydrationEndSync = (pageContext: PageContextClient) => void;
|
|
112
|
-
/** @deprecated This type is deprecated, see
|
|
148
|
+
/** @deprecated This type is deprecated, see:
|
|
149
|
+
* - https://vike.dev/migration/hook-types
|
|
150
|
+
* - https://vike.dev/onPageTransitionEnd
|
|
151
|
+
*/
|
|
113
152
|
type OnPageTransitionEndAsync = (pageContext: PageContextClient) => Promise<void>;
|
|
114
|
-
/** @deprecated This type is deprecated, see
|
|
153
|
+
/** @deprecated This type is deprecated, see:
|
|
154
|
+
* - https://vike.dev/migration/hook-types
|
|
155
|
+
* - https://vike.dev/onPageTransitionEnd
|
|
156
|
+
*/
|
|
115
157
|
type OnPageTransitionEndSync = (pageContext: PageContextClient) => void;
|
|
116
|
-
/** @deprecated This type is deprecated, see
|
|
158
|
+
/** @deprecated This type is deprecated, see:
|
|
159
|
+
* - https://vike.dev/migration/hook-types
|
|
160
|
+
* - https://vike.dev/onPageTransitionStart
|
|
161
|
+
*/
|
|
117
162
|
type OnPageTransitionStartAsync = (pageContext: PageContextClient) => Promise<void>;
|
|
118
|
-
/** @deprecated This type is deprecated, see
|
|
163
|
+
/** @deprecated This type is deprecated, see:
|
|
164
|
+
* - https://vike.dev/migration/hook-types
|
|
165
|
+
* - https://vike.dev/onPageTransitionStart
|
|
166
|
+
*/
|
|
119
167
|
type OnPageTransitionStartSync = (pageContext: PageContextClient) => void;
|
|
120
|
-
/** @deprecated This type is deprecated, see
|
|
168
|
+
/** @deprecated This type is deprecated, see:
|
|
169
|
+
* - https://vike.dev/migration/hook-types
|
|
170
|
+
* - https://vike.dev/onPrerenderStart
|
|
171
|
+
*/
|
|
121
172
|
type OnPrerenderStartAsync = (prerenderContext: {
|
|
122
173
|
pageContexts: PageContextServer[];
|
|
123
174
|
}) => Promise<{
|
|
@@ -125,7 +176,10 @@ type OnPrerenderStartAsync = (prerenderContext: {
|
|
|
125
176
|
pageContexts: PageContextServer[];
|
|
126
177
|
};
|
|
127
178
|
}>;
|
|
128
|
-
/** @deprecated This type is deprecated, see
|
|
179
|
+
/** @deprecated This type is deprecated, see:
|
|
180
|
+
* - https://vike.dev/migration/hook-types
|
|
181
|
+
* - https://vike.dev/onPrerenderStart
|
|
182
|
+
*/
|
|
129
183
|
type OnPrerenderStartSync = (prerenderContext: {
|
|
130
184
|
pageContexts: PageContextServer[];
|
|
131
185
|
}) => {
|
|
@@ -133,13 +187,25 @@ type OnPrerenderStartSync = (prerenderContext: {
|
|
|
133
187
|
pageContexts: PageContextServer[];
|
|
134
188
|
};
|
|
135
189
|
};
|
|
136
|
-
/** @deprecated This type is deprecated, see
|
|
190
|
+
/** @deprecated This type is deprecated, see:
|
|
191
|
+
* - https://vike.dev/migration/hook-types
|
|
192
|
+
* - https://vike.dev/onRenderClient
|
|
193
|
+
*/
|
|
137
194
|
type OnRenderClientAsync = (pageContext: PageContextClient) => Promise<void>;
|
|
138
|
-
/** @deprecated This type is deprecated, see
|
|
195
|
+
/** @deprecated This type is deprecated, see:
|
|
196
|
+
* - https://vike.dev/migration/hook-types
|
|
197
|
+
* - https://vike.dev/onRenderClient
|
|
198
|
+
*/
|
|
139
199
|
type OnRenderClientSync = (pageContext: PageContextClient) => void;
|
|
140
|
-
/** @deprecated This type is deprecated, see
|
|
200
|
+
/** @deprecated This type is deprecated, see:
|
|
201
|
+
* - https://vike.dev/migration/hook-types
|
|
202
|
+
* - https://vike.dev/onRenderHtml
|
|
203
|
+
*/
|
|
141
204
|
type OnRenderHtmlAsync = (pageContext: PageContextServer) => Promise<OnRenderHtmlReturn>;
|
|
142
|
-
/** @deprecated This type is deprecated, see
|
|
205
|
+
/** @deprecated This type is deprecated, see:
|
|
206
|
+
* - https://vike.dev/migration/hook-types
|
|
207
|
+
* - https://vike.dev/onRenderHtml
|
|
208
|
+
*/
|
|
143
209
|
type OnRenderHtmlSync = (pageContext: PageContextServer) => OnRenderHtmlReturn;
|
|
144
210
|
type OnRenderHtmlReturn = DocumentHtml | {
|
|
145
211
|
injectFilter?: (assets: InjectFilterEntry[]) => void;
|
|
@@ -155,7 +221,10 @@ type RouteAsync = (pageContext: PageContextServer | PageContextClient) => Promis
|
|
|
155
221
|
routeParams?: Record<string, string>;
|
|
156
222
|
precedence?: number;
|
|
157
223
|
} | boolean>;
|
|
158
|
-
/** @deprecated This type is deprecated, see
|
|
224
|
+
/** @deprecated This type is deprecated, see:
|
|
225
|
+
* - https://vike.dev/migration/hook-types
|
|
226
|
+
* - https://vike.dev/route
|
|
227
|
+
*/
|
|
159
228
|
type RouteSync = (pageContext: PageContextServer | PageContextClient) => {
|
|
160
229
|
routeParams?: Record<string, string>;
|
|
161
230
|
precedence?: number;
|
|
@@ -170,19 +170,28 @@ type PageContextBuiltInServer<Data> = PageContextBuiltInCommon<Data> & PageConte
|
|
|
170
170
|
cspNonce: string | null;
|
|
171
171
|
isHydration?: undefined;
|
|
172
172
|
isBackwardNavigation?: undefined;
|
|
173
|
+
isHistoryNavigation?: undefined;
|
|
173
174
|
previousPageContext?: undefined;
|
|
174
175
|
};
|
|
175
176
|
type PageContextBuiltInClientWithClientRouting<Data> = Partial<PageContextBuiltInCommon<Data>> & Pick<PageContextBuiltInCommon<Data>, 'Page' | 'routeParams' | 'pageExports' | 'config' | 'configEntries' | 'exports' | 'exportsAll' | 'abortReason' | 'data' | 'pageId' | 'source' | 'sources' | 'from'> & PageContextClientCommon & {
|
|
176
177
|
/** Whether the current page is already rendered to HTML */
|
|
177
178
|
isHydration: boolean;
|
|
178
179
|
/**
|
|
179
|
-
* Whether the user is navigating
|
|
180
|
+
* Whether the user is navigating backward in history.
|
|
180
181
|
*
|
|
181
182
|
* The value is `true` when the user clicks on his browser's backward navigation button, or when invoking `history.back()`.
|
|
182
183
|
*
|
|
183
184
|
* https://vike.dev/pageContext#isBackwardNavigation
|
|
184
185
|
*/
|
|
185
186
|
isBackwardNavigation: boolean | null;
|
|
187
|
+
/**
|
|
188
|
+
* Whether the user is navigating back or forward in history.
|
|
189
|
+
*
|
|
190
|
+
* The value is `true` when the user clicks on his browser's backward/forward button, or when invoking `history.back()` or `history.forward()`.
|
|
191
|
+
*
|
|
192
|
+
* https://vike.dev/pageContext#isHistoryNavigation
|
|
193
|
+
*/
|
|
194
|
+
isHistoryNavigation: boolean;
|
|
186
195
|
/**
|
|
187
196
|
* Upon client-side page navigation, you can use `pageContext.previousPageContext` to access the `pageContext` of the previous page.
|
|
188
197
|
*
|
|
@@ -208,6 +217,14 @@ type PageContextBuiltInClientWithServerRouting<Data> = Partial<PageContextBuiltI
|
|
|
208
217
|
* https://vike.dev/pageContext#isBackwardNavigation
|
|
209
218
|
*/
|
|
210
219
|
isBackwardNavigation: null;
|
|
220
|
+
/**
|
|
221
|
+
* Whether the user is navigating back or forward in history.
|
|
222
|
+
*
|
|
223
|
+
* The `isHistoryNavigation` property only works with Client Routing. (The value is always `null` when using Server Routing.)
|
|
224
|
+
*
|
|
225
|
+
* https://vike.dev/pageContext#isHistoryNavigation
|
|
226
|
+
*/
|
|
227
|
+
isHistoryNavigation: null;
|
|
211
228
|
globalContext: GlobalContextClientWithServerRouting;
|
|
212
229
|
};
|
|
213
230
|
type PageContextClientCommon = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.245-commit-4d0629e";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.245-commit-4d0629e';
|