vike 0.4.216 → 0.4.217-commit-99ea561
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/api/build.js +4 -2
- package/dist/cjs/node/api/prepareViteApiCall.js +14 -4
- package/dist/cjs/node/plugin/index.js +5 -7
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +15 -12
- package/dist/cjs/node/plugin/plugins/baseUrls.js +17 -12
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +1 -1
- package/dist/cjs/node/plugin/plugins/buildConfig.js +4 -5
- package/dist/cjs/node/plugin/plugins/commonConfig.js +14 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +4 -7
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +2 -2
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +8 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +8 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +9 -13
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +15 -102
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveVikeConfigGlobal.js +128 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +42 -28
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -1
- package/dist/cjs/node/plugin/plugins/previewConfig.js +4 -3
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +4 -1
- package/dist/cjs/node/prerender/runPrerender.js +2 -4
- package/dist/cjs/node/runtime/globalContext.js +16 -8
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +1 -1
- package/dist/cjs/node/shared/resolveBase.js +41 -0
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/node/api/build.js +4 -2
- package/dist/esm/node/api/prepareViteApiCall.d.ts +1 -1
- package/dist/esm/node/api/prepareViteApiCall.js +14 -4
- package/dist/esm/node/plugin/index.d.ts +3 -3
- package/dist/esm/node/plugin/index.js +3 -5
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +15 -12
- package/dist/esm/node/plugin/plugins/baseUrls.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/baseUrls.js +17 -12
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +1 -1
- package/dist/esm/node/plugin/plugins/buildConfig.js +4 -5
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +7 -1
- package/dist/esm/node/plugin/plugins/commonConfig.js +15 -2
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/esm/node/plugin/plugins/devConfig/index.js +1 -1
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +4 -7
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.d.ts +3 -2
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.js +2 -2
- package/dist/esm/node/plugin/plugins/importBuild/index.js +8 -6
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +8 -8
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +11 -15
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +15 -102
- package/dist/esm/{shared/ConfigVike.d.ts → node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveVikeConfigGlobal.d.ts} +14 -12
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveVikeConfigGlobal.js +123 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +8 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +43 -29
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +3 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -1
- package/dist/esm/node/plugin/plugins/previewConfig.js +4 -3
- package/dist/esm/node/plugin/plugins/setGlobalContext.js +5 -2
- package/dist/esm/node/plugin/shared/getEnvVarObject.d.ts +1 -1
- package/dist/esm/node/prerender/runPrerender.js +2 -4
- package/dist/esm/node/runtime/globalContext.d.ts +6 -2
- package/dist/esm/node/runtime/globalContext.js +16 -8
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +1 -1
- package/dist/esm/node/shared/resolveBase.d.ts +11 -0
- package/dist/esm/node/shared/resolveBase.js +36 -0
- package/dist/esm/shared/page-configs/Config.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/projectInfo.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/node/plugin/plugins/config/assertVikeConfig.js +0 -75
- package/dist/cjs/node/plugin/plugins/config/index.js +0 -81
- package/dist/cjs/node/plugin/plugins/config/pickFirst.js +0 -6
- package/dist/cjs/node/plugin/plugins/config/resolveBase.js +0 -47
- package/dist/cjs/node/shared/getConfigVike.js +0 -10
- package/dist/cjs/shared/ConfigVike.js +0 -2
- package/dist/esm/node/plugin/plugins/config/assertVikeConfig.d.ts +0 -7
- package/dist/esm/node/plugin/plugins/config/assertVikeConfig.js +0 -73
- package/dist/esm/node/plugin/plugins/config/index.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/config/index.js +0 -76
- package/dist/esm/node/plugin/plugins/config/pickFirst.d.ts +0 -1
- package/dist/esm/node/plugin/plugins/config/pickFirst.js +0 -3
- package/dist/esm/node/plugin/plugins/config/resolveBase.d.ts +0 -10
- package/dist/esm/node/plugin/plugins/config/resolveBase.js +0 -42
- package/dist/esm/node/shared/getConfigVike.d.ts +0 -4
- package/dist/esm/node/shared/getConfigVike.js +0 -8
- package/dist/esm/shared/ConfigVike.js +0 -1
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -6,17 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.crawlPlusFiles = crawlPlusFiles;
|
|
7
7
|
const utils_js_1 = require("../../../../utils.js");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
9
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
11
10
|
const child_process_1 = require("child_process");
|
|
12
11
|
const util_1 = require("util");
|
|
13
12
|
const transpileAndExecuteFile_js_1 = require("./transpileAndExecuteFile.js");
|
|
13
|
+
const getEnvVarObject_js_1 = require("../../../../shared/getEnvVarObject.js");
|
|
14
14
|
const execA = (0, util_1.promisify)(child_process_1.exec);
|
|
15
|
-
const TOO_MANY_UNTRACKED_FILES = 5;
|
|
16
15
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
17
16
|
(0, utils_js_1.assertIsSingleModuleInstance)('crawlPlusFiles.ts');
|
|
18
17
|
let gitIsNotUsable = false;
|
|
19
|
-
async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem
|
|
18
|
+
async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
|
|
20
19
|
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
21
20
|
//*/
|
|
22
21
|
const outDirRelativeFromUserRootDir = null;
|
|
@@ -36,14 +35,13 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, crawlWithGi
|
|
|
36
35
|
//
|
|
37
36
|
!outDirRelativeFromUserRootDir.startsWith('../')));
|
|
38
37
|
// Crawl
|
|
39
|
-
let files
|
|
40
|
-
const res =
|
|
38
|
+
let files;
|
|
39
|
+
const res = !isGitCrawlDisabled() && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
|
|
41
40
|
if (res &&
|
|
42
41
|
// Fallback to fast-glob for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
|
|
43
|
-
res.
|
|
44
|
-
files = res
|
|
42
|
+
res.length > 0) {
|
|
43
|
+
files = res;
|
|
45
44
|
// We cannot find files inside symlink directories with `$ git ls-files` => we use fast-glob
|
|
46
|
-
files.push(...(await crawlSymlinkDirs(res.symlinkDirs, userRootDir, outDirRelativeFromUserRootDir)));
|
|
47
45
|
}
|
|
48
46
|
else {
|
|
49
47
|
files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
|
|
@@ -85,14 +83,13 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
85
83
|
...ignoreAsPatterns.map((pattern) => `--exclude="${pattern}"`),
|
|
86
84
|
// --others --exclude-standard => list untracked files (--others) while using .gitignore (--exclude-standard)
|
|
87
85
|
// --cached => list tracked files
|
|
88
|
-
|
|
89
|
-
'--others --exclude-standard --cached --stage'
|
|
86
|
+
'--others --exclude-standard --cached'
|
|
90
87
|
].join(' ');
|
|
91
|
-
let
|
|
88
|
+
let filesAll;
|
|
92
89
|
let filesDeleted;
|
|
93
90
|
try {
|
|
94
91
|
;
|
|
95
|
-
[
|
|
92
|
+
[filesAll, filesDeleted] = await Promise.all([
|
|
96
93
|
// Main command
|
|
97
94
|
runCmd1(cmd, userRootDir),
|
|
98
95
|
// Get tracked but deleted files
|
|
@@ -106,31 +103,14 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
106
103
|
}
|
|
107
104
|
throw err;
|
|
108
105
|
}
|
|
109
|
-
const filePaths = resultLines.map(parseGitLsResultLine);
|
|
110
|
-
// If there are too many files without mode we fallback to fast-glob
|
|
111
|
-
if (filePaths.filter((f) => !f.mode).length > TOO_MANY_UNTRACKED_FILES)
|
|
112
|
-
return null;
|
|
113
|
-
const symlinkDirs = [];
|
|
114
106
|
const files = [];
|
|
115
|
-
for (const
|
|
107
|
+
for (const filePath of filesAll) {
|
|
116
108
|
// Deleted?
|
|
117
109
|
if (filesDeleted.includes(filePath))
|
|
118
110
|
continue;
|
|
119
111
|
// We have to repeat the same exclusion logic here because the option --exclude of `$ git ls-files` only applies to untracked files. (We use --exclude only to speed up the `$ git ls-files` command.)
|
|
120
112
|
if (!ignoreAsFilterFn(filePath))
|
|
121
113
|
continue;
|
|
122
|
-
// Symlink directory?
|
|
123
|
-
{
|
|
124
|
-
const isSymlinkDir = await isSymlinkDirectory(mode, filePath, userRootDir);
|
|
125
|
-
if (isSymlinkDir) {
|
|
126
|
-
symlinkDirs.push(filePath);
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
// Skip deleted files and non-symlink directories
|
|
130
|
-
if (isSymlinkDir === null) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
114
|
// + file?
|
|
135
115
|
if (!path_1.default.posix.basename(filePath).startsWith('+'))
|
|
136
116
|
continue;
|
|
@@ -139,7 +119,7 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
139
119
|
continue;
|
|
140
120
|
files.push(filePath);
|
|
141
121
|
}
|
|
142
|
-
return
|
|
122
|
+
return files;
|
|
143
123
|
}
|
|
144
124
|
// Same as gitLsFiles() but using fast-glob
|
|
145
125
|
async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
|
|
@@ -209,77 +189,6 @@ async function isGitNotUsable(userRootDir) {
|
|
|
209
189
|
return false;
|
|
210
190
|
}
|
|
211
191
|
}
|
|
212
|
-
async function crawlSymlinkDirs(symlinkDirs, userRootDir, outDirRelativeFromUserRootDir) {
|
|
213
|
-
const filesInSymlinkDirs = (await Promise.all(symlinkDirs.map(async (symlinkDir) => (await fastGlob(path_1.default.posix.join(userRootDir, symlinkDir), outDirRelativeFromUserRootDir)).map((filePath) => path_1.default.posix.join(symlinkDir, filePath))))).flat();
|
|
214
|
-
return filesInSymlinkDirs;
|
|
215
|
-
}
|
|
216
|
-
// Parse:
|
|
217
|
-
// ```
|
|
218
|
-
// some/not/tracked/path
|
|
219
|
-
// 100644 f6928073402b241b468b199893ff6f4aed0b7195 0\tpages/index/+Page.tsx
|
|
220
|
-
// ```
|
|
221
|
-
function parseGitLsResultLine(resultLine) {
|
|
222
|
-
const [part1, part2, ...rest] = resultLine.split('\t');
|
|
223
|
-
(0, utils_js_1.assert)(part1);
|
|
224
|
-
(0, utils_js_1.assert)(rest.length === 0);
|
|
225
|
-
// Git doesn't provide the mode for untracked paths.
|
|
226
|
-
// `resultLine` is:
|
|
227
|
-
// ```
|
|
228
|
-
// some/not/tracked/path
|
|
229
|
-
// ```
|
|
230
|
-
if (part2 === undefined) {
|
|
231
|
-
return { filePath: part1, mode: null };
|
|
232
|
-
}
|
|
233
|
-
(0, utils_js_1.assert)(part2);
|
|
234
|
-
// `resultLine` is:
|
|
235
|
-
// ```
|
|
236
|
-
// 100644 f6928073402b241b468b199893ff6f4aed0b7195 0\tpages/index/+Page.tsx
|
|
237
|
-
// ```
|
|
238
|
-
const [mode, _, __, ...rest2] = part1.split(' ');
|
|
239
|
-
(0, utils_js_1.assert)(mode && _ && __ && rest2.length === 0);
|
|
240
|
-
return { filePath: part2, mode };
|
|
241
|
-
}
|
|
242
|
-
async function isSymlinkDirectory(mode, filePath, userRootDir) {
|
|
243
|
-
const filePathAbsolute = path_1.default.posix.join(userRootDir, filePath);
|
|
244
|
-
let stats = null;
|
|
245
|
-
let isSymlink = false;
|
|
246
|
-
if (mode === '120000') {
|
|
247
|
-
isSymlink = true;
|
|
248
|
-
}
|
|
249
|
-
else if (mode === null) {
|
|
250
|
-
// `$ git ls-files` doesn't provide the mode when Git doesn't track the path
|
|
251
|
-
stats = await getFileStats(filePathAbsolute);
|
|
252
|
-
if (stats === null)
|
|
253
|
-
return null;
|
|
254
|
-
isSymlink = stats.isSymbolicLink();
|
|
255
|
-
if (!isSymlink && stats.isDirectory())
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
(0, utils_js_1.assert)(mode);
|
|
260
|
-
}
|
|
261
|
-
if (!isSymlink)
|
|
262
|
-
return false;
|
|
263
|
-
if (!stats)
|
|
264
|
-
stats = await getFileStats(filePathAbsolute);
|
|
265
|
-
if (stats === null)
|
|
266
|
-
return null;
|
|
267
|
-
const isDirectory = stats.isDirectory();
|
|
268
|
-
return isDirectory;
|
|
269
|
-
}
|
|
270
|
-
async function getFileStats(filePathAbsolute) {
|
|
271
|
-
let stats;
|
|
272
|
-
try {
|
|
273
|
-
stats = await promises_1.default.lstat(filePathAbsolute);
|
|
274
|
-
}
|
|
275
|
-
catch (err) {
|
|
276
|
-
// File was deleted, usually a temporary file such as +config.js.build-j95xb988fpln.mjs
|
|
277
|
-
// ENOENT: no such file or directory
|
|
278
|
-
(0, utils_js_1.assert)(err.code === 'ENOENT');
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
return stats;
|
|
282
|
-
}
|
|
283
192
|
async function runCmd1(cmd, cwd) {
|
|
284
193
|
const { stdout } = await execA(cmd, {
|
|
285
194
|
cwd,
|
|
@@ -304,3 +213,7 @@ async function runCmd2(cmd, cwd) {
|
|
|
304
213
|
stderr = stderr.toString().trim();
|
|
305
214
|
return { stdout, stderr };
|
|
306
215
|
}
|
|
216
|
+
function isGitCrawlDisabled() {
|
|
217
|
+
const crawSettings = (0, getEnvVarObject_js_1.getEnvVarObject)('VIKE_CRAWL');
|
|
218
|
+
return crawSettings?.git === false;
|
|
219
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveVikeConfigGlobal = resolveVikeConfigGlobal;
|
|
7
|
+
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
|
+
const utils_js_1 = require("../../../../utils.js");
|
|
9
|
+
function resolveVikeConfigGlobal(vikeVitePluginOptions, pageConfigGlobalValues) {
|
|
10
|
+
// TODO/v1-release: remove
|
|
11
|
+
assertVikeConfigGlobal(vikeVitePluginOptions, ({ prop, errMsg }) => `vite.config.js > vike option ${prop} ${errMsg}`);
|
|
12
|
+
const configs = [vikeVitePluginOptions];
|
|
13
|
+
assertVikeConfigGlobal(pageConfigGlobalValues, ({ prop, errMsg }) => {
|
|
14
|
+
// Can we add the config file path ?
|
|
15
|
+
return `config ${picocolors_1.default.cyan(prop)} ${errMsg}`;
|
|
16
|
+
});
|
|
17
|
+
configs.push(pageConfigGlobalValues);
|
|
18
|
+
const vikeConfigGlobal = {
|
|
19
|
+
disableAutoFullBuild: pickFirst(configs.map((c) => c.disableAutoFullBuild)) ?? null,
|
|
20
|
+
prerender: resolvePrerenderOptions(configs),
|
|
21
|
+
includeAssetsImportedByServer: pickFirst(configs.map((c) => c.includeAssetsImportedByServer)) ?? true,
|
|
22
|
+
baseServer: pickFirst(configs.map((c) => c.baseServer)) ?? null,
|
|
23
|
+
baseAssets: pickFirst(configs.map((c) => c.baseAssets)) ?? null,
|
|
24
|
+
redirects: merge(configs.map((c) => c.redirects)) ?? {},
|
|
25
|
+
disableUrlNormalization: pickFirst(configs.map((c) => c.disableUrlNormalization)) ?? false,
|
|
26
|
+
trailingSlash: pickFirst(configs.map((c) => c.trailingSlash)) ?? false,
|
|
27
|
+
crawl: {
|
|
28
|
+
git: vikeVitePluginOptions.crawl?.git ?? null
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return vikeConfigGlobal;
|
|
32
|
+
}
|
|
33
|
+
function resolvePrerenderOptions(configs) {
|
|
34
|
+
if (!configs.some((c) => c.prerender)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const configsPrerender = configs.map((c) => c.prerender).filter(isObject2);
|
|
38
|
+
return {
|
|
39
|
+
partial: pickFirst(configsPrerender.map((c) => c.partial)) ?? false,
|
|
40
|
+
noExtraDir: pickFirst(configsPrerender.map((c) => c.noExtraDir)) ?? false,
|
|
41
|
+
parallel: pickFirst(configsPrerender.map((c) => c.parallel)) ?? true,
|
|
42
|
+
disableAutoRun: pickFirst(configsPrerender.map((c) => c.disableAutoRun)) ?? false
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function isObject2(p) {
|
|
46
|
+
return typeof p === 'object';
|
|
47
|
+
}
|
|
48
|
+
function merge(objs) {
|
|
49
|
+
const obj = {};
|
|
50
|
+
objs.forEach((e) => {
|
|
51
|
+
Object.assign(obj, e);
|
|
52
|
+
});
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
55
|
+
function pickFirst(arr) {
|
|
56
|
+
return arr.filter((v) => v !== undefined)[0];
|
|
57
|
+
}
|
|
58
|
+
function assertVikeConfigGlobal(vikeConfigGlobal, wrongUsageMsg) {
|
|
59
|
+
const wrongUsageError = check(vikeConfigGlobal);
|
|
60
|
+
if (wrongUsageError) {
|
|
61
|
+
(0, utils_js_1.assertUsage)(false, wrongUsageMsg(wrongUsageError));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function check(vikeConfigGlobal) {
|
|
65
|
+
(0, utils_js_1.assert)((0, utils_js_1.isObject)(vikeConfigGlobal));
|
|
66
|
+
{
|
|
67
|
+
const prop = 'disableUrlNormalization';
|
|
68
|
+
if (!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'boolean') && !(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'undefined'))
|
|
69
|
+
return { prop, errMsg: 'should be a boolean' };
|
|
70
|
+
}
|
|
71
|
+
{
|
|
72
|
+
const prop = 'trailingSlash';
|
|
73
|
+
if (!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'boolean') && !(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'undefined'))
|
|
74
|
+
return { prop, errMsg: 'should be a boolean' };
|
|
75
|
+
}
|
|
76
|
+
{
|
|
77
|
+
const prop = 'redirects';
|
|
78
|
+
const { redirects } = vikeConfigGlobal;
|
|
79
|
+
if (!(redirects === undefined ||
|
|
80
|
+
((0, utils_js_1.isObject)(redirects) && Object.values(redirects).every((v) => typeof v === 'string'))))
|
|
81
|
+
return { prop, errMsg: 'should be an object of strings' };
|
|
82
|
+
}
|
|
83
|
+
{
|
|
84
|
+
const prop = 'disableAutoFullBuild';
|
|
85
|
+
if (!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'boolean') &&
|
|
86
|
+
!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'undefined') &&
|
|
87
|
+
!(vikeConfigGlobal[prop] === 'prerender'))
|
|
88
|
+
return { prop, errMsg: "should be a boolean or 'prerender'" };
|
|
89
|
+
}
|
|
90
|
+
{
|
|
91
|
+
const prop = 'includeAssetsImportedByServer';
|
|
92
|
+
if (!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'boolean') && !(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'undefined'))
|
|
93
|
+
return { prop, errMsg: 'should be a boolean' };
|
|
94
|
+
}
|
|
95
|
+
{
|
|
96
|
+
const prop = 'prerender';
|
|
97
|
+
if (!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'object') &&
|
|
98
|
+
!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'boolean') &&
|
|
99
|
+
!(0, utils_js_1.hasProp)(vikeConfigGlobal, prop, 'undefined'))
|
|
100
|
+
return { prop, errMsg: 'should be an object or a boolean' };
|
|
101
|
+
}
|
|
102
|
+
const configVikePrerender = vikeConfigGlobal.prerender;
|
|
103
|
+
if (typeof configVikePrerender === 'object') {
|
|
104
|
+
{
|
|
105
|
+
const p = 'partial';
|
|
106
|
+
if (!(0, utils_js_1.hasProp)(configVikePrerender, p, 'boolean') && !(0, utils_js_1.hasProp)(configVikePrerender, p, 'undefined'))
|
|
107
|
+
return { prop: `prerender.${p}`, errMsg: 'should be a boolean' };
|
|
108
|
+
}
|
|
109
|
+
{
|
|
110
|
+
const p = 'noExtraDir';
|
|
111
|
+
if (!(0, utils_js_1.hasProp)(configVikePrerender, p, 'boolean') && !(0, utils_js_1.hasProp)(configVikePrerender, p, 'undefined'))
|
|
112
|
+
return { prop: `prerender.${p}`, errMsg: 'should be a boolean' };
|
|
113
|
+
}
|
|
114
|
+
{
|
|
115
|
+
const p = 'disableAutoRun';
|
|
116
|
+
if (!(0, utils_js_1.hasProp)(configVikePrerender, p, 'boolean') && !(0, utils_js_1.hasProp)(configVikePrerender, p, 'undefined'))
|
|
117
|
+
return { prop: `prerender.${p}`, errMsg: 'should be a boolean' };
|
|
118
|
+
}
|
|
119
|
+
{
|
|
120
|
+
const p = 'parallel';
|
|
121
|
+
if (!(0, utils_js_1.hasProp)(configVikePrerender, p, 'boolean') &&
|
|
122
|
+
!(0, utils_js_1.hasProp)(configVikePrerender, p, 'number') &&
|
|
123
|
+
!(0, utils_js_1.hasProp)(configVikePrerender, p, 'undefined'))
|
|
124
|
+
return { prop: `prerender.${p}`, errMsg: 'should be a boolean or a number' };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.vikeConfigDependencies = void 0;
|
|
7
7
|
exports.getVikeConfig = getVikeConfig;
|
|
8
|
+
exports.getVikeConfig2 = getVikeConfig2;
|
|
8
9
|
exports.reloadVikeConfig = reloadVikeConfig;
|
|
9
10
|
exports.isVikeConfigFile = isVikeConfigFile;
|
|
10
11
|
exports.isV1Design = isV1Design;
|
|
@@ -26,18 +27,21 @@ const loadFileAtConfigTime_js_1 = require("./getVikeConfig/loadFileAtConfigTime.
|
|
|
26
27
|
const resolvePointerImport_js_1 = require("./getVikeConfig/resolvePointerImport.js");
|
|
27
28
|
const getFilePath_js_1 = require("../../../shared/getFilePath.js");
|
|
28
29
|
const getConfigValueBuildTime_js_1 = require("../../../../../shared/page-configs/getConfigValueBuildTime.js");
|
|
29
|
-
const getConfigVike_js_1 = require("../../../../shared/getConfigVike.js");
|
|
30
30
|
const assertExtensions_js_1 = require("./assertExtensions.js");
|
|
31
|
+
const resolveVikeConfigGlobal_js_1 = require("./getVikeConfig/resolveVikeConfigGlobal.js");
|
|
31
32
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
32
|
-
let
|
|
33
|
+
let restartVite = false;
|
|
33
34
|
let wasConfigInvalid = null;
|
|
34
35
|
let vikeConfigPromise = null;
|
|
35
36
|
const vikeConfigDependencies = new Set();
|
|
36
37
|
exports.vikeConfigDependencies = vikeConfigDependencies;
|
|
37
|
-
function reloadVikeConfig(
|
|
38
|
+
function reloadVikeConfig(config) {
|
|
39
|
+
const userRootDir = config.root;
|
|
40
|
+
const vikeVitePluginOptions = config._vikeVitePluginOptions;
|
|
41
|
+
(0, utils_js_1.assert)(vikeVitePluginOptions);
|
|
38
42
|
vikeConfigDependencies.clear();
|
|
39
43
|
(0, resolvePointerImport_js_1.clearFilesEnvMap)();
|
|
40
|
-
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir,
|
|
44
|
+
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, true, vikeVitePluginOptions);
|
|
41
45
|
handleReloadSideEffects();
|
|
42
46
|
}
|
|
43
47
|
async function handleReloadSideEffects() {
|
|
@@ -61,8 +65,8 @@ async function handleReloadSideEffects() {
|
|
|
61
65
|
wasConfigInvalid = false;
|
|
62
66
|
(0, loggerNotProd_js_1.logConfigErrorRecover)();
|
|
63
67
|
}
|
|
64
|
-
if (
|
|
65
|
-
|
|
68
|
+
if (restartVite) {
|
|
69
|
+
restartVite = false;
|
|
66
70
|
const viteDevServer = (0, globalContext_js_1.getViteDevServer)();
|
|
67
71
|
(0, utils_js_1.assert)(viteDevServer);
|
|
68
72
|
(0, removeSuperfluousViteLog_js_1.removeSuperfluousViteLog_enable)();
|
|
@@ -71,23 +75,32 @@ async function handleReloadSideEffects() {
|
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
|
-
async function getVikeConfig(config,
|
|
75
|
-
const { outDirRoot } = (0, utils_js_1.getOutDirs)(config);
|
|
78
|
+
async function getVikeConfig(config, { doNotRestartViteOnError } = {}) {
|
|
76
79
|
const userRootDir = config.root;
|
|
80
|
+
const vikeVitePluginOptions = config._vikeVitePluginOptions;
|
|
81
|
+
(0, utils_js_1.assert)(vikeVitePluginOptions);
|
|
82
|
+
const isDev = config._isDev;
|
|
83
|
+
(0, utils_js_1.assert)(typeof isDev === 'boolean');
|
|
84
|
+
return await getVikeConfigEntry(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError ?? false);
|
|
85
|
+
}
|
|
86
|
+
async function getVikeConfig2(userRootDir, isDev, vikeVitePluginOptions) {
|
|
87
|
+
(0, utils_js_1.assert)(vikeVitePluginOptions);
|
|
88
|
+
return await getVikeConfigEntry(userRootDir, isDev, vikeVitePluginOptions, false);
|
|
89
|
+
}
|
|
90
|
+
async function getVikeConfigEntry(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError) {
|
|
77
91
|
if (!vikeConfigPromise) {
|
|
78
|
-
|
|
79
|
-
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev, crawlWithGit_, tolerateInvalidConfig);
|
|
92
|
+
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError);
|
|
80
93
|
}
|
|
81
94
|
return await vikeConfigPromise;
|
|
82
95
|
}
|
|
83
|
-
async function isV1Design(config
|
|
84
|
-
const vikeConfig = await getVikeConfig(config
|
|
96
|
+
async function isV1Design(config) {
|
|
97
|
+
const vikeConfig = await getVikeConfig(config);
|
|
85
98
|
const { pageConfigs } = vikeConfig;
|
|
86
99
|
const isV1Design = pageConfigs.length > 0;
|
|
87
100
|
return isV1Design;
|
|
88
101
|
}
|
|
89
|
-
async function loadInterfaceFiles(userRootDir
|
|
90
|
-
const plusFiles = await findPlusFiles(userRootDir,
|
|
102
|
+
async function loadInterfaceFiles(userRootDir) {
|
|
103
|
+
const plusFiles = await findPlusFiles(userRootDir, null);
|
|
91
104
|
const configFiles = [];
|
|
92
105
|
const valueFiles = [];
|
|
93
106
|
plusFiles.forEach((f) => {
|
|
@@ -196,12 +209,12 @@ function assertAllConfigsAreKnown(interfaceFilesByLocationId) {
|
|
|
196
209
|
});
|
|
197
210
|
});
|
|
198
211
|
}
|
|
199
|
-
async function loadVikeConfig_withErrorHandling(userRootDir,
|
|
212
|
+
async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError) {
|
|
200
213
|
let hasError = false;
|
|
201
214
|
let ret;
|
|
202
215
|
let err;
|
|
203
216
|
try {
|
|
204
|
-
ret = await loadVikeConfig(userRootDir,
|
|
217
|
+
ret = await loadVikeConfig(userRootDir, vikeVitePluginOptions);
|
|
205
218
|
}
|
|
206
219
|
catch (err_) {
|
|
207
220
|
hasError = true;
|
|
@@ -223,8 +236,8 @@ async function loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev,
|
|
|
223
236
|
}
|
|
224
237
|
else {
|
|
225
238
|
(0, loggerNotProd_js_1.logConfigError)(err);
|
|
226
|
-
if (!
|
|
227
|
-
|
|
239
|
+
if (!doNotRestartViteOnError) {
|
|
240
|
+
restartVite = true;
|
|
228
241
|
}
|
|
229
242
|
const dummyData = {
|
|
230
243
|
pageConfigs: [],
|
|
@@ -232,16 +245,17 @@ async function loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev,
|
|
|
232
245
|
configDefinitions: {},
|
|
233
246
|
configValueSources: {}
|
|
234
247
|
},
|
|
235
|
-
|
|
248
|
+
vikeConfigGlobal: (0, resolveVikeConfigGlobal_js_1.resolveVikeConfigGlobal)({}, {})
|
|
236
249
|
};
|
|
237
250
|
return dummyData;
|
|
238
251
|
}
|
|
239
252
|
}
|
|
240
253
|
}
|
|
241
|
-
async function loadVikeConfig(userRootDir,
|
|
242
|
-
const interfaceFilesByLocationId = await loadInterfaceFiles(userRootDir
|
|
254
|
+
async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
|
|
255
|
+
const interfaceFilesByLocationId = await loadInterfaceFiles(userRootDir);
|
|
243
256
|
const importedFilesLoaded = {};
|
|
244
|
-
const {
|
|
257
|
+
const { pageConfigGlobal, pageConfigGlobalValues } = await getGlobalConfigs(interfaceFilesByLocationId, userRootDir, importedFilesLoaded);
|
|
258
|
+
const vikeConfigGlobal = (0, resolveVikeConfigGlobal_js_1.resolveVikeConfigGlobal)(vikeVitePluginOptions, pageConfigGlobalValues);
|
|
245
259
|
const pageConfigs = await Promise.all((0, utils_js_1.objectEntries)(interfaceFilesByLocationId)
|
|
246
260
|
.filter(([_pageId, interfaceFiles]) => isDefiningPage(interfaceFiles))
|
|
247
261
|
.map(async ([locationId]) => {
|
|
@@ -291,7 +305,7 @@ async function loadVikeConfig(userRootDir, outDirRoot, crawlWithGit) {
|
|
|
291
305
|
return pageConfig;
|
|
292
306
|
}));
|
|
293
307
|
assertPageConfigs(pageConfigs);
|
|
294
|
-
return { pageConfigs, pageConfigGlobal,
|
|
308
|
+
return { pageConfigs, pageConfigGlobal, vikeConfigGlobal };
|
|
295
309
|
}
|
|
296
310
|
// TODO/soon: refactor
|
|
297
311
|
// - Dedupe: most of the assertUsageGlobalConfigs() code below is a copy-paste of the assertUsage() logic inside getGlobalConfigs()
|
|
@@ -401,7 +415,7 @@ async function getGlobalConfigs(interfaceFilesByLocationId, userRootDir, importe
|
|
|
401
415
|
});
|
|
402
416
|
});
|
|
403
417
|
}
|
|
404
|
-
const
|
|
418
|
+
const pageConfigGlobalValues = {};
|
|
405
419
|
const pageConfigGlobal = {
|
|
406
420
|
configDefinitions: configDefinitionsBuiltIn_js_1.configDefinitionsBuiltInGlobal,
|
|
407
421
|
configValueSources: {}
|
|
@@ -421,10 +435,10 @@ async function getGlobalConfigs(interfaceFilesByLocationId, userRootDir, importe
|
|
|
421
435
|
return;
|
|
422
436
|
const { filePathToShowToUser } = configValueSource.definedAtFilePath;
|
|
423
437
|
(0, utils_js_1.assertWarning)(false, `Being able to define config ${picocolors_1.default.cyan(configName)} in ${filePathToShowToUser} is experimental and will likely be removed. Define the config ${picocolors_1.default.cyan(configName)} in Vike's Vite plugin options instead.`, { onlyOnce: true });
|
|
424
|
-
|
|
438
|
+
pageConfigGlobalValues[configName] = configValueSource.value;
|
|
425
439
|
}
|
|
426
440
|
}));
|
|
427
|
-
return { pageConfigGlobal,
|
|
441
|
+
return { pageConfigGlobal, pageConfigGlobalValues };
|
|
428
442
|
}
|
|
429
443
|
async function resolveConfigValueSources(configName, configDef, interfaceFilesRelevant, userRootDir, importedFilesLoaded) {
|
|
430
444
|
const sourcesInfo = [];
|
|
@@ -785,8 +799,8 @@ function getComputed(configValueSources, configDefinitions) {
|
|
|
785
799
|
});
|
|
786
800
|
return configValuesComputed;
|
|
787
801
|
}
|
|
788
|
-
async function findPlusFiles(userRootDir, outDirRoot
|
|
789
|
-
const files = await (0, crawlPlusFiles_js_1.crawlPlusFiles)(userRootDir, outDirRoot
|
|
802
|
+
async function findPlusFiles(userRootDir, outDirRoot) {
|
|
803
|
+
const files = await (0, crawlPlusFiles_js_1.crawlPlusFiles)(userRootDir, outDirRoot);
|
|
790
804
|
const plusFiles = files.map(({ filePathAbsoluteUserRootDir }) => (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir }));
|
|
791
805
|
return plusFiles;
|
|
792
806
|
}
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js
CHANGED
|
@@ -8,7 +8,6 @@ const extractAssetsQuery_js_1 = require("../../../../shared/extractAssetsQuery.j
|
|
|
8
8
|
const debug_js_1 = require("./debug.js");
|
|
9
9
|
const isRuntimeEnvMatch_js_1 = require("./isRuntimeEnvMatch.js");
|
|
10
10
|
const serializeConfigValues_js_1 = require("../../../../../shared/page-configs/serialize/serializeConfigValues.js");
|
|
11
|
-
const getConfigVike_js_1 = require("../../../../shared/getConfigVike.js");
|
|
12
11
|
const fixServerAssets_js_1 = require("../../buildConfig/fixServerAssets.js");
|
|
13
12
|
const getConfigValueBuildTime_js_1 = require("../../../../../shared/page-configs/getConfigValueBuildTime.js");
|
|
14
13
|
async function getVirtualFilePageConfigValuesAll(id, isDev, config) {
|
|
@@ -21,11 +20,11 @@ async function getVirtualFilePageConfigValuesAll(id, isDev, config) {
|
|
|
21
20
|
}
|
|
22
21
|
*/
|
|
23
22
|
const { pageId, isForClientSide } = result;
|
|
24
|
-
const
|
|
23
|
+
const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config, { doNotRestartViteOnError: true });
|
|
24
|
+
const { pageConfigs } = vikeConfig;
|
|
25
25
|
const pageConfig = pageConfigs.find((pageConfig) => pageConfig.pageId === pageId);
|
|
26
26
|
(0, utils_js_1.assert)(pageConfig, { id, pageId });
|
|
27
|
-
const
|
|
28
|
-
const code = getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, configVike.includeAssetsImportedByServer, isDev);
|
|
27
|
+
const code = getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, vikeConfig.vikeConfigGlobal.includeAssetsImportedByServer, isDev);
|
|
29
28
|
(0, debug_js_1.debug)(id, isForClientSide ? 'CLIENT-SIDE' : 'SERVER-SIDE', code);
|
|
30
29
|
return code;
|
|
31
30
|
}
|
|
@@ -7,7 +7,7 @@ const getVikeConfig_js_1 = require("./getVikeConfig.js");
|
|
|
7
7
|
const isRuntimeEnvMatch_js_1 = require("./isRuntimeEnvMatch.js");
|
|
8
8
|
const serializeConfigValues_js_1 = require("../../../../../shared/page-configs/serialize/serializeConfigValues.js");
|
|
9
9
|
async function getVirtualFilePageConfigs(isForClientSide, isDev, id, isClientRouting, config) {
|
|
10
|
-
const { pageConfigs, pageConfigGlobal } = await (0, getVikeConfig_js_1.getVikeConfig)(config,
|
|
10
|
+
const { pageConfigs, pageConfigGlobal } = await (0, getVikeConfig_js_1.getVikeConfig)(config, { doNotRestartViteOnError: true });
|
|
11
11
|
return getCode(pageConfigs, pageConfigGlobal, isForClientSide, isDev, id, isClientRouting);
|
|
12
12
|
}
|
|
13
13
|
function getCode(pageConfigs, pageConfigGlobal, isForClientSide, isDev, id, isClientRouting) {
|
|
@@ -12,7 +12,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
12
12
|
const index_js_1 = require("./devConfig/index.js");
|
|
13
13
|
function previewConfig() {
|
|
14
14
|
let config;
|
|
15
|
-
// let
|
|
15
|
+
// let vikeConfigGlobal: VikeConfigGlobal
|
|
16
16
|
return {
|
|
17
17
|
name: 'vike:previewConfig',
|
|
18
18
|
apply: utils_js_1.applyPreview,
|
|
@@ -27,7 +27,8 @@ function previewConfig() {
|
|
|
27
27
|
async configResolved(config_) {
|
|
28
28
|
config = config_;
|
|
29
29
|
(0, index_js_1.logDockerHint)(config.preview.host);
|
|
30
|
-
//
|
|
30
|
+
// const vikeConfig = await getVikeConfig(config)
|
|
31
|
+
// vikeConfigGlobal = vikeConfig.vikeConfigGlobal
|
|
31
32
|
},
|
|
32
33
|
configurePreviewServer(server) {
|
|
33
34
|
/* - Couldn't make `appType: 'mpa'` work as of npm:@brillout/vite@5.0.0-beta.14.0426910c
|
|
@@ -37,7 +38,7 @@ function previewConfig() {
|
|
|
37
38
|
return () => {
|
|
38
39
|
assertDist();
|
|
39
40
|
/* We don't use this condition (we wrongfully always use the SSR middleware) because of the regression introduced by https://github.com/vitejs/vite/pull/14756 which stops servering .html files when `appType: 'custom'`.
|
|
40
|
-
if (!
|
|
41
|
+
if (!vikeConfigGlobal.prerender || vikeConfigGlobal.prerender.partial) {
|
|
41
42
|
addSsrMiddleware(server.middlewares, config, true)
|
|
42
43
|
}
|
|
43
44
|
/*/
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setGlobalContext = setGlobalContext;
|
|
4
4
|
const globalContext_js_1 = require("../../runtime/globalContext.js");
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
|
+
const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
|
|
6
7
|
function setGlobalContext() {
|
|
7
8
|
return [
|
|
8
9
|
{
|
|
@@ -32,10 +33,12 @@ function setGlobalContext() {
|
|
|
32
33
|
enforce: 'post',
|
|
33
34
|
configResolved: {
|
|
34
35
|
order: 'post',
|
|
35
|
-
handler(config) {
|
|
36
|
+
async handler(config) {
|
|
36
37
|
const { outDirRoot } = (0, utils_js_1.getOutDirs)(config);
|
|
37
38
|
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(outDirRoot); // Needed for loadImportBuild(outDir) of @brillout/vite-plugin-server-entry
|
|
38
39
|
(0, globalContext_js_1.setGlobalContext_viteConfig)(config, outDirRoot);
|
|
40
|
+
const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config);
|
|
41
|
+
(0, globalContext_js_1.setGlobalContext_vikeConfig)(vikeConfig);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
}
|
|
@@ -39,7 +39,6 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
39
39
|
const os_1 = require("os");
|
|
40
40
|
const globalContext_js_1 = require("../runtime/globalContext.js");
|
|
41
41
|
const vite_1 = require("vite");
|
|
42
|
-
const getConfigVike_js_1 = require("../shared/getConfigVike.js");
|
|
43
42
|
const getPageFiles_js_1 = require("../../shared/getPageFiles.js");
|
|
44
43
|
const getPageContextRequestUrl_js_1 = require("../../shared/getPageContextRequestUrl.js");
|
|
45
44
|
const resolveRouteString_js_1 = require("../../shared/route/resolveRouteString.js");
|
|
@@ -99,10 +98,10 @@ async function runPrerender(options = {}, standaloneTrigger) {
|
|
|
99
98
|
await disableReactStreaming();
|
|
100
99
|
const viteConfig = await (0, vite_1.resolveConfig)(options.viteConfig || {}, 'vike pre-rendering', 'production');
|
|
101
100
|
assertLoadedConfig(viteConfig, options);
|
|
102
|
-
const
|
|
101
|
+
const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(viteConfig);
|
|
103
102
|
const { outDirClient } = (0, utils_js_1.getOutDirs)(viteConfig);
|
|
104
103
|
const { root } = viteConfig;
|
|
105
|
-
const prerenderConfig =
|
|
104
|
+
const prerenderConfig = vikeConfig.vikeConfigGlobal.prerender;
|
|
106
105
|
if (!prerenderConfig) {
|
|
107
106
|
(0, utils_js_1.assert)(standaloneTrigger);
|
|
108
107
|
(0, utils_js_1.assertWarning)(prerenderConfig, `You're executing ${picocolors_1.default.cyan(standaloneTrigger)} but the config ${picocolors_1.default.cyan('prerender')} isn't set to true`, {
|
|
@@ -122,7 +121,6 @@ async function runPrerender(options = {}, standaloneTrigger) {
|
|
|
122
121
|
pageContextInit: options.pageContextInit ?? null
|
|
123
122
|
});
|
|
124
123
|
const doNotPrerenderList = [];
|
|
125
|
-
const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(viteConfig, false);
|
|
126
124
|
await collectDoNoPrerenderList(renderContext, vikeConfig.pageConfigs, doNotPrerenderList, concurrencyLimit);
|
|
127
125
|
await callOnBeforePrerenderStartHooks(prerenderContext, renderContext, concurrencyLimit, doNotPrerenderList);
|
|
128
126
|
await handlePagesWithStaticRoutes(prerenderContext, renderContext, doNotPrerenderList, concurrencyLimit);
|