vike 0.4.239-commit-33e55d4 → 0.4.239-commit-4d0d950
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/runtime-client-routing/entry.js +5 -0
- package/dist/esm/client/runtime-client-routing/globalContext.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/globalContext.js +9 -3
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +2 -2
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +15 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/entry.js +5 -0
- package/dist/esm/client/runtime-server-routing/globalContext.d.ts +2 -2
- package/dist/esm/client/runtime-server-routing/globalContext.js +7 -3
- package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +4 -3
- package/dist/esm/client/shared/createGetGlobalContextClient.js +38 -34
- package/dist/esm/node/vite/index.js +34 -15
- package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBaseUrls.js +37 -35
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.d.ts +4 -0
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +21 -6
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.js +16 -4
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +82 -80
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +23 -21
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +38 -36
- package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +26 -24
- package/dist/esm/node/vite/plugins/pluginCommon.js +1 -1
- package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
- package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +87 -65
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +29 -27
- package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +75 -73
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +30 -28
- package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginPreview.js +35 -33
- package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.d.ts +9 -0
- package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.js +45 -0
- package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.js +89 -0
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +50 -48
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +12 -10
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
- package/dist/esm/shared/createGlobalContextShared.js +1 -0
- package/dist/esm/shared/route/abort.d.ts +22 -11
- package/dist/esm/shared/route/abort.js +37 -5
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/findPackageJson.js +0 -1
- package/dist/esm/utils/getViteRPC.js +0 -2
- package/dist/esm/utils/requireResolve.js +0 -1
- package/package.json +3 -22
- package/dist/cjs/__internal/index.js +0 -35
- package/dist/cjs/client/runtime-client-routing/globalContext.js +0 -49
- package/dist/cjs/client/runtime-client-routing/prefetch/PrefetchSetting.js +0 -2
- package/dist/cjs/client/runtime-server-routing/globalContext.js +0 -41
- package/dist/cjs/client/runtime-server-routing/onLoad.js +0 -7
- package/dist/cjs/client/runtime-server-routing/utils.js +0 -34
- package/dist/cjs/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/cjs/client/shared/getJsonSerializedInHtml.js +0 -40
- package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +0 -41
- package/dist/cjs/client/shared/utils.js +0 -23
- package/dist/cjs/node/api/build.js +0 -24
- package/dist/cjs/node/api/context.js +0 -23
- package/dist/cjs/node/api/dev.js +0 -18
- package/dist/cjs/node/api/index.js +0 -44
- package/dist/cjs/node/api/onLoad.js +0 -9
- package/dist/cjs/node/api/prepareViteApiCall.js +0 -206
- package/dist/cjs/node/api/prerender.js +0 -18
- package/dist/cjs/node/api/preview.js +0 -38
- package/dist/cjs/node/api/types.js +0 -2
- package/dist/cjs/node/api/utils.js +0 -27
- package/dist/cjs/node/cli/context.js +0 -17
- package/dist/cjs/node/cli/entry.js +0 -121
- package/dist/cjs/node/cli/index.js +0 -12
- package/dist/cjs/node/cli/onLoad.js +0 -9
- package/dist/cjs/node/cli/parseCli.js +0 -95
- package/dist/cjs/node/cli/utils.js +0 -24
- package/dist/cjs/node/client/router.js +0 -19
- package/dist/cjs/node/createPageRenderer.js +0 -132
- package/dist/cjs/node/importBuild.js +0 -3
- package/dist/cjs/node/prerender/context.js +0 -26
- package/dist/cjs/node/prerender/index.js +0 -12
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +0 -66
- package/dist/cjs/node/prerender/runPrerender.js +0 -778
- package/dist/cjs/node/prerender/runPrerenderEntry.js +0 -55
- package/dist/cjs/node/prerender/utils.js +0 -37
- package/dist/cjs/node/runtime/globalContext.js +0 -582
- package/dist/cjs/node/runtime/index-deprecated.js +0 -33
- package/dist/cjs/node/runtime/index.js +0 -74
- package/dist/cjs/node/runtime/loggerRuntime.js +0 -17
- package/dist/cjs/node/runtime/onLoad.js +0 -29
- package/dist/cjs/node/runtime/page-files/setup.js +0 -5
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +0 -71
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +0 -42
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +0 -51
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -114
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +0 -59
- package/dist/cjs/node/runtime/renderPage/csp.js +0 -47
- package/dist/cjs/node/runtime/renderPage/execHookDataAndOnBeforeRender.js +0 -31
- package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +0 -120
- package/dist/cjs/node/runtime/renderPage/execHookServer.js +0 -8
- package/dist/cjs/node/runtime/renderPage/getCacheControl.js +0 -24
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +0 -20
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +0 -137
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +0 -125
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsDev.js +0 -86
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsProd.js +0 -77
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +0 -36
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +0 -50
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +0 -41
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +0 -68
- package/dist/cjs/node/runtime/renderPage/headersResponse.js +0 -48
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getHtmlTags.js +0 -269
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getViteDevScript.js +0 -32
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/inferHtmlTags.js +0 -55
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectAssets__public.js +0 -31
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectHtmlTags.js +0 -161
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/mergeScriptTags.js +0 -73
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/sanitizeJson.js +0 -8
- package/dist/cjs/node/runtime/renderPage/html/injectAssets.js +0 -93
- package/dist/cjs/node/runtime/renderPage/html/propKeys.js +0 -47
- package/dist/cjs/node/runtime/renderPage/html/renderHtml.js +0 -245
- package/dist/cjs/node/runtime/renderPage/html/serializeContext.js +0 -189
- package/dist/cjs/node/runtime/renderPage/html/stream/react-streaming.js +0 -36
- package/dist/cjs/node/runtime/renderPage/html/stream.js +0 -829
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +0 -81
- package/dist/cjs/node/runtime/renderPage/isFontFallback.js +0 -29
- package/dist/cjs/node/runtime/renderPage/isNewError.js +0 -25
- package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +0 -124
- package/dist/cjs/node/runtime/renderPage/log404/index.js +0 -154
- package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +0 -20
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +0 -200
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +0 -34
- package/dist/cjs/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +0 -10
- package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +0 -83
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +0 -71
- package/dist/cjs/node/runtime/renderPage.js +0 -502
- package/dist/cjs/node/runtime/universal-middleware.js +0 -20
- package/dist/cjs/node/runtime/utils.js +0 -83
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -27
- package/dist/cjs/node/runtime-dev/index.js +0 -42
- package/dist/cjs/node/shared/assertV1Design.js +0 -30
- package/dist/cjs/node/shared/extractAssetsQuery.js +0 -29
- package/dist/cjs/node/shared/getVikeConfigError.js +0 -22
- package/dist/cjs/node/shared/isErrorDebug.js +0 -7
- package/dist/cjs/node/shared/prependEntriesDir.js +0 -13
- package/dist/cjs/node/shared/resolveBase.js +0 -35
- package/dist/cjs/node/shared/utils.js +0 -35
- package/dist/cjs/node/shared/virtualFileId.js +0 -110
- package/dist/cjs/node/vite/index.js +0 -69
- package/dist/cjs/node/vite/onLoad.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +0 -52
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -342
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -183
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -222
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -256
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -40
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -49
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -111
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -65
- package/dist/cjs/node/vite/plugins/pluginBuild.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +0 -88
- package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -183
- package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -28
- package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +0 -163
- package/dist/cjs/node/vite/plugins/pluginDev.js +0 -111
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -92
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -241
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -113
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -172
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -70
- package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -82
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -95
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -51
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/debug.js +0 -5
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +0 -56
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +0 -190
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +0 -54
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +0 -97
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +0 -233
- package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -17
- package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +0 -35
- package/dist/cjs/node/vite/shared/addSsrMiddleware.js +0 -60
- package/dist/cjs/node/vite/shared/findPageFiles.js +0 -25
- package/dist/cjs/node/vite/shared/getAssetsDir.js +0 -10
- package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +0 -42
- package/dist/cjs/node/vite/shared/getEnvVarObject.js +0 -37
- package/dist/cjs/node/vite/shared/getFilePath.js +0 -172
- package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +0 -125
- package/dist/cjs/node/vite/shared/getMagicString.js +0 -18
- package/dist/cjs/node/vite/shared/getManifestFilePathRelative.js +0 -10
- package/dist/cjs/node/vite/shared/getOutDirs.js +0 -146
- package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +0 -21
- package/dist/cjs/node/vite/shared/isAsset.js +0 -40
- package/dist/cjs/node/vite/shared/isViteCliCall.js +0 -83
- package/dist/cjs/node/vite/shared/isViteServerSide.js +0 -68
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +0 -38
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +0 -26
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +0 -85
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +0 -30
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +0 -29
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +0 -13
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +0 -162
- package/dist/cjs/node/vite/shared/loggerNotProd/log.js +0 -102
- package/dist/cjs/node/vite/shared/loggerNotProd.js +0 -208
- package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +0 -26
- package/dist/cjs/node/vite/shared/loggerVite.js +0 -54
- package/dist/cjs/node/vite/shared/normalizeId.js +0 -9
- package/dist/cjs/node/vite/shared/parseEsModule.js +0 -33
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +0 -136
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +0 -262
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +0 -18
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +0 -252
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +0 -190
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getConfigFileExport.js +0 -17
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +0 -127
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +0 -129
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +0 -195
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +0 -102
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +0 -425
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +0 -1151
- package/dist/cjs/node/vite/shared/rollupIsEsm.js +0 -15
- package/dist/cjs/node/vite/utils.js +0 -45
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/shared/NOT_SERIALIZABLE.js +0 -4
- package/dist/cjs/shared/RenderErrorPage.js +0 -6
- package/dist/cjs/shared/abort.js +0 -16
- package/dist/cjs/shared/addIs404ToPageProps.js +0 -18
- package/dist/cjs/shared/assertHookReturnedObject.js +0 -21
- package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +0 -21
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +0 -20
- package/dist/cjs/shared/createGlobalContextShared.js +0 -109
- package/dist/cjs/shared/createPageContextShared.js +0 -17
- package/dist/cjs/shared/determinePageIdOld.js +0 -11
- package/dist/cjs/shared/error-page.js +0 -40
- package/dist/cjs/shared/getPageContext.js +0 -6
- package/dist/cjs/shared/getPageContextRequestUrl.js +0 -16
- package/dist/cjs/shared/getPageContextUrlComputed.js +0 -132
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +0 -19
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +0 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +0 -50
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +0 -30
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +0 -15
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +0 -59
- package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +0 -22
- package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +0 -24
- package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -52
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -102
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -56
- package/dist/cjs/shared/getPageFiles/parseVirtualFileExportsGlobalEntry.js +0 -100
- package/dist/cjs/shared/getPageFiles.js +0 -7
- package/dist/cjs/shared/getProxyForPublicUsage.js +0 -56
- package/dist/cjs/shared/hooks/execHook.js +0 -147
- package/dist/cjs/shared/hooks/getHook.js +0 -173
- package/dist/cjs/shared/htmlElementIds.js +0 -5
- package/dist/cjs/shared/misc/isServerSideError.js +0 -4
- package/dist/cjs/shared/misc/pageContextInitIsPassedToClient.js +0 -4
- package/dist/cjs/shared/modifyUrl.js +0 -28
- package/dist/cjs/shared/modifyUrlSameOrigin.js +0 -47
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +0 -42
- package/dist/cjs/shared/page-configs/findPageConfig.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +0 -65
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -68
- package/dist/cjs/shared/page-configs/getConfigValueRuntime.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigValueTyped.js +0 -32
- package/dist/cjs/shared/page-configs/getExportPath.js +0 -29
- package/dist/cjs/shared/page-configs/helpers.js +0 -27
- package/dist/cjs/shared/page-configs/loadAndParseVirtualFilePageEntry.js +0 -25
- package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +0 -287
- package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +0 -2
- package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -1
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigsSerialized.js +0 -145
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +0 -290
- package/dist/cjs/shared/prepareGlobalContextForPublicUsage.js +0 -10
- package/dist/cjs/shared/preparePageContextForPublicUsage.js +0 -80
- package/dist/cjs/shared/route/abort.js +0 -178
- package/dist/cjs/shared/route/debug.js +0 -23
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +0 -52
- package/dist/cjs/shared/route/execHookGuard.js +0 -37
- package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -84
- package/dist/cjs/shared/route/index.js +0 -107
- package/dist/cjs/shared/route/loadPageRoutes.js +0 -197
- package/dist/cjs/shared/route/noRouteMatch.js +0 -4
- package/dist/cjs/shared/route/resolvePrecedence.js +0 -93
- package/dist/cjs/shared/route/resolveRoute.js +0 -20
- package/dist/cjs/shared/route/resolveRouteFunction.js +0 -73
- package/dist/cjs/shared/route/resolveRouteString.js +0 -153
- package/dist/cjs/shared/route/resolveUrlPathname.js +0 -47
- package/dist/cjs/shared/route/routing.js +0 -9
- package/dist/cjs/shared/route/utils.js +0 -40
- package/dist/cjs/shared/utils.js +0 -49
- package/dist/cjs/types/Config/ConfigResolved.js +0 -2
- package/dist/cjs/types/Config.js +0 -2
- package/dist/cjs/types/FilePath.js +0 -2
- package/dist/cjs/types/PageConfig.js +0 -2
- package/dist/cjs/types/PageContext.js +0 -2
- package/dist/cjs/types/VikeGlobalInternal.js +0 -2
- package/dist/cjs/types/VikeNamespace.js +0 -2
- package/dist/cjs/types/ViteManifest.js +0 -2
- package/dist/cjs/types/defineConfig.js +0 -6
- package/dist/cjs/types/index-dreprecated.js +0 -3
- package/dist/cjs/types/index.js +0 -5
- package/dist/cjs/utils/PROJECT_VERSION.js +0 -5
- package/dist/cjs/utils/PromiseType.js +0 -2
- package/dist/cjs/utils/assert.js +0 -211
- package/dist/cjs/utils/assertIsBrowser.js +0 -8
- package/dist/cjs/utils/assertIsNotBrowser.js +0 -9
- package/dist/cjs/utils/assertKeys.js +0 -27
- package/dist/cjs/utils/assertNodeVersion.js +0 -14
- package/dist/cjs/utils/assertRoutingType.js +0 -29
- package/dist/cjs/utils/assertSetup.js +0 -171
- package/dist/cjs/utils/assertSingleInstance.js +0 -110
- package/dist/cjs/utils/assertVersion.js +0 -60
- package/dist/cjs/utils/capitalizeFirstLetter.js +0 -9
- package/dist/cjs/utils/cast.js +0 -6
- package/dist/cjs/utils/catchInfiniteLoop.js +0 -34
- package/dist/cjs/utils/changeEnumerable.js +0 -8
- package/dist/cjs/utils/checkType.js +0 -6
- package/dist/cjs/utils/compareString.js +0 -10
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +0 -39
- package/dist/cjs/utils/debug.js +0 -178
- package/dist/cjs/utils/debugGlob.js +0 -6
- package/dist/cjs/utils/deepEqual.js +0 -10
- package/dist/cjs/utils/escapeHtml.js +0 -13
- package/dist/cjs/utils/escapeRegex.js +0 -7
- package/dist/cjs/utils/findFile.js +0 -30
- package/dist/cjs/utils/findPackageJson.js +0 -18
- package/dist/cjs/utils/formatHintLog.js +0 -17
- package/dist/cjs/utils/freezePartial.js +0 -35
- package/dist/cjs/utils/genPromise.js +0 -51
- package/dist/cjs/utils/getFileExtension.js +0 -16
- package/dist/cjs/utils/getGlobalObject.js +0 -15
- package/dist/cjs/utils/getMostSimilar.js +0 -68
- package/dist/cjs/utils/getPropAccessNotation.js +0 -9
- package/dist/cjs/utils/getRandomId.js +0 -14
- package/dist/cjs/utils/getTerminalWidth.js +0 -7
- package/dist/cjs/utils/getValuePrintable.js +0 -10
- package/dist/cjs/utils/getViteRPC.js +0 -79
- package/dist/cjs/utils/hasProp.js +0 -50
- package/dist/cjs/utils/humanizeTime.js +0 -24
- package/dist/cjs/utils/includes.js +0 -13
- package/dist/cjs/utils/injectRollupInputs.js +0 -29
- package/dist/cjs/utils/isArray.js +0 -7
- package/dist/cjs/utils/isArrayOfStrings.js +0 -7
- package/dist/cjs/utils/isBrowser.js +0 -8
- package/dist/cjs/utils/isCallable.js +0 -6
- package/dist/cjs/utils/isDev.js +0 -20
- package/dist/cjs/utils/isDocker.js +0 -45
- package/dist/cjs/utils/isEqualStringList.js +0 -13
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +0 -66
- package/dist/cjs/utils/isHtml.js +0 -9
- package/dist/cjs/utils/isImportPath.js +0 -21
- package/dist/cjs/utils/isNodeJS.js +0 -16
- package/dist/cjs/utils/isNonRunnableDev.js +0 -12
- package/dist/cjs/utils/isNullish.js +0 -16
- package/dist/cjs/utils/isObject.js +0 -6
- package/dist/cjs/utils/isObjectOfStrings.js +0 -7
- package/dist/cjs/utils/isObjectWithKeys.js +0 -15
- package/dist/cjs/utils/isPlainObject.js +0 -19
- package/dist/cjs/utils/isPromise.js +0 -7
- package/dist/cjs/utils/isPropertyGetter.js +0 -7
- package/dist/cjs/utils/isReact.js +0 -23
- package/dist/cjs/utils/isRunnableDevEnvironment.js +0 -9
- package/dist/cjs/utils/isSameErrorMessage.js +0 -9
- package/dist/cjs/utils/isScriptFile.js +0 -67
- package/dist/cjs/utils/isVikeReactApp.js +0 -8
- package/dist/cjs/utils/isVitest.js +0 -6
- package/dist/cjs/utils/joinEnglish.js +0 -14
- package/dist/cjs/utils/normalizeHeaders.js +0 -17
- package/dist/cjs/utils/objectAssign.js +0 -14
- package/dist/cjs/utils/objectAssignSafe.js +0 -7
- package/dist/cjs/utils/objectDefineProperty.js +0 -7
- package/dist/cjs/utils/objectEntries.js +0 -8
- package/dist/cjs/utils/objectEntriesForEach.js +0 -7
- package/dist/cjs/utils/objectFilter.js +0 -10
- package/dist/cjs/utils/objectFromEntries.js +0 -7
- package/dist/cjs/utils/objectKeys.js +0 -9
- package/dist/cjs/utils/objectReplace.js +0 -9
- package/dist/cjs/utils/onPageVisibilityChange.js +0 -18
- package/dist/cjs/utils/pLimit.js +0 -134
- package/dist/cjs/utils/parseNpmPackage.js +0 -106
- package/dist/cjs/utils/parseUrl-extras.js +0 -110
- package/dist/cjs/utils/parseUrl.js +0 -338
- package/dist/cjs/utils/path.js +0 -59
- package/dist/cjs/utils/pick.js +0 -12
- package/dist/cjs/utils/preservePropertyGetters.js +0 -30
- package/dist/cjs/utils/redirectHard.js +0 -6
- package/dist/cjs/utils/removeEmptyLines.js +0 -9
- package/dist/cjs/utils/removeFileExtension.js +0 -6
- package/dist/cjs/utils/requireResolve.js +0 -214
- package/dist/cjs/utils/rollupSourceMap.js +0 -19
- package/dist/cjs/utils/sleep.js +0 -6
- package/dist/cjs/utils/slice.js +0 -35
- package/dist/cjs/utils/sorter.js +0 -117
- package/dist/cjs/utils/stringifyStringArray.js +0 -6
- package/dist/cjs/utils/stripAnsi.js +0 -21
- package/dist/cjs/utils/styleFileRE.js +0 -6
- package/dist/cjs/utils/throttle.js +0 -15
- package/dist/cjs/utils/trackLogs.js +0 -31
- package/dist/cjs/utils/trimWithAnsi.js +0 -40
- package/dist/cjs/utils/truncateString.js +0 -23
- package/dist/cjs/utils/unique.js +0 -6
- package/dist/cjs/utils/updateType.js +0 -9
- package/dist/cjs/utils/urlToFile.js +0 -36
- package/dist/cjs/utils/virtualFileId.js +0 -43
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
- package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginBuild.js +0 -19
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -14
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -92
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.addSsrMiddleware = addSsrMiddleware;
|
|
7
|
-
const renderPage_js_1 = require("../../runtime/renderPage.js");
|
|
8
|
-
const utils_js_1 = require("../utils.js");
|
|
9
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
10
|
-
function addSsrMiddleware(middlewares, config, isPreview, isPrerenderingEnabled) {
|
|
11
|
-
middlewares.use(async (req, res, next) => {
|
|
12
|
-
if (res.headersSent)
|
|
13
|
-
return next();
|
|
14
|
-
const url = req.originalUrl || req.url;
|
|
15
|
-
if (!url)
|
|
16
|
-
return next();
|
|
17
|
-
const { headers } = req;
|
|
18
|
-
const pageContextInit = {
|
|
19
|
-
urlOriginal: url,
|
|
20
|
-
headersOriginal: headers,
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(pageContextInit, 'userAgent', {
|
|
23
|
-
get() {
|
|
24
|
-
// TO-DO/next-major-release: assertUsage() instead of assertWarning()
|
|
25
|
-
(0, utils_js_1.assertWarning)(false, `${picocolors_1.default.cyan('pageContext.userAgent')} is deprecated: use ${picocolors_1.default.cyan("pageContext.headers['user-agent']")} instead.`, {
|
|
26
|
-
showStackTrace: true,
|
|
27
|
-
onlyOnce: true,
|
|
28
|
-
});
|
|
29
|
-
return headers['user-agent'];
|
|
30
|
-
},
|
|
31
|
-
enumerable: false,
|
|
32
|
-
});
|
|
33
|
-
let pageContext;
|
|
34
|
-
try {
|
|
35
|
-
pageContext = await (0, renderPage_js_1.renderPage)(pageContextInit);
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
// Throwing an error in a connect middleware shut downs the server
|
|
39
|
-
console.error(err);
|
|
40
|
-
// - next(err) automatically uses buildErrorMessage() (pretty formatting of Rollup errors)
|
|
41
|
-
// - But it only works for users using Vite's standalone dev server (it doesn't work for users using Vite's dev middleware)
|
|
42
|
-
// - We purposely don't use next(err) to align behavior: we use our own/copied implementation of buildErrorMessage() regardless of whether the user uses Vite's dev middleware or Vite's standalone dev server
|
|
43
|
-
return next();
|
|
44
|
-
}
|
|
45
|
-
if (pageContext.httpResponse.statusCode === 404 && isPreview && isPrerenderingEnabled) {
|
|
46
|
-
// Serve /dist/client/404.html instead
|
|
47
|
-
return next();
|
|
48
|
-
}
|
|
49
|
-
const configHeaders = (isPreview && config?.preview?.headers) || config?.server?.headers;
|
|
50
|
-
if (configHeaders) {
|
|
51
|
-
for (const [name, value] of Object.entries(configHeaders))
|
|
52
|
-
if (value)
|
|
53
|
-
res.setHeader(name, value);
|
|
54
|
-
}
|
|
55
|
-
const { httpResponse } = pageContext;
|
|
56
|
-
httpResponse.headers.forEach(([name, value]) => res.setHeader(name, value));
|
|
57
|
-
res.statusCode = httpResponse.statusCode;
|
|
58
|
-
httpResponse.pipe(res);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.findPageFiles = findPageFiles;
|
|
7
|
-
const tinyglobby_1 = require("tinyglobby");
|
|
8
|
-
const utils_js_1 = require("../utils.js");
|
|
9
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
10
|
-
const getOutDirs_js_1 = require("./getOutDirs.js");
|
|
11
|
-
async function findPageFiles(config, fileTypes, isDev) {
|
|
12
|
-
const cwd = config.root;
|
|
13
|
-
const { outDirRoot } = (0, getOutDirs_js_1.getOutDirs)(config, undefined);
|
|
14
|
-
const timeBase = new Date().getTime();
|
|
15
|
-
let pageFiles = await (0, tinyglobby_1.glob)(fileTypes.map((fileType) => `**/*${fileType}.${utils_js_1.scriptFileExtensionPattern}`), { ignore: ['**/node_modules/**', `${outDirRoot}/**`], cwd, dot: false, expandDirectories: false });
|
|
16
|
-
pageFiles = pageFiles.map((p) => '/' + (0, utils_js_1.toPosixPath)(p));
|
|
17
|
-
const time = new Date().getTime() - timeBase;
|
|
18
|
-
if (isDev) {
|
|
19
|
-
// We only warn in dev, because while building it's expected to take a long time as tinyglobby is competing for resources with other tasks
|
|
20
|
-
(0, utils_js_1.assertWarning)(time < 1.5 * 1000, `Finding your page files ${picocolors_1.default.cyan('**/*.page.*')} took an unexpected long time (${time}ms). Reach out to the vike maintainer.`, {
|
|
21
|
-
onlyOnce: 'slow-page-files-search',
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return pageFiles;
|
|
25
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAssetsDir = getAssetsDir;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
function getAssetsDir(config) {
|
|
6
|
-
let { assetsDir } = config.build;
|
|
7
|
-
(0, utils_js_1.assertUsage)(assetsDir, `${assetsDir} cannot be an empty string`);
|
|
8
|
-
assetsDir = assetsDir.split(/\/|\\/).filter(Boolean).join('/');
|
|
9
|
-
return assetsDir;
|
|
10
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getClientEntrySrcDev = getClientEntrySrcDev;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
6
|
-
function getClientEntrySrcDev(clientEntry, viteDevServer) {
|
|
7
|
-
let userRootDir = viteDevServer.config.root;
|
|
8
|
-
(0, utils_js_1.assert)(userRootDir);
|
|
9
|
-
userRootDir = (0, utils_js_1.toPosixPath)(userRootDir);
|
|
10
|
-
// The `?import` suffix is needed for MDX to be transpiled:
|
|
11
|
-
// - Not transpiled: `/pages/markdown.page.mdx`
|
|
12
|
-
// - Transpiled: `/pages/markdown.page.mdx?import`
|
|
13
|
-
// But `?import` doesn't work with `/@fs/`:
|
|
14
|
-
// - Not transpiled: /@fs/home/runner/work/vike/packages/vike/examples/react-full/pages/markdown.page.mdx
|
|
15
|
-
// - Not transpiled: /@fs/home/runner/work/vike/packages/vike/examples/react-full/pages/markdown.page.mdx?import
|
|
16
|
-
if (clientEntry.endsWith('?import')) {
|
|
17
|
-
(0, utils_js_1.assert)(clientEntry.startsWith('/'));
|
|
18
|
-
return clientEntry;
|
|
19
|
-
}
|
|
20
|
-
(0, utils_js_1.assertPosixPath)(clientEntry);
|
|
21
|
-
let filePath;
|
|
22
|
-
if (clientEntry.startsWith('/')) {
|
|
23
|
-
filePath = (0, utils_js_1.pathJoin)(userRootDir, clientEntry);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
if (clientEntry.startsWith('@@vike/')) {
|
|
27
|
-
(0, utils_js_1.assert)(clientEntry.endsWith('.js'));
|
|
28
|
-
filePath = (0, utils_js_1.requireResolveDistFile)(`dist/esm/${clientEntry.replace('@@vike/dist/esm/', '')}`);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
(0, utils_js_1.assertIsImportPathNpmPackage)(clientEntry);
|
|
32
|
-
filePath = (0, utils_js_1.requireResolveNpmPackage)({ importPathNpmPackage: clientEntry, userRootDir });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (!filePath.startsWith('/')) {
|
|
36
|
-
(0, utils_js_1.assert)(process.platform === 'win32');
|
|
37
|
-
filePath = '/' + filePath;
|
|
38
|
-
}
|
|
39
|
-
filePath = '/@fs' + filePath;
|
|
40
|
-
(0, utils_js_1.assertPosixPath)(filePath);
|
|
41
|
-
return filePath;
|
|
42
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getEnvVarObject = getEnvVarObject;
|
|
7
|
-
exports.parseJson5 = parseJson5;
|
|
8
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
-
const utils_js_1 = require("../utils.js");
|
|
10
|
-
const json5_1 = __importDefault(require("json5"));
|
|
11
|
-
function getEnvVarObject(envVarName) {
|
|
12
|
-
const valueStr = process.env[envVarName];
|
|
13
|
-
if (!valueStr)
|
|
14
|
-
return null;
|
|
15
|
-
const value = parseJson5(valueStr, envVarName);
|
|
16
|
-
(0, utils_js_1.assertUsage)(value, `${envVarName} should define an object but it's ${picocolors_1.default.bold(String(value))} instead.`);
|
|
17
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(value), `${envVarName} should define an object but it's set to the following which isn't an object: ${picocolors_1.default.bold(valueStr)}`);
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
function parseJson5(valueStr, what) {
|
|
21
|
-
let value;
|
|
22
|
-
try {
|
|
23
|
-
value = json5_1.default.parse(valueStr);
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
if (isNotJavaScriptLike(valueStr)) {
|
|
27
|
-
// Interpret as string
|
|
28
|
-
return valueStr;
|
|
29
|
-
}
|
|
30
|
-
console.error(err);
|
|
31
|
-
(0, utils_js_1.assertUsage)(false, `Cannot parse ${picocolors_1.default.cyan(what)} (see error above) because it's set to the following which isn't a valid JSON5 string: ${picocolors_1.default.bold(valueStr)}`);
|
|
32
|
-
}
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
function isNotJavaScriptLike(valueStr) {
|
|
36
|
-
return ![':', ',', '{', '}', '(', ')'].some((c) => valueStr.includes(c));
|
|
37
|
-
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getFilePathResolved = getFilePathResolved;
|
|
7
|
-
exports.getFilePathUnresolved = getFilePathUnresolved;
|
|
8
|
-
exports.getFilePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir;
|
|
9
|
-
exports.getFilePathToShowToUserFromUnknown = getFilePathToShowToUserFromUnknown;
|
|
10
|
-
exports.getModuleFilePathAbsolute = getModuleFilePathAbsolute;
|
|
11
|
-
exports.getModuleFilePathRelative = getModuleFilePathRelative;
|
|
12
|
-
exports.cleanFilePathUnknown = cleanFilePathUnknown;
|
|
13
|
-
exports.assertModuleId = assertModuleId;
|
|
14
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
-
const utils_js_1 = require("../utils.js");
|
|
16
|
-
function getFilePathResolved(args) {
|
|
17
|
-
const { userRootDir } = args;
|
|
18
|
-
let filePathAbsoluteFilesystem;
|
|
19
|
-
let filePathAbsoluteUserRootDir;
|
|
20
|
-
if ('filePathAbsoluteFilesystem' in args) {
|
|
21
|
-
filePathAbsoluteFilesystem = args.filePathAbsoluteFilesystem;
|
|
22
|
-
filePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir });
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
filePathAbsoluteUserRootDir = args.filePathAbsoluteUserRootDir;
|
|
26
|
-
filePathAbsoluteFilesystem = getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir });
|
|
27
|
-
}
|
|
28
|
-
(0, utils_js_1.assert)(filePathAbsoluteFilesystem);
|
|
29
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(filePathAbsoluteFilesystem);
|
|
30
|
-
const filePathToShowToUserResolved = filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
|
|
31
|
-
(0, utils_js_1.assert)(filePathToShowToUserResolved);
|
|
32
|
-
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
33
|
-
const fileName = node_path_1.default.posix.basename(filePathAbsoluteFilesystem);
|
|
34
|
-
const filePathResolved = {
|
|
35
|
-
...getComputedProps(args),
|
|
36
|
-
filePathAbsoluteFilesystem,
|
|
37
|
-
filePathToShowToUserResolved,
|
|
38
|
-
fileName,
|
|
39
|
-
};
|
|
40
|
-
return filePathResolved;
|
|
41
|
-
}
|
|
42
|
-
function getComputedProps(args) {
|
|
43
|
-
if ('filePathAbsoluteUserRootDir' in args) {
|
|
44
|
-
const importPathAbsolute = args.importPathAbsolute ?? null;
|
|
45
|
-
const { filePathAbsoluteUserRootDir } = args;
|
|
46
|
-
if (importPathAbsolute)
|
|
47
|
-
(0, utils_js_1.assertIsImportPathNpmPackage)(importPathAbsolute);
|
|
48
|
-
return {
|
|
49
|
-
importPathAbsolute,
|
|
50
|
-
filePathAbsoluteUserRootDir,
|
|
51
|
-
filePathAbsoluteVite: filePathAbsoluteUserRootDir,
|
|
52
|
-
filePathToShowToUser: filePathAbsoluteUserRootDir,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
return getComputedPropsImportPathAbsolute(args);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function getComputedPropsImportPathAbsolute(args) {
|
|
60
|
-
const { importPathAbsolute } = args;
|
|
61
|
-
(0, utils_js_1.assertIsImportPathNpmPackage)(importPathAbsolute);
|
|
62
|
-
return {
|
|
63
|
-
filePathAbsoluteUserRootDir: null,
|
|
64
|
-
importPathAbsolute,
|
|
65
|
-
filePathAbsoluteVite: importPathAbsolute,
|
|
66
|
-
filePathToShowToUser: importPathAbsolute,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function getFilePathUnresolved(args) {
|
|
70
|
-
return {
|
|
71
|
-
...getComputedPropsImportPathAbsolute(args),
|
|
72
|
-
filePathAbsoluteFilesystem: null,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir, }) {
|
|
76
|
-
(0, utils_js_1.assertPosixPath)(filePathAbsoluteUserRootDir);
|
|
77
|
-
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
78
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(userRootDir);
|
|
79
|
-
const filePathAbsoluteFilesystem = node_path_1.default.posix.join(userRootDir, filePathAbsoluteUserRootDir);
|
|
80
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(userRootDir);
|
|
81
|
-
return filePathAbsoluteFilesystem;
|
|
82
|
-
}
|
|
83
|
-
function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir, }) {
|
|
84
|
-
const { filePathAbsoluteUserRootDir } = getFilePathRelative({
|
|
85
|
-
filePathAbsoluteFilesystem,
|
|
86
|
-
userRootDir,
|
|
87
|
-
});
|
|
88
|
-
return filePathAbsoluteUserRootDir;
|
|
89
|
-
}
|
|
90
|
-
function getFilePathRelative({ filePathAbsoluteFilesystem, userRootDir, }) {
|
|
91
|
-
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
92
|
-
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
93
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(filePathAbsoluteFilesystem);
|
|
94
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(userRootDir);
|
|
95
|
-
const filePathRelativeUserRootDir = node_path_1.default.posix.relative(userRootDir, filePathAbsoluteFilesystem);
|
|
96
|
-
if (!filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
97
|
-
(0, utils_js_1.assert)(filePathRelativeUserRootDir.startsWith('../'));
|
|
98
|
-
return {
|
|
99
|
-
filePathAbsoluteUserRootDir: null,
|
|
100
|
-
filePathRelativeUserRootDir,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
(0, utils_js_1.assert)(!filePathRelativeUserRootDir.startsWith('/') &&
|
|
105
|
-
/* Not true if filePathRelative starts with a hidden directory (i.e. a directory with a name that starts with `.`)
|
|
106
|
-
!filePathRelative.startsWith('.') &&
|
|
107
|
-
*/
|
|
108
|
-
!filePathRelativeUserRootDir.startsWith('./') &&
|
|
109
|
-
!filePathRelativeUserRootDir.startsWith('../'));
|
|
110
|
-
const filePathAbsoluteUserRootDir = `/${filePathRelativeUserRootDir}`;
|
|
111
|
-
(0, utils_js_1.assert)(filePathAbsoluteUserRootDir === getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir));
|
|
112
|
-
return { filePathAbsoluteUserRootDir, filePathRelativeUserRootDir };
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function getModuleFilePathAbsolute(moduleId, config) {
|
|
116
|
-
const { filePathAbsoluteUserRootDir, filePathAbsoluteFilesystem } = getModuleFilePath(moduleId, config);
|
|
117
|
-
return filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
|
|
118
|
-
}
|
|
119
|
-
function getModuleFilePathRelative(moduleId, config) {
|
|
120
|
-
const { filePathRelativeUserRootDir } = getModuleFilePath(moduleId, config);
|
|
121
|
-
return filePathRelativeUserRootDir;
|
|
122
|
-
}
|
|
123
|
-
function getModuleFilePath(moduleId, config) {
|
|
124
|
-
const userRootDir = config.root;
|
|
125
|
-
assertModuleId(moduleId);
|
|
126
|
-
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
127
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(userRootDir);
|
|
128
|
-
const filePathAbsoluteFilesystem = cleanModuleId(moduleId);
|
|
129
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(filePathAbsoluteFilesystem);
|
|
130
|
-
const { filePathAbsoluteUserRootDir, filePathRelativeUserRootDir } = getFilePathRelative({
|
|
131
|
-
filePathAbsoluteFilesystem,
|
|
132
|
-
userRootDir,
|
|
133
|
-
});
|
|
134
|
-
return { filePathAbsoluteFilesystem, filePathAbsoluteUserRootDir, filePathRelativeUserRootDir };
|
|
135
|
-
}
|
|
136
|
-
function assertModuleId(moduleId) {
|
|
137
|
-
(0, utils_js_1.assertPosixPath)(moduleId);
|
|
138
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(moduleId); // Can moduleId be something else than the filesystem absolute path?
|
|
139
|
-
}
|
|
140
|
-
function getFilePathToShowToUserFromUnknown(
|
|
141
|
-
// We don't have any guarantee about filePath, e.g. about whether is filePathAbsoluteFilesystem or filePathAbsoluteUserRootDir
|
|
142
|
-
filePathUnknown, userRootDir) {
|
|
143
|
-
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
144
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(userRootDir);
|
|
145
|
-
filePathUnknown = cleanFilePathUnknown(filePathUnknown);
|
|
146
|
-
if (!filePathUnknown.startsWith(userRootDir)) {
|
|
147
|
-
return filePathUnknown;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
return getFilePathAbsoluteUserRootDir2(filePathUnknown, userRootDir);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir) {
|
|
154
|
-
(0, utils_js_1.assert)(filePathAbsoluteFilesystem.startsWith(userRootDir));
|
|
155
|
-
let filePathAbsoluteUserRootDir = filePathAbsoluteFilesystem.slice(userRootDir.length);
|
|
156
|
-
if (!filePathAbsoluteUserRootDir.startsWith('/'))
|
|
157
|
-
filePathAbsoluteUserRootDir = '/' + filePathAbsoluteUserRootDir;
|
|
158
|
-
return filePathAbsoluteUserRootDir;
|
|
159
|
-
}
|
|
160
|
-
function cleanFilePathUnknown(filePathUnknown) {
|
|
161
|
-
filePathUnknown = (0, utils_js_1.toPosixPath)(filePathUnknown);
|
|
162
|
-
filePathUnknown = cleanModuleId(filePathUnknown);
|
|
163
|
-
return filePathUnknown;
|
|
164
|
-
}
|
|
165
|
-
function cleanModuleId(moduleId) {
|
|
166
|
-
// remove query
|
|
167
|
-
const parts = moduleId.split('?');
|
|
168
|
-
if (parts.length > 1)
|
|
169
|
-
parts.pop();
|
|
170
|
-
(0, utils_js_1.assert)(parts.length >= 1);
|
|
171
|
-
return parts.join('?');
|
|
172
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Purpose of this file:
|
|
3
|
-
// - Swallow redundant error messages (Vite is buggy and emits the same error multiple times)
|
|
4
|
-
// - Prepend "[request(n)]" tag to Vite logs
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getHttpRequestAsyncStore = getHttpRequestAsyncStore;
|
|
40
|
-
exports.installHttpRequestAsyncStore = installHttpRequestAsyncStore;
|
|
41
|
-
const renderPage_js_1 = require("../../runtime/renderPage.js");
|
|
42
|
-
const utils_js_1 = require("../utils.js");
|
|
43
|
-
const transpileAndExecuteFile_js_1 = require("./resolveVikeConfigInternal/transpileAndExecuteFile.js");
|
|
44
|
-
const loggerNotProd_js_1 = require("./loggerNotProd.js");
|
|
45
|
-
const errorWithCodeSnippet_js_1 = require("./loggerNotProd/errorWithCodeSnippet.js");
|
|
46
|
-
const node_util_1 = require("node:util");
|
|
47
|
-
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
48
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('getHttpRequestAsyncStore.ts', {
|
|
49
|
-
asyncLocalStorage: null,
|
|
50
|
-
});
|
|
51
|
-
async function installHttpRequestAsyncStore() {
|
|
52
|
-
let mod;
|
|
53
|
-
try {
|
|
54
|
-
mod = await Promise.resolve().then(() => __importStar(require('node:async_hooks')));
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
globalObject.asyncLocalStorage = new mod.AsyncLocalStorage();
|
|
60
|
-
(0, renderPage_js_1.renderPage_addAsyncHookwrapper)(async (httpRequestId, renderPage) => {
|
|
61
|
-
(0, utils_js_1.assert)(globalObject.asyncLocalStorage);
|
|
62
|
-
const loggedErrors = new Set();
|
|
63
|
-
const markErrorAsLogged = (err) => {
|
|
64
|
-
loggedErrors.add(err);
|
|
65
|
-
};
|
|
66
|
-
const shouldErrorBeSwallowed = (err) => {
|
|
67
|
-
if (loggedErrors.has(err) ||
|
|
68
|
-
Array.from(loggedErrors).some((errAlreadyLogged) => isEquivalent(err, errAlreadyLogged))) {
|
|
69
|
-
// In principle, some random message can be shown between the non-swallowed error and this logErrorDebugNote() call.
|
|
70
|
-
// We take a leap of faith that it happens only seldom and that it's worth the risk.
|
|
71
|
-
(0, loggerNotProd_js_1.logErrorDebugNote)();
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const store = {
|
|
79
|
-
httpRequestId,
|
|
80
|
-
markErrorAsLogged,
|
|
81
|
-
shouldErrorBeSwallowed,
|
|
82
|
-
errorDebugNoteAlreadyShown: false,
|
|
83
|
-
};
|
|
84
|
-
const pageContextReturn = await globalObject.asyncLocalStorage.run(store, renderPage);
|
|
85
|
-
return { pageContextReturn };
|
|
86
|
-
});
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
function getHttpRequestAsyncStore() {
|
|
90
|
-
if (globalObject.asyncLocalStorage === null)
|
|
91
|
-
return null;
|
|
92
|
-
const store = globalObject.asyncLocalStorage.getStore();
|
|
93
|
-
(0, utils_js_1.assert)(store === undefined || (0, utils_js_1.isObject)(store));
|
|
94
|
-
return store;
|
|
95
|
-
}
|
|
96
|
-
function isEquivalent(err1, err2) {
|
|
97
|
-
if (err1 === err2)
|
|
98
|
-
return true;
|
|
99
|
-
if (!(0, utils_js_1.isObject)(err1) || !(0, utils_js_1.isObject)(err2))
|
|
100
|
-
return false;
|
|
101
|
-
{
|
|
102
|
-
const errMsgFormatted1 = (0, transpileAndExecuteFile_js_1.getConfigBuildErrorFormatted)(err1);
|
|
103
|
-
const errMsgFormatted2 = (0, transpileAndExecuteFile_js_1.getConfigBuildErrorFormatted)(err2);
|
|
104
|
-
if (errMsgFormatted1 && errMsgFormatted1 === errMsgFormatted2)
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
if ((0, errorWithCodeSnippet_js_1.isEquivalentErrorWithCodeSnippet)(err1, err2))
|
|
108
|
-
return true;
|
|
109
|
-
if ((0, utils_js_1.unique)([
|
|
110
|
-
// error.message and error.stack aren't enumerable and therefore not listed by Object.keys()
|
|
111
|
-
'message',
|
|
112
|
-
'stack',
|
|
113
|
-
...Object.keys(err1),
|
|
114
|
-
...Object.keys(err2),
|
|
115
|
-
]).every((k) => {
|
|
116
|
-
// isDeepStrictEqual() need to compare error.position which is an object.
|
|
117
|
-
if ((0, node_util_1.isDeepStrictEqual)(err1[k], err2[k]))
|
|
118
|
-
return true;
|
|
119
|
-
// console.log('diff', k)
|
|
120
|
-
return false;
|
|
121
|
-
})) {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getMagicString = getMagicString;
|
|
7
|
-
const magic_string_1 = __importDefault(require("magic-string"));
|
|
8
|
-
// Used everywhere instead of `new MagicString()` for consistent source map generation
|
|
9
|
-
function getMagicString(code, id) {
|
|
10
|
-
const magicString = new magic_string_1.default(code);
|
|
11
|
-
const getMagicStringResult = () => {
|
|
12
|
-
return {
|
|
13
|
-
code: magicString.toString(),
|
|
14
|
-
map: magicString.generateMap({ hires: true, source: id }),
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
return { magicString, getMagicStringResult };
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getManifestFilePathRelative = getManifestFilePathRelative;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
function getManifestFilePathRelative(manifestConfig) {
|
|
6
|
-
(0, utils_js_1.assert)(['string', 'boolean'].includes(typeof manifestConfig));
|
|
7
|
-
(0, utils_js_1.assert)(manifestConfig !== false);
|
|
8
|
-
const manifestFileRelative = typeof manifestConfig === 'string' ? manifestConfig : '.vite/manifest.json';
|
|
9
|
-
return manifestFileRelative;
|
|
10
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getOutDirs = getOutDirs;
|
|
7
|
-
exports.resolveOutDir = resolveOutDir;
|
|
8
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
-
const utils_js_1 = require("../utils.js");
|
|
10
|
-
const isViteServerSide_js_1 = require("./isViteServerSide.js");
|
|
11
|
-
const debug = (0, utils_js_1.createDebugger)('vike:outDir');
|
|
12
|
-
function getOutDirs(configGlobal, viteEnv) {
|
|
13
|
-
debug('getOutDirs()', new Error().stack);
|
|
14
|
-
const outDir = getOutDirFromResolvedConfig(configGlobal, viteEnv);
|
|
15
|
-
assertOutDirResolved(outDir, configGlobal, viteEnv);
|
|
16
|
-
const outDirs = getOutDirsAll(outDir, configGlobal.root);
|
|
17
|
-
assertNormalization(outDirs.outDirRoot);
|
|
18
|
-
assertNormalization(outDirs.outDirClient);
|
|
19
|
-
assertNormalization(outDirs.outDirServer);
|
|
20
|
-
return outDirs;
|
|
21
|
-
}
|
|
22
|
-
/** Appends `client/` or `server/` to `config.build.outDir` */
|
|
23
|
-
function resolveOutDir(config, isServerSide) {
|
|
24
|
-
debug('resolveOutDir()');
|
|
25
|
-
const outDir = getOutDirFromViteUserConfig(config) || 'dist';
|
|
26
|
-
debug('outDir', outDir);
|
|
27
|
-
const { outDirClient, outDirServer } = getOutDirsAll(outDir);
|
|
28
|
-
if (isServerSide) {
|
|
29
|
-
debug('outDirServer', 'outDirServer');
|
|
30
|
-
return outDirServer;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
debug('outDirClient', 'outDirClient');
|
|
34
|
-
return outDirClient;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function determineOutDirs(outDirRoot) {
|
|
38
|
-
(0, utils_js_1.assertPosixPath)(outDirRoot);
|
|
39
|
-
(0, utils_js_1.assert)(isOutDirRoot(outDirRoot));
|
|
40
|
-
const outDirClient = (0, utils_js_1.pathJoin)(outDirRoot, 'client');
|
|
41
|
-
const outDirServer = (0, utils_js_1.pathJoin)(outDirRoot, 'server');
|
|
42
|
-
assertIsNotOutDirRoot(outDirClient);
|
|
43
|
-
assertIsNotOutDirRoot(outDirServer);
|
|
44
|
-
return { outDirClient, outDirServer };
|
|
45
|
-
}
|
|
46
|
-
function getOutDirsAll(outDir, root) {
|
|
47
|
-
let outDirRoot;
|
|
48
|
-
{
|
|
49
|
-
if (isOutDirRoot(outDir)) {
|
|
50
|
-
outDirRoot = outDir;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
(0, utils_js_1.assert)(outDir.endsWith('/server') || outDir.endsWith('/client'));
|
|
54
|
-
(0, utils_js_1.assert)('/client'.length === '/server'.length);
|
|
55
|
-
outDirRoot = outDir.slice(0, -1 * '/client'.length);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
debug('outDirRoot', outDirRoot);
|
|
59
|
-
let outDirs;
|
|
60
|
-
if (root) {
|
|
61
|
-
outDirs = getOutDirsAllFromRootNormalized(outDirRoot, root);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
outDirs = getOutDirsAllFromRoot(outDirRoot);
|
|
65
|
-
}
|
|
66
|
-
debug('outDirs', outDirs);
|
|
67
|
-
return outDirs;
|
|
68
|
-
}
|
|
69
|
-
function getOutDirsAllFromRoot(outDirRoot) {
|
|
70
|
-
let { outDirClient, outDirServer } = determineOutDirs(outDirRoot);
|
|
71
|
-
return { outDirRoot, outDirClient, outDirServer };
|
|
72
|
-
}
|
|
73
|
-
function getOutDirsAllFromRootNormalized(outDirRoot, root) {
|
|
74
|
-
if (root && !outDirIsAbsolutePath(outDirRoot)) {
|
|
75
|
-
(0, utils_js_1.assertPosixPath)(outDirRoot);
|
|
76
|
-
(0, utils_js_1.assertPosixPath)(root);
|
|
77
|
-
outDirRoot = (0, utils_js_1.pathJoin)(root, outDirRoot);
|
|
78
|
-
}
|
|
79
|
-
let { outDirClient, outDirServer } = determineOutDirs(outDirRoot);
|
|
80
|
-
outDirRoot = outDirRoot + '/';
|
|
81
|
-
outDirClient = outDirClient + '/';
|
|
82
|
-
outDirServer = outDirServer + '/';
|
|
83
|
-
assertNormalization(outDirRoot);
|
|
84
|
-
assertNormalization(outDirClient);
|
|
85
|
-
assertNormalization(outDirServer);
|
|
86
|
-
return { outDirRoot, outDirClient, outDirServer };
|
|
87
|
-
}
|
|
88
|
-
function assertNormalization(outDirAny) {
|
|
89
|
-
(0, utils_js_1.assertPosixPath)(outDirAny);
|
|
90
|
-
(0, utils_js_1.assert)(outDirIsAbsolutePath(outDirAny), outDirAny);
|
|
91
|
-
(0, utils_js_1.assert)(outDirAny.endsWith('/'), outDirAny);
|
|
92
|
-
(0, utils_js_1.assert)(!outDirAny.endsWith('//'), outDirAny);
|
|
93
|
-
}
|
|
94
|
-
function isOutDirRoot(outDirRot) {
|
|
95
|
-
const p = outDirRot.split('/').filter(Boolean);
|
|
96
|
-
const lastDir = p[p.length - 1];
|
|
97
|
-
return lastDir !== 'client' && lastDir !== 'server';
|
|
98
|
-
}
|
|
99
|
-
function assertIsNotOutDirRoot(outDir) {
|
|
100
|
-
(0, utils_js_1.assert)(outDir.endsWith('/client') || outDir.endsWith('/server'));
|
|
101
|
-
}
|
|
102
|
-
/** Assert that `outDir` ends with the correct directory `/server` or `/client` */
|
|
103
|
-
function assertOutDirResolved(outDir, configGlobal, viteEnv) {
|
|
104
|
-
(0, utils_js_1.assertPosixPath)(outDir);
|
|
105
|
-
if (isOutDirRoot(outDir))
|
|
106
|
-
return;
|
|
107
|
-
(0, utils_js_1.assert)(outDir.endsWith('/client') || outDir.endsWith('/server')); // we normalized outDir
|
|
108
|
-
(0, utils_js_1.assert)('/client'.length === '/server'.length);
|
|
109
|
-
const outDirCorrected = outDir.slice(0, -1 * '/client'.length);
|
|
110
|
-
const wrongUsage = `You've set Vite's config.build.outDir to ${picocolors_1.default.cyan(outDir)} but you should set it to ${picocolors_1.default.cyan(outDirCorrected)} instead.`;
|
|
111
|
-
const isServerSide = (0, isViteServerSide_js_1.isViteServerSide_viteEnvOptional)(configGlobal, viteEnv);
|
|
112
|
-
if (isServerSide) {
|
|
113
|
-
(0, utils_js_1.assertUsage)(outDir.endsWith('/server'), wrongUsage);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
(0, utils_js_1.assertUsage)(outDir.endsWith('/client'), wrongUsage);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function getOutDirFromViteUserConfig(config) {
|
|
120
|
-
let outDir = config.build?.outDir;
|
|
121
|
-
if (outDir === undefined)
|
|
122
|
-
return undefined;
|
|
123
|
-
outDir = normalizeOutDir(outDir);
|
|
124
|
-
return outDir;
|
|
125
|
-
}
|
|
126
|
-
function getOutDirFromResolvedConfig(config, viteEnv) {
|
|
127
|
-
let outDir = viteEnv?.config.build?.outDir ?? config.build.outDir;
|
|
128
|
-
(0, utils_js_1.assert)(outDir);
|
|
129
|
-
outDir = normalizeOutDir(outDir);
|
|
130
|
-
return outDir;
|
|
131
|
-
}
|
|
132
|
-
function normalizeOutDir(outDir) {
|
|
133
|
-
outDir = (0, utils_js_1.toPosixPath)(outDir);
|
|
134
|
-
outDir = outDir.replace(/\/+$/, ''); // remove trailing slashes
|
|
135
|
-
return outDir;
|
|
136
|
-
}
|
|
137
|
-
function outDirIsAbsolutePath(outDir) {
|
|
138
|
-
// There doesn't seem to be a better alternative to determine whether `outDir` is an absolute path
|
|
139
|
-
// - Very unlikely that `outDir`'s first dir matches the filesystem's first dir
|
|
140
|
-
// - Although more likely to happen with Docker
|
|
141
|
-
return getFirstDir(outDir) === getFirstDir(process.cwd());
|
|
142
|
-
}
|
|
143
|
-
function getFirstDir(p) {
|
|
144
|
-
const firstDir = p.split(/\/|\\/).filter(Boolean)[0];
|
|
145
|
-
return firstDir;
|
|
146
|
-
}
|