vike 0.0.0-alpha.0 → 0.4.142-commit-8bf568b

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 (922) hide show
  1. package/RenderErrorPage.js +2 -0
  2. package/__internal/setup.js +2 -0
  3. package/__internal.js +2 -0
  4. package/abort.js +2 -0
  5. package/cli.js +2 -0
  6. package/client/router.js +2 -0
  7. package/client.js +2 -0
  8. package/dist/cjs/__internal/index.js +31 -0
  9. package/dist/cjs/node/cli/bin.js +44 -0
  10. package/dist/cjs/node/cli/index.js +11 -0
  11. package/dist/cjs/node/cli/onLoad.js +8 -0
  12. package/dist/cjs/node/cli/utils.js +21 -0
  13. package/dist/cjs/node/client/router.js +15 -0
  14. package/dist/cjs/node/createPageRenderer.js +133 -0
  15. package/dist/cjs/node/importBuild.js +3 -0
  16. package/dist/cjs/node/plugin/index.js +70 -0
  17. package/dist/cjs/node/plugin/onLoad.js +13 -0
  18. package/dist/cjs/node/plugin/plugins/autoFullBuild.js +104 -0
  19. package/dist/cjs/node/plugin/plugins/baseUrls.js +43 -0
  20. package/dist/cjs/node/plugin/plugins/buildConfig.js +252 -0
  21. package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +73 -0
  22. package/dist/cjs/node/plugin/plugins/commonConfig.js +80 -0
  23. package/dist/cjs/node/plugin/plugins/config/assertVikeConfig.js +74 -0
  24. package/dist/cjs/node/plugin/plugins/config/findConfigVikeFromStemPackages.js +27 -0
  25. package/dist/cjs/node/plugin/plugins/config/index.js +77 -0
  26. package/dist/cjs/node/plugin/plugins/config/pickFirst.js +7 -0
  27. package/dist/cjs/node/plugin/plugins/config/resolveBase.js +48 -0
  28. package/dist/cjs/node/plugin/plugins/config/resolveExtensions.js +107 -0
  29. package/dist/cjs/node/plugin/plugins/config/stemUtils.js +85 -0
  30. package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +42 -0
  31. package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +125 -0
  32. package/dist/cjs/node/plugin/plugins/devConfig/index.js +87 -0
  33. package/dist/cjs/node/plugin/plugins/distFileNames.js +169 -0
  34. package/dist/cjs/node/plugin/plugins/envVars.js +82 -0
  35. package/dist/cjs/node/plugin/plugins/extensionsAssets.js +101 -0
  36. package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +234 -0
  37. package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +95 -0
  38. package/dist/cjs/node/plugin/plugins/importBuild/index.js +54 -0
  39. package/dist/cjs/node/plugin/plugins/importUserCode/generateEagerImport.js +21 -0
  40. package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +242 -0
  41. package/dist/cjs/node/plugin/plugins/importUserCode/index.js +140 -0
  42. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/debug.js +5 -0
  43. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +10 -0
  44. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +100 -0
  45. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +176 -0
  46. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +1120 -0
  47. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +79 -0
  48. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +160 -0
  49. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/helpers.js +34 -0
  50. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isConfigEnvMatch.js +13 -0
  51. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/replaceImportStatements.js +154 -0
  52. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.js +283 -0
  53. package/dist/cjs/node/plugin/plugins/manifest.js +59 -0
  54. package/dist/cjs/node/plugin/plugins/packageJsonFile.js +45 -0
  55. package/dist/cjs/node/plugin/plugins/previewConfig.js +61 -0
  56. package/dist/cjs/node/plugin/plugins/removeRequireHookPlugin.js +18 -0
  57. package/dist/cjs/node/plugin/plugins/setGlobalContext.js +31 -0
  58. package/dist/cjs/node/plugin/plugins/suppressRollupWarning.js +51 -0
  59. package/dist/cjs/node/plugin/shared/addSsrMiddleware.js +41 -0
  60. package/dist/cjs/node/plugin/shared/findPageFiles.js +24 -0
  61. package/dist/cjs/node/plugin/shared/getConfigValueSource.js +25 -0
  62. package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +122 -0
  63. package/dist/cjs/node/plugin/shared/isAsset.js +41 -0
  64. package/dist/cjs/node/plugin/shared/isErrorDebug.js +8 -0
  65. package/dist/cjs/node/plugin/shared/isViteCliCall.js +84 -0
  66. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +15 -0
  67. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +15 -0
  68. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +38 -0
  69. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx.js +26 -0
  70. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +30 -0
  71. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +19 -0
  72. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +19 -0
  73. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +29 -0
  74. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +13 -0
  75. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +15 -0
  76. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +168 -0
  77. package/dist/cjs/node/plugin/shared/loggerNotProd/log.js +114 -0
  78. package/dist/cjs/node/plugin/shared/loggerNotProd.js +224 -0
  79. package/dist/cjs/node/plugin/shared/loggerVite/removeSuperfluousViteLog.js +25 -0
  80. package/dist/cjs/node/plugin/shared/loggerVite.js +61 -0
  81. package/dist/cjs/node/plugin/shared/parseEsModule.js +34 -0
  82. package/dist/cjs/node/plugin/shared/removeSourceMap.js +12 -0
  83. package/dist/cjs/node/plugin/shared/rollupIsEsm.js +16 -0
  84. package/dist/cjs/node/plugin/utils.js +41 -0
  85. package/dist/cjs/node/prerender/index.js +5 -0
  86. package/dist/cjs/node/prerender/runPrerender.js +707 -0
  87. package/dist/cjs/node/prerender/utils.js +31 -0
  88. package/dist/cjs/node/runtime/globalContext/loadImportBuild.js +30 -0
  89. package/dist/cjs/node/runtime/globalContext.js +163 -0
  90. package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +161 -0
  91. package/dist/cjs/node/runtime/html/injectAssets/getViteDevScripts.js +28 -0
  92. package/dist/cjs/node/runtime/html/injectAssets/inferHtmlTags.js +52 -0
  93. package/dist/cjs/node/runtime/html/injectAssets/injectAssets__public.js +32 -0
  94. package/dist/cjs/node/runtime/html/injectAssets/injectHtmlTags.js +157 -0
  95. package/dist/cjs/node/runtime/html/injectAssets/mergeScriptTags.js +71 -0
  96. package/dist/cjs/node/runtime/html/injectAssets/sanitizeJson.js +9 -0
  97. package/dist/cjs/node/runtime/html/injectAssets.js +76 -0
  98. package/dist/cjs/node/runtime/html/renderHtml.js +237 -0
  99. package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +117 -0
  100. package/dist/cjs/node/runtime/html/stream/react-streaming.js +36 -0
  101. package/dist/cjs/node/runtime/html/stream.js +751 -0
  102. package/dist/cjs/node/runtime/index-common.js +23 -0
  103. package/dist/cjs/node/runtime/index-deprecated.js +61 -0
  104. package/dist/cjs/node/runtime/index.js +19 -0
  105. package/dist/cjs/node/runtime/onLoad.js +12 -0
  106. package/dist/cjs/node/runtime/page-files/setup.js +23 -0
  107. package/dist/cjs/node/runtime/renderPage/analyzePage.js +69 -0
  108. package/dist/cjs/node/runtime/renderPage/assertArguments.js +43 -0
  109. package/dist/cjs/node/runtime/renderPage/createHttpResponseObject/assertNoInfiniteHttpRedirect.js +44 -0
  110. package/dist/cjs/node/runtime/renderPage/createHttpResponseObject.js +68 -0
  111. package/dist/cjs/node/runtime/renderPage/debugPageFiles.js +53 -0
  112. package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderHook.js +23 -0
  113. package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +139 -0
  114. package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +46 -0
  115. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +131 -0
  116. package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +25 -0
  117. package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +128 -0
  118. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +75 -0
  119. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +61 -0
  120. package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +33 -0
  121. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +133 -0
  122. package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +43 -0
  123. package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +33 -0
  124. package/dist/cjs/node/runtime/renderPage/inferMediaType.js +41 -0
  125. package/dist/cjs/node/runtime/renderPage/isConfigInvalid.js +8 -0
  126. package/dist/cjs/node/runtime/renderPage/isNewError.js +23 -0
  127. package/dist/cjs/node/runtime/renderPage/loadPageFilesServerSide.js +100 -0
  128. package/dist/cjs/node/runtime/renderPage/log404/index.js +144 -0
  129. package/dist/cjs/node/runtime/renderPage/loggerProd.js +23 -0
  130. package/dist/cjs/node/runtime/renderPage/loggerRuntime.js +17 -0
  131. package/dist/cjs/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.js +19 -0
  132. package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +186 -0
  133. package/dist/cjs/node/runtime/renderPage.js +405 -0
  134. package/dist/cjs/node/runtime/utils.js +71 -0
  135. package/dist/cjs/node/shared/ViteManifest.js +2 -0
  136. package/dist/cjs/node/shared/assertPluginManifest.js +24 -0
  137. package/dist/cjs/node/shared/assertRuntimeManifest.js +19 -0
  138. package/dist/cjs/node/shared/extractAssetsQuery.js +29 -0
  139. package/dist/cjs/node/shared/getClientEntryFilePath.js +18 -0
  140. package/dist/cjs/node/shared/getConfigVike.js +8 -0
  141. package/dist/cjs/node/shared/utils.js +33 -0
  142. package/dist/cjs/node/shared/virtual-files/virtualFileImportUserCode.js +27 -0
  143. package/dist/cjs/node/shared/virtual-files/virtualFilePageConfigValuesAll.js +39 -0
  144. package/dist/cjs/package.json +1 -0
  145. package/dist/cjs/shared/ConfigVike.js +2 -0
  146. package/dist/cjs/shared/RenderErrorPage.js +6 -0
  147. package/dist/cjs/shared/VikeNamespace.js +2 -0
  148. package/dist/cjs/shared/abort.js +16 -0
  149. package/dist/cjs/shared/addIs404ToPageProps.js +26 -0
  150. package/dist/cjs/shared/addUrlComputedProps.js +111 -0
  151. package/dist/cjs/shared/assertHookReturnedObject.js +22 -0
  152. package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +22 -0
  153. package/dist/cjs/shared/assertPageContextProvidedByUser.js +21 -0
  154. package/dist/cjs/shared/assertPageFilePath.js +12 -0
  155. package/dist/cjs/shared/determinePageIdOld.js +12 -0
  156. package/dist/cjs/shared/error-page.js +41 -0
  157. package/dist/cjs/shared/getPageContextRequestUrl.js +16 -0
  158. package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +22 -0
  159. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +2 -0
  160. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +51 -0
  161. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +30 -0
  162. package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +16 -0
  163. package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +61 -0
  164. package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +23 -0
  165. package/dist/cjs/shared/getPageFiles/assertExports.js +24 -0
  166. package/dist/cjs/shared/getPageFiles/assertPageConfigs.js +19 -0
  167. package/dist/cjs/shared/getPageFiles/fileTypes.js +53 -0
  168. package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +106 -0
  169. package/dist/cjs/shared/getPageFiles/getExports.js +146 -0
  170. package/dist/cjs/shared/getPageFiles/getPageFileObject.js +62 -0
  171. package/dist/cjs/shared/getPageFiles/parseGlobResults.js +127 -0
  172. package/dist/cjs/shared/getPageFiles/setPageFiles.js +47 -0
  173. package/dist/cjs/shared/getPageFiles.js +18 -0
  174. package/dist/cjs/shared/hooks/executeHook.js +74 -0
  175. package/dist/cjs/shared/hooks/getHook.js +29 -0
  176. package/dist/cjs/shared/notSerializable.js +5 -0
  177. package/dist/cjs/shared/page-configs/Config/PageContextConfig.js +2 -0
  178. package/dist/cjs/shared/page-configs/Config/helpers.js +2 -0
  179. package/dist/cjs/shared/page-configs/Config.js +2 -0
  180. package/dist/cjs/shared/page-configs/PageConfig.js +2 -0
  181. package/dist/cjs/shared/page-configs/findPageConfig.js +11 -0
  182. package/dist/cjs/shared/page-configs/getExportPath.js +31 -0
  183. package/dist/cjs/shared/page-configs/loadPageCode.js +63 -0
  184. package/dist/cjs/shared/page-configs/utils.js +80 -0
  185. package/dist/cjs/shared/route/abort.js +161 -0
  186. package/dist/cjs/shared/route/debug.js +14 -0
  187. package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +53 -0
  188. package/dist/cjs/shared/route/executeGuardHook.js +40 -0
  189. package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +56 -0
  190. package/dist/cjs/shared/route/index.js +119 -0
  191. package/dist/cjs/shared/route/loadPageRoutes.js +197 -0
  192. package/dist/cjs/shared/route/resolvePrecedence.js +72 -0
  193. package/dist/cjs/shared/route/resolveRedirects.js +55 -0
  194. package/dist/cjs/shared/route/resolveRoute.js +21 -0
  195. package/dist/cjs/shared/route/resolveRouteFunction.js +70 -0
  196. package/dist/cjs/shared/route/resolveRouteString.js +101 -0
  197. package/dist/cjs/shared/route/routing.js +9 -0
  198. package/dist/cjs/shared/route/utils.js +43 -0
  199. package/dist/cjs/shared/sortPageContext.js +17 -0
  200. package/dist/cjs/shared/types.js +2 -0
  201. package/dist/cjs/shared/utils.js +43 -0
  202. package/dist/cjs/types/index-dreprecated.js +3 -0
  203. package/dist/cjs/types/index.js +2 -0
  204. package/dist/cjs/utils/PromiseType.js +2 -0
  205. package/dist/cjs/utils/arrayIncludes.js +7 -0
  206. package/dist/cjs/utils/assert.js +194 -0
  207. package/dist/cjs/utils/assertDefaultExport.js +53 -0
  208. package/dist/cjs/utils/assertIsBrowser.js +9 -0
  209. package/dist/cjs/utils/assertIsNotBrowser.js +10 -0
  210. package/dist/cjs/utils/assertIsNotProductionRuntime.js +44 -0
  211. package/dist/cjs/utils/assertNodeVersion.js +14 -0
  212. package/dist/cjs/utils/assertPathIsFilesystemAbsolute.js +20 -0
  213. package/dist/cjs/utils/assertRoutingType.js +30 -0
  214. package/dist/cjs/utils/assertSingleInstance.js +97 -0
  215. package/dist/cjs/utils/autoRetry.js +23 -0
  216. package/dist/cjs/utils/capitalizeFirstLetter.js +10 -0
  217. package/dist/cjs/utils/cast.js +7 -0
  218. package/dist/cjs/utils/checkType.js +7 -0
  219. package/dist/cjs/utils/compareString.js +11 -0
  220. package/dist/cjs/utils/createErrorWithCleanStackTrace.js +46 -0
  221. package/dist/cjs/utils/debug.js +109 -0
  222. package/dist/cjs/utils/debugGlob.js +6 -0
  223. package/dist/cjs/utils/deepEqual.js +11 -0
  224. package/dist/cjs/utils/dynamicImport.js +8 -0
  225. package/dist/cjs/utils/escapeRegex.js +8 -0
  226. package/dist/cjs/utils/filesystemPathHandling.js +19 -0
  227. package/dist/cjs/utils/findUserPackageJsonPath.js +24 -0
  228. package/dist/cjs/utils/freezePartial.js +36 -0
  229. package/dist/cjs/utils/getCurrentUrl.js +19 -0
  230. package/dist/cjs/utils/getDependencyPackageJson.js +91 -0
  231. package/dist/cjs/utils/getFileExtension.js +17 -0
  232. package/dist/cjs/utils/getFilePathAbsolute.js +70 -0
  233. package/dist/cjs/utils/getGlobalObject.js +11 -0
  234. package/dist/cjs/utils/getMostSimilar.js +69 -0
  235. package/dist/cjs/utils/getOutDirs.js +121 -0
  236. package/dist/cjs/utils/getPropAccessNotation.js +10 -0
  237. package/dist/cjs/utils/getRandomId.js +15 -0
  238. package/dist/cjs/utils/getTerminWidth.js +8 -0
  239. package/dist/cjs/utils/getValuePrintable.js +11 -0
  240. package/dist/cjs/utils/hasProp.js +48 -0
  241. package/dist/cjs/utils/hasPropertyGetter.js +8 -0
  242. package/dist/cjs/utils/humanizeTime.js +25 -0
  243. package/dist/cjs/utils/isBrowser.js +9 -0
  244. package/dist/cjs/utils/isCallable.js +7 -0
  245. package/dist/cjs/utils/isDev.js +32 -0
  246. package/dist/cjs/utils/isEquivalentError.js +18 -0
  247. package/dist/cjs/utils/isHtml.js +10 -0
  248. package/dist/cjs/utils/isNodeJS.js +17 -0
  249. package/dist/cjs/utils/isNotNullish.js +5 -0
  250. package/dist/cjs/utils/isNpmPackage.js +96 -0
  251. package/dist/cjs/utils/isObject.js +7 -0
  252. package/dist/cjs/utils/isObjectWithKeys.js +16 -0
  253. package/dist/cjs/utils/isPlainObject.js +18 -0
  254. package/dist/cjs/utils/isPromise.js +8 -0
  255. package/dist/cjs/utils/isReact.js +24 -0
  256. package/dist/cjs/utils/isScriptFile.js +53 -0
  257. package/dist/cjs/utils/isStemPackageName.js +14 -0
  258. package/dist/cjs/utils/isStringRecord.js +7 -0
  259. package/dist/cjs/utils/isVitest.js +7 -0
  260. package/dist/cjs/utils/joinEnglish.js +14 -0
  261. package/dist/cjs/utils/mergeCumulativeValues.js +21 -0
  262. package/dist/cjs/utils/nodeEnv.js +16 -0
  263. package/dist/cjs/utils/objectAssign.js +10 -0
  264. package/dist/cjs/utils/objectEntries.js +8 -0
  265. package/dist/cjs/utils/objectKeys.js +10 -0
  266. package/dist/cjs/utils/pLimit.js +135 -0
  267. package/dist/cjs/utils/parseUrl-extras.js +96 -0
  268. package/dist/cjs/utils/parseUrl.js +221 -0
  269. package/dist/cjs/utils/path-shim.js +15 -0
  270. package/dist/cjs/utils/projectInfo.js +14 -0
  271. package/dist/cjs/utils/removeEmptyLines.js +10 -0
  272. package/dist/cjs/utils/removeFileExtention.js +7 -0
  273. package/dist/cjs/utils/resolve.js +60 -0
  274. package/dist/cjs/utils/serverSideRouteTo.js +7 -0
  275. package/dist/cjs/utils/sleep.js +7 -0
  276. package/dist/cjs/utils/slice.js +36 -0
  277. package/dist/cjs/utils/sorter.js +60 -0
  278. package/dist/cjs/utils/stringifyStringArray.js +7 -0
  279. package/dist/cjs/utils/stripAnsi.js +22 -0
  280. package/dist/cjs/utils/styleFileRE.js +5 -0
  281. package/dist/cjs/utils/throttle.js +16 -0
  282. package/dist/cjs/utils/trackLogs.js +31 -0
  283. package/dist/cjs/utils/trimWithAnsi.js +41 -0
  284. package/dist/cjs/utils/truncateString.js +19 -0
  285. package/dist/cjs/utils/unique.js +7 -0
  286. package/dist/cjs/utils/urlToFile.js +36 -0
  287. package/dist/cjs/utils/virtual-files.js +33 -0
  288. package/dist/cjs/utils/viteIsSSR.js +23 -0
  289. package/dist/cjs/utils/warnIfErrorIsNotObject.js +24 -0
  290. package/dist/esm/__internal/index.d.ts +17 -0
  291. package/dist/esm/__internal/index.js +27 -0
  292. package/dist/esm/client/client-routing-runtime/createPageContext.d.ts +18 -0
  293. package/dist/esm/client/client-routing-runtime/createPageContext.js +35 -0
  294. package/dist/esm/client/client-routing-runtime/entry.d.ts +1 -0
  295. package/dist/esm/client/client-routing-runtime/entry.js +9 -0
  296. package/dist/esm/client/client-routing-runtime/getBaseServer.d.ts +1 -0
  297. package/dist/esm/client/client-routing-runtime/getBaseServer.js +11 -0
  298. package/dist/esm/client/client-routing-runtime/getPageContext/removeBuiltInOverrides.d.ts +7 -0
  299. package/dist/esm/client/client-routing-runtime/getPageContext/removeBuiltInOverrides.js +22 -0
  300. package/dist/esm/client/client-routing-runtime/getPageContext.d.ts +29 -0
  301. package/dist/esm/client/client-routing-runtime/getPageContext.js +240 -0
  302. package/dist/esm/client/client-routing-runtime/getPageId.d.ts +10 -0
  303. package/dist/esm/client/client-routing-runtime/getPageId.js +17 -0
  304. package/dist/esm/client/client-routing-runtime/history.d.ts +13 -0
  305. package/dist/esm/client/client-routing-runtime/history.js +71 -0
  306. package/dist/esm/client/client-routing-runtime/index.d.ts +18 -0
  307. package/dist/esm/client/client-routing-runtime/index.js +7 -0
  308. package/dist/esm/client/client-routing-runtime/isExternalLink.d.ts +2 -0
  309. package/dist/esm/client/client-routing-runtime/isExternalLink.js +4 -0
  310. package/dist/esm/client/client-routing-runtime/navigate.d.ts +17 -0
  311. package/dist/esm/client/client-routing-runtime/navigate.js +34 -0
  312. package/dist/esm/client/client-routing-runtime/navigationState.d.ts +5 -0
  313. package/dist/esm/client/client-routing-runtime/navigationState.js +14 -0
  314. package/dist/esm/client/client-routing-runtime/onLoad.d.ts +2 -0
  315. package/dist/esm/client/client-routing-runtime/onLoad.js +8 -0
  316. package/dist/esm/client/client-routing-runtime/pageFiles.d.ts +1 -0
  317. package/dist/esm/client/client-routing-runtime/pageFiles.js +4 -0
  318. package/dist/esm/client/client-routing-runtime/prefetch/alreadyPrefetched.d.ts +4 -0
  319. package/dist/esm/client/client-routing-runtime/prefetch/alreadyPrefetched.js +16 -0
  320. package/dist/esm/client/client-routing-runtime/prefetch/getPrefetchSettings.d.ts +11 -0
  321. package/dist/esm/client/client-routing-runtime/prefetch/getPrefetchSettings.js +82 -0
  322. package/dist/esm/client/client-routing-runtime/prefetch.d.ts +15 -0
  323. package/dist/esm/client/client-routing-runtime/prefetch.js +89 -0
  324. package/dist/esm/client/client-routing-runtime/skipLink/isClientSideRoutable.d.ts +2 -0
  325. package/dist/esm/client/client-routing-runtime/skipLink/isClientSideRoutable.js +15 -0
  326. package/dist/esm/client/client-routing-runtime/skipLink.d.ts +3 -0
  327. package/dist/esm/client/client-routing-runtime/skipLink.js +61 -0
  328. package/dist/esm/client/client-routing-runtime/useClientRouter.d.ts +6 -0
  329. package/dist/esm/client/client-routing-runtime/useClientRouter.js +493 -0
  330. package/dist/esm/client/client-routing-runtime/utils.d.ts +22 -0
  331. package/dist/esm/client/client-routing-runtime/utils.js +28 -0
  332. package/dist/esm/client/node.d.ts +1 -0
  333. package/dist/esm/client/node.js +9 -0
  334. package/dist/esm/client/server-routing-runtime/entry.d.ts +1 -0
  335. package/dist/esm/client/server-routing-runtime/entry.js +17 -0
  336. package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +14 -0
  337. package/dist/esm/client/server-routing-runtime/getPageContext.js +36 -0
  338. package/dist/esm/client/server-routing-runtime/index.d.ts +16 -0
  339. package/dist/esm/client/server-routing-runtime/index.js +2 -0
  340. package/dist/esm/client/server-routing-runtime/onLoad.d.ts +2 -0
  341. package/dist/esm/client/server-routing-runtime/onLoad.js +5 -0
  342. package/dist/esm/client/server-routing-runtime/pageFiles.d.ts +1 -0
  343. package/dist/esm/client/server-routing-runtime/pageFiles.js +4 -0
  344. package/dist/esm/client/server-routing-runtime/utils.d.ts +14 -0
  345. package/dist/esm/client/server-routing-runtime/utils.js +18 -0
  346. package/dist/esm/client/shared/executeOnRenderClientHook.d.ts +11 -0
  347. package/dist/esm/client/shared/executeOnRenderClientHook.js +63 -0
  348. package/dist/esm/client/shared/getPageContextProxyForUser.d.ts +11 -0
  349. package/dist/esm/client/shared/getPageContextProxyForUser.js +66 -0
  350. package/dist/esm/client/shared/getPageContextSerializedInHtml.d.ts +5 -0
  351. package/dist/esm/client/shared/getPageContextSerializedInHtml.js +16 -0
  352. package/dist/esm/client/shared/loadPageFilesClientSide.d.ts +8 -0
  353. package/dist/esm/client/shared/loadPageFilesClientSide.js +64 -0
  354. package/dist/esm/client/shared/preparePageContextForUserConsumptionClientSide.d.ts +12 -0
  355. package/dist/esm/client/shared/preparePageContextForUserConsumptionClientSide.js +53 -0
  356. package/dist/esm/node/cli/bin.d.ts +1 -0
  357. package/dist/esm/node/cli/bin.js +42 -0
  358. package/dist/esm/node/cli/index.d.ts +2 -0
  359. package/dist/esm/node/cli/index.js +7 -0
  360. package/dist/esm/node/cli/onLoad.d.ts +2 -0
  361. package/dist/esm/node/cli/onLoad.js +5 -0
  362. package/dist/esm/node/cli/utils.d.ts +2 -0
  363. package/dist/esm/node/cli/utils.js +5 -0
  364. package/dist/esm/node/client/router.d.ts +4 -0
  365. package/dist/esm/node/client/router.js +12 -0
  366. package/dist/esm/node/createPageRenderer.d.ts +13 -0
  367. package/dist/esm/node/createPageRenderer.js +131 -0
  368. package/dist/esm/node/importBuild.d.ts +1 -0
  369. package/dist/esm/node/importBuild.js +3 -0
  370. package/dist/esm/node/plugin/index.d.ts +6 -0
  371. package/dist/esm/node/plugin/index.js +64 -0
  372. package/dist/esm/node/plugin/onLoad.d.ts +2 -0
  373. package/dist/esm/node/plugin/onLoad.js +10 -0
  374. package/dist/esm/node/plugin/plugins/autoFullBuild.d.ts +3 -0
  375. package/dist/esm/node/plugin/plugins/autoFullBuild.js +98 -0
  376. package/dist/esm/node/plugin/plugins/baseUrls.d.ts +4 -0
  377. package/dist/esm/node/plugin/plugins/baseUrls.js +40 -0
  378. package/dist/esm/node/plugin/plugins/buildConfig.d.ts +12 -0
  379. package/dist/esm/node/plugin/plugins/buildConfig.js +246 -0
  380. package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.d.ts +3 -0
  381. package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.js +67 -0
  382. package/dist/esm/node/plugin/plugins/commonConfig.d.ts +3 -0
  383. package/dist/esm/node/plugin/plugins/commonConfig.js +74 -0
  384. package/dist/esm/node/plugin/plugins/config/assertVikeConfig.d.ts +7 -0
  385. package/dist/esm/node/plugin/plugins/config/assertVikeConfig.js +71 -0
  386. package/dist/esm/node/plugin/plugins/config/findConfigVikeFromStemPackages.d.ts +3 -0
  387. package/dist/esm/node/plugin/plugins/config/findConfigVikeFromStemPackages.js +24 -0
  388. package/dist/esm/node/plugin/plugins/config/index.d.ts +3 -0
  389. package/dist/esm/node/plugin/plugins/config/index.js +71 -0
  390. package/dist/esm/node/plugin/plugins/config/pickFirst.d.ts +1 -0
  391. package/dist/esm/node/plugin/plugins/config/pickFirst.js +3 -0
  392. package/dist/esm/node/plugin/plugins/config/resolveBase.d.ts +10 -0
  393. package/dist/esm/node/plugin/plugins/config/resolveBase.js +42 -0
  394. package/dist/esm/node/plugin/plugins/config/resolveExtensions.d.ts +4 -0
  395. package/dist/esm/node/plugin/plugins/config/resolveExtensions.js +101 -0
  396. package/dist/esm/node/plugin/plugins/config/stemUtils.d.ts +8 -0
  397. package/dist/esm/node/plugin/plugins/config/stemUtils.js +79 -0
  398. package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.d.ts +4 -0
  399. package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.js +36 -0
  400. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.d.ts +4 -0
  401. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +122 -0
  402. package/dist/esm/node/plugin/plugins/devConfig/index.d.ts +3 -0
  403. package/dist/esm/node/plugin/plugins/devConfig/index.js +84 -0
  404. package/dist/esm/node/plugin/plugins/distFileNames.d.ts +3 -0
  405. package/dist/esm/node/plugin/plugins/distFileNames.js +163 -0
  406. package/dist/esm/node/plugin/plugins/envVars.d.ts +3 -0
  407. package/dist/esm/node/plugin/plugins/envVars.js +79 -0
  408. package/dist/esm/node/plugin/plugins/extensionsAssets.d.ts +3 -0
  409. package/dist/esm/node/plugin/plugins/extensionsAssets.js +95 -0
  410. package/dist/esm/node/plugin/plugins/extractAssetsPlugin.d.ts +5 -0
  411. package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +232 -0
  412. package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.d.ts +7 -0
  413. package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +92 -0
  414. package/dist/esm/node/plugin/plugins/importBuild/index.d.ts +3 -0
  415. package/dist/esm/node/plugin/plugins/importBuild/index.js +48 -0
  416. package/dist/esm/node/plugin/plugins/importUserCode/generateEagerImport.d.ts +5 -0
  417. package/dist/esm/node/plugin/plugins/importUserCode/generateEagerImport.js +18 -0
  418. package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.d.ts +6 -0
  419. package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +236 -0
  420. package/dist/esm/node/plugin/plugins/importUserCode/index.d.ts +3 -0
  421. package/dist/esm/node/plugin/plugins/importUserCode/index.js +134 -0
  422. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +8 -0
  423. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.js +2 -0
  424. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.d.ts +7 -0
  425. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +7 -0
  426. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +53 -0
  427. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +97 -0
  428. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +31 -0
  429. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +174 -0
  430. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +15 -0
  431. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +1114 -0
  432. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.d.ts +3 -0
  433. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +73 -0
  434. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.d.ts +3 -0
  435. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +154 -0
  436. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/helpers.d.ts +5 -0
  437. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/helpers.js +31 -0
  438. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isConfigEnvMatch.d.ts +3 -0
  439. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isConfigEnvMatch.js +10 -0
  440. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/replaceImportStatements.d.ts +31 -0
  441. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/replaceImportStatements.js +148 -0
  442. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.d.ts +12 -0
  443. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.js +277 -0
  444. package/dist/esm/node/plugin/plugins/manifest.d.ts +3 -0
  445. package/dist/esm/node/plugin/plugins/manifest.js +53 -0
  446. package/dist/esm/node/plugin/plugins/packageJsonFile.d.ts +3 -0
  447. package/dist/esm/node/plugin/plugins/packageJsonFile.js +42 -0
  448. package/dist/esm/node/plugin/plugins/previewConfig.d.ts +3 -0
  449. package/dist/esm/node/plugin/plugins/previewConfig.js +55 -0
  450. package/dist/esm/node/plugin/plugins/removeRequireHookPlugin.d.ts +3 -0
  451. package/dist/esm/node/plugin/plugins/removeRequireHookPlugin.js +15 -0
  452. package/dist/esm/node/plugin/plugins/setGlobalContext.d.ts +3 -0
  453. package/dist/esm/node/plugin/plugins/setGlobalContext.js +28 -0
  454. package/dist/esm/node/plugin/plugins/suppressRollupWarning.d.ts +3 -0
  455. package/dist/esm/node/plugin/plugins/suppressRollupWarning.js +48 -0
  456. package/dist/esm/node/plugin/shared/addSsrMiddleware.d.ts +4 -0
  457. package/dist/esm/node/plugin/shared/addSsrMiddleware.js +38 -0
  458. package/dist/esm/node/plugin/shared/findPageFiles.d.ts +4 -0
  459. package/dist/esm/node/plugin/shared/findPageFiles.js +18 -0
  460. package/dist/esm/node/plugin/shared/getConfigValueSource.d.ts +7 -0
  461. package/dist/esm/node/plugin/shared/getConfigValueSource.js +22 -0
  462. package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.d.ts +11 -0
  463. package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js +103 -0
  464. package/dist/esm/node/plugin/shared/isAsset.d.ts +2 -0
  465. package/dist/esm/node/plugin/shared/isAsset.js +38 -0
  466. package/dist/esm/node/plugin/shared/isErrorDebug.d.ts +2 -0
  467. package/dist/esm/node/plugin/shared/isErrorDebug.js +5 -0
  468. package/dist/esm/node/plugin/shared/isViteCliCall.d.ts +10 -0
  469. package/dist/esm/node/plugin/shared/isViteCliCall.js +81 -0
  470. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.d.ts +16 -0
  471. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +12 -0
  472. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.d.ts +16 -0
  473. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +12 -0
  474. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.d.ts +33 -0
  475. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +35 -0
  476. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx.d.ts +47 -0
  477. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx.js +23 -0
  478. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.d.ts +30 -0
  479. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +27 -0
  480. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.d.ts +16 -0
  481. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +16 -0
  482. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.d.ts +16 -0
  483. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +16 -0
  484. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.d.ts +30 -0
  485. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +26 -0
  486. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.d.ts +14 -0
  487. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +10 -0
  488. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.d.ts +16 -0
  489. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +12 -0
  490. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.d.ts +15 -0
  491. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +163 -0
  492. package/dist/esm/node/plugin/shared/loggerNotProd/log.d.ts +14 -0
  493. package/dist/esm/node/plugin/shared/loggerNotProd/log.js +108 -0
  494. package/dist/esm/node/plugin/shared/loggerNotProd.d.ts +39 -0
  495. package/dist/esm/node/plugin/shared/loggerNotProd.js +218 -0
  496. package/dist/esm/node/plugin/shared/loggerVite/removeSuperfluousViteLog.d.ts +6 -0
  497. package/dist/esm/node/plugin/shared/loggerVite/removeSuperfluousViteLog.js +22 -0
  498. package/dist/esm/node/plugin/shared/loggerVite.d.ts +3 -0
  499. package/dist/esm/node/plugin/shared/loggerVite.js +58 -0
  500. package/dist/esm/node/plugin/shared/parseEsModule.d.ts +11 -0
  501. package/dist/esm/node/plugin/shared/parseEsModule.js +31 -0
  502. package/dist/esm/node/plugin/shared/removeSourceMap.d.ts +7 -0
  503. package/dist/esm/node/plugin/shared/removeSourceMap.js +9 -0
  504. package/dist/esm/node/plugin/shared/rollupIsEsm.d.ts +3 -0
  505. package/dist/esm/node/plugin/shared/rollupIsEsm.js +12 -0
  506. package/dist/esm/node/plugin/utils.d.ts +19 -0
  507. package/dist/esm/node/plugin/utils.js +25 -0
  508. package/dist/esm/node/prerender/index.d.ts +1 -0
  509. package/dist/esm/node/prerender/index.js +1 -0
  510. package/dist/esm/node/prerender/runPrerender.d.ts +53 -0
  511. package/dist/esm/node/prerender/runPrerender.js +678 -0
  512. package/dist/esm/node/prerender/utils.d.ts +13 -0
  513. package/dist/esm/node/prerender/utils.js +15 -0
  514. package/dist/esm/node/runtime/globalContext/loadImportBuild.d.ts +18 -0
  515. package/dist/esm/node/runtime/globalContext/loadImportBuild.js +27 -0
  516. package/dist/esm/node/runtime/globalContext.d.ts +52 -0
  517. package/dist/esm/node/runtime/globalContext.js +157 -0
  518. package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.d.ts +27 -0
  519. package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +155 -0
  520. package/dist/esm/node/runtime/html/injectAssets/getViteDevScripts.d.ts +2 -0
  521. package/dist/esm/node/runtime/html/injectAssets/getViteDevScripts.js +22 -0
  522. package/dist/esm/node/runtime/html/injectAssets/inferHtmlTags.d.ts +7 -0
  523. package/dist/esm/node/runtime/html/injectAssets/inferHtmlTags.js +49 -0
  524. package/dist/esm/node/runtime/html/injectAssets/injectAssets__public.d.ts +2 -0
  525. package/dist/esm/node/runtime/html/injectAssets/injectAssets__public.js +29 -0
  526. package/dist/esm/node/runtime/html/injectAssets/injectHtmlTags.d.ts +10 -0
  527. package/dist/esm/node/runtime/html/injectAssets/injectHtmlTags.js +155 -0
  528. package/dist/esm/node/runtime/html/injectAssets/mergeScriptTags.d.ts +2 -0
  529. package/dist/esm/node/runtime/html/injectAssets/mergeScriptTags.js +68 -0
  530. package/dist/esm/node/runtime/html/injectAssets/sanitizeJson.d.ts +2 -0
  531. package/dist/esm/node/runtime/html/injectAssets/sanitizeJson.js +6 -0
  532. package/dist/esm/node/runtime/html/injectAssets.d.ts +34 -0
  533. package/dist/esm/node/runtime/html/injectAssets.js +73 -0
  534. package/dist/esm/node/runtime/html/renderHtml.d.ts +33 -0
  535. package/dist/esm/node/runtime/html/renderHtml.js +231 -0
  536. package/dist/esm/node/runtime/html/serializePageContextClientSide.d.ts +22 -0
  537. package/dist/esm/node/runtime/html/serializePageContextClientSide.js +111 -0
  538. package/dist/esm/node/runtime/html/stream/react-streaming.d.ts +25 -0
  539. package/dist/esm/node/runtime/html/stream/react-streaming.js +33 -0
  540. package/dist/esm/node/runtime/html/stream.d.ts +84 -0
  541. package/dist/esm/node/runtime/html/stream.js +745 -0
  542. package/dist/esm/node/runtime/index-common.d.ts +10 -0
  543. package/dist/esm/node/runtime/index-common.js +11 -0
  544. package/dist/esm/node/runtime/index-deprecated.d.ts +17 -0
  545. package/dist/esm/node/runtime/index-deprecated.js +40 -0
  546. package/dist/esm/node/runtime/index.d.ts +1 -0
  547. package/dist/esm/node/runtime/index.js +3 -0
  548. package/dist/esm/node/runtime/onLoad.d.ts +2 -0
  549. package/dist/esm/node/runtime/onLoad.js +9 -0
  550. package/dist/esm/node/runtime/page-files/setup.d.ts +1 -0
  551. package/dist/esm/node/runtime/page-files/setup.js +21 -0
  552. package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +5 -0
  553. package/dist/esm/node/runtime/renderPage/analyzePage.js +66 -0
  554. package/dist/esm/node/runtime/renderPage/assertArguments.d.ts +2 -0
  555. package/dist/esm/node/runtime/renderPage/assertArguments.js +37 -0
  556. package/dist/esm/node/runtime/renderPage/createHttpResponseObject/assertNoInfiniteHttpRedirect.d.ts +2 -0
  557. package/dist/esm/node/runtime/renderPage/createHttpResponseObject/assertNoInfiniteHttpRedirect.js +38 -0
  558. package/dist/esm/node/runtime/renderPage/createHttpResponseObject.d.ts +28 -0
  559. package/dist/esm/node/runtime/renderPage/createHttpResponseObject.js +65 -0
  560. package/dist/esm/node/runtime/renderPage/debugPageFiles.d.ts +24 -0
  561. package/dist/esm/node/runtime/renderPage/debugPageFiles.js +47 -0
  562. package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderHook.d.ts +7 -0
  563. package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderHook.js +20 -0
  564. package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.d.ts +25 -0
  565. package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.js +133 -0
  566. package/dist/esm/node/runtime/renderPage/getEarlyHints.d.ts +7 -0
  567. package/dist/esm/node/runtime/renderPage/getEarlyHints.js +43 -0
  568. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +31 -0
  569. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +125 -0
  570. package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.d.ts +2 -0
  571. package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +22 -0
  572. package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.d.ts +6 -0
  573. package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +125 -0
  574. package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.d.ts +4 -0
  575. package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +72 -0
  576. package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.d.ts +4 -0
  577. package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +58 -0
  578. package/dist/esm/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.d.ts +3 -0
  579. package/dist/esm/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +30 -0
  580. package/dist/esm/node/runtime/renderPage/getPageAssets.d.ts +19 -0
  581. package/dist/esm/node/runtime/renderPage/getPageAssets.js +130 -0
  582. package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +11 -0
  583. package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.js +37 -0
  584. package/dist/esm/node/runtime/renderPage/handlePageContextRequestUrl.d.ts +5 -0
  585. package/dist/esm/node/runtime/renderPage/handlePageContextRequestUrl.js +30 -0
  586. package/dist/esm/node/runtime/renderPage/inferMediaType.d.ts +7 -0
  587. package/dist/esm/node/runtime/renderPage/inferMediaType.js +38 -0
  588. package/dist/esm/node/runtime/renderPage/isConfigInvalid.d.ts +2 -0
  589. package/dist/esm/node/runtime/renderPage/isConfigInvalid.js +4 -0
  590. package/dist/esm/node/runtime/renderPage/isNewError.d.ts +4 -0
  591. package/dist/esm/node/runtime/renderPage/isNewError.js +20 -0
  592. package/dist/esm/node/runtime/renderPage/loadPageFilesServerSide.d.ts +29 -0
  593. package/dist/esm/node/runtime/renderPage/loadPageFilesServerSide.js +97 -0
  594. package/dist/esm/node/runtime/renderPage/log404/index.d.ts +10 -0
  595. package/dist/esm/node/runtime/renderPage/log404/index.js +138 -0
  596. package/dist/esm/node/runtime/renderPage/loggerProd.d.ts +2 -0
  597. package/dist/esm/node/runtime/renderPage/loggerProd.js +17 -0
  598. package/dist/esm/node/runtime/renderPage/loggerRuntime.d.ts +5 -0
  599. package/dist/esm/node/runtime/renderPage/loggerRuntime.js +15 -0
  600. package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +26 -0
  601. package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.js +16 -0
  602. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +265 -0
  603. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +180 -0
  604. package/dist/esm/node/runtime/renderPage.d.ts +17 -0
  605. package/dist/esm/node/runtime/renderPage.js +399 -0
  606. package/dist/esm/node/runtime/utils.d.ts +52 -0
  607. package/dist/esm/node/runtime/utils.js +55 -0
  608. package/dist/esm/node/shared/ViteManifest.d.ts +13 -0
  609. package/dist/esm/node/shared/ViteManifest.js +1 -0
  610. package/dist/esm/node/shared/assertPluginManifest.d.ts +14 -0
  611. package/dist/esm/node/shared/assertPluginManifest.js +21 -0
  612. package/dist/esm/node/shared/assertRuntimeManifest.d.ts +11 -0
  613. package/dist/esm/node/shared/assertRuntimeManifest.js +16 -0
  614. package/dist/esm/node/shared/extractAssetsQuery.d.ts +4 -0
  615. package/dist/esm/node/shared/extractAssetsQuery.js +26 -0
  616. package/dist/esm/node/shared/getClientEntryFilePath.d.ts +3 -0
  617. package/dist/esm/node/shared/getClientEntryFilePath.js +15 -0
  618. package/dist/esm/node/shared/getConfigVike.d.ts +3 -0
  619. package/dist/esm/node/shared/getConfigVike.js +5 -0
  620. package/dist/esm/node/shared/utils.d.ts +15 -0
  621. package/dist/esm/node/shared/utils.js +17 -0
  622. package/dist/esm/node/shared/virtual-files/virtualFileImportUserCode.d.ts +11 -0
  623. package/dist/esm/node/shared/virtual-files/virtualFileImportUserCode.js +24 -0
  624. package/dist/esm/node/shared/virtual-files/virtualFilePageConfigValuesAll.d.ts +9 -0
  625. package/dist/esm/node/shared/virtual-files/virtualFilePageConfigValuesAll.js +36 -0
  626. package/dist/esm/shared/ConfigVike.d.ts +128 -0
  627. package/dist/esm/shared/ConfigVike.js +1 -0
  628. package/dist/esm/shared/RenderErrorPage.d.ts +1 -0
  629. package/dist/esm/shared/RenderErrorPage.js +2 -0
  630. package/dist/esm/shared/VikeNamespace.d.ts +43 -0
  631. package/dist/esm/shared/VikeNamespace.js +1 -0
  632. package/dist/esm/shared/abort.d.ts +1 -0
  633. package/dist/esm/shared/abort.js +11 -0
  634. package/dist/esm/shared/addIs404ToPageProps.d.ts +7 -0
  635. package/dist/esm/shared/addIs404ToPageProps.js +23 -0
  636. package/dist/esm/shared/addUrlComputedProps.d.ts +62 -0
  637. package/dist/esm/shared/addUrlComputedProps.js +108 -0
  638. package/dist/esm/shared/assertHookReturnedObject.d.ts +4 -0
  639. package/dist/esm/shared/assertHookReturnedObject.js +19 -0
  640. package/dist/esm/shared/assertOnBeforeRenderHookReturn.d.ts +4 -0
  641. package/dist/esm/shared/assertOnBeforeRenderHookReturn.js +16 -0
  642. package/dist/esm/shared/assertPageContextProvidedByUser.d.ts +5 -0
  643. package/dist/esm/shared/assertPageContextProvidedByUser.js +15 -0
  644. package/dist/esm/shared/assertPageFilePath.d.ts +2 -0
  645. package/dist/esm/shared/assertPageFilePath.js +9 -0
  646. package/dist/esm/shared/determinePageIdOld.d.ts +2 -0
  647. package/dist/esm/shared/determinePageIdOld.js +9 -0
  648. package/dist/esm/shared/error-page.d.ts +8 -0
  649. package/dist/esm/shared/error-page.js +38 -0
  650. package/dist/esm/shared/getPageContextRequestUrl.d.ts +6 -0
  651. package/dist/esm/shared/getPageContextRequestUrl.js +13 -0
  652. package/dist/esm/shared/getPageFiles/analyzeClientSide.d.ts +7 -0
  653. package/dist/esm/shared/getPageFiles/analyzeClientSide.js +19 -0
  654. package/dist/esm/shared/getPageFiles/analyzePageClientSide/ClientDependency.d.ts +6 -0
  655. package/dist/esm/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +1 -0
  656. package/dist/esm/shared/getPageFiles/analyzePageClientSide/analyzeExports.d.ts +10 -0
  657. package/dist/esm/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +48 -0
  658. package/dist/esm/shared/getPageFiles/analyzePageClientSide/determineClientEntry.d.ts +14 -0
  659. package/dist/esm/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +27 -0
  660. package/dist/esm/shared/getPageFiles/analyzePageClientSide/getExportNames.d.ts +3 -0
  661. package/dist/esm/shared/getPageFiles/analyzePageClientSide/getExportNames.js +13 -0
  662. package/dist/esm/shared/getPageFiles/analyzePageClientSide.d.ts +17 -0
  663. package/dist/esm/shared/getPageFiles/analyzePageClientSide.js +58 -0
  664. package/dist/esm/shared/getPageFiles/analyzePageServerSide.d.ts +5 -0
  665. package/dist/esm/shared/getPageFiles/analyzePageServerSide.js +20 -0
  666. package/dist/esm/shared/getPageFiles/assertExports.d.ts +7 -0
  667. package/dist/esm/shared/getPageFiles/assertExports.js +21 -0
  668. package/dist/esm/shared/getPageFiles/assertPageConfigs.d.ts +5 -0
  669. package/dist/esm/shared/getPageFiles/assertPageConfigs.js +16 -0
  670. package/dist/esm/shared/getPageFiles/fileTypes.d.ts +8 -0
  671. package/dist/esm/shared/getPageFiles/fileTypes.js +50 -0
  672. package/dist/esm/shared/getPageFiles/getAllPageIdFiles.d.ts +5 -0
  673. package/dist/esm/shared/getPageFiles/getAllPageIdFiles.js +103 -0
  674. package/dist/esm/shared/getPageFiles/getExports.d.ts +39 -0
  675. package/dist/esm/shared/getPageFiles/getExports.js +140 -0
  676. package/dist/esm/shared/getPageFiles/getPageFileObject.d.ts +18 -0
  677. package/dist/esm/shared/getPageFiles/getPageFileObject.js +59 -0
  678. package/dist/esm/shared/getPageFiles/parseGlobResults.d.ts +8 -0
  679. package/dist/esm/shared/getPageFiles/parseGlobResults.js +124 -0
  680. package/dist/esm/shared/getPageFiles/setPageFiles.d.ts +13 -0
  681. package/dist/esm/shared/getPageFiles/setPageFiles.js +44 -0
  682. package/dist/esm/shared/getPageFiles.d.ts +9 -0
  683. package/dist/esm/shared/getPageFiles.js +8 -0
  684. package/dist/esm/shared/hooks/executeHook.d.ts +5 -0
  685. package/dist/esm/shared/hooks/executeHook.js +71 -0
  686. package/dist/esm/shared/hooks/getHook.d.ts +24 -0
  687. package/dist/esm/shared/hooks/getHook.js +26 -0
  688. package/dist/esm/shared/notSerializable.d.ts +1 -0
  689. package/dist/esm/shared/notSerializable.js +2 -0
  690. package/dist/esm/shared/page-configs/Config/PageContextConfig.d.ts +8 -0
  691. package/dist/esm/shared/page-configs/Config/PageContextConfig.js +1 -0
  692. package/dist/esm/shared/page-configs/Config/helpers.d.ts +10 -0
  693. package/dist/esm/shared/page-configs/Config/helpers.js +1 -0
  694. package/dist/esm/shared/page-configs/Config.d.ts +131 -0
  695. package/dist/esm/shared/page-configs/Config.js +1 -0
  696. package/dist/esm/shared/page-configs/PageConfig.d.ts +97 -0
  697. package/dist/esm/shared/page-configs/PageConfig.js +1 -0
  698. package/dist/esm/shared/page-configs/findPageConfig.d.ts +3 -0
  699. package/dist/esm/shared/page-configs/findPageConfig.js +8 -0
  700. package/dist/esm/shared/page-configs/getExportPath.d.ts +2 -0
  701. package/dist/esm/shared/page-configs/getExportPath.js +28 -0
  702. package/dist/esm/shared/page-configs/loadPageCode.d.ts +3 -0
  703. package/dist/esm/shared/page-configs/loadPageCode.js +57 -0
  704. package/dist/esm/shared/page-configs/utils.d.ts +28 -0
  705. package/dist/esm/shared/page-configs/utils.js +74 -0
  706. package/dist/esm/shared/route/abort.d.ts +103 -0
  707. package/dist/esm/shared/route/abort.js +155 -0
  708. package/dist/esm/shared/route/debug.d.ts +3 -0
  709. package/dist/esm/shared/route/debug.js +11 -0
  710. package/dist/esm/shared/route/deduceRouteStringFromFilesystemPath.d.ts +7 -0
  711. package/dist/esm/shared/route/deduceRouteStringFromFilesystemPath.js +50 -0
  712. package/dist/esm/shared/route/executeGuardHook.d.ts +8 -0
  713. package/dist/esm/shared/route/executeGuardHook.js +37 -0
  714. package/dist/esm/shared/route/executeOnBeforeRouteHook.d.ts +17 -0
  715. package/dist/esm/shared/route/executeOnBeforeRouteHook.js +50 -0
  716. package/dist/esm/shared/route/index.d.ts +31 -0
  717. package/dist/esm/shared/route/index.js +113 -0
  718. package/dist/esm/shared/route/loadPageRoutes.d.ts +29 -0
  719. package/dist/esm/shared/route/loadPageRoutes.js +194 -0
  720. package/dist/esm/shared/route/resolvePrecedence.d.ts +8 -0
  721. package/dist/esm/shared/route/resolvePrecedence.js +69 -0
  722. package/dist/esm/shared/route/resolveRedirects.d.ts +4 -0
  723. package/dist/esm/shared/route/resolveRedirects.js +50 -0
  724. package/dist/esm/shared/route/resolveRoute.d.ts +5 -0
  725. package/dist/esm/shared/route/resolveRoute.js +15 -0
  726. package/dist/esm/shared/route/resolveRouteFunction.d.ts +14 -0
  727. package/dist/esm/shared/route/resolveRouteFunction.js +64 -0
  728. package/dist/esm/shared/route/resolveRouteString.d.ts +17 -0
  729. package/dist/esm/shared/route/resolveRouteString.js +95 -0
  730. package/dist/esm/shared/route/routing.d.ts +1 -0
  731. package/dist/esm/shared/route/routing.js +5 -0
  732. package/dist/esm/shared/route/utils.d.ts +18 -0
  733. package/dist/esm/shared/route/utils.js +27 -0
  734. package/dist/esm/shared/sortPageContext.d.ts +2 -0
  735. package/dist/esm/shared/sortPageContext.js +14 -0
  736. package/dist/esm/shared/types.d.ts +127 -0
  737. package/dist/esm/shared/types.js +1 -0
  738. package/dist/esm/shared/utils.d.ts +23 -0
  739. package/dist/esm/shared/utils.js +27 -0
  740. package/dist/esm/types/index-dreprecated.d.ts +51 -0
  741. package/dist/esm/types/index-dreprecated.js +2 -0
  742. package/dist/esm/types/index.d.ts +47 -0
  743. package/dist/esm/types/index.js +1 -0
  744. package/dist/esm/utils/PromiseType.d.ts +1 -0
  745. package/dist/esm/utils/PromiseType.js +1 -0
  746. package/dist/esm/utils/arrayIncludes.d.ts +1 -0
  747. package/dist/esm/utils/arrayIncludes.js +3 -0
  748. package/dist/esm/utils/assert.d.ts +29 -0
  749. package/dist/esm/utils/assert.js +188 -0
  750. package/dist/esm/utils/assertDefaultExport.d.ts +8 -0
  751. package/dist/esm/utils/assertDefaultExport.js +47 -0
  752. package/dist/esm/utils/assertIsBrowser.d.ts +2 -0
  753. package/dist/esm/utils/assertIsBrowser.js +6 -0
  754. package/dist/esm/utils/assertIsNotBrowser.d.ts +3 -0
  755. package/dist/esm/utils/assertIsNotBrowser.js +7 -0
  756. package/dist/esm/utils/assertIsNotProductionRuntime.d.ts +10 -0
  757. package/dist/esm/utils/assertIsNotProductionRuntime.js +41 -0
  758. package/dist/esm/utils/assertNodeVersion.d.ts +2 -0
  759. package/dist/esm/utils/assertNodeVersion.js +11 -0
  760. package/dist/esm/utils/assertPathIsFilesystemAbsolute.d.ts +3 -0
  761. package/dist/esm/utils/assertPathIsFilesystemAbsolute.js +14 -0
  762. package/dist/esm/utils/assertRoutingType.d.ts +6 -0
  763. package/dist/esm/utils/assertRoutingType.js +24 -0
  764. package/dist/esm/utils/assertSingleInstance.d.ts +6 -0
  765. package/dist/esm/utils/assertSingleInstance.js +94 -0
  766. package/dist/esm/utils/autoRetry.d.ts +2 -0
  767. package/dist/esm/utils/autoRetry.js +20 -0
  768. package/dist/esm/utils/capitalizeFirstLetter.d.ts +2 -0
  769. package/dist/esm/utils/capitalizeFirstLetter.js +7 -0
  770. package/dist/esm/utils/cast.d.ts +4 -0
  771. package/dist/esm/utils/cast.js +4 -0
  772. package/dist/esm/utils/checkType.d.ts +2 -0
  773. package/dist/esm/utils/checkType.js +2 -0
  774. package/dist/esm/utils/compareString.d.ts +2 -0
  775. package/dist/esm/utils/compareString.js +8 -0
  776. package/dist/esm/utils/createErrorWithCleanStackTrace.d.ts +2 -0
  777. package/dist/esm/utils/createErrorWithCleanStackTrace.js +43 -0
  778. package/dist/esm/utils/debug.d.ts +15 -0
  779. package/dist/esm/utils/debug.js +106 -0
  780. package/dist/esm/utils/debugGlob.d.ts +8 -0
  781. package/dist/esm/utils/debugGlob.js +3 -0
  782. package/dist/esm/utils/deepEqual.d.ts +1 -0
  783. package/dist/esm/utils/deepEqual.js +7 -0
  784. package/dist/esm/utils/dynamicImport.d.ts +2 -0
  785. package/dist/esm/utils/dynamicImport.js +4 -0
  786. package/dist/esm/utils/escapeRegex.d.ts +1 -0
  787. package/dist/esm/utils/escapeRegex.js +4 -0
  788. package/dist/esm/utils/filesystemPathHandling.d.ts +4 -0
  789. package/dist/esm/utils/filesystemPathHandling.js +16 -0
  790. package/dist/esm/utils/findUserPackageJsonPath.d.ts +2 -0
  791. package/dist/esm/utils/findUserPackageJsonPath.js +18 -0
  792. package/dist/esm/utils/freezePartial.d.ts +2 -0
  793. package/dist/esm/utils/freezePartial.js +30 -0
  794. package/dist/esm/utils/getCurrentUrl.d.ts +4 -0
  795. package/dist/esm/utils/getCurrentUrl.js +16 -0
  796. package/dist/esm/utils/getDependencyPackageJson.d.ts +6 -0
  797. package/dist/esm/utils/getDependencyPackageJson.js +85 -0
  798. package/dist/esm/utils/getFileExtension.d.ts +2 -0
  799. package/dist/esm/utils/getFileExtension.js +14 -0
  800. package/dist/esm/utils/getFilePathAbsolute.d.ts +5 -0
  801. package/dist/esm/utils/getFilePathAbsolute.js +64 -0
  802. package/dist/esm/utils/getGlobalObject.d.ts +4 -0
  803. package/dist/esm/utils/getGlobalObject.js +7 -0
  804. package/dist/esm/utils/getMostSimilar.d.ts +2 -0
  805. package/dist/esm/utils/getMostSimilar.js +66 -0
  806. package/dist/esm/utils/getOutDirs.d.ts +16 -0
  807. package/dist/esm/utils/getOutDirs.js +115 -0
  808. package/dist/esm/utils/getPropAccessNotation.d.ts +2 -0
  809. package/dist/esm/utils/getPropAccessNotation.js +7 -0
  810. package/dist/esm/utils/getRandomId.d.ts +2 -0
  811. package/dist/esm/utils/getRandomId.js +12 -0
  812. package/dist/esm/utils/getTerminWidth.d.ts +1 -0
  813. package/dist/esm/utils/getTerminWidth.js +4 -0
  814. package/dist/esm/utils/getValuePrintable.d.ts +1 -0
  815. package/dist/esm/utils/getValuePrintable.js +7 -0
  816. package/dist/esm/utils/hasProp.d.ts +14 -0
  817. package/dist/esm/utils/hasProp.js +45 -0
  818. package/dist/esm/utils/hasPropertyGetter.d.ts +1 -0
  819. package/dist/esm/utils/hasPropertyGetter.js +4 -0
  820. package/dist/esm/utils/humanizeTime.d.ts +2 -0
  821. package/dist/esm/utils/humanizeTime.js +22 -0
  822. package/dist/esm/utils/isBrowser.d.ts +1 -0
  823. package/dist/esm/utils/isBrowser.js +5 -0
  824. package/dist/esm/utils/isCallable.d.ts +1 -0
  825. package/dist/esm/utils/isCallable.js +3 -0
  826. package/dist/esm/utils/isDev.d.ts +7 -0
  827. package/dist/esm/utils/isDev.js +29 -0
  828. package/dist/esm/utils/isEquivalentError.d.ts +2 -0
  829. package/dist/esm/utils/isEquivalentError.js +15 -0
  830. package/dist/esm/utils/isHtml.d.ts +2 -0
  831. package/dist/esm/utils/isHtml.js +7 -0
  832. package/dist/esm/utils/isNodeJS.d.ts +1 -0
  833. package/dist/esm/utils/isNodeJS.js +13 -0
  834. package/dist/esm/utils/isNotNullish.d.ts +1 -0
  835. package/dist/esm/utils/isNotNullish.js +1 -0
  836. package/dist/esm/utils/isNpmPackage.d.ts +17 -0
  837. package/dist/esm/utils/isNpmPackage.js +94 -0
  838. package/dist/esm/utils/isObject.d.ts +1 -0
  839. package/dist/esm/utils/isObject.js +3 -0
  840. package/dist/esm/utils/isObjectWithKeys.d.ts +4 -0
  841. package/dist/esm/utils/isObjectWithKeys.js +13 -0
  842. package/dist/esm/utils/isPlainObject.d.ts +3 -0
  843. package/dist/esm/utils/isPlainObject.js +15 -0
  844. package/dist/esm/utils/isPromise.d.ts +1 -0
  845. package/dist/esm/utils/isPromise.js +4 -0
  846. package/dist/esm/utils/isReact.d.ts +1 -0
  847. package/dist/esm/utils/isReact.js +20 -0
  848. package/dist/esm/utils/isScriptFile.d.ts +8 -0
  849. package/dist/esm/utils/isScriptFile.js +50 -0
  850. package/dist/esm/utils/isStemPackageName.d.ts +1 -0
  851. package/dist/esm/utils/isStemPackageName.js +10 -0
  852. package/dist/esm/utils/isStringRecord.d.ts +1 -0
  853. package/dist/esm/utils/isStringRecord.js +3 -0
  854. package/dist/esm/utils/isVitest.d.ts +1 -0
  855. package/dist/esm/utils/isVitest.js +3 -0
  856. package/dist/esm/utils/joinEnglish.d.ts +2 -0
  857. package/dist/esm/utils/joinEnglish.js +11 -0
  858. package/dist/esm/utils/mergeCumulativeValues.d.ts +2 -0
  859. package/dist/esm/utils/mergeCumulativeValues.js +18 -0
  860. package/dist/esm/utils/nodeEnv.d.ts +4 -0
  861. package/dist/esm/utils/nodeEnv.js +13 -0
  862. package/dist/esm/utils/objectAssign.d.ts +2 -0
  863. package/dist/esm/utils/objectAssign.js +7 -0
  864. package/dist/esm/utils/objectEntries.d.ts +4 -0
  865. package/dist/esm/utils/objectEntries.js +5 -0
  866. package/dist/esm/utils/objectKeys.d.ts +2 -0
  867. package/dist/esm/utils/objectKeys.js +6 -0
  868. package/dist/esm/utils/pLimit.d.ts +14 -0
  869. package/dist/esm/utils/pLimit.js +131 -0
  870. package/dist/esm/utils/parseUrl-extras.d.ts +17 -0
  871. package/dist/esm/utils/parseUrl-extras.js +93 -0
  872. package/dist/esm/utils/parseUrl.d.ts +22 -0
  873. package/dist/esm/utils/parseUrl.js +216 -0
  874. package/dist/esm/utils/path-shim.d.ts +2 -0
  875. package/dist/esm/utils/path-shim.js +12 -0
  876. package/dist/esm/utils/projectInfo.d.ts +11 -0
  877. package/dist/esm/utils/projectInfo.js +11 -0
  878. package/dist/esm/utils/removeEmptyLines.d.ts +1 -0
  879. package/dist/esm/utils/removeEmptyLines.js +6 -0
  880. package/dist/esm/utils/removeFileExtention.d.ts +1 -0
  881. package/dist/esm/utils/removeFileExtention.js +3 -0
  882. package/dist/esm/utils/resolve.d.ts +2 -0
  883. package/dist/esm/utils/resolve.js +57 -0
  884. package/dist/esm/utils/serverSideRouteTo.d.ts +2 -0
  885. package/dist/esm/utils/serverSideRouteTo.js +4 -0
  886. package/dist/esm/utils/sleep.d.ts +1 -0
  887. package/dist/esm/utils/sleep.js +3 -0
  888. package/dist/esm/utils/slice.d.ts +3 -0
  889. package/dist/esm/utils/slice.js +33 -0
  890. package/dist/esm/utils/sorter.d.ts +8 -0
  891. package/dist/esm/utils/sorter.js +57 -0
  892. package/dist/esm/utils/stringifyStringArray.d.ts +2 -0
  893. package/dist/esm/utils/stringifyStringArray.js +4 -0
  894. package/dist/esm/utils/stripAnsi.d.ts +2 -0
  895. package/dist/esm/utils/stripAnsi.js +19 -0
  896. package/dist/esm/utils/styleFileRE.d.ts +1 -0
  897. package/dist/esm/utils/styleFileRE.js +2 -0
  898. package/dist/esm/utils/throttle.d.ts +2 -0
  899. package/dist/esm/utils/throttle.js +13 -0
  900. package/dist/esm/utils/trackLogs.d.ts +1 -0
  901. package/dist/esm/utils/trackLogs.js +26 -0
  902. package/dist/esm/utils/trimWithAnsi.d.ts +4 -0
  903. package/dist/esm/utils/trimWithAnsi.js +38 -0
  904. package/dist/esm/utils/truncateString.d.ts +1 -0
  905. package/dist/esm/utils/truncateString.js +15 -0
  906. package/dist/esm/utils/unique.d.ts +2 -0
  907. package/dist/esm/utils/unique.js +4 -0
  908. package/dist/esm/utils/urlToFile.d.ts +4 -0
  909. package/dist/esm/utils/urlToFile.js +33 -0
  910. package/dist/esm/utils/virtual-files.d.ts +6 -0
  911. package/dist/esm/utils/virtual-files.js +30 -0
  912. package/dist/esm/utils/viteIsSSR.d.ts +11 -0
  913. package/dist/esm/utils/viteIsSSR.js +20 -0
  914. package/dist/esm/utils/warnIfErrorIsNotObject.d.ts +2 -0
  915. package/dist/esm/utils/warnIfErrorIsNotObject.js +18 -0
  916. package/node/cli/bin-entry.js +3 -0
  917. package/package.json +198 -1
  918. package/plugin.js +2 -0
  919. package/prerender.js +2 -0
  920. package/readme.md +3 -1
  921. package/routing.js +2 -0
  922. package/server.js +2 -0
@@ -0,0 +1,85 @@
1
+ export { getDependencyPackageJson };
2
+ export { getDependencyPackageJsonPath };
3
+ export { getDependencyRootDir };
4
+ // There doesn't seem to be any alternative:
5
+ // - https://github.com/antfu/local-pkg
6
+ // - https://stackoverflow.com/questions/74640378/find-and-read-package-json-of-a-dependency
7
+ // - https://stackoverflow.com/questions/58442451/finding-the-root-directory-of-a-dependency-in-npm
8
+ // - https://stackoverflow.com/questions/10111163/how-can-i-get-the-path-of-a-module-i-have-loaded-via-require-that-is-not-mine/63441056#63441056
9
+ import { assert, assertUsage } from './assert.js';
10
+ import { isNpmPackageName } from './isNpmPackage.js';
11
+ import { toPosixPath } from './filesystemPathHandling.js';
12
+ import { isObject } from './isObject.js';
13
+ import path from 'path';
14
+ import fs from 'fs';
15
+ import { assertIsNotProductionRuntime } from './assertIsNotProductionRuntime.js';
16
+ import { createRequire } from 'module';
17
+ // @ts-ignore Shimed by dist-cjs-fixup.js for CJS build.
18
+ const importMetaUrl = import.meta.url;
19
+ const require_ = createRequire(importMetaUrl);
20
+ assertIsNotProductionRuntime();
21
+ function getDependencyPackageJson(npmPackageName, userAppRootDir) {
22
+ const packageJsonPath = getDependencyPackageJsonPath(npmPackageName, userAppRootDir);
23
+ const packageJson = fs.readFileSync(packageJsonPath, 'utf8');
24
+ assert(isObject(packageJson));
25
+ return packageJson;
26
+ }
27
+ function getDependencyRootDir(npmPackageName, userAppRootDir) {
28
+ const rootDir = path.posix.dirname(getDependencyPackageJsonPath(npmPackageName, userAppRootDir));
29
+ return rootDir;
30
+ }
31
+ function getDependencyPackageJsonPath(npmPackageName, userAppRootDir) {
32
+ assert(isNpmPackageName(npmPackageName));
33
+ let packageJsonPath = resolvePackageJsonDirectly(npmPackageName, userAppRootDir);
34
+ if (!packageJsonPath) {
35
+ packageJsonPath = resolvePackageJsonWithMainEntry(npmPackageName, userAppRootDir);
36
+ }
37
+ assertUsage(packageJsonPath, `Cannot read ${npmPackageName}/package.json. Define package.json#exports["./package.json"] with the value "./package.json" in the package.json of ${npmPackageName}.`);
38
+ packageJsonPath = toPosixPath(packageJsonPath);
39
+ assert(packageJsonPath.endsWith('/package.json'), packageJsonPath); // package.json#exports["package.json"] may point to another file than package.json
40
+ return packageJsonPath;
41
+ }
42
+ function resolvePackageJsonDirectly(npmPackageName, userAppRootDir) {
43
+ let packageJsonPath;
44
+ try {
45
+ packageJsonPath = require_.resolve(`${npmPackageName}/package.json`, { paths: [userAppRootDir] });
46
+ }
47
+ catch (err) {
48
+ if (isUnexpectedError(err))
49
+ throw err;
50
+ return null;
51
+ }
52
+ return packageJsonPath;
53
+ }
54
+ function resolvePackageJsonWithMainEntry(npmPackageName, userAppRootDir) {
55
+ let mainEntry;
56
+ try {
57
+ mainEntry = require_.resolve(npmPackageName, { paths: [userAppRootDir] });
58
+ }
59
+ catch (err) {
60
+ if (isUnexpectedError(err))
61
+ throw err;
62
+ return null;
63
+ }
64
+ const packageJsonPath = searchPackageJSON(mainEntry);
65
+ return packageJsonPath;
66
+ }
67
+ // If the npm package doesn't define package.json#exports then require.resolve(`${npmPackageName}/package.json`) just works.
68
+ // This means we can assume packageJson#exports to be defined and, consequently, we can assume the error code to always be ERR_PACKAGE_PATH_NOT_EXPORTED.
69
+ // (If MODULE_NOT_FOUND is thrown then this means that npmPackageName isn't installed.)
70
+ function isUnexpectedError(err) {
71
+ return err?.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED';
72
+ }
73
+ // Copied and adapted from https://github.com/antfu/local-pkg
74
+ function searchPackageJSON(dir) {
75
+ let packageJsonPath;
76
+ while (true) {
77
+ assert(dir);
78
+ const newDir = path.dirname(dir);
79
+ assert(newDir !== dir);
80
+ dir = newDir;
81
+ packageJsonPath = path.join(dir, 'package.json');
82
+ if (fs.existsSync(packageJsonPath))
83
+ return packageJsonPath;
84
+ }
85
+ }
@@ -0,0 +1,2 @@
1
+ export { getFileExtension };
2
+ declare function getFileExtension(id: string): string | null;
@@ -0,0 +1,14 @@
1
+ export { getFileExtension };
2
+ import { slice } from './slice.js';
3
+ function getFileExtension(id) {
4
+ id = id.split('?')[0];
5
+ const fileName = slice(id.split('/'), -1, 0)[0];
6
+ if (!fileName) {
7
+ return null;
8
+ }
9
+ const fileExtension = slice(fileName.split('.'), -1, 0)[0];
10
+ if (!fileExtension) {
11
+ return null;
12
+ }
13
+ return fileExtension;
14
+ }
@@ -0,0 +1,5 @@
1
+ export { getFilePathAbsolute };
2
+ export { getFilePathRelativeToUserRootDir };
3
+ import type { ResolvedConfig } from 'vite';
4
+ declare function getFilePathAbsolute(filePath: string, config: ResolvedConfig): string;
5
+ declare function getFilePathRelativeToUserRootDir(filePathAbsolute: string, userRootDir: string, alwaysRelative?: boolean): string;
@@ -0,0 +1,64 @@
1
+ export { getFilePathAbsolute };
2
+ export { getFilePathRelativeToUserRootDir };
3
+ import { assertPosixPath, toPosixPath } from './filesystemPathHandling.js';
4
+ import { assert } from './assert.js';
5
+ import path from 'path';
6
+ import { assertIsNotProductionRuntime } from './assertIsNotProductionRuntime.js';
7
+ import { isNpmPackageImport } from './isNpmPackage.js';
8
+ import { assertPathIsFilesystemAbsolute } from './assertPathIsFilesystemAbsolute.js';
9
+ import { createRequire } from 'module';
10
+ // @ts-ignore Shimed by dist-cjs-fixup.js for CJS build.
11
+ const importMetaUrl = import.meta.url;
12
+ const require_ = createRequire(importMetaUrl);
13
+ assertIsNotProductionRuntime();
14
+ // Vite handles paths such as /pages/index.page.js which are relative to `config.root`.
15
+ // Make them absolute starting from the filesystem root.
16
+ // Also resolve plus files living in npm packages such as restack/renderer/+onRenderHtml.js
17
+ function getFilePathAbsolute(filePath, config) {
18
+ assertPosixPath(filePath);
19
+ if (filePath.startsWith('/@fs/')) {
20
+ return filePath;
21
+ }
22
+ let filePathUnresolved;
23
+ if (isNpmPackageImport(filePath)) {
24
+ filePathUnresolved = filePath;
25
+ }
26
+ else {
27
+ assert(filePath.startsWith('/'));
28
+ const { root } = config;
29
+ assertPathIsFilesystemAbsolute(root);
30
+ filePathUnresolved = path.posix.join(root, filePath);
31
+ assertPathIsFilesystemAbsolute(filePathUnresolved);
32
+ }
33
+ let filePathAbsolute;
34
+ try {
35
+ filePathAbsolute = require_.resolve(filePathUnresolved, { paths: [config.root] });
36
+ }
37
+ catch (err) {
38
+ console.error(err);
39
+ assert(false);
40
+ }
41
+ filePathAbsolute = toPosixPath(filePathAbsolute);
42
+ assertPathIsFilesystemAbsolute(filePathAbsolute);
43
+ return filePathAbsolute;
44
+ }
45
+ function getFilePathRelativeToUserRootDir(filePathAbsolute, userRootDir, alwaysRelative = false) {
46
+ assertPosixPath(filePathAbsolute);
47
+ assertPosixPath(userRootDir);
48
+ let filePathRelativeToUserRootDir = path.posix.relative(userRootDir, filePathAbsolute);
49
+ if (filePathAbsolute.startsWith(userRootDir)) {
50
+ assert(!filePathRelativeToUserRootDir.startsWith('.') && !filePathRelativeToUserRootDir.startsWith('/'),
51
+ // Surprinsingly, this assertion seem to fail sometimes: https://github.com/vikejs/vike/issues/1139
52
+ { filePathRelativeToUserRootDir, filePathAbsolute, userRootDir });
53
+ filePathRelativeToUserRootDir = `/${filePathRelativeToUserRootDir}`;
54
+ return filePathRelativeToUserRootDir;
55
+ }
56
+ else {
57
+ if (alwaysRelative) {
58
+ return filePathRelativeToUserRootDir;
59
+ }
60
+ else {
61
+ return filePathAbsolute;
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,4 @@
1
+ export declare function getGlobalObject<T extends Record<string, unknown> = never>(key: `${string}.ts`, defaultValue: T): T;
2
+ declare global {
3
+ var __vike: undefined | Record<string, Record<string, unknown>>;
4
+ }
@@ -0,0 +1,7 @@
1
+ export function getGlobalObject(
2
+ // We use the filename as key; each `getGlobalObject()` call should live in a unique filename.
3
+ key, defaultValue) {
4
+ const allGlobalObjects = (globalThis.__vike = globalThis.__vike || {});
5
+ const globalObject = (allGlobalObjects[key] = allGlobalObjects[key] || defaultValue);
6
+ return globalObject;
7
+ }
@@ -0,0 +1,2 @@
1
+ export { getMostSimilar };
2
+ declare function getMostSimilar(word: string, words: string[]): null | string;
@@ -0,0 +1,66 @@
1
+ export { getMostSimilar };
2
+ import { assert } from './assert.js';
3
+ import { higherFirst } from './sorter.js';
4
+ import { assertIsNotBrowser } from './assertIsNotBrowser.js';
5
+ assertIsNotBrowser();
6
+ function getMostSimilar(word, words) {
7
+ if (words.length === 0)
8
+ return null;
9
+ const exactMatch = words.find((w) => w === word);
10
+ if (exactMatch)
11
+ return exactMatch;
12
+ const lowerCaseMatch = words.find((w) => w.toLowerCase() === word.toLowerCase());
13
+ if (lowerCaseMatch)
14
+ return lowerCaseMatch;
15
+ const mostSimilar = words
16
+ .map((w) => ({
17
+ word: w,
18
+ similarity: getSimilarity(w, word)
19
+ }))
20
+ .sort(higherFirst(({ similarity }) => similarity))[0];
21
+ assert(mostSimilar);
22
+ if (mostSimilar.similarity >= 0.8) {
23
+ return mostSimilar.word;
24
+ }
25
+ else {
26
+ return null;
27
+ }
28
+ }
29
+ // https://stackoverflow.com/questions/10473745/compare-strings-javascript-return-of-likely/36566052#36566052
30
+ function getSimilarity(s1, s2) {
31
+ var longer = s1;
32
+ var shorter = s2;
33
+ if (s1.length < s2.length) {
34
+ longer = s2;
35
+ shorter = s1;
36
+ }
37
+ var longerLength = longer.length;
38
+ if (longerLength == 0) {
39
+ return 1.0;
40
+ }
41
+ return (longerLength - editDistance(longer, shorter)) / longerLength;
42
+ }
43
+ function editDistance(s1, s2) {
44
+ s1 = s1.toLowerCase();
45
+ s2 = s2.toLowerCase();
46
+ var costs = new Array();
47
+ for (var i = 0; i <= s1.length; i++) {
48
+ var lastValue = i;
49
+ for (var j = 0; j <= s2.length; j++) {
50
+ if (i == 0)
51
+ costs[j] = j;
52
+ else {
53
+ if (j > 0) {
54
+ var newValue = costs[j - 1];
55
+ if (s1.charAt(i - 1) != s2.charAt(j - 1))
56
+ newValue = Math.min(Math.min(newValue, lastValue), costs[j]) + 1;
57
+ costs[j - 1] = lastValue;
58
+ lastValue = newValue;
59
+ }
60
+ }
61
+ }
62
+ if (i > 0)
63
+ costs[s2.length] = lastValue;
64
+ }
65
+ return costs[s2.length];
66
+ }
@@ -0,0 +1,16 @@
1
+ export { getOutDirs };
2
+ export { getOutDirs_prerender };
3
+ export { resolveOutDir };
4
+ import type { UserConfig, ResolvedConfig } from 'vite';
5
+ type OutDirs = {
6
+ /** Absolute path to `outDir` */
7
+ outDirRoot: string;
8
+ /** Absolute path to `${outDir}/client` */
9
+ outDirClient: string;
10
+ /** Absolute path to `${outDir}/server` */
11
+ outDirServer: string;
12
+ };
13
+ declare function getOutDirs(config: ResolvedConfig): OutDirs;
14
+ declare function getOutDirs_prerender(config: ResolvedConfig): OutDirs;
15
+ /** Appends `client/` or `server/` to `config.build.outDir` */
16
+ declare function resolveOutDir(config: UserConfig): string;
@@ -0,0 +1,115 @@
1
+ export { getOutDirs };
2
+ export { getOutDirs_prerender };
3
+ export { resolveOutDir };
4
+ import { viteIsSSR } from './viteIsSSR.js';
5
+ import { assert, assertUsage } from './assert.js';
6
+ import { pathJoin } from './path-shim.js';
7
+ import { assertPosixPath, toPosixPath } from './filesystemPathHandling.js';
8
+ import pc from '@brillout/picocolors';
9
+ function getOutDirs(config) {
10
+ const outDir = getOutDirFromResolvedConfig(config);
11
+ assertOutDirResolved(outDir, config);
12
+ assert(outDir.endsWith('/server') || outDir.endsWith('/client'));
13
+ assert('/client'.length === '/server'.length);
14
+ const outDirRoot = outDir.slice(0, -1 * '/client'.length);
15
+ return getOutDirsAll(outDirRoot, config.root);
16
+ }
17
+ function getOutDirs_prerender(config) {
18
+ const outDirRoot = getOutDirFromResolvedConfig(config);
19
+ assert(isOutDirRoot(outDirRoot));
20
+ return getOutDirsAll(outDirRoot, config.root);
21
+ }
22
+ /** Appends `client/` or `server/` to `config.build.outDir` */
23
+ function resolveOutDir(config) {
24
+ const outDir = getOutDirFromUserConfig(config) || 'dist';
25
+ // outDir may already be resolved when using Telefunc + vike (because both Telefunc and vike use this logic)
26
+ if (!isOutDirRoot(outDir)) {
27
+ assertOutDirResolved(outDir, config);
28
+ return outDir;
29
+ }
30
+ else {
31
+ const { outDirClient, outDirServer } = determineOutDirs(outDir);
32
+ if (viteIsSSR(config)) {
33
+ return outDirServer;
34
+ }
35
+ else {
36
+ return outDirClient;
37
+ }
38
+ }
39
+ }
40
+ function determineOutDirs(outDirRoot) {
41
+ assertPosixPath(outDirRoot);
42
+ assert(isOutDirRoot(outDirRoot));
43
+ const outDirClient = pathJoin(outDirRoot, 'client');
44
+ const outDirServer = pathJoin(outDirRoot, 'server');
45
+ assertIsNotOutDirRoot(outDirClient);
46
+ assertIsNotOutDirRoot(outDirServer);
47
+ return { outDirClient, outDirServer };
48
+ }
49
+ function getOutDirsAll(outDirRoot, root) {
50
+ if (!outDirIsAbsolutePath(outDirRoot)) {
51
+ assertPosixPath(outDirRoot);
52
+ assertPosixPath(root);
53
+ outDirRoot = pathJoin(root, outDirRoot);
54
+ }
55
+ let { outDirClient, outDirServer } = determineOutDirs(outDirRoot);
56
+ outDirRoot = outDirRoot + '/';
57
+ outDirClient = outDirClient + '/';
58
+ outDirServer = outDirServer + '/';
59
+ assertNormalization(outDirRoot);
60
+ assertNormalization(outDirClient);
61
+ assertNormalization(outDirServer);
62
+ return { outDirRoot, outDirClient, outDirServer };
63
+ }
64
+ function assertNormalization(outDirAny) {
65
+ assertPosixPath(outDirAny);
66
+ assert(outDirIsAbsolutePath(outDirAny));
67
+ assert(outDirAny.endsWith('/'));
68
+ assert(!outDirAny.endsWith('//'));
69
+ }
70
+ function isOutDirRoot(outDirRot) {
71
+ const p = outDirRot.split('/').filter(Boolean);
72
+ const lastDir = p[p.length - 1];
73
+ return lastDir !== 'client' && lastDir !== 'server';
74
+ }
75
+ function assertIsNotOutDirRoot(outDir) {
76
+ assert(outDir.endsWith('/client') || outDir.endsWith('/server'));
77
+ }
78
+ /** `outDir` ends with `/server` or `/client` */
79
+ function assertOutDirResolved(outDir, config) {
80
+ assertPosixPath(outDir);
81
+ assertIsNotOutDirRoot(outDir);
82
+ assert('/client'.length === '/server'.length);
83
+ const outDirCorrected = outDir.slice(0, -1 * '/client'.length);
84
+ const wrongUsage = `You've set Vite's config.build.outDir to ${pc.cyan(outDir)} but you should set it to ${pc.cyan(outDirCorrected)} instead.`;
85
+ if (viteIsSSR(config)) {
86
+ assertUsage(outDir.endsWith('/server'), wrongUsage);
87
+ }
88
+ else {
89
+ assertUsage(outDir.endsWith('/client'), wrongUsage);
90
+ }
91
+ }
92
+ function getOutDirFromUserConfig(config) {
93
+ let outDir = config.build?.outDir;
94
+ if (outDir === undefined)
95
+ return undefined;
96
+ // I believe Vite normalizes config.build.outDir only if config is ResolvedConfig
97
+ outDir = toPosixPath(outDir);
98
+ return outDir;
99
+ }
100
+ function getOutDirFromResolvedConfig(config) {
101
+ let outDir = config.build.outDir;
102
+ // Vite seems to be buggy and doesn't always normalize config.build.outDir
103
+ outDir = toPosixPath(outDir);
104
+ return outDir;
105
+ }
106
+ function outDirIsAbsolutePath(outDir) {
107
+ // There doesn't seem to be a better alternative to determine whether `outDir` is an aboslute path
108
+ // - Very unlikely that `outDir`'s first dir macthes the filesystem's first dir
109
+ // - Although more likely to happen with Docker
110
+ return getFirstDir(outDir) === getFirstDir(process.cwd());
111
+ }
112
+ function getFirstDir(p) {
113
+ const firstDir = p.split(/\/|\\/).filter(Boolean)[0];
114
+ return firstDir;
115
+ }
@@ -0,0 +1,2 @@
1
+ export { getPropAccessNotation };
2
+ declare function getPropAccessNotation(key: string): `.${string}` | `[${string}]`;
@@ -0,0 +1,7 @@
1
+ export { getPropAccessNotation };
2
+ function getPropAccessNotation(key) {
3
+ return isKeyDotNotationCompatible(key) ? `.${key}` : `[${JSON.stringify(key)}]`;
4
+ }
5
+ function isKeyDotNotationCompatible(key) {
6
+ return /^[a-z0-9\$_]+$/i.test(key);
7
+ }
@@ -0,0 +1,2 @@
1
+ export { getRandomId };
2
+ declare function getRandomId(length: number): string;
@@ -0,0 +1,12 @@
1
+ export { getRandomId };
2
+ import { assert } from './assert.js';
3
+ // https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
4
+ function getRandomId(length) {
5
+ let randomId = '';
6
+ while (randomId.length < length) {
7
+ randomId += Math.random().toString(36).slice(2);
8
+ }
9
+ randomId = randomId.slice(0, length);
10
+ assert(/^[a-z0-9]+$/.test(randomId) && randomId.length === length);
11
+ return randomId;
12
+ }
@@ -0,0 +1 @@
1
+ export declare function getTerminalWidth(): number | undefined;
@@ -0,0 +1,4 @@
1
+ export function getTerminalWidth() {
2
+ // https://stackoverflow.com/questions/30335637/get-width-of-terminal-in-node-js/30335724#30335724
3
+ return ((typeof process !== 'undefined' && typeof process.stdout !== 'undefined' && process.stdout.columns) || undefined);
4
+ }
@@ -0,0 +1 @@
1
+ export declare function getValuePrintable(value: unknown): null | string;
@@ -0,0 +1,7 @@
1
+ export function getValuePrintable(value) {
2
+ if ([null, undefined].includes(value))
3
+ return String(value);
4
+ if (['undefined', 'boolean', 'number', 'string'].includes(typeof value))
5
+ return JSON.stringify(value);
6
+ return null;
7
+ }
@@ -0,0 +1,14 @@
1
+ export { hasProp };
2
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'boolean'): obj is ObjectType & Record<PropName, boolean>;
3
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'number'): obj is ObjectType & Record<PropName, number>;
4
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'string'): obj is ObjectType & Record<PropName, string>;
5
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'object'): obj is ObjectType & Record<PropName, Record<string, unknown>>;
6
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'array'): obj is ObjectType & Record<PropName, unknown[]>;
7
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'string[]'): obj is ObjectType & Record<PropName, string[]>;
8
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'function'): obj is ObjectType & Record<PropName, (...args: any[]) => unknown>;
9
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'undefined'): obj is ObjectType & Record<PropName, undefined>;
10
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'null'): obj is ObjectType & Record<PropName, null>;
11
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'true'): obj is ObjectType & Record<PropName, true>;
12
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'false'): obj is ObjectType & Record<PropName, false>;
13
+ declare function hasProp<ObjectType, PropName extends PropertyKey, Enum>(obj: ObjectType, prop: PropName, type: Enum[]): obj is ObjectType & Record<PropName, Enum>;
14
+ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName): obj is ObjectType & Record<PropName, unknown>;
@@ -0,0 +1,45 @@
1
+ export { hasProp };
2
+ // - https://2ality.com/2020/06/type-guards-assertion-functions-typescript.html
3
+ // - https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABDAzgFQJ4AcCmdgAUAbgIYA2IOAXIiWBgDSJTbWIDkARnHGTnewCUNUhRzIUibr35gA3AFgAUKEiwEEzLnzFylGnUbNWNdmBABbTjgBOQkXvGpE5q7cUrw0eElRa8hKL6tPRMLLimKFA2MGAA5vaIQU6SUTHxHqreGn6sOskGocYRHOAA1mBwAO5gickSiOWVNZle6r7oeYGOhUbhbGmxcYgAvKVgFdW1wlI8fHSIAN7KiMiExeIjW+OTNeyIgksrq4g2OFAgNkjRlMcAvsdnF1cb+EmOo9v9Hg9KyhAIKK0GhNKajRAAFgATMplCQUChbFACLltIQSEwzJZrHZBIJ-oCZAA6MhwOIEEj4v6eNQ+WgIpEEAFgAAmMHaIImzTAM3hiJsUEkzLZ7SOShOa0QTIQIp8hyelzAx1WUAAFjZqi4cFVEABRGwamwEdgAQQZArpADESDAyEJlHcgA
4
+ import { isCallable } from './isCallable.js';
5
+ import { isObject } from './isObject.js';
6
+ // prettier-ignore
7
+ function hasProp(obj, prop, type = 'unknown') {
8
+ if (!isObject(obj))
9
+ return false;
10
+ if (!(prop in obj)) {
11
+ return type === 'undefined';
12
+ }
13
+ if (type === 'unknown') {
14
+ return true;
15
+ }
16
+ const propValue = obj[prop];
17
+ if (type === 'array') {
18
+ return Array.isArray(propValue);
19
+ }
20
+ if (type === 'object') {
21
+ return isObject(propValue);
22
+ }
23
+ if (type === 'string[]') {
24
+ return Array.isArray(propValue) && propValue.every(el => typeof el === 'string');
25
+ }
26
+ if (type === 'function') {
27
+ return isCallable(propValue);
28
+ }
29
+ if (Array.isArray(type)) {
30
+ return typeof propValue === 'string' && type.includes(propValue);
31
+ }
32
+ if (type === 'null') {
33
+ return propValue === null;
34
+ }
35
+ if (type === 'undefined') {
36
+ return propValue === undefined;
37
+ }
38
+ if (type === 'true') {
39
+ return propValue === true;
40
+ }
41
+ if (type === 'false') {
42
+ return propValue === false;
43
+ }
44
+ return typeof propValue === type;
45
+ }
@@ -0,0 +1 @@
1
+ export declare function hasPropertyGetter(obj: Object, prop: string): boolean;
@@ -0,0 +1,4 @@
1
+ export function hasPropertyGetter(obj, prop) {
2
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
3
+ return !!descriptor && !('value' in descriptor) && !!descriptor.get;
4
+ }
@@ -0,0 +1,2 @@
1
+ export { humanizeTime };
2
+ declare function humanizeTime(milliseconds: number): string;
@@ -0,0 +1,22 @@
1
+ export { humanizeTime };
2
+ function humanizeTime(milliseconds) {
3
+ const seconds = milliseconds / 1000;
4
+ if (seconds < 120) {
5
+ const n = round(seconds);
6
+ return `${n} second${plural(n)}`;
7
+ }
8
+ {
9
+ const minutes = seconds / 60;
10
+ const n = round(minutes);
11
+ return `${n} minute${plural(n)}`;
12
+ }
13
+ }
14
+ function round(n) {
15
+ let rounded = n.toFixed(1);
16
+ if (rounded.endsWith('.0'))
17
+ rounded = rounded.slice(0, -2);
18
+ return rounded;
19
+ }
20
+ function plural(n) {
21
+ return n === '1' ? '' : 's';
22
+ }
@@ -0,0 +1 @@
1
+ export declare function isBrowser(): boolean;
@@ -0,0 +1,5 @@
1
+ export function isBrowser() {
2
+ // Using `typeof window !== 'undefined'` alone is not enough because some users use https://www.npmjs.com/package/ssr-window
3
+ return typeof window !== 'undefined' && typeof window.scrollY === 'number';
4
+ // Alternatively, test whether environment is a *real* browser: https://github.com/brillout/picocolors/blob/d59a33a0fd52a8a33e4158884069192a89ce0113/picocolors.js#L87-L89
5
+ }
@@ -0,0 +1 @@
1
+ export declare function isCallable<T extends (...args: any[]) => any>(thing: T | unknown): thing is T;
@@ -0,0 +1,3 @@
1
+ export function isCallable(thing) {
2
+ return thing instanceof Function || typeof thing === 'function';
3
+ }
@@ -0,0 +1,7 @@
1
+ export { isDev1 };
2
+ export { isDev1_onConfigureServer };
3
+ export { isDev2 };
4
+ declare function isDev1(): boolean;
5
+ declare function isDev1_onConfigureServer(): void | undefined;
6
+ import type { ResolvedConfig } from 'vite';
7
+ declare function isDev2(config: ResolvedConfig): boolean;
@@ -0,0 +1,29 @@
1
+ export { isDev1 };
2
+ export { isDev1_onConfigureServer };
3
+ export { isDev2 };
4
+ // There isn't any reliable way to test whether Vite is ran as dev/build/preview/optimizeDep
5
+ // - Failed attempt to make a PR: https://github.com/brillout/vite/tree/fix/config-operation
6
+ // ********
7
+ // Method 1 - most reliable
8
+ // ********
9
+ import { assert } from './assert.js';
10
+ import { getGlobalObject } from './getGlobalObject.js';
11
+ const globalObject = getGlobalObject('utils/isDev.ts', { isDev: false, isDev_wasCalled: false });
12
+ function isDev1() {
13
+ globalObject.isDev_wasCalled = true;
14
+ return globalObject.isDev;
15
+ }
16
+ function isDev1_onConfigureServer() {
17
+ // configureServer() is called more than once when user presses Vite's dev server reload hotkey <r>
18
+ if (globalObject.isDev)
19
+ return;
20
+ assert(!globalObject.isDev_wasCalled);
21
+ globalObject.isDev = true;
22
+ }
23
+ function isDev2(config) {
24
+ const isDev = config.command === 'serve' &&
25
+ // Mode is 'development' by default: https://github.com/vitejs/vite/blob/bf9c49f521b7a6730231c35754d5e1f9c3a6a16e/packages/vite/src/node/config.ts#L383
26
+ // Note that user can override this: https://github.com/vitejs/vite/blob/bf9c49f521b7a6730231c35754d5e1f9c3a6a16e/packages/vite/src/node/cli.ts#L126
27
+ config.mode === 'development';
28
+ return isDev;
29
+ }
@@ -0,0 +1,2 @@
1
+ export { isEquivalentError };
2
+ declare function isEquivalentError(err1: unknown, err2: unknown): boolean;
@@ -0,0 +1,15 @@
1
+ import { isObject } from './isObject.js';
2
+ import { deepEqual } from './deepEqual.js';
3
+ export { isEquivalentError };
4
+ function isEquivalentError(err1, err2) {
5
+ return (isObject(err1) &&
6
+ isObject(err2) &&
7
+ err1.constructor === err2.constructor &&
8
+ deepEqual({ ...err1, stack: null }, { ...err2, stack: null }) &&
9
+ // 'message' and 'stack' are usually non-emurable
10
+ err2.message === err2.message
11
+ /* Doesn't work because: the stack trace isn't exactly the same between the original page rendering and the fallback error page rendering
12
+ err2.stack === err2.stack
13
+ */
14
+ );
15
+ }
@@ -0,0 +1,2 @@
1
+ export { isHtml };
2
+ declare function isHtml(str: string): boolean;
@@ -0,0 +1,7 @@
1
+ // Unit tests at ./isHtml.spec.ts
2
+ export { isHtml };
3
+ function isHtml(str) {
4
+ // Copied and adapted from https://stackoverflow.com/questions/15458876/check-if-a-string-is-html-or-not/51325984#51325984
5
+ const re = /(<\/[^<]+>)|(<[^<]+\/>)/;
6
+ return re.test(str);
7
+ }
@@ -0,0 +1 @@
1
+ export declare function isNodeJS(): boolean;