vike 0.4.239-commit-59f1017 → 0.4.239-commit-9dcde6d
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.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} +1 -1
- package/dist/esm/client/runtime-client-routing/{globalContext.js → getGlobalContextClientInternal.js} +8 -4
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +4 -4
- package/dist/esm/client/runtime-client-routing/isClientSideRoutable.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +2 -4
- 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.js +3 -1
- 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/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/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.d.ts +1 -1
- package/dist/esm/shared/route/abort.d.ts +22 -11
- package/dist/esm/shared/route/abort.js +37 -5
- 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/findPackageJson.js +0 -1
- package/dist/esm/utils/getViteRPC.js +0 -2
- package/dist/esm/utils/requireResolve.js +0 -1
- package/package.json +2 -21
- 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 -357
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -183
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -234
- 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 -22
- 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/client/runtime-server-routing/globalContext.js +0 -5
- package/dist/esm/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginBuild.js +0 -20
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -14
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -92
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/
|
|
1
|
+
export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/getGlobalContextClientInternalShared.js';
|
package/dist/esm/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { isBrowser } from '../utils/isBrowser.js';
|
|
2
2
|
import { assert } from '../utils/assert.js';
|
|
3
3
|
assert(isBrowser());
|
|
4
|
-
export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/
|
|
4
|
+
export { getGlobalContext, getGlobalContext as getGlobalContextAsync, getGlobalContextSync, } from './shared/getGlobalContextClientInternalShared.js';
|
|
@@ -2,7 +2,7 @@ export { createPageContextClientSide };
|
|
|
2
2
|
import { createPageContextObject, createPageContextShared } from '../../shared/createPageContextShared.js';
|
|
3
3
|
import { getPageContextUrlComputed } from '../../shared/getPageContextUrlComputed.js';
|
|
4
4
|
import { getBaseServer } from './getBaseServer.js';
|
|
5
|
-
import { getGlobalContextClientInternal } from './
|
|
5
|
+
import { getGlobalContextClientInternal } from './getGlobalContextClientInternal.js';
|
|
6
6
|
import { assert, updateType, isBaseServer, objectAssign } from './utils.js';
|
|
7
7
|
async function createPageContextClientSide(urlOriginal) {
|
|
8
8
|
const globalContext = await getGlobalContextClientInternal();
|
|
@@ -3,9 +3,11 @@ assertClientRouting();
|
|
|
3
3
|
import { initClientRouter } from './initClientRouter.js';
|
|
4
4
|
import { assertSingleInstance_onClientEntryClientRouting } from './utils.js';
|
|
5
5
|
import { removeFoucBuster } from '../shared/removeFoucBuster.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { setVirtualFileExportsGlobalEntry } from '../shared/getGlobalContextClientInternalShared.js';
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
import * as virtualFileExportsGlobalEntry from 'virtual:vike:global-entry:client:client-routing';
|
|
9
|
+
assertSingleInstance_onClientEntryClientRouting(import.meta.env.PROD);
|
|
10
|
+
setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry);
|
|
9
11
|
initClientRouter();
|
|
10
12
|
if (import.meta.env.DEV)
|
|
11
13
|
removeFoucBuster();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { getBaseServer };
|
|
2
2
|
import { assert } from '../runtime-server-routing/utils.js';
|
|
3
3
|
function getBaseServer() {
|
|
4
|
-
// @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
|
|
5
4
|
const baseServer = import.meta.env.BASE_SERVER;
|
|
6
5
|
assert(isBaseServer(baseServer));
|
|
7
6
|
return baseServer;
|
|
@@ -4,7 +4,7 @@ export type { GlobalContextClientInternal };
|
|
|
4
4
|
import type { GlobalContextBasePublic } from '../../shared/createGlobalContextShared.js';
|
|
5
5
|
type GlobalContextClient = GlobalContextBasePublic & Pick<GlobalContextClientInternal, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
|
|
6
6
|
type GlobalContextClientInternal = Awaited<ReturnType<typeof getGlobalContextClientInternal>>;
|
|
7
|
-
declare
|
|
7
|
+
declare function getGlobalContextClientInternal(): Promise<{
|
|
8
8
|
_globalConfigPublic: {
|
|
9
9
|
pages: {
|
|
10
10
|
[k: string]: {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export { getGlobalContextClientInternal };
|
|
2
|
-
import {
|
|
2
|
+
import { getGlobalContextClientInternalShared } from '../shared/getGlobalContextClientInternalShared.js';
|
|
3
3
|
import { loadPageRoutes } from '../../shared/route/loadPageRoutes.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
4
|
+
import { objectAssign } from './utils.js';
|
|
5
|
+
async function getGlobalContextClientInternal() {
|
|
6
|
+
const globalContext = await getGlobalContextClientInternalShared();
|
|
7
|
+
objectAssign(globalContext, await addGlobalContext(globalContext));
|
|
8
|
+
return globalContext;
|
|
9
|
+
}
|
|
10
|
+
// TO-DO/next-major-release make this function sync
|
|
7
11
|
async function addGlobalContext(globalContext) {
|
|
8
12
|
const { pageRoutes, onBeforeRouteHook } = await loadPageRoutes(globalContext._pageFilesAll, globalContext._pageConfigs, globalContext._pageConfigGlobal, globalContext._allPageIds);
|
|
9
13
|
return {
|
|
@@ -145,7 +145,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
|
|
|
145
145
|
isHydration: boolean;
|
|
146
146
|
isBackwardNavigation: boolean | null;
|
|
147
147
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
148
|
-
globalContext: import("./
|
|
148
|
+
globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
|
|
149
149
|
} & {
|
|
150
150
|
urlOriginal: string;
|
|
151
151
|
} & {
|
|
@@ -210,7 +210,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
|
|
|
210
210
|
isHydration: boolean;
|
|
211
211
|
isBackwardNavigation: boolean | null;
|
|
212
212
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
213
|
-
globalContext: import("./
|
|
213
|
+
globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
|
|
214
214
|
} & {
|
|
215
215
|
urlOriginal: string;
|
|
216
216
|
} & {
|
|
@@ -366,7 +366,7 @@ declare function getPageContextFromClientHooks(pageContext: {
|
|
|
366
366
|
isHydration: boolean;
|
|
367
367
|
isBackwardNavigation: boolean | null;
|
|
368
368
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
369
|
-
globalContext: import("./
|
|
369
|
+
globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
|
|
370
370
|
} & {
|
|
371
371
|
urlOriginal: string;
|
|
372
372
|
} & {
|
|
@@ -429,7 +429,7 @@ declare function getPageContextFromClientHooks(pageContext: {
|
|
|
429
429
|
isHydration: boolean;
|
|
430
430
|
isBackwardNavigation: boolean | null;
|
|
431
431
|
previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
|
|
432
|
-
globalContext: import("./
|
|
432
|
+
globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
|
|
433
433
|
} & {
|
|
434
434
|
urlOriginal: string;
|
|
435
435
|
} & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isClientSideRoutable };
|
|
2
|
-
import type { GlobalContextClientInternal } from './
|
|
2
|
+
import type { GlobalContextClientInternal } from './getGlobalContextClientInternal.js';
|
|
3
3
|
import type { PageFile } from '../../shared/getPageFiles.js';
|
|
4
4
|
declare function isClientSideRoutable(pageId: string, pageContext: {
|
|
5
5
|
_globalContext: GlobalContextClientInternal;
|
|
@@ -156,7 +156,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
|
|
|
156
156
|
isHydration: boolean;
|
|
157
157
|
isBackwardNavigation: boolean | null;
|
|
158
158
|
previousPageContext: PageContextClient<unknown> | null;
|
|
159
|
-
globalContext: import("./
|
|
159
|
+
globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
|
|
160
160
|
} & {
|
|
161
161
|
urlOriginal: string;
|
|
162
162
|
} & {
|
|
@@ -511,11 +511,9 @@ function disableClientRouting(err, log) {
|
|
|
511
511
|
// We don't use console.error() to avoid flooding error trackers such as Sentry
|
|
512
512
|
console.log(err);
|
|
513
513
|
}
|
|
514
|
-
// @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
|
|
515
|
-
const isProd = import.meta.env.PROD;
|
|
516
514
|
assertInfo(false, [
|
|
517
515
|
'Failed to fetch static asset.',
|
|
518
|
-
|
|
516
|
+
import.meta.env.PROD ? 'This usually happens when a new frontend is deployed.' : null,
|
|
519
517
|
'Falling back to Server Routing.',
|
|
520
518
|
'(The next page navigation will use Server Routing instead of Client Routing.)',
|
|
521
519
|
]
|
|
@@ -646,7 +644,7 @@ function handleErrorFetchingStaticAssets(err, pageContext, isFirstRender) {
|
|
|
646
644
|
}
|
|
647
645
|
// [HMR] If error page is shown => re-render whole page
|
|
648
646
|
if (import.meta.env.DEV && import.meta.hot)
|
|
649
|
-
import.meta.hot.on('vite:
|
|
647
|
+
import.meta.hot.on('vite:afterUpdate', () => {
|
|
650
648
|
const pageContext = globalObject.renderedPageContext;
|
|
651
649
|
if (pageContext?.pageId && isErrorPage(pageContext.pageId, pageContext._globalContext._pageConfigs)) {
|
|
652
650
|
renderPageClientSide({
|
|
@@ -54,7 +54,7 @@ declare function createPageContextClientSide(): Promise<{
|
|
|
54
54
|
_allPageIds: string[];
|
|
55
55
|
} & {
|
|
56
56
|
isClientSide: true;
|
|
57
|
-
}
|
|
57
|
+
};
|
|
58
58
|
_pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
|
|
59
59
|
isBackwardNavigation: null;
|
|
60
60
|
_hasPageContextFromServer: true;
|
|
@@ -4,7 +4,7 @@ import { getPageContextSerializedInHtml } from '../shared/getJsonSerializedInHtm
|
|
|
4
4
|
import { loadPageConfigsLazyClientSide, } from '../shared/loadPageConfigsLazyClientSide.js';
|
|
5
5
|
import { getCurrentUrl } from '../shared/getCurrentUrl.js';
|
|
6
6
|
import { createPageContextObject, createPageContextShared } from '../../shared/createPageContextShared.js';
|
|
7
|
-
import { getGlobalContextClientInternal } from './
|
|
7
|
+
import { getGlobalContextClientInternal } from './getGlobalContextClientInternal.js';
|
|
8
8
|
import { preparePageContextForPublicUsageClient, } from './preparePageContextForPublicUsageClient.js';
|
|
9
9
|
import { execHook } from '../../shared/hooks/execHook.js';
|
|
10
10
|
const urlFirst = getCurrentUrl({ withoutHash: true });
|
|
@@ -6,9 +6,11 @@ import { assertSingleInstance_onClientEntryServerRouting } from './utils.js';
|
|
|
6
6
|
import { removeFoucBuster } from '../shared/removeFoucBuster.js';
|
|
7
7
|
import { execHook } from '../../shared/hooks/execHook.js';
|
|
8
8
|
import { preparePageContextForPublicUsageClient } from './preparePageContextForPublicUsageClient.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import { setVirtualFileExportsGlobalEntry } from '../shared/getGlobalContextClientInternalShared.js';
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
import * as virtualFileExportsGlobalEntry from 'virtual:vike:global-entry:client:server-routing';
|
|
12
|
+
assertSingleInstance_onClientEntryServerRouting(import.meta.env.PROD);
|
|
13
|
+
setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry);
|
|
12
14
|
if (import.meta.env.DEV)
|
|
13
15
|
removeFoucBuster();
|
|
14
16
|
hydrate();
|
|
@@ -4,7 +4,7 @@ export type { GlobalContextClientInternalWithServerRouting };
|
|
|
4
4
|
import type { GlobalContextBasePublic } from '../../shared/createGlobalContextShared.js';
|
|
5
5
|
type GlobalContextClientWithServerRouting = GlobalContextBasePublic & Pick<GlobalContextClientInternalWithServerRouting, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
|
|
6
6
|
type GlobalContextClientInternalWithServerRouting = Awaited<ReturnType<typeof getGlobalContextClientInternal>>;
|
|
7
|
-
declare
|
|
7
|
+
declare function getGlobalContextClientInternal(): Promise<{
|
|
8
8
|
_globalConfigPublic: {
|
|
9
9
|
pages: {
|
|
10
10
|
[k: string]: {
|
|
@@ -52,4 +52,4 @@ declare const getGlobalContextClientInternal: () => Promise<{
|
|
|
52
52
|
_allPageIds: string[];
|
|
53
53
|
} & {
|
|
54
54
|
isClientSide: true;
|
|
55
|
-
}
|
|
55
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { getGlobalContextClientInternal };
|
|
2
|
+
import { getGlobalContextClientInternalShared } from '../shared/getGlobalContextClientInternalShared.js';
|
|
3
|
+
async function getGlobalContextClientInternal() {
|
|
4
|
+
const globalContext = await getGlobalContextClientInternalShared();
|
|
5
|
+
return globalContext;
|
|
6
|
+
}
|
|
@@ -2,7 +2,7 @@ export { execHookOnRenderClient };
|
|
|
2
2
|
export type { PageContextBeforeRenderClient };
|
|
3
3
|
import type { PageFile, PageContextConfig } from '../../shared/getPageFiles.js';
|
|
4
4
|
import type { PageContextForPublicUsageClientShared } from './preparePageContextForPublicUsageClientShared.js';
|
|
5
|
-
import type { GlobalContextClientInternalShared } from './
|
|
5
|
+
import type { GlobalContextClientInternalShared } from './getGlobalContextClientInternalShared.js';
|
|
6
6
|
type PageContextBeforeRenderClient = {
|
|
7
7
|
_pageFilesLoaded: PageFile[];
|
|
8
8
|
urlOriginal?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { getGlobalContext };
|
|
2
2
|
export { getGlobalContextSync };
|
|
3
|
-
export {
|
|
3
|
+
export { setVirtualFileExportsGlobalEntry };
|
|
4
|
+
export { getGlobalContextClientInternalShared };
|
|
4
5
|
export type GlobalContextClientInternalShared = GlobalContextClientInternal | GlobalContextClientInternalWithServerRouting;
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
declare function createGetGlobalContextClient<GlobalContextAddendum extends object>(virtualFileExportsGlobalEntry: unknown, isClientRouting: boolean, addGlobalContext?: (globalContext: GlobalContextBase) => Promise<GlobalContextAddendum>): () => Promise<{
|
|
6
|
+
import type { GlobalContextClientInternal } from '../runtime-client-routing/getGlobalContextClientInternal.js';
|
|
7
|
+
import type { GlobalContextClientInternalWithServerRouting } from '../runtime-server-routing/getGlobalContextClientInternal.js';
|
|
8
|
+
declare function getGlobalContextClientInternalShared(): Promise<{
|
|
9
9
|
_globalConfigPublic: {
|
|
10
10
|
pages: {
|
|
11
11
|
[k: string]: {
|
|
@@ -53,12 +53,15 @@ declare function createGetGlobalContextClient<GlobalContextAddendum extends obje
|
|
|
53
53
|
_allPageIds: string[];
|
|
54
54
|
} & {
|
|
55
55
|
/**
|
|
56
|
-
* Whether the environment is client-side
|
|
56
|
+
* Whether the environment is the client-side:
|
|
57
|
+
* - In the browser, the value is `true`.
|
|
58
|
+
* - Upon SSR and pre-rendering, the value is `false`.
|
|
57
59
|
*
|
|
58
|
-
*
|
|
60
|
+
* https://vike.dev/globalContext#isClientSide
|
|
59
61
|
*/
|
|
60
62
|
isClientSide: true;
|
|
61
|
-
}
|
|
63
|
+
}>;
|
|
62
64
|
type NeverExported = never;
|
|
63
65
|
declare function getGlobalContext(): Promise<NeverExported>;
|
|
64
66
|
declare function getGlobalContextSync(): NeverExported;
|
|
67
|
+
declare function setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry: unknown): Promise<void>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Public usage
|
|
2
|
+
export { getGlobalContext };
|
|
3
|
+
export { getGlobalContextSync };
|
|
4
|
+
export { setVirtualFileExportsGlobalEntry };
|
|
5
|
+
// Internal usage
|
|
6
|
+
export { getGlobalContextClientInternalShared };
|
|
7
|
+
import { createGlobalContextShared, getGlobalContextSyncErrMsg } from '../../shared/createGlobalContextShared.js';
|
|
8
|
+
import { getGlobalContextSerializedInHtml } from './getJsonSerializedInHtml.js';
|
|
9
|
+
import { assert, assertUsage, genPromise, getGlobalObject, objectAssign, checkType } from './utils.js';
|
|
10
|
+
const globalObject = getGlobalObject('getGlobalContextClientInternalShared.ts', (() => {
|
|
11
|
+
const { promise: globalContextInitialPromise, resolve: globalContextInitialPromiseResolve } = genPromise();
|
|
12
|
+
return {
|
|
13
|
+
globalContextInitialPromise,
|
|
14
|
+
globalContextInitialPromiseResolve,
|
|
15
|
+
};
|
|
16
|
+
})());
|
|
17
|
+
async function getGlobalContextClientInternalShared() {
|
|
18
|
+
// Get
|
|
19
|
+
if (globalObject.globalContextPromise) {
|
|
20
|
+
const globalContext = await globalObject.globalContextPromise;
|
|
21
|
+
return globalContext;
|
|
22
|
+
}
|
|
23
|
+
// Create
|
|
24
|
+
const globalContextPromise = createGlobalContextShared(globalObject.virtualFileExportsGlobalEntry, globalObject, () => {
|
|
25
|
+
const globalContextAddendum = {
|
|
26
|
+
/**
|
|
27
|
+
* Whether the environment is the client-side:
|
|
28
|
+
* - In the browser, the value is `true`.
|
|
29
|
+
* - Upon SSR and pre-rendering, the value is `false`.
|
|
30
|
+
*
|
|
31
|
+
* https://vike.dev/globalContext#isClientSide
|
|
32
|
+
*/
|
|
33
|
+
isClientSide: true,
|
|
34
|
+
};
|
|
35
|
+
objectAssign(globalContextAddendum, getGlobalContextSerializedInHtml());
|
|
36
|
+
return globalContextAddendum;
|
|
37
|
+
});
|
|
38
|
+
globalObject.globalContextPromise = globalContextPromise;
|
|
39
|
+
const globalContext = await globalContextPromise;
|
|
40
|
+
assert(globalObject.globalContext === globalContext);
|
|
41
|
+
globalObject.globalContextInitialPromiseResolve();
|
|
42
|
+
// Return
|
|
43
|
+
return globalContext;
|
|
44
|
+
}
|
|
45
|
+
async function getGlobalContext() {
|
|
46
|
+
await globalObject.globalContextInitialPromise;
|
|
47
|
+
const globalContext = await globalObject.globalContextPromise;
|
|
48
|
+
assert(globalContext);
|
|
49
|
+
checkType(globalContext);
|
|
50
|
+
return globalContext;
|
|
51
|
+
}
|
|
52
|
+
function getGlobalContextSync() {
|
|
53
|
+
const { globalContext } = globalObject;
|
|
54
|
+
assertUsage(globalContext, getGlobalContextSyncErrMsg);
|
|
55
|
+
checkType(globalContext);
|
|
56
|
+
return globalContext;
|
|
57
|
+
}
|
|
58
|
+
async function setVirtualFileExportsGlobalEntry(virtualFileExportsGlobalEntry) {
|
|
59
|
+
// HMR => virtualFileExportsGlobalEntry differ
|
|
60
|
+
if (globalObject.virtualFileExportsGlobalEntry !== virtualFileExportsGlobalEntry) {
|
|
61
|
+
delete globalObject.globalContextPromise;
|
|
62
|
+
globalObject.virtualFileExportsGlobalEntry = virtualFileExportsGlobalEntry;
|
|
63
|
+
// Eagerly call +onCreateGlobalContext() hooks
|
|
64
|
+
await getGlobalContextClientInternalShared();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -10,13 +10,11 @@ async function loadPageConfigsLazyClientSide(pageId, pageFilesAll, pageConfigs,
|
|
|
10
10
|
const pageFilesClientSide = getPageFilesClientSide(pageFilesAll, pageId);
|
|
11
11
|
const pageConfig = findPageConfig(pageConfigs, pageId);
|
|
12
12
|
let pageConfigLoaded;
|
|
13
|
-
// @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
|
|
14
|
-
const isDev = import.meta.env.DEV;
|
|
15
13
|
try {
|
|
16
14
|
// prettier-ignore
|
|
17
15
|
// biome-ignore format:
|
|
18
16
|
const result = await Promise.all([
|
|
19
|
-
pageConfig && loadAndParseVirtualFilePageEntry(pageConfig,
|
|
17
|
+
pageConfig && loadAndParseVirtualFilePageEntry(pageConfig, import.meta.env.DEV),
|
|
20
18
|
...pageFilesClientSide.map((p) => p.loadFile?.()),
|
|
21
19
|
]);
|
|
22
20
|
pageConfigLoaded = result[0];
|
|
@@ -715,12 +715,14 @@ async function prerenderRedirects(globalContext, onComplete, showWarningUponDyna
|
|
|
715
715
|
}
|
|
716
716
|
function getRedirectHtml(urlTarget) {
|
|
717
717
|
const urlTargetSafe = escapeHtml(urlTarget);
|
|
718
|
-
//
|
|
718
|
+
// - Test: /test/playground => http://localhost:3000/download
|
|
719
|
+
// - Adding `<link rel="canonical">` for SEO, see https://github.com/vikejs/vike/pull/2711
|
|
719
720
|
const htmlString = `<!DOCTYPE html>
|
|
720
721
|
<html lang="en">
|
|
721
722
|
<head>
|
|
722
723
|
<meta charset="UTF-8">
|
|
723
724
|
<meta http-equiv="refresh" content="0;url=${urlTargetSafe}">
|
|
725
|
+
<link rel="canonical" href="${urlTargetSafe}" />
|
|
724
726
|
<title>Redirect ${urlTargetSafe}</title>
|
|
725
727
|
<style>body{opacity:0}</style>
|
|
726
728
|
<noscript>
|
|
@@ -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 { getClientEntrySrcDev } from './shared/getClientEntrySrcDev.js';
|
|
8
|
+
import { setGetClientEntrySrcDev } from '../runtime/renderPage/getPageAssets/retrievePageAssetsDev.js';
|
|
7
9
|
import { assertUsage } from './utils.js';
|
|
8
|
-
import
|
|
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';
|
|
@@ -15,38 +17,55 @@ import { pluginSetGlobalContext } from './plugins/pluginSetGlobalContext.js';
|
|
|
15
17
|
import { pluginCommon } from './plugins/pluginCommon.js';
|
|
16
18
|
import { pluginBaseUrls } from './plugins/pluginBaseUrls.js';
|
|
17
19
|
import { pluginEnvVars } from './plugins/pluginEnvVars.js';
|
|
18
|
-
import pc from '@brillout/picocolors';
|
|
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 {
|
|
23
|
+
import { pluginReplaceIsClientSide } from './plugins/pluginReplaceIsClientSide.js';
|
|
24
|
+
import { pluginReplaceGlobalThisConstants } from './plugins/pluginReplaceGlobalThisConstants.js';
|
|
24
25
|
import { pluginNonRunnableDev } from './plugins/pluginNonRunnableDev.js';
|
|
25
|
-
import {
|
|
26
|
+
import { pluginBuildApp } from './plugins/pluginBuild/pluginBuildApp.js';
|
|
27
|
+
import { pluginDistPackageJsonFile } from './plugins/pluginBuild/pluginDistPackageJsonFile.js';
|
|
28
|
+
import { pluginSuppressRollupWarning } from './plugins/pluginBuild/pluginSuppressRollupWarning.js';
|
|
29
|
+
import { pluginDistFileNames } from './plugins/pluginBuild/pluginDistFileNames.js';
|
|
30
|
+
import { pluginProdBuildEntry } from './plugins/pluginBuild/pluginProdBuildEntry.js';
|
|
31
|
+
import { pluginBuildConfig } from './plugins/pluginBuild/pluginBuildConfig.js';
|
|
32
|
+
import { pluginModuleBanner } from './plugins/pluginBuild/pluginModuleBanner.js';
|
|
26
33
|
// We don't call this in ./onLoad.ts to avoid a cyclic dependency with utils.ts
|
|
27
34
|
setGetClientEntrySrcDev(getClientEntrySrcDev);
|
|
28
35
|
// Return `PluginInterop` instead of `Plugin` to avoid type mismatch upon different Vite versions
|
|
29
36
|
function plugin(vikeVitePluginOptions = {}) {
|
|
30
37
|
const plugins = [
|
|
31
38
|
...pluginCommon(vikeVitePluginOptions),
|
|
32
|
-
pluginVirtualFiles(),
|
|
39
|
+
...pluginVirtualFiles(),
|
|
33
40
|
...pluginDev(),
|
|
34
41
|
...pluginBuild(),
|
|
35
|
-
pluginPreview(),
|
|
42
|
+
...pluginPreview(),
|
|
36
43
|
...pluginExtractAssets(),
|
|
37
|
-
pluginExtractExportNames(),
|
|
44
|
+
...pluginExtractExportNames(),
|
|
38
45
|
...pluginSetGlobalContext(),
|
|
39
|
-
pluginBaseUrls(),
|
|
40
|
-
pluginEnvVars(),
|
|
41
|
-
pluginFileEnv(),
|
|
42
|
-
pluginWorkaroundCssModuleHmr(),
|
|
43
|
-
pluginWorkaroundVite6HmrRegression(),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
...pluginBaseUrls(),
|
|
47
|
+
...pluginEnvVars(),
|
|
48
|
+
...pluginFileEnv(),
|
|
49
|
+
...pluginWorkaroundCssModuleHmr(),
|
|
50
|
+
...pluginWorkaroundVite6HmrRegression(),
|
|
51
|
+
...pluginReplaceIsClientSide(),
|
|
52
|
+
...pluginReplaceGlobalThisConstants(),
|
|
53
|
+
...pluginNonRunnableDev(),
|
|
46
54
|
];
|
|
47
55
|
Object.assign(plugins, { _vikeVitePluginOptions: vikeVitePluginOptions });
|
|
48
56
|
return plugins;
|
|
49
57
|
}
|
|
58
|
+
function pluginBuild() {
|
|
59
|
+
return [
|
|
60
|
+
...pluginBuildConfig(),
|
|
61
|
+
...pluginBuildApp(),
|
|
62
|
+
...pluginProdBuildEntry(),
|
|
63
|
+
...pluginDistPackageJsonFile(),
|
|
64
|
+
...pluginSuppressRollupWarning(),
|
|
65
|
+
...pluginDistFileNames(),
|
|
66
|
+
...pluginModuleBanner(),
|
|
67
|
+
];
|
|
68
|
+
}
|
|
50
69
|
// Error upon wrong usage
|
|
51
70
|
Object.defineProperty(plugin, 'apply', {
|
|
52
71
|
enumerable: true,
|
|
@@ -4,44 +4,46 @@ import { assert } from '../utils.js';
|
|
|
4
4
|
import { getVikeConfigInternal } from '../shared/resolveVikeConfigInternal.js';
|
|
5
5
|
function pluginBaseUrls() {
|
|
6
6
|
let basesResolved;
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
name: 'vike:pluginBaseUrls',
|
|
10
|
+
enforce: 'post',
|
|
11
|
+
config: {
|
|
12
|
+
async handler(config) {
|
|
13
|
+
const isDev = config._isDev;
|
|
14
|
+
assert(typeof isDev === 'boolean');
|
|
15
|
+
const baseViteOriginal = config.base ?? '/__UNSET__'; // '/__UNSET__' because Vite resolves `_baseViteOriginal: null` to `undefined`
|
|
16
|
+
const vikeConfig = await getVikeConfigInternal();
|
|
17
|
+
basesResolved = resolveBase(baseViteOriginal, vikeConfig.config.baseServer ?? null, vikeConfig.config.baseAssets ?? null);
|
|
18
|
+
// We cannot define these in configResolved() because Vite picks up the env variables before any configResolved() hook is called
|
|
19
|
+
process.env.BASE_SERVER = basesResolved.baseServer;
|
|
20
|
+
process.env.BASE_ASSETS = basesResolved.baseAssets;
|
|
21
|
+
return {
|
|
22
|
+
envPrefix: [
|
|
23
|
+
'VITE_', // Vite doesn't seem to merge in its default, see https://github.com/vikejs/vike/issues/554
|
|
24
|
+
'BASE_SERVER',
|
|
25
|
+
'BASE_ASSETS',
|
|
26
|
+
],
|
|
27
|
+
base: basesResolved.baseAssets, // Make Vite inject baseAssets to imports e.g. `import logoUrl from './logo.svg.js'`
|
|
28
|
+
_baseViteOriginal: baseViteOriginal,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
29
31
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
configResolved: {
|
|
33
|
+
async handler(config) {
|
|
34
|
+
const vikeConfig = await getVikeConfigInternal();
|
|
35
|
+
const basesResolved2 = resolveBaseFromResolvedConfig(vikeConfig.config.baseServer ?? null, vikeConfig.config.baseAssets ?? null, config);
|
|
36
|
+
assert(basesResolved2.baseServer === basesResolved.baseServer);
|
|
37
|
+
assert(basesResolved2.baseAssets === basesResolved.baseAssets);
|
|
38
|
+
/* In dev, Vite seems buggy around setting vite.config.js#base to an absolute URL (e.g. http://localhost:8080/cdn/)
|
|
39
|
+
* - In dev, Vite removes the URL origin. (I.e. it resolves the user config `vite.config.js#base: 'http://localhost:8080/cdn/'` to resolved config `config.base === '/cdn/'`.)
|
|
40
|
+
* - Instead of having an internal Vike assertion fail, we let the user discover Vite's buggy behavior.
|
|
41
|
+
assert(config.base === baseAssets)
|
|
42
|
+
*/
|
|
43
|
+
},
|
|
42
44
|
},
|
|
43
45
|
},
|
|
44
|
-
|
|
46
|
+
];
|
|
45
47
|
}
|
|
46
48
|
function resolveBaseFromResolvedConfig(baseServer, baseAssets, config) {
|
|
47
49
|
let baseViteOriginal = config._baseViteOriginal;
|