vike 0.4.231-commit-e1c3295 → 0.4.232-commit-134207d
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/README.md +4 -2
- package/dist/cjs/__internal/index.js +2 -2
- package/dist/cjs/client/runtime-client-routing/globalContext.js +1 -1
- package/dist/cjs/client/shared/createGetGlobalContextClient.js +2 -2
- package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +2 -2
- package/dist/cjs/node/api/build.js +6 -2
- package/dist/cjs/node/api/dev.js +1 -1
- package/dist/cjs/node/api/prepareViteApiCall.js +8 -8
- package/dist/cjs/node/api/prerender.js +1 -1
- package/dist/cjs/node/api/preview.js +2 -2
- package/dist/cjs/node/cli/entry.js +1 -1
- package/dist/cjs/node/cli/parseCli.js +2 -2
- package/dist/cjs/node/client/router.js +1 -1
- package/dist/cjs/node/createPageRenderer.js +1 -1
- package/dist/cjs/node/prerender/context.js +1 -1
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +3 -2
- package/dist/cjs/node/prerender/runPrerender.js +91 -46
- package/dist/cjs/node/prerender/runPrerenderEntry.js +1 -1
- package/dist/cjs/node/prerender/utils.js +1 -0
- package/dist/cjs/node/runtime/globalContext.js +22 -15
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +7 -7
- package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +1 -1
- package/dist/cjs/node/runtime/html/injectAssets/inferHtmlTags.js +1 -1
- package/dist/cjs/node/runtime/html/injectAssets/injectAssets__public.js +5 -5
- package/dist/cjs/node/runtime/html/injectAssets/injectHtmlTags.js +3 -3
- package/dist/cjs/node/runtime/html/injectAssets.js +1 -1
- package/dist/cjs/node/runtime/html/renderHtml.js +8 -8
- package/dist/cjs/node/runtime/html/serializeContext.js +5 -5
- package/dist/cjs/node/runtime/html/stream.js +19 -19
- package/dist/cjs/node/runtime/index-deprecated.js +2 -2
- package/dist/cjs/node/runtime/index.js +1 -1
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +4 -4
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +1 -1
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -1
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +5 -6
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +4 -4
- package/dist/cjs/node/runtime/renderPage/debugPageFiles.js +1 -1
- package/dist/cjs/node/runtime/renderPage/execHookServer.js +1 -4
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -1
- package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +3 -3
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -1
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +1 -1
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -1
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +1 -1
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +2 -2
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +1 -1
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -1
- package/dist/cjs/node/runtime/renderPage/isFontFallback.js +3 -3
- package/dist/cjs/node/runtime/renderPage/isNewError.js +2 -1
- package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +10 -10
- package/dist/cjs/node/runtime/renderPage/log404/index.js +4 -8
- package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +2 -2
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +18 -18
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +3 -3
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +1 -1
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +22 -4
- package/dist/cjs/node/runtime/renderPage.js +17 -34
- package/dist/cjs/node/runtime/universal-middleware.js +2 -2
- package/dist/cjs/node/runtime/utils.js +1 -1
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +3 -3
- package/dist/cjs/node/shared/extractAssetsQuery.js +1 -1
- package/dist/cjs/node/shared/getVikeConfigError.js +22 -0
- package/dist/cjs/node/shared/resolveBase.js +1 -1
- package/dist/cjs/node/shared/utils.js +1 -0
- package/dist/cjs/node/shared/virtualFiles/virtualFilePageConfigLazy.js +2 -2
- package/dist/cjs/node/vite/index.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +30 -28
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginAutoFullBuild.js +10 -10
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +10 -10
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +10 -10
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildEntry.js +12 -13
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +14 -12
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginBuild.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginCommon.js +14 -14
- package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginDev.js +8 -8
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +4 -4
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +6 -6
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginPreview.js +9 -9
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +6 -6
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getVirtualFileEntry.js +10 -10
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getVirtualFilePageConfigLazy.js +11 -1
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +2 -2
- package/dist/cjs/node/vite/shared/addSsrMiddleware.js +3 -3
- package/dist/cjs/node/vite/shared/findPageFiles.js +1 -1
- package/dist/cjs/node/vite/shared/getFilePath.js +24 -24
- package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +4 -4
- package/dist/cjs/node/vite/shared/getOutDirs.js +2 -2
- package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +3 -3
- package/dist/cjs/node/vite/shared/isAsset.js +1 -1
- package/dist/cjs/node/vite/shared/isViteCliCall.js +1 -1
- package/dist/cjs/node/vite/shared/isViteServerBuild.js +2 -2
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +1 -1
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +1 -1
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +5 -5
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +3 -3
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +10 -10
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +2 -2
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +2 -2
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +2 -2
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +2 -2
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +1 -1
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +1 -1
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +3 -3
- package/dist/cjs/node/vite/shared/loggerNotProd.js +1 -1
- package/dist/cjs/node/vite/shared/resolveClientEntriesDev.js +2 -2
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +2 -2
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +50 -50
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +1 -1
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +13 -13
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +14 -5
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +4 -4
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +1 -1
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +5 -5
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +5 -5
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +25 -25
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +46 -46
- package/dist/cjs/node/vite/utils.js +2 -7
- package/dist/cjs/shared/assertHookReturnedObject.js +1 -1
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +2 -2
- package/dist/cjs/shared/createGlobalContextShared.js +26 -18
- package/dist/cjs/shared/createPageContextShared.js +1 -1
- package/dist/cjs/shared/getPageContextRequestUrl.js +1 -1
- package/dist/cjs/shared/getPageContextUrlComputed.js +5 -5
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +3 -3
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +1 -1
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +3 -3
- package/dist/cjs/shared/getPageFiles/fileTypes.js +1 -1
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +2 -2
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +1 -1
- package/dist/cjs/shared/getProxyForPublicUsage.js +2 -2
- package/dist/cjs/shared/hooks/execHook.js +2 -2
- package/dist/cjs/shared/hooks/getHook.js +4 -4
- package/dist/cjs/shared/modifyUrl.js +1 -1
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +2 -2
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +4 -4
- package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +21 -21
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +3 -3
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +9 -9
- package/dist/cjs/shared/preparePageContextForPublicUsage.js +3 -3
- package/dist/cjs/shared/route/abort.js +7 -7
- package/dist/cjs/shared/route/debug.js +1 -1
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +1 -1
- package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +3 -3
- package/dist/cjs/shared/route/index.js +5 -5
- package/dist/cjs/shared/route/loadPageRoutes.js +8 -8
- package/dist/cjs/shared/route/resolvePrecedence.js +2 -2
- package/dist/cjs/shared/route/resolveRoute.js +1 -1
- package/dist/cjs/shared/route/resolveRouteFunction.js +2 -2
- package/dist/cjs/shared/utils.js +1 -0
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assert.js +9 -9
- package/dist/cjs/utils/assertKeys.js +1 -1
- package/dist/cjs/utils/assertSetup.js +1 -1
- package/dist/cjs/utils/assertSingleInstance.js +5 -5
- package/dist/cjs/utils/catchInfiniteLoop.js +1 -1
- package/dist/cjs/utils/debug.js +1 -1
- package/dist/cjs/utils/findFile.js +5 -5
- package/dist/cjs/utils/findPackageJson.js +3 -3
- package/dist/cjs/utils/formatHintLog.js +1 -1
- package/dist/cjs/utils/freezePartial.js +1 -1
- package/dist/cjs/utils/genPromise.js +2 -2
- package/dist/cjs/utils/getMostSimilar.js +1 -1
- package/dist/cjs/utils/injectRollupInputs.js +2 -2
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +1 -1
- package/dist/cjs/utils/objectAssignSafe.js +1 -1
- package/dist/cjs/utils/pLimit.js +4 -4
- package/dist/cjs/utils/parseNpmPackage.js +2 -2
- package/dist/cjs/utils/parseUrl.js +3 -3
- package/dist/cjs/utils/path.js +1 -1
- package/dist/cjs/utils/preservePropertyGetters.js +1 -1
- package/dist/cjs/utils/{removeFileExtention.js → removeFileExtension.js} +2 -2
- package/dist/cjs/utils/requireResolve.js +10 -10
- package/dist/cjs/utils/rollupSourceMap.js +2 -2
- package/dist/cjs/utils/stripAnsi.js +1 -1
- package/dist/cjs/utils/styleFileRE.js +1 -0
- package/dist/cjs/utils/trimWithAnsi.js +1 -1
- package/dist/esm/__internal/index.js +2 -2
- package/dist/esm/client/index.d.ts +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/client/node.js +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-client-routing/getPageContext/removeBuiltInOverrides.js +1 -1
- package/dist/esm/client/runtime-client-routing/getPageContextCurrent.js +1 -1
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +2 -3
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.js +5 -5
- package/dist/esm/client/runtime-client-routing/globalContext.js +1 -1
- package/dist/esm/client/runtime-client-routing/history.js +6 -6
- package/dist/esm/client/runtime-client-routing/initClientRouter.js +1 -1
- package/dist/esm/client/runtime-client-routing/initOnLinkClick.js +1 -1
- package/dist/esm/client/runtime-client-routing/initOnPopState.js +1 -1
- package/dist/esm/client/runtime-client-routing/isClientSideRoutable.js +1 -1
- package/dist/esm/client/runtime-client-routing/navigate.js +1 -1
- package/dist/esm/client/runtime-client-routing/prefetch/getPrefetchSettings.js +2 -2
- package/dist/esm/client/runtime-client-routing/prefetch.js +10 -10
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +20 -20
- package/dist/esm/client/runtime-client-routing/setScrollPosition.js +1 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/shared/createGetGlobalContextClient.js +3 -3
- package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +1 -1
- package/dist/esm/client/shared/preparePageContextForPublicUsageClientShared.js +3 -3
- package/dist/esm/node/api/build.js +6 -2
- package/dist/esm/node/api/dev.js +1 -1
- package/dist/esm/node/api/prepareViteApiCall.js +8 -8
- package/dist/esm/node/api/prerender.js +1 -1
- package/dist/esm/node/api/preview.js +2 -2
- package/dist/esm/node/cli/entry.js +1 -1
- package/dist/esm/node/cli/parseCli.js +2 -2
- package/dist/esm/node/client/router.js +1 -1
- package/dist/esm/node/createPageRenderer.js +1 -1
- package/dist/esm/node/prerender/context.d.ts +1 -1
- package/dist/esm/node/prerender/context.js +1 -1
- package/dist/esm/node/prerender/resolvePrerenderConfig.d.ts +1 -0
- package/dist/esm/node/prerender/resolvePrerenderConfig.js +3 -2
- package/dist/esm/node/prerender/runPrerender.d.ts +9 -6
- package/dist/esm/node/prerender/runPrerender.js +90 -45
- package/dist/esm/node/prerender/runPrerenderEntry.js +1 -1
- package/dist/esm/node/prerender/utils.d.ts +1 -0
- package/dist/esm/node/prerender/utils.js +1 -0
- package/dist/esm/node/runtime/globalContext.js +25 -18
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +8 -8
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.js +1 -1
- package/dist/esm/node/runtime/html/injectAssets/inferHtmlTags.js +1 -1
- package/dist/esm/node/runtime/html/injectAssets/injectAssets__public.js +5 -5
- package/dist/esm/node/runtime/html/injectAssets/injectHtmlTags.js +3 -3
- package/dist/esm/node/runtime/html/injectAssets.js +2 -2
- package/dist/esm/node/runtime/html/renderHtml.js +10 -10
- package/dist/esm/node/runtime/html/serializeContext.js +5 -5
- package/dist/esm/node/runtime/html/stream.d.ts +1 -1
- package/dist/esm/node/runtime/html/stream.js +21 -21
- package/dist/esm/node/runtime/index-deprecated.js +2 -2
- package/dist/esm/node/runtime/index.js +1 -1
- package/dist/esm/node/runtime/renderPage/analyzePage.js +4 -4
- package/dist/esm/node/runtime/renderPage/assertArguments.js +1 -1
- package/dist/esm/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -1
- package/dist/esm/node/runtime/renderPage/createHttpResponse.js +5 -6
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.js +4 -4
- package/dist/esm/node/runtime/renderPage/debugPageFiles.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/debugPageFiles.js +1 -1
- package/dist/esm/node/runtime/renderPage/execHookServer.js +2 -5
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -1
- package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.js +5 -5
- package/dist/esm/node/runtime/renderPage/getEarlyHints.js +1 -1
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +2 -2
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.js +1 -1
- package/dist/esm/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -1
- package/dist/esm/node/runtime/renderPage/isFontFallback.js +3 -3
- package/dist/esm/node/runtime/renderPage/isNewError.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/isNewError.js +2 -1
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +11 -11
- package/dist/esm/node/runtime/renderPage/log404/index.js +5 -9
- package/dist/esm/node/runtime/renderPage/logErrorHint/errors.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/logErrorHint/errors.js +1 -1
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +18 -18
- package/dist/esm/node/runtime/renderPage/loggerProd.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/loggerProd.js +3 -3
- package/dist/esm/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +1 -1
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -2
- package/dist/esm/node/runtime/renderPage/resolveRedirects.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/resolveRedirects.js +24 -6
- package/dist/esm/node/runtime/renderPage.d.ts +0 -11
- package/dist/esm/node/runtime/renderPage.js +20 -37
- package/dist/esm/node/runtime/universal-middleware.js +2 -2
- package/dist/esm/node/runtime/utils.d.ts +1 -1
- package/dist/esm/node/runtime/utils.js +1 -1
- package/dist/esm/node/runtime-dev/createDevMiddleware.js +3 -3
- package/dist/esm/node/shared/extractAssetsQuery.js +1 -1
- package/dist/esm/node/shared/getVikeConfigError.d.ts +13 -0
- package/dist/esm/node/shared/getVikeConfigError.js +20 -0
- package/dist/esm/node/shared/resolveBase.js +1 -1
- package/dist/esm/node/shared/utils.d.ts +1 -0
- package/dist/esm/node/shared/utils.js +1 -0
- package/dist/esm/node/shared/virtualFiles/virtualFilePageConfigLazy.js +2 -2
- package/dist/esm/node/vite/index.js +2 -2
- package/dist/esm/node/vite/plugins/pluginBaseUrls.js +3 -3
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.d.ts +3 -2
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +14 -12
- package/dist/esm/node/vite/plugins/pluginBuild/pluginAutoFullBuild.js +10 -10
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildApp.js +10 -10
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.js +12 -12
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildEntry.d.ts +1 -2
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildEntry.js +11 -12
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +11 -9
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +2 -2
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +3 -3
- package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +3 -3
- package/dist/esm/node/vite/plugins/pluginBuild.js +1 -1
- package/dist/esm/node/vite/plugins/pluginCommon/assertResolveAlias.js +2 -2
- package/dist/esm/node/vite/plugins/pluginCommon.js +14 -14
- package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +1 -1
- package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +5 -5
- package/dist/esm/node/vite/plugins/pluginDev.js +8 -8
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +5 -5
- package/dist/esm/node/vite/plugins/pluginExtractAssets.js +8 -8
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +3 -3
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +4 -4
- package/dist/esm/node/vite/plugins/pluginPreview.js +5 -5
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +3 -3
- package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +7 -7
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/getVirtualFileEntry.js +11 -11
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/getVirtualFilePageConfigLazy.js +13 -3
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +3 -3
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +2 -2
- package/dist/esm/node/vite/shared/addSsrMiddleware.js +3 -3
- package/dist/esm/node/vite/shared/findPageFiles.js +1 -1
- package/dist/esm/node/vite/shared/getFilePath.d.ts +5 -5
- package/dist/esm/node/vite/shared/getFilePath.js +22 -22
- package/dist/esm/node/vite/shared/getHttpRequestAsyncStore.js +4 -4
- package/dist/esm/node/vite/shared/getOutDirs.js +2 -2
- package/dist/esm/node/vite/shared/getViteConfigRuntime.js +3 -3
- package/dist/esm/node/vite/shared/isAsset.js +1 -1
- package/dist/esm/node/vite/shared/isViteCliCall.js +1 -1
- package/dist/esm/node/vite/shared/isViteServerBuild.js +2 -2
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +1 -1
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +1 -1
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +5 -5
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +3 -3
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +10 -10
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +2 -2
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +2 -2
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +2 -2
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +2 -2
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +1 -1
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +1 -1
- package/dist/esm/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +4 -4
- package/dist/esm/node/vite/shared/loggerNotProd.js +3 -3
- package/dist/esm/node/vite/shared/resolveClientEntriesDev.js +3 -3
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +1 -1
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +50 -50
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +1 -1
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +10 -10
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +14 -5
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +4 -4
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +1 -1
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +5 -5
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +6 -6
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +14 -14
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.d.ts +2 -2
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +52 -52
- package/dist/esm/node/vite/utils.d.ts +0 -6
- package/dist/esm/node/vite/utils.js +2 -7
- package/dist/esm/shared/assertHookReturnedObject.js +1 -1
- package/dist/esm/shared/assertPageContextProvidedByUser.d.ts +1 -1
- package/dist/esm/shared/assertPageContextProvidedByUser.js +2 -2
- package/dist/esm/shared/createGlobalContextShared.d.ts +2 -0
- package/dist/esm/shared/createGlobalContextShared.js +28 -20
- package/dist/esm/shared/createPageContextShared.js +1 -1
- package/dist/esm/shared/getPageContextRequestUrl.js +1 -1
- package/dist/esm/shared/getPageContextUrlComputed.js +5 -5
- package/dist/esm/shared/getPageFiles/analyzePageClientSide/analyzeExports.d.ts +1 -1
- package/dist/esm/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +3 -3
- package/dist/esm/shared/getPageFiles/analyzePageClientSide/determineClientEntry.d.ts +1 -1
- package/dist/esm/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +1 -1
- package/dist/esm/shared/getPageFiles/analyzePageClientSide.js +3 -3
- package/dist/esm/shared/getPageFiles/fileTypes.js +1 -1
- package/dist/esm/shared/getPageFiles/getAllPageIdFiles.js +2 -2
- package/dist/esm/shared/getPageFiles/getPageFileObject.js +1 -1
- package/dist/esm/shared/getProxyForPublicUsage.js +2 -2
- package/dist/esm/shared/hooks/execHook.js +3 -3
- package/dist/esm/shared/hooks/getHook.js +4 -4
- package/dist/esm/shared/modifyUrl.js +1 -1
- package/dist/esm/shared/modifyUrlSameOrigin.js +1 -1
- package/dist/esm/shared/page-configs/assertPlusFileExport.js +2 -2
- package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +4 -4
- package/dist/esm/shared/page-configs/resolveVikeConfigPublic.d.ts +2 -2
- package/dist/esm/shared/page-configs/resolveVikeConfigPublic.js +22 -22
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +3 -3
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +11 -11
- package/dist/esm/shared/preparePageContextForPublicUsage.js +4 -4
- package/dist/esm/shared/route/abort.js +8 -8
- package/dist/esm/shared/route/debug.js +1 -1
- package/dist/esm/shared/route/deduceRouteStringFromFilesystemPath.js +1 -1
- package/dist/esm/shared/route/executeOnBeforeRouteHook.js +5 -5
- package/dist/esm/shared/route/index.js +6 -6
- package/dist/esm/shared/route/loadPageRoutes.js +8 -8
- package/dist/esm/shared/route/resolvePrecedence.d.ts +2 -2
- package/dist/esm/shared/route/resolvePrecedence.js +2 -2
- package/dist/esm/shared/route/resolveRoute.js +1 -1
- package/dist/esm/shared/route/resolveRouteFunction.js +2 -2
- package/dist/esm/shared/utils.d.ts +1 -0
- package/dist/esm/shared/utils.js +1 -0
- package/dist/esm/types/Config.d.ts +6 -0
- package/dist/esm/types/FilePath.d.ts +1 -1
- package/dist/esm/types/PageConfig.d.ts +1 -1
- package/dist/esm/types/PageContext.d.ts +2 -2
- package/dist/esm/types/index-dreprecated.d.ts +1 -1
- package/dist/esm/types/index.d.ts +3 -3
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assert.js +9 -9
- package/dist/esm/utils/assertKeys.js +1 -1
- package/dist/esm/utils/assertSetup.js +1 -1
- package/dist/esm/utils/assertSingleInstance.js +5 -5
- package/dist/esm/utils/catchInfiniteLoop.js +1 -1
- package/dist/esm/utils/debug.js +1 -1
- package/dist/esm/utils/findFile.js +2 -2
- package/dist/esm/utils/findPackageJson.js +2 -2
- package/dist/esm/utils/formatHintLog.js +1 -1
- package/dist/esm/utils/freezePartial.js +1 -1
- package/dist/esm/utils/genPromise.d.ts +1 -1
- package/dist/esm/utils/genPromise.js +2 -2
- package/dist/esm/utils/getMostSimilar.js +1 -1
- package/dist/esm/utils/injectRollupInputs.js +2 -2
- package/dist/esm/utils/isFilePathAbsoluteFilesystem.js +1 -1
- package/dist/esm/utils/objectAssignSafe.js +1 -1
- package/dist/esm/utils/pLimit.js +4 -4
- package/dist/esm/utils/parseNpmPackage.js +2 -2
- package/dist/esm/utils/parseUrl.js +3 -3
- package/dist/esm/utils/path.js +1 -1
- package/dist/esm/utils/preservePropertyGetters.js +1 -1
- package/dist/esm/utils/removeFileExtension.d.ts +1 -0
- package/dist/esm/utils/{removeFileExtention.js → removeFileExtension.js} +1 -1
- package/dist/esm/utils/requireResolve.d.ts +3 -3
- package/dist/esm/utils/requireResolve.js +10 -10
- package/dist/esm/utils/rollupSourceMap.js +2 -2
- package/dist/esm/utils/stripAnsi.js +1 -1
- package/dist/esm/utils/styleFileRE.js +1 -0
- package/dist/esm/utils/trimWithAnsi.js +1 -1
- package/package.json +2 -2
- package/dist/esm/utils/removeFileExtention.d.ts +0 -1
|
@@ -8,8 +8,8 @@ exports.set_macro_ASSETS_MANIFEST = set_macro_ASSETS_MANIFEST;
|
|
|
8
8
|
const plugin_1 = require("@brillout/vite-plugin-server-entry/plugin");
|
|
9
9
|
const virtualFileEntry_js_1 = require("../../../shared/virtualFiles/virtualFileEntry.js");
|
|
10
10
|
const utils_js_1 = require("../../utils.js");
|
|
11
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
12
|
-
const
|
|
11
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
12
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
13
13
|
const pluginExtractExportNames_js_1 = require("../pluginExtractExportNames.js");
|
|
14
14
|
const globalContext_js_1 = require("../../../runtime/globalContext.js");
|
|
15
15
|
const getOutDirs_js_1 = require("../../shared/getOutDirs.js");
|
|
@@ -24,14 +24,14 @@ function pluginBuildEntry() {
|
|
|
24
24
|
enforce: 'post',
|
|
25
25
|
async configResolved(config_) {
|
|
26
26
|
config = config_;
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
28
|
},
|
|
29
29
|
...(0, plugin_1.serverProductionEntryPlugin)({
|
|
30
30
|
getServerProductionEntry: () => {
|
|
31
31
|
return getServerProductionEntryCode(config);
|
|
32
32
|
},
|
|
33
|
-
libraryName: 'Vike'
|
|
34
|
-
})
|
|
33
|
+
libraryName: 'Vike',
|
|
34
|
+
}),
|
|
35
35
|
];
|
|
36
36
|
}
|
|
37
37
|
function getServerProductionEntryCode(config) {
|
|
@@ -39,7 +39,7 @@ function getServerProductionEntryCode(config) {
|
|
|
39
39
|
const buildInfo = {
|
|
40
40
|
versionAtBuildTime: utils_js_1.PROJECT_VERSION,
|
|
41
41
|
usesClientRouter: (0, pluginExtractExportNames_js_1.isUsingClientRouter)(), // TODO/v1-release: remove
|
|
42
|
-
viteConfigRuntime: (0, getViteConfigRuntime_js_1.getViteConfigRuntime)(config)
|
|
42
|
+
viteConfigRuntime: (0, getViteConfigRuntime_js_1.getViteConfigRuntime)(config),
|
|
43
43
|
};
|
|
44
44
|
(0, globalContext_js_1.assertBuildInfo)(buildInfo);
|
|
45
45
|
// After the old design is removed, let's maybe simplify and move everything into a single virtual module
|
|
@@ -57,14 +57,13 @@ function getServerProductionEntryCode(config) {
|
|
|
57
57
|
` buildInfo,`,
|
|
58
58
|
' });',
|
|
59
59
|
` }`,
|
|
60
|
-
''
|
|
60
|
+
'',
|
|
61
61
|
].join('\n');
|
|
62
62
|
return importerCode;
|
|
63
63
|
}
|
|
64
64
|
// Set the value of the ASSETS_MANIFEST constant inside dist/server/entry.js (or dist/server/index.js)
|
|
65
|
-
async function set_macro_ASSETS_MANIFEST(
|
|
66
|
-
|
|
67
|
-
(0, utils_js_1.assert)(dir);
|
|
65
|
+
async function set_macro_ASSETS_MANIFEST(assetsJsonFilePath, bundle, outDir) {
|
|
66
|
+
(0, utils_js_1.assert)(outDir);
|
|
68
67
|
const chunkPath = find_ASSETS_MANIFEST(bundle);
|
|
69
68
|
// Some server builds don't contain __VITE_ASSETS_MANIFEST__ such as dist/rsc/ from vike-react-rsc
|
|
70
69
|
if (!chunkPath) {
|
|
@@ -72,10 +71,10 @@ async function set_macro_ASSETS_MANIFEST(options, bundle, assetsJsonFilePath) {
|
|
|
72
71
|
return noop;
|
|
73
72
|
}
|
|
74
73
|
(0, utils_js_1.assert)(assetsJsonFilePath);
|
|
75
|
-
const chunkFilePath =
|
|
74
|
+
const chunkFilePath = node_path_1.default.join(outDir, chunkPath);
|
|
76
75
|
const [assetsJsonString, chunkFileContent] = await Promise.all([
|
|
77
76
|
await promises_1.default.readFile(assetsJsonFilePath, 'utf8'),
|
|
78
|
-
await promises_1.default.readFile(chunkFilePath, 'utf8')
|
|
77
|
+
await promises_1.default.readFile(chunkFilePath, 'utf8'),
|
|
79
78
|
]);
|
|
80
79
|
const serverEntryFileContentPatched = chunkFileContent.replace(ASSETS_MANIFEST, assetsJsonString);
|
|
81
80
|
(0, utils_js_1.assert)(serverEntryFileContentPatched !== chunkFileContent);
|
|
@@ -104,7 +103,7 @@ function getImportPath(config) {
|
|
|
104
103
|
}
|
|
105
104
|
else {
|
|
106
105
|
const { outDirServer } = (0, getOutDirs_js_1.getOutDirs)(config);
|
|
107
|
-
const filePathRelative =
|
|
106
|
+
const filePathRelative = node_path_1.default.posix.relative(outDirServer, filePathAbsolute);
|
|
108
107
|
return filePathRelative;
|
|
109
108
|
}
|
|
110
109
|
}
|
|
@@ -8,8 +8,8 @@ exports.pluginDistFileNames = pluginDistFileNames;
|
|
|
8
8
|
// - https://github.com/vikejs/vike/commit/11a4c49e5403aa7c37c8020c462b499425b41854
|
|
9
9
|
// - Blocker: https://github.com/rollup/rollup/issues/4724
|
|
10
10
|
const utils_js_1 = require("../../utils.js");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
13
13
|
const getAssetsDir_js_1 = require("../../shared/getAssetsDir.js");
|
|
14
14
|
const getFilePath_js_1 = require("../../shared/getFilePath.js");
|
|
15
15
|
function pluginDistFileNames() {
|
|
@@ -19,7 +19,7 @@ function pluginDistFileNames() {
|
|
|
19
19
|
enforce: 'post',
|
|
20
20
|
configResolved(config) {
|
|
21
21
|
const rollupOutputs = getRollupOutputs(config);
|
|
22
|
-
// We need to support multiple outputs: @vite/plugin-legacy adds an
|
|
22
|
+
// We need to support multiple outputs: @vite/plugin-legacy adds an output, see https://github.com/vikejs/vike/issues/477#issuecomment-1406434802
|
|
23
23
|
rollupOutputs.forEach((rollupOutput) => {
|
|
24
24
|
if (!('entryFileNames' in rollupOutput)) {
|
|
25
25
|
rollupOutput.entryFileNames = (chunkInfo) => getEntryFileName(chunkInfo, config, true);
|
|
@@ -29,6 +29,8 @@ function pluginDistFileNames() {
|
|
|
29
29
|
}
|
|
30
30
|
if (!('assetFileNames' in rollupOutput)) {
|
|
31
31
|
rollupOutput.assetFileNames = (chunkInfo) => getAssetFileName(chunkInfo, config);
|
|
32
|
+
rollupOutput.assetFileNames.isTheOneSetByVike = true;
|
|
33
|
+
(0, utils_js_1.assert)(rollupOutput.assetFileNames.isTheOneSetByVike);
|
|
32
34
|
}
|
|
33
35
|
else {
|
|
34
36
|
// If a user needs this:
|
|
@@ -36,7 +38,7 @@ function pluginDistFileNames() {
|
|
|
36
38
|
// - It's needed for getHash() of handleAssetsManifest()
|
|
37
39
|
// - Asset URLs should always contain a hash: it's paramount for caching assets.
|
|
38
40
|
// - If rollupOutput.assetFileNames is a function then use a wrapper function to apply the assertUsage()
|
|
39
|
-
(0, utils_js_1.assertUsage)(
|
|
41
|
+
(0, utils_js_1.assertUsage)(rollupOutput.assetFileNames.isTheOneSetByVike, "Setting Vite's configuration build.rollupOptions.output.assetFileNames is currently forbidden. Reach out if you need to use it.");
|
|
40
42
|
}
|
|
41
43
|
{
|
|
42
44
|
const manualChunksOriginal = rollupOutput.manualChunks;
|
|
@@ -70,7 +72,7 @@ function pluginDistFileNames() {
|
|
|
70
72
|
name = name.split('/').filter(Boolean).join('_');
|
|
71
73
|
}
|
|
72
74
|
// Make fileHash the same between local development and CI
|
|
73
|
-
const idStable =
|
|
75
|
+
const idStable = node_path_1.default.posix.relative(userRootDir, id);
|
|
74
76
|
// Don't remove `?` queries because each `id` should belong to a unique bundle.
|
|
75
77
|
const hash = getIdHash(idStable);
|
|
76
78
|
return `${name}-${hash}`;
|
|
@@ -97,11 +99,11 @@ function pluginDistFileNames() {
|
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
});
|
|
100
|
-
}
|
|
102
|
+
},
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
105
|
function getIdHash(id) {
|
|
104
|
-
return
|
|
106
|
+
return node_crypto_1.default.createHash('md5').update(id).digest('hex').slice(0, 8);
|
|
105
107
|
}
|
|
106
108
|
function getAssetFileName(assetInfo, config) {
|
|
107
109
|
const assetsDir = (0, getAssetsDir_js_1.getAssetsDir)(config);
|
|
@@ -112,7 +114,7 @@ function getAssetFileName(assetInfo, config) {
|
|
|
112
114
|
}
|
|
113
115
|
// https://github.com/vikejs/vike/issues/794
|
|
114
116
|
(0, utils_js_1.assertPosixPath)(name);
|
|
115
|
-
name =
|
|
117
|
+
name = node_path_1.default.posix.basename(name);
|
|
116
118
|
// dist/client/assets/index.page.server.jsx_extractAssets_lang.e4e33422.css
|
|
117
119
|
// => dist/client/assets/index.page.server.e4e33422.css
|
|
118
120
|
if (
|
|
@@ -152,7 +154,7 @@ function getEntryFileName(chunkInfo, config, isEntry) {
|
|
|
152
154
|
return `${name}.${isEntry ? 'mjs' : 'js'}`;
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
|
-
function
|
|
157
|
+
function removePathSeparators(name) {
|
|
156
158
|
(0, utils_js_1.assertPosixPath)(name);
|
|
157
159
|
(0, utils_js_1.assert)(!name.startsWith('/'));
|
|
158
160
|
const entryDir = 'entries/';
|
|
@@ -172,9 +174,9 @@ function clean(name, removePathSep, fixGlob) {
|
|
|
172
174
|
if (fixGlob) {
|
|
173
175
|
name = workaroundGlob(name);
|
|
174
176
|
}
|
|
175
|
-
name =
|
|
177
|
+
name = replaceNonLatinCharacters(name);
|
|
176
178
|
if (removePathSep) {
|
|
177
|
-
name =
|
|
179
|
+
name = removePathSeparators(name);
|
|
178
180
|
}
|
|
179
181
|
name = removeLeadingUnderscoreInFilename(name);
|
|
180
182
|
name = removeUnderscoreDoublets(name);
|
|
@@ -194,7 +196,7 @@ function removeUnderscoreDoublets(name) {
|
|
|
194
196
|
name = name.split(/__+/).join('_');
|
|
195
197
|
return name;
|
|
196
198
|
}
|
|
197
|
-
function
|
|
199
|
+
function replaceNonLatinCharacters(name) {
|
|
198
200
|
name = name.split('+').join('');
|
|
199
201
|
name = name.replace(/[^a-zA-Z0-9\/\._]/g, '-');
|
|
200
202
|
return name;
|
|
@@ -39,9 +39,9 @@ function pluginModuleBanner() {
|
|
|
39
39
|
magicString.prepend(`/*! ${id} [vike:pluginModuleBanner] */\n`);
|
|
40
40
|
return {
|
|
41
41
|
code: magicString.toString(),
|
|
42
|
-
map: magicString.generateMap({ hires: true, source: id })
|
|
42
|
+
map: magicString.generateMap({ hires: true, source: id }),
|
|
43
43
|
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
46
|
};
|
|
47
47
|
}
|
|
@@ -25,14 +25,14 @@ function pluginSuppressRollupWarning() {
|
|
|
25
25
|
warn(warning);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
}
|
|
28
|
+
},
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
/** Suppress warning about Rollup removing the React Server Components `"use client";` directives */
|
|
32
32
|
function suppressUseClientDirective(warning) {
|
|
33
33
|
return warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes('"use client"');
|
|
34
34
|
}
|
|
35
|
-
/** Suppress warning about generating
|
|
35
|
+
/** Suppress warning about generating empty chunks in dist/ */
|
|
36
36
|
function suppressEmptyBundle(warning) {
|
|
37
37
|
return warning.code === 'EMPTY_BUNDLE';
|
|
38
38
|
}
|
|
@@ -40,7 +40,7 @@ function suppressEmptyBundle(warning) {
|
|
|
40
40
|
function suppressUnusedImport(warning) {
|
|
41
41
|
if (warning.code !== 'UNUSED_EXTERNAL_IMPORT')
|
|
42
42
|
return false;
|
|
43
|
-
// I guess it's expected that JSX contains
|
|
43
|
+
// I guess it's expected that JSX contains unused `import React from 'react'`
|
|
44
44
|
if (warning.exporter === 'react' && warning.names?.includes('default')) {
|
|
45
45
|
warning.names = warning.names.filter((n) => n !== 'default');
|
|
46
46
|
if (warning.names.length === 0)
|
|
@@ -18,6 +18,6 @@ function pluginBuild() {
|
|
|
18
18
|
(0, pluginDistPackageJsonFile_js_1.pluginDistPackageJsonFile)(),
|
|
19
19
|
(0, pluginSuppressRollupWarning_js_1.pluginSuppressRollupWarning)(),
|
|
20
20
|
(0, pluginDistFileNames_js_1.pluginDistFileNames)(),
|
|
21
|
-
(0, pluginModuleBanner_js_1.pluginModuleBanner)()
|
|
21
|
+
(0, pluginModuleBanner_js_1.pluginModuleBanner)(),
|
|
22
22
|
];
|
|
23
23
|
}
|
|
@@ -25,7 +25,7 @@ function assertResolveAlias(config) {
|
|
|
25
25
|
const errPrefix = config.configFile || 'Your Vite configuration';
|
|
26
26
|
const errSuffix1 = 'see https://vike.dev/path-aliases#vite';
|
|
27
27
|
const deprecation = 'which will be deprecated in the next major release';
|
|
28
|
-
const errSuffix2 = `${deprecation}, use a string
|
|
28
|
+
const errSuffix2 = `${deprecation}, use a string instead and ${errSuffix1}`;
|
|
29
29
|
aliases.forEach((alias) => {
|
|
30
30
|
const { customResolver, find } = alias;
|
|
31
31
|
{
|
|
@@ -45,7 +45,7 @@ function assertResolveAlias(config) {
|
|
|
45
45
|
{
|
|
46
46
|
const msg = `${errPrefix} defines resolve.alias with a regular expression ${errSuffix2}`;
|
|
47
47
|
(0, utils_js_1.assertWarning)(false, msg, {
|
|
48
|
-
onlyOnce: true
|
|
48
|
+
onlyOnce: true,
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -8,7 +8,7 @@ const utils_js_1 = require("../utils.js");
|
|
|
8
8
|
const pluginBuildConfig_js_1 = require("./pluginBuild/pluginBuildConfig.js");
|
|
9
9
|
const require_shim_1 = require("@brillout/require-shim");
|
|
10
10
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
11
|
-
const
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
12
|
const assertResolveAlias_js_1 = require("./pluginCommon/assertResolveAlias.js");
|
|
13
13
|
const isViteCliCall_js_1 = require("../shared/isViteCliCall.js");
|
|
14
14
|
const context_js_1 = require("../../api/context.js");
|
|
@@ -38,11 +38,11 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
38
38
|
_rootResolvedEarly: rootResolvedEarly,
|
|
39
39
|
// TODO/v1-release: remove https://github.com/vikejs/vike/issues/2122
|
|
40
40
|
configVikePromise: Promise.resolve({
|
|
41
|
-
prerender: vikeConfig.prerenderContext.isPrerenderingEnabled
|
|
42
|
-
})
|
|
41
|
+
prerender: vikeConfig.prerenderContext.isPrerenderingEnabled,
|
|
42
|
+
}),
|
|
43
43
|
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
name: pluginName,
|
|
@@ -50,7 +50,7 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
50
50
|
(0, prepareViteApiCall_js_1.assertViteRoot)(config._rootResolvedEarly, config);
|
|
51
51
|
assertSingleInstance(config);
|
|
52
52
|
(0, require_shim_1.installRequireShim_setUserRootDir)(config.root);
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
name: `${pluginName}:post`,
|
|
@@ -68,7 +68,7 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
68
68
|
assertVikeCliOrApi(config);
|
|
69
69
|
temp_supportOldInterface(config);
|
|
70
70
|
await emitServerEntryOnlyIfNeeded(config);
|
|
71
|
-
}
|
|
71
|
+
},
|
|
72
72
|
},
|
|
73
73
|
config: {
|
|
74
74
|
order: 'post',
|
|
@@ -92,9 +92,9 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
92
92
|
setDefault('host', true, configFromUser, configFromVike);
|
|
93
93
|
}
|
|
94
94
|
return configFromVike;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
98
|
];
|
|
99
99
|
}
|
|
100
100
|
// Override Vite's default value without overriding user settings
|
|
@@ -125,7 +125,7 @@ function assertEsm(userViteRoot) {
|
|
|
125
125
|
if (!found)
|
|
126
126
|
return;
|
|
127
127
|
const { packageJson, packageJsonPath } = found;
|
|
128
|
-
let dir =
|
|
128
|
+
let dir = node_path_1.default.posix.dirname(packageJsonPath);
|
|
129
129
|
if (dir !== '/') {
|
|
130
130
|
(0, utils_js_1.assert)(!dir.endsWith('/'));
|
|
131
131
|
dir = dir + '/';
|
|
@@ -144,7 +144,7 @@ function assertVikeCliOrApi(config) {
|
|
|
144
144
|
if ((0, isViteCliCall_js_1.isViteCliCall)()) {
|
|
145
145
|
(0, utils_js_1.assert)(!(0, utils_js_1.isVitest)());
|
|
146
146
|
(0, utils_js_1.assertWarning)(false, `Vite's CLI is deprecated ${picocolors_1.default.underline('https://vike.dev/migration/cli')}`, {
|
|
147
|
-
onlyOnce: true
|
|
147
|
+
onlyOnce: true,
|
|
148
148
|
});
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
@@ -154,12 +154,12 @@ function assertVikeCliOrApi(config) {
|
|
|
154
154
|
}
|
|
155
155
|
if (config.server.middlewareMode) {
|
|
156
156
|
(0, utils_js_1.assertWarning)(false, `${picocolors_1.default.cyan('vite.createServer()')} is deprecated ${picocolors_1.default.underline('https://vike.dev/migration/cli#api')}`, {
|
|
157
|
-
onlyOnce: true
|
|
157
|
+
onlyOnce: true,
|
|
158
158
|
});
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
161
|
(0, utils_js_1.assertWarning)(false, `Vite's JavaScript API is deprecated ${picocolors_1.default.underline('https://vike.dev/migration/cli#api')}`, {
|
|
162
|
-
onlyOnce: true
|
|
162
|
+
onlyOnce: true,
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
// TODO/v1-release: remove https://github.com/vikejs/vike/issues/2122
|
|
@@ -7,11 +7,11 @@ exports.determineFsAllowList = determineFsAllowList;
|
|
|
7
7
|
const vite_1 = require("vite");
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const utils_js_1 = require("../../utils.js");
|
|
10
|
-
const
|
|
10
|
+
const node_url_1 = require("node:url");
|
|
11
11
|
// @ts-ignore `file:///${__filename.split('\\').join('/')}` is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
12
12
|
const importMetaUrl = `file:///${__filename.split('\\').join('/')}`;
|
|
13
13
|
(0, utils_js_1.assertPosixPath)(importMetaUrl);
|
|
14
|
-
const __dirname_ = node_path_1.default.posix.dirname((0,
|
|
14
|
+
const __dirname_ = node_path_1.default.posix.dirname((0, node_url_1.fileURLToPath)(importMetaUrl));
|
|
15
15
|
(0, utils_js_1.assertPosixPath)(__dirname_);
|
|
16
16
|
async function determineFsAllowList(config) {
|
|
17
17
|
const fsAllow = config.server.fs.allow;
|
|
@@ -28,7 +28,7 @@ async function determineOptimizeDeps(config) {
|
|
|
28
28
|
if (debug.isActivated)
|
|
29
29
|
debug('config.optimizeDeps', {
|
|
30
30
|
'config.optimizeDeps.entries': config.optimizeDeps.entries,
|
|
31
|
-
'config.optimizeDeps.include': config.optimizeDeps.include
|
|
31
|
+
'config.optimizeDeps.include': config.optimizeDeps.include,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
async function getPageDeps(config, pageConfigs) {
|
|
@@ -49,7 +49,7 @@ async function getPageDeps(config, pageConfigs) {
|
|
|
49
49
|
pageConfigs.forEach((pageConfig) => {
|
|
50
50
|
Object.entries(pageConfig.configValueSources).forEach(([configName, sources]) => {
|
|
51
51
|
sources
|
|
52
|
-
.filter((source) => !(0, resolveVikeConfigInternal_js_1.
|
|
52
|
+
.filter((source) => !(0, resolveVikeConfigInternal_js_1.isOverridden)(source, configName, pageConfig))
|
|
53
53
|
.forEach((configValueSource) => {
|
|
54
54
|
if (!configValueSource.valueIsLoadedWithImport && !configValueSource.valueIsFilePath)
|
|
55
55
|
return;
|
|
@@ -56,9 +56,9 @@ function pluginDev() {
|
|
|
56
56
|
// // ../../node_modules/.pnpm/react-streaming@0.3.16_react-dom@18.2.0_react@18.2.0/node_modules/react-streaming/dist/esm/client/useAsync.js
|
|
57
57
|
// import { parse as parse2 } from "@brillout/json-serializer/parse";
|
|
58
58
|
// ```
|
|
59
|
-
'react-streaming'
|
|
60
|
-
]
|
|
61
|
-
}
|
|
59
|
+
'react-streaming',
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
62
|
};
|
|
63
63
|
},
|
|
64
64
|
async configResolved(config_) {
|
|
@@ -70,7 +70,7 @@ function pluginDev() {
|
|
|
70
70
|
(0, loggerVite_js_1.improveViteLogs)(config);
|
|
71
71
|
}
|
|
72
72
|
logDockerHint(config.server.host);
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
name: 'vike:pluginDev:addSsrMiddleware',
|
|
@@ -86,7 +86,7 @@ function pluginDev() {
|
|
|
86
86
|
return () => {
|
|
87
87
|
(0, addSsrMiddleware_js_1.addSsrMiddleware)(server.middlewares, config, false, null);
|
|
88
88
|
};
|
|
89
|
-
}
|
|
89
|
+
},
|
|
90
90
|
},
|
|
91
91
|
// Setting `configResolved.clearScreen = false` doesn't work
|
|
92
92
|
config: {
|
|
@@ -95,9 +95,9 @@ function pluginDev() {
|
|
|
95
95
|
if ((0, isErrorDebug_js_1.isErrorDebug)()) {
|
|
96
96
|
return { clearScreen: false };
|
|
97
97
|
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
101
|
];
|
|
102
102
|
}
|
|
103
103
|
function logDockerHint(configHost) {
|
|
@@ -14,11 +14,11 @@ const applyRegExWithMagicString_js_1 = require("../shared/applyRegExWithMagicStr
|
|
|
14
14
|
// TODO/enventually:
|
|
15
15
|
// - Make import.meta.env work inside +config.js
|
|
16
16
|
// - For it to work, we'll probably need the user to define the settings (e.g. `envDir`) for loadEnv() inside vike.config.js instead of vite.config.js
|
|
17
|
-
// - Or stop using Vite's `mode`
|
|
17
|
+
// - Or stop using Vite's `mode` implementation and have Vike implement its own `mode` feature? (So that the only dependencies are `$ vike build --mode staging` and `$ MODE=staging vike build`.)
|
|
18
18
|
const PUBLIC_ENV_PREFIX = 'PUBLIC_ENV__';
|
|
19
19
|
const PUBLIC_ENV_ALLOWLIST = [
|
|
20
20
|
// https://github.com/vikejs/vike/issues/1724
|
|
21
|
-
'STORYBOOK'
|
|
21
|
+
'STORYBOOK',
|
|
22
22
|
];
|
|
23
23
|
function pluginEnvVars() {
|
|
24
24
|
let envsAll;
|
|
@@ -87,8 +87,8 @@ function pluginEnvVars() {
|
|
|
87
87
|
return null;
|
|
88
88
|
return {
|
|
89
89
|
code: magicString.toString(),
|
|
90
|
-
map: magicString.generateMap({ hires: true, source: id })
|
|
90
|
+
map: magicString.generateMap({ hires: true, source: id }),
|
|
91
91
|
};
|
|
92
|
-
}
|
|
92
|
+
},
|
|
93
93
|
};
|
|
94
94
|
}
|
|
@@ -30,7 +30,7 @@ function pluginExtractAssets() {
|
|
|
30
30
|
let vikeConfig;
|
|
31
31
|
let isFixEnabled;
|
|
32
32
|
return [
|
|
33
|
-
// This plugin removes all JavaScript from server-side only code, so that only CSS imports remains. (And also
|
|
33
|
+
// This plugin removes all JavaScript from server-side only code, so that only CSS imports remains. (And also static files imports e.g. `import logoURL from './logo.svg.js'`).
|
|
34
34
|
{
|
|
35
35
|
name: 'vike:pluginExtractAssets:remove-javaScript',
|
|
36
36
|
// In dev, things just work. (Because Vite's module graph erroneously conflates the Vite server-side importees with the client-side importees.)
|
|
@@ -54,7 +54,7 @@ function pluginExtractAssets() {
|
|
|
54
54
|
const code = moduleNames.map((moduleName) => `import '${moduleName}';`).join('\n');
|
|
55
55
|
debugTransformResult(id, code, importStatements);
|
|
56
56
|
return (0, utils_js_1.rollupSourceMapRemove)(code);
|
|
57
|
-
}
|
|
57
|
+
},
|
|
58
58
|
},
|
|
59
59
|
// This plugin appends `?extractAssets` to module IDs
|
|
60
60
|
{
|
|
@@ -118,7 +118,7 @@ function pluginExtractAssets() {
|
|
|
118
118
|
return emptyModule(file, importer);
|
|
119
119
|
}
|
|
120
120
|
return appendExtractAssetsQuery(file, importer);
|
|
121
|
-
}
|
|
121
|
+
},
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
name: 'vike:pluginExtractAssets-3',
|
|
@@ -135,7 +135,7 @@ function pluginExtractAssets() {
|
|
|
135
135
|
if (debug.isActivated) {
|
|
136
136
|
return { logLevel: 'silent' };
|
|
137
137
|
}
|
|
138
|
-
}
|
|
138
|
+
},
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
name: 'vike:pluginExtractAssets-4',
|
|
@@ -147,8 +147,8 @@ function pluginExtractAssets() {
|
|
|
147
147
|
// https://github.com/vikejs/vike/issues/1060
|
|
148
148
|
(0, utils_js_1.assertUsage)(!config.plugins.find((p) => p.name === 'vite-tsconfig-paths'), 'vite-tsconfig-paths not supported, remove it and use vite.config.js#resolve.alias instead');
|
|
149
149
|
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
152
|
];
|
|
153
153
|
}
|
|
154
154
|
function emptyModule(file, importer) {
|
|
@@ -32,7 +32,7 @@ function pluginExtractExportNames() {
|
|
|
32
32
|
if (debug.isActivated) {
|
|
33
33
|
return { logLevel: 'silent' };
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
async function getExtractExportNamesCode(src, isClientSide, isProduction, id) {
|
|
@@ -54,7 +54,7 @@ function getCode(exportNames, wildcardReExports, isClientSide, isProduction, id)
|
|
|
54
54
|
code += '\n';
|
|
55
55
|
code += `export const exportNames = [${[
|
|
56
56
|
...exportNames.map((n) => JSON.stringify(n)),
|
|
57
|
-
...reExportVarNames.map((varName) => `...${varName}`)
|
|
57
|
+
...reExportVarNames.map((varName) => `...${varName}`),
|
|
58
58
|
].join(', ')}];`;
|
|
59
59
|
code = injectHmr(code, isClientSide, isProduction);
|
|
60
60
|
return code;
|
|
@@ -49,13 +49,13 @@ function pluginFileEnv() {
|
|
|
49
49
|
if (!isWrongEnv(id, isServerSide))
|
|
50
50
|
return;
|
|
51
51
|
const { importers } = this.getModuleInfo(id);
|
|
52
|
-
// Throwing a verbose error doesn't waste client-side KBs as dynamic imports are code
|
|
52
|
+
// Throwing a verbose error doesn't waste client-side KBs as dynamic imports are code split.
|
|
53
53
|
const errMsg = getErrorMessage(id, isServerSide, importers, false, true);
|
|
54
54
|
// We have to inject empty exports to avoid Rollup complaining about missing exports, see https://gist.github.com/brillout/5ea45776e65bd65100a52ecd7bfda3ff
|
|
55
55
|
const { exportNames } = await (0, parseEsModule_js_1.getExportNames)(code);
|
|
56
56
|
return (0, utils_js_1.rollupSourceMapRemove)([
|
|
57
57
|
`throw new Error(${JSON.stringify(errMsg)});`,
|
|
58
|
-
...exportNames.map((name) => name === 'default' ? 'export default undefined;' : `export const ${name} = undefined;`)
|
|
58
|
+
...exportNames.map((name) => name === 'default' ? 'export default undefined;' : `export const ${name} = undefined;`),
|
|
59
59
|
].join('\n'));
|
|
60
60
|
},
|
|
61
61
|
generateBundle() {
|
|
@@ -79,7 +79,7 @@ function pluginFileEnv() {
|
|
|
79
79
|
},
|
|
80
80
|
configureServer(viteDevServer_) {
|
|
81
81
|
viteDevServer = viteDevServer_;
|
|
82
|
-
}
|
|
82
|
+
},
|
|
83
83
|
};
|
|
84
84
|
function assertFileEnv(moduleId, isServerSide, importers, onlyWarn) {
|
|
85
85
|
if (!isWrongEnv(moduleId, isServerSide))
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.pluginPreview = pluginPreview;
|
|
7
7
|
const utils_js_1 = require("../utils.js");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const addSsrMiddleware_js_1 = require("../shared/addSsrMiddleware.js");
|
|
11
11
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
12
12
|
const pluginDev_js_1 = require("./pluginDev.js");
|
|
@@ -23,8 +23,8 @@ function pluginPreview() {
|
|
|
23
23
|
return {
|
|
24
24
|
appType: 'custom',
|
|
25
25
|
build: {
|
|
26
|
-
outDir: (0, getOutDirs_js_1.resolveOutDir)(config)
|
|
27
|
-
}
|
|
26
|
+
outDir: (0, getOutDirs_js_1.resolveOutDir)(config),
|
|
27
|
+
},
|
|
28
28
|
};
|
|
29
29
|
},
|
|
30
30
|
async configResolved(config_) {
|
|
@@ -48,7 +48,7 @@ function pluginPreview() {
|
|
|
48
48
|
}
|
|
49
49
|
addStatic404Middleware(server.middlewares);
|
|
50
50
|
};
|
|
51
|
-
}
|
|
51
|
+
},
|
|
52
52
|
};
|
|
53
53
|
function assertDist(isPrerenderingEnabledForAllPages) {
|
|
54
54
|
const { outDirRoot, outDirClient, outDirServer } = (0, getOutDirs_js_1.getOutDirs)(config);
|
|
@@ -56,7 +56,7 @@ function pluginPreview() {
|
|
|
56
56
|
if (!isPrerenderingEnabledForAllPages)
|
|
57
57
|
dirS.push(outDirServer);
|
|
58
58
|
dirS.forEach((outDirAny) => {
|
|
59
|
-
(0, utils_js_1.assertUsage)(
|
|
59
|
+
(0, utils_js_1.assertUsage)(node_fs_1.default.existsSync(outDirAny), `Cannot run ${picocolors_1.default.cyan('$ vike preview')}: your app isn't built (the build directory ${picocolors_1.default.cyan(outDirAny)} is missing). Make sure to run ${picocolors_1.default.cyan('$ vike build')} before running ${picocolors_1.default.cyan('$ vike preview')}.`);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
function addStaticAssetsMiddleware(middlewares) {
|
|
@@ -66,10 +66,10 @@ function pluginPreview() {
|
|
|
66
66
|
function addStatic404Middleware(middlewares) {
|
|
67
67
|
const { outDirClient } = (0, getOutDirs_js_1.getOutDirs)(config);
|
|
68
68
|
middlewares.use(config.base, (_, res, next) => {
|
|
69
|
-
const file =
|
|
70
|
-
if (
|
|
69
|
+
const file = node_path_1.default.posix.join(outDirClient, './404.html');
|
|
70
|
+
if (node_fs_1.default.existsSync(file)) {
|
|
71
71
|
res.statusCode = 404;
|
|
72
|
-
res.end(
|
|
72
|
+
res.end(node_fs_1.default.readFileSync(file));
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
75
|
next();
|
|
@@ -39,7 +39,7 @@ function pluginReplaceConstants() {
|
|
|
39
39
|
const constantsMap = [];
|
|
40
40
|
constantsMap.push({
|
|
41
41
|
constants: ['pageContext.isClientSide', 'globalContext.isClientSide', 'pageContext.globalContext.isClientSide'],
|
|
42
|
-
replacement: !(0, isViteServerBuild_js_1.isViteServerBuild_safe)(config, options)
|
|
42
|
+
replacement: !(0, isViteServerBuild_js_1.isViteServerBuild_safe)(config, options),
|
|
43
43
|
});
|
|
44
44
|
constantsMap.forEach(({ constants, replacement }) => {
|
|
45
45
|
if (!constants.some((c) => code.includes(c)))
|
|
@@ -51,9 +51,9 @@ function pluginReplaceConstants() {
|
|
|
51
51
|
return null;
|
|
52
52
|
return {
|
|
53
53
|
code: magicString.toString(),
|
|
54
|
-
map: magicString.generateMap({ hires: true, source: id })
|
|
54
|
+
map: magicString.generateMap({ hires: true, source: id }),
|
|
55
55
|
};
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
// Copied & adapted from:
|
|
@@ -20,7 +20,7 @@ function pluginSetGlobalContext() {
|
|
|
20
20
|
isServerReload = true;
|
|
21
21
|
(0, globalContext_js_1.setGlobalContext_viteDevServer)(viteDevServer);
|
|
22
22
|
(0, utils_js_1.markSetup_viteDevServer)();
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
},
|
|
25
25
|
configurePreviewServer() {
|
|
26
26
|
(0, utils_js_1.markSetup_vitePreviewServer)();
|
|
@@ -31,8 +31,8 @@ function pluginSetGlobalContext() {
|
|
|
31
31
|
const isViteDev = (0, utils_js_1.isDevCheck)(env);
|
|
32
32
|
(0, globalContext_js_1.setGlobalContext_isProduction)(!isViteDev);
|
|
33
33
|
(0, utils_js_1.markSetup_isViteDev)(isViteDev);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
name: 'vike:pluginSetGlobalContext:post',
|
|
@@ -42,8 +42,8 @@ function pluginSetGlobalContext() {
|
|
|
42
42
|
async handler(config) {
|
|
43
43
|
const viteConfigRuntime = (0, getViteConfigRuntime_js_1.getViteConfigRuntime)(config);
|
|
44
44
|
(0, globalContext_js_1.setGlobalContext_viteConfig)(config, viteConfigRuntime);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
48
|
];
|
|
49
49
|
}
|