vike 0.4.145-commit-2520555 → 0.4.146-commit-701e2e5
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/runtime/renderPage.js +2 -2
- package/dist/cjs/utils/parseUrl-extras.js +16 -7
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/node/runtime/renderPage.js +2 -2
- package/dist/esm/utils/parseUrl-extras.d.ts +1 -1
- package/dist/esm/utils/parseUrl-extras.js +16 -7
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
|
@@ -318,11 +318,11 @@ function skipRequest(urlOriginal) {
|
|
|
318
318
|
isViteClientRequest);
|
|
319
319
|
}
|
|
320
320
|
function normalizeUrl(pageContextInit, httpRequestId) {
|
|
321
|
-
const { trailingSlash, disableUrlNormalization } = (0, globalContext_js_1.getGlobalContext)();
|
|
321
|
+
const { trailingSlash, disableUrlNormalization, baseServer } = (0, globalContext_js_1.getGlobalContext)();
|
|
322
322
|
if (disableUrlNormalization)
|
|
323
323
|
return null;
|
|
324
324
|
const { urlOriginal } = pageContextInit;
|
|
325
|
-
const urlNormalized = (0, utils_js_1.normalizeUrlPathname)(urlOriginal, trailingSlash);
|
|
325
|
+
const urlNormalized = (0, utils_js_1.normalizeUrlPathname)(urlOriginal, trailingSlash, baseServer);
|
|
326
326
|
if (!urlNormalized)
|
|
327
327
|
return null;
|
|
328
328
|
(0, loggerRuntime_js_1.logRuntimeInfo)?.(`URL normalized from ${picocolors_1.default.cyan(urlOriginal)} to ${picocolors_1.default.cyan(urlNormalized)} (https://vike.dev/url-normalization)`, httpRequestId, 'info');
|
|
@@ -52,15 +52,20 @@ function isBaseAssets(base) {
|
|
|
52
52
|
return base.startsWith('/') || base.startsWith('http://') || base.startsWith('https://');
|
|
53
53
|
}
|
|
54
54
|
exports.isBaseAssets = isBaseAssets;
|
|
55
|
-
function normalizeUrlPathname(urlOriginal, trailingSlash) {
|
|
55
|
+
function normalizeUrlPathname(urlOriginal, trailingSlash, baseServer) {
|
|
56
56
|
const urlNormalized = modifyUrlPathname(urlOriginal, (urlPathname) => {
|
|
57
57
|
(0, assert_js_1.assert)(urlPathname.startsWith('/'));
|
|
58
|
-
let urlPathnameNormalized =
|
|
59
|
-
if (urlPathnameNormalized
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
let urlPathnameNormalized = normalize(urlPathname);
|
|
59
|
+
if (urlPathnameNormalized === '/') {
|
|
60
|
+
return urlPathnameNormalized;
|
|
61
|
+
}
|
|
62
|
+
// If the Base URL has a trailing slash, then Vite (as of vite@5.0.0-beta.19) expects the root URL to also have a trailing slash, see https://github.com/vikejs/vike/issues/1258#issuecomment-1812226260
|
|
63
|
+
if (baseServer.endsWith('/') && baseServer !== '/' && normalize(baseServer) === urlPathnameNormalized) {
|
|
64
|
+
trailingSlash = true;
|
|
65
|
+
}
|
|
66
|
+
(0, assert_js_1.assert)(!urlPathnameNormalized.endsWith('/'));
|
|
67
|
+
if (trailingSlash) {
|
|
68
|
+
urlPathnameNormalized = urlPathnameNormalized + '/';
|
|
64
69
|
}
|
|
65
70
|
return urlPathnameNormalized;
|
|
66
71
|
});
|
|
@@ -69,6 +74,10 @@ function normalizeUrlPathname(urlOriginal, trailingSlash) {
|
|
|
69
74
|
return urlNormalized;
|
|
70
75
|
}
|
|
71
76
|
exports.normalizeUrlPathname = normalizeUrlPathname;
|
|
77
|
+
function normalize(urlPathname) {
|
|
78
|
+
(0, assert_js_1.assert)(urlPathname.startsWith('/'));
|
|
79
|
+
return '/' + urlPathname.split('/').filter(Boolean).join('/');
|
|
80
|
+
}
|
|
72
81
|
function modifyUrlPathname(url, modifier) {
|
|
73
82
|
const { origin, pathnameOriginal, searchOriginal, hashOriginal } = (0, parseUrl_js_1.parseUrl)(url, '/');
|
|
74
83
|
const pathnameModified = modifier(pathnameOriginal);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.projectInfo = void 0;
|
|
4
4
|
const assertSingleInstance_js_1 = require("./assertSingleInstance.js");
|
|
5
|
-
const PROJECT_VERSION = '0.4.
|
|
5
|
+
const PROJECT_VERSION = '0.4.146-commit-701e2e5';
|
|
6
6
|
const projectInfo = {
|
|
7
7
|
projectName: 'Vike',
|
|
8
8
|
projectVersion: PROJECT_VERSION,
|
|
@@ -312,11 +312,11 @@ function skipRequest(urlOriginal) {
|
|
|
312
312
|
isViteClientRequest);
|
|
313
313
|
}
|
|
314
314
|
function normalizeUrl(pageContextInit, httpRequestId) {
|
|
315
|
-
const { trailingSlash, disableUrlNormalization } = getGlobalContext();
|
|
315
|
+
const { trailingSlash, disableUrlNormalization, baseServer } = getGlobalContext();
|
|
316
316
|
if (disableUrlNormalization)
|
|
317
317
|
return null;
|
|
318
318
|
const { urlOriginal } = pageContextInit;
|
|
319
|
-
const urlNormalized = normalizeUrlPathname(urlOriginal, trailingSlash);
|
|
319
|
+
const urlNormalized = normalizeUrlPathname(urlOriginal, trailingSlash, baseServer);
|
|
320
320
|
if (!urlNormalized)
|
|
321
321
|
return null;
|
|
322
322
|
logRuntimeInfo?.(`URL normalized from ${pc.cyan(urlOriginal)} to ${pc.cyan(urlNormalized)} (https://vike.dev/url-normalization)`, httpRequestId, 'info');
|
|
@@ -8,7 +8,7 @@ export { addUrlOrigin };
|
|
|
8
8
|
declare function prependBase(url: string, baseServer: string): string;
|
|
9
9
|
declare function removeBaseServer(url: string, baseServer: string): string;
|
|
10
10
|
declare function isBaseAssets(base: string): boolean;
|
|
11
|
-
declare function normalizeUrlPathname(urlOriginal: string, trailingSlash: boolean): string | null;
|
|
11
|
+
declare function normalizeUrlPathname(urlOriginal: string, trailingSlash: boolean, baseServer: string): string | null;
|
|
12
12
|
declare function modifyUrlPathname(url: string, modifier: (urlPathname: string) => string | null): string;
|
|
13
13
|
declare function removeUrlOrigin(url: string): {
|
|
14
14
|
urlModified: string;
|
|
@@ -53,15 +53,20 @@ function normalizeBaseServer(baseServer) {
|
|
|
53
53
|
function isBaseAssets(base) {
|
|
54
54
|
return base.startsWith('/') || base.startsWith('http://') || base.startsWith('https://');
|
|
55
55
|
}
|
|
56
|
-
function normalizeUrlPathname(urlOriginal, trailingSlash) {
|
|
56
|
+
function normalizeUrlPathname(urlOriginal, trailingSlash, baseServer) {
|
|
57
57
|
const urlNormalized = modifyUrlPathname(urlOriginal, (urlPathname) => {
|
|
58
58
|
assert(urlPathname.startsWith('/'));
|
|
59
|
-
let urlPathnameNormalized =
|
|
60
|
-
if (urlPathnameNormalized
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
let urlPathnameNormalized = normalize(urlPathname);
|
|
60
|
+
if (urlPathnameNormalized === '/') {
|
|
61
|
+
return urlPathnameNormalized;
|
|
62
|
+
}
|
|
63
|
+
// If the Base URL has a trailing slash, then Vite (as of vite@5.0.0-beta.19) expects the root URL to also have a trailing slash, see https://github.com/vikejs/vike/issues/1258#issuecomment-1812226260
|
|
64
|
+
if (baseServer.endsWith('/') && baseServer !== '/' && normalize(baseServer) === urlPathnameNormalized) {
|
|
65
|
+
trailingSlash = true;
|
|
66
|
+
}
|
|
67
|
+
assert(!urlPathnameNormalized.endsWith('/'));
|
|
68
|
+
if (trailingSlash) {
|
|
69
|
+
urlPathnameNormalized = urlPathnameNormalized + '/';
|
|
65
70
|
}
|
|
66
71
|
return urlPathnameNormalized;
|
|
67
72
|
});
|
|
@@ -69,6 +74,10 @@ function normalizeUrlPathname(urlOriginal, trailingSlash) {
|
|
|
69
74
|
return null;
|
|
70
75
|
return urlNormalized;
|
|
71
76
|
}
|
|
77
|
+
function normalize(urlPathname) {
|
|
78
|
+
assert(urlPathname.startsWith('/'));
|
|
79
|
+
return '/' + urlPathname.split('/').filter(Boolean).join('/');
|
|
80
|
+
}
|
|
72
81
|
function modifyUrlPathname(url, modifier) {
|
|
73
82
|
const { origin, pathnameOriginal, searchOriginal, hashOriginal } = parseUrl(url, '/');
|
|
74
83
|
const pathnameModified = modifier(pathnameOriginal);
|
|
@@ -5,7 +5,7 @@ type ProjectVersion = typeof projectInfo.projectVersion;
|
|
|
5
5
|
type ProjectTag = `[${PackageName}]` | `[${PackageName}@${ProjectVersion}]`;
|
|
6
6
|
declare const projectInfo: {
|
|
7
7
|
projectName: "Vike";
|
|
8
|
-
projectVersion: "0.4.
|
|
8
|
+
projectVersion: "0.4.146-commit-701e2e5";
|
|
9
9
|
npmPackageName: "vike";
|
|
10
10
|
githubRepository: "https://github.com/vikejs/vike";
|
|
11
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
import { onProjectInfo } from './assertSingleInstance.js';
|
|
3
|
-
const PROJECT_VERSION = '0.4.
|
|
3
|
+
const PROJECT_VERSION = '0.4.146-commit-701e2e5';
|
|
4
4
|
const projectInfo = {
|
|
5
5
|
projectName: 'Vike',
|
|
6
6
|
projectVersion: PROJECT_VERSION,
|