vike 0.4.195 → 0.4.196-commit-df033dd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -0
- package/dist/cjs/__internal/index.js +3 -4
- package/dist/cjs/node/cli/onLoad.js +1 -2
- package/dist/cjs/node/createPageRenderer.js +1 -2
- package/dist/cjs/node/plugin/index.js +3 -3
- package/dist/cjs/node/plugin/onLoad.js +1 -2
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +1 -2
- package/dist/cjs/node/plugin/plugins/baseUrls.js +1 -2
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +2 -3
- package/dist/cjs/node/plugin/plugins/buildConfig.js +4 -4
- package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +1 -2
- package/dist/cjs/node/plugin/plugins/commonConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/assertVikeConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/pickFirst.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/resolveBase.js +2 -3
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -2
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -2
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/distFileNames.js +1 -2
- package/dist/cjs/node/plugin/plugins/envVars.js +1 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +3 -3
- package/dist/cjs/node/plugin/plugins/fileEnv.js +109 -88
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +1 -2
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +2 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/addImportStatement.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +1 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +2 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +8 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +5 -7
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +1 -2
- package/dist/cjs/node/plugin/plugins/packageJsonFile.js +1 -2
- package/dist/cjs/node/plugin/plugins/previewConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/removeRequireHookPlugin.js +1 -2
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +1 -2
- package/dist/cjs/node/plugin/plugins/suppressRollupWarning.js +1 -2
- package/dist/cjs/node/plugin/plugins/workaroundCssModuleHmr.js +1 -2
- package/dist/cjs/node/plugin/resolveClientEntriesDev.js +1 -2
- package/dist/cjs/node/plugin/shared/addSsrMiddleware.js +1 -2
- package/dist/cjs/node/plugin/shared/findPageFiles.js +1 -2
- package/dist/cjs/node/plugin/shared/getAssetsDir.js +1 -2
- package/dist/cjs/node/plugin/shared/getFilePath.js +8 -9
- package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +2 -3
- package/dist/cjs/node/plugin/shared/isAsset.js +1 -2
- package/dist/cjs/node/plugin/shared/isViteCliCall.js +2 -3
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +4 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd/log.js +4 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd.js +6 -7
- package/dist/cjs/node/plugin/shared/loggerVite/removeSuperfluousViteLog.js +3 -4
- package/dist/cjs/node/plugin/shared/loggerVite.js +1 -2
- package/dist/cjs/node/plugin/shared/parseEsModule.js +2 -3
- package/dist/cjs/node/plugin/shared/rollupIsEsm.js +1 -2
- package/dist/cjs/node/plugin/shared/rollupSourceMap.js +2 -3
- package/dist/cjs/node/prerender/runPrerender.js +4 -5
- package/dist/cjs/node/runtime/globalContext/loadImportBuild.js +2 -3
- package/dist/cjs/node/runtime/globalContext.js +13 -14
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/inferHtmlTags.js +4 -4
- package/dist/cjs/node/runtime/html/injectAssets/injectAssets__public.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/injectHtmlTags.js +6 -7
- package/dist/cjs/node/runtime/html/injectAssets/mergeScriptTags.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/sanitizeJson.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets.js +2 -3
- package/dist/cjs/node/runtime/html/renderHtml.js +5 -6
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +2 -3
- package/dist/cjs/node/runtime/html/stream/react-streaming.js +3 -4
- package/dist/cjs/node/runtime/html/stream.js +21 -22
- package/dist/cjs/node/runtime/onLoad.js +1 -2
- package/dist/cjs/node/runtime/page-files/getPageFilesExports.js +1 -2
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +5 -6
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/getCacheControl.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +19 -8
- package/dist/cjs/node/runtime/renderPage/debugPageFiles.js +1 -2
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -2
- package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -3
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +2 -3
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +2 -3
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -2
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +1 -2
- package/dist/cjs/node/runtime/renderPage/isNewError.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -2
- package/dist/cjs/node/runtime/renderPage/log404/index.js +2 -3
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loggerRuntime.js +2 -2
- package/dist/cjs/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.js +1 -2
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +5 -6
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +2 -3
- package/dist/cjs/node/runtime/renderPage.js +8 -8
- package/dist/cjs/node/shared/assertPluginManifest.js +1 -2
- package/dist/cjs/node/shared/assertRuntimeManifest.js +1 -2
- package/dist/cjs/node/shared/assertV1Design.js +1 -2
- package/dist/cjs/node/shared/extractAssetsQuery.js +2 -3
- package/dist/cjs/node/shared/getConfigVike.js +1 -2
- package/dist/cjs/node/shared/isErrorDebug.js +1 -2
- package/dist/cjs/node/shared/prependEntriesDir.js +1 -2
- package/dist/cjs/node/shared/virtual-files/virtualFileImportUserCode.js +2 -2
- package/dist/cjs/node/shared/virtual-files/virtualFilePageConfigValuesAll.js +2 -3
- package/dist/cjs/shared/addIs404ToPageProps.js +1 -2
- package/dist/cjs/shared/assertHookReturnedObject.js +1 -2
- package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +1 -2
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +1 -2
- package/dist/cjs/shared/assertPageFilePath.js +1 -2
- package/dist/cjs/shared/determinePageIdOld.js +1 -2
- package/dist/cjs/shared/error-page.js +3 -4
- package/dist/cjs/shared/getPageContextRequestUrl.js +2 -2
- package/dist/cjs/shared/getPageContextUrlComputed.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +4 -5
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +1 -2
- package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +3 -3
- package/dist/cjs/shared/getPageFiles/fileTypes.js +3 -3
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +2 -3
- package/dist/cjs/shared/getPageFiles/getExports.js +1 -2
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +1 -2
- package/dist/cjs/shared/getPageFiles/parseGlobResults.js +1 -2
- package/dist/cjs/shared/getPageFiles/setPageFiles.js +3 -4
- package/dist/cjs/shared/hooks/executeHook.js +4 -5
- package/dist/cjs/shared/hooks/getHook.js +6 -7
- package/dist/cjs/shared/modifyUrl.js +1 -2
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +1 -2
- package/dist/cjs/shared/page-configs/findPageConfig.js +1 -2
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +3 -4
- package/dist/cjs/shared/page-configs/getConfigValue.js +2 -3
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +1 -2
- package/dist/cjs/shared/page-configs/getExportPath.js +1 -2
- package/dist/cjs/shared/page-configs/helpers.js +3 -4
- package/dist/cjs/shared/page-configs/loadConfigValues.js +1 -2
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -3
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +1 -2
- package/dist/cjs/shared/route/abort.js +9 -10
- package/dist/cjs/shared/route/debug.js +1 -2
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +1 -2
- package/dist/cjs/shared/route/executeGuardHook.js +1 -2
- package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +1 -2
- package/dist/cjs/shared/route/index.js +1 -2
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -2
- package/dist/cjs/shared/route/resolvePrecedence.js +1 -2
- package/dist/cjs/shared/route/resolveRoute.js +1 -2
- package/dist/cjs/shared/route/resolveRouteFunction.js +4 -5
- package/dist/cjs/shared/route/resolveRouteString.js +6 -7
- package/dist/cjs/shared/route/resolveUrlPathname.js +1 -2
- package/dist/cjs/shared/sortPageContext.js +1 -2
- package/dist/cjs/types/defineConfig.js +1 -2
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assert.js +10 -11
- package/dist/cjs/utils/assertIsBrowser.js +1 -2
- package/dist/cjs/utils/assertIsNotBrowser.js +1 -2
- package/dist/cjs/utils/assertIsNotProductionRuntime.js +6 -6
- package/dist/cjs/utils/assertKeys.js +1 -2
- package/dist/cjs/utils/assertNodeEnv.js +5 -6
- package/dist/cjs/utils/assertNodeVersion.js +1 -2
- package/dist/cjs/utils/assertRoutingType.js +3 -4
- package/dist/cjs/utils/assertSingleInstance.js +3 -4
- package/dist/cjs/utils/assertVersion.js +2 -3
- package/dist/cjs/utils/augmentType.js +1 -2
- package/dist/cjs/utils/capitalizeFirstLetter.js +1 -2
- package/dist/cjs/utils/cast.js +2 -3
- package/dist/cjs/utils/changeEnumerable.js +1 -2
- package/dist/cjs/utils/checkType.js +2 -3
- package/dist/cjs/utils/compareString.js +1 -2
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +1 -2
- package/dist/cjs/utils/debug.js +2 -3
- package/dist/cjs/utils/deepEqual.js +1 -2
- package/dist/cjs/utils/escapeHtml.js +1 -2
- package/dist/cjs/utils/escapeRegex.js +1 -2
- package/dist/cjs/utils/filesystemPathHandling.js +2 -3
- package/dist/cjs/utils/findFile.js +1 -2
- package/dist/cjs/utils/findPackageJson.js +1 -2
- package/dist/cjs/utils/formatHintLog.js +1 -2
- package/dist/cjs/utils/freezePartial.js +1 -2
- package/dist/cjs/utils/genPromise.js +1 -2
- package/dist/cjs/utils/getCurrentUrl.js +1 -2
- package/dist/cjs/utils/getFileExtension.js +1 -2
- package/dist/cjs/utils/getGlobalObject.js +2 -3
- package/dist/cjs/utils/getMostSimilar.js +1 -2
- package/dist/cjs/utils/getOutDirs.js +2 -3
- package/dist/cjs/utils/getPropAccessNotation.js +1 -2
- package/dist/cjs/utils/getRandomId.js +1 -2
- package/dist/cjs/utils/getTerminWidth.js +1 -2
- package/dist/cjs/utils/getValuePrintable.js +1 -2
- package/dist/cjs/utils/hasProp.js +1 -2
- package/dist/cjs/utils/humanizeTime.js +1 -2
- package/dist/cjs/utils/includes.js +1 -2
- package/dist/cjs/utils/injectRollupInputs.js +2 -3
- package/dist/cjs/utils/isArray.js +1 -2
- package/dist/cjs/utils/isArrayOfStrings.js +1 -2
- package/dist/cjs/utils/isBrowser.js +1 -2
- package/dist/cjs/utils/isCallable.js +1 -2
- package/dist/cjs/utils/isDev.js +2 -3
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +2 -3
- package/dist/cjs/utils/isHtml.js +1 -2
- package/dist/cjs/utils/isNodeJS.js +1 -2
- package/dist/cjs/utils/isNpmPackage.js +5 -6
- package/dist/cjs/utils/isObject.js +1 -2
- package/dist/cjs/utils/isObjectOfStrings.js +1 -2
- package/dist/cjs/utils/isObjectWithKeys.js +1 -2
- package/dist/cjs/utils/isPlainObject.js +1 -2
- package/dist/cjs/utils/isPromise.js +1 -2
- package/dist/cjs/utils/isPropertyGetter.js +1 -2
- package/dist/cjs/utils/isReact.js +1 -2
- package/dist/cjs/utils/isSameErrorMessage.js +1 -2
- package/dist/cjs/utils/isScriptFile.js +4 -4
- package/dist/cjs/utils/isVikeReactApp.js +1 -2
- package/dist/cjs/utils/isVitest.js +1 -2
- package/dist/cjs/utils/joinEnglish.js +1 -2
- package/dist/cjs/utils/normalizeHeaders.js +1 -2
- package/dist/cjs/utils/objectAssign.js +1 -2
- package/dist/cjs/utils/objectDefineProperty.js +1 -2
- package/dist/cjs/utils/objectEntries.js +1 -2
- package/dist/cjs/utils/objectEntriesForEach.js +1 -2
- package/dist/cjs/utils/objectFromEntries.js +1 -2
- package/dist/cjs/utils/objectKeys.js +1 -2
- package/dist/cjs/utils/onPageVisibilityChange.js +2 -3
- package/dist/cjs/utils/pLimit.js +1 -2
- package/dist/cjs/utils/parseUrl-extras.js +8 -9
- package/dist/cjs/utils/parseUrl.js +11 -12
- package/dist/cjs/utils/path-shim.js +1 -2
- package/dist/cjs/utils/redirectHard.js +1 -2
- package/dist/cjs/utils/removeEmptyLines.js +1 -2
- package/dist/cjs/utils/removeFileExtention.js +1 -2
- package/dist/cjs/utils/requireResolve.js +1 -2
- package/dist/cjs/utils/sleep.js +1 -2
- package/dist/cjs/utils/slice.js +1 -2
- package/dist/cjs/utils/sorter.js +5 -6
- package/dist/cjs/utils/stringifyStringArray.js +1 -2
- package/dist/cjs/utils/stripAnsi.js +1 -2
- package/dist/cjs/utils/throttle.js +1 -2
- package/dist/cjs/utils/trimWithAnsi.js +2 -3
- package/dist/cjs/utils/truncateString.js +1 -2
- package/dist/cjs/utils/unique.js +1 -2
- package/dist/cjs/utils/urlToFile.js +2 -2
- package/dist/cjs/utils/virtual-files.js +3 -4
- package/dist/cjs/utils/viteIsSSR.js +2 -3
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +1 -2
- package/dist/esm/client/client-routing-runtime/installClientRouter.js +2 -4
- package/dist/esm/client/client-routing-runtime/isClientSideRoutable.js +2 -2
- package/dist/esm/client/client-routing-runtime/navigate.js +3 -1
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +2 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +39 -12
- package/dist/esm/client/client-routing-runtime/skipLink.js +1 -1
- package/dist/esm/client/client-routing-runtime/utils.d.ts +1 -0
- package/dist/esm/client/client-routing-runtime/utils.js +1 -0
- package/dist/esm/client/shared/removeFoucBuster.js +17 -11
- package/dist/esm/node/plugin/plugins/fileEnv.js +109 -87
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +1 -2
- package/dist/esm/node/runtime/html/stream.d.ts +0 -1
- package/dist/esm/node/runtime/index-deprecated.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/analyzePage.js +4 -4
- package/dist/esm/node/runtime/renderPage/createHttpResponse.d.ts +5 -1
- package/dist/esm/node/runtime/renderPage/createHttpResponse.js +15 -3
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +0 -1
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.js +1 -1
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +6 -6
- package/dist/esm/node/runtime/renderPage.js +6 -6
- package/dist/esm/shared/getPageFiles/analyzeClientSide.d.ts +1 -1
- package/dist/esm/shared/getPageFiles/analyzeClientSide.js +3 -3
- package/dist/esm/shared/page-configs/Config.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/debugGlob.d.ts +2 -2
- package/dist/esm/utils/genPromise.d.ts +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +6 -5
|
@@ -176,12 +176,11 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
176
176
|
}
|
|
177
177
|
if (debug.isActivated)
|
|
178
178
|
debug('onResolved()', { args, resolved, importPathTranspiled, isPointerImport, isExternal });
|
|
179
|
-
pointerImports[importPathTranspiled] = isPointerImport;
|
|
180
179
|
if (isExternal) {
|
|
180
|
+
pointerImports[importPathTranspiled] = isPointerImport;
|
|
181
181
|
return { external: true, path: importPathTranspiled };
|
|
182
182
|
}
|
|
183
183
|
else {
|
|
184
|
-
resolved.path = importPathTranspiled;
|
|
185
184
|
return resolved;
|
|
186
185
|
}
|
|
187
186
|
});
|
|
@@ -7,17 +7,17 @@ import { getGlobalContext } from '../globalContext.js';
|
|
|
7
7
|
import { getConfigValueRuntime } from '../../../shared/page-configs/getConfigValue.js';
|
|
8
8
|
function analyzePage(pageFilesAll, pageConfig, pageId) {
|
|
9
9
|
if (pageConfig) {
|
|
10
|
-
const {
|
|
10
|
+
const { isClientRuntimeLoaded, isClientRouting } = analyzeClientSide(pageConfig, pageFilesAll, pageId);
|
|
11
11
|
const clientEntries = [];
|
|
12
12
|
const clientFilePath = getConfigValueRuntime(pageConfig, 'client', 'string')?.value ?? null;
|
|
13
13
|
if (clientFilePath)
|
|
14
14
|
clientEntries.push(clientFilePath);
|
|
15
|
-
if (
|
|
15
|
+
if (isClientRuntimeLoaded)
|
|
16
16
|
clientEntries.push(getVikeClientEntry(isClientRouting));
|
|
17
17
|
const clientDependencies = [];
|
|
18
18
|
clientDependencies.push({
|
|
19
19
|
id: getVirtualFileIdPageConfigValuesAll(pageConfig.pageId, true),
|
|
20
|
-
onlyAssets:
|
|
20
|
+
onlyAssets: isClientRuntimeLoaded ? false : true,
|
|
21
21
|
eagerlyImported: false
|
|
22
22
|
});
|
|
23
23
|
// In production we inject the import of the server virtual module with ?extractAssets inside the client virtual module
|
|
@@ -53,7 +53,7 @@ function analyzePage(pageFilesAll, pageConfig, pageId) {
|
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
return {
|
|
56
|
-
isHtmlOnly: !
|
|
56
|
+
isHtmlOnly: !isClientRuntimeLoaded,
|
|
57
57
|
isClientRouting,
|
|
58
58
|
clientEntries,
|
|
59
59
|
clientDependencies,
|
|
@@ -11,6 +11,7 @@ import type { RenderHook } from './executeOnRenderHtmlHook.js';
|
|
|
11
11
|
import type { RedirectStatusCode, AbortStatusCode, UrlRedirect } from '../../../shared/route/abort.js';
|
|
12
12
|
import { HttpResponseBody } from './getHttpResponseBody.js';
|
|
13
13
|
import { type EarlyHint } from './getEarlyHints.js';
|
|
14
|
+
import type { PageFile } from '../../../shared/getPageFiles.js';
|
|
14
15
|
type HttpResponse = {
|
|
15
16
|
statusCode: 200 | 404 | 500 | RedirectStatusCode | AbortStatusCode;
|
|
16
17
|
headers: [string, string][];
|
|
@@ -27,6 +28,9 @@ declare function createHttpResponsePage(htmlRender: HtmlRender, renderHook: null
|
|
|
27
28
|
abortStatusCode?: AbortStatusCode;
|
|
28
29
|
}): Promise<HttpResponse>;
|
|
29
30
|
declare function createHttpResponseFavicon404(): HttpResponse;
|
|
30
|
-
declare function createHttpResponseError(
|
|
31
|
+
declare function createHttpResponseError(pageContext: null | {
|
|
32
|
+
_pageFilesAll: PageFile[];
|
|
33
|
+
_pageConfigs: PageConfigRuntime[];
|
|
34
|
+
}): HttpResponse;
|
|
31
35
|
declare function createHttpResponsePageContextJson(pageContextSerialized: string): Promise<HttpResponse>;
|
|
32
36
|
declare function createHttpResponseRedirect({ url, statusCode }: UrlRedirect, urlLogical: string): HttpResponse;
|
|
@@ -4,7 +4,7 @@ export { createHttpResponseError };
|
|
|
4
4
|
export { createHttpResponseRedirect };
|
|
5
5
|
export { createHttpResponseFavicon404 };
|
|
6
6
|
import { assert, assertWarning } from '../utils.js';
|
|
7
|
-
import { isErrorPage } from '../../../shared/error-page.js';
|
|
7
|
+
import { getErrorPageId, isErrorPage } from '../../../shared/error-page.js';
|
|
8
8
|
import { getHttpResponseBody, getHttpResponseBodyStreamHandlers } from './getHttpResponseBody.js';
|
|
9
9
|
import { getEarlyHints } from './getEarlyHints.js';
|
|
10
10
|
import { getCacheControl } from './createHttpResponse/getCacheControl.js';
|
|
@@ -38,8 +38,20 @@ function createHttpResponseFavicon404() {
|
|
|
38
38
|
const httpResponse = createHttpResponse(404, 'text/html;charset=utf-8', [], "<p>No favicon.ico found.</p><script>console.log('This HTTP response was generated by Vike.')</script>");
|
|
39
39
|
return httpResponse;
|
|
40
40
|
}
|
|
41
|
-
function createHttpResponseError() {
|
|
42
|
-
const
|
|
41
|
+
function createHttpResponseError(pageContext) {
|
|
42
|
+
const reason = (() => {
|
|
43
|
+
if (!pageContext) {
|
|
44
|
+
return 'no error page (https://vike.dev/error-page) could be rendered';
|
|
45
|
+
}
|
|
46
|
+
const errorPageId = getErrorPageId(pageContext._pageFilesAll, pageContext._pageConfigs);
|
|
47
|
+
if (errorPageId) {
|
|
48
|
+
return "the error page (https://vike.dev/error-page) couldn't be rendered (for example if an error occurred while rendering the error page)";
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return 'no error page (https://vike.dev/error-page) is defined, make sure to create one';
|
|
52
|
+
}
|
|
53
|
+
})();
|
|
54
|
+
const httpResponse = createHttpResponse(500, 'text/html;charset=utf-8', [], `<p>An error occurred.</p><script>console.log(${JSON.stringify(`This HTTP response was generated by Vike. Vike returned this response because ${reason}.`)})</script>`);
|
|
43
55
|
return httpResponse;
|
|
44
56
|
}
|
|
45
57
|
async function createHttpResponsePageContextJson(pageContextSerialized) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export { handleErrorWithoutErrorPage };
|
|
2
2
|
import type { PageContextAfterRender } from './renderPageAlreadyRouted.js';
|
|
3
3
|
import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js';
|
|
4
|
+
import type { PageFile } from '../../../shared/getPageFiles.js';
|
|
4
5
|
declare function handleErrorWithoutErrorPage<PageContext extends {
|
|
5
6
|
isClientSideNavigation: boolean;
|
|
6
7
|
errorWhileRendering: null | Error;
|
|
7
8
|
is404: null | boolean;
|
|
8
9
|
_pageId: null;
|
|
10
|
+
_pageFilesAll: PageFile[];
|
|
9
11
|
_pageConfigs: PageConfigRuntime[];
|
|
10
12
|
urlOriginal: string;
|
|
11
13
|
}>(pageContext: PageContext): Promise<PageContext & PageContextAfterRender>;
|
|
@@ -13,7 +13,7 @@ async function handleErrorWithoutErrorPage(pageContext) {
|
|
|
13
13
|
warnMissingErrorPage(isV1);
|
|
14
14
|
}
|
|
15
15
|
if (!pageContext.isClientSideNavigation) {
|
|
16
|
-
const httpResponse = createHttpResponseError();
|
|
16
|
+
const httpResponse = createHttpResponseError(pageContext);
|
|
17
17
|
objectAssign(pageContext, { httpResponse });
|
|
18
18
|
return pageContext;
|
|
19
19
|
}
|
|
@@ -78,7 +78,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
78
78
|
_urlRewrite: null;
|
|
79
79
|
_httpRequestId: number | null;
|
|
80
80
|
_usesClientRouter: boolean;
|
|
81
|
-
_pageContextAlreadyProvidedByOnPrerenderHook?: true
|
|
81
|
+
_pageContextAlreadyProvidedByOnPrerenderHook?: true;
|
|
82
82
|
is404: null | boolean;
|
|
83
83
|
} & {
|
|
84
84
|
isClientSideNavigation: boolean;
|
|
@@ -129,7 +129,7 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
129
129
|
_urlRewrite: null;
|
|
130
130
|
_httpRequestId: number | null;
|
|
131
131
|
_usesClientRouter: boolean;
|
|
132
|
-
_pageContextAlreadyProvidedByOnPrerenderHook?: true
|
|
132
|
+
_pageContextAlreadyProvidedByOnPrerenderHook?: true;
|
|
133
133
|
is404: null | boolean;
|
|
134
134
|
} & {
|
|
135
135
|
isClientSideNavigation: boolean;
|
|
@@ -181,8 +181,8 @@ declare function prerender404Page(renderContext: RenderContext, pageContextInit_
|
|
|
181
181
|
_urlRewrite: null;
|
|
182
182
|
_httpRequestId: number | null;
|
|
183
183
|
_usesClientRouter: boolean;
|
|
184
|
-
_pageContextAlreadyProvidedByOnPrerenderHook?: true
|
|
185
|
-
is404:
|
|
184
|
+
_pageContextAlreadyProvidedByOnPrerenderHook?: true;
|
|
185
|
+
is404: null | boolean;
|
|
186
186
|
} & {
|
|
187
187
|
isClientSideNavigation: boolean;
|
|
188
188
|
_urlHandler: null;
|
|
@@ -232,8 +232,8 @@ declare function prerender404Page(renderContext: RenderContext, pageContextInit_
|
|
|
232
232
|
_urlRewrite: null;
|
|
233
233
|
_httpRequestId: number | null;
|
|
234
234
|
_usesClientRouter: boolean;
|
|
235
|
-
_pageContextAlreadyProvidedByOnPrerenderHook?: true
|
|
236
|
-
is404:
|
|
235
|
+
_pageContextAlreadyProvidedByOnPrerenderHook?: true;
|
|
236
|
+
is404: null | boolean;
|
|
237
237
|
} & {
|
|
238
238
|
isClientSideNavigation: boolean;
|
|
239
239
|
_urlHandler: null;
|
|
@@ -50,7 +50,7 @@ async function renderPageAndPrepare(pageContextInit, httpRequestId) {
|
|
|
50
50
|
// Invalid config
|
|
51
51
|
const handleInvalidConfig = (err) => {
|
|
52
52
|
logRuntimeInfo?.(pc.bold(pc.red('Error while loading a Vike config file, see error above.')), httpRequestId, 'error');
|
|
53
|
-
const pageContextWithError = getPageContextHttpResponseError(err, pageContextInit);
|
|
53
|
+
const pageContextWithError = getPageContextHttpResponseError(err, pageContextInit, null);
|
|
54
54
|
return pageContextWithError;
|
|
55
55
|
};
|
|
56
56
|
if (isConfigInvalid) {
|
|
@@ -70,7 +70,7 @@ async function renderPageAndPrepare(pageContextInit, httpRequestId) {
|
|
|
70
70
|
// initGlobalContext_renderPage() and getRenderContext() don't call any user hooks => err isn't thrown from user code.
|
|
71
71
|
assert(!isAbortError(err));
|
|
72
72
|
logRuntimeError(err, httpRequestId);
|
|
73
|
-
const pageContextWithError = getPageContextHttpResponseError(err, pageContextInit);
|
|
73
|
+
const pageContextWithError = getPageContextHttpResponseError(err, pageContextInit, null);
|
|
74
74
|
return pageContextWithError;
|
|
75
75
|
}
|
|
76
76
|
if (isConfigInvalid) {
|
|
@@ -176,7 +176,7 @@ async function renderPageAlreadyPrepared(pageContextInit, httpRequestId, renderC
|
|
|
176
176
|
if (!handled.pageContextReturn) {
|
|
177
177
|
const pageContextAbort = errErrorPage._pageContextAbort;
|
|
178
178
|
assertWarning(false, `Failed to render error page because ${pc.cyan(pageContextAbort._abortCall)} was called: make sure ${pc.cyan(pageContextAbort._abortCaller)} doesn't occur while the error page is being rendered.`, { onlyOnce: false });
|
|
179
|
-
const pageContextHttpWithError = getPageContextHttpResponseError(errNominalPage, pageContextInit);
|
|
179
|
+
const pageContextHttpWithError = getPageContextHttpResponseError(errNominalPage, pageContextInit, pageContextErrorPageInit);
|
|
180
180
|
return pageContextHttpWithError;
|
|
181
181
|
}
|
|
182
182
|
// `throw redirect()` / `throw render(url)`
|
|
@@ -185,7 +185,7 @@ async function renderPageAlreadyPrepared(pageContextInit, httpRequestId, renderC
|
|
|
185
185
|
if (isNewError(errErrorPage, errNominalPage)) {
|
|
186
186
|
logRuntimeError(errErrorPage, httpRequestId);
|
|
187
187
|
}
|
|
188
|
-
const pageContextWithError = getPageContextHttpResponseError(errNominalPage, pageContextInit);
|
|
188
|
+
const pageContextWithError = getPageContextHttpResponseError(errNominalPage, pageContextInit, pageContextErrorPageInit);
|
|
189
189
|
return pageContextWithError;
|
|
190
190
|
}
|
|
191
191
|
return pageContextErrorPage;
|
|
@@ -239,9 +239,9 @@ function logHttpResponse(urlOriginalPretty, httpRequestId, pageContextReturn) {
|
|
|
239
239
|
function prettyUrl(url) {
|
|
240
240
|
return pc.bold(decodeURI(url));
|
|
241
241
|
}
|
|
242
|
-
function getPageContextHttpResponseError(err, pageContextInit) {
|
|
242
|
+
function getPageContextHttpResponseError(err, pageContextInit, pageContext) {
|
|
243
243
|
const pageContextWithError = createPageContext(pageContextInit);
|
|
244
|
-
const httpResponse = createHttpResponseError();
|
|
244
|
+
const httpResponse = createHttpResponseError(pageContext);
|
|
245
245
|
objectAssign(pageContextWithError, {
|
|
246
246
|
httpResponse,
|
|
247
247
|
errorWhileRendering: err
|
|
@@ -2,6 +2,6 @@ export { analyzeClientSide };
|
|
|
2
2
|
import type { PageConfigRuntime } from '../page-configs/PageConfig.js';
|
|
3
3
|
import type { PageFile } from './getPageFileObject.js';
|
|
4
4
|
declare function analyzeClientSide(pageConfig: PageConfigRuntime | null, pageFilesAll: PageFile[], pageId: string): {
|
|
5
|
-
|
|
5
|
+
isClientRuntimeLoaded: boolean;
|
|
6
6
|
isClientRouting: boolean;
|
|
7
7
|
};
|
|
@@ -5,13 +5,13 @@ function analyzeClientSide(pageConfig, pageFilesAll, pageId) {
|
|
|
5
5
|
// V1 design
|
|
6
6
|
if (pageConfig) {
|
|
7
7
|
const isClientRouting = getConfigValueRuntime(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
8
|
-
const
|
|
9
|
-
return {
|
|
8
|
+
const isClientRuntimeLoaded = getConfigValueRuntime(pageConfig, 'isClientRuntimeLoaded', 'boolean')?.value ?? false;
|
|
9
|
+
return { isClientRuntimeLoaded, isClientRouting };
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
12
|
// TODO/v1-release: remove
|
|
13
13
|
// V0.4 design
|
|
14
14
|
const { isHtmlOnly, isClientRouting } = analyzePageClientSide(pageFilesAll, pageId);
|
|
15
|
-
return {
|
|
15
|
+
return { isClientRuntimeLoaded: !isHtmlOnly, isClientRouting };
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -41,7 +41,7 @@ type HookName = HookNamePage | HookNameGlobal | HookNameOldDesign;
|
|
|
41
41
|
type HookNamePage = 'onHydrationEnd' | 'onBeforePrerenderStart' | 'onBeforeRender' | 'onPageTransitionStart' | 'onPageTransitionEnd' | 'onRenderHtml' | 'onRenderClient' | 'guard' | 'data';
|
|
42
42
|
type HookNameGlobal = 'onBeforePrerender' | 'onBeforeRoute' | 'onPrerenderStart';
|
|
43
43
|
type HookNameOldDesign = 'render' | 'prerender';
|
|
44
|
-
type ConfigNameBuiltIn = Exclude<keyof Config, keyof ConfigVikeUserProvided | 'onBeforeRoute' | 'onPrerenderStart'> | 'prerender' | '
|
|
44
|
+
type ConfigNameBuiltIn = Exclude<keyof Config, keyof ConfigVikeUserProvided | 'onBeforeRoute' | 'onPrerenderStart'> | 'prerender' | 'isClientRuntimeLoaded' | 'onBeforeRenderEnv' | 'dataEnv' | 'hooksTimeout' | 'clientHooks';
|
|
45
45
|
type Config = ConfigBuiltIn & Vike.Config & (VikePackages.ConfigVikeReact | VikePackages.ConfigVikeVue | VikePackages.ConfigVikeSolid | VikePackages.ConfigVikeSvelte | VikePackages.ConfigVikeAngular);
|
|
46
46
|
/** Hook for fetching data.
|
|
47
47
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.196-commit-df033dd";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.196-commit-df033dd';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.196-commit-df033dd",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"dependencies": {
|
|
124
124
|
"@brillout/import": "^0.2.3",
|
|
125
125
|
"@brillout/json-serializer": "^0.5.13",
|
|
126
|
-
"@brillout/picocolors": "^1.0.
|
|
126
|
+
"@brillout/picocolors": "^1.0.15",
|
|
127
127
|
"@brillout/require-shim": "^0.1.2",
|
|
128
128
|
"@brillout/vite-plugin-server-entry": "^0.4.11",
|
|
129
129
|
"acorn": "^8.0.0",
|
|
@@ -225,11 +225,12 @@
|
|
|
225
225
|
],
|
|
226
226
|
"devDependencies": {
|
|
227
227
|
"@biomejs/biome": "^1.5.3",
|
|
228
|
-
"@brillout/release-me": "^0.4.
|
|
228
|
+
"@brillout/release-me": "^0.4.2",
|
|
229
229
|
"@types/estree": "^1.0.5",
|
|
230
230
|
"@types/jest": "^29.5.11",
|
|
231
231
|
"@types/node": "^20.10.5",
|
|
232
232
|
"@types/resolve": "^1.20.6",
|
|
233
|
+
"@types/semver": "^7.5.8",
|
|
233
234
|
"@types/source-map-support": "^0.5.10",
|
|
234
235
|
"acorn": "^8.11.2",
|
|
235
236
|
"cac": "^6.7.14",
|
|
@@ -241,7 +242,7 @@
|
|
|
241
242
|
"semver": "^7.6.3",
|
|
242
243
|
"sirv": "^2.0.4",
|
|
243
244
|
"source-map-support": "^0.5.21",
|
|
244
|
-
"typescript": "^5.
|
|
245
|
+
"typescript": "^5.6.2",
|
|
245
246
|
"vite": "^5.4.0"
|
|
246
247
|
},
|
|
247
248
|
"scripts": {
|
|
@@ -255,4 +256,4 @@
|
|
|
255
256
|
"release:minor": "release-me minor",
|
|
256
257
|
"release:commit": "release-me commit"
|
|
257
258
|
}
|
|
258
|
-
}
|
|
259
|
+
}
|