vike 0.4.222 → 0.4.223
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 +1 -1
- package/dist/cjs/node/plugin/plugins/baseUrls.js +6 -1
- package/dist/cjs/node/plugin/plugins/buildApp.js +9 -5
- package/dist/cjs/node/plugin/plugins/buildConfig.js +3 -0
- 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/crawlPlusFiles.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +16 -41
- package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +1 -1
- package/dist/cjs/node/plugin/shared/viteIsSSR.js +19 -10
- 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/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/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/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/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.js +2 -2
- 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 +4 -1
- package/dist/esm/node/plugin/index.js +1 -1
- package/dist/esm/node/plugin/plugins/baseUrls.js +6 -1
- package/dist/esm/node/plugin/plugins/buildApp.js +9 -5
- package/dist/esm/node/plugin/plugins/buildConfig.js +3 -0
- 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/crawlPlusFiles.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +17 -42
- 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/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/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 +9 -2
- 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/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/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 +15 -2
- 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
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPageContextProxyForUser = getPageContextProxyForUser;
|
|
4
4
|
const utils_js_1 = require("../server-routing-runtime/utils.js");
|
|
5
5
|
const notSerializable_js_1 = require("../../shared/notSerializable.js");
|
|
6
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('getPageContextProxyForUser.ts', {});
|
|
6
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('shared/getPageContextProxyForUser.ts', {});
|
|
7
7
|
/**
|
|
8
8
|
* Throw error when pageContext value isn't:
|
|
9
9
|
* - serializable, or
|
|
@@ -48,7 +48,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
48
48
|
const utils_js_1 = require("./utils.js");
|
|
49
49
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
50
50
|
const globalContext_js_1 = require("../runtime/globalContext.js");
|
|
51
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('prepareViteApiCall.ts', {});
|
|
51
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('api/prepareViteApiCall.ts', {});
|
|
52
52
|
async function prepareViteApiCall(viteConfigFromOptions, operation) {
|
|
53
53
|
clear();
|
|
54
54
|
(0, context_js_1.setContextApiOperation)(operation);
|
|
@@ -35,7 +35,7 @@ const workaroundVite6HmrRegression_js_1 = require("./plugins/workaroundVite6HmrR
|
|
|
35
35
|
const buildApp_js_1 = require("./plugins/buildApp.js");
|
|
36
36
|
// We don't call this in ./onLoad.ts to avoid a cyclic dependency with utils.ts
|
|
37
37
|
(0, getPageAssets_js_1.setResolveClientEntriesDev)(resolveClientEntriesDev_js_1.resolveClientEntriesDev);
|
|
38
|
-
// Return
|
|
38
|
+
// Return `PluginInterop` instead of `Plugin` to avoid type mismatch upon different Vite versions
|
|
39
39
|
function plugin(vikeVitePluginOptions = {}) {
|
|
40
40
|
const plugins = [
|
|
41
41
|
...(0, commonConfig_js_1.commonConfig)(vikeVitePluginOptions),
|
|
@@ -29,7 +29,7 @@ function baseUrls() {
|
|
|
29
29
|
},
|
|
30
30
|
async configResolved(config) {
|
|
31
31
|
const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config);
|
|
32
|
-
const basesResolved2 =
|
|
32
|
+
const basesResolved2 = resolveBaseFromResolvedConfig(vikeConfig.global.config.baseServer ?? null, vikeConfig.global.config.baseAssets ?? null, config);
|
|
33
33
|
(0, utils_js_1.assert)(basesResolved2.baseServer === basesResolved.baseServer);
|
|
34
34
|
(0, utils_js_1.assert)(basesResolved2.baseAssets === basesResolved.baseAssets);
|
|
35
35
|
/* In dev, Vite seems buggy around setting vite.config.js#base to an absolute URL (e.g. http://localhost:8080/cdn/)
|
|
@@ -40,3 +40,8 @@ function baseUrls() {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
function resolveBaseFromResolvedConfig(baseServer, baseAssets, config) {
|
|
44
|
+
let baseViteOriginal = config._baseViteOriginal;
|
|
45
|
+
(0, utils_js_1.assert)(baseViteOriginal === null || typeof baseViteOriginal == 'string');
|
|
46
|
+
return (0, resolveBase_js_1.resolveBase)(baseViteOriginal, baseServer, baseAssets);
|
|
47
|
+
}
|
|
@@ -9,6 +9,9 @@ const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js"
|
|
|
9
9
|
const getFullBuildInlineConfig_js_1 = require("../shared/getFullBuildInlineConfig.js");
|
|
10
10
|
function buildApp() {
|
|
11
11
|
let config;
|
|
12
|
+
// `builder.buildApp` can be overriden by another plugin e.g vike-vercel https://github.com/vikejs/vike/pull/2184#issuecomment-2659425195
|
|
13
|
+
// In that case, we should'nt `forceExit`.
|
|
14
|
+
let forceExit = false;
|
|
12
15
|
return [
|
|
13
16
|
{
|
|
14
17
|
name: 'vike:buildApp',
|
|
@@ -23,6 +26,10 @@ function buildApp() {
|
|
|
23
26
|
(0, utils_js_1.assert)(builder.environments.ssr);
|
|
24
27
|
await builder.build(builder.environments.client);
|
|
25
28
|
await builder.build(builder.environments.ssr);
|
|
29
|
+
if (forceExit) {
|
|
30
|
+
(0, runPrerender_js_1.runPrerender_forceExit)();
|
|
31
|
+
(0, utils_js_1.assert)(false);
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
},
|
|
28
35
|
environments: {
|
|
@@ -61,11 +68,8 @@ function buildApp() {
|
|
|
61
68
|
if (!(0, context_js_1.isPrerenderAutoRunEnabled)(vikeConfig))
|
|
62
69
|
return;
|
|
63
70
|
const configInline = (0, getFullBuildInlineConfig_js_1.getFullBuildInlineConfig)(config);
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
(0, runPrerender_js_1.runPrerender_forceExit)();
|
|
67
|
-
(0, utils_js_1.assert)(false);
|
|
68
|
-
}
|
|
71
|
+
const res = await (0, runPrerender_js_1.runPrerenderFromAutoRun)(configInline, config);
|
|
72
|
+
forceExit = res.forceExit;
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
];
|
|
@@ -86,6 +86,9 @@ function buildConfig() {
|
|
|
86
86
|
{
|
|
87
87
|
name: 'vike:buildConfig:pre',
|
|
88
88
|
apply: 'build',
|
|
89
|
+
applyToEnvironment(env) {
|
|
90
|
+
return env.name === 'ssr';
|
|
91
|
+
},
|
|
89
92
|
// Make sure other writeBundle() hooks are called after this writeBundle() hook.
|
|
90
93
|
// - set_ASSETS_MANIFEST() needs to be called before dist/server/ code is executed.
|
|
91
94
|
// - For example, the writeBundle() hook of vite-plugin-vercel needs to be called after this writeBundle() hook, otherwise: https://github.com/vikejs/vike/issues/1527
|
|
@@ -6,6 +6,7 @@ const utils_js_1 = require("../utils.js");
|
|
|
6
6
|
const rollupSourceMap_js_1 = require("../shared/rollupSourceMap.js");
|
|
7
7
|
const getFilePath_js_1 = require("../shared/getFilePath.js");
|
|
8
8
|
const normalizeId_js_1 = require("../shared/normalizeId.js");
|
|
9
|
+
const viteIsSSR_js_1 = require("../shared/viteIsSSR.js");
|
|
9
10
|
// TODO/enventually: (after we implemented vike.config.js)
|
|
10
11
|
// - Make import.meta.env work inside +config.js
|
|
11
12
|
// - For it to work, we'll probably need the user to define the settings (e.g. `envDir`) for loadEnv() inside vike.config.js instead of vite.config.js
|
|
@@ -38,7 +39,7 @@ function envVarsPlugin() {
|
|
|
38
39
|
if (!code.includes('import.meta.env.'))
|
|
39
40
|
return;
|
|
40
41
|
const isBuild = config.command === 'build';
|
|
41
|
-
const isClientSide =
|
|
42
|
+
const isClientSide = !(0, viteIsSSR_js_1.viteIsSSR_safe)(config, options);
|
|
42
43
|
Object.entries(envsAll)
|
|
43
44
|
.filter(([key]) => {
|
|
44
45
|
// Already handled by Vite
|
|
@@ -84,20 +85,3 @@ function envVarsPlugin() {
|
|
|
84
85
|
function applyEnvVar(envStatementRegEx, envVal, code) {
|
|
85
86
|
return code.replace(envStatementRegEx, JSON.stringify(envVal));
|
|
86
87
|
}
|
|
87
|
-
function getIsClientSide(config, options) {
|
|
88
|
-
const isBuild = config.command === 'build';
|
|
89
|
-
if (isBuild) {
|
|
90
|
-
(0, utils_js_1.assert)(typeof config.build.ssr === 'boolean');
|
|
91
|
-
const isServerSide = config.build.ssr;
|
|
92
|
-
if (options !== undefined) {
|
|
93
|
-
(0, utils_js_1.assert)(options.ssr === isServerSide);
|
|
94
|
-
}
|
|
95
|
-
return !isServerSide;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
(0, utils_js_1.assert)(config.build.ssr === false);
|
|
99
|
-
(0, utils_js_1.assert)(typeof options?.ssr === 'boolean');
|
|
100
|
-
const isServerSide = options.ssr;
|
|
101
|
-
return !isServerSide;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -48,7 +48,7 @@ function extractAssetsPlugin() {
|
|
|
48
48
|
}
|
|
49
49
|
// TODO/now: add meta.default
|
|
50
50
|
(0, utils_js_1.assert)(vikeConfig.global.config.includeAssetsImportedByServer ?? true);
|
|
51
|
-
(0, utils_js_1.assert)(!(0, viteIsSSR_js_1.
|
|
51
|
+
(0, utils_js_1.assert)(!(0, viteIsSSR_js_1.viteIsSSR_safe)(config, options));
|
|
52
52
|
const importStatements = await (0, parseEsModule_js_1.getImportStatements)(src);
|
|
53
53
|
const moduleNames = getImportedModules(importStatements);
|
|
54
54
|
const code = moduleNames.map((moduleName) => `import '${moduleName}';`).join('\n');
|
|
@@ -65,7 +65,7 @@ function extractAssetsPlugin() {
|
|
|
65
65
|
// - Vite's `vite:resolve` plugin; https://github.com/vitejs/vite/blob/d649daba7682791178b711d9a3e44a6b5d00990c/packages/vite/src/node/plugins/resolve.ts#L105
|
|
66
66
|
enforce: 'pre',
|
|
67
67
|
async resolveId(source, importer, options) {
|
|
68
|
-
if ((0, viteIsSSR_js_1.
|
|
68
|
+
if ((0, viteIsSSR_js_1.viteIsSSR_safe)(config, options)) {
|
|
69
69
|
// When building for the server, there should never be a `?extractAssets` query
|
|
70
70
|
(0, utils_js_1.assert)(!extractAssetsRE.test(source));
|
|
71
71
|
(0, utils_js_1.assert)(importer === undefined || !extractAssetsRE.test(importer));
|
|
@@ -11,7 +11,7 @@ const viteIsSSR_js_1 = require("../shared/viteIsSSR.js");
|
|
|
11
11
|
const extractExportNamesRE = /(\?|&)extractExportNames(?:&|$)/;
|
|
12
12
|
exports.extractExportNamesRE = extractExportNamesRE;
|
|
13
13
|
const debug = (0, utils_js_1.createDebugger)('vike:extractExportNames');
|
|
14
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('extractExportNamesPlugin.ts', {});
|
|
14
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('plugins/extractExportNamesPlugin.ts', {});
|
|
15
15
|
function extractExportNamesPlugin() {
|
|
16
16
|
let isDev = false;
|
|
17
17
|
return {
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -16,7 +16,7 @@ const getEnvVarObject_js_1 = require("../../../../shared/getEnvVarObject.js");
|
|
|
16
16
|
const execA = (0, util_1.promisify)(child_process_1.exec);
|
|
17
17
|
const debug = (0, utils_js_1.createDebugger)('vike:crawl');
|
|
18
18
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
19
|
-
(0, utils_js_1.assertIsSingleModuleInstance)('crawlPlusFiles.ts');
|
|
19
|
+
(0, utils_js_1.assertIsSingleModuleInstance)('getVikeConfig/crawlPlusFiles.ts');
|
|
20
20
|
let gitIsNotUsable = false;
|
|
21
21
|
async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
|
|
22
22
|
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
@@ -13,7 +13,7 @@ exports.getConfigDefinitionOptional = getConfigDefinitionOptional;
|
|
|
13
13
|
const utils_js_1 = require("../../../utils.js");
|
|
14
14
|
const configDefinitionsBuiltIn_js_1 = require("./getVikeConfig/configDefinitionsBuiltIn.js");
|
|
15
15
|
const filesystemRouting_js_1 = require("./getVikeConfig/filesystemRouting.js");
|
|
16
|
-
const
|
|
16
|
+
const isVikeConfigInvalid_js_1 = require("../../../../runtime/renderPage/isVikeConfigInvalid.js");
|
|
17
17
|
const globalContext_js_1 = require("../../../../runtime/globalContext.js");
|
|
18
18
|
const loggerNotProd_js_1 = require("../../../shared/loggerNotProd.js");
|
|
19
19
|
const removeSuperfluousViteLog_js_1 = require("../../../shared/loggerVite/removeSuperfluousViteLog.js");
|
|
@@ -43,7 +43,7 @@ function reloadVikeConfig(config) {
|
|
|
43
43
|
handleReloadSideEffects();
|
|
44
44
|
}
|
|
45
45
|
async function handleReloadSideEffects() {
|
|
46
|
-
wasConfigInvalid = !!
|
|
46
|
+
wasConfigInvalid = !!isVikeConfigInvalid_js_1.isVikeConfigInvalid;
|
|
47
47
|
const vikeConfigPromisePrevious = vikeConfigPromise;
|
|
48
48
|
try {
|
|
49
49
|
await vikeConfigPromise;
|
|
@@ -58,7 +58,7 @@ async function handleReloadSideEffects() {
|
|
|
58
58
|
// Let the next handleReloadSideEffects() call handle side effects
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (!
|
|
61
|
+
if (!isVikeConfigInvalid_js_1.isVikeConfigInvalid) {
|
|
62
62
|
if (wasConfigInvalid) {
|
|
63
63
|
wasConfigInvalid = false;
|
|
64
64
|
(0, loggerNotProd_js_1.logConfigErrorRecover)();
|
|
@@ -111,13 +111,13 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
|
|
|
111
111
|
if (!hasError) {
|
|
112
112
|
(0, utils_js_1.assert)(ret);
|
|
113
113
|
(0, utils_js_1.assert)(err === undefined);
|
|
114
|
-
(0,
|
|
114
|
+
(0, isVikeConfigInvalid_js_1.isVikeConfigInvalid_set)(false);
|
|
115
115
|
return ret;
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
118
|
(0, utils_js_1.assert)(ret === undefined);
|
|
119
119
|
(0, utils_js_1.assert)(err);
|
|
120
|
-
(0,
|
|
120
|
+
(0, isVikeConfigInvalid_js_1.isVikeConfigInvalid_set)({ err });
|
|
121
121
|
if (!isDev) {
|
|
122
122
|
(0, utils_js_1.assert)((0, globalContext_js_1.getViteDevServer)() === null);
|
|
123
123
|
throw err;
|
|
@@ -133,7 +133,7 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
|
|
|
133
133
|
configDefinitions: {},
|
|
134
134
|
configValueSources: {}
|
|
135
135
|
},
|
|
136
|
-
global: (0, getPageConfigUserFriendly_js_1.
|
|
136
|
+
global: (0, getPageConfigUserFriendly_js_1.getPageConfigGlobalUserFriendly)({ pageConfigGlobalValues: {} }),
|
|
137
137
|
pages: {}
|
|
138
138
|
};
|
|
139
139
|
return dummyData;
|
|
@@ -149,18 +149,12 @@ async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
|
|
|
149
149
|
// interop vike(options) in vite.config.js
|
|
150
150
|
temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
|
|
151
151
|
// global
|
|
152
|
-
const
|
|
153
|
-
const global = (0, getPageConfigUserFriendly_js_1.
|
|
154
|
-
// TODO/now DEDUPE
|
|
152
|
+
const pageConfigGlobalValues = getConfigValues(pageConfigGlobal);
|
|
153
|
+
const global = (0, getPageConfigUserFriendly_js_1.getPageConfigGlobalUserFriendly)({ pageConfigGlobalValues });
|
|
155
154
|
// pages
|
|
156
155
|
const pages = (0, utils_js_1.objectFromEntries)(pageConfigs.map((pageConfig) => {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const page = {
|
|
160
|
-
...(0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendlyNew)({ configValues }),
|
|
161
|
-
route: pageConfig.routeFilesystem?.routeString ?? null
|
|
162
|
-
};
|
|
163
|
-
return [pageConfig.pageId, page];
|
|
156
|
+
const pageConfigValues = getConfigValues(pageConfig, true);
|
|
157
|
+
return (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendly)(pageConfigGlobalValues, pageConfig, pageConfigValues);
|
|
164
158
|
}));
|
|
165
159
|
return { pageConfigs, pageConfigGlobal, global, pages };
|
|
166
160
|
}
|
|
@@ -225,13 +219,12 @@ function getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRo
|
|
|
225
219
|
return;
|
|
226
220
|
configValueSources[configName] = sources;
|
|
227
221
|
});
|
|
228
|
-
const
|
|
222
|
+
const pageConfigRoute = determineRouteFilesystem(locationId, configValueSources);
|
|
229
223
|
applyEffectsAll(configValueSources, configDefinitionsLocal);
|
|
230
224
|
const configValuesComputed = getComputed(configValueSources, configDefinitionsLocal);
|
|
231
225
|
const pageConfig = {
|
|
232
226
|
pageId: locationId,
|
|
233
|
-
|
|
234
|
-
routeFilesystem,
|
|
227
|
+
...pageConfigRoute,
|
|
235
228
|
configDefinitions: configDefinitionsLocal,
|
|
236
229
|
plusFiles: plusFilesRelevant,
|
|
237
230
|
configValueSources,
|
|
@@ -430,20 +423,10 @@ function getPlusFilesOrdered(configName, plusFilesRelevant) {
|
|
|
430
423
|
const plusFilesConfig = plusFilesForConfigName.filter((plusFile) => plusFile.isConfigFile &&
|
|
431
424
|
// We consider extensions (e.g. vike-react) later (i.e. with less priority)
|
|
432
425
|
!plusFile.isExtensionConfig);
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
const plusFileWinner = plusFilesValue[0] ?? plusFilesConfig[0];
|
|
438
|
-
if (plusFileWinner) {
|
|
439
|
-
const plusFilesOverriden = [...plusFilesValue, ...plusFilesConfig].filter((f) => f !== plusFileWinner);
|
|
440
|
-
// A user-land conflict of plusFiles with the same `locationId` (we are iterating over `plusFilesRelevant: PlusFilesByLocationId`) means that the user has superfluously defined the config twice; the user should remove such redundancy as it makes things unnecessarily ambiguous.
|
|
441
|
-
assertOverwrittenConfigFile(plusFileWinner, plusFilesOverriden, configName);
|
|
442
|
-
[plusFileWinner, ...plusFilesOverriden].forEach((plusFile) => {
|
|
443
|
-
(0, utils_js_1.assert)(plusFile.filePath.filePathAbsoluteUserRootDir); // ensure it's a user-land plus file
|
|
444
|
-
populate(plusFile);
|
|
445
|
-
});
|
|
446
|
-
}
|
|
426
|
+
[...plusFilesValue, ...plusFilesConfig].forEach((plusFile) => {
|
|
427
|
+
(0, utils_js_1.assert)(plusFile.filePath.filePathAbsoluteUserRootDir); // ensure it's a user-land plus file
|
|
428
|
+
populate(plusFile);
|
|
429
|
+
});
|
|
447
430
|
}
|
|
448
431
|
// ==========================
|
|
449
432
|
// Side-effect configs (next)
|
|
@@ -595,14 +578,6 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
595
578
|
}
|
|
596
579
|
(0, utils_js_1.assert)(false);
|
|
597
580
|
}
|
|
598
|
-
function assertOverwrittenConfigFile(plusFileWinner, plusFilesOverriden, configName) {
|
|
599
|
-
plusFilesOverriden.forEach((plusFileLoser) => {
|
|
600
|
-
const loserFilePath = plusFileLoser.filePath.filePathToShowToUser;
|
|
601
|
-
const winnerFilePath = plusFileWinner.filePath.filePathToShowToUser;
|
|
602
|
-
const confName = picocolors_1.default.cyan(configName);
|
|
603
|
-
(0, utils_js_1.assertWarning)(false, `The value of the config ${confName} defined at ${loserFilePath} is always overwritten by the value defined at ${winnerFilePath}, remove the superfluous value defined at ${loserFilePath}`, { onlyOnce: true });
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
581
|
function isDefiningPage(plusFiles) {
|
|
607
582
|
for (const plusFile of plusFiles) {
|
|
608
583
|
const configNames = getDefiningConfigNames(plusFile);
|
|
@@ -55,7 +55,7 @@ async function installHttpRequestAsyncStore() {
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
asyncLocalStorage = new mod.AsyncLocalStorage();
|
|
58
|
-
(0, renderPage_js_1.
|
|
58
|
+
(0, renderPage_js_1.renderPage_addAsyncHookwrapper)(async (httpRequestId, renderPage) => {
|
|
59
59
|
(0, utils_js_1.assert)(asyncLocalStorage);
|
|
60
60
|
const loggedErrors = new Set();
|
|
61
61
|
const markErrorAsLogged = (err) => {
|
|
@@ -2,21 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.viteIsSSR = viteIsSSR;
|
|
4
4
|
exports.viteIsSSR_options = viteIsSSR_options;
|
|
5
|
+
exports.viteIsSSR_safe = viteIsSSR_safe;
|
|
5
6
|
const assert_js_1 = require("../../../utils/assert.js");
|
|
6
|
-
const isObject_js_1 = require("../../../utils/isObject.js");
|
|
7
7
|
function viteIsSSR(config) {
|
|
8
8
|
return !!config?.build?.ssr;
|
|
9
9
|
}
|
|
10
|
-
// https://github.com/vitejs/vite/discussions/5109#discussioncomment-1450726
|
|
11
10
|
function viteIsSSR_options(options) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
return !!options?.ssr;
|
|
12
|
+
}
|
|
13
|
+
// Vite is quite messy about setting `ssr: boolean`, thus we use an extra safe implemention for security purposes.
|
|
14
|
+
// It's used for .client.js and .server.js guarantee thus we use agressive assert() calls for added safety.
|
|
15
|
+
function viteIsSSR_safe(config, options) {
|
|
16
|
+
if (config.command === 'build') {
|
|
17
|
+
(0, assert_js_1.assert)(typeof config.build.ssr === 'boolean');
|
|
18
|
+
const val = config.build.ssr;
|
|
19
|
+
if (options?.ssr !== undefined)
|
|
20
|
+
(0, assert_js_1.assert)(val === options.ssr);
|
|
21
|
+
return val;
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
else {
|
|
24
|
+
(0, assert_js_1.assert)(typeof options?.ssr === 'boolean');
|
|
25
|
+
const val = options.ssr;
|
|
26
|
+
/* This assert() fails (which is very unexpected).
|
|
27
|
+
if (typeof config.build.ssr === 'boolean') assert(val === config.build.ssr)
|
|
28
|
+
//*/
|
|
29
|
+
return val;
|
|
20
30
|
}
|
|
21
|
-
(0, assert_js_1.assert)(false);
|
|
22
31
|
}
|
|
@@ -21,7 +21,7 @@ exports.assertBuildInfo = assertBuildInfo;
|
|
|
21
21
|
exports.getViteConfigRuntime = getViteConfigRuntime;
|
|
22
22
|
exports.updateUserFiles = updateUserFiles;
|
|
23
23
|
// The core logic revolves around:
|
|
24
|
-
// - globalObject.userFiles which is the main requirement for
|
|
24
|
+
// - globalObject.userFiles which is the main requirement for resolveGlobalContext()
|
|
25
25
|
// - In production: globalObject.buildEntry which is the production entry set by @brillout/vite-plugin-server-entry
|
|
26
26
|
// - loadBuildEntry() sets globalObject.buildEntry and then sets globalObject.userFiles
|
|
27
27
|
// - 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()
|
|
@@ -35,8 +35,9 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
35
35
|
const loadPageRoutes_js_1 = require("../../shared/route/loadPageRoutes.js");
|
|
36
36
|
const assertV1Design_js_1 = require("../shared/assertV1Design.js");
|
|
37
37
|
const getPageConfigsRuntime_js_1 = require("../../shared/getPageConfigsRuntime.js");
|
|
38
|
+
const resolveBase_js_1 = require("../shared/resolveBase.js");
|
|
38
39
|
const debug = (0, utils_js_1.createDebugger)('vike:globalContext');
|
|
39
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('globalContext.ts', getInitialGlobalContext());
|
|
40
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('runtime/globalContext.ts', getInitialGlobalContext());
|
|
40
41
|
async function getGlobalContextInternal() {
|
|
41
42
|
// getGlobalContextInternal() should always be called after initGlobalContext()
|
|
42
43
|
(0, utils_js_1.assert)(globalObject.isInitialized);
|
|
@@ -82,7 +83,9 @@ function makePublic(globalContext) {
|
|
|
82
83
|
'assetsManifest',
|
|
83
84
|
'config',
|
|
84
85
|
'viteConfig',
|
|
85
|
-
'pages'
|
|
86
|
+
'pages',
|
|
87
|
+
'baseServer',
|
|
88
|
+
'baseAssets'
|
|
86
89
|
]);
|
|
87
90
|
return globalContextPublic;
|
|
88
91
|
}
|
|
@@ -124,7 +127,7 @@ function getViteConfig() {
|
|
|
124
127
|
}
|
|
125
128
|
async function initGlobalContext_renderPage() {
|
|
126
129
|
debug('initGlobalContext_renderPage()');
|
|
127
|
-
// globalObject.isProduction
|
|
130
|
+
// `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.)
|
|
128
131
|
if (globalObject.isProduction === undefined)
|
|
129
132
|
setIsProduction(true);
|
|
130
133
|
await initGlobalContext();
|
|
@@ -187,7 +190,7 @@ function setIsProduction(isProduction) {
|
|
|
187
190
|
globalObject.isProduction = isProduction;
|
|
188
191
|
}
|
|
189
192
|
function defineGlobalContext() {
|
|
190
|
-
const globalContext =
|
|
193
|
+
const globalContext = resolveGlobalContext();
|
|
191
194
|
assertIsDefined(globalContext);
|
|
192
195
|
const globalContext_public = makePublic(globalContext);
|
|
193
196
|
(0, utils_js_1.objectAssign)(globalContext, { globalContext_public });
|
|
@@ -196,7 +199,7 @@ function defineGlobalContext() {
|
|
|
196
199
|
assertGlobalContextIsDefined();
|
|
197
200
|
(0, utils_js_1.onSetupRuntime)();
|
|
198
201
|
}
|
|
199
|
-
function
|
|
202
|
+
function resolveGlobalContext() {
|
|
200
203
|
const { viteDevServer, viteConfig, isPrerendering, isProduction, userFiles } = globalObject;
|
|
201
204
|
(0, utils_js_1.assert)(typeof isProduction === 'boolean');
|
|
202
205
|
let globalContext;
|
|
@@ -215,7 +218,8 @@ function assembleGlobalContext() {
|
|
|
215
218
|
viteDevServer,
|
|
216
219
|
viteConfig,
|
|
217
220
|
...userFiles,
|
|
218
|
-
viteConfigRuntime
|
|
221
|
+
viteConfigRuntime,
|
|
222
|
+
...resolveBaseRuntime(viteConfigRuntime, userFiles.config)
|
|
219
223
|
};
|
|
220
224
|
}
|
|
221
225
|
else {
|
|
@@ -232,7 +236,8 @@ function assembleGlobalContext() {
|
|
|
232
236
|
...userFiles,
|
|
233
237
|
viteDevServer: null,
|
|
234
238
|
viteConfigRuntime: buildInfo.viteConfigRuntime,
|
|
235
|
-
usesClientRouter: buildInfo.usesClientRouter
|
|
239
|
+
usesClientRouter: buildInfo.usesClientRouter,
|
|
240
|
+
...resolveBaseRuntime(buildInfo.viteConfigRuntime, userFiles.config)
|
|
236
241
|
};
|
|
237
242
|
if (isPrerendering) {
|
|
238
243
|
(0, utils_js_1.assert)(viteConfig);
|
|
@@ -401,3 +406,9 @@ function getInitialGlobalContext() {
|
|
|
401
406
|
viteDevServerPromiseResolve
|
|
402
407
|
};
|
|
403
408
|
}
|
|
409
|
+
function resolveBaseRuntime(viteConfigRuntime, config) {
|
|
410
|
+
const baseViteOriginal = viteConfigRuntime._baseViteOriginal;
|
|
411
|
+
const baseServerUnresolved = config.baseServer ?? null;
|
|
412
|
+
const baseAssetsUnresolved = config.baseAssets ?? null;
|
|
413
|
+
return (0, resolveBase_js_1.resolveBase)(baseViteOriginal, baseServerUnresolved, baseAssetsUnresolved);
|
|
414
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.assertNoInfiniteHttpRedirect = assertNoInfiniteHttpRedirect;
|
|
7
7
|
const utils_js_1 = require("../../utils.js");
|
|
8
8
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('assertNoInfiniteHttpRedirect.ts', {
|
|
9
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('createHttpResponse/assertNoInfiniteHttpRedirect.ts', {
|
|
10
10
|
redirectGraph: {}
|
|
11
11
|
});
|
|
12
12
|
function assertNoInfiniteHttpRedirect(urlRedirectTarget, urlLogical) {
|
|
@@ -5,6 +5,7 @@ exports.createHttpResponsePageContextJson = createHttpResponsePageContextJson;
|
|
|
5
5
|
exports.createHttpResponseError = createHttpResponseError;
|
|
6
6
|
exports.createHttpResponseRedirect = createHttpResponseRedirect;
|
|
7
7
|
exports.createHttpResponseFavicon404 = createHttpResponseFavicon404;
|
|
8
|
+
exports.createHttpResponseBaseIsMissing = createHttpResponseBaseIsMissing;
|
|
8
9
|
const utils_js_1 = require("../utils.js");
|
|
9
10
|
const error_page_js_1 = require("../../../shared/error-page.js");
|
|
10
11
|
const getHttpResponseBody_js_1 = require("./getHttpResponseBody.js");
|
|
@@ -40,6 +41,29 @@ function createHttpResponseFavicon404() {
|
|
|
40
41
|
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>");
|
|
41
42
|
return httpResponse;
|
|
42
43
|
}
|
|
44
|
+
function createHttpResponseBaseIsMissing(urlOriginal, baseServer) {
|
|
45
|
+
const httpResponse = createHttpResponse(
|
|
46
|
+
// 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
|
|
47
|
+
// In other words: this HTTP response is expected to be generated but isn't expected to be actually used.
|
|
48
|
+
500, 'text/html;charset=utf-8', [], `
|
|
49
|
+
<h1>Error: Base URL is missing</h1>
|
|
50
|
+
<p>
|
|
51
|
+
<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>.
|
|
52
|
+
</p>
|
|
53
|
+
<p>
|
|
54
|
+
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.
|
|
55
|
+
</p>
|
|
56
|
+
<style>
|
|
57
|
+
code {
|
|
58
|
+
font-family: monospace;
|
|
59
|
+
background-color: #eaeaea;
|
|
60
|
+
padding: 3px 5px;
|
|
61
|
+
border-radius: 4px;
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
64
|
+
`);
|
|
65
|
+
return httpResponse;
|
|
66
|
+
}
|
|
43
67
|
function createHttpResponseError(pageContext) {
|
|
44
68
|
const reason = (() => {
|
|
45
69
|
if (!pageContext) {
|
|
@@ -8,7 +8,7 @@ const retrieveAssetsProd_js_1 = require("./getPageAssets/retrieveAssetsProd.js")
|
|
|
8
8
|
const inferMediaType_js_1 = require("./inferMediaType.js");
|
|
9
9
|
const getManifestEntry_js_1 = require("./getPageAssets/getManifestEntry.js");
|
|
10
10
|
const sortPageAssetsForEarlyHintsHeader_js_1 = require("./getPageAssets/sortPageAssetsForEarlyHintsHeader.js");
|
|
11
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('getPageAssets.ts', {
|
|
11
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('renderPage/getPageAssets.ts', {
|
|
12
12
|
resolveClientEntriesDev: null
|
|
13
13
|
});
|
|
14
14
|
async function getPageAssets(pageContext, clientDependencies, clientEntries) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handlePageContextRequestUrl = handlePageContextRequestUrl;
|
|
4
4
|
const getPageContextRequestUrl_js_1 = require("../../../shared/getPageContextRequestUrl.js");
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
|
-
// See shared/getPageContextRequestUrl.ts
|
|
6
|
+
// See also shared/getPageContextRequestUrl.ts
|
|
7
7
|
function handlePageContextRequestUrl(url) {
|
|
8
8
|
if (!hasSuffix(url)) {
|
|
9
9
|
return { urlWithoutPageContextRequestSuffix: url, isPageContextRequest: false };
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isNewError = isNewError;
|
|
4
4
|
exports.setAlreadyLogged = setAlreadyLogged;
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('
|
|
6
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('renderPage/isNewError.ts', {
|
|
7
7
|
wasAlreadyLogged: new WeakSet()
|
|
8
8
|
});
|
|
9
9
|
function isNewError(errErrorPage, errNominalPage) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isVikeConfigInvalid_set = exports.isVikeConfigInvalid = void 0;
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
let isVikeConfigInvalid;
|
|
6
|
+
const isVikeConfigInvalid_set = (val) => {
|
|
7
|
+
(0, utils_js_1.assert)(val === false || val.err);
|
|
8
|
+
exports.isVikeConfigInvalid = isVikeConfigInvalid = val;
|
|
9
|
+
};
|
|
10
|
+
exports.isVikeConfigInvalid_set = isVikeConfigInvalid_set;
|
|
@@ -102,7 +102,7 @@ async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pag
|
|
|
102
102
|
const pageFilesServerSide = (0, getPageFiles_js_1.getPageFilesServerSide)(pageFilesAll, pageId);
|
|
103
103
|
const pageConfigLoaded = !pageConfig ? null : await (0, loadConfigValues_js_1.loadConfigValues)(pageConfig, isDev);
|
|
104
104
|
await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
|
|
105
|
-
const pageContextExports = (0, getPageConfigUserFriendly_js_1.
|
|
105
|
+
const pageContextExports = (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendly_oldDesign)(pageFilesServerSide, pageConfigLoaded, pageConfigGlobal);
|
|
106
106
|
return {
|
|
107
107
|
pageContextExports,
|
|
108
108
|
pageFilesLoaded: pageFilesServerSide
|
|
@@ -22,7 +22,6 @@ const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePa
|
|
|
22
22
|
const executeGuardHook_js_1 = require("../../../shared/route/executeGuardHook.js");
|
|
23
23
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
24
24
|
const isServerSideError_js_1 = require("../../../shared/misc/isServerSideError.js");
|
|
25
|
-
const resolveBase_js_1 = require("../../shared/resolveBase.js");
|
|
26
25
|
async function renderPageAlreadyRouted(pageContext) {
|
|
27
26
|
// pageContext.pageId can either be the:
|
|
28
27
|
// - ID of the page matching the routing, or the
|
|
@@ -117,14 +116,13 @@ async function getPageContextInitEnhanced(pageContextInit, globalContext, { ssr:
|
|
|
117
116
|
isClientSideNavigation: false
|
|
118
117
|
} } = {}) {
|
|
119
118
|
(0, utils_js_1.assert)(pageContextInit.urlOriginal);
|
|
120
|
-
const { baseServer, baseAssets } = (0, resolveBase_js_1.resolveBaseRuntime)(globalContext);
|
|
121
119
|
const pageContextInitEnhanced = {};
|
|
122
120
|
(0, utils_js_1.objectAssign)(pageContextInitEnhanced, pageContextInit);
|
|
123
121
|
(0, utils_js_1.objectAssign)(pageContextInitEnhanced, {
|
|
124
122
|
_objectCreatedByVike: true,
|
|
125
123
|
// The following is defined on `pageContext` because we can eventually make these non-global
|
|
126
|
-
_baseServer: baseServer,
|
|
127
|
-
_baseAssets: baseAssets,
|
|
124
|
+
_baseServer: globalContext.baseServer,
|
|
125
|
+
_baseAssets: globalContext.baseAssets,
|
|
128
126
|
// TODO/now: add meta.default
|
|
129
127
|
_includeAssetsImportedByServer: globalContext.config.includeAssetsImportedByServer ?? true,
|
|
130
128
|
// TODO/soon: use GloablContext instead
|