vike 0.4.238 → 0.4.239-commit-33e55d4
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/prerender/resolvePrerenderConfig.js +3 -2
- package/dist/cjs/node/prerender/runPrerender.js +1 -0
- package/dist/cjs/node/runtime/globalContext.js +10 -0
- package/dist/cjs/node/runtime/index.js +3 -3
- package/dist/cjs/node/runtime/page-files/setup.js +3 -1
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +2 -9
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +2 -2
- package/dist/cjs/node/runtime/renderPage/csp.js +47 -0
- package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +2 -2
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -1
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -2
- package/dist/cjs/node/runtime/renderPage/headersResponse.js +48 -0
- package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.js +16 -13
- package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.js +1 -1
- package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/inferHtmlTags.js +8 -6
- package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.js +1 -1
- package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.js +1 -1
- package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/mergeScriptTags.js +5 -3
- package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets.js +2 -2
- package/dist/cjs/node/runtime/{html → renderPage/html}/propKeys.js +1 -1
- package/dist/cjs/node/runtime/{html → renderPage/html}/renderHtml.js +1 -1
- package/dist/cjs/node/runtime/{html → renderPage/html}/serializeContext.js +6 -6
- package/dist/cjs/node/runtime/{html → renderPage/html}/stream/react-streaming.js +1 -1
- package/dist/cjs/node/runtime/{html → renderPage/html}/stream.js +1 -1
- package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +17 -38
- package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +2 -2
- package/dist/cjs/node/runtime/renderPage.js +1 -1
- package/dist/cjs/node/vite/onLoad.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +32 -28
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +24 -20
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +4 -2
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +76 -74
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +18 -14
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +17 -9
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +4 -2
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +20 -18
- package/dist/cjs/node/vite/plugins/pluginCommon.js +7 -21
- package/dist/cjs/node/vite/plugins/pluginDev.js +51 -47
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +62 -57
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +107 -93
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +27 -13
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +107 -84
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +40 -21
- package/dist/cjs/node/vite/plugins/pluginPreview.js +30 -24
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +59 -33
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +4 -2
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +54 -36
- package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +8 -6
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +3 -0
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +1 -1
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +20 -22
- package/dist/cjs/shared/createGlobalContextShared.js +4 -22
- package/dist/cjs/shared/createPageContextShared.js +2 -2
- package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +62 -43
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assert.js +16 -1
- package/dist/cjs/utils/assertNodeVersion.js +3 -1
- package/dist/cjs/utils/assertVersion.js +26 -5
- package/dist/cjs/utils/joinEnglish.js +2 -1
- package/dist/cjs/utils/virtualFileId.js +15 -11
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +40 -17
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-client-routing/getPageContextCurrent.d.ts +2 -2
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +99 -85
- package/dist/esm/client/runtime-client-routing/globalContext.d.ts +39 -11
- package/dist/esm/client/runtime-client-routing/prefetch/getPrefetchSettings.d.ts +2 -2
- package/dist/esm/client/runtime-client-routing/prefetch.d.ts +2 -2
- package/dist/esm/client/runtime-client-routing/prefetch.js +2 -2
- package/dist/esm/client/runtime-client-routing/preparePageContextForPublicUsageClient.d.ts +2 -2
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +44 -29
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +40 -17
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-server-routing/globalContext.d.ts +39 -11
- package/dist/esm/client/runtime-server-routing/preparePageContextForPublicUsageClient.d.ts +2 -2
- package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +39 -11
- package/dist/esm/client/shared/execHookOnRenderClient.d.ts +2 -2
- package/dist/esm/client/shared/loadPageConfigsLazyClientSide.d.ts +1 -1
- package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +2 -3
- package/dist/esm/client/shared/preparePageContextForPublicUsageClientShared.d.ts +2 -2
- package/dist/esm/node/prerender/resolvePrerenderConfig.js +4 -3
- package/dist/esm/node/prerender/runPrerender.d.ts +61 -16
- package/dist/esm/node/prerender/runPrerender.js +2 -1
- package/dist/esm/node/runtime/globalContext.d.ts +167 -42
- package/dist/esm/node/runtime/globalContext.js +11 -1
- package/dist/esm/node/runtime/index.d.ts +3 -3
- package/dist/esm/node/runtime/index.js +3 -3
- package/dist/esm/node/runtime/page-files/setup.js +3 -1
- package/dist/esm/node/runtime/renderPage/createHttpResponse.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/createHttpResponse.js +2 -9
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +56 -12
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.js +2 -2
- package/dist/esm/node/runtime/renderPage/csp.d.ts +12 -0
- package/dist/esm/node/runtime/renderPage/csp.js +45 -0
- package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.js +2 -2
- package/dist/esm/node/runtime/renderPage/execHookServer.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/getEarlyHints.js +1 -1
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +2 -2
- package/dist/esm/node/runtime/renderPage/headersResponse.d.ts +10 -0
- package/dist/esm/node/runtime/renderPage/headersResponse.js +46 -0
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.d.ts +1 -1
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.js +16 -13
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.d.ts +1 -1
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.js +1 -1
- package/dist/esm/node/runtime/renderPage/html/injectAssets/inferHtmlTags.d.ts +10 -0
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/inferHtmlTags.js +7 -5
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.js +1 -1
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.js +1 -1
- package/dist/esm/node/runtime/renderPage/html/injectAssets/mergeScriptTags.d.ts +3 -0
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/mergeScriptTags.js +6 -4
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets.d.ts +2 -2
- package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets.js +2 -2
- package/dist/esm/node/runtime/{html → renderPage/html}/propKeys.js +1 -1
- package/dist/esm/node/runtime/{html → renderPage/html}/renderHtml.d.ts +1 -1
- package/dist/esm/node/runtime/{html → renderPage/html}/renderHtml.js +1 -1
- package/dist/esm/node/runtime/{html → renderPage/html}/serializeContext.d.ts +6 -5
- package/dist/esm/node/runtime/{html → renderPage/html}/serializeContext.js +6 -6
- package/dist/esm/node/runtime/{html → renderPage/html}/stream/react-streaming.js +1 -1
- package/dist/esm/node/runtime/{html → renderPage/html}/stream.js +1 -1
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +66 -17
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +18 -39
- package/dist/esm/node/runtime/renderPage/preparePageContextForPublicUsageServer.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.d.ts +122 -32
- package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.js +2 -2
- package/dist/esm/node/runtime/renderPage.d.ts +56 -12
- package/dist/esm/node/runtime/renderPage.js +1 -1
- package/dist/esm/node/vite/onLoad.js +1 -1
- package/dist/esm/node/vite/plugins/pluginBaseUrls.js +32 -28
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildApp.js +24 -20
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.js +4 -2
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +76 -74
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +18 -14
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +18 -10
- package/dist/esm/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +4 -2
- package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +20 -18
- package/dist/esm/node/vite/plugins/pluginCommon.js +8 -22
- package/dist/esm/node/vite/plugins/pluginDev.js +51 -47
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +62 -57
- package/dist/esm/node/vite/plugins/pluginExtractAssets.js +107 -91
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +27 -13
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +107 -84
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +41 -22
- package/dist/esm/node/vite/plugins/pluginPreview.js +30 -24
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +11 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +58 -33
- package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +4 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +2 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +56 -38
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +8 -6
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +3 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +2 -2
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.d.ts +4 -8
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +22 -24
- package/dist/esm/shared/createGlobalContextShared.d.ts +75 -19
- package/dist/esm/shared/createGlobalContextShared.js +5 -23
- package/dist/esm/shared/createPageContextShared.d.ts +2 -7
- package/dist/esm/shared/createPageContextShared.js +2 -2
- package/dist/esm/shared/getPageFiles.d.ts +1 -1
- package/dist/esm/shared/hooks/execHook.d.ts +2 -2
- package/dist/esm/shared/hooks/getHook.d.ts +3 -3
- package/dist/esm/shared/page-configs/resolveVikeConfigPublic.d.ts +91 -31
- package/dist/esm/shared/page-configs/resolveVikeConfigPublic.js +62 -43
- package/dist/esm/types/Config/ConfigResolved.d.ts +8 -0
- package/dist/esm/types/Config.d.ts +14 -6
- package/dist/esm/types/PageContext.d.ts +8 -25
- package/dist/esm/types/VikeNamespace.d.ts +0 -27
- package/dist/esm/types/index.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/assert.js +16 -1
- package/dist/esm/utils/assertNodeVersion.js +3 -1
- package/dist/esm/utils/assertVersion.d.ts +4 -3
- package/dist/esm/utils/assertVersion.js +23 -5
- package/dist/esm/utils/joinEnglish.js +2 -1
- package/dist/esm/utils/virtualFileId.d.ts +4 -0
- package/dist/esm/utils/virtualFileId.js +14 -11
- package/package.json +5 -5
- package/dist/cjs/types/Config/helpers.js +0 -2
- package/dist/esm/node/runtime/html/injectAssets/inferHtmlTags.d.ts +0 -9
- package/dist/esm/node/runtime/html/injectAssets/mergeScriptTags.d.ts +0 -2
- package/dist/esm/types/Config/PageContextConfig.d.ts +0 -15
- package/dist/esm/types/Config/helpers.d.ts +0 -10
- package/dist/esm/types/Config/helpers.js +0 -1
- /package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.js +0 -0
- /package/dist/cjs/types/Config/{PageContextConfig.js → ConfigResolved.js} +0 -0
- /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.d.ts +0 -0
- /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.d.ts +0 -0
- /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.d.ts +0 -0
- /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.js +0 -0
- /package/dist/esm/node/runtime/{html → renderPage/html}/propKeys.d.ts +0 -0
- /package/dist/esm/node/runtime/{html → renderPage/html}/stream/react-streaming.d.ts +0 -0
- /package/dist/esm/node/runtime/{html → renderPage/html}/stream.d.ts +0 -0
- /package/dist/esm/types/Config/{PageContextConfig.js → ConfigResolved.js} +0 -0
|
@@ -2,12 +2,14 @@ export { pluginWorkaroundCssModuleHmr };
|
|
|
2
2
|
function pluginWorkaroundCssModuleHmr() {
|
|
3
3
|
return {
|
|
4
4
|
name: 'vike:pluginWorkaroundCssModuleHmr',
|
|
5
|
-
handleHotUpdate
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
handleHotUpdate: {
|
|
6
|
+
handler(ctx) {
|
|
7
|
+
// prevent full reload due to non self-accepting css module.
|
|
8
|
+
// here only "?direct" module should be filtered out as it doesn't have a parent module.
|
|
9
|
+
if (ctx.file.includes('module.css')) {
|
|
10
|
+
return ctx.modules.filter((m) => !m.id?.includes('?direct'));
|
|
11
|
+
}
|
|
12
|
+
},
|
|
11
13
|
},
|
|
12
14
|
};
|
|
13
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { crawlPlusFiles };
|
|
2
2
|
export { isPlusFile };
|
|
3
3
|
export { getPlusFileValueConfigName };
|
|
4
|
-
import { assertPosixPath, assert, scriptFileExtensionPattern, assertIsNotProductionRuntime,
|
|
4
|
+
import { assertPosixPath, assert, scriptFileExtensionPattern, assertIsNotProductionRuntime, isVersionMatch, isScriptFile, scriptFileExtensionList, createDebugger, deepEqual, assertUsage, assertFilePathAbsoluteFilesystem, assertWarning, hasProp, isNotNullish, getGlobalObject, } from '../../utils.js';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { glob } from 'tinyglobby';
|
|
7
7
|
import { exec } from 'node:child_process';
|
|
@@ -147,7 +147,7 @@ async function isGitNotUsable(userRootDir) {
|
|
|
147
147
|
// - We didn't bother test which is the earliest version that works.
|
|
148
148
|
// - Git 2.32.0 doesn't seem to work: https://github.com/vikejs/vike/discussions/1549
|
|
149
149
|
// - Maybe it's because of StackBlitz: looking at the release notes, Git 2.32.0 should be working.
|
|
150
|
-
if (!
|
|
150
|
+
if (!isVersionMatch(gitVersion, ['2.43.1']))
|
|
151
151
|
return true;
|
|
152
152
|
}
|
|
153
153
|
// Is userRootDir inside a Git repository?
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { getVikeConfig };
|
|
2
|
+
export type { VikeConfig };
|
|
1
3
|
export { getVikeConfigInternal };
|
|
2
4
|
export { getVikeConfigInternalOptional };
|
|
3
5
|
export { getVikeConfigInternalSync };
|
|
@@ -9,11 +11,9 @@ export { getConfigDefinitionOptional };
|
|
|
9
11
|
export { getVikeConfigFromCliOrEnv };
|
|
10
12
|
export type { VikeConfigInternal };
|
|
11
13
|
export type { PageConfigBuildTimeBeforeComputed };
|
|
12
|
-
export { getVikeConfig };
|
|
13
|
-
export type { VikeConfig };
|
|
14
14
|
import type { PageConfigGlobalBuildTime, PageConfigBuildTime } from '../../../types/PageConfig.js';
|
|
15
15
|
import { type ConfigDefinitionsInternal, type ConfigDefinitionInternal } from './resolveVikeConfigInternal/configDefinitionsBuiltIn.js';
|
|
16
|
-
import { type
|
|
16
|
+
import { type GlobalConfigPublic } from '../../../shared/page-configs/resolveVikeConfigPublic.js';
|
|
17
17
|
import { type PlusFile } from './resolveVikeConfigInternal/getPlusFilesAll.js';
|
|
18
18
|
import type { PrerenderContextPublic } from '../../prerender/runPrerender.js';
|
|
19
19
|
import type { ResolvedConfig, UserConfig } from 'vite';
|
|
@@ -28,13 +28,9 @@ type PrerenderContext = {
|
|
|
28
28
|
} & ({
|
|
29
29
|
[K in keyof PrerenderContextPublic]: null;
|
|
30
30
|
} | PrerenderContextPublic);
|
|
31
|
-
type VikeConfigInternal = {
|
|
31
|
+
type VikeConfigInternal = GlobalConfigPublic & {
|
|
32
32
|
_pageConfigs: PageConfigBuildTime[];
|
|
33
33
|
_pageConfigGlobal: PageConfigGlobalBuildTime;
|
|
34
|
-
config: VikeConfigPublicGlobal['config'];
|
|
35
|
-
_from: VikeConfigPublicGlobal['_from'];
|
|
36
|
-
pages: Record<string, // pageId
|
|
37
|
-
VikeConfigPublicPageEagerLoaded>;
|
|
38
34
|
_vikeConfigDependencies: Set<string>;
|
|
39
35
|
prerenderContext: PrerenderContext;
|
|
40
36
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Public usage
|
|
2
|
+
export { getVikeConfig };
|
|
1
3
|
// Internal usage
|
|
2
4
|
export { getVikeConfigInternal };
|
|
3
5
|
export { getVikeConfigInternalOptional };
|
|
@@ -8,8 +10,6 @@ export { isV1Design };
|
|
|
8
10
|
export { getConfVal };
|
|
9
11
|
export { getConfigDefinitionOptional };
|
|
10
12
|
export { getVikeConfigFromCliOrEnv };
|
|
11
|
-
// Public usage
|
|
12
|
-
export { getVikeConfig };
|
|
13
13
|
import { assertPosixPath, assert, isObject, assertUsage, assertWarning, objectEntries, hasProp, includes, assertIsNotProductionRuntime, getMostSimilar, joinEnglish, assertKeys, objectKeys, objectFromEntries, unique, isCallable, makeFirst, lowerFirst, makeLast, genPromise, checkType, objectAssign, getGlobalObject, } from '../utils.js';
|
|
14
14
|
import { configDefinitionsBuiltIn, } from './resolveVikeConfigInternal/configDefinitionsBuiltIn.js';
|
|
15
15
|
import { getLocationId, getFilesystemRouteString, getFilesystemRouteDefinedBy, isInherited, sortAfterInheritanceOrder, applyFilesystemRoutingRootEffect, } from './resolveVikeConfigInternal/filesystemRouting.js';
|
|
@@ -22,7 +22,7 @@ import { loadPointerImport, loadValueFile } from './resolveVikeConfigInternal/lo
|
|
|
22
22
|
import { resolvePointerImport } from './resolveVikeConfigInternal/resolvePointerImport.js';
|
|
23
23
|
import { getFilePathResolved } from './getFilePath.js';
|
|
24
24
|
import { getConfigValueBuildTime } from '../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
25
|
-
import {
|
|
25
|
+
import { resolveGlobalConfigPublic, } from '../../../shared/page-configs/resolveVikeConfigPublic.js';
|
|
26
26
|
import { getConfigValuesBase, isJsonValue } from '../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
27
27
|
import { getPlusFilesAll, } from './resolveVikeConfigInternal/getPlusFilesAll.js';
|
|
28
28
|
import { getEnvVarObject } from './getEnvVarObject.js';
|
|
@@ -170,31 +170,26 @@ async function resolveVikeConfigInternal(userRootDir, vikeVitePluginOptions, esb
|
|
|
170
170
|
// Backwards compatibility for vike(options) in vite.config.js
|
|
171
171
|
temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
|
|
172
172
|
setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved);
|
|
173
|
-
|
|
174
|
-
const pageConfigGlobalValues = getConfigValues(pageConfigGlobal);
|
|
175
|
-
const vikeConfigPublicGlobal = resolveVikeConfigPublicGlobal({ pageConfigGlobalValues });
|
|
176
|
-
// pages
|
|
177
|
-
const vikeConfigPublicPagesEager = objectFromEntries(pageConfigs.map((pageConfig) => {
|
|
178
|
-
const pageConfigValues = getConfigValues(pageConfig, true);
|
|
179
|
-
return resolveVikeConfigPublicPageEagerLoaded(pageConfigGlobalValues, pageConfig, pageConfigValues);
|
|
180
|
-
}));
|
|
173
|
+
const globalConfigPublic = resolveGlobalConfig(pageConfigGlobal, pageConfigs);
|
|
181
174
|
const prerenderContext = resolvePrerenderContext({
|
|
182
|
-
config:
|
|
183
|
-
_from:
|
|
175
|
+
config: globalConfigPublic.config,
|
|
176
|
+
_from: globalConfigPublic._from,
|
|
184
177
|
_pageConfigs: pageConfigs,
|
|
185
178
|
});
|
|
186
179
|
const vikeConfig = {
|
|
180
|
+
...globalConfigPublic,
|
|
181
|
+
prerenderContext,
|
|
187
182
|
_pageConfigs: pageConfigs,
|
|
188
183
|
_pageConfigGlobal: pageConfigGlobal,
|
|
189
|
-
config: vikeConfigPublicGlobal.config,
|
|
190
|
-
_from: vikeConfigPublicGlobal._from,
|
|
191
|
-
pages: vikeConfigPublicPagesEager,
|
|
192
|
-
prerenderContext,
|
|
193
184
|
_vikeConfigDependencies: esbuildCache.vikeConfigDependencies,
|
|
194
185
|
};
|
|
195
186
|
globalObject.vikeConfigSync = vikeConfig;
|
|
196
187
|
return vikeConfig;
|
|
197
188
|
}
|
|
189
|
+
function resolveGlobalConfig(pageConfigGlobal, pageConfigs) {
|
|
190
|
+
const globalConfigPublic = resolveGlobalConfigPublic(pageConfigs, pageConfigGlobal, getConfigValues);
|
|
191
|
+
return globalConfigPublic;
|
|
192
|
+
}
|
|
198
193
|
async function resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache) {
|
|
199
194
|
const plusFilesAllOrdered = Object.values(plusFilesAll)
|
|
200
195
|
.flat()
|
|
@@ -358,7 +353,8 @@ function assertOnBeforeRenderEnv(pageConfig) {
|
|
|
358
353
|
// 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
|
|
359
354
|
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.`);
|
|
360
355
|
}
|
|
361
|
-
function getConfigValues(pageConfig,
|
|
356
|
+
function getConfigValues(pageConfig, isGlobalConfig) {
|
|
357
|
+
const tolerateMissingValue = !isGlobalConfig;
|
|
362
358
|
const configValues = {};
|
|
363
359
|
getConfigValuesBase(pageConfig, { isForConfig: true }, null).forEach((entry) => {
|
|
364
360
|
if (entry.configValueBase.type === 'computed') {
|
|
@@ -1125,11 +1121,15 @@ function restartViteDevServer() {
|
|
|
1125
1121
|
removeSuperfluousViteLog_disable();
|
|
1126
1122
|
}
|
|
1127
1123
|
function getVikeConfigDummy(esbuildCache) {
|
|
1128
|
-
const globalDummy = resolveVikeConfigPublicGlobal({ pageConfigGlobalValues: {} });
|
|
1129
1124
|
const pageConfigsDummy = [];
|
|
1125
|
+
const pageConfigGlobalDummy = {
|
|
1126
|
+
configValueSources: {},
|
|
1127
|
+
configDefinitions: {},
|
|
1128
|
+
};
|
|
1129
|
+
const globalConfigPublicDummy = resolveGlobalConfig(pageConfigGlobalDummy, pageConfigsDummy);
|
|
1130
1130
|
const prerenderContextDummy = resolvePrerenderContext({
|
|
1131
|
-
config:
|
|
1132
|
-
_from:
|
|
1131
|
+
config: globalConfigPublicDummy.config,
|
|
1132
|
+
_from: globalConfigPublicDummy._from,
|
|
1133
1133
|
_pageConfigs: pageConfigsDummy,
|
|
1134
1134
|
});
|
|
1135
1135
|
const vikeConfigDummy = {
|
|
@@ -1138,9 +1138,7 @@ function getVikeConfigDummy(esbuildCache) {
|
|
|
1138
1138
|
configDefinitions: {},
|
|
1139
1139
|
configValueSources: {},
|
|
1140
1140
|
},
|
|
1141
|
-
|
|
1142
|
-
_from: globalDummy._from,
|
|
1143
|
-
pages: {},
|
|
1141
|
+
...globalConfigPublicDummy,
|
|
1144
1142
|
prerenderContext: prerenderContextDummy,
|
|
1145
1143
|
_vikeConfigDependencies: esbuildCache.vikeConfigDependencies,
|
|
1146
1144
|
};
|
|
@@ -9,11 +9,49 @@ import type { GlobalContextServerInternal } from '../node/runtime/globalContext.
|
|
|
9
9
|
import type { GlobalContextClientInternal } from '../client/runtime-client-routing/globalContext.js';
|
|
10
10
|
import { type Hook } from './hooks/getHook.js';
|
|
11
11
|
declare const getGlobalContextSyncErrMsg = "The global context isn't set yet, call getGlobalContextSync() later or use getGlobalContext() instead.";
|
|
12
|
-
declare function createGlobalContextShared<GlobalContextAdded extends
|
|
13
|
-
globalContext?:
|
|
12
|
+
declare function createGlobalContextShared<GlobalContextAdded extends {}, GlobalContextAddedAsync extends {}>(virtualFileExportsGlobalEntry: unknown, globalObject: {
|
|
13
|
+
globalContext?: {};
|
|
14
14
|
onCreateGlobalContextHooks?: Hook[];
|
|
15
15
|
previousCreateGlobalContextPromise?: Promise<void>;
|
|
16
16
|
}, addGlobalContext?: (globalContext: GlobalContextBase) => GlobalContextAdded, addGlobalContextTmp?: (globalContext: GlobalContextBase) => Promise<GlobalContextAdded>, addGlobalContextAsync?: (globalContext: GlobalContextBase) => Promise<GlobalContextAddedAsync>): Promise<{
|
|
17
|
+
_globalConfigPublic: {
|
|
18
|
+
pages: {
|
|
19
|
+
[k: string]: {
|
|
20
|
+
config: import("../types/index.js").ConfigResolved;
|
|
21
|
+
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
22
|
+
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
23
|
+
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
24
|
+
} & ({
|
|
25
|
+
route: import("../types/Config.js").Route;
|
|
26
|
+
isErrorPage?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
route?: undefined;
|
|
29
|
+
isErrorPage: true;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
config: import("../types/index.js").ConfigResolved;
|
|
33
|
+
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
34
|
+
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
35
|
+
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
36
|
+
};
|
|
37
|
+
pages: {
|
|
38
|
+
[k: string]: {
|
|
39
|
+
config: import("../types/index.js").ConfigResolved;
|
|
40
|
+
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
41
|
+
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
42
|
+
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
43
|
+
} & ({
|
|
44
|
+
route: import("../types/Config.js").Route;
|
|
45
|
+
isErrorPage?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
route?: undefined;
|
|
48
|
+
isErrorPage: true;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
config: import("../types/index.js").ConfigResolved;
|
|
52
|
+
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
53
|
+
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
54
|
+
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
17
55
|
/**
|
|
18
56
|
* Useful for distinguishing `globalContext` from other objects and narrowing down TypeScript unions.
|
|
19
57
|
*
|
|
@@ -26,20 +64,48 @@ declare function createGlobalContextShared<GlobalContextAdded extends Record<str
|
|
|
26
64
|
_pageConfigs: PageConfigRuntime[];
|
|
27
65
|
_pageConfigGlobal: import("../types/PageConfig.js").PageConfigGlobalRuntime;
|
|
28
66
|
_allPageIds: string[];
|
|
29
|
-
|
|
67
|
+
} & GlobalContextAdded & Awaited<GlobalContextAddedAsync>>;
|
|
68
|
+
type GlobalContextBasePublic = Pick<GlobalContextBase, 'config' | 'pages' | 'isGlobalContext'>;
|
|
69
|
+
type GlobalContextBase = ReturnType<typeof createGlobalContextBase>;
|
|
70
|
+
declare function createGlobalContextBase(virtualFileExportsGlobalEntry: unknown): {
|
|
71
|
+
_globalConfigPublic: {
|
|
72
|
+
pages: {
|
|
73
|
+
[k: string]: {
|
|
74
|
+
config: import("../types/index.js").ConfigResolved;
|
|
75
|
+
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
76
|
+
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
77
|
+
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
78
|
+
} & ({
|
|
79
|
+
route: import("../types/Config.js").Route;
|
|
80
|
+
isErrorPage?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
route?: undefined;
|
|
83
|
+
isErrorPage: true;
|
|
84
|
+
});
|
|
85
|
+
};
|
|
30
86
|
config: import("../types/index.js").ConfigResolved;
|
|
31
87
|
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
32
88
|
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
33
89
|
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
34
90
|
};
|
|
35
|
-
config: import("../types/index.js").ConfigResolved;
|
|
36
91
|
pages: {
|
|
37
|
-
[k: string]:
|
|
92
|
+
[k: string]: {
|
|
93
|
+
config: import("../types/index.js").ConfigResolved;
|
|
94
|
+
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
95
|
+
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
96
|
+
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
97
|
+
} & ({
|
|
98
|
+
route: import("../types/Config.js").Route;
|
|
99
|
+
isErrorPage?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
route?: undefined;
|
|
102
|
+
isErrorPage: true;
|
|
103
|
+
});
|
|
38
104
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
105
|
+
config: import("../types/index.js").ConfigResolved;
|
|
106
|
+
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
107
|
+
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
108
|
+
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
43
109
|
/**
|
|
44
110
|
* Useful for distinguishing `globalContext` from other objects and narrowing down TypeScript unions.
|
|
45
111
|
*
|
|
@@ -52,14 +118,4 @@ declare function createGlobalContextBase(virtualFileExportsGlobalEntry: unknown)
|
|
|
52
118
|
_pageConfigs: PageConfigRuntime[];
|
|
53
119
|
_pageConfigGlobal: import("../types/PageConfig.js").PageConfigGlobalRuntime;
|
|
54
120
|
_allPageIds: string[];
|
|
55
|
-
_vikeConfigPublicGlobal: {
|
|
56
|
-
config: import("../types/index.js").ConfigResolved;
|
|
57
|
-
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
58
|
-
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
59
|
-
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
60
|
-
};
|
|
61
|
-
config: import("../types/index.js").ConfigResolved;
|
|
62
|
-
pages: {
|
|
63
|
-
[k: string]: import("./page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEagerLoaded;
|
|
64
|
-
};
|
|
65
121
|
};
|
|
@@ -2,7 +2,7 @@ export { createGlobalContextShared };
|
|
|
2
2
|
export { getGlobalContextSyncErrMsg };
|
|
3
3
|
import { assert, changeEnumerable, genPromise, objectAssign, objectReplace, unique } from './utils.js';
|
|
4
4
|
import { parseVirtualFileExportsGlobalEntry } from './getPageFiles/parseVirtualFileExportsGlobalEntry.js';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveGlobalContextConfig } from './page-configs/resolveVikeConfigPublic.js';
|
|
6
6
|
import { execHookGlobal } from './hooks/execHook.js';
|
|
7
7
|
import { prepareGlobalContextForPublicUsage } from './prepareGlobalContextForPublicUsage.js';
|
|
8
8
|
import { getHookFromPageConfigGlobalCumulative } from './hooks/getHook.js';
|
|
@@ -70,7 +70,9 @@ addGlobalContextTmp, addGlobalContextAsync) {
|
|
|
70
70
|
return globalObject.globalContext;
|
|
71
71
|
}
|
|
72
72
|
function createGlobalContextBase(virtualFileExportsGlobalEntry) {
|
|
73
|
-
const { pageFilesAll,
|
|
73
|
+
const { pageFilesAll, pageConfigs, pageConfigGlobal } = parseVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry);
|
|
74
|
+
const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
|
|
75
|
+
const globalContextAddendum = resolveGlobalContextConfig(pageConfigs, pageConfigGlobal);
|
|
74
76
|
const globalContext = {
|
|
75
77
|
/**
|
|
76
78
|
* Useful for distinguishing `globalContext` from other objects and narrowing down TypeScript unions.
|
|
@@ -84,31 +86,11 @@ function createGlobalContextBase(virtualFileExportsGlobalEntry) {
|
|
|
84
86
|
_pageConfigs: pageConfigs,
|
|
85
87
|
_pageConfigGlobal: pageConfigGlobal,
|
|
86
88
|
_allPageIds: allPageIds,
|
|
87
|
-
|
|
88
|
-
config: vikeConfigPublicGlobal.config,
|
|
89
|
-
pages: vikeConfigPublicPagesEager,
|
|
89
|
+
...globalContextAddendum,
|
|
90
90
|
};
|
|
91
91
|
changeEnumerable(globalContext, '_isOriginalObject', false);
|
|
92
92
|
return globalContext;
|
|
93
93
|
}
|
|
94
|
-
function getConfigsAll(virtualFileExportsGlobalEntry) {
|
|
95
|
-
const { pageFilesAll, pageConfigs, pageConfigGlobal } = parseVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry);
|
|
96
|
-
const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
|
|
97
|
-
const vikeConfigPublicGlobal = resolveVikeConfigPublicGlobal({
|
|
98
|
-
pageConfigGlobalValues: pageConfigGlobal.configValues,
|
|
99
|
-
});
|
|
100
|
-
const vikeConfigPublicPagesEager = Object.fromEntries(pageConfigs.map((pageConfig) => {
|
|
101
|
-
return resolveVikeConfigPublicPageEagerLoaded(pageConfigGlobal.configValues, pageConfig, pageConfig.configValues);
|
|
102
|
-
}));
|
|
103
|
-
return {
|
|
104
|
-
pageFilesAll,
|
|
105
|
-
allPageIds,
|
|
106
|
-
pageConfigs,
|
|
107
|
-
pageConfigGlobal,
|
|
108
|
-
vikeConfigPublicGlobal,
|
|
109
|
-
vikeConfigPublicPagesEager,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
94
|
function getAllPageIds(pageFilesAll, pageConfigs) {
|
|
113
95
|
const fileIds = pageFilesAll.filter(({ isDefaultPageFile }) => !isDefaultPageFile).map(({ pageId }) => pageId);
|
|
114
96
|
const allPageIds = unique(fileIds);
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
export { createPageContextShared };
|
|
2
2
|
export { createPageContextObject };
|
|
3
|
-
import type {
|
|
3
|
+
import type { GlobalConfigPublic } from './page-configs/resolveVikeConfigPublic.js';
|
|
4
4
|
import { type PageContextPrepareMinimum } from './preparePageContextForPublicUsage.js';
|
|
5
|
-
declare function createPageContextShared<T extends PageContextPrepareMinimum>(pageContextCreated: T,
|
|
6
|
-
config: import("../types/index.js").ConfigResolved;
|
|
7
|
-
_source: import("./page-configs/resolveVikeConfigPublic.js").Source;
|
|
8
|
-
_sources: import("./page-configs/resolveVikeConfigPublic.js").Sources;
|
|
9
|
-
_from: import("./page-configs/resolveVikeConfigPublic.js").From;
|
|
10
|
-
};
|
|
5
|
+
declare function createPageContextShared<T extends PageContextPrepareMinimum>(pageContextCreated: T, globalConfigPublic: GlobalConfigPublic): T & GlobalConfigPublic;
|
|
11
6
|
declare function createPageContextObject(): {
|
|
12
7
|
_isOriginalObject: true;
|
|
13
8
|
isPageContext: true;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { createPageContextShared };
|
|
2
2
|
export { createPageContextObject };
|
|
3
3
|
import { changeEnumerable, objectAssign } from './utils.js';
|
|
4
|
-
function createPageContextShared(pageContextCreated,
|
|
5
|
-
objectAssign(pageContextCreated,
|
|
4
|
+
function createPageContextShared(pageContextCreated, globalConfigPublic) {
|
|
5
|
+
objectAssign(pageContextCreated, globalConfigPublic);
|
|
6
6
|
return pageContextCreated;
|
|
7
7
|
}
|
|
8
8
|
function createPageContextObject() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { PageFile } from './getPageFiles/getPageFileObject.js';
|
|
2
|
-
export type { ExportsAll,
|
|
2
|
+
export type { ExportsAll, PageContextConfig } from './page-configs/resolveVikeConfigPublic.js';
|
|
3
3
|
export { getPageFilesClientSide } from './getPageFiles/getAllPageIdFiles.js';
|
|
4
4
|
export { getPageFilesServerSide } from './getPageFiles/getAllPageIdFiles.js';
|
|
@@ -11,14 +11,14 @@ export { isUserHookError };
|
|
|
11
11
|
export type { PageContextExecHook };
|
|
12
12
|
import type { PageContextClient, PageContextServer } from '../../types/PageContext.js';
|
|
13
13
|
import type { Hook, HookLoc } from './getHook.js';
|
|
14
|
-
import type {
|
|
14
|
+
import type { PageContextConfig } from '../getPageFiles.js';
|
|
15
15
|
import type { HookName, HookNameGlobal } from '../../types/Config.js';
|
|
16
16
|
import type { PageConfigGlobalRuntime } from '../../types/PageConfig.js';
|
|
17
17
|
import type { PageContextForPublicUsageServer } from '../../node/runtime/renderPage/preparePageContextForPublicUsageServer.js';
|
|
18
18
|
import type { PageContextForPublicUsageClientShared } from '../../client/shared/preparePageContextForPublicUsageClientShared.js';
|
|
19
19
|
import { type PageContextPrepareMinimum } from '../preparePageContextForPublicUsage.js';
|
|
20
20
|
import type { GlobalContextPrepareMinimum } from '../prepareGlobalContextForPublicUsage.js';
|
|
21
|
-
type PageContextExecHook =
|
|
21
|
+
type PageContextExecHook = PageContextConfig & PageContextForPublicUsage;
|
|
22
22
|
type PageContextForPublicUsage = PageContextForPublicUsageServer | PageContextForPublicUsageClientShared;
|
|
23
23
|
type HookWithResult = Hook & {
|
|
24
24
|
hookReturn: unknown;
|
|
@@ -9,7 +9,7 @@ export type { HookLoc };
|
|
|
9
9
|
export type { HookTimeout };
|
|
10
10
|
export type { HooksTimeoutProvidedByUser };
|
|
11
11
|
export { getHookTimeoutDefault };
|
|
12
|
-
import type {
|
|
12
|
+
import type { PageContextConfig } from '../getPageFiles.js';
|
|
13
13
|
import type { HookNameOld, HookNamePage, HookNameGlobal, HookName } from '../../types/Config.js';
|
|
14
14
|
import type { PageConfigGlobalRuntime, PageConfigRuntime } from '../../types/PageConfig.js';
|
|
15
15
|
import type { GlobalContextPrepareMinimum } from '../prepareGlobalContextForPublicUsage.js';
|
|
@@ -28,8 +28,8 @@ type HookTimeout = {
|
|
|
28
28
|
warning: number | false;
|
|
29
29
|
};
|
|
30
30
|
type HooksTimeoutProvidedByUser = false | Partial<Record<HookNameOld, false | Partial<HookTimeout>>>;
|
|
31
|
-
declare function getHookFromPageContext(pageContext:
|
|
32
|
-
declare function getHookFromPageContextNew(hookName: HookName, pageContext:
|
|
31
|
+
declare function getHookFromPageContext(pageContext: PageContextConfig, hookName: HookNameOld): null | Hook;
|
|
32
|
+
declare function getHookFromPageContextNew(hookName: HookName, pageContext: PageContextConfig): Hook[];
|
|
33
33
|
declare function getHookFromPageConfig(pageConfig: PageConfigRuntime, hookName: HookNamePage): null | Hook;
|
|
34
34
|
declare function getHookFromPageConfigGlobal(pageConfigGlobal: PageConfigGlobalRuntime, hookName: HookNameGlobal): null | Hook;
|
|
35
35
|
declare function getHookFromPageConfigGlobalCumulative(pageConfigGlobal: PageConfigGlobalRuntime, hookName: HookNameGlobal): Hook[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export type {
|
|
6
|
-
export type { VikeConfigPublicPageLazyLoaded };
|
|
1
|
+
export { resolveGlobalConfigPublic };
|
|
2
|
+
export { resolvePageContextConfig };
|
|
3
|
+
export { resolveGlobalContextConfig };
|
|
4
|
+
export type { PageContextConfig };
|
|
5
|
+
export type { GlobalConfigPublic };
|
|
7
6
|
export type { Source };
|
|
8
7
|
export type { Sources };
|
|
9
8
|
export type { From };
|
|
@@ -11,9 +10,9 @@ export type { ExportsAll };
|
|
|
11
10
|
export type { ConfigEntries };
|
|
12
11
|
import type { FileType } from '../getPageFiles/fileTypes.js';
|
|
13
12
|
import type { PageFile } from '../getPageFiles/getPageFileObject.js';
|
|
14
|
-
import type { ConfigValues, PageConfigBuildTime, PageConfigGlobalRuntime, PageConfigRuntime, PageConfigRuntimeLoaded } from '../../types/PageConfig.js';
|
|
13
|
+
import type { ConfigValues, PageConfigBuildTime, PageConfigGlobalBuildTime, PageConfigGlobalRuntime, PageConfigRuntime, PageConfigRuntimeLoaded } from '../../types/PageConfig.js';
|
|
15
14
|
import { type ConfigDefinedAtOptional } from './getConfigDefinedAt.js';
|
|
16
|
-
import type { ConfigResolved } from '../../types/Config/
|
|
15
|
+
import type { ConfigResolved } from '../../types/Config/ConfigResolved.js';
|
|
17
16
|
import type { Route } from '../../types/Config.js';
|
|
18
17
|
type ExportsAll = Record<string, {
|
|
19
18
|
exportValue: unknown;
|
|
@@ -35,17 +34,6 @@ type ConfigEntries = Record<string, {
|
|
|
35
34
|
configDefinedAt: ConfigDefinedAtOptional;
|
|
36
35
|
configDefinedByFile: string | null;
|
|
37
36
|
}[]>;
|
|
38
|
-
type VikeConfigPublicPageLazyLoaded = {
|
|
39
|
-
config: ConfigResolved;
|
|
40
|
-
source: Source;
|
|
41
|
-
sources: Sources;
|
|
42
|
-
from: From;
|
|
43
|
-
configEntries: ConfigEntries;
|
|
44
|
-
exports: Record<string, unknown>;
|
|
45
|
-
exportsAll: ExportsAll;
|
|
46
|
-
/** @deprecated */
|
|
47
|
-
pageExports: Record<string, unknown>;
|
|
48
|
-
};
|
|
49
37
|
type From = {
|
|
50
38
|
configsStandard: Record<string, // configName
|
|
51
39
|
SourceConfigsStandard>;
|
|
@@ -77,11 +65,34 @@ type SourceConfigsComputed = {
|
|
|
77
65
|
definedAt: 'Vike';
|
|
78
66
|
value: unknown;
|
|
79
67
|
};
|
|
80
|
-
type
|
|
68
|
+
type PageContextConfig = {
|
|
69
|
+
/** The page's configuration values.
|
|
70
|
+
*
|
|
71
|
+
* https://vike.dev/config
|
|
72
|
+
* https://vike.dev/pageContext#config
|
|
73
|
+
*/
|
|
81
74
|
config: ConfigResolved;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
source: Source;
|
|
76
|
+
sources: Sources;
|
|
77
|
+
from: From;
|
|
78
|
+
/** The page's configuration, including the configs origin and overridden configs.
|
|
79
|
+
*
|
|
80
|
+
* https://vike.dev/config
|
|
81
|
+
*/
|
|
82
|
+
configEntries: ConfigEntries;
|
|
83
|
+
/** Custom Exports/Hooks.
|
|
84
|
+
*
|
|
85
|
+
* https://vike.dev/exports
|
|
86
|
+
*/
|
|
87
|
+
exports: Record<string, unknown>;
|
|
88
|
+
/**
|
|
89
|
+
* Same as `pageContext.exports` but cumulative.
|
|
90
|
+
*
|
|
91
|
+
* https://vike.dev/exports
|
|
92
|
+
*/
|
|
93
|
+
exportsAll: ExportsAll;
|
|
94
|
+
/** @deprecated */
|
|
95
|
+
pageExports: Record<string, unknown>;
|
|
85
96
|
};
|
|
86
97
|
type WithRoute = {
|
|
87
98
|
route: Route;
|
|
@@ -90,12 +101,61 @@ type WithRoute = {
|
|
|
90
101
|
route?: undefined;
|
|
91
102
|
isErrorPage: true;
|
|
92
103
|
};
|
|
93
|
-
type
|
|
94
|
-
type
|
|
95
|
-
declare function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
type PageConfigPublicWithRoute = ConfigPublic & WithRoute;
|
|
105
|
+
type ConfigPublic = ReturnType<typeof getPublicCopy>;
|
|
106
|
+
declare function getPublicCopy(configInternal: ReturnType<typeof resolveConfigPublic_V1Design>): {
|
|
107
|
+
config: ConfigResolved;
|
|
108
|
+
_source: Source;
|
|
109
|
+
_sources: Sources;
|
|
110
|
+
_from: From;
|
|
111
|
+
};
|
|
112
|
+
declare function resolvePageContextConfig(pageFiles: PageFile[], // V0.4 design
|
|
100
113
|
pageConfig: PageConfigRuntimeLoaded | null, // V1 design
|
|
101
|
-
pageConfigGlobal: PageConfigGlobalRuntime):
|
|
114
|
+
pageConfigGlobal: PageConfigGlobalRuntime): PageContextConfig;
|
|
115
|
+
declare function resolveGlobalContextConfig(pageConfigs: PageConfigRuntime[], pageConfigGlobal: PageConfigGlobalRuntime): {
|
|
116
|
+
_globalConfigPublic: {
|
|
117
|
+
pages: {
|
|
118
|
+
[k: string]: PageConfigPublicWithRoute;
|
|
119
|
+
};
|
|
120
|
+
config: ConfigResolved;
|
|
121
|
+
_source: Source;
|
|
122
|
+
_sources: Sources;
|
|
123
|
+
_from: From;
|
|
124
|
+
};
|
|
125
|
+
pages: {
|
|
126
|
+
[k: string]: PageConfigPublicWithRoute;
|
|
127
|
+
};
|
|
128
|
+
config: ConfigResolved;
|
|
129
|
+
_source: Source;
|
|
130
|
+
_sources: Sources;
|
|
131
|
+
_from: From;
|
|
132
|
+
};
|
|
133
|
+
type GlobalConfigPublic = Omit<ReturnType<typeof resolveGlobalConfigPublic>, '_globalConfigPublic'>;
|
|
134
|
+
declare function resolveGlobalConfigPublic<PageConfig extends PageConfigRuntime | PageConfigBuildTime, PageConfigGlobal extends PageConfigGlobalRuntime | PageConfigGlobalBuildTime>(pageConfigs: PageConfig[], pageConfigGlobal: PageConfigGlobal, getConfigValues: (config: PageConfig | PageConfigGlobal, isGlobalConfig?: true) => ConfigValues): {
|
|
135
|
+
_globalConfigPublic: {
|
|
136
|
+
pages: {
|
|
137
|
+
[k: string]: PageConfigPublicWithRoute;
|
|
138
|
+
};
|
|
139
|
+
config: ConfigResolved;
|
|
140
|
+
_source: Source;
|
|
141
|
+
_sources: Sources;
|
|
142
|
+
_from: From;
|
|
143
|
+
};
|
|
144
|
+
pages: {
|
|
145
|
+
[k: string]: PageConfigPublicWithRoute;
|
|
146
|
+
};
|
|
147
|
+
config: ConfigResolved;
|
|
148
|
+
_source: Source;
|
|
149
|
+
_sources: Sources;
|
|
150
|
+
_from: From;
|
|
151
|
+
};
|
|
152
|
+
declare function resolveConfigPublic_V1Design(pageConfig: {
|
|
153
|
+
configValues: ConfigValues;
|
|
154
|
+
}): {
|
|
155
|
+
config: ConfigResolved;
|
|
156
|
+
configEntries: ConfigEntries;
|
|
157
|
+
exportsAll: ExportsAll;
|
|
158
|
+
source: Source;
|
|
159
|
+
sources: Sources;
|
|
160
|
+
from: From;
|
|
161
|
+
};
|