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
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rollupIsEsm = rollupIsEsm;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
function rollupIsEsm(rollupOptions) {
|
|
6
|
-
const { format } = rollupOptions;
|
|
7
|
-
(0, utils_js_1.assert)(typeof format === 'string');
|
|
8
|
-
(0, utils_js_1.assert)(format === 'amd' ||
|
|
9
|
-
format === 'cjs' ||
|
|
10
|
-
format === 'es' ||
|
|
11
|
-
format === 'iife' ||
|
|
12
|
-
format === 'system' ||
|
|
13
|
-
format === 'umd');
|
|
14
|
-
return format === 'es';
|
|
15
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Utils needed by Vike's Vite plugin
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
// We call onLoad() here so that it's called even when only a subset of the plugin is loaded. (Making the assert() calls inside onLoad() a lot stronger.)
|
|
19
|
-
const onLoad_js_1 = require("./onLoad.js");
|
|
20
|
-
(0, onLoad_js_1.onLoad)();
|
|
21
|
-
// - Server-side bloat is negligible
|
|
22
|
-
// - The Vite plugin imports the server runtime anyways
|
|
23
|
-
__exportStar(require("../runtime/utils.js"), exports);
|
|
24
|
-
// Utils only needed by `plugin/*`
|
|
25
|
-
__exportStar(require("../../utils/requireResolve.js"), exports);
|
|
26
|
-
__exportStar(require("../../utils/includes.js"), exports);
|
|
27
|
-
__exportStar(require("../../utils/isDev.js"), exports);
|
|
28
|
-
__exportStar(require("../../utils/getMostSimilar.js"), exports);
|
|
29
|
-
__exportStar(require("../../utils/getRandomId.js"), exports);
|
|
30
|
-
__exportStar(require("../../utils/escapeRegex.js"), exports);
|
|
31
|
-
__exportStar(require("../../utils/trimWithAnsi.js"), exports);
|
|
32
|
-
__exportStar(require("../../utils/removeEmptyLines.js"), exports);
|
|
33
|
-
__exportStar(require("../../utils/findPackageJson.js"), exports);
|
|
34
|
-
__exportStar(require("../../utils/deepEqual.js"), exports);
|
|
35
|
-
__exportStar(require("../../utils/assertKeys.js"), exports);
|
|
36
|
-
__exportStar(require("../../utils/injectRollupInputs.js"), exports);
|
|
37
|
-
__exportStar(require("../../utils/pLimit.js"), exports);
|
|
38
|
-
__exportStar(require("../../utils/assertVersion.js"), exports);
|
|
39
|
-
__exportStar(require("../../utils/isFilePathAbsoluteFilesystem.js"), exports);
|
|
40
|
-
__exportStar(require("../../utils/isEqualStringList.js"), exports);
|
|
41
|
-
__exportStar(require("../../utils/isDocker.js"), exports);
|
|
42
|
-
__exportStar(require("../../utils/isVitest.js"), exports);
|
|
43
|
-
__exportStar(require("../../utils/rollupSourceMap.js"), exports);
|
|
44
|
-
__exportStar(require("../../utils/isImportPath.js"), exports);
|
|
45
|
-
__exportStar(require("../../utils/virtualFileId.js"), exports);
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "type": "commonjs" }
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RenderErrorPage = void 0;
|
|
4
|
-
// TO-DO/next-major-release: remove
|
|
5
|
-
var abort_js_1 = require("./route/abort.js");
|
|
6
|
-
Object.defineProperty(exports, "RenderErrorPage", { enumerable: true, get: function () { return abort_js_1.RenderErrorPage; } });
|
package/dist/cjs/shared/abort.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.render = exports.redirect = void 0;
|
|
4
|
-
// TO-DO/next-major-release: Move all universal imports (when using Client Routing) to:
|
|
5
|
-
// import {
|
|
6
|
-
// redirect,
|
|
7
|
-
// render,
|
|
8
|
-
// resolveRoute,
|
|
9
|
-
// navigate,
|
|
10
|
-
// prefetch,
|
|
11
|
-
// } from 'vike'
|
|
12
|
-
// Use package.json#exports to make the imports isomorphic.
|
|
13
|
-
// The client-side has no utility when using Server Routing.
|
|
14
|
-
var abort_js_1 = require("./route/abort.js");
|
|
15
|
-
Object.defineProperty(exports, "redirect", { enumerable: true, get: function () { return abort_js_1.redirect; } });
|
|
16
|
-
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return abort_js_1.render; } });
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addIs404ToPageProps = addIs404ToPageProps;
|
|
4
|
-
const utils_js_1 = require("./utils.js");
|
|
5
|
-
function addIs404ToPageProps(pageContext) {
|
|
6
|
-
addIs404(pageContext);
|
|
7
|
-
}
|
|
8
|
-
function addIs404(pageContext) {
|
|
9
|
-
if (pageContext.is404 === undefined || pageContext.is404 === null)
|
|
10
|
-
return;
|
|
11
|
-
const pageProps = pageContext.pageProps || {};
|
|
12
|
-
if (!(0, utils_js_1.isObject)(pageProps)) {
|
|
13
|
-
(0, utils_js_1.assertWarning)(false, 'pageContext.pageProps should be an object', { showStackTrace: true, onlyOnce: true });
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
pageProps.is404 = pageProps.is404 || pageContext.is404;
|
|
17
|
-
pageContext.pageProps = pageProps;
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertHookReturnedObject = assertHookReturnedObject;
|
|
4
|
-
const utils_js_1 = require("./utils.js");
|
|
5
|
-
function assertHookReturnedObject(obj, keysExpected, errPrefix) {
|
|
6
|
-
(0, utils_js_1.assert)(!errPrefix.endsWith(' '));
|
|
7
|
-
const keysUnknown = [];
|
|
8
|
-
const keys = Object.keys(obj);
|
|
9
|
-
for (const key of keys) {
|
|
10
|
-
if (!keysExpected.includes(key)) {
|
|
11
|
-
keysUnknown.push(key);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
(0, utils_js_1.assertUsage)(keysUnknown.length === 0, [
|
|
15
|
-
errPrefix,
|
|
16
|
-
'returned an object with following unknown keys:',
|
|
17
|
-
(0, utils_js_1.stringifyStringArray)(keysUnknown) + '.',
|
|
18
|
-
'Only following keys are allowed:',
|
|
19
|
-
(0, utils_js_1.stringifyStringArray)(keysExpected) + '.',
|
|
20
|
-
].join(' '));
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertOnBeforeRenderHookReturn = assertOnBeforeRenderHookReturn;
|
|
7
|
-
const utils_js_1 = require("./utils.js");
|
|
8
|
-
const assertPageContextProvidedByUser_js_1 = require("./assertPageContextProvidedByUser.js");
|
|
9
|
-
const assertHookReturnedObject_js_1 = require("./assertHookReturnedObject.js");
|
|
10
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
11
|
-
function assertOnBeforeRenderHookReturn(hookReturnValue, hookFilePath) {
|
|
12
|
-
if (hookReturnValue === undefined || hookReturnValue === null) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const errPrefix = `The onBeforeRender() hook defined by ${hookFilePath}`;
|
|
16
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.isPlainObject)(hookReturnValue), `${errPrefix} should return a plain JavaScript object, ${picocolors_1.default.cyan('undefined')}, or ${picocolors_1.default.cyan('null')}`);
|
|
17
|
-
(0, assertHookReturnedObject_js_1.assertHookReturnedObject)(hookReturnValue, ['pageContext'], errPrefix);
|
|
18
|
-
if (hookReturnValue.pageContext) {
|
|
19
|
-
(0, assertPageContextProvidedByUser_js_1.assertPageContextProvidedByUser)(hookReturnValue['pageContext'], { hookName: 'onBeforeRender', hookFilePath });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertPageContextProvidedByUser = assertPageContextProvidedByUser;
|
|
7
|
-
const utils_js_1 = require("./utils.js");
|
|
8
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
-
function assertPageContextProvidedByUser(pageContextProvidedByUser, { hookName, hookFilePath, }) {
|
|
10
|
-
if (pageContextProvidedByUser === undefined || pageContextProvidedByUser === null)
|
|
11
|
-
return;
|
|
12
|
-
(0, utils_js_1.assert)(!hookName.endsWith(')'));
|
|
13
|
-
const errPrefix = `The ${picocolors_1.default.cyan('pageContext')} object provided by the ${hookName}() hook defined by ${hookFilePath}`;
|
|
14
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(pageContextProvidedByUser), `${errPrefix} should be an object (but it's ${picocolors_1.default.cyan(`typeof pageContext === ${JSON.stringify(typeof pageContextProvidedByUser)}`)} instead)`);
|
|
15
|
-
(0, utils_js_1.assertUsage)(!('isPageContext' in pageContextProvidedByUser), `${errPrefix} shouldn't be the whole ${picocolors_1.default.cyan('pageContext')} object, see https://vike.dev/pageContext-manipulation#do-not-return-entire-pagecontext`);
|
|
16
|
-
// In principle, it's possible to use onBeforeRoute()` to override and define the whole routing.
|
|
17
|
-
// Is that a good idea to allow users to do this? Beyond deep integration with Vue Router or React Router, is there a use case for this?
|
|
18
|
-
(0, utils_js_1.assertWarning)(!('pageId' in pageContextProvidedByUser), `${errPrefix} sets ${picocolors_1.default.cyan('pageContext.pageId')} which means that Vike's routing is overridden. This is an experimental feature: make sure to contact a vike maintainer before using this.`, { onlyOnce: true });
|
|
19
|
-
(0, utils_js_1.assertUsage)(!('is404' in pageContextProvidedByUser), `${errPrefix} sets ${picocolors_1.default.cyan('pageContext.is404')} which is forbidden, use ${picocolors_1.default.cyan('throw render()')} instead, see https://vike.dev/render`);
|
|
20
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGlobalContextSyncErrMsg = void 0;
|
|
4
|
-
exports.createGlobalContextShared = createGlobalContextShared;
|
|
5
|
-
const utils_js_1 = require("./utils.js");
|
|
6
|
-
const parseVirtualFileExportsGlobalEntry_js_1 = require("./getPageFiles/parseVirtualFileExportsGlobalEntry.js");
|
|
7
|
-
const resolveVikeConfigPublic_js_1 = require("./page-configs/resolveVikeConfigPublic.js");
|
|
8
|
-
const execHook_js_1 = require("./hooks/execHook.js");
|
|
9
|
-
const prepareGlobalContextForPublicUsage_js_1 = require("./prepareGlobalContextForPublicUsage.js");
|
|
10
|
-
const getHook_js_1 = require("./hooks/getHook.js");
|
|
11
|
-
const getGlobalContextSyncErrMsg = "The global context isn't set yet, call getGlobalContextSync() later or use getGlobalContext() instead.";
|
|
12
|
-
exports.getGlobalContextSyncErrMsg = getGlobalContextSyncErrMsg;
|
|
13
|
-
// TO-DO/eventually use flat globalContext — like flat pageContext
|
|
14
|
-
async function createGlobalContextShared(virtualFileExportsGlobalEntry, globalObject, addGlobalContext,
|
|
15
|
-
// TO-DO/next-major-release: we'll be able to remove addGlobalContextTmp after loadPageRoutes() is sync (it will be sync after we remove the old design)
|
|
16
|
-
addGlobalContextTmp, addGlobalContextAsync) {
|
|
17
|
-
const { previousCreateGlobalContextPromise } = globalObject;
|
|
18
|
-
const { promise, resolve } = (0, utils_js_1.genPromise)({
|
|
19
|
-
// Avoid this Cloudflare Worker error:
|
|
20
|
-
// ```console
|
|
21
|
-
// Error: Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler.
|
|
22
|
-
// ```
|
|
23
|
-
timeout: null,
|
|
24
|
-
});
|
|
25
|
-
globalObject.previousCreateGlobalContextPromise = promise;
|
|
26
|
-
if (previousCreateGlobalContextPromise) {
|
|
27
|
-
(0, utils_js_1.assert)(globalObject.globalContext);
|
|
28
|
-
await previousCreateGlobalContextPromise;
|
|
29
|
-
}
|
|
30
|
-
const globalContext = createGlobalContextBase(virtualFileExportsGlobalEntry);
|
|
31
|
-
let isNewGlobalContext;
|
|
32
|
-
if (!globalObject.globalContext) {
|
|
33
|
-
// We set globalObject.globalContext early and before any async operations, so that getGlobalContextSync() can be used early.
|
|
34
|
-
// - Required by vike-vercel
|
|
35
|
-
globalObject.globalContext = globalContext;
|
|
36
|
-
isNewGlobalContext = false;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
isNewGlobalContext = true;
|
|
40
|
-
}
|
|
41
|
-
if (addGlobalContext &&
|
|
42
|
-
// TO-DO/next-major-release: remove
|
|
43
|
-
globalContext._pageConfigs.length > 0) {
|
|
44
|
-
const globalContextAdded = addGlobalContext?.(globalContext);
|
|
45
|
-
(0, utils_js_1.objectAssign)(globalContext, globalContextAdded);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
const globalContextAdded = await addGlobalContextTmp?.(globalContext);
|
|
49
|
-
(0, utils_js_1.objectAssign)(globalContext, globalContextAdded);
|
|
50
|
-
}
|
|
51
|
-
{
|
|
52
|
-
const globalContextAddedAsync = await addGlobalContextAsync?.(globalContext);
|
|
53
|
-
(0, utils_js_1.objectAssign)(globalContext, globalContextAddedAsync);
|
|
54
|
-
}
|
|
55
|
-
const onCreateGlobalContextHooks = (0, getHook_js_1.getHookFromPageConfigGlobalCumulative)(globalContext._pageConfigGlobal, 'onCreateGlobalContext');
|
|
56
|
-
let hooksCalled = false;
|
|
57
|
-
if (!hooksAreEqual(globalObject.onCreateGlobalContextHooks ?? [], onCreateGlobalContextHooks)) {
|
|
58
|
-
globalObject.onCreateGlobalContextHooks = onCreateGlobalContextHooks;
|
|
59
|
-
await (0, execHook_js_1.execHookGlobal)('onCreateGlobalContext', globalContext._pageConfigGlobal, null, globalContext, prepareGlobalContextForPublicUsage_js_1.prepareGlobalContextForPublicUsage);
|
|
60
|
-
hooksCalled = true;
|
|
61
|
-
}
|
|
62
|
-
if (isNewGlobalContext) {
|
|
63
|
-
// Singleton: ensure all `globalContext` user-land references are preserved & updated.
|
|
64
|
-
if (hooksCalled) {
|
|
65
|
-
(0, utils_js_1.objectReplace)(globalObject.globalContext, globalContext);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
// We don't use objectReplace() in order to keep user-land properties.
|
|
69
|
-
(0, utils_js_1.objectAssign)(globalObject.globalContext, globalContext, true);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
resolve();
|
|
73
|
-
return globalObject.globalContext;
|
|
74
|
-
}
|
|
75
|
-
function createGlobalContextBase(virtualFileExportsGlobalEntry) {
|
|
76
|
-
const { pageFilesAll, pageConfigs, pageConfigGlobal } = (0, parseVirtualFileExportsGlobalEntry_js_1.parseVirtualFileExportsGlobalEntry)(virtualFileExportsGlobalEntry);
|
|
77
|
-
const allPageIds = getAllPageIds(pageFilesAll, pageConfigs);
|
|
78
|
-
const globalContextAddendum = (0, resolveVikeConfigPublic_js_1.resolveGlobalContextConfig)(pageConfigs, pageConfigGlobal);
|
|
79
|
-
const globalContext = {
|
|
80
|
-
/**
|
|
81
|
-
* Useful for distinguishing `globalContext` from other objects and narrowing down TypeScript unions.
|
|
82
|
-
*
|
|
83
|
-
* https://vike.dev/globalContext#typescript
|
|
84
|
-
*/
|
|
85
|
-
isGlobalContext: true,
|
|
86
|
-
_isOriginalObject: true,
|
|
87
|
-
_virtualFileExportsGlobalEntry: virtualFileExportsGlobalEntry,
|
|
88
|
-
_pageFilesAll: pageFilesAll,
|
|
89
|
-
_pageConfigs: pageConfigs,
|
|
90
|
-
_pageConfigGlobal: pageConfigGlobal,
|
|
91
|
-
_allPageIds: allPageIds,
|
|
92
|
-
...globalContextAddendum,
|
|
93
|
-
};
|
|
94
|
-
(0, utils_js_1.changeEnumerable)(globalContext, '_isOriginalObject', false);
|
|
95
|
-
return globalContext;
|
|
96
|
-
}
|
|
97
|
-
function getAllPageIds(pageFilesAll, pageConfigs) {
|
|
98
|
-
const fileIds = pageFilesAll.filter(({ isDefaultPageFile }) => !isDefaultPageFile).map(({ pageId }) => pageId);
|
|
99
|
-
const allPageIds = (0, utils_js_1.unique)(fileIds);
|
|
100
|
-
const allPageIds2 = pageConfigs.map((p) => p.pageId);
|
|
101
|
-
return [...allPageIds, ...allPageIds2];
|
|
102
|
-
}
|
|
103
|
-
function hooksAreEqual(hooks1, hooks2) {
|
|
104
|
-
const hooksFn1 = hooks1.map((hook) => hook.hookFn);
|
|
105
|
-
const hooksFn2 = hooks2.map((hook) => hook.hookFn);
|
|
106
|
-
return (hooksFn1.every((hook) => hooksFn2.includes(hook)) &&
|
|
107
|
-
//
|
|
108
|
-
hooksFn2.every((hook) => hooksFn1.includes(hook)));
|
|
109
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPageContextShared = createPageContextShared;
|
|
4
|
-
exports.createPageContextObject = createPageContextObject;
|
|
5
|
-
const utils_js_1 = require("./utils.js");
|
|
6
|
-
function createPageContextShared(pageContextCreated, globalConfigPublic) {
|
|
7
|
-
(0, utils_js_1.objectAssign)(pageContextCreated, globalConfigPublic);
|
|
8
|
-
return pageContextCreated;
|
|
9
|
-
}
|
|
10
|
-
function createPageContextObject() {
|
|
11
|
-
const pageContext = {
|
|
12
|
-
_isOriginalObject: true,
|
|
13
|
-
isPageContext: true,
|
|
14
|
-
};
|
|
15
|
-
(0, utils_js_1.changeEnumerable)(pageContext, '_isOriginalObject', false);
|
|
16
|
-
return pageContext;
|
|
17
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.determinePageIdOld = determinePageIdOld;
|
|
4
|
-
const utils_js_1 = require("./utils.js");
|
|
5
|
-
// TO-DO/next-major-release: remove
|
|
6
|
-
function determinePageIdOld(filePath) {
|
|
7
|
-
const pageSuffix = '.page.';
|
|
8
|
-
const pageId = (0, utils_js_1.slice)(filePath.split(pageSuffix), 0, -1).join(pageSuffix);
|
|
9
|
-
(0, utils_js_1.assert)(!pageId.includes('\\'));
|
|
10
|
-
return pageId;
|
|
11
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getErrorPageId = getErrorPageId;
|
|
4
|
-
exports.isErrorPageId = isErrorPageId;
|
|
5
|
-
exports.isErrorPage = isErrorPage;
|
|
6
|
-
// TO-DO/next-major-release: consider loading this file only for Client Routing
|
|
7
|
-
const utils_js_1 = require("./utils.js");
|
|
8
|
-
function getErrorPageId(pageFilesAll, pageConfigs) {
|
|
9
|
-
if (pageConfigs.length > 0) {
|
|
10
|
-
const errorPageConfigs = pageConfigs.filter((p) => p.isErrorPage);
|
|
11
|
-
if (errorPageConfigs.length === 0)
|
|
12
|
-
return null;
|
|
13
|
-
(0, utils_js_1.assertUsage)(errorPageConfigs.length === 1, 'Only one error page can be defined');
|
|
14
|
-
return errorPageConfigs[0].pageId;
|
|
15
|
-
}
|
|
16
|
-
// TO-DO/next-major-release: remove
|
|
17
|
-
const errorPageIds = (0, utils_js_1.unique)(pageFilesAll.map(({ pageId }) => pageId).filter((pageId) => isErrorPageId(pageId, false)));
|
|
18
|
-
(0, utils_js_1.assertUsage)(errorPageIds.length <= 1, `Only one _error.page.js is allowed, but found several: ${errorPageIds.join(' ')}`);
|
|
19
|
-
if (errorPageIds.length > 0) {
|
|
20
|
-
const errorPageId = errorPageIds[0];
|
|
21
|
-
(0, utils_js_1.assert)(errorPageId);
|
|
22
|
-
return errorPageId;
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
// TO-DO/next-major-release: remove
|
|
27
|
-
function isErrorPageId(pageId, _isV1Design) {
|
|
28
|
-
(0, utils_js_1.assert)(!pageId.includes('\\'));
|
|
29
|
-
return pageId.includes('/_error');
|
|
30
|
-
}
|
|
31
|
-
function isErrorPage(pageId, pageConfigs) {
|
|
32
|
-
if (pageConfigs.length > 0) {
|
|
33
|
-
const pageConfig = pageConfigs.find((p) => p.pageId === pageId);
|
|
34
|
-
(0, utils_js_1.assert)(pageConfig);
|
|
35
|
-
return !!pageConfig.isErrorPage;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
return isErrorPageId(pageId, false);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.providePageContext = exports.getPageContext = void 0;
|
|
4
|
-
var execHook_js_1 = require("./hooks/execHook.js");
|
|
5
|
-
Object.defineProperty(exports, "getPageContext", { enumerable: true, get: function () { return execHook_js_1.getPageContext; } });
|
|
6
|
-
Object.defineProperty(exports, "providePageContext", { enumerable: true, get: function () { return execHook_js_1.providePageContext; } });
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.doNotCreateExtraDirectory = exports.pageContextJsonFileExtension = void 0;
|
|
4
|
-
exports.getPageContextRequestUrl = getPageContextRequestUrl;
|
|
5
|
-
// This module isn't loaded by the client-side of Server Routing => we don't include `urlToFile` to `./utils.ts`
|
|
6
|
-
const urlToFile_js_1 = require("../utils/urlToFile.js");
|
|
7
|
-
const pageContextJsonFileExtension = '.pageContext.json';
|
|
8
|
-
exports.pageContextJsonFileExtension = pageContextJsonFileExtension;
|
|
9
|
-
// `/some-base-url/index.pageContext.json` instead of `/some-base-url.pageContext.json` in order to comply to common reverse proxy setups, see https://github.com/vikejs/vike/issues/443
|
|
10
|
-
const doNotCreateExtraDirectory = false;
|
|
11
|
-
exports.doNotCreateExtraDirectory = doNotCreateExtraDirectory;
|
|
12
|
-
// See also node/renderPage/handlePageContextRequestUrl.ts
|
|
13
|
-
function getPageContextRequestUrl(url) {
|
|
14
|
-
const pageContextRequestUrl = (0, urlToFile_js_1.urlToFile)(url, pageContextJsonFileExtension, doNotCreateExtraDirectory);
|
|
15
|
-
return pageContextRequestUrl;
|
|
16
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPageContextUrlComputed = getPageContextUrlComputed;
|
|
4
|
-
// =====================
|
|
5
|
-
// File determining the URL logic.
|
|
6
|
-
// URLs need to be computed, because the user can modify the URL e.g. with onBeforeRoute() for i18n.
|
|
7
|
-
// =====================
|
|
8
|
-
const objectDefineProperty_js_1 = require("../utils/objectDefineProperty.js");
|
|
9
|
-
const preparePageContextForPublicUsage_js_1 = require("./preparePageContextForPublicUsage.js");
|
|
10
|
-
const utils_js_1 = require("./utils.js");
|
|
11
|
-
function getPageContextUrlComputed(pageContext) {
|
|
12
|
-
(0, utils_js_1.assert)(typeof pageContext.urlOriginal === 'string');
|
|
13
|
-
(0, preparePageContextForPublicUsage_js_1.assertPropertyGetters)(pageContext);
|
|
14
|
-
const pageContextUrlComputed = {};
|
|
15
|
-
(0, objectDefineProperty_js_1.objectDefineProperty)(pageContextUrlComputed, 'urlPathname', {
|
|
16
|
-
get: urlPathnameGetter,
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
});
|
|
20
|
-
(0, objectDefineProperty_js_1.objectDefineProperty)(pageContextUrlComputed, 'url', {
|
|
21
|
-
get: urlGetter,
|
|
22
|
-
enumerable: false,
|
|
23
|
-
configurable: true,
|
|
24
|
-
});
|
|
25
|
-
(0, objectDefineProperty_js_1.objectDefineProperty)(pageContextUrlComputed, 'urlParsed', {
|
|
26
|
-
get: urlParsedGetter,
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
});
|
|
30
|
-
return pageContextUrlComputed;
|
|
31
|
-
}
|
|
32
|
-
function getUrlParsed(pageContext) {
|
|
33
|
-
// Example of i18n app using `throw render()`:
|
|
34
|
-
// 1. User goes to '/fr-FR/admin'.
|
|
35
|
-
// 2. The first onBeforeRoute() call accesses pageContext.urlPathname (its value is '/fr-FR/admin': the pathname of pageContext.urlOriginal, since both pageContext.urlLogical and pageContext._urlRewrite are undefined) and sets pageContext.urlLogical to '/admin'.
|
|
36
|
-
// 3. A guard() hooks accesses pageContext.urlPathname (its value is '/admin': the pathname of pageContext.urlLogical) and calls `throw render('/fr-FR/login')`
|
|
37
|
-
// 4. Vike create a new pageContext object (pageContext.urlLogical is erased) and sets pageContext._urlRewrite to '/fr-FR/login'. (While pageContext.urlOriginal is still '/fr-FR/admin'.)
|
|
38
|
-
// 5. The second onBeforeRoute() call accesses pageContext.urlPathname (its value is '/fr-FR/login': the pathname of pageContext._urlRewrite, since pageContext.urlLogical is undefined) and sets pageContext.urlLogical to '/login'.
|
|
39
|
-
// 6. The value of pageContext.urlPathname is now '/login': the pathname of `pageContext.urlLogical`. (While pageContext.urlOriginal is still '/fr-FR/admin'.)
|
|
40
|
-
// Reproduction: https://github.com/vikejs/vike/discussions/1436#discussioncomment-8142023
|
|
41
|
-
// Determine logical URL
|
|
42
|
-
const assertUrlResolved = (src) => (0, utils_js_1.assert)(typeof urlResolved === 'string',
|
|
43
|
-
// TO-DO/eventually: remove debug logs, see:
|
|
44
|
-
// - https://github.com/vikejs/vike/issues/2138#issuecomment-2631713411
|
|
45
|
-
// - https://github.com/vikejs/vike/commit/5c7810f3080ab62536950f26e019bb2a3a517082
|
|
46
|
-
{ src, urlResolved });
|
|
47
|
-
let urlResolved;
|
|
48
|
-
let isBaseToBeRemoved;
|
|
49
|
-
if (pageContext.urlLogical) {
|
|
50
|
-
// Set by onBeforeRoute()
|
|
51
|
-
urlResolved = pageContext.urlLogical;
|
|
52
|
-
isBaseToBeRemoved = false;
|
|
53
|
-
assertUrlResolved(1);
|
|
54
|
-
}
|
|
55
|
-
else if (pageContext._urlRewrite) {
|
|
56
|
-
// Set by `throw render()`
|
|
57
|
-
urlResolved = pageContext._urlRewrite;
|
|
58
|
-
isBaseToBeRemoved = false;
|
|
59
|
-
assertUrlResolved(2);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
// Set by renderPage()
|
|
63
|
-
urlResolved = pageContext.urlOriginal;
|
|
64
|
-
isBaseToBeRemoved = true;
|
|
65
|
-
assertUrlResolved(3);
|
|
66
|
-
}
|
|
67
|
-
assertUrlResolved(4);
|
|
68
|
-
// Remove .pageContext.json
|
|
69
|
-
let urlHandler = pageContext._urlHandler;
|
|
70
|
-
if (!urlHandler)
|
|
71
|
-
urlHandler = (url) => url;
|
|
72
|
-
urlResolved = urlHandler(urlResolved);
|
|
73
|
-
// Remove Base URL.
|
|
74
|
-
// - We assume there isn't any Base URL to the URLs set by the user at `throw render()` and onBeforeRoute()
|
|
75
|
-
// - This makes sense because the Base URL is merely a setting: ideally the user should write code that doesn't know anything about it (so that the user can remove/add/change Base URL without having to modify any code).
|
|
76
|
-
// - pageContext.urlOriginal is the URL of the HTTP request and thus contains the Base URL.
|
|
77
|
-
const baseServer = !isBaseToBeRemoved ? '/' : pageContext._baseServer;
|
|
78
|
-
// Parse URL
|
|
79
|
-
return (0, utils_js_1.parseUrl)(urlResolved, baseServer);
|
|
80
|
-
}
|
|
81
|
-
function urlPathnameGetter() {
|
|
82
|
-
const { pathname } = getUrlParsed(this);
|
|
83
|
-
const urlPathname = pathname;
|
|
84
|
-
(0, utils_js_1.assert)(urlPathname.startsWith('/'));
|
|
85
|
-
return urlPathname;
|
|
86
|
-
}
|
|
87
|
-
function urlGetter() {
|
|
88
|
-
// TO-DO/next-major-release: remove
|
|
89
|
-
(0, utils_js_1.assertWarning)(false, '`pageContext.url` is outdated. Use `pageContext.urlPathname`, `pageContext.urlParsed`, or `pageContext.urlOriginal` instead. (See https://vike.dev/migration/0.4.23 for more information.)', { onlyOnce: true, showStackTrace: true });
|
|
90
|
-
return urlPathnameGetter.call(this);
|
|
91
|
-
}
|
|
92
|
-
function urlParsedGetter() {
|
|
93
|
-
const {
|
|
94
|
-
// remove isBaseMissing as it isn't part of UrlPublic
|
|
95
|
-
isBaseMissing: _, ...urlParsed } = getUrlParsed(this);
|
|
96
|
-
const hashIsAvailable = (0, utils_js_1.isBrowser)();
|
|
97
|
-
const warnHashNotAvailable = (prop) => {
|
|
98
|
-
(0, utils_js_1.assertWarning)(hashIsAvailable, `pageContext.urlParsed.${prop} isn't available on the server-side (HTTP requests don't include the URL hash)`, { onlyOnce: true, showStackTrace: true });
|
|
99
|
-
};
|
|
100
|
-
const urlParsedEnhanced = {
|
|
101
|
-
...urlParsed,
|
|
102
|
-
get hash() {
|
|
103
|
-
warnHashNotAvailable('hash');
|
|
104
|
-
return urlParsed.hash;
|
|
105
|
-
},
|
|
106
|
-
get hashOriginal() {
|
|
107
|
-
warnHashNotAvailable('hashOriginal');
|
|
108
|
-
return urlParsed.hashOriginal;
|
|
109
|
-
},
|
|
110
|
-
// TO-DO/next-major-release: remove
|
|
111
|
-
get hashString() {
|
|
112
|
-
(0, utils_js_1.assertWarning)(false, 'pageContext.urlParsed.hashString has been renamed to pageContext.urlParsed.hashOriginal', {
|
|
113
|
-
onlyOnce: true,
|
|
114
|
-
showStackTrace: true,
|
|
115
|
-
});
|
|
116
|
-
warnHashNotAvailable('hashString');
|
|
117
|
-
return urlParsed.hashOriginal;
|
|
118
|
-
},
|
|
119
|
-
// TO-DO/next-major-release: remove
|
|
120
|
-
get searchString() {
|
|
121
|
-
(0, utils_js_1.assertWarning)(false, 'pageContext.urlParsed.searchString has been renamed to pageContext.urlParsed.searchOriginal', { onlyOnce: true, showStackTrace: true });
|
|
122
|
-
return urlParsed.searchOriginal;
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
(0, utils_js_1.changeEnumerable)(urlParsedEnhanced, 'hashString', false);
|
|
126
|
-
(0, utils_js_1.changeEnumerable)(urlParsedEnhanced, 'searchString', false);
|
|
127
|
-
if (!hashIsAvailable) {
|
|
128
|
-
(0, utils_js_1.changeEnumerable)(urlParsedEnhanced, 'hash', false);
|
|
129
|
-
(0, utils_js_1.changeEnumerable)(urlParsedEnhanced, 'hashOriginal', false);
|
|
130
|
-
}
|
|
131
|
-
return urlParsedEnhanced;
|
|
132
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.analyzeClientSide = analyzeClientSide;
|
|
4
|
-
const getConfigValueRuntime_js_1 = require("../page-configs/getConfigValueRuntime.js");
|
|
5
|
-
const analyzePageClientSide_js_1 = require("./analyzePageClientSide.js");
|
|
6
|
-
function analyzeClientSide(pageConfig, pageFilesAll, pageId) {
|
|
7
|
-
// V1 design
|
|
8
|
-
if (pageConfig) {
|
|
9
|
-
const isClientRouting = (0, getConfigValueRuntime_js_1.getConfigValueRuntime)(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
10
|
-
const isClientRuntimeLoaded = (0, getConfigValueRuntime_js_1.getConfigValueRuntime)(pageConfig, 'isClientRuntimeLoaded', 'boolean')?.value ?? false;
|
|
11
|
-
return { isClientRuntimeLoaded, isClientRouting };
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
// TO-DO/next-major-release: remove
|
|
15
|
-
// V0.4 design
|
|
16
|
-
const { isHtmlOnly, isClientRouting } = (0, analyzePageClientSide_js_1.analyzePageClientSide)(pageFilesAll, pageId);
|
|
17
|
-
return { isClientRuntimeLoaded: !isHtmlOnly, isClientRouting };
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.analyzeExports = analyzeExports;
|
|
4
|
-
const getExportNames_js_1 = require("./getExportNames.js");
|
|
5
|
-
const utils_js_1 = require("../../utils.js");
|
|
6
|
-
// TO-DO/next-major-release: remove
|
|
7
|
-
function analyzeExports({ pageFilesClientSide, pageFilesServerSide, pageId, }) {
|
|
8
|
-
return { isHtmlOnly: isHtmlOnly(), isClientRouting: isClientRouting() };
|
|
9
|
-
function isHtmlOnly() {
|
|
10
|
-
{
|
|
11
|
-
const hasPageIdIsmrphFile = pageFilesServerSide.some((p) => p.pageId === pageId && p.fileType === '.page');
|
|
12
|
-
if (hasPageIdIsmrphFile) {
|
|
13
|
-
assertClientSideRenderHook();
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
{
|
|
18
|
-
const hasPageIdServerFile = pageFilesServerSide.some((p) => p.pageId === pageId && p.fileType === '.page.server');
|
|
19
|
-
if (!hasPageIdServerFile) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
{
|
|
24
|
-
const definesClientRenderer = pageFilesClientSide.some((p) => p.pageId === pageId && p.fileType === '.page.client' && (0, getExportNames_js_1.getExportNames)(p).includes('render'));
|
|
25
|
-
if (definesClientRenderer) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
function assertClientSideRenderHook() {
|
|
32
|
-
const hasClientSideRenderHook = pageFilesClientSide.some((p) => {
|
|
33
|
-
return (0, getExportNames_js_1.getExportNames)(p).includes('render');
|
|
34
|
-
});
|
|
35
|
-
(0, utils_js_1.assertUsage)(hasClientSideRenderHook, [
|
|
36
|
-
'No client-side `render()` hook found.',
|
|
37
|
-
'See https://vike.dev/render-modes for more information.',
|
|
38
|
-
[
|
|
39
|
-
'Loaded client-side page files (none of them `export { render }`):',
|
|
40
|
-
...pageFilesClientSide.map((p, i) => ` (${i + 1}): ${p.filePath}`),
|
|
41
|
-
].join('\n'),
|
|
42
|
-
].join(' '));
|
|
43
|
-
}
|
|
44
|
-
function isClientRouting() {
|
|
45
|
-
const hasClientRoutingExport = pageFilesClientSide.some((p) => {
|
|
46
|
-
return (0, getExportNames_js_1.getExportNames)(p).includes('clientRouting');
|
|
47
|
-
});
|
|
48
|
-
return hasClientRoutingExport;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// TO-DO/next-major-release: remove
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.determineClientEntry = determineClientEntry;
|
|
5
|
-
exports.getVikeClientEntry = getVikeClientEntry;
|
|
6
|
-
function determineClientEntry({ pageFilesClientSide, pageFilesServerSide, isHtmlOnly, isClientRouting, }) {
|
|
7
|
-
let clientEntries = [];
|
|
8
|
-
const pageFilesServerSideOnly = pageFilesServerSide.filter((p) => !pageFilesClientSide.includes(p));
|
|
9
|
-
const clientDependencies = [];
|
|
10
|
-
clientDependencies.push(...pageFilesClientSide.map((p) => ({ id: p.filePath, onlyAssets: false, eagerlyImported: false })));
|
|
11
|
-
// CSS & assets
|
|
12
|
-
clientDependencies.push(...pageFilesServerSideOnly.map((p) => ({ id: p.filePath, onlyAssets: true, eagerlyImported: false })));
|
|
13
|
-
// Handle SPA & SSR pages.
|
|
14
|
-
if (isHtmlOnly) {
|
|
15
|
-
clientEntries = pageFilesClientSide.map((p) => p.filePath);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
// Add the vike client entry
|
|
19
|
-
const clientEntry = getVikeClientEntry(isClientRouting);
|
|
20
|
-
clientDependencies.push({ id: clientEntry, onlyAssets: false, eagerlyImported: false });
|
|
21
|
-
clientEntries = [clientEntry];
|
|
22
|
-
}
|
|
23
|
-
// console.log(pageFilesClientSide, pageFilesServerSide, clientDependencies, clientEntry)
|
|
24
|
-
return { clientEntries, clientDependencies };
|
|
25
|
-
}
|
|
26
|
-
function getVikeClientEntry(isClientRouting) {
|
|
27
|
-
return isClientRouting
|
|
28
|
-
? '@@vike/dist/esm/client/runtime-client-routing/entry.js'
|
|
29
|
-
: '@@vike/dist/esm/client/runtime-server-routing/entry.js';
|
|
30
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExportNames = getExportNames;
|
|
4
|
-
const utils_js_1 = require("../../utils.js");
|
|
5
|
-
function getExportNames(p) {
|
|
6
|
-
if (p.fileType === '.css') {
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
if (p.exportNames) {
|
|
10
|
-
return p.exportNames;
|
|
11
|
-
}
|
|
12
|
-
(0, utils_js_1.assert)(p.fileExports, p.filePath);
|
|
13
|
-
const exportNames = Object.keys(p.fileExports);
|
|
14
|
-
return exportNames;
|
|
15
|
-
}
|