vike 0.4.238-commit-3c1a09d → 0.4.238-commit-d48a597

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 (135) hide show
  1. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +3 -2
  2. package/dist/cjs/node/runtime/index.js +3 -3
  3. package/dist/cjs/node/runtime/page-files/setup.js +3 -1
  4. package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +2 -9
  5. package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +2 -2
  6. package/dist/cjs/node/runtime/{csp.js → renderPage/csp.js} +13 -12
  7. package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +2 -2
  8. package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -1
  9. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -2
  10. package/dist/cjs/node/runtime/renderPage/headersResponse.js +48 -0
  11. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.js +6 -6
  12. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.js +1 -1
  13. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/inferHtmlTags.js +5 -6
  14. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.js +1 -1
  15. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.js +1 -1
  16. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/mergeScriptTags.js +2 -2
  17. package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets.js +2 -2
  18. package/dist/cjs/node/runtime/{html → renderPage/html}/propKeys.js +1 -1
  19. package/dist/cjs/node/runtime/{html → renderPage/html}/renderHtml.js +1 -1
  20. package/dist/cjs/node/runtime/{html → renderPage/html}/serializeContext.js +6 -6
  21. package/dist/cjs/node/runtime/{html → renderPage/html}/stream/react-streaming.js +1 -1
  22. package/dist/cjs/node/runtime/{html → renderPage/html}/stream.js +1 -1
  23. package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +16 -48
  24. package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +2 -2
  25. package/dist/cjs/node/runtime/renderPage.js +1 -1
  26. package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +1 -1
  27. package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +4 -3
  28. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +20 -22
  29. package/dist/cjs/shared/createGlobalContextShared.js +4 -22
  30. package/dist/cjs/shared/createPageContextShared.js +2 -2
  31. package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +62 -44
  32. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  33. package/dist/cjs/utils/assert.js +16 -1
  34. package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +39 -16
  35. package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
  36. package/dist/esm/client/runtime-client-routing/getPageContextCurrent.d.ts +2 -2
  37. package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +97 -83
  38. package/dist/esm/client/runtime-client-routing/globalContext.d.ts +38 -10
  39. package/dist/esm/client/runtime-client-routing/prefetch/getPrefetchSettings.d.ts +2 -2
  40. package/dist/esm/client/runtime-client-routing/prefetch.d.ts +2 -2
  41. package/dist/esm/client/runtime-client-routing/prefetch.js +2 -2
  42. package/dist/esm/client/runtime-client-routing/preparePageContextForPublicUsageClient.d.ts +2 -2
  43. package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +43 -28
  44. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +39 -16
  45. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
  46. package/dist/esm/client/runtime-server-routing/globalContext.d.ts +38 -10
  47. package/dist/esm/client/runtime-server-routing/preparePageContextForPublicUsageClient.d.ts +2 -2
  48. package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +38 -10
  49. package/dist/esm/client/shared/execHookOnRenderClient.d.ts +2 -2
  50. package/dist/esm/client/shared/loadPageConfigsLazyClientSide.d.ts +1 -1
  51. package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +2 -3
  52. package/dist/esm/client/shared/preparePageContextForPublicUsageClientShared.d.ts +2 -2
  53. package/dist/esm/node/prerender/resolvePrerenderConfig.js +4 -3
  54. package/dist/esm/node/prerender/runPrerender.d.ts +56 -15
  55. package/dist/esm/node/runtime/globalContext.d.ts +152 -40
  56. package/dist/esm/node/runtime/index.d.ts +3 -3
  57. package/dist/esm/node/runtime/index.js +3 -3
  58. package/dist/esm/node/runtime/page-files/setup.js +3 -1
  59. package/dist/esm/node/runtime/renderPage/createHttpResponse.d.ts +1 -1
  60. package/dist/esm/node/runtime/renderPage/createHttpResponse.js +2 -9
  61. package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +52 -10
  62. package/dist/esm/node/runtime/renderPage/createPageContextServerSide.js +2 -2
  63. package/dist/esm/node/runtime/renderPage/csp.d.ts +12 -0
  64. package/dist/esm/node/runtime/{csp.js → renderPage/csp.js} +13 -12
  65. package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.d.ts +2 -2
  66. package/dist/esm/node/runtime/renderPage/execHookOnRenderHtml.js +2 -2
  67. package/dist/esm/node/runtime/renderPage/execHookServer.d.ts +2 -2
  68. package/dist/esm/node/runtime/renderPage/getEarlyHints.js +1 -1
  69. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +2 -2
  70. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +2 -2
  71. package/dist/esm/node/runtime/renderPage/headersResponse.d.ts +10 -0
  72. package/dist/esm/node/runtime/renderPage/headersResponse.js +46 -0
  73. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.d.ts +1 -1
  74. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getHtmlTags.js +6 -6
  75. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.d.ts +1 -1
  76. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/getViteDevScript.js +1 -1
  77. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/inferHtmlTags.d.ts +3 -3
  78. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/inferHtmlTags.js +4 -5
  79. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.js +1 -1
  80. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.js +1 -1
  81. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/mergeScriptTags.js +3 -3
  82. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets.d.ts +2 -2
  83. package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets.js +2 -2
  84. package/dist/esm/node/runtime/{html → renderPage/html}/propKeys.js +1 -1
  85. package/dist/esm/node/runtime/{html → renderPage/html}/renderHtml.d.ts +1 -1
  86. package/dist/esm/node/runtime/{html → renderPage/html}/renderHtml.js +1 -1
  87. package/dist/esm/node/runtime/{html → renderPage/html}/serializeContext.d.ts +4 -4
  88. package/dist/esm/node/runtime/{html → renderPage/html}/serializeContext.js +6 -6
  89. package/dist/esm/node/runtime/{html → renderPage/html}/stream/react-streaming.js +1 -1
  90. package/dist/esm/node/runtime/{html → renderPage/html}/stream.js +1 -1
  91. package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +61 -16
  92. package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +18 -50
  93. package/dist/esm/node/runtime/renderPage/preparePageContextForPublicUsageServer.d.ts +2 -2
  94. package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.d.ts +112 -30
  95. package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.js +2 -2
  96. package/dist/esm/node/runtime/renderPage.d.ts +52 -10
  97. package/dist/esm/node/runtime/renderPage.js +1 -1
  98. package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +1 -1
  99. package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +4 -3
  100. package/dist/esm/node/vite/shared/resolveVikeConfigInternal.d.ts +4 -8
  101. package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +22 -24
  102. package/dist/esm/shared/createGlobalContextShared.d.ts +73 -17
  103. package/dist/esm/shared/createGlobalContextShared.js +5 -23
  104. package/dist/esm/shared/createPageContextShared.d.ts +2 -7
  105. package/dist/esm/shared/createPageContextShared.js +2 -2
  106. package/dist/esm/shared/getPageFiles.d.ts +1 -1
  107. package/dist/esm/shared/hooks/execHook.d.ts +2 -2
  108. package/dist/esm/shared/hooks/getHook.d.ts +3 -3
  109. package/dist/esm/shared/page-configs/resolveVikeConfigPublic.d.ts +91 -31
  110. package/dist/esm/shared/page-configs/resolveVikeConfigPublic.js +62 -44
  111. package/dist/esm/types/Config/ConfigResolved.d.ts +8 -0
  112. package/dist/esm/types/Config.d.ts +4 -4
  113. package/dist/esm/types/PageContext.d.ts +3 -26
  114. package/dist/esm/types/VikeNamespace.d.ts +0 -27
  115. package/dist/esm/types/index.d.ts +2 -2
  116. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  117. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  118. package/dist/esm/utils/assert.js +16 -1
  119. package/package.json +1 -1
  120. package/dist/cjs/types/Config/helpers.js +0 -2
  121. package/dist/esm/node/runtime/csp.d.ts +0 -12
  122. package/dist/esm/types/Config/PageContextConfig.d.ts +0 -15
  123. package/dist/esm/types/Config/helpers.d.ts +0 -10
  124. package/dist/esm/types/Config/helpers.js +0 -1
  125. /package/dist/cjs/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.js +0 -0
  126. /package/dist/cjs/types/Config/{PageContextConfig.js → ConfigResolved.js} +0 -0
  127. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectAssets__public.d.ts +0 -0
  128. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/injectHtmlTags.d.ts +0 -0
  129. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/mergeScriptTags.d.ts +0 -0
  130. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.d.ts +0 -0
  131. /package/dist/esm/node/runtime/{html → renderPage/html}/injectAssets/sanitizeJson.js +0 -0
  132. /package/dist/esm/node/runtime/{html → renderPage/html}/propKeys.d.ts +0 -0
  133. /package/dist/esm/node/runtime/{html → renderPage/html}/stream/react-streaming.d.ts +0 -0
  134. /package/dist/esm/node/runtime/{html → renderPage/html}/stream.d.ts +0 -0
  135. /package/dist/esm/types/Config/{PageContextConfig.js → ConfigResolved.js} +0 -0
@@ -40,23 +40,51 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
40
40
  headers?: Record<string, string>;
41
41
  } & {
42
42
  _globalContext: {
43
- isGlobalContext: true;
44
- _isOriginalObject: true;
45
- _virtualFileExportsGlobalEntry: unknown;
46
- _pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
47
- _pageConfigs: import("../../../types/PageConfig.js").PageConfigRuntime[];
48
- _pageConfigGlobal: import("../../../types/PageConfig.js").PageConfigGlobalRuntime;
49
- _allPageIds: string[];
50
- _vikeConfigPublicGlobal: {
43
+ _globalConfigPublic: {
44
+ pages: {
45
+ [k: string]: {
46
+ config: import("../../../types/index.js").ConfigResolved;
47
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
48
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
49
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
50
+ } & ({
51
+ route: import("../../../types/Config.js").Route;
52
+ isErrorPage?: undefined;
53
+ } | {
54
+ route?: undefined;
55
+ isErrorPage: true;
56
+ });
57
+ };
51
58
  config: import("../../../types/index.js").ConfigResolved;
52
59
  _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
53
60
  _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
54
61
  _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
55
62
  };
56
- config: import("../../../types/index.js").ConfigResolved;
57
63
  pages: {
58
- [k: string]: import("../../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEagerLoaded;
64
+ [k: string]: {
65
+ config: import("../../../types/index.js").ConfigResolved;
66
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
67
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
68
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
69
+ } & ({
70
+ route: import("../../../types/Config.js").Route;
71
+ isErrorPage?: undefined;
72
+ } | {
73
+ route?: undefined;
74
+ isErrorPage: true;
75
+ });
59
76
  };
77
+ config: import("../../../types/index.js").ConfigResolved;
78
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
79
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
80
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
81
+ isGlobalContext: true;
82
+ _isOriginalObject: true;
83
+ _virtualFileExportsGlobalEntry: unknown;
84
+ _pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
85
+ _pageConfigs: import("../../../types/PageConfig.js").PageConfigRuntime[];
86
+ _pageConfigGlobal: import("../../../types/PageConfig.js").PageConfigGlobalRuntime;
87
+ _allPageIds: string[];
60
88
  } & (({
61
89
  _isProduction: false;
62
90
  _isPrerendering: false;
@@ -108,6 +136,20 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
108
136
  _urlHandler: ((url: string) => string) | null;
109
137
  isClientSideNavigation: boolean;
110
138
  } & {
139
+ pages: {
140
+ [k: string]: {
141
+ config: import("../../../types/index.js").ConfigResolved;
142
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
143
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
144
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
145
+ } & ({
146
+ route: import("../../../types/Config.js").Route;
147
+ isErrorPage?: undefined;
148
+ } | {
149
+ route?: undefined;
150
+ isErrorPage: true;
151
+ });
152
+ };
111
153
  config: import("../../../types/index.js").ConfigResolved;
112
154
  _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
113
155
  _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
@@ -123,16 +165,15 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
123
165
  pageId: string;
124
166
  } & {
125
167
  _pageConfig: import("../../../types/PageConfig.js").PageConfigRuntime | null;
126
- } & {
127
- _pageConfig: null | import("../../../types/PageConfig.js").PageConfigRuntime;
128
- } & import("../../../shared/getPageFiles.js").VikeConfigPublicPageLazyLoaded & {
168
+ } & import("../../../shared/getPageFiles.js").PageContextConfig & {
129
169
  _pageConfig: null | import("../../../types/PageConfig.js").PageConfigRuntime;
130
170
  } & {
131
- cspNonce: string;
171
+ cspNonce: string | null;
132
172
  } & {
133
173
  Page: unknown;
134
174
  _isHtmlOnly: boolean;
135
- _passToClient: import("../html/serializeContext.js").PassToClient;
175
+ _passToClient: import("./html/serializeContext.js").PassToClient;
176
+ } & {
136
177
  headersResponse: Headers;
137
178
  } & {
138
179
  __getPageAssets: () => Promise<import("./getPageAssets.js").PageAsset[]>;
@@ -161,23 +202,51 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
161
202
  headers?: Record<string, string>;
162
203
  } & {
163
204
  _globalContext: {
164
- isGlobalContext: true;
165
- _isOriginalObject: true;
166
- _virtualFileExportsGlobalEntry: unknown;
167
- _pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
168
- _pageConfigs: import("../../../types/PageConfig.js").PageConfigRuntime[];
169
- _pageConfigGlobal: import("../../../types/PageConfig.js").PageConfigGlobalRuntime;
170
- _allPageIds: string[];
171
- _vikeConfigPublicGlobal: {
205
+ _globalConfigPublic: {
206
+ pages: {
207
+ [k: string]: {
208
+ config: import("../../../types/index.js").ConfigResolved;
209
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
210
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
211
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
212
+ } & ({
213
+ route: import("../../../types/Config.js").Route;
214
+ isErrorPage?: undefined;
215
+ } | {
216
+ route?: undefined;
217
+ isErrorPage: true;
218
+ });
219
+ };
172
220
  config: import("../../../types/index.js").ConfigResolved;
173
221
  _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
174
222
  _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
175
223
  _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
176
224
  };
177
- config: import("../../../types/index.js").ConfigResolved;
178
225
  pages: {
179
- [k: string]: import("../../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEagerLoaded;
226
+ [k: string]: {
227
+ config: import("../../../types/index.js").ConfigResolved;
228
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
229
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
230
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
231
+ } & ({
232
+ route: import("../../../types/Config.js").Route;
233
+ isErrorPage?: undefined;
234
+ } | {
235
+ route?: undefined;
236
+ isErrorPage: true;
237
+ });
180
238
  };
239
+ config: import("../../../types/index.js").ConfigResolved;
240
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
241
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
242
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
243
+ isGlobalContext: true;
244
+ _isOriginalObject: true;
245
+ _virtualFileExportsGlobalEntry: unknown;
246
+ _pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
247
+ _pageConfigs: import("../../../types/PageConfig.js").PageConfigRuntime[];
248
+ _pageConfigGlobal: import("../../../types/PageConfig.js").PageConfigGlobalRuntime;
249
+ _allPageIds: string[];
181
250
  } & (({
182
251
  _isProduction: false;
183
252
  _isPrerendering: false;
@@ -229,6 +298,20 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
229
298
  _urlHandler: ((url: string) => string) | null;
230
299
  isClientSideNavigation: boolean;
231
300
  } & {
301
+ pages: {
302
+ [k: string]: {
303
+ config: import("../../../types/index.js").ConfigResolved;
304
+ _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
305
+ _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
306
+ _from: import("../../../shared/page-configs/resolveVikeConfigPublic.js").From;
307
+ } & ({
308
+ route: import("../../../types/Config.js").Route;
309
+ isErrorPage?: undefined;
310
+ } | {
311
+ route?: undefined;
312
+ isErrorPage: true;
313
+ });
314
+ };
232
315
  config: import("../../../types/index.js").ConfigResolved;
233
316
  _source: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Source;
234
317
  _sources: import("../../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
@@ -244,16 +327,15 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
244
327
  pageId: string;
245
328
  } & {
246
329
  _pageConfig: import("../../../types/PageConfig.js").PageConfigRuntime | null;
247
- } & {
248
- _pageConfig: null | import("../../../types/PageConfig.js").PageConfigRuntime;
249
- } & import("../../../shared/getPageFiles.js").VikeConfigPublicPageLazyLoaded & {
330
+ } & import("../../../shared/getPageFiles.js").PageContextConfig & {
250
331
  _pageConfig: null | import("../../../types/PageConfig.js").PageConfigRuntime;
251
332
  } & {
252
- cspNonce: string;
333
+ cspNonce: string | null;
253
334
  } & {
254
335
  Page: unknown;
255
336
  _isHtmlOnly: boolean;
256
- _passToClient: import("../html/serializeContext.js").PassToClient;
337
+ _passToClient: import("./html/serializeContext.js").PassToClient;
338
+ } & {
257
339
  headersResponse: Headers;
258
340
  } & {
259
341
  __getPageAssets: () => Promise<import("./getPageAssets.js").PageAsset[]>;
@@ -1,9 +1,9 @@
1
1
  export { renderPageAfterRoute };
2
2
  export { prerenderPage };
3
3
  import { getErrorPageId } from '../../../shared/error-page.js';
4
- import { getHtmlString } from '../html/renderHtml.js';
4
+ import { getHtmlString } from './html/renderHtml.js';
5
5
  import { assert, assertUsage, updateType, hasProp, objectAssign } from '../utils.js';
6
- import { getPageContextClientSerialized } from '../html/serializeContext.js';
6
+ import { getPageContextClientSerialized } from './html/serializeContext.js';
7
7
  import { createHttpResponsePage, createHttpResponsePageContextJson } from './createHttpResponse.js';
8
8
  import { loadPageConfigsLazyServerSide, } from './loadPageConfigsLazyServerSide.js';
9
9
  import { execHookOnRenderHtml } from './execHookOnRenderHtml.js';
@@ -32,23 +32,51 @@ declare function getPageContextBegin(pageContextInit: PageContextInit, globalCon
32
32
  /** @deprecated Set pageContextInit.headersOriginal instead */ headers?: Record<string, string>;
33
33
  } & {
34
34
  _globalContext: {
35
- isGlobalContext: true;
36
- _isOriginalObject: true;
37
- _virtualFileExportsGlobalEntry: unknown;
38
- _pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
39
- _pageConfigs: import("../../types/PageConfig.js").PageConfigRuntime[];
40
- _pageConfigGlobal: import("../../types/PageConfig.js").PageConfigGlobalRuntime;
41
- _allPageIds: string[];
42
- _vikeConfigPublicGlobal: {
35
+ _globalConfigPublic: {
36
+ pages: {
37
+ [k: string]: {
38
+ config: import("../../types/index.js").ConfigResolved;
39
+ _source: import("../../shared/page-configs/resolveVikeConfigPublic.js").Source;
40
+ _sources: import("../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
41
+ _from: import("../../shared/page-configs/resolveVikeConfigPublic.js").From;
42
+ } & ({
43
+ route: import("../../types/Config.js").Route;
44
+ isErrorPage?: undefined;
45
+ } | {
46
+ route?: undefined;
47
+ isErrorPage: true;
48
+ });
49
+ };
43
50
  config: import("../../types/index.js").ConfigResolved;
44
51
  _source: import("../../shared/page-configs/resolveVikeConfigPublic.js").Source;
45
52
  _sources: import("../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
46
53
  _from: import("../../shared/page-configs/resolveVikeConfigPublic.js").From;
47
54
  };
48
- config: import("../../types/index.js").ConfigResolved;
49
55
  pages: {
50
- [k: string]: import("../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEagerLoaded;
56
+ [k: string]: {
57
+ config: import("../../types/index.js").ConfigResolved;
58
+ _source: import("../../shared/page-configs/resolveVikeConfigPublic.js").Source;
59
+ _sources: import("../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
60
+ _from: import("../../shared/page-configs/resolveVikeConfigPublic.js").From;
61
+ } & ({
62
+ route: import("../../types/Config.js").Route;
63
+ isErrorPage?: undefined;
64
+ } | {
65
+ route?: undefined;
66
+ isErrorPage: true;
67
+ });
51
68
  };
69
+ config: import("../../types/index.js").ConfigResolved;
70
+ _source: import("../../shared/page-configs/resolveVikeConfigPublic.js").Source;
71
+ _sources: import("../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
72
+ _from: import("../../shared/page-configs/resolveVikeConfigPublic.js").From;
73
+ isGlobalContext: true;
74
+ _isOriginalObject: true;
75
+ _virtualFileExportsGlobalEntry: unknown;
76
+ _pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
77
+ _pageConfigs: import("../../types/PageConfig.js").PageConfigRuntime[];
78
+ _pageConfigGlobal: import("../../types/PageConfig.js").PageConfigGlobalRuntime;
79
+ _allPageIds: string[];
52
80
  } & (({
53
81
  _isProduction: false;
54
82
  _isPrerendering: false;
@@ -100,6 +128,20 @@ declare function getPageContextBegin(pageContextInit: PageContextInit, globalCon
100
128
  _urlHandler: ((url: string) => string) | null;
101
129
  isClientSideNavigation: boolean;
102
130
  } & {
131
+ pages: {
132
+ [k: string]: {
133
+ config: import("../../types/index.js").ConfigResolved;
134
+ _source: import("../../shared/page-configs/resolveVikeConfigPublic.js").Source;
135
+ _sources: import("../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
136
+ _from: import("../../shared/page-configs/resolveVikeConfigPublic.js").From;
137
+ } & ({
138
+ route: import("../../types/Config.js").Route;
139
+ isErrorPage?: undefined;
140
+ } | {
141
+ route?: undefined;
142
+ isErrorPage: true;
143
+ });
144
+ };
103
145
  config: import("../../types/index.js").ConfigResolved;
104
146
  _source: import("../../shared/page-configs/resolveVikeConfigPublic.js").Source;
105
147
  _sources: import("../../shared/page-configs/resolveVikeConfigPublic.js").Sources;
@@ -13,7 +13,7 @@ import { isNewError } from './renderPage/isNewError.js';
13
13
  import { assertArguments } from './renderPage/assertArguments.js';
14
14
  import { log404 } from './renderPage/log404/index.js';
15
15
  import pc from '@brillout/picocolors';
16
- import { getPageContextClientSerializedAbort, getPageContextClientSerialized } from './html/serializeContext.js';
16
+ import { getPageContextClientSerializedAbort, getPageContextClientSerialized, } from './renderPage/html/serializeContext.js';
17
17
  import { getErrorPageId } from '../../shared/error-page.js';
18
18
  import { handleErrorWithoutErrorPage } from './renderPage/handleErrorWithoutErrorPage.js';
19
19
  import { loadPageConfigsLazyServerSide } from './renderPage/loadPageConfigsLazyServerSide.js';
@@ -19,7 +19,7 @@ import { getManifestFilePathRelative } from '../../shared/getManifestFilePathRel
19
19
  const globalObject = getGlobalObject('build/handleAssetsManifest.ts', {
20
20
  assetsJsonFilePath: undefined,
21
21
  });
22
- // true => use workaround config.build.ssrEmitAssets
22
+ // yes => use workaround config.build.ssrEmitAssets
23
23
  // false => use workaround extractAssets plugin
24
24
  function handleAssetsManifest_isFixEnabled() {
25
25
  // Allow user to toggle between the two workarounds? E.g. based on https://vike.dev/includeAssetsImportedByServer.
@@ -32,15 +32,16 @@ function pluginNonRunnableDev() {
32
32
  transform(code, id) {
33
33
  if (!config._isDev)
34
34
  return;
35
- if (id !== distFileIsNonRunnableDev && id !== distFileGlobalContext)
35
+ const idWithoutQuery = id.split('?')[0];
36
+ if (idWithoutQuery !== distFileIsNonRunnableDev && idWithoutQuery !== distFileGlobalContext)
36
37
  return;
37
38
  if (isRunnableDevEnvironment(this.environment))
38
39
  return;
39
40
  const { magicString, getMagicStringResult } = getMagicString(code, id);
40
- if (id === distFileIsNonRunnableDev) {
41
+ if (idWithoutQuery === distFileIsNonRunnableDev) {
41
42
  magicString.replaceAll('__VIKE__IS_NON_RUNNABLE_DEV', JSON.stringify(true));
42
43
  }
43
- if (id === distFileGlobalContext) {
44
+ if (idWithoutQuery === distFileGlobalContext) {
44
45
  magicString.replaceAll('__VIKE__DYNAMIC_IMPORT', 'import');
45
46
  }
46
47
  return getMagicStringResult();
@@ -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 VikeConfigPublicGlobal, type VikeConfigPublicPageEagerLoaded } from '../../../shared/page-configs/resolveVikeConfigPublic.js';
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 { resolveVikeConfigPublicGlobal, resolveVikeConfigPublicPageEagerLoaded, } from '../../../shared/page-configs/resolveVikeConfigPublic.js';
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
- // global
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: vikeConfigPublicGlobal.config,
183
- _from: vikeConfigPublicGlobal._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, tolerateMissingValue) {
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: globalDummy.config,
1132
- _from: globalDummy._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
- config: globalDummy.config,
1142
- _from: globalDummy._from,
1143
- pages: {},
1141
+ ...globalConfigPublicDummy,
1144
1142
  prerenderContext: prerenderContextDummy,
1145
1143
  _vikeConfigDependencies: esbuildCache.vikeConfigDependencies,
1146
1144
  };
@@ -14,6 +14,44 @@ declare function createGlobalContextShared<GlobalContextAdded extends Record<str
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
- _vikeConfigPublicGlobal: {
67
+ } & GlobalContextAdded & 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]: import("./page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEagerLoaded;
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
- } & GlobalContextAdded & GlobalContextAddedAsync>;
40
- type GlobalContextBasePublic = Pick<GlobalContextBase, 'config' | 'pages' | 'isGlobalContext'>;
41
- type GlobalContextBase = ReturnType<typeof createGlobalContextBase>;
42
- declare function createGlobalContextBase(virtualFileExportsGlobalEntry: unknown): {
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
  };