vike 0.4.249 → 0.4.250-commit-6161324
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/bin.js +3 -0
- package/dist/client/runtime-client-routing/createPageContextClientSide.d.ts +20 -2
- package/dist/client/runtime-client-routing/createPageContextClientSide.js +19 -11
- package/dist/client/runtime-client-routing/getPageContext.js +0 -2
- package/dist/client/runtime-client-routing/getPageContextFromHooks.d.ts +180 -60
- package/dist/client/runtime-client-routing/history.d.ts +1 -1
- package/dist/client/runtime-client-routing/history.js +4 -11
- package/dist/client/runtime-client-routing/prefetch.d.ts +2 -2
- package/dist/client/runtime-client-routing/renderPageClient.d.ts +628 -31
- package/dist/client/runtime-client-routing/utils.d.ts +0 -1
- package/dist/client/runtime-client-routing/utils.js +0 -1
- package/dist/client/runtime-server-routing/createPageContextClientSide.d.ts +15 -6
- package/dist/client/runtime-server-routing/createPageContextClientSide.js +11 -25
- package/dist/client/runtime-server-routing/entry.js +15 -1
- package/dist/client/shared/execHookOnRenderClient.d.ts +4 -1
- package/dist/node/prerender/runPrerender.d.ts +2 -5
- package/dist/node/prerender/runPrerender.js +2 -2
- package/dist/node/vite/index.js +5 -2
- package/dist/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js +38 -13
- package/dist/node/vite/plugins/pluginAssertFileEnv.js +22 -13
- package/dist/node/vite/plugins/pluginExtractAssets.js +2 -0
- package/dist/node/vite/plugins/pluginExtractExportNames.js +2 -0
- package/dist/node/vite/plugins/pluginReplaceConstantsEnvVars.js +2 -0
- package/dist/node/vite/plugins/pluginReplaceConstantsGlobalThis.js +3 -1
- package/dist/node/vite/plugins/pluginReplaceConstantsPageContext.js +2 -0
- package/dist/node/vite/plugins/pluginStaticReplace/applyStaticReplace.d.ts +126 -0
- package/dist/node/vite/plugins/pluginStaticReplace/applyStaticReplace.js +421 -0
- package/dist/node/vite/plugins/pluginStaticReplace.d.ts +4 -0
- package/dist/node/vite/plugins/pluginStaticReplace.js +88 -0
- package/dist/node/vite/plugins/pluginVirtualFiles.js +73 -113
- package/dist/node/vite/plugins/pluginViteConfigVikeExtensions.d.ts +2 -1
- package/dist/node/vite/plugins/pluginViteConfigVikeExtensions.js +1 -3
- package/dist/node/vite/shared/importString.d.ts +50 -0
- package/dist/node/vite/shared/importString.js +63 -0
- package/dist/node/vite/shared/loggerDev.d.ts +3 -3
- package/dist/node/vite/shared/loggerDev.js +3 -3
- package/dist/node/vite/shared/resolveVikeConfigInternal/assertExtensions.d.ts +1 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +15 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/{crawlPlusFiles.d.ts → crawlPlusFilePaths.d.ts} +2 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/{crawlPlusFiles.js → crawlPlusFilePaths.js} +4 -4
- package/dist/node/vite/shared/resolveVikeConfigInternal/{getPlusFilesAll.d.ts → getPlusFilesByLocationId.d.ts} +8 -6
- package/dist/node/vite/shared/resolveVikeConfigInternal/{getPlusFilesAll.js → getPlusFilesByLocationId.js} +47 -59
- package/dist/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.d.ts +1 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +11 -18
- package/dist/node/vite/shared/resolveVikeConfigInternal.d.ts +1 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal.js +66 -64
- package/dist/server/onLoad.js +2 -2
- package/dist/server/runtime/logErrorServer.d.ts +2 -2
- package/dist/server/runtime/logErrorServer.js +0 -2
- package/dist/server/runtime/loggerRuntime.d.ts +3 -2
- package/dist/server/runtime/renderPageServer/createHttpResponse.d.ts +4 -2
- package/dist/server/runtime/renderPageServer/createHttpResponse.js +16 -8
- package/dist/server/runtime/renderPageServer/createPageContextServerSide.d.ts +15 -10
- package/dist/server/runtime/renderPageServer/createPageContextServerSide.js +12 -11
- package/dist/server/runtime/renderPageServer/csp.js +2 -0
- package/dist/server/runtime/renderPageServer/execHookOnError.d.ts +2 -2
- package/dist/server/runtime/renderPageServer/execHookOnError.js +3 -1
- package/dist/server/runtime/renderPageServer/handleErrorWithoutErrorPage.d.ts +4 -4
- package/dist/server/runtime/renderPageServer/handleErrorWithoutErrorPage.js +3 -4
- package/dist/server/runtime/renderPageServer/html/serializeContext.d.ts +2 -2
- package/dist/server/runtime/renderPageServer/html/stream.js +12 -13
- package/dist/server/runtime/renderPageServer/loadPageConfigsLazyServerSide.d.ts +3 -6
- package/dist/server/runtime/renderPageServer/log404/index.d.ts +2 -2
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.d.ts +7 -19
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.js +2 -2
- package/dist/server/runtime/renderPageServer.d.ts +2 -9
- package/dist/server/runtime/renderPageServer.js +19 -19
- package/dist/shared-server-client/createGlobalContextShared.js +1 -1
- package/dist/shared-server-client/createPageContextShared.d.ts +12 -2
- package/dist/shared-server-client/createPageContextShared.js +1 -0
- package/dist/shared-server-client/getPageContextUrlComputed.d.ts +5 -2
- package/dist/shared-server-client/hooks/execHook.d.ts +6 -4
- package/dist/shared-server-client/hooks/execHook.js +77 -12
- package/dist/shared-server-client/prepareGlobalContextForPublicUsage.d.ts +2 -0
- package/dist/shared-server-client/preparePageContextForPublicUsage.d.ts +2 -3
- package/dist/types/Config/ConfigResolved.d.ts +3 -2
- package/dist/types/Config.d.ts +48 -32
- package/dist/types/Config.js +1 -0
- package/dist/types/PageConfig.d.ts +1 -1
- package/dist/types/PageContext.d.ts +33 -26
- package/dist/types/index.d.ts +2 -1
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/dist/utils/assert.d.ts +5 -5
- package/dist/utils/assert.js +8 -8
- package/dist/utils/debug.d.ts +1 -1
- package/dist/utils/debug.js +1 -0
- package/package.json +9 -7
- package/node/cli/bin.js +0 -3
- /package/dist/node/vite/shared/resolveVikeConfigInternal/{crawlPlusFiles → crawlPlusFilePaths}/ignorePatternsBuiltIn.d.ts +0 -0
- /package/dist/node/vite/shared/resolveVikeConfigInternal/{crawlPlusFiles → crawlPlusFilePaths}/ignorePatternsBuiltIn.js +0 -0
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
export { createPageContextShared };
|
|
2
2
|
export { createPageContextObject };
|
|
3
|
+
export type { PageContextCreated };
|
|
4
|
+
export type { PageContextCreatedBase };
|
|
3
5
|
import type { GlobalConfigPublic } from './page-configs/resolveVikeConfigPublic.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
+
import type { PageContextCreatedClient } from '../client/runtime-client-routing/createPageContextClientSide.js';
|
|
7
|
+
import type { PageContextCreatedServer } from '../server/runtime/renderPageServer/createPageContextServerSide.js';
|
|
8
|
+
import type { PageContextCreatedClient_ServerRouting } from '../client/runtime-server-routing/createPageContextClientSide.js';
|
|
9
|
+
type PageContextCreated = PageContextCreatedServer | PageContextCreatedClient | PageContextCreatedClient_ServerRouting;
|
|
10
|
+
type PageContextCreatedBase = {
|
|
11
|
+
_isOriginalObject: true;
|
|
12
|
+
isPageContext: true;
|
|
13
|
+
isClientSide: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare function createPageContextShared<T extends Record<string, unknown>>(pageContextCreated: T, globalConfigPublic: GlobalConfigPublic): T & GlobalConfigPublic;
|
|
6
16
|
declare function createPageContextObject(): {
|
|
7
17
|
_isOriginalObject: true;
|
|
8
18
|
isPageContext: true;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { createPageContextShared };
|
|
2
2
|
export { createPageContextObject };
|
|
3
3
|
import { changeEnumerable, objectAssign } from './utils.js';
|
|
4
|
+
//*/
|
|
4
5
|
function createPageContextShared(pageContextCreated, globalConfigPublic) {
|
|
5
6
|
objectAssign(pageContextCreated, globalConfigPublic);
|
|
6
7
|
return pageContextCreated;
|
|
@@ -3,8 +3,9 @@ export type { PageContextUrlInternal };
|
|
|
3
3
|
export type { PageContextUrlClient };
|
|
4
4
|
export type { PageContextUrlServer };
|
|
5
5
|
export type { PageContextUrlSource };
|
|
6
|
-
import { type PageContextPrepareMinimum } from './preparePageContextForPublicUsage.js';
|
|
7
6
|
import { type UrlPublic } from './utils.js';
|
|
7
|
+
import type { GlobalContextPrepareMinimum } from './prepareGlobalContextForPublicUsage.js';
|
|
8
|
+
import type { PageContextCreatedBase } from './createPageContextShared.js';
|
|
8
9
|
type PageContextUrlComputed = {
|
|
9
10
|
/** Parsed information about the current URL */
|
|
10
11
|
urlParsed: UrlPublic;
|
|
@@ -17,8 +18,10 @@ type PageContextUrl = {
|
|
|
17
18
|
/** The URL of the HTTP request */
|
|
18
19
|
urlOriginal: string;
|
|
19
20
|
} & PageContextUrlComputed;
|
|
20
|
-
type PageContextUrlInternal =
|
|
21
|
+
type PageContextUrlInternal = PageContextUrl & {
|
|
21
22
|
_urlRewrite?: string;
|
|
23
|
+
} & PageContextCreatedBase & {
|
|
24
|
+
_globalContext: GlobalContextPrepareMinimum;
|
|
22
25
|
};
|
|
23
26
|
type PageContextUrlClient = PageContextUrl;
|
|
24
27
|
type PageContextUrlServer = PageContextUrl & {
|
|
@@ -5,6 +5,7 @@ export { execHookDirectSingle };
|
|
|
5
5
|
export { execHookDirectSingleWithReturn };
|
|
6
6
|
export { execHookDirectWithoutPageContext };
|
|
7
7
|
export { execHookDirectSync };
|
|
8
|
+
export { execHookBase };
|
|
8
9
|
export { getPageContext_sync };
|
|
9
10
|
export { providePageContext };
|
|
10
11
|
export { isUserHookError };
|
|
@@ -13,28 +14,29 @@ import type { PageContextClient, PageContextServer } from '../../types/PageConte
|
|
|
13
14
|
import type { Hook, HookLoc } from './getHook.js';
|
|
14
15
|
import type { PageContextConfig } from '../getPageFiles.js';
|
|
15
16
|
import type { HookName, HookNameGlobal } from '../../types/Config.js';
|
|
16
|
-
import type {
|
|
17
|
+
import type { PageContextCreated } from '../createPageContextShared.js';
|
|
17
18
|
import type { PageContextForPublicUsageServer } from '../../server/runtime/renderPageServer/preparePageContextForPublicUsageServer.js';
|
|
18
19
|
import type { PageContextForPublicUsageClientShared } from '../../client/shared/preparePageContextForPublicUsageClientShared.js';
|
|
19
20
|
import { type PageContextPrepareMinimum } from '../preparePageContextForPublicUsage.js';
|
|
20
21
|
import type { GlobalContextPrepareMinimum } from '../prepareGlobalContextForPublicUsage.js';
|
|
21
|
-
type PageContextExecHook = PageContextConfig & PageContextForPublicUsage;
|
|
22
|
+
type PageContextExecHook = PageContextCreated & PageContextConfig & PageContextForPublicUsage;
|
|
22
23
|
type PageContextForPublicUsage = PageContextForPublicUsageServer | PageContextForPublicUsageClientShared;
|
|
23
24
|
type HookWithResult = Hook & {
|
|
24
25
|
hookReturn: unknown;
|
|
25
26
|
};
|
|
26
27
|
declare function execHook<PageContext extends PageContextExecHook>(hookName: HookName, pageContext: PageContext, preparePageContextForPublicUsage: (pageContext: PageContext) => PageContext): Promise<HookWithResult[]>;
|
|
27
|
-
declare function execHookGlobal<HookArg extends GlobalContextPrepareMinimum>(hookName: HookNameGlobal,
|
|
28
|
+
declare function execHookGlobal<HookArg extends GlobalContextPrepareMinimum>(hookName: HookNameGlobal, globalContext: GlobalContextPrepareMinimum, pageContext: PageContextPrepareMinimum | null, hookArg: HookArg, prepareForPublicUsage: (hookArg: HookArg) => HookArg): Promise<void>;
|
|
28
29
|
declare function execHookDirect<PageContext extends PageContextPrepareMinimum>(hooks: Hook[], pageContext: PageContext, preparePageContextForPublicUsage: (pageContext: PageContext) => PageContext): Promise<HookWithResult[]>;
|
|
29
30
|
declare function execHookDirectSingle<PageContext extends PageContextExecHook>(hook: Hook, pageContext: PageContext, preparePageContextForPublicUsage: (pageContext: PageContext) => PageContext): Promise<void>;
|
|
30
31
|
declare function execHookDirectSingleWithReturn<PageContext extends PageContextExecHook>(hook: Hook, pageContext: PageContext, preparePageContextForPublicUsage: (pageContext: PageContext) => PageContext): Promise<{
|
|
31
32
|
hookReturn: unknown;
|
|
32
33
|
}>;
|
|
33
34
|
declare function isUserHookError(err: unknown): false | HookLoc;
|
|
34
|
-
declare function execHookDirectWithoutPageContext<HookReturn>(hookFnCaller: () => HookReturn, hook: Omit<Hook, 'hookFn'
|
|
35
|
+
declare function execHookDirectWithoutPageContext<HookReturn>(hookFnCaller: () => HookReturn, hook: Omit<Hook, 'hookFn'>, globalContext: GlobalContextPrepareMinimum): Promise<HookReturn>;
|
|
35
36
|
declare function execHookDirectSync<PageContext extends PageContextPrepareMinimum>(hook: Omit<Hook, 'hookTimeout'>, pageContext: PageContext, preparePageContextForPublicUsage: (pageContext: PageContext) => PageContext): {
|
|
36
37
|
hookReturn: unknown;
|
|
37
38
|
};
|
|
39
|
+
declare function execHookBase<HookReturn>(hookFnCaller: () => HookReturn, hook: Omit<Hook, 'hookTimeout' | 'hookFn'>, globalContext: GlobalContextPrepareMinimum, pageContext: PageContextPrepareMinimum | null): HookReturn | Promise<HookReturn>;
|
|
38
40
|
declare function getPageContext_sync<PageContext = PageContextClient | PageContextServer>(): null | PageContext;
|
|
39
41
|
/**
|
|
40
42
|
* Provide `pageContext` for universal hooks.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// TODO: rename all exports
|
|
1
2
|
export { execHook };
|
|
2
3
|
export { execHookGlobal };
|
|
3
4
|
export { execHookDirect };
|
|
@@ -5,10 +6,12 @@ export { execHookDirectSingle };
|
|
|
5
6
|
export { execHookDirectSingleWithReturn };
|
|
6
7
|
export { execHookDirectWithoutPageContext };
|
|
7
8
|
export { execHookDirectSync };
|
|
9
|
+
export { execHookBase };
|
|
8
10
|
export { getPageContext_sync };
|
|
9
11
|
export { providePageContext };
|
|
10
12
|
export { isUserHookError };
|
|
11
|
-
|
|
13
|
+
// TODO: minor refactor — maybe completely remove (some) utils.js files?
|
|
14
|
+
import { assert, getProjectError, assertWarning, assertUsage } from '../../utils/assert.js';
|
|
12
15
|
import { getGlobalObject } from '../../utils/getGlobalObject.js';
|
|
13
16
|
import { humanizeTime } from '../../utils/humanizeTime.js';
|
|
14
17
|
import { isObject } from '../../utils/isObject.js';
|
|
@@ -18,15 +21,16 @@ const globalObject = getGlobalObject('utils/execHook.ts', {
|
|
|
18
21
|
userHookErrors: new WeakMap(),
|
|
19
22
|
pageContext: null,
|
|
20
23
|
});
|
|
24
|
+
// TODO/refactor: export new type PageContextExecHookMinimum instead of PageContextPrepareMinimum ?
|
|
21
25
|
async function execHook(hookName, pageContext, preparePageContextForPublicUsage) {
|
|
22
26
|
const hooks = getHookFromPageContextNew(hookName, pageContext);
|
|
23
27
|
return await execHookDirect(hooks, pageContext, preparePageContextForPublicUsage);
|
|
24
28
|
}
|
|
25
|
-
async function execHookGlobal(hookName,
|
|
26
|
-
const hooks = getHookFromPageConfigGlobalCumulative(
|
|
29
|
+
async function execHookGlobal(hookName, globalContext, pageContext, hookArg, prepareForPublicUsage) {
|
|
30
|
+
const hooks = getHookFromPageConfigGlobalCumulative(globalContext._pageConfigGlobal, hookName);
|
|
27
31
|
const hookArgForPublicUsage = prepareForPublicUsage(hookArg);
|
|
28
32
|
await Promise.all(hooks.map(async (hook) => {
|
|
29
|
-
await execHookDirectAsync(() => hook.hookFn(hookArgForPublicUsage), hook, pageContext);
|
|
33
|
+
await execHookDirectAsync(() => hook.hookFn(hookArgForPublicUsage), hook, globalContext, pageContext);
|
|
30
34
|
}));
|
|
31
35
|
}
|
|
32
36
|
async function execHookDirect(hooks, pageContext, preparePageContextForPublicUsage) {
|
|
@@ -34,7 +38,7 @@ async function execHookDirect(hooks, pageContext, preparePageContextForPublicUsa
|
|
|
34
38
|
return [];
|
|
35
39
|
const pageContextForPublicUsage = preparePageContextForPublicUsage(pageContext);
|
|
36
40
|
const hooksWithResult = await Promise.all(hooks.map(async (hook) => {
|
|
37
|
-
const hookReturn = await execHookDirectAsync(() => hook.hookFn(pageContextForPublicUsage), hook, pageContextForPublicUsage);
|
|
41
|
+
const hookReturn = await execHookDirectAsync(() => hook.hookFn(pageContextForPublicUsage), hook, pageContext._globalContext, pageContextForPublicUsage);
|
|
38
42
|
return { ...hook, hookReturn };
|
|
39
43
|
}));
|
|
40
44
|
return hooksWithResult;
|
|
@@ -54,12 +58,12 @@ function isUserHookError(err) {
|
|
|
54
58
|
return false;
|
|
55
59
|
return globalObject.userHookErrors.get(err) ?? false;
|
|
56
60
|
}
|
|
57
|
-
async function execHookDirectWithoutPageContext(hookFnCaller, hook) {
|
|
61
|
+
async function execHookDirectWithoutPageContext(hookFnCaller, hook, globalContext) {
|
|
58
62
|
const { hookName, hookFilePath, hookTimeout } = hook;
|
|
59
|
-
const hookReturn = await execHookDirectAsync(hookFnCaller, { hookName, hookFilePath, hookTimeout }, null);
|
|
63
|
+
const hookReturn = await execHookDirectAsync(hookFnCaller, { hookName, hookFilePath, hookTimeout }, globalContext, null);
|
|
60
64
|
return hookReturn;
|
|
61
65
|
}
|
|
62
|
-
function execHookDirectAsync(hookFnCaller, hook, pageContextForPublicUsage) {
|
|
66
|
+
function execHookDirectAsync(hookFnCaller, hook, globalContext, pageContextForPublicUsage) {
|
|
63
67
|
const { hookName, hookFilePath, hookTimeout: { error: timeoutErr, warning: timeoutWarn }, } = hook;
|
|
64
68
|
let resolve;
|
|
65
69
|
let reject;
|
|
@@ -90,8 +94,7 @@ function execHookDirectAsync(hookFnCaller, hook, pageContextForPublicUsage) {
|
|
|
90
94
|
}, timeoutErr);
|
|
91
95
|
(async () => {
|
|
92
96
|
try {
|
|
93
|
-
|
|
94
|
-
const ret = await hookFnCaller();
|
|
97
|
+
const ret = await execHookBase(hookFnCaller, hook, globalContext, pageContextForPublicUsage);
|
|
95
98
|
resolve(ret);
|
|
96
99
|
}
|
|
97
100
|
catch (err) {
|
|
@@ -105,10 +108,72 @@ function execHookDirectAsync(hookFnCaller, hook, pageContextForPublicUsage) {
|
|
|
105
108
|
}
|
|
106
109
|
function execHookDirectSync(hook, pageContext, preparePageContextForPublicUsage) {
|
|
107
110
|
const pageContextForPublicUsage = preparePageContextForPublicUsage(pageContext);
|
|
108
|
-
|
|
109
|
-
const hookReturn = hook.hookFn(pageContextForPublicUsage);
|
|
111
|
+
const hookReturn = execHookBase(() => hook.hookFn(pageContextForPublicUsage), hook, pageContext._globalContext, pageContextForPublicUsage);
|
|
110
112
|
return { hookReturn };
|
|
111
113
|
}
|
|
114
|
+
// Every execHook* variant should call this
|
|
115
|
+
function execHookBase(hookFnCaller, hook, globalContext, pageContext) {
|
|
116
|
+
const { hookName, hookFilePath } = hook;
|
|
117
|
+
assert(hookName !== 'onHookCall'); // ensure no infinite loop
|
|
118
|
+
const configValue = globalContext._pageConfigGlobal.configValues['onHookCall'];
|
|
119
|
+
const callOriginal = () => {
|
|
120
|
+
providePageContextInternal(pageContext);
|
|
121
|
+
return hookFnCaller();
|
|
122
|
+
};
|
|
123
|
+
// +onHookCall doesn't exist
|
|
124
|
+
if (!configValue?.value)
|
|
125
|
+
return callOriginal();
|
|
126
|
+
// +onHookCall wrapping
|
|
127
|
+
let originalCalled = false;
|
|
128
|
+
let originalReturn;
|
|
129
|
+
let originalError;
|
|
130
|
+
let call = () => {
|
|
131
|
+
originalCalled = true;
|
|
132
|
+
try {
|
|
133
|
+
originalReturn = callOriginal();
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
originalError = err;
|
|
137
|
+
}
|
|
138
|
+
return originalReturn;
|
|
139
|
+
};
|
|
140
|
+
for (const onHookCall of configValue.value) {
|
|
141
|
+
const hookPublic = { name: hookName, filePath: hookFilePath, call };
|
|
142
|
+
// Recursively wrap callOriginal() so +onHookCall can use async hooks. (E.g. vike-react-sentry integrates Sentry's `Tracer.startActiveSpan()`.)
|
|
143
|
+
call = () => {
|
|
144
|
+
;
|
|
145
|
+
(async () => {
|
|
146
|
+
try {
|
|
147
|
+
await onHookCall(hookPublic, pageContext);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
console.error(err);
|
|
151
|
+
/* TO-DO/eventually: use dependency injection to be able to use logErrorServer() when this function runs on the server-side.
|
|
152
|
+
if (
|
|
153
|
+
!globalThis.__VIKE__IS_CLIENT &&
|
|
154
|
+
pageContext &&
|
|
155
|
+
// Avoid infinite loop
|
|
156
|
+
hookName !== 'onError'
|
|
157
|
+
) {
|
|
158
|
+
assert(!pageContext.isClientSide)
|
|
159
|
+
logErrorServer(err, pageContext)
|
|
160
|
+
} else {
|
|
161
|
+
logErrorClient(err)
|
|
162
|
+
}
|
|
163
|
+
//*/
|
|
164
|
+
}
|
|
165
|
+
})();
|
|
166
|
+
// +onHookCall must run hook.call() before any `await` — https://github.com/vikejs/vike/pull/2978#discussion_r2645232953
|
|
167
|
+
assertUsage(originalCalled, 'onHookCall() must run hook.call()');
|
|
168
|
+
return originalReturn;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// Start the call() chain
|
|
172
|
+
call();
|
|
173
|
+
if (originalError)
|
|
174
|
+
throw originalError;
|
|
175
|
+
return originalReturn;
|
|
176
|
+
}
|
|
112
177
|
function isNotDisabled(timeout) {
|
|
113
178
|
return !!timeout && timeout !== Infinity;
|
|
114
179
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { prepareGlobalContextForPublicUsage };
|
|
2
2
|
export type { GlobalContextPrepareMinimum };
|
|
3
|
+
import type { PageConfigGlobalRuntime } from '../types/PageConfig.js';
|
|
3
4
|
type GlobalContextPrepareMinimum = {
|
|
4
5
|
_isOriginalObject: true;
|
|
5
6
|
isGlobalContext: true;
|
|
7
|
+
_pageConfigGlobal: PageConfigGlobalRuntime;
|
|
6
8
|
};
|
|
7
9
|
declare function prepareGlobalContextForPublicUsage<GlobalContext extends GlobalContextPrepareMinimum>(globalContext: GlobalContext): GlobalContext & {
|
|
8
10
|
_isProxyObject: true;
|
|
@@ -2,11 +2,10 @@ export { preparePageContextForPublicUsage };
|
|
|
2
2
|
export { assertPropertyGetters };
|
|
3
3
|
export type { PageContextPrepareMinimum };
|
|
4
4
|
import { type GlobalContextPrepareMinimum } from './prepareGlobalContextForPublicUsage.js';
|
|
5
|
+
import type { PageContextCreatedBase } from './createPageContextShared.js';
|
|
5
6
|
type PageContextPrepareMinimum = {
|
|
6
|
-
_isOriginalObject: true;
|
|
7
|
-
isPageContext: true;
|
|
8
7
|
_globalContext: GlobalContextPrepareMinimum;
|
|
9
|
-
};
|
|
8
|
+
} & PageContextCreatedBase;
|
|
10
9
|
declare function preparePageContextForPublicUsage<PageContext extends PageContextPrepareMinimum>(pageContext: PageContext): PageContext & {
|
|
11
10
|
_isProxyObject: true;
|
|
12
11
|
_originalObject: PageContext;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export type { ConfigResolved };
|
|
2
|
-
import type { ConfigBuiltIn, ConfigBuiltInResolved
|
|
2
|
+
import type { ConfigBuiltIn, ConfigBuiltInResolved } from '../Config.js';
|
|
3
|
+
import type { ImportStringList } from '../../node/vite/shared/importString.js';
|
|
3
4
|
type ConfigUnresolved = WithoutImportString<ConfigBuiltIn & Vike.Config>;
|
|
4
5
|
type ConfigResolvedOnly = ConfigBuiltInResolved & Vike.ConfigResolved;
|
|
5
6
|
type ConfigResolved = ConfigResolvedOnly & Omit<ConfigUnresolved, keyof ConfigResolvedOnly>;
|
|
6
7
|
type WithoutImportString<T> = {
|
|
7
|
-
[K in keyof T]: Exclude<T[K],
|
|
8
|
+
[K in keyof T]: Exclude<T[K], ImportStringList>;
|
|
8
9
|
};
|
package/dist/types/Config.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export type { HookName };
|
|
|
8
8
|
export type { HookNameOld };
|
|
9
9
|
export type { HookNamePage };
|
|
10
10
|
export type { HookNameGlobal };
|
|
11
|
-
export type { ImportString };
|
|
12
11
|
export type { Route };
|
|
13
12
|
export type { KeepScrollPosition };
|
|
14
13
|
export type { DataAsync };
|
|
@@ -47,10 +46,12 @@ import type { GlobalContext } from './GlobalContext.js';
|
|
|
47
46
|
import type { InlineConfig } from 'vite';
|
|
48
47
|
import type { PassToClientPublic } from '../server/runtime/renderPageServer/html/serializeContext.js';
|
|
49
48
|
import type { CliPreviewConfig } from '../node/api/preview.js';
|
|
49
|
+
import type { StaticReplace } from '../node/vite/plugins/pluginStaticReplace/applyStaticReplace.js';
|
|
50
|
+
import type { ImportStringList } from '../node/vite/shared/importString.js';
|
|
50
51
|
type HookNameOld = HookName | HookNameOldDesign;
|
|
51
52
|
type HookName = HookNamePage | HookNameGlobal;
|
|
52
53
|
type HookNamePage = 'onHydrationEnd' | 'onBeforePrerenderStart' | 'onBeforeRender' | 'onPageTransitionStart' | 'onPageTransitionEnd' | 'onRenderHtml' | 'onRenderClient' | 'guard' | 'data' | 'onData' | 'route';
|
|
53
|
-
type HookNameGlobal = 'onBeforeRoute' | 'onPrerenderStart' | 'onCreatePageContext' | 'onCreateGlobalContext' | 'onError';
|
|
54
|
+
type HookNameGlobal = 'onBeforeRoute' | 'onPrerenderStart' | 'onCreatePageContext' | 'onCreateGlobalContext' | 'onError' | 'onHookCall';
|
|
54
55
|
type HookNameOldDesign = 'render' | 'prerender' | 'onBeforePrerender';
|
|
55
56
|
type ConfigNameBuiltIn = Exclude<keyof ConfigBuiltIn, keyof VikeVitePluginOptions | 'onBeforeRoute' | 'onPrerenderStart' | 'vite' | 'redirects'> | 'prerender' | 'hasServerOnlyHook' | 'isClientRuntimeLoaded' | 'onBeforeRenderEnv' | 'dataEnv' | 'guardEnv' | 'hooksTimeout' | 'clientHooks' | 'middleware';
|
|
56
57
|
type ConfigNameGlobal = 'onPrerenderStart' | 'onBeforeRoute' | 'prerender' | 'disableAutoFullBuild' | 'includeAssetsImportedByServer' | 'baseAssets' | 'baseServer' | 'redirects' | 'trailingSlash' | 'disableUrlNormalization' | 'vite';
|
|
@@ -250,12 +251,12 @@ type ConfigBuiltIn = {
|
|
|
250
251
|
*
|
|
251
252
|
* https://vike.dev/route
|
|
252
253
|
*/
|
|
253
|
-
route?: Route |
|
|
254
|
+
route?: Route | ImportStringList;
|
|
254
255
|
/** Protect page(s), e.g. forbid unauthorized access.
|
|
255
256
|
*
|
|
256
257
|
* https://vike.dev/guard
|
|
257
258
|
*/
|
|
258
|
-
guard?: GuardAsync | GuardSync |
|
|
259
|
+
guard?: GuardAsync | GuardSync | ImportStringList;
|
|
259
260
|
/**
|
|
260
261
|
* Pre-render page(s).
|
|
261
262
|
*
|
|
@@ -264,7 +265,7 @@ type ConfigBuiltIn = {
|
|
|
264
265
|
*
|
|
265
266
|
* @default false
|
|
266
267
|
*/
|
|
267
|
-
prerender?: boolean |
|
|
268
|
+
prerender?: boolean | ImportStringList | {
|
|
268
269
|
/**
|
|
269
270
|
* Allow only some of your pages to be pre-rendered.
|
|
270
271
|
*
|
|
@@ -339,32 +340,41 @@ type ConfigBuiltIn = {
|
|
|
339
340
|
*
|
|
340
341
|
* https://vike.dev/extends
|
|
341
342
|
*/
|
|
342
|
-
extends?: Config |
|
|
343
|
+
extends?: Config | Config[] | ImportStringList;
|
|
343
344
|
/** Hook called before the page is rendered.
|
|
344
345
|
*
|
|
345
346
|
* https://vike.dev/onBeforeRender
|
|
346
347
|
*/
|
|
347
|
-
onBeforeRender?: OnBeforeRenderAsync | OnBeforeRenderSync |
|
|
348
|
+
onBeforeRender?: OnBeforeRenderAsync | OnBeforeRenderSync | ImportStringList | null;
|
|
348
349
|
/** Hook called when a `pageContext` object is created.
|
|
349
350
|
*
|
|
350
351
|
* https://vike.dev/onCreatePageContext
|
|
351
352
|
*/
|
|
352
|
-
onCreatePageContext?: ((pageContext: PageContextServer) => void) |
|
|
353
|
+
onCreatePageContext?: ((pageContext: PageContextServer) => void) | ImportStringList | null;
|
|
353
354
|
/** Hook called when an error occurs during server-side rendering.
|
|
354
355
|
*
|
|
355
356
|
* https://vike.dev/onError
|
|
356
357
|
*/
|
|
357
|
-
onError?: ((error: unknown, pageContext: null | PageContextServer) => void) |
|
|
358
|
+
onError?: ((error: unknown, pageContext: null | PageContextServer) => void) | ImportStringList | null;
|
|
358
359
|
/** Hook called when the `globalContext` object is created.
|
|
359
360
|
*
|
|
360
361
|
* https://vike.dev/onCreateGlobalContext
|
|
361
362
|
*/
|
|
362
|
-
onCreateGlobalContext?: ((globalContext: GlobalContext) => void) |
|
|
363
|
+
onCreateGlobalContext?: ((globalContext: GlobalContext) => void) | ImportStringList | null;
|
|
364
|
+
/** Called whenever a hook is called.
|
|
365
|
+
*
|
|
366
|
+
* https://vike.dev/onHookCall
|
|
367
|
+
*/
|
|
368
|
+
onHookCall?: ((hook: {
|
|
369
|
+
name: HookName;
|
|
370
|
+
filePath: string;
|
|
371
|
+
call: () => void | Promise<void>;
|
|
372
|
+
}, pageContext: PageContextClient | PageContextServer | null) => void | Promise<void>) | ImportStringList;
|
|
363
373
|
/** Hook for fetching data.
|
|
364
374
|
*
|
|
365
375
|
* https://vike.dev/data
|
|
366
376
|
*/
|
|
367
|
-
data?: DataAsync<unknown> | DataSync<unknown> |
|
|
377
|
+
data?: DataAsync<unknown> | DataSync<unknown> | ImportStringList | null;
|
|
368
378
|
/** Hook called as soon as `pageContext.data` is available.
|
|
369
379
|
*
|
|
370
380
|
* https://vike.dev/onData
|
|
@@ -374,83 +384,83 @@ type ConfigBuiltIn = {
|
|
|
374
384
|
*
|
|
375
385
|
* https://vike.dev/passToClient
|
|
376
386
|
*/
|
|
377
|
-
passToClient?: PassToClientPublic |
|
|
387
|
+
passToClient?: PassToClientPublic | ImportStringList;
|
|
378
388
|
/** Hook called when page is rendered on the client-side.
|
|
379
389
|
*
|
|
380
390
|
* https://vike.dev/onRenderClient
|
|
381
391
|
*/
|
|
382
|
-
onRenderClient?: OnRenderClientAsync | OnRenderClientSync |
|
|
392
|
+
onRenderClient?: OnRenderClientAsync | OnRenderClientSync | ImportStringList;
|
|
383
393
|
/** Hook called when page is rendered to HTML on the server-side.
|
|
384
394
|
*
|
|
385
395
|
* https://vike.dev/onRenderHtml
|
|
386
396
|
*/
|
|
387
|
-
onRenderHtml?: OnRenderHtmlAsync | OnRenderHtmlSync |
|
|
397
|
+
onRenderHtml?: OnRenderHtmlAsync | OnRenderHtmlSync | ImportStringList;
|
|
388
398
|
/** Enable async Route Functions.
|
|
389
399
|
*
|
|
390
400
|
* https://vike.dev/route-function#async
|
|
391
401
|
*/
|
|
392
|
-
iKnowThePerformanceRisksOfAsyncRouteFunctions?: boolean |
|
|
402
|
+
iKnowThePerformanceRisksOfAsyncRouteFunctions?: boolean | ImportStringList;
|
|
393
403
|
/** Change the URL root of Filesystem Routing.
|
|
394
404
|
*
|
|
395
405
|
* https://vike.dev/filesystemRoutingRoot
|
|
396
406
|
*/
|
|
397
|
-
filesystemRoutingRoot?: string |
|
|
407
|
+
filesystemRoutingRoot?: string | ImportStringList;
|
|
398
408
|
/** Page Hook called when pre-rendering starts.
|
|
399
409
|
*
|
|
400
410
|
* https://vike.dev/onPrerenderStart
|
|
401
411
|
*/
|
|
402
|
-
onPrerenderStart?: OnPrerenderStartAsync | OnPrerenderStartSync |
|
|
412
|
+
onPrerenderStart?: OnPrerenderStartAsync | OnPrerenderStartSync | ImportStringList;
|
|
403
413
|
/** Global Hook called before the whole pre-rendering process starts.
|
|
404
414
|
*
|
|
405
415
|
* https://vike.dev/onBeforePrerenderStart
|
|
406
416
|
*/
|
|
407
|
-
onBeforePrerenderStart?: OnBeforePrerenderStartAsync | OnBeforePrerenderStartSync |
|
|
417
|
+
onBeforePrerenderStart?: OnBeforePrerenderStartAsync | OnBeforePrerenderStartSync | ImportStringList;
|
|
408
418
|
/** Hook called before the URL is routed to a page.
|
|
409
419
|
*
|
|
410
420
|
* https://vike.dev/onBeforeRoute
|
|
411
421
|
*/
|
|
412
|
-
onBeforeRoute?: OnBeforeRouteAsync | OnBeforeRouteSync |
|
|
422
|
+
onBeforeRoute?: OnBeforeRouteAsync | OnBeforeRouteSync | ImportStringList;
|
|
413
423
|
/** Hook called after the page is hydrated.
|
|
414
424
|
*
|
|
415
425
|
* https://vike.dev/onHydrationEnd
|
|
416
426
|
*/
|
|
417
|
-
onHydrationEnd?: OnHydrationEndAsync | OnHydrationEndSync |
|
|
427
|
+
onHydrationEnd?: OnHydrationEndAsync | OnHydrationEndSync | ImportStringList;
|
|
418
428
|
/** Hook called before the user navigates to a new page.
|
|
419
429
|
*
|
|
420
430
|
* https://vike.dev/onPageTransitionStart
|
|
421
431
|
*/
|
|
422
|
-
onPageTransitionStart?: OnPageTransitionStartAsync | OnPageTransitionStartSync |
|
|
432
|
+
onPageTransitionStart?: OnPageTransitionStartAsync | OnPageTransitionStartSync | ImportStringList;
|
|
423
433
|
/** Hook called after the user navigates to a new page.
|
|
424
434
|
*
|
|
425
435
|
* https://vike.dev/onPageTransitionEnd
|
|
426
436
|
*/
|
|
427
|
-
onPageTransitionEnd?: OnPageTransitionEndAsync | OnPageTransitionEndSync |
|
|
437
|
+
onPageTransitionEnd?: OnPageTransitionEndAsync | OnPageTransitionEndSync | ImportStringList;
|
|
428
438
|
/** Whether the UI framework (React/Vue/Solid/...) allows the page's hydration to be aborted.
|
|
429
439
|
*
|
|
430
440
|
* https://vike.dev/hydrationCanBeAborted
|
|
431
441
|
*/
|
|
432
|
-
hydrationCanBeAborted?: boolean |
|
|
442
|
+
hydrationCanBeAborted?: boolean | ImportStringList;
|
|
433
443
|
/** Add client code.
|
|
434
444
|
*
|
|
435
445
|
* https://vike.dev/client
|
|
436
446
|
*/
|
|
437
|
-
client?: string |
|
|
447
|
+
client?: string | ImportStringList;
|
|
438
448
|
/** Enable Client Routing.
|
|
439
449
|
*
|
|
440
450
|
* https://vike.dev/clientRouting
|
|
441
451
|
*/
|
|
442
|
-
clientRouting?: boolean |
|
|
452
|
+
clientRouting?: boolean | ImportStringList;
|
|
443
453
|
/**
|
|
444
454
|
* Whether hooks are loaded on the client-side.
|
|
445
455
|
*
|
|
446
456
|
* https://vike.dev/clientHooks
|
|
447
457
|
*/
|
|
448
|
-
clientHooks?: boolean | null |
|
|
458
|
+
clientHooks?: boolean | null | ImportStringList;
|
|
449
459
|
/** Create new or modify existing configurations.
|
|
450
460
|
*
|
|
451
461
|
* https://vike.dev/meta
|
|
452
462
|
*/
|
|
453
|
-
meta?: ConfigMeta |
|
|
463
|
+
meta?: ConfigMeta | ImportStringList;
|
|
454
464
|
/** Vite configuration.
|
|
455
465
|
*
|
|
456
466
|
* https://vite.dev/config/
|
|
@@ -498,13 +508,13 @@ type ConfigBuiltIn = {
|
|
|
498
508
|
*
|
|
499
509
|
* https://vike.dev/prefetch
|
|
500
510
|
*/
|
|
501
|
-
prefetch?: PrefetchSetting |
|
|
511
|
+
prefetch?: PrefetchSetting | ImportStringList;
|
|
502
512
|
/** @deprecated Use `prefetch` setting (https://vike.dev/prefetch) instead. */
|
|
503
513
|
/** Prefetch links.
|
|
504
514
|
*
|
|
505
515
|
* https://vike.dev/prefetchStaticAssets
|
|
506
516
|
*/
|
|
507
|
-
prefetchStaticAssets?: PrefetchStaticAssets |
|
|
517
|
+
prefetchStaticAssets?: PrefetchStaticAssets | ImportStringList;
|
|
508
518
|
/** Modify the timeouts of hooks. */
|
|
509
519
|
hooksTimeout?: HooksTimeoutProvidedByUser;
|
|
510
520
|
/** `Cache-Control` HTTP header value.
|
|
@@ -587,13 +597,19 @@ type ConfigBuiltIn = {
|
|
|
587
597
|
cli?: {
|
|
588
598
|
preview?: CliPreviewConfig;
|
|
589
599
|
};
|
|
600
|
+
/**
|
|
601
|
+
* Static code transformations for optimizations like removing component children server-side.
|
|
602
|
+
*
|
|
603
|
+
* @experimental
|
|
604
|
+
*/
|
|
605
|
+
staticReplace?: StaticReplace[];
|
|
590
606
|
};
|
|
591
607
|
type ConfigBuiltInResolved = {
|
|
592
608
|
passToClient?: string[][];
|
|
593
609
|
redirects?: Record<string, string>[];
|
|
594
|
-
prerender?: Exclude<Config['prerender'],
|
|
610
|
+
prerender?: Exclude<Config['prerender'], ImportStringList | undefined>[];
|
|
595
611
|
middleware?: Function[];
|
|
596
|
-
headersResponse?: Exclude<Config['headersResponse'],
|
|
612
|
+
headersResponse?: Exclude<Config['headersResponse'], ImportStringList | undefined>[];
|
|
613
|
+
staticReplace?: StaticReplace[][];
|
|
597
614
|
};
|
|
598
615
|
type ConfigMeta = Record<string, ConfigDefinition>;
|
|
599
|
-
type ImportString = `import:${string}`;
|
package/dist/types/Config.js
CHANGED
|
@@ -25,7 +25,7 @@ import type { ConfigValueSerialized } from '../shared-server-client/page-configs
|
|
|
25
25
|
import type { LocationId } from '../node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js';
|
|
26
26
|
import type { FilePath } from './FilePath.js';
|
|
27
27
|
import type { ConfigDefinitionsInternal } from '../node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js';
|
|
28
|
-
import type { PlusFile } from '../node/vite/shared/resolveVikeConfigInternal/
|
|
28
|
+
import type { PlusFile } from '../node/vite/shared/resolveVikeConfigInternal/getPlusFilesByLocationId.js';
|
|
29
29
|
import type { ApiOperation } from '../node/api/types.js';
|
|
30
30
|
type PageConfigCommon = {
|
|
31
31
|
pageId: string;
|
|
@@ -7,6 +7,7 @@ export type { PageContextInternalServer };
|
|
|
7
7
|
export type { PageContextInternalClient };
|
|
8
8
|
export type { PageContextInternalClient_ServerRouting };
|
|
9
9
|
export type { PageContextInternalClient_ClientRouting };
|
|
10
|
+
export type { PageContextInit };
|
|
10
11
|
export type { PageContextBuiltInServer_deprecated as PageContextBuiltInServer };
|
|
11
12
|
export type { PageContextBuiltInClientWithClientRouting_deprecated as PageContextBuiltInClientWithClientRouting };
|
|
12
13
|
export type { PageContextBuiltInClientWithServerRouting_deprecated as PageContextBuiltInClientWithServerRouting };
|
|
@@ -56,29 +57,6 @@ type PageContextBuiltInCommon<Data> = PageContextConfig & {
|
|
|
56
57
|
* https://vike.dev/pageContext#data
|
|
57
58
|
*/
|
|
58
59
|
data: Data;
|
|
59
|
-
/** The URL you provided to Vike when calling `renderPage({ urlOriginal })` in your server middleware.
|
|
60
|
-
*
|
|
61
|
-
* https://vike.dev/renderPage
|
|
62
|
-
*/
|
|
63
|
-
urlOriginal: string;
|
|
64
|
-
/**
|
|
65
|
-
* The HTTP request headers.
|
|
66
|
-
*
|
|
67
|
-
* As a string object normalized by Vike.
|
|
68
|
-
*
|
|
69
|
-
* https://vike.dev/headers
|
|
70
|
-
* https://vike.dev/pageContext#headers
|
|
71
|
-
*/
|
|
72
|
-
headers: Record<string, string> | null;
|
|
73
|
-
/**
|
|
74
|
-
* The HTTP request headers.
|
|
75
|
-
*
|
|
76
|
-
* The original object provided by the server.
|
|
77
|
-
*
|
|
78
|
-
* https://vike.dev/headers
|
|
79
|
-
* https://vike.dev/pageContext#headersOriginal
|
|
80
|
-
*/
|
|
81
|
-
headersOriginal?: unknown;
|
|
82
60
|
/**
|
|
83
61
|
* The HTTP response headers.
|
|
84
62
|
*
|
|
@@ -128,8 +106,6 @@ type PageContextBuiltInCommon<Data> = PageContextConfig & {
|
|
|
128
106
|
/** @experimental https://github.com/vikejs/vike/issues/1268 */
|
|
129
107
|
sources: Sources;
|
|
130
108
|
/** @deprecated */
|
|
131
|
-
url: string;
|
|
132
|
-
/** @deprecated */
|
|
133
109
|
pageExports: Record<string, unknown>;
|
|
134
110
|
/**
|
|
135
111
|
* Whether the Base URL is missing in the URL of the HTTP request made to the SSR server.
|
|
@@ -139,7 +115,34 @@ type PageContextBuiltInCommon<Data> = PageContextConfig & {
|
|
|
139
115
|
*/
|
|
140
116
|
isBaseMissing?: true;
|
|
141
117
|
};
|
|
142
|
-
type
|
|
118
|
+
type PageContextInit = {
|
|
119
|
+
/** The URL provided when `renderPage({ urlOriginal })` is called.
|
|
120
|
+
*
|
|
121
|
+
* https://vike.dev/renderPage
|
|
122
|
+
*/
|
|
123
|
+
urlOriginal: string;
|
|
124
|
+
/**
|
|
125
|
+
* The HTTP request headers.
|
|
126
|
+
*
|
|
127
|
+
* The original object provided by the server.
|
|
128
|
+
*
|
|
129
|
+
* https://vike.dev/headers
|
|
130
|
+
* https://vike.dev/pageContext#headersOriginal
|
|
131
|
+
*/
|
|
132
|
+
headersOriginal?: unknown;
|
|
133
|
+
/** @deprecated Set `pageContextInit.urlOriginal` instead */ url?: string;
|
|
134
|
+
/** @deprecated Set pageContextInit.headersOriginal instead */ headers?: Record<string, string>;
|
|
135
|
+
};
|
|
136
|
+
type PageContextBuiltInServer<Data> = PageContextBuiltInCommon<Data> & PageContextInit & PageContextUrlServer & {
|
|
137
|
+
/**
|
|
138
|
+
* The HTTP request headers.
|
|
139
|
+
*
|
|
140
|
+
* As a string object normalized by Vike.
|
|
141
|
+
*
|
|
142
|
+
* https://vike.dev/headers
|
|
143
|
+
* https://vike.dev/pageContext#headers
|
|
144
|
+
*/
|
|
145
|
+
headers: Record<string, string> | null;
|
|
143
146
|
/**
|
|
144
147
|
* Whether the environment is the client-side:
|
|
145
148
|
* - In the browser, the value is `true`.
|
|
@@ -182,6 +185,10 @@ type PageContextBuiltInServer<Data> = PageContextBuiltInCommon<Data> & PageConte
|
|
|
182
185
|
previousPageContext?: undefined;
|
|
183
186
|
};
|
|
184
187
|
type PageContextBuiltInClientWithClientRouting<Data> = Partial<PageContextBuiltInCommon<Data>> & Pick<PageContextBuiltInCommon<Data>, 'Page' | 'routeParams' | 'pageExports' | 'config' | 'configEntries' | 'exports' | 'exportsAll' | 'abortReason' | 'data' | 'pageId' | 'source' | 'sources' | 'from'> & PageContextClientCommon & {
|
|
188
|
+
/**
|
|
189
|
+
* The current URL unprocessed (e.g. with the Base URL).
|
|
190
|
+
*/
|
|
191
|
+
urlOriginal: string;
|
|
185
192
|
/**
|
|
186
193
|
* Whether the page is the first page rendered.
|
|
187
194
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export type { PrerenderContextPublic as PrerenderContext } from '../node/prerend
|
|
|
4
4
|
export type { PageContextBuiltInServer } from './PageContext.js';
|
|
5
5
|
export type { PageContextBuiltInClientWithClientRouting } from './PageContext.js';
|
|
6
6
|
export type { PageContextBuiltInClientWithServerRouting } from './PageContext.js';
|
|
7
|
-
export type { Config, ConfigMeta as Meta,
|
|
7
|
+
export type { Config, ConfigMeta as Meta, KeepScrollPosition, } from './Config.js';
|
|
8
|
+
export type { ImportString } from '../node/vite/shared/importString.js';
|
|
8
9
|
export type { DataAsync, DataSync, GuardAsync, GuardSync, OnBeforePrerenderStartAsync, OnBeforePrerenderStartSync, OnBeforeRenderAsync, OnBeforeRenderSync, OnBeforeRouteAsync, OnBeforeRouteSync, OnHydrationEndAsync, OnHydrationEndSync, OnPageTransitionEndAsync, OnPageTransitionEndSync, OnPageTransitionStartAsync, OnPageTransitionStartSync, OnPrerenderStartAsync, OnPrerenderStartSync, OnRenderClientAsync, OnRenderClientSync, OnRenderHtmlAsync, OnRenderHtmlSync, RouteAsync, RouteSync, } from './Config.js';
|
|
9
10
|
export type { ConfigResolved } from './Config/ConfigResolved.js';
|
|
10
11
|
export type { ConfigEnv } from './PageConfig.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.250-commit-6161324";
|
|
@@ -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.250-commit-6161324';
|