vike 0.4.246-commit-1ceb8ac → 0.4.247-commit-a642bde
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.
|
@@ -30,24 +30,12 @@ const virtualFileIdPageEntryPrefix =
|
|
|
30
30
|
const virtualFileIdGlobalEntryPrefix =
|
|
31
31
|
//
|
|
32
32
|
'virtual:vike:global-entry:';
|
|
33
|
-
const virtualFileIdGlobalEntries = [
|
|
34
|
-
virtualFileIdGlobalEntryServer,
|
|
35
|
-
virtualFileIdGlobalEntryClientCR,
|
|
36
|
-
virtualFileIdGlobalEntryClientSR,
|
|
37
|
-
];
|
|
38
|
-
assert(virtualFileIdGlobalEntries.every((v) =>
|
|
39
|
-
//
|
|
40
|
-
v.startsWith(virtualFileIdGlobalEntryPrefix)));
|
|
41
|
-
assert([virtualFileIdPageEntryClient, virtualFileIdPageEntryServer].every((v) =>
|
|
42
|
-
//
|
|
43
|
-
v.startsWith(virtualFileIdPageEntryPrefix)));
|
|
44
33
|
function parseVirtualFileId(id) {
|
|
45
34
|
id = removeVirtualFileIdPrefix(id);
|
|
46
35
|
if (!id.startsWith(virtualFileIdGlobalEntryPrefix) && !id.startsWith(virtualFileIdPageEntryPrefix))
|
|
47
36
|
return false;
|
|
48
37
|
// Global entry
|
|
49
38
|
if (id.includes(virtualFileIdGlobalEntryPrefix)) {
|
|
50
|
-
assert(virtualFileIdGlobalEntries.includes(id));
|
|
51
39
|
const isForClientSide = id !== virtualFileIdGlobalEntryServer;
|
|
52
40
|
const isClientRouting = id === virtualFileIdGlobalEntryClientCR;
|
|
53
41
|
return {
|
|
@@ -58,23 +46,26 @@ function parseVirtualFileId(id) {
|
|
|
58
46
|
}
|
|
59
47
|
// Page entry
|
|
60
48
|
if (id.includes(virtualFileIdPageEntryPrefix)) {
|
|
61
|
-
assert(id.startsWith(virtualFileIdPageEntryPrefix));
|
|
62
49
|
const idOriginal = id;
|
|
63
50
|
id = extractAssetsRemoveQuery(id);
|
|
64
51
|
const isExtractAssets = idOriginal !== id;
|
|
65
52
|
if (id.startsWith(virtualFileIdPageEntryClient)) {
|
|
66
53
|
assert(isExtractAssets === false);
|
|
54
|
+
const pageIdSerialized = id.slice(virtualFileIdPageEntryClient.length);
|
|
55
|
+
const pageId = deserializePageId(pageIdSerialized);
|
|
67
56
|
return {
|
|
68
57
|
type: 'page-entry',
|
|
69
|
-
pageId
|
|
58
|
+
pageId,
|
|
70
59
|
isForClientSide: true,
|
|
71
60
|
isExtractAssets,
|
|
72
61
|
};
|
|
73
62
|
}
|
|
74
63
|
if (id.startsWith(virtualFileIdPageEntryServer)) {
|
|
64
|
+
const pageIdSerialized = id.slice(virtualFileIdPageEntryServer.length);
|
|
65
|
+
const pageId = deserializePageId(pageIdSerialized);
|
|
75
66
|
return {
|
|
76
67
|
type: 'page-entry',
|
|
77
|
-
pageId
|
|
68
|
+
pageId,
|
|
78
69
|
isForClientSide: false,
|
|
79
70
|
isExtractAssets,
|
|
80
71
|
};
|
|
@@ -86,7 +77,6 @@ function parseVirtualFileId(id) {
|
|
|
86
77
|
function generateVirtualFileId(args) {
|
|
87
78
|
if (args.type === 'global-entry') {
|
|
88
79
|
const { isForClientSide, isClientRouting } = args;
|
|
89
|
-
assert(typeof isClientRouting === 'boolean');
|
|
90
80
|
if (!isForClientSide) {
|
|
91
81
|
return virtualFileIdGlobalEntryServer;
|
|
92
82
|
}
|
|
@@ -99,9 +89,20 @@ function generateVirtualFileId(args) {
|
|
|
99
89
|
}
|
|
100
90
|
if (args.type === 'page-entry') {
|
|
101
91
|
const { pageId, isForClientSide } = args;
|
|
102
|
-
|
|
103
|
-
const id = `${isForClientSide ? virtualFileIdPageEntryClient : virtualFileIdPageEntryServer}${
|
|
92
|
+
const pageIdSerialized = serializePageId(pageId);
|
|
93
|
+
const id = `${isForClientSide ? virtualFileIdPageEntryClient : virtualFileIdPageEntryServer}${pageIdSerialized}`;
|
|
104
94
|
return id;
|
|
105
95
|
}
|
|
106
96
|
assert(false);
|
|
107
97
|
}
|
|
98
|
+
// Workaround:
|
|
99
|
+
// - We replace virtual:vike:page-entry:client:/ with virtual:vike:page-entry:client:ROOT
|
|
100
|
+
// - In order to avoid Vite to replace `virtual:vike:page-entry:client:/` with `virtual:vike:page-entry:client:`
|
|
101
|
+
// - I guess Vite/Rollup mistakenly treat the virtual ID as a path and tries to normalize id
|
|
102
|
+
const ROOT = 'ROOT';
|
|
103
|
+
function serializePageId(pageId) {
|
|
104
|
+
return pageId === '/' ? ROOT : pageId;
|
|
105
|
+
}
|
|
106
|
+
function deserializePageId(pageId) {
|
|
107
|
+
return pageId === ROOT ? '/' : pageId;
|
|
108
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.247-commit-a642bde";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.247-commit-a642bde';
|