vike 0.4.247-commit-dbcfa58 → 0.4.247-commit-87e5f2f
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/client/runtime-client-routing/history.d.ts +5 -7
- package/dist/client/runtime-client-routing/history.js +43 -80
- package/dist/client/runtime-client-routing/initOnPopState.js +4 -4
- package/dist/node/api/dev.d.ts +6 -0
- package/dist/node/api/dev.js +22 -9
- package/dist/node/vite/plugins/build/pluginModuleBanner.js +6 -5
- package/dist/node/vite/plugins/pluginCommon.d.ts +1 -1
- package/dist/node/vite/plugins/pluginCommon.js +3 -2
- package/dist/server/__internal/vite.d.ts +1 -0
- package/dist/server/__internal/vite.js +1 -0
- package/dist/server/runtime/renderPageServer.js +4 -0
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/package.json +5 -1
|
@@ -5,14 +5,12 @@ export { saveScrollPosition };
|
|
|
5
5
|
export { initHistory };
|
|
6
6
|
export type { HistoryInfo };
|
|
7
7
|
export type { ScrollPosition };
|
|
8
|
-
type VikeHistoryData = {
|
|
9
|
-
timestamp: number;
|
|
10
|
-
scrollPosition: null | ScrollPosition;
|
|
11
|
-
triggeredBy: 'user' | 'vike' | 'browser';
|
|
12
|
-
};
|
|
13
8
|
type StateEnhanced = {
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
vike: {
|
|
10
|
+
timestamp: number;
|
|
11
|
+
scrollPosition: null | ScrollPosition;
|
|
12
|
+
triggeredBy: 'user' | 'vike' | 'browser';
|
|
13
|
+
};
|
|
16
14
|
};
|
|
17
15
|
type ScrollPosition = {
|
|
18
16
|
x: number;
|
|
@@ -15,53 +15,17 @@ globalObject.previous = getHistoryInfo();
|
|
|
15
15
|
// - The very first render
|
|
16
16
|
// - Click on `<a href="#some-hash" />`
|
|
17
17
|
// - `location.hash = 'some-hash'`
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
18
|
+
function enhance() {
|
|
19
|
+
if (isEnhanced(window.history.state))
|
|
20
20
|
return;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!stateNotEnhanced) {
|
|
30
|
-
stateVikeEnhanced = {
|
|
31
|
-
_isVikeEnhanced: {
|
|
32
|
-
timestamp,
|
|
33
|
-
scrollPosition,
|
|
34
|
-
triggeredBy,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// State information may be incomplete if `window.history.state` is set by an old Vike version. (E.g. `state.timestamp` was introduced for `pageContext.isBackwardNavigation` in `0.4.19`.)
|
|
40
|
-
let oldVikeData;
|
|
41
|
-
if (isObject(stateNotEnhanced) && '_isVikeEnhanced' in stateNotEnhanced) {
|
|
42
|
-
if (isObject(stateNotEnhanced._isVikeEnhanced)) {
|
|
43
|
-
// New format: _isVikeEnhanced is an object with nested properties
|
|
44
|
-
oldVikeData = stateNotEnhanced._isVikeEnhanced;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
// Old format: _isVikeEnhanced is true, properties are on state root
|
|
48
|
-
oldVikeData = stateNotEnhanced;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
oldVikeData = {};
|
|
53
|
-
}
|
|
54
|
-
stateVikeEnhanced = {
|
|
55
|
-
...stateNotEnhanced,
|
|
56
|
-
_isVikeEnhanced: {
|
|
57
|
-
timestamp: oldVikeData.timestamp ?? timestamp,
|
|
58
|
-
scrollPosition: oldVikeData.scrollPosition ?? scrollPosition,
|
|
59
|
-
triggeredBy: oldVikeData.triggeredBy ?? triggeredBy,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
assertIsVikeEnhanced(stateVikeEnhanced);
|
|
64
|
-
return stateVikeEnhanced;
|
|
21
|
+
const stateEnhanced = {
|
|
22
|
+
vike: {
|
|
23
|
+
timestamp: getTimestamp(),
|
|
24
|
+
scrollPosition: getScrollPosition(),
|
|
25
|
+
triggeredBy: 'browser',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
replaceHistoryState(stateEnhanced);
|
|
65
29
|
}
|
|
66
30
|
function getState() {
|
|
67
31
|
const state = window.history.state;
|
|
@@ -70,7 +34,7 @@ function getState() {
|
|
|
70
34
|
// - Therefore, we have to monkey patch history.pushState() and history.replaceState()
|
|
71
35
|
// - Therefore, we need the assert() below to ensure history.state has been enhanced by Vike
|
|
72
36
|
// - If users stumble upon this assert() then let's make it a assertUsage()
|
|
73
|
-
|
|
37
|
+
assertIsEnhanced(state);
|
|
74
38
|
return state;
|
|
75
39
|
}
|
|
76
40
|
function getScrollPosition() {
|
|
@@ -84,15 +48,15 @@ function saveScrollPosition() {
|
|
|
84
48
|
const scrollPosition = getScrollPosition();
|
|
85
49
|
// Don't overwrite history.state if it was set by a non-Vike history.pushState() call.
|
|
86
50
|
// https://github.com/vikejs/vike/issues/2801#issuecomment-3490431479
|
|
87
|
-
if (!
|
|
51
|
+
if (!isEnhanced(window.history.state))
|
|
88
52
|
return;
|
|
89
53
|
const state = getState();
|
|
90
|
-
replaceHistoryState({ ...state,
|
|
54
|
+
replaceHistoryState({ ...state, vike: { ...state.vike, scrollPosition } });
|
|
91
55
|
}
|
|
92
56
|
function pushHistoryState(url, overwriteLastHistoryEntry) {
|
|
93
57
|
if (!overwriteLastHistoryEntry) {
|
|
94
58
|
const state = {
|
|
95
|
-
|
|
59
|
+
vike: {
|
|
96
60
|
timestamp: getTimestamp(),
|
|
97
61
|
// I don't remember why I set it to `null`, maybe because setting it now would be too early? (Maybe there is a delay between renderPageClient() is finished and the browser updating the scroll position.) Anyways, it seems like autoSaveScrollPosition() is enough.
|
|
98
62
|
scrollPosition: null,
|
|
@@ -110,7 +74,7 @@ function pushHistoryState(url, overwriteLastHistoryEntry) {
|
|
|
110
74
|
function replaceHistoryState(state, url) {
|
|
111
75
|
const url_ = url ?? null; // Passing `undefined` chokes older Edge versions.
|
|
112
76
|
window.history.replaceState(state, '', url_);
|
|
113
|
-
|
|
77
|
+
assertIsEnhanced(window.history.state);
|
|
114
78
|
}
|
|
115
79
|
function replaceHistoryStateOriginal(state, url) {
|
|
116
80
|
// Bypass all monkey patches.
|
|
@@ -126,42 +90,42 @@ function monkeyPatchHistoryAPI() {
|
|
|
126
90
|
globalObject.monkeyPatched = true;
|
|
127
91
|
['pushState', 'replaceState'].forEach((funcName) => {
|
|
128
92
|
const funcOriginal = window.history[funcName].bind(window.history);
|
|
129
|
-
window.history[funcName] = (
|
|
130
|
-
assertUsage(
|
|
131
|
-
const
|
|
132
|
-
?
|
|
93
|
+
window.history[funcName] = (stateFromUser = {}, ...rest) => {
|
|
94
|
+
assertUsage(stateFromUser === undefined || stateFromUser === null || isObject(stateFromUser), `history.${funcName}(state) argument state must be an object`);
|
|
95
|
+
const state = isEnhanced(stateFromUser)
|
|
96
|
+
? stateFromUser
|
|
133
97
|
: {
|
|
134
|
-
...
|
|
135
|
-
|
|
98
|
+
...stateFromUser,
|
|
99
|
+
vike: {
|
|
136
100
|
scrollPosition: getScrollPosition(),
|
|
137
101
|
timestamp: getTimestamp(),
|
|
138
102
|
triggeredBy: 'user',
|
|
139
|
-
...stateOriginal?._isVikeEnhanced,
|
|
140
103
|
},
|
|
141
104
|
};
|
|
142
|
-
|
|
143
|
-
funcOriginal(
|
|
144
|
-
|
|
105
|
+
assertIsEnhanced(state);
|
|
106
|
+
funcOriginal(state, ...rest);
|
|
107
|
+
// TO-DO/eventually remove excessive assertions to save client-side KBs
|
|
108
|
+
assert(isEqual(state, window.history.state));
|
|
145
109
|
globalObject.previous = getHistoryInfo();
|
|
146
110
|
// Workaround https://github.com/vikejs/vike/issues/2504#issuecomment-3149764736
|
|
147
111
|
queueMicrotask(() => {
|
|
148
|
-
if (isEqual(
|
|
112
|
+
if (isEqual(state, window.history.state))
|
|
149
113
|
return;
|
|
150
|
-
Object.assign(
|
|
151
|
-
|
|
152
|
-
replaceHistoryStateOriginal(
|
|
153
|
-
assert(isEqual(
|
|
114
|
+
Object.assign(state, window.history.state);
|
|
115
|
+
assertIsEnhanced(state);
|
|
116
|
+
replaceHistoryStateOriginal(state, rest[1]);
|
|
117
|
+
assert(isEqual(state, window.history.state));
|
|
154
118
|
});
|
|
155
119
|
};
|
|
156
120
|
});
|
|
157
121
|
}
|
|
158
122
|
function isEqual(state1, state2) {
|
|
159
|
-
return deepEqual(state1?.
|
|
123
|
+
return deepEqual(state1?.vike, state2?.vike);
|
|
160
124
|
}
|
|
161
|
-
function
|
|
162
|
-
if (state?.
|
|
125
|
+
function isEnhanced(state) {
|
|
126
|
+
if (state?.vike) {
|
|
163
127
|
/* We don't use the assert() below to save client-side KBs.
|
|
164
|
-
const vikeData = state.
|
|
128
|
+
const vikeData = state.vike
|
|
165
129
|
assert(isObject(vikeData))
|
|
166
130
|
assert(hasProp(vikeData, 'timestamp', 'number'))
|
|
167
131
|
assert(hasProp(vikeData, 'scrollPosition'))
|
|
@@ -174,8 +138,8 @@ function isVikeEnhanced(state) {
|
|
|
174
138
|
}
|
|
175
139
|
return false;
|
|
176
140
|
}
|
|
177
|
-
function
|
|
178
|
-
if (
|
|
141
|
+
function assertIsEnhanced(state) {
|
|
142
|
+
if (isEnhanced(state))
|
|
179
143
|
return;
|
|
180
144
|
assert(false, { state });
|
|
181
145
|
}
|
|
@@ -187,33 +151,32 @@ function getHistoryInfo() {
|
|
|
187
151
|
}
|
|
188
152
|
function onPopStateBegin() {
|
|
189
153
|
const { previous } = globalObject;
|
|
190
|
-
const
|
|
154
|
+
const isStateEnhanced = isEnhanced(window.history.state);
|
|
191
155
|
// Either:
|
|
192
156
|
// - `window.history.pushState(null, '', '/some-path')` , or
|
|
193
157
|
// - hash navigation
|
|
194
158
|
// - Click on `<a href="#some-hash">`
|
|
195
159
|
// - Using the `location` API (only hash navigation)
|
|
196
160
|
// See comments a the top of the ./initOnPopState.ts file.
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
161
|
+
const isStatePristine = window.history.state === null;
|
|
162
|
+
if (!isStateEnhanced && !isStatePristine) {
|
|
199
163
|
// Going to a history entry not created by Vike — entering another "SPA realm" => hard reload
|
|
200
164
|
// https://github.com/vikejs/vike/issues/2801#issuecomment-3490431479
|
|
201
165
|
redirectHard(getCurrentUrl());
|
|
202
166
|
return { skip: true };
|
|
203
167
|
}
|
|
204
|
-
if (!
|
|
205
|
-
|
|
206
|
-
assertIsVikeEnhanced(window.history.state);
|
|
168
|
+
if (!isStateEnhanced)
|
|
169
|
+
enhance();
|
|
207
170
|
const current = getHistoryInfo();
|
|
208
171
|
globalObject.previous = current;
|
|
209
172
|
// Let the browser handle hash navigations.
|
|
210
173
|
// - Upon hash navigation: `isHistoryStatePristine===true` (see comment above).
|
|
211
|
-
if (
|
|
174
|
+
if (isStatePristine) {
|
|
212
175
|
return { skip: true };
|
|
213
176
|
}
|
|
214
177
|
return { previous, current };
|
|
215
178
|
}
|
|
216
179
|
function initHistory() {
|
|
217
180
|
monkeyPatchHistoryAPI(); // the earlier we call it the better (Vike can workaround erroneous library monkey patches if Vike is the last one in the monkey patch chain)
|
|
218
|
-
|
|
181
|
+
enhance(); // enhance very first window.history.state which is `null`
|
|
219
182
|
}
|
|
@@ -37,18 +37,18 @@ async function onPopState() {
|
|
|
37
37
|
await handleHistoryNavigation(previous, current);
|
|
38
38
|
}
|
|
39
39
|
async function handleHistoryNavigation(previous, current) {
|
|
40
|
-
const scrollTarget = current.state.
|
|
40
|
+
const scrollTarget = current.state.vike.scrollPosition || undefined;
|
|
41
41
|
const isHashNavigation = removeHash(current.url) === removeHash(previous.url) && current.url !== previous.url;
|
|
42
42
|
if (isHashNavigation) {
|
|
43
43
|
// We have to scroll ourselves because we have set `window.history.scrollRestoration = 'manual'`
|
|
44
44
|
setScrollPosition(scrollTarget);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const isUserPushStateNavigation = current.state.
|
|
47
|
+
const isUserPushStateNavigation = current.state.vike.triggeredBy === 'user' || previous.state.vike.triggeredBy === 'user';
|
|
48
48
|
const doNotRenderIfSamePage = isUserPushStateNavigation;
|
|
49
|
-
const isBackwardNavigation = !current.state.
|
|
49
|
+
const isBackwardNavigation = !current.state.vike.timestamp || !previous.state.vike.timestamp
|
|
50
50
|
? null
|
|
51
|
-
: current.state.
|
|
51
|
+
: current.state.vike.timestamp < previous.state.vike.timestamp;
|
|
52
52
|
await renderPageClient({ scrollTarget, isBackwardNavigation, doNotRenderIfSamePage, isHistoryNavigation: true });
|
|
53
53
|
}
|
|
54
54
|
function removeHash(url) {
|
package/dist/node/api/dev.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { dev };
|
|
2
|
+
export { startupLog };
|
|
2
3
|
import { type ResolvedConfig, type ViteDevServer } from 'vite';
|
|
3
4
|
import type { ApiOptions } from './types.js';
|
|
4
5
|
/**
|
|
@@ -13,3 +14,8 @@ declare function dev(options?: ApiOptions & {
|
|
|
13
14
|
viteConfig: ResolvedConfig;
|
|
14
15
|
viteVersion: string;
|
|
15
16
|
}>;
|
|
17
|
+
declare function startupLog(resolvedUrls: ResolvedServerUrls, viteServer: ViteDevServer): Promise<void>;
|
|
18
|
+
interface ResolvedServerUrls {
|
|
19
|
+
local: string[];
|
|
20
|
+
network: string[];
|
|
21
|
+
}
|
package/dist/node/api/dev.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { dev };
|
|
2
|
+
// TO-DO/eventually: remove if it doesn't end up being used
|
|
3
|
+
export { startupLog };
|
|
2
4
|
import { prepareViteApiCall } from './prepareViteApiCall.js';
|
|
3
|
-
import { createServer
|
|
4
|
-
import {
|
|
5
|
-
import { colorVike, colorVite, PROJECT_VERSION } from './utils.js';
|
|
5
|
+
import { createServer } from 'vite';
|
|
6
|
+
import { assert, colorVike, colorVite, PROJECT_VERSION } from './utils.js';
|
|
6
7
|
import pc from '@brillout/picocolors';
|
|
7
8
|
import { processStartupLog } from '../vite/shared/loggerVite.js';
|
|
8
9
|
/**
|
|
@@ -11,23 +12,35 @@ import { processStartupLog } from '../vite/shared/loggerVite.js';
|
|
|
11
12
|
* https://vike.dev/api#dev
|
|
12
13
|
*/
|
|
13
14
|
async function dev(options = {}) {
|
|
14
|
-
const startTime = performance.now();
|
|
15
15
|
const { viteConfigFromUserResolved } = await prepareViteApiCall(options, 'dev');
|
|
16
16
|
const server = await createServer(viteConfigFromUserResolved);
|
|
17
|
-
const viteVersion = viteVersionUser ?? viteVersionVike;
|
|
18
17
|
const viteServer = server;
|
|
19
18
|
const viteConfig = server.config;
|
|
19
|
+
const viteVersion = viteConfig._viteVersionResolved;
|
|
20
|
+
assert(viteVersion);
|
|
20
21
|
if (viteServer.httpServer)
|
|
21
22
|
await viteServer.listen();
|
|
22
|
-
if (options.startupLog)
|
|
23
|
-
|
|
23
|
+
if (options.startupLog) {
|
|
24
|
+
if (viteServer.resolvedUrls) {
|
|
25
|
+
startupLog(viteServer.resolvedUrls, viteServer);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// TO-DO/eventually: remove if it doesn't end up being used
|
|
29
|
+
;
|
|
30
|
+
viteConfig.server.startupLog = (resolvedUrls) => startupLog(resolvedUrls, viteServer);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
24
33
|
return {
|
|
25
34
|
viteServer,
|
|
26
35
|
viteConfig,
|
|
27
36
|
viteVersion,
|
|
28
37
|
};
|
|
29
38
|
}
|
|
30
|
-
|
|
39
|
+
const startTime = performance.now();
|
|
40
|
+
async function startupLog(resolvedUrls, viteServer) {
|
|
41
|
+
const viteConfig = viteServer.config;
|
|
42
|
+
const viteVersion = viteConfig._viteVersionResolved;
|
|
43
|
+
assert(viteVersion);
|
|
31
44
|
const startupDurationString = pc.dim(`ready in ${pc.reset(pc.bold(String(Math.ceil(performance.now() - startTime))))} ms`);
|
|
32
45
|
const sep = pc.dim('·');
|
|
33
46
|
const firstLine = `\n ${colorVike('Vike')} ${pc.yellow(`v${PROJECT_VERSION}`)} ${sep} ${colorVite('Vite')} ${pc.cyan(`v${viteVersion}`)} ${sep} ${startupDurationString}\n`;
|
|
@@ -36,7 +49,7 @@ async function printStartupLog(viteServer, viteConfig, viteVersion, startTime) {
|
|
|
36
49
|
const { isCompact } = ret;
|
|
37
50
|
// We don't call viteServer.printUrls() because Vite throws an error if `resolvedUrls` is missing:
|
|
38
51
|
// https://github.com/vitejs/vite/blob/df5a30d2690a2ebc4824a79becdcef30538dc602/packages/vite/src/node/server/index.ts#L745
|
|
39
|
-
printServerUrls(
|
|
52
|
+
printServerUrls(resolvedUrls, viteConfig.server.host);
|
|
40
53
|
viteServer.bindCLIShortcuts({ print: true });
|
|
41
54
|
if (!isCompact)
|
|
42
55
|
console.log();
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { pluginModuleBanner };
|
|
2
2
|
import { assert, removeVirtualFileIdPrefix } from '../../utils.js';
|
|
3
3
|
import { getMagicString } from '../../shared/getMagicString.js';
|
|
4
|
-
//
|
|
5
|
-
//
|
|
4
|
+
// Misusing legal comments so that esbuild doesn't remove them.
|
|
5
|
+
// - Legal comments: https://esbuild.github.io/api/#legal-comments
|
|
6
|
+
// - Terser removes legal comments, but I guess users use terser to minify JavaScript so I guess it's a good thing that comment is removed.
|
|
7
|
+
// - Rollup's banner feature doesn't work with Vite: https://github.com/vitejs/vite/issues/8412
|
|
8
|
+
// - But, anyways, we want to prepend the banner at the beginning of each module, not at the beginning of each file (I believe that's what Rollup's banner feature does).
|
|
9
|
+
// - Potential alternative: https://github.com/vitejs/vite/issues/21228#issuecomment-3627899741
|
|
6
10
|
function pluginModuleBanner() {
|
|
7
11
|
let config;
|
|
8
12
|
let isEnabled = false;
|
|
@@ -39,9 +43,6 @@ function pluginModuleBanner() {
|
|
|
39
43
|
id = id.slice(config.root.length + 1);
|
|
40
44
|
id = id.replaceAll('*/', '*\\/'); // https://github.com/vikejs/vike/issues/2377
|
|
41
45
|
const { magicString, getMagicStringResult } = getMagicString(code, id);
|
|
42
|
-
// Use legal comment so that esbuild doesn't remove it.
|
|
43
|
-
// - Terser still removes the comment, but I guess users use terser to minify JavaScript so I guess it's a good thing that comment is removed.
|
|
44
|
-
// - https://esbuild.github.io/api/#legal-comments
|
|
45
46
|
magicString.prepend(`/*! ${id} [vike:pluginModuleBanner] */\n`);
|
|
46
47
|
return getMagicStringResult();
|
|
47
48
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { pluginCommon };
|
|
2
|
-
export declare let viteVersionUser: string | null | undefined;
|
|
3
2
|
import { type InlineConfig, type Plugin } from 'vite';
|
|
4
3
|
import type { VitePluginServerEntryOptions } from '@brillout/vite-plugin-server-entry/plugin';
|
|
5
4
|
declare module 'vite' {
|
|
@@ -9,6 +8,7 @@ declare module 'vite' {
|
|
|
9
8
|
_rootResolvedEarly?: string;
|
|
10
9
|
_baseViteOriginal?: string;
|
|
11
10
|
_viteConfigFromUserResolved?: InlineConfig;
|
|
11
|
+
_viteVersionResolved?: string;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
declare global {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { pluginCommon };
|
|
2
|
-
export let viteVersionUser = null;
|
|
3
2
|
import { assert, assertUsage, assertWarning, hasProp, isDevCheck, isDocker, isExactlyOneTruthy, isObject, isVitest, } from '../utils.js';
|
|
4
3
|
import { assertRollupInput } from './build/pluginBuildConfig.js';
|
|
5
4
|
import { installRequireShim_setUserRootDir } from '@brillout/require-shim';
|
|
@@ -10,6 +9,7 @@ import { isVikeCliOrApi } from '../../../shared-server-node/api-context.js';
|
|
|
10
9
|
import { getVikeConfigInternal, setVikeConfigContext } from '../shared/resolveVikeConfigInternal.js';
|
|
11
10
|
import { assertViteRoot, getViteRoot, normalizeViteRoot } from '../../api/resolveViteConfigFromUser.js';
|
|
12
11
|
import { temp_disablePrerenderAutoRun } from '../../prerender/context.js';
|
|
12
|
+
import { version as viteVersionVike } from 'vite';
|
|
13
13
|
const pluginName = 'vike:pluginCommon';
|
|
14
14
|
globalThis.__VIKE__IS_PROCESS_SHARED_WITH_VITE = true;
|
|
15
15
|
function pluginCommon(vikeVitePluginOptions) {
|
|
@@ -20,7 +20,7 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
20
20
|
config: {
|
|
21
21
|
order: 'pre',
|
|
22
22
|
async handler(configFromUser, env) {
|
|
23
|
-
viteVersionUser = this?.meta?.viteVersion; // is `undefined` on old Vite versions
|
|
23
|
+
const viteVersionUser = this?.meta?.viteVersion; // is `undefined` on old Vite versions
|
|
24
24
|
const isDev = isDevCheck(env);
|
|
25
25
|
const isBuild = env.command === 'build';
|
|
26
26
|
const isPreview = env.isPreview;
|
|
@@ -34,6 +34,7 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
34
34
|
const vikeConfig = await getVikeConfigInternal();
|
|
35
35
|
return {
|
|
36
36
|
_isDev: isDev,
|
|
37
|
+
_viteVersionResolved: viteVersionUser || viteVersionVike,
|
|
37
38
|
_rootResolvedEarly: rootResolvedEarly,
|
|
38
39
|
// TO-DO/next-major-release: remove https://github.com/vikejs/vike/issues/2122
|
|
39
40
|
configVikePromise: Promise.resolve({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { startupLog } from '../../node/api/dev.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { startupLog } from '../../node/api/dev.js';
|
|
@@ -220,6 +220,10 @@ function logHttpRequest(urlOriginal, pageContextInit, requestId) {
|
|
|
220
220
|
logRuntimeInfo?.(getRequestInfoMessage(urlOriginal), pageContext_logRuntime, 'info');
|
|
221
221
|
}
|
|
222
222
|
/*
|
|
223
|
+
const arrowRight = pc.dim('→')
|
|
224
|
+
const arrowLeft = pc.dim('←')
|
|
225
|
+
*/
|
|
226
|
+
/*
|
|
223
227
|
const arrowRight = pc.dim('>>')
|
|
224
228
|
const arrowLeft = pc.dim('<<')
|
|
225
229
|
/*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.247-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.247-commit-87e5f2f";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.247-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.247-commit-87e5f2f';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.247-commit-
|
|
3
|
+
"version": "0.4.247-commit-87e5f2f",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -104,6 +104,10 @@
|
|
|
104
104
|
"types": "./dist/server/runtime/page-files/setup.d.ts",
|
|
105
105
|
"default": "./dist/server/runtime/page-files/setup.js"
|
|
106
106
|
},
|
|
107
|
+
"./__internal/vite": {
|
|
108
|
+
"types": "./dist/server/__internal/vite.d.ts",
|
|
109
|
+
"default": "./dist/server/__internal/vite.js"
|
|
110
|
+
},
|
|
107
111
|
".": {
|
|
108
112
|
"worker": "./dist/server/runtime/index.js",
|
|
109
113
|
"workerd": "./dist/server/runtime/index.js",
|