vike 0.4.239 → 0.4.240

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 (465) hide show
  1. package/dist/esm/client/index.d.ts +1 -1
  2. package/dist/esm/client/index.js +1 -1
  3. package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +1 -1
  4. package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
  5. package/dist/esm/client/runtime-client-routing/entry.js +5 -3
  6. package/dist/esm/client/runtime-client-routing/getBaseServer.js +0 -1
  7. package/dist/esm/client/runtime-client-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
  8. package/dist/esm/client/runtime-client-routing/{globalContext.js → getGlobalContextClientInternal.js} +8 -4
  9. package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +6 -6
  10. package/dist/esm/client/runtime-client-routing/isClientSideRoutable.d.ts +1 -1
  11. package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +4 -4
  12. package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +15 -4
  13. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
  14. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
  15. package/dist/esm/client/runtime-server-routing/entry.js +5 -3
  16. package/dist/esm/client/runtime-server-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
  17. package/dist/esm/client/runtime-server-routing/getGlobalContextClientInternal.js +6 -0
  18. package/dist/esm/client/shared/execHookOnRenderClient.d.ts +1 -1
  19. package/dist/esm/client/shared/{createGetGlobalContextClient.d.ts → getGlobalContextClientInternalShared.d.ts} +11 -8
  20. package/dist/esm/client/shared/getGlobalContextClientInternalShared.js +66 -0
  21. package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +1 -3
  22. package/dist/esm/node/prerender/runPrerender.d.ts +4 -2
  23. package/dist/esm/node/prerender/runPrerender.js +5 -2
  24. package/dist/esm/node/runtime/globalContext.d.ts +15 -2
  25. package/dist/esm/node/runtime/globalContext.js +46 -32
  26. package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +4 -2
  27. package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +4 -2
  28. package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.d.ts +8 -4
  29. package/dist/esm/node/runtime/renderPage.d.ts +4 -2
  30. package/dist/esm/node/vite/index.js +41 -17
  31. package/dist/esm/node/vite/onLoad.js +1 -1
  32. package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.d.ts +4 -0
  33. package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.js +21 -6
  34. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.js +24 -20
  35. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.js +20 -6
  36. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistFileNames.d.ts +1 -1
  37. package/dist/esm/node/vite/plugins/build/pluginDistFileNames.js +253 -0
  38. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistPackageJsonFile.d.ts +1 -1
  39. package/dist/esm/node/vite/plugins/build/pluginDistPackageJsonFile.js +40 -0
  40. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginModuleBanner.d.ts +1 -1
  41. package/dist/esm/node/vite/plugins/build/pluginModuleBanner.js +49 -0
  42. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.js +4 -2
  43. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.d.ts +1 -1
  44. package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.js +27 -23
  45. package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.d.ts +7 -0
  46. package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js +47 -0
  47. package/dist/esm/node/vite/plugins/{pluginNonRunnableDev.d.ts → non-runnable-dev/pluginViteRPC.d.ts} +3 -7
  48. package/dist/esm/node/vite/plugins/non-runnable-dev/pluginViteRPC.js +30 -0
  49. package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
  50. package/dist/esm/node/vite/plugins/pluginBaseUrls.js +39 -33
  51. package/dist/esm/node/vite/plugins/pluginCommon.js +8 -28
  52. package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
  53. package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +1 -1
  54. package/dist/esm/node/vite/plugins/pluginDev.js +51 -47
  55. package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +1 -1
  56. package/dist/esm/node/vite/plugins/pluginEnvVars.js +88 -63
  57. package/dist/esm/node/vite/plugins/pluginExtractAssets.js +108 -92
  58. package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
  59. package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +39 -23
  60. package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
  61. package/dist/esm/node/vite/plugins/pluginFileEnv.js +117 -92
  62. package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
  63. package/dist/esm/node/vite/plugins/pluginPreview.js +38 -30
  64. package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.d.ts +9 -0
  65. package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.js +45 -0
  66. package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.d.ts +3 -0
  67. package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.js +87 -0
  68. package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +4 -2
  69. package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +1 -1
  70. package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
  71. package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +67 -47
  72. package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
  73. package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +13 -9
  74. package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
  75. package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
  76. package/dist/esm/node/vite/shared/getMagicString.d.ts +1 -1
  77. package/dist/esm/node/vite/shared/getMagicString.js +2 -0
  78. package/dist/esm/shared/createGlobalContextShared.d.ts +4 -4
  79. package/dist/esm/shared/route/abort.d.ts +22 -11
  80. package/dist/esm/shared/route/abort.js +37 -5
  81. package/dist/esm/types/PageContext.d.ts +8 -8
  82. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  83. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  84. package/dist/esm/utils/debug.js +10 -0
  85. package/dist/esm/utils/findPackageJson.js +0 -1
  86. package/dist/esm/utils/getViteRPC.js +0 -2
  87. package/dist/esm/utils/isDev.js +3 -1
  88. package/dist/esm/utils/isNonRunnableDev.js +2 -2
  89. package/dist/esm/utils/requireResolve.js +0 -1
  90. package/dist/esm/utils/virtualFileId.d.ts +4 -0
  91. package/dist/esm/utils/virtualFileId.js +14 -11
  92. package/package.json +6 -25
  93. package/dist/cjs/__internal/index.js +0 -35
  94. package/dist/cjs/client/runtime-client-routing/globalContext.js +0 -49
  95. package/dist/cjs/client/runtime-client-routing/prefetch/PrefetchSetting.js +0 -2
  96. package/dist/cjs/client/runtime-server-routing/globalContext.js +0 -41
  97. package/dist/cjs/client/runtime-server-routing/onLoad.js +0 -7
  98. package/dist/cjs/client/runtime-server-routing/utils.js +0 -34
  99. package/dist/cjs/client/shared/createGetGlobalContextClient.js +0 -65
  100. package/dist/cjs/client/shared/getJsonSerializedInHtml.js +0 -40
  101. package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +0 -41
  102. package/dist/cjs/client/shared/utils.js +0 -23
  103. package/dist/cjs/node/api/build.js +0 -24
  104. package/dist/cjs/node/api/context.js +0 -23
  105. package/dist/cjs/node/api/dev.js +0 -18
  106. package/dist/cjs/node/api/index.js +0 -44
  107. package/dist/cjs/node/api/onLoad.js +0 -9
  108. package/dist/cjs/node/api/prepareViteApiCall.js +0 -206
  109. package/dist/cjs/node/api/prerender.js +0 -18
  110. package/dist/cjs/node/api/preview.js +0 -38
  111. package/dist/cjs/node/api/types.js +0 -2
  112. package/dist/cjs/node/api/utils.js +0 -27
  113. package/dist/cjs/node/cli/context.js +0 -17
  114. package/dist/cjs/node/cli/entry.js +0 -121
  115. package/dist/cjs/node/cli/index.js +0 -12
  116. package/dist/cjs/node/cli/onLoad.js +0 -9
  117. package/dist/cjs/node/cli/parseCli.js +0 -95
  118. package/dist/cjs/node/cli/utils.js +0 -24
  119. package/dist/cjs/node/client/router.js +0 -19
  120. package/dist/cjs/node/createPageRenderer.js +0 -132
  121. package/dist/cjs/node/importBuild.js +0 -3
  122. package/dist/cjs/node/prerender/context.js +0 -26
  123. package/dist/cjs/node/prerender/index.js +0 -12
  124. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +0 -66
  125. package/dist/cjs/node/prerender/runPrerender.js +0 -777
  126. package/dist/cjs/node/prerender/runPrerenderEntry.js +0 -55
  127. package/dist/cjs/node/prerender/utils.js +0 -37
  128. package/dist/cjs/node/runtime/globalContext.js +0 -572
  129. package/dist/cjs/node/runtime/index-deprecated.js +0 -33
  130. package/dist/cjs/node/runtime/index.js +0 -74
  131. package/dist/cjs/node/runtime/loggerRuntime.js +0 -17
  132. package/dist/cjs/node/runtime/onLoad.js +0 -29
  133. package/dist/cjs/node/runtime/page-files/setup.js +0 -5
  134. package/dist/cjs/node/runtime/renderPage/analyzePage.js +0 -71
  135. package/dist/cjs/node/runtime/renderPage/assertArguments.js +0 -42
  136. package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +0 -51
  137. package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -114
  138. package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +0 -59
  139. package/dist/cjs/node/runtime/renderPage/csp.js +0 -47
  140. package/dist/cjs/node/runtime/renderPage/execHookDataAndOnBeforeRender.js +0 -31
  141. package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +0 -120
  142. package/dist/cjs/node/runtime/renderPage/execHookServer.js +0 -8
  143. package/dist/cjs/node/runtime/renderPage/getCacheControl.js +0 -24
  144. package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +0 -20
  145. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +0 -137
  146. package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +0 -125
  147. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsDev.js +0 -86
  148. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsProd.js +0 -77
  149. package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +0 -36
  150. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +0 -50
  151. package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +0 -41
  152. package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +0 -68
  153. package/dist/cjs/node/runtime/renderPage/headersResponse.js +0 -48
  154. package/dist/cjs/node/runtime/renderPage/html/injectAssets/getHtmlTags.js +0 -269
  155. package/dist/cjs/node/runtime/renderPage/html/injectAssets/getViteDevScript.js +0 -32
  156. package/dist/cjs/node/runtime/renderPage/html/injectAssets/inferHtmlTags.js +0 -55
  157. package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectAssets__public.js +0 -31
  158. package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectHtmlTags.js +0 -161
  159. package/dist/cjs/node/runtime/renderPage/html/injectAssets/mergeScriptTags.js +0 -73
  160. package/dist/cjs/node/runtime/renderPage/html/injectAssets/sanitizeJson.js +0 -8
  161. package/dist/cjs/node/runtime/renderPage/html/injectAssets.js +0 -93
  162. package/dist/cjs/node/runtime/renderPage/html/propKeys.js +0 -47
  163. package/dist/cjs/node/runtime/renderPage/html/renderHtml.js +0 -245
  164. package/dist/cjs/node/runtime/renderPage/html/serializeContext.js +0 -189
  165. package/dist/cjs/node/runtime/renderPage/html/stream/react-streaming.js +0 -36
  166. package/dist/cjs/node/runtime/renderPage/html/stream.js +0 -829
  167. package/dist/cjs/node/runtime/renderPage/inferMediaType.js +0 -81
  168. package/dist/cjs/node/runtime/renderPage/isFontFallback.js +0 -29
  169. package/dist/cjs/node/runtime/renderPage/isNewError.js +0 -25
  170. package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +0 -124
  171. package/dist/cjs/node/runtime/renderPage/log404/index.js +0 -154
  172. package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +0 -20
  173. package/dist/cjs/node/runtime/renderPage/logErrorHint.js +0 -200
  174. package/dist/cjs/node/runtime/renderPage/loggerProd.js +0 -34
  175. package/dist/cjs/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +0 -10
  176. package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +0 -83
  177. package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +0 -71
  178. package/dist/cjs/node/runtime/renderPage.js +0 -502
  179. package/dist/cjs/node/runtime/universal-middleware.js +0 -20
  180. package/dist/cjs/node/runtime/utils.js +0 -83
  181. package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -27
  182. package/dist/cjs/node/runtime-dev/index.js +0 -42
  183. package/dist/cjs/node/shared/assertV1Design.js +0 -30
  184. package/dist/cjs/node/shared/extractAssetsQuery.js +0 -29
  185. package/dist/cjs/node/shared/getVikeConfigError.js +0 -22
  186. package/dist/cjs/node/shared/isErrorDebug.js +0 -7
  187. package/dist/cjs/node/shared/prependEntriesDir.js +0 -13
  188. package/dist/cjs/node/shared/resolveBase.js +0 -35
  189. package/dist/cjs/node/shared/utils.js +0 -35
  190. package/dist/cjs/node/shared/virtualFileId.js +0 -110
  191. package/dist/cjs/node/vite/index.js +0 -69
  192. package/dist/cjs/node/vite/onLoad.js +0 -21
  193. package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +0 -48
  194. package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -342
  195. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -179
  196. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -220
  197. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -254
  198. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -36
  199. package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -41
  200. package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -109
  201. package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -63
  202. package/dist/cjs/node/vite/plugins/pluginBuild.js +0 -21
  203. package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +0 -88
  204. package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -197
  205. package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -28
  206. package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +0 -163
  207. package/dist/cjs/node/vite/plugins/pluginDev.js +0 -107
  208. package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -87
  209. package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -227
  210. package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -99
  211. package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -149
  212. package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -52
  213. package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -76
  214. package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -69
  215. package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -49
  216. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/debug.js +0 -5
  217. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +0 -56
  218. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +0 -190
  219. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +0 -54
  220. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +0 -97
  221. package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +0 -215
  222. package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -15
  223. package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +0 -35
  224. package/dist/cjs/node/vite/shared/addSsrMiddleware.js +0 -60
  225. package/dist/cjs/node/vite/shared/findPageFiles.js +0 -25
  226. package/dist/cjs/node/vite/shared/getAssetsDir.js +0 -10
  227. package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +0 -42
  228. package/dist/cjs/node/vite/shared/getEnvVarObject.js +0 -37
  229. package/dist/cjs/node/vite/shared/getFilePath.js +0 -172
  230. package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +0 -125
  231. package/dist/cjs/node/vite/shared/getMagicString.js +0 -18
  232. package/dist/cjs/node/vite/shared/getManifestFilePathRelative.js +0 -10
  233. package/dist/cjs/node/vite/shared/getOutDirs.js +0 -146
  234. package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +0 -21
  235. package/dist/cjs/node/vite/shared/isAsset.js +0 -40
  236. package/dist/cjs/node/vite/shared/isViteCliCall.js +0 -83
  237. package/dist/cjs/node/vite/shared/isViteServerSide.js +0 -68
  238. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +0 -15
  239. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +0 -15
  240. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +0 -38
  241. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +0 -26
  242. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +0 -85
  243. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +0 -30
  244. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +0 -19
  245. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +0 -19
  246. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +0 -29
  247. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +0 -13
  248. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +0 -15
  249. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +0 -162
  250. package/dist/cjs/node/vite/shared/loggerNotProd/log.js +0 -102
  251. package/dist/cjs/node/vite/shared/loggerNotProd.js +0 -208
  252. package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +0 -26
  253. package/dist/cjs/node/vite/shared/loggerVite.js +0 -54
  254. package/dist/cjs/node/vite/shared/normalizeId.js +0 -9
  255. package/dist/cjs/node/vite/shared/parseEsModule.js +0 -33
  256. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +0 -136
  257. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +0 -262
  258. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +0 -18
  259. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +0 -252
  260. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +0 -190
  261. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getConfigFileExport.js +0 -17
  262. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +0 -127
  263. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +0 -129
  264. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +0 -195
  265. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +0 -102
  266. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +0 -425
  267. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +0 -1151
  268. package/dist/cjs/node/vite/shared/rollupIsEsm.js +0 -15
  269. package/dist/cjs/node/vite/utils.js +0 -45
  270. package/dist/cjs/package.json +0 -1
  271. package/dist/cjs/shared/NOT_SERIALIZABLE.js +0 -4
  272. package/dist/cjs/shared/RenderErrorPage.js +0 -6
  273. package/dist/cjs/shared/abort.js +0 -16
  274. package/dist/cjs/shared/addIs404ToPageProps.js +0 -18
  275. package/dist/cjs/shared/assertHookReturnedObject.js +0 -21
  276. package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +0 -21
  277. package/dist/cjs/shared/assertPageContextProvidedByUser.js +0 -20
  278. package/dist/cjs/shared/createGlobalContextShared.js +0 -109
  279. package/dist/cjs/shared/createPageContextShared.js +0 -17
  280. package/dist/cjs/shared/determinePageIdOld.js +0 -11
  281. package/dist/cjs/shared/error-page.js +0 -40
  282. package/dist/cjs/shared/getPageContext.js +0 -6
  283. package/dist/cjs/shared/getPageContextRequestUrl.js +0 -16
  284. package/dist/cjs/shared/getPageContextUrlComputed.js +0 -132
  285. package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +0 -19
  286. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +0 -2
  287. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +0 -50
  288. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +0 -30
  289. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +0 -15
  290. package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +0 -59
  291. package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +0 -22
  292. package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +0 -24
  293. package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -52
  294. package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -102
  295. package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -56
  296. package/dist/cjs/shared/getPageFiles/parseVirtualFileExportsGlobalEntry.js +0 -100
  297. package/dist/cjs/shared/getPageFiles.js +0 -7
  298. package/dist/cjs/shared/getProxyForPublicUsage.js +0 -56
  299. package/dist/cjs/shared/hooks/execHook.js +0 -147
  300. package/dist/cjs/shared/hooks/getHook.js +0 -173
  301. package/dist/cjs/shared/htmlElementIds.js +0 -5
  302. package/dist/cjs/shared/misc/isServerSideError.js +0 -4
  303. package/dist/cjs/shared/misc/pageContextInitIsPassedToClient.js +0 -4
  304. package/dist/cjs/shared/modifyUrl.js +0 -28
  305. package/dist/cjs/shared/modifyUrlSameOrigin.js +0 -47
  306. package/dist/cjs/shared/page-configs/assertPlusFileExport.js +0 -42
  307. package/dist/cjs/shared/page-configs/findPageConfig.js +0 -10
  308. package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +0 -65
  309. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -68
  310. package/dist/cjs/shared/page-configs/getConfigValueRuntime.js +0 -10
  311. package/dist/cjs/shared/page-configs/getConfigValueTyped.js +0 -32
  312. package/dist/cjs/shared/page-configs/getExportPath.js +0 -29
  313. package/dist/cjs/shared/page-configs/helpers.js +0 -27
  314. package/dist/cjs/shared/page-configs/loadAndParseVirtualFilePageEntry.js +0 -25
  315. package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +0 -287
  316. package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +0 -2
  317. package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -1
  318. package/dist/cjs/shared/page-configs/serialize/parsePageConfigsSerialized.js +0 -145
  319. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +0 -290
  320. package/dist/cjs/shared/prepareGlobalContextForPublicUsage.js +0 -10
  321. package/dist/cjs/shared/preparePageContextForPublicUsage.js +0 -80
  322. package/dist/cjs/shared/route/abort.js +0 -178
  323. package/dist/cjs/shared/route/debug.js +0 -23
  324. package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +0 -52
  325. package/dist/cjs/shared/route/execHookGuard.js +0 -37
  326. package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -84
  327. package/dist/cjs/shared/route/index.js +0 -107
  328. package/dist/cjs/shared/route/loadPageRoutes.js +0 -197
  329. package/dist/cjs/shared/route/noRouteMatch.js +0 -4
  330. package/dist/cjs/shared/route/resolvePrecedence.js +0 -93
  331. package/dist/cjs/shared/route/resolveRoute.js +0 -20
  332. package/dist/cjs/shared/route/resolveRouteFunction.js +0 -73
  333. package/dist/cjs/shared/route/resolveRouteString.js +0 -153
  334. package/dist/cjs/shared/route/resolveUrlPathname.js +0 -47
  335. package/dist/cjs/shared/route/routing.js +0 -9
  336. package/dist/cjs/shared/route/utils.js +0 -40
  337. package/dist/cjs/shared/utils.js +0 -49
  338. package/dist/cjs/types/Config/ConfigResolved.js +0 -2
  339. package/dist/cjs/types/Config.js +0 -2
  340. package/dist/cjs/types/FilePath.js +0 -2
  341. package/dist/cjs/types/PageConfig.js +0 -2
  342. package/dist/cjs/types/PageContext.js +0 -2
  343. package/dist/cjs/types/VikeGlobalInternal.js +0 -2
  344. package/dist/cjs/types/VikeNamespace.js +0 -2
  345. package/dist/cjs/types/ViteManifest.js +0 -2
  346. package/dist/cjs/types/defineConfig.js +0 -6
  347. package/dist/cjs/types/index-dreprecated.js +0 -3
  348. package/dist/cjs/types/index.js +0 -5
  349. package/dist/cjs/utils/PROJECT_VERSION.js +0 -5
  350. package/dist/cjs/utils/PromiseType.js +0 -2
  351. package/dist/cjs/utils/assert.js +0 -211
  352. package/dist/cjs/utils/assertIsBrowser.js +0 -8
  353. package/dist/cjs/utils/assertIsNotBrowser.js +0 -9
  354. package/dist/cjs/utils/assertKeys.js +0 -27
  355. package/dist/cjs/utils/assertNodeVersion.js +0 -14
  356. package/dist/cjs/utils/assertRoutingType.js +0 -29
  357. package/dist/cjs/utils/assertSetup.js +0 -171
  358. package/dist/cjs/utils/assertSingleInstance.js +0 -110
  359. package/dist/cjs/utils/assertVersion.js +0 -60
  360. package/dist/cjs/utils/capitalizeFirstLetter.js +0 -9
  361. package/dist/cjs/utils/cast.js +0 -6
  362. package/dist/cjs/utils/catchInfiniteLoop.js +0 -34
  363. package/dist/cjs/utils/changeEnumerable.js +0 -8
  364. package/dist/cjs/utils/checkType.js +0 -6
  365. package/dist/cjs/utils/compareString.js +0 -10
  366. package/dist/cjs/utils/createErrorWithCleanStackTrace.js +0 -39
  367. package/dist/cjs/utils/debug.js +0 -178
  368. package/dist/cjs/utils/debugGlob.js +0 -6
  369. package/dist/cjs/utils/deepEqual.js +0 -10
  370. package/dist/cjs/utils/escapeHtml.js +0 -13
  371. package/dist/cjs/utils/escapeRegex.js +0 -7
  372. package/dist/cjs/utils/findFile.js +0 -30
  373. package/dist/cjs/utils/findPackageJson.js +0 -18
  374. package/dist/cjs/utils/formatHintLog.js +0 -17
  375. package/dist/cjs/utils/freezePartial.js +0 -35
  376. package/dist/cjs/utils/genPromise.js +0 -51
  377. package/dist/cjs/utils/getFileExtension.js +0 -16
  378. package/dist/cjs/utils/getGlobalObject.js +0 -15
  379. package/dist/cjs/utils/getMostSimilar.js +0 -68
  380. package/dist/cjs/utils/getPropAccessNotation.js +0 -9
  381. package/dist/cjs/utils/getRandomId.js +0 -14
  382. package/dist/cjs/utils/getTerminalWidth.js +0 -7
  383. package/dist/cjs/utils/getValuePrintable.js +0 -10
  384. package/dist/cjs/utils/getViteRPC.js +0 -79
  385. package/dist/cjs/utils/hasProp.js +0 -50
  386. package/dist/cjs/utils/humanizeTime.js +0 -24
  387. package/dist/cjs/utils/includes.js +0 -13
  388. package/dist/cjs/utils/injectRollupInputs.js +0 -29
  389. package/dist/cjs/utils/isArray.js +0 -7
  390. package/dist/cjs/utils/isArrayOfStrings.js +0 -7
  391. package/dist/cjs/utils/isBrowser.js +0 -8
  392. package/dist/cjs/utils/isCallable.js +0 -6
  393. package/dist/cjs/utils/isDev.js +0 -20
  394. package/dist/cjs/utils/isDocker.js +0 -45
  395. package/dist/cjs/utils/isEqualStringList.js +0 -13
  396. package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +0 -66
  397. package/dist/cjs/utils/isHtml.js +0 -9
  398. package/dist/cjs/utils/isImportPath.js +0 -21
  399. package/dist/cjs/utils/isNodeJS.js +0 -16
  400. package/dist/cjs/utils/isNonRunnableDev.js +0 -12
  401. package/dist/cjs/utils/isNullish.js +0 -16
  402. package/dist/cjs/utils/isObject.js +0 -6
  403. package/dist/cjs/utils/isObjectOfStrings.js +0 -7
  404. package/dist/cjs/utils/isObjectWithKeys.js +0 -15
  405. package/dist/cjs/utils/isPlainObject.js +0 -19
  406. package/dist/cjs/utils/isPromise.js +0 -7
  407. package/dist/cjs/utils/isPropertyGetter.js +0 -7
  408. package/dist/cjs/utils/isReact.js +0 -23
  409. package/dist/cjs/utils/isRunnableDevEnvironment.js +0 -9
  410. package/dist/cjs/utils/isSameErrorMessage.js +0 -9
  411. package/dist/cjs/utils/isScriptFile.js +0 -67
  412. package/dist/cjs/utils/isVikeReactApp.js +0 -8
  413. package/dist/cjs/utils/isVitest.js +0 -6
  414. package/dist/cjs/utils/joinEnglish.js +0 -14
  415. package/dist/cjs/utils/normalizeHeaders.js +0 -17
  416. package/dist/cjs/utils/objectAssign.js +0 -14
  417. package/dist/cjs/utils/objectAssignSafe.js +0 -7
  418. package/dist/cjs/utils/objectDefineProperty.js +0 -7
  419. package/dist/cjs/utils/objectEntries.js +0 -8
  420. package/dist/cjs/utils/objectEntriesForEach.js +0 -7
  421. package/dist/cjs/utils/objectFilter.js +0 -10
  422. package/dist/cjs/utils/objectFromEntries.js +0 -7
  423. package/dist/cjs/utils/objectKeys.js +0 -9
  424. package/dist/cjs/utils/objectReplace.js +0 -9
  425. package/dist/cjs/utils/onPageVisibilityChange.js +0 -18
  426. package/dist/cjs/utils/pLimit.js +0 -134
  427. package/dist/cjs/utils/parseNpmPackage.js +0 -106
  428. package/dist/cjs/utils/parseUrl-extras.js +0 -110
  429. package/dist/cjs/utils/parseUrl.js +0 -338
  430. package/dist/cjs/utils/path.js +0 -59
  431. package/dist/cjs/utils/pick.js +0 -12
  432. package/dist/cjs/utils/preservePropertyGetters.js +0 -30
  433. package/dist/cjs/utils/redirectHard.js +0 -6
  434. package/dist/cjs/utils/removeEmptyLines.js +0 -9
  435. package/dist/cjs/utils/removeFileExtension.js +0 -6
  436. package/dist/cjs/utils/requireResolve.js +0 -214
  437. package/dist/cjs/utils/rollupSourceMap.js +0 -19
  438. package/dist/cjs/utils/sleep.js +0 -6
  439. package/dist/cjs/utils/slice.js +0 -35
  440. package/dist/cjs/utils/sorter.js +0 -117
  441. package/dist/cjs/utils/stringifyStringArray.js +0 -6
  442. package/dist/cjs/utils/stripAnsi.js +0 -21
  443. package/dist/cjs/utils/styleFileRE.js +0 -6
  444. package/dist/cjs/utils/throttle.js +0 -15
  445. package/dist/cjs/utils/trackLogs.js +0 -31
  446. package/dist/cjs/utils/trimWithAnsi.js +0 -40
  447. package/dist/cjs/utils/truncateString.js +0 -23
  448. package/dist/cjs/utils/unique.js +0 -6
  449. package/dist/cjs/utils/updateType.js +0 -9
  450. package/dist/cjs/utils/urlToFile.js +0 -36
  451. package/dist/cjs/utils/virtualFileId.js +0 -39
  452. package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
  453. package/dist/esm/client/runtime-server-routing/globalContext.js +0 -5
  454. package/dist/esm/client/shared/createGetGlobalContextClient.js +0 -65
  455. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -249
  456. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -34
  457. package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -39
  458. package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
  459. package/dist/esm/node/vite/plugins/pluginBuild.js +0 -19
  460. package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +0 -50
  461. package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -3
  462. package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -67
  463. /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.d.ts +0 -0
  464. /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.d.ts +0 -0
  465. /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.d.ts +0 -0
@@ -1 +1 @@
1
- export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/createGetGlobalContextClient.js';
1
+ export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/getGlobalContextClientInternalShared.js';
@@ -1,4 +1,4 @@
1
1
  import { isBrowser } from '../utils/isBrowser.js';
2
2
  import { assert } from '../utils/assert.js';
3
3
  assert(isBrowser());
4
- export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/createGetGlobalContextClient.js';
4
+ export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/getGlobalContextClientInternalShared.js';
@@ -58,7 +58,7 @@ declare function createPageContextClientSide(urlOriginal: string): Promise<{
58
58
  } & {
59
59
  _pageRoutes: import("../../__internal/index.js").PageRoutes;
60
60
  _onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
61
- } & Record<string, any>;
61
+ };
62
62
  _pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
63
63
  _urlHandler: null;
64
64
  _urlRewrite: null | string;
@@ -2,7 +2,7 @@ export { createPageContextClientSide };
2
2
  import { createPageContextObject, createPageContextShared } from '../../shared/createPageContextShared.js';
3
3
  import { getPageContextUrlComputed } from '../../shared/getPageContextUrlComputed.js';
4
4
  import { getBaseServer } from './getBaseServer.js';
5
- import { getGlobalContextClientInternal } from './globalContext.js';
5
+ import { getGlobalContextClientInternal } from './getGlobalContextClientInternal.js';
6
6
  import { assert, updateType, isBaseServer, objectAssign } from './utils.js';
7
7
  async function createPageContextClientSide(urlOriginal) {
8
8
  const globalContext = await getGlobalContextClientInternal();
@@ -3,9 +3,11 @@ assertClientRouting();
3
3
  import { initClientRouter } from './initClientRouter.js';
4
4
  import { assertSingleInstance_onClientEntryClientRouting } from './utils.js';
5
5
  import { removeFoucBuster } from '../shared/removeFoucBuster.js';
6
- // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
7
- const isProd = import.meta.env.PROD;
8
- assertSingleInstance_onClientEntryClientRouting(isProd);
6
+ import { setVirtualFileExportsGlobalEntry } from '../shared/getGlobalContextClientInternalShared.js';
7
+ // @ts-expect-error
8
+ import * as virtualFileExportsGlobalEntry from 'virtual:vike:global-entry:client:client-routing';
9
+ assertSingleInstance_onClientEntryClientRouting(import.meta.env.PROD);
10
+ setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry);
9
11
  initClientRouter();
10
12
  if (import.meta.env.DEV)
11
13
  removeFoucBuster();
@@ -1,7 +1,6 @@
1
1
  export { getBaseServer };
2
2
  import { assert } from '../runtime-server-routing/utils.js';
3
3
  function getBaseServer() {
4
- // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
5
4
  const baseServer = import.meta.env.BASE_SERVER;
6
5
  assert(isBaseServer(baseServer));
7
6
  return baseServer;
@@ -4,7 +4,7 @@ export type { GlobalContextClientInternal };
4
4
  import type { GlobalContextBasePublic } from '../../shared/createGlobalContextShared.js';
5
5
  type GlobalContextClient = GlobalContextBasePublic & Pick<GlobalContextClientInternal, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
6
6
  type GlobalContextClientInternal = Awaited<ReturnType<typeof getGlobalContextClientInternal>>;
7
- declare const getGlobalContextClientInternal: () => Promise<{
7
+ declare function getGlobalContextClientInternal(): Promise<{
8
8
  _globalConfigPublic: {
9
9
  pages: {
10
10
  [k: string]: {
@@ -55,4 +55,4 @@ declare const getGlobalContextClientInternal: () => Promise<{
55
55
  } & {
56
56
  _pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
57
57
  _onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
58
- } & Record<string, any>>;
58
+ }>;
@@ -1,9 +1,13 @@
1
1
  export { getGlobalContextClientInternal };
2
- import { createGetGlobalContextClient } from '../shared/createGetGlobalContextClient.js';
2
+ import { getGlobalContextClientInternalShared } from '../shared/getGlobalContextClientInternalShared.js';
3
3
  import { loadPageRoutes } from '../../shared/route/loadPageRoutes.js';
4
- // @ts-ignore
5
- import * as virtualFileExportsGlobalEntry from 'virtual:vike:global-entry:client:client-routing';
6
- const getGlobalContextClientInternal = createGetGlobalContextClient(virtualFileExportsGlobalEntry, true, addGlobalContext);
4
+ import { objectAssign } from './utils.js';
5
+ async function getGlobalContextClientInternal() {
6
+ const globalContext = await getGlobalContextClientInternalShared();
7
+ objectAssign(globalContext, await addGlobalContext(globalContext));
8
+ return globalContext;
9
+ }
10
+ // TO-DO/next-major-release make this function sync
7
11
  async function addGlobalContext(globalContext) {
8
12
  const { pageRoutes, onBeforeRouteHook } = await loadPageRoutes(globalContext._pageFilesAll, globalContext._pageConfigs, globalContext._pageConfigGlobal, globalContext._allPageIds);
9
13
  return {
@@ -78,7 +78,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
78
78
  } & {
79
79
  _pageRoutes: import("../../__internal/index.js").PageRoutes;
80
80
  _onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
81
- } & Record<string, any>;
81
+ };
82
82
  _pageFilesAll: PageFile[];
83
83
  _urlHandler: null;
84
84
  _urlRewrite: null | string;
@@ -145,7 +145,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
145
145
  isHydration: boolean;
146
146
  isBackwardNavigation: boolean | null;
147
147
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
148
- globalContext: import("./globalContext.js").GlobalContextClient;
148
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
149
149
  } & {
150
150
  urlOriginal: string;
151
151
  } & {
@@ -210,7 +210,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
210
210
  isHydration: boolean;
211
211
  isBackwardNavigation: boolean | null;
212
212
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
213
- globalContext: import("./globalContext.js").GlobalContextClient;
213
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
214
214
  } & {
215
215
  urlOriginal: string;
216
216
  } & {
@@ -299,7 +299,7 @@ declare function getPageContextFromClientHooks(pageContext: {
299
299
  } & {
300
300
  _pageRoutes: import("../../__internal/index.js").PageRoutes;
301
301
  _onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
302
- } & Record<string, any>;
302
+ };
303
303
  _pageFilesAll: PageFile[];
304
304
  _urlHandler: null;
305
305
  _urlRewrite: null | string;
@@ -366,7 +366,7 @@ declare function getPageContextFromClientHooks(pageContext: {
366
366
  isHydration: boolean;
367
367
  isBackwardNavigation: boolean | null;
368
368
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
369
- globalContext: import("./globalContext.js").GlobalContextClient;
369
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
370
370
  } & {
371
371
  urlOriginal: string;
372
372
  } & {
@@ -429,7 +429,7 @@ declare function getPageContextFromClientHooks(pageContext: {
429
429
  isHydration: boolean;
430
430
  isBackwardNavigation: boolean | null;
431
431
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
432
- globalContext: import("./globalContext.js").GlobalContextClient;
432
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
433
433
  } & {
434
434
  urlOriginal: string;
435
435
  } & {
@@ -1,5 +1,5 @@
1
1
  export { isClientSideRoutable };
2
- import type { GlobalContextClientInternal } from './globalContext.js';
2
+ import type { GlobalContextClientInternal } from './getGlobalContextClientInternal.js';
3
3
  import type { PageFile } from '../../shared/getPageFiles.js';
4
4
  declare function isClientSideRoutable(pageId: string, pageContext: {
5
5
  _globalContext: GlobalContextClientInternal;
@@ -7,7 +7,7 @@ export type { PageContextBegin };
7
7
  import { type PageContextFromRewrite } from '../../shared/route/abort.js';
8
8
  import { type ScrollTarget } from './setScrollPosition.js';
9
9
  import type { PageContextConfig } from '../../shared/getPageFiles.js';
10
- import type { PageContextClient } from '../../types/PageContext.js';
10
+ import type { PageContextClient, PageContextInternalClient } from '../../types/PageContext.js';
11
11
  import type { VikeGlobalInternal } from '../../types/VikeGlobalInternal.js';
12
12
  declare const firstRenderStartPromise: Promise<void>;
13
13
  type PageContextRouted = {
@@ -92,7 +92,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
92
92
  } & {
93
93
  _pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
94
94
  _onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
95
- } & Record<string, any>;
95
+ };
96
96
  _pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
97
97
  _urlHandler: null;
98
98
  _urlRewrite: null | string;
@@ -107,7 +107,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
107
107
  isHydration: boolean;
108
108
  previousPageContext: ({
109
109
  pageId: string;
110
- } & PageContextConfig & PageContextRouted & import("../../shared/preparePageContextForPublicUsage.js").PageContextPrepareMinimum & import("../../types/PageContext.js").PageContextInternalClient & Omit<Partial<PageContextConfig & {
110
+ } & PageContextConfig & PageContextRouted & import("../../shared/preparePageContextForPublicUsage.js").PageContextPrepareMinimum & PageContextInternalClient & Omit<Partial<PageContextConfig & {
111
111
  isPageContext: true;
112
112
  Page: import("../../types/Config.js").Config["Page"];
113
113
  routeParams: Record<string, string>;
@@ -156,7 +156,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
156
156
  isHydration: boolean;
157
157
  isBackwardNavigation: boolean | null;
158
158
  previousPageContext: PageContextClient<unknown> | null;
159
- globalContext: import("./globalContext.js").GlobalContextClient;
159
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
160
160
  } & {
161
161
  urlOriginal: string;
162
162
  } & {
@@ -16,7 +16,7 @@ import { route } from '../../shared/route/index.js';
16
16
  import { isClientSideRoutable } from './isClientSideRoutable.js';
17
17
  import { setScrollPosition } from './setScrollPosition.js';
18
18
  import { scrollRestoration_initialRenderIsDone } from './scrollRestoration.js';
19
- import { getErrorPageId } from '../../shared/error-page.js';
19
+ import { getErrorPageId, isErrorPage } from '../../shared/error-page.js';
20
20
  import { setPageContextCurrent } from './getPageContextCurrent.js';
21
21
  import { getRouteStringParameterList } from '../../shared/route/resolveRouteString.js';
22
22
  import { getCurrentUrl } from '../shared/getCurrentUrl.js';
@@ -511,11 +511,9 @@ function disableClientRouting(err, log) {
511
511
  // We don't use console.error() to avoid flooding error trackers such as Sentry
512
512
  console.log(err);
513
513
  }
514
- // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
515
- const isProd = import.meta.env.PROD;
516
514
  assertInfo(false, [
517
515
  'Failed to fetch static asset.',
518
- isProd ? 'This usually happens when a new frontend is deployed.' : null,
516
+ import.meta.env.PROD ? 'This usually happens when a new frontend is deployed.' : null,
519
517
  'Falling back to Server Routing.',
520
518
  '(The next page navigation will use Server Routing instead of Client Routing.)',
521
519
  ]
@@ -644,3 +642,16 @@ function handleErrorFetchingStaticAssets(err, pageContext, isFirstRender) {
644
642
  redirectHard(pageContext.urlOriginal);
645
643
  return true;
646
644
  }
645
+ // [HMR] If error page is shown => re-render whole page
646
+ if (import.meta.env.DEV && import.meta.hot)
647
+ import.meta.hot.on('vite:afterUpdate', () => {
648
+ const pageContext = globalObject.renderedPageContext;
649
+ if (pageContext?.pageId && isErrorPage(pageContext.pageId, pageContext._globalContext._pageConfigs)) {
650
+ renderPageClientSide({
651
+ scrollTarget: { preserveScroll: false },
652
+ urlOriginal: getCurrentUrl(),
653
+ overwriteLastHistoryEntry: true,
654
+ isBackwardNavigation: false,
655
+ });
656
+ }
657
+ });
@@ -54,7 +54,7 @@ declare function createPageContextClientSide(): Promise<{
54
54
  _allPageIds: string[];
55
55
  } & {
56
56
  isClientSide: true;
57
- } & object & Record<string, any>;
57
+ };
58
58
  _pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
59
59
  isBackwardNavigation: null;
60
60
  _hasPageContextFromServer: true;
@@ -4,7 +4,7 @@ import { getPageContextSerializedInHtml } from '../shared/getJsonSerializedInHtm
4
4
  import { loadPageConfigsLazyClientSide, } from '../shared/loadPageConfigsLazyClientSide.js';
5
5
  import { getCurrentUrl } from '../shared/getCurrentUrl.js';
6
6
  import { createPageContextObject, createPageContextShared } from '../../shared/createPageContextShared.js';
7
- import { getGlobalContextClientInternal } from './globalContext.js';
7
+ import { getGlobalContextClientInternal } from './getGlobalContextClientInternal.js';
8
8
  import { preparePageContextForPublicUsageClient, } from './preparePageContextForPublicUsageClient.js';
9
9
  import { execHook } from '../../shared/hooks/execHook.js';
10
10
  const urlFirst = getCurrentUrl({ withoutHash: true });
@@ -6,9 +6,11 @@ import { assertSingleInstance_onClientEntryServerRouting } from './utils.js';
6
6
  import { removeFoucBuster } from '../shared/removeFoucBuster.js';
7
7
  import { execHook } from '../../shared/hooks/execHook.js';
8
8
  import { preparePageContextForPublicUsageClient } from './preparePageContextForPublicUsageClient.js';
9
- // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
10
- const isProd = import.meta.env.PROD;
11
- assertSingleInstance_onClientEntryServerRouting(isProd);
9
+ import { setVirtualFileExportsGlobalEntry } from '../shared/getGlobalContextClientInternalShared.js';
10
+ // @ts-expect-error
11
+ import * as virtualFileExportsGlobalEntry from 'virtual:vike:global-entry:client:server-routing';
12
+ assertSingleInstance_onClientEntryServerRouting(import.meta.env.PROD);
13
+ setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry);
12
14
  if (import.meta.env.DEV)
13
15
  removeFoucBuster();
14
16
  hydrate();
@@ -4,7 +4,7 @@ export type { GlobalContextClientInternalWithServerRouting };
4
4
  import type { GlobalContextBasePublic } from '../../shared/createGlobalContextShared.js';
5
5
  type GlobalContextClientWithServerRouting = GlobalContextBasePublic & Pick<GlobalContextClientInternalWithServerRouting, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
6
6
  type GlobalContextClientInternalWithServerRouting = Awaited<ReturnType<typeof getGlobalContextClientInternal>>;
7
- declare const getGlobalContextClientInternal: () => Promise<{
7
+ declare function getGlobalContextClientInternal(): Promise<{
8
8
  _globalConfigPublic: {
9
9
  pages: {
10
10
  [k: string]: {
@@ -52,4 +52,4 @@ declare const getGlobalContextClientInternal: () => Promise<{
52
52
  _allPageIds: string[];
53
53
  } & {
54
54
  isClientSide: true;
55
- } & object & Record<string, any>>;
55
+ }>;
@@ -0,0 +1,6 @@
1
+ export { getGlobalContextClientInternal };
2
+ import { getGlobalContextClientInternalShared } from '../shared/getGlobalContextClientInternalShared.js';
3
+ async function getGlobalContextClientInternal() {
4
+ const globalContext = await getGlobalContextClientInternalShared();
5
+ return globalContext;
6
+ }
@@ -2,7 +2,7 @@ export { execHookOnRenderClient };
2
2
  export type { PageContextBeforeRenderClient };
3
3
  import type { PageFile, PageContextConfig } from '../../shared/getPageFiles.js';
4
4
  import type { PageContextForPublicUsageClientShared } from './preparePageContextForPublicUsageClientShared.js';
5
- import type { GlobalContextClientInternalShared } from './createGetGlobalContextClient.js';
5
+ import type { GlobalContextClientInternalShared } from './getGlobalContextClientInternalShared.js';
6
6
  type PageContextBeforeRenderClient = {
7
7
  _pageFilesLoaded: PageFile[];
8
8
  urlOriginal?: string;
@@ -1,11 +1,11 @@
1
1
  export { getGlobalContext };
2
2
  export { getGlobalContextSync };
3
- export { createGetGlobalContextClient };
3
+ export { setVirtualFileExportsGlobalEntry };
4
+ export { getGlobalContextClientInternalShared };
4
5
  export type GlobalContextClientInternalShared = GlobalContextClientInternal | GlobalContextClientInternalWithServerRouting;
5
- import { type GlobalContextBase } from '../../shared/createGlobalContextShared.js';
6
- import type { GlobalContextClientInternal } from '../runtime-client-routing/globalContext.js';
7
- import type { GlobalContextClientInternalWithServerRouting } from '../runtime-server-routing/globalContext.js';
8
- declare function createGetGlobalContextClient<GlobalContextAddendum extends object>(virtualFileExportsGlobalEntry: unknown, isClientRouting: boolean, addGlobalContext?: (globalContext: GlobalContextBase) => Promise<GlobalContextAddendum>): () => Promise<{
6
+ import type { GlobalContextClientInternal } from '../runtime-client-routing/getGlobalContextClientInternal.js';
7
+ import type { GlobalContextClientInternalWithServerRouting } from '../runtime-server-routing/getGlobalContextClientInternal.js';
8
+ declare function getGlobalContextClientInternalShared(): Promise<{
9
9
  _globalConfigPublic: {
10
10
  pages: {
11
11
  [k: string]: {
@@ -53,12 +53,15 @@ declare function createGetGlobalContextClient<GlobalContextAddendum extends obje
53
53
  _allPageIds: string[];
54
54
  } & {
55
55
  /**
56
- * Whether the environment is client-side or server-side / pre-rendering.
56
+ * Whether the environment is the client-side:
57
+ * - In the browser, the value is `true`.
58
+ * - Upon SSR and pre-rendering, the value is `false`.
57
59
  *
58
- * We recommend using `import.meta.env.SSR` instead, see https://vike.dev/globalContext
60
+ * https://vike.dev/globalContext#isClientSide
59
61
  */
60
62
  isClientSide: true;
61
- } & Awaited<GlobalContextAddendum> & Record<string, any>>;
63
+ }>;
62
64
  type NeverExported = never;
63
65
  declare function getGlobalContext(): Promise<NeverExported>;
64
66
  declare function getGlobalContextSync(): NeverExported;
67
+ declare function setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry: unknown): Promise<void>;
@@ -0,0 +1,66 @@
1
+ // Public usage
2
+ export { getGlobalContext };
3
+ export { getGlobalContextSync };
4
+ export { setVirtualFileExportsGlobalEntry };
5
+ // Internal usage
6
+ export { getGlobalContextClientInternalShared };
7
+ import { createGlobalContextShared, getGlobalContextSyncErrMsg } from '../../shared/createGlobalContextShared.js';
8
+ import { getGlobalContextSerializedInHtml } from './getJsonSerializedInHtml.js';
9
+ import { assert, assertUsage, genPromise, getGlobalObject, objectAssign, checkType } from './utils.js';
10
+ const globalObject = getGlobalObject('getGlobalContextClientInternalShared.ts', (() => {
11
+ const { promise: globalContextInitialPromise, resolve: globalContextInitialPromiseResolve } = genPromise();
12
+ return {
13
+ globalContextInitialPromise,
14
+ globalContextInitialPromiseResolve,
15
+ };
16
+ })());
17
+ async function getGlobalContextClientInternalShared() {
18
+ // Get
19
+ if (globalObject.globalContextPromise) {
20
+ const globalContext = await globalObject.globalContextPromise;
21
+ return globalContext;
22
+ }
23
+ // Create
24
+ const globalContextPromise = createGlobalContextShared(globalObject.virtualFileExportsGlobalEntry, globalObject, () => {
25
+ const globalContextAddendum = {
26
+ /**
27
+ * Whether the environment is the client-side:
28
+ * - In the browser, the value is `true`.
29
+ * - Upon SSR and pre-rendering, the value is `false`.
30
+ *
31
+ * https://vike.dev/globalContext#isClientSide
32
+ */
33
+ isClientSide: true,
34
+ };
35
+ objectAssign(globalContextAddendum, getGlobalContextSerializedInHtml());
36
+ return globalContextAddendum;
37
+ });
38
+ globalObject.globalContextPromise = globalContextPromise;
39
+ const globalContext = await globalContextPromise;
40
+ assert(globalObject.globalContext === globalContext);
41
+ globalObject.globalContextInitialPromiseResolve();
42
+ // Return
43
+ return globalContext;
44
+ }
45
+ async function getGlobalContext() {
46
+ await globalObject.globalContextInitialPromise;
47
+ const globalContext = await globalObject.globalContextPromise;
48
+ assert(globalContext);
49
+ checkType(globalContext);
50
+ return globalContext;
51
+ }
52
+ function getGlobalContextSync() {
53
+ const { globalContext } = globalObject;
54
+ assertUsage(globalContext, getGlobalContextSyncErrMsg);
55
+ checkType(globalContext);
56
+ return globalContext;
57
+ }
58
+ async function setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry) {
59
+ // HMR => virtualFileExportsGlobalEntry differ
60
+ if (globalObject.virtualFileExportsGlobalEntry !== virtualFileExportsGlobalEntry) {
61
+ delete globalObject.globalContextPromise;
62
+ globalObject.virtualFileExportsGlobalEntry = virtualFileExportsGlobalEntry;
63
+ // Eagerly call +onCreateGlobalContext() hooks
64
+ await getGlobalContextClientInternalShared();
65
+ }
66
+ }
@@ -10,13 +10,11 @@ async function loadPageConfigsLazyClientSide(pageId, pageFilesAll, pageConfigs,
10
10
  const pageFilesClientSide = getPageFilesClientSide(pageFilesAll, pageId);
11
11
  const pageConfig = findPageConfig(pageConfigs, pageId);
12
12
  let pageConfigLoaded;
13
- // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
14
- const isDev = import.meta.env.DEV;
15
13
  try {
16
14
  // prettier-ignore
17
15
  // biome-ignore format:
18
16
  const result = await Promise.all([
19
- pageConfig && loadAndParseVirtualFilePageEntry(pageConfig, isDev),
17
+ pageConfig && loadAndParseVirtualFilePageEntry(pageConfig, import.meta.env.DEV),
20
18
  ...pageFilesClientSide.map((p) => p.loadFile?.()),
21
19
  ]);
22
20
  pageConfigLoaded = result[0];
@@ -74,7 +74,7 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
74
74
  url?: string;
75
75
  headers?: Record<string, string>;
76
76
  } & {
77
- _globalContext: {
77
+ _globalContext: ({
78
78
  _globalConfigPublic: {
79
79
  pages: {
80
80
  [k: string]: {
@@ -162,7 +162,9 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
162
162
  inject: boolean | undefined;
163
163
  };
164
164
  };
165
- });
165
+ })) & {
166
+ prerenderContext: PrerenderContextPublic | undefined;
167
+ };
166
168
  _pageFilesAll: PageFile[];
167
169
  _baseServer: string;
168
170
  _baseAssets: string;
@@ -9,7 +9,7 @@ import { prerenderPage } from '../runtime/renderPage/renderPageAfterRoute.js';
9
9
  import { createPageContextServerSide } from '../runtime/renderPage/createPageContextServerSide.js';
10
10
  import pc from '@brillout/picocolors';
11
11
  import { cpus } from 'node:os';
12
- import { getGlobalContextServerInternal, initGlobalContext_runPrerender, setGlobalContext_isPrerendering, } from '../runtime/globalContext.js';
12
+ import { getGlobalContextServerInternal, initGlobalContext_runPrerender, setGlobalContext_isPrerendering, setGlobalContext_prerenderContext, } from '../runtime/globalContext.js';
13
13
  import { resolveConfig as resolveViteConfig } from 'vite';
14
14
  import { getPageFilesServerSide } from '../../shared/getPageFiles.js';
15
15
  import { getPageContextRequestUrl } from '../../shared/getPageContextRequestUrl.js';
@@ -108,6 +108,7 @@ async function runPrerender(options = {}, trigger) {
108
108
  await warnMissingPages(prerenderContext._prerenderedPageContexts, globalContext, doNotPrerenderList, partial);
109
109
  const prerenderContextPublic = preparePrerenderContextForPublicUsage(prerenderContext);
110
110
  objectAssign(vikeConfig.prerenderContext, prerenderContextPublic, true);
111
+ setGlobalContext_prerenderContext(prerenderContextPublic);
111
112
  if (prerenderConfigGlobal.isPrerenderingEnabledForAllPages && !prerenderConfigGlobal.keepDistServer) {
112
113
  fs.rmSync(outDirServer, { recursive: true });
113
114
  }
@@ -714,12 +715,14 @@ async function prerenderRedirects(globalContext, onComplete, showWarningUponDyna
714
715
  }
715
716
  function getRedirectHtml(urlTarget) {
716
717
  const urlTargetSafe = escapeHtml(urlTarget);
717
- // To test it: /test/playground => http://localhost:3000/download
718
+ // - Test: /test/playground => http://localhost:3000/download
719
+ // - Adding `<link rel="canonical">` for SEO, see https://github.com/vikejs/vike/pull/2711
718
720
  const htmlString = `<!DOCTYPE html>
719
721
  <html lang="en">
720
722
  <head>
721
723
  <meta charset="UTF-8">
722
724
  <meta http-equiv="refresh" content="0;url=${urlTargetSafe}">
725
+ <link rel="canonical" href="${urlTargetSafe}" />
723
726
  <title>Redirect ${urlTargetSafe}</title>
724
727
  <style>body{opacity:0}</style>
725
728
  <noscript>
@@ -10,11 +10,13 @@ export { initGlobalContext_getPagesAndRoutes };
10
10
  export { setGlobalContext_viteDevServer };
11
11
  export { setGlobalContext_viteConfig };
12
12
  export { setGlobalContext_isPrerendering };
13
+ export { setGlobalContext_prerenderContext };
13
14
  export { setGlobalContext_isProductionAccordingToVite };
14
15
  export { setGlobalContext_prodBuildEntry };
15
16
  export { clearGlobalContext };
16
17
  export { assertBuildInfo };
17
18
  export { updateUserFiles };
19
+ export { isRunnable };
18
20
  export { vikeConfigErrorRecoverMsg };
19
21
  export type { BuildInfo };
20
22
  export type { GlobalContextServerInternal as GlobalContextServerInternal };
@@ -25,6 +27,7 @@ import { type PageRoutes } from '../../shared/route/loadPageRoutes.js';
25
27
  import type { ViteConfigRuntime } from '../vite/shared/getViteConfigRuntime.js';
26
28
  import type { GlobalContext } from '../../types/PageContext.js';
27
29
  import type { Hook } from '../../shared/hooks/getHook.js';
30
+ import type { PrerenderContext } from '../../types/index.js';
28
31
  declare const vikeConfigErrorRecoverMsg: "Vike config loaded";
29
32
  type GlobalContextServer = Pick<GlobalContextServerInternal, 'assetsManifest' | 'config' | 'viteConfig' | 'viteConfigRuntime' | 'pages' | 'baseServer' | 'baseAssets' | 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextServer;
30
33
  type GlobalContextServerInternal = Awaited<ReturnType<typeof createGlobalContext>>;
@@ -97,6 +100,8 @@ declare function getGlobalContextServerInternal(): Promise<{
97
100
  inject: boolean | undefined;
98
101
  };
99
102
  };
103
+ } & {
104
+ prerenderContext: PrerenderContext | undefined;
100
105
  }) | (Record<string, unknown> & {
101
106
  _globalConfigPublic: {
102
107
  pages: {
@@ -166,6 +171,8 @@ declare function getGlobalContextServerInternal(): Promise<{
166
171
  inject: boolean | undefined;
167
172
  };
168
173
  };
174
+ } & {
175
+ prerenderContext: PrerenderContext | undefined;
169
176
  }) | (Record<string, unknown> & {
170
177
  _globalConfigPublic: {
171
178
  pages: {
@@ -235,6 +242,8 @@ declare function getGlobalContextServerInternal(): Promise<{
235
242
  inject: boolean | undefined;
236
243
  };
237
244
  };
245
+ } & {
246
+ prerenderContext: PrerenderContext | undefined;
238
247
  });
239
248
  }>;
240
249
  /**
@@ -258,6 +267,7 @@ declare function getGlobalContextSync(): GlobalContext;
258
267
  declare function setGlobalContext_viteDevServer(viteDevServer: ViteDevServer): Promise<void>;
259
268
  declare function setGlobalContext_viteConfig(viteConfig: ResolvedConfig, viteConfigRuntime: ViteConfigRuntime): void;
260
269
  declare function setGlobalContext_isPrerendering(): void;
270
+ declare function setGlobalContext_prerenderContext(prerenderContextPublic: PrerenderContext): void;
261
271
  declare function setGlobalContext_isProductionAccordingToVite(isProductionAccordingToVite: boolean): void;
262
272
  declare function getViteDevServer(): ViteDevServer | null;
263
273
  declare function getViteConfig(): ResolvedConfig | null;
@@ -274,7 +284,7 @@ declare function assertBuildInfo(buildInfo: unknown): asserts buildInfo is Build
274
284
  declare function updateUserFiles(): Promise<{
275
285
  success: boolean;
276
286
  }>;
277
- declare function createGlobalContext(virtualFileExportsGlobalEntry: unknown): Promise<{
287
+ declare function createGlobalContext(virtualFileExportsGlobalEntry: unknown): Promise<({
278
288
  _globalConfigPublic: {
279
289
  pages: {
280
290
  [k: string]: {
@@ -362,5 +372,8 @@ declare function createGlobalContext(virtualFileExportsGlobalEntry: unknown): Pr
362
372
  inject: boolean | undefined;
363
373
  };
364
374
  };
365
- })>;
375
+ })) & {
376
+ prerenderContext: PrerenderContext | undefined;
377
+ }>;
366
378
  declare function clearGlobalContext(): void;
379
+ declare function isRunnable(viteDevServer: ViteDevServer): boolean;