vike 0.4.239 → 0.4.240-commit-a80417c
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/index.d.ts +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-client-routing/entry.js +5 -3
- package/dist/esm/client/runtime-client-routing/getBaseServer.js +0 -1
- package/dist/esm/client/runtime-client-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
- package/dist/esm/client/runtime-client-routing/{globalContext.js → getGlobalContextClientInternal.js} +8 -4
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +6 -6
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.js +1 -1
- package/dist/esm/client/runtime-client-routing/isClientSideRoutable.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +4 -4
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +102 -77
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-server-routing/entry.js +5 -3
- package/dist/esm/client/runtime-server-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
- package/dist/esm/client/runtime-server-routing/getGlobalContextClientInternal.js +6 -0
- package/dist/esm/client/shared/execHookOnRenderClient.d.ts +1 -1
- package/dist/esm/client/shared/{createGetGlobalContextClient.d.ts → getGlobalContextClientInternalShared.d.ts} +11 -8
- package/dist/esm/client/shared/getGlobalContextClientInternalShared.js +66 -0
- package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +1 -3
- package/dist/esm/node/prerender/runPrerender.d.ts +4 -2
- package/dist/esm/node/prerender/runPrerender.js +5 -2
- package/dist/esm/node/runtime/globalContext.d.ts +15 -2
- package/dist/esm/node/runtime/globalContext.js +46 -32
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +4 -2
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +4 -2
- package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.d.ts +8 -4
- package/dist/esm/node/runtime/renderPage.d.ts +4 -2
- package/dist/esm/node/vite/index.js +42 -18
- package/dist/esm/node/vite/onLoad.js +1 -1
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.d.ts +4 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.js +21 -6
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.js +24 -20
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.js +20 -6
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistFileNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginDistFileNames.js +253 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistPackageJsonFile.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginDistPackageJsonFile.js +40 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginModuleBanner.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginModuleBanner.js +49 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.js +4 -2
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.d.ts +1 -1
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.js +27 -23
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.d.ts +7 -0
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js +47 -0
- package/dist/esm/node/vite/plugins/{pluginNonRunnableDev.d.ts → non-runnable-dev/pluginViteRPC.d.ts} +3 -7
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginViteRPC.js +30 -0
- package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBaseUrls.js +39 -33
- package/dist/esm/node/vite/plugins/pluginCommon.js +8 -28
- package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
- package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/vite/plugins/pluginDev.js +51 -47
- package/dist/esm/node/vite/plugins/pluginExtractAssets.js +108 -92
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +39 -23
- package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +117 -92
- package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginPreview.js +38 -30
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.js +127 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.d.ts +17 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.js +52 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsPageContext.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsPageContext.js +89 -0
- package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +4 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +67 -47
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +13 -9
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
- package/dist/esm/node/vite/shared/getMagicString.d.ts +1 -1
- package/dist/esm/node/vite/shared/getMagicString.js +2 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +2 -2
- package/dist/esm/shared/createGlobalContextShared.d.ts +4 -4
- package/dist/esm/shared/route/abort.d.ts +23 -11
- package/dist/esm/shared/route/abort.js +45 -5
- package/dist/esm/shared/route/index.js +13 -4
- package/dist/esm/shared/route/utils.d.ts +1 -0
- package/dist/esm/shared/route/utils.js +1 -0
- package/dist/esm/types/Config.d.ts +1 -1
- package/dist/esm/types/PageContext.d.ts +8 -8
- 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 +1 -0
- package/dist/esm/utils/debug.d.ts +5 -3
- package/dist/esm/utils/debug.js +30 -16
- package/dist/esm/utils/findPackageJson.js +0 -1
- package/dist/esm/utils/getGlobalObject.d.ts +5 -1
- package/dist/esm/utils/getGlobalObject.js +5 -1
- package/dist/esm/utils/getViteRPC.js +0 -2
- package/dist/esm/utils/isDev.js +3 -1
- package/dist/esm/utils/isNonRunnableDev.js +2 -2
- package/dist/esm/utils/requireResolve.js +1 -2
- package/dist/esm/utils/virtualFileId.d.ts +4 -0
- package/dist/esm/utils/virtualFileId.js +14 -11
- package/package.json +8 -27
- 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 -777
- 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 -572
- 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 -48
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -342
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -179
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -220
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -254
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -36
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -41
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -109
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -63
- 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 -197
- 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 -107
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -87
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -227
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -99
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -149
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -52
- package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -76
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -69
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -49
- 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 -215
- package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -15
- 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 -39
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
- package/dist/esm/client/runtime-server-routing/globalContext.js +0 -5
- package/dist/esm/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -249
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -34
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -39
- 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/pluginEnvVars.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +0 -85
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +0 -50
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -67
- package/dist/esm/shared/route/debug.d.ts +0 -6
- package/dist/esm/shared/route/debug.js +0 -21
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.d.ts +0 -0
|
@@ -74,7 +74,7 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
74
74
|
url?: string;
|
|
75
75
|
headers?: Record<string, string>;
|
|
76
76
|
} & {
|
|
77
|
-
_globalContext: {
|
|
77
|
+
_globalContext: ({
|
|
78
78
|
_globalConfigPublic: {
|
|
79
79
|
pages: {
|
|
80
80
|
[k: string]: {
|
|
@@ -162,7 +162,9 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
162
162
|
inject: boolean | undefined;
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
|
-
})
|
|
165
|
+
})) & {
|
|
166
|
+
prerenderContext: PrerenderContextPublic | undefined;
|
|
167
|
+
};
|
|
166
168
|
_pageFilesAll: PageFile[];
|
|
167
169
|
_baseServer: string;
|
|
168
170
|
_baseAssets: string;
|
|
@@ -9,7 +9,7 @@ import { prerenderPage } from '../runtime/renderPage/renderPageAfterRoute.js';
|
|
|
9
9
|
import { createPageContextServerSide } from '../runtime/renderPage/createPageContextServerSide.js';
|
|
10
10
|
import pc from '@brillout/picocolors';
|
|
11
11
|
import { cpus } from 'node:os';
|
|
12
|
-
import { getGlobalContextServerInternal, initGlobalContext_runPrerender, setGlobalContext_isPrerendering, } from '../runtime/globalContext.js';
|
|
12
|
+
import { getGlobalContextServerInternal, initGlobalContext_runPrerender, setGlobalContext_isPrerendering, setGlobalContext_prerenderContext, } from '../runtime/globalContext.js';
|
|
13
13
|
import { resolveConfig as resolveViteConfig } from 'vite';
|
|
14
14
|
import { getPageFilesServerSide } from '../../shared/getPageFiles.js';
|
|
15
15
|
import { getPageContextRequestUrl } from '../../shared/getPageContextRequestUrl.js';
|
|
@@ -108,6 +108,7 @@ async function runPrerender(options = {}, trigger) {
|
|
|
108
108
|
await warnMissingPages(prerenderContext._prerenderedPageContexts, globalContext, doNotPrerenderList, partial);
|
|
109
109
|
const prerenderContextPublic = preparePrerenderContextForPublicUsage(prerenderContext);
|
|
110
110
|
objectAssign(vikeConfig.prerenderContext, prerenderContextPublic, true);
|
|
111
|
+
setGlobalContext_prerenderContext(prerenderContextPublic);
|
|
111
112
|
if (prerenderConfigGlobal.isPrerenderingEnabledForAllPages && !prerenderConfigGlobal.keepDistServer) {
|
|
112
113
|
fs.rmSync(outDirServer, { recursive: true });
|
|
113
114
|
}
|
|
@@ -714,12 +715,14 @@ async function prerenderRedirects(globalContext, onComplete, showWarningUponDyna
|
|
|
714
715
|
}
|
|
715
716
|
function getRedirectHtml(urlTarget) {
|
|
716
717
|
const urlTargetSafe = escapeHtml(urlTarget);
|
|
717
|
-
//
|
|
718
|
+
// - Test: /test/playground => http://localhost:3000/download
|
|
719
|
+
// - Adding `<link rel="canonical">` for SEO, see https://github.com/vikejs/vike/pull/2711
|
|
718
720
|
const htmlString = `<!DOCTYPE html>
|
|
719
721
|
<html lang="en">
|
|
720
722
|
<head>
|
|
721
723
|
<meta charset="UTF-8">
|
|
722
724
|
<meta http-equiv="refresh" content="0;url=${urlTargetSafe}">
|
|
725
|
+
<link rel="canonical" href="${urlTargetSafe}" />
|
|
723
726
|
<title>Redirect ${urlTargetSafe}</title>
|
|
724
727
|
<style>body{opacity:0}</style>
|
|
725
728
|
<noscript>
|
|
@@ -10,11 +10,13 @@ export { initGlobalContext_getPagesAndRoutes };
|
|
|
10
10
|
export { setGlobalContext_viteDevServer };
|
|
11
11
|
export { setGlobalContext_viteConfig };
|
|
12
12
|
export { setGlobalContext_isPrerendering };
|
|
13
|
+
export { setGlobalContext_prerenderContext };
|
|
13
14
|
export { setGlobalContext_isProductionAccordingToVite };
|
|
14
15
|
export { setGlobalContext_prodBuildEntry };
|
|
15
16
|
export { clearGlobalContext };
|
|
16
17
|
export { assertBuildInfo };
|
|
17
18
|
export { updateUserFiles };
|
|
19
|
+
export { isRunnable };
|
|
18
20
|
export { vikeConfigErrorRecoverMsg };
|
|
19
21
|
export type { BuildInfo };
|
|
20
22
|
export type { GlobalContextServerInternal as GlobalContextServerInternal };
|
|
@@ -25,6 +27,7 @@ import { type PageRoutes } from '../../shared/route/loadPageRoutes.js';
|
|
|
25
27
|
import type { ViteConfigRuntime } from '../vite/shared/getViteConfigRuntime.js';
|
|
26
28
|
import type { GlobalContext } from '../../types/PageContext.js';
|
|
27
29
|
import type { Hook } from '../../shared/hooks/getHook.js';
|
|
30
|
+
import type { PrerenderContext } from '../../types/index.js';
|
|
28
31
|
declare const vikeConfigErrorRecoverMsg: "Vike config loaded";
|
|
29
32
|
type GlobalContextServer = Pick<GlobalContextServerInternal, 'assetsManifest' | 'config' | 'viteConfig' | 'viteConfigRuntime' | 'pages' | 'baseServer' | 'baseAssets' | 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextServer;
|
|
30
33
|
type GlobalContextServerInternal = Awaited<ReturnType<typeof createGlobalContext>>;
|
|
@@ -97,6 +100,8 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
97
100
|
inject: boolean | undefined;
|
|
98
101
|
};
|
|
99
102
|
};
|
|
103
|
+
} & {
|
|
104
|
+
prerenderContext: PrerenderContext | undefined;
|
|
100
105
|
}) | (Record<string, unknown> & {
|
|
101
106
|
_globalConfigPublic: {
|
|
102
107
|
pages: {
|
|
@@ -166,6 +171,8 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
166
171
|
inject: boolean | undefined;
|
|
167
172
|
};
|
|
168
173
|
};
|
|
174
|
+
} & {
|
|
175
|
+
prerenderContext: PrerenderContext | undefined;
|
|
169
176
|
}) | (Record<string, unknown> & {
|
|
170
177
|
_globalConfigPublic: {
|
|
171
178
|
pages: {
|
|
@@ -235,6 +242,8 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
235
242
|
inject: boolean | undefined;
|
|
236
243
|
};
|
|
237
244
|
};
|
|
245
|
+
} & {
|
|
246
|
+
prerenderContext: PrerenderContext | undefined;
|
|
238
247
|
});
|
|
239
248
|
}>;
|
|
240
249
|
/**
|
|
@@ -258,6 +267,7 @@ declare function getGlobalContextSync(): GlobalContext;
|
|
|
258
267
|
declare function setGlobalContext_viteDevServer(viteDevServer: ViteDevServer): Promise<void>;
|
|
259
268
|
declare function setGlobalContext_viteConfig(viteConfig: ResolvedConfig, viteConfigRuntime: ViteConfigRuntime): void;
|
|
260
269
|
declare function setGlobalContext_isPrerendering(): void;
|
|
270
|
+
declare function setGlobalContext_prerenderContext(prerenderContextPublic: PrerenderContext): void;
|
|
261
271
|
declare function setGlobalContext_isProductionAccordingToVite(isProductionAccordingToVite: boolean): void;
|
|
262
272
|
declare function getViteDevServer(): ViteDevServer | null;
|
|
263
273
|
declare function getViteConfig(): ResolvedConfig | null;
|
|
@@ -274,7 +284,7 @@ declare function assertBuildInfo(buildInfo: unknown): asserts buildInfo is Build
|
|
|
274
284
|
declare function updateUserFiles(): Promise<{
|
|
275
285
|
success: boolean;
|
|
276
286
|
}>;
|
|
277
|
-
declare function createGlobalContext(virtualFileExportsGlobalEntry: unknown): Promise<{
|
|
287
|
+
declare function createGlobalContext(virtualFileExportsGlobalEntry: unknown): Promise<({
|
|
278
288
|
_globalConfigPublic: {
|
|
279
289
|
pages: {
|
|
280
290
|
[k: string]: {
|
|
@@ -362,5 +372,8 @@ declare function createGlobalContext(virtualFileExportsGlobalEntry: unknown): Pr
|
|
|
362
372
|
inject: boolean | undefined;
|
|
363
373
|
};
|
|
364
374
|
};
|
|
365
|
-
})
|
|
375
|
+
})) & {
|
|
376
|
+
prerenderContext: PrerenderContext | undefined;
|
|
377
|
+
}>;
|
|
366
378
|
declare function clearGlobalContext(): void;
|
|
379
|
+
declare function isRunnable(viteDevServer: ViteDevServer): boolean;
|
|
@@ -12,11 +12,13 @@ export { initGlobalContext_getPagesAndRoutes };
|
|
|
12
12
|
export { setGlobalContext_viteDevServer };
|
|
13
13
|
export { setGlobalContext_viteConfig };
|
|
14
14
|
export { setGlobalContext_isPrerendering };
|
|
15
|
+
export { setGlobalContext_prerenderContext };
|
|
15
16
|
export { setGlobalContext_isProductionAccordingToVite };
|
|
16
17
|
export { setGlobalContext_prodBuildEntry }; // production entry
|
|
17
18
|
export { clearGlobalContext };
|
|
18
19
|
export { assertBuildInfo };
|
|
19
20
|
export { updateUserFiles };
|
|
21
|
+
export { isRunnable };
|
|
20
22
|
export { vikeConfigErrorRecoverMsg };
|
|
21
23
|
// The core logic revolves around:
|
|
22
24
|
// - virtualFileExportsGlobalEntry is the main requirement
|
|
@@ -26,7 +28,7 @@ export { vikeConfigErrorRecoverMsg };
|
|
|
26
28
|
// - Without vike-server it's manually loaded here using importServerProductionEntry() which uses @brillout/vite-plugin-server-entry's autoImporter or crawler
|
|
27
29
|
// - In development: globalObject.viteDevServer which is Vite's development server
|
|
28
30
|
// - globalObject.viteDevServer is used by updateUserFiles() which then sets virtualFileExportsGlobalEntry
|
|
29
|
-
import { assert, onSetupRuntime, assertUsage, assertWarning, isPlainObject, objectReplace, isObject, hasProp, getGlobalObject, genPromise, createDebugger, checkType, PROJECT_VERSION, getViteRPC, isRunnableDevEnvironment, assertIsNotBrowser, isNonRunnableDev, } from './utils.js';
|
|
31
|
+
import { assert, onSetupRuntime, assertUsage, assertWarning, isPlainObject, objectReplace, isObject, hasProp, getGlobalObject, genPromise, createDebugger, checkType, PROJECT_VERSION, getViteRPC, isRunnableDevEnvironment, assertIsNotBrowser, isNonRunnableDev, objectAssign, } from './utils.js';
|
|
30
32
|
import { importServerProductionEntry } from '@brillout/vite-plugin-server-entry/runtime';
|
|
31
33
|
import { virtualFileIdGlobalEntryServer } from '../shared/virtualFileId.js';
|
|
32
34
|
import pc from '@brillout/picocolors';
|
|
@@ -149,6 +151,13 @@ function assertIsNotInitializedYet() {
|
|
|
149
151
|
function setGlobalContext_isPrerendering() {
|
|
150
152
|
globalObject.isPrerendering = true;
|
|
151
153
|
}
|
|
154
|
+
function setGlobalContext_prerenderContext(prerenderContextPublic) {
|
|
155
|
+
globalObject.prerenderContextPublic = prerenderContextPublic;
|
|
156
|
+
// Ugly redundancy, which we can remove after globalContext is a proxy
|
|
157
|
+
const { globalContext } = globalObjectTyped;
|
|
158
|
+
if (globalContext)
|
|
159
|
+
globalContext.prerenderContext = prerenderContextPublic;
|
|
160
|
+
}
|
|
152
161
|
function setGlobalContext_isProductionAccordingToVite(isProductionAccordingToVite) {
|
|
153
162
|
globalObject.isProductionAccordingToVite = isProductionAccordingToVite;
|
|
154
163
|
}
|
|
@@ -252,6 +261,7 @@ async function loadProdBuildEntry(outDir) {
|
|
|
252
261
|
// https://github.com/vikejs/vike/blob/8c350e8105a626469e87594d983090919e82099b/packages/vike/node/vite/plugins/pluginBuild/pluginProdBuildEntry.ts#L47
|
|
253
262
|
async function setGlobalContext_prodBuildEntry(prodBuildEntry) {
|
|
254
263
|
debug('setGlobalContext_prodBuildEntry()');
|
|
264
|
+
assert(!isNonRunnableDev());
|
|
255
265
|
assertProdBuildEntry(prodBuildEntry);
|
|
256
266
|
globalObject.prodBuildEntry = prodBuildEntry;
|
|
257
267
|
globalObject.prodBuildEntryPrevious = prodBuildEntry;
|
|
@@ -350,13 +360,14 @@ async function updateUserFiles() {
|
|
|
350
360
|
}
|
|
351
361
|
else {
|
|
352
362
|
try {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
363
|
+
// We don't directly use import() because:
|
|
364
|
+
// - Avoid Cloudflare Workers (without @cloudflare/vite-plugin) to try to bundle `import('virtual:id')`.
|
|
365
|
+
// - Using import() seems to lead to a Vite HMR bug:
|
|
366
|
+
// ```js
|
|
367
|
+
// assert(false)
|
|
368
|
+
// // This line breaks the HMR of regular (runnable) apps, even though (as per the assert() above) it's never run. It seems to be a Vite bug: handleHotUpdate() receives an empty `modules` list.
|
|
369
|
+
// import('virtual:vike:global-entry:server')
|
|
370
|
+
// ```
|
|
360
371
|
virtualFileExportsGlobalEntry = await __VIKE__DYNAMIC_IMPORT('virtual:vike:global-entry:server');
|
|
361
372
|
}
|
|
362
373
|
catch (err_) {
|
|
@@ -400,6 +411,7 @@ async function createGlobalContext(virtualFileExportsGlobalEntry) {
|
|
|
400
411
|
globalContext._pageConfigs.length > 0, globalContext._pageFilesAll);
|
|
401
412
|
assertGlobalContextIsDefined();
|
|
402
413
|
onSetupRuntime();
|
|
414
|
+
objectAssign(globalContext, { prerenderContext: globalObject.prerenderContextPublic });
|
|
403
415
|
// Never actually used, only used for TypeScript `ReturnType<typeof createGlobalContext>`
|
|
404
416
|
return globalContext;
|
|
405
417
|
}
|
|
@@ -533,35 +545,37 @@ function isProd() {
|
|
|
533
545
|
}
|
|
534
546
|
function isProdOptional() {
|
|
535
547
|
const vikeApiOperation = getVikeApiOperation()?.operation ?? null;
|
|
536
|
-
const yes =
|
|
537
548
|
// setGlobalContext_prodBuildEntry() was called
|
|
538
|
-
!!globalObject.prodBuildEntry
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
549
|
+
const yes1 = !!globalObject.prodBuildEntry;
|
|
550
|
+
const yes2 = globalObject.isPrerendering === true;
|
|
551
|
+
// Vike CLI & Vike API
|
|
552
|
+
const yes3 = !!vikeApiOperation && vikeApiOperation !== 'dev';
|
|
553
|
+
// Vite command
|
|
554
|
+
const yes4 = globalObject.isProductionAccordingToVite === true;
|
|
555
|
+
// getGlobalContextAsync(isProduction)
|
|
556
|
+
const yes5 = globalObject.isProductionAccordingToUser === true;
|
|
557
|
+
// vite-plugin-vercel
|
|
558
|
+
const yes6 = globalObject.isProductionAccordingToPhotonVercel === true;
|
|
559
|
+
const yes = yes1 || yes2 || yes3 || yes4 || yes5 || yes6;
|
|
560
|
+
const no1 = !!globalObject.viteDevServer;
|
|
561
|
+
// Vike CLI & Vike API
|
|
562
|
+
const no2 = vikeApiOperation === 'dev';
|
|
563
|
+
// Vite command
|
|
564
|
+
const no3 = globalObject.isProductionAccordingToVite === false;
|
|
565
|
+
// getGlobalContextAsync(isProduction)
|
|
566
|
+
const no4 = globalObject.isProductionAccordingToUser === false;
|
|
567
|
+
// @cloudflare/vite-plugin
|
|
568
|
+
const no5 = isNonRunnableDev();
|
|
569
|
+
const no = no1 || no2 || no3 || no4 || no5;
|
|
570
|
+
const debug = { yes1, yes2, yes3, yes4, yes5, yes6, no1, no2, no3, no4, no5 };
|
|
571
|
+
assert(typeof yes === 'boolean', debug);
|
|
572
|
+
assert(typeof no === 'boolean', debug);
|
|
559
573
|
if (yes) {
|
|
560
|
-
assert(no === false);
|
|
574
|
+
assert(no === false, debug);
|
|
561
575
|
return true;
|
|
562
576
|
}
|
|
563
577
|
if (no) {
|
|
564
|
-
assert(yes === false);
|
|
578
|
+
assert(yes === false, debug);
|
|
565
579
|
return false;
|
|
566
580
|
}
|
|
567
581
|
return null;
|
|
@@ -23,7 +23,7 @@ declare function createPageContextServerSide(pageContextInit: PageContextInit, g
|
|
|
23
23
|
url?: string;
|
|
24
24
|
headers?: Record<string, string>;
|
|
25
25
|
} & {
|
|
26
|
-
_globalContext: {
|
|
26
|
+
_globalContext: ({
|
|
27
27
|
_globalConfigPublic: {
|
|
28
28
|
pages: {
|
|
29
29
|
[k: string]: {
|
|
@@ -111,7 +111,9 @@ declare function createPageContextServerSide(pageContextInit: PageContextInit, g
|
|
|
111
111
|
inject: boolean | undefined;
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
-
})
|
|
114
|
+
})) & {
|
|
115
|
+
prerenderContext: import("../../prerender/runPrerender.js").PrerenderContextPublic | undefined;
|
|
116
|
+
};
|
|
115
117
|
_pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
116
118
|
_baseServer: string;
|
|
117
119
|
_baseAssets: string;
|
|
@@ -24,7 +24,7 @@ declare function loadPageConfigsLazyServerSide(pageContext: PageContext_loadPage
|
|
|
24
24
|
url?: string;
|
|
25
25
|
headers?: Record<string, string>;
|
|
26
26
|
} & {
|
|
27
|
-
_globalContext: {
|
|
27
|
+
_globalContext: ({
|
|
28
28
|
_globalConfigPublic: {
|
|
29
29
|
pages: {
|
|
30
30
|
[k: string]: {
|
|
@@ -112,7 +112,9 @@ declare function loadPageConfigsLazyServerSide(pageContext: PageContext_loadPage
|
|
|
112
112
|
inject: boolean | undefined;
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
|
-
})
|
|
115
|
+
})) & {
|
|
116
|
+
prerenderContext: import("../../prerender/runPrerender.js").PrerenderContextPublic | undefined;
|
|
117
|
+
};
|
|
116
118
|
_pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
117
119
|
_baseServer: string;
|
|
118
120
|
_baseAssets: string;
|
|
@@ -39,7 +39,7 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
|
|
|
39
39
|
url?: string;
|
|
40
40
|
headers?: Record<string, string>;
|
|
41
41
|
} & {
|
|
42
|
-
_globalContext: {
|
|
42
|
+
_globalContext: ({
|
|
43
43
|
_globalConfigPublic: {
|
|
44
44
|
pages: {
|
|
45
45
|
[k: string]: {
|
|
@@ -127,7 +127,9 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
|
|
|
127
127
|
inject: boolean | undefined;
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
|
-
})
|
|
130
|
+
})) & {
|
|
131
|
+
prerenderContext: import("../../prerender/runPrerender.js").PrerenderContextPublic | undefined;
|
|
132
|
+
};
|
|
131
133
|
_pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
132
134
|
_baseServer: string;
|
|
133
135
|
_baseAssets: string;
|
|
@@ -201,7 +203,7 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
|
|
|
201
203
|
url?: string;
|
|
202
204
|
headers?: Record<string, string>;
|
|
203
205
|
} & {
|
|
204
|
-
_globalContext: {
|
|
206
|
+
_globalContext: ({
|
|
205
207
|
_globalConfigPublic: {
|
|
206
208
|
pages: {
|
|
207
209
|
[k: string]: {
|
|
@@ -289,7 +291,9 @@ declare function prerenderPage(pageContext: PageContextCreated & PageConfigsLazy
|
|
|
289
291
|
inject: boolean | undefined;
|
|
290
292
|
};
|
|
291
293
|
};
|
|
292
|
-
})
|
|
294
|
+
})) & {
|
|
295
|
+
prerenderContext: import("../../prerender/runPrerender.js").PrerenderContextPublic | undefined;
|
|
296
|
+
};
|
|
293
297
|
_pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
294
298
|
_baseServer: string;
|
|
295
299
|
_baseAssets: string;
|
|
@@ -31,7 +31,7 @@ declare function getPageContextBegin(pageContextInit: PageContextInit, globalCon
|
|
|
31
31
|
/** @deprecated Set `pageContextInit.urlOriginal` instead */ url?: string;
|
|
32
32
|
/** @deprecated Set pageContextInit.headersOriginal instead */ headers?: Record<string, string>;
|
|
33
33
|
} & {
|
|
34
|
-
_globalContext: {
|
|
34
|
+
_globalContext: ({
|
|
35
35
|
_globalConfigPublic: {
|
|
36
36
|
pages: {
|
|
37
37
|
[k: string]: {
|
|
@@ -119,7 +119,9 @@ declare function getPageContextBegin(pageContextInit: PageContextInit, globalCon
|
|
|
119
119
|
inject: boolean | undefined;
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
|
-
})
|
|
122
|
+
})) & {
|
|
123
|
+
prerenderContext: import("../prerender/runPrerender.js").PrerenderContextPublic | undefined;
|
|
124
|
+
};
|
|
123
125
|
_pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
|
|
124
126
|
_baseServer: string;
|
|
125
127
|
_baseAssets: string;
|
|
@@ -4,8 +4,10 @@ export { plugin };
|
|
|
4
4
|
export { plugin as ssr };
|
|
5
5
|
export { getVikeConfig } from './shared/resolveVikeConfigInternal.js';
|
|
6
6
|
export { PROJECT_VERSION as version } from './utils.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { getClientEntrySrcDev } from './shared/getClientEntrySrcDev.js';
|
|
8
|
+
import { setGetClientEntrySrcDev } from '../runtime/renderPage/getPageAssets/retrievePageAssetsDev.js';
|
|
9
|
+
import { assertIsNotProductionRuntime, assertUsage } from './utils.js';
|
|
10
|
+
import pc from '@brillout/picocolors';
|
|
9
11
|
import { pluginPreview } from './plugins/pluginPreview.js';
|
|
10
12
|
import { pluginDev } from './plugins/pluginDev.js';
|
|
11
13
|
import { pluginVirtualFiles } from './plugins/pluginVirtualFiles.js';
|
|
@@ -14,39 +16,61 @@ import { pluginExtractExportNames } from './plugins/pluginExtractExportNames.js'
|
|
|
14
16
|
import { pluginSetGlobalContext } from './plugins/pluginSetGlobalContext.js';
|
|
15
17
|
import { pluginCommon } from './plugins/pluginCommon.js';
|
|
16
18
|
import { pluginBaseUrls } from './plugins/pluginBaseUrls.js';
|
|
17
|
-
import {
|
|
18
|
-
import pc from '@brillout/picocolors';
|
|
19
|
+
import { pluginReplaceConstantsEnvVars } from './plugins/pluginReplaceConstantsEnvVars.js';
|
|
19
20
|
import { pluginFileEnv } from './plugins/pluginFileEnv.js';
|
|
20
|
-
import { getClientEntrySrcDev } from './shared/getClientEntrySrcDev.js';
|
|
21
21
|
import { pluginWorkaroundCssModuleHmr } from './plugins/pluginWorkaroundCssModuleHmr.js';
|
|
22
22
|
import { pluginWorkaroundVite6HmrRegression } from './plugins/pluginWorkaroundVite6HmrRegression.js';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
23
|
+
import { pluginReplaceConstantsPageContext } from './plugins/pluginReplaceConstantsPageContext.js';
|
|
24
|
+
import { pluginReplaceConstantsGlobalThis } from './plugins/pluginReplaceConstantsGlobalThis.js';
|
|
25
|
+
import { pluginViteRPC } from './plugins/non-runnable-dev/pluginViteRPC.js';
|
|
26
|
+
import { pluginBuildApp } from './plugins/build/pluginBuildApp.js';
|
|
27
|
+
import { pluginDistPackageJsonFile } from './plugins/build/pluginDistPackageJsonFile.js';
|
|
28
|
+
import { pluginSuppressRollupWarning } from './plugins/build/pluginSuppressRollupWarning.js';
|
|
29
|
+
import { pluginDistFileNames } from './plugins/build/pluginDistFileNames.js';
|
|
30
|
+
import { pluginProdBuildEntry } from './plugins/build/pluginProdBuildEntry.js';
|
|
31
|
+
import { pluginBuildConfig } from './plugins/build/pluginBuildConfig.js';
|
|
32
|
+
import { pluginModuleBanner } from './plugins/build/pluginModuleBanner.js';
|
|
33
|
+
import { pluginReplaceConstantsNonRunnableDev } from './plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js';
|
|
26
34
|
// We don't call this in ./onLoad.ts to avoid a cyclic dependency with utils.ts
|
|
27
35
|
setGetClientEntrySrcDev(getClientEntrySrcDev);
|
|
36
|
+
assertIsNotProductionRuntime();
|
|
28
37
|
// Return `PluginInterop` instead of `Plugin` to avoid type mismatch upon different Vite versions
|
|
29
38
|
function plugin(vikeVitePluginOptions = {}) {
|
|
30
39
|
const plugins = [
|
|
31
40
|
...pluginCommon(vikeVitePluginOptions),
|
|
32
|
-
pluginVirtualFiles(),
|
|
41
|
+
...pluginVirtualFiles(),
|
|
33
42
|
...pluginDev(),
|
|
34
43
|
...pluginBuild(),
|
|
35
|
-
pluginPreview(),
|
|
44
|
+
...pluginPreview(),
|
|
36
45
|
...pluginExtractAssets(),
|
|
37
|
-
pluginExtractExportNames(),
|
|
46
|
+
...pluginExtractExportNames(),
|
|
38
47
|
...pluginSetGlobalContext(),
|
|
39
|
-
pluginBaseUrls(),
|
|
40
|
-
|
|
41
|
-
pluginFileEnv(),
|
|
42
|
-
pluginWorkaroundCssModuleHmr(),
|
|
43
|
-
pluginWorkaroundVite6HmrRegression(),
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
...pluginBaseUrls(),
|
|
49
|
+
...pluginReplaceConstantsEnvVars(),
|
|
50
|
+
...pluginFileEnv(),
|
|
51
|
+
...pluginWorkaroundCssModuleHmr(),
|
|
52
|
+
...pluginWorkaroundVite6HmrRegression(),
|
|
53
|
+
...pluginReplaceConstantsPageContext(),
|
|
54
|
+
...pluginReplaceConstantsGlobalThis(),
|
|
55
|
+
...pluginNonRunnabeDev(),
|
|
46
56
|
];
|
|
47
57
|
Object.assign(plugins, { _vikeVitePluginOptions: vikeVitePluginOptions });
|
|
48
58
|
return plugins;
|
|
49
59
|
}
|
|
60
|
+
function pluginBuild() {
|
|
61
|
+
return [
|
|
62
|
+
...pluginBuildConfig(),
|
|
63
|
+
...pluginBuildApp(),
|
|
64
|
+
...pluginProdBuildEntry(),
|
|
65
|
+
...pluginDistPackageJsonFile(),
|
|
66
|
+
...pluginSuppressRollupWarning(),
|
|
67
|
+
...pluginDistFileNames(),
|
|
68
|
+
...pluginModuleBanner(),
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
function pluginNonRunnabeDev() {
|
|
72
|
+
return [...pluginViteRPC(), ...pluginReplaceConstantsNonRunnableDev()];
|
|
73
|
+
}
|
|
50
74
|
// Error upon wrong usage
|
|
51
75
|
Object.defineProperty(plugin, 'apply', {
|
|
52
76
|
enumerable: true,
|
|
@@ -13,7 +13,7 @@ function onLoad() {
|
|
|
13
13
|
// TO-DO/eventually: let's also use this.meta.viteVersion
|
|
14
14
|
// - https://github.com/vitejs/vite/pull/20088
|
|
15
15
|
// - https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#700-2025-06-24
|
|
16
|
-
assertVersion('Vite', version, ['6.
|
|
16
|
+
assertVersion('Vite', version, ['6.3.0']);
|
|
17
17
|
// Ensure we don't bloat the server runtime with heavy dependencies such Vite and esbuild
|
|
18
18
|
assertIsNotProductionRuntime();
|
|
19
19
|
}
|
|
@@ -3,10 +3,14 @@ export { handleAssetsManifest_getBuildConfig };
|
|
|
3
3
|
export { handleAssetsManifest_isFixEnabled };
|
|
4
4
|
export { handleAssetsManifest_assertUsageCssCodeSplit };
|
|
5
5
|
export { handleAssetsManifest_assertUsageCssTarget };
|
|
6
|
+
export { handleAssetsManifest_workaroundCssTarget_part1 };
|
|
7
|
+
export { handleAssetsManifest_workaroundCssTarget_part2 };
|
|
6
8
|
import type { Environment, ResolvedConfig, Rollup } from 'vite';
|
|
7
9
|
type Bundle = Rollup.OutputBundle;
|
|
8
10
|
declare function handleAssetsManifest_isFixEnabled(): boolean;
|
|
9
11
|
declare function handleAssetsManifest_assertUsageCssCodeSplit(config: ResolvedConfig): void;
|
|
12
|
+
declare function handleAssetsManifest_workaroundCssTarget_part1(config: ResolvedConfig): void;
|
|
13
|
+
declare function handleAssetsManifest_workaroundCssTarget_part2(): void;
|
|
10
14
|
declare function handleAssetsManifest_assertUsageCssTarget(config: ResolvedConfig, env: Environment): void;
|
|
11
15
|
declare function handleAssetsManifest_getBuildConfig(): Promise<{
|
|
12
16
|
readonly ssrEmitAssets: true | undefined;
|
|
@@ -3,6 +3,8 @@ export { handleAssetsManifest_getBuildConfig };
|
|
|
3
3
|
export { handleAssetsManifest_isFixEnabled };
|
|
4
4
|
export { handleAssetsManifest_assertUsageCssCodeSplit };
|
|
5
5
|
export { handleAssetsManifest_assertUsageCssTarget };
|
|
6
|
+
export { handleAssetsManifest_workaroundCssTarget_part1 };
|
|
7
|
+
export { handleAssetsManifest_workaroundCssTarget_part2 };
|
|
6
8
|
import fs from 'node:fs/promises';
|
|
7
9
|
import fs_sync from 'node:fs';
|
|
8
10
|
import path from 'node:path';
|
|
@@ -13,11 +15,14 @@ import { getAssetsDir } from '../../shared/getAssetsDir.js';
|
|
|
13
15
|
import pc from '@brillout/picocolors';
|
|
14
16
|
import { isV1Design } from '../../shared/resolveVikeConfigInternal.js';
|
|
15
17
|
import { getOutDirs } from '../../shared/getOutDirs.js';
|
|
16
|
-
import { isViteServerSide_onlySsrEnv, isViteServerSide } from '../../shared/isViteServerSide.js';
|
|
18
|
+
import { isViteServerSide_onlySsrEnv, isViteServerSide, isViteServerSide_viteEnvOptional, } from '../../shared/isViteServerSide.js';
|
|
17
19
|
import { set_macro_ASSETS_MANIFEST } from './pluginProdBuildEntry.js';
|
|
18
20
|
import { getManifestFilePathRelative } from '../../shared/getManifestFilePathRelative.js';
|
|
19
|
-
const globalObject = getGlobalObject('
|
|
21
|
+
const globalObject = getGlobalObject('handleAssetsManifest.ts', {
|
|
20
22
|
assetsJsonFilePath: undefined,
|
|
23
|
+
cssTarget: '__VIKE__UNSET',
|
|
24
|
+
targetsAll: [],
|
|
25
|
+
configsAll: [],
|
|
21
26
|
});
|
|
22
27
|
// yes => use workaround config.build.ssrEmitAssets
|
|
23
28
|
// false => use workaround extractAssets plugin
|
|
@@ -216,16 +221,26 @@ function handleAssetsManifest_assertUsageCssCodeSplit(config) {
|
|
|
216
221
|
return;
|
|
217
222
|
assertWarning(config.build.cssCodeSplit, `${pc.cyan('build.cssCodeSplit')} shouldn't be set to ${pc.cyan('false')} (https://github.com/vikejs/vike/issues/1993)`, { onlyOnce: true });
|
|
218
223
|
}
|
|
219
|
-
|
|
224
|
+
function handleAssetsManifest_workaroundCssTarget_part1(config) {
|
|
225
|
+
globalObject.configsAll.push(config);
|
|
226
|
+
if (!isViteServerSide_viteEnvOptional(config, undefined)) {
|
|
227
|
+
globalObject.cssTarget = config.build.cssTarget;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function handleAssetsManifest_workaroundCssTarget_part2() {
|
|
231
|
+
assert(globalObject.cssTarget !== '__VIKE__UNSET');
|
|
232
|
+
globalObject.configsAll.forEach((c) => (c.build.cssTarget = globalObject.cssTarget));
|
|
233
|
+
}
|
|
220
234
|
function handleAssetsManifest_assertUsageCssTarget(config, env) {
|
|
221
235
|
if (!handleAssetsManifest_isFixEnabled())
|
|
222
236
|
return;
|
|
223
237
|
const isServerSide = isViteServerSide(config, env);
|
|
224
238
|
assert(typeof isServerSide === 'boolean');
|
|
225
239
|
assert(config.build.target !== undefined);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const
|
|
240
|
+
const { targetsAll } = globalObject;
|
|
241
|
+
targetsAll.push({ global: config.build.target, css: config.build.cssTarget, isServerSide });
|
|
242
|
+
const targetsServer = targetsAll.filter((t) => t.isServerSide);
|
|
243
|
+
const targetsClient = targetsAll.filter((t) => !t.isServerSide);
|
|
229
244
|
targetsClient.forEach((targetClient) => {
|
|
230
245
|
const targetCssResolvedClient = resolveCssTarget(targetClient);
|
|
231
246
|
targetsServer.forEach((targetServer) => {
|
|
@@ -46,35 +46,39 @@ function pluginBuildApp() {
|
|
|
46
46
|
{
|
|
47
47
|
name: 'vike:build:pluginBuildApp',
|
|
48
48
|
apply: 'build',
|
|
49
|
-
config
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
config: {
|
|
50
|
+
handler(config) {
|
|
51
|
+
return {
|
|
52
|
+
environments: {
|
|
53
|
+
ssr: {
|
|
54
|
+
consumer: 'server',
|
|
55
|
+
build: {
|
|
56
|
+
outDir: resolveOutDir(config, true),
|
|
57
|
+
ssr: true,
|
|
58
|
+
},
|
|
57
59
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
client: {
|
|
61
|
+
consumer: 'client',
|
|
62
|
+
build: {
|
|
63
|
+
outDir: resolveOutDir(config, false),
|
|
64
|
+
copyPublicDir: true,
|
|
65
|
+
ssr: false,
|
|
66
|
+
},
|
|
65
67
|
},
|
|
66
68
|
},
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
+
};
|
|
70
|
+
},
|
|
69
71
|
},
|
|
70
72
|
},
|
|
71
73
|
{
|
|
72
74
|
name: 'vike:build:pluginBuildApp:autoFullBuild:pre',
|
|
73
75
|
apply: 'build',
|
|
74
76
|
enforce: 'pre',
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
configResolved: {
|
|
78
|
+
async handler(config_) {
|
|
79
|
+
config = config_;
|
|
80
|
+
await abortViteBuildSsr();
|
|
81
|
+
},
|
|
78
82
|
},
|
|
79
83
|
// TO-DO/eventually: stop using this writeBundle() hack and, instead, use the buildApp() implementation above.
|
|
80
84
|
// - Could it cause issues if a tool uses the writeBundle() hack together with getVikeConfig() ?
|