vike 0.4.222 → 0.4.223-commit-6f064ad
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/cjs/client/shared/getPageContextProxyForUser.js +1 -1
- package/dist/cjs/node/api/prepareViteApiCall.js +1 -1
- package/dist/cjs/node/plugin/index.js +6 -4
- package/dist/cjs/node/plugin/plugins/baseUrls.js +9 -2
- package/dist/cjs/node/plugin/plugins/buildApp.js +14 -7
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +49 -19
- package/dist/cjs/node/plugin/plugins/buildConfig.js +6 -1
- package/dist/cjs/node/plugin/plugins/commonConfig.js +17 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -1
- package/dist/cjs/node/plugin/plugins/envVars.js +2 -18
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +4 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +11 -10
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +8 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +36 -71
- package/dist/cjs/node/plugin/shared/findPageFiles.js +3 -3
- package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +1 -1
- package/dist/cjs/node/plugin/shared/viteIsSSR.js +19 -10
- package/dist/cjs/node/prerender/runPrerender.js +3 -1
- package/dist/cjs/node/runtime/globalContext.js +19 -8
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -1
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +24 -0
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +1 -1
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -1
- package/dist/cjs/node/runtime/renderPage/isNewError.js +1 -1
- package/dist/cjs/node/runtime/renderPage/isVikeConfigInvalid.js +10 -0
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +7 -1
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
- package/dist/cjs/node/runtime/renderPage.js +63 -49
- package/dist/cjs/node/runtime/universal-middleware.js +14 -0
- package/dist/cjs/node/shared/resolveBase.js +0 -13
- package/dist/cjs/shared/getPageConfigsRuntime.js +2 -8
- package/dist/cjs/shared/getPageContextRequestUrl.js +1 -1
- package/dist/cjs/shared/getPageContextUrlComputed.js +12 -9
- package/dist/cjs/shared/hooks/getHook.js +1 -1
- package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +44 -12
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -8
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +16 -6
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assert.js +1 -1
- package/dist/cjs/utils/assertSetup.js +1 -1
- package/dist/cjs/utils/assertSingleInstance.js +2 -2
- package/dist/cjs/utils/findFile.js +1 -1
- package/dist/cjs/utils/getGlobalObject.js +2 -6
- package/dist/cjs/utils/parseUrl-extras.js +2 -2
- package/dist/cjs/utils/parseUrl.js +5 -5
- package/dist/esm/client/client-routing-runtime/getPageContextCurrent.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/getPageContextCurrent.js +1 -1
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +4 -4
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.js +1 -1
- package/dist/esm/client/client-routing-runtime/history.js +1 -1
- package/dist/esm/client/client-routing-runtime/index.d.ts +1 -0
- package/dist/esm/client/client-routing-runtime/index.js +1 -0
- package/dist/esm/client/client-routing-runtime/prefetch/getPrefetchSettings.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/prefetch.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/prefetch.js +3 -3
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +8 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +12 -3
- package/dist/esm/client/client-routing-runtime/scrollRestoration.js +1 -1
- package/dist/esm/client/client-routing-runtime/skipLink.js +2 -2
- package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +1 -1
- package/dist/esm/client/shared/executeOnRenderClientHook.d.ts +2 -2
- package/dist/esm/client/shared/getPageContextProxyForUser.js +1 -1
- package/dist/esm/client/shared/loadUserFilesClientSide.d.ts +2 -2
- package/dist/esm/client/shared/loadUserFilesClientSide.js +2 -2
- package/dist/esm/client/shared/preparePageContextForUserConsumptionClientSide.d.ts +2 -2
- package/dist/esm/node/api/prepareViteApiCall.js +1 -1
- package/dist/esm/node/plugin/index.d.ts +6 -2
- package/dist/esm/node/plugin/index.js +2 -1
- package/dist/esm/node/plugin/plugins/baseUrls.js +9 -2
- package/dist/esm/node/plugin/plugins/buildApp.js +14 -7
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +49 -19
- package/dist/esm/node/plugin/plugins/buildConfig.js +6 -1
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +14 -6
- package/dist/esm/node/plugin/plugins/commonConfig.js +17 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/plugin/plugins/envVars.js +2 -18
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +3 -3
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +10 -9
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +8 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +5 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +38 -73
- package/dist/esm/node/plugin/shared/findPageFiles.js +3 -3
- package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js +2 -2
- package/dist/esm/node/plugin/shared/viteIsSSR.d.ts +7 -4
- package/dist/esm/node/plugin/shared/viteIsSSR.js +20 -11
- package/dist/esm/node/prerender/runPrerender.js +3 -1
- package/dist/esm/node/runtime/globalContext.d.ts +9 -8
- package/dist/esm/node/runtime/globalContext.js +19 -8
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.d.ts +2 -2
- package/dist/esm/node/runtime/html/injectAssets.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -1
- package/dist/esm/node/runtime/renderPage/createHttpResponse.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/createHttpResponse.js +24 -0
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +1 -1
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -1
- package/dist/esm/node/runtime/renderPage/isNewError.js +1 -1
- package/dist/esm/node/runtime/renderPage/isVikeConfigInvalid.d.ts +6 -0
- package/dist/esm/node/runtime/renderPage/isVikeConfigInvalid.js +8 -0
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +3 -3
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +2 -2
- package/dist/esm/node/runtime/renderPage/log404/index.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +7 -1
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +4 -4
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +12 -12
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
- package/dist/esm/node/runtime/renderPage.d.ts +5 -5
- package/dist/esm/node/runtime/renderPage.js +64 -49
- package/dist/esm/node/runtime/universal-middleware.d.ts +1 -0
- package/dist/esm/node/runtime/universal-middleware.js +11 -0
- package/dist/esm/node/shared/resolveBase.d.ts +1 -9
- package/dist/esm/node/shared/resolveBase.js +0 -13
- package/dist/esm/shared/getPageConfigsRuntime.d.ts +2 -2
- package/dist/esm/shared/getPageConfigsRuntime.js +3 -9
- package/dist/esm/shared/getPageContextRequestUrl.js +1 -1
- package/dist/esm/shared/getPageContextUrlComputed.js +12 -9
- package/dist/esm/shared/getPageFiles.d.ts +1 -1
- package/dist/esm/shared/hooks/getHook.d.ts +3 -3
- package/dist/esm/shared/hooks/getHook.js +1 -1
- package/dist/esm/shared/page-configs/Config.d.ts +3 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +12 -4
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.d.ts +24 -16
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.js +44 -12
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +3 -2
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -8
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.d.ts +2 -0
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +16 -6
- package/dist/esm/shared/route/executeGuardHook.d.ts +2 -2
- package/dist/esm/shared/route/loadPageRoutes.js +1 -1
- package/dist/esm/shared/types.d.ts +6 -0
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assert.js +1 -1
- package/dist/esm/utils/assertSetup.js +1 -1
- package/dist/esm/utils/assertSingleInstance.js +2 -2
- package/dist/esm/utils/findFile.js +1 -1
- package/dist/esm/utils/getGlobalObject.d.ts +3 -2
- package/dist/esm/utils/getGlobalObject.js +2 -6
- package/dist/esm/utils/parseUrl-extras.js +2 -2
- package/dist/esm/utils/parseUrl.d.ts +3 -4
- package/dist/esm/utils/parseUrl.js +5 -5
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +16 -3
- package/universal-middleware.js +3 -0
- package/dist/cjs/node/runtime/renderPage/isConfigInvalid.js +0 -10
- package/dist/esm/node/runtime/renderPage/isConfigInvalid.d.ts +0 -6
- package/dist/esm/node/runtime/renderPage/isConfigInvalid.js +0 -8
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// - We dedupe errors ourself with getHttpRequestAsyncStore().shouldErrorBeSwallowed()
|
|
11
11
|
export { getHttpRequestAsyncStore };
|
|
12
12
|
export { installHttpRequestAsyncStore };
|
|
13
|
-
import {
|
|
13
|
+
import { renderPage_addAsyncHookwrapper } from '../../runtime/renderPage.js';
|
|
14
14
|
import { assert, assertIsNotProductionRuntime, isObject, unique } from '../utils.js';
|
|
15
15
|
import { getConfigBuildErrorFormatted } from '../plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js';
|
|
16
16
|
import { logErrorDebugNote } from './loggerNotProd.js';
|
|
@@ -27,7 +27,7 @@ async function installHttpRequestAsyncStore() {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
asyncLocalStorage = new mod.AsyncLocalStorage();
|
|
30
|
-
|
|
30
|
+
renderPage_addAsyncHookwrapper(async (httpRequestId, renderPage) => {
|
|
31
31
|
assert(asyncLocalStorage);
|
|
32
32
|
const loggedErrors = new Set();
|
|
33
33
|
const markErrorAsLogged = (err) => {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { ResolvedConfig, UserConfig } from 'vite';
|
|
2
1
|
export { viteIsSSR };
|
|
3
2
|
export { viteIsSSR_options };
|
|
3
|
+
export { viteIsSSR_safe };
|
|
4
|
+
import type { ResolvedConfig, UserConfig } from 'vite';
|
|
4
5
|
declare function viteIsSSR(config: ResolvedConfig | UserConfig): boolean;
|
|
5
|
-
|
|
6
|
+
declare function viteIsSSR_options(options: {
|
|
7
|
+
ssr?: boolean;
|
|
8
|
+
} | undefined): boolean;
|
|
9
|
+
declare function viteIsSSR_safe(config: ResolvedConfig, options: {
|
|
6
10
|
ssr?: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare function viteIsSSR_options(options: Options): boolean;
|
|
11
|
+
} | undefined): boolean;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import { assert } from '../../../utils/assert.js';
|
|
2
|
-
import { isObject } from '../../../utils/isObject.js';
|
|
3
1
|
export { viteIsSSR };
|
|
4
2
|
export { viteIsSSR_options };
|
|
3
|
+
export { viteIsSSR_safe };
|
|
4
|
+
import { assert } from '../../../utils/assert.js';
|
|
5
5
|
function viteIsSSR(config) {
|
|
6
6
|
return !!config?.build?.ssr;
|
|
7
7
|
}
|
|
8
|
-
// https://github.com/vitejs/vite/discussions/5109#discussioncomment-1450726
|
|
9
8
|
function viteIsSSR_options(options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
return !!options?.ssr;
|
|
10
|
+
}
|
|
11
|
+
// Vite is quite messy about setting `ssr: boolean`, thus we use an extra safe implemention for security purposes.
|
|
12
|
+
// It's used for .client.js and .server.js guarantee thus we use agressive assert() calls for added safety.
|
|
13
|
+
function viteIsSSR_safe(config, options) {
|
|
14
|
+
if (config.command === 'build') {
|
|
15
|
+
assert(typeof config.build.ssr === 'boolean');
|
|
16
|
+
const val = config.build.ssr;
|
|
17
|
+
if (options?.ssr !== undefined)
|
|
18
|
+
assert(val === options.ssr);
|
|
19
|
+
return val;
|
|
15
20
|
}
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
else {
|
|
22
|
+
assert(typeof options?.ssr === 'boolean');
|
|
23
|
+
const val = options.ssr;
|
|
24
|
+
/* This assert() fails (which is very unexpected).
|
|
25
|
+
if (typeof config.build.ssr === 'boolean') assert(val === config.build.ssr)
|
|
26
|
+
//*/
|
|
27
|
+
return val;
|
|
18
28
|
}
|
|
19
|
-
assert(false);
|
|
20
29
|
}
|
|
@@ -30,6 +30,7 @@ import { resolvePrerenderConfig, resolvePrerenderConfigLocal } from './resolvePr
|
|
|
30
30
|
import { getOutDirs } from '../plugin/shared/getOutDirs.js';
|
|
31
31
|
import { isVikeCli } from '../cli/context.js';
|
|
32
32
|
import { isViteCliCall } from '../plugin/shared/isViteCliCall.js';
|
|
33
|
+
import { getVikeConfigPublic } from '../plugin/plugins/commonConfig.js';
|
|
33
34
|
async function runPrerenderFromAPI(options = {}) {
|
|
34
35
|
return await runPrerender(options, 'prerender()');
|
|
35
36
|
// - We purposely propagate the error to the user land, so that the error interrupts the user land. It's also, I guess, a nice-to-have that the user has control over the error.
|
|
@@ -60,7 +61,8 @@ async function runPrerenderFromAutoRun(viteConfig, config) {
|
|
|
60
61
|
logErrorHint(err);
|
|
61
62
|
process.exit(1);
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
const vike = getVikeConfigPublic(config);
|
|
65
|
+
vike.prerenderContext = prerenderContextPublic;
|
|
64
66
|
const forceExit = isVikeCli() || isViteCliCall();
|
|
65
67
|
return { forceExit };
|
|
66
68
|
}
|
|
@@ -16,24 +16,25 @@ export { assertBuildInfo };
|
|
|
16
16
|
export { getViteConfigRuntime };
|
|
17
17
|
export { updateUserFiles };
|
|
18
18
|
export type { BuildInfo };
|
|
19
|
-
export type {
|
|
19
|
+
export type { GlobalContextInternal };
|
|
20
20
|
export type { GlobalContextPublic };
|
|
21
21
|
import type { ViteManifest } from '../shared/ViteManifest.js';
|
|
22
22
|
import type { ResolvedConfig, ViteDevServer } from 'vite';
|
|
23
|
-
import type {
|
|
23
|
+
import type { PageConfigUserFriendly, PageConfigsUserFriendly } from '../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
24
24
|
import type { ConfigVitePluginServerEntry } from '@brillout/vite-plugin-server-entry/plugin';
|
|
25
|
-
|
|
25
|
+
import { type BaseUrlsResolved } from '../shared/resolveBase.js';
|
|
26
|
+
type GlobalContextPublic = Pick<GlobalContext, 'assetsManifest' | 'config' | 'viteConfig' | 'pages' | 'baseAssets' | 'baseServer'>;
|
|
26
27
|
type PageRuntimeInfo = Awaited<ReturnType<typeof getUserFiles>>;
|
|
27
|
-
type
|
|
28
|
+
type GlobalContextInternal = GlobalContext & {
|
|
28
29
|
globalContext_public: GlobalContextPublic;
|
|
29
30
|
};
|
|
30
|
-
type
|
|
31
|
+
type GlobalContext = {
|
|
31
32
|
viteConfigRuntime: {
|
|
32
33
|
_baseViteOriginal: null | string;
|
|
33
34
|
};
|
|
34
|
-
config:
|
|
35
|
+
config: PageConfigUserFriendly['config'];
|
|
35
36
|
pages: PageConfigsUserFriendly;
|
|
36
|
-
} & PageRuntimeInfo & ({
|
|
37
|
+
} & BaseUrlsResolved & PageRuntimeInfo & ({
|
|
37
38
|
isProduction: false;
|
|
38
39
|
isPrerendering: false;
|
|
39
40
|
viteConfig: ResolvedConfig;
|
|
@@ -51,7 +52,7 @@ type GlobalContextWithoutPublicCopy = {
|
|
|
51
52
|
usesClientRouter: boolean;
|
|
52
53
|
viteConfig: ResolvedConfig;
|
|
53
54
|
})));
|
|
54
|
-
declare function getGlobalContextInternal(): Promise<
|
|
55
|
+
declare function getGlobalContextInternal(): Promise<GlobalContextInternal>;
|
|
55
56
|
/** @experimental https://vike.dev/getGlobalContext */
|
|
56
57
|
declare function getGlobalContextSync(): GlobalContextPublic;
|
|
57
58
|
/** @experimental https://vike.dev/getGlobalContext */
|
|
@@ -18,7 +18,7 @@ export { assertBuildInfo };
|
|
|
18
18
|
export { getViteConfigRuntime };
|
|
19
19
|
export { updateUserFiles };
|
|
20
20
|
// The core logic revolves around:
|
|
21
|
-
// - globalObject.userFiles which is the main requirement for
|
|
21
|
+
// - globalObject.userFiles which is the main requirement for resolveGlobalContext()
|
|
22
22
|
// - In production: globalObject.buildEntry which is the production entry set by @brillout/vite-plugin-server-entry
|
|
23
23
|
// - loadBuildEntry() sets globalObject.buildEntry and then sets globalObject.userFiles
|
|
24
24
|
// - With vike-server it's set at server start: @brillout/vite-plugin-server-entry injects `import './entry.mjs'` (the production entry generated by @brillout/vite-plugin-server-entry) as first line of code of dist/server/index.mjs while dist/server/entry.mjs calls setGlobalContext_buildEntry()
|
|
@@ -32,8 +32,9 @@ import pc from '@brillout/picocolors';
|
|
|
32
32
|
import { loadPageRoutes } from '../../shared/route/loadPageRoutes.js';
|
|
33
33
|
import { assertV1Design } from '../shared/assertV1Design.js';
|
|
34
34
|
import { getPageConfigsRuntime } from '../../shared/getPageConfigsRuntime.js';
|
|
35
|
+
import { resolveBase } from '../shared/resolveBase.js';
|
|
35
36
|
const debug = createDebugger('vike:globalContext');
|
|
36
|
-
const globalObject = getGlobalObject('globalContext.ts', getInitialGlobalContext());
|
|
37
|
+
const globalObject = getGlobalObject('runtime/globalContext.ts', getInitialGlobalContext());
|
|
37
38
|
async function getGlobalContextInternal() {
|
|
38
39
|
// getGlobalContextInternal() should always be called after initGlobalContext()
|
|
39
40
|
assert(globalObject.isInitialized);
|
|
@@ -79,7 +80,9 @@ function makePublic(globalContext) {
|
|
|
79
80
|
'assetsManifest',
|
|
80
81
|
'config',
|
|
81
82
|
'viteConfig',
|
|
82
|
-
'pages'
|
|
83
|
+
'pages',
|
|
84
|
+
'baseServer',
|
|
85
|
+
'baseAssets'
|
|
83
86
|
]);
|
|
84
87
|
return globalContextPublic;
|
|
85
88
|
}
|
|
@@ -121,7 +124,7 @@ function getViteConfig() {
|
|
|
121
124
|
}
|
|
122
125
|
async function initGlobalContext_renderPage() {
|
|
123
126
|
debug('initGlobalContext_renderPage()');
|
|
124
|
-
// globalObject.isProduction
|
|
127
|
+
// `globalObject.isProduction === undefined` when using production server without `vike-server`. (There isn't any reliable signal we can use to determine early whether the environement is production or development.)
|
|
125
128
|
if (globalObject.isProduction === undefined)
|
|
126
129
|
setIsProduction(true);
|
|
127
130
|
await initGlobalContext();
|
|
@@ -184,7 +187,7 @@ function setIsProduction(isProduction) {
|
|
|
184
187
|
globalObject.isProduction = isProduction;
|
|
185
188
|
}
|
|
186
189
|
function defineGlobalContext() {
|
|
187
|
-
const globalContext =
|
|
190
|
+
const globalContext = resolveGlobalContext();
|
|
188
191
|
assertIsDefined(globalContext);
|
|
189
192
|
const globalContext_public = makePublic(globalContext);
|
|
190
193
|
objectAssign(globalContext, { globalContext_public });
|
|
@@ -193,7 +196,7 @@ function defineGlobalContext() {
|
|
|
193
196
|
assertGlobalContextIsDefined();
|
|
194
197
|
onSetupRuntime();
|
|
195
198
|
}
|
|
196
|
-
function
|
|
199
|
+
function resolveGlobalContext() {
|
|
197
200
|
const { viteDevServer, viteConfig, isPrerendering, isProduction, userFiles } = globalObject;
|
|
198
201
|
assert(typeof isProduction === 'boolean');
|
|
199
202
|
let globalContext;
|
|
@@ -212,7 +215,8 @@ function assembleGlobalContext() {
|
|
|
212
215
|
viteDevServer,
|
|
213
216
|
viteConfig,
|
|
214
217
|
...userFiles,
|
|
215
|
-
viteConfigRuntime
|
|
218
|
+
viteConfigRuntime,
|
|
219
|
+
...resolveBaseRuntime(viteConfigRuntime, userFiles.config)
|
|
216
220
|
};
|
|
217
221
|
}
|
|
218
222
|
else {
|
|
@@ -229,7 +233,8 @@ function assembleGlobalContext() {
|
|
|
229
233
|
...userFiles,
|
|
230
234
|
viteDevServer: null,
|
|
231
235
|
viteConfigRuntime: buildInfo.viteConfigRuntime,
|
|
232
|
-
usesClientRouter: buildInfo.usesClientRouter
|
|
236
|
+
usesClientRouter: buildInfo.usesClientRouter,
|
|
237
|
+
...resolveBaseRuntime(buildInfo.viteConfigRuntime, userFiles.config)
|
|
233
238
|
};
|
|
234
239
|
if (isPrerendering) {
|
|
235
240
|
assert(viteConfig);
|
|
@@ -398,3 +403,9 @@ function getInitialGlobalContext() {
|
|
|
398
403
|
viteDevServerPromiseResolve
|
|
399
404
|
};
|
|
400
405
|
}
|
|
406
|
+
function resolveBaseRuntime(viteConfigRuntime, config) {
|
|
407
|
+
const baseViteOriginal = viteConfigRuntime._baseViteOriginal;
|
|
408
|
+
const baseServerUnresolved = config.baseServer ?? null;
|
|
409
|
+
const baseAssetsUnresolved = config.baseAssets ?? null;
|
|
410
|
+
return resolveBase(baseViteOriginal, baseServerUnresolved, baseAssetsUnresolved);
|
|
411
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getViteDevScript };
|
|
2
|
-
import type {
|
|
2
|
+
import type { GlobalContextInternal } from '../../globalContext.js';
|
|
3
3
|
declare function getViteDevScript(pageContext: {
|
|
4
|
-
_globalContext:
|
|
4
|
+
_globalContext: GlobalContextInternal;
|
|
5
5
|
}): Promise<string>;
|
|
@@ -8,7 +8,7 @@ import { type PreloadFilter } from './injectAssets/getHtmlTags.js';
|
|
|
8
8
|
import type { StreamFromReactStreamingPackage } from './stream/react-streaming.js';
|
|
9
9
|
import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js';
|
|
10
10
|
import type { PageContextSerialization } from './serializePageContextClientSide.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { GlobalContextInternal } from '../globalContext.js';
|
|
12
12
|
type PageContextInjectAssets = {
|
|
13
13
|
urlPathname: string;
|
|
14
14
|
__getPageAssets: () => Promise<PageAsset[]>;
|
|
@@ -22,7 +22,7 @@ type PageContextInjectAssets = {
|
|
|
22
22
|
_baseServer: string;
|
|
23
23
|
_pageConfigs: PageConfigRuntime[];
|
|
24
24
|
is404: null | boolean;
|
|
25
|
-
_globalContext:
|
|
25
|
+
_globalContext: GlobalContextInternal;
|
|
26
26
|
} & PageContextSerialization;
|
|
27
27
|
declare function injectHtmlTagsToString(htmlParts: HtmlPart[], pageContext: PageContextInjectAssets & {
|
|
28
28
|
_isStream: false;
|
|
@@ -2,5 +2,5 @@ export { analyzePage };
|
|
|
2
2
|
import type { PageFile } from '../../../shared/getPageFiles/getPageFileObject.js';
|
|
3
3
|
import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js';
|
|
4
4
|
import { type AnalysisResult } from '../../../shared/getPageFiles/analyzePageClientSide.js';
|
|
5
|
-
import type {
|
|
6
|
-
declare function analyzePage(pageFilesAll: PageFile[], pageConfig: null | PageConfigRuntime, pageId: string, globalContext:
|
|
5
|
+
import type { GlobalContextInternal } from '../globalContext.js';
|
|
6
|
+
declare function analyzePage(pageFilesAll: PageFile[], pageConfig: null | PageConfigRuntime, pageId: string, globalContext: GlobalContextInternal): Promise<AnalysisResult>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { assertNoInfiniteHttpRedirect };
|
|
2
2
|
import { assert, assertUsage, getGlobalObject } from '../../utils.js';
|
|
3
3
|
import pc from '@brillout/picocolors';
|
|
4
|
-
const globalObject = getGlobalObject('assertNoInfiniteHttpRedirect.ts', {
|
|
4
|
+
const globalObject = getGlobalObject('createHttpResponse/assertNoInfiniteHttpRedirect.ts', {
|
|
5
5
|
redirectGraph: {}
|
|
6
6
|
});
|
|
7
7
|
function assertNoInfiniteHttpRedirect(urlRedirectTarget, urlLogical) {
|
|
@@ -3,6 +3,7 @@ export { createHttpResponsePageContextJson };
|
|
|
3
3
|
export { createHttpResponseError };
|
|
4
4
|
export { createHttpResponseRedirect };
|
|
5
5
|
export { createHttpResponseFavicon404 };
|
|
6
|
+
export { createHttpResponseBaseIsMissing };
|
|
6
7
|
export type { HttpResponse };
|
|
7
8
|
import type { GetPageAssets } from './getPageAssets.js';
|
|
8
9
|
import type { HtmlRender } from '../html/renderHtml.js';
|
|
@@ -28,6 +29,7 @@ declare function createHttpResponsePage(htmlRender: HtmlRender, renderHook: null
|
|
|
28
29
|
abortStatusCode?: AbortStatusCode;
|
|
29
30
|
}): Promise<HttpResponse>;
|
|
30
31
|
declare function createHttpResponseFavicon404(): HttpResponse;
|
|
32
|
+
declare function createHttpResponseBaseIsMissing(urlOriginal: string, baseServer: string): HttpResponse;
|
|
31
33
|
declare function createHttpResponseError(pageContext: null | {
|
|
32
34
|
_pageFilesAll: PageFile[];
|
|
33
35
|
_pageConfigs: PageConfigRuntime[];
|
|
@@ -3,6 +3,7 @@ export { createHttpResponsePageContextJson };
|
|
|
3
3
|
export { createHttpResponseError };
|
|
4
4
|
export { createHttpResponseRedirect };
|
|
5
5
|
export { createHttpResponseFavicon404 };
|
|
6
|
+
export { createHttpResponseBaseIsMissing };
|
|
6
7
|
import { assert, assertWarning, escapeHtml } from '../utils.js';
|
|
7
8
|
import { getErrorPageId, isErrorPage } from '../../../shared/error-page.js';
|
|
8
9
|
import { getHttpResponseBody, getHttpResponseBodyStreamHandlers } from './getHttpResponseBody.js';
|
|
@@ -38,6 +39,29 @@ function createHttpResponseFavicon404() {
|
|
|
38
39
|
const httpResponse = createHttpResponse(404, 'text/html;charset=utf-8', [], "<p>No favicon.ico found.</p><script>console.log('This HTTP response was generated by Vike.')</script>");
|
|
39
40
|
return httpResponse;
|
|
40
41
|
}
|
|
42
|
+
function createHttpResponseBaseIsMissing(urlOriginal, baseServer) {
|
|
43
|
+
const httpResponse = createHttpResponse(
|
|
44
|
+
// We use the error code `500` to signal a failing state because this HTTP response should never be used, see https://vike.dev/base-url#setup
|
|
45
|
+
// In other words: this HTTP response is expected to be generated but isn't expected to be actually used.
|
|
46
|
+
500, 'text/html;charset=utf-8', [], `
|
|
47
|
+
<h1>Error: Base URL is missing</h1>
|
|
48
|
+
<p>
|
|
49
|
+
<a href="https://vike.dev/renderPage"><code>renderPage(pageContextInit)</code></a> called with <code>pageContextInit.urlOriginal===${JSON.stringify(urlOriginal)}</code> which doesn't start with the Base URL <code>${baseServer}</code>.
|
|
50
|
+
</p>
|
|
51
|
+
<p>
|
|
52
|
+
See <a href="https://vike.dev/base-url#setup">vike.dev/base-url#setup</a> for how to properly setup your server while using a Base URL.
|
|
53
|
+
</p>
|
|
54
|
+
<style>
|
|
55
|
+
code {
|
|
56
|
+
font-family: monospace;
|
|
57
|
+
background-color: #eaeaea;
|
|
58
|
+
padding: 3px 5px;
|
|
59
|
+
border-radius: 4px;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
`);
|
|
63
|
+
return httpResponse;
|
|
64
|
+
}
|
|
41
65
|
function createHttpResponseError(pageContext) {
|
|
42
66
|
const reason = (() => {
|
|
43
67
|
if (!pageContext) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { executeOnBeforeRenderAndDataHooks };
|
|
2
|
-
import { type
|
|
2
|
+
import { type PageConfigUserFriendlyOld } from '../../../shared/getPageFiles.js';
|
|
3
3
|
import { type PageContextForUserConsumptionServerSide } from './preparePageContextForUserConsumptionServerSide.js';
|
|
4
4
|
declare function executeOnBeforeRenderAndDataHooks(pageContext: {
|
|
5
5
|
pageId: string;
|
|
6
6
|
_pageContextAlreadyProvidedByOnPrerenderHook?: true;
|
|
7
|
-
} &
|
|
7
|
+
} & PageConfigUserFriendlyOld & PageContextForUserConsumptionServerSide): Promise<void>;
|
|
@@ -5,7 +5,7 @@ export type { GetPageAssets };
|
|
|
5
5
|
export type { PageContextGetPageAssets };
|
|
6
6
|
import { type MediaType } from './inferMediaType.js';
|
|
7
7
|
import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { GlobalContextInternal } from '../globalContext.js';
|
|
9
9
|
import type { ResolveClientEntriesDev } from '../../plugin/shared/resolveClientEntriesDev.js';
|
|
10
10
|
type PageAsset = {
|
|
11
11
|
src: string;
|
|
@@ -18,7 +18,7 @@ type PageContextGetPageAssets = {
|
|
|
18
18
|
_baseServer: string;
|
|
19
19
|
_baseAssets: string | null;
|
|
20
20
|
_includeAssetsImportedByServer: boolean;
|
|
21
|
-
_globalContext:
|
|
21
|
+
_globalContext: GlobalContextInternal;
|
|
22
22
|
};
|
|
23
23
|
declare function getPageAssets(pageContext: PageContextGetPageAssets, clientDependencies: ClientDependency[], clientEntries: string[]): Promise<PageAsset[]>;
|
|
24
24
|
declare function setResolveClientEntriesDev(resolveClientEntriesDev: ResolveClientEntriesDev): void;
|
|
@@ -6,7 +6,7 @@ import { retrieveAssetsProd } from './getPageAssets/retrieveAssetsProd.js';
|
|
|
6
6
|
import { inferMediaType } from './inferMediaType.js';
|
|
7
7
|
import { getManifestEntry } from './getPageAssets/getManifestEntry.js';
|
|
8
8
|
import { sortPageAssetsForEarlyHintsHeader } from './getPageAssets/sortPageAssetsForEarlyHintsHeader.js';
|
|
9
|
-
const globalObject = getGlobalObject('getPageAssets.ts', {
|
|
9
|
+
const globalObject = getGlobalObject('renderPage/getPageAssets.ts', {
|
|
10
10
|
resolveClientEntriesDev: null
|
|
11
11
|
});
|
|
12
12
|
async function getPageAssets(pageContext, clientDependencies, clientEntries) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { handleErrorWithoutErrorPage };
|
|
2
|
-
import type {
|
|
2
|
+
import type { GlobalContextInternal } from '../globalContext.js';
|
|
3
3
|
import type { PageContextAfterRender } from './renderPageAlreadyRouted.js';
|
|
4
4
|
import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js';
|
|
5
5
|
import type { PageFile } from '../../../shared/getPageFiles.js';
|
|
@@ -10,6 +10,6 @@ declare function handleErrorWithoutErrorPage<PageContext extends {
|
|
|
10
10
|
pageId: null;
|
|
11
11
|
_pageFilesAll: PageFile[];
|
|
12
12
|
_pageConfigs: PageConfigRuntime[];
|
|
13
|
-
_globalContext:
|
|
13
|
+
_globalContext: GlobalContextInternal;
|
|
14
14
|
urlOriginal: string;
|
|
15
15
|
}>(pageContext: PageContext): Promise<PageContext & PageContextAfterRender>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { handlePageContextRequestUrl };
|
|
2
2
|
import { pageContextJsonFileExtension, doNotCreateExtraDirectory } from '../../../shared/getPageContextRequestUrl.js';
|
|
3
3
|
import { baseServer, parseUrl, assert, slice } from '../utils.js';
|
|
4
|
-
// See shared/getPageContextRequestUrl.ts
|
|
4
|
+
// See also shared/getPageContextRequestUrl.ts
|
|
5
5
|
function handlePageContextRequestUrl(url) {
|
|
6
6
|
if (!hasSuffix(url)) {
|
|
7
7
|
return { urlWithoutPageContextRequestSuffix: url, isPageContextRequest: false };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { isNewError };
|
|
2
2
|
export { setAlreadyLogged };
|
|
3
3
|
import { getGlobalObject, isObject, isSameErrorMessage, warnIfErrorIsNotObject } from '../utils.js';
|
|
4
|
-
const globalObject = getGlobalObject('
|
|
4
|
+
const globalObject = getGlobalObject('renderPage/isNewError.ts', {
|
|
5
5
|
wasAlreadyLogged: new WeakSet()
|
|
6
6
|
});
|
|
7
7
|
function isNewError(errErrorPage, errNominalPage) {
|
|
@@ -6,17 +6,17 @@ import { PromiseType } from '../utils.js';
|
|
|
6
6
|
import { PageContextGetPageAssets, type PageAsset } from './getPageAssets.js';
|
|
7
7
|
import { type PageContextDebugRouteMatches } from './debugPageFiles.js';
|
|
8
8
|
import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js';
|
|
9
|
-
import type {
|
|
9
|
+
import type { GlobalContextInternal } from '../globalContext.js';
|
|
10
10
|
type PageContext_loadUserFilesServerSide = PageContextGetPageAssets & PageContextDebugRouteMatches & {
|
|
11
11
|
urlOriginal: string;
|
|
12
12
|
_pageFilesAll: PageFile[];
|
|
13
13
|
_pageConfigs: PageConfigRuntime[];
|
|
14
|
-
_globalContext:
|
|
14
|
+
_globalContext: GlobalContextInternal;
|
|
15
15
|
};
|
|
16
16
|
type PageFiles = PromiseType<ReturnType<typeof loadUserFilesServerSide>>;
|
|
17
17
|
declare function loadUserFilesServerSide(pageContext: {
|
|
18
18
|
pageId: string;
|
|
19
|
-
} & PageContext_loadUserFilesServerSide): Promise<import("../../../shared/getPageFiles.js").
|
|
19
|
+
} & PageContext_loadUserFilesServerSide): Promise<import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
20
20
|
Page: unknown;
|
|
21
21
|
_isHtmlOnly: boolean;
|
|
22
22
|
_passToClient: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { loadUserFilesServerSide };
|
|
2
2
|
import { getPageFilesServerSide } from '../../../shared/getPageFiles.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getPageConfigUserFriendly_oldDesign } from '../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
4
4
|
import { analyzePageClientSideInit } from '../../../shared/getPageFiles/analyzePageClientSide.js';
|
|
5
5
|
import { assert, assertUsage, assertWarning, hasProp, isArrayOfStrings, objectAssign, isArray } from '../utils.js';
|
|
6
6
|
import { getPageAssets } from './getPageAssets.js';
|
|
@@ -100,7 +100,7 @@ async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pag
|
|
|
100
100
|
const pageFilesServerSide = getPageFilesServerSide(pageFilesAll, pageId);
|
|
101
101
|
const pageConfigLoaded = !pageConfig ? null : await loadConfigValues(pageConfig, isDev);
|
|
102
102
|
await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
|
|
103
|
-
const pageContextExports =
|
|
103
|
+
const pageContextExports = getPageConfigUserFriendly_oldDesign(pageFilesServerSide, pageConfigLoaded, pageConfigGlobal);
|
|
104
104
|
return {
|
|
105
105
|
pageContextExports,
|
|
106
106
|
pageFilesLoaded: pageFilesServerSide
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { log404 };
|
|
2
2
|
export { getRoutesInfo };
|
|
3
3
|
import type { PageRoutes } from '../../../../shared/route/index.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { GlobalContextInternal } from '../../globalContext.js';
|
|
5
5
|
declare function log404(pageContext: {
|
|
6
6
|
urlPathname: string;
|
|
7
7
|
errorWhileRendering: null | Error;
|
|
8
8
|
isClientSideNavigation: boolean;
|
|
9
9
|
_pageRoutes: PageRoutes;
|
|
10
|
-
_globalContext:
|
|
10
|
+
_globalContext: GlobalContextInternal;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
declare function getRoutesInfo(pageRoutes: PageRoutes): string | null;
|
|
@@ -25,13 +25,19 @@ const errorsMisc = [
|
|
|
25
25
|
mustMentionNodeModules: false
|
|
26
26
|
}
|
|
27
27
|
];
|
|
28
|
+
const reactInvalidEelement = 'https://vike.dev/broken-npm-package#react-invalid-component';
|
|
28
29
|
const errorsReact = [
|
|
29
30
|
{
|
|
30
31
|
errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
|
|
31
|
-
link:
|
|
32
|
+
link: reactInvalidEelement,
|
|
32
33
|
// The stack trace can be user-land while the import is coming from node_modules
|
|
33
34
|
mustMentionNodeModules: false
|
|
34
35
|
},
|
|
36
|
+
{
|
|
37
|
+
errMsg: 'Objects are not valid as a React child',
|
|
38
|
+
link: reactInvalidEelement,
|
|
39
|
+
mustMentionNodeModules: false
|
|
40
|
+
},
|
|
35
41
|
{
|
|
36
42
|
// React's "Invalid hook call.", see https://github.com/vikejs/vike/discussions/1637#discussioncomment-9424712
|
|
37
43
|
errMsg: "Cannot read properties of null (reading 'useContext')"
|
package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ export { preparePageContextForUserConsumptionServerSide };
|
|
|
2
2
|
export type { PageContextForUserConsumptionServerSide };
|
|
3
3
|
import { PageContextUrlInternal } from '../../../shared/getPageContextUrlComputed.js';
|
|
4
4
|
import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PageConfigUserFriendlyOld } from '../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
6
6
|
import { PageContextBuiltInServerInternal } from '../../../shared/types.js';
|
|
7
|
-
import type {
|
|
8
|
-
type PageContextForUserConsumptionServerSide = PageContextBuiltInServerInternal &
|
|
7
|
+
import type { GlobalContextInternal, GlobalContextPublic } from '../globalContext.js';
|
|
8
|
+
type PageContextForUserConsumptionServerSide = PageContextBuiltInServerInternal & PageConfigUserFriendlyOld & {
|
|
9
9
|
urlOriginal: string;
|
|
10
10
|
/** @deprecated */
|
|
11
11
|
url: string;
|
|
@@ -18,7 +18,7 @@ type PageContextForUserConsumptionServerSide = PageContextBuiltInServerInternal
|
|
|
18
18
|
is404: null | boolean;
|
|
19
19
|
isClientSideNavigation: boolean;
|
|
20
20
|
pageProps?: Record<string, unknown>;
|
|
21
|
-
_globalContext:
|
|
21
|
+
_globalContext: GlobalContextInternal;
|
|
22
22
|
globalContext: GlobalContextPublic;
|
|
23
23
|
} & Record<string, unknown>;
|
|
24
24
|
declare function preparePageContextForUserConsumptionServerSide(pageContext: PageContextForUserConsumptionServerSide): void;
|
|
@@ -5,7 +5,7 @@ export { getPageContextInitEnhanced };
|
|
|
5
5
|
export type { PageContextAfterRender };
|
|
6
6
|
export type { PageContextInitEnhanced };
|
|
7
7
|
import { type PageContextUrlInternal } from '../../../shared/getPageContextUrlComputed.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { GlobalContextInternal } from '../globalContext.js';
|
|
9
9
|
import { HttpResponse } from './createHttpResponse.js';
|
|
10
10
|
import { PageContext_loadUserFilesServerSide, type PageFiles } from './loadUserFilesServerSide.js';
|
|
11
11
|
type PageContextAfterRender = {
|
|
@@ -46,7 +46,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
46
46
|
_allPageIds: string[];
|
|
47
47
|
_pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
48
48
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
49
|
-
_globalContext:
|
|
49
|
+
_globalContext: GlobalContextInternal;
|
|
50
50
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
51
51
|
globalContext: import("../globalContext.js").GlobalContextPublic;
|
|
52
52
|
_pageContextInit: {
|
|
@@ -63,7 +63,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
63
63
|
url: string;
|
|
64
64
|
} & {
|
|
65
65
|
headers: Record<string, string> | null;
|
|
66
|
-
} & import("../../../shared/getPageFiles.js").
|
|
66
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
67
67
|
Page: unknown;
|
|
68
68
|
_isHtmlOnly: boolean;
|
|
69
69
|
_passToClient: string[];
|
|
@@ -100,7 +100,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
100
100
|
_allPageIds: string[];
|
|
101
101
|
_pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
102
102
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
103
|
-
_globalContext:
|
|
103
|
+
_globalContext: GlobalContextInternal;
|
|
104
104
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
105
105
|
globalContext: import("../globalContext.js").GlobalContextPublic;
|
|
106
106
|
_pageContextInit: {
|
|
@@ -117,7 +117,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
117
117
|
url: string;
|
|
118
118
|
} & {
|
|
119
119
|
headers: Record<string, string> | null;
|
|
120
|
-
} & import("../../../shared/getPageFiles.js").
|
|
120
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
121
121
|
Page: unknown;
|
|
122
122
|
_isHtmlOnly: boolean;
|
|
123
123
|
_passToClient: string[];
|
|
@@ -137,7 +137,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
137
137
|
_urlHandler: null;
|
|
138
138
|
};
|
|
139
139
|
}>;
|
|
140
|
-
declare function prerender404Page(pageContextInit_: Record<string, unknown> | null, globalContext:
|
|
140
|
+
declare function prerender404Page(pageContextInit_: Record<string, unknown> | null, globalContext: GlobalContextInternal): Promise<{
|
|
141
141
|
documentHtml: string;
|
|
142
142
|
pageContextSerialized: null;
|
|
143
143
|
pageContext: {
|
|
@@ -155,7 +155,7 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
155
155
|
_allPageIds: string[];
|
|
156
156
|
_pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
157
157
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
158
|
-
_globalContext:
|
|
158
|
+
_globalContext: GlobalContextInternal;
|
|
159
159
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
160
160
|
globalContext: import("../globalContext.js").GlobalContextPublic;
|
|
161
161
|
_pageContextInit: {
|
|
@@ -172,7 +172,7 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
172
172
|
url: string;
|
|
173
173
|
} & {
|
|
174
174
|
headers: Record<string, string> | null;
|
|
175
|
-
} & import("../../../shared/getPageFiles.js").
|
|
175
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
176
176
|
Page: unknown;
|
|
177
177
|
_isHtmlOnly: boolean;
|
|
178
178
|
_passToClient: string[];
|
|
@@ -209,7 +209,7 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
209
209
|
_allPageIds: string[];
|
|
210
210
|
_pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
211
211
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
212
|
-
_globalContext:
|
|
212
|
+
_globalContext: GlobalContextInternal;
|
|
213
213
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
214
214
|
globalContext: import("../globalContext.js").GlobalContextPublic;
|
|
215
215
|
_pageContextInit: {
|
|
@@ -226,7 +226,7 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
226
226
|
url: string;
|
|
227
227
|
} & {
|
|
228
228
|
headers: Record<string, string> | null;
|
|
229
|
-
} & import("../../../shared/getPageFiles.js").
|
|
229
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
230
230
|
Page: unknown;
|
|
231
231
|
_isHtmlOnly: boolean;
|
|
232
232
|
_passToClient: string[];
|
|
@@ -251,7 +251,7 @@ declare function getPageContextInitEnhanced(pageContextInit: {
|
|
|
251
251
|
urlOriginal: string;
|
|
252
252
|
headersOriginal?: unknown;
|
|
253
253
|
headers?: unknown;
|
|
254
|
-
}, globalContext:
|
|
254
|
+
}, globalContext: GlobalContextInternal, { ssr: { urlRewrite, urlHandler, isClientSideNavigation } }?: {
|
|
255
255
|
ssr?: {
|
|
256
256
|
urlRewrite: null | string;
|
|
257
257
|
urlHandler: null | ((url: string) => string);
|
|
@@ -272,7 +272,7 @@ declare function getPageContextInitEnhanced(pageContextInit: {
|
|
|
272
272
|
_allPageIds: string[];
|
|
273
273
|
_pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
274
274
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
275
|
-
_globalContext:
|
|
275
|
+
_globalContext: GlobalContextInternal;
|
|
276
276
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
277
277
|
globalContext: import("../globalContext.js").GlobalContextPublic;
|
|
278
278
|
_pageContextInit: {
|