vike 0.4.191-commit-a91fd40 → 0.4.191-commit-7e0cd43
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/__internal/index.js +11 -1
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +0 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +12 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +0 -3
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +3 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/__internal/index.d.ts +7 -0
- package/dist/esm/__internal/index.js +12 -1
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +8 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +12 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.d.ts +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +0 -3
- package/dist/esm/shared/page-configs/PageConfig.d.ts +0 -2
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.d.ts +3 -1
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +3 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPagesAndRoutes = exports.route = void 0;
|
|
3
|
+
exports.getPageFilesAllSafe = exports.getPagesAndRoutes = exports.route = void 0;
|
|
4
4
|
const index_js_1 = require("../shared/route/index.js");
|
|
5
|
+
const getPageFiles_js_1 = require("../shared/getPageFiles.js");
|
|
5
6
|
const globalContext_js_1 = require("../node/runtime/globalContext.js");
|
|
6
7
|
const assertNodeEnv_js_1 = require("../utils/assertNodeEnv.js");
|
|
7
8
|
const assert_js_1 = require("../utils/assert.js");
|
|
@@ -27,6 +28,15 @@ async function getPagesAndRoutes() {
|
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
exports.getPagesAndRoutes = getPagesAndRoutes;
|
|
31
|
+
// TODO: make it cleaner once the internal refactoring about global configs is done
|
|
32
|
+
async function getPageFilesAllSafe() {
|
|
33
|
+
await (0, globalContext_js_1.initGlobalContext)(false);
|
|
34
|
+
await (0, globalContext_js_1.getGlobalContextAsync)();
|
|
35
|
+
const globalContext = (0, globalContext_js_1.getGlobalContext)();
|
|
36
|
+
const pageFilesAll = await (0, getPageFiles_js_1.getPageFilesAll)(false, globalContext.isProduction);
|
|
37
|
+
return pageFilesAll;
|
|
38
|
+
}
|
|
39
|
+
exports.getPageFilesAllSafe = getPageFilesAllSafe;
|
|
30
40
|
async function route(pageContext) {
|
|
31
41
|
const pageContextFromRoute = await (0, index_js_1.route)(pageContext);
|
|
32
42
|
// Old interface
|
|
@@ -95,7 +95,6 @@ async function triggerFullBuild(config, configVike, bundle) {
|
|
|
95
95
|
process.exit(1);
|
|
96
96
|
}
|
|
97
97
|
if (configVike.prerender && !configVike.prerender.disableAutoRun) {
|
|
98
|
-
return;
|
|
99
98
|
await (0, runPrerender_js_1.runPrerenderFromAutoFullBuild)({ viteConfig: configInline });
|
|
100
99
|
forceExit = true;
|
|
101
100
|
}
|
|
@@ -33,7 +33,8 @@ const configDefinitionsBuiltIn = {
|
|
|
33
33
|
cumulative: true
|
|
34
34
|
},
|
|
35
35
|
route: {
|
|
36
|
-
env: { server: true, client: 'if-client-routing'
|
|
36
|
+
env: { server: true, client: 'if-client-routing' },
|
|
37
|
+
eager: true
|
|
37
38
|
},
|
|
38
39
|
guard: {
|
|
39
40
|
env: { server: true, client: 'if-client-routing' }
|
|
@@ -42,7 +43,8 @@ const configDefinitionsBuiltIn = {
|
|
|
42
43
|
env: { server: true }
|
|
43
44
|
},
|
|
44
45
|
iKnowThePerformanceRisksOfAsyncRouteFunctions: {
|
|
45
|
-
env: { server: true, client: 'if-client-routing'
|
|
46
|
+
env: { server: true, client: 'if-client-routing' },
|
|
47
|
+
eager: true
|
|
46
48
|
},
|
|
47
49
|
filesystemRoutingRoot: {
|
|
48
50
|
env: { config: true }
|
|
@@ -54,7 +56,8 @@ const configDefinitionsBuiltIn = {
|
|
|
54
56
|
},
|
|
55
57
|
clientRouting: {
|
|
56
58
|
// We could make it { client: false } but we don't yet because of some legacy V0.4 design code
|
|
57
|
-
env: { server: true, client: true, config: true
|
|
59
|
+
env: { server: true, client: true, config: true },
|
|
60
|
+
eager: true
|
|
58
61
|
},
|
|
59
62
|
clientHooks: {
|
|
60
63
|
env: { config: true }
|
|
@@ -75,7 +78,8 @@ const configDefinitionsBuiltIn = {
|
|
|
75
78
|
env: { config: true }
|
|
76
79
|
},
|
|
77
80
|
clientEntryLoaded: {
|
|
78
|
-
env: { server: true, client: true
|
|
81
|
+
env: { server: true, client: true },
|
|
82
|
+
eager: true,
|
|
79
83
|
_computed: (configValueSources) => {
|
|
80
84
|
{
|
|
81
85
|
const source = getConfigValueSource(configValueSources, 'clientHooks');
|
|
@@ -118,10 +122,12 @@ const configDefinitionsBuiltIn = {
|
|
|
118
122
|
exports.configDefinitionsBuiltIn = configDefinitionsBuiltIn;
|
|
119
123
|
const configDefinitionsBuiltInGlobal = {
|
|
120
124
|
onPrerenderStart: {
|
|
121
|
-
env: { server: true, production: true
|
|
125
|
+
env: { server: true, production: true },
|
|
126
|
+
eager: true
|
|
122
127
|
},
|
|
123
128
|
onBeforeRoute: {
|
|
124
|
-
env: { server: true, client: 'if-client-routing'
|
|
129
|
+
env: { server: true, client: 'if-client-routing' },
|
|
130
|
+
eager: true
|
|
125
131
|
},
|
|
126
132
|
prerender: {
|
|
127
133
|
env: { config: true }
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js
CHANGED
|
@@ -35,7 +35,7 @@ function getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, includeAsse
|
|
|
35
35
|
const importStatements = [];
|
|
36
36
|
const isClientRouting = (0, getConfigValueBuildTime_js_1.getConfigValueBuildTime)(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
37
37
|
lines.push('export const configValuesSerialized = {');
|
|
38
|
-
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfig, importStatements, (configEnv) => (0, isRuntimeEnvMatch_js_1.isRuntimeEnvMatch)(configEnv, { isForClientSide, isClientRouting, isEager: false
|
|
38
|
+
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfig, importStatements, (configEnv) => (0, isRuntimeEnvMatch_js_1.isRuntimeEnvMatch)(configEnv, { isForClientSide, isClientRouting, isDev }), { isEager: false }, ''));
|
|
39
39
|
lines.push('};');
|
|
40
40
|
if (!(0, fixServerAssets_js_1.fixServerAssets_isEnabled)() && includeAssetsImportedByServer && isForClientSide && !isDev) {
|
|
41
41
|
importStatements.push(`import '${(0, extractAssetsQuery_js_1.extractAssetsAddQuery)((0, virtualFilePageConfigValuesAll_js_1.getVirtualFileIdPageConfigValuesAll)(pageId, false))}'`);
|
|
@@ -35,7 +35,7 @@ function getCodePageConfigsSerialized(pageConfigs, isForClientSide, isClientRout
|
|
|
35
35
|
lines.push(` routeFilesystem: ${JSON.stringify(routeFilesystem)},`);
|
|
36
36
|
lines.push(` loadConfigValuesAll: () => import(${JSON.stringify(virtualFileIdPageConfigValuesAll)}),`);
|
|
37
37
|
lines.push(` configValuesSerialized: {`);
|
|
38
|
-
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfig, importStatements, (configEnv) => (0, isRuntimeEnvMatch_js_1.isRuntimeEnvMatch)(configEnv, { isForClientSide, isClientRouting, isEager: true
|
|
38
|
+
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfig, importStatements, (configEnv) => (0, isRuntimeEnvMatch_js_1.isRuntimeEnvMatch)(configEnv, { isForClientSide, isClientRouting, isDev }), { isEager: true }, ' '));
|
|
39
39
|
lines.push(` },`);
|
|
40
40
|
lines.push(` },`);
|
|
41
41
|
});
|
|
@@ -45,7 +45,7 @@ function getCodePageConfigsSerialized(pageConfigs, isForClientSide, isClientRout
|
|
|
45
45
|
function getCodePageConfigGlobalSerialized(pageConfigGlobal, isForClientSide, isClientRouting, isDev, importStatements) {
|
|
46
46
|
const lines = [];
|
|
47
47
|
lines.push(` configValuesSerialized: {`);
|
|
48
|
-
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfigGlobal, importStatements, (configEnv) => (0, isRuntimeEnvMatch_js_1.isRuntimeEnvMatch)(configEnv, { isForClientSide, isClientRouting, isEager: true
|
|
48
|
+
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfigGlobal, importStatements, (configEnv) => (0, isRuntimeEnvMatch_js_1.isRuntimeEnvMatch)(configEnv, { isForClientSide, isClientRouting, isDev }), { isEager: true }, ' '));
|
|
49
49
|
lines.push(` },`);
|
|
50
50
|
const code = lines.join('\n');
|
|
51
51
|
return code;
|
|
@@ -13,9 +13,6 @@ function isRuntimeEnvMatch(configEnv, runtime) {
|
|
|
13
13
|
if (configEnv.client === 'if-client-routing' && !runtime.isClientRouting)
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
-
// Eager
|
|
17
|
-
if (runtime.isEager !== !!configEnv.eager)
|
|
18
|
-
return false;
|
|
19
16
|
// Production/development
|
|
20
17
|
if (
|
|
21
18
|
//
|
|
@@ -17,7 +17,7 @@ const REPLACE_ME_AFTER = '__VIKE__REPLACE_ME_AFTER__';
|
|
|
17
17
|
// - vike/shared/page-configs/serialize/parsePageConfigs.ts
|
|
18
18
|
// - parsePageConfigs() is loaded on both the client- and server-side.
|
|
19
19
|
(0, assertIsNotProductionRuntime_js_1.assertIsNotProductionRuntime)();
|
|
20
|
-
function serializeConfigValues(pageConfig, importStatements, isEnvMatch, tabspace) {
|
|
20
|
+
function serializeConfigValues(pageConfig, importStatements, isEnvMatch, { isEager }, tabspace) {
|
|
21
21
|
const lines = [];
|
|
22
22
|
tabspace += ' ';
|
|
23
23
|
Object.entries(pageConfig.configValuesComputed ?? {}).forEach(([configName, configValuesComputed]) => {
|
|
@@ -36,6 +36,8 @@ function serializeConfigValues(pageConfig, importStatements, isEnvMatch, tabspac
|
|
|
36
36
|
Object.entries(pageConfig.configValueSources).forEach(([configName, sources]) => {
|
|
37
37
|
const configDef = pageConfig.configDefinitions[configName];
|
|
38
38
|
(0, utils_js_1.assert)(configDef);
|
|
39
|
+
if (isEager !== !!configDef.eager)
|
|
40
|
+
return;
|
|
39
41
|
if (!configDef.cumulative) {
|
|
40
42
|
const configValueSource = sources[0];
|
|
41
43
|
(0, utils_js_1.assert)(configValueSource);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { route, getPagesAndRoutes };
|
|
2
2
|
export type { PageRoutes, PageFile, PageConfigRuntime as PageConfig };
|
|
3
|
+
export { getPageFilesAllSafe };
|
|
3
4
|
import { route as routeInternal, type PageRoutes } from '../shared/route/index.js';
|
|
4
5
|
import { type PageFile } from '../shared/getPageFiles.js';
|
|
5
6
|
import { PageConfigRuntime } from '../shared/page-configs/PageConfig.js';
|
|
@@ -15,6 +16,12 @@ declare function getPagesAndRoutes(): Promise<{
|
|
|
15
16
|
pageConfigs: PageConfigRuntime[];
|
|
16
17
|
allPageIds: string[];
|
|
17
18
|
}>;
|
|
19
|
+
declare function getPageFilesAllSafe(): Promise<{
|
|
20
|
+
pageFilesAll: PageFile[];
|
|
21
|
+
allPageIds: string[];
|
|
22
|
+
pageConfigs: PageConfigRuntime[];
|
|
23
|
+
pageConfigGlobal: import("../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
24
|
+
}>;
|
|
18
25
|
declare function route(pageContext: Parameters<typeof routeInternal>[0]): Promise<{
|
|
19
26
|
pageContextAddendum: import("../shared/route/index.js").PageContextFromRoute;
|
|
20
27
|
}>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Internals needed by vite-plugin-vercel
|
|
2
2
|
export { route, getPagesAndRoutes };
|
|
3
|
+
// Internals needed by nitedani's experimental implementation of vike-telefunc
|
|
4
|
+
export { getPageFilesAllSafe };
|
|
3
5
|
import { route as routeInternal } from '../shared/route/index.js';
|
|
4
|
-
import {
|
|
6
|
+
import { getPageFilesAll } from '../shared/getPageFiles.js';
|
|
7
|
+
import { getGlobalContext, getGlobalContextAsync, initGlobalContext } from '../node/runtime/globalContext.js';
|
|
5
8
|
import { handleNodeEnv_vitePluginVercel } from '../utils/assertNodeEnv.js';
|
|
6
9
|
import { assert } from '../utils/assert.js';
|
|
7
10
|
import { getRenderContext } from '../node/runtime/renderPage/renderPageAlreadyRouted.js';
|
|
@@ -25,6 +28,14 @@ async function getPagesAndRoutes() {
|
|
|
25
28
|
allPageIds
|
|
26
29
|
};
|
|
27
30
|
}
|
|
31
|
+
// TODO: make it cleaner once the internal refactoring about global configs is done
|
|
32
|
+
async function getPageFilesAllSafe() {
|
|
33
|
+
await initGlobalContext(false);
|
|
34
|
+
await getGlobalContextAsync();
|
|
35
|
+
const globalContext = getGlobalContext();
|
|
36
|
+
const pageFilesAll = await getPageFilesAll(false, globalContext.isProduction);
|
|
37
|
+
return pageFilesAll;
|
|
38
|
+
}
|
|
28
39
|
async function route(pageContext) {
|
|
29
40
|
const pageContextFromRoute = await routeInternal(pageContext);
|
|
30
41
|
// Old interface
|
|
@@ -89,7 +89,6 @@ async function triggerFullBuild(config, configVike, bundle) {
|
|
|
89
89
|
process.exit(1);
|
|
90
90
|
}
|
|
91
91
|
if (configVike.prerender && !configVike.prerender.disableAutoRun) {
|
|
92
|
-
return;
|
|
93
92
|
await runPrerenderFromAutoFullBuild({ viteConfig: configInline });
|
|
94
93
|
forceExit = true;
|
|
95
94
|
}
|
|
@@ -31,6 +31,14 @@ type ConfigDefinition = {
|
|
|
31
31
|
* https://vike.dev/meta
|
|
32
32
|
*/
|
|
33
33
|
effect?: ConfigEffect;
|
|
34
|
+
/**
|
|
35
|
+
* Always load the configuration value, and as soon as possible.
|
|
36
|
+
*
|
|
37
|
+
* @default false
|
|
38
|
+
*
|
|
39
|
+
* https://vike.dev/meta
|
|
40
|
+
*/
|
|
41
|
+
eager?: boolean;
|
|
34
42
|
/**
|
|
35
43
|
* Whether the configuration always applies to all pages (no config inheritance).
|
|
36
44
|
*
|
|
@@ -32,7 +32,8 @@ const configDefinitionsBuiltIn = {
|
|
|
32
32
|
cumulative: true
|
|
33
33
|
},
|
|
34
34
|
route: {
|
|
35
|
-
env: { server: true, client: 'if-client-routing'
|
|
35
|
+
env: { server: true, client: 'if-client-routing' },
|
|
36
|
+
eager: true
|
|
36
37
|
},
|
|
37
38
|
guard: {
|
|
38
39
|
env: { server: true, client: 'if-client-routing' }
|
|
@@ -41,7 +42,8 @@ const configDefinitionsBuiltIn = {
|
|
|
41
42
|
env: { server: true }
|
|
42
43
|
},
|
|
43
44
|
iKnowThePerformanceRisksOfAsyncRouteFunctions: {
|
|
44
|
-
env: { server: true, client: 'if-client-routing'
|
|
45
|
+
env: { server: true, client: 'if-client-routing' },
|
|
46
|
+
eager: true
|
|
45
47
|
},
|
|
46
48
|
filesystemRoutingRoot: {
|
|
47
49
|
env: { config: true }
|
|
@@ -53,7 +55,8 @@ const configDefinitionsBuiltIn = {
|
|
|
53
55
|
},
|
|
54
56
|
clientRouting: {
|
|
55
57
|
// We could make it { client: false } but we don't yet because of some legacy V0.4 design code
|
|
56
|
-
env: { server: true, client: true, config: true
|
|
58
|
+
env: { server: true, client: true, config: true },
|
|
59
|
+
eager: true
|
|
57
60
|
},
|
|
58
61
|
clientHooks: {
|
|
59
62
|
env: { config: true }
|
|
@@ -74,7 +77,8 @@ const configDefinitionsBuiltIn = {
|
|
|
74
77
|
env: { config: true }
|
|
75
78
|
},
|
|
76
79
|
clientEntryLoaded: {
|
|
77
|
-
env: { server: true, client: true
|
|
80
|
+
env: { server: true, client: true },
|
|
81
|
+
eager: true,
|
|
78
82
|
_computed: (configValueSources) => {
|
|
79
83
|
{
|
|
80
84
|
const source = getConfigValueSource(configValueSources, 'clientHooks');
|
|
@@ -116,10 +120,12 @@ const configDefinitionsBuiltIn = {
|
|
|
116
120
|
};
|
|
117
121
|
const configDefinitionsBuiltInGlobal = {
|
|
118
122
|
onPrerenderStart: {
|
|
119
|
-
env: { server: true, production: true
|
|
123
|
+
env: { server: true, production: true },
|
|
124
|
+
eager: true
|
|
120
125
|
},
|
|
121
126
|
onBeforeRoute: {
|
|
122
|
-
env: { server: true, client: 'if-client-routing'
|
|
127
|
+
env: { server: true, client: 'if-client-routing' },
|
|
128
|
+
eager: true
|
|
123
129
|
},
|
|
124
130
|
prerender: {
|
|
125
131
|
env: { config: true }
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js
CHANGED
|
@@ -32,7 +32,7 @@ function getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, includeAsse
|
|
|
32
32
|
const importStatements = [];
|
|
33
33
|
const isClientRouting = getConfigValueBuildTime(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
34
34
|
lines.push('export const configValuesSerialized = {');
|
|
35
|
-
lines.push(...serializeConfigValues(pageConfig, importStatements, (configEnv) => isRuntimeEnvMatch(configEnv, { isForClientSide, isClientRouting, isEager: false
|
|
35
|
+
lines.push(...serializeConfigValues(pageConfig, importStatements, (configEnv) => isRuntimeEnvMatch(configEnv, { isForClientSide, isClientRouting, isDev }), { isEager: false }, ''));
|
|
36
36
|
lines.push('};');
|
|
37
37
|
if (!fixServerAssets_isEnabled() && includeAssetsImportedByServer && isForClientSide && !isDev) {
|
|
38
38
|
importStatements.push(`import '${extractAssetsAddQuery(getVirtualFileIdPageConfigValuesAll(pageId, false))}'`);
|
|
@@ -32,7 +32,7 @@ function getCodePageConfigsSerialized(pageConfigs, isForClientSide, isClientRout
|
|
|
32
32
|
lines.push(` routeFilesystem: ${JSON.stringify(routeFilesystem)},`);
|
|
33
33
|
lines.push(` loadConfigValuesAll: () => import(${JSON.stringify(virtualFileIdPageConfigValuesAll)}),`);
|
|
34
34
|
lines.push(` configValuesSerialized: {`);
|
|
35
|
-
lines.push(...serializeConfigValues(pageConfig, importStatements, (configEnv) => isRuntimeEnvMatch(configEnv, { isForClientSide, isClientRouting, isEager: true
|
|
35
|
+
lines.push(...serializeConfigValues(pageConfig, importStatements, (configEnv) => isRuntimeEnvMatch(configEnv, { isForClientSide, isClientRouting, isDev }), { isEager: true }, ' '));
|
|
36
36
|
lines.push(` },`);
|
|
37
37
|
lines.push(` },`);
|
|
38
38
|
});
|
|
@@ -42,7 +42,7 @@ function getCodePageConfigsSerialized(pageConfigs, isForClientSide, isClientRout
|
|
|
42
42
|
function getCodePageConfigGlobalSerialized(pageConfigGlobal, isForClientSide, isClientRouting, isDev, importStatements) {
|
|
43
43
|
const lines = [];
|
|
44
44
|
lines.push(` configValuesSerialized: {`);
|
|
45
|
-
lines.push(...serializeConfigValues(pageConfigGlobal, importStatements, (configEnv) => isRuntimeEnvMatch(configEnv, { isForClientSide, isClientRouting, isEager: true
|
|
45
|
+
lines.push(...serializeConfigValues(pageConfigGlobal, importStatements, (configEnv) => isRuntimeEnvMatch(configEnv, { isForClientSide, isClientRouting, isDev }), { isEager: true }, ' '));
|
|
46
46
|
lines.push(` },`);
|
|
47
47
|
const code = lines.join('\n');
|
|
48
48
|
return code;
|
|
@@ -11,9 +11,6 @@ function isRuntimeEnvMatch(configEnv, runtime) {
|
|
|
11
11
|
if (configEnv.client === 'if-client-routing' && !runtime.isClientRouting)
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
|
-
// Eager
|
|
15
|
-
if (runtime.isEager !== !!configEnv.eager)
|
|
16
|
-
return false;
|
|
17
14
|
// Production/development
|
|
18
15
|
if (
|
|
19
16
|
//
|
|
@@ -67,8 +67,6 @@ type ConfigEnv = {
|
|
|
67
67
|
/** For Vike internal use */
|
|
68
68
|
type ConfigEnvInternal = Omit<ConfigEnv, 'client'> & {
|
|
69
69
|
client?: boolean | 'if-client-routing';
|
|
70
|
-
/** Always load value, no matter which page is loaded. */
|
|
71
|
-
eager?: true;
|
|
72
70
|
/** Load value only in production, or only in development. */
|
|
73
71
|
production?: boolean;
|
|
74
72
|
};
|
|
@@ -2,4 +2,6 @@ export { serializeConfigValues };
|
|
|
2
2
|
import type { ConfigEnvInternal, PageConfigBuildTime, PageConfigGlobalBuildTime } from '../PageConfig.js';
|
|
3
3
|
declare function serializeConfigValues(pageConfig: PageConfigBuildTime | (PageConfigGlobalBuildTime & {
|
|
4
4
|
configValuesComputed?: undefined;
|
|
5
|
-
}), importStatements: string[], isEnvMatch: (configEnv: ConfigEnvInternal) => boolean,
|
|
5
|
+
}), importStatements: string[], isEnvMatch: (configEnv: ConfigEnvInternal) => boolean, { isEager }: {
|
|
6
|
+
isEager: boolean;
|
|
7
|
+
}, tabspace: string): string[];
|
|
@@ -12,7 +12,7 @@ const REPLACE_ME_AFTER = '__VIKE__REPLACE_ME_AFTER__';
|
|
|
12
12
|
// - vike/shared/page-configs/serialize/parsePageConfigs.ts
|
|
13
13
|
// - parsePageConfigs() is loaded on both the client- and server-side.
|
|
14
14
|
assertIsNotProductionRuntime();
|
|
15
|
-
function serializeConfigValues(pageConfig, importStatements, isEnvMatch, tabspace) {
|
|
15
|
+
function serializeConfigValues(pageConfig, importStatements, isEnvMatch, { isEager }, tabspace) {
|
|
16
16
|
const lines = [];
|
|
17
17
|
tabspace += ' ';
|
|
18
18
|
Object.entries(pageConfig.configValuesComputed ?? {}).forEach(([configName, configValuesComputed]) => {
|
|
@@ -31,6 +31,8 @@ function serializeConfigValues(pageConfig, importStatements, isEnvMatch, tabspac
|
|
|
31
31
|
Object.entries(pageConfig.configValueSources).forEach(([configName, sources]) => {
|
|
32
32
|
const configDef = pageConfig.configDefinitions[configName];
|
|
33
33
|
assert(configDef);
|
|
34
|
+
if (isEager !== !!configDef.eager)
|
|
35
|
+
return;
|
|
34
36
|
if (!configDef.cumulative) {
|
|
35
37
|
const configValueSource = sources[0];
|
|
36
38
|
assert(configValueSource);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.191-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.191-commit-7e0cd43";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.191-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.191-commit-7e0cd43';
|