vike 0.4.222-commit-207e079 → 0.4.222-commit-5513d32
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/buildApp.js +9 -5
- package/dist/cjs/node/plugin/plugins/buildConfig.js +3 -0
- package/dist/cjs/node/plugin/plugins/envVars.js +0 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +7 -14
- package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +1 -1
- package/dist/cjs/node/runtime/globalContext.js +1 -1
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
- package/dist/cjs/node/runtime/renderPage.js +17 -13
- package/dist/cjs/node/runtime/universal-middleware.js +14 -0
- package/dist/cjs/shared/getPageConfigsRuntime.js +2 -8
- package/dist/cjs/shared/getPageContextUrlComputed.js +2 -2
- 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/cjs/utils/assert.js +1 -1
- package/dist/cjs/utils/parseUrl-extras.js +2 -2
- package/dist/cjs/utils/parseUrl.js +5 -5
- package/dist/esm/client/client-routing-runtime/getPageContextCurrent.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/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/client-routing-runtime/skipLink.js +2 -2
- package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +1 -1
- package/dist/esm/client/shared/executeOnRenderClientHook.d.ts +2 -2
- package/dist/esm/client/shared/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/buildApp.js +9 -5
- package/dist/esm/node/plugin/plugins/buildConfig.js +3 -0
- package/dist/esm/node/plugin/plugins/envVars.js +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +8 -15
- package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js +2 -2
- package/dist/esm/node/runtime/globalContext.d.ts +2 -2
- package/dist/esm/node/runtime/globalContext.js +1 -1
- 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/node/runtime/renderPage.d.ts +5 -5
- package/dist/esm/node/runtime/renderPage.js +17 -12
- package/dist/esm/node/runtime/universal-middleware.d.ts +1 -0
- package/dist/esm/node/runtime/universal-middleware.js +11 -0
- package/dist/esm/shared/getPageConfigsRuntime.d.ts +2 -2
- package/dist/esm/shared/getPageConfigsRuntime.js +3 -9
- package/dist/esm/shared/getPageContextUrlComputed.js +2 -2
- 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/assert.js +1 -1
- package/dist/esm/utils/parseUrl-extras.js +2 -2
- package/dist/esm/utils/parseUrl.d.ts +3 -4
- package/dist/esm/utils/parseUrl.js +5 -5
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +15 -2
- package/universal-middleware.js +3 -0
|
@@ -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-5513d32";
|
|
@@ -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-5513d32';
|
package/dist/esm/utils/assert.js
CHANGED
|
@@ -42,7 +42,7 @@ function assert(condition, debugInfo) {
|
|
|
42
42
|
const debugInfoSerialized = typeof debugInfo === 'string' ? debugInfo : JSON.stringify(debugInfo);
|
|
43
43
|
return pc.dim(`Debug info (for Vike maintainers; you can ignore this): ${debugInfoSerialized}`);
|
|
44
44
|
})();
|
|
45
|
-
const link = pc.blue('https://github.com/vikejs/vike/issues/new');
|
|
45
|
+
const link = pc.blue('https://github.com/vikejs/vike/issues/new?template=bug.yml');
|
|
46
46
|
let errMsg = [
|
|
47
47
|
`You stumbled upon a Vike bug. Go to ${link} and copy-paste this error. A maintainer will fix the bug (usually within 24 hours).`,
|
|
48
48
|
debugStr
|
|
@@ -28,8 +28,8 @@ function prependBase(url, baseServer) {
|
|
|
28
28
|
return `${baseServerNormalized}${url}`;
|
|
29
29
|
}
|
|
30
30
|
function removeBaseServer(url, baseServer) {
|
|
31
|
-
const {
|
|
32
|
-
assert(
|
|
31
|
+
const { isBaseMissing, origin, pathname, pathnameOriginal, searchOriginal, hashOriginal } = parseUrl(url, baseServer);
|
|
32
|
+
assert(!isBaseMissing);
|
|
33
33
|
assertUrlComponents(url, origin, pathnameOriginal, searchOriginal, hashOriginal);
|
|
34
34
|
const urlWithoutBase = createUrlFromComponents(origin, pathname, searchOriginal, hashOriginal);
|
|
35
35
|
return urlWithoutBase;
|
|
@@ -10,7 +10,6 @@ export { isBaseServer };
|
|
|
10
10
|
export { assertUrlComponents };
|
|
11
11
|
export { createUrlFromComponents };
|
|
12
12
|
export type { UrlPublic };
|
|
13
|
-
export type { UrlPrivate };
|
|
14
13
|
type UrlPublic = {
|
|
15
14
|
/** The full URL. */
|
|
16
15
|
href: string;
|
|
@@ -41,10 +40,10 @@ type UrlPublic = {
|
|
|
41
40
|
/** @deprecated */
|
|
42
41
|
searchString: null | string;
|
|
43
42
|
};
|
|
44
|
-
type
|
|
45
|
-
|
|
43
|
+
type UrlInternal = Omit<UrlPublic, 'hashString' | 'searchString'> & {
|
|
44
|
+
isBaseMissing: boolean;
|
|
46
45
|
};
|
|
47
|
-
declare function parseUrl(url: string, baseServer: string):
|
|
46
|
+
declare function parseUrl(url: string, baseServer: string): UrlInternal;
|
|
48
47
|
declare function isBaseServer(baseServer: string): boolean;
|
|
49
48
|
declare function assertUrlComponents(url: string, origin: string | null, pathnameOriginal: string, searchOriginal: string | null, hashOriginal: string | null): void;
|
|
50
49
|
declare function createUrlFromComponents(origin: string | null, pathname: string, search: string | null, hash: string | null): string;
|
|
@@ -45,7 +45,7 @@ function parseUrl(url, baseServer) {
|
|
|
45
45
|
const pathnameOriginal = urlWithoutHashNorSearch.slice((origin || '').length);
|
|
46
46
|
assertUrlComponents(url, origin, pathnameOriginal, searchOriginal, hashOriginal);
|
|
47
47
|
// Base URL
|
|
48
|
-
let { pathname,
|
|
48
|
+
let { pathname, isBaseMissing } = removeBaseServer(pathnameAbsoluteWithBase, baseServer);
|
|
49
49
|
// pageContext.urlParsed.href
|
|
50
50
|
const href = createUrlFromComponents(origin, pathname, searchOriginal, hashOriginal);
|
|
51
51
|
// pageContext.urlParsed.{hostname, port}
|
|
@@ -62,7 +62,7 @@ function parseUrl(url, baseServer) {
|
|
|
62
62
|
origin,
|
|
63
63
|
pathname,
|
|
64
64
|
pathnameOriginal: pathnameOriginal,
|
|
65
|
-
|
|
65
|
+
isBaseMissing,
|
|
66
66
|
search,
|
|
67
67
|
searchAll,
|
|
68
68
|
searchOriginal,
|
|
@@ -231,7 +231,7 @@ function removeBaseServer(pathnameAbsoluteWithBase, baseServer) {
|
|
|
231
231
|
assert(baseServer.startsWith('/'));
|
|
232
232
|
if (baseServer === '/') {
|
|
233
233
|
const pathname = pathnameAbsoluteWithBase;
|
|
234
|
-
return { pathname,
|
|
234
|
+
return { pathname, isBaseMissing: false };
|
|
235
235
|
}
|
|
236
236
|
// Support `url === '/some-base-url' && baseServer === '/some-base-url/'`
|
|
237
237
|
let baseServerNormalized = baseServer;
|
|
@@ -241,7 +241,7 @@ function removeBaseServer(pathnameAbsoluteWithBase, baseServer) {
|
|
|
241
241
|
}
|
|
242
242
|
if (!urlPathname.startsWith(baseServerNormalized)) {
|
|
243
243
|
const pathname = pathnameAbsoluteWithBase;
|
|
244
|
-
return { pathname,
|
|
244
|
+
return { pathname, isBaseMissing: true };
|
|
245
245
|
}
|
|
246
246
|
assert(urlPathname.startsWith('/') || urlPathname.startsWith('http'));
|
|
247
247
|
assert(urlPathname.startsWith(baseServerNormalized));
|
|
@@ -249,7 +249,7 @@ function removeBaseServer(pathnameAbsoluteWithBase, baseServer) {
|
|
|
249
249
|
if (!urlPathname.startsWith('/'))
|
|
250
250
|
urlPathname = '/' + urlPathname;
|
|
251
251
|
assert(urlPathname.startsWith('/'));
|
|
252
|
-
return { pathname: urlPathname,
|
|
252
|
+
return { pathname: urlPathname, isBaseMissing: false };
|
|
253
253
|
}
|
|
254
254
|
function isBaseServer(baseServer) {
|
|
255
255
|
return baseServer.startsWith('/');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.222-commit-
|
|
3
|
+
"version": "0.4.222-commit-5513d32",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -96,6 +96,15 @@
|
|
|
96
96
|
"types": "./dist/esm/shared/modifyUrl.d.ts",
|
|
97
97
|
"default": "./dist/esm/shared/modifyUrl.js"
|
|
98
98
|
},
|
|
99
|
+
"./universal-middleware": {
|
|
100
|
+
"worker": "./dist/esm/node/runtime/universal-middleware.js",
|
|
101
|
+
"edge-light": "./dist/esm/node/runtime/universal-middleware.js",
|
|
102
|
+
"require": "./dist/cjs/node/runtime/universal-middleware.js",
|
|
103
|
+
"node": "./dist/esm/node/runtime/universal-middleware.js",
|
|
104
|
+
"browser": "./dist/esm/client/node.js",
|
|
105
|
+
"types": "./dist/esm/node/runtime/universal-middleware.d.ts",
|
|
106
|
+
"default": "./dist/esm/node/runtime/universal-middleware.js"
|
|
107
|
+
},
|
|
99
108
|
"./__internal": {
|
|
100
109
|
"require": "./dist/cjs/__internal/index.js",
|
|
101
110
|
"node": "./dist/esm/__internal/index.js",
|
|
@@ -203,6 +212,9 @@
|
|
|
203
212
|
"modifyUrl": [
|
|
204
213
|
"./dist/esm/shared/modifyUrl.d.ts"
|
|
205
214
|
],
|
|
215
|
+
"universal-middleware": [
|
|
216
|
+
"./dist/esm/node/runtime/universal-middleware.d.ts"
|
|
217
|
+
],
|
|
206
218
|
"__internal": [
|
|
207
219
|
"./dist/esm/__internal/index.d.ts"
|
|
208
220
|
],
|
|
@@ -235,7 +247,8 @@
|
|
|
235
247
|
"./RenderErrorPage.js",
|
|
236
248
|
"./routing.js",
|
|
237
249
|
"./server.js",
|
|
238
|
-
"./types.js"
|
|
250
|
+
"./types.js",
|
|
251
|
+
"./universal-middleware.js"
|
|
239
252
|
],
|
|
240
253
|
"devDependencies": {
|
|
241
254
|
"@biomejs/biome": "^1.5.3",
|