vike 0.4.238 → 0.4.239-commit-050a4a3

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.
Files changed (191) hide show
  1. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +3 -2
  2. package/dist/cjs/node/runtime/globalContext.js +1 -0
  3. package/dist/cjs/node/runtime/index.js +3 -3
  4. package/dist/cjs/node/runtime/page-files/setup.js +3 -1
  5. package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +2 -9
  6. package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +2 -2
  7. package/dist/cjs/node/runtime/renderPage/csp.js +47 -0
  8. package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +2 -2
  9. package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -1
  10. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -2
  11. package/dist/cjs/node/runtime/renderPage/headersResponse.js +48 -0
  12. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.js +16 -13
  13. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.js +1 -1
  14. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/inferHtmlTags.js +8 -6
  15. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.js +1 -1
  16. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.js +1 -1
  17. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/mergeScriptTags.js +5 -3
  18. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets.js +2 -2
  19. package/dist/cjs/node/runtime/{html → renderPage/html}/propKeys.js +1 -1
  20. package/dist/cjs/node/runtime/{html → renderPage/html}/renderHtml.js +1 -1
  21. package/dist/cjs/node/runtime/{html → renderPage/html}/serializeContext.js +6 -6
  22. package/dist/cjs/node/runtime/{html → renderPage/html}/stream/react-streaming.js +1 -1
  23. package/dist/cjs/node/runtime/{html → renderPage/html}/stream.js +1 -1
  24. package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +17 -38
  25. package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +2 -2
  26. package/dist/cjs/node/runtime/renderPage.js +1 -1
  27. package/dist/cjs/node/vite/onLoad.js +1 -1
  28. package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +32 -28
  29. package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +1 -1
  30. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +24 -20
  31. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +4 -2
  32. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +76 -74
  33. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +18 -14
  34. package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +4 -2
  35. package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +4 -2
  36. package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +20 -18
  37. package/dist/cjs/node/vite/plugins/pluginCommon.js +7 -21
  38. package/dist/cjs/node/vite/plugins/pluginDev.js +51 -47
  39. package/dist/cjs/node/vite/plugins/pluginEnvVars.js +63 -57
  40. package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +101 -91
  41. package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +24 -16
  42. package/dist/cjs/node/vite/plugins/pluginFileEnv.js +67 -57
  43. package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +26 -19
  44. package/dist/cjs/node/vite/plugins/pluginPreview.js +30 -24
  45. package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +41 -33
  46. package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +4 -2
  47. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +1 -1
  48. package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +50 -37
  49. package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +8 -6
  50. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +3 -0
  51. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +1 -1
  52. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +20 -22
  53. package/dist/cjs/shared/createGlobalContextShared.js +4 -22
  54. package/dist/cjs/shared/createPageContextShared.js +2 -2
  55. package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +62 -43
  56. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  57. package/dist/cjs/utils/assert.js +16 -1
  58. package/dist/cjs/utils/assertNodeVersion.js +3 -1
  59. package/dist/cjs/utils/assertVersion.js +26 -5
  60. package/dist/cjs/utils/joinEnglish.js +2 -1
  61. package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +39 -16
  62. package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
  63. package/dist/esm/client/runtime-client-routing/getPageContextCurrent.d.ts +2 -2
  64. package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +97 -83
  65. package/dist/esm/client/runtime-client-routing/globalContext.d.ts +38 -10
  66. package/dist/esm/client/runtime-client-routing/prefetch/getPrefetchSettings.d.ts +2 -2
  67. package/dist/esm/client/runtime-client-routing/prefetch.d.ts +2 -2
  68. package/dist/esm/client/runtime-client-routing/prefetch.js +2 -2
  69. package/dist/esm/client/runtime-client-routing/preparePageContextForPublicUsageClient.d.ts +2 -2
  70. package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +43 -28
  71. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +39 -16
  72. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
  73. package/dist/esm/client/runtime-server-routing/globalContext.d.ts +38 -10
  74. package/dist/esm/client/runtime-server-routing/preparePageContextForPublicUsageClient.d.ts +2 -2
  75. package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +38 -10
  76. package/dist/esm/client/shared/execHookOnRenderClient.d.ts +2 -2
  77. package/dist/esm/client/shared/loadPageConfigsLazyClientSide.d.ts +1 -1
  78. package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +2 -3
  79. package/dist/esm/client/shared/preparePageContextForPublicUsageClientShared.d.ts +2 -2
  80. package/dist/esm/node/prerender/resolvePrerenderConfig.js +4 -3
  81. package/dist/esm/node/prerender/runPrerender.d.ts +57 -14
  82. package/dist/esm/node/runtime/globalContext.d.ts +154 -40
  83. package/dist/esm/node/runtime/globalContext.js +1 -0
  84. package/dist/esm/node/runtime/index.d.ts +3 -3
  85. package/dist/esm/node/runtime/index.js +3 -3
  86. package/dist/esm/node/runtime/page-files/setup.js +3 -1
  87. package/dist/esm/node/runtime/renderPage/createHttpResponse.d.ts +1 -1
  88. package/dist/esm/node/runtime/renderPage/createHttpResponse.js +2 -9
  89. package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +52 -10
  90. package/dist/esm/node/runtime/renderPage/createPageContextServerSide.js +2 -2
  91. package/dist/esm/node/runtime/renderPage/csp.d.ts +12 -0
  92. package/dist/esm/node/runtime/renderPage/csp.js +45 -0
  93. package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.d.ts +2 -2
  94. package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.js +2 -2
  95. package/dist/esm/node/runtime/renderPage/execHookServer.d.ts +2 -2
  96. package/dist/esm/node/runtime/renderPage/getEarlyHints.js +1 -1
  97. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +2 -2
  98. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +2 -2
  99. package/dist/esm/node/runtime/renderPage/headersResponse.d.ts +10 -0
  100. package/dist/esm/node/runtime/renderPage/headersResponse.js +46 -0
  101. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.d.ts +1 -1
  102. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.js +16 -13
  103. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.d.ts +1 -1
  104. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.js +1 -1
  105. package/dist/esm/node/runtime/renderPage/html/injectAssets/inferHtmlTags.d.ts +10 -0
  106. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/inferHtmlTags.js +7 -5
  107. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.js +1 -1
  108. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.js +1 -1
  109. package/dist/esm/node/runtime/renderPage/html/injectAssets/mergeScriptTags.d.ts +3 -0
  110. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/mergeScriptTags.js +6 -4
  111. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets.d.ts +2 -2
  112. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets.js +2 -2
  113. package/dist/esm/node/runtime/{html → renderPage/html}/propKeys.js +1 -1
  114. package/dist/esm/node/runtime/{html → renderPage/html}/renderHtml.d.ts +1 -1
  115. package/dist/esm/node/runtime/{html → renderPage/html}/renderHtml.js +1 -1
  116. package/dist/esm/node/runtime/{html → renderPage/html}/serializeContext.d.ts +6 -5
  117. package/dist/esm/node/runtime/{html → renderPage/html}/serializeContext.js +6 -6
  118. package/dist/esm/node/runtime/{html → renderPage/html}/stream/react-streaming.js +1 -1
  119. package/dist/esm/node/runtime/{html → renderPage/html}/stream.js +1 -1
  120. package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +62 -15
  121. package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +18 -39
  122. package/dist/esm/node/runtime/renderPage/preparePageContextForPublicUsageServer.d.ts +2 -2
  123. package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.d.ts +114 -28
  124. package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.js +2 -2
  125. package/dist/esm/node/runtime/renderPage.d.ts +52 -10
  126. package/dist/esm/node/runtime/renderPage.js +1 -1
  127. package/dist/esm/node/vite/onLoad.js +1 -1
  128. package/dist/esm/node/vite/plugins/pluginBaseUrls.js +32 -28
  129. package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +1 -1
  130. package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildApp.js +24 -20
  131. package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.js +4 -2
  132. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +76 -74
  133. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +18 -14
  134. package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +4 -2
  135. package/dist/esm/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +4 -2
  136. package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +20 -18
  137. package/dist/esm/node/vite/plugins/pluginCommon.js +8 -22
  138. package/dist/esm/node/vite/plugins/pluginDev.js +51 -47
  139. package/dist/esm/node/vite/plugins/pluginEnvVars.js +63 -57
  140. package/dist/esm/node/vite/plugins/pluginExtractAssets.js +101 -91
  141. package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +24 -16
  142. package/dist/esm/node/vite/plugins/pluginFileEnv.js +67 -57
  143. package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +26 -19
  144. package/dist/esm/node/vite/plugins/pluginPreview.js +30 -24
  145. package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +41 -33
  146. package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +4 -2
  147. package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +2 -2
  148. package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +51 -38
  149. package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +8 -6
  150. package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +3 -0
  151. package/dist/esm/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +2 -2
  152. package/dist/esm/node/vite/shared/resolveVikeConfigInternal.d.ts +4 -8
  153. package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +22 -24
  154. package/dist/esm/shared/createGlobalContextShared.d.ts +73 -17
  155. package/dist/esm/shared/createGlobalContextShared.js +5 -23
  156. package/dist/esm/shared/createPageContextShared.d.ts +2 -7
  157. package/dist/esm/shared/createPageContextShared.js +2 -2
  158. package/dist/esm/shared/getPageFiles.d.ts +1 -1
  159. package/dist/esm/shared/hooks/execHook.d.ts +2 -2
  160. package/dist/esm/shared/hooks/getHook.d.ts +3 -3
  161. package/dist/esm/shared/page-configs/resolveVikeConfigPublic.d.ts +91 -31
  162. package/dist/esm/shared/page-configs/resolveVikeConfigPublic.js +62 -43
  163. package/dist/esm/types/Config/ConfigResolved.d.ts +8 -0
  164. package/dist/esm/types/Config.d.ts +14 -6
  165. package/dist/esm/types/PageContext.d.ts +8 -25
  166. package/dist/esm/types/VikeNamespace.d.ts +0 -27
  167. package/dist/esm/types/index.d.ts +2 -2
  168. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  169. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  170. package/dist/esm/utils/assert.js +16 -1
  171. package/dist/esm/utils/assertNodeVersion.js +3 -1
  172. package/dist/esm/utils/assertVersion.d.ts +4 -3
  173. package/dist/esm/utils/assertVersion.js +23 -5
  174. package/dist/esm/utils/joinEnglish.js +2 -1
  175. package/package.json +2 -2
  176. package/dist/cjs/types/Config/helpers.js +0 -2
  177. package/dist/esm/node/runtime/html/injectAssets/inferHtmlTags.d.ts +0 -9
  178. package/dist/esm/node/runtime/html/injectAssets/mergeScriptTags.d.ts +0 -2
  179. package/dist/esm/types/Config/PageContextConfig.d.ts +0 -15
  180. package/dist/esm/types/Config/helpers.d.ts +0 -10
  181. package/dist/esm/types/Config/helpers.js +0 -1
  182. /package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.js +0 -0
  183. /package/dist/cjs/types/Config/{PageContextConfig.js → ConfigResolved.js} +0 -0
  184. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.d.ts +0 -0
  185. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.d.ts +0 -0
  186. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.d.ts +0 -0
  187. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.js +0 -0
  188. /package/dist/esm/node/runtime/{html → renderPage/html}/propKeys.d.ts +0 -0
  189. /package/dist/esm/node/runtime/{html → renderPage/html}/stream/react-streaming.d.ts +0 -0
  190. /package/dist/esm/node/runtime/{html → renderPage/html}/stream.d.ts +0 -0
  191. /package/dist/esm/types/Config/{PageContextConfig.js → ConfigResolved.js} +0 -0
@@ -19,32 +19,38 @@ function pluginPreview() {
19
19
  return {
20
20
  name: 'vike:pluginPreview',
21
21
  apply: utils_js_1.applyPreview,
22
- config() {
23
- return {
24
- appType: 'custom',
25
- };
22
+ config: {
23
+ handler() {
24
+ return {
25
+ appType: 'custom',
26
+ };
27
+ },
26
28
  },
27
- async configResolved(config_) {
28
- config = config_;
29
- vikeConfig = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternal)();
30
- (0, pluginDev_js_1.logDockerHint)(config.preview.host);
31
- // vikeConfig = await getVikeConfig(config)
29
+ configResolved: {
30
+ async handler(config_) {
31
+ config = config_;
32
+ vikeConfig = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternal)();
33
+ (0, pluginDev_js_1.logDockerHint)(config.preview.host);
34
+ // vikeConfig = await getVikeConfig(config)
35
+ },
32
36
  },
33
- configurePreviewServer(server) {
34
- /* - Couldn't make `appType: 'mpa'` work as of npm:@brillout/vite@5.0.0-beta.14.0426910c
35
- - This ugly hack to set appType for preview won't be need once https://github.com/vitejs/vite/pull/14855 is merged.
36
- config.appType = 'mpa'
37
- */
38
- return () => {
39
- const { isPrerenderingEnabledForAllPages, isPrerenderingEnabled } = vikeConfig.prerenderContext;
40
- assertDist(isPrerenderingEnabledForAllPages);
41
- // We cannot re-use Vite's static middleware: https://github.com/vitejs/vite/pull/14836#issuecomment-1788540300
42
- addStaticAssetsMiddleware(server.middlewares);
43
- if (!isPrerenderingEnabledForAllPages) {
44
- (0, addSsrMiddleware_js_1.addSsrMiddleware)(server.middlewares, config, true, isPrerenderingEnabled);
45
- }
46
- addStatic404Middleware(server.middlewares);
47
- };
37
+ configurePreviewServer: {
38
+ handler(server) {
39
+ /* - Couldn't make `appType: 'mpa'` work as of npm:@brillout/vite@5.0.0-beta.14.0426910c
40
+ - This ugly hack to set appType for preview won't be need once https://github.com/vitejs/vite/pull/14855 is merged.
41
+ config.appType = 'mpa'
42
+ */
43
+ return () => {
44
+ const { isPrerenderingEnabledForAllPages, isPrerenderingEnabled } = vikeConfig.prerenderContext;
45
+ assertDist(isPrerenderingEnabledForAllPages);
46
+ // We cannot re-use Vite's static middleware: https://github.com/vitejs/vite/pull/14836#issuecomment-1788540300
47
+ addStaticAssetsMiddleware(server.middlewares);
48
+ if (!isPrerenderingEnabledForAllPages) {
49
+ (0, addSsrMiddleware_js_1.addSsrMiddleware)(server.middlewares, config, true, isPrerenderingEnabled);
50
+ }
51
+ addStatic404Middleware(server.middlewares);
52
+ };
53
+ },
48
54
  },
49
55
  };
50
56
  function assertDist(isPrerenderingEnabledForAllPages) {
@@ -11,41 +11,49 @@ function pluginReplaceConstants() {
11
11
  name: 'vike:pluginReplaceConstants',
12
12
  enforce: 'post',
13
13
  apply: 'build',
14
- configResolved(config_) {
15
- config = config_;
14
+ configResolved: {
15
+ handler(config_) {
16
+ config = config_;
17
+ },
16
18
  },
17
- transform(code, id, options) {
18
- id = (0, normalizeId_js_1.normalizeId)(id);
19
- (0, utils_js_1.assertPosixPath)(id);
20
- if (id.includes('/node_modules/'))
21
- return;
22
- (0, utils_js_1.assertPosixPath)(config.root);
23
- if (!id.startsWith(config.root))
24
- return;
25
- if (!code.includes('({}).'))
26
- return;
27
- const isBuild = config.command === 'build';
28
- (0, utils_js_1.assert)(isBuild);
29
- // Used by vike.dev
30
- // https://github.com/vikejs/vike/blob/08a1ff55c80ddca64ca6d4417fefd45fefeb4ffb/docs/vite.config.ts#L12
31
- // @ts-expect-error
32
- if (config._skipVikeReplaceConstants?.(id))
33
- return;
34
- const { magicString, getMagicStringResult } = (0, getMagicString_js_1.getMagicString)(code, id);
35
- const constantsMap = [];
36
- constantsMap.push({
37
- constants: ['pageContext.isClientSide', 'globalContext.isClientSide', 'pageContext.globalContext.isClientSide'],
38
- replacement: !(0, isViteServerSide_js_1.isViteServerSide_extraSafe)(config, this.environment, options),
39
- });
40
- constantsMap.forEach(({ constants, replacement }) => {
41
- if (!constants.some((c) => code.includes(c)))
19
+ transform: {
20
+ handler(code, id, options) {
21
+ id = (0, normalizeId_js_1.normalizeId)(id);
22
+ (0, utils_js_1.assertPosixPath)(id);
23
+ if (id.includes('/node_modules/'))
42
24
  return;
43
- const regExp = getConstantRegExp(constants);
44
- magicString.replaceAll(regExp, JSON.stringify(replacement));
45
- });
46
- if (!magicString.hasChanged())
47
- return null;
48
- return getMagicStringResult();
25
+ (0, utils_js_1.assertPosixPath)(config.root);
26
+ if (!id.startsWith(config.root))
27
+ return;
28
+ if (!code.includes('({}).'))
29
+ return;
30
+ const isBuild = config.command === 'build';
31
+ (0, utils_js_1.assert)(isBuild);
32
+ // Used by vike.dev
33
+ // https://github.com/vikejs/vike/blob/08a1ff55c80ddca64ca6d4417fefd45fefeb4ffb/docs/vite.config.ts#L12
34
+ // @ts-expect-error
35
+ if (config._skipVikeReplaceConstants?.(id))
36
+ return;
37
+ const { magicString, getMagicStringResult } = (0, getMagicString_js_1.getMagicString)(code, id);
38
+ const constantsMap = [];
39
+ constantsMap.push({
40
+ constants: [
41
+ 'pageContext.isClientSide',
42
+ 'globalContext.isClientSide',
43
+ 'pageContext.globalContext.isClientSide',
44
+ ],
45
+ replacement: !(0, isViteServerSide_js_1.isViteServerSide_extraSafe)(config, this.environment, options),
46
+ });
47
+ constantsMap.forEach(({ constants, replacement }) => {
48
+ if (!constants.some((c) => code.includes(c)))
49
+ return;
50
+ const regExp = getConstantRegExp(constants);
51
+ magicString.replaceAll(regExp, JSON.stringify(replacement));
52
+ });
53
+ if (!magicString.hasChanged())
54
+ return null;
55
+ return getMagicStringResult();
56
+ },
49
57
  },
50
58
  };
51
59
  }
@@ -22,8 +22,10 @@ function pluginSetGlobalContext() {
22
22
  (0, utils_js_1.markSetup_viteDevServer)();
23
23
  },
24
24
  },
25
- configurePreviewServer() {
26
- (0, utils_js_1.markSetup_vitePreviewServer)();
25
+ configurePreviewServer: {
26
+ handler() {
27
+ (0, utils_js_1.markSetup_vitePreviewServer)();
28
+ },
27
29
  },
28
30
  config: {
29
31
  order: 'pre',
@@ -144,7 +144,7 @@ function getGlobs(globRoots, isBuild, fileType, query, isV1Design) {
144
144
  const globExcludePath = globRoot.excludeDir ? `'!${getGlobPath(globRoot.excludeDir, fileType)}'` : null;
145
145
  const globOptions = { eager: isEager };
146
146
  if (query) {
147
- const isNewViteInterface = (0, utils_js_1.isVersionOrAbove)(vite_1.version, '5.1.0');
147
+ const isNewViteInterface = (0, utils_js_1.isVersionMatch)(vite_1.version, ['5.1.0']);
148
148
  if (isNewViteInterface &&
149
149
  // When used for the old design, the new syntax breaks Vike's CI (surprinsigly so). I couldn't reproduce locally (I didn't dig much).
150
150
  isV1Design) {
@@ -21,47 +21,57 @@ function pluginVirtualFiles() {
21
21
  let config;
22
22
  return {
23
23
  name: 'vike:pluginVirtualFiles',
24
- async configResolved(config_) {
25
- config = config_;
26
- // TO-DO/next-major-release: remove
27
- if (!(0, resolveVikeConfigInternal_js_1.isV1Design)())
28
- config.experimental.importGlobRestoreExtension = true;
24
+ configResolved: {
25
+ async handler(config_) {
26
+ config = config_;
27
+ // TO-DO/next-major-release: remove
28
+ if (!(0, resolveVikeConfigInternal_js_1.isV1Design)())
29
+ config.experimental.importGlobRestoreExtension = true;
30
+ },
29
31
  },
30
- resolveId(id) {
31
- if ((0, utils_js_1.isVirtualFileId)(id)) {
32
- return (0, utils_js_1.addVirtualFileIdPrefix)(id);
33
- }
34
- },
35
- async handleHotUpdate(ctx) {
36
- try {
37
- return await handleHotUpdate(ctx, config);
38
- }
39
- catch (err) {
40
- // Vite swallows errors thrown by handleHotUpdate()
41
- console.error(err);
42
- throw err;
43
- }
32
+ resolveId: {
33
+ handler(id) {
34
+ if ((0, utils_js_1.isVirtualFileId)(id)) {
35
+ return (0, utils_js_1.addVirtualFileIdPrefix)(id);
36
+ }
37
+ },
44
38
  },
45
- async load(id, options) {
46
- if (!(0, utils_js_1.isVirtualFileId)(id))
47
- return undefined;
48
- id = (0, utils_js_1.removeVirtualFileIdPrefix)(id);
49
- const isDev = config._isDev;
50
- (0, utils_js_1.assert)(typeof isDev === 'boolean');
51
- const idParsed = (0, virtualFileId_js_1.parseVirtualFileId)(id);
52
- if (idParsed) {
53
- if (idParsed.type === 'page-entry') {
54
- const code = await (0, generateVirtualFilePageEntry_js_1.generateVirtualFilePageEntry)(id, isDev);
55
- return code;
39
+ handleHotUpdate: {
40
+ async handler(ctx) {
41
+ try {
42
+ return await handleHotUpdate(ctx, config);
56
43
  }
57
- if (idParsed.type === 'global-entry') {
58
- const code = await (0, generateVirtualFileGlobalEntryWithOldDesign_js_1.generateVirtualFileGlobalEntryWithOldDesign)(id, options, config, this.environment, isDev);
59
- return code;
44
+ catch (err) {
45
+ // Vite swallows errors thrown by handleHotUpdate()
46
+ console.error(err);
47
+ throw err;
60
48
  }
61
- }
49
+ },
50
+ },
51
+ load: {
52
+ async handler(id, options) {
53
+ if (!(0, utils_js_1.isVirtualFileId)(id))
54
+ return undefined;
55
+ id = (0, utils_js_1.removeVirtualFileIdPrefix)(id);
56
+ const isDev = config._isDev;
57
+ (0, utils_js_1.assert)(typeof isDev === 'boolean');
58
+ const idParsed = (0, virtualFileId_js_1.parseVirtualFileId)(id);
59
+ if (idParsed) {
60
+ if (idParsed.type === 'page-entry') {
61
+ const code = await (0, generateVirtualFilePageEntry_js_1.generateVirtualFilePageEntry)(id, isDev);
62
+ return code;
63
+ }
64
+ if (idParsed.type === 'global-entry') {
65
+ const code = await (0, generateVirtualFileGlobalEntryWithOldDesign_js_1.generateVirtualFileGlobalEntryWithOldDesign)(id, options, config, this.environment, isDev);
66
+ return code;
67
+ }
68
+ }
69
+ },
62
70
  },
63
- configureServer(server) {
64
- handleFileAddRemove(server, config);
71
+ configureServer: {
72
+ handler(server) {
73
+ handleFileAddRemove(server, config);
74
+ },
65
75
  },
66
76
  };
67
77
  }
@@ -130,7 +140,10 @@ async function handleHotUpdate(ctx, config) {
130
140
  // Ensure we invalidate `file` *before* server.ssrLoadModule() in updateUserFiles()
131
141
  // Vite already invalidates it, but *after* handleHotUpdate() and thus after server.ssrLoadModule()
132
142
  ctx.modules.forEach((mod) => server.moduleGraph.invalidateModule(mod));
133
- (0, globalContext_js_1.updateUserFiles)();
143
+ if ((0, globalContext_js_1.isRunnable)(server)) {
144
+ // TODO/now: await
145
+ (0, globalContext_js_1.updateUserFiles)();
146
+ }
134
147
  }
135
148
  }
136
149
  }
@@ -4,12 +4,14 @@ exports.pluginWorkaroundCssModuleHmr = pluginWorkaroundCssModuleHmr;
4
4
  function pluginWorkaroundCssModuleHmr() {
5
5
  return {
6
6
  name: 'vike:pluginWorkaroundCssModuleHmr',
7
- handleHotUpdate(ctx) {
8
- // prevent full reload due to non self-accepting css module.
9
- // here only "?direct" module should be filtered out as it doesn't have a parent module.
10
- if (ctx.file.includes('module.css')) {
11
- return ctx.modules.filter((m) => !m.id?.includes('?direct'));
12
- }
7
+ handleHotUpdate: {
8
+ handler(ctx) {
9
+ // prevent full reload due to non self-accepting css module.
10
+ // here only "?direct" module should be filtered out as it doesn't have a parent module.
11
+ if (ctx.file.includes('module.css')) {
12
+ return ctx.modules.filter((m) => !m.id?.includes('?direct'));
13
+ }
14
+ },
13
15
  },
14
16
  };
15
17
  }
@@ -173,6 +173,9 @@ const configDefinitionsBuiltIn = {
173
173
  env: { config: true },
174
174
  global: true,
175
175
  },
176
+ csp: {
177
+ env: { server: true },
178
+ },
176
179
  injectScriptsAt: {
177
180
  env: { server: true },
178
181
  },
@@ -152,7 +152,7 @@ async function isGitNotUsable(userRootDir) {
152
152
  // - We didn't bother test which is the earliest version that works.
153
153
  // - Git 2.32.0 doesn't seem to work: https://github.com/vikejs/vike/discussions/1549
154
154
  // - Maybe it's because of StackBlitz: looking at the release notes, Git 2.32.0 should be working.
155
- if (!(0, utils_js_1.isVersionOrAbove)(gitVersion, '2.43.1'))
155
+ if (!(0, utils_js_1.isVersionMatch)(gitVersion, ['2.43.1']))
156
156
  return true;
157
157
  }
158
158
  // Is userRootDir inside a Git repository?
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getVikeConfig = getVikeConfig;
6
7
  exports.getVikeConfigInternal = getVikeConfigInternal;
7
8
  exports.getVikeConfigInternalOptional = getVikeConfigInternalOptional;
8
9
  exports.getVikeConfigInternalSync = getVikeConfigInternalSync;
@@ -12,7 +13,6 @@ exports.isV1Design = isV1Design;
12
13
  exports.getConfVal = getConfVal;
13
14
  exports.getConfigDefinitionOptional = getConfigDefinitionOptional;
14
15
  exports.getVikeConfigFromCliOrEnv = getVikeConfigFromCliOrEnv;
15
- exports.getVikeConfig = getVikeConfig;
16
16
  const utils_js_1 = require("../utils.js");
17
17
  const configDefinitionsBuiltIn_js_1 = require("./resolveVikeConfigInternal/configDefinitionsBuiltIn.js");
18
18
  const filesystemRouting_js_1 = require("./resolveVikeConfigInternal/filesystemRouting.js");
@@ -173,31 +173,26 @@ async function resolveVikeConfigInternal(userRootDir, vikeVitePluginOptions, esb
173
173
  // Backwards compatibility for vike(options) in vite.config.js
174
174
  temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
175
175
  setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved);
176
- // global
177
- const pageConfigGlobalValues = getConfigValues(pageConfigGlobal);
178
- const vikeConfigPublicGlobal = (0, resolveVikeConfigPublic_js_1.resolveVikeConfigPublicGlobal)({ pageConfigGlobalValues });
179
- // pages
180
- const vikeConfigPublicPagesEager = (0, utils_js_1.objectFromEntries)(pageConfigs.map((pageConfig) => {
181
- const pageConfigValues = getConfigValues(pageConfig, true);
182
- return (0, resolveVikeConfigPublic_js_1.resolveVikeConfigPublicPageEagerLoaded)(pageConfigGlobalValues, pageConfig, pageConfigValues);
183
- }));
176
+ const globalConfigPublic = resolveGlobalConfig(pageConfigGlobal, pageConfigs);
184
177
  const prerenderContext = resolvePrerenderContext({
185
- config: vikeConfigPublicGlobal.config,
186
- _from: vikeConfigPublicGlobal._from,
178
+ config: globalConfigPublic.config,
179
+ _from: globalConfigPublic._from,
187
180
  _pageConfigs: pageConfigs,
188
181
  });
189
182
  const vikeConfig = {
183
+ ...globalConfigPublic,
184
+ prerenderContext,
190
185
  _pageConfigs: pageConfigs,
191
186
  _pageConfigGlobal: pageConfigGlobal,
192
- config: vikeConfigPublicGlobal.config,
193
- _from: vikeConfigPublicGlobal._from,
194
- pages: vikeConfigPublicPagesEager,
195
- prerenderContext,
196
187
  _vikeConfigDependencies: esbuildCache.vikeConfigDependencies,
197
188
  };
198
189
  globalObject.vikeConfigSync = vikeConfig;
199
190
  return vikeConfig;
200
191
  }
192
+ function resolveGlobalConfig(pageConfigGlobal, pageConfigs) {
193
+ const globalConfigPublic = (0, resolveVikeConfigPublic_js_1.resolveGlobalConfigPublic)(pageConfigs, pageConfigGlobal, getConfigValues);
194
+ return globalConfigPublic;
195
+ }
201
196
  async function resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache) {
202
197
  const plusFilesAllOrdered = Object.values(plusFilesAll)
203
198
  .flat()
@@ -361,7 +356,8 @@ function assertOnBeforeRenderEnv(pageConfig) {
361
356
  // 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
362
357
  (0, utils_js_1.assertUsage)(!(onBeforeRenderEnv.client && !isClientRouting), `Page ${pageConfig.pageId} has an onBeforeRender() hook with env ${picocolors_1.default.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.`);
363
358
  }
364
- function getConfigValues(pageConfig, tolerateMissingValue) {
359
+ function getConfigValues(pageConfig, isGlobalConfig) {
360
+ const tolerateMissingValue = !isGlobalConfig;
365
361
  const configValues = {};
366
362
  (0, serializeConfigValues_js_1.getConfigValuesBase)(pageConfig, { isForConfig: true }, null).forEach((entry) => {
367
363
  if (entry.configValueBase.type === 'computed') {
@@ -1128,11 +1124,15 @@ function restartViteDevServer() {
1128
1124
  (0, removeSuperfluousViteLog_js_1.removeSuperfluousViteLog_disable)();
1129
1125
  }
1130
1126
  function getVikeConfigDummy(esbuildCache) {
1131
- const globalDummy = (0, resolveVikeConfigPublic_js_1.resolveVikeConfigPublicGlobal)({ pageConfigGlobalValues: {} });
1132
1127
  const pageConfigsDummy = [];
1128
+ const pageConfigGlobalDummy = {
1129
+ configValueSources: {},
1130
+ configDefinitions: {},
1131
+ };
1132
+ const globalConfigPublicDummy = resolveGlobalConfig(pageConfigGlobalDummy, pageConfigsDummy);
1133
1133
  const prerenderContextDummy = resolvePrerenderContext({
1134
- config: globalDummy.config,
1135
- _from: globalDummy._from,
1134
+ config: globalConfigPublicDummy.config,
1135
+ _from: globalConfigPublicDummy._from,
1136
1136
  _pageConfigs: pageConfigsDummy,
1137
1137
  });
1138
1138
  const vikeConfigDummy = {
@@ -1141,9 +1141,7 @@ function getVikeConfigDummy(esbuildCache) {
1141
1141
  configDefinitions: {},
1142
1142
  configValueSources: {},
1143
1143
  },
1144
- config: globalDummy.config,
1145
- _from: globalDummy._from,
1146
- pages: {},
1144
+ ...globalConfigPublicDummy,
1147
1145
  prerenderContext: prerenderContextDummy,
1148
1146
  _vikeConfigDependencies: esbuildCache.vikeConfigDependencies,
1149
1147
  };
@@ -73,7 +73,9 @@ addGlobalContextTmp, addGlobalContextAsync) {
73
73
  return globalObject.globalContext;
74
74
  }
75
75
  function createGlobalContextBase(virtualFileExportsGlobalEntry) {
76
- const { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal, vikeConfigPublicGlobal, vikeConfigPublicPagesEager, } = getConfigsAll(virtualFileExportsGlobalEntry);
76
+ const { pageFilesAll, pageConfigs, pageConfigGlobal } = (0, parseVirtualFileExportsGlobalEntry_js_1.parseVirtualFileExportsGlobalEntry)(virtualFileExportsGlobalEntry);
77
+ const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
78
+ const globalContextAddendum = (0, resolveVikeConfigPublic_js_1.resolveGlobalContextConfig)(pageConfigs, pageConfigGlobal);
77
79
  const globalContext = {
78
80
  /**
79
81
  * Useful for distinguishing `globalContext` from other objects and narrowing down TypeScript unions.
@@ -87,31 +89,11 @@ function createGlobalContextBase(virtualFileExportsGlobalEntry) {
87
89
  _pageConfigs: pageConfigs,
88
90
  _pageConfigGlobal: pageConfigGlobal,
89
91
  _allPageIds: allPageIds,
90
- _vikeConfigPublicGlobal: vikeConfigPublicGlobal,
91
- config: vikeConfigPublicGlobal.config,
92
- pages: vikeConfigPublicPagesEager,
92
+ ...globalContextAddendum,
93
93
  };
94
94
  (0, utils_js_1.changeEnumerable)(globalContext, '_isOriginalObject', false);
95
95
  return globalContext;
96
96
  }
97
- function getConfigsAll(virtualFileExportsGlobalEntry) {
98
- const { pageFilesAll, pageConfigs, pageConfigGlobal } = (0, parseVirtualFileExportsGlobalEntry_js_1.parseVirtualFileExportsGlobalEntry)(virtualFileExportsGlobalEntry);
99
- const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
100
- const vikeConfigPublicGlobal = (0, resolveVikeConfigPublic_js_1.resolveVikeConfigPublicGlobal)({
101
- pageConfigGlobalValues: pageConfigGlobal.configValues,
102
- });
103
- const vikeConfigPublicPagesEager = Object.fromEntries(pageConfigs.map((pageConfig) => {
104
- return (0, resolveVikeConfigPublic_js_1.resolveVikeConfigPublicPageEagerLoaded)(pageConfigGlobal.configValues, pageConfig, pageConfig.configValues);
105
- }));
106
- return {
107
- pageFilesAll,
108
- allPageIds,
109
- pageConfigs,
110
- pageConfigGlobal,
111
- vikeConfigPublicGlobal,
112
- vikeConfigPublicPagesEager,
113
- };
114
- }
115
97
  function getAllPageIds(pageFilesAll, pageConfigs) {
116
98
  const fileIds = pageFilesAll.filter(({ isDefaultPageFile }) => !isDefaultPageFile).map(({ pageId }) => pageId);
117
99
  const allPageIds = (0, utils_js_1.unique)(fileIds);
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPageContextShared = createPageContextShared;
4
4
  exports.createPageContextObject = createPageContextObject;
5
5
  const utils_js_1 = require("./utils.js");
6
- function createPageContextShared(pageContextCreated, vikeConfigPublicGlobal) {
7
- (0, utils_js_1.objectAssign)(pageContextCreated, vikeConfigPublicGlobal);
6
+ function createPageContextShared(pageContextCreated, globalConfigPublic) {
7
+ (0, utils_js_1.objectAssign)(pageContextCreated, globalConfigPublic);
8
8
  return pageContextCreated;
9
9
  }
10
10
  function createPageContextObject() {
@@ -1,57 +1,51 @@
1
1
  "use strict";
2
- // TO-DO/soon: rename PageConfig names
3
- // - Use `Internal` suffix, i.e. {Page,Global}ConfigInternal
4
- // - While keeping {Page,Global}ConfigPublic or remove Public suffix and rename it to {Page,Global}Config ?
5
- // - rename EagerLoaded EagerlyLoaded
6
- // - remove `LazyLoaded` suffix
7
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
8
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
4
  };
10
5
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.resolveVikeConfigPublicGlobal = resolveVikeConfigPublicGlobal;
12
- exports.resolveVikeConfigPublicPageEagerLoaded = resolveVikeConfigPublicPageEagerLoaded;
13
- exports.resolveVikeConfigPublicPageLazyLoaded = resolveVikeConfigPublicPageLazyLoaded;
6
+ exports.resolveGlobalConfigPublic = resolveGlobalConfigPublic;
7
+ exports.resolvePageContextConfig = resolvePageContextConfig;
8
+ exports.resolveGlobalContextConfig = resolveGlobalContextConfig;
14
9
  const assert_exports_old_design_js_1 = require("../getPageFiles/assert_exports_old_design.js");
15
10
  const getConfigDefinedAt_js_1 = require("./getConfigDefinedAt.js");
16
11
  const helpers_js_1 = require("./helpers.js");
17
12
  const utils_js_1 = require("../utils.js");
18
13
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
19
- function resolveVikeConfigPublicPageEagerLoaded(pageConfigGlobalValues, pageConfig, pageConfigValues) {
20
- const vikeConfigPublicPage_ = resolveVikeConfigPublic_base({ pageConfigGlobalValues, pageConfigValues });
21
- const vikeConfigPublicPage = getPublicCopy(vikeConfigPublicPage_);
22
- let page;
23
- if (!pageConfig.isErrorPage) {
24
- const route = vikeConfigPublicPage.config.route ?? pageConfig.routeFilesystem.routeString;
25
- page = {
26
- ...vikeConfigPublicPage,
27
- route,
28
- };
29
- }
30
- else {
31
- page = {
32
- ...vikeConfigPublicPage,
33
- isErrorPage: true,
34
- };
35
- }
14
+ function resolveGlobalConfigPublicPage(pageConfigGlobalValues, pageConfig, pageConfigValues) {
15
+ const pageConfigPublic_ = resolvePageConfigPublic({ pageConfigGlobalValues, pageConfigValues });
16
+ const pageConfigPublic = getPublicCopy(pageConfigPublic_);
17
+ const page = (() => {
18
+ if (!pageConfig.isErrorPage) {
19
+ const route = pageConfigPublic.config.route ?? pageConfig.routeFilesystem.routeString;
20
+ return {
21
+ ...pageConfigPublic,
22
+ route,
23
+ };
24
+ }
25
+ else {
26
+ return {
27
+ ...pageConfigPublic,
28
+ isErrorPage: true,
29
+ };
30
+ }
31
+ })();
36
32
  return [pageConfig.pageId, page];
37
33
  }
38
- function getPublicCopy(vikeConfigPublic) {
39
- return {
40
- config: vikeConfigPublic.config,
41
- _source: vikeConfigPublic.source,
42
- _sources: vikeConfigPublic.sources,
43
- _from: vikeConfigPublic.from,
34
+ function getPublicCopy(configInternal) {
35
+ const configPublic = {
36
+ config: configInternal.config,
37
+ // TO-DO/soon/flat-pageContext: expose publicly?
38
+ _source: configInternal.source,
39
+ _sources: configInternal.sources,
40
+ _from: configInternal.from,
44
41
  };
42
+ return configPublic;
45
43
  }
46
- function resolveVikeConfigPublic_base({ pageConfigGlobalValues, pageConfigValues, }) {
44
+ function resolvePageConfigPublic({ pageConfigGlobalValues, pageConfigValues, }) {
47
45
  const configValues = { ...pageConfigGlobalValues, ...pageConfigValues };
48
- return resolveVikeConfigPublic_V1Design({ configValues });
46
+ return resolveConfigPublic_V1Design({ configValues });
49
47
  }
50
- function resolveVikeConfigPublicGlobal({ pageConfigGlobalValues, }) {
51
- const vikeConfigPublicGlobal = resolveVikeConfigPublic_V1Design({ configValues: pageConfigGlobalValues });
52
- return getPublicCopy(vikeConfigPublicGlobal);
53
- }
54
- function resolveVikeConfigPublicPageLazyLoaded(pageFiles, // V0.4 design
48
+ function resolvePageContextConfig(pageFiles, // V0.4 design
55
49
  pageConfig, // V1 design
56
50
  pageConfigGlobal) {
57
51
  const config = {};
@@ -78,7 +72,7 @@ pageConfigGlobal) {
78
72
  let sources;
79
73
  let from;
80
74
  if (pageConfig) {
81
- const res = resolveVikeConfigPublic_base({
75
+ const res = resolvePageConfigPublic({
82
76
  pageConfigGlobalValues: pageConfigGlobal.configValues,
83
77
  pageConfigValues: pageConfig.configValues,
84
78
  });
@@ -113,7 +107,7 @@ pageConfigGlobal) {
113
107
  });
114
108
  (0, utils_js_1.assert)(!('default' in exports));
115
109
  (0, utils_js_1.assert)(!('default' in exportsAll));
116
- const configPublicPageLazy = {
110
+ const pageContextAddendum = {
117
111
  config: config,
118
112
  from,
119
113
  source,
@@ -124,7 +118,7 @@ pageConfigGlobal) {
124
118
  exportsAll,
125
119
  };
126
120
  // TO-DO/next-major-release: remove
127
- (0, utils_js_1.objectDefineProperty)(configPublicPageLazy, 'pageExports', {
121
+ (0, utils_js_1.objectDefineProperty)(pageContextAddendum, 'pageExports', {
128
122
  get: () => {
129
123
  // We only show the warning in Node.js because when using Client Routing Vue integration uses `Object.assign(pageContextReactive, pageContext)` which will wrongully trigger the warning. There is no cross-browser way to catch whether the property accessor was initiated by an `Object.assign()` call.
130
124
  if (!(0, utils_js_1.isBrowser)()) {
@@ -138,10 +132,33 @@ pageConfigGlobal) {
138
132
  enumerable: false,
139
133
  configurable: true,
140
134
  });
141
- return configPublicPageLazy;
135
+ return pageContextAddendum;
136
+ }
137
+ function resolveGlobalContextConfig(pageConfigs, pageConfigGlobal) {
138
+ const globalContextAddendum = resolveGlobalConfigPublic(pageConfigs, pageConfigGlobal, (c) => c.configValues);
139
+ return globalContextAddendum;
140
+ }
141
+ function resolveGlobalConfigPublic(pageConfigs, pageConfigGlobal, getConfigValues) {
142
+ // global
143
+ const pageConfigGlobalValues = getConfigValues(pageConfigGlobal, true);
144
+ const globalConfigPublicBase_ = resolveConfigPublic_V1Design({ configValues: pageConfigGlobalValues });
145
+ const globalConfigPublicBase = getPublicCopy(globalConfigPublicBase_);
146
+ // pages
147
+ const pages = Object.fromEntries(pageConfigs.map((pageConfig) => {
148
+ const pageConfigValues = getConfigValues(pageConfig);
149
+ return resolveGlobalConfigPublicPage(pageConfigGlobalValues, pageConfig, pageConfigValues);
150
+ }));
151
+ const globalConfigPublic = {
152
+ ...globalConfigPublicBase,
153
+ pages,
154
+ };
155
+ return {
156
+ ...globalConfigPublic,
157
+ _globalConfigPublic: globalConfigPublic,
158
+ };
142
159
  }
143
160
  // V1 design
144
- function resolveVikeConfigPublic_V1Design(pageConfig) {
161
+ function resolveConfigPublic_V1Design(pageConfig) {
145
162
  const config = {};
146
163
  const configEntries = {};
147
164
  const exportsAll = {};
@@ -229,6 +246,8 @@ function resolveVikeConfigPublic_V1Design(pageConfig) {
229
246
  from,
230
247
  };
231
248
  }
249
+ // V0.4 design
250
+ // TO-DO/next-major-release: remove
232
251
  function getExportValues(pageFile) {
233
252
  const { filePath, fileExports } = pageFile;
234
253
  (0, utils_js_1.assert)(fileExports); // assume pageFile.loadFile() was called
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.238';
5
+ exports.PROJECT_VERSION = '0.4.239-commit-050a4a3';