vike 0.4.239-commit-59f1017 → 0.4.239-commit-4d0d950

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 (415) hide show
  1. package/dist/esm/client/runtime-client-routing/entry.js +5 -0
  2. package/dist/esm/client/runtime-client-routing/globalContext.d.ts +1 -1
  3. package/dist/esm/client/runtime-client-routing/globalContext.js +9 -3
  4. package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +1 -0
  5. package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
  6. package/dist/esm/client/runtime-server-routing/entry.js +5 -0
  7. package/dist/esm/client/runtime-server-routing/globalContext.d.ts +2 -2
  8. package/dist/esm/client/runtime-server-routing/globalContext.js +7 -3
  9. package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +4 -3
  10. package/dist/esm/client/shared/createGetGlobalContextClient.js +38 -34
  11. package/dist/esm/node/vite/index.js +34 -15
  12. package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
  13. package/dist/esm/node/vite/plugins/pluginBaseUrls.js +37 -35
  14. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.d.ts +1 -1
  15. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +82 -80
  16. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.d.ts +1 -1
  17. package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +23 -21
  18. package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.d.ts +1 -1
  19. package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +38 -36
  20. package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.d.ts +1 -1
  21. package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +26 -24
  22. package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
  23. package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +1 -1
  24. package/dist/esm/node/vite/plugins/pluginEnvVars.js +87 -65
  25. package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
  26. package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +29 -27
  27. package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
  28. package/dist/esm/node/vite/plugins/pluginFileEnv.js +75 -73
  29. package/dist/esm/node/vite/plugins/pluginNonRunnableDev.d.ts +1 -1
  30. package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +30 -28
  31. package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
  32. package/dist/esm/node/vite/plugins/pluginPreview.js +35 -33
  33. package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.d.ts +9 -0
  34. package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.js +45 -0
  35. package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.d.ts +3 -0
  36. package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.js +89 -0
  37. package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
  38. package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +50 -48
  39. package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
  40. package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +12 -10
  41. package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
  42. package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
  43. package/dist/esm/shared/createGlobalContextShared.js +1 -0
  44. package/dist/esm/shared/route/abort.d.ts +22 -11
  45. package/dist/esm/shared/route/abort.js +37 -5
  46. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  47. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  48. package/dist/esm/utils/findPackageJson.js +0 -1
  49. package/dist/esm/utils/getViteRPC.js +0 -2
  50. package/dist/esm/utils/requireResolve.js +0 -1
  51. package/package.json +2 -21
  52. package/dist/cjs/__internal/index.js +0 -35
  53. package/dist/cjs/client/runtime-client-routing/globalContext.js +0 -49
  54. package/dist/cjs/client/runtime-client-routing/prefetch/PrefetchSetting.js +0 -2
  55. package/dist/cjs/client/runtime-server-routing/globalContext.js +0 -41
  56. package/dist/cjs/client/runtime-server-routing/onLoad.js +0 -7
  57. package/dist/cjs/client/runtime-server-routing/utils.js +0 -34
  58. package/dist/cjs/client/shared/createGetGlobalContextClient.js +0 -65
  59. package/dist/cjs/client/shared/getJsonSerializedInHtml.js +0 -40
  60. package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +0 -41
  61. package/dist/cjs/client/shared/utils.js +0 -23
  62. package/dist/cjs/node/api/build.js +0 -24
  63. package/dist/cjs/node/api/context.js +0 -23
  64. package/dist/cjs/node/api/dev.js +0 -18
  65. package/dist/cjs/node/api/index.js +0 -44
  66. package/dist/cjs/node/api/onLoad.js +0 -9
  67. package/dist/cjs/node/api/prepareViteApiCall.js +0 -206
  68. package/dist/cjs/node/api/prerender.js +0 -18
  69. package/dist/cjs/node/api/preview.js +0 -38
  70. package/dist/cjs/node/api/types.js +0 -2
  71. package/dist/cjs/node/api/utils.js +0 -27
  72. package/dist/cjs/node/cli/context.js +0 -17
  73. package/dist/cjs/node/cli/entry.js +0 -121
  74. package/dist/cjs/node/cli/index.js +0 -12
  75. package/dist/cjs/node/cli/onLoad.js +0 -9
  76. package/dist/cjs/node/cli/parseCli.js +0 -95
  77. package/dist/cjs/node/cli/utils.js +0 -24
  78. package/dist/cjs/node/client/router.js +0 -19
  79. package/dist/cjs/node/createPageRenderer.js +0 -132
  80. package/dist/cjs/node/importBuild.js +0 -3
  81. package/dist/cjs/node/prerender/context.js +0 -26
  82. package/dist/cjs/node/prerender/index.js +0 -12
  83. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +0 -66
  84. package/dist/cjs/node/prerender/runPrerender.js +0 -778
  85. package/dist/cjs/node/prerender/runPrerenderEntry.js +0 -55
  86. package/dist/cjs/node/prerender/utils.js +0 -37
  87. package/dist/cjs/node/runtime/globalContext.js +0 -582
  88. package/dist/cjs/node/runtime/index-deprecated.js +0 -33
  89. package/dist/cjs/node/runtime/index.js +0 -74
  90. package/dist/cjs/node/runtime/loggerRuntime.js +0 -17
  91. package/dist/cjs/node/runtime/onLoad.js +0 -29
  92. package/dist/cjs/node/runtime/page-files/setup.js +0 -5
  93. package/dist/cjs/node/runtime/renderPage/analyzePage.js +0 -71
  94. package/dist/cjs/node/runtime/renderPage/assertArguments.js +0 -42
  95. package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +0 -51
  96. package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -114
  97. package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +0 -59
  98. package/dist/cjs/node/runtime/renderPage/csp.js +0 -47
  99. package/dist/cjs/node/runtime/renderPage/execHookDataAndOnBeforeRender.js +0 -31
  100. package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +0 -120
  101. package/dist/cjs/node/runtime/renderPage/execHookServer.js +0 -8
  102. package/dist/cjs/node/runtime/renderPage/getCacheControl.js +0 -24
  103. package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +0 -20
  104. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +0 -137
  105. package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +0 -125
  106. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsDev.js +0 -86
  107. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsProd.js +0 -77
  108. package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +0 -36
  109. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +0 -50
  110. package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +0 -41
  111. package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +0 -68
  112. package/dist/cjs/node/runtime/renderPage/headersResponse.js +0 -48
  113. package/dist/cjs/node/runtime/renderPage/html/injectAssets/getHtmlTags.js +0 -269
  114. package/dist/cjs/node/runtime/renderPage/html/injectAssets/getViteDevScript.js +0 -32
  115. package/dist/cjs/node/runtime/renderPage/html/injectAssets/inferHtmlTags.js +0 -55
  116. package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectAssets__public.js +0 -31
  117. package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectHtmlTags.js +0 -161
  118. package/dist/cjs/node/runtime/renderPage/html/injectAssets/mergeScriptTags.js +0 -73
  119. package/dist/cjs/node/runtime/renderPage/html/injectAssets/sanitizeJson.js +0 -8
  120. package/dist/cjs/node/runtime/renderPage/html/injectAssets.js +0 -93
  121. package/dist/cjs/node/runtime/renderPage/html/propKeys.js +0 -47
  122. package/dist/cjs/node/runtime/renderPage/html/renderHtml.js +0 -245
  123. package/dist/cjs/node/runtime/renderPage/html/serializeContext.js +0 -189
  124. package/dist/cjs/node/runtime/renderPage/html/stream/react-streaming.js +0 -36
  125. package/dist/cjs/node/runtime/renderPage/html/stream.js +0 -829
  126. package/dist/cjs/node/runtime/renderPage/inferMediaType.js +0 -81
  127. package/dist/cjs/node/runtime/renderPage/isFontFallback.js +0 -29
  128. package/dist/cjs/node/runtime/renderPage/isNewError.js +0 -25
  129. package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +0 -124
  130. package/dist/cjs/node/runtime/renderPage/log404/index.js +0 -154
  131. package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +0 -20
  132. package/dist/cjs/node/runtime/renderPage/logErrorHint.js +0 -200
  133. package/dist/cjs/node/runtime/renderPage/loggerProd.js +0 -34
  134. package/dist/cjs/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +0 -10
  135. package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +0 -83
  136. package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +0 -71
  137. package/dist/cjs/node/runtime/renderPage.js +0 -502
  138. package/dist/cjs/node/runtime/universal-middleware.js +0 -20
  139. package/dist/cjs/node/runtime/utils.js +0 -83
  140. package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -27
  141. package/dist/cjs/node/runtime-dev/index.js +0 -42
  142. package/dist/cjs/node/shared/assertV1Design.js +0 -30
  143. package/dist/cjs/node/shared/extractAssetsQuery.js +0 -29
  144. package/dist/cjs/node/shared/getVikeConfigError.js +0 -22
  145. package/dist/cjs/node/shared/isErrorDebug.js +0 -7
  146. package/dist/cjs/node/shared/prependEntriesDir.js +0 -13
  147. package/dist/cjs/node/shared/resolveBase.js +0 -35
  148. package/dist/cjs/node/shared/utils.js +0 -35
  149. package/dist/cjs/node/shared/virtualFileId.js +0 -110
  150. package/dist/cjs/node/vite/index.js +0 -69
  151. package/dist/cjs/node/vite/onLoad.js +0 -21
  152. package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +0 -52
  153. package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -357
  154. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -183
  155. package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -234
  156. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -256
  157. package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -40
  158. package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -49
  159. package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -111
  160. package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -65
  161. package/dist/cjs/node/vite/plugins/pluginBuild.js +0 -22
  162. package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +0 -88
  163. package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -183
  164. package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -28
  165. package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +0 -163
  166. package/dist/cjs/node/vite/plugins/pluginDev.js +0 -111
  167. package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -92
  168. package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -241
  169. package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -113
  170. package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -172
  171. package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -70
  172. package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -82
  173. package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -95
  174. package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -51
  175. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/debug.js +0 -5
  176. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +0 -56
  177. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +0 -190
  178. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +0 -54
  179. package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +0 -97
  180. package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +0 -233
  181. package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -17
  182. package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +0 -35
  183. package/dist/cjs/node/vite/shared/addSsrMiddleware.js +0 -60
  184. package/dist/cjs/node/vite/shared/findPageFiles.js +0 -25
  185. package/dist/cjs/node/vite/shared/getAssetsDir.js +0 -10
  186. package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +0 -42
  187. package/dist/cjs/node/vite/shared/getEnvVarObject.js +0 -37
  188. package/dist/cjs/node/vite/shared/getFilePath.js +0 -172
  189. package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +0 -125
  190. package/dist/cjs/node/vite/shared/getMagicString.js +0 -18
  191. package/dist/cjs/node/vite/shared/getManifestFilePathRelative.js +0 -10
  192. package/dist/cjs/node/vite/shared/getOutDirs.js +0 -146
  193. package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +0 -21
  194. package/dist/cjs/node/vite/shared/isAsset.js +0 -40
  195. package/dist/cjs/node/vite/shared/isViteCliCall.js +0 -83
  196. package/dist/cjs/node/vite/shared/isViteServerSide.js +0 -68
  197. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +0 -15
  198. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +0 -15
  199. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +0 -38
  200. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +0 -26
  201. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +0 -85
  202. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +0 -30
  203. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +0 -19
  204. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +0 -19
  205. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +0 -29
  206. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +0 -13
  207. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +0 -15
  208. package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +0 -162
  209. package/dist/cjs/node/vite/shared/loggerNotProd/log.js +0 -102
  210. package/dist/cjs/node/vite/shared/loggerNotProd.js +0 -208
  211. package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +0 -26
  212. package/dist/cjs/node/vite/shared/loggerVite.js +0 -54
  213. package/dist/cjs/node/vite/shared/normalizeId.js +0 -9
  214. package/dist/cjs/node/vite/shared/parseEsModule.js +0 -33
  215. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +0 -136
  216. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +0 -262
  217. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +0 -18
  218. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +0 -252
  219. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +0 -190
  220. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getConfigFileExport.js +0 -17
  221. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +0 -127
  222. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +0 -129
  223. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +0 -195
  224. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +0 -102
  225. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +0 -425
  226. package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +0 -1151
  227. package/dist/cjs/node/vite/shared/rollupIsEsm.js +0 -15
  228. package/dist/cjs/node/vite/utils.js +0 -45
  229. package/dist/cjs/package.json +0 -1
  230. package/dist/cjs/shared/NOT_SERIALIZABLE.js +0 -4
  231. package/dist/cjs/shared/RenderErrorPage.js +0 -6
  232. package/dist/cjs/shared/abort.js +0 -16
  233. package/dist/cjs/shared/addIs404ToPageProps.js +0 -18
  234. package/dist/cjs/shared/assertHookReturnedObject.js +0 -21
  235. package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +0 -21
  236. package/dist/cjs/shared/assertPageContextProvidedByUser.js +0 -20
  237. package/dist/cjs/shared/createGlobalContextShared.js +0 -109
  238. package/dist/cjs/shared/createPageContextShared.js +0 -17
  239. package/dist/cjs/shared/determinePageIdOld.js +0 -11
  240. package/dist/cjs/shared/error-page.js +0 -40
  241. package/dist/cjs/shared/getPageContext.js +0 -6
  242. package/dist/cjs/shared/getPageContextRequestUrl.js +0 -16
  243. package/dist/cjs/shared/getPageContextUrlComputed.js +0 -132
  244. package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +0 -19
  245. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +0 -2
  246. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +0 -50
  247. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +0 -30
  248. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +0 -15
  249. package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +0 -59
  250. package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +0 -22
  251. package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +0 -24
  252. package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -52
  253. package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -102
  254. package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -56
  255. package/dist/cjs/shared/getPageFiles/parseVirtualFileExportsGlobalEntry.js +0 -100
  256. package/dist/cjs/shared/getPageFiles.js +0 -7
  257. package/dist/cjs/shared/getProxyForPublicUsage.js +0 -56
  258. package/dist/cjs/shared/hooks/execHook.js +0 -147
  259. package/dist/cjs/shared/hooks/getHook.js +0 -173
  260. package/dist/cjs/shared/htmlElementIds.js +0 -5
  261. package/dist/cjs/shared/misc/isServerSideError.js +0 -4
  262. package/dist/cjs/shared/misc/pageContextInitIsPassedToClient.js +0 -4
  263. package/dist/cjs/shared/modifyUrl.js +0 -28
  264. package/dist/cjs/shared/modifyUrlSameOrigin.js +0 -47
  265. package/dist/cjs/shared/page-configs/assertPlusFileExport.js +0 -42
  266. package/dist/cjs/shared/page-configs/findPageConfig.js +0 -10
  267. package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +0 -65
  268. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -68
  269. package/dist/cjs/shared/page-configs/getConfigValueRuntime.js +0 -10
  270. package/dist/cjs/shared/page-configs/getConfigValueTyped.js +0 -32
  271. package/dist/cjs/shared/page-configs/getExportPath.js +0 -29
  272. package/dist/cjs/shared/page-configs/helpers.js +0 -27
  273. package/dist/cjs/shared/page-configs/loadAndParseVirtualFilePageEntry.js +0 -25
  274. package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +0 -287
  275. package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +0 -2
  276. package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -1
  277. package/dist/cjs/shared/page-configs/serialize/parsePageConfigsSerialized.js +0 -145
  278. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +0 -290
  279. package/dist/cjs/shared/prepareGlobalContextForPublicUsage.js +0 -10
  280. package/dist/cjs/shared/preparePageContextForPublicUsage.js +0 -80
  281. package/dist/cjs/shared/route/abort.js +0 -178
  282. package/dist/cjs/shared/route/debug.js +0 -23
  283. package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +0 -52
  284. package/dist/cjs/shared/route/execHookGuard.js +0 -37
  285. package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -84
  286. package/dist/cjs/shared/route/index.js +0 -107
  287. package/dist/cjs/shared/route/loadPageRoutes.js +0 -197
  288. package/dist/cjs/shared/route/noRouteMatch.js +0 -4
  289. package/dist/cjs/shared/route/resolvePrecedence.js +0 -93
  290. package/dist/cjs/shared/route/resolveRoute.js +0 -20
  291. package/dist/cjs/shared/route/resolveRouteFunction.js +0 -73
  292. package/dist/cjs/shared/route/resolveRouteString.js +0 -153
  293. package/dist/cjs/shared/route/resolveUrlPathname.js +0 -47
  294. package/dist/cjs/shared/route/routing.js +0 -9
  295. package/dist/cjs/shared/route/utils.js +0 -40
  296. package/dist/cjs/shared/utils.js +0 -49
  297. package/dist/cjs/types/Config/ConfigResolved.js +0 -2
  298. package/dist/cjs/types/Config.js +0 -2
  299. package/dist/cjs/types/FilePath.js +0 -2
  300. package/dist/cjs/types/PageConfig.js +0 -2
  301. package/dist/cjs/types/PageContext.js +0 -2
  302. package/dist/cjs/types/VikeGlobalInternal.js +0 -2
  303. package/dist/cjs/types/VikeNamespace.js +0 -2
  304. package/dist/cjs/types/ViteManifest.js +0 -2
  305. package/dist/cjs/types/defineConfig.js +0 -6
  306. package/dist/cjs/types/index-dreprecated.js +0 -3
  307. package/dist/cjs/types/index.js +0 -5
  308. package/dist/cjs/utils/PROJECT_VERSION.js +0 -5
  309. package/dist/cjs/utils/PromiseType.js +0 -2
  310. package/dist/cjs/utils/assert.js +0 -211
  311. package/dist/cjs/utils/assertIsBrowser.js +0 -8
  312. package/dist/cjs/utils/assertIsNotBrowser.js +0 -9
  313. package/dist/cjs/utils/assertKeys.js +0 -27
  314. package/dist/cjs/utils/assertNodeVersion.js +0 -14
  315. package/dist/cjs/utils/assertRoutingType.js +0 -29
  316. package/dist/cjs/utils/assertSetup.js +0 -171
  317. package/dist/cjs/utils/assertSingleInstance.js +0 -110
  318. package/dist/cjs/utils/assertVersion.js +0 -60
  319. package/dist/cjs/utils/capitalizeFirstLetter.js +0 -9
  320. package/dist/cjs/utils/cast.js +0 -6
  321. package/dist/cjs/utils/catchInfiniteLoop.js +0 -34
  322. package/dist/cjs/utils/changeEnumerable.js +0 -8
  323. package/dist/cjs/utils/checkType.js +0 -6
  324. package/dist/cjs/utils/compareString.js +0 -10
  325. package/dist/cjs/utils/createErrorWithCleanStackTrace.js +0 -39
  326. package/dist/cjs/utils/debug.js +0 -178
  327. package/dist/cjs/utils/debugGlob.js +0 -6
  328. package/dist/cjs/utils/deepEqual.js +0 -10
  329. package/dist/cjs/utils/escapeHtml.js +0 -13
  330. package/dist/cjs/utils/escapeRegex.js +0 -7
  331. package/dist/cjs/utils/findFile.js +0 -30
  332. package/dist/cjs/utils/findPackageJson.js +0 -18
  333. package/dist/cjs/utils/formatHintLog.js +0 -17
  334. package/dist/cjs/utils/freezePartial.js +0 -35
  335. package/dist/cjs/utils/genPromise.js +0 -51
  336. package/dist/cjs/utils/getFileExtension.js +0 -16
  337. package/dist/cjs/utils/getGlobalObject.js +0 -15
  338. package/dist/cjs/utils/getMostSimilar.js +0 -68
  339. package/dist/cjs/utils/getPropAccessNotation.js +0 -9
  340. package/dist/cjs/utils/getRandomId.js +0 -14
  341. package/dist/cjs/utils/getTerminalWidth.js +0 -7
  342. package/dist/cjs/utils/getValuePrintable.js +0 -10
  343. package/dist/cjs/utils/getViteRPC.js +0 -79
  344. package/dist/cjs/utils/hasProp.js +0 -50
  345. package/dist/cjs/utils/humanizeTime.js +0 -24
  346. package/dist/cjs/utils/includes.js +0 -13
  347. package/dist/cjs/utils/injectRollupInputs.js +0 -29
  348. package/dist/cjs/utils/isArray.js +0 -7
  349. package/dist/cjs/utils/isArrayOfStrings.js +0 -7
  350. package/dist/cjs/utils/isBrowser.js +0 -8
  351. package/dist/cjs/utils/isCallable.js +0 -6
  352. package/dist/cjs/utils/isDev.js +0 -20
  353. package/dist/cjs/utils/isDocker.js +0 -45
  354. package/dist/cjs/utils/isEqualStringList.js +0 -13
  355. package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +0 -66
  356. package/dist/cjs/utils/isHtml.js +0 -9
  357. package/dist/cjs/utils/isImportPath.js +0 -21
  358. package/dist/cjs/utils/isNodeJS.js +0 -16
  359. package/dist/cjs/utils/isNonRunnableDev.js +0 -12
  360. package/dist/cjs/utils/isNullish.js +0 -16
  361. package/dist/cjs/utils/isObject.js +0 -6
  362. package/dist/cjs/utils/isObjectOfStrings.js +0 -7
  363. package/dist/cjs/utils/isObjectWithKeys.js +0 -15
  364. package/dist/cjs/utils/isPlainObject.js +0 -19
  365. package/dist/cjs/utils/isPromise.js +0 -7
  366. package/dist/cjs/utils/isPropertyGetter.js +0 -7
  367. package/dist/cjs/utils/isReact.js +0 -23
  368. package/dist/cjs/utils/isRunnableDevEnvironment.js +0 -9
  369. package/dist/cjs/utils/isSameErrorMessage.js +0 -9
  370. package/dist/cjs/utils/isScriptFile.js +0 -67
  371. package/dist/cjs/utils/isVikeReactApp.js +0 -8
  372. package/dist/cjs/utils/isVitest.js +0 -6
  373. package/dist/cjs/utils/joinEnglish.js +0 -14
  374. package/dist/cjs/utils/normalizeHeaders.js +0 -17
  375. package/dist/cjs/utils/objectAssign.js +0 -14
  376. package/dist/cjs/utils/objectAssignSafe.js +0 -7
  377. package/dist/cjs/utils/objectDefineProperty.js +0 -7
  378. package/dist/cjs/utils/objectEntries.js +0 -8
  379. package/dist/cjs/utils/objectEntriesForEach.js +0 -7
  380. package/dist/cjs/utils/objectFilter.js +0 -10
  381. package/dist/cjs/utils/objectFromEntries.js +0 -7
  382. package/dist/cjs/utils/objectKeys.js +0 -9
  383. package/dist/cjs/utils/objectReplace.js +0 -9
  384. package/dist/cjs/utils/onPageVisibilityChange.js +0 -18
  385. package/dist/cjs/utils/pLimit.js +0 -134
  386. package/dist/cjs/utils/parseNpmPackage.js +0 -106
  387. package/dist/cjs/utils/parseUrl-extras.js +0 -110
  388. package/dist/cjs/utils/parseUrl.js +0 -338
  389. package/dist/cjs/utils/path.js +0 -59
  390. package/dist/cjs/utils/pick.js +0 -12
  391. package/dist/cjs/utils/preservePropertyGetters.js +0 -30
  392. package/dist/cjs/utils/redirectHard.js +0 -6
  393. package/dist/cjs/utils/removeEmptyLines.js +0 -9
  394. package/dist/cjs/utils/removeFileExtension.js +0 -6
  395. package/dist/cjs/utils/requireResolve.js +0 -214
  396. package/dist/cjs/utils/rollupSourceMap.js +0 -19
  397. package/dist/cjs/utils/sleep.js +0 -6
  398. package/dist/cjs/utils/slice.js +0 -35
  399. package/dist/cjs/utils/sorter.js +0 -117
  400. package/dist/cjs/utils/stringifyStringArray.js +0 -6
  401. package/dist/cjs/utils/stripAnsi.js +0 -21
  402. package/dist/cjs/utils/styleFileRE.js +0 -6
  403. package/dist/cjs/utils/throttle.js +0 -15
  404. package/dist/cjs/utils/trackLogs.js +0 -31
  405. package/dist/cjs/utils/trimWithAnsi.js +0 -40
  406. package/dist/cjs/utils/truncateString.js +0 -23
  407. package/dist/cjs/utils/unique.js +0 -6
  408. package/dist/cjs/utils/updateType.js +0 -9
  409. package/dist/cjs/utils/urlToFile.js +0 -36
  410. package/dist/cjs/utils/virtualFileId.js +0 -43
  411. package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
  412. package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
  413. package/dist/esm/node/vite/plugins/pluginBuild.js +0 -20
  414. package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -14
  415. package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -92
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inferMediaType = inferMediaType;
4
- const utils_js_1 = require("../utils.js");
5
- function inferMediaType(href) {
6
- // Basics
7
- if (utils_js_1.styleFileRE.test(href)) {
8
- return { mediaType: 'text/css', assetType: 'style' };
9
- }
10
- if ((0, utils_js_1.isScriptFile)(href)) {
11
- return { mediaType: 'text/javascript', assetType: 'script' };
12
- }
13
- // Images
14
- if (href.endsWith('.png')) {
15
- return { assetType: 'image', mediaType: 'image/png' };
16
- }
17
- if (href.endsWith('.webp')) {
18
- return { assetType: 'image', mediaType: 'image/webp' };
19
- }
20
- if (href.endsWith('.jpg') || href.endsWith('.jpeg')) {
21
- return { assetType: 'image', mediaType: 'image/jpeg' };
22
- }
23
- if (href.endsWith('.gif')) {
24
- return { assetType: 'image', mediaType: 'image/gif' };
25
- }
26
- if (href.endsWith('.svg')) {
27
- return { assetType: 'image', mediaType: 'image/svg+xml' };
28
- }
29
- if (href.endsWith('.avif')) {
30
- return { assetType: 'image', mediaType: 'image/avif' };
31
- }
32
- // Fonts
33
- if (href.endsWith('.ttf')) {
34
- return { assetType: 'font', mediaType: 'font/ttf' };
35
- }
36
- if (href.endsWith('.woff')) {
37
- return { assetType: 'font', mediaType: 'font/woff' };
38
- }
39
- if (href.endsWith('.woff2')) {
40
- return { assetType: 'font', mediaType: 'font/woff2' };
41
- }
42
- // Videos
43
- if (href.endsWith('.mp4')) {
44
- return { assetType: 'video', mediaType: 'video/mp4' };
45
- }
46
- if (href.endsWith('.webm')) {
47
- return { assetType: 'video', mediaType: 'video/webm' };
48
- }
49
- if (href.endsWith('.ogv')) {
50
- return { assetType: 'video', mediaType: 'video/ogg' };
51
- }
52
- if (href.endsWith('.mpeg') || href.endsWith('.mpg')) {
53
- return { assetType: 'video', mediaType: 'video/mpeg' };
54
- }
55
- if (href.endsWith('.avi')) {
56
- return { assetType: 'video', mediaType: 'video/x-msvideo' };
57
- }
58
- if (href.endsWith('.mov') || href.endsWith('.qt')) {
59
- return { assetType: 'video', mediaType: 'video/quicktime' };
60
- }
61
- // Audios
62
- if (href.endsWith('.mp3')) {
63
- return { assetType: 'audio', mediaType: 'audio/mpeg' };
64
- }
65
- if (href.endsWith('.wav')) {
66
- return { assetType: 'audio', mediaType: 'audio/wav' };
67
- }
68
- if (href.endsWith('.ogg')) {
69
- return { assetType: 'audio', mediaType: 'audio/ogg' };
70
- }
71
- if (href.endsWith('.m4a')) {
72
- return { assetType: 'audio', mediaType: 'audio/aac' };
73
- }
74
- if (href.endsWith('midi') || href.endsWith('.mid')) {
75
- return { assetType: 'audio', mediaType: 'audio/midi' };
76
- }
77
- if (href.endsWith('.flac')) {
78
- return { assetType: 'audio', mediaType: 'audio/flac' };
79
- }
80
- return null;
81
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFontFallback = isFontFallback;
4
- const assert_js_1 = require("../../../utils/assert.js");
5
- function isFontFallback(asset, pageAssets) {
6
- if (asset.assetType !== 'font') {
7
- return false;
8
- }
9
- const fontUrlBase = removeFileExtensionAndHash(asset.src);
10
- return pageAssets.some((assetOther) => {
11
- return assetOther.assetType === 'font' && removeFileExtensionAndHash(assetOther.src) === fontUrlBase;
12
- });
13
- }
14
- function removeFileExtensionAndHash(assetUrl) {
15
- (0, assert_js_1.assert)(!assetUrl.includes('\\'));
16
- // The logic below doesn't work for '/assets/chunk-0e184ced.js'
17
- (0, assert_js_1.assert)(!assetUrl.endsWith('.js'));
18
- const paths = assetUrl.split('/');
19
- {
20
- const filename = paths[paths.length - 1];
21
- const filenameParts = filename.split('.');
22
- (0, assert_js_1.assert)(filenameParts.length >= 2);
23
- // User may set config.build.rollupOptions.output.assetFileNames => we can't assume the filename to be `*.${hash}.${ext}`
24
- const filenameBase = filenameParts.slice(0, filenameParts.length === 2 ? -1 : -2);
25
- (0, assert_js_1.assert)(filenameBase.length >= 1);
26
- paths[paths.length - 1] = filenameBase.join('.');
27
- }
28
- return paths.join('/');
29
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNewError = isNewError;
4
- exports.setAlreadyLogged = setAlreadyLogged;
5
- exports.hasAlreadyLogged = hasAlreadyLogged;
6
- const utils_js_1 = require("../utils.js");
7
- const globalObject = (0, utils_js_1.getGlobalObject)('renderPage/isNewError.ts', {
8
- wasAlreadyLogged: new WeakSet(),
9
- });
10
- function isNewError(errErrorPage, errNominalPage) {
11
- (0, utils_js_1.warnIfErrorIsNotObject)(errErrorPage);
12
- return (!(0, utils_js_1.isSameErrorMessage)(errNominalPage, errErrorPage) ||
13
- // Isn't this redudant/superfluous? I think we can remove this entire file and only use isSameErrorMessage() instead.
14
- !hasAlreadyLogged(errNominalPage));
15
- }
16
- function hasAlreadyLogged(err) {
17
- if (!(0, utils_js_1.isObject)(err))
18
- return false;
19
- return globalObject.wasAlreadyLogged.has(err);
20
- }
21
- function setAlreadyLogged(err) {
22
- if (!(0, utils_js_1.isObject)(err))
23
- return;
24
- globalObject.wasAlreadyLogged.add(err);
25
- }
@@ -1,124 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadPageConfigsLazyServerSide = loadPageConfigsLazyServerSide;
4
- const getPageFiles_js_1 = require("../../../shared/getPageFiles.js");
5
- const resolveVikeConfigPublic_js_1 = require("../../../shared/page-configs/resolveVikeConfigPublic.js");
6
- const analyzePageClientSide_js_1 = require("../../../shared/getPageFiles/analyzePageClientSide.js");
7
- const utils_js_1 = require("../utils.js");
8
- const getPageAssets_js_1 = require("./getPageAssets.js");
9
- const findPageConfig_js_1 = require("../../../shared/page-configs/findPageConfig.js");
10
- const analyzePage_js_1 = require("./analyzePage.js");
11
- const loadAndParseVirtualFilePageEntry_js_1 = require("../../../shared/page-configs/loadAndParseVirtualFilePageEntry.js");
12
- const execHookServer_js_1 = require("./execHookServer.js");
13
- const headersResponse_js_1 = require("./headersResponse.js");
14
- const csp_js_1 = require("./csp.js");
15
- async function loadPageConfigsLazyServerSide(pageContext) {
16
- (0, utils_js_1.objectAssign)(pageContext, {
17
- _pageConfig: (0, findPageConfig_js_1.findPageConfig)(pageContext._globalContext._pageConfigs, pageContext.pageId),
18
- });
19
- // Load the page's + files
20
- (0, utils_js_1.objectAssign)(pageContext, await loadPageUserFiles(pageContext));
21
- // Resolve new computed pageContext properties
22
- (0, utils_js_1.updateType)(pageContext, await resolvePageContext(pageContext));
23
- // Execute +onCreatePageContext
24
- await (0, execHookServer_js_1.execHookServer)('onCreatePageContext', pageContext);
25
- return pageContext;
26
- }
27
- async function resolvePageContext(pageContext) {
28
- const { isHtmlOnly, clientEntries, clientDependencies } = (0, analyzePage_js_1.analyzePage)(pageContext);
29
- const passToClient = [];
30
- const errMsgSuffix = ' should be an array of strings.';
31
- const isV1Design = !!pageContext._pageConfig;
32
- if (!isV1Design) {
33
- pageContext.exportsAll.passToClient?.forEach((e) => {
34
- (0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(e, 'exportValue', 'string[]'), `${e.exportSource}${errMsgSuffix}`);
35
- passToClient.push(...e.exportValue);
36
- });
37
- }
38
- else {
39
- pageContext.from.configsCumulative.passToClient?.values.forEach((v) => {
40
- const { value, definedAt } = v;
41
- const errMsg = `+passToClient value defined at ${definedAt}${errMsgSuffix}`;
42
- //*/ TO-DO/next-major-release: remove the passToClient once setting from the public API
43
- (0, utils_js_1.assertUsage)((0, utils_js_1.isArray)(value), `+passToClient value defined at ${definedAt} should be an array`);
44
- const valS = value.map((el) => {
45
- if ((0, utils_js_1.isObject)(el)) {
46
- (0, utils_js_1.assertWarning)(!('once' in el), 'The passToClient once setting is deprecated and no longer has any effect. Instead, see the upcoming .once.js suffix (see https://github.com/vikejs/vike/issues/2566 for more information).', { onlyOnce: true });
47
- (0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(el, 'prop', 'string'), errMsg);
48
- return el.prop;
49
- }
50
- (0, utils_js_1.assertUsage)(typeof el === 'string', errMsg);
51
- return el;
52
- });
53
- /*/
54
- assertUsage(isArrayOfStrings(value), errMsg)
55
- //*/
56
- passToClient.push(...valS);
57
- });
58
- }
59
- (0, utils_js_1.objectAssign)(pageContext, await (0, csp_js_1.resolvePageContextCspNone)(pageContext));
60
- (0, utils_js_1.objectAssign)(pageContext, {
61
- Page: pageContext.exports.Page,
62
- _isHtmlOnly: isHtmlOnly,
63
- _passToClient: passToClient,
64
- });
65
- (0, utils_js_1.objectAssign)(pageContext, await (0, headersResponse_js_1.resolveHeadersResponseEarly)(pageContext));
66
- (0, utils_js_1.objectAssign)(pageContext, {
67
- __getPageAssets: async () => {
68
- if ('_pageAssets' in pageContext) {
69
- return pageContext._pageAssets;
70
- }
71
- else {
72
- const pageAssets = await (0, getPageAssets_js_1.getPageAssets)(pageContext, clientDependencies, clientEntries);
73
- (0, utils_js_1.objectAssign)(pageContext, { _pageAssets: pageAssets });
74
- return pageContext._pageAssets;
75
- }
76
- },
77
- });
78
- // TO-DO/next-major-release: remove
79
- Object.assign(pageContext, {
80
- _getPageAssets: async () => {
81
- (0, utils_js_1.assertWarning)(false, 'pageContext._getPageAssets() deprecated, see https://vike.dev/preloading', {
82
- onlyOnce: true,
83
- showStackTrace: true,
84
- });
85
- const pageAssetsOldFormat = [];
86
- (await pageContext.__getPageAssets()).forEach((p) => {
87
- if (p.assetType === 'script' && p.isEntry) {
88
- pageAssetsOldFormat.push({
89
- src: p.src,
90
- preloadType: null,
91
- assetType: 'script',
92
- mediaType: p.mediaType,
93
- });
94
- }
95
- pageAssetsOldFormat.push({
96
- src: p.src,
97
- preloadType: p.assetType,
98
- assetType: p.assetType === 'style' ? 'style' : 'preload',
99
- mediaType: p.mediaType,
100
- });
101
- });
102
- return pageAssetsOldFormat;
103
- },
104
- });
105
- return pageContext;
106
- }
107
- async function loadPageUserFiles(pageContext) {
108
- const [{ pageContextAddendum }] = await Promise.all([
109
- (async () => {
110
- const pageFilesServerSide = (0, getPageFiles_js_1.getPageFilesServerSide)(pageContext._pageFilesAll, pageContext.pageId);
111
- const isDev = !pageContext._globalContext._isProduction;
112
- const pageConfigLoaded = !pageContext._pageConfig
113
- ? null
114
- : await (0, loadAndParseVirtualFilePageEntry_js_1.loadAndParseVirtualFilePageEntry)(pageContext._pageConfig, isDev);
115
- await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
116
- const pageContextAddendum = (0, resolveVikeConfigPublic_js_1.resolvePageContextConfig)(pageFilesServerSide, pageConfigLoaded, pageContext._globalContext._pageConfigGlobal);
117
- return { pageContextAddendum };
118
- })(),
119
- (0, analyzePageClientSide_js_1.analyzePageClientSideInit)(pageContext._globalContext._pageFilesAll, pageContext.pageId, {
120
- sharedPageFilesAlreadyLoaded: true,
121
- }),
122
- ]);
123
- return pageContextAddendum;
124
- }
@@ -1,154 +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.log404 = log404;
7
- exports.getRoutesInfo = getRoutesInfo;
8
- const noRouteMatch_js_1 = require("../../../../shared/route/noRouteMatch.js");
9
- const utils_js_1 = require("../../utils.js");
10
- const picocolors_1 = __importDefault(require("@brillout/picocolors"));
11
- async function log404(pageContext) {
12
- const { urlPathname } = pageContext;
13
- const pageRoutes = pageContext._globalContext._pageRoutes;
14
- (0, utils_js_1.assertUsage)(pageRoutes.length > 0, 'No page found.');
15
- const globalContext = pageContext._globalContext;
16
- if (!globalContext._isProduction && !isFileRequest(urlPathname) && !pageContext.isClientSideNavigation) {
17
- const routesInfo = getRoutesInfo(pageRoutes);
18
- let msg = `URL ${picocolors_1.default.cyan(urlPathname)} ${noRouteMatch_js_1.noRouteMatch}`;
19
- const outro = 'See https://vike.dev/routing for more information about routing.';
20
- if (!routesInfo) {
21
- msg = `${msg}. ${picocolors_1.default.dim(outro)}`;
22
- }
23
- else {
24
- msg = `${msg}:\n${routesInfo}\n${outro}`;
25
- }
26
- (0, utils_js_1.assertInfo)(false, msg, { onlyOnce: false });
27
- }
28
- }
29
- function getRoutesInfo(pageRoutes) {
30
- const entries = pageRoutes
31
- .map((pageRoute) => {
32
- let routeStr;
33
- let routeTypeSrc;
34
- let routeDefinedBy;
35
- if (pageRoute.routeType === 'FILESYSTEM') {
36
- (0, utils_js_1.assert)(pageRoute.routeFilesystemDefinedBy);
37
- routeDefinedBy = pageRoute.routeFilesystemDefinedBy;
38
- }
39
- else {
40
- (0, utils_js_1.assert)(pageRoute.routeDefinedAtString);
41
- routeDefinedBy = pageRoute.routeDefinedAtString;
42
- }
43
- if (pageRoute.routeType === 'STRING') {
44
- routeStr = pageRoute.routeString;
45
- routeTypeSrc = 'Route String';
46
- }
47
- else if (pageRoute.routeType === 'FUNCTION') {
48
- routeStr = String(pageRoute.routeFunction);
49
- routeTypeSrc = 'Route Function';
50
- }
51
- else {
52
- routeStr = pageRoute.routeString;
53
- routeTypeSrc = 'Filesystem Route';
54
- }
55
- (0, utils_js_1.assert)(routeStr && routeTypeSrc && routeDefinedBy);
56
- return { routeStr, routeTypeSrc, routeDefinedBy };
57
- })
58
- .sort((e1, e2) => {
59
- if (e1.routeTypeSrc !== 'Route Function' && e2.routeTypeSrc === 'Route Function') {
60
- return -1;
61
- }
62
- if (e1.routeTypeSrc === 'Route Function' && e2.routeTypeSrc !== 'Route Function') {
63
- return 1;
64
- }
65
- return (0, utils_js_1.compareString)(e1.routeStr, e2.routeStr);
66
- });
67
- const linesContent = [
68
- {
69
- routeStr: 'ROUTE',
70
- routeTypeSrc: 'TYPE',
71
- routeDefinedBy: 'DEFINED BY',
72
- },
73
- ...entries,
74
- ];
75
- const terminalWidth = (0, utils_js_1.getTerminalWidth)() || 134;
76
- let width2 = Math.max(...linesContent.map(({ routeTypeSrc }) => (0, utils_js_1.stripAnsi)(routeTypeSrc).length));
77
- let width3 = Math.max(...linesContent.map(({ routeDefinedBy }) => (0, utils_js_1.stripAnsi)(routeDefinedBy).length));
78
- const width1_max = terminalWidth -
79
- width3 -
80
- width2 -
81
- // Total width of table border & padding
82
- 10;
83
- if (width1_max < 10)
84
- return null;
85
- linesContent.forEach((lineContent) => {
86
- let { routeStr } = lineContent;
87
- if (lineContent.routeTypeSrc === 'Route Function') {
88
- routeStr = truncateRouteFunction(routeStr, width1_max);
89
- (0, utils_js_1.assert)((0, utils_js_1.stripAnsi)(routeStr).length <= width1_max);
90
- }
91
- lineContent.routeStr = routeStr;
92
- });
93
- let width1 = Math.max(...linesContent.map(({ routeStr }) => (0, utils_js_1.stripAnsi)(routeStr).length));
94
- if (width1 > width1_max)
95
- return null;
96
- let lines = linesContent.map(({ routeStr, routeTypeSrc, routeDefinedBy }, i) => {
97
- let cell1 = padEnd(routeStr, width1 + ((0, utils_js_1.stripAnsi)(routeStr).length - (0, utils_js_1.stripAnsi)(routeStr).length));
98
- let cell2 = padEnd(routeTypeSrc, width2);
99
- let cell3 = padEnd(routeDefinedBy, width3);
100
- const isHeader = i === 0;
101
- if (isHeader) {
102
- cell1 = picocolors_1.default.dim(cell1);
103
- cell2 = picocolors_1.default.dim(cell2);
104
- cell3 = picocolors_1.default.dim(cell3);
105
- }
106
- let line = [cell1, cell2, cell3].join(picocolors_1.default.dim(' │ '));
107
- line = picocolors_1.default.dim('│ ') + line + picocolors_1.default.dim(' │');
108
- return line;
109
- });
110
- width1 = width1 + 2;
111
- width2 = width2 + 2;
112
- width3 = width3 + 2;
113
- // https://en.wikipedia.org/wiki/Box-drawing_character
114
- lines = [
115
- picocolors_1.default.dim(`┌${'─'.repeat(width1)}┬${'─'.repeat(width2)}┬${'─'.repeat(width3)}┐`),
116
- lines[0],
117
- picocolors_1.default.dim(`├${'─'.repeat(width1)}┼${'─'.repeat(width2)}┼${'─'.repeat(width3)}┤`),
118
- ...lines.slice(1),
119
- picocolors_1.default.dim(`└${'─'.repeat(width1)}┴${'─'.repeat(width2)}┴${'─'.repeat(width3)}┘`),
120
- ];
121
- lines.forEach((line) => {
122
- (0, utils_js_1.assert)((0, utils_js_1.stripAnsi)(line).length <= terminalWidth);
123
- });
124
- return lines.join('\n');
125
- }
126
- function truncateRouteFunction(routeStr, lenMax) {
127
- routeStr = (0, utils_js_1.stripAnsi)(routeStr);
128
- routeStr = removeNonAscii(routeStr);
129
- routeStr = routeStr.split(/\s/).filter(Boolean).join(' ');
130
- routeStr = (0, utils_js_1.truncateString)(routeStr, lenMax);
131
- return routeStr;
132
- }
133
- /** Same as String.prototype.padEnd but with stripAnsi() */
134
- function padEnd(str, width) {
135
- const padWidth = Math.max(0, width - (0, utils_js_1.stripAnsi)(str).length);
136
- return str + ''.padEnd(padWidth, ' ');
137
- }
138
- function removeNonAscii(str) {
139
- // https://stackoverflow.com/questions/20856197/remove-non-ascii-character-in-string/20856346#20856346
140
- return str.replace(/[^\x00-\x7F]/g, '');
141
- }
142
- function isFileRequest(urlPathname) {
143
- (0, utils_js_1.assert)(urlPathname.startsWith('/'));
144
- const paths = urlPathname.split('/');
145
- const lastPath = paths[paths.length - 1];
146
- (0, utils_js_1.assert)(typeof lastPath === 'string');
147
- const parts = lastPath.split('.');
148
- if (parts.length < 2) {
149
- return false;
150
- }
151
- const fileExtension = parts[parts.length - 1];
152
- (0, utils_js_1.assert)(typeof fileExtension === 'string');
153
- return /^[a-z0-9]+$/.test(fileExtension);
154
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.error_cannot_use_import_outside_of_module = void 0;
4
- // https://github.com/vikejs/vike/discussions/571#discussioncomment-6137618
5
- exports.error_cannot_use_import_outside_of_module = `
6
- import{useRunner as e}from"react-runner";export*from"react-runner";import t,{useState as r,useEffect as n,Fragment as a,useCallback as l,useRef as o,useMemo as c,createContext as s,useContext as i}from"react";import p from"react-simple-code-editor";import m,{Prism as u}from"prism-react-renderer";function g(){return g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(this,arguments)}function y(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t.indexOf(r=l[n])>=0||(a[r]=e[r]);return a}const d=["initialCode","transformCode"],h=t=>{let{initialCode:a="",transformCode:l}=t,o=y(t,d);const[c,s]=r(a),{element:i,error:p}=e(g({code:l?l(c):c},o));return n(()=>{s(a)},[a]),{element:i,error:p,code:c,onChange:s}},f={plain:{color:"#ffffff",backgroundColor:"#282c34"},styles:[{types:["comment","block-comment","prolog","doctype","cdata"],style:{color:"#b2b2b2"}},{types:["property","number","function-name","constant","symbol","deleted"],style:{color:"#5a9bcf"}},{types:["boolean"],style:{color:"#ff8b50"}},{types:["tag"],style:{color:"#fc929e"}},{types:["string","attr-value"],style:{color:"#8dc891"}},{types:["punctuation"],style:{color:"#88c6Be"}},{types:["selector","char","builtin","inserted"],style:{color:"#d8dee9"}},{types:["function"],style:{color:"#79b6f2"}},{types:["operator","entity","url","variable"],style:{color:"#d7deea"}},{types:["keyword"],style:{color:"#c5a5c5"}},{types:["atrule","class-name"],style:{color:"#fac863"}},{types:["important"],style:{fontWeight:"400"}},{types:["bold"],style:{fontWeight:"700"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["entity"],style:{cursor:"help"}},{types:["namespace"],style:{opacity:.7}}]},b=["children","language","theme","Prism","padding","noWrapper","noWrap","className","style"],C=e=>{let{children:r,language:n="jsx",theme:l=f,Prism:o=u,padding:c=10,noWrapper:s,noWrap:i,className:p,style:d}=e,h=y(e,b);/*#__PURE__*/return t.createElement(m,{code:r||"",language:n,Prism:o,theme:l},({className:e,style:r,tokens:n,getLineProps:l,getTokenProps:o})=>{const m=n.map((e,r)=>/*#__PURE__*/t.createElement(a,{key:r},/*#__PURE__*/t.createElement("span",l({line:e}),e.map((e,r)=>/*#__PURE__*/t.createElement("span",o({token:e,key:r})))),"\\n"));return s?m:/*#__PURE__*/t.createElement("pre",g({className:p?:e,style:g({},r,{margin:0,padding:c,whiteSpace:i?"pre":"pre-wrap"},d)},h),m)})},v=["defaultValue","value","language","theme","Prism","highlight","padding","onChange"],E=e=>{let{defaultValue:n,value:a,language:s="jsx",theme:i=f,Prism:m,highlight:u,padding:d=10,onChange:h}=e,b=y(e,v);const[E,P]=r(n||""),k=void 0!==a,W=l(e=>/*#__PURE__*/t.createElement(C,{language:s,theme:i,Prism:m,noWrapper:!0},e),[s,i,m]),j=o(h);j.current=h;const x=l(e=>{k||P(e),null==j.current||j.current(e)},[k]),O=c(()=>g({},i.plain,b.style),[i.plain,b.style]);/*#__PURE__*/return t.createElement(p,g({},b,{highlight:u||W,padding:d,value:k?a:E,onValueChange:x,style:O}))},P=s({}),k=()=>i(P),W=["children","code","language","theme"],j=e=>{let{children:r,code:n="",language:a="jsx",theme:l=f}=e,o=y(e,W);const{element:c,error:s,code:i,onChange:p}=h(g({initialCode:n},o));/*#__PURE__*/return t.createElement(P.Provider,{value:{element:c,error:s,code:i,onChange:p,language:a,theme:l}},r)},x=e=>{const{code:r,language:n,theme:a,onChange:l}=k();/*#__PURE__*/return t.createElement(E,g({value:r,language:n,theme:a,onChange:l},e))},O=["Component"],w=e=>{let{Component:r="div"}=e,n=y(e,O);const{element:a}=k();/*#__PURE__*/return t.createElement(r,n,a)},N=e=>{const{error:r}=k();return r?/*#__PURE__*/t.createElement("pre",e,r):/*#__PURE__*/t.createElement(t.Fragment,null)};export{C as CodeBlock,E as CodeEditor,P as LiveContext,x as LiveEditor,N as LiveError,w as LivePreview,j as LiveProvider,f as defaultTheme,k as useLiveContext,h as useLiveRunner};
7
- ^^^^^^
8
-
9
- SyntaxError: Cannot use import statement outside a module
10
- at Object.compileFunction (node:vm:360:18)
11
- at wrapSafe (node:internal/modules/cjs/loader:1084:15)
12
- at Module._compile (node:internal/modules/cjs/loader:1119:27)
13
- at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
14
- at Module.load (node:internal/modules/cjs/loader:1033:32)
15
- at Function.Module._load (node:internal/modules/cjs/loader:868:12)
16
- at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
17
- at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
18
- at processTicksAndRejections (node:internal/process/task_queues:96:5)
19
- at async Promise.all (index 0)
20
- `;
@@ -1,200 +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.logErrorHint = logErrorHint;
7
- exports.getErrorHint = getErrorHint;
8
- const utils_js_1 = require("../utils.js");
9
- const picocolors_1 = __importDefault(require("@brillout/picocolors"));
10
- const hintDefault = 'The error could be a CJS/ESM issue, see https://vike.dev/broken-npm-package';
11
- const hintLinkPrefix = 'To fix this error, see ';
12
- const errorsMisc = [
13
- {
14
- errMsg: 'window is not defined',
15
- link: 'https://vike.dev/hints#window-is-not-defined',
16
- mustMentionNodeModules: false,
17
- },
18
- {
19
- errMsg: 'jsxDEV is not a function',
20
- link: 'https://github.com/vikejs/vike/issues/1469#issuecomment-1919518096',
21
- mustMentionNodeModules: false,
22
- },
23
- {
24
- // ```
25
- // Error [RollupError]: Could not resolve "../dist/client/assets.json" from "renderer/+onRenderHtml.tsx"
26
- // ```
27
- errMsg: 'assets.json',
28
- link: 'https://vike.dev/getGlobalContext',
29
- mustMentionNodeModules: false,
30
- },
31
- {
32
- errMsg: 'ERR_UNKNOWN_FILE_EXTENSION',
33
- link: 'https://vike.dev/broken-npm-package#err-unknown-file-extension',
34
- },
35
- ];
36
- const reactInvalidEelement = 'https://vike.dev/broken-npm-package#react-invalid-component';
37
- const errorsReact = [
38
- {
39
- errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
40
- link: reactInvalidEelement,
41
- // The stack trace can be user-land while the import is coming from node_modules
42
- mustMentionNodeModules: false,
43
- },
44
- {
45
- errMsg: 'Objects are not valid as a React child',
46
- link: reactInvalidEelement,
47
- mustMentionNodeModules: false,
48
- },
49
- {
50
- // React's "Invalid hook call.", see https://github.com/vikejs/vike/discussions/1637#discussioncomment-9424712
51
- errMsg: "Cannot read properties of null (reading 'useContext')",
52
- },
53
- ];
54
- const errorsCjsEsm_withPreciseLink = [
55
- {
56
- // `SyntaxError: Named export '${exportName}' not found. The requested module '${packageName}' is a CommonJS module, which may not support all module.exports as named exports.`
57
- errMsg: /Named export.*not found/i,
58
- link: 'https://vike.dev/broken-npm-package#named-export-not-found',
59
- // It seems that this always points to an npm package import.
60
- mustMentionNodeModules: false,
61
- },
62
- ];
63
- const errorsCjsEsm = [
64
- { errMsg: 'ERR_UNSUPPORTED_DIR_IMPORT' },
65
- { errMsg: 'ERR_REQUIRE_ESM' },
66
- { errMsg: 'Must use import' },
67
- { errMsg: /Cannot find \S+ '(\S+)' imported from (\S+)/ },
68
- { errMsg: 'ERR_UNKNOWN_FILE_EXTENSION' },
69
- { errMsg: /Unknown file extension "\S+" for (\S+)/ },
70
- // `SyntaxError: Cannot use import statement outside a module`.
71
- {
72
- errMsg: 'Cannot use import statement',
73
- // Since user code is always ESM, this error must always originate from an npm package.
74
- mustMentionNodeModules: false,
75
- },
76
- { errMsg: 'is not exported' },
77
- { errMsg: 'Cannot read properties of undefined' },
78
- { errMsg: '.default is not' },
79
- // Using CJS inside ESM modules.
80
- { errMsg: 'require is not a function' },
81
- { errMsg: 'exports is not defined' },
82
- { errMsg: 'module is not defined' },
83
- { errMsg: 'not defined in ES' },
84
- { errMsg: "Unexpected token 'export'" },
85
- { errMsg: 'Failed to resolve entry for package' },
86
- ];
87
- function logErrorHint(error) {
88
- /* Collect errors for ./logErrorHint.spec.ts
89
- collectError(error)
90
- //*/
91
- const hint = getErrorHint(error);
92
- if (hint)
93
- logHint(hint);
94
- }
95
- function getErrorHint(error) {
96
- {
97
- const knownErr = isKnownError(error);
98
- if (knownErr) {
99
- if (knownErr.link) {
100
- return hintLinkPrefix + knownErr.link;
101
- }
102
- else {
103
- return hintDefault;
104
- }
105
- }
106
- }
107
- return null;
108
- }
109
- function logHint(hint) {
110
- hint = (0, utils_js_1.formatHintLog)(hint);
111
- hint = picocolors_1.default.bold(hint);
112
- console.error(hint);
113
- }
114
- function isKnownError(error) {
115
- const anywhere = getAnywhere(error);
116
- const knownErr = [
117
- //
118
- ...errorsMisc,
119
- ...errorsReact,
120
- ...errorsCjsEsm_withPreciseLink,
121
- ...errorsCjsEsm,
122
- ].find((knownError) => {
123
- if (!includesLowercase(anywhere, knownError.errMsg))
124
- return false;
125
- if (knownError.mustMentionNodeModules !== false && !includesLowercase(anywhere, 'node_modules'))
126
- return false;
127
- return true;
128
- });
129
- if (!knownErr)
130
- return false;
131
- return knownErr;
132
- }
133
- function includesLowercase(str, substr) {
134
- if (substr instanceof RegExp) {
135
- let { flags } = substr;
136
- if (!flags.includes('i'))
137
- flags += 'i';
138
- const regex = new RegExp(substr.source, flags);
139
- return regex.test(str);
140
- }
141
- if (typeof substr === 'string') {
142
- return str.toLowerCase().includes(substr.toLowerCase());
143
- }
144
- (0, utils_js_1.assert)(false);
145
- }
146
- function getAnywhere(error) {
147
- const code = getErrCode(error);
148
- const message = getErrMessage(error);
149
- const stack = getErrStack(error);
150
- const anywhere = [code, message, stack].filter(Boolean).join('\n');
151
- return anywhere;
152
- }
153
- function getErrMessage(err) {
154
- if (!(0, utils_js_1.isObject)(err))
155
- return null;
156
- if (!err.message)
157
- return null;
158
- if (typeof err.message !== 'string')
159
- return null;
160
- return err.message;
161
- }
162
- function getErrCode(err) {
163
- if (!(0, utils_js_1.isObject)(err))
164
- return null;
165
- if (!err.code)
166
- return null;
167
- if (typeof err.code !== 'string')
168
- return null;
169
- return err.code;
170
- }
171
- function getErrStack(err) {
172
- if (!(0, utils_js_1.isObject)(err))
173
- return null;
174
- if (!err.stack)
175
- return null;
176
- if (typeof err.stack !== 'string')
177
- return null;
178
- return err.stack;
179
- }
180
- function collectError(err) {
181
- console.log([
182
- '{',
183
- ` message: ${JSON.stringify(err.message)},`,
184
- ` code: ${JSON.stringify(err.code)},`,
185
- ' stack: `\n' + err.stack + '\n`',
186
- '}',
187
- ].join('\n'));
188
- /* For reproductions using older vite-plugin-ssr versions, do one of the following.
189
- - If upon pre-rendering:https: //github.com/brillout/repro_node-syntax-error#error-catched-by-vite-plugin-ssr
190
- - Inject the logger inside `catch` in node_modules/vite-plugin-ssr/dist/esm/node/runtime/renderPage.js
191
- - Inject the following inside `configResolved(config_)` at node_modules/vite-plugin-ssr/dist/cjs/node/vite/plugins/pluginDev/index.js
192
- ```js
193
- config_.logger.error = (msg, options) => {
194
- const { error } = options;
195
- if (error) return;
196
- console.log(...);
197
- };
198
- ```
199
- */
200
- }