vike 0.4.195 → 0.4.196-commit-df033dd

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 (291) hide show
  1. package/LICENSE.md +9 -0
  2. package/dist/cjs/__internal/index.js +3 -4
  3. package/dist/cjs/node/cli/onLoad.js +1 -2
  4. package/dist/cjs/node/createPageRenderer.js +1 -2
  5. package/dist/cjs/node/plugin/index.js +3 -3
  6. package/dist/cjs/node/plugin/onLoad.js +1 -2
  7. package/dist/cjs/node/plugin/plugins/autoFullBuild.js +1 -2
  8. package/dist/cjs/node/plugin/plugins/baseUrls.js +1 -2
  9. package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +2 -3
  10. package/dist/cjs/node/plugin/plugins/buildConfig.js +4 -4
  11. package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +1 -2
  12. package/dist/cjs/node/plugin/plugins/commonConfig.js +1 -2
  13. package/dist/cjs/node/plugin/plugins/config/assertVikeConfig.js +1 -2
  14. package/dist/cjs/node/plugin/plugins/config/index.js +1 -2
  15. package/dist/cjs/node/plugin/plugins/config/pickFirst.js +1 -2
  16. package/dist/cjs/node/plugin/plugins/config/resolveBase.js +2 -3
  17. package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -2
  18. package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -2
  19. package/dist/cjs/node/plugin/plugins/devConfig/index.js +1 -2
  20. package/dist/cjs/node/plugin/plugins/distFileNames.js +1 -2
  21. package/dist/cjs/node/plugin/plugins/envVars.js +1 -2
  22. package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +2 -2
  23. package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +3 -3
  24. package/dist/cjs/node/plugin/plugins/fileEnv.js +109 -88
  25. package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +1 -2
  26. package/dist/cjs/node/plugin/plugins/importBuild/index.js +2 -3
  27. package/dist/cjs/node/plugin/plugins/importUserCode/addImportStatement.js +1 -2
  28. package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +1 -3
  29. package/dist/cjs/node/plugin/plugins/importUserCode/index.js +1 -2
  30. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +2 -3
  31. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +1 -2
  32. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -2
  33. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -2
  34. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +8 -9
  35. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +3 -4
  36. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +3 -4
  37. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +3 -4
  38. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +5 -7
  39. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -6
  40. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -2
  41. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -2
  42. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +1 -2
  43. package/dist/cjs/node/plugin/plugins/packageJsonFile.js +1 -2
  44. package/dist/cjs/node/plugin/plugins/previewConfig.js +1 -2
  45. package/dist/cjs/node/plugin/plugins/removeRequireHookPlugin.js +1 -2
  46. package/dist/cjs/node/plugin/plugins/setGlobalContext.js +1 -2
  47. package/dist/cjs/node/plugin/plugins/suppressRollupWarning.js +1 -2
  48. package/dist/cjs/node/plugin/plugins/workaroundCssModuleHmr.js +1 -2
  49. package/dist/cjs/node/plugin/resolveClientEntriesDev.js +1 -2
  50. package/dist/cjs/node/plugin/shared/addSsrMiddleware.js +1 -2
  51. package/dist/cjs/node/plugin/shared/findPageFiles.js +1 -2
  52. package/dist/cjs/node/plugin/shared/getAssetsDir.js +1 -2
  53. package/dist/cjs/node/plugin/shared/getFilePath.js +8 -9
  54. package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +2 -3
  55. package/dist/cjs/node/plugin/shared/isAsset.js +1 -2
  56. package/dist/cjs/node/plugin/shared/isViteCliCall.js +2 -3
  57. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +4 -5
  58. package/dist/cjs/node/plugin/shared/loggerNotProd/log.js +4 -5
  59. package/dist/cjs/node/plugin/shared/loggerNotProd.js +6 -7
  60. package/dist/cjs/node/plugin/shared/loggerVite/removeSuperfluousViteLog.js +3 -4
  61. package/dist/cjs/node/plugin/shared/loggerVite.js +1 -2
  62. package/dist/cjs/node/plugin/shared/parseEsModule.js +2 -3
  63. package/dist/cjs/node/plugin/shared/rollupIsEsm.js +1 -2
  64. package/dist/cjs/node/plugin/shared/rollupSourceMap.js +2 -3
  65. package/dist/cjs/node/prerender/runPrerender.js +4 -5
  66. package/dist/cjs/node/runtime/globalContext/loadImportBuild.js +2 -3
  67. package/dist/cjs/node/runtime/globalContext.js +13 -14
  68. package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +1 -2
  69. package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +1 -2
  70. package/dist/cjs/node/runtime/html/injectAssets/inferHtmlTags.js +4 -4
  71. package/dist/cjs/node/runtime/html/injectAssets/injectAssets__public.js +1 -2
  72. package/dist/cjs/node/runtime/html/injectAssets/injectHtmlTags.js +6 -7
  73. package/dist/cjs/node/runtime/html/injectAssets/mergeScriptTags.js +1 -2
  74. package/dist/cjs/node/runtime/html/injectAssets/sanitizeJson.js +1 -2
  75. package/dist/cjs/node/runtime/html/injectAssets.js +2 -3
  76. package/dist/cjs/node/runtime/html/renderHtml.js +5 -6
  77. package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +2 -3
  78. package/dist/cjs/node/runtime/html/stream/react-streaming.js +3 -4
  79. package/dist/cjs/node/runtime/html/stream.js +21 -22
  80. package/dist/cjs/node/runtime/onLoad.js +1 -2
  81. package/dist/cjs/node/runtime/page-files/getPageFilesExports.js +1 -2
  82. package/dist/cjs/node/runtime/renderPage/analyzePage.js +5 -6
  83. package/dist/cjs/node/runtime/renderPage/assertArguments.js +1 -2
  84. package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -2
  85. package/dist/cjs/node/runtime/renderPage/createHttpResponse/getCacheControl.js +1 -2
  86. package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +19 -8
  87. package/dist/cjs/node/runtime/renderPage/debugPageFiles.js +1 -2
  88. package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -2
  89. package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +1 -2
  90. package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -2
  91. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -3
  92. package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -2
  93. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +1 -2
  94. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +1 -2
  95. package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +1 -2
  96. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +2 -3
  97. package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +2 -3
  98. package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -2
  99. package/dist/cjs/node/runtime/renderPage/inferMediaType.js +1 -2
  100. package/dist/cjs/node/runtime/renderPage/isNewError.js +2 -3
  101. package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -2
  102. package/dist/cjs/node/runtime/renderPage/log404/index.js +2 -3
  103. package/dist/cjs/node/runtime/renderPage/logErrorHint.js +2 -3
  104. package/dist/cjs/node/runtime/renderPage/loggerProd.js +2 -3
  105. package/dist/cjs/node/runtime/renderPage/loggerRuntime.js +2 -2
  106. package/dist/cjs/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.js +1 -2
  107. package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +5 -6
  108. package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +2 -3
  109. package/dist/cjs/node/runtime/renderPage.js +8 -8
  110. package/dist/cjs/node/shared/assertPluginManifest.js +1 -2
  111. package/dist/cjs/node/shared/assertRuntimeManifest.js +1 -2
  112. package/dist/cjs/node/shared/assertV1Design.js +1 -2
  113. package/dist/cjs/node/shared/extractAssetsQuery.js +2 -3
  114. package/dist/cjs/node/shared/getConfigVike.js +1 -2
  115. package/dist/cjs/node/shared/isErrorDebug.js +1 -2
  116. package/dist/cjs/node/shared/prependEntriesDir.js +1 -2
  117. package/dist/cjs/node/shared/virtual-files/virtualFileImportUserCode.js +2 -2
  118. package/dist/cjs/node/shared/virtual-files/virtualFilePageConfigValuesAll.js +2 -3
  119. package/dist/cjs/shared/addIs404ToPageProps.js +1 -2
  120. package/dist/cjs/shared/assertHookReturnedObject.js +1 -2
  121. package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +1 -2
  122. package/dist/cjs/shared/assertPageContextProvidedByUser.js +1 -2
  123. package/dist/cjs/shared/assertPageFilePath.js +1 -2
  124. package/dist/cjs/shared/determinePageIdOld.js +1 -2
  125. package/dist/cjs/shared/error-page.js +3 -4
  126. package/dist/cjs/shared/getPageContextRequestUrl.js +2 -2
  127. package/dist/cjs/shared/getPageContextUrlComputed.js +2 -3
  128. package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +4 -5
  129. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +1 -2
  130. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +2 -3
  131. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +1 -2
  132. package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +2 -3
  133. package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +1 -2
  134. package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +3 -3
  135. package/dist/cjs/shared/getPageFiles/fileTypes.js +3 -3
  136. package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +2 -3
  137. package/dist/cjs/shared/getPageFiles/getExports.js +1 -2
  138. package/dist/cjs/shared/getPageFiles/getPageFileObject.js +1 -2
  139. package/dist/cjs/shared/getPageFiles/parseGlobResults.js +1 -2
  140. package/dist/cjs/shared/getPageFiles/setPageFiles.js +3 -4
  141. package/dist/cjs/shared/hooks/executeHook.js +4 -5
  142. package/dist/cjs/shared/hooks/getHook.js +6 -7
  143. package/dist/cjs/shared/modifyUrl.js +1 -2
  144. package/dist/cjs/shared/page-configs/assertPlusFileExport.js +1 -2
  145. package/dist/cjs/shared/page-configs/findPageConfig.js +1 -2
  146. package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +3 -4
  147. package/dist/cjs/shared/page-configs/getConfigValue.js +2 -3
  148. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +1 -2
  149. package/dist/cjs/shared/page-configs/getExportPath.js +1 -2
  150. package/dist/cjs/shared/page-configs/helpers.js +3 -4
  151. package/dist/cjs/shared/page-configs/loadConfigValues.js +1 -2
  152. package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -3
  153. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +1 -2
  154. package/dist/cjs/shared/route/abort.js +9 -10
  155. package/dist/cjs/shared/route/debug.js +1 -2
  156. package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +1 -2
  157. package/dist/cjs/shared/route/executeGuardHook.js +1 -2
  158. package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +1 -2
  159. package/dist/cjs/shared/route/index.js +1 -2
  160. package/dist/cjs/shared/route/loadPageRoutes.js +1 -2
  161. package/dist/cjs/shared/route/resolvePrecedence.js +1 -2
  162. package/dist/cjs/shared/route/resolveRoute.js +1 -2
  163. package/dist/cjs/shared/route/resolveRouteFunction.js +4 -5
  164. package/dist/cjs/shared/route/resolveRouteString.js +6 -7
  165. package/dist/cjs/shared/route/resolveUrlPathname.js +1 -2
  166. package/dist/cjs/shared/sortPageContext.js +1 -2
  167. package/dist/cjs/types/defineConfig.js +1 -2
  168. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  169. package/dist/cjs/utils/assert.js +10 -11
  170. package/dist/cjs/utils/assertIsBrowser.js +1 -2
  171. package/dist/cjs/utils/assertIsNotBrowser.js +1 -2
  172. package/dist/cjs/utils/assertIsNotProductionRuntime.js +6 -6
  173. package/dist/cjs/utils/assertKeys.js +1 -2
  174. package/dist/cjs/utils/assertNodeEnv.js +5 -6
  175. package/dist/cjs/utils/assertNodeVersion.js +1 -2
  176. package/dist/cjs/utils/assertRoutingType.js +3 -4
  177. package/dist/cjs/utils/assertSingleInstance.js +3 -4
  178. package/dist/cjs/utils/assertVersion.js +2 -3
  179. package/dist/cjs/utils/augmentType.js +1 -2
  180. package/dist/cjs/utils/capitalizeFirstLetter.js +1 -2
  181. package/dist/cjs/utils/cast.js +2 -3
  182. package/dist/cjs/utils/changeEnumerable.js +1 -2
  183. package/dist/cjs/utils/checkType.js +2 -3
  184. package/dist/cjs/utils/compareString.js +1 -2
  185. package/dist/cjs/utils/createErrorWithCleanStackTrace.js +1 -2
  186. package/dist/cjs/utils/debug.js +2 -3
  187. package/dist/cjs/utils/deepEqual.js +1 -2
  188. package/dist/cjs/utils/escapeHtml.js +1 -2
  189. package/dist/cjs/utils/escapeRegex.js +1 -2
  190. package/dist/cjs/utils/filesystemPathHandling.js +2 -3
  191. package/dist/cjs/utils/findFile.js +1 -2
  192. package/dist/cjs/utils/findPackageJson.js +1 -2
  193. package/dist/cjs/utils/formatHintLog.js +1 -2
  194. package/dist/cjs/utils/freezePartial.js +1 -2
  195. package/dist/cjs/utils/genPromise.js +1 -2
  196. package/dist/cjs/utils/getCurrentUrl.js +1 -2
  197. package/dist/cjs/utils/getFileExtension.js +1 -2
  198. package/dist/cjs/utils/getGlobalObject.js +2 -3
  199. package/dist/cjs/utils/getMostSimilar.js +1 -2
  200. package/dist/cjs/utils/getOutDirs.js +2 -3
  201. package/dist/cjs/utils/getPropAccessNotation.js +1 -2
  202. package/dist/cjs/utils/getRandomId.js +1 -2
  203. package/dist/cjs/utils/getTerminWidth.js +1 -2
  204. package/dist/cjs/utils/getValuePrintable.js +1 -2
  205. package/dist/cjs/utils/hasProp.js +1 -2
  206. package/dist/cjs/utils/humanizeTime.js +1 -2
  207. package/dist/cjs/utils/includes.js +1 -2
  208. package/dist/cjs/utils/injectRollupInputs.js +2 -3
  209. package/dist/cjs/utils/isArray.js +1 -2
  210. package/dist/cjs/utils/isArrayOfStrings.js +1 -2
  211. package/dist/cjs/utils/isBrowser.js +1 -2
  212. package/dist/cjs/utils/isCallable.js +1 -2
  213. package/dist/cjs/utils/isDev.js +2 -3
  214. package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +2 -3
  215. package/dist/cjs/utils/isHtml.js +1 -2
  216. package/dist/cjs/utils/isNodeJS.js +1 -2
  217. package/dist/cjs/utils/isNpmPackage.js +5 -6
  218. package/dist/cjs/utils/isObject.js +1 -2
  219. package/dist/cjs/utils/isObjectOfStrings.js +1 -2
  220. package/dist/cjs/utils/isObjectWithKeys.js +1 -2
  221. package/dist/cjs/utils/isPlainObject.js +1 -2
  222. package/dist/cjs/utils/isPromise.js +1 -2
  223. package/dist/cjs/utils/isPropertyGetter.js +1 -2
  224. package/dist/cjs/utils/isReact.js +1 -2
  225. package/dist/cjs/utils/isSameErrorMessage.js +1 -2
  226. package/dist/cjs/utils/isScriptFile.js +4 -4
  227. package/dist/cjs/utils/isVikeReactApp.js +1 -2
  228. package/dist/cjs/utils/isVitest.js +1 -2
  229. package/dist/cjs/utils/joinEnglish.js +1 -2
  230. package/dist/cjs/utils/normalizeHeaders.js +1 -2
  231. package/dist/cjs/utils/objectAssign.js +1 -2
  232. package/dist/cjs/utils/objectDefineProperty.js +1 -2
  233. package/dist/cjs/utils/objectEntries.js +1 -2
  234. package/dist/cjs/utils/objectEntriesForEach.js +1 -2
  235. package/dist/cjs/utils/objectFromEntries.js +1 -2
  236. package/dist/cjs/utils/objectKeys.js +1 -2
  237. package/dist/cjs/utils/onPageVisibilityChange.js +2 -3
  238. package/dist/cjs/utils/pLimit.js +1 -2
  239. package/dist/cjs/utils/parseUrl-extras.js +8 -9
  240. package/dist/cjs/utils/parseUrl.js +11 -12
  241. package/dist/cjs/utils/path-shim.js +1 -2
  242. package/dist/cjs/utils/redirectHard.js +1 -2
  243. package/dist/cjs/utils/removeEmptyLines.js +1 -2
  244. package/dist/cjs/utils/removeFileExtention.js +1 -2
  245. package/dist/cjs/utils/requireResolve.js +1 -2
  246. package/dist/cjs/utils/sleep.js +1 -2
  247. package/dist/cjs/utils/slice.js +1 -2
  248. package/dist/cjs/utils/sorter.js +5 -6
  249. package/dist/cjs/utils/stringifyStringArray.js +1 -2
  250. package/dist/cjs/utils/stripAnsi.js +1 -2
  251. package/dist/cjs/utils/throttle.js +1 -2
  252. package/dist/cjs/utils/trimWithAnsi.js +2 -3
  253. package/dist/cjs/utils/truncateString.js +1 -2
  254. package/dist/cjs/utils/unique.js +1 -2
  255. package/dist/cjs/utils/urlToFile.js +2 -2
  256. package/dist/cjs/utils/virtual-files.js +3 -4
  257. package/dist/cjs/utils/viteIsSSR.js +2 -3
  258. package/dist/cjs/utils/warnIfErrorIsNotObject.js +1 -2
  259. package/dist/esm/client/client-routing-runtime/installClientRouter.js +2 -4
  260. package/dist/esm/client/client-routing-runtime/isClientSideRoutable.js +2 -2
  261. package/dist/esm/client/client-routing-runtime/navigate.js +3 -1
  262. package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +2 -0
  263. package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +39 -12
  264. package/dist/esm/client/client-routing-runtime/skipLink.js +1 -1
  265. package/dist/esm/client/client-routing-runtime/utils.d.ts +1 -0
  266. package/dist/esm/client/client-routing-runtime/utils.js +1 -0
  267. package/dist/esm/client/shared/removeFoucBuster.js +17 -11
  268. package/dist/esm/node/plugin/plugins/fileEnv.js +109 -87
  269. package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +0 -1
  270. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +2 -2
  271. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -2
  272. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +1 -2
  273. package/dist/esm/node/runtime/html/stream.d.ts +0 -1
  274. package/dist/esm/node/runtime/index-deprecated.d.ts +1 -1
  275. package/dist/esm/node/runtime/renderPage/analyzePage.js +4 -4
  276. package/dist/esm/node/runtime/renderPage/createHttpResponse.d.ts +5 -1
  277. package/dist/esm/node/runtime/renderPage/createHttpResponse.js +15 -3
  278. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +0 -1
  279. package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -0
  280. package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.js +1 -1
  281. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +6 -6
  282. package/dist/esm/node/runtime/renderPage.js +6 -6
  283. package/dist/esm/shared/getPageFiles/analyzeClientSide.d.ts +1 -1
  284. package/dist/esm/shared/getPageFiles/analyzeClientSide.js +3 -3
  285. package/dist/esm/shared/page-configs/Config.d.ts +1 -1
  286. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  287. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  288. package/dist/esm/utils/debugGlob.d.ts +2 -2
  289. package/dist/esm/utils/genPromise.d.ts +1 -1
  290. package/dist/esm/utils/projectInfo.d.ts +1 -1
  291. package/package.json +6 -5
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  // Unit tests at ./injectHtmlTags.spec.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.injectAtClosingTag = exports.injectAtOpeningTag = exports.joinHtmlTags = exports.createHtmlHeadIfMissing = exports.injectHtmlTagsUsingStream = exports.injectHtmlTags = void 0;
4
+ exports.injectHtmlTags = injectHtmlTags;
5
+ exports.injectHtmlTagsUsingStream = injectHtmlTagsUsingStream;
6
+ exports.createHtmlHeadIfMissing = createHtmlHeadIfMissing;
7
+ exports.joinHtmlTags = joinHtmlTags;
8
+ exports.injectAtOpeningTag = injectAtOpeningTag;
9
+ exports.injectAtClosingTag = injectAtClosingTag;
5
10
  const utils_js_1 = require("../../utils.js");
6
11
  function injectHtmlTags(htmlString, htmlTags, position) {
7
12
  const htmlFragment = joinHtmlTags(htmlTags.filter((h) => h.position === position));
@@ -10,7 +15,6 @@ function injectHtmlTags(htmlString, htmlTags, position) {
10
15
  }
11
16
  return htmlString;
12
17
  }
13
- exports.injectHtmlTags = injectHtmlTags;
14
18
  // Is it worth it? Should we remove this? https://github.com/vikejs/vike/pull/1740#issuecomment-2230540892
15
19
  function injectHtmlTagsUsingStream(htmlTags, streamFromReactStreamingPackage) {
16
20
  const htmlFragment = joinHtmlTags(htmlTags.filter((h) => h.position === 'HTML_STREAM'));
@@ -19,12 +23,10 @@ function injectHtmlTagsUsingStream(htmlTags, streamFromReactStreamingPackage) {
19
23
  streamFromReactStreamingPackage.injectToStream(htmlFragment, { flush: true });
20
24
  }
21
25
  }
22
- exports.injectHtmlTagsUsingStream = injectHtmlTagsUsingStream;
23
26
  function joinHtmlTags(htmlTags) {
24
27
  const htmlFragment = htmlTags.map((h) => resolveHtmlTag(h.htmlTag)).join('');
25
28
  return htmlFragment;
26
29
  }
27
- exports.joinHtmlTags = joinHtmlTags;
28
30
  function injectHtmlFragment(position, htmlFragment, htmlString) {
29
31
  if (position === 'HTML_BEGIN') {
30
32
  {
@@ -69,7 +71,6 @@ function injectAtOpeningTag(tag, htmlString, htmlFragment) {
69
71
  htmlFragment = injectBreakLines(htmlFragment, before, after);
70
72
  return before + htmlFragment + after;
71
73
  }
72
- exports.injectAtOpeningTag = injectAtOpeningTag;
73
74
  function injectAtClosingTag(tag, htmlString, htmlFragment) {
74
75
  const tagClosing = getTagClosing(tag);
75
76
  const matches = htmlString.match(tagClosing);
@@ -84,7 +85,6 @@ function injectAtClosingTag(tag, htmlString, htmlFragment) {
84
85
  htmlFragment = injectBreakLines(htmlFragment, before, after);
85
86
  return before + htmlFragment + after;
86
87
  }
87
- exports.injectAtClosingTag = injectAtClosingTag;
88
88
  function injectBreakLines(htmlFragment, before, after) {
89
89
  (0, utils_js_1.assert)(htmlFragment.trim() === htmlFragment);
90
90
  const currentLineBefore = before.split('\n').slice(-1)[0];
@@ -130,7 +130,6 @@ function createHtmlHeadIfMissing(htmlString) {
130
130
  assertion();
131
131
  return htmlString;
132
132
  }
133
- exports.createHtmlHeadIfMissing = createHtmlHeadIfMissing;
134
133
  // Pay attention to performance when searching for tags
135
134
  // Use the most effective way to test or match tag existence
136
135
  // Use tag existence checking with caution as it is costly operation
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeScriptTags = void 0;
3
+ exports.mergeScriptTags = mergeScriptTags;
4
4
  const utils_js_1 = require("../../utils.js");
5
5
  const inferHtmlTags_js_1 = require("./inferHtmlTags.js");
6
6
  const scriptRE = /(<script\b(?:\s[^>]*>|>))(.*?)<\/script>/gims;
@@ -42,7 +42,6 @@ function mergeScriptTags(scriptTagsHtml) {
42
42
  }
43
43
  return scriptTag;
44
44
  }
45
- exports.mergeScriptTags = mergeScriptTags;
46
45
  function parseScripts(htmlString) {
47
46
  const scripts = [];
48
47
  let match;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  // Prevent XSS attacks, see https://github.com/vikejs/vike/pull/181#issuecomment-952846026
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.sanitizeJson = void 0;
4
+ exports.sanitizeJson = sanitizeJson;
5
5
  function sanitizeJson(unsafe) {
6
6
  const safe = unsafe.replace(/</g, '\\u003c');
7
7
  return safe;
8
8
  }
9
- exports.sanitizeJson = sanitizeJson;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.injectHtmlTagsToStream = exports.injectHtmlTagsToString = void 0;
3
+ exports.injectHtmlTagsToString = injectHtmlTagsToString;
4
+ exports.injectHtmlTagsToStream = injectHtmlTagsToStream;
4
5
  const utils_js_1 = require("../utils.js");
5
6
  const assertPageContextProvidedByUser_js_1 = require("../../../shared/assertPageContextProvidedByUser.js");
6
7
  const injectHtmlTags_js_1 = require("./injectAssets/injectHtmlTags.js");
@@ -16,7 +17,6 @@ async function injectHtmlTagsToString(htmlParts, pageContext, injectFilter) {
16
17
  (0, utils_js_1.assert)(htmlTags.filter((snippet) => snippet.position === 'HTML_STREAM').length === 0);
17
18
  return htmlString;
18
19
  }
19
- exports.injectHtmlTagsToString = injectHtmlTagsToString;
20
20
  function injectHtmlTagsToStream(pageContext, streamFromReactStreamingPackage, injectFilter) {
21
21
  let htmlTags;
22
22
  return {
@@ -56,7 +56,6 @@ function injectHtmlTagsToStream(pageContext, streamFromReactStreamingPackage, in
56
56
  return htmlEnd;
57
57
  }
58
58
  }
59
- exports.injectHtmlTagsToStream = injectHtmlTagsToStream;
60
59
  function injectToHtmlBegin(htmlBegin, htmlTags) {
61
60
  // Ensure existence of `<head>`
62
61
  htmlBegin = (0, injectHtmlTags_js_1.createHtmlHeadIfMissing)(htmlBegin);
@@ -3,7 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getHtmlString = exports.isDocumentHtml = exports.renderDocumentHtml = exports.dangerouslySkipEscape = exports.escapeInject = void 0;
6
+ exports.escapeInject = escapeInject;
7
+ exports.dangerouslySkipEscape = dangerouslySkipEscape;
8
+ exports.renderDocumentHtml = renderDocumentHtml;
9
+ exports.isDocumentHtml = isDocumentHtml;
10
+ exports.getHtmlString = getHtmlString;
7
11
  const utils_js_1 = require("../utils.js");
8
12
  const injectAssets_js_1 = require("./injectAssets.js");
9
13
  const stream_js_1 = require("./stream.js");
@@ -17,7 +21,6 @@ function isDocumentHtml(something) {
17
21
  }
18
22
  return false;
19
23
  }
20
- exports.isDocumentHtml = isDocumentHtml;
21
24
  async function renderDocumentHtml(documentHtml, pageContext, onErrorWhileStreaming, injectFilter) {
22
25
  if (isEscapedString(documentHtml)) {
23
26
  (0, utils_js_1.objectAssign)(pageContext, { _isStream: false });
@@ -53,7 +56,6 @@ async function renderDocumentHtml(documentHtml, pageContext, onErrorWhileStreami
53
56
  (0, utils_js_1.checkType)(documentHtml);
54
57
  (0, utils_js_1.assert)(false);
55
58
  }
56
- exports.renderDocumentHtml = renderDocumentHtml;
57
59
  async function renderHtmlStream(streamOriginal, injectString, pageContext, onErrorWhileStreaming, injectFilter) {
58
60
  const processStreamOptions = {
59
61
  onErrorWhileStreaming,
@@ -105,11 +107,9 @@ function escapeInject(templateStrings, ...templateVariables) {
105
107
  }
106
108
  };
107
109
  }
108
- exports.escapeInject = escapeInject;
109
110
  function dangerouslySkipEscape(alreadyEscapedString) {
110
111
  return _dangerouslySkipEscape(alreadyEscapedString);
111
112
  }
112
- exports.dangerouslySkipEscape = dangerouslySkipEscape;
113
113
  function _dangerouslySkipEscape(arg) {
114
114
  if ((0, utils_js_1.hasProp)(arg, '_escaped')) {
115
115
  (0, utils_js_1.assert)(isEscapedString(arg));
@@ -234,4 +234,3 @@ async function getHtmlString(htmlRender) {
234
234
  (0, utils_js_1.checkType)(htmlRender);
235
235
  (0, utils_js_1.assert)(false);
236
236
  }
237
- exports.getHtmlString = getHtmlString;
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.serializePageContextAbort = exports.serializePageContextClientSide = void 0;
6
+ exports.serializePageContextClientSide = serializePageContextClientSide;
7
+ exports.serializePageContextAbort = serializePageContextAbort;
7
8
  const stringify_1 = require("@brillout/json-serializer/stringify");
8
9
  const utils_js_1 = require("../utils.js");
9
10
  const error_page_js_1 = require("../../../shared/error-page.js");
@@ -94,7 +95,6 @@ function serializePageContextClientSide(pageContext) {
94
95
  }
95
96
  return pageContextSerialized;
96
97
  }
97
- exports.serializePageContextClientSide = serializePageContextClientSide;
98
98
  function serialize(value, varName) {
99
99
  return (0, stringify_1.stringify)(value, { forbidReactElements: true, valueName: varName });
100
100
  }
@@ -143,4 +143,3 @@ function serializePageContextAbort(pageContext) {
143
143
  }
144
144
  return serialize(pageContext);
145
145
  }
146
- exports.serializePageContextAbort = serializePageContextAbort;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  // Zero-config support for https://www.npmjs.com/package/react-streaming
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getStreamOfReactStreamingPackage = exports.streamFromReactStreamingPackageToString = exports.isStreamFromReactStreamingPackage = void 0;
4
+ exports.isStreamFromReactStreamingPackage = isStreamFromReactStreamingPackage;
5
+ exports.streamFromReactStreamingPackageToString = streamFromReactStreamingPackageToString;
6
+ exports.getStreamOfReactStreamingPackage = getStreamOfReactStreamingPackage;
5
7
  const utils_js_1 = require("../../utils.js");
6
8
  const stream_js_1 = require("../stream.js");
7
9
  function streamFromReactStreamingPackageToString(stream) {
@@ -13,7 +15,6 @@ function streamFromReactStreamingPackageToString(stream) {
13
15
  }
14
16
  (0, utils_js_1.assert)(false);
15
17
  }
16
- exports.streamFromReactStreamingPackageToString = streamFromReactStreamingPackageToString;
17
18
  function isStreamFromReactStreamingPackage(thing) {
18
19
  if ((0, utils_js_1.hasProp)(thing, 'injectToStream', 'function')) {
19
20
  (0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(thing, 'hasStreamEnded', 'function'), (0, utils_js_1.isVikeReactApp)()
@@ -24,7 +25,6 @@ function isStreamFromReactStreamingPackage(thing) {
24
25
  }
25
26
  return false;
26
27
  }
27
- exports.isStreamFromReactStreamingPackage = isStreamFromReactStreamingPackage;
28
28
  function getStreamOfReactStreamingPackage(stream) {
29
29
  if (stream.pipe) {
30
30
  return { __streamPipeNode: stream.pipe };
@@ -34,4 +34,3 @@ function getStreamOfReactStreamingPackage(stream) {
34
34
  }
35
35
  (0, utils_js_1.assert)(false);
36
36
  }
37
- exports.getStreamOfReactStreamingPackage = getStreamOfReactStreamingPackage;
@@ -3,7 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isStreamWritableNode = exports.isStreamWritableWeb = exports.streamPipeNodeToString = exports.streamReadableWebToString = exports.inferStreamName = exports.getStreamName = exports.isStreamReadableNode = exports.isStreamReadableWeb = exports.isStreamPipeNode = exports.isStreamPipeWeb = exports.isStream = exports.pipeToStreamWritableWeb = exports.pipeToStreamWritableNode = exports.getStreamReadableWeb = exports.getStreamReadableNode = exports.pipeNodeStream = exports.pipeWebStream = exports.pipeStream = exports.stampPipe = exports.streamToString = exports.processStream = void 0;
6
+ exports.processStream = processStream;
7
+ exports.streamToString = streamToString;
8
+ exports.stampPipe = stampPipe;
9
+ exports.pipeStream = pipeStream;
10
+ exports.pipeWebStream = pipeWebStream;
11
+ exports.pipeNodeStream = pipeNodeStream;
12
+ exports.getStreamReadableNode = getStreamReadableNode;
13
+ exports.getStreamReadableWeb = getStreamReadableWeb;
14
+ exports.pipeToStreamWritableNode = pipeToStreamWritableNode;
15
+ exports.pipeToStreamWritableWeb = pipeToStreamWritableWeb;
16
+ exports.isStream = isStream;
17
+ exports.isStreamPipeWeb = isStreamPipeWeb;
18
+ exports.isStreamPipeNode = isStreamPipeNode;
19
+ exports.isStreamReadableWeb = isStreamReadableWeb;
20
+ exports.isStreamReadableNode = isStreamReadableNode;
21
+ exports.getStreamName = getStreamName;
22
+ exports.inferStreamName = inferStreamName;
23
+ exports.streamReadableWebToString = streamReadableWebToString;
24
+ exports.streamPipeNodeToString = streamPipeNodeToString;
25
+ exports.isStreamWritableWeb = isStreamWritableWeb;
26
+ exports.isStreamWritableNode = isStreamWritableNode;
7
27
  const utils_js_1 = require("../utils.js");
8
28
  const react_streaming_js_1 = require("./stream/react-streaming.js");
9
29
  const import_1 = require("@brillout/import");
@@ -12,11 +32,9 @@ const debug = (0, utils_js_1.createDebugger)('vike:stream');
12
32
  function isStreamReadableWeb(thing) {
13
33
  return typeof ReadableStream !== 'undefined' && thing instanceof ReadableStream;
14
34
  }
15
- exports.isStreamReadableWeb = isStreamReadableWeb;
16
35
  function isStreamWritableWeb(thing) {
17
36
  return typeof WritableStream !== 'undefined' && thing instanceof WritableStream;
18
37
  }
19
- exports.isStreamWritableWeb = isStreamWritableWeb;
20
38
  function isStreamReadableNode(thing) {
21
39
  if (isStreamReadableWeb(thing)) {
22
40
  return false;
@@ -24,7 +42,6 @@ function isStreamReadableNode(thing) {
24
42
  // https://stackoverflow.com/questions/17009975/how-to-test-if-an-object-is-a-stream-in-nodejs/37022523#37022523
25
43
  return (0, utils_js_1.hasProp)(thing, 'read', 'function');
26
44
  }
27
- exports.isStreamReadableNode = isStreamReadableNode;
28
45
  function isStreamWritableNode(thing) {
29
46
  if (isStreamWritableWeb(thing)) {
30
47
  return false;
@@ -32,7 +49,6 @@ function isStreamWritableNode(thing) {
32
49
  // https://stackoverflow.com/questions/17009975/how-to-test-if-an-object-is-a-stream-in-nodejs/37022523#37022523
33
50
  return (0, utils_js_1.hasProp)(thing, 'write', 'function');
34
51
  }
35
- exports.isStreamWritableNode = isStreamWritableNode;
36
52
  async function streamReadableNodeToString(readableNode) {
37
53
  // Copied from: https://stackoverflow.com/questions/10623798/how-do-i-read-the-contents-of-a-node-js-stream-into-a-string-variable/49428486#49428486
38
54
  const chunks = [];
@@ -55,7 +71,6 @@ async function streamReadableWebToString(readableWeb) {
55
71
  str += getClosingChunk();
56
72
  return str;
57
73
  }
58
- exports.streamReadableWebToString = streamReadableWebToString;
59
74
  async function stringToStreamReadableNode(str) {
60
75
  const { Readable } = await loadStreamNodeModule();
61
76
  return Readable.from(str);
@@ -116,7 +131,6 @@ async function streamPipeNodeToString(streamPipeNode) {
116
131
  streamPipeNode(writable);
117
132
  return promise;
118
133
  }
119
- exports.streamPipeNodeToString = streamPipeNodeToString;
120
134
  function streamPipeWebToString(streamPipeWeb) {
121
135
  const { decode, getClosingChunk } = decodeChunks();
122
136
  let str = '';
@@ -143,7 +157,6 @@ async function getStreamReadableNode(htmlRender) {
143
157
  }
144
158
  return null;
145
159
  }
146
- exports.getStreamReadableNode = getStreamReadableNode;
147
160
  function getStreamReadableWeb(htmlRender) {
148
161
  if (typeof htmlRender === 'string') {
149
162
  return stringToStreamReadableWeb(htmlRender);
@@ -153,7 +166,6 @@ function getStreamReadableWeb(htmlRender) {
153
166
  }
154
167
  return null;
155
168
  }
156
- exports.getStreamReadableWeb = getStreamReadableWeb;
157
169
  function pipeToStreamWritableWeb(htmlRender, writable) {
158
170
  if (typeof htmlRender === 'string') {
159
171
  const streamPipeWeb = stringToStreamPipeWeb(htmlRender);
@@ -176,7 +188,6 @@ function pipeToStreamWritableWeb(htmlRender, writable) {
176
188
  (0, utils_js_1.checkType)(htmlRender);
177
189
  (0, utils_js_1.assert)(false);
178
190
  }
179
- exports.pipeToStreamWritableWeb = pipeToStreamWritableWeb;
180
191
  function pipeToStreamWritableNode(htmlRender, writable) {
181
192
  if (typeof htmlRender === 'string') {
182
193
  const streamPipeNode = stringToStreamPipeNode(htmlRender);
@@ -199,7 +210,6 @@ function pipeToStreamWritableNode(htmlRender, writable) {
199
210
  (0, utils_js_1.checkType)(htmlRender);
200
211
  (0, utils_js_1.assert)(false);
201
212
  }
202
- exports.pipeToStreamWritableNode = pipeToStreamWritableNode;
203
213
  async function processStream(streamOriginal, { injectStringAtBegin, injectStringAfterFirstChunk, injectStringAtEnd, onErrorWhileStreaming, enableEagerStreaming }) {
204
214
  const buffer = [];
205
215
  let streamOriginalHasStartedEmitting = false;
@@ -361,7 +371,6 @@ async function processStream(streamOriginal, { injectStringAtBegin, injectString
361
371
  return !enableEagerStreaming && !streamOriginalHasStartedEmitting;
362
372
  }
363
373
  }
364
- exports.processStream = processStream;
365
374
  async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onFlush, onReadyToWrite }) {
366
375
  if ((0, react_streaming_js_1.isStreamFromReactStreamingPackage)(streamOriginal)) {
367
376
  debug(`onRenderHtml() hook returned ${picocolors_1.default.cyan('react-streaming')} result`);
@@ -626,7 +635,6 @@ function isStream(something) {
626
635
  }
627
636
  return false;
628
637
  }
629
- exports.isStream = isStream;
630
638
  const __streamPipeWeb = '__streamPipeWeb';
631
639
  /** @deprecated */
632
640
  function pipeWebStream(pipe) {
@@ -636,7 +644,6 @@ function pipeWebStream(pipe) {
636
644
  });
637
645
  return { [__streamPipeWeb]: pipe };
638
646
  }
639
- exports.pipeWebStream = pipeWebStream;
640
647
  function getStreamPipeWeb(thing) {
641
648
  if (!isStreamPipeWeb(thing)) {
642
649
  return null;
@@ -663,7 +670,6 @@ function isStreamPipeWeb(thing) {
663
670
  }
664
671
  return false;
665
672
  }
666
- exports.isStreamPipeWeb = isStreamPipeWeb;
667
673
  const __streamPipeNode = '__streamPipeNode';
668
674
  /** @deprecated */
669
675
  function pipeNodeStream(pipe) {
@@ -673,7 +679,6 @@ function pipeNodeStream(pipe) {
673
679
  });
674
680
  return { [__streamPipeNode]: pipe };
675
681
  }
676
- exports.pipeNodeStream = pipeNodeStream;
677
682
  function getStreamPipeNode(thing) {
678
683
  if (!isStreamPipeNode(thing)) {
679
684
  return null;
@@ -700,7 +705,6 @@ function isStreamPipeNode(thing) {
700
705
  }
701
706
  return false;
702
707
  }
703
- exports.isStreamPipeNode = isStreamPipeNode;
704
708
  function stampPipe(pipe, pipeType) {
705
709
  (0, utils_js_1.assertUsage)(pipeType, `stampPipe(pipe, pipeType): argument ${picocolors_1.default.cyan('pipeType')} is missing.)`, {
706
710
  showStackTrace: true
@@ -713,12 +717,10 @@ function stampPipe(pipe, pipeType) {
713
717
  Object.assign(pipe, { isWebStreamPipe: true });
714
718
  }
715
719
  }
716
- exports.stampPipe = stampPipe;
717
720
  const __streamPipe = '__streamPipe';
718
721
  function pipeStream(pipe) {
719
722
  return { [__streamPipe]: pipe };
720
723
  }
721
- exports.pipeStream = pipeStream;
722
724
  async function streamToString(stream) {
723
725
  if (isStreamReadableWeb(stream)) {
724
726
  return await streamReadableWebToString(stream);
@@ -737,7 +739,6 @@ async function streamToString(stream) {
737
739
  }
738
740
  (0, utils_js_1.assert)(false);
739
741
  }
740
- exports.streamToString = streamToString;
741
742
  function assertReadableStreamConstructor() {
742
743
  (0, utils_js_1.assertUsage)(typeof ReadableStream === 'function',
743
744
  // Error message copied from vue's renderToWebStream() implementation
@@ -775,7 +776,6 @@ function getStreamName(kind, type) {
775
776
  }
776
777
  (0, utils_js_1.assert)(false);
777
778
  }
778
- exports.getStreamName = getStreamName;
779
779
  function inferStreamName(stream) {
780
780
  if (isStreamReadableWeb(stream)) {
781
781
  return getStreamName('readable', 'web');
@@ -791,7 +791,6 @@ function inferStreamName(stream) {
791
791
  }
792
792
  (0, utils_js_1.assert)(false);
793
793
  }
794
- exports.inferStreamName = inferStreamName;
795
794
  function decodeChunks() {
796
795
  const decoder = new TextDecoder();
797
796
  const decode = (chunk) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onLoad = void 0;
3
+ exports.onLoad = onLoad;
4
4
  const assertIsNotBrowser_js_1 = require("../../utils/assertIsNotBrowser.js");
5
5
  const assertNodeVersion_js_1 = require("../../utils/assertNodeVersion.js");
6
6
  const require_shim_1 = require("@brillout/require-shim");
@@ -13,4 +13,3 @@ function onLoad() {
13
13
  if ((0, isErrorDebug_js_1.isErrorDebug)())
14
14
  (0, utils_js_1.setAlwaysShowStackTrace)();
15
15
  }
16
- exports.onLoad = onLoad;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPageFilesExports = void 0;
3
+ exports.getPageFilesExports = getPageFilesExports;
4
4
  const utils_js_1 = require("../utils.js");
5
5
  const globalContext_js_1 = require("../globalContext.js");
6
6
  const virtualFileImportUserCode_js_1 = require("../../shared/virtual-files/virtualFileImportUserCode.js");
@@ -20,4 +20,3 @@ async function getPageFilesExports() {
20
20
  (0, utils_js_1.assert)((0, utils_js_1.isObject)(moduleExports));
21
21
  return moduleExports;
22
22
  }
23
- exports.getPageFilesExports = getPageFilesExports;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.analyzePage = void 0;
3
+ exports.analyzePage = analyzePage;
4
4
  const determineClientEntry_js_1 = require("../../../shared/getPageFiles/analyzePageClientSide/determineClientEntry.js");
5
5
  const analyzePageClientSide_js_1 = require("../../../shared/getPageFiles/analyzePageClientSide.js");
6
6
  const virtualFilePageConfigValuesAll_js_1 = require("../../shared/virtual-files/virtualFilePageConfigValuesAll.js");
@@ -9,17 +9,17 @@ const globalContext_js_1 = require("../globalContext.js");
9
9
  const getConfigValue_js_1 = require("../../../shared/page-configs/getConfigValue.js");
10
10
  function analyzePage(pageFilesAll, pageConfig, pageId) {
11
11
  if (pageConfig) {
12
- const { clientEntryLoaded, isClientRouting } = (0, analyzeClientSide_js_1.analyzeClientSide)(pageConfig, pageFilesAll, pageId);
12
+ const { isClientRuntimeLoaded, isClientRouting } = (0, analyzeClientSide_js_1.analyzeClientSide)(pageConfig, pageFilesAll, pageId);
13
13
  const clientEntries = [];
14
14
  const clientFilePath = (0, getConfigValue_js_1.getConfigValueRuntime)(pageConfig, 'client', 'string')?.value ?? null;
15
15
  if (clientFilePath)
16
16
  clientEntries.push(clientFilePath);
17
- if (clientEntryLoaded)
17
+ if (isClientRuntimeLoaded)
18
18
  clientEntries.push((0, determineClientEntry_js_1.getVikeClientEntry)(isClientRouting));
19
19
  const clientDependencies = [];
20
20
  clientDependencies.push({
21
21
  id: (0, virtualFilePageConfigValuesAll_js_1.getVirtualFileIdPageConfigValuesAll)(pageConfig.pageId, true),
22
- onlyAssets: clientEntryLoaded ? false : true,
22
+ onlyAssets: isClientRuntimeLoaded ? false : true,
23
23
  eagerlyImported: false
24
24
  });
25
25
  // In production we inject the import of the server virtual module with ?extractAssets inside the client virtual module
@@ -55,7 +55,7 @@ function analyzePage(pageFilesAll, pageConfig, pageId) {
55
55
  });
56
56
  });
57
57
  return {
58
- isHtmlOnly: !clientEntryLoaded,
58
+ isHtmlOnly: !isClientRuntimeLoaded,
59
59
  isClientRouting,
60
60
  clientEntries,
61
61
  clientDependencies,
@@ -68,4 +68,3 @@ function analyzePage(pageFilesAll, pageConfig, pageId) {
68
68
  return (0, analyzePageClientSide_js_1.analyzePageClientSide)(pageFilesAll, pageId);
69
69
  }
70
70
  }
71
- exports.analyzePage = analyzePage;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assertArguments = void 0;
6
+ exports.assertArguments = assertArguments;
7
7
  const utils_js_1 = require("../utils.js");
8
8
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
9
9
  function assertArguments(...args) {
@@ -40,4 +40,3 @@ function assertArguments(...args) {
40
40
  ` ${picocolors_1.default.cyan('pageContextInit.urlOriginal')} should be a URL but ${picocolors_1.default.cyan(`pageContextInit.urlOriginal === ${JSON.stringify(urlOriginal)}`)}`, { showStackTrace: true });
41
41
  }
42
42
  }
43
- exports.assertArguments = assertArguments;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assertNoInfiniteHttpRedirect = void 0;
6
+ exports.assertNoInfiniteHttpRedirect = assertNoInfiniteHttpRedirect;
7
7
  const utils_js_1 = require("../../utils.js");
8
8
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
9
9
  const globalObject = (0, utils_js_1.getGlobalObject)('assertNoInfiniteHttpRedirect.ts', {
@@ -26,7 +26,6 @@ function assertNoInfiniteHttpRedirect(urlRedirectTarget, urlLogical) {
26
26
  validate(graph);
27
27
  globalObject.redirectGraph = graph;
28
28
  }
29
- exports.assertNoInfiniteHttpRedirect = assertNoInfiniteHttpRedirect;
30
29
  function copy(G) {
31
30
  return Object.fromEntries(Object.entries(G).map(([key, val]) => [key, new Set(val)]));
32
31
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCacheControl = void 0;
3
+ exports.getCacheControl = getCacheControl;
4
4
  const helpers_js_1 = require("../../../../shared/page-configs/helpers.js");
5
5
  const getConfigValue_js_1 = require("../../../../shared/page-configs/getConfigValue.js");
6
6
  const defaultValue = 'no-store, max-age=0';
@@ -18,4 +18,3 @@ function getCacheControl(pageId, pageConfigs) {
18
18
  // - When there isn't any <script id="vike_pageContext" type="application/json"> then we can safely have caching. (We don't implement this exception because we're lazy and it's quite a rare situation.)
19
19
  return defaultValue;
20
20
  }
21
- exports.getCacheControl = getCacheControl;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createHttpResponseFavicon404 = exports.createHttpResponseRedirect = exports.createHttpResponseError = exports.createHttpResponsePageContextJson = exports.createHttpResponsePage = void 0;
3
+ exports.createHttpResponsePage = createHttpResponsePage;
4
+ exports.createHttpResponsePageContextJson = createHttpResponsePageContextJson;
5
+ exports.createHttpResponseError = createHttpResponseError;
6
+ exports.createHttpResponseRedirect = createHttpResponseRedirect;
7
+ exports.createHttpResponseFavicon404 = createHttpResponseFavicon404;
4
8
  const utils_js_1 = require("../utils.js");
5
9
  const error_page_js_1 = require("../../../shared/error-page.js");
6
10
  const getHttpResponseBody_js_1 = require("./getHttpResponseBody.js");
@@ -32,22 +36,30 @@ async function createHttpResponsePage(htmlRender, renderHook, pageContext) {
32
36
  }
33
37
  return createHttpResponse(statusCode, 'text/html;charset=utf-8', headers, htmlRender, earlyHints, renderHook);
34
38
  }
35
- exports.createHttpResponsePage = createHttpResponsePage;
36
39
  function createHttpResponseFavicon404() {
37
40
  const httpResponse = createHttpResponse(404, 'text/html;charset=utf-8', [], "<p>No favicon.ico found.</p><script>console.log('This HTTP response was generated by Vike.')</script>");
38
41
  return httpResponse;
39
42
  }
40
- exports.createHttpResponseFavicon404 = createHttpResponseFavicon404;
41
- function createHttpResponseError() {
42
- const httpResponse = createHttpResponse(500, 'text/html;charset=utf-8', [], "<p>An error occurred.</p><script>console.log('This HTTP response was generated by Vike. This response is used instead of rendering the error page (https://vike.dev/error-page), either because there isn't error page or because an error occurred while rendering the error page.')</script>");
43
+ function createHttpResponseError(pageContext) {
44
+ const reason = (() => {
45
+ if (!pageContext) {
46
+ return 'no error page (https://vike.dev/error-page) could be rendered';
47
+ }
48
+ const errorPageId = (0, error_page_js_1.getErrorPageId)(pageContext._pageFilesAll, pageContext._pageConfigs);
49
+ if (errorPageId) {
50
+ return "the error page (https://vike.dev/error-page) couldn't be rendered (for example if an error occurred while rendering the error page)";
51
+ }
52
+ else {
53
+ return 'no error page (https://vike.dev/error-page) is defined, make sure to create one';
54
+ }
55
+ })();
56
+ const httpResponse = createHttpResponse(500, 'text/html;charset=utf-8', [], `<p>An error occurred.</p><script>console.log(${JSON.stringify(`This HTTP response was generated by Vike. Vike returned this response because ${reason}.`)})</script>`);
43
57
  return httpResponse;
44
58
  }
45
- exports.createHttpResponseError = createHttpResponseError;
46
59
  async function createHttpResponsePageContextJson(pageContextSerialized) {
47
60
  const httpResponse = createHttpResponse(200, 'application/json', [], pageContextSerialized, [], null);
48
61
  return httpResponse;
49
62
  }
50
- exports.createHttpResponsePageContextJson = createHttpResponsePageContextJson;
51
63
  function createHttpResponseRedirect({ url, statusCode },
52
64
  // The URL we assume the redirect to be logically based on
53
65
  urlLogical) {
@@ -61,7 +73,6 @@ urlLogical) {
61
73
  // For users: showing a blank page is probably better than a flickering text.
62
74
  `<p style="display: none">Redirecting to ${url}</p><script>console.log('This HTTP response was generated by Vike.')</script>`);
63
75
  }
64
- exports.createHttpResponseRedirect = createHttpResponseRedirect;
65
76
  function createHttpResponse(statusCode, contentType, headers, htmlRender, earlyHints = [], renderHook = null) {
66
77
  headers.push(['Content-Type', contentType]);
67
78
  (0, utils_js_1.assert)(renderHook || typeof htmlRender === 'string');
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.debugPageFiles = void 0;
6
+ exports.debugPageFiles = debugPageFiles;
7
7
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
8
8
  const utils_js_1 = require("../utils.js");
9
9
  function debugPageFiles({ pageContext, isHtmlOnly, isClientRouting, pageFilesLoaded, pageFilesServerSide, pageFilesClientSide, clientEntries, clientDependencies }) {
@@ -46,7 +46,6 @@ function debugPageFiles({ pageContext, isHtmlOnly, isClientRouting, pageFilesLoa
46
46
  .join('\n'));
47
47
  }
48
48
  }
49
- exports.debugPageFiles = debugPageFiles;
50
49
  function samePageFiles(pageFiles1, pageFiles2) {
51
50
  return (pageFiles1.every((p1) => pageFiles2.some((p2) => p2.filePath === p1.filePath)) &&
52
51
  pageFiles2.every((p2) => pageFiles1.some((p1) => p1.filePath === p2.filePath)));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.executeOnBeforeRenderAndDataHooks = void 0;
3
+ exports.executeOnBeforeRenderAndDataHooks = executeOnBeforeRenderAndDataHooks;
4
4
  const getHook_js_1 = require("../../../shared/hooks/getHook.js");
5
5
  const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePageContextForUserConsumptionServerSide.js");
6
6
  const assertOnBeforeRenderHookReturn_js_1 = require("../../../shared/assertOnBeforeRenderHookReturn.js");
@@ -30,4 +30,3 @@ async function executeOnBeforeRenderAndDataHooks(pageContext) {
30
30
  Object.assign(pageContext, pageContextFromHook);
31
31
  }
32
32
  }
33
- exports.executeOnBeforeRenderAndDataHooks = executeOnBeforeRenderAndDataHooks;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.executeOnRenderHtmlHook = void 0;
6
+ exports.executeOnRenderHtmlHook = executeOnRenderHtmlHook;
7
7
  const renderHtml_js_1 = require("../html/renderHtml.js");
8
8
  const getHook_js_1 = require("../../../shared/hooks/getHook.js");
9
9
  const utils_js_1 = require("../utils.js");
@@ -36,7 +36,6 @@ async function executeOnRenderHtmlHook(pageContext) {
36
36
  (0, utils_js_1.assert)(typeof htmlRender === 'string' || (0, stream_js_1.isStream)(htmlRender));
37
37
  return { htmlRender, renderHook };
38
38
  }
39
- exports.executeOnRenderHtmlHook = executeOnRenderHtmlHook;
40
39
  function getRenderHook(pageContext) {
41
40
  let hookFound;
42
41
  {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEarlyHints = void 0;
3
+ exports.getEarlyHints = getEarlyHints;
4
4
  const inferHtmlTags_js_1 = require("../html/injectAssets/inferHtmlTags.js");
5
5
  const utils_js_1 = require("../utils.js");
6
6
  function getEarlyHints(assets) {
@@ -18,7 +18,6 @@ function getEarlyHints(assets) {
18
18
  }
19
19
  return earlyHints;
20
20
  }
21
- exports.getEarlyHints = getEarlyHints;
22
21
  function isFontFallback(asset, earlyHints) {
23
22
  if (asset.assetType !== 'font') {
24
23
  return false;