vike 0.4.237-commit-92dc549 → 0.4.237-commit-fd8294f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/runtime-server-routing/utils.js +1 -1
- package/dist/cjs/node/api/build.js +4 -30
- package/dist/cjs/node/prerender/runPrerender.js +5 -6
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +3 -1
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +1 -1
- package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +1 -11
- package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +42 -46
- package/dist/cjs/node/runtime/renderPage/{renderPageAlreadyRouted.js → renderPageAfterRoute.js} +3 -4
- package/dist/cjs/node/runtime/renderPage.js +6 -9
- package/dist/cjs/node/runtime/utils.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +3 -5
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginAutoFullBuild.js +8 -26
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +2 -9
- package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +3 -2
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +4 -3
- package/dist/cjs/node/vite/shared/getOutDirs.js +5 -4
- package/dist/cjs/node/vite/shared/isViteServerSide.js +46 -19
- package/dist/cjs/shared/page-configs/{loadPageEntry.js → loadAndParseVirtualFilePageEntry.js} +2 -2
- package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +5 -0
- package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -1
- package/dist/cjs/shared/route/index.js +0 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/{augmentType.js → updateType.js} +3 -3
- package/dist/esm/__internal/index.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +2 -2
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +6 -6
- package/dist/esm/client/runtime-client-routing/utils.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/utils.js +1 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +3 -3
- package/dist/esm/client/runtime-server-routing/utils.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/utils.js +1 -1
- package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +2 -2
- package/dist/esm/node/api/build.js +5 -31
- package/dist/esm/node/prerender/runPrerender.d.ts +9 -300
- package/dist/esm/node/prerender/runPrerender.js +6 -7
- package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +4 -3
- package/dist/esm/node/runtime/renderPage/analyzePage.js +3 -1
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.js +2 -2
- package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.d.ts +0 -1
- package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.js +1 -11
- package/dist/esm/node/runtime/renderPage/getPageAssets.d.ts +2 -4
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +105 -19
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +44 -48
- package/dist/esm/node/runtime/renderPage/{renderPageAlreadyRouted.d.ts → renderPageAfterRoute.d.ts} +20 -4
- package/dist/esm/node/runtime/renderPage/{renderPageAlreadyRouted.js → renderPageAfterRoute.js} +5 -6
- package/dist/esm/node/runtime/renderPage.js +8 -11
- package/dist/esm/node/runtime/utils.d.ts +1 -1
- package/dist/esm/node/runtime/utils.js +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.d.ts +0 -1
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +5 -7
- package/dist/esm/node/vite/plugins/pluginBuild/pluginAutoFullBuild.js +10 -28
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildApp.js +2 -9
- package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +3 -2
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +4 -3
- package/dist/esm/node/vite/shared/getOutDirs.js +5 -4
- package/dist/esm/node/vite/shared/isViteServerSide.d.ts +1 -1
- package/dist/esm/node/vite/shared/isViteServerSide.js +46 -19
- package/dist/esm/shared/page-configs/loadAndParseVirtualFilePageEntry.d.ts +3 -0
- package/dist/esm/shared/page-configs/{loadPageEntry.js → loadAndParseVirtualFilePageEntry.js} +2 -2
- package/dist/esm/shared/page-configs/resolveVikeConfigPublic.js +5 -0
- package/dist/esm/shared/route/execHookOnBeforeRoute.d.ts +3 -3
- package/dist/esm/shared/route/execHookOnBeforeRoute.js +0 -1
- package/dist/esm/shared/route/index.d.ts +5 -6
- package/dist/esm/shared/route/index.js +0 -1
- package/dist/esm/types/Config.d.ts +2 -4
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/updateType.d.ts +3 -0
- package/dist/esm/utils/updateType.js +7 -0
- package/package.json +3 -3
- package/dist/cjs/node/runtime/renderPage/debugPageFiles.js +0 -52
- package/dist/esm/node/runtime/renderPage/debugPageFiles.d.ts +0 -23
- package/dist/esm/node/runtime/renderPage/debugPageFiles.js +0 -47
- package/dist/esm/shared/page-configs/loadPageEntry.d.ts +0 -3
- package/dist/esm/utils/augmentType.d.ts +0 -3
- package/dist/esm/utils/augmentType.js +0 -7
|
@@ -4,16 +4,16 @@ export { isViteServerSide_withoutEnv };
|
|
|
4
4
|
export { isViteServerSide_onlySsrEnv };
|
|
5
5
|
export { isViteServerSide_extraSafe };
|
|
6
6
|
import { assert } from '../../../utils/assert.js';
|
|
7
|
-
function
|
|
7
|
+
function isViteServerSide_impl(configGlobal, viteEnv) {
|
|
8
8
|
assert(!('consumer' in configGlobal)); // make sure configGlobal isn't viteEnv.config
|
|
9
9
|
const isServerSide1 = !viteEnv?.config.consumer ? null : viteEnv.config.consumer !== 'client';
|
|
10
|
-
const isServerSide2 = !viteEnv?.
|
|
11
|
-
const isServerSide3 = !
|
|
12
|
-
const isServerSide4 =
|
|
10
|
+
const isServerSide2 = !viteEnv?.config.build ? null : getBuildSsrValue(viteEnv.config.build.ssr);
|
|
11
|
+
const isServerSide3 = !configGlobal.build ? null : getBuildSsrValue(configGlobal.build.ssr);
|
|
12
|
+
const isServerSide4 = viteEnv?.name === 'ssr' ? true : viteEnv?.name === 'client' ? false : null;
|
|
13
13
|
const debug = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
viteEnvIsUndefined: !viteEnv,
|
|
15
|
+
viteEnvName: viteEnv?.name ?? null,
|
|
16
|
+
viteEnvConsumer: viteEnv?.config.consumer ?? null,
|
|
17
17
|
configEnvBuildSsr: viteEnv?.config.build?.ssr ?? null,
|
|
18
18
|
configGlobalBuildSsr: configGlobal.build?.ssr ?? null,
|
|
19
19
|
isServerSide1,
|
|
@@ -22,25 +22,36 @@ function isViteServerSide_withoutEnv(configGlobal, viteEnv) {
|
|
|
22
22
|
isServerSide4,
|
|
23
23
|
};
|
|
24
24
|
if (isServerSide1 !== null) {
|
|
25
|
-
assert(isServerSide1 ===
|
|
25
|
+
// assert(isServerSide1 === isServerSide4 || isServerSide4 === null, debug)
|
|
26
26
|
/* This assertion can fail, seems to be a Vite bug?
|
|
27
|
-
assert(isServerSide1 ===
|
|
27
|
+
assert(isServerSide1 === isServerSide2, debug)
|
|
28
28
|
*/
|
|
29
29
|
return isServerSide1;
|
|
30
30
|
}
|
|
31
31
|
if (isServerSide2 !== null) {
|
|
32
|
-
|
|
33
|
-
assert(isServerSide2 === isServerSide3, debug)
|
|
34
|
-
*/
|
|
32
|
+
// assert(isServerSide2 === isServerSide4 || isServerSide4 === null, debug)
|
|
35
33
|
return isServerSide2;
|
|
36
34
|
}
|
|
37
35
|
if (isServerSide3 !== null) {
|
|
36
|
+
// assert(isServerSide3 === isServerSide4 || isServerSide4 === null, debug)
|
|
38
37
|
return isServerSide3;
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
if (isServerSide4 !== null) {
|
|
40
|
+
return isServerSide4;
|
|
41
|
+
}
|
|
42
|
+
assert(!viteEnv);
|
|
43
|
+
return !!configGlobal.build?.ssr;
|
|
44
|
+
}
|
|
45
|
+
function getBuildSsrValue(buildSsr) {
|
|
46
|
+
if (buildSsr === undefined)
|
|
47
|
+
return null;
|
|
48
|
+
return !!buildSsr;
|
|
41
49
|
}
|
|
42
50
|
function isViteServerSide(configGlobal, viteEnv) {
|
|
43
|
-
return
|
|
51
|
+
return isViteServerSide_impl(configGlobal, viteEnv);
|
|
52
|
+
}
|
|
53
|
+
function isViteServerSide_withoutEnv(configGlobal, viteEnv) {
|
|
54
|
+
return isViteServerSide_impl(configGlobal, viteEnv);
|
|
44
55
|
}
|
|
45
56
|
function isViteClientSide(configGlobal, viteEnv) {
|
|
46
57
|
return !isViteServerSide(configGlobal, viteEnv);
|
|
@@ -51,20 +62,36 @@ function isViteServerSide_onlySsrEnv(configGlobal, viteEnv) {
|
|
|
51
62
|
}
|
|
52
63
|
// Vite is quite messy about setting config.build.ssr — for security purposes, we use an extra safe implementation with lots of assertions, which is needed for the .client.js and .server.js guarantee.
|
|
53
64
|
function isViteServerSide_extraSafe(config, options, viteEnv) {
|
|
65
|
+
const isServerSide = isViteServerSide(config, viteEnv);
|
|
66
|
+
const debug = {
|
|
67
|
+
configCommand: config.command,
|
|
68
|
+
configBuildSsr: config.build.ssr,
|
|
69
|
+
optionsIsUndefined: options === undefined,
|
|
70
|
+
optionsSsr: options?.ssr,
|
|
71
|
+
isServerSide,
|
|
72
|
+
};
|
|
73
|
+
if (true) {
|
|
74
|
+
const res = options?.ssr;
|
|
75
|
+
if (typeof res === 'boolean') {
|
|
76
|
+
assert(res === isServerSide, debug);
|
|
77
|
+
return res;
|
|
78
|
+
}
|
|
79
|
+
return isServerSide;
|
|
80
|
+
}
|
|
54
81
|
if (config.command === 'build') {
|
|
55
82
|
const res = config.build.ssr;
|
|
56
|
-
assert(typeof res === 'boolean');
|
|
57
|
-
assert(res === options?.ssr || options?.ssr === undefined);
|
|
58
|
-
assert(res ===
|
|
83
|
+
assert(typeof res === 'boolean', debug);
|
|
84
|
+
assert(res === options?.ssr || options?.ssr === undefined, debug);
|
|
85
|
+
assert(res === isServerSide, debug);
|
|
59
86
|
return res;
|
|
60
87
|
}
|
|
61
88
|
else {
|
|
62
89
|
const res = options?.ssr;
|
|
63
|
-
assert(typeof res === 'boolean');
|
|
90
|
+
assert(typeof res === 'boolean', debug);
|
|
64
91
|
/* This assertion can fail, seems to be a Vite bug? It's very unexpected.
|
|
65
92
|
if (typeof config.build.ssr === 'boolean') assert(res === config.build.ssr)
|
|
66
93
|
*/
|
|
67
|
-
assert(res ===
|
|
94
|
+
assert(res === isServerSide, debug);
|
|
68
95
|
return res;
|
|
69
96
|
}
|
|
70
97
|
}
|
package/dist/esm/shared/page-configs/{loadPageEntry.js → loadAndParseVirtualFilePageEntry.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { loadAndParseVirtualFilePageEntry };
|
|
2
2
|
import { assert, objectAssign } from '../utils.js';
|
|
3
3
|
import { parseConfigValuesSerialized } from './serialize/parsePageConfigsSerialized.js';
|
|
4
|
-
async function
|
|
4
|
+
async function loadAndParseVirtualFilePageEntry(pageConfig, isDev) {
|
|
5
5
|
if ('isPageEntryLoaded' in pageConfig &&
|
|
6
6
|
// We don't need to cache in dev, since Vite already caches the virtual module
|
|
7
7
|
!isDev) {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// TO-DO/soon: rename PageConfig names
|
|
2
|
+
// - Use `Internal` suffix, i.e. {Page,Global}ConfigInternal
|
|
3
|
+
// - While keeping {Page,Global}ConfigPublic or remove Public suffix and rename it to {Page,Global}Config ?
|
|
4
|
+
// - rename EagerLoaded EagerlyLoaded
|
|
5
|
+
// - remove `LazyLoaded` suffix
|
|
1
6
|
// TO-DO/soon/same-api: use public API internally?
|
|
2
7
|
// TO-DO/soon/flat-pageContext: rename definedAt => definedBy
|
|
3
8
|
export { resolveVikeConfigPublicGlobal };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { execHookOnBeforeRoute };
|
|
2
|
-
import type {
|
|
3
|
-
declare function execHookOnBeforeRoute(pageContext:
|
|
2
|
+
import type { PageContextBeforeRoute, PageContextAfterRoute } from './index.js';
|
|
3
|
+
declare function execHookOnBeforeRoute(pageContext: PageContextBeforeRoute): Promise<null | ({
|
|
4
4
|
_routingProvidedByOnBeforeRouteHook: true;
|
|
5
|
-
} &
|
|
5
|
+
} & PageContextAfterRoute) | {
|
|
6
6
|
_routingProvidedByOnBeforeRouteHook: false;
|
|
7
7
|
}>;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
export { route };
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
2
|
+
export type { PageContextBeforeRoute };
|
|
3
|
+
export type { PageContextAfterRoute };
|
|
4
4
|
export type { PageRoutes };
|
|
5
5
|
export type { RouteMatches };
|
|
6
6
|
import { type PageContextUrlInternal, type PageContextUrlSource } from '../getPageContextUrlComputed.js';
|
|
7
7
|
import type { PageRoutes, RouteType } from './loadPageRoutes.js';
|
|
8
8
|
import type { GlobalContextInternal } from '../createGlobalContextShared.js';
|
|
9
|
-
type
|
|
9
|
+
type PageContextBeforeRoute = PageContextUrlInternal & {
|
|
10
10
|
_globalContext: GlobalContextInternal;
|
|
11
11
|
} & PageContextUrlSource;
|
|
12
|
-
type
|
|
12
|
+
type PageContextAfterRoute = {
|
|
13
13
|
pageId: string | null;
|
|
14
14
|
routeParams: Record<string, string>;
|
|
15
15
|
_routingProvidedByOnBeforeRouteHook?: boolean;
|
|
16
|
-
_debugRouteMatches: RouteMatches;
|
|
17
16
|
};
|
|
18
17
|
type RouteMatch = {
|
|
19
18
|
pageId: string;
|
|
@@ -23,4 +22,4 @@ type RouteMatch = {
|
|
|
23
22
|
routeParams: Record<string, string>;
|
|
24
23
|
};
|
|
25
24
|
type RouteMatches = 'CUSTOM_ROUTING' | RouteMatch[];
|
|
26
|
-
declare function route(pageContext:
|
|
25
|
+
declare function route(pageContext: PageContextBeforeRoute, skipOnBeforeRouteHook?: true): Promise<PageContextAfterRoute>;
|
|
@@ -81,7 +81,6 @@ async function route(pageContext, skipOnBeforeRouteHook) {
|
|
|
81
81
|
resolvePrecedence(routeMatches);
|
|
82
82
|
const winner = routeMatches[0] ?? null;
|
|
83
83
|
debug(`Route matches for URL ${pc.cyan(urlPathname)} (in precedence order):`, routeMatches);
|
|
84
|
-
objectAssign(pageContextFromRoute, { _debugRouteMatches: routeMatches });
|
|
85
84
|
// For vite-plugin-vercel https://github.com/magne4000/vite-plugin-vercel/blob/main/packages/vike-integration/vike.ts#L173
|
|
86
85
|
objectAssign(pageContextFromRoute, { _routeMatch: winner });
|
|
87
86
|
if (!winner) {
|
|
@@ -404,11 +404,9 @@ type ConfigBuiltIn = {
|
|
|
404
404
|
/** @deprecated See https://vike.dev/disableAutoFullBuild */
|
|
405
405
|
disableAutoFullBuild?: boolean | 'prerender';
|
|
406
406
|
/**
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
* @experimental
|
|
407
|
+
* @deprecated It's value is now always true.
|
|
410
408
|
*/
|
|
411
|
-
vite6BuilderApp?:
|
|
409
|
+
vite6BuilderApp?: true;
|
|
412
410
|
/** The Base URL of your server.
|
|
413
411
|
*
|
|
414
412
|
* https://vike.dev/base-url
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.237-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.237-commit-fd8294f";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.237-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.237-commit-fd8294f';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.237-commit-
|
|
3
|
+
"version": "0.4.237-commit-fd8294f",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"@brillout/json-serializer": "^0.5.20",
|
|
133
133
|
"@brillout/picocolors": "^1.0.26",
|
|
134
134
|
"@brillout/require-shim": "^0.1.2",
|
|
135
|
-
"@brillout/vite-plugin-server-entry": "^0.7.
|
|
135
|
+
"@brillout/vite-plugin-server-entry": "^0.7.13",
|
|
136
136
|
"acorn": "^8.0.0",
|
|
137
137
|
"cac": "^6.0.0",
|
|
138
138
|
"es-module-lexer": "^1.0.0",
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
"react-streaming": "^0.4.3",
|
|
264
264
|
"rimraf": "^5.0.5",
|
|
265
265
|
"typescript": "^5.8.3",
|
|
266
|
-
"vite": "^7.
|
|
266
|
+
"vite": "^7.1.3"
|
|
267
267
|
},
|
|
268
268
|
"scripts": {
|
|
269
269
|
"dev": "tsc --watch",
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.debugPageFiles = debugPageFiles;
|
|
7
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
|
-
const utils_js_1 = require("../utils.js");
|
|
9
|
-
function debugPageFiles({ pageContext, isHtmlOnly, isClientRouting, pageFilesLoaded, pageFilesServerSide, pageFilesClientSide, clientEntries, clientDependencies, }) {
|
|
10
|
-
const debug = (0, utils_js_1.createDebugger)('vike:pageFiles', { serialization: { emptyArray: 'None' } });
|
|
11
|
-
const padding = ' - ';
|
|
12
|
-
debug('All page files:', printPageFiles(pageContext._globalContext._pageFilesAll, true));
|
|
13
|
-
debug(`URL:`, pageContext.urlOriginal);
|
|
14
|
-
debug.options({ serialization: { emptyArray: 'No match' } })(`Routing:`, printRouteMatches(pageContext._debugRouteMatches));
|
|
15
|
-
debug(`pageId:`, pageContext.pageId);
|
|
16
|
-
debug('Page type:', isHtmlOnly ? 'HTML-only' : 'SSR/SPA');
|
|
17
|
-
debug(`Routing type:`, !isHtmlOnly && isClientRouting ? 'Client Routing' : 'Server Routing');
|
|
18
|
-
debug('Server-side page files:', printPageFiles(pageFilesLoaded));
|
|
19
|
-
(0, utils_js_1.assert)(samePageFiles(pageFilesLoaded, pageFilesServerSide));
|
|
20
|
-
debug('Client-side page files:', printPageFiles(pageFilesClientSide));
|
|
21
|
-
debug('Client-side entries:', clientEntries);
|
|
22
|
-
debug('Client-side dependencies:', clientDependencies);
|
|
23
|
-
return;
|
|
24
|
-
function printRouteMatches(debugRouteMatches) {
|
|
25
|
-
if (debugRouteMatches === 'ROUTING_ERROR') {
|
|
26
|
-
return 'Routing Failed';
|
|
27
|
-
}
|
|
28
|
-
if (debugRouteMatches === 'CUSTOM_ROUTING') {
|
|
29
|
-
return 'Custom Routing';
|
|
30
|
-
}
|
|
31
|
-
return debugRouteMatches;
|
|
32
|
-
}
|
|
33
|
-
function printPageFiles(pageFiles, genericPageFilesLast = false) {
|
|
34
|
-
if (pageFiles.length === 0) {
|
|
35
|
-
return 'None';
|
|
36
|
-
}
|
|
37
|
-
return ('\n' +
|
|
38
|
-
pageFiles
|
|
39
|
-
.sort((p1, p2) => p1.filePath.localeCompare(p2.filePath))
|
|
40
|
-
.sort((0, utils_js_1.makeFirst)((p) => (p.isRendererPageFile ? !genericPageFilesLast : null)))
|
|
41
|
-
.sort((0, utils_js_1.makeFirst)((p) => (p.isDefaultPageFile ? !genericPageFilesLast : null)))
|
|
42
|
-
.map((p) => p.filePath)
|
|
43
|
-
.map((s) => s.split('_default.page.').join(`${picocolors_1.default.blue('_default')}.page.`))
|
|
44
|
-
.map((s) => s.split('/renderer/').join(`/${picocolors_1.default.red('renderer')}/`))
|
|
45
|
-
.map((s) => padding + s)
|
|
46
|
-
.join('\n'));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function samePageFiles(pageFiles1, pageFiles2) {
|
|
50
|
-
return (pageFiles1.every((p1) => pageFiles2.some((p2) => p2.filePath === p1.filePath)) &&
|
|
51
|
-
pageFiles2.every((p2) => pageFiles1.some((p1) => p1.filePath === p2.filePath)));
|
|
52
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export { debugPageFiles };
|
|
2
|
-
export type { PageContextDebugRouteMatches };
|
|
3
|
-
import type { RouteMatches } from '../../../shared/route/index.js';
|
|
4
|
-
import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js';
|
|
5
|
-
import type { PageFile } from '../../../shared/getPageFiles.js';
|
|
6
|
-
import type { GlobalContextServerInternal } from '../globalContext.js';
|
|
7
|
-
type PageContextDebugRouteMatches = {
|
|
8
|
-
_debugRouteMatches: 'ROUTING_ERROR' | RouteMatches;
|
|
9
|
-
};
|
|
10
|
-
declare function debugPageFiles({ pageContext, isHtmlOnly, isClientRouting, pageFilesLoaded, pageFilesServerSide, pageFilesClientSide, clientEntries, clientDependencies, }: {
|
|
11
|
-
pageContext: {
|
|
12
|
-
urlOriginal: string;
|
|
13
|
-
pageId: string;
|
|
14
|
-
_globalContext: GlobalContextServerInternal;
|
|
15
|
-
} & PageContextDebugRouteMatches;
|
|
16
|
-
isHtmlOnly: boolean;
|
|
17
|
-
isClientRouting: boolean;
|
|
18
|
-
pageFilesLoaded: PageFile[];
|
|
19
|
-
pageFilesClientSide: PageFile[];
|
|
20
|
-
pageFilesServerSide: PageFile[];
|
|
21
|
-
clientEntries: string[];
|
|
22
|
-
clientDependencies: ClientDependency[];
|
|
23
|
-
}): void;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export { debugPageFiles };
|
|
2
|
-
import pc from '@brillout/picocolors';
|
|
3
|
-
import { assert, makeFirst, createDebugger } from '../utils.js';
|
|
4
|
-
function debugPageFiles({ pageContext, isHtmlOnly, isClientRouting, pageFilesLoaded, pageFilesServerSide, pageFilesClientSide, clientEntries, clientDependencies, }) {
|
|
5
|
-
const debug = createDebugger('vike:pageFiles', { serialization: { emptyArray: 'None' } });
|
|
6
|
-
const padding = ' - ';
|
|
7
|
-
debug('All page files:', printPageFiles(pageContext._globalContext._pageFilesAll, true));
|
|
8
|
-
debug(`URL:`, pageContext.urlOriginal);
|
|
9
|
-
debug.options({ serialization: { emptyArray: 'No match' } })(`Routing:`, printRouteMatches(pageContext._debugRouteMatches));
|
|
10
|
-
debug(`pageId:`, pageContext.pageId);
|
|
11
|
-
debug('Page type:', isHtmlOnly ? 'HTML-only' : 'SSR/SPA');
|
|
12
|
-
debug(`Routing type:`, !isHtmlOnly && isClientRouting ? 'Client Routing' : 'Server Routing');
|
|
13
|
-
debug('Server-side page files:', printPageFiles(pageFilesLoaded));
|
|
14
|
-
assert(samePageFiles(pageFilesLoaded, pageFilesServerSide));
|
|
15
|
-
debug('Client-side page files:', printPageFiles(pageFilesClientSide));
|
|
16
|
-
debug('Client-side entries:', clientEntries);
|
|
17
|
-
debug('Client-side dependencies:', clientDependencies);
|
|
18
|
-
return;
|
|
19
|
-
function printRouteMatches(debugRouteMatches) {
|
|
20
|
-
if (debugRouteMatches === 'ROUTING_ERROR') {
|
|
21
|
-
return 'Routing Failed';
|
|
22
|
-
}
|
|
23
|
-
if (debugRouteMatches === 'CUSTOM_ROUTING') {
|
|
24
|
-
return 'Custom Routing';
|
|
25
|
-
}
|
|
26
|
-
return debugRouteMatches;
|
|
27
|
-
}
|
|
28
|
-
function printPageFiles(pageFiles, genericPageFilesLast = false) {
|
|
29
|
-
if (pageFiles.length === 0) {
|
|
30
|
-
return 'None';
|
|
31
|
-
}
|
|
32
|
-
return ('\n' +
|
|
33
|
-
pageFiles
|
|
34
|
-
.sort((p1, p2) => p1.filePath.localeCompare(p2.filePath))
|
|
35
|
-
.sort(makeFirst((p) => (p.isRendererPageFile ? !genericPageFilesLast : null)))
|
|
36
|
-
.sort(makeFirst((p) => (p.isDefaultPageFile ? !genericPageFilesLast : null)))
|
|
37
|
-
.map((p) => p.filePath)
|
|
38
|
-
.map((s) => s.split('_default.page.').join(`${pc.blue('_default')}.page.`))
|
|
39
|
-
.map((s) => s.split('/renderer/').join(`/${pc.red('renderer')}/`))
|
|
40
|
-
.map((s) => padding + s)
|
|
41
|
-
.join('\n'));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function samePageFiles(pageFiles1, pageFiles2) {
|
|
45
|
-
return (pageFiles1.every((p1) => pageFiles2.some((p2) => p2.filePath === p1.filePath)) &&
|
|
46
|
-
pageFiles2.every((p2) => pageFiles1.some((p1) => p1.filePath === p2.filePath)));
|
|
47
|
-
}
|