vike 0.4.239-commit-33e55d4 → 0.4.239-commit-4d0d950
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/runtime-client-routing/entry.js +5 -0
- package/dist/esm/client/runtime-client-routing/globalContext.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/globalContext.js +9 -3
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +2 -2
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +15 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/entry.js +5 -0
- package/dist/esm/client/runtime-server-routing/globalContext.d.ts +2 -2
- package/dist/esm/client/runtime-server-routing/globalContext.js +7 -3
- package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +4 -3
- package/dist/esm/client/shared/createGetGlobalContextClient.js +38 -34
- package/dist/esm/node/vite/index.js +34 -15
- package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBaseUrls.js +37 -35
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.d.ts +4 -0
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +21 -6
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.js +16 -4
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +82 -80
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +23 -21
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +38 -36
- package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +26 -24
- package/dist/esm/node/vite/plugins/pluginCommon.js +1 -1
- package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
- package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +87 -65
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +29 -27
- package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +75 -73
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +30 -28
- package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginPreview.js +35 -33
- package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.d.ts +9 -0
- package/dist/esm/node/vite/plugins/pluginReplaceGlobalThisConstants.js +45 -0
- package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.js +89 -0
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +50 -48
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +12 -10
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
- package/dist/esm/shared/createGlobalContextShared.js +1 -0
- package/dist/esm/shared/route/abort.d.ts +22 -11
- package/dist/esm/shared/route/abort.js +37 -5
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/findPackageJson.js +0 -1
- package/dist/esm/utils/getViteRPC.js +0 -2
- package/dist/esm/utils/requireResolve.js +0 -1
- package/package.json +3 -22
- package/dist/cjs/__internal/index.js +0 -35
- package/dist/cjs/client/runtime-client-routing/globalContext.js +0 -49
- package/dist/cjs/client/runtime-client-routing/prefetch/PrefetchSetting.js +0 -2
- package/dist/cjs/client/runtime-server-routing/globalContext.js +0 -41
- package/dist/cjs/client/runtime-server-routing/onLoad.js +0 -7
- package/dist/cjs/client/runtime-server-routing/utils.js +0 -34
- package/dist/cjs/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/cjs/client/shared/getJsonSerializedInHtml.js +0 -40
- package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +0 -41
- package/dist/cjs/client/shared/utils.js +0 -23
- package/dist/cjs/node/api/build.js +0 -24
- package/dist/cjs/node/api/context.js +0 -23
- package/dist/cjs/node/api/dev.js +0 -18
- package/dist/cjs/node/api/index.js +0 -44
- package/dist/cjs/node/api/onLoad.js +0 -9
- package/dist/cjs/node/api/prepareViteApiCall.js +0 -206
- package/dist/cjs/node/api/prerender.js +0 -18
- package/dist/cjs/node/api/preview.js +0 -38
- package/dist/cjs/node/api/types.js +0 -2
- package/dist/cjs/node/api/utils.js +0 -27
- package/dist/cjs/node/cli/context.js +0 -17
- package/dist/cjs/node/cli/entry.js +0 -121
- package/dist/cjs/node/cli/index.js +0 -12
- package/dist/cjs/node/cli/onLoad.js +0 -9
- package/dist/cjs/node/cli/parseCli.js +0 -95
- package/dist/cjs/node/cli/utils.js +0 -24
- package/dist/cjs/node/client/router.js +0 -19
- package/dist/cjs/node/createPageRenderer.js +0 -132
- package/dist/cjs/node/importBuild.js +0 -3
- package/dist/cjs/node/prerender/context.js +0 -26
- package/dist/cjs/node/prerender/index.js +0 -12
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +0 -66
- package/dist/cjs/node/prerender/runPrerender.js +0 -778
- package/dist/cjs/node/prerender/runPrerenderEntry.js +0 -55
- package/dist/cjs/node/prerender/utils.js +0 -37
- package/dist/cjs/node/runtime/globalContext.js +0 -582
- package/dist/cjs/node/runtime/index-deprecated.js +0 -33
- package/dist/cjs/node/runtime/index.js +0 -74
- package/dist/cjs/node/runtime/loggerRuntime.js +0 -17
- package/dist/cjs/node/runtime/onLoad.js +0 -29
- package/dist/cjs/node/runtime/page-files/setup.js +0 -5
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +0 -71
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +0 -42
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +0 -51
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -114
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +0 -59
- package/dist/cjs/node/runtime/renderPage/csp.js +0 -47
- package/dist/cjs/node/runtime/renderPage/execHookDataAndOnBeforeRender.js +0 -31
- package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +0 -120
- package/dist/cjs/node/runtime/renderPage/execHookServer.js +0 -8
- package/dist/cjs/node/runtime/renderPage/getCacheControl.js +0 -24
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +0 -20
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +0 -137
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +0 -125
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsDev.js +0 -86
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsProd.js +0 -77
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +0 -36
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +0 -50
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +0 -41
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +0 -68
- package/dist/cjs/node/runtime/renderPage/headersResponse.js +0 -48
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getHtmlTags.js +0 -269
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getViteDevScript.js +0 -32
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/inferHtmlTags.js +0 -55
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectAssets__public.js +0 -31
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectHtmlTags.js +0 -161
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/mergeScriptTags.js +0 -73
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/sanitizeJson.js +0 -8
- package/dist/cjs/node/runtime/renderPage/html/injectAssets.js +0 -93
- package/dist/cjs/node/runtime/renderPage/html/propKeys.js +0 -47
- package/dist/cjs/node/runtime/renderPage/html/renderHtml.js +0 -245
- package/dist/cjs/node/runtime/renderPage/html/serializeContext.js +0 -189
- package/dist/cjs/node/runtime/renderPage/html/stream/react-streaming.js +0 -36
- package/dist/cjs/node/runtime/renderPage/html/stream.js +0 -829
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +0 -81
- package/dist/cjs/node/runtime/renderPage/isFontFallback.js +0 -29
- package/dist/cjs/node/runtime/renderPage/isNewError.js +0 -25
- package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +0 -124
- package/dist/cjs/node/runtime/renderPage/log404/index.js +0 -154
- package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +0 -20
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +0 -200
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +0 -34
- package/dist/cjs/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +0 -10
- package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +0 -83
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +0 -71
- package/dist/cjs/node/runtime/renderPage.js +0 -502
- package/dist/cjs/node/runtime/universal-middleware.js +0 -20
- package/dist/cjs/node/runtime/utils.js +0 -83
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -27
- package/dist/cjs/node/runtime-dev/index.js +0 -42
- package/dist/cjs/node/shared/assertV1Design.js +0 -30
- package/dist/cjs/node/shared/extractAssetsQuery.js +0 -29
- package/dist/cjs/node/shared/getVikeConfigError.js +0 -22
- package/dist/cjs/node/shared/isErrorDebug.js +0 -7
- package/dist/cjs/node/shared/prependEntriesDir.js +0 -13
- package/dist/cjs/node/shared/resolveBase.js +0 -35
- package/dist/cjs/node/shared/utils.js +0 -35
- package/dist/cjs/node/shared/virtualFileId.js +0 -110
- package/dist/cjs/node/vite/index.js +0 -69
- package/dist/cjs/node/vite/onLoad.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +0 -52
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -342
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -183
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -222
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -256
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -40
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -49
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -111
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -65
- package/dist/cjs/node/vite/plugins/pluginBuild.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +0 -88
- package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -183
- package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -28
- package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +0 -163
- package/dist/cjs/node/vite/plugins/pluginDev.js +0 -111
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -92
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -241
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -113
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -172
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -70
- package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -82
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -95
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -51
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/debug.js +0 -5
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +0 -56
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +0 -190
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +0 -54
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +0 -97
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +0 -233
- package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -17
- package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +0 -35
- package/dist/cjs/node/vite/shared/addSsrMiddleware.js +0 -60
- package/dist/cjs/node/vite/shared/findPageFiles.js +0 -25
- package/dist/cjs/node/vite/shared/getAssetsDir.js +0 -10
- package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +0 -42
- package/dist/cjs/node/vite/shared/getEnvVarObject.js +0 -37
- package/dist/cjs/node/vite/shared/getFilePath.js +0 -172
- package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +0 -125
- package/dist/cjs/node/vite/shared/getMagicString.js +0 -18
- package/dist/cjs/node/vite/shared/getManifestFilePathRelative.js +0 -10
- package/dist/cjs/node/vite/shared/getOutDirs.js +0 -146
- package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +0 -21
- package/dist/cjs/node/vite/shared/isAsset.js +0 -40
- package/dist/cjs/node/vite/shared/isViteCliCall.js +0 -83
- package/dist/cjs/node/vite/shared/isViteServerSide.js +0 -68
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +0 -38
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +0 -26
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +0 -85
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +0 -30
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +0 -29
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +0 -13
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +0 -162
- package/dist/cjs/node/vite/shared/loggerNotProd/log.js +0 -102
- package/dist/cjs/node/vite/shared/loggerNotProd.js +0 -208
- package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +0 -26
- package/dist/cjs/node/vite/shared/loggerVite.js +0 -54
- package/dist/cjs/node/vite/shared/normalizeId.js +0 -9
- package/dist/cjs/node/vite/shared/parseEsModule.js +0 -33
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +0 -136
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +0 -262
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +0 -18
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +0 -252
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +0 -190
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getConfigFileExport.js +0 -17
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +0 -127
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +0 -129
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +0 -195
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +0 -102
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +0 -425
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +0 -1151
- package/dist/cjs/node/vite/shared/rollupIsEsm.js +0 -15
- package/dist/cjs/node/vite/utils.js +0 -45
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/shared/NOT_SERIALIZABLE.js +0 -4
- package/dist/cjs/shared/RenderErrorPage.js +0 -6
- package/dist/cjs/shared/abort.js +0 -16
- package/dist/cjs/shared/addIs404ToPageProps.js +0 -18
- package/dist/cjs/shared/assertHookReturnedObject.js +0 -21
- package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +0 -21
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +0 -20
- package/dist/cjs/shared/createGlobalContextShared.js +0 -109
- package/dist/cjs/shared/createPageContextShared.js +0 -17
- package/dist/cjs/shared/determinePageIdOld.js +0 -11
- package/dist/cjs/shared/error-page.js +0 -40
- package/dist/cjs/shared/getPageContext.js +0 -6
- package/dist/cjs/shared/getPageContextRequestUrl.js +0 -16
- package/dist/cjs/shared/getPageContextUrlComputed.js +0 -132
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +0 -19
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +0 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +0 -50
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +0 -30
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +0 -15
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +0 -59
- package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +0 -22
- package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +0 -24
- package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -52
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -102
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -56
- package/dist/cjs/shared/getPageFiles/parseVirtualFileExportsGlobalEntry.js +0 -100
- package/dist/cjs/shared/getPageFiles.js +0 -7
- package/dist/cjs/shared/getProxyForPublicUsage.js +0 -56
- package/dist/cjs/shared/hooks/execHook.js +0 -147
- package/dist/cjs/shared/hooks/getHook.js +0 -173
- package/dist/cjs/shared/htmlElementIds.js +0 -5
- package/dist/cjs/shared/misc/isServerSideError.js +0 -4
- package/dist/cjs/shared/misc/pageContextInitIsPassedToClient.js +0 -4
- package/dist/cjs/shared/modifyUrl.js +0 -28
- package/dist/cjs/shared/modifyUrlSameOrigin.js +0 -47
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +0 -42
- package/dist/cjs/shared/page-configs/findPageConfig.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +0 -65
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -68
- package/dist/cjs/shared/page-configs/getConfigValueRuntime.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigValueTyped.js +0 -32
- package/dist/cjs/shared/page-configs/getExportPath.js +0 -29
- package/dist/cjs/shared/page-configs/helpers.js +0 -27
- package/dist/cjs/shared/page-configs/loadAndParseVirtualFilePageEntry.js +0 -25
- package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +0 -287
- package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +0 -2
- package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -1
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigsSerialized.js +0 -145
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +0 -290
- package/dist/cjs/shared/prepareGlobalContextForPublicUsage.js +0 -10
- package/dist/cjs/shared/preparePageContextForPublicUsage.js +0 -80
- package/dist/cjs/shared/route/abort.js +0 -178
- package/dist/cjs/shared/route/debug.js +0 -23
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +0 -52
- package/dist/cjs/shared/route/execHookGuard.js +0 -37
- package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -84
- package/dist/cjs/shared/route/index.js +0 -107
- package/dist/cjs/shared/route/loadPageRoutes.js +0 -197
- package/dist/cjs/shared/route/noRouteMatch.js +0 -4
- package/dist/cjs/shared/route/resolvePrecedence.js +0 -93
- package/dist/cjs/shared/route/resolveRoute.js +0 -20
- package/dist/cjs/shared/route/resolveRouteFunction.js +0 -73
- package/dist/cjs/shared/route/resolveRouteString.js +0 -153
- package/dist/cjs/shared/route/resolveUrlPathname.js +0 -47
- package/dist/cjs/shared/route/routing.js +0 -9
- package/dist/cjs/shared/route/utils.js +0 -40
- package/dist/cjs/shared/utils.js +0 -49
- package/dist/cjs/types/Config/ConfigResolved.js +0 -2
- package/dist/cjs/types/Config.js +0 -2
- package/dist/cjs/types/FilePath.js +0 -2
- package/dist/cjs/types/PageConfig.js +0 -2
- package/dist/cjs/types/PageContext.js +0 -2
- package/dist/cjs/types/VikeGlobalInternal.js +0 -2
- package/dist/cjs/types/VikeNamespace.js +0 -2
- package/dist/cjs/types/ViteManifest.js +0 -2
- package/dist/cjs/types/defineConfig.js +0 -6
- package/dist/cjs/types/index-dreprecated.js +0 -3
- package/dist/cjs/types/index.js +0 -5
- package/dist/cjs/utils/PROJECT_VERSION.js +0 -5
- package/dist/cjs/utils/PromiseType.js +0 -2
- package/dist/cjs/utils/assert.js +0 -211
- package/dist/cjs/utils/assertIsBrowser.js +0 -8
- package/dist/cjs/utils/assertIsNotBrowser.js +0 -9
- package/dist/cjs/utils/assertKeys.js +0 -27
- package/dist/cjs/utils/assertNodeVersion.js +0 -14
- package/dist/cjs/utils/assertRoutingType.js +0 -29
- package/dist/cjs/utils/assertSetup.js +0 -171
- package/dist/cjs/utils/assertSingleInstance.js +0 -110
- package/dist/cjs/utils/assertVersion.js +0 -60
- package/dist/cjs/utils/capitalizeFirstLetter.js +0 -9
- package/dist/cjs/utils/cast.js +0 -6
- package/dist/cjs/utils/catchInfiniteLoop.js +0 -34
- package/dist/cjs/utils/changeEnumerable.js +0 -8
- package/dist/cjs/utils/checkType.js +0 -6
- package/dist/cjs/utils/compareString.js +0 -10
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +0 -39
- package/dist/cjs/utils/debug.js +0 -178
- package/dist/cjs/utils/debugGlob.js +0 -6
- package/dist/cjs/utils/deepEqual.js +0 -10
- package/dist/cjs/utils/escapeHtml.js +0 -13
- package/dist/cjs/utils/escapeRegex.js +0 -7
- package/dist/cjs/utils/findFile.js +0 -30
- package/dist/cjs/utils/findPackageJson.js +0 -18
- package/dist/cjs/utils/formatHintLog.js +0 -17
- package/dist/cjs/utils/freezePartial.js +0 -35
- package/dist/cjs/utils/genPromise.js +0 -51
- package/dist/cjs/utils/getFileExtension.js +0 -16
- package/dist/cjs/utils/getGlobalObject.js +0 -15
- package/dist/cjs/utils/getMostSimilar.js +0 -68
- package/dist/cjs/utils/getPropAccessNotation.js +0 -9
- package/dist/cjs/utils/getRandomId.js +0 -14
- package/dist/cjs/utils/getTerminalWidth.js +0 -7
- package/dist/cjs/utils/getValuePrintable.js +0 -10
- package/dist/cjs/utils/getViteRPC.js +0 -79
- package/dist/cjs/utils/hasProp.js +0 -50
- package/dist/cjs/utils/humanizeTime.js +0 -24
- package/dist/cjs/utils/includes.js +0 -13
- package/dist/cjs/utils/injectRollupInputs.js +0 -29
- package/dist/cjs/utils/isArray.js +0 -7
- package/dist/cjs/utils/isArrayOfStrings.js +0 -7
- package/dist/cjs/utils/isBrowser.js +0 -8
- package/dist/cjs/utils/isCallable.js +0 -6
- package/dist/cjs/utils/isDev.js +0 -20
- package/dist/cjs/utils/isDocker.js +0 -45
- package/dist/cjs/utils/isEqualStringList.js +0 -13
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +0 -66
- package/dist/cjs/utils/isHtml.js +0 -9
- package/dist/cjs/utils/isImportPath.js +0 -21
- package/dist/cjs/utils/isNodeJS.js +0 -16
- package/dist/cjs/utils/isNonRunnableDev.js +0 -12
- package/dist/cjs/utils/isNullish.js +0 -16
- package/dist/cjs/utils/isObject.js +0 -6
- package/dist/cjs/utils/isObjectOfStrings.js +0 -7
- package/dist/cjs/utils/isObjectWithKeys.js +0 -15
- package/dist/cjs/utils/isPlainObject.js +0 -19
- package/dist/cjs/utils/isPromise.js +0 -7
- package/dist/cjs/utils/isPropertyGetter.js +0 -7
- package/dist/cjs/utils/isReact.js +0 -23
- package/dist/cjs/utils/isRunnableDevEnvironment.js +0 -9
- package/dist/cjs/utils/isSameErrorMessage.js +0 -9
- package/dist/cjs/utils/isScriptFile.js +0 -67
- package/dist/cjs/utils/isVikeReactApp.js +0 -8
- package/dist/cjs/utils/isVitest.js +0 -6
- package/dist/cjs/utils/joinEnglish.js +0 -14
- package/dist/cjs/utils/normalizeHeaders.js +0 -17
- package/dist/cjs/utils/objectAssign.js +0 -14
- package/dist/cjs/utils/objectAssignSafe.js +0 -7
- package/dist/cjs/utils/objectDefineProperty.js +0 -7
- package/dist/cjs/utils/objectEntries.js +0 -8
- package/dist/cjs/utils/objectEntriesForEach.js +0 -7
- package/dist/cjs/utils/objectFilter.js +0 -10
- package/dist/cjs/utils/objectFromEntries.js +0 -7
- package/dist/cjs/utils/objectKeys.js +0 -9
- package/dist/cjs/utils/objectReplace.js +0 -9
- package/dist/cjs/utils/onPageVisibilityChange.js +0 -18
- package/dist/cjs/utils/pLimit.js +0 -134
- package/dist/cjs/utils/parseNpmPackage.js +0 -106
- package/dist/cjs/utils/parseUrl-extras.js +0 -110
- package/dist/cjs/utils/parseUrl.js +0 -338
- package/dist/cjs/utils/path.js +0 -59
- package/dist/cjs/utils/pick.js +0 -12
- package/dist/cjs/utils/preservePropertyGetters.js +0 -30
- package/dist/cjs/utils/redirectHard.js +0 -6
- package/dist/cjs/utils/removeEmptyLines.js +0 -9
- package/dist/cjs/utils/removeFileExtension.js +0 -6
- package/dist/cjs/utils/requireResolve.js +0 -214
- package/dist/cjs/utils/rollupSourceMap.js +0 -19
- package/dist/cjs/utils/sleep.js +0 -6
- package/dist/cjs/utils/slice.js +0 -35
- package/dist/cjs/utils/sorter.js +0 -117
- package/dist/cjs/utils/stringifyStringArray.js +0 -6
- package/dist/cjs/utils/stripAnsi.js +0 -21
- package/dist/cjs/utils/styleFileRE.js +0 -6
- package/dist/cjs/utils/throttle.js +0 -15
- package/dist/cjs/utils/trackLogs.js +0 -31
- package/dist/cjs/utils/trimWithAnsi.js +0 -40
- package/dist/cjs/utils/truncateString.js +0 -23
- package/dist/cjs/utils/unique.js +0 -6
- package/dist/cjs/utils/updateType.js +0 -9
- package/dist/cjs/utils/urlToFile.js +0 -36
- package/dist/cjs/utils/virtualFileId.js +0 -43
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
- package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginBuild.js +0 -19
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -14
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -92
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pluginFileEnv = pluginFileEnv;
|
|
7
|
-
const utils_js_1 = require("../utils.js");
|
|
8
|
-
const pluginExtractAssets_js_1 = require("./pluginExtractAssets.js");
|
|
9
|
-
const pluginExtractExportNames_js_1 = require("./pluginExtractExportNames.js");
|
|
10
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
11
|
-
const getFilePath_js_1 = require("../shared/getFilePath.js");
|
|
12
|
-
const parseEsModule_js_1 = require("../shared/parseEsModule.js");
|
|
13
|
-
const normalizeId_js_1 = require("../shared/normalizeId.js");
|
|
14
|
-
const resolveVikeConfigInternal_js_1 = require("../shared/resolveVikeConfigInternal.js");
|
|
15
|
-
const isViteServerSide_js_1 = require("../shared/isViteServerSide.js");
|
|
16
|
-
const skipNodeModules = '/node_modules/'; // Only apply `.server.js` and `.client.js` to user files
|
|
17
|
-
const filterRolldown = {
|
|
18
|
-
id: {
|
|
19
|
-
include: ['client', 'server'].map((env) => `**/*${getSuffix(env)}*`),
|
|
20
|
-
exclude: [`**${skipNodeModules}**`],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
const filterFunction = (id) => {
|
|
24
|
-
if (id.includes(skipNodeModules))
|
|
25
|
-
return false;
|
|
26
|
-
if (!id.includes(getSuffix('client')) && !id.includes(getSuffix('server')))
|
|
27
|
-
return false;
|
|
28
|
-
return true;
|
|
29
|
-
};
|
|
30
|
-
function pluginFileEnv() {
|
|
31
|
-
let config;
|
|
32
|
-
let viteDevServer;
|
|
33
|
-
return {
|
|
34
|
-
name: 'vike:pluginFileEnv',
|
|
35
|
-
load: {
|
|
36
|
-
filter: filterRolldown,
|
|
37
|
-
handler(id, options) {
|
|
38
|
-
// In build, we use generateBundle() instead of the load() hook. Using load() works for dynamic imports in dev thanks to Vite's lazy transpiling, but it doesn't work in build because Rollup transpiles any dynamically imported module even if it's never actually imported.
|
|
39
|
-
if (!viteDevServer)
|
|
40
|
-
return;
|
|
41
|
-
if (!(0, resolveVikeConfigInternal_js_1.isV1Design)())
|
|
42
|
-
return;
|
|
43
|
-
if (skip(id, config.root))
|
|
44
|
-
return;
|
|
45
|
-
// For `.vue` files: https://github.com/vikejs/vike/issues/1912#issuecomment-2394981475
|
|
46
|
-
if (id.endsWith('?direct'))
|
|
47
|
-
id = id.slice(0, -1 * '?direct'.length);
|
|
48
|
-
const moduleInfo = viteDevServer.moduleGraph.getModuleById(id);
|
|
49
|
-
(0, utils_js_1.assert)(moduleInfo);
|
|
50
|
-
const importers = Array.from(moduleInfo.importers)
|
|
51
|
-
.map((m) => m.id)
|
|
52
|
-
.filter((id) => id !== null);
|
|
53
|
-
assertFileEnv(id, (0, isViteServerSide_js_1.isViteServerSide_extraSafe)(config, this.environment, options), importers,
|
|
54
|
-
// In dev, we only show a warning because we don't want to disrupt when the user plays with settings such as [ssr](https://vike.dev/ssr).
|
|
55
|
-
true);
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
// In production, we have to use transform() to replace modules with a runtime error because generateBundle() doesn't work for dynamic imports. In production, dynamic imports can only be verified at runtime.
|
|
59
|
-
transform: {
|
|
60
|
-
filter: filterRolldown,
|
|
61
|
-
async handler(code, id, options) {
|
|
62
|
-
id = (0, normalizeId_js_1.normalizeId)(id);
|
|
63
|
-
// In dev, only using load() is enough as it also works for dynamic imports (see sibling comment).
|
|
64
|
-
if (viteDevServer)
|
|
65
|
-
return;
|
|
66
|
-
if (skip(id, config.root))
|
|
67
|
-
return;
|
|
68
|
-
const isServerSide = (0, isViteServerSide_js_1.isViteServerSide_extraSafe)(config, this.environment, options);
|
|
69
|
-
if (!isWrongEnv(id, isServerSide))
|
|
70
|
-
return;
|
|
71
|
-
const { importers } = this.getModuleInfo(id);
|
|
72
|
-
// Throwing a verbose error doesn't waste client-side KBs as dynamic imports are code split.
|
|
73
|
-
const errMsg = getErrorMessage(id, isServerSide, importers, false, true);
|
|
74
|
-
// We have to inject empty exports to avoid Rollup complaining about missing exports, see https://gist.github.com/brillout/5ea45776e65bd65100a52ecd7bfda3ff
|
|
75
|
-
const { exportNames } = await (0, parseEsModule_js_1.getExportNames)(code);
|
|
76
|
-
return (0, utils_js_1.rollupSourceMapRemove)([
|
|
77
|
-
`throw new Error(${JSON.stringify(errMsg)});`,
|
|
78
|
-
...exportNames.map((name) => name === 'default' ? 'export default undefined;' : `export const ${name} = undefined;`),
|
|
79
|
-
].join('\n'));
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
generateBundle: {
|
|
83
|
-
handler() {
|
|
84
|
-
Array.from(this.getModuleIds())
|
|
85
|
-
.filter(filterFunction)
|
|
86
|
-
.filter((id) => !skip(id, config.root))
|
|
87
|
-
.forEach((moduleId) => {
|
|
88
|
-
const mod = this.getModuleInfo(moduleId);
|
|
89
|
-
const { importers } = mod;
|
|
90
|
-
if (importers.length === 0) {
|
|
91
|
-
// Dynamic imports can only be verified at runtime
|
|
92
|
-
/* This assertion can fail: https://github.com/vikejs/vike/issues/2227
|
|
93
|
-
assert(dynamicImporters.length > 0)
|
|
94
|
-
*/
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
assertFileEnv(moduleId, (0, isViteServerSide_js_1.isViteServerSide)(config, this.environment), importers, false);
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
configResolved: {
|
|
102
|
-
handler(config_) {
|
|
103
|
-
config = config_;
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
configureServer: {
|
|
107
|
-
handler(viteDevServer_) {
|
|
108
|
-
viteDevServer = viteDevServer_;
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
function assertFileEnv(moduleId, isServerSide, importers, onlyWarn) {
|
|
113
|
-
if (!isWrongEnv(moduleId, isServerSide))
|
|
114
|
-
return;
|
|
115
|
-
const errMsg = getErrorMessage(moduleId, isServerSide, importers, onlyWarn, false);
|
|
116
|
-
if (onlyWarn) {
|
|
117
|
-
(0, utils_js_1.assertWarning)(false, errMsg, { onlyOnce: true });
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
(0, utils_js_1.assertUsage)(false, errMsg);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function getErrorMessage(moduleId, isServerSide, importers, onlyWarn, noColor) {
|
|
124
|
-
const modulePath = getModulePath(moduleId);
|
|
125
|
-
const envActual = isServerSide ? 'server' : 'client';
|
|
126
|
-
const envExpect = isServerSide ? 'client' : 'server';
|
|
127
|
-
let errMsg;
|
|
128
|
-
let modulePathPretty = (0, getFilePath_js_1.getModuleFilePathAbsolute)(modulePath, config);
|
|
129
|
-
if (!noColor) {
|
|
130
|
-
const suffix = getSuffix(envExpect);
|
|
131
|
-
modulePathPretty = modulePathPretty.replaceAll(suffix, picocolors_1.default.bold(suffix));
|
|
132
|
-
}
|
|
133
|
-
errMsg = `${(0, utils_js_1.capitalizeFirstLetter)(envExpect)}-only file ${modulePathPretty} (https://vike.dev/file-env) imported on the ${envActual}-side`;
|
|
134
|
-
{
|
|
135
|
-
const importPaths = importers
|
|
136
|
-
.filter((importer) =>
|
|
137
|
-
// Can be Vike's virtual module: https://github.com/vikejs/vike/issues/2483
|
|
138
|
-
(0, utils_js_1.isFilePathAbsolute)(importer))
|
|
139
|
-
.map((importer) => (0, getFilePath_js_1.getModuleFilePathAbsolute)(importer, config));
|
|
140
|
-
if (importPaths.length > 0) {
|
|
141
|
-
errMsg += ` by ${(0, utils_js_1.joinEnglish)(importPaths, 'and')}`;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (onlyWarn) {
|
|
145
|
-
errMsg += ' and, therefore, Vike will prevent building your app for production.';
|
|
146
|
-
}
|
|
147
|
-
return errMsg;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function isWrongEnv(moduleId, isServerSide) {
|
|
151
|
-
const modulePath = getModulePath(moduleId);
|
|
152
|
-
const suffixWrong = getSuffix(isServerSide ? 'client' : 'server');
|
|
153
|
-
return modulePath.includes(suffixWrong);
|
|
154
|
-
}
|
|
155
|
-
function skip(id, userRootDir) {
|
|
156
|
-
(0, utils_js_1.assert)(filterFunction(id));
|
|
157
|
-
// TO-DO/next-major-release: remove
|
|
158
|
-
if (pluginExtractAssets_js_1.extractAssetsRE.test(id) || pluginExtractExportNames_js_1.extractExportNamesRE.test(id))
|
|
159
|
-
return true;
|
|
160
|
-
if (getModulePath(id).endsWith('.css'))
|
|
161
|
-
return true;
|
|
162
|
-
// Skip linked dependencies
|
|
163
|
-
if (!id.startsWith(userRootDir))
|
|
164
|
-
return true;
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
function getSuffix(env) {
|
|
168
|
-
return `.${env}.`;
|
|
169
|
-
}
|
|
170
|
-
function getModulePath(moduleId) {
|
|
171
|
-
return moduleId.split('?')[0];
|
|
172
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pluginNonRunnableDev = pluginNonRunnableDev;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
const retrievePageAssetsDev_js_1 = require("../../runtime/renderPage/getPageAssets/retrievePageAssetsDev.js");
|
|
6
|
-
const getViteConfigRuntime_js_1 = require("../shared/getViteConfigRuntime.js");
|
|
7
|
-
const getMagicString_js_1 = require("../shared/getMagicString.js");
|
|
8
|
-
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
9
|
-
const distFileIsNonRunnableDev = (0, utils_js_1.requireResolveDistFile)('dist/esm/utils/isNonRunnableDev.js');
|
|
10
|
-
const distFileGlobalContext = (0, utils_js_1.requireResolveDistFile)('dist/esm/node/runtime/globalContext.js');
|
|
11
|
-
const filterRolldown = {
|
|
12
|
-
id: {
|
|
13
|
-
include: [distFileIsNonRunnableDev, distFileGlobalContext].map((filePath) => new RegExp(`^${(0, utils_js_1.escapeRegex)(filePath)}($|${(0, utils_js_1.escapeRegex)('?')}.*)`)),
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
const filterFunction = (id) => {
|
|
17
|
-
const idWithoutQuery = getIdWithoutQuery(id);
|
|
18
|
-
return idWithoutQuery === distFileIsNonRunnableDev || idWithoutQuery === distFileGlobalContext;
|
|
19
|
-
};
|
|
20
|
-
function getViteRpcFunctions(viteDevServer) {
|
|
21
|
-
return {
|
|
22
|
-
async transformIndexHtmlRPC(html) {
|
|
23
|
-
return await viteDevServer.transformIndexHtml('/', html);
|
|
24
|
-
},
|
|
25
|
-
async retrievePageAssetsDevRPC(clientDependencies, clientEntries) {
|
|
26
|
-
return await (0, retrievePageAssetsDev_js_1.retrievePageAssetsDev)(viteDevServer, clientDependencies, clientEntries);
|
|
27
|
-
},
|
|
28
|
-
async getViteConfigRuntimeRPC() {
|
|
29
|
-
return (0, getViteConfigRuntime_js_1.getViteConfigRuntime)(viteDevServer.config);
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function pluginNonRunnableDev() {
|
|
34
|
-
let config;
|
|
35
|
-
return {
|
|
36
|
-
name: 'vike:pluginNonRunnableDev',
|
|
37
|
-
apply: (_, configEnv) => (0, utils_js_1.isDevCheck)(configEnv),
|
|
38
|
-
configureServer: {
|
|
39
|
-
handler(viteDevServer) {
|
|
40
|
-
(0, utils_js_1.createViteRPC)(viteDevServer, getViteRpcFunctions);
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
configResolved: {
|
|
44
|
-
handler(config_) {
|
|
45
|
-
config = config_;
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
transform: {
|
|
49
|
-
filter: filterRolldown,
|
|
50
|
-
handler(code, id) {
|
|
51
|
-
(0, utils_js_1.assert)(config._isDev);
|
|
52
|
-
(0, utils_js_1.assert)(filterFunction(id));
|
|
53
|
-
const idWithoutQuery = getIdWithoutQuery(id);
|
|
54
|
-
if ((0, utils_js_1.isRunnableDevEnvironment)(this.environment))
|
|
55
|
-
return;
|
|
56
|
-
const { magicString, getMagicStringResult } = (0, getMagicString_js_1.getMagicString)(code, id);
|
|
57
|
-
if (idWithoutQuery === distFileIsNonRunnableDev) {
|
|
58
|
-
magicString.replaceAll('__VIKE__IS_NON_RUNNABLE_DEV', JSON.stringify(true));
|
|
59
|
-
}
|
|
60
|
-
if (idWithoutQuery === distFileGlobalContext) {
|
|
61
|
-
magicString.replaceAll('__VIKE__DYNAMIC_IMPORT', 'import');
|
|
62
|
-
}
|
|
63
|
-
return getMagicStringResult();
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function getIdWithoutQuery(id) {
|
|
69
|
-
return id.split('?')[0];
|
|
70
|
-
}
|
|
@@ -1,82 +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.pluginPreview = pluginPreview;
|
|
7
|
-
const utils_js_1 = require("../utils.js");
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const addSsrMiddleware_js_1 = require("../shared/addSsrMiddleware.js");
|
|
11
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
12
|
-
const pluginDev_js_1 = require("./pluginDev.js");
|
|
13
|
-
const getOutDirs_js_1 = require("../shared/getOutDirs.js");
|
|
14
|
-
const sirv_1 = __importDefault(require("sirv"));
|
|
15
|
-
const resolveVikeConfigInternal_js_1 = require("../shared/resolveVikeConfigInternal.js");
|
|
16
|
-
function pluginPreview() {
|
|
17
|
-
let config;
|
|
18
|
-
let vikeConfig;
|
|
19
|
-
return {
|
|
20
|
-
name: 'vike:pluginPreview',
|
|
21
|
-
apply: utils_js_1.applyPreview,
|
|
22
|
-
config: {
|
|
23
|
-
handler() {
|
|
24
|
-
return {
|
|
25
|
-
appType: 'custom',
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
configResolved: {
|
|
30
|
-
async handler(config_) {
|
|
31
|
-
config = config_;
|
|
32
|
-
vikeConfig = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternal)();
|
|
33
|
-
(0, pluginDev_js_1.logDockerHint)(config.preview.host);
|
|
34
|
-
// vikeConfig = await getVikeConfig(config)
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
configurePreviewServer: {
|
|
38
|
-
handler(server) {
|
|
39
|
-
/* - Couldn't make `appType: 'mpa'` work as of npm:@brillout/vite@5.0.0-beta.14.0426910c
|
|
40
|
-
- This ugly hack to set appType for preview won't be need once https://github.com/vitejs/vite/pull/14855 is merged.
|
|
41
|
-
config.appType = 'mpa'
|
|
42
|
-
*/
|
|
43
|
-
return () => {
|
|
44
|
-
const { isPrerenderingEnabledForAllPages, isPrerenderingEnabled } = vikeConfig.prerenderContext;
|
|
45
|
-
assertDist(isPrerenderingEnabledForAllPages);
|
|
46
|
-
// We cannot re-use Vite's static middleware: https://github.com/vitejs/vite/pull/14836#issuecomment-1788540300
|
|
47
|
-
addStaticAssetsMiddleware(server.middlewares);
|
|
48
|
-
if (!isPrerenderingEnabledForAllPages) {
|
|
49
|
-
(0, addSsrMiddleware_js_1.addSsrMiddleware)(server.middlewares, config, true, isPrerenderingEnabled);
|
|
50
|
-
}
|
|
51
|
-
addStatic404Middleware(server.middlewares);
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
function assertDist(isPrerenderingEnabledForAllPages) {
|
|
57
|
-
const { outDirRoot, outDirClient, outDirServer } = (0, getOutDirs_js_1.getOutDirs)(config, undefined);
|
|
58
|
-
const dirS = [outDirRoot, outDirClient];
|
|
59
|
-
if (!isPrerenderingEnabledForAllPages)
|
|
60
|
-
dirS.push(outDirServer);
|
|
61
|
-
dirS.forEach((outDirAny) => {
|
|
62
|
-
(0, utils_js_1.assertUsage)(node_fs_1.default.existsSync(outDirAny), `Cannot run ${picocolors_1.default.cyan('$ vike preview')}: your app isn't built (the build directory ${picocolors_1.default.cyan(outDirAny)} is missing). Make sure to run ${picocolors_1.default.cyan('$ vike build')} before running ${picocolors_1.default.cyan('$ vike preview')}.`);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function addStaticAssetsMiddleware(middlewares) {
|
|
66
|
-
const { outDirClient } = (0, getOutDirs_js_1.getOutDirs)(config, undefined);
|
|
67
|
-
middlewares.use((0, sirv_1.default)(outDirClient));
|
|
68
|
-
}
|
|
69
|
-
function addStatic404Middleware(middlewares) {
|
|
70
|
-
const { outDirClient } = (0, getOutDirs_js_1.getOutDirs)(config, undefined);
|
|
71
|
-
middlewares.use(config.base, (_, res, next) => {
|
|
72
|
-
const file = node_path_1.default.posix.join(outDirClient, './404.html');
|
|
73
|
-
if (node_fs_1.default.existsSync(file)) {
|
|
74
|
-
res.statusCode = 404;
|
|
75
|
-
res.end(node_fs_1.default.readFileSync(file));
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
next();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterRolldown = exports.filterFunction = void 0;
|
|
4
|
-
exports.pluginReplaceConstants = pluginReplaceConstants;
|
|
5
|
-
const utils_js_1 = require("../utils.js");
|
|
6
|
-
const normalizeId_js_1 = require("../shared/normalizeId.js");
|
|
7
|
-
const isViteServerSide_js_1 = require("../shared/isViteServerSide.js");
|
|
8
|
-
const getMagicString_js_1 = require("../shared/getMagicString.js");
|
|
9
|
-
const skipNodeModules = '/node_modules/';
|
|
10
|
-
const skipIrrelevant = '({}).';
|
|
11
|
-
const filterRolldown = {
|
|
12
|
-
id: {
|
|
13
|
-
exclude: `**${skipNodeModules}**`,
|
|
14
|
-
},
|
|
15
|
-
code: {
|
|
16
|
-
include: skipIrrelevant,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
exports.filterRolldown = filterRolldown;
|
|
20
|
-
const filterFunction = (id, code) => {
|
|
21
|
-
if (id.includes(skipNodeModules))
|
|
22
|
-
return false;
|
|
23
|
-
if (!code.includes(skipIrrelevant))
|
|
24
|
-
return false;
|
|
25
|
-
return true;
|
|
26
|
-
};
|
|
27
|
-
exports.filterFunction = filterFunction;
|
|
28
|
-
function pluginReplaceConstants() {
|
|
29
|
-
let config;
|
|
30
|
-
return {
|
|
31
|
-
name: 'vike:pluginReplaceConstants',
|
|
32
|
-
enforce: 'post',
|
|
33
|
-
apply: 'build',
|
|
34
|
-
configResolved: {
|
|
35
|
-
handler(config_) {
|
|
36
|
-
config = config_;
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
transform: {
|
|
40
|
-
filter: filterRolldown,
|
|
41
|
-
handler(code, id, options) {
|
|
42
|
-
id = (0, normalizeId_js_1.normalizeId)(id);
|
|
43
|
-
(0, utils_js_1.assertPosixPath)(id);
|
|
44
|
-
(0, utils_js_1.assertPosixPath)(config.root);
|
|
45
|
-
if (!id.startsWith(config.root))
|
|
46
|
-
return; // skip linked dependencies
|
|
47
|
-
(0, utils_js_1.assert)(filterFunction(id, code));
|
|
48
|
-
const isBuild = config.command === 'build';
|
|
49
|
-
(0, utils_js_1.assert)(isBuild);
|
|
50
|
-
// Used by vike.dev
|
|
51
|
-
// https://github.com/vikejs/vike/blob/08a1ff55c80ddca64ca6d4417fefd45fefeb4ffb/docs/vite.config.ts#L12
|
|
52
|
-
// @ts-expect-error
|
|
53
|
-
if (config._skipVikeReplaceConstants?.(id))
|
|
54
|
-
return;
|
|
55
|
-
const { magicString, getMagicStringResult } = (0, getMagicString_js_1.getMagicString)(code, id);
|
|
56
|
-
const constantsMap = [];
|
|
57
|
-
constantsMap.push({
|
|
58
|
-
constants: [
|
|
59
|
-
'pageContext.isClientSide',
|
|
60
|
-
'globalContext.isClientSide',
|
|
61
|
-
'pageContext.globalContext.isClientSide',
|
|
62
|
-
],
|
|
63
|
-
replacement: !(0, isViteServerSide_js_1.isViteServerSide_extraSafe)(config, this.environment, options),
|
|
64
|
-
});
|
|
65
|
-
constantsMap.forEach(({ constants, replacement }) => {
|
|
66
|
-
if (!constants.some((c) => code.includes(c)))
|
|
67
|
-
return;
|
|
68
|
-
const regExp = getConstantRegExp(constants);
|
|
69
|
-
magicString.replaceAll(regExp, JSON.stringify(replacement));
|
|
70
|
-
});
|
|
71
|
-
if (!magicString.hasChanged())
|
|
72
|
-
return null;
|
|
73
|
-
return getMagicStringResult();
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
// Copied & adapted from:
|
|
79
|
-
// https://github.com/rollup/plugins/blob/e1a5ef99f1578eb38a8c87563cb9651db228f3bd/packages/replace/src/index.js#L57-L67
|
|
80
|
-
function getConstantRegExp(constants) {
|
|
81
|
-
const keys = Object.values(constants).sort(longest).map(escape);
|
|
82
|
-
// const delimiters = ['\\b', '\\b(?!\\.)']
|
|
83
|
-
const delimiters = ['(?<!\\.)\\b', '\\b(?!\\.)']; // Improved version, to avoid replacing `globalContext.pageContext.isClientSide` with `globalContext.false`
|
|
84
|
-
const preventAssignment = false; // Let's try without it first, let's see if a user complains
|
|
85
|
-
const lookbehind = preventAssignment ? '(?<!\\b(?:const|let|var)\\s*)' : '';
|
|
86
|
-
const lookahead = preventAssignment ? '(?!\\s*=[^=])' : '';
|
|
87
|
-
const pattern = new RegExp(`${lookbehind}${delimiters[0]}(${keys.join('|')})${delimiters[1]}${lookahead}`, 'g');
|
|
88
|
-
return pattern;
|
|
89
|
-
}
|
|
90
|
-
function escape(str) {
|
|
91
|
-
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
|
|
92
|
-
}
|
|
93
|
-
function longest(a, b) {
|
|
94
|
-
return b.length - a.length;
|
|
95
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pluginSetGlobalContext = pluginSetGlobalContext;
|
|
4
|
-
const globalContext_js_1 = require("../../runtime/globalContext.js");
|
|
5
|
-
const utils_js_1 = require("../utils.js");
|
|
6
|
-
const resolveVikeConfigInternal_js_1 = require("../shared/resolveVikeConfigInternal.js");
|
|
7
|
-
const getViteConfigRuntime_js_1 = require("../shared/getViteConfigRuntime.js");
|
|
8
|
-
function pluginSetGlobalContext() {
|
|
9
|
-
let isServerReload = false;
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
name: 'vike:pluginSetGlobalContext:pre',
|
|
13
|
-
enforce: 'pre',
|
|
14
|
-
// This hook is called not only at server start but also at server restart (a new `viteDevServer` instance is created)
|
|
15
|
-
configureServer: {
|
|
16
|
-
order: 'pre',
|
|
17
|
-
handler(viteDevServer) {
|
|
18
|
-
if (isServerReload)
|
|
19
|
-
(0, resolveVikeConfigInternal_js_1.reloadVikeConfig)();
|
|
20
|
-
isServerReload = true;
|
|
21
|
-
(0, globalContext_js_1.setGlobalContext_viteDevServer)(viteDevServer);
|
|
22
|
-
(0, utils_js_1.markSetup_viteDevServer)();
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
configurePreviewServer: {
|
|
26
|
-
handler() {
|
|
27
|
-
(0, utils_js_1.markSetup_vitePreviewServer)();
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
config: {
|
|
31
|
-
order: 'pre',
|
|
32
|
-
handler(_, env) {
|
|
33
|
-
const isViteDev = (0, utils_js_1.isDevCheck)(env);
|
|
34
|
-
(0, globalContext_js_1.setGlobalContext_isProductionAccordingToVite)(!isViteDev);
|
|
35
|
-
(0, utils_js_1.markSetup_isViteDev)(isViteDev);
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'vike:pluginSetGlobalContext:post',
|
|
41
|
-
enforce: 'post',
|
|
42
|
-
configResolved: {
|
|
43
|
-
order: 'post',
|
|
44
|
-
async handler(config) {
|
|
45
|
-
const viteConfigRuntime = (0, getViteConfigRuntime_js_1.getViteConfigRuntime)(config);
|
|
46
|
-
(0, globalContext_js_1.setGlobalContext_viteConfig)(config, viteConfigRuntime);
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateVirtualFileGlobalEntry = generateVirtualFileGlobalEntry;
|
|
4
|
-
const virtualFileId_js_1 = require("../../../shared/virtualFileId.js");
|
|
5
|
-
const debug_js_1 = require("./debug.js");
|
|
6
|
-
const resolveVikeConfigInternal_js_1 = require("../../shared/resolveVikeConfigInternal.js");
|
|
7
|
-
const serializeConfigValues_js_1 = require("../../../../shared/page-configs/serialize/serializeConfigValues.js");
|
|
8
|
-
async function generateVirtualFileGlobalEntry(isForClientSide, isDev, id, isClientRouting) {
|
|
9
|
-
const vikeConfig = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternal)(true);
|
|
10
|
-
const { _pageConfigs: pageConfigs, _pageConfigGlobal: pageConfigGlobal } = vikeConfig;
|
|
11
|
-
return getCode(pageConfigs, pageConfigGlobal, isForClientSide, isDev, id, isClientRouting);
|
|
12
|
-
}
|
|
13
|
-
function getCode(pageConfigs, pageConfigGlobal, isForClientSide, isDev, id, isClientRouting) {
|
|
14
|
-
const lines = [];
|
|
15
|
-
const importStatements = [];
|
|
16
|
-
const filesEnv = new Map();
|
|
17
|
-
lines.push('export const pageConfigsSerialized = [');
|
|
18
|
-
lines.push(getCodePageConfigsSerialized(pageConfigs, isForClientSide, isClientRouting, isDev, importStatements, filesEnv));
|
|
19
|
-
lines.push('];');
|
|
20
|
-
lines.push('export const pageConfigGlobalSerialized = {');
|
|
21
|
-
lines.push(getCodePageConfigGlobalSerialized(pageConfigGlobal, isForClientSide, isClientRouting, isDev, importStatements, filesEnv));
|
|
22
|
-
lines.push('};');
|
|
23
|
-
if (!isForClientSide && isDev) {
|
|
24
|
-
// https://vite.dev/guide/api-environment-frameworks.html
|
|
25
|
-
lines.push('if ((undefined)) (undefined).accept();');
|
|
26
|
-
}
|
|
27
|
-
const code = [...importStatements, ...lines].join('\n');
|
|
28
|
-
(0, debug_js_1.debug)(id, isForClientSide ? 'CLIENT-SIDE' : 'SERVER-SIDE', code);
|
|
29
|
-
return code;
|
|
30
|
-
}
|
|
31
|
-
function getCodePageConfigsSerialized(pageConfigs, isForClientSide, isClientRouting, isDev, importStatements, filesEnv) {
|
|
32
|
-
const lines = [];
|
|
33
|
-
pageConfigs.forEach((pageConfig) => {
|
|
34
|
-
const { pageId, routeFilesystem, isErrorPage } = pageConfig;
|
|
35
|
-
lines.push(` {`);
|
|
36
|
-
lines.push(` pageId: ${JSON.stringify(pageId)},`);
|
|
37
|
-
lines.push(` isErrorPage: ${JSON.stringify(isErrorPage)},`);
|
|
38
|
-
lines.push(` routeFilesystem: ${JSON.stringify(routeFilesystem)},`);
|
|
39
|
-
const virtualFileId = JSON.stringify((0, virtualFileId_js_1.generateVirtualFileId)({ type: 'page-entry', pageId, isForClientSide }));
|
|
40
|
-
lines.push(` loadVirtualFilePageEntry: () => ({ moduleId: ${virtualFileId}, moduleExportsPromise: import(${virtualFileId}) }),`);
|
|
41
|
-
lines.push(` configValuesSerialized: {`);
|
|
42
|
-
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfig, importStatements, filesEnv, { isForClientSide, isClientRouting, isDev }, ' ', true));
|
|
43
|
-
lines.push(` },`);
|
|
44
|
-
lines.push(` },`);
|
|
45
|
-
});
|
|
46
|
-
const code = lines.join('\n');
|
|
47
|
-
return code;
|
|
48
|
-
}
|
|
49
|
-
function getCodePageConfigGlobalSerialized(pageConfigGlobal, isForClientSide, isClientRouting, isDev, importStatements, filesEnv) {
|
|
50
|
-
const lines = [];
|
|
51
|
-
lines.push(` configValuesSerialized: {`);
|
|
52
|
-
lines.push(...(0, serializeConfigValues_js_1.serializeConfigValues)(pageConfigGlobal, importStatements, filesEnv, { isForClientSide, isClientRouting, isDev }, ' ', null));
|
|
53
|
-
lines.push(` },`);
|
|
54
|
-
const code = lines.join('\n');
|
|
55
|
-
return code;
|
|
56
|
-
}
|