vike 0.4.222-commit-207e079 → 0.4.222-commit-6647d1e
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.js +7 -14
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
- package/dist/cjs/shared/getPageConfigsRuntime.js +2 -8
- package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +44 -12
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -8
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/client/client-routing-runtime/getPageContextCurrent.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +4 -4
- 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 +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/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/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +8 -15
- package/dist/esm/node/runtime/globalContext.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +2 -2
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +4 -4
- package/dist/esm/shared/getPageConfigsRuntime.d.ts +2 -2
- package/dist/esm/shared/getPageConfigsRuntime.js +3 -9
- package/dist/esm/shared/getPageFiles.d.ts +1 -1
- package/dist/esm/shared/hooks/getHook.d.ts +3 -3
- 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/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
|
@@ -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,
|
|
@@ -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
|
|
@@ -9,15 +9,9 @@ function getPageConfigsRuntime(virtualFileExports) {
|
|
|
9
9
|
const { pageFilesAll, pageConfigs, pageConfigGlobal } = (0, parseGlobResults_js_1.parseGlobResults)(virtualFileExports);
|
|
10
10
|
const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
|
|
11
11
|
// TODO/now: re-use this call, instead of calling it twice
|
|
12
|
-
const globalConfig = (0, getPageConfigUserFriendly_js_1.
|
|
13
|
-
// TODO/now DEDUPE
|
|
12
|
+
const globalConfig = (0, getPageConfigUserFriendly_js_1.getPageConfigGlobalUserFriendly)({ pageConfigGlobalValues: pageConfigGlobal.configValues });
|
|
14
13
|
const pageConfigsUserFriendly = Object.fromEntries(pageConfigs.map((pageConfig) => {
|
|
15
|
-
|
|
16
|
-
const page = {
|
|
17
|
-
...(0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendlyNew)({ configValues }),
|
|
18
|
-
route: pageConfig.routeFilesystem?.routeString ?? null
|
|
19
|
-
};
|
|
20
|
-
return [pageConfig.pageId, page];
|
|
14
|
+
return (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendly)(pageConfigGlobal.configValues, pageConfig, pageConfig.configValues);
|
|
21
15
|
}));
|
|
22
16
|
return { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal, globalConfig, pageConfigsUserFriendly };
|
|
23
17
|
}
|
|
@@ -3,23 +3,54 @@ 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.
|
|
6
|
+
exports.getPageConfigUserFriendly = getPageConfigUserFriendly;
|
|
7
|
+
exports.getPageConfigUserFriendly_oldDesign = getPageConfigUserFriendly_oldDesign;
|
|
8
|
+
exports.getPageConfigGlobalUserFriendly = getPageConfigGlobalUserFriendly;
|
|
8
9
|
const assert_exports_old_design_js_1 = require("../getPageFiles/assert_exports_old_design.js");
|
|
9
10
|
const getConfigDefinedAt_js_1 = require("./getConfigDefinedAt.js");
|
|
10
11
|
const helpers_js_1 = require("./helpers.js");
|
|
11
12
|
const utils_js_1 = require("../utils.js");
|
|
12
13
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
13
|
-
function
|
|
14
|
-
const
|
|
14
|
+
function getPageConfigUserFriendly(pageConfigGlobalValues, pageConfig, pageConfigValues) {
|
|
15
|
+
const pageConfigUserFriendly = getPageConfigUserFriendly_public({ pageConfigGlobalValues, pageConfigValues });
|
|
16
|
+
let page;
|
|
17
|
+
if (!pageConfig.isErrorPage) {
|
|
18
|
+
const route = pageConfigUserFriendly.config.route ?? pageConfig.routeFilesystem.routeString;
|
|
19
|
+
page = {
|
|
20
|
+
...pageConfigUserFriendly,
|
|
21
|
+
route
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
page = {
|
|
26
|
+
...pageConfigUserFriendly,
|
|
27
|
+
isErrorPage: true
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return [pageConfig.pageId, page];
|
|
31
|
+
}
|
|
32
|
+
function getPageConfigUserFriendly_public({ pageConfigGlobalValues, pageConfigValues }) {
|
|
33
|
+
const pageConfigUserFriendly = getPageConfigUserFriendly_base({ pageConfigGlobalValues, pageConfigValues });
|
|
34
|
+
return getPublicCopy(pageConfigUserFriendly);
|
|
35
|
+
}
|
|
36
|
+
function getPublicCopy(pageConfigUserFriendly) {
|
|
37
|
+
const p = pageConfigUserFriendly;
|
|
15
38
|
return {
|
|
16
|
-
config:
|
|
17
|
-
_source:
|
|
18
|
-
_sources:
|
|
19
|
-
_from:
|
|
39
|
+
config: p.config,
|
|
40
|
+
_source: p.source,
|
|
41
|
+
_sources: p.sources,
|
|
42
|
+
_from: p.from
|
|
20
43
|
};
|
|
21
44
|
}
|
|
22
|
-
function
|
|
45
|
+
function getPageConfigUserFriendly_base({ pageConfigGlobalValues, pageConfigValues }) {
|
|
46
|
+
const configValues = { ...pageConfigGlobalValues, ...pageConfigValues };
|
|
47
|
+
return getPageConfigUserFriendly_V1Design({ configValues });
|
|
48
|
+
}
|
|
49
|
+
function getPageConfigGlobalUserFriendly({ pageConfigGlobalValues }) {
|
|
50
|
+
const pageConfigGlobalUserFriendly = getPageConfigUserFriendly_V1Design({ configValues: pageConfigGlobalValues });
|
|
51
|
+
return getPublicCopy(pageConfigGlobalUserFriendly);
|
|
52
|
+
}
|
|
53
|
+
function getPageConfigUserFriendly_oldDesign(pageFiles, pageConfig, pageConfigGlobal) {
|
|
23
54
|
const config = {};
|
|
24
55
|
const configEntries = {}; // TODO/v1-release: remove
|
|
25
56
|
const exportsAll = {}; // TODO/v1-release: remove
|
|
@@ -44,8 +75,9 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
|
|
|
44
75
|
let sources;
|
|
45
76
|
let from;
|
|
46
77
|
if (pageConfig) {
|
|
47
|
-
const res =
|
|
48
|
-
|
|
78
|
+
const res = getPageConfigUserFriendly_base({
|
|
79
|
+
pageConfigGlobalValues: pageConfigGlobal.configValues,
|
|
80
|
+
pageConfigValues: pageConfig.configValues
|
|
49
81
|
});
|
|
50
82
|
source = res.source;
|
|
51
83
|
sources = res.sources;
|
|
@@ -92,7 +124,7 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
|
|
|
92
124
|
return pageContextExports;
|
|
93
125
|
}
|
|
94
126
|
// V1 design
|
|
95
|
-
function
|
|
127
|
+
function getPageConfigUserFriendly_V1Design(pageConfig) {
|
|
96
128
|
const config = {};
|
|
97
129
|
const configEntries = {};
|
|
98
130
|
const exportsAll = {};
|
|
@@ -14,15 +14,9 @@ function parsePageConfigs(pageConfigsSerialized, pageConfigGlobalSerialized) {
|
|
|
14
14
|
// pageConfigs
|
|
15
15
|
const pageConfigs = pageConfigsSerialized.map((pageConfigSerialized) => {
|
|
16
16
|
const configValues = parseConfigValuesSerialized(pageConfigSerialized.configValuesSerialized);
|
|
17
|
-
const { pageId, isErrorPage, routeFilesystem, loadConfigValuesAll } = pageConfigSerialized;
|
|
18
17
|
assertRouteConfigValue(configValues);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
isErrorPage,
|
|
22
|
-
routeFilesystem,
|
|
23
|
-
configValues,
|
|
24
|
-
loadConfigValuesAll
|
|
25
|
-
};
|
|
18
|
+
const pageConfig = { ...pageConfigSerialized, configValues };
|
|
19
|
+
return pageConfig;
|
|
26
20
|
});
|
|
27
21
|
// pageConfigsGlobal
|
|
28
22
|
const pageConfigGlobal = { configValues: {} };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { setPageContextCurrent };
|
|
2
2
|
export { getPageContextCurrent };
|
|
3
|
-
import type {
|
|
4
|
-
type PageContextCurrent =
|
|
3
|
+
import type { PageConfigUserFriendlyOld } from '../../shared/getPageFiles.js';
|
|
4
|
+
type PageContextCurrent = PageConfigUserFriendlyOld & {
|
|
5
5
|
urlPathname: string;
|
|
6
6
|
};
|
|
7
7
|
declare function getPageContextCurrent(): null | PageContextCurrent;
|
|
@@ -5,7 +5,7 @@ export { getPageContextFromClientHooks };
|
|
|
5
5
|
export { setPageContextInitIsPassedToClient };
|
|
6
6
|
export type { PageContextFromServerHooks };
|
|
7
7
|
export type { PageContextFromClientHooks };
|
|
8
|
-
import type {
|
|
8
|
+
import type { PageConfigUserFriendlyOld, PageFile } from '../../shared/getPageFiles.js';
|
|
9
9
|
import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
10
10
|
type PageContext = {
|
|
11
11
|
urlOriginal: string;
|
|
@@ -21,9 +21,9 @@ declare function getPageContextFromHooks_serialized(): PageContextSerialized & {
|
|
|
21
21
|
routeParams: Record<string, string>;
|
|
22
22
|
_hasPageContextFromServer: true;
|
|
23
23
|
};
|
|
24
|
-
declare function getPageContextFromHooks_isHydration(pageContext: PageContextSerialized & PageContext &
|
|
24
|
+
declare function getPageContextFromHooks_isHydration(pageContext: PageContextSerialized & PageContext & PageConfigUserFriendlyOld & {
|
|
25
25
|
_hasPageContextFromServer: true;
|
|
26
|
-
}): Promise<PageContextSerialized & PageContext &
|
|
26
|
+
}): Promise<PageContextSerialized & PageContext & PageConfigUserFriendlyOld & {
|
|
27
27
|
_hasPageContextFromServer: true;
|
|
28
28
|
} & {
|
|
29
29
|
_hasPageContextFromClient: boolean;
|
|
@@ -45,5 +45,5 @@ type PageContextFromClientHooks = {
|
|
|
45
45
|
declare function getPageContextFromClientHooks(pageContext: {
|
|
46
46
|
pageId: string;
|
|
47
47
|
_hasPageContextFromServer: boolean;
|
|
48
|
-
} & PageContext &
|
|
48
|
+
} & PageContext & PageConfigUserFriendlyOld, isErrorPage: boolean): Promise<PageContextFromClientHooks>;
|
|
49
49
|
declare function setPageContextInitIsPassedToClient(pageContext: Record<string, unknown>): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { getPrefetchSettings };
|
|
2
2
|
export { PAGE_CONTEXT_MAX_AGE_DEFAULT };
|
|
3
3
|
export type { PrefetchSettingResolved };
|
|
4
|
-
import type {
|
|
4
|
+
import type { PageConfigUserFriendlyOld } from '../../../shared/getPageFiles.js';
|
|
5
5
|
declare const PAGE_CONTEXT_MAX_AGE_DEFAULT = 5000;
|
|
6
6
|
type PrefetchSettingResolved = {
|
|
7
7
|
staticAssets: false | 'hover' | 'viewport';
|
|
8
8
|
pageContext: false | number;
|
|
9
9
|
};
|
|
10
|
-
declare function getPrefetchSettings(pageContext:
|
|
10
|
+
declare function getPrefetchSettings(pageContext: PageConfigUserFriendlyOld, linkTag: null | HTMLElement): PrefetchSettingResolved;
|
|
@@ -6,7 +6,7 @@ export { addLinkPrefetchHandlers };
|
|
|
6
6
|
export { addLinkPrefetchHandlers_watch };
|
|
7
7
|
export { addLinkPrefetchHandlers_unwatch };
|
|
8
8
|
import { type PageContextFromServerHooks, getPageContextFromServerHooks } from './getPageContextFromHooks.js';
|
|
9
|
-
import type {
|
|
9
|
+
import type { PageConfigUserFriendlyOld, PageFile } from '../../shared/getPageFiles.js';
|
|
10
10
|
import { type PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
11
11
|
type ResultPageContextFromServer = Awaited<ReturnType<typeof getPageContextFromServerHooks>>;
|
|
12
12
|
type PageContextForPrefetch = {
|
|
@@ -19,7 +19,7 @@ type PageContextForPrefetch = {
|
|
|
19
19
|
};
|
|
20
20
|
declare function getPageContextPrefetched(pageContext: {
|
|
21
21
|
urlPathname: string;
|
|
22
|
-
} &
|
|
22
|
+
} & PageConfigUserFriendlyOld): null | PageContextFromServerHooks;
|
|
23
23
|
declare function populatePageContextPrefetchCache(pageContext: PageContextForPrefetch, result: ResultPageContextFromServer): void;
|
|
24
24
|
/**
|
|
25
25
|
* Programmatically prefetch client assets.
|
|
@@ -60,8 +60,8 @@ async function prefetchPageContextFromServerHooks(pageContextLink, resultMaxAge)
|
|
|
60
60
|
const result = await getPageContextFromServerHooks(pageContextLink, false);
|
|
61
61
|
setPageContextPrefetchCache(pageContextLink, result, resultMaxAge);
|
|
62
62
|
}
|
|
63
|
-
function populatePageContextPrefetchCache(pageContext /*&
|
|
64
|
-
// TODO/pageContext-prefetch: replace with using pageContext.config.prerender instead. (For being able to do that: eager configs need to be accessible without have to use
|
|
63
|
+
function populatePageContextPrefetchCache(pageContext /*& PageConfigUserFriendlyOld*/, result) {
|
|
64
|
+
// TODO/pageContext-prefetch: replace with using pageContext.config.prerender instead. (For being able to do that: eager configs need to be accessible without have to use PageConfigUserFriendlyOld as it isn't available here.)
|
|
65
65
|
if (!isBrilloutDocpress())
|
|
66
66
|
return;
|
|
67
67
|
setPageContextPrefetchCache(pageContext, result, null);
|
|
@@ -11,6 +11,6 @@ declare function getPageContext(): Promise<{
|
|
|
11
11
|
_pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
|
|
12
12
|
_pageConfigs: import("../../__internal/index.js").PageConfig[];
|
|
13
13
|
_pageConfigGlobal: import("../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
14
|
-
} & import("../../shared/getPageFiles.js").
|
|
14
|
+
} & import("../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
15
15
|
_pageFilesLoaded: import("../../shared/getPageFiles.js").PageFile[];
|
|
16
16
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { executeOnRenderClientHook };
|
|
2
2
|
export type { PageContextBeforeRenderClient };
|
|
3
|
-
import type { PageFile,
|
|
3
|
+
import type { PageFile, PageConfigUserFriendlyOld } from '../../shared/getPageFiles.js';
|
|
4
4
|
import { type PageContextForUserConsumptionClientSide } from './preparePageContextForUserConsumptionClientSide.js';
|
|
5
5
|
import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
6
6
|
type PageContextBeforeRenderClient = {
|
|
@@ -9,5 +9,5 @@ type PageContextBeforeRenderClient = {
|
|
|
9
9
|
urlPathname?: string;
|
|
10
10
|
pageId: string;
|
|
11
11
|
_pageConfigs: PageConfigRuntime[];
|
|
12
|
-
} &
|
|
12
|
+
} & PageConfigUserFriendlyOld & PageContextForUserConsumptionClientSide;
|
|
13
13
|
declare function executeOnRenderClientHook<PC extends PageContextBeforeRenderClient>(pageContext: PC, isClientRouting: boolean): Promise<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { loadUserFilesClientSide };
|
|
2
2
|
export { isErrorFetchingStaticAssets };
|
|
3
3
|
export type { PageContextUserFiles };
|
|
4
|
-
import { type PageFile, type
|
|
4
|
+
import { type PageFile, type PageConfigUserFriendlyOld } from '../../shared/getPageFiles.js';
|
|
5
5
|
import type { PageConfigGlobalRuntime, PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
6
|
-
type PageContextUserFilesLoaded =
|
|
6
|
+
type PageContextUserFilesLoaded = PageConfigUserFriendlyOld & {
|
|
7
7
|
_pageFilesLoaded: PageFile[];
|
|
8
8
|
};
|
|
9
9
|
type PageContextUserFiles = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { loadUserFilesClientSide };
|
|
2
2
|
export { isErrorFetchingStaticAssets };
|
|
3
3
|
import { getPageFilesClientSide } from '../../shared/getPageFiles.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getPageConfigUserFriendly_oldDesign } from '../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
5
5
|
import { findPageConfig } from '../../shared/page-configs/findPageConfig.js';
|
|
6
6
|
import { loadConfigValues } from '../../shared/page-configs/loadConfigValues.js';
|
|
7
7
|
import { objectAssign } from '../server-routing-runtime/utils.js';
|
|
@@ -30,7 +30,7 @@ async function loadUserFilesClientSide(pageId, pageFilesAll, pageConfigs, pageCo
|
|
|
30
30
|
}
|
|
31
31
|
throw err;
|
|
32
32
|
}
|
|
33
|
-
const pageContextExports =
|
|
33
|
+
const pageContextExports = getPageConfigUserFriendly_oldDesign(pageFilesClientSide, pageConfigLoaded, pageConfigGlobal);
|
|
34
34
|
const pageContextAddendum = {};
|
|
35
35
|
objectAssign(pageContextAddendum, pageContextExports);
|
|
36
36
|
objectAssign(pageContextAddendum, { _pageFilesLoaded: pageFilesClientSide });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { preparePageContextForUserConsumptionClientSide };
|
|
2
2
|
export type { PageContextForUserConsumptionClientSide };
|
|
3
|
-
import type {
|
|
3
|
+
import type { PageConfigUserFriendlyOld } from '../../shared/getPageFiles.js';
|
|
4
4
|
import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
5
5
|
import { PageContextForPassToClientWarning } from './getPageContextProxyForUser.js';
|
|
6
|
-
type PageContextForUserConsumptionClientSide =
|
|
6
|
+
type PageContextForUserConsumptionClientSide = PageConfigUserFriendlyOld & PageContextForPassToClientWarning & {
|
|
7
7
|
pageId: string;
|
|
8
8
|
_pageConfigs: PageConfigRuntime[];
|
|
9
9
|
};
|
|
@@ -9,12 +9,12 @@ export type { VikeConfigObject };
|
|
|
9
9
|
import type { PageConfigGlobalBuildTime, PageConfigBuildTime } from '../../../../../shared/page-configs/PageConfig.js';
|
|
10
10
|
import { type ConfigDefinitions, type ConfigDefinitionInternal } from './getVikeConfig/configDefinitionsBuiltIn.js';
|
|
11
11
|
import type { ResolvedConfig } from 'vite';
|
|
12
|
-
import { type
|
|
12
|
+
import { type PageConfigUserFriendly, type PageConfigsUserFriendly } from '../../../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
13
13
|
import { type PlusFile } from './getVikeConfig/getPlusFilesAll.js';
|
|
14
14
|
type VikeConfigObject = {
|
|
15
15
|
pageConfigs: PageConfigBuildTime[];
|
|
16
16
|
pageConfigGlobal: PageConfigGlobalBuildTime;
|
|
17
|
-
global:
|
|
17
|
+
global: PageConfigUserFriendly;
|
|
18
18
|
pages: PageConfigsUserFriendly;
|
|
19
19
|
};
|
|
20
20
|
declare const vikeConfigDependencies: Set<string>;
|
|
@@ -19,7 +19,7 @@ import { resolvePointerImport } from './getVikeConfig/resolvePointerImport.js';
|
|
|
19
19
|
import { getFilePathResolved } from '../../../shared/getFilePath.js';
|
|
20
20
|
import { getConfigValueBuildTime } from '../../../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
21
21
|
import { assertExtensionsRequire } from './getVikeConfig/assertExtensions.js';
|
|
22
|
-
import {
|
|
22
|
+
import { getPageConfigGlobalUserFriendly, getPageConfigUserFriendly } from '../../../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
23
23
|
import { getConfigValuesBase } from '../../../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
24
24
|
import { getPlusFilesAll } from './getVikeConfig/getPlusFilesAll.js';
|
|
25
25
|
assertIsNotProductionRuntime();
|
|
@@ -127,7 +127,7 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
|
|
|
127
127
|
configDefinitions: {},
|
|
128
128
|
configValueSources: {}
|
|
129
129
|
},
|
|
130
|
-
global:
|
|
130
|
+
global: getPageConfigGlobalUserFriendly({ pageConfigGlobalValues: {} }),
|
|
131
131
|
pages: {}
|
|
132
132
|
};
|
|
133
133
|
return dummyData;
|
|
@@ -143,18 +143,12 @@ async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
|
|
|
143
143
|
// interop vike(options) in vite.config.js
|
|
144
144
|
temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
|
|
145
145
|
// global
|
|
146
|
-
const
|
|
147
|
-
const global =
|
|
148
|
-
// TODO/now DEDUPE
|
|
146
|
+
const pageConfigGlobalValues = getConfigValues(pageConfigGlobal);
|
|
147
|
+
const global = getPageConfigGlobalUserFriendly({ pageConfigGlobalValues });
|
|
149
148
|
// pages
|
|
150
149
|
const pages = objectFromEntries(pageConfigs.map((pageConfig) => {
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
const page = {
|
|
154
|
-
...getPageConfigUserFriendlyNew({ configValues }),
|
|
155
|
-
route: pageConfig.routeFilesystem?.routeString ?? null
|
|
156
|
-
};
|
|
157
|
-
return [pageConfig.pageId, page];
|
|
150
|
+
const pageConfigValues = getConfigValues(pageConfig, true);
|
|
151
|
+
return getPageConfigUserFriendly(pageConfigGlobalValues, pageConfig, pageConfigValues);
|
|
158
152
|
}));
|
|
159
153
|
return { pageConfigs, pageConfigGlobal, global, pages };
|
|
160
154
|
}
|
|
@@ -219,13 +213,12 @@ function getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRo
|
|
|
219
213
|
return;
|
|
220
214
|
configValueSources[configName] = sources;
|
|
221
215
|
});
|
|
222
|
-
const
|
|
216
|
+
const pageConfigRoute = determineRouteFilesystem(locationId, configValueSources);
|
|
223
217
|
applyEffectsAll(configValueSources, configDefinitionsLocal);
|
|
224
218
|
const configValuesComputed = getComputed(configValueSources, configDefinitionsLocal);
|
|
225
219
|
const pageConfig = {
|
|
226
220
|
pageId: locationId,
|
|
227
|
-
|
|
228
|
-
routeFilesystem,
|
|
221
|
+
...pageConfigRoute,
|
|
229
222
|
configDefinitions: configDefinitionsLocal,
|
|
230
223
|
plusFiles: plusFilesRelevant,
|
|
231
224
|
configValueSources,
|
|
@@ -20,7 +20,7 @@ export type { GlobalContextInternal };
|
|
|
20
20
|
export type { GlobalContextPublic };
|
|
21
21
|
import type { ViteManifest } from '../shared/ViteManifest.js';
|
|
22
22
|
import type { ResolvedConfig, ViteDevServer } from 'vite';
|
|
23
|
-
import type {
|
|
23
|
+
import type { PageConfigUserFriendly, PageConfigsUserFriendly } from '../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
24
24
|
import type { ConfigVitePluginServerEntry } from '@brillout/vite-plugin-server-entry/plugin';
|
|
25
25
|
import { type BaseUrlsResolved } from '../shared/resolveBase.js';
|
|
26
26
|
type GlobalContextPublic = Pick<GlobalContext, 'assetsManifest' | 'config' | 'viteConfig' | 'pages' | 'baseAssets' | 'baseServer'>;
|
|
@@ -32,7 +32,7 @@ type GlobalContext = {
|
|
|
32
32
|
viteConfigRuntime: {
|
|
33
33
|
_baseViteOriginal: null | string;
|
|
34
34
|
};
|
|
35
|
-
config:
|
|
35
|
+
config: PageConfigUserFriendly['config'];
|
|
36
36
|
pages: PageConfigsUserFriendly;
|
|
37
37
|
} & BaseUrlsResolved & PageRuntimeInfo & ({
|
|
38
38
|
isProduction: false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { executeOnBeforeRenderAndDataHooks };
|
|
2
|
-
import { type
|
|
2
|
+
import { type PageConfigUserFriendlyOld } from '../../../shared/getPageFiles.js';
|
|
3
3
|
import { type PageContextForUserConsumptionServerSide } from './preparePageContextForUserConsumptionServerSide.js';
|
|
4
4
|
declare function executeOnBeforeRenderAndDataHooks(pageContext: {
|
|
5
5
|
pageId: string;
|
|
6
6
|
_pageContextAlreadyProvidedByOnPrerenderHook?: true;
|
|
7
|
-
} &
|
|
7
|
+
} & PageConfigUserFriendlyOld & PageContextForUserConsumptionServerSide): Promise<void>;
|
|
@@ -16,7 +16,7 @@ type PageContext_loadUserFilesServerSide = PageContextGetPageAssets & PageContex
|
|
|
16
16
|
type PageFiles = PromiseType<ReturnType<typeof loadUserFilesServerSide>>;
|
|
17
17
|
declare function loadUserFilesServerSide(pageContext: {
|
|
18
18
|
pageId: string;
|
|
19
|
-
} & PageContext_loadUserFilesServerSide): Promise<import("../../../shared/getPageFiles.js").
|
|
19
|
+
} & PageContext_loadUserFilesServerSide): Promise<import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
20
20
|
Page: unknown;
|
|
21
21
|
_isHtmlOnly: boolean;
|
|
22
22
|
_passToClient: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { loadUserFilesServerSide };
|
|
2
2
|
import { getPageFilesServerSide } from '../../../shared/getPageFiles.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getPageConfigUserFriendly_oldDesign } from '../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
4
4
|
import { analyzePageClientSideInit } from '../../../shared/getPageFiles/analyzePageClientSide.js';
|
|
5
5
|
import { assert, assertUsage, assertWarning, hasProp, isArrayOfStrings, objectAssign, isArray } from '../utils.js';
|
|
6
6
|
import { getPageAssets } from './getPageAssets.js';
|
|
@@ -100,7 +100,7 @@ async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pag
|
|
|
100
100
|
const pageFilesServerSide = getPageFilesServerSide(pageFilesAll, pageId);
|
|
101
101
|
const pageConfigLoaded = !pageConfig ? null : await loadConfigValues(pageConfig, isDev);
|
|
102
102
|
await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
|
|
103
|
-
const pageContextExports =
|
|
103
|
+
const pageContextExports = getPageConfigUserFriendly_oldDesign(pageFilesServerSide, pageConfigLoaded, pageConfigGlobal);
|
|
104
104
|
return {
|
|
105
105
|
pageContextExports,
|
|
106
106
|
pageFilesLoaded: pageFilesServerSide
|
package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ export { preparePageContextForUserConsumptionServerSide };
|
|
|
2
2
|
export type { PageContextForUserConsumptionServerSide };
|
|
3
3
|
import { PageContextUrlInternal } from '../../../shared/getPageContextUrlComputed.js';
|
|
4
4
|
import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PageConfigUserFriendlyOld } from '../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
6
6
|
import { PageContextBuiltInServerInternal } from '../../../shared/types.js';
|
|
7
7
|
import type { GlobalContextInternal, GlobalContextPublic } from '../globalContext.js';
|
|
8
|
-
type PageContextForUserConsumptionServerSide = PageContextBuiltInServerInternal &
|
|
8
|
+
type PageContextForUserConsumptionServerSide = PageContextBuiltInServerInternal & PageConfigUserFriendlyOld & {
|
|
9
9
|
urlOriginal: string;
|
|
10
10
|
/** @deprecated */
|
|
11
11
|
url: string;
|
|
@@ -63,7 +63,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
63
63
|
url: string;
|
|
64
64
|
} & {
|
|
65
65
|
headers: Record<string, string> | null;
|
|
66
|
-
} & import("../../../shared/getPageFiles.js").
|
|
66
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
67
67
|
Page: unknown;
|
|
68
68
|
_isHtmlOnly: boolean;
|
|
69
69
|
_passToClient: string[];
|
|
@@ -117,7 +117,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
117
117
|
url: string;
|
|
118
118
|
} & {
|
|
119
119
|
headers: Record<string, string> | null;
|
|
120
|
-
} & import("../../../shared/getPageFiles.js").
|
|
120
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
121
121
|
Page: unknown;
|
|
122
122
|
_isHtmlOnly: boolean;
|
|
123
123
|
_passToClient: string[];
|
|
@@ -172,7 +172,7 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
172
172
|
url: string;
|
|
173
173
|
} & {
|
|
174
174
|
headers: Record<string, string> | null;
|
|
175
|
-
} & import("../../../shared/getPageFiles.js").
|
|
175
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
176
176
|
Page: unknown;
|
|
177
177
|
_isHtmlOnly: boolean;
|
|
178
178
|
_passToClient: string[];
|
|
@@ -226,7 +226,7 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
226
226
|
url: string;
|
|
227
227
|
} & {
|
|
228
228
|
headers: Record<string, string> | null;
|
|
229
|
-
} & import("../../../shared/getPageFiles.js").
|
|
229
|
+
} & import("../../../shared/getPageFiles.js").PageConfigUserFriendlyOld & {
|
|
230
230
|
Page: unknown;
|
|
231
231
|
_isHtmlOnly: boolean;
|
|
232
232
|
_passToClient: string[];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export { getPageConfigsRuntime };
|
|
2
2
|
export { getAllPageIds };
|
|
3
3
|
import type { PageFile } from './getPageFiles.js';
|
|
4
|
-
import { type
|
|
4
|
+
import { type PageConfigUserFriendly, type PageConfigsUserFriendly } from './page-configs/getPageConfigUserFriendly.js';
|
|
5
5
|
import type { PageConfigGlobalRuntime, PageConfigRuntime } from './page-configs/PageConfig.js';
|
|
6
6
|
declare function getPageConfigsRuntime(virtualFileExports: unknown): {
|
|
7
7
|
pageFilesAll: PageFile[];
|
|
8
8
|
allPageIds: string[];
|
|
9
9
|
pageConfigs: PageConfigRuntime[];
|
|
10
10
|
pageConfigGlobal: PageConfigGlobalRuntime;
|
|
11
|
-
globalConfig:
|
|
11
|
+
globalConfig: PageConfigUserFriendly;
|
|
12
12
|
pageConfigsUserFriendly: PageConfigsUserFriendly;
|
|
13
13
|
};
|
|
14
14
|
declare function getAllPageIds(pageFilesAll: PageFile[], pageConfigs: PageConfigRuntime[]): string[];
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
export { getPageConfigsRuntime };
|
|
2
2
|
export { getAllPageIds };
|
|
3
3
|
import { parseGlobResults } from './getPageFiles/parseGlobResults.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getPageConfigGlobalUserFriendly, getPageConfigUserFriendly } from './page-configs/getPageConfigUserFriendly.js';
|
|
5
5
|
import { unique } from './utils.js';
|
|
6
6
|
function getPageConfigsRuntime(virtualFileExports) {
|
|
7
7
|
const { pageFilesAll, pageConfigs, pageConfigGlobal } = parseGlobResults(virtualFileExports);
|
|
8
8
|
const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
|
|
9
9
|
// TODO/now: re-use this call, instead of calling it twice
|
|
10
|
-
const globalConfig =
|
|
11
|
-
// TODO/now DEDUPE
|
|
10
|
+
const globalConfig = getPageConfigGlobalUserFriendly({ pageConfigGlobalValues: pageConfigGlobal.configValues });
|
|
12
11
|
const pageConfigsUserFriendly = Object.fromEntries(pageConfigs.map((pageConfig) => {
|
|
13
|
-
|
|
14
|
-
const page = {
|
|
15
|
-
...getPageConfigUserFriendlyNew({ configValues }),
|
|
16
|
-
route: pageConfig.routeFilesystem?.routeString ?? null
|
|
17
|
-
};
|
|
18
|
-
return [pageConfig.pageId, page];
|
|
12
|
+
return getPageConfigUserFriendly(pageConfigGlobal.configValues, pageConfig, pageConfig.configValues);
|
|
19
13
|
}));
|
|
20
14
|
return { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal, globalConfig, pageConfigsUserFriendly };
|
|
21
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { PageFile } from './getPageFiles/getPageFileObject.js';
|
|
2
|
-
export type { ExportsAll,
|
|
2
|
+
export type { ExportsAll, PageConfigUserFriendlyOld } from './page-configs/getPageConfigUserFriendly.js';
|
|
3
3
|
export { getPageFilesClientSide } from './getPageFiles/getAllPageIdFiles.js';
|
|
4
4
|
export { getPageFilesServerSide } from './getPageFiles/getAllPageIdFiles.js';
|
|
@@ -9,7 +9,7 @@ export type { HookLoc };
|
|
|
9
9
|
export type { HookTimeout };
|
|
10
10
|
export type { HooksTimeoutProvidedByUser };
|
|
11
11
|
export { getHookTimeoutDefault };
|
|
12
|
-
import type {
|
|
12
|
+
import type { PageConfigUserFriendlyOld } from '../getPageFiles.js';
|
|
13
13
|
import type { HookName, HookNamePage, HookNameGlobal } from '../page-configs/Config.js';
|
|
14
14
|
import type { PageConfigGlobalRuntime, PageConfigRuntime } from '../page-configs/PageConfig.js';
|
|
15
15
|
type Hook = HookLoc & {
|
|
@@ -26,10 +26,10 @@ type HookTimeout = {
|
|
|
26
26
|
warning: number | false;
|
|
27
27
|
};
|
|
28
28
|
type HooksTimeoutProvidedByUser = false | Partial<Record<HookName, false | Partial<HookTimeout>>>;
|
|
29
|
-
declare function getHook(pageContext:
|
|
29
|
+
declare function getHook(pageContext: PageConfigUserFriendlyOld, hookName: HookName): null | Hook;
|
|
30
30
|
declare function getHookFromPageConfig(pageConfig: PageConfigRuntime, hookName: HookNamePage): null | Hook;
|
|
31
31
|
declare function getHookFromPageConfigGlobal(pageConfigGlobal: PageConfigGlobalRuntime, hookName: HookNameGlobal): null | Hook;
|
|
32
|
-
declare function assertHook<TPageContext extends
|
|
32
|
+
declare function assertHook<TPageContext extends PageConfigUserFriendlyOld, THookName extends PropertyKey & HookName>(pageContext: TPageContext, hookName: THookName): asserts pageContext is TPageContext & {
|
|
33
33
|
exports: Record<THookName, Function | undefined>;
|
|
34
34
|
};
|
|
35
35
|
declare function getHookTimeoutDefault(hookName: HookName): HookTimeout;
|
|
@@ -32,6 +32,7 @@ export type { OnRenderHtmlAsync };
|
|
|
32
32
|
export type { OnRenderHtmlSync };
|
|
33
33
|
export type { RouteAsync };
|
|
34
34
|
export type { RouteSync };
|
|
35
|
+
export type { Route };
|
|
35
36
|
export type { KeepScrollPosition };
|
|
36
37
|
import type { PrefetchSetting, PrefetchStaticAssets } from '../../client/client-routing-runtime/prefetch/PrefetchSetting.js';
|
|
37
38
|
import type { ConfigDefinition } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js';
|
|
@@ -223,6 +224,7 @@ type RouteSync = (pageContext: PageContextServer | PageContextClient) => {
|
|
|
223
224
|
routeParams?: Record<string, string>;
|
|
224
225
|
precedence?: number;
|
|
225
226
|
} | boolean;
|
|
227
|
+
type Route = string | RouteSync | RouteAsync;
|
|
226
228
|
/** Whether the page scrolls to the top upon navigation.
|
|
227
229
|
*
|
|
228
230
|
* https://vike.dev/keepScrollPosition
|
|
@@ -239,7 +241,7 @@ type ConfigBuiltIn = {
|
|
|
239
241
|
*
|
|
240
242
|
* https://vike.dev/route
|
|
241
243
|
*/
|
|
242
|
-
route?:
|
|
244
|
+
route?: Route | ImportString;
|
|
243
245
|
/** Protect page(s), e.g. forbid unauthorized access.
|
|
244
246
|
*
|
|
245
247
|
* https://vike.dev/guard
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type { PageConfigRuntime };
|
|
2
2
|
export type { PageConfigRuntimeLoaded };
|
|
3
3
|
export type { PageConfigBuildTime };
|
|
4
|
+
export type { PageConfigCommon };
|
|
5
|
+
export type { PageConfigRoute };
|
|
4
6
|
export type { ConfigEnv };
|
|
5
7
|
export type { ConfigEnvInternal };
|
|
6
8
|
export type { PageConfigGlobalRuntime };
|
|
@@ -23,8 +25,13 @@ import type { ConfigDefinitions } from '../../node/plugin/plugins/importUserCode
|
|
|
23
25
|
import type { PlusFile, PlusFilesByLocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js';
|
|
24
26
|
type PageConfigCommon = {
|
|
25
27
|
pageId: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
} & PageConfigRoute;
|
|
29
|
+
type PageConfigRoute = {
|
|
30
|
+
isErrorPage: true;
|
|
31
|
+
routeFilesystem?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
isErrorPage?: undefined;
|
|
34
|
+
routeFilesystem: {
|
|
28
35
|
routeString: string;
|
|
29
36
|
definedBy: string;
|
|
30
37
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
export type { PageConfigUserFriendly };
|
|
1
|
+
export { getPageConfigUserFriendly };
|
|
2
|
+
export { getPageConfigUserFriendly_oldDesign };
|
|
3
|
+
export { getPageConfigGlobalUserFriendly };
|
|
5
4
|
export type { PageConfigsUserFriendly };
|
|
5
|
+
export type { PageConfigUserFriendly };
|
|
6
|
+
export type { PageConfigUserFriendlyOld };
|
|
6
7
|
export type { Source };
|
|
7
8
|
export type { Sources };
|
|
8
9
|
export type { From };
|
|
@@ -10,9 +11,10 @@ export type { ExportsAll };
|
|
|
10
11
|
export type { ConfigEntries };
|
|
11
12
|
import type { FileType } from '../getPageFiles/fileTypes.js';
|
|
12
13
|
import type { PageFile } from '../getPageFiles/getPageFileObject.js';
|
|
13
|
-
import type { ConfigValues, PageConfigGlobalRuntime, PageConfigRuntimeLoaded } from './PageConfig.js';
|
|
14
|
+
import type { ConfigValues, PageConfigBuildTime, PageConfigGlobalRuntime, PageConfigRuntime, PageConfigRuntimeLoaded } from './PageConfig.js';
|
|
14
15
|
import { type ConfigDefinedAtOptional } from './getConfigDefinedAt.js';
|
|
15
16
|
import type { ConfigResolved } from './Config/PageContextConfig.js';
|
|
17
|
+
import type { Route } from './Config.js';
|
|
16
18
|
type ExportsAll = Record<string, {
|
|
17
19
|
exportValue: unknown;
|
|
18
20
|
exportSource: string;
|
|
@@ -33,7 +35,7 @@ type ConfigEntries = Record<string, {
|
|
|
33
35
|
configDefinedAt: ConfigDefinedAtOptional;
|
|
34
36
|
configDefinedByFile: string | null;
|
|
35
37
|
}[]>;
|
|
36
|
-
type
|
|
38
|
+
type PageConfigUserFriendlyOld = {
|
|
37
39
|
config: ConfigResolved;
|
|
38
40
|
source: Source;
|
|
39
41
|
sources: Sources;
|
|
@@ -74,18 +76,24 @@ type SourceConfigsComputed = {
|
|
|
74
76
|
type: 'configsComputed';
|
|
75
77
|
value: unknown;
|
|
76
78
|
};
|
|
77
|
-
type
|
|
78
|
-
// pageId
|
|
79
|
-
ConfigUserFriendly & {
|
|
80
|
-
route: string | null;
|
|
81
|
-
}>;
|
|
82
|
-
type ConfigUserFriendly = {
|
|
79
|
+
type PageConfigUserFriendly = {
|
|
83
80
|
config: ConfigResolved;
|
|
84
81
|
_source: Source;
|
|
85
82
|
_sources: Sources;
|
|
86
83
|
_from: From;
|
|
87
84
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
type PageConfigsUserFriendly = Record<string, // pageId
|
|
86
|
+
PageConfigUserFriendlyWithRoute>;
|
|
87
|
+
type WithRoute = {
|
|
88
|
+
route: Route;
|
|
89
|
+
isErrorPage?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
route?: undefined;
|
|
92
|
+
isErrorPage: true;
|
|
93
|
+
};
|
|
94
|
+
type PageConfigUserFriendlyWithRoute = PageConfigUserFriendly & WithRoute;
|
|
95
|
+
declare function getPageConfigUserFriendly(pageConfigGlobalValues: ConfigValues, pageConfig: PageConfigRuntime | PageConfigBuildTime, pageConfigValues: ConfigValues): [string, PageConfigUserFriendlyWithRoute];
|
|
96
|
+
declare function getPageConfigGlobalUserFriendly({ pageConfigGlobalValues }: {
|
|
97
|
+
pageConfigGlobalValues: ConfigValues;
|
|
98
|
+
}): PageConfigUserFriendly;
|
|
99
|
+
declare function getPageConfigUserFriendly_oldDesign(pageFiles: PageFile[], pageConfig: PageConfigRuntimeLoaded | null, pageConfigGlobal: PageConfigGlobalRuntime): PageConfigUserFriendlyOld;
|
|
@@ -1,20 +1,51 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { getPageConfigUserFriendly };
|
|
2
|
+
export { getPageConfigUserFriendly_oldDesign };
|
|
3
|
+
export { getPageConfigGlobalUserFriendly };
|
|
3
4
|
import { assertDefaultExports, forbiddenDefaultExports } from '../getPageFiles/assert_exports_old_design.js';
|
|
4
5
|
import { getConfigDefinedAtOptional, getDefinedAtString } from './getConfigDefinedAt.js';
|
|
5
6
|
import { getConfigValueFilePathToShowToUser } from './helpers.js';
|
|
6
7
|
import { assert, isObject, assertWarning, assertUsage, makeLast, isBrowser, isScriptFile, isTemplateFile } from '../utils.js';
|
|
7
8
|
import pc from '@brillout/picocolors';
|
|
8
|
-
function
|
|
9
|
-
const
|
|
9
|
+
function getPageConfigUserFriendly(pageConfigGlobalValues, pageConfig, pageConfigValues) {
|
|
10
|
+
const pageConfigUserFriendly = getPageConfigUserFriendly_public({ pageConfigGlobalValues, pageConfigValues });
|
|
11
|
+
let page;
|
|
12
|
+
if (!pageConfig.isErrorPage) {
|
|
13
|
+
const route = pageConfigUserFriendly.config.route ?? pageConfig.routeFilesystem.routeString;
|
|
14
|
+
page = {
|
|
15
|
+
...pageConfigUserFriendly,
|
|
16
|
+
route
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
page = {
|
|
21
|
+
...pageConfigUserFriendly,
|
|
22
|
+
isErrorPage: true
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return [pageConfig.pageId, page];
|
|
26
|
+
}
|
|
27
|
+
function getPageConfigUserFriendly_public({ pageConfigGlobalValues, pageConfigValues }) {
|
|
28
|
+
const pageConfigUserFriendly = getPageConfigUserFriendly_base({ pageConfigGlobalValues, pageConfigValues });
|
|
29
|
+
return getPublicCopy(pageConfigUserFriendly);
|
|
30
|
+
}
|
|
31
|
+
function getPublicCopy(pageConfigUserFriendly) {
|
|
32
|
+
const p = pageConfigUserFriendly;
|
|
10
33
|
return {
|
|
11
|
-
config:
|
|
12
|
-
_source:
|
|
13
|
-
_sources:
|
|
14
|
-
_from:
|
|
34
|
+
config: p.config,
|
|
35
|
+
_source: p.source,
|
|
36
|
+
_sources: p.sources,
|
|
37
|
+
_from: p.from
|
|
15
38
|
};
|
|
16
39
|
}
|
|
17
|
-
function
|
|
40
|
+
function getPageConfigUserFriendly_base({ pageConfigGlobalValues, pageConfigValues }) {
|
|
41
|
+
const configValues = { ...pageConfigGlobalValues, ...pageConfigValues };
|
|
42
|
+
return getPageConfigUserFriendly_V1Design({ configValues });
|
|
43
|
+
}
|
|
44
|
+
function getPageConfigGlobalUserFriendly({ pageConfigGlobalValues }) {
|
|
45
|
+
const pageConfigGlobalUserFriendly = getPageConfigUserFriendly_V1Design({ configValues: pageConfigGlobalValues });
|
|
46
|
+
return getPublicCopy(pageConfigGlobalUserFriendly);
|
|
47
|
+
}
|
|
48
|
+
function getPageConfigUserFriendly_oldDesign(pageFiles, pageConfig, pageConfigGlobal) {
|
|
18
49
|
const config = {};
|
|
19
50
|
const configEntries = {}; // TODO/v1-release: remove
|
|
20
51
|
const exportsAll = {}; // TODO/v1-release: remove
|
|
@@ -39,8 +70,9 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
|
|
|
39
70
|
let sources;
|
|
40
71
|
let from;
|
|
41
72
|
if (pageConfig) {
|
|
42
|
-
const res =
|
|
43
|
-
|
|
73
|
+
const res = getPageConfigUserFriendly_base({
|
|
74
|
+
pageConfigGlobalValues: pageConfigGlobal.configValues,
|
|
75
|
+
pageConfigValues: pageConfig.configValues
|
|
44
76
|
});
|
|
45
77
|
source = res.source;
|
|
46
78
|
sources = res.sources;
|
|
@@ -87,7 +119,7 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
|
|
|
87
119
|
return pageContextExports;
|
|
88
120
|
}
|
|
89
121
|
// V1 design
|
|
90
|
-
function
|
|
122
|
+
function getPageConfigUserFriendly_V1Design(pageConfig) {
|
|
91
123
|
const config = {};
|
|
92
124
|
const configEntries = {};
|
|
93
125
|
const exportsAll = {};
|
|
@@ -2,11 +2,12 @@ export type { PageConfigRuntimeSerialized };
|
|
|
2
2
|
export type { PageConfigGlobalRuntimeSerialized };
|
|
3
3
|
export type { ConfigValueSerialized };
|
|
4
4
|
export type { ValueSerialized };
|
|
5
|
-
import type { ConfigValueStandard, ConfigValueComputed, ConfigValueCumulative, PageConfigRuntime } from '../PageConfig.js';
|
|
5
|
+
import type { ConfigValueStandard, ConfigValueComputed, ConfigValueCumulative, PageConfigCommon, PageConfigRuntime } from '../PageConfig.js';
|
|
6
6
|
/** Page config data structure serialized in virtual files: parsing it results in PageConfigRuntime */
|
|
7
|
-
type PageConfigRuntimeSerialized =
|
|
7
|
+
type PageConfigRuntimeSerialized = PageConfigCommon & {
|
|
8
8
|
/** Config values that are serializable and loaded eagerly such as config.passToClient */
|
|
9
9
|
configValuesSerialized: Record<string, ConfigValueSerialized>;
|
|
10
|
+
loadConfigValuesAll: PageConfigRuntime['loadConfigValuesAll'];
|
|
10
11
|
};
|
|
11
12
|
type PageConfigGlobalRuntimeSerialized = {
|
|
12
13
|
configValuesSerialized: Record<string, ConfigValueSerialized>;
|
|
@@ -12,15 +12,9 @@ function parsePageConfigs(pageConfigsSerialized, pageConfigGlobalSerialized) {
|
|
|
12
12
|
// pageConfigs
|
|
13
13
|
const pageConfigs = pageConfigsSerialized.map((pageConfigSerialized) => {
|
|
14
14
|
const configValues = parseConfigValuesSerialized(pageConfigSerialized.configValuesSerialized);
|
|
15
|
-
const { pageId, isErrorPage, routeFilesystem, loadConfigValuesAll } = pageConfigSerialized;
|
|
16
15
|
assertRouteConfigValue(configValues);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
isErrorPage,
|
|
20
|
-
routeFilesystem,
|
|
21
|
-
configValues,
|
|
22
|
-
loadConfigValuesAll
|
|
23
|
-
};
|
|
16
|
+
const pageConfig = { ...pageConfigSerialized, configValues };
|
|
17
|
+
return pageConfig;
|
|
24
18
|
});
|
|
25
19
|
// pageConfigsGlobal
|
|
26
20
|
const pageConfigGlobal = { configValues: {} };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { executeGuardHook };
|
|
2
|
-
import type {
|
|
2
|
+
import type { PageConfigUserFriendlyOld, PageFile } from '../getPageFiles.js';
|
|
3
3
|
import type { PageConfigRuntime } from '../page-configs/PageConfig.js';
|
|
4
|
-
declare function executeGuardHook<T extends
|
|
4
|
+
declare function executeGuardHook<T extends PageConfigUserFriendlyOld & {
|
|
5
5
|
pageId: string;
|
|
6
6
|
_pageFilesAll: PageFile[];
|
|
7
7
|
_pageConfigs: PageConfigRuntime[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.222-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.222-commit-6647d1e";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.222-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.222-commit-6647d1e';
|