vike 0.4.229-commit-845a4e0 → 0.4.229-commit-7056ef0
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/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +12 -6
- package/dist/cjs/node/prerender/runPrerender.js +2 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/getCacheControl.js +7 -5
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -1
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +2 -1
- package/dist/cjs/node/runtime/renderPage/executeHookServer.js +11 -0
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +8 -16
- package/dist/cjs/node/runtime/renderPage/{loadUserFilesServerSide.js → loadPageConfigsLazyServerSide.js} +4 -4
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -2
- package/dist/cjs/node/runtime/renderPage.js +2 -2
- package/dist/cjs/shared/createGlobalContextShared.js +33 -7
- package/dist/cjs/shared/createPageContextShared.js +5 -11
- package/dist/cjs/shared/hooks/executeHook.js +21 -0
- package/dist/cjs/shared/hooks/getHook.js +23 -4
- package/dist/cjs/shared/page-configs/{getPageConfigUserFriendly.js → getUserFriendlyConfigs.js} +37 -32
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/client/client-routing-runtime/{createPageContext.d.ts → createPageContextClientSide.d.ts} +11 -6
- package/dist/esm/client/client-routing-runtime/{createPageContext.js → createPageContextClientSide.js} +1 -1
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +15 -7
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.js +38 -46
- package/dist/esm/client/client-routing-runtime/globalContext.d.ts +10 -1
- package/dist/esm/client/client-routing-runtime/prefetch.js +3 -3
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +14 -22
- package/dist/esm/client/server-routing-runtime/createPageContextClientSide.d.ts +12 -8
- package/dist/esm/client/server-routing-runtime/createPageContextClientSide.js +7 -16
- package/dist/esm/client/server-routing-runtime/entry.js +5 -3
- package/dist/esm/client/server-routing-runtime/globalContext.d.ts +10 -1
- package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +10 -1
- package/dist/esm/client/shared/{loadUserFilesClientSide.d.ts → loadPageConfigsLazyClientSide.d.ts} +2 -2
- package/dist/esm/client/shared/{loadUserFilesClientSide.js → loadPageConfigsLazyClientSide.js} +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +12 -6
- package/dist/esm/node/prerender/runPrerender.d.ts +82 -18
- package/dist/esm/node/prerender/runPrerender.js +2 -2
- package/dist/esm/node/runtime/globalContext.d.ts +181 -18
- package/dist/esm/node/runtime/renderPage/createHttpResponse/getCacheControl.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/createHttpResponse/getCacheControl.js +7 -5
- package/dist/esm/node/runtime/renderPage/createHttpResponse.js +0 -1
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +41 -9
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.js +2 -1
- package/dist/esm/node/runtime/renderPage/executeHookServer.d.ts +13 -0
- package/dist/esm/node/runtime/renderPage/executeHookServer.js +9 -0
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.d.ts +2 -3
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +8 -16
- package/dist/esm/node/runtime/renderPage/{loadUserFilesServerSide.d.ts → loadPageConfigsLazyServerSide.d.ts} +6 -6
- package/dist/esm/node/runtime/renderPage/{loadUserFilesServerSide.js → loadPageConfigsLazyServerSide.js} +4 -4
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +84 -20
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -2
- package/dist/esm/node/runtime/renderPage.d.ts +41 -9
- package/dist/esm/node/runtime/renderPage.js +2 -2
- package/dist/esm/shared/createGlobalContextShared.d.ts +26 -6
- package/dist/esm/shared/createGlobalContextShared.js +33 -7
- package/dist/esm/shared/createPageContextShared.d.ts +3 -6
- package/dist/esm/shared/createPageContextShared.js +5 -11
- package/dist/esm/shared/getPageFiles.d.ts +1 -1
- package/dist/esm/shared/hooks/executeHook.d.ts +14 -1
- package/dist/esm/shared/hooks/executeHook.js +21 -0
- package/dist/esm/shared/hooks/getHook.d.ts +7 -10
- package/dist/esm/shared/hooks/getHook.js +23 -4
- package/dist/esm/shared/page-configs/Config.d.ts +4 -2
- package/dist/esm/shared/page-configs/{getPageConfigUserFriendly.d.ts → getUserFriendlyConfigs.d.ts} +8 -6
- package/dist/esm/shared/page-configs/{getPageConfigUserFriendly.js → getUserFriendlyConfigs.js} +37 -32
- package/dist/esm/shared/types.d.ts +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/shared/getPageConfigsRuntime.js +0 -23
- package/dist/cjs/shared/hooks/executeHookGeneric.js +0 -18
- package/dist/esm/shared/getPageConfigsRuntime.d.ts +0 -14
- package/dist/esm/shared/getPageConfigsRuntime.js +0 -21
- package/dist/esm/shared/hooks/executeHookGeneric.d.ts +0 -8
- package/dist/esm/shared/hooks/executeHookGeneric.js +0 -16
|
@@ -59,10 +59,8 @@ const configDefinitionsBuiltIn = {
|
|
|
59
59
|
env: { server: true }
|
|
60
60
|
},
|
|
61
61
|
onData: {
|
|
62
|
-
env: { server: true, client: true }
|
|
63
|
-
/* TODO/now
|
|
62
|
+
env: { server: true, client: true },
|
|
64
63
|
cumulative: true
|
|
65
|
-
*/
|
|
66
64
|
},
|
|
67
65
|
iKnowThePerformanceRisksOfAsyncRouteFunctions: {
|
|
68
66
|
env: { server: true, client: 'if-client-routing' },
|
|
@@ -26,7 +26,7 @@ const resolvePointerImport_js_1 = require("./getVikeConfig/resolvePointerImport.
|
|
|
26
26
|
const getFilePath_js_1 = require("../../../shared/getFilePath.js");
|
|
27
27
|
const getConfigValueBuildTime_js_1 = require("../../../../../shared/page-configs/getConfigValueBuildTime.js");
|
|
28
28
|
const assertExtensions_js_1 = require("./getVikeConfig/assertExtensions.js");
|
|
29
|
-
const
|
|
29
|
+
const getUserFriendlyConfigs_js_1 = require("../../../../../shared/page-configs/getUserFriendlyConfigs.js");
|
|
30
30
|
const serializeConfigValues_js_1 = require("../../../../../shared/page-configs/serialize/serializeConfigValues.js");
|
|
31
31
|
const getPlusFilesAll_js_1 = require("./getVikeConfig/getPlusFilesAll.js");
|
|
32
32
|
const getEnvVarObject_js_1 = require("../../../shared/getEnvVarObject.js");
|
|
@@ -142,7 +142,7 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
|
|
|
142
142
|
configDefinitions: {},
|
|
143
143
|
configValueSources: {}
|
|
144
144
|
},
|
|
145
|
-
global: (0,
|
|
145
|
+
global: (0, getUserFriendlyConfigs_js_1.getUserFriendlyConfigsGlobal)({ pageConfigGlobalValues: {} }),
|
|
146
146
|
pages: {},
|
|
147
147
|
vikeConfigDependencies: new Set()
|
|
148
148
|
};
|
|
@@ -163,13 +163,19 @@ async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
|
|
|
163
163
|
setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved);
|
|
164
164
|
// global
|
|
165
165
|
const pageConfigGlobalValues = getConfigValues(pageConfigGlobal);
|
|
166
|
-
const
|
|
166
|
+
const userFriendlyConfigsGlobal = (0, getUserFriendlyConfigs_js_1.getUserFriendlyConfigsGlobal)({ pageConfigGlobalValues });
|
|
167
167
|
// pages
|
|
168
|
-
const
|
|
168
|
+
const userFriendlyConfigsPageEager = (0, utils_js_1.objectFromEntries)(pageConfigs.map((pageConfig) => {
|
|
169
169
|
const pageConfigValues = getConfigValues(pageConfig, true);
|
|
170
|
-
return (0,
|
|
170
|
+
return (0, getUserFriendlyConfigs_js_1.getUserFriendlyConfigsPageEager)(pageConfigGlobalValues, pageConfig, pageConfigValues);
|
|
171
171
|
}));
|
|
172
|
-
return {
|
|
172
|
+
return {
|
|
173
|
+
pageConfigs,
|
|
174
|
+
pageConfigGlobal,
|
|
175
|
+
global: userFriendlyConfigsGlobal,
|
|
176
|
+
pages: userFriendlyConfigsPageEager,
|
|
177
|
+
vikeConfigDependencies: esbuildCache.vikeConfigDependencies
|
|
178
|
+
};
|
|
173
179
|
}
|
|
174
180
|
async function resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache) {
|
|
175
181
|
const plusFilesAllOrdered = Object.values(plusFilesAll)
|
|
@@ -56,7 +56,7 @@ const getConfigValueRuntime_js_1 = require("../../shared/page-configs/getConfigV
|
|
|
56
56
|
const loadConfigValues_js_1 = require("../../shared/page-configs/loadConfigValues.js");
|
|
57
57
|
const error_page_js_1 = require("../../shared/error-page.js");
|
|
58
58
|
const abort_js_1 = require("../../shared/route/abort.js");
|
|
59
|
-
const
|
|
59
|
+
const loadPageConfigsLazyServerSide_js_1 = require("../runtime/renderPage/loadPageConfigsLazyServerSide.js");
|
|
60
60
|
const getHook_js_1 = require("../../shared/hooks/getHook.js");
|
|
61
61
|
const noRouteMatch_js_1 = require("../../shared/route/noRouteMatch.js");
|
|
62
62
|
const getVikeConfig_js_1 = require("../plugin/plugins/importUserCode/v1-design/getVikeConfig.js");
|
|
@@ -386,7 +386,7 @@ async function createPageContextPrerendering(urlOriginal, prerenderContext, glob
|
|
|
386
386
|
routeParams: {}
|
|
387
387
|
});
|
|
388
388
|
}
|
|
389
|
-
(0, utils_js_1.objectAssign)(pageContext, await (0,
|
|
389
|
+
(0, utils_js_1.objectAssign)(pageContext, await (0, loadPageConfigsLazyServerSide_js_1.loadPageConfigsLazyServerSide)(pageContext));
|
|
390
390
|
let usesClientRouter;
|
|
391
391
|
{
|
|
392
392
|
const { pageId } = pageContext;
|
|
@@ -10,11 +10,13 @@ function getCacheControl(pageId, pageConfigs, statusCode) {
|
|
|
10
10
|
return defaultValue;
|
|
11
11
|
if (statusCode > 499)
|
|
12
12
|
return defaultValue;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
if (pageId) {
|
|
14
|
+
const pageConfig = (0, helpers_js_1.getPageConfig)(pageId, pageConfigs);
|
|
15
|
+
const configValue = (0, getConfigValueRuntime_js_1.getConfigValueRuntime)(pageConfig, 'cacheControl', 'string');
|
|
16
|
+
const value = configValue?.value;
|
|
17
|
+
if (value)
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
18
20
|
// - Disabling caching by default is the safest strategy, because caching is problematic with authentication as described in https://github.com/vikejs/vike/issues/1275#issuecomment-1824366875
|
|
19
21
|
// - Are there use cases when we don't need to disable caching?
|
|
20
22
|
// - When there isn't any <script id="vike_pageContext" type="application/json"> then we can safely have caching. (We don't implement this exception because we're lazy and it's quite a rare situation.)
|
|
@@ -31,7 +31,6 @@ async function createHttpResponsePage(htmlRender, renderHook, pageContext) {
|
|
|
31
31
|
}
|
|
32
32
|
const earlyHints = (0, getEarlyHints_js_1.getEarlyHints)(await pageContext.__getPageAssets());
|
|
33
33
|
const headers = [];
|
|
34
|
-
(0, utils_js_1.assert)(pageContext.pageId);
|
|
35
34
|
const cacheControl = (0, getCacheControl_js_1.getCacheControl)(pageContext.pageId, pageContext._pageConfigs, statusCode);
|
|
36
35
|
if (cacheControl) {
|
|
37
36
|
headers.push(['Cache-Control', cacheControl]);
|
|
@@ -35,6 +35,7 @@ async function createPageContextServerSide(pageContextInit, globalContext, globa
|
|
|
35
35
|
_urlHandler: urlHandler,
|
|
36
36
|
isClientSideNavigation
|
|
37
37
|
});
|
|
38
|
+
(0, utils_js_1.objectAssign)(pageContextCreated, globalContext._userFriendlyConfigsGlobal);
|
|
38
39
|
// pageContext.urlParsed
|
|
39
40
|
const pageContextUrlComputed = (0, getPageContextUrlComputed_js_1.getPageContextUrlComputed)(pageContextCreated);
|
|
40
41
|
(0, utils_js_1.objectAssign)(pageContextCreated, pageContextUrlComputed);
|
|
@@ -55,7 +56,7 @@ async function createPageContextServerSide(pageContextInit, globalContext, globa
|
|
|
55
56
|
}
|
|
56
57
|
(0, utils_js_1.objectAssign)(pageContextCreated, { headers });
|
|
57
58
|
}
|
|
58
|
-
const pageContextAugmented = await (0, createPageContextShared_js_1.createPageContextShared)(pageContextCreated, globalContext._pageConfigGlobal);
|
|
59
|
+
const pageContextAugmented = await (0, createPageContextShared_js_1.createPageContextShared)(pageContextCreated, globalContext._pageConfigGlobal, globalContext._userFriendlyConfigsGlobal);
|
|
59
60
|
(0, utils_js_1.augmentType)(pageContextCreated, pageContextAugmented);
|
|
60
61
|
return pageContextCreated;
|
|
61
62
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeHookServer = executeHookServer;
|
|
4
|
+
const executeHook_js_1 = require("../../../shared/hooks/executeHook.js");
|
|
5
|
+
const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePageContextForUserConsumptionServerSide.js");
|
|
6
|
+
async function executeHookServer(hookName, pageContext) {
|
|
7
|
+
return await (0, executeHook_js_1.executeHookNew)(hookName, pageContext, (p) => {
|
|
8
|
+
(0, preparePageContextForUserConsumptionServerSide_js_1.preparePageContextForUserConsumptionServerSide)(p);
|
|
9
|
+
return p;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeOnBeforeRenderAndDataHooks = executeOnBeforeRenderAndDataHooks;
|
|
4
|
-
const getHook_js_1 = require("../../../shared/hooks/getHook.js");
|
|
5
|
-
const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePageContextForUserConsumptionServerSide.js");
|
|
6
4
|
const assertOnBeforeRenderHookReturn_js_1 = require("../../../shared/assertOnBeforeRenderHookReturn.js");
|
|
7
|
-
const
|
|
5
|
+
const executeHookServer_js_1 = require("./executeHookServer.js");
|
|
8
6
|
async function executeOnBeforeRenderAndDataHooks(pageContext) {
|
|
9
7
|
if (pageContext._pageContextAlreadyProvidedByOnPrerenderHook) {
|
|
10
8
|
return;
|
|
11
9
|
}
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
if (!dataHook && !onBeforeRenderHook) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
(0, preparePageContextForUserConsumptionServerSide_js_1.preparePageContextForUserConsumptionServerSide)(pageContext);
|
|
10
|
+
const hooks = await (0, executeHookServer_js_1.executeHookServer)('data', pageContext);
|
|
11
|
+
const dataHook = hooks[0]; // TO-DO/soon: support cumulative
|
|
18
12
|
if (dataHook) {
|
|
19
|
-
const hookResult = await (0, executeHook_js_1.executeHook)(() => dataHook.hookFn(pageContext), dataHook, pageContext);
|
|
20
13
|
// Note: hookResult can be anything (e.g. an object) and is to be assigned to pageContext.data
|
|
21
14
|
const pageContextFromHook = {
|
|
22
|
-
data: hookResult
|
|
15
|
+
data: dataHook.hookResult
|
|
23
16
|
};
|
|
24
17
|
Object.assign(pageContext, pageContextFromHook);
|
|
25
18
|
// Execute +onData
|
|
26
19
|
if (!pageContext.isClientSideNavigation) {
|
|
27
|
-
|
|
28
|
-
if (onDataHook) {
|
|
29
|
-
await (0, executeHook_js_1.executeHook)(() => onDataHook.hookFn(pageContext), dataHook, pageContext);
|
|
30
|
-
}
|
|
20
|
+
await (0, executeHookServer_js_1.executeHookServer)('onData', pageContext);
|
|
31
21
|
}
|
|
32
22
|
}
|
|
23
|
+
const res = await (0, executeHookServer_js_1.executeHookServer)('onBeforeRender', pageContext);
|
|
24
|
+
const onBeforeRenderHook = res[0]; // TO-DO/soon: support cumulative
|
|
33
25
|
if (onBeforeRenderHook) {
|
|
34
|
-
const hookResult =
|
|
26
|
+
const { hookResult } = onBeforeRenderHook;
|
|
35
27
|
(0, assertOnBeforeRenderHookReturn_js_1.assertOnBeforeRenderHookReturn)(hookResult, onBeforeRenderHook.hookFilePath);
|
|
36
28
|
const pageContextFromHook = hookResult?.pageContext;
|
|
37
29
|
Object.assign(pageContext, pageContextFromHook);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.loadPageConfigsLazyServerSide = loadPageConfigsLazyServerSide;
|
|
4
4
|
const getPageFiles_js_1 = require("../../../shared/getPageFiles.js");
|
|
5
|
-
const
|
|
5
|
+
const getUserFriendlyConfigs_js_1 = require("../../../shared/page-configs/getUserFriendlyConfigs.js");
|
|
6
6
|
const analyzePageClientSide_js_1 = require("../../../shared/getPageFiles/analyzePageClientSide.js");
|
|
7
7
|
const utils_js_1 = require("../utils.js");
|
|
8
8
|
const getPageAssets_js_1 = require("./getPageAssets.js");
|
|
@@ -10,7 +10,7 @@ const debugPageFiles_js_1 = require("./debugPageFiles.js");
|
|
|
10
10
|
const findPageConfig_js_1 = require("../../../shared/page-configs/findPageConfig.js");
|
|
11
11
|
const analyzePage_js_1 = require("./analyzePage.js");
|
|
12
12
|
const loadConfigValues_js_1 = require("../../../shared/page-configs/loadConfigValues.js");
|
|
13
|
-
async function
|
|
13
|
+
async function loadPageConfigsLazyServerSide(pageContext) {
|
|
14
14
|
const pageConfig = (0, findPageConfig_js_1.findPageConfig)(pageContext._pageConfigs, pageContext.pageId); // Make pageConfig globally available as pageContext._pageConfig?
|
|
15
15
|
const globalContext = pageContext._globalContext;
|
|
16
16
|
const [{ pageFilesLoaded, pageContextExports }] = await Promise.all([
|
|
@@ -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,
|
|
105
|
+
const pageContextExports = (0, getUserFriendlyConfigs_js_1.getUserFriendlyConfigsPageLazy)(pageFilesServerSide, pageConfigLoaded, pageConfigGlobal);
|
|
106
106
|
return {
|
|
107
107
|
pageContextExports,
|
|
108
108
|
pageFilesLoaded: pageFilesServerSide
|
|
@@ -10,7 +10,7 @@ const renderHtml_js_1 = require("../html/renderHtml.js");
|
|
|
10
10
|
const utils_js_1 = require("../utils.js");
|
|
11
11
|
const serializeContext_js_1 = require("../html/serializeContext.js");
|
|
12
12
|
const createHttpResponse_js_1 = require("./createHttpResponse.js");
|
|
13
|
-
const
|
|
13
|
+
const loadPageConfigsLazyServerSide_js_1 = require("./loadPageConfigsLazyServerSide.js");
|
|
14
14
|
const executeOnRenderHtmlHook_js_1 = require("./executeOnRenderHtmlHook.js");
|
|
15
15
|
const executeOnBeforeRenderAndDataHooks_js_1 = require("./executeOnBeforeRenderAndDataHooks.js");
|
|
16
16
|
const loggerRuntime_js_1 = require("./loggerRuntime.js");
|
|
@@ -26,7 +26,7 @@ async function renderPageAlreadyRouted(pageContext) {
|
|
|
26
26
|
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageContext, 'pageId', 'string'));
|
|
27
27
|
const isError = pageContext.is404 || !!pageContext.errorWhileRendering;
|
|
28
28
|
(0, utils_js_1.assert)(isError === (pageContext.pageId === (0, error_page_js_1.getErrorPageId)(pageContext._pageFilesAll, pageContext._pageConfigs)));
|
|
29
|
-
(0, utils_js_1.objectAssign)(pageContext, await (0,
|
|
29
|
+
(0, utils_js_1.objectAssign)(pageContext, await (0, loadPageConfigsLazyServerSide_js_1.loadPageConfigsLazyServerSide)(pageContext));
|
|
30
30
|
if (!isError) {
|
|
31
31
|
await (0, executeGuardHook_js_1.executeGuardHook)(pageContext, (pageContext) => (0, preparePageContextForUserConsumptionServerSide_js_1.preparePageContextForUserConsumptionServerSide)(pageContext));
|
|
32
32
|
}
|
|
@@ -22,7 +22,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
22
22
|
const serializeContext_js_1 = require("./html/serializeContext.js");
|
|
23
23
|
const error_page_js_1 = require("../../shared/error-page.js");
|
|
24
24
|
const handleErrorWithoutErrorPage_js_1 = require("./renderPage/handleErrorWithoutErrorPage.js");
|
|
25
|
-
const
|
|
25
|
+
const loadPageConfigsLazyServerSide_js_1 = require("./renderPage/loadPageConfigsLazyServerSide.js");
|
|
26
26
|
const resolveRedirects_js_1 = require("./renderPage/resolveRedirects.js");
|
|
27
27
|
const globalObject = (0, utils_js_1.getGlobalObject)('runtime/renderPage.ts', {
|
|
28
28
|
httpRequestsCount: 0
|
|
@@ -415,7 +415,7 @@ pageContextNominalPageBegin, httpRequestId, pageContextErrorPageInit, globalCont
|
|
|
415
415
|
(0, utils_js_1.objectAssign)(pageContext, { pageId: errorPageId });
|
|
416
416
|
(0, utils_js_1.objectAssign)(pageContext, pageContextAbort);
|
|
417
417
|
(0, utils_js_1.objectAssign)(pageContext, pageContextErrorPageInit, true);
|
|
418
|
-
(0, utils_js_1.objectAssign)(pageContext, await (0,
|
|
418
|
+
(0, utils_js_1.objectAssign)(pageContext, await (0, loadPageConfigsLazyServerSide_js_1.loadPageConfigsLazyServerSide)(pageContext));
|
|
419
419
|
// We include pageContextInit: we don't only serialize pageContextAbort because the error page may need to access pageContextInit
|
|
420
420
|
pageContextSerialized = (0, serializeContext_js_1.getPageContextClientSerialized)(pageContext);
|
|
421
421
|
}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getGlobalContextSyncErrMsg = void 0;
|
|
4
4
|
exports.createGlobalContextShared = createGlobalContextShared;
|
|
5
|
+
const utils_js_1 = require("./utils.js");
|
|
6
|
+
const parseGlobResults_js_1 = require("./getPageFiles/parseGlobResults.js");
|
|
7
|
+
const getUserFriendlyConfigs_js_1 = require("./page-configs/getUserFriendlyConfigs.js");
|
|
8
|
+
const executeHook_js_1 = require("./hooks/executeHook.js");
|
|
5
9
|
const getGlobalContextSyncErrMsg = "The global context isn't set yet, call getGlobalContextSync() later or use getGlobalContext() instead.";
|
|
6
10
|
exports.getGlobalContextSyncErrMsg = getGlobalContextSyncErrMsg;
|
|
7
|
-
const getPageConfigsRuntime_js_1 = require("./getPageConfigsRuntime.js");
|
|
8
|
-
const executeHookGeneric_js_1 = require("./hooks/executeHookGeneric.js");
|
|
9
|
-
const utils_js_1 = require("./utils.js");
|
|
10
11
|
async function createGlobalContextShared(virtualFileExports, globalObject, addGlobalContext) {
|
|
11
12
|
const globalContext = createGlobalContextBase(virtualFileExports);
|
|
12
13
|
const globalContextAddendum = await addGlobalContext?.(globalContext);
|
|
@@ -24,7 +25,7 @@ async function createGlobalContextShared(virtualFileExports, globalObject, addGl
|
|
|
24
25
|
// - globalContext._viteDevServer.hot.send()
|
|
25
26
|
// - Send 'full-server-reload' signal whenever a onCreateGlobalContext() function is modified => we need a globalObject to track all hooks and see if one of them is new/modified.
|
|
26
27
|
// - Seems less idiomatic
|
|
27
|
-
await (0,
|
|
28
|
+
await (0, executeHook_js_1.executeHookGlobalCumulative)('onCreateGlobalContext', globalContext._pageConfigGlobal, null, globalContext);
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
30
31
|
// Singleton: ensure all `globalContext` user-land references are preserved & updated.
|
|
@@ -34,7 +35,7 @@ async function createGlobalContextShared(virtualFileExports, globalObject, addGl
|
|
|
34
35
|
return globalObject.globalContext;
|
|
35
36
|
}
|
|
36
37
|
function createGlobalContextBase(virtualFileExports) {
|
|
37
|
-
const { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal,
|
|
38
|
+
const { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal, userFriendlyConfigsGlobal, userFriendlyConfigsPageEager } = getConfigsAll(virtualFileExports);
|
|
38
39
|
const globalContext = {
|
|
39
40
|
/**
|
|
40
41
|
* Useful for distinguishing `globalContext` from other objects and narrowing down TypeScript unions.
|
|
@@ -47,8 +48,33 @@ function createGlobalContextBase(virtualFileExports) {
|
|
|
47
48
|
_pageConfigs: pageConfigs,
|
|
48
49
|
_pageConfigGlobal: pageConfigGlobal,
|
|
49
50
|
_allPageIds: allPageIds,
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
_userFriendlyConfigsGlobal: userFriendlyConfigsGlobal,
|
|
52
|
+
config: userFriendlyConfigsGlobal.config,
|
|
53
|
+
pages: userFriendlyConfigsPageEager
|
|
52
54
|
};
|
|
53
55
|
return globalContext;
|
|
54
56
|
}
|
|
57
|
+
function getConfigsAll(virtualFileExports) {
|
|
58
|
+
const { pageFilesAll, pageConfigs, pageConfigGlobal } = (0, parseGlobResults_js_1.parseGlobResults)(virtualFileExports);
|
|
59
|
+
const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
|
|
60
|
+
const userFriendlyConfigsGlobal = (0, getUserFriendlyConfigs_js_1.getUserFriendlyConfigsGlobal)({
|
|
61
|
+
pageConfigGlobalValues: pageConfigGlobal.configValues
|
|
62
|
+
});
|
|
63
|
+
const userFriendlyConfigsPageEager = Object.fromEntries(pageConfigs.map((pageConfig) => {
|
|
64
|
+
return (0, getUserFriendlyConfigs_js_1.getUserFriendlyConfigsPageEager)(pageConfigGlobal.configValues, pageConfig, pageConfig.configValues);
|
|
65
|
+
}));
|
|
66
|
+
return {
|
|
67
|
+
pageFilesAll,
|
|
68
|
+
allPageIds,
|
|
69
|
+
pageConfigs,
|
|
70
|
+
pageConfigGlobal,
|
|
71
|
+
userFriendlyConfigsGlobal,
|
|
72
|
+
userFriendlyConfigsPageEager
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function getAllPageIds(pageFilesAll, pageConfigs) {
|
|
76
|
+
const fileIds = pageFilesAll.filter(({ isDefaultPageFile }) => !isDefaultPageFile).map(({ pageId }) => pageId);
|
|
77
|
+
const allPageIds = (0, utils_js_1.unique)(fileIds);
|
|
78
|
+
const allPageIds2 = pageConfigs.map((p) => p.pageId);
|
|
79
|
+
return [...allPageIds, ...allPageIds2];
|
|
80
|
+
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPageContextShared = createPageContextShared;
|
|
4
|
-
const
|
|
5
|
-
const getPageConfigUserFriendly_js_1 = require("./page-configs/getPageConfigUserFriendly.js");
|
|
4
|
+
const executeHook_js_1 = require("./hooks/executeHook.js");
|
|
6
5
|
const utils_js_1 = require("./utils.js");
|
|
7
|
-
async function createPageContextShared(pageContextCreated, pageConfigGlobal) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
(0, utils_js_1.objectAssign)(pageContextCreated, {
|
|
12
|
-
isPageContext: true,
|
|
13
|
-
...pageConfigGlobalUserFriendly
|
|
14
|
-
}, true);
|
|
15
|
-
await (0, executeHookGeneric_js_1.executeHookGenericGlobalCumulative)('onCreatePageContext', pageConfigGlobal, pageContextCreated, pageContextCreated);
|
|
6
|
+
async function createPageContextShared(pageContextCreated, pageConfigGlobal, userFriendlyConfigsGlobal) {
|
|
7
|
+
(0, utils_js_1.objectAssign)(pageContextCreated, { isPageContext: true }, true);
|
|
8
|
+
(0, utils_js_1.objectAssign)(pageContextCreated, userFriendlyConfigsGlobal);
|
|
9
|
+
await (0, executeHook_js_1.executeHookGlobalCumulative)('onCreatePageContext', pageConfigGlobal, pageContextCreated, pageContextCreated);
|
|
16
10
|
return pageContextCreated;
|
|
17
11
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeHook = executeHook;
|
|
4
|
+
exports.executeHookNew = executeHookNew;
|
|
5
|
+
exports.executeHookGlobalCumulative = executeHookGlobalCumulative;
|
|
4
6
|
exports.getPageContext = getPageContext;
|
|
5
7
|
exports.providePageContext = providePageContext;
|
|
6
8
|
exports.isUserHookError = isUserHookError;
|
|
@@ -8,10 +10,29 @@ const assert_js_1 = require("../../utils/assert.js");
|
|
|
8
10
|
const getGlobalObject_js_1 = require("../../utils/getGlobalObject.js");
|
|
9
11
|
const humanizeTime_js_1 = require("../../utils/humanizeTime.js");
|
|
10
12
|
const isObject_js_1 = require("../../utils/isObject.js");
|
|
13
|
+
const getHook_js_1 = require("./getHook.js");
|
|
11
14
|
const globalObject = (0, getGlobalObject_js_1.getGlobalObject)('utils/executeHook.ts', {
|
|
12
15
|
userHookErrors: new WeakMap(),
|
|
13
16
|
pageContext: null
|
|
14
17
|
});
|
|
18
|
+
// TO-DO/eventually: use this variant more prominently
|
|
19
|
+
async function executeHookNew(hookName, pageContext, prepare) {
|
|
20
|
+
const hooks = (0, getHook_js_1.getHookFromPageContextNew)(hookName, pageContext);
|
|
21
|
+
if (!hooks.length)
|
|
22
|
+
return [];
|
|
23
|
+
const pageContextPrepared = prepare(pageContext);
|
|
24
|
+
const hooksWithResult = await Promise.all(hooks.map(async (hook) => {
|
|
25
|
+
const hookResult = await executeHook(() => hook.hookFn(pageContextPrepared), hook, pageContext);
|
|
26
|
+
return { ...hook, hookResult };
|
|
27
|
+
}));
|
|
28
|
+
return hooksWithResult;
|
|
29
|
+
}
|
|
30
|
+
async function executeHookGlobalCumulative(hookName, pageConfigGlobal, pageContext, arg) {
|
|
31
|
+
const hooks = (0, getHook_js_1.getHookFromPageConfigGlobalCumulative)(pageConfigGlobal, hookName);
|
|
32
|
+
await Promise.all(hooks.map(async (hook) => {
|
|
33
|
+
await executeHook(() => hook.hookFn(arg), hook, pageContext);
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
15
36
|
function isUserHookError(err) {
|
|
16
37
|
if (!(0, isObject_js_1.isObject)(err))
|
|
17
38
|
return false;
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getHookFromPageContext = getHookFromPageContext;
|
|
7
|
+
exports.getHookFromPageContextNew = getHookFromPageContextNew;
|
|
7
8
|
exports.getHookFromPageConfig = getHookFromPageConfig;
|
|
8
9
|
exports.getHookFromPageConfigGlobal = getHookFromPageConfigGlobal;
|
|
9
10
|
exports.getHookFromPageConfigGlobalCumulative = getHookFromPageConfigGlobalCumulative;
|
|
10
|
-
exports.assertHook = assertHook;
|
|
11
11
|
exports.getHook_setIsPrerenderering = getHook_setIsPrerenderering;
|
|
12
12
|
exports.getHookTimeoutDefault = getHookTimeoutDefault;
|
|
13
13
|
const getGlobalObject_js_1 = require("../../utils/getGlobalObject.js");
|
|
@@ -25,12 +25,34 @@ function getHookFromPageContext(pageContext, hookName) {
|
|
|
25
25
|
const hookFn = pageContext.exports[hookName];
|
|
26
26
|
if (hookFn === null)
|
|
27
27
|
return null;
|
|
28
|
+
// TO-DO/eventually: use pageContext.configEntries in favor of pageContext.exportsAll once V0.4 is removed
|
|
28
29
|
const file = pageContext.exportsAll[hookName][0];
|
|
29
30
|
(0, utils_js_1.assert)(file.exportValue === hookFn);
|
|
30
31
|
const hookFilePath = file.filePath;
|
|
31
32
|
(0, utils_js_1.assert)(hookFilePath);
|
|
32
33
|
return getHook(hookFn, hookName, hookFilePath, hookTimeout);
|
|
33
34
|
}
|
|
35
|
+
// TO-DO/eventually: remove getHookFromPageContext() in favor of getHookFromPageContextNew()
|
|
36
|
+
function getHookFromPageContextNew(hookName, pageContext) {
|
|
37
|
+
const { hooksTimeout } = pageContext.config;
|
|
38
|
+
const hookTimeout = getHookTimeout(hooksTimeout, hookName);
|
|
39
|
+
const hooks = [];
|
|
40
|
+
/* TO-DO/eventually: use pageContext.configEntries in favor of pageContext.exportsAll once V0.4 is removed
|
|
41
|
+
pageContext.configEntries[hookName]?.forEach((val) => {
|
|
42
|
+
const hookFn = val.configValue
|
|
43
|
+
if (hookFn === null) return
|
|
44
|
+
const hookFilePath = val.configDefinedByFile
|
|
45
|
+
*/
|
|
46
|
+
pageContext.exportsAll[hookName]?.forEach((val) => {
|
|
47
|
+
const hookFn = val.exportValue;
|
|
48
|
+
if (hookFn === null)
|
|
49
|
+
return;
|
|
50
|
+
const hookFilePath = val.filePath;
|
|
51
|
+
(0, utils_js_1.assert)(hookFilePath);
|
|
52
|
+
hooks.push(getHook(hookFn, hookName, hookFilePath, hookTimeout));
|
|
53
|
+
});
|
|
54
|
+
return hooks;
|
|
55
|
+
}
|
|
34
56
|
function getHookFromPageConfig(pageConfig, hookName) {
|
|
35
57
|
const configValue = (0, getConfigValueRuntime_js_1.getConfigValueRuntime)(pageConfig, hookName);
|
|
36
58
|
if (!configValue?.value)
|
|
@@ -79,9 +101,6 @@ function getHookFromConfigValue(configValue) {
|
|
|
79
101
|
const hookFilePath = (0, helpers_js_1.getHookFilePathToShowToUser)(configValue.definedAtData);
|
|
80
102
|
return { hookFn, hookFilePath };
|
|
81
103
|
}
|
|
82
|
-
function assertHook(pageContext, hookName) {
|
|
83
|
-
getHookFromPageContext(pageContext, hookName);
|
|
84
|
-
}
|
|
85
104
|
function assertHookFn(hookFn, { hookName, hookFilePath }) {
|
|
86
105
|
(0, utils_js_1.assert)(hookName && hookFilePath);
|
|
87
106
|
(0, utils_js_1.assert)(!hookName.endsWith(')'));
|
package/dist/cjs/shared/page-configs/{getPageConfigUserFriendly.js → getUserFriendlyConfigs.js}
RENAMED
|
@@ -3,16 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
6
|
+
exports.getUserFriendlyConfigsGlobal = getUserFriendlyConfigsGlobal;
|
|
7
|
+
exports.getUserFriendlyConfigsPageEager = getUserFriendlyConfigsPageEager;
|
|
8
|
+
exports.getUserFriendlyConfigsPageLazy = getUserFriendlyConfigsPageLazy;
|
|
9
9
|
const assert_exports_old_design_js_1 = require("../getPageFiles/assert_exports_old_design.js");
|
|
10
10
|
const getConfigDefinedAt_js_1 = require("./getConfigDefinedAt.js");
|
|
11
11
|
const helpers_js_1 = require("./helpers.js");
|
|
12
12
|
const utils_js_1 = require("../utils.js");
|
|
13
13
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
14
|
-
function
|
|
15
|
-
const pageConfigUserFriendly =
|
|
14
|
+
function getUserFriendlyConfigsPageEager(pageConfigGlobalValues, pageConfig, pageConfigValues) {
|
|
15
|
+
const pageConfigUserFriendly = getUserFriendlyConfigs_public({ pageConfigGlobalValues, pageConfigValues });
|
|
16
16
|
let page;
|
|
17
17
|
if (!pageConfig.isErrorPage) {
|
|
18
18
|
const route = pageConfigUserFriendly.config.route ?? pageConfig.routeFilesystem.routeString;
|
|
@@ -29,8 +29,8 @@ function getPageConfigUserFriendly(pageConfigGlobalValues, pageConfig, pageConfi
|
|
|
29
29
|
}
|
|
30
30
|
return [pageConfig.pageId, page];
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const pageConfigUserFriendly =
|
|
32
|
+
function getUserFriendlyConfigs_public({ pageConfigGlobalValues, pageConfigValues }) {
|
|
33
|
+
const pageConfigUserFriendly = getUserFriendlyConfigs_base({ pageConfigGlobalValues, pageConfigValues });
|
|
34
34
|
return getPublicCopy(pageConfigUserFriendly);
|
|
35
35
|
}
|
|
36
36
|
function getPublicCopy(pageConfigUserFriendly) {
|
|
@@ -42,15 +42,17 @@ function getPublicCopy(pageConfigUserFriendly) {
|
|
|
42
42
|
_from: p.from
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function getUserFriendlyConfigs_base({ pageConfigGlobalValues, pageConfigValues }) {
|
|
46
46
|
const configValues = { ...pageConfigGlobalValues, ...pageConfigValues };
|
|
47
|
-
return
|
|
47
|
+
return getUserFriendlyConfigs_V1Design({ configValues });
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const pageConfigGlobalUserFriendly =
|
|
49
|
+
function getUserFriendlyConfigsGlobal({ pageConfigGlobalValues }) {
|
|
50
|
+
const pageConfigGlobalUserFriendly = getUserFriendlyConfigs_V1Design({ configValues: pageConfigGlobalValues });
|
|
51
51
|
return getPublicCopy(pageConfigGlobalUserFriendly);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function getUserFriendlyConfigsPageLazy(pageFiles, // V0.4 design
|
|
54
|
+
pageConfig, // V1 design
|
|
55
|
+
pageConfigGlobal) {
|
|
54
56
|
const config = {};
|
|
55
57
|
const configEntries = {}; // TODO/v1-release: remove
|
|
56
58
|
const exportsAll = {}; // TODO/v1-release: remove
|
|
@@ -75,7 +77,7 @@ function getPageConfigUserFriendly_oldDesign(pageFiles, pageConfig, pageConfigGl
|
|
|
75
77
|
let sources;
|
|
76
78
|
let from;
|
|
77
79
|
if (pageConfig) {
|
|
78
|
-
const res =
|
|
80
|
+
const res = getUserFriendlyConfigs_base({
|
|
79
81
|
pageConfigGlobalValues: pageConfigGlobal.configValues,
|
|
80
82
|
pageConfigValues: pageConfig.configValues
|
|
81
83
|
});
|
|
@@ -124,7 +126,7 @@ function getPageConfigUserFriendly_oldDesign(pageFiles, pageConfig, pageConfigGl
|
|
|
124
126
|
return pageContextExports;
|
|
125
127
|
}
|
|
126
128
|
// V1 design
|
|
127
|
-
function
|
|
129
|
+
function getUserFriendlyConfigs_V1Design(pageConfig) {
|
|
128
130
|
const config = {};
|
|
129
131
|
const configEntries = {};
|
|
130
132
|
const exportsAll = {};
|
|
@@ -140,19 +142,30 @@ function getPageConfigUserFriendly_V1Design(pageConfig) {
|
|
|
140
142
|
sources[configName] ?? (sources[configName] = []);
|
|
141
143
|
sources[configName].push(src);
|
|
142
144
|
};
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const configDefinedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAtOptional)('Config', configName, configValue.definedAtData);
|
|
147
|
-
config[configName] = config[configName] ?? value;
|
|
145
|
+
const addLegacy = (configName, value, definedAtData) => {
|
|
146
|
+
const configValueFilePathToShowToUser = (0, helpers_js_1.getConfigValueFilePathToShowToUser)(definedAtData);
|
|
147
|
+
const configDefinedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAtOptional)('Config', configName, definedAtData);
|
|
148
148
|
configEntries[configName] = configEntries[configName] ?? [];
|
|
149
|
-
// Currently each configName has only one entry. Adding an entry for each overriden config value isn't implemented yet. (This is an isomorphic file and it isn't clear whether this can/should be implemented on the client-side. We should load a minimum amount of code on the client-side.)
|
|
150
|
-
(0, utils_js_1.assert)(configEntries[configName].length === 0);
|
|
151
149
|
configEntries[configName].push({
|
|
152
150
|
configValue: value,
|
|
153
151
|
configDefinedAt,
|
|
154
152
|
configDefinedByFile: configValueFilePathToShowToUser
|
|
155
153
|
});
|
|
154
|
+
// TODO/v1-release: remove
|
|
155
|
+
const exportName = configName;
|
|
156
|
+
exportsAll[exportName] = exportsAll[exportName] ?? [];
|
|
157
|
+
exportsAll[exportName].push({
|
|
158
|
+
exportValue: value,
|
|
159
|
+
exportSource: configDefinedAt,
|
|
160
|
+
filePath: configValueFilePathToShowToUser,
|
|
161
|
+
_filePath: configValueFilePathToShowToUser,
|
|
162
|
+
_fileType: null,
|
|
163
|
+
_isFromDefaultExport: null
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
Object.entries(pageConfig.configValues).forEach(([configName, configValue]) => {
|
|
167
|
+
const { value } = configValue;
|
|
168
|
+
config[configName] = config[configName] ?? value;
|
|
156
169
|
if (configValue.type === 'standard') {
|
|
157
170
|
const src = {
|
|
158
171
|
type: 'configsStandard',
|
|
@@ -161,6 +174,7 @@ function getPageConfigUserFriendly_V1Design(pageConfig) {
|
|
|
161
174
|
};
|
|
162
175
|
addSrc(src, configName);
|
|
163
176
|
from.configsStandard[configName] = src;
|
|
177
|
+
addLegacy(configName, value, configValue.definedAtData);
|
|
164
178
|
}
|
|
165
179
|
if (configValue.type === 'cumulative') {
|
|
166
180
|
const src = {
|
|
@@ -169,6 +183,7 @@ function getPageConfigUserFriendly_V1Design(pageConfig) {
|
|
|
169
183
|
const definedAtFile = configValue.definedAtData[i];
|
|
170
184
|
(0, utils_js_1.assert)(definedAtFile);
|
|
171
185
|
const definedAt = (0, getConfigDefinedAt_js_1.getDefinedAtString)(definedAtFile, configName);
|
|
186
|
+
addLegacy(configName, value, definedAtFile);
|
|
172
187
|
return {
|
|
173
188
|
value,
|
|
174
189
|
definedAt
|
|
@@ -185,18 +200,8 @@ function getPageConfigUserFriendly_V1Design(pageConfig) {
|
|
|
185
200
|
};
|
|
186
201
|
addSrc(src, configName);
|
|
187
202
|
from.configsComputed[configName] = src;
|
|
203
|
+
addLegacy(configName, value, configValue.definedAtData);
|
|
188
204
|
}
|
|
189
|
-
// TODO/v1-release: remove
|
|
190
|
-
const exportName = configName;
|
|
191
|
-
exportsAll[exportName] = exportsAll[exportName] ?? [];
|
|
192
|
-
exportsAll[exportName].push({
|
|
193
|
-
exportValue: value,
|
|
194
|
-
exportSource: configDefinedAt,
|
|
195
|
-
filePath: configValueFilePathToShowToUser,
|
|
196
|
-
_filePath: configValueFilePathToShowToUser,
|
|
197
|
-
_fileType: null,
|
|
198
|
-
_isFromDefaultExport: null
|
|
199
|
-
});
|
|
200
205
|
});
|
|
201
206
|
return {
|
|
202
207
|
config: config,
|
|
@@ -7,8 +7,17 @@ declare function createPageContextClientSide(urlOriginal: string): Promise<{
|
|
|
7
7
|
_pageConfigs: import("../../__internal/index.js").PageConfig[];
|
|
8
8
|
_pageConfigGlobal: import("../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
9
9
|
_allPageIds: string[];
|
|
10
|
+
_userFriendlyConfigsGlobal: import("../../shared/page-configs/getUserFriendlyConfigs.js").PageConfigUserFriendly;
|
|
10
11
|
config: import("../../types/index.js").ConfigResolved;
|
|
11
|
-
pages:
|
|
12
|
+
pages: {
|
|
13
|
+
[k: string]: import("../../shared/page-configs/getUserFriendlyConfigs.js").PageConfigUserFriendly & ({
|
|
14
|
+
route: import("../../shared/page-configs/Config.js").Route;
|
|
15
|
+
isErrorPage?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
route?: undefined;
|
|
18
|
+
isErrorPage: true;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
12
21
|
} & {
|
|
13
22
|
isClientSide: true;
|
|
14
23
|
} & {
|
|
@@ -32,9 +41,5 @@ declare function createPageContextClientSide(urlOriginal: string): Promise<{
|
|
|
32
41
|
urlPathname: string;
|
|
33
42
|
url: string;
|
|
34
43
|
} & {
|
|
35
|
-
config: import("../../types/index.js").ConfigResolved;
|
|
36
|
-
_source: import("../../shared/page-configs/getPageConfigUserFriendly.js").Source;
|
|
37
|
-
_sources: import("../../shared/page-configs/getPageConfigUserFriendly.js").Sources;
|
|
38
|
-
_from: import("../../shared/page-configs/getPageConfigUserFriendly.js").From;
|
|
39
44
|
isPageContext: true;
|
|
40
|
-
}>;
|
|
45
|
+
} & import("../../shared/page-configs/getUserFriendlyConfigs.js").PageConfigUserFriendly>;
|