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
|
@@ -34,7 +34,16 @@ function getFilesystemRouteString(locationId) {
|
|
|
34
34
|
}
|
|
35
35
|
/** Filesystem Inheritance: get the apply root */
|
|
36
36
|
function getInheritanceRoot(locationId) {
|
|
37
|
-
return getLogicalPath(locationId, [
|
|
37
|
+
return getLogicalPath(locationId, [
|
|
38
|
+
'renderer',
|
|
39
|
+
// - Enable hooks defined by vike-{react,vue,solid} such as +onBeforeRenderClient to be defined at the root directory. In other words, avoid following error:
|
|
40
|
+
// ```bash
|
|
41
|
+
// [11:09:43.072][/test-preview.test.ts][npm run preview][stderr] Error: [vike][Wrong Usage] /+onBeforeRenderClient.ts sets the value of the config onBeforeRenderClient which is a custom config that is defined with https://vike.dev/meta at a path that doesn't apply to / — see https://vike.dev/config#inheritance
|
|
42
|
+
// ```
|
|
43
|
+
// - Not sure if it's a good idea? Could it make config inheritance confusing? Let's try for now and see how it goes.
|
|
44
|
+
// - TO-DO/eventually: update docs https://github.com/vikejs/vike/blob/5fcdc4d5094f1a4dcbefc0b481cdd30a205aef2d/docs/pages/filesystem-routing/%2BPage.mdx?plain=1#L98
|
|
45
|
+
'pages',
|
|
46
|
+
]);
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
40
49
|
* getLogicalPath('/pages/some-page', ['pages']) => '/some-page'
|
|
@@ -113,14 +122,14 @@ function assertRedundantParentheses(dir, ignoredDirs, somePath) {
|
|
|
113
122
|
return;
|
|
114
123
|
}
|
|
115
124
|
const dirnameActual = dir;
|
|
116
|
-
const
|
|
125
|
+
const dirnameCorrect = dirWithoutParentheses;
|
|
117
126
|
const dirpathActual = somePath.slice(0, somePath.indexOf(dirnameActual) + dirnameActual.length);
|
|
118
|
-
const
|
|
127
|
+
const dirpathCorrect = dirpathActual.replaceAll(dirnameActual, dirnameCorrect);
|
|
119
128
|
const logDir = (d) => picocolors_1.default.bold(d + '/');
|
|
120
129
|
(0, utils_js_1.assertWarning)(false, [
|
|
121
|
-
`The directories ${logDir(
|
|
130
|
+
`The directories ${logDir(dirnameCorrect)} are always ignored by Vike's Filesystem Routing`,
|
|
122
131
|
'(https://vike.dev/filesystem-routing):',
|
|
123
|
-
`rename directory ${logDir(dirpathActual)} to ${logDir(
|
|
132
|
+
`rename directory ${logDir(dirpathActual)} to ${logDir(dirpathCorrect)}`,
|
|
124
133
|
].join(' '), { onlyOnce: true });
|
|
125
134
|
}
|
|
126
135
|
function removeFilename(filePathAbsoluteUserRootDir) {
|
|
@@ -68,7 +68,7 @@ async function getPlusFilesAll(userRootDir, esbuildCache) {
|
|
|
68
68
|
filePath,
|
|
69
69
|
isConfigFile: false,
|
|
70
70
|
isNotLoaded: true,
|
|
71
|
-
configName
|
|
71
|
+
configName,
|
|
72
72
|
};
|
|
73
73
|
plusFilesAll[locationId] = plusFilesAll[locationId] ?? [];
|
|
74
74
|
plusFilesAll[locationId].push(plusFile);
|
|
@@ -76,7 +76,7 @@ async function getPlusFilesAll(userRootDir, esbuildCache) {
|
|
|
76
76
|
// - If `configDef` is `undefined` => we load the file +{configName}.js later.
|
|
77
77
|
// - We already need to load +meta.js here (to get the custom config definitions defined by the user)
|
|
78
78
|
await (0, loadFileAtConfigTime_js_1.loadValueFile)(plusFile, configDefinitionsBuiltIn_js_1.configDefinitionsBuiltIn, userRootDir, esbuildCache);
|
|
79
|
-
})
|
|
79
|
+
}),
|
|
80
80
|
]);
|
|
81
81
|
// Make lists element order deterministic
|
|
82
82
|
Object.entries(plusFilesAll).forEach(([_locationId, plusFiles]) => {
|
|
@@ -101,7 +101,7 @@ function getPlusFileFromConfigFile(configFile, isExtensionConfig, locationId, us
|
|
|
101
101
|
if (pointerImport) {
|
|
102
102
|
pointerImportsByConfigName[configName] = {
|
|
103
103
|
...pointerImport,
|
|
104
|
-
fileExportValueLoaded: false
|
|
104
|
+
fileExportValueLoaded: false,
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
});
|
|
@@ -112,7 +112,7 @@ function getPlusFileFromConfigFile(configFile, isExtensionConfig, locationId, us
|
|
|
112
112
|
pointerImportsByConfigName,
|
|
113
113
|
isConfigFile: true,
|
|
114
114
|
isExtensionConfig,
|
|
115
|
-
extendsFilePaths
|
|
115
|
+
extendsFilePaths,
|
|
116
116
|
};
|
|
117
117
|
return plusFile;
|
|
118
118
|
}
|
|
@@ -14,7 +14,7 @@ exports.assertPointerImportPath = assertPointerImportPath;
|
|
|
14
14
|
// - Acorn plugin: https://github.com/acornjs/acorn/issues/983
|
|
15
15
|
// - Isn't stage 4 yet: https://github.com/tc39/proposal-import-attributes
|
|
16
16
|
// - Using a import path suffix such as `import { Layout } from './Layout?real` breaks TypeScript, and TypeScript isn't working on supporting query params: https://github.com/microsoft/TypeScript/issues/10988#issuecomment-867135453
|
|
17
|
-
// - Node.js >=21 supports import
|
|
17
|
+
// - Node.js >=21 supports import attributes: https://nodejs.org/api/esm.html#import-attributes
|
|
18
18
|
// - Esbuid supports
|
|
19
19
|
// - Blocker: https://github.com/evanw/esbuild/issues/3646
|
|
20
20
|
// - Ugly hack to make it work: https://github.com/brillout/esbuild-playground/tree/experiment/import-attribute
|
|
@@ -68,7 +68,7 @@ skipWarnings) {
|
|
|
68
68
|
const errMsg = [
|
|
69
69
|
`The following import in ${filePathToShowToUser2} has no effect:`,
|
|
70
70
|
quote,
|
|
71
|
-
'See https://vike.dev/config#pointer-imports'
|
|
71
|
+
'See https://vike.dev/config#pointer-imports',
|
|
72
72
|
].join('\n');
|
|
73
73
|
if (!skipWarnings) {
|
|
74
74
|
if (!isWarning) {
|
|
@@ -101,7 +101,7 @@ skipWarnings) {
|
|
|
101
101
|
spliceOperations.push({
|
|
102
102
|
start,
|
|
103
103
|
end,
|
|
104
|
-
replacement
|
|
104
|
+
replacement,
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
const codeMod = spliceMany(code, spliceOperations);
|
|
@@ -110,7 +110,7 @@ skipWarnings) {
|
|
|
110
110
|
function getImports(code) {
|
|
111
111
|
const { body } = (0, acorn_1.parse)(code, {
|
|
112
112
|
ecmaVersion: 'latest',
|
|
113
|
-
sourceType: 'module'
|
|
113
|
+
sourceType: 'module',
|
|
114
114
|
// https://github.com/acornjs/acorn/issues/1136
|
|
115
115
|
});
|
|
116
116
|
const imports = [];
|
|
@@ -123,7 +123,7 @@ function getImports(code) {
|
|
|
123
123
|
const import_ = 'import';
|
|
124
124
|
const SEP = ':';
|
|
125
125
|
const zeroWidthSpace = '\u200b';
|
|
126
|
-
function serializePointerImportData({ importPath, exportName, importStringWasGenerated }) {
|
|
126
|
+
function serializePointerImportData({ importPath, exportName, importStringWasGenerated, }) {
|
|
127
127
|
const tag = importStringWasGenerated ? zeroWidthSpace : '';
|
|
128
128
|
// `import:${importPath}:${importPath}`
|
|
129
129
|
return `${tag}${import_}${SEP}${importPath}${SEP}${exportName}`;
|
|
@@ -21,7 +21,7 @@ function resolvePointerImport(configValue, importerFilePath, userRootDir, config
|
|
|
21
21
|
const fileExportPath = {
|
|
22
22
|
...filePath,
|
|
23
23
|
fileExportName: exportName,
|
|
24
|
-
fileExportPathToShowToUser
|
|
24
|
+
fileExportPathToShowToUser,
|
|
25
25
|
};
|
|
26
26
|
return { fileExportPath };
|
|
27
27
|
}
|
|
@@ -45,7 +45,7 @@ function resolvePointerImportData(pointerImportData, importerFilePath, userRootD
|
|
|
45
45
|
(0, utils_js_1.assertUsage)(filePathAbsoluteUserRootDir, `The import path ${importPath} defined by ${importerFilePath.filePathToShowToUser} is ${errSuffix}`);
|
|
46
46
|
}
|
|
47
47
|
// Forbid node_modules/ because it's brittle: if node_modules/ lives outside of userRootDir then it crashes.
|
|
48
|
-
(0, utils_js_1.assertUsage)(!filePathAbsoluteUserRootDir.includes('/node_modules/'), `The import path ${importPath} defined by ${importerFilePath.filePathToShowToUser} resolves to ${filePathAbsoluteFilesystem} inside of node_modules/ which is
|
|
48
|
+
(0, utils_js_1.assertUsage)(!filePathAbsoluteUserRootDir.includes('/node_modules/'), `The import path ${importPath} defined by ${importerFilePath.filePathToShowToUser} resolves to ${filePathAbsoluteFilesystem} inside of node_modules/ which is forbidden: use an npm package import instead.`);
|
|
49
49
|
filePath = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir });
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -55,13 +55,13 @@ function resolvePointerImportData(pointerImportData, importerFilePath, userRootD
|
|
|
55
55
|
filePath = (0, getFilePath_js_1.getFilePathResolved)({
|
|
56
56
|
userRootDir,
|
|
57
57
|
filePathAbsoluteFilesystem,
|
|
58
|
-
importPathAbsolute
|
|
58
|
+
importPathAbsolute,
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
// We cannot resolve path aliases defined only in Vite
|
|
63
63
|
filePath = (0, getFilePath_js_1.getFilePathUnresolved)({
|
|
64
|
-
importPathAbsolute
|
|
64
|
+
importPathAbsolute,
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -74,7 +74,7 @@ function resolveImportPathWithNode(pointerImportData, importerFilePath, userRoot
|
|
|
74
74
|
const filePathAbsoluteFilesystem = (0, utils_js_1.requireResolveOptional)({
|
|
75
75
|
importPath: pointerImportData.importPath,
|
|
76
76
|
importerFilePath: importerFilePathAbsolute,
|
|
77
|
-
userRootDir
|
|
77
|
+
userRootDir,
|
|
78
78
|
});
|
|
79
79
|
if (!filePathAbsoluteFilesystem) {
|
|
80
80
|
(0, utils_js_1.assert)(!(0, utils_js_1.isImportPathRelative)(pointerImportData.importPath));
|
|
@@ -8,8 +8,8 @@ exports.getConfigBuildErrorFormatted = getConfigBuildErrorFormatted;
|
|
|
8
8
|
exports.getConfigExecutionErrorIntroMsg = getConfigExecutionErrorIntroMsg;
|
|
9
9
|
exports.isTemporaryBuildFile = isTemporaryBuildFile;
|
|
10
10
|
const esbuild_1 = require("esbuild");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
13
13
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
14
14
|
const import_1 = require("@brillout/import");
|
|
15
15
|
const utils_js_1 = require("../../utils.js");
|
|
@@ -77,14 +77,14 @@ async function transpileFile(filePath, transformImports, userRootDir, esbuildCac
|
|
|
77
77
|
}
|
|
78
78
|
async function transpileWithEsbuild(filePath, userRootDir, transformImports, esbuildCache) {
|
|
79
79
|
const entryFilePath = filePath.filePathAbsoluteFilesystem;
|
|
80
|
-
const entryFileDir =
|
|
80
|
+
const entryFileDir = node_path_1.default.posix.dirname(entryFilePath);
|
|
81
81
|
const options = {
|
|
82
82
|
platform: 'node',
|
|
83
83
|
entryPoints: [entryFilePath],
|
|
84
84
|
sourcemap: 'inline',
|
|
85
85
|
write: false,
|
|
86
86
|
target: ['node14.18', 'node16'],
|
|
87
|
-
outfile:
|
|
87
|
+
outfile: node_path_1.default.posix.join(
|
|
88
88
|
// Needed for correct inline source map
|
|
89
89
|
entryFileDir,
|
|
90
90
|
// `write: false` => no file is actually emitted
|
|
@@ -97,7 +97,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
|
|
|
97
97
|
treeShaking: false,
|
|
98
98
|
minify: false,
|
|
99
99
|
metafile: true,
|
|
100
|
-
bundle: true
|
|
100
|
+
bundle: true,
|
|
101
101
|
};
|
|
102
102
|
const pointerImports = {};
|
|
103
103
|
options.plugins = [
|
|
@@ -123,13 +123,13 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
|
|
|
123
123
|
if (debugEsbuildResolve.isActivated)
|
|
124
124
|
debugEsbuildResolve('resolved', resolved);
|
|
125
125
|
// Temporary workaround for https://github.com/evanw/esbuild/issues/3973
|
|
126
|
-
// -
|
|
126
|
+
// - Still required for esbuild@0.24.0 (November 2024).
|
|
127
127
|
// - Let's try to remove this workaround again later.
|
|
128
128
|
if (resolved.errors.length > 0) {
|
|
129
129
|
const resolvedWithNode = (0, utils_js_1.requireResolveOptionalDir)({
|
|
130
130
|
importPath: path,
|
|
131
131
|
importerDir: (0, utils_js_1.toPosixPath)(args.resolveDir),
|
|
132
|
-
userRootDir
|
|
132
|
+
userRootDir,
|
|
133
133
|
});
|
|
134
134
|
if (debugEsbuildResolve.isActivated)
|
|
135
135
|
debugEsbuildResolve('resolvedWithNode', resolvedWithNode);
|
|
@@ -204,7 +204,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
|
|
|
204
204
|
// - Path alias
|
|
205
205
|
const filePathAbsoluteUserRootDir = (0, getFilePath_js_1.getFilePathAbsoluteUserRootDir)({
|
|
206
206
|
filePathAbsoluteFilesystem: importPathResolved,
|
|
207
|
-
userRootDir
|
|
207
|
+
userRootDir,
|
|
208
208
|
});
|
|
209
209
|
if (filePathAbsoluteUserRootDir && !isNpmPkgImport) {
|
|
210
210
|
// `importPathOriginal` is most likely a path alias.
|
|
@@ -232,14 +232,14 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
|
|
|
232
232
|
pointerImports[importPathTranspiled] = isPointerImport;
|
|
233
233
|
return { external: true, path: importPathTranspiled };
|
|
234
234
|
});
|
|
235
|
-
}
|
|
235
|
+
},
|
|
236
236
|
},
|
|
237
237
|
// Track dependencies
|
|
238
238
|
{
|
|
239
239
|
name: 'vike:dependency-tracker',
|
|
240
240
|
setup(b) {
|
|
241
241
|
b.onLoad({ filter: /./ }, (args) => {
|
|
242
|
-
// We collect the dependency `args.path` in case the
|
|
242
|
+
// We collect the dependency `args.path` in case the build fails (upon build error => error is thrown => no metafile)
|
|
243
243
|
let { path } = args;
|
|
244
244
|
path = (0, utils_js_1.toPosixPath)(path);
|
|
245
245
|
esbuildCache.vikeConfigDependencies.add(path);
|
|
@@ -254,8 +254,8 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
|
|
|
254
254
|
* - But implementing a fix is complex and isn't worth it.
|
|
255
255
|
b.onResolve(...)
|
|
256
256
|
*/
|
|
257
|
-
}
|
|
258
|
-
}
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
259
|
];
|
|
260
260
|
let result;
|
|
261
261
|
try {
|
|
@@ -270,7 +270,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
|
|
|
270
270
|
Object.keys(result.metafile.inputs).forEach((filePathRelative) => {
|
|
271
271
|
filePathRelative = (0, utils_js_1.toPosixPath)(filePathRelative);
|
|
272
272
|
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
273
|
-
const filePathAbsoluteFilesystem =
|
|
273
|
+
const filePathAbsoluteFilesystem = node_path_1.default.posix.join(userRootDir, filePathRelative);
|
|
274
274
|
esbuildCache.vikeConfigDependencies.add(filePathAbsoluteFilesystem);
|
|
275
275
|
});
|
|
276
276
|
const code = result.outputFiles[0].text;
|
|
@@ -282,8 +282,8 @@ async function executeTranspiledFile(filePath, code) {
|
|
|
282
282
|
// Alternative to using a temporary file: https://github.com/vitejs/vite/pull/13269
|
|
283
283
|
// - But seems to break source maps, so I don't think it's worth it
|
|
284
284
|
const filePathTmp = getTemporaryBuildFilePath(filePathAbsoluteFilesystem);
|
|
285
|
-
|
|
286
|
-
const clean = () =>
|
|
285
|
+
node_fs_1.default.writeFileSync(filePathTmp, code);
|
|
286
|
+
const clean = () => node_fs_1.default.unlinkSync(filePathTmp);
|
|
287
287
|
let fileExports = {};
|
|
288
288
|
try {
|
|
289
289
|
fileExports = await executeFile(filePathTmp, filePath);
|
|
@@ -324,7 +324,7 @@ async function formatBuildErr(err, filePath) {
|
|
|
324
324
|
(0, utils_js_1.assert)((0, utils_js_1.isObject)(err) && err.errors);
|
|
325
325
|
const msgEsbuild = (await (0, esbuild_1.formatMessages)(err.errors, {
|
|
326
326
|
kind: 'error',
|
|
327
|
-
color: true
|
|
327
|
+
color: true,
|
|
328
328
|
}))
|
|
329
329
|
.map((m) => m.trim())
|
|
330
330
|
.join('\n');
|
|
@@ -340,16 +340,16 @@ function getConfigExecutionErrorIntroMsg(err) {
|
|
|
340
340
|
}
|
|
341
341
|
function getTemporaryBuildFilePath(filePathAbsoluteFilesystem) {
|
|
342
342
|
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
343
|
-
const dirname =
|
|
344
|
-
const filename =
|
|
343
|
+
const dirname = node_path_1.default.posix.dirname(filePathAbsoluteFilesystem);
|
|
344
|
+
const filename = node_path_1.default.posix.basename(filePathAbsoluteFilesystem);
|
|
345
345
|
// Syntax with semicolon `build:${/*...*/}` doesn't work on Windows: https://github.com/vikejs/vike/issues/800#issuecomment-1517329455
|
|
346
|
-
const filePathTmp =
|
|
346
|
+
const filePathTmp = node_path_1.default.posix.join(dirname, `${filename}.build-${(0, utils_js_1.getRandomId)()}.mjs`);
|
|
347
347
|
(0, utils_js_1.assert)(isTemporaryBuildFile(filePathTmp));
|
|
348
348
|
return filePathTmp;
|
|
349
349
|
}
|
|
350
350
|
function isTemporaryBuildFile(filePath) {
|
|
351
351
|
(0, utils_js_1.assertPosixPath)(filePath);
|
|
352
|
-
const fileName =
|
|
352
|
+
const fileName = node_path_1.default.posix.basename(filePath);
|
|
353
353
|
return /\.build-[a-z0-9]{12}\.mjs$/.test(fileName);
|
|
354
354
|
}
|
|
355
355
|
// TODO/next-major: remove
|
|
@@ -359,21 +359,21 @@ function isHeaderFile(filePath) {
|
|
|
359
359
|
return fileExtensions.includes('h');
|
|
360
360
|
}
|
|
361
361
|
function getFileExtensions(filePath) {
|
|
362
|
-
const fileExtensions =
|
|
362
|
+
const fileExtensions = node_path_1.default.posix.basename(filePath).split('.').slice(1);
|
|
363
363
|
return fileExtensions;
|
|
364
364
|
}
|
|
365
365
|
function getFileExtension(filePath) {
|
|
366
|
-
const fileExtensions =
|
|
366
|
+
const fileExtensions = node_path_1.default.posix.basename(filePath).split('.').slice(1);
|
|
367
367
|
return fileExtensions.pop();
|
|
368
368
|
}
|
|
369
369
|
function removeHeaderFileExtension(filePath) {
|
|
370
370
|
(0, utils_js_1.assertPosixPath)(filePath);
|
|
371
|
-
const fileName =
|
|
371
|
+
const fileName = node_path_1.default.posix.basename(filePath);
|
|
372
372
|
const fileNameParts = fileName.split('.');
|
|
373
373
|
const fileNamePartsMod = fileNameParts.filter((p) => p !== 'h');
|
|
374
374
|
(0, utils_js_1.assert)(fileNamePartsMod.length < fileNameParts.length);
|
|
375
375
|
const fileNameMod = fileNamePartsMod.join('.');
|
|
376
|
-
return
|
|
376
|
+
return node_path_1.default.posix.join(node_path_1.default.posix.dirname(filePath), fileNameMod);
|
|
377
377
|
}
|
|
378
378
|
// Needed for the npm package 'source-map-support'. The Error.prepareStackTrace() hook of 'source-map-support' needs to be called before the file containing the source map is removed. The clean() call above removes the transpiled file from disk but it contains the inline source map.
|
|
379
379
|
function triggerPrepareStackTrace(err) {
|
|
@@ -391,7 +391,7 @@ function getErrIntroMsg(operation, filePath) {
|
|
|
391
391
|
// prettier ignore
|
|
392
392
|
picocolors_1.default.red(`Failed to ${operation}`),
|
|
393
393
|
picocolors_1.default.bold(picocolors_1.default.red(filePathToShowToUserResolved)),
|
|
394
|
-
picocolors_1.default.red(`because:`)
|
|
394
|
+
picocolors_1.default.red(`because:`),
|
|
395
395
|
].join(' ');
|
|
396
396
|
return msg;
|
|
397
397
|
}
|