vike 0.4.259-commit-dcc116b → 0.4.259-commit-286bd57
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/node/api/build.js +6 -6
- package/dist/node/api/dev.js +2 -2
- package/dist/node/api/prepareViteApiCall.d.ts +1 -1
- package/dist/node/api/prepareViteApiCall.js +2 -2
- package/dist/node/api/prerender.js +2 -2
- package/dist/node/api/preview.js +2 -2
- package/dist/node/api/{resolveViteConfigFromUser.d.ts → resolveViteConfigUser.d.ts} +5 -5
- package/dist/node/api/{resolveViteConfigFromUser.js → resolveViteConfigUser.js} +68 -73
- package/dist/node/createDevMiddleware.js +2 -2
- package/dist/node/prerender/runPrerenderEntry.js +2 -2
- package/dist/node/vite/index.js +2 -2
- package/dist/node/vite/plugins/build/pluginBuildApp.js +2 -2
- package/dist/node/vite/plugins/pluginCommon.d.ts +1 -1
- package/dist/node/vite/plugins/pluginCommon.js +1 -1
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
package/dist/node/api/build.js
CHANGED
|
@@ -8,16 +8,16 @@ import './assertEnvApiDev.js';
|
|
|
8
8
|
* https://vike.dev/api#build
|
|
9
9
|
*/
|
|
10
10
|
async function build(options = {}) {
|
|
11
|
-
const {
|
|
11
|
+
const { viteConfigUser } = await prepareViteApiCall(options, 'build');
|
|
12
12
|
// Pass it to vike:build:pluginBuildApp
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
const builder = await createBuilder(
|
|
13
|
+
if (viteConfigUser)
|
|
14
|
+
viteConfigUser._viteConfigUser = viteConfigUser;
|
|
15
|
+
const builder = await createBuilder(viteConfigUser);
|
|
16
16
|
// buildApp() is implemented by vike:build:pluginBuildApp
|
|
17
17
|
await builder.buildApp();
|
|
18
18
|
return {
|
|
19
|
-
/* We don't return `viteConfig` because `
|
|
20
|
-
viteConfig:
|
|
19
|
+
/* We don't return `viteConfig` because `viteConfigUser` is `InlineConfig` not `ResolvedConfig`
|
|
20
|
+
viteConfig: viteConfigUser,
|
|
21
21
|
*/
|
|
22
22
|
};
|
|
23
23
|
}
|
package/dist/node/api/dev.js
CHANGED
|
@@ -15,8 +15,8 @@ assertIsNotProductionRuntime();
|
|
|
15
15
|
* https://vike.dev/api#dev
|
|
16
16
|
*/
|
|
17
17
|
async function dev(options = {}) {
|
|
18
|
-
const {
|
|
19
|
-
const server = await createServer(
|
|
18
|
+
const { viteConfigUser } = await prepareViteApiCall(options, 'dev');
|
|
19
|
+
const server = await createServer(viteConfigUser);
|
|
20
20
|
const viteServer = server;
|
|
21
21
|
const viteConfig = server.config;
|
|
22
22
|
const viteVersion = viteConfig._viteVersionResolved;
|
|
@@ -3,5 +3,5 @@ import type { ApiOptions, ApiOperation } from './types.js';
|
|
|
3
3
|
import './assertEnvApiDevAndProd.js';
|
|
4
4
|
declare function prepareViteApiCall(options: ApiOptions, operation: ApiOperation): Promise<{
|
|
5
5
|
viteConfigResolved: import("vite").ResolvedConfig;
|
|
6
|
-
|
|
6
|
+
viteConfigUser: import("vite").UserConfig;
|
|
7
7
|
}>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { prepareViteApiCall };
|
|
2
2
|
import { clearContextVikeApiOperation, setContextVikeApiOperation } from '../../shared-server-node/api-context.js';
|
|
3
3
|
import { clearGlobalContext } from '../../server/runtime/globalContext.js';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveViteConfigUser } from './resolveViteConfigUser.js';
|
|
5
5
|
import './assertEnvApiDevAndProd.js';
|
|
6
6
|
async function prepareViteApiCall(options, operation) {
|
|
7
7
|
clear();
|
|
8
8
|
setContextVikeApiOperation(operation, options);
|
|
9
|
-
return
|
|
9
|
+
return resolveViteConfigUser();
|
|
10
10
|
}
|
|
11
11
|
// For subsequent API calls, e.g. calling prerender() after build()
|
|
12
12
|
function clear() {
|
|
@@ -8,8 +8,8 @@ import './assertEnvApiDevAndProd.js';
|
|
|
8
8
|
* https://vike.dev/api#prerender
|
|
9
9
|
*/
|
|
10
10
|
async function prerender(options = {}) {
|
|
11
|
-
const {
|
|
12
|
-
options.viteConfig =
|
|
11
|
+
const { viteConfigUser } = await prepareViteApiCall(options, 'prerender');
|
|
12
|
+
options.viteConfig = viteConfigUser;
|
|
13
13
|
const { viteConfig } = await runPrerenderFromAPI(options);
|
|
14
14
|
return {
|
|
15
15
|
viteConfig,
|
package/dist/node/api/preview.js
CHANGED
|
@@ -19,7 +19,7 @@ import { getStartupLogFirstLine } from './getStartupLogFirstLine.js';
|
|
|
19
19
|
*/
|
|
20
20
|
async function preview(options = {}) {
|
|
21
21
|
onSetupPreview();
|
|
22
|
-
const {
|
|
22
|
+
const { viteConfigUser, viteConfigResolved } = await prepareViteApiCall(options, 'preview');
|
|
23
23
|
const vikeConfig = await getVikeConfigInternal();
|
|
24
24
|
const cliPreviewConfig = await resolveCliPreviewConfig(vikeConfig);
|
|
25
25
|
assertUsage(cliPreviewConfig !== false, `${pc.cyan('$ vike preview')} isn't supported`);
|
|
@@ -53,7 +53,7 @@ async function preview(options = {}) {
|
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
// Use Vite's preview server
|
|
56
|
-
const server = await previewVite(
|
|
56
|
+
const server = await previewVite(viteConfigUser);
|
|
57
57
|
logHint(vikeConfig.prerenderContext.isPrerenderingEnabledForAllPages
|
|
58
58
|
? ' — your app is fully pre-rendered and can be statically deployed.'
|
|
59
59
|
: '', isStartupLogCompact);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { resolveViteConfigUser };
|
|
2
|
+
export { isResolvingViteConfigUser };
|
|
3
3
|
export { getVikeConfigInternalEarly };
|
|
4
4
|
export { getViteRoot };
|
|
5
5
|
export { assertViteRoot };
|
|
6
6
|
export { normalizeViteRoot };
|
|
7
7
|
import type { ResolvedConfig, UserConfig } from 'vite';
|
|
8
8
|
import './assertEnvApiDevAndProd.js';
|
|
9
|
-
declare function
|
|
9
|
+
declare function resolveViteConfigUser(): Promise<{
|
|
10
10
|
viteConfigResolved: ResolvedConfig;
|
|
11
|
-
|
|
11
|
+
viteConfigUser: UserConfig;
|
|
12
12
|
}>;
|
|
13
13
|
declare function getVikeConfigInternalEarly(): Promise<import("../vite/shared/resolveVikeConfigInternal.js").VikeConfigInternal>;
|
|
14
|
-
declare function
|
|
14
|
+
declare function isResolvingViteConfigUser(): boolean | undefined;
|
|
15
15
|
declare function getViteRoot(viteContext: ViteContext): Promise<string>;
|
|
16
16
|
type ViteContext = 'build' | 'preview' | 'dev';
|
|
17
17
|
declare function normalizeViteRoot(root: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { resolveViteConfigUser };
|
|
2
|
+
export { isResolvingViteConfigUser };
|
|
3
3
|
export { getVikeConfigInternalEarly };
|
|
4
4
|
export { getViteRoot };
|
|
5
5
|
export { assertViteRoot };
|
|
@@ -16,96 +16,95 @@ import { getEnvVarObject } from '../vite/shared/getEnvVarObject.js';
|
|
|
16
16
|
import { getVikeApiOperation, isVikeCliOrApi } from '../../shared-server-node/api-context.js';
|
|
17
17
|
import { getViteCliCommand, getViteCliArgs } from '../vite/shared/isViteCli.js';
|
|
18
18
|
import './assertEnvApiDevAndProd.js';
|
|
19
|
-
const globalObject = getGlobalObject('
|
|
20
|
-
async function
|
|
19
|
+
const globalObject = getGlobalObject('resolveViteConfigUser.ts', {});
|
|
20
|
+
async function resolveViteConfigUser() {
|
|
21
21
|
const { viteContext } = getVikeApiContext();
|
|
22
22
|
assert(viteContext);
|
|
23
|
-
const
|
|
24
|
-
const {
|
|
25
|
-
const { viteConfigResolved } = await assertViteRoot2(viteInfo.root, viteConfigFromUserResolved, viteContext);
|
|
23
|
+
const { viteConfigUser, root } = await resolve(viteContext);
|
|
24
|
+
const { viteConfigResolved } = await assertViteRoot2(root, viteConfigUser, viteContext);
|
|
26
25
|
return {
|
|
27
26
|
viteConfigResolved, // ONLY USE if strictly necessary. (We plan to remove assertViteRoot2() as explained in the comments of that function.)
|
|
28
|
-
|
|
27
|
+
viteConfigUser,
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
async function getVikeConfigInternalEarly() {
|
|
32
|
-
assert(!globalObject.
|
|
31
|
+
assert(!globalObject.isResolvingViteConfigUser); // ensure no infinite loop
|
|
33
32
|
if (!isVikeConfigContextSet()) {
|
|
34
33
|
const viteContext = getViteContext();
|
|
35
|
-
const
|
|
36
|
-
setVikeConfigContext_(
|
|
34
|
+
const resolved = await resolve(viteContext);
|
|
35
|
+
setVikeConfigContext_(resolved, viteContext);
|
|
37
36
|
}
|
|
38
37
|
return await getVikeConfigInternal();
|
|
39
38
|
}
|
|
40
|
-
function setVikeConfigContext_(
|
|
39
|
+
function setVikeConfigContext_(resolved, viteContext) {
|
|
41
40
|
setVikeConfigContext({
|
|
42
|
-
userRootDir:
|
|
41
|
+
userRootDir: resolved.root,
|
|
43
42
|
isDev: viteContext === 'dev',
|
|
44
|
-
vikeVitePluginOptions:
|
|
43
|
+
vikeVitePluginOptions: resolved.vikeVitePluginOptions,
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
|
-
function
|
|
48
|
-
return globalObject.
|
|
46
|
+
function isResolvingViteConfigUser() {
|
|
47
|
+
return globalObject.isResolvingViteConfigUser;
|
|
49
48
|
}
|
|
50
49
|
async function getViteRoot(viteContext) {
|
|
51
50
|
if (!globalObject.root)
|
|
52
|
-
await
|
|
51
|
+
await resolve(viteContext);
|
|
53
52
|
assert(globalObject.root);
|
|
54
53
|
return globalObject.root;
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
// TODO rename_all viteConfigFromUser viteConfigFrom
|
|
58
|
-
// TODO rename_all vikeConfigFromUser vikeConfigFrom
|
|
59
|
-
async function getViteInfo(viteContext) {
|
|
55
|
+
async function resolve(viteContext) {
|
|
60
56
|
// Precedence:
|
|
61
|
-
// 1. (highest precedence) |
|
|
62
|
-
// 2. | viteConfigFromVikeCliOrEnv
|
|
63
|
-
// 3. |
|
|
64
|
-
// 4. |
|
|
65
|
-
// 5. (lowest precedence) |
|
|
66
|
-
let
|
|
57
|
+
// 1. (highest precedence) | viteConfigFromViteEnv | VITE_CONFIG
|
|
58
|
+
// 2. | viteConfigFromVikeCliOrEnv | VIKE_CONFIG & Vike CLI options — `+mode` & `+root`
|
|
59
|
+
// 3. | viteConfigFromViteCli | Vite CLI args — `[root]` & `-c/--config`
|
|
60
|
+
// 4. | viteConfigFromVikeApi | Vike API options — `viteConfig`, and `+mode` & `+root` from `vikeConfig`
|
|
61
|
+
// 5. (lowest precedence) | viteConfigFromViteFile | vite.config.js
|
|
62
|
+
let viteConfigUser = {};
|
|
63
|
+
const addConfig = (c) => {
|
|
64
|
+
// Merge `c` overriding viteConfigUser (`c` wins — higher precedence)
|
|
65
|
+
viteConfigUser = mergeConfig(viteConfigUser, c ?? {});
|
|
66
|
+
};
|
|
67
|
+
const underride = (c) => {
|
|
68
|
+
// Merge `c` underiding viteConfigUser (`c` loses — lower precedence)
|
|
69
|
+
return mergeConfig(c ?? {}, viteConfigUser);
|
|
70
|
+
};
|
|
67
71
|
// Vike API args
|
|
68
|
-
const { viteConfigFromUserVikeApiOptions, vikeConfigFromUserVikeApiOptions } = getVikeApiContext();
|
|
69
|
-
// - Resolve `viteConfig` set over Vike's API
|
|
70
|
-
viteConfigFromUserResolved = merge(viteConfigFromUserResolved, viteConfigFromUserVikeApiOptions ?? {});
|
|
71
|
-
// - Resolve +mode/+root set over Vike's API
|
|
72
72
|
{
|
|
73
|
-
const
|
|
74
|
-
|
|
73
|
+
const { viteConfigFromVikeApi, vikeConfigFromApi } = getVikeApiContext();
|
|
74
|
+
addConfig(viteConfigFromVikeApi); // `viteConfig`
|
|
75
|
+
addConfig(pick(vikeConfigFromApi ?? {}, EARLY_SETTINGS)); // `+mode` & `+root`
|
|
75
76
|
}
|
|
76
77
|
// Vite CLI args (when invoked via Vite's CLI rather than Vike's API).
|
|
77
78
|
// - Without this, Vike loads vite.config.js blind to `vite [root]` / `-c <file>` and ends up with the wrong root when those Vite CLI args are used.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
{
|
|
80
|
+
const viteConfigFromViteCli = getViteCliArgs();
|
|
81
|
+
addConfig(viteConfigFromViteCli);
|
|
81
82
|
}
|
|
82
|
-
// Vike's CLI and VIKE_CONFIG
|
|
83
|
-
// - Resolve +mode/+root set over Vike's CLI or VIKE_CONFIG
|
|
83
|
+
// Vike's CLI and VIKE_CONFIG — `+mode` & `+root`
|
|
84
84
|
{
|
|
85
85
|
const viteConfigFromVikeCliOrEnv = pick(getVikeConfigFromCliOrEnv().vikeConfigFromCliOrEnv, EARLY_SETTINGS);
|
|
86
|
-
|
|
87
|
-
viteConfigFromUserResolved = merge(viteConfigFromUserResolved ?? {}, viteConfigFromVikeCliOrEnv);
|
|
88
|
-
}
|
|
86
|
+
addConfig(viteConfigFromVikeCliOrEnv);
|
|
89
87
|
}
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
// VITE_CONFIG
|
|
89
|
+
{
|
|
90
|
+
const viteConfigFromViteEnv = getEnvVarObject('VITE_CONFIG');
|
|
91
|
+
addConfig(viteConfigFromViteEnv);
|
|
94
92
|
}
|
|
95
|
-
//
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
93
|
+
// vite.config.js — lowest precedence. Merged into a *separate* result (used only to compute `root` and to
|
|
94
|
+
// find the Vike plugin): it must not flow back into `viteConfigUser`, which is handed to Vite —
|
|
95
|
+
// Vite loads vite.config.js itself, so merging it here would add the Vike plugin twice.
|
|
96
|
+
// Replicates Vite: https://github.com/vitejs/vite/blob/4f5845a3182fc950eb9cd76d7161698383113b18/packages/vite/src/node/config.ts#L1001
|
|
97
|
+
globalObject.isResolvingViteConfigUser = true;
|
|
98
|
+
const viteConfigFromViteFile = await loadViteConfigFile(viteConfigUser, viteContext);
|
|
99
|
+
globalObject.isResolvingViteConfigUser = false;
|
|
100
|
+
const viteConfigAll = underride(viteConfigFromViteFile ?? {});
|
|
101
|
+
const root = normalizeViteRoot(viteConfigAll.root ?? process.cwd());
|
|
103
102
|
globalObject.root = root;
|
|
104
103
|
// - Find options `vike(options)` set in vite.config.js
|
|
105
104
|
// - TO-DO/next-major-release: remove
|
|
106
105
|
// - Add Vike's Vite plugin if missing
|
|
107
106
|
let vikeVitePluginOptions;
|
|
108
|
-
const found = findVikeVitePlugin(
|
|
107
|
+
const found = findVikeVitePlugin(viteConfigAll);
|
|
109
108
|
if (found) {
|
|
110
109
|
vikeVitePluginOptions = found.vikeVitePluginOptions;
|
|
111
110
|
}
|
|
@@ -113,25 +112,21 @@ async function getViteInfo(viteContext) {
|
|
|
113
112
|
// Show a warning because Vike supports Vite's CLI (as well as third-party CLIs).
|
|
114
113
|
// - Encourage users to define a vite.config.js file that also works with Vite's CLI (and potentially other third-party CLIs).
|
|
115
114
|
// - Vike-based frameworks, such as DocPress, allow their users to omit defining a vite.config.js file.
|
|
116
|
-
assertWarning(!
|
|
115
|
+
assertWarning(!viteConfigFromViteFile, // Only show the warning if the user defined a vite.config.js file
|
|
117
116
|
"Omitting Vike's Vite plugin (inside your vite.config.js) is deprecated — make sure to always add Vike's Vite plugin https://vike.dev/vite-plugin", { onlyOnce: true });
|
|
118
117
|
// Add Vike to plugins if not present.
|
|
119
118
|
// Using a dynamic import because the script calling the Vike API may not live in the same place as vite.config.js, thus vike/plugin may resolved to two different node_modules/vike directories.
|
|
120
119
|
const { plugin: vikePlugin } = await import('../vite/index.js');
|
|
121
|
-
|
|
122
|
-
...
|
|
123
|
-
plugins: [...(
|
|
120
|
+
viteConfigUser = {
|
|
121
|
+
...viteConfigUser,
|
|
122
|
+
plugins: [...(viteConfigUser?.plugins ?? []), vikePlugin()],
|
|
124
123
|
};
|
|
125
|
-
const res = findVikeVitePlugin(
|
|
124
|
+
const res = findVikeVitePlugin(viteConfigUser);
|
|
126
125
|
assert(res);
|
|
127
126
|
vikeVitePluginOptions = res.vikeVitePluginOptions;
|
|
128
127
|
}
|
|
129
128
|
assert(vikeVitePluginOptions);
|
|
130
|
-
return { root, vikeVitePluginOptions
|
|
131
|
-
}
|
|
132
|
-
/** `c2` overrides `c1` */
|
|
133
|
-
function merge(c1, c2) {
|
|
134
|
-
return mergeConfig(c1, c2);
|
|
129
|
+
return { viteConfigUser, root, vikeVitePluginOptions };
|
|
135
130
|
}
|
|
136
131
|
function findVikeVitePlugin(viteConfig) {
|
|
137
132
|
let vikeVitePluginOptions;
|
|
@@ -149,8 +144,8 @@ function findVikeVitePlugin(viteConfig) {
|
|
|
149
144
|
return { vikeVitePluginOptions };
|
|
150
145
|
}
|
|
151
146
|
// Copied from https://github.com/vitejs/vite/blob/4f5845a3182fc950eb9cd76d7161698383113b18/packages/vite/src/node/config.ts#L961-L1005
|
|
152
|
-
async function loadViteConfigFile(
|
|
153
|
-
const viteContextResolved = resolveViteContext(
|
|
147
|
+
async function loadViteConfigFile(viteConfigUser, viteContext) {
|
|
148
|
+
const viteContextResolved = resolveViteContext(viteConfigUser, viteContext);
|
|
154
149
|
const [inlineConfig, command, defaultMode, _defaultNodeEnv, isPreview] = viteContextResolved;
|
|
155
150
|
let config = inlineConfig;
|
|
156
151
|
let mode = inlineConfig.mode || defaultMode;
|
|
@@ -206,12 +201,12 @@ function getViteContextWithOperation(operation) {
|
|
|
206
201
|
function getVikeApiContext() {
|
|
207
202
|
const vikeApiOperation = getVikeApiOperation();
|
|
208
203
|
if (!vikeApiOperation)
|
|
209
|
-
return {
|
|
204
|
+
return { viteConfigFromVikeApi: null, vikeConfigFromApi: null, viteContext: null };
|
|
210
205
|
const { options, operation } = vikeApiOperation;
|
|
211
|
-
const
|
|
212
|
-
const
|
|
206
|
+
const viteConfigFromVikeApi = options.viteConfig;
|
|
207
|
+
const vikeConfigFromApi = options.vikeConfig;
|
|
213
208
|
const viteContext = getViteContextWithOperation(operation);
|
|
214
|
-
return {
|
|
209
|
+
return { viteConfigFromVikeApi, vikeConfigFromApi, viteContext };
|
|
215
210
|
}
|
|
216
211
|
function resolveViteContext(inlineConfig = {}, viteContext) {
|
|
217
212
|
const isBuild = viteContext === 'build';
|
|
@@ -224,15 +219,15 @@ function resolveViteContext(inlineConfig = {}, viteContext) {
|
|
|
224
219
|
return viteContextResolved;
|
|
225
220
|
}
|
|
226
221
|
function normalizeViteRoot(root) {
|
|
227
|
-
// `path.resolve(
|
|
222
|
+
// `path.resolve(viteConfigUserViteFile.configFile, root)` could be more intuitive than `path.resolve(process.cwd(), root)` but we replicate Vite's behavior (`vite.config.js` should follow Vite's API), see:
|
|
228
223
|
// https://github.com/vitejs/vite/blob/4f5845a3182fc950eb9cd76d7161698383113b18/packages/vite/src/node/config.ts#L1063
|
|
229
224
|
return toPosixPath(
|
|
230
225
|
// Equivalent to `path.resolve(process.cwd(), root)`
|
|
231
226
|
path.resolve(root));
|
|
232
227
|
}
|
|
233
228
|
const errMsg = `A Vite plugin is modifying the Vite setting ${pc.cyan('root')} which is forbidden`;
|
|
234
|
-
async function assertViteRoot2(root,
|
|
235
|
-
const viteContextResolved = resolveViteContext(
|
|
229
|
+
async function assertViteRoot2(root, viteConfigUser, viteContext) {
|
|
230
|
+
const viteContextResolved = resolveViteContext(viteConfigUser, viteContext);
|
|
236
231
|
// We can eventually remove this resolveConfig() call (along with removing the whole assertViteRoot2() function which is redundant with the assertViteRoot() function) so that Vike doesn't make any resolveConfig() (except for pre-rendering and preview which is required). But let's keep it for now, just to see whether calling resolveConfig() can be problematic.
|
|
237
232
|
const viteConfigResolved = await resolveConfig(...viteContextResolved);
|
|
238
233
|
assertUsage(normalizeViteRoot(viteConfigResolved.root) === normalizeViteRoot(root), errMsg);
|
|
@@ -18,8 +18,8 @@ async function createDevMiddleware(options = {}) {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
-
const {
|
|
22
|
-
const server = await createServer(
|
|
21
|
+
const { viteConfigUser } = await prepareViteApiCall(optionsMod, 'dev');
|
|
22
|
+
const server = await createServer(viteConfigUser);
|
|
23
23
|
const devMiddleware = server.middlewares;
|
|
24
24
|
return { devMiddleware, viteServer: server, viteConfig: server.config };
|
|
25
25
|
}
|
|
@@ -19,8 +19,8 @@ async function runPrerenderFromAPI(options = {}) {
|
|
|
19
19
|
}
|
|
20
20
|
async function runPrerenderFromCLIPrerenderCommand() {
|
|
21
21
|
try {
|
|
22
|
-
const {
|
|
23
|
-
await runPrerender({ viteConfig:
|
|
22
|
+
const { viteConfigUser } = await prepareViteApiCall({}, 'prerender');
|
|
23
|
+
await runPrerender({ viteConfig: viteConfigUser }, '$ vike prerender');
|
|
24
24
|
}
|
|
25
25
|
catch (err) {
|
|
26
26
|
// Error may come from user-land
|
package/dist/node/vite/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import { pluginReplaceConstantsNonRunnableDev } from './plugins/non-runnable-dev
|
|
|
37
37
|
import { isVikeCliOrApi } from '../../shared-server-node/api-context.js';
|
|
38
38
|
import { pluginViteConfigVikeExtensions } from './plugins/pluginViteConfigVikeExtensions.js';
|
|
39
39
|
import { pluginStripPointerImportAttribute } from './plugins/pluginStripPointerImportAttribute.js';
|
|
40
|
-
import { getVikeConfigInternalEarly,
|
|
40
|
+
import { getVikeConfigInternalEarly, isResolvingViteConfigUser } from '../api/resolveViteConfigUser.js';
|
|
41
41
|
import './assertEnvVite.js';
|
|
42
42
|
import { isStorybook } from '../../utils/isStorybook.js';
|
|
43
43
|
import { pluginUniversalDeploy } from './plugins/pluginUniversalDeploy.js';
|
|
@@ -96,7 +96,7 @@ function pluginNonRunnabeDev() {
|
|
|
96
96
|
}
|
|
97
97
|
function removeVitePlugin() {
|
|
98
98
|
// Early resolving of user Vite configs
|
|
99
|
-
if (
|
|
99
|
+
if (isResolvingViteConfigUser()) {
|
|
100
100
|
return true;
|
|
101
101
|
}
|
|
102
102
|
// *****************/
|
|
@@ -166,8 +166,8 @@ function isPrerenderForceExit() {
|
|
|
166
166
|
}
|
|
167
167
|
function getFullBuildInlineConfig(config) {
|
|
168
168
|
const configFromCli = !isViteCli() ? null : getViteBuildCliArgs();
|
|
169
|
-
if (config.
|
|
170
|
-
return config.
|
|
169
|
+
if (config._viteConfigUser) {
|
|
170
|
+
return config._viteConfigUser;
|
|
171
171
|
}
|
|
172
172
|
else {
|
|
173
173
|
return {
|
|
@@ -9,7 +9,7 @@ import { assertRollupInput } from './build/pluginBuildConfig.js';
|
|
|
9
9
|
import pc from '@brillout/picocolors';
|
|
10
10
|
import { assertResolveAlias } from './pluginCommon/assertResolveAlias.js';
|
|
11
11
|
import { getVikeConfigInternal, setVikeConfigContext } from '../shared/resolveVikeConfigInternal.js';
|
|
12
|
-
import { assertViteRoot, getViteRoot, normalizeViteRoot } from '../../api/
|
|
12
|
+
import { assertViteRoot, getViteRoot, normalizeViteRoot } from '../../api/resolveViteConfigUser.js';
|
|
13
13
|
import { temp_disablePrerenderAutoRun } from '../../prerender/context.js';
|
|
14
14
|
import { version as viteVersionVike } from 'vite';
|
|
15
15
|
import '../assertEnvVite.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.259-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.259-commit-286bd57";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.259-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.259-commit-286bd57';
|