vike 0.4.239-commit-59f1017 → 0.4.239-commit-9dcde6d

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 (429) 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.js +1 -1
  4. package/dist/esm/client/runtime-client-routing/entry.js +5 -3
  5. package/dist/esm/client/runtime-client-routing/getBaseServer.js +0 -1
  6. package/dist/esm/client/runtime-client-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +1 -1
  7. package/dist/esm/client/runtime-client-routing/{globalContext.js → getGlobalContextClientInternal.js} +8 -4
  8. package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +4 -4
  9. package/dist/esm/client/runtime-client-routing/isClientSideRoutable.d.ts +1 -1
  10. package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +1 -1
  11. package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +2 -4
  12. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
  13. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
  14. package/dist/esm/client/runtime-server-routing/entry.js +5 -3
  15. package/dist/esm/client/runtime-server-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
  16. package/dist/esm/client/runtime-server-routing/getGlobalContextClientInternal.js +6 -0
  17. package/dist/esm/client/shared/execHookOnRenderClient.d.ts +1 -1
  18. package/dist/esm/client/shared/{createGetGlobalContextClient.d.ts → getGlobalContextClientInternalShared.d.ts} +11 -8
  19. package/dist/esm/client/shared/getGlobalContextClientInternalShared.js +66 -0
  20. package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +1 -3
  21. package/dist/esm/node/prerender/runPrerender.js +3 -1
  22. package/dist/esm/node/vite/index.js +34 -15
  23. package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
  24. package/dist/esm/node/vite/plugins/pluginBaseUrls.js +37 -35
  25. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.d.ts +1 -1
  26. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +82 -80
  27. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.d.ts +1 -1
  28. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +23 -21
  29. package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.d.ts +1 -1
  30. package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +38 -36
  31. package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.d.ts +1 -1
  32. package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +26 -24
  33. package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
  34. package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +1 -1
  35. package/dist/esm/node/vite/plugins/pluginEnvVars.js +87 -65
  36. package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
  37. package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +29 -27
  38. package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
  39. package/dist/esm/node/vite/plugins/pluginFileEnv.js +75 -73
  40. package/dist/esm/node/vite/plugins/pluginNonRunnableDev.d.ts +1 -1
  41. package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +30 -28
  42. package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
  43. package/dist/esm/node/vite/plugins/pluginPreview.js +35 -33
  44. package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.d.ts +9 -0
  45. package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.js +45 -0
  46. package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.d.ts +3 -0
  47. package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.js +89 -0
  48. package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
  49. package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +50 -48
  50. package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
  51. package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +12 -10
  52. package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
  53. package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
  54. package/dist/esm/shared/createGlobalContextShared.d.ts +1 -1
  55. package/dist/esm/shared/route/abort.d.ts +22 -11
  56. package/dist/esm/shared/route/abort.js +37 -5
  57. package/dist/esm/types/PageContext.d.ts +8 -8
  58. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  59. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  60. package/dist/esm/utils/findPackageJson.js +0 -1
  61. package/dist/esm/utils/getViteRPC.js +0 -2
  62. package/dist/esm/utils/requireResolve.js +0 -1
  63. package/package.json +2 -21
  64. package/dist/cjs/__internal/index.js +0 -35
  65. package/dist/cjs/client/runtime-client-routing/globalContext.js +0 -49
  66. package/dist/cjs/client/runtime-client-routing/prefetch/PrefetchSetting.js +0 -2
  67. package/dist/cjs/client/runtime-server-routing/globalContext.js +0 -41
  68. package/dist/cjs/client/runtime-server-routing/onLoad.js +0 -7
  69. package/dist/cjs/client/runtime-server-routing/utils.js +0 -34
  70. package/dist/cjs/client/shared/createGetGlobalContextClient.js +0 -65
  71. package/dist/cjs/client/shared/getJsonSerializedInHtml.js +0 -40
  72. package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +0 -41
  73. package/dist/cjs/client/shared/utils.js +0 -23
  74. package/dist/cjs/node/api/build.js +0 -24
  75. package/dist/cjs/node/api/context.js +0 -23
  76. package/dist/cjs/node/api/dev.js +0 -18
  77. package/dist/cjs/node/api/index.js +0 -44
  78. package/dist/cjs/node/api/onLoad.js +0 -9
  79. package/dist/cjs/node/api/prepareViteApiCall.js +0 -206
  80. package/dist/cjs/node/api/prerender.js +0 -18
  81. package/dist/cjs/node/api/preview.js +0 -38
  82. package/dist/cjs/node/api/types.js +0 -2
  83. package/dist/cjs/node/api/utils.js +0 -27
  84. package/dist/cjs/node/cli/context.js +0 -17
  85. package/dist/cjs/node/cli/entry.js +0 -121
  86. package/dist/cjs/node/cli/index.js +0 -12
  87. package/dist/cjs/node/cli/onLoad.js +0 -9
  88. package/dist/cjs/node/cli/parseCli.js +0 -95
  89. package/dist/cjs/node/cli/utils.js +0 -24
  90. package/dist/cjs/node/client/router.js +0 -19
  91. package/dist/cjs/node/createPageRenderer.js +0 -132
  92. package/dist/cjs/node/importBuild.js +0 -3
  93. package/dist/cjs/node/prerender/context.js +0 -26
  94. package/dist/cjs/node/prerender/index.js +0 -12
  95. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +0 -66
  96. package/dist/cjs/node/prerender/runPrerender.js +0 -778
  97. package/dist/cjs/node/prerender/runPrerenderEntry.js +0 -55
  98. package/dist/cjs/node/prerender/utils.js +0 -37
  99. package/dist/cjs/node/runtime/globalContext.js +0 -582
  100. package/dist/cjs/node/runtime/index-deprecated.js +0 -33
  101. package/dist/cjs/node/runtime/index.js +0 -74
  102. package/dist/cjs/node/runtime/loggerRuntime.js +0 -17
  103. package/dist/cjs/node/runtime/onLoad.js +0 -29
  104. package/dist/cjs/node/runtime/page-files/setup.js +0 -5
  105. package/dist/cjs/node/runtime/renderPage/analyzePage.js +0 -71
  106. package/dist/cjs/node/runtime/renderPage/assertArguments.js +0 -42
  107. package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +0 -51
  108. package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -114
  109. package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +0 -59
  110. package/dist/cjs/node/runtime/renderPage/csp.js +0 -47
  111. package/dist/cjs/node/runtime/renderPage/execHookDataAndOnBeforeRender.js +0 -31
  112. package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +0 -120
  113. package/dist/cjs/node/runtime/renderPage/execHookServer.js +0 -8
  114. package/dist/cjs/node/runtime/renderPage/getCacheControl.js +0 -24
  115. package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +0 -20
  116. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +0 -137
  117. package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +0 -125
  118. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsDev.js +0 -86
  119. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsProd.js +0 -77
  120. package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +0 -36
  121. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +0 -50
  122. package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +0 -41
  123. package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +0 -68
  124. package/dist/cjs/node/runtime/renderPage/headersResponse.js +0 -48
  125. package/dist/cjs/node/runtime/renderPage/html/injectAssets/getHtmlTags.js +0 -269
  126. package/dist/cjs/node/runtime/renderPage/html/injectAssets/getViteDevScript.js +0 -32
  127. package/dist/cjs/node/runtime/renderPage/html/injectAssets/inferHtmlTags.js +0 -55
  128. package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectAssets__public.js +0 -31
  129. package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectHtmlTags.js +0 -161
  130. package/dist/cjs/node/runtime/renderPage/html/injectAssets/mergeScriptTags.js +0 -73
  131. package/dist/cjs/node/runtime/renderPage/html/injectAssets/sanitizeJson.js +0 -8
  132. package/dist/cjs/node/runtime/renderPage/html/injectAssets.js +0 -93
  133. package/dist/cjs/node/runtime/renderPage/html/propKeys.js +0 -47
  134. package/dist/cjs/node/runtime/renderPage/html/renderHtml.js +0 -245
  135. package/dist/cjs/node/runtime/renderPage/html/serializeContext.js +0 -189
  136. package/dist/cjs/node/runtime/renderPage/html/stream/react-streaming.js +0 -36
  137. package/dist/cjs/node/runtime/renderPage/html/stream.js +0 -829
  138. package/dist/cjs/node/runtime/renderPage/inferMediaType.js +0 -81
  139. package/dist/cjs/node/runtime/renderPage/isFontFallback.js +0 -29
  140. package/dist/cjs/node/runtime/renderPage/isNewError.js +0 -25
  141. package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +0 -124
  142. package/dist/cjs/node/runtime/renderPage/log404/index.js +0 -154
  143. package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +0 -20
  144. package/dist/cjs/node/runtime/renderPage/logErrorHint.js +0 -200
  145. package/dist/cjs/node/runtime/renderPage/loggerProd.js +0 -34
  146. package/dist/cjs/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +0 -10
  147. package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +0 -83
  148. package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +0 -71
  149. package/dist/cjs/node/runtime/renderPage.js +0 -502
  150. package/dist/cjs/node/runtime/universal-middleware.js +0 -20
  151. package/dist/cjs/node/runtime/utils.js +0 -83
  152. package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -27
  153. package/dist/cjs/node/runtime-dev/index.js +0 -42
  154. package/dist/cjs/node/shared/assertV1Design.js +0 -30
  155. package/dist/cjs/node/shared/extractAssetsQuery.js +0 -29
  156. package/dist/cjs/node/shared/getVikeConfigError.js +0 -22
  157. package/dist/cjs/node/shared/isErrorDebug.js +0 -7
  158. package/dist/cjs/node/shared/prependEntriesDir.js +0 -13
  159. package/dist/cjs/node/shared/resolveBase.js +0 -35
  160. package/dist/cjs/node/shared/utils.js +0 -35
  161. package/dist/cjs/node/shared/virtualFileId.js +0 -110
  162. package/dist/cjs/node/vite/index.js +0 -69
  163. package/dist/cjs/node/vite/onLoad.js +0 -21
  164. package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +0 -52
  165. package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -357
  166. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -183
  167. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -234
  168. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -256
  169. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -40
  170. package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -49
  171. package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -111
  172. package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -65
  173. package/dist/cjs/node/vite/plugins/pluginBuild.js +0 -22
  174. package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +0 -88
  175. package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -183
  176. package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -28
  177. package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +0 -163
  178. package/dist/cjs/node/vite/plugins/pluginDev.js +0 -111
  179. package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -92
  180. package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -241
  181. package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -113
  182. package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -172
  183. package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -70
  184. package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -82
  185. package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -95
  186. package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -51
  187. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/debug.js +0 -5
  188. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +0 -56
  189. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +0 -190
  190. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +0 -54
  191. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +0 -97
  192. package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +0 -233
  193. package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -17
  194. package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +0 -35
  195. package/dist/cjs/node/vite/shared/addSsrMiddleware.js +0 -60
  196. package/dist/cjs/node/vite/shared/findPageFiles.js +0 -25
  197. package/dist/cjs/node/vite/shared/getAssetsDir.js +0 -10
  198. package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +0 -42
  199. package/dist/cjs/node/vite/shared/getEnvVarObject.js +0 -37
  200. package/dist/cjs/node/vite/shared/getFilePath.js +0 -172
  201. package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +0 -125
  202. package/dist/cjs/node/vite/shared/getMagicString.js +0 -18
  203. package/dist/cjs/node/vite/shared/getManifestFilePathRelative.js +0 -10
  204. package/dist/cjs/node/vite/shared/getOutDirs.js +0 -146
  205. package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +0 -21
  206. package/dist/cjs/node/vite/shared/isAsset.js +0 -40
  207. package/dist/cjs/node/vite/shared/isViteCliCall.js +0 -83
  208. package/dist/cjs/node/vite/shared/isViteServerSide.js +0 -68
  209. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +0 -15
  210. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +0 -15
  211. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +0 -38
  212. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +0 -26
  213. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +0 -85
  214. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +0 -30
  215. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +0 -19
  216. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +0 -19
  217. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +0 -29
  218. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +0 -13
  219. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +0 -15
  220. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +0 -162
  221. package/dist/cjs/node/vite/shared/loggerNotProd/log.js +0 -102
  222. package/dist/cjs/node/vite/shared/loggerNotProd.js +0 -208
  223. package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +0 -26
  224. package/dist/cjs/node/vite/shared/loggerVite.js +0 -54
  225. package/dist/cjs/node/vite/shared/normalizeId.js +0 -9
  226. package/dist/cjs/node/vite/shared/parseEsModule.js +0 -33
  227. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +0 -136
  228. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +0 -262
  229. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +0 -18
  230. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +0 -252
  231. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +0 -190
  232. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getConfigFileExport.js +0 -17
  233. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +0 -127
  234. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +0 -129
  235. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +0 -195
  236. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +0 -102
  237. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +0 -425
  238. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +0 -1151
  239. package/dist/cjs/node/vite/shared/rollupIsEsm.js +0 -15
  240. package/dist/cjs/node/vite/utils.js +0 -45
  241. package/dist/cjs/package.json +0 -1
  242. package/dist/cjs/shared/NOT_SERIALIZABLE.js +0 -4
  243. package/dist/cjs/shared/RenderErrorPage.js +0 -6
  244. package/dist/cjs/shared/abort.js +0 -16
  245. package/dist/cjs/shared/addIs404ToPageProps.js +0 -18
  246. package/dist/cjs/shared/assertHookReturnedObject.js +0 -21
  247. package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +0 -21
  248. package/dist/cjs/shared/assertPageContextProvidedByUser.js +0 -20
  249. package/dist/cjs/shared/createGlobalContextShared.js +0 -109
  250. package/dist/cjs/shared/createPageContextShared.js +0 -17
  251. package/dist/cjs/shared/determinePageIdOld.js +0 -11
  252. package/dist/cjs/shared/error-page.js +0 -40
  253. package/dist/cjs/shared/getPageContext.js +0 -6
  254. package/dist/cjs/shared/getPageContextRequestUrl.js +0 -16
  255. package/dist/cjs/shared/getPageContextUrlComputed.js +0 -132
  256. package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +0 -19
  257. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +0 -2
  258. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +0 -50
  259. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +0 -30
  260. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +0 -15
  261. package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +0 -59
  262. package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +0 -22
  263. package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +0 -24
  264. package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -52
  265. package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -102
  266. package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -56
  267. package/dist/cjs/shared/getPageFiles/parseVirtualFileExportsGlobalEntry.js +0 -100
  268. package/dist/cjs/shared/getPageFiles.js +0 -7
  269. package/dist/cjs/shared/getProxyForPublicUsage.js +0 -56
  270. package/dist/cjs/shared/hooks/execHook.js +0 -147
  271. package/dist/cjs/shared/hooks/getHook.js +0 -173
  272. package/dist/cjs/shared/htmlElementIds.js +0 -5
  273. package/dist/cjs/shared/misc/isServerSideError.js +0 -4
  274. package/dist/cjs/shared/misc/pageContextInitIsPassedToClient.js +0 -4
  275. package/dist/cjs/shared/modifyUrl.js +0 -28
  276. package/dist/cjs/shared/modifyUrlSameOrigin.js +0 -47
  277. package/dist/cjs/shared/page-configs/assertPlusFileExport.js +0 -42
  278. package/dist/cjs/shared/page-configs/findPageConfig.js +0 -10
  279. package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +0 -65
  280. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -68
  281. package/dist/cjs/shared/page-configs/getConfigValueRuntime.js +0 -10
  282. package/dist/cjs/shared/page-configs/getConfigValueTyped.js +0 -32
  283. package/dist/cjs/shared/page-configs/getExportPath.js +0 -29
  284. package/dist/cjs/shared/page-configs/helpers.js +0 -27
  285. package/dist/cjs/shared/page-configs/loadAndParseVirtualFilePageEntry.js +0 -25
  286. package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +0 -287
  287. package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +0 -2
  288. package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -1
  289. package/dist/cjs/shared/page-configs/serialize/parsePageConfigsSerialized.js +0 -145
  290. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +0 -290
  291. package/dist/cjs/shared/prepareGlobalContextForPublicUsage.js +0 -10
  292. package/dist/cjs/shared/preparePageContextForPublicUsage.js +0 -80
  293. package/dist/cjs/shared/route/abort.js +0 -178
  294. package/dist/cjs/shared/route/debug.js +0 -23
  295. package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +0 -52
  296. package/dist/cjs/shared/route/execHookGuard.js +0 -37
  297. package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -84
  298. package/dist/cjs/shared/route/index.js +0 -107
  299. package/dist/cjs/shared/route/loadPageRoutes.js +0 -197
  300. package/dist/cjs/shared/route/noRouteMatch.js +0 -4
  301. package/dist/cjs/shared/route/resolvePrecedence.js +0 -93
  302. package/dist/cjs/shared/route/resolveRoute.js +0 -20
  303. package/dist/cjs/shared/route/resolveRouteFunction.js +0 -73
  304. package/dist/cjs/shared/route/resolveRouteString.js +0 -153
  305. package/dist/cjs/shared/route/resolveUrlPathname.js +0 -47
  306. package/dist/cjs/shared/route/routing.js +0 -9
  307. package/dist/cjs/shared/route/utils.js +0 -40
  308. package/dist/cjs/shared/utils.js +0 -49
  309. package/dist/cjs/types/Config/ConfigResolved.js +0 -2
  310. package/dist/cjs/types/Config.js +0 -2
  311. package/dist/cjs/types/FilePath.js +0 -2
  312. package/dist/cjs/types/PageConfig.js +0 -2
  313. package/dist/cjs/types/PageContext.js +0 -2
  314. package/dist/cjs/types/VikeGlobalInternal.js +0 -2
  315. package/dist/cjs/types/VikeNamespace.js +0 -2
  316. package/dist/cjs/types/ViteManifest.js +0 -2
  317. package/dist/cjs/types/defineConfig.js +0 -6
  318. package/dist/cjs/types/index-dreprecated.js +0 -3
  319. package/dist/cjs/types/index.js +0 -5
  320. package/dist/cjs/utils/PROJECT_VERSION.js +0 -5
  321. package/dist/cjs/utils/PromiseType.js +0 -2
  322. package/dist/cjs/utils/assert.js +0 -211
  323. package/dist/cjs/utils/assertIsBrowser.js +0 -8
  324. package/dist/cjs/utils/assertIsNotBrowser.js +0 -9
  325. package/dist/cjs/utils/assertKeys.js +0 -27
  326. package/dist/cjs/utils/assertNodeVersion.js +0 -14
  327. package/dist/cjs/utils/assertRoutingType.js +0 -29
  328. package/dist/cjs/utils/assertSetup.js +0 -171
  329. package/dist/cjs/utils/assertSingleInstance.js +0 -110
  330. package/dist/cjs/utils/assertVersion.js +0 -60
  331. package/dist/cjs/utils/capitalizeFirstLetter.js +0 -9
  332. package/dist/cjs/utils/cast.js +0 -6
  333. package/dist/cjs/utils/catchInfiniteLoop.js +0 -34
  334. package/dist/cjs/utils/changeEnumerable.js +0 -8
  335. package/dist/cjs/utils/checkType.js +0 -6
  336. package/dist/cjs/utils/compareString.js +0 -10
  337. package/dist/cjs/utils/createErrorWithCleanStackTrace.js +0 -39
  338. package/dist/cjs/utils/debug.js +0 -178
  339. package/dist/cjs/utils/debugGlob.js +0 -6
  340. package/dist/cjs/utils/deepEqual.js +0 -10
  341. package/dist/cjs/utils/escapeHtml.js +0 -13
  342. package/dist/cjs/utils/escapeRegex.js +0 -7
  343. package/dist/cjs/utils/findFile.js +0 -30
  344. package/dist/cjs/utils/findPackageJson.js +0 -18
  345. package/dist/cjs/utils/formatHintLog.js +0 -17
  346. package/dist/cjs/utils/freezePartial.js +0 -35
  347. package/dist/cjs/utils/genPromise.js +0 -51
  348. package/dist/cjs/utils/getFileExtension.js +0 -16
  349. package/dist/cjs/utils/getGlobalObject.js +0 -15
  350. package/dist/cjs/utils/getMostSimilar.js +0 -68
  351. package/dist/cjs/utils/getPropAccessNotation.js +0 -9
  352. package/dist/cjs/utils/getRandomId.js +0 -14
  353. package/dist/cjs/utils/getTerminalWidth.js +0 -7
  354. package/dist/cjs/utils/getValuePrintable.js +0 -10
  355. package/dist/cjs/utils/getViteRPC.js +0 -79
  356. package/dist/cjs/utils/hasProp.js +0 -50
  357. package/dist/cjs/utils/humanizeTime.js +0 -24
  358. package/dist/cjs/utils/includes.js +0 -13
  359. package/dist/cjs/utils/injectRollupInputs.js +0 -29
  360. package/dist/cjs/utils/isArray.js +0 -7
  361. package/dist/cjs/utils/isArrayOfStrings.js +0 -7
  362. package/dist/cjs/utils/isBrowser.js +0 -8
  363. package/dist/cjs/utils/isCallable.js +0 -6
  364. package/dist/cjs/utils/isDev.js +0 -20
  365. package/dist/cjs/utils/isDocker.js +0 -45
  366. package/dist/cjs/utils/isEqualStringList.js +0 -13
  367. package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +0 -66
  368. package/dist/cjs/utils/isHtml.js +0 -9
  369. package/dist/cjs/utils/isImportPath.js +0 -21
  370. package/dist/cjs/utils/isNodeJS.js +0 -16
  371. package/dist/cjs/utils/isNonRunnableDev.js +0 -12
  372. package/dist/cjs/utils/isNullish.js +0 -16
  373. package/dist/cjs/utils/isObject.js +0 -6
  374. package/dist/cjs/utils/isObjectOfStrings.js +0 -7
  375. package/dist/cjs/utils/isObjectWithKeys.js +0 -15
  376. package/dist/cjs/utils/isPlainObject.js +0 -19
  377. package/dist/cjs/utils/isPromise.js +0 -7
  378. package/dist/cjs/utils/isPropertyGetter.js +0 -7
  379. package/dist/cjs/utils/isReact.js +0 -23
  380. package/dist/cjs/utils/isRunnableDevEnvironment.js +0 -9
  381. package/dist/cjs/utils/isSameErrorMessage.js +0 -9
  382. package/dist/cjs/utils/isScriptFile.js +0 -67
  383. package/dist/cjs/utils/isVikeReactApp.js +0 -8
  384. package/dist/cjs/utils/isVitest.js +0 -6
  385. package/dist/cjs/utils/joinEnglish.js +0 -14
  386. package/dist/cjs/utils/normalizeHeaders.js +0 -17
  387. package/dist/cjs/utils/objectAssign.js +0 -14
  388. package/dist/cjs/utils/objectAssignSafe.js +0 -7
  389. package/dist/cjs/utils/objectDefineProperty.js +0 -7
  390. package/dist/cjs/utils/objectEntries.js +0 -8
  391. package/dist/cjs/utils/objectEntriesForEach.js +0 -7
  392. package/dist/cjs/utils/objectFilter.js +0 -10
  393. package/dist/cjs/utils/objectFromEntries.js +0 -7
  394. package/dist/cjs/utils/objectKeys.js +0 -9
  395. package/dist/cjs/utils/objectReplace.js +0 -9
  396. package/dist/cjs/utils/onPageVisibilityChange.js +0 -18
  397. package/dist/cjs/utils/pLimit.js +0 -134
  398. package/dist/cjs/utils/parseNpmPackage.js +0 -106
  399. package/dist/cjs/utils/parseUrl-extras.js +0 -110
  400. package/dist/cjs/utils/parseUrl.js +0 -338
  401. package/dist/cjs/utils/path.js +0 -59
  402. package/dist/cjs/utils/pick.js +0 -12
  403. package/dist/cjs/utils/preservePropertyGetters.js +0 -30
  404. package/dist/cjs/utils/redirectHard.js +0 -6
  405. package/dist/cjs/utils/removeEmptyLines.js +0 -9
  406. package/dist/cjs/utils/removeFileExtension.js +0 -6
  407. package/dist/cjs/utils/requireResolve.js +0 -214
  408. package/dist/cjs/utils/rollupSourceMap.js +0 -19
  409. package/dist/cjs/utils/sleep.js +0 -6
  410. package/dist/cjs/utils/slice.js +0 -35
  411. package/dist/cjs/utils/sorter.js +0 -117
  412. package/dist/cjs/utils/stringifyStringArray.js +0 -6
  413. package/dist/cjs/utils/stripAnsi.js +0 -21
  414. package/dist/cjs/utils/styleFileRE.js +0 -6
  415. package/dist/cjs/utils/throttle.js +0 -15
  416. package/dist/cjs/utils/trackLogs.js +0 -31
  417. package/dist/cjs/utils/trimWithAnsi.js +0 -40
  418. package/dist/cjs/utils/truncateString.js +0 -23
  419. package/dist/cjs/utils/unique.js +0 -6
  420. package/dist/cjs/utils/updateType.js +0 -9
  421. package/dist/cjs/utils/urlToFile.js +0 -36
  422. package/dist/cjs/utils/virtualFileId.js +0 -43
  423. package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
  424. package/dist/esm/client/runtime-server-routing/globalContext.js +0 -5
  425. package/dist/esm/client/shared/createGetGlobalContextClient.js +0 -65
  426. package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
  427. package/dist/esm/node/vite/plugins/pluginBuild.js +0 -20
  428. package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -14
  429. package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -92
@@ -1,173 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getHookFromPageContext = getHookFromPageContext;
7
- exports.getHookFromPageContextNew = getHookFromPageContextNew;
8
- exports.getHookFromPageConfig = getHookFromPageConfig;
9
- exports.getHookFromPageConfigGlobal = getHookFromPageConfigGlobal;
10
- exports.getHookFromPageConfigGlobalCumulative = getHookFromPageConfigGlobalCumulative;
11
- exports.getHook_setIsPrerenderering = getHook_setIsPrerenderering;
12
- exports.getHookTimeoutDefault = getHookTimeoutDefault;
13
- const getGlobalObject_js_1 = require("../../utils/getGlobalObject.js");
14
- const helpers_js_1 = require("../page-configs/helpers.js");
15
- const getConfigValueRuntime_js_1 = require("../page-configs/getConfigValueRuntime.js");
16
- const utils_js_1 = require("../utils.js");
17
- const picocolors_1 = __importDefault(require("@brillout/picocolors"));
18
- const globalObject = (0, getGlobalObject_js_1.getGlobalObject)('hooks/getHook.ts', {});
19
- function getHookFromPageContext(pageContext, hookName) {
20
- if (!(hookName in pageContext.exports)) {
21
- return null;
22
- }
23
- const { hooksTimeout } = pageContext.config;
24
- const hookTimeout = getHookTimeout(hooksTimeout, hookName);
25
- const hookFn = pageContext.exports[hookName];
26
- if (hookFn === null)
27
- return null;
28
- // TO-DO/eventually: use pageContext.configEntries in favor of pageContext.exportsAll once V0.4 is removed
29
- const file = pageContext.exportsAll[hookName][0];
30
- (0, utils_js_1.assert)(file.exportValue === hookFn);
31
- const hookFilePath = file.filePath;
32
- (0, utils_js_1.assert)(hookFilePath);
33
- return getHook(hookFn, hookName, hookFilePath, hookTimeout);
34
- }
35
- // TO-DO/eventually: remove getHookFromPageContext() in favor of getHookFromPageContextNew()
36
- function getHookFromPageContextNew(hookName, pageContext) {
37
- const { hooksTimeout } = pageContext.config;
38
- const hookTimeout = getHookTimeout(hooksTimeout, hookName);
39
- const hooks = [];
40
- /* TO-DO/eventually: use pageContext.configEntries in favor of pageContext.exportsAll once V0.4 is removed
41
- pageContext.configEntries[hookName]?.forEach((val) => {
42
- const hookFn = val.configValue
43
- if (hookFn === null) return
44
- const hookFilePath = val.configDefinedByFile
45
- */
46
- pageContext.exportsAll[hookName]?.forEach((val) => {
47
- const hookFn = val.exportValue;
48
- if (hookFn === null)
49
- return;
50
- const hookFilePath = val.filePath;
51
- (0, utils_js_1.assert)(hookFilePath);
52
- hooks.push(getHook(hookFn, hookName, hookFilePath, hookTimeout));
53
- });
54
- return hooks;
55
- }
56
- function getHookFromPageConfig(pageConfig, hookName) {
57
- const configValue = (0, getConfigValueRuntime_js_1.getConfigValueRuntime)(pageConfig, hookName);
58
- if (!configValue?.value)
59
- return null;
60
- const { hookFn, hookFilePath } = getHookFromConfigValue(configValue);
61
- const hooksTimeout = (0, getConfigValueRuntime_js_1.getConfigValueRuntime)(pageConfig, 'hooksTimeout')?.value;
62
- const hookTimeout = getHookTimeout(hooksTimeout, hookName);
63
- return getHook(hookFn, hookName, hookFilePath, hookTimeout);
64
- }
65
- function getHookFromPageConfigGlobal(pageConfigGlobal, hookName) {
66
- const configValue = pageConfigGlobal.configValues[hookName];
67
- if (!configValue?.value)
68
- return null;
69
- const { hookFn, hookFilePath } = getHookFromConfigValue(configValue);
70
- const hookTimeout = getHookTimeoutGlobal(hookName);
71
- return getHook(hookFn, hookName, hookFilePath, hookTimeout);
72
- }
73
- function getHookFromPageConfigGlobalCumulative(pageConfigGlobal, hookName) {
74
- const configValue = pageConfigGlobal.configValues[hookName];
75
- if (!configValue?.value)
76
- return [];
77
- const val = configValue.value;
78
- (0, utils_js_1.assert)((0, utils_js_1.isArray)(val));
79
- return val.map((v, i) => {
80
- const hookFn = v;
81
- const hookTimeout = getHookTimeoutGlobal(hookName);
82
- (0, utils_js_1.assert)((0, utils_js_1.isArray)(configValue.definedAtData));
83
- const hookFilePath = (0, helpers_js_1.getHookFilePathToShowToUser)(configValue.definedAtData[i]);
84
- return getHook(hookFn, hookName, hookFilePath, hookTimeout);
85
- });
86
- }
87
- function getHookTimeoutGlobal(hookName) {
88
- // TO-DO/perfection: we could use the global value of configooksTimeout but it requires some non-trivial refactoring
89
- const hookTimeout = getHookTimeoutDefault(hookName);
90
- return hookTimeout;
91
- }
92
- function getHook(hookFn, hookName, hookFilePath, hookTimeout) {
93
- (0, utils_js_1.assert)(hookFilePath);
94
- assertHookFn(hookFn, { hookName, hookFilePath });
95
- const hook = { hookFn, hookName, hookFilePath, hookTimeout };
96
- return hook;
97
- }
98
- function getHookFromConfigValue(configValue) {
99
- const hookFn = configValue.value;
100
- (0, utils_js_1.assert)(hookFn);
101
- const hookFilePath = (0, helpers_js_1.getHookFilePathToShowToUser)(configValue.definedAtData);
102
- return { hookFn, hookFilePath };
103
- }
104
- function assertHookFn(hookFn, { hookName, hookFilePath }) {
105
- (0, utils_js_1.assert)(hookName && hookFilePath);
106
- (0, utils_js_1.assert)(!hookName.endsWith(')'));
107
- (0, utils_js_1.assert)(!hookFilePath.endsWith(' '));
108
- (0, utils_js_1.assertUsage)((0, utils_js_1.isCallable)(hookFn), `Hook ${hookName}() defined by ${hookFilePath} should be a function`);
109
- (0, utils_js_1.checkType)(hookFn);
110
- }
111
- function getHookTimeout(hooksTimeoutProvidedByUser, hookName) {
112
- const hooksTimeoutProvidedbyUserNormalized = getHooksTimeoutProvidedByUserNormalized(hooksTimeoutProvidedByUser);
113
- if (hooksTimeoutProvidedbyUserNormalized === false)
114
- return { error: false, warning: false };
115
- const providedbyUser = hooksTimeoutProvidedbyUserNormalized[hookName];
116
- const hookTimeout = getHookTimeoutDefault(hookName);
117
- if (providedbyUser?.error !== undefined)
118
- hookTimeout.error = providedbyUser.error;
119
- if (providedbyUser?.warning !== undefined)
120
- hookTimeout.warning = providedbyUser.warning;
121
- return hookTimeout;
122
- }
123
- // Ideally this should be called only once and at build-time (to avoid bloating the client-side bundle), but we didn't implement any mechanism to valid config values at build-time yet
124
- function getHooksTimeoutProvidedByUserNormalized(hooksTimeoutProvidedByUser) {
125
- if (hooksTimeoutProvidedByUser === undefined)
126
- return {};
127
- if (hooksTimeoutProvidedByUser === false)
128
- return false;
129
- (0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(hooksTimeoutProvidedByUser), `Setting ${picocolors_1.default.cyan('hooksTimeout')} should be ${picocolors_1.default.cyan('false')} or an object`);
130
- const hooksTimeoutProvidedByUserNormalized = {};
131
- Object.entries(hooksTimeoutProvidedByUser).forEach(([hookName, hookTimeoutProvidedbyUser]) => {
132
- if (hookTimeoutProvidedbyUser === false) {
133
- hooksTimeoutProvidedByUserNormalized[hookName] = { error: false, warning: false };
134
- return;
135
- }
136
- (0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(hookTimeoutProvidedbyUser), `Setting ${picocolors_1.default.cyan(`hooksTimeout.${hookName}`)} should be ${picocolors_1.default.cyan('false')} or an object`);
137
- const [error, warning] = ['error', 'warning'].map((timeoutName) => {
138
- const timeoutVal = hookTimeoutProvidedbyUser[timeoutName];
139
- if (timeoutVal === undefined || timeoutVal === false)
140
- return timeoutVal;
141
- const errPrefix = `Setting ${picocolors_1.default.cyan(`hooksTimeout.${hookName}.${timeoutName}`)} should be`;
142
- (0, utils_js_1.assertUsage)(typeof timeoutVal === 'number', `${errPrefix} ${picocolors_1.default.cyan('false')} or a number`);
143
- (0, utils_js_1.assertUsage)(timeoutVal > 0, `${errPrefix} a positive number`);
144
- return timeoutVal;
145
- });
146
- hooksTimeoutProvidedByUserNormalized[hookName] = { error, warning };
147
- });
148
- return hooksTimeoutProvidedByUserNormalized;
149
- }
150
- function getHookTimeoutDefault(hookName) {
151
- if (hookName === 'onBeforeRoute') {
152
- return {
153
- error: 5 * 1000,
154
- warning: 1 * 1000,
155
- };
156
- }
157
- if (globalObject.isPrerendering) {
158
- return {
159
- error: 2 * 60 * 1000,
160
- warning: 30 * 1000,
161
- };
162
- }
163
- else {
164
- (0, utils_js_1.assert)(!hookName.toLowerCase().includes('prerender'));
165
- }
166
- return {
167
- error: 30 * 1000,
168
- warning: 4 * 1000,
169
- };
170
- }
171
- function getHook_setIsPrerenderering() {
172
- globalObject.isPrerendering = true;
173
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.htmlElementId_globalContext = exports.htmlElementId_pageContext = void 0;
4
- exports.htmlElementId_pageContext = 'vike_pageContext';
5
- exports.htmlElementId_globalContext = 'vike_globalContext';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isServerSideError = void 0;
4
- exports.isServerSideError = '_isServerSideError';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pageContextInitIsPassedToClient = void 0;
4
- exports.pageContextInitIsPassedToClient = '_pageContextInitIsPassedToClient';
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modifyUrl = modifyUrl;
4
- const modifyUrlSameOrigin_js_1 = require("./modifyUrlSameOrigin.js");
5
- const utils_js_1 = require("./utils.js");
6
- /**
7
- * Modify a URL.
8
- *
9
- * Example: changing the URL pathname for internationalization.
10
- *
11
- * https://vike.dev/modifyUrl
12
- */
13
- function modifyUrl(url, modify) {
14
- url = (0, modifyUrlSameOrigin_js_1.modifyUrlSameOrigin)(url, modify);
15
- const urlParsed = (0, utils_js_1.parseUrl)(url, '/');
16
- // Origin
17
- const originParts = [
18
- modify.protocol ?? urlParsed.protocol ?? '',
19
- modify.hostname ?? urlParsed.hostname ?? '',
20
- ];
21
- const port = modify.port ?? urlParsed.port;
22
- if (port || port === 0) {
23
- originParts.push(`:${port}`);
24
- }
25
- const origin = originParts.join('');
26
- const urlModified = (0, utils_js_1.createUrlFromComponents)(origin, urlParsed.pathname, urlParsed.searchOriginal, urlParsed.hashOriginal);
27
- return urlModified;
28
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modifyUrlSameOrigin = modifyUrlSameOrigin;
4
- // We don't move modifyUrlSameOrigin() to the modifyUrl.ts file because we plan to use modifyUrlSameOrigin() on the client-side:
5
- // https://github.com/vikejs/vike/blob/c5a2de5e85262771f97851767c00ac35da69c64b/packages/vike/client/runtime-client-routing/navigate.ts#L4
6
- const utils_js_1 = require("./utils.js");
7
- function modifyUrlSameOrigin(url, modify) {
8
- const urlParsed = (0, utils_js_1.parseUrl)(url, '/');
9
- // Pathname
10
- const pathname = modify.pathname ?? urlParsed.pathnameOriginal;
11
- (0, utils_js_1.assertUsageUrlPathnameAbsolute)(pathname, 'modify.pathname');
12
- // Search
13
- let search = modify.search === null ? '' : !modify.search ? urlParsed.searchOriginal : resolveSearch(urlParsed, modify.search);
14
- if (search === '?')
15
- search = '';
16
- // Hash
17
- let hash;
18
- if (modify.hash === null) {
19
- hash = '';
20
- }
21
- else if (modify.hash === undefined) {
22
- hash = urlParsed.hashOriginal ?? '';
23
- }
24
- else {
25
- hash = modify.hash;
26
- if (!hash.startsWith('#'))
27
- hash = '#' + hash;
28
- }
29
- const urlModified = (0, utils_js_1.createUrlFromComponents)(urlParsed.origin, pathname, search, hash);
30
- return urlModified;
31
- }
32
- function resolveSearch(urlParsed, modifySearch) {
33
- let searchParams;
34
- if (modifySearch instanceof URLSearchParams) {
35
- // Overwrite
36
- searchParams = modifySearch;
37
- }
38
- else {
39
- // Merge
40
- const searchMap = (0, utils_js_1.objectFilter)({ ...urlParsed.search, ...(0, utils_js_1.objectFilter)(modifySearch, isNotUndefined) }, (utils_js_1.isNotNullish_keyVal));
41
- searchParams = new URLSearchParams(searchMap);
42
- }
43
- return '?' + searchParams.toString();
44
- }
45
- function isNotUndefined(arg) {
46
- return arg[1] !== undefined;
47
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assertPlusFileExport = assertPlusFileExport;
7
- const utils_js_1 = require("../utils.js");
8
- const picocolors_1 = __importDefault(require("@brillout/picocolors"));
9
- const SIDE_EXPORTS_TOLERATE = [
10
- // vite-plugin-solid adds `export { $$registrations }`
11
- '$$registrations',
12
- // @vitejs/plugin-vue adds `export { _rerender_only }`
13
- '_rerender_only',
14
- ];
15
- // Tolerate `export { frontmatter }` in .mdx files
16
- const SIDE_EXPORTS_DO_NOT_CHECK = ['.md', '.mdx'];
17
- function assertPlusFileExport(fileExports, filePathToShowToUser, configName) {
18
- const exportNames = Object.keys(fileExports);
19
- const isValid = (exportName) => exportName === 'default' || exportName === configName;
20
- // Error upon missing/ambiguous export
21
- const exportNamesValid = exportNames.filter(isValid);
22
- const exportDefault = picocolors_1.default.code('export default');
23
- const exportNamed = picocolors_1.default.code(`export { ${configName} }`);
24
- if (exportNamesValid.length === 0) {
25
- (0, utils_js_1.assertUsage)(false, `${filePathToShowToUser} should define ${exportNamed} or ${exportDefault}`);
26
- }
27
- if (exportNamesValid.length === 2) {
28
- (0, utils_js_1.assertUsage)(false, `${filePathToShowToUser} is ambiguous: remove ${exportDefault} or ${exportNamed}`);
29
- }
30
- (0, utils_js_1.assert)(exportNamesValid.length === 1);
31
- // Warn upon side exports
32
- const exportNamesInvalid = exportNames
33
- .filter((e) => !isValid(e))
34
- .filter((exportName) => !SIDE_EXPORTS_TOLERATE.includes(exportName));
35
- if (!SIDE_EXPORTS_DO_NOT_CHECK.some((ext) => filePathToShowToUser.endsWith(ext))) {
36
- exportNamesInvalid.forEach((exportInvalid) => {
37
- (0, utils_js_1.assertWarning)(false, `${filePathToShowToUser} unexpected ${picocolors_1.default.cyan(`export { ${exportInvalid} }`)}, see https://vike.dev/no-side-exports`, {
38
- onlyOnce: true,
39
- });
40
- });
41
- }
42
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findPageConfig = findPageConfig;
4
- const utils_js_1 = require("../utils.js");
5
- function findPageConfig(pageConfigs, pageId) {
6
- const result = pageConfigs.filter((p) => p.pageId === pageId);
7
- (0, utils_js_1.assert)(result.length <= 1);
8
- const pageConfig = result[0] ?? null;
9
- return pageConfig;
10
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getConfigDefinedAt = getConfigDefinedAt;
7
- exports.getConfigDefinedAtOptional = getConfigDefinedAtOptional;
8
- exports.getDefinedAtString = getDefinedAtString;
9
- exports.getDefinedByString = getDefinedByString;
10
- const utils_js_1 = require("../utils.js");
11
- const picocolors_1 = __importDefault(require("@brillout/picocolors"));
12
- const getExportPath_js_1 = require("./getExportPath.js");
13
- function getConfigDefinedAt(sentenceBegin, configName, definedAtData) {
14
- return `${begin(sentenceBegin, configName)} at ${getDefinedAtString(definedAtData, configName)}`;
15
- }
16
- function getConfigDefinedAtOptional(sentenceBegin, configName, definedAtData) {
17
- if (!definedAtData) {
18
- return `${begin(sentenceBegin, configName)} internally`;
19
- }
20
- else {
21
- return `${begin(sentenceBegin, configName)} at ${getDefinedAtString(definedAtData, configName)}`;
22
- }
23
- }
24
- function begin(sentenceBegin, configName) {
25
- return `${sentenceBegin} ${picocolors_1.default.cyan(configName)} defined`;
26
- }
27
- function getDefinedAtString(definedAtData, configName) {
28
- let files;
29
- if ((0, utils_js_1.isArray)(definedAtData)) {
30
- files = definedAtData;
31
- }
32
- else {
33
- files = [definedAtData];
34
- }
35
- (0, utils_js_1.assert)(files.length >= 1);
36
- const definedAtString = files
37
- .map((definedAt) => {
38
- if (definedAt.definedBy)
39
- return getDefinedByString(definedAt, configName);
40
- const { filePathToShowToUser, fileExportPathToShowToUser } = definedAt;
41
- const exportPath = (0, getExportPath_js_1.getExportPath)(fileExportPathToShowToUser, configName);
42
- if (exportPath) {
43
- return `${filePathToShowToUser} > ${picocolors_1.default.cyan(exportPath)}`;
44
- }
45
- else {
46
- return filePathToShowToUser;
47
- }
48
- })
49
- .join(' / ');
50
- return definedAtString;
51
- }
52
- function getDefinedByString(definedAt, configName) {
53
- if (definedAt.definedBy === 'api') {
54
- return `API call ${picocolors_1.default.cyan(`${definedAt.operation}({ vikeConfig: { ${configName} } })`)}`;
55
- }
56
- const { definedBy } = definedAt;
57
- if (definedBy === 'cli') {
58
- return `CLI option ${picocolors_1.default.cyan(`--${configName}`)}`;
59
- }
60
- if (definedBy === 'env') {
61
- return `environment variable ${picocolors_1.default.cyan(`VIKE_CONFIG="{${configName}}"`)}`;
62
- }
63
- (0, utils_js_1.checkType)(definedBy);
64
- (0, utils_js_1.assert)(false);
65
- }
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfigValueBuildTime = getConfigValueBuildTime;
4
- const utils_js_1 = require("../utils.js");
5
- const assertSetup_js_1 = require("../../utils/assertSetup.js");
6
- const getConfigValueTyped_js_1 = require("./getConfigValueTyped.js");
7
- (0, assertSetup_js_1.assertIsNotProductionRuntime)();
8
- function getConfigValueBuildTime(pageConfig, configName, type) {
9
- const configValue = getConfigValue(pageConfig, configName);
10
- if (!configValue)
11
- return null;
12
- return (0, getConfigValueTyped_js_1.getConfigValueTyped)(configValue, configName, type);
13
- }
14
- function getConfigValue(pageConfig, configName) {
15
- const { configValueSources, configValuesComputed, configDefinitions } = pageConfig;
16
- const configValueComputed = configValuesComputed[configName];
17
- if (configValueComputed) {
18
- return {
19
- type: 'computed',
20
- value: configValueComputed.value,
21
- definedAtData: null,
22
- };
23
- }
24
- const sources = configValueSources[configName];
25
- if (!sources)
26
- return null;
27
- const configDef = configDefinitions[configName];
28
- (0, utils_js_1.assert)(configDef);
29
- if (!configDef.cumulative) {
30
- const configValueSource = sources[0];
31
- (0, utils_js_1.assert)(configValueSource);
32
- (0, utils_js_1.assert)(configValueSource.valueIsLoaded);
33
- return {
34
- type: 'standard',
35
- value: configValueSource.value,
36
- definedAtData: getDefinedAt(configValueSource),
37
- };
38
- }
39
- else {
40
- const { value, definedAtData } = mergeCumulative(sources);
41
- (0, utils_js_1.assert)(value.length === definedAtData.length);
42
- return {
43
- type: 'cumulative',
44
- value,
45
- definedAtData,
46
- };
47
- }
48
- }
49
- function mergeCumulative(configValueSources) {
50
- const value = [];
51
- const definedAtData = [];
52
- configValueSources.forEach((configValueSource) => {
53
- (0, utils_js_1.assert)(configValueSource.configEnv.config === true);
54
- (0, utils_js_1.assert)(configValueSource.valueIsLoaded);
55
- value.push(configValueSource.value);
56
- definedAtData.push(getDefinedAt(configValueSource));
57
- });
58
- return { value, definedAtData };
59
- }
60
- function getDefinedAt(configValueSource) {
61
- const { definedAt } = configValueSource;
62
- if (definedAt.definedBy)
63
- return definedAt;
64
- return {
65
- filePathToShowToUser: definedAt.filePathToShowToUser,
66
- fileExportPathToShowToUser: definedAt.fileExportPathToShowToUser,
67
- };
68
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfigValueRuntime = getConfigValueRuntime;
4
- const getConfigValueTyped_js_1 = require("./getConfigValueTyped.js");
5
- function getConfigValueRuntime(pageConfig, configName, type) {
6
- const configValue = pageConfig.configValues[configName];
7
- if (!configValue)
8
- return null;
9
- return (0, getConfigValueTyped_js_1.getConfigValueTyped)(configValue, configName, type);
10
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getConfigValueTyped = getConfigValueTyped;
7
- const utils_js_1 = require("../utils.js");
8
- const picocolors_1 = __importDefault(require("@brillout/picocolors"));
9
- const getConfigDefinedAt_js_1 = require("./getConfigDefinedAt.js");
10
- function getConfigValueTyped(configValue, configName, type) {
11
- /* [NULL_HANDLING] Do we really need this? This doesn't seem to make sense, let's eventually (re)move this.
12
- // Enable users to suppress global config values by setting the local config value to null
13
- if (configValue.value === null) return null
14
- */
15
- const { value, definedAtData } = configValue;
16
- if (type)
17
- assertConfigValueType(value, type, configName, definedAtData);
18
- return configValue;
19
- }
20
- function assertConfigValueType(value, type, configName, definedAtData) {
21
- (0, utils_js_1.assert)(value !== null);
22
- const typeActual = typeof value;
23
- if (typeActual === type)
24
- return;
25
- const valuePrintable = (0, utils_js_1.getValuePrintable)(value);
26
- const problem = valuePrintable !== null
27
- ? `value ${picocolors_1.default.cyan(valuePrintable)}`
28
- : `type ${picocolors_1.default.cyan(typeActual)}`;
29
- const configDefinedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAtOptional)('Config', configName, definedAtData);
30
- const errMsg = `${configDefinedAt} has an invalid ${problem}: it should be a ${picocolors_1.default.cyan(type)} instead`;
31
- (0, utils_js_1.assertUsage)(false, errMsg);
32
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExportPath = getExportPath;
4
- const utils_js_1 = require("../utils.js");
5
- function getExportPath(fileExportPathToShowToUser, configName) {
6
- if (!fileExportPathToShowToUser)
7
- return null;
8
- let [exportName, ...exportObjectPath] = fileExportPathToShowToUser;
9
- if (!exportName)
10
- return null;
11
- if (exportObjectPath.length === 0 && ['*', 'default', configName].includes(exportName))
12
- return null;
13
- (0, utils_js_1.assert)(exportName !== '*');
14
- let prefix = '';
15
- let suffix = '';
16
- if (exportName === 'default') {
17
- prefix = 'export default';
18
- }
19
- else {
20
- prefix = 'export';
21
- exportObjectPath = [exportName, ...exportObjectPath];
22
- }
23
- exportObjectPath.forEach((prop) => {
24
- prefix = `${prefix} { ${prop}`;
25
- suffix = ` }${suffix}`;
26
- });
27
- const exportPath = prefix + suffix;
28
- return exportPath;
29
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPageConfig = getPageConfig;
4
- exports.getConfigValueFilePathToShowToUser = getConfigValueFilePathToShowToUser;
5
- exports.getHookFilePathToShowToUser = getHookFilePathToShowToUser;
6
- const utils_js_1 = require("../utils.js");
7
- function getPageConfig(pageId, pageConfigs) {
8
- const pageConfig = pageConfigs.find((p) => p.pageId === pageId);
9
- (0, utils_js_1.assert)(pageConfigs.length > 0);
10
- (0, utils_js_1.assert)(pageConfig);
11
- return pageConfig;
12
- }
13
- function getConfigValueFilePathToShowToUser(definedAtData) {
14
- // A unique file path only exists if the config value isn't cumulative nor computed:
15
- // - cumulative config values have multiple file paths
16
- // - computed values don't have any file path
17
- if (!definedAtData || (0, utils_js_1.isArray)(definedAtData) || definedAtData.definedBy)
18
- return null;
19
- const { filePathToShowToUser } = definedAtData;
20
- (0, utils_js_1.assert)(filePathToShowToUser);
21
- return filePathToShowToUser;
22
- }
23
- function getHookFilePathToShowToUser(definedAtData) {
24
- const filePathToShowToUser = getConfigValueFilePathToShowToUser(definedAtData);
25
- (0, utils_js_1.assert)(filePathToShowToUser);
26
- return filePathToShowToUser;
27
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadAndParseVirtualFilePageEntry = loadAndParseVirtualFilePageEntry;
4
- const utils_js_1 = require("../utils.js");
5
- const parsePageConfigsSerialized_js_1 = require("./serialize/parsePageConfigsSerialized.js");
6
- async function loadAndParseVirtualFilePageEntry(pageConfig, isDev) {
7
- if ('isPageEntryLoaded' in pageConfig &&
8
- // We don't need to cache in dev, since Vite already caches the virtual module
9
- !isDev) {
10
- return pageConfig;
11
- }
12
- const { moduleId, moduleExportsPromise } = pageConfig.loadVirtualFilePageEntry();
13
- const virtualFileExportsPageEntry = await moduleExportsPromise;
14
- // `configValuesLoaded` is sometimes `undefined` https://github.com/vikejs/vike/discussions/2092
15
- if (!virtualFileExportsPageEntry)
16
- (0, utils_js_1.assert)(false, { moduleExportsPromise, virtualFileExportsPageEntry, moduleId });
17
- const configValues = parseVirtualFileExportsPageEntry(virtualFileExportsPageEntry);
18
- Object.assign(pageConfig.configValues, configValues);
19
- (0, utils_js_1.objectAssign)(pageConfig, { isPageEntryLoaded: true });
20
- return pageConfig;
21
- }
22
- function parseVirtualFileExportsPageEntry(virtualFileExportsPageEntry) {
23
- const configValues = (0, parsePageConfigsSerialized_js_1.parseConfigValuesSerialized)(virtualFileExportsPageEntry.configValuesSerialized);
24
- return configValues;
25
- }