vike 0.4.221 → 0.4.222-commit-6647d1e
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/prepareViteApiCall.js +18 -16
- package/dist/cjs/node/plugin/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/baseUrls.js +6 -1
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +8 -10
- package/dist/cjs/node/plugin/plugins/buildConfig.js +0 -1
- package/dist/cjs/node/plugin/plugins/commonConfig.js +4 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +73 -39
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +64 -14
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +0 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +2 -40
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +6 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +45 -21
- package/dist/cjs/node/runtime/globalContext.js +24 -8
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +3 -3
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
- package/dist/cjs/node/runtime/renderPage.js +4 -8
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +3 -3
- package/dist/cjs/node/shared/resolveBase.js +0 -13
- package/dist/cjs/shared/getPageConfigsRuntime.js +5 -2
- package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +45 -11
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -8
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertSingleInstance.js +1 -1
- package/dist/cjs/utils/debug.js +9 -6
- package/dist/esm/client/client-routing-runtime/getPageContextCurrent.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +4 -4
- package/dist/esm/client/client-routing-runtime/prefetch/getPrefetchSettings.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/prefetch.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/prefetch.js +3 -3
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +5 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +9 -2
- package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +2 -1
- package/dist/esm/client/server-routing-runtime/getPageContext.js +4 -3
- package/dist/esm/client/shared/executeOnRenderClientHook.d.ts +2 -2
- package/dist/esm/client/shared/loadUserFilesClientSide.d.ts +5 -4
- package/dist/esm/client/shared/loadUserFilesClientSide.js +3 -3
- package/dist/esm/client/shared/preparePageContextForUserConsumptionClientSide.d.ts +2 -2
- package/dist/esm/node/api/prepareViteApiCall.d.ts +2 -2
- package/dist/esm/node/api/prepareViteApiCall.js +18 -16
- package/dist/esm/node/plugin/index.d.ts +4 -1
- package/dist/esm/node/plugin/index.js +1 -1
- package/dist/esm/node/plugin/plugins/baseUrls.js +6 -1
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +0 -2
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +8 -10
- package/dist/esm/node/plugin/plugins/buildConfig.js +1 -2
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +1 -0
- package/dist/esm/node/plugin/plugins/commonConfig.js +4 -1
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +73 -39
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +4 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +65 -15
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +0 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.d.ts +0 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +2 -37
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +6 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +3 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +47 -23
- package/dist/esm/node/runtime/globalContext.d.ts +11 -8
- package/dist/esm/node/runtime/globalContext.js +24 -8
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.d.ts +2 -2
- package/dist/esm/node/runtime/html/injectAssets.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +3 -3
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +4 -4
- package/dist/esm/node/runtime/renderPage/log404/index.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +4 -4
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +12 -12
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
- package/dist/esm/node/runtime/renderPage.js +4 -8
- package/dist/esm/node/runtime-dev/createDevMiddleware.js +3 -3
- package/dist/esm/node/shared/resolveBase.d.ts +1 -9
- package/dist/esm/node/shared/resolveBase.js +0 -13
- package/dist/esm/shared/getPageConfigsRuntime.d.ts +3 -2
- package/dist/esm/shared/getPageConfigsRuntime.js +6 -3
- package/dist/esm/shared/getPageFiles.d.ts +1 -1
- package/dist/esm/shared/hooks/getHook.d.ts +3 -3
- package/dist/esm/shared/page-configs/Config.d.ts +3 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +9 -2
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.d.ts +24 -10
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.js +45 -11
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +3 -2
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -8
- package/dist/esm/shared/route/executeGuardHook.d.ts +2 -2
- package/dist/esm/shared/route/loadPageRoutes.js +1 -1
- package/dist/esm/shared/types.d.ts +9 -0
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertSingleInstance.js +1 -1
- package/dist/esm/utils/debug.d.ts +1 -1
- package/dist/esm/utils/debug.js +9 -6
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +1 -1
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { crawlPlusFiles };
|
|
2
|
+
export { isPlusFile };
|
|
3
|
+
export { getPlusFileValueConfigName };
|
|
2
4
|
declare function crawlPlusFiles(userRootDir: string, outDirAbsoluteFilesystem: null | string): Promise<{
|
|
3
5
|
filePathAbsoluteUserRootDir: string;
|
|
4
6
|
}[]>;
|
|
7
|
+
declare function isPlusFile(filePath: string): boolean;
|
|
8
|
+
declare function getPlusFileValueConfigName(filePath: string): string | null;
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { crawlPlusFiles };
|
|
2
|
-
|
|
2
|
+
export { isPlusFile };
|
|
3
|
+
export { getPlusFileValueConfigName };
|
|
4
|
+
import { assertPosixPath, assert, scriptFileExtensions, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove, isScriptFile, scriptFileExtensionList, createDebugger, deepEqual, assertUsage } from '../../../../utils.js';
|
|
3
5
|
import path from 'path';
|
|
4
6
|
import glob from 'fast-glob';
|
|
5
7
|
import { exec } from 'child_process';
|
|
@@ -7,6 +9,7 @@ import { promisify } from 'util';
|
|
|
7
9
|
import { isTemporaryBuildFile } from './transpileAndExecuteFile.js';
|
|
8
10
|
import { getEnvVarObject } from '../../../../shared/getEnvVarObject.js';
|
|
9
11
|
const execA = promisify(exec);
|
|
12
|
+
const debug = createDebugger('vike:crawl');
|
|
10
13
|
assertIsNotProductionRuntime();
|
|
11
14
|
assertIsSingleModuleInstance('crawlPlusFiles.ts');
|
|
12
15
|
let gitIsNotUsable = false;
|
|
@@ -30,17 +33,16 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
|
|
|
30
33
|
//
|
|
31
34
|
!outDirRelativeFromUserRootDir.startsWith('../')));
|
|
32
35
|
// Crawl
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
files
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
36
|
+
const filesGit = !isGitCrawlDisabled() && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
|
|
37
|
+
const filesGitNothingFound = !filesGit || filesGit.length === 0;
|
|
38
|
+
const filesGlob = (filesGitNothingFound || debug.isActivated) && (await fastGlob(userRootDir, outDirRelativeFromUserRootDir));
|
|
39
|
+
let files = !filesGitNothingFound
|
|
40
|
+
? filesGit
|
|
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.)
|
|
42
|
+
filesGlob;
|
|
43
|
+
assert(files);
|
|
44
|
+
if (debug.isActivated)
|
|
45
|
+
assert(deepEqual(filesGlob, filesGit), "Git and glob results aren't matching.");
|
|
44
46
|
// Filter build files
|
|
45
47
|
files = files.filter((filePath) => !isTemporaryBuildFile(filePath));
|
|
46
48
|
// Normalize
|
|
@@ -49,6 +51,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
|
|
|
49
51
|
assertPosixPath(filePath);
|
|
50
52
|
assert(!filePath.startsWith(userRootDir));
|
|
51
53
|
const filePathAbsoluteUserRootDir = path.posix.join('/', filePath);
|
|
54
|
+
assert(isPlusFile(filePathAbsoluteUserRootDir));
|
|
52
55
|
return { filePathAbsoluteUserRootDir };
|
|
53
56
|
});
|
|
54
57
|
return plusFiles;
|
|
@@ -69,7 +72,7 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
69
72
|
preserveUTF8,
|
|
70
73
|
'ls-files',
|
|
71
74
|
// Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
72
|
-
...scriptFileExtensionList.map((ext) => `"**/+*.${ext}"`),
|
|
75
|
+
...scriptFileExtensionList.map((ext) => `"**/+*.${ext}" "+*.${ext}"`),
|
|
73
76
|
// Performance gain is non-negligible.
|
|
74
77
|
// - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
75
78
|
// - When node_modules/ is untracked the performance gain could be significant?
|
|
@@ -96,6 +99,12 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
96
99
|
}
|
|
97
100
|
throw err;
|
|
98
101
|
}
|
|
102
|
+
if (debug.isActivated) {
|
|
103
|
+
debug('[git] userRootDir:', userRootDir);
|
|
104
|
+
debug('[git] cmd:', cmd);
|
|
105
|
+
debug('[git] result:', filesAll);
|
|
106
|
+
debug('[git] filesDeleted:', filesDeleted);
|
|
107
|
+
}
|
|
99
108
|
const files = [];
|
|
100
109
|
for (const filePath of filesAll) {
|
|
101
110
|
// + file?
|
|
@@ -116,14 +125,21 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
|
|
|
116
125
|
}
|
|
117
126
|
// Same as gitLsFiles() but using fast-glob
|
|
118
127
|
async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
|
|
119
|
-
const
|
|
128
|
+
const pattern = `**/+*.${scriptFileExtensions}`;
|
|
129
|
+
const options = {
|
|
120
130
|
ignore: getIgnoreAsPatterns(outDirRelativeFromUserRootDir),
|
|
121
131
|
cwd: userRootDir,
|
|
122
132
|
dot: false
|
|
123
|
-
}
|
|
133
|
+
};
|
|
134
|
+
const files = await glob(pattern, options);
|
|
124
135
|
// Make build deterministic, in order to get a stable generated hash for dist/client/assets/entries/entry-client-routing.${hash}.js
|
|
125
136
|
// https://github.com/vikejs/vike/pull/1750
|
|
126
137
|
files.sort();
|
|
138
|
+
if (debug.isActivated) {
|
|
139
|
+
debug('[glob] pattern:', pattern);
|
|
140
|
+
debug('[glob] options:', options);
|
|
141
|
+
debug('[glob] result:', files);
|
|
142
|
+
}
|
|
127
143
|
return files;
|
|
128
144
|
}
|
|
129
145
|
// Same as getIgnoreAsFilterFn() but as glob pattern
|
|
@@ -210,3 +226,37 @@ function isGitCrawlDisabled() {
|
|
|
210
226
|
const crawSettings = getEnvVarObject('VIKE_CRAWL');
|
|
211
227
|
return crawSettings?.git === false;
|
|
212
228
|
}
|
|
229
|
+
function isPlusFile(filePath) {
|
|
230
|
+
assertPosixPath(filePath);
|
|
231
|
+
if (isTemporaryBuildFile(filePath))
|
|
232
|
+
return false;
|
|
233
|
+
const fileName = filePath.split('/').pop();
|
|
234
|
+
return fileName.startsWith('+');
|
|
235
|
+
}
|
|
236
|
+
function getPlusFileValueConfigName(filePath) {
|
|
237
|
+
if (!isPlusFile(filePath))
|
|
238
|
+
return null;
|
|
239
|
+
const fileName = path.posix.basename(filePath);
|
|
240
|
+
// assertNoUnexpectedPlusSign(filePath, fileName)
|
|
241
|
+
const basename = fileName.split('.')[0];
|
|
242
|
+
assert(basename.startsWith('+'));
|
|
243
|
+
const configName = basename.slice(1);
|
|
244
|
+
assertUsage(configName !== '', `${filePath} Invalid filename ${fileName}`);
|
|
245
|
+
return configName;
|
|
246
|
+
}
|
|
247
|
+
/* https://github.com/vikejs/vike/issues/1407
|
|
248
|
+
function assertNoUnexpectedPlusSign(filePath: string, fileName: string) {
|
|
249
|
+
const dirs = path.posix.dirname(filePath).split('/')
|
|
250
|
+
dirs.forEach((dir, i) => {
|
|
251
|
+
const dirPath = dirs.slice(0, i + 1).join('/')
|
|
252
|
+
assertUsage(
|
|
253
|
+
!dir.includes('+'),
|
|
254
|
+
`Character '+' is a reserved character: remove '+' from the directory name ${dirPath}/`
|
|
255
|
+
)
|
|
256
|
+
})
|
|
257
|
+
assertUsage(
|
|
258
|
+
!fileName.slice(1).includes('+'),
|
|
259
|
+
`Character '+' is only allowed at the beginning of filenames: make sure ${filePath} doesn't contain any '+' in its filename other than its first letter`
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
*/
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { getFilesystemRouteDefinedBy };
|
|
|
3
3
|
export { isInherited };
|
|
4
4
|
export { getLocationId };
|
|
5
5
|
export { sortAfterInheritanceOrder };
|
|
6
|
-
export { isGlobalLocation };
|
|
7
6
|
export { applyFilesystemRoutingRootEffect };
|
|
8
7
|
export type { LocationId };
|
|
9
8
|
export { getLogicalPath };
|
|
@@ -46,8 +45,6 @@ declare function getFilesystemRouteString(locationId: LocationId): string;
|
|
|
46
45
|
* getLogicalPath('/pages/some-page', ['pages']) => '/some-page'
|
|
47
46
|
*/
|
|
48
47
|
declare function getLogicalPath(locationId: LocationId, ignoredDirs: string[], removeParenthesesDirs?: true): string;
|
|
49
|
-
/** Whether configs defined in `locationId` apply in every `locationIds` */
|
|
50
|
-
declare function isGlobalLocation(locationId: LocationId, locationIds: LocationId[]): boolean;
|
|
51
48
|
declare function sortAfterInheritanceOrder(locationId1: LocationId, locationId2: LocationId, locationIdPage: LocationId): -1 | 1 | 0;
|
|
52
49
|
/** Whether configs defined at `locationId1` also apply at `locationId2` */
|
|
53
50
|
declare function isInherited(locationId1: LocationId, locationId2: LocationId): boolean;
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js
CHANGED
|
@@ -3,7 +3,6 @@ export { getFilesystemRouteDefinedBy };
|
|
|
3
3
|
export { isInherited };
|
|
4
4
|
export { getLocationId };
|
|
5
5
|
export { sortAfterInheritanceOrder };
|
|
6
|
-
export { isGlobalLocation };
|
|
7
6
|
export { applyFilesystemRoutingRootEffect };
|
|
8
7
|
// For ./filesystemRouting.spec.ts
|
|
9
8
|
export { getLogicalPath };
|
|
@@ -41,10 +40,6 @@ function getLogicalPath(locationId, ignoredDirs, removeParenthesesDirs) {
|
|
|
41
40
|
assertIsPath(logicalPath);
|
|
42
41
|
return logicalPath;
|
|
43
42
|
}
|
|
44
|
-
/** Whether configs defined in `locationId` apply in every `locationIds` */
|
|
45
|
-
function isGlobalLocation(locationId, locationIds) {
|
|
46
|
-
return locationIds.every((locId) => isInherited(locationId, locId) || locationIsRendererDir(locId));
|
|
47
|
-
}
|
|
48
43
|
function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
|
|
49
44
|
assertLocationId(locationId1);
|
|
50
45
|
assertLocationId(locationId2);
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getPlusFilesAll };
|
|
2
|
-
export { getPlusFileValueConfigName };
|
|
3
2
|
export type { PlusFileValue };
|
|
4
3
|
export type { PlusFile };
|
|
5
4
|
export type { PlusFilesByLocationId };
|
|
@@ -36,4 +35,3 @@ type PlusFileValue = PlusFileCommons & {
|
|
|
36
35
|
};
|
|
37
36
|
type PlusFilesByLocationId = Record<LocationId, PlusFile[]>;
|
|
38
37
|
declare function getPlusFilesAll(userRootDir: string, esbuildCache: EsbuildCache): Promise<PlusFilesByLocationId>;
|
|
39
|
-
declare function getPlusFileValueConfigName(filePath: string): string | null;
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
export { getPlusFilesAll };
|
|
2
|
-
|
|
3
|
-
import { assert, assertPosixPath, assertUsage } from '../../../../utils.js';
|
|
2
|
+
import { assert } from '../../../../utils.js';
|
|
4
3
|
import { configDefinitionsBuiltIn } from './configDefinitionsBuiltIn.js';
|
|
5
4
|
import { getLocationId } from './filesystemRouting.js';
|
|
6
|
-
import {
|
|
7
|
-
import { crawlPlusFiles } from './crawlPlusFiles.js';
|
|
5
|
+
import { crawlPlusFiles, getPlusFileValueConfigName } from './crawlPlusFiles.js';
|
|
8
6
|
import { getConfigFileExport } from './getConfigFileExport.js';
|
|
9
7
|
import { loadConfigFile, loadValueFile } from './loadFileAtConfigTime.js';
|
|
10
8
|
import { resolvePointerImport } from './resolvePointerImport.js';
|
|
11
9
|
import { getFilePathResolved } from '../../../../shared/getFilePath.js';
|
|
12
10
|
import { assertExtensionsConventions } from './assertExtensions.js';
|
|
13
|
-
import path from 'node:path';
|
|
14
11
|
async function getPlusFilesAll(userRootDir, esbuildCache) {
|
|
15
12
|
const plusFiles = await findPlusFiles(userRootDir, null);
|
|
16
13
|
const configFiles = [];
|
|
@@ -120,35 +117,3 @@ async function findPlusFiles(userRootDir, outDirRoot) {
|
|
|
120
117
|
const plusFiles = files.map(({ filePathAbsoluteUserRootDir }) => getFilePathResolved({ filePathAbsoluteUserRootDir, userRootDir }));
|
|
121
118
|
return plusFiles;
|
|
122
119
|
}
|
|
123
|
-
function getPlusFileValueConfigName(filePath) {
|
|
124
|
-
assertPosixPath(filePath);
|
|
125
|
-
if (isTemporaryBuildFile(filePath))
|
|
126
|
-
return null;
|
|
127
|
-
const fileName = path.posix.basename(filePath);
|
|
128
|
-
// assertNoUnexpectedPlusSign(filePath, fileName)
|
|
129
|
-
const basename = fileName.split('.')[0];
|
|
130
|
-
if (!basename.startsWith('+')) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
const configName = basename.slice(1);
|
|
135
|
-
assertUsage(configName !== '', `${filePath} Invalid filename ${fileName}`);
|
|
136
|
-
return configName;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
/* https://github.com/vikejs/vike/issues/1407
|
|
140
|
-
function assertNoUnexpectedPlusSign(filePath: string, fileName: string) {
|
|
141
|
-
const dirs = path.posix.dirname(filePath).split('/')
|
|
142
|
-
dirs.forEach((dir, i) => {
|
|
143
|
-
const dirPath = dirs.slice(0, i + 1).join('/')
|
|
144
|
-
assertUsage(
|
|
145
|
-
!dir.includes('+'),
|
|
146
|
-
`Character '+' is a reserved character: remove '+' from the directory name ${dirPath}/`
|
|
147
|
-
)
|
|
148
|
-
})
|
|
149
|
-
assertUsage(
|
|
150
|
-
!fileName.slice(1).includes('+'),
|
|
151
|
-
`Character '+' is only allowed at the beginning of filenames: make sure ${filePath} doesn't contain any '+' in its filename other than its first letter`
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
*/
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js
CHANGED
|
@@ -51,7 +51,7 @@ async function loadValueFile(interfaceValueFile, configDefinitions, userRootDir,
|
|
|
51
51
|
async function loadConfigFile(configFilePath, userRootDir, visited, isExtensionConfig, esbuildCache) {
|
|
52
52
|
const { filePathAbsoluteFilesystem } = configFilePath;
|
|
53
53
|
assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem);
|
|
54
|
-
const { fileExports } = await transpileAndExecuteFile(configFilePath, userRootDir, isExtensionConfig
|
|
54
|
+
const { fileExports } = await transpileAndExecuteFile(configFilePath, userRootDir, isExtensionConfig, esbuildCache);
|
|
55
55
|
const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [...visited, filePathAbsoluteFilesystem], esbuildCache);
|
|
56
56
|
const configFile = {
|
|
57
57
|
fileExports,
|
|
@@ -10,7 +10,7 @@ type FileExports = {
|
|
|
10
10
|
};
|
|
11
11
|
type EsbuildCache = Record<string, // filePathAbsoluteFilesystem
|
|
12
12
|
Promise<FileExports>>;
|
|
13
|
-
declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string,
|
|
13
|
+
declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string, isExtensionConfig: boolean, esbuildCache: EsbuildCache): Promise<FileExports>;
|
|
14
14
|
declare function getConfigBuildErrorFormatted(err: unknown): null | string;
|
|
15
15
|
declare function getConfigExecutionErrorIntroMsg(err: unknown): string | null;
|
|
16
16
|
declare function isTemporaryBuildFile(filePath: string): boolean;
|
|
@@ -21,8 +21,9 @@ const debug = createDebugger('vike:pointer-imports');
|
|
|
21
21
|
const debugEsbuildResolve = createDebugger('vike:esbuild-resolve');
|
|
22
22
|
if (debugEsbuildResolve.isActivated)
|
|
23
23
|
debugEsbuildResolve('esbuild version', version);
|
|
24
|
-
async function transpileAndExecuteFile(filePath, userRootDir,
|
|
24
|
+
async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig, esbuildCache) {
|
|
25
25
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
26
|
+
assert(filePathAbsoluteFilesystem);
|
|
26
27
|
const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
|
|
27
28
|
if (esbuildCache[filePathAbsoluteFilesystem]) {
|
|
28
29
|
return await esbuildCache[filePathAbsoluteFilesystem];
|
|
@@ -35,12 +36,12 @@ async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile, esbu
|
|
|
35
36
|
assertWarning(false, `${pc.cyan('.h.js')} files are deprecated: simply renaming ${filePathToShowToUserResolved} to ${removeHeaderFileExtension(filePathToShowToUserResolved)} is usually enough, although you may occasionally need to use ${pc.cyan("with { type: 'pointer' }")} as explained at https://vike.dev/config#pointer-imports`, { onlyOnce: true });
|
|
36
37
|
}
|
|
37
38
|
let fileExports;
|
|
38
|
-
if (
|
|
39
|
+
if (isExtensionConfig && !isHeader && fileExtension.endsWith('js')) {
|
|
39
40
|
// This doesn't track dependencies => we should never use this for user land configs
|
|
40
41
|
fileExports = await executeFile(filePathAbsoluteFilesystem, filePath);
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
|
-
const transformImports =
|
|
44
|
+
const transformImports = isHeader ? 'all' : true;
|
|
44
45
|
const code = await transpileFile(filePath, transformImports, userRootDir);
|
|
45
46
|
fileExports = await executeTranspiledFile(filePath, code);
|
|
46
47
|
}
|
|
@@ -49,6 +50,7 @@ async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile, esbu
|
|
|
49
50
|
}
|
|
50
51
|
async function transpileFile(filePath, transformImports, userRootDir) {
|
|
51
52
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
53
|
+
assert(filePathAbsoluteFilesystem);
|
|
52
54
|
assertPosixPath(filePathAbsoluteFilesystem);
|
|
53
55
|
vikeConfigDependencies.add(filePathAbsoluteFilesystem);
|
|
54
56
|
if (debug.isActivated)
|
|
@@ -333,6 +335,7 @@ function isTemporaryBuildFile(filePath) {
|
|
|
333
335
|
const fileName = path.posix.basename(filePath);
|
|
334
336
|
return /\.build-[a-z0-9]{12}\.mjs$/.test(fileName);
|
|
335
337
|
}
|
|
338
|
+
// TODO/next-major: remove
|
|
336
339
|
function isHeaderFile(filePath) {
|
|
337
340
|
assertPosixPath(filePath);
|
|
338
341
|
const fileExtensions = getFileExtensions(filePath);
|
|
@@ -9,12 +9,13 @@ export type { VikeConfigObject };
|
|
|
9
9
|
import type { PageConfigGlobalBuildTime, PageConfigBuildTime } from '../../../../../shared/page-configs/PageConfig.js';
|
|
10
10
|
import { type ConfigDefinitions, type ConfigDefinitionInternal } from './getVikeConfig/configDefinitionsBuiltIn.js';
|
|
11
11
|
import type { ResolvedConfig } from 'vite';
|
|
12
|
-
import {
|
|
12
|
+
import { type PageConfigUserFriendly, type PageConfigsUserFriendly } from '../../../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
13
13
|
import { type PlusFile } from './getVikeConfig/getPlusFilesAll.js';
|
|
14
14
|
type VikeConfigObject = {
|
|
15
15
|
pageConfigs: PageConfigBuildTime[];
|
|
16
16
|
pageConfigGlobal: PageConfigGlobalBuildTime;
|
|
17
|
-
global:
|
|
17
|
+
global: PageConfigUserFriendly;
|
|
18
|
+
pages: PageConfigsUserFriendly;
|
|
18
19
|
};
|
|
19
20
|
declare const vikeConfigDependencies: Set<string>;
|
|
20
21
|
declare function reloadVikeConfig(config: ResolvedConfig): void;
|
|
@@ -7,7 +7,7 @@ export { getConfVal };
|
|
|
7
7
|
export { getConfigDefinitionOptional };
|
|
8
8
|
import { assertPosixPath, assert, isObject, assertUsage, assertWarning, objectEntries, hasProp, includes, assertIsNotProductionRuntime, getMostSimilar, joinEnglish, assertKeys, objectKeys, objectFromEntries, unique, isCallable, makeFirst, lowerFirst } from '../../../utils.js';
|
|
9
9
|
import { configDefinitionsBuiltIn } from './getVikeConfig/configDefinitionsBuiltIn.js';
|
|
10
|
-
import { getLocationId, getFilesystemRouteString, getFilesystemRouteDefinedBy, isInherited, sortAfterInheritanceOrder,
|
|
10
|
+
import { getLocationId, getFilesystemRouteString, getFilesystemRouteDefinedBy, isInherited, sortAfterInheritanceOrder, applyFilesystemRoutingRootEffect } from './getVikeConfig/filesystemRouting.js';
|
|
11
11
|
import { isConfigInvalid, isConfigInvalid_set } from '../../../../runtime/renderPage/isConfigInvalid.js';
|
|
12
12
|
import { getViteDevServer } from '../../../../runtime/globalContext.js';
|
|
13
13
|
import { logConfigError, logConfigErrorRecover } from '../../../shared/loggerNotProd.js';
|
|
@@ -19,7 +19,7 @@ import { resolvePointerImport } from './getVikeConfig/resolvePointerImport.js';
|
|
|
19
19
|
import { getFilePathResolved } from '../../../shared/getFilePath.js';
|
|
20
20
|
import { getConfigValueBuildTime } from '../../../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
21
21
|
import { assertExtensionsRequire } from './getVikeConfig/assertExtensions.js';
|
|
22
|
-
import {
|
|
22
|
+
import { getPageConfigGlobalUserFriendly, getPageConfigUserFriendly } from '../../../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
23
23
|
import { getConfigValuesBase } from '../../../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
24
24
|
import { getPlusFilesAll } from './getVikeConfig/getPlusFilesAll.js';
|
|
25
25
|
assertIsNotProductionRuntime();
|
|
@@ -31,6 +31,7 @@ function reloadVikeConfig(config) {
|
|
|
31
31
|
const userRootDir = config.root;
|
|
32
32
|
const vikeVitePluginOptions = config._vikeVitePluginOptions;
|
|
33
33
|
assert(vikeVitePluginOptions);
|
|
34
|
+
// TODO/now: unify with esbuildCache
|
|
34
35
|
vikeConfigDependencies.clear();
|
|
35
36
|
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, true, vikeVitePluginOptions);
|
|
36
37
|
handleReloadSideEffects();
|
|
@@ -126,7 +127,8 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
|
|
|
126
127
|
configDefinitions: {},
|
|
127
128
|
configValueSources: {}
|
|
128
129
|
},
|
|
129
|
-
global:
|
|
130
|
+
global: getPageConfigGlobalUserFriendly({ pageConfigGlobalValues: {} }),
|
|
131
|
+
pages: {}
|
|
130
132
|
};
|
|
131
133
|
return dummyData;
|
|
132
134
|
}
|
|
@@ -135,15 +137,20 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
|
|
|
135
137
|
async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
|
|
136
138
|
const esbuildCache = {};
|
|
137
139
|
const plusFilesAll = await getPlusFilesAll(userRootDir, esbuildCache);
|
|
138
|
-
assertKnownConfigs(plusFilesAll);
|
|
139
140
|
const configDefinitionsResolved = await resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache);
|
|
141
|
+
assertKnownConfigs(configDefinitionsResolved, plusFilesAll);
|
|
140
142
|
const { pageConfigGlobal, pageConfigs } = getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRootDir);
|
|
141
143
|
// interop vike(options) in vite.config.js
|
|
142
144
|
temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
|
|
143
145
|
// global
|
|
144
|
-
const
|
|
145
|
-
const global =
|
|
146
|
-
|
|
146
|
+
const pageConfigGlobalValues = getConfigValues(pageConfigGlobal);
|
|
147
|
+
const global = getPageConfigGlobalUserFriendly({ pageConfigGlobalValues });
|
|
148
|
+
// pages
|
|
149
|
+
const pages = objectFromEntries(pageConfigs.map((pageConfig) => {
|
|
150
|
+
const pageConfigValues = getConfigValues(pageConfig, true);
|
|
151
|
+
return getPageConfigUserFriendly(pageConfigGlobalValues, pageConfig, pageConfigValues);
|
|
152
|
+
}));
|
|
153
|
+
return { pageConfigs, pageConfigGlobal, global, pages };
|
|
147
154
|
}
|
|
148
155
|
async function resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache) {
|
|
149
156
|
const configDefinitionsGlobal = getConfigDefinitions(
|
|
@@ -206,13 +213,12 @@ function getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRo
|
|
|
206
213
|
return;
|
|
207
214
|
configValueSources[configName] = sources;
|
|
208
215
|
});
|
|
209
|
-
const
|
|
216
|
+
const pageConfigRoute = determineRouteFilesystem(locationId, configValueSources);
|
|
210
217
|
applyEffectsAll(configValueSources, configDefinitionsLocal);
|
|
211
218
|
const configValuesComputed = getComputed(configValueSources, configDefinitionsLocal);
|
|
212
219
|
const pageConfig = {
|
|
213
220
|
pageId: locationId,
|
|
214
|
-
|
|
215
|
-
routeFilesystem,
|
|
221
|
+
...pageConfigRoute,
|
|
216
222
|
configDefinitions: configDefinitionsLocal,
|
|
217
223
|
plusFiles: plusFilesRelevant,
|
|
218
224
|
configValueSources,
|
|
@@ -229,10 +235,9 @@ function assertPageConfigGlobal(pageConfigGlobal, plusFilesAll) {
|
|
|
229
235
|
});
|
|
230
236
|
}
|
|
231
237
|
function assertGlobalConfigLocation(configName, sources, plusFilesAll, configDefinitionsGlobal) {
|
|
232
|
-
const locationIdsAll = objectKeys(plusFilesAll);
|
|
233
238
|
// Determine existing global +config.js files
|
|
234
239
|
const configFilePathsGlobal = [];
|
|
235
|
-
const plusFilesGlobal = Object.values(objectFromEntries(objectEntries(plusFilesAll).filter(([locationId]) => isGlobalLocation(locationId,
|
|
240
|
+
const plusFilesGlobal = Object.values(objectFromEntries(objectEntries(plusFilesAll).filter(([locationId]) => isGlobalLocation(locationId, plusFilesAll)))).flat();
|
|
236
241
|
plusFilesGlobal
|
|
237
242
|
.filter((i) => i.isConfigFile)
|
|
238
243
|
.forEach((plusFile) => {
|
|
@@ -251,7 +256,7 @@ function assertGlobalConfigLocation(configName, sources, plusFilesAll, configDef
|
|
|
251
256
|
if (!filePathAbsoluteUserRootDir)
|
|
252
257
|
return;
|
|
253
258
|
assert(!plusFile.isExtensionConfig);
|
|
254
|
-
if (!isGlobalLocation(source.locationId,
|
|
259
|
+
if (!isGlobalLocation(source.locationId, plusFilesAll)) {
|
|
255
260
|
const configDef = configDefinitionsGlobal[configName];
|
|
256
261
|
assert(configDef);
|
|
257
262
|
const isConditionallyGlobal = isCallable(configDef.global);
|
|
@@ -284,7 +289,7 @@ function assertOnBeforeRenderEnv(pageConfig) {
|
|
|
284
289
|
// When using Server Routing, loading a onBeforeRender() hook on the client-side hasn't any effect (the Server Routing's client runtime never calls it); it unnecessarily bloats client bundle sizes
|
|
285
290
|
assertUsage(!(onBeforeRenderEnv.client && !isClientRouting), `Page ${pageConfig.pageId} has an onBeforeRender() hook with env ${pc.cyan(JSON.stringify(onBeforeRenderEnv))} which doesn't make sense because the page is using Server Routing: onBeforeRender() can be run in the client only when using Client Routing.`);
|
|
286
291
|
}
|
|
287
|
-
function getConfigValues(pageConfig) {
|
|
292
|
+
function getConfigValues(pageConfig, tolerateMissingValue) {
|
|
288
293
|
const configValues = {};
|
|
289
294
|
getConfigValuesBase(pageConfig, (configEnv) => !!configEnv.config, null).forEach((entry) => {
|
|
290
295
|
if (entry.configValueBase.type === 'computed') {
|
|
@@ -295,7 +300,11 @@ function getConfigValues(pageConfig) {
|
|
|
295
300
|
if (entry.configValueBase.type === 'standard') {
|
|
296
301
|
assert('sourceRelevant' in entry); // Help TS
|
|
297
302
|
const { configValueBase, sourceRelevant, configName } = entry;
|
|
298
|
-
|
|
303
|
+
if (!sourceRelevant.valueIsLoaded) {
|
|
304
|
+
if (tolerateMissingValue)
|
|
305
|
+
return;
|
|
306
|
+
assert(false);
|
|
307
|
+
}
|
|
299
308
|
const { value } = sourceRelevant;
|
|
300
309
|
configValues[configName] = { ...configValueBase, value };
|
|
301
310
|
}
|
|
@@ -304,9 +313,18 @@ function getConfigValues(pageConfig) {
|
|
|
304
313
|
const { configValueBase, sourcesRelevant, configName } = entry;
|
|
305
314
|
const values = [];
|
|
306
315
|
sourcesRelevant.forEach((source) => {
|
|
307
|
-
|
|
316
|
+
if (!source.valueIsLoaded) {
|
|
317
|
+
if (tolerateMissingValue)
|
|
318
|
+
return;
|
|
319
|
+
assert(false);
|
|
320
|
+
}
|
|
308
321
|
values.push(source.value);
|
|
309
322
|
});
|
|
323
|
+
if (values.length === 0) {
|
|
324
|
+
if (tolerateMissingValue)
|
|
325
|
+
return;
|
|
326
|
+
assert(false);
|
|
327
|
+
}
|
|
310
328
|
configValues[configName] = { ...configValueBase, value: values };
|
|
311
329
|
}
|
|
312
330
|
});
|
|
@@ -351,10 +369,9 @@ function getPlusFilesRelevant(plusFilesAll, locationIdPage) {
|
|
|
351
369
|
return plusFilesRelevant;
|
|
352
370
|
}
|
|
353
371
|
function sortForGlobal(plusFilesAll) {
|
|
354
|
-
const locationIdsAll = objectKeys(plusFilesAll);
|
|
355
372
|
const plusFilesAllSorted = Object.fromEntries(objectEntries(plusFilesAll)
|
|
356
373
|
.sort(lowerFirst(([locationId]) => locationId.split('/').length))
|
|
357
|
-
.sort(makeFirst(([locationId]) => isGlobalLocation(locationId,
|
|
374
|
+
.sort(makeFirst(([locationId]) => isGlobalLocation(locationId, plusFilesAll))));
|
|
358
375
|
return plusFilesAllSorted;
|
|
359
376
|
}
|
|
360
377
|
function resolveConfigValueSources(configName, configDef, plusFilesRelevant, userRootDir, isGlobal) {
|
|
@@ -748,13 +765,13 @@ function getComputed(configValueSources, configDefinitions) {
|
|
|
748
765
|
return configValuesComputed;
|
|
749
766
|
}
|
|
750
767
|
// Show error message upon unknown config
|
|
751
|
-
function assertKnownConfigs(plusFilesAll) {
|
|
768
|
+
function assertKnownConfigs(configDefinitionsResolved, plusFilesAll) {
|
|
752
769
|
const configDefinitionsAll = getConfigDefinitions(plusFilesAll);
|
|
753
770
|
const configNamesKnownAll = Object.keys(configDefinitionsAll);
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
const configDefinitionsLocal =
|
|
757
|
-
const configNamesKnownLocal = Object.keys(configDefinitionsLocal);
|
|
771
|
+
const configNamesGlobal = Object.keys(configDefinitionsResolved.configDefinitionsGlobal);
|
|
772
|
+
objectEntries(configDefinitionsResolved.configDefinitionsLocal).forEach(([_locationId, { configDefinitions, plusFiles }]) => {
|
|
773
|
+
const configDefinitionsLocal = configDefinitions;
|
|
774
|
+
const configNamesKnownLocal = [...Object.keys(configDefinitionsLocal), ...configNamesGlobal];
|
|
758
775
|
plusFiles.forEach((plusFile) => {
|
|
759
776
|
const configNames = getDefiningConfigNames(plusFile);
|
|
760
777
|
configNames.forEach((configName) => {
|
|
@@ -926,3 +943,10 @@ function resolveConfigEnv(configEnv, filePath) {
|
|
|
926
943
|
}
|
|
927
944
|
return configEnvResolved;
|
|
928
945
|
}
|
|
946
|
+
/** Whether configs defined in `locationId` apply to every page */
|
|
947
|
+
function isGlobalLocation(locationId, plusFilesAll) {
|
|
948
|
+
const locationIdsPage = objectEntries(plusFilesAll)
|
|
949
|
+
.filter(([_locationId, plusFiles]) => isDefiningPage(plusFiles))
|
|
950
|
+
.map(([locationId]) => locationId);
|
|
951
|
+
return locationIdsPage.every((locId) => isInherited(locationId, locId));
|
|
952
|
+
}
|
|
@@ -16,23 +16,25 @@ export { assertBuildInfo };
|
|
|
16
16
|
export { getViteConfigRuntime };
|
|
17
17
|
export { updateUserFiles };
|
|
18
18
|
export type { BuildInfo };
|
|
19
|
-
export type {
|
|
19
|
+
export type { GlobalContextInternal };
|
|
20
20
|
export type { GlobalContextPublic };
|
|
21
21
|
import type { ViteManifest } from '../shared/ViteManifest.js';
|
|
22
22
|
import type { ResolvedConfig, ViteDevServer } from 'vite';
|
|
23
|
-
import type {
|
|
23
|
+
import type { PageConfigUserFriendly, PageConfigsUserFriendly } from '../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
24
24
|
import type { ConfigVitePluginServerEntry } from '@brillout/vite-plugin-server-entry/plugin';
|
|
25
|
-
|
|
25
|
+
import { type BaseUrlsResolved } from '../shared/resolveBase.js';
|
|
26
|
+
type GlobalContextPublic = Pick<GlobalContext, 'assetsManifest' | 'config' | 'viteConfig' | 'pages' | 'baseAssets' | 'baseServer'>;
|
|
26
27
|
type PageRuntimeInfo = Awaited<ReturnType<typeof getUserFiles>>;
|
|
27
|
-
type
|
|
28
|
+
type GlobalContextInternal = GlobalContext & {
|
|
28
29
|
globalContext_public: GlobalContextPublic;
|
|
29
30
|
};
|
|
30
|
-
type
|
|
31
|
+
type GlobalContext = {
|
|
31
32
|
viteConfigRuntime: {
|
|
32
33
|
_baseViteOriginal: null | string;
|
|
33
34
|
};
|
|
34
|
-
config:
|
|
35
|
-
|
|
35
|
+
config: PageConfigUserFriendly['config'];
|
|
36
|
+
pages: PageConfigsUserFriendly;
|
|
37
|
+
} & BaseUrlsResolved & PageRuntimeInfo & ({
|
|
36
38
|
isProduction: false;
|
|
37
39
|
isPrerendering: false;
|
|
38
40
|
viteConfig: ResolvedConfig;
|
|
@@ -50,7 +52,7 @@ type GlobalContextWithoutPublicCopy = {
|
|
|
50
52
|
usesClientRouter: boolean;
|
|
51
53
|
viteConfig: ResolvedConfig;
|
|
52
54
|
})));
|
|
53
|
-
declare function getGlobalContextInternal(): Promise<
|
|
55
|
+
declare function getGlobalContextInternal(): Promise<GlobalContextInternal>;
|
|
54
56
|
/** @experimental https://vike.dev/getGlobalContext */
|
|
55
57
|
declare function getGlobalContextSync(): GlobalContextPublic;
|
|
56
58
|
/** @experimental https://vike.dev/getGlobalContext */
|
|
@@ -71,6 +73,7 @@ declare function getUserFiles(): Promise<{
|
|
|
71
73
|
allPageIds: string[];
|
|
72
74
|
pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
73
75
|
onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
76
|
+
pages: PageConfigsUserFriendly;
|
|
74
77
|
config: import("../../shared/page-configs/Config/PageContextConfig.js").ConfigResolved;
|
|
75
78
|
}>;
|
|
76
79
|
declare function setGlobalContext_buildEntry(buildEntry: unknown): Promise<void>;
|