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
package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js
DELETED
|
@@ -1,190 +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.generateVirtualFileGlobalEntryWithOldDesign = generateVirtualFileGlobalEntryWithOldDesign;
|
|
7
|
-
const utils_js_1 = require("../../utils.js");
|
|
8
|
-
const virtualFileId_js_1 = require("../../../shared/virtualFileId.js");
|
|
9
|
-
const vite_1 = require("vite");
|
|
10
|
-
const fileTypes_js_1 = require("../../../../shared/getPageFiles/fileTypes.js");
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const generateVirtualFileGlobalEntry_js_1 = require("./generateVirtualFileGlobalEntry.js");
|
|
13
|
-
const resolveVikeConfigInternal_js_1 = require("../../shared/resolveVikeConfigInternal.js");
|
|
14
|
-
const getOutDirs_js_1 = require("../../shared/getOutDirs.js");
|
|
15
|
-
const isViteServerSide_js_1 = require("../../shared/isViteServerSide.js");
|
|
16
|
-
const retrievePageAssetsProd_js_1 = require("../../../runtime/renderPage/getPageAssets/retrievePageAssetsProd.js");
|
|
17
|
-
async function generateVirtualFileGlobalEntryWithOldDesign(id, options, config, env, isDev) {
|
|
18
|
-
const idParsed = (0, virtualFileId_js_1.parseVirtualFileId)(id);
|
|
19
|
-
(0, utils_js_1.assert)(idParsed && idParsed.type === 'global-entry');
|
|
20
|
-
const { isForClientSide, isClientRouting } = idParsed;
|
|
21
|
-
(0, utils_js_1.assert)(isForClientSide === !(0, isViteServerSide_js_1.isViteServerSide_extraSafe)(config, env, options));
|
|
22
|
-
const code = await getCode(config, isForClientSide, isClientRouting, isDev, id);
|
|
23
|
-
return code;
|
|
24
|
-
}
|
|
25
|
-
async function getCode(config, isForClientSide, isClientRouting, isDev, id) {
|
|
26
|
-
const { command } = config;
|
|
27
|
-
(0, utils_js_1.assert)(command === 'serve' || command === 'build');
|
|
28
|
-
const isBuild = command === 'build';
|
|
29
|
-
(0, utils_js_1.assert)(isDev === !isBuild);
|
|
30
|
-
let content = '';
|
|
31
|
-
{
|
|
32
|
-
const globRoots = getGlobRoots(config);
|
|
33
|
-
(0, utils_js_1.debugGlob)('Glob roots: ', globRoots);
|
|
34
|
-
content += await generateGlobImports(globRoots, isBuild, isForClientSide, isClientRouting, isDev, id);
|
|
35
|
-
}
|
|
36
|
-
(0, utils_js_1.debugGlob)(`Glob imports for ${isForClientSide ? 'client' : 'server'}:\n`, content);
|
|
37
|
-
return content;
|
|
38
|
-
}
|
|
39
|
-
function determineInjection({ fileType, isForClientSide, isClientRouting, isPrerendering, isBuild, }) {
|
|
40
|
-
if (!isForClientSide) {
|
|
41
|
-
return {
|
|
42
|
-
includeImport: fileType === '.page.server' || fileType === '.page' || fileType === '.page.route',
|
|
43
|
-
includeExportNames: isPrerendering && isBuild
|
|
44
|
-
? fileType === '.page.client' || fileType === '.page.server' || fileType === '.page' // We extensively use `PageFile['exportNames']` while pre-rendering, in order to avoid loading page files unnecessarily, and therefore reducing memory usage.
|
|
45
|
-
: fileType === '.page.client',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
const includeImport = fileType === '.page.client' || fileType === '.css' || fileType === '.page';
|
|
50
|
-
if (!isClientRouting) {
|
|
51
|
-
return {
|
|
52
|
-
includeImport,
|
|
53
|
-
includeExportNames: false,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return {
|
|
58
|
-
includeImport: includeImport || fileType === '.page.route',
|
|
59
|
-
includeExportNames: fileType === '.page.client' || fileType === '.page.server' || fileType === '.page',
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function generateGlobImports(globRoots, isBuild, isForClientSide, isClientRouting, isDev, id) {
|
|
65
|
-
let fileContent = `// Generated by Vike
|
|
66
|
-
|
|
67
|
-
export const pageFilesLazy = {};
|
|
68
|
-
export const pageFilesEager = {};
|
|
69
|
-
export const pageFilesExportNamesLazy = {};
|
|
70
|
-
export const pageFilesExportNamesEager = {};
|
|
71
|
-
export const pageFilesList = [];
|
|
72
|
-
export const neverLoaded = {};
|
|
73
|
-
|
|
74
|
-
${await (0, generateVirtualFileGlobalEntry_js_1.generateVirtualFileGlobalEntry)(isForClientSide, isDev, id, isClientRouting)}
|
|
75
|
-
|
|
76
|
-
`;
|
|
77
|
-
// We still use import.meta.glob() when using th V1 design in order to not break the V1 design deprecation warning
|
|
78
|
-
const isV1Design = (0, resolveVikeConfigInternal_js_1.isV1Design)();
|
|
79
|
-
const vikeConfig = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternal)();
|
|
80
|
-
// Old design => no + files => only to enable pre-rendering is setting `vike({prerender})` in vite.config.js
|
|
81
|
-
const isPrerendering = !!vikeConfig.config.prerender;
|
|
82
|
-
fileTypes_js_1.fileTypes
|
|
83
|
-
.filter((fileType) => fileType !== '.css')
|
|
84
|
-
.forEach((fileType) => {
|
|
85
|
-
const { includeImport, includeExportNames } = determineInjection({
|
|
86
|
-
fileType,
|
|
87
|
-
isForClientSide,
|
|
88
|
-
isClientRouting,
|
|
89
|
-
isPrerendering,
|
|
90
|
-
isBuild,
|
|
91
|
-
});
|
|
92
|
-
if (includeImport) {
|
|
93
|
-
fileContent += getGlobs(globRoots, isBuild, fileType, null, isV1Design);
|
|
94
|
-
}
|
|
95
|
-
if (includeExportNames) {
|
|
96
|
-
fileContent += getGlobs(globRoots, isBuild, fileType, 'extractExportNames', isV1Design);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
const includeAssetsImportedByServer = (0, retrievePageAssetsProd_js_1.resolveIncludeAssetsImportedByServer)(vikeConfig.config);
|
|
100
|
-
if (includeAssetsImportedByServer && isForClientSide) {
|
|
101
|
-
fileContent += getGlobs(globRoots, isBuild, '.page.server', 'extractAssets', isV1Design);
|
|
102
|
-
}
|
|
103
|
-
return fileContent;
|
|
104
|
-
}
|
|
105
|
-
function getGlobs(globRoots, isBuild, fileType, query, isV1Design) {
|
|
106
|
-
const isEager = isBuild && (query === 'extractExportNames' || fileType === '.page.route');
|
|
107
|
-
let pageFilesVar;
|
|
108
|
-
if (query === 'extractExportNames') {
|
|
109
|
-
if (!isEager) {
|
|
110
|
-
pageFilesVar = 'pageFilesExportNamesLazy';
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
pageFilesVar = 'pageFilesExportNamesEager';
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else if (query === 'extractAssets') {
|
|
117
|
-
(0, utils_js_1.assert)(!isEager);
|
|
118
|
-
pageFilesVar = 'neverLoaded';
|
|
119
|
-
}
|
|
120
|
-
else if (!query) {
|
|
121
|
-
if (!isEager) {
|
|
122
|
-
pageFilesVar = 'pageFilesLazy';
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
// Used for `.page.route.js` files
|
|
126
|
-
pageFilesVar = 'pageFilesEager';
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
(0, utils_js_1.assert)(false);
|
|
131
|
-
}
|
|
132
|
-
const varNameSuffix = (fileType === '.page' && 'Isomorph') ||
|
|
133
|
-
(fileType === '.page.client' && 'Client') ||
|
|
134
|
-
(fileType === '.page.server' && 'Server') ||
|
|
135
|
-
(fileType === '.page.route' && 'Route');
|
|
136
|
-
(0, utils_js_1.assert)(varNameSuffix);
|
|
137
|
-
const varName = `${pageFilesVar}${varNameSuffix}`;
|
|
138
|
-
const varNameLocals = [];
|
|
139
|
-
return [
|
|
140
|
-
...globRoots.map((globRoot, i) => {
|
|
141
|
-
const varNameLocal = `${varName}${i + 1}`;
|
|
142
|
-
varNameLocals.push(varNameLocal);
|
|
143
|
-
const globIncludePath = `'${getGlobPath(globRoot.includeDir, fileType)}'`;
|
|
144
|
-
const globExcludePath = globRoot.excludeDir ? `'!${getGlobPath(globRoot.excludeDir, fileType)}'` : null;
|
|
145
|
-
const globOptions = { eager: isEager };
|
|
146
|
-
if (query) {
|
|
147
|
-
const isNewViteInterface = (0, utils_js_1.isVersionMatch)(vite_1.version, ['5.1.0']);
|
|
148
|
-
if (isNewViteInterface &&
|
|
149
|
-
// When used for the old design, the new syntax breaks Vike's CI (surprinsigly so). I couldn't reproduce locally (I didn't dig much).
|
|
150
|
-
isV1Design) {
|
|
151
|
-
globOptions.query = `?${query}`;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
globOptions.as = query;
|
|
155
|
-
const msg = [
|
|
156
|
-
"Update to the new V1 design to get rid of Vite's warning:",
|
|
157
|
-
'The glob option "as" has been deprecated in favour of "query".',
|
|
158
|
-
'See https://vike.dev/migration/v1-design for how to migrate.',
|
|
159
|
-
].join(' ');
|
|
160
|
-
(0, utils_js_1.assertWarning)(!isNewViteInterface, msg, { onlyOnce: true });
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
const globPaths = globExcludePath ? `[${globIncludePath}, ${globExcludePath}]` : `[${globIncludePath}]`;
|
|
164
|
-
const globLine = `const ${varNameLocal} = import.meta.glob(${globPaths}, ${JSON.stringify(globOptions)});`;
|
|
165
|
-
return globLine;
|
|
166
|
-
}),
|
|
167
|
-
`const ${varName} = {${varNameLocals.map((varNameLocal) => `...${varNameLocal}`).join(',')}};`,
|
|
168
|
-
`${pageFilesVar}['${fileType}'] = ${varName};`,
|
|
169
|
-
'',
|
|
170
|
-
].join('\n');
|
|
171
|
-
}
|
|
172
|
-
function getGlobRoots(config) {
|
|
173
|
-
const globRoots = [
|
|
174
|
-
{
|
|
175
|
-
includeDir: '/',
|
|
176
|
-
excludeDir: node_path_1.default.posix.relative(config.root, (0, getOutDirs_js_1.getOutDirs)(config, undefined).outDirRoot),
|
|
177
|
-
},
|
|
178
|
-
];
|
|
179
|
-
return globRoots;
|
|
180
|
-
}
|
|
181
|
-
function getGlobPath(globRootDir, fileType) {
|
|
182
|
-
(0, utils_js_1.assertPosixPath)(globRootDir);
|
|
183
|
-
let globPath = [...globRootDir.split('/'), '**', `*${fileType}.${utils_js_1.scriptFileExtensionPattern}`]
|
|
184
|
-
.filter(Boolean)
|
|
185
|
-
.join('/');
|
|
186
|
-
if (!globPath.startsWith('/')) {
|
|
187
|
-
globPath = '/' + globPath;
|
|
188
|
-
}
|
|
189
|
-
return globPath;
|
|
190
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateVirtualFilePageEntry = generateVirtualFilePageEntry;
|
|
4
|
-
const utils_js_1 = require("../../utils.js");
|
|
5
|
-
const virtualFileId_js_1 = require("../../../shared/virtualFileId.js");
|
|
6
|
-
const resolveVikeConfigInternal_js_1 = require("../../shared/resolveVikeConfigInternal.js");
|
|
7
|
-
const extractAssetsQuery_js_1 = require("../../../shared/extractAssetsQuery.js");
|
|
8
|
-
const debug_js_1 = require("./debug.js");
|
|
9
|
-
const serializeConfigValues_js_1 = require("../../../../shared/page-configs/serialize/serializeConfigValues.js");
|
|
10
|
-
const handleAssetsManifest_js_1 = require("../pluginBuild/handleAssetsManifest.js");
|
|
11
|
-
const getConfigValueBuildTime_js_1 = require("../../../../shared/page-configs/getConfigValueBuildTime.js");
|
|
12
|
-
const retrievePageAssetsProd_js_1 = require("../../../runtime/renderPage/getPageAssets/retrievePageAssetsProd.js");
|
|
13
|
-
async function generateVirtualFilePageEntry(id, isDev) {
|
|
14
|
-
const result = (0, virtualFileId_js_1.parseVirtualFileId)(id);
|
|
15
|
-
(0, utils_js_1.assert)(result && result.type === 'page-entry');
|
|
16
|
-
/* This assertion fails when using includeAssetsImportedByServer
|
|
17
|
-
{
|
|
18
|
-
const isForClientSide = !config.build.ssr
|
|
19
|
-
assert(result.isForClientSide === isForClientSide)
|
|
20
|
-
}
|
|
21
|
-
*/
|
|
22
|
-
const { pageId, isForClientSide } = result;
|
|
23
|
-
const vikeConfig = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternal)(true);
|
|
24
|
-
const { _pageConfigs: pageConfigs } = vikeConfig;
|
|
25
|
-
const pageConfig = pageConfigs.find((pageConfig) => pageConfig.pageId === pageId);
|
|
26
|
-
if (!isDev) {
|
|
27
|
-
(0, utils_js_1.assert)(pageConfig);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
/* This assertion sometimes fail. It happens very seldom and I couldn't reproduce it (https://gist.github.com/brillout/9e212ce829f4d62a912ca163ffa8881a). I suspect some kind of HMR race condition.
|
|
31
|
-
assert(pageConfig, { id, pageId })
|
|
32
|
-
/*/
|
|
33
|
-
if (!pageConfig)
|
|
34
|
-
throw (0, utils_js_1.getProjectError)('Outdated request');
|
|
35
|
-
//*/
|
|
36
|
-
}
|
|
37
|
-
const code = getCode(pageConfig, isForClientSide, pageId, (0, retrievePageAssetsProd_js_1.resolveIncludeAssetsImportedByServer)(vikeConfig.config), isDev);
|
|
38
|
-
(0, debug_js_1.debug)(id, isForClientSide ? 'CLIENT-SIDE' : 'SERVER-SIDE', code);
|
|
39
|
-
return code;
|
|
40
|
-
}
|
|
41
|
-
function getCode(pageConfig, isForClientSide, pageId, includeAssetsImportedByServer, isDev) {
|
|
42
|
-
const lines = [];
|
|
43
|
-
const importStatements = [];
|
|
44
|
-
const filesEnv = new Map();
|
|
45
|
-
const isClientRouting = (0, getConfigValueBuildTime_js_1.getConfigValueBuildTime)(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
46
|
-
lines.push('export const configValuesSerialized = {');
|
|
47
|
-
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfig, importStatements, filesEnv, { isForClientSide, isClientRouting, isDev }, '', false));
|
|
48
|
-
lines.push('};');
|
|
49
|
-
if (!(0, handleAssetsManifest_js_1.handleAssetsManifest_isFixEnabled)() && includeAssetsImportedByServer && isForClientSide && !isDev) {
|
|
50
|
-
importStatements.push(`import '${(0, extractAssetsQuery_js_1.extractAssetsAddQuery)((0, virtualFileId_js_1.generateVirtualFileId)({ type: 'page-entry', pageId, isForClientSide: false }))}'`);
|
|
51
|
-
}
|
|
52
|
-
const code = [...importStatements, ...lines].join('\n');
|
|
53
|
-
return code;
|
|
54
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConfigValueSourcesRelevant = getConfigValueSourcesRelevant;
|
|
4
|
-
exports.getConfigValueSourceRelevantAnyEnv = getConfigValueSourceRelevantAnyEnv;
|
|
5
|
-
exports.isRuntimeEnvMatch = isRuntimeEnvMatch;
|
|
6
|
-
exports.isConfigSourceValueNull = isConfigSourceValueNull;
|
|
7
|
-
const utils_js_1 = require("../../utils.js");
|
|
8
|
-
(0, utils_js_1.assertIsNotBrowser)();
|
|
9
|
-
function getConfigValueSourcesRelevant(configName, runtimeEnv, pageConfig) {
|
|
10
|
-
const configDef = pageConfig.configDefinitions[configName];
|
|
11
|
-
(0, utils_js_1.assert)(configDef);
|
|
12
|
-
let sourcesRelevant = pageConfig.configValueSources[configName];
|
|
13
|
-
if (!sourcesRelevant)
|
|
14
|
-
return [];
|
|
15
|
-
// Ignore configs with value `undefined`
|
|
16
|
-
sourcesRelevant = sourcesRelevant.filter((source) => !isConfigSourceValueUndefined(source));
|
|
17
|
-
// Environment filtering
|
|
18
|
-
sourcesRelevant = sourcesRelevant.filter((source) => isRuntimeEnvMatch(source.configEnv, runtimeEnv));
|
|
19
|
-
// Overriding - non-cumulative configs
|
|
20
|
-
if (!configDef.cumulative && sourcesRelevant.length > 1) {
|
|
21
|
-
const source = sourcesRelevant[0];
|
|
22
|
-
(0, utils_js_1.assert)(source);
|
|
23
|
-
sourcesRelevant = [source];
|
|
24
|
-
}
|
|
25
|
-
// Overriding - cumulative configs
|
|
26
|
-
if (configDef.cumulative && sourcesRelevant.length > 0) {
|
|
27
|
-
sourcesRelevant = applyFilenameSuffix(sourcesRelevant);
|
|
28
|
-
}
|
|
29
|
-
return sourcesRelevant;
|
|
30
|
-
}
|
|
31
|
-
function getConfigValueSourceRelevantAnyEnv(configName, pageConfig) {
|
|
32
|
-
const configDef = pageConfig.configDefinitions[configName];
|
|
33
|
-
(0, utils_js_1.assert)(configDef);
|
|
34
|
-
(0, utils_js_1.assert)(!configDef.cumulative); // So far, this function is only used by non-cumulative configs
|
|
35
|
-
let sourcesRelevant = pageConfig.configValueSources[configName];
|
|
36
|
-
if (!sourcesRelevant)
|
|
37
|
-
return null;
|
|
38
|
-
// Ignore configs with value `undefined`
|
|
39
|
-
sourcesRelevant = sourcesRelevant.filter((source) => !isConfigSourceValueUndefined(source));
|
|
40
|
-
const source = sourcesRelevant[0];
|
|
41
|
-
if (!source)
|
|
42
|
-
return null;
|
|
43
|
-
if (isConfigSourceValueNull(source))
|
|
44
|
-
return null;
|
|
45
|
-
return source;
|
|
46
|
-
}
|
|
47
|
-
function isRuntimeEnvMatch(configEnv, runtimeEnv) {
|
|
48
|
-
if ('isForConfig' in runtimeEnv)
|
|
49
|
-
return !!configEnv.config;
|
|
50
|
-
// Runtime
|
|
51
|
-
if (!runtimeEnv.isForClientSide) {
|
|
52
|
-
if (!configEnv.server)
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
if (!configEnv.client)
|
|
57
|
-
return false;
|
|
58
|
-
if (configEnv.client === 'if-client-routing' && !runtimeEnv.isClientRouting)
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
// Production/development
|
|
62
|
-
if (configEnv.production !== undefined) {
|
|
63
|
-
(0, utils_js_1.assert)(typeof configEnv.production === 'boolean');
|
|
64
|
-
(0, utils_js_1.assert)(typeof runtimeEnv.isDev === 'boolean');
|
|
65
|
-
if (configEnv.production) {
|
|
66
|
-
if (runtimeEnv.isDev)
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
if (!runtimeEnv.isDev)
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
// Setting a config to `undefined` should be equivalent to not setting it at all
|
|
77
|
-
function isConfigSourceValueUndefined(source) {
|
|
78
|
-
if (!source.valueIsLoaded)
|
|
79
|
-
return null;
|
|
80
|
-
return source.value === undefined;
|
|
81
|
-
}
|
|
82
|
-
// Setting a config to `null` enables the user to suppress inherited config by overriding it with `null` (this only works when setting the config value to `null` inside a +config.js file — it doesn't work when setting the config value to `null` with a +{configName}.js file).
|
|
83
|
-
function isConfigSourceValueNull(source) {
|
|
84
|
-
if (!source.valueIsLoaded)
|
|
85
|
-
return null;
|
|
86
|
-
return source.value === null;
|
|
87
|
-
}
|
|
88
|
-
function applyFilenameSuffix(sourcesRelevant) {
|
|
89
|
-
const getFileName = (source) => source.plusFile?.filePath.fileName ?? '';
|
|
90
|
-
// Apply `clear`: truncate at first clear file
|
|
91
|
-
const clearIndex = sourcesRelevant.findIndex((source) => getFileName(source).includes('.clear.'));
|
|
92
|
-
if (clearIndex !== -1)
|
|
93
|
-
sourcesRelevant = sourcesRelevant.slice(0, clearIndex + 1);
|
|
94
|
-
// Apply `default`: exclude defaults if any non-defaults exist, otherwise keep only first default
|
|
95
|
-
const nonDefaults = sourcesRelevant.filter((source) => !getFileName(source).includes('.default.'));
|
|
96
|
-
return nonDefaults.length > 0 ? nonDefaults : sourcesRelevant.slice(0, 1);
|
|
97
|
-
}
|
|
@@ -1,233 +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.pluginVirtualFiles = pluginVirtualFiles;
|
|
7
|
-
const vite_1 = require("vite");
|
|
8
|
-
const generateVirtualFilePageEntry_js_1 = require("./pluginVirtualFiles/generateVirtualFilePageEntry.js");
|
|
9
|
-
const generateVirtualFileGlobalEntryWithOldDesign_js_1 = require("./pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js");
|
|
10
|
-
const utils_js_1 = require("../utils.js");
|
|
11
|
-
const virtualFileId_js_1 = require("../../shared/virtualFileId.js");
|
|
12
|
-
const resolveVikeConfigInternal_js_1 = require("../shared/resolveVikeConfigInternal.js");
|
|
13
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
14
|
-
const loggerNotProd_js_1 = require("../shared/loggerNotProd.js");
|
|
15
|
-
const getFilePath_js_1 = require("../shared/getFilePath.js");
|
|
16
|
-
const globalContext_js_1 = require("../../runtime/globalContext.js");
|
|
17
|
-
const crawlPlusFiles_js_1 = require("../shared/resolveVikeConfigInternal/crawlPlusFiles.js");
|
|
18
|
-
const transpileAndExecuteFile_js_1 = require("../shared/resolveVikeConfigInternal/transpileAndExecuteFile.js");
|
|
19
|
-
const getVikeConfigError_js_1 = require("../../shared/getVikeConfigError.js");
|
|
20
|
-
const filterRolldown = {
|
|
21
|
-
id: {
|
|
22
|
-
include: new RegExp(`^(${(0, utils_js_1.escapeRegex)(utils_js_1.virtualFileIdPrefix1)}|${(0, utils_js_1.escapeRegex)(utils_js_1.virtualFileIdPrefix2)})`),
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
const filterFunction = (id) => (0, utils_js_1.isVirtualFileId)(id);
|
|
26
|
-
function pluginVirtualFiles() {
|
|
27
|
-
let config;
|
|
28
|
-
return {
|
|
29
|
-
name: 'vike:pluginVirtualFiles',
|
|
30
|
-
configResolved: {
|
|
31
|
-
async handler(config_) {
|
|
32
|
-
config = config_;
|
|
33
|
-
// TO-DO/next-major-release: remove
|
|
34
|
-
if (!(0, resolveVikeConfigInternal_js_1.isV1Design)())
|
|
35
|
-
config.experimental.importGlobRestoreExtension = true;
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
resolveId: {
|
|
39
|
-
filter: filterRolldown,
|
|
40
|
-
handler(id) {
|
|
41
|
-
(0, utils_js_1.assert)(filterFunction(id));
|
|
42
|
-
return (0, utils_js_1.addVirtualFileIdPrefix)(id);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
handleHotUpdate: {
|
|
46
|
-
async handler(ctx) {
|
|
47
|
-
try {
|
|
48
|
-
return await handleHotUpdate(ctx, config);
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
// Vite swallows errors thrown by handleHotUpdate()
|
|
52
|
-
console.error(err);
|
|
53
|
-
throw err;
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
load: {
|
|
58
|
-
filter: filterRolldown,
|
|
59
|
-
async handler(id, options) {
|
|
60
|
-
(0, utils_js_1.assert)(filterFunction(id));
|
|
61
|
-
id = (0, utils_js_1.removeVirtualFileIdPrefix)(id);
|
|
62
|
-
const isDev = config._isDev;
|
|
63
|
-
(0, utils_js_1.assert)(typeof isDev === 'boolean');
|
|
64
|
-
const idParsed = (0, virtualFileId_js_1.parseVirtualFileId)(id);
|
|
65
|
-
if (idParsed) {
|
|
66
|
-
if (idParsed.type === 'page-entry') {
|
|
67
|
-
const code = await (0, generateVirtualFilePageEntry_js_1.generateVirtualFilePageEntry)(id, isDev);
|
|
68
|
-
return code;
|
|
69
|
-
}
|
|
70
|
-
if (idParsed.type === 'global-entry') {
|
|
71
|
-
const code = await (0, generateVirtualFileGlobalEntryWithOldDesign_js_1.generateVirtualFileGlobalEntryWithOldDesign)(id, options, config, this.environment, isDev);
|
|
72
|
-
return code;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
configureServer: {
|
|
78
|
-
handler(server) {
|
|
79
|
-
handleFileAddRemove(server, config);
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function handleFileAddRemove(server, config) {
|
|
85
|
-
server.watcher.prependListener('add', (f) => listener(f, false));
|
|
86
|
-
server.watcher.prependListener('unlink', (f) => listener(f, true));
|
|
87
|
-
return;
|
|
88
|
-
async function listener(file, isRemove) {
|
|
89
|
-
file = (0, vite_1.normalizePath)(file);
|
|
90
|
-
if ((0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(file))
|
|
91
|
-
return;
|
|
92
|
-
const { moduleGraph } = server;
|
|
93
|
-
const isVikeConfigDep = await isVikeConfigDependency(file, moduleGraph);
|
|
94
|
-
const reload = () => reloadConfig(file, config, isRemove ? 'removed' : 'created', server);
|
|
95
|
-
// Config code
|
|
96
|
-
if (isVikeConfigDep && !isVikeConfigDep.isProcessedByVite) {
|
|
97
|
-
reload();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
// New or deleted + file
|
|
101
|
-
if ((0, crawlPlusFiles_js_1.isPlusFile)(file)) {
|
|
102
|
-
reload();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
// Runtime code => let Vite handle it
|
|
106
|
-
if (isVikeConfigDep && isVikeConfigDep.isProcessedByVite) {
|
|
107
|
-
(0, utils_js_1.assert)(existsInViteModuleGraph(file, moduleGraph));
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
// Trick: when importing a file that doesn't exist => we don't know whether `file` is that missing file => we take a leap of faith when the conditions below are met.
|
|
111
|
-
// - Not sure how reliable that trick is.
|
|
112
|
-
// - Reloading Vike's config is cheap and file creation/removal is rare => the trick is worth it.
|
|
113
|
-
// - Reproduction:
|
|
114
|
-
// ```bash
|
|
115
|
-
// rm someDep.js && sleep 2 && git checkout someDep.js
|
|
116
|
-
// ```
|
|
117
|
-
if ((0, utils_js_1.isScriptFile)(file) && (0, getVikeConfigError_js_1.getVikeConfigError)() && !existsInViteModuleGraph(file, moduleGraph)) {
|
|
118
|
-
reload();
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function invalidateVikeVirtualFiles(server) {
|
|
124
|
-
const vikeVirtualFiles = getVikeVirtualFiles(server);
|
|
125
|
-
vikeVirtualFiles.forEach((mod) => {
|
|
126
|
-
server.moduleGraph.invalidateModule(mod);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
// Vite calls its hook handleHotUpdate() whenever *any file* is modified — including files that aren't in Vite's module graph such as `pages/+config.js`
|
|
130
|
-
async function handleHotUpdate(ctx, config) {
|
|
131
|
-
const { file, server } = ctx;
|
|
132
|
-
const isVikeConfigDep = await isVikeConfigDependency(ctx.file, ctx.server.moduleGraph);
|
|
133
|
-
if (isVikeConfigDep) {
|
|
134
|
-
if (!isVikeConfigDep.isProcessedByVite) {
|
|
135
|
-
/* Tailwind breaks this assertion, see https://github.com/vikejs/vike/discussions/1330#discussioncomment-7787238
|
|
136
|
-
const isViteModule = ctx.modules.length > 0
|
|
137
|
-
assert(!isViteModule)
|
|
138
|
-
*/
|
|
139
|
-
reloadConfig(file, config, 'modified', server);
|
|
140
|
-
// Files such as `pages/+config.js` can potentially modify Vike's virtual files.
|
|
141
|
-
// Triggers a full page reload
|
|
142
|
-
const vikeVirtualFiles = getVikeVirtualFiles(server);
|
|
143
|
-
return vikeVirtualFiles;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
// Ensure we invalidate `file` *before* server.ssrLoadModule() in updateUserFiles()
|
|
147
|
-
// Vite already invalidates it, but *after* handleHotUpdate() and thus after server.ssrLoadModule()
|
|
148
|
-
ctx.modules.forEach((mod) => server.moduleGraph.invalidateModule(mod));
|
|
149
|
-
if ((0, globalContext_js_1.isRunnable)(server)) {
|
|
150
|
-
await (0, globalContext_js_1.updateUserFiles)();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
async function isVikeConfigDependency(filePathAbsoluteFilesystem, moduleGraph) {
|
|
156
|
-
// Non-runtime Vike config files such as `pages/+config.js` which aren't processed by Vite.
|
|
157
|
-
// - They're missing in Vite's module graph.
|
|
158
|
-
// - Potentially modifies Vike's virtual files.
|
|
159
|
-
// - Same for all `pages/+config.js` dependencies.
|
|
160
|
-
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
161
|
-
const vikeConfigObject = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternalOptional)();
|
|
162
|
-
if (vikeConfigObject) {
|
|
163
|
-
const { _vikeConfigDependencies: vikeConfigDependencies } = vikeConfigObject;
|
|
164
|
-
vikeConfigDependencies.forEach((f) => (0, utils_js_1.assertPosixPath)(f));
|
|
165
|
-
if (vikeConfigDependencies.has(filePathAbsoluteFilesystem))
|
|
166
|
-
return { isProcessedByVite: false };
|
|
167
|
-
}
|
|
168
|
-
// Runtime Vike config files such as +data.js which are processed by Vite.
|
|
169
|
-
// - They're included in Vite's module graph.
|
|
170
|
-
// - They never modify Vike's virtual files.
|
|
171
|
-
// - Same for all `+data.js` dependencies.
|
|
172
|
-
const importers = getImporters(filePathAbsoluteFilesystem, moduleGraph);
|
|
173
|
-
const isPlusValueFileDependency = Array.from(importers).some((importer) => importer.file && (0, crawlPlusFiles_js_1.isPlusFile)(importer.file));
|
|
174
|
-
if (isPlusValueFileDependency)
|
|
175
|
-
return { isProcessedByVite: true };
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
function reloadConfig(filePath, config, op, server) {
|
|
179
|
-
// Ensure server.ssrLoadModule() loads fresh Vike virtual files (`reloadConfig()` > `updateUserFiles()` > `server.ssrLoadModule()`)
|
|
180
|
-
invalidateVikeVirtualFiles(server);
|
|
181
|
-
{
|
|
182
|
-
const filePathToShowToUserResolved = (0, getFilePath_js_1.getModuleFilePathAbsolute)(filePath, config);
|
|
183
|
-
const msg = `${op} ${picocolors_1.default.dim(filePathToShowToUserResolved)}`;
|
|
184
|
-
(0, loggerNotProd_js_1.logConfigInfo)(msg, 'info');
|
|
185
|
-
}
|
|
186
|
-
(0, resolveVikeConfigInternal_js_1.reloadVikeConfig)();
|
|
187
|
-
(0, globalContext_js_1.updateUserFiles)();
|
|
188
|
-
}
|
|
189
|
-
function getVikeVirtualFiles(server) {
|
|
190
|
-
const vikeVirtualFiles = Array.from(server.moduleGraph.urlToModuleMap.keys())
|
|
191
|
-
.filter((url) => (0, virtualFileId_js_1.parseVirtualFileId)(url))
|
|
192
|
-
.map((url) => {
|
|
193
|
-
const mod = server.moduleGraph.urlToModuleMap.get(url);
|
|
194
|
-
(0, utils_js_1.assert)(mod);
|
|
195
|
-
return mod;
|
|
196
|
-
});
|
|
197
|
-
return vikeVirtualFiles;
|
|
198
|
-
}
|
|
199
|
-
// Get all transitive importers (including the module itself)
|
|
200
|
-
function getImporters(file, moduleGraph) {
|
|
201
|
-
const importers = new Set();
|
|
202
|
-
const mods = moduleGraph.getModulesByFile(file);
|
|
203
|
-
if (!mods)
|
|
204
|
-
return importers;
|
|
205
|
-
for (const mod of mods) {
|
|
206
|
-
getModuleImporters(mod).forEach((importer) => {
|
|
207
|
-
if (importer)
|
|
208
|
-
importers.add(importer);
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
return importers;
|
|
212
|
-
}
|
|
213
|
-
function getModuleImporters(mod, seen = new Set()) {
|
|
214
|
-
if (seen.has(mod))
|
|
215
|
-
return new Set();
|
|
216
|
-
seen.add(mod);
|
|
217
|
-
const importers = new Set();
|
|
218
|
-
if (mod.id)
|
|
219
|
-
importers.add(mod);
|
|
220
|
-
// Traverse through the importers (modules that import this module)
|
|
221
|
-
for (const importer of mod.importers) {
|
|
222
|
-
if (importer.id)
|
|
223
|
-
importers.add(importer);
|
|
224
|
-
getModuleImporters(importer, seen).forEach((importerTransitive) => {
|
|
225
|
-
if (importerTransitive)
|
|
226
|
-
importers.add(importerTransitive);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
return importers;
|
|
230
|
-
}
|
|
231
|
-
function existsInViteModuleGraph(file, moduleGraph) {
|
|
232
|
-
return !!moduleGraph.getModulesByFile(file);
|
|
233
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pluginWorkaroundCssModuleHmr = pluginWorkaroundCssModuleHmr;
|
|
4
|
-
function pluginWorkaroundCssModuleHmr() {
|
|
5
|
-
return {
|
|
6
|
-
name: 'vike:pluginWorkaroundCssModuleHmr',
|
|
7
|
-
handleHotUpdate: {
|
|
8
|
-
handler(ctx) {
|
|
9
|
-
// prevent full reload due to non self-accepting css module.
|
|
10
|
-
// here only "?direct" module should be filtered out as it doesn't have a parent module.
|
|
11
|
-
if (ctx.file.includes('module.css')) {
|
|
12
|
-
return ctx.modules.filter((m) => !m.id?.includes('?direct'));
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pluginWorkaroundVite6HmrRegression = pluginWorkaroundVite6HmrRegression;
|
|
4
|
-
// https://vite.dev/guide/migration (will be 404 after vite@7 release) > search for `hmrReload()`
|
|
5
|
-
// https://v6.vite.dev/guide/migration (will exist after vite@7 release) > search for `hmrReload()`
|
|
6
|
-
// Workaround seems to work for docs page /banner (which is HTML-only)
|
|
7
|
-
// But doesn't seem to work for /examples/render-modes/ (see https://github.com/vikejs/vike/pull/2069 commit `renable HMR test for HTML-only`)
|
|
8
|
-
function pluginWorkaroundVite6HmrRegression() {
|
|
9
|
-
return {
|
|
10
|
-
name: 'vike:pluginWorkaroundVite6HmrRegression',
|
|
11
|
-
enforce: 'post',
|
|
12
|
-
hotUpdate: {
|
|
13
|
-
order: 'post',
|
|
14
|
-
handler({ modules, server, timestamp }) {
|
|
15
|
-
if (this.environment.name !== 'ssr')
|
|
16
|
-
return;
|
|
17
|
-
let hasSsrOnlyModules = false;
|
|
18
|
-
const invalidatedModules = new Set();
|
|
19
|
-
for (const mod of modules) {
|
|
20
|
-
if (mod.id == null)
|
|
21
|
-
continue;
|
|
22
|
-
const clientModule = server.environments.client.moduleGraph.getModuleById(mod.id);
|
|
23
|
-
if (clientModule != null)
|
|
24
|
-
continue;
|
|
25
|
-
this.environment.moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true);
|
|
26
|
-
hasSsrOnlyModules = true;
|
|
27
|
-
}
|
|
28
|
-
if (hasSsrOnlyModules) {
|
|
29
|
-
server.ws.send({ type: 'full-reload' });
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|