vike 0.4.239 → 0.4.240-commit-a80417c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/index.d.ts +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-client-routing/entry.js +5 -3
- package/dist/esm/client/runtime-client-routing/getBaseServer.js +0 -1
- package/dist/esm/client/runtime-client-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
- package/dist/esm/client/runtime-client-routing/{globalContext.js → getGlobalContextClientInternal.js} +8 -4
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +6 -6
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.js +1 -1
- package/dist/esm/client/runtime-client-routing/isClientSideRoutable.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +4 -4
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +102 -77
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-server-routing/entry.js +5 -3
- package/dist/esm/client/runtime-server-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
- package/dist/esm/client/runtime-server-routing/getGlobalContextClientInternal.js +6 -0
- package/dist/esm/client/shared/execHookOnRenderClient.d.ts +1 -1
- package/dist/esm/client/shared/{createGetGlobalContextClient.d.ts → getGlobalContextClientInternalShared.d.ts} +11 -8
- package/dist/esm/client/shared/getGlobalContextClientInternalShared.js +66 -0
- package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +1 -3
- package/dist/esm/node/prerender/runPrerender.d.ts +4 -2
- package/dist/esm/node/prerender/runPrerender.js +5 -2
- package/dist/esm/node/runtime/globalContext.d.ts +15 -2
- package/dist/esm/node/runtime/globalContext.js +46 -32
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +4 -2
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +4 -2
- package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.d.ts +8 -4
- package/dist/esm/node/runtime/renderPage.d.ts +4 -2
- package/dist/esm/node/vite/index.js +42 -18
- package/dist/esm/node/vite/onLoad.js +1 -1
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.d.ts +4 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.js +21 -6
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.js +24 -20
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.js +20 -6
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistFileNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginDistFileNames.js +253 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistPackageJsonFile.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginDistPackageJsonFile.js +40 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginModuleBanner.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginModuleBanner.js +49 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.js +4 -2
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.d.ts +1 -1
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.js +27 -23
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.d.ts +7 -0
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js +47 -0
- package/dist/esm/node/vite/plugins/{pluginNonRunnableDev.d.ts → non-runnable-dev/pluginViteRPC.d.ts} +3 -7
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginViteRPC.js +30 -0
- package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBaseUrls.js +39 -33
- package/dist/esm/node/vite/plugins/pluginCommon.js +8 -28
- package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
- package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/vite/plugins/pluginDev.js +51 -47
- package/dist/esm/node/vite/plugins/pluginExtractAssets.js +108 -92
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +39 -23
- package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +117 -92
- package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginPreview.js +38 -30
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.js +127 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.d.ts +17 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.js +52 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsPageContext.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsPageContext.js +89 -0
- package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +4 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +67 -47
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +13 -9
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
- package/dist/esm/node/vite/shared/getMagicString.d.ts +1 -1
- package/dist/esm/node/vite/shared/getMagicString.js +2 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +2 -2
- package/dist/esm/shared/createGlobalContextShared.d.ts +4 -4
- package/dist/esm/shared/route/abort.d.ts +23 -11
- package/dist/esm/shared/route/abort.js +45 -5
- package/dist/esm/shared/route/index.js +13 -4
- package/dist/esm/shared/route/utils.d.ts +1 -0
- package/dist/esm/shared/route/utils.js +1 -0
- package/dist/esm/types/Config.d.ts +1 -1
- package/dist/esm/types/PageContext.d.ts +8 -8
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assert.js +1 -0
- package/dist/esm/utils/debug.d.ts +5 -3
- package/dist/esm/utils/debug.js +30 -16
- package/dist/esm/utils/findPackageJson.js +0 -1
- package/dist/esm/utils/getGlobalObject.d.ts +5 -1
- package/dist/esm/utils/getGlobalObject.js +5 -1
- package/dist/esm/utils/getViteRPC.js +0 -2
- package/dist/esm/utils/isDev.js +3 -1
- package/dist/esm/utils/isNonRunnableDev.js +2 -2
- package/dist/esm/utils/requireResolve.js +1 -2
- package/dist/esm/utils/virtualFileId.d.ts +4 -0
- package/dist/esm/utils/virtualFileId.js +14 -11
- package/package.json +8 -27
- package/dist/cjs/__internal/index.js +0 -35
- package/dist/cjs/client/runtime-client-routing/globalContext.js +0 -49
- package/dist/cjs/client/runtime-client-routing/prefetch/PrefetchSetting.js +0 -2
- package/dist/cjs/client/runtime-server-routing/globalContext.js +0 -41
- package/dist/cjs/client/runtime-server-routing/onLoad.js +0 -7
- package/dist/cjs/client/runtime-server-routing/utils.js +0 -34
- package/dist/cjs/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/cjs/client/shared/getJsonSerializedInHtml.js +0 -40
- package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +0 -41
- package/dist/cjs/client/shared/utils.js +0 -23
- package/dist/cjs/node/api/build.js +0 -24
- package/dist/cjs/node/api/context.js +0 -23
- package/dist/cjs/node/api/dev.js +0 -18
- package/dist/cjs/node/api/index.js +0 -44
- package/dist/cjs/node/api/onLoad.js +0 -9
- package/dist/cjs/node/api/prepareViteApiCall.js +0 -206
- package/dist/cjs/node/api/prerender.js +0 -18
- package/dist/cjs/node/api/preview.js +0 -38
- package/dist/cjs/node/api/types.js +0 -2
- package/dist/cjs/node/api/utils.js +0 -27
- package/dist/cjs/node/cli/context.js +0 -17
- package/dist/cjs/node/cli/entry.js +0 -121
- package/dist/cjs/node/cli/index.js +0 -12
- package/dist/cjs/node/cli/onLoad.js +0 -9
- package/dist/cjs/node/cli/parseCli.js +0 -95
- package/dist/cjs/node/cli/utils.js +0 -24
- package/dist/cjs/node/client/router.js +0 -19
- package/dist/cjs/node/createPageRenderer.js +0 -132
- package/dist/cjs/node/importBuild.js +0 -3
- package/dist/cjs/node/prerender/context.js +0 -26
- package/dist/cjs/node/prerender/index.js +0 -12
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +0 -66
- package/dist/cjs/node/prerender/runPrerender.js +0 -777
- package/dist/cjs/node/prerender/runPrerenderEntry.js +0 -55
- package/dist/cjs/node/prerender/utils.js +0 -37
- package/dist/cjs/node/runtime/globalContext.js +0 -572
- package/dist/cjs/node/runtime/index-deprecated.js +0 -33
- package/dist/cjs/node/runtime/index.js +0 -74
- package/dist/cjs/node/runtime/loggerRuntime.js +0 -17
- package/dist/cjs/node/runtime/onLoad.js +0 -29
- package/dist/cjs/node/runtime/page-files/setup.js +0 -5
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +0 -71
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +0 -42
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +0 -51
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -114
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +0 -59
- package/dist/cjs/node/runtime/renderPage/csp.js +0 -47
- package/dist/cjs/node/runtime/renderPage/execHookDataAndOnBeforeRender.js +0 -31
- package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +0 -120
- package/dist/cjs/node/runtime/renderPage/execHookServer.js +0 -8
- package/dist/cjs/node/runtime/renderPage/getCacheControl.js +0 -24
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +0 -20
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +0 -137
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +0 -125
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsDev.js +0 -86
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsProd.js +0 -77
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +0 -36
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +0 -50
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +0 -41
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +0 -68
- package/dist/cjs/node/runtime/renderPage/headersResponse.js +0 -48
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getHtmlTags.js +0 -269
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getViteDevScript.js +0 -32
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/inferHtmlTags.js +0 -55
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectAssets__public.js +0 -31
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectHtmlTags.js +0 -161
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/mergeScriptTags.js +0 -73
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/sanitizeJson.js +0 -8
- package/dist/cjs/node/runtime/renderPage/html/injectAssets.js +0 -93
- package/dist/cjs/node/runtime/renderPage/html/propKeys.js +0 -47
- package/dist/cjs/node/runtime/renderPage/html/renderHtml.js +0 -245
- package/dist/cjs/node/runtime/renderPage/html/serializeContext.js +0 -189
- package/dist/cjs/node/runtime/renderPage/html/stream/react-streaming.js +0 -36
- package/dist/cjs/node/runtime/renderPage/html/stream.js +0 -829
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +0 -81
- package/dist/cjs/node/runtime/renderPage/isFontFallback.js +0 -29
- package/dist/cjs/node/runtime/renderPage/isNewError.js +0 -25
- package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +0 -124
- package/dist/cjs/node/runtime/renderPage/log404/index.js +0 -154
- package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +0 -20
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +0 -200
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +0 -34
- package/dist/cjs/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +0 -10
- package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +0 -83
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +0 -71
- package/dist/cjs/node/runtime/renderPage.js +0 -502
- package/dist/cjs/node/runtime/universal-middleware.js +0 -20
- package/dist/cjs/node/runtime/utils.js +0 -83
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -27
- package/dist/cjs/node/runtime-dev/index.js +0 -42
- package/dist/cjs/node/shared/assertV1Design.js +0 -30
- package/dist/cjs/node/shared/extractAssetsQuery.js +0 -29
- package/dist/cjs/node/shared/getVikeConfigError.js +0 -22
- package/dist/cjs/node/shared/isErrorDebug.js +0 -7
- package/dist/cjs/node/shared/prependEntriesDir.js +0 -13
- package/dist/cjs/node/shared/resolveBase.js +0 -35
- package/dist/cjs/node/shared/utils.js +0 -35
- package/dist/cjs/node/shared/virtualFileId.js +0 -110
- package/dist/cjs/node/vite/index.js +0 -69
- package/dist/cjs/node/vite/onLoad.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +0 -48
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -342
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -179
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -220
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -254
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -36
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -41
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -109
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -63
- package/dist/cjs/node/vite/plugins/pluginBuild.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +0 -88
- package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -197
- package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -28
- package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +0 -163
- package/dist/cjs/node/vite/plugins/pluginDev.js +0 -107
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -87
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -227
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -99
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -149
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -52
- package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -76
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -69
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -49
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/debug.js +0 -5
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +0 -56
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +0 -190
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +0 -54
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +0 -97
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +0 -215
- package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -15
- package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +0 -35
- package/dist/cjs/node/vite/shared/addSsrMiddleware.js +0 -60
- package/dist/cjs/node/vite/shared/findPageFiles.js +0 -25
- package/dist/cjs/node/vite/shared/getAssetsDir.js +0 -10
- package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +0 -42
- package/dist/cjs/node/vite/shared/getEnvVarObject.js +0 -37
- package/dist/cjs/node/vite/shared/getFilePath.js +0 -172
- package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +0 -125
- package/dist/cjs/node/vite/shared/getMagicString.js +0 -18
- package/dist/cjs/node/vite/shared/getManifestFilePathRelative.js +0 -10
- package/dist/cjs/node/vite/shared/getOutDirs.js +0 -146
- package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +0 -21
- package/dist/cjs/node/vite/shared/isAsset.js +0 -40
- package/dist/cjs/node/vite/shared/isViteCliCall.js +0 -83
- package/dist/cjs/node/vite/shared/isViteServerSide.js +0 -68
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +0 -38
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +0 -26
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +0 -85
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +0 -30
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +0 -29
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +0 -13
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +0 -162
- package/dist/cjs/node/vite/shared/loggerNotProd/log.js +0 -102
- package/dist/cjs/node/vite/shared/loggerNotProd.js +0 -208
- package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +0 -26
- package/dist/cjs/node/vite/shared/loggerVite.js +0 -54
- package/dist/cjs/node/vite/shared/normalizeId.js +0 -9
- package/dist/cjs/node/vite/shared/parseEsModule.js +0 -33
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +0 -136
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +0 -262
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +0 -18
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +0 -252
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +0 -190
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getConfigFileExport.js +0 -17
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +0 -127
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +0 -129
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +0 -195
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +0 -102
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +0 -425
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +0 -1151
- package/dist/cjs/node/vite/shared/rollupIsEsm.js +0 -15
- package/dist/cjs/node/vite/utils.js +0 -45
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/shared/NOT_SERIALIZABLE.js +0 -4
- package/dist/cjs/shared/RenderErrorPage.js +0 -6
- package/dist/cjs/shared/abort.js +0 -16
- package/dist/cjs/shared/addIs404ToPageProps.js +0 -18
- package/dist/cjs/shared/assertHookReturnedObject.js +0 -21
- package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +0 -21
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +0 -20
- package/dist/cjs/shared/createGlobalContextShared.js +0 -109
- package/dist/cjs/shared/createPageContextShared.js +0 -17
- package/dist/cjs/shared/determinePageIdOld.js +0 -11
- package/dist/cjs/shared/error-page.js +0 -40
- package/dist/cjs/shared/getPageContext.js +0 -6
- package/dist/cjs/shared/getPageContextRequestUrl.js +0 -16
- package/dist/cjs/shared/getPageContextUrlComputed.js +0 -132
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +0 -19
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +0 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +0 -50
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +0 -30
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +0 -15
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +0 -59
- package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +0 -22
- package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +0 -24
- package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -52
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -102
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -56
- package/dist/cjs/shared/getPageFiles/parseVirtualFileExportsGlobalEntry.js +0 -100
- package/dist/cjs/shared/getPageFiles.js +0 -7
- package/dist/cjs/shared/getProxyForPublicUsage.js +0 -56
- package/dist/cjs/shared/hooks/execHook.js +0 -147
- package/dist/cjs/shared/hooks/getHook.js +0 -173
- package/dist/cjs/shared/htmlElementIds.js +0 -5
- package/dist/cjs/shared/misc/isServerSideError.js +0 -4
- package/dist/cjs/shared/misc/pageContextInitIsPassedToClient.js +0 -4
- package/dist/cjs/shared/modifyUrl.js +0 -28
- package/dist/cjs/shared/modifyUrlSameOrigin.js +0 -47
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +0 -42
- package/dist/cjs/shared/page-configs/findPageConfig.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +0 -65
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -68
- package/dist/cjs/shared/page-configs/getConfigValueRuntime.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigValueTyped.js +0 -32
- package/dist/cjs/shared/page-configs/getExportPath.js +0 -29
- package/dist/cjs/shared/page-configs/helpers.js +0 -27
- package/dist/cjs/shared/page-configs/loadAndParseVirtualFilePageEntry.js +0 -25
- package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +0 -287
- package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +0 -2
- package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -1
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigsSerialized.js +0 -145
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +0 -290
- package/dist/cjs/shared/prepareGlobalContextForPublicUsage.js +0 -10
- package/dist/cjs/shared/preparePageContextForPublicUsage.js +0 -80
- package/dist/cjs/shared/route/abort.js +0 -178
- package/dist/cjs/shared/route/debug.js +0 -23
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +0 -52
- package/dist/cjs/shared/route/execHookGuard.js +0 -37
- package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -84
- package/dist/cjs/shared/route/index.js +0 -107
- package/dist/cjs/shared/route/loadPageRoutes.js +0 -197
- package/dist/cjs/shared/route/noRouteMatch.js +0 -4
- package/dist/cjs/shared/route/resolvePrecedence.js +0 -93
- package/dist/cjs/shared/route/resolveRoute.js +0 -20
- package/dist/cjs/shared/route/resolveRouteFunction.js +0 -73
- package/dist/cjs/shared/route/resolveRouteString.js +0 -153
- package/dist/cjs/shared/route/resolveUrlPathname.js +0 -47
- package/dist/cjs/shared/route/routing.js +0 -9
- package/dist/cjs/shared/route/utils.js +0 -40
- package/dist/cjs/shared/utils.js +0 -49
- package/dist/cjs/types/Config/ConfigResolved.js +0 -2
- package/dist/cjs/types/Config.js +0 -2
- package/dist/cjs/types/FilePath.js +0 -2
- package/dist/cjs/types/PageConfig.js +0 -2
- package/dist/cjs/types/PageContext.js +0 -2
- package/dist/cjs/types/VikeGlobalInternal.js +0 -2
- package/dist/cjs/types/VikeNamespace.js +0 -2
- package/dist/cjs/types/ViteManifest.js +0 -2
- package/dist/cjs/types/defineConfig.js +0 -6
- package/dist/cjs/types/index-dreprecated.js +0 -3
- package/dist/cjs/types/index.js +0 -5
- package/dist/cjs/utils/PROJECT_VERSION.js +0 -5
- package/dist/cjs/utils/PromiseType.js +0 -2
- package/dist/cjs/utils/assert.js +0 -211
- package/dist/cjs/utils/assertIsBrowser.js +0 -8
- package/dist/cjs/utils/assertIsNotBrowser.js +0 -9
- package/dist/cjs/utils/assertKeys.js +0 -27
- package/dist/cjs/utils/assertNodeVersion.js +0 -14
- package/dist/cjs/utils/assertRoutingType.js +0 -29
- package/dist/cjs/utils/assertSetup.js +0 -171
- package/dist/cjs/utils/assertSingleInstance.js +0 -110
- package/dist/cjs/utils/assertVersion.js +0 -60
- package/dist/cjs/utils/capitalizeFirstLetter.js +0 -9
- package/dist/cjs/utils/cast.js +0 -6
- package/dist/cjs/utils/catchInfiniteLoop.js +0 -34
- package/dist/cjs/utils/changeEnumerable.js +0 -8
- package/dist/cjs/utils/checkType.js +0 -6
- package/dist/cjs/utils/compareString.js +0 -10
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +0 -39
- package/dist/cjs/utils/debug.js +0 -178
- package/dist/cjs/utils/debugGlob.js +0 -6
- package/dist/cjs/utils/deepEqual.js +0 -10
- package/dist/cjs/utils/escapeHtml.js +0 -13
- package/dist/cjs/utils/escapeRegex.js +0 -7
- package/dist/cjs/utils/findFile.js +0 -30
- package/dist/cjs/utils/findPackageJson.js +0 -18
- package/dist/cjs/utils/formatHintLog.js +0 -17
- package/dist/cjs/utils/freezePartial.js +0 -35
- package/dist/cjs/utils/genPromise.js +0 -51
- package/dist/cjs/utils/getFileExtension.js +0 -16
- package/dist/cjs/utils/getGlobalObject.js +0 -15
- package/dist/cjs/utils/getMostSimilar.js +0 -68
- package/dist/cjs/utils/getPropAccessNotation.js +0 -9
- package/dist/cjs/utils/getRandomId.js +0 -14
- package/dist/cjs/utils/getTerminalWidth.js +0 -7
- package/dist/cjs/utils/getValuePrintable.js +0 -10
- package/dist/cjs/utils/getViteRPC.js +0 -79
- package/dist/cjs/utils/hasProp.js +0 -50
- package/dist/cjs/utils/humanizeTime.js +0 -24
- package/dist/cjs/utils/includes.js +0 -13
- package/dist/cjs/utils/injectRollupInputs.js +0 -29
- package/dist/cjs/utils/isArray.js +0 -7
- package/dist/cjs/utils/isArrayOfStrings.js +0 -7
- package/dist/cjs/utils/isBrowser.js +0 -8
- package/dist/cjs/utils/isCallable.js +0 -6
- package/dist/cjs/utils/isDev.js +0 -20
- package/dist/cjs/utils/isDocker.js +0 -45
- package/dist/cjs/utils/isEqualStringList.js +0 -13
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +0 -66
- package/dist/cjs/utils/isHtml.js +0 -9
- package/dist/cjs/utils/isImportPath.js +0 -21
- package/dist/cjs/utils/isNodeJS.js +0 -16
- package/dist/cjs/utils/isNonRunnableDev.js +0 -12
- package/dist/cjs/utils/isNullish.js +0 -16
- package/dist/cjs/utils/isObject.js +0 -6
- package/dist/cjs/utils/isObjectOfStrings.js +0 -7
- package/dist/cjs/utils/isObjectWithKeys.js +0 -15
- package/dist/cjs/utils/isPlainObject.js +0 -19
- package/dist/cjs/utils/isPromise.js +0 -7
- package/dist/cjs/utils/isPropertyGetter.js +0 -7
- package/dist/cjs/utils/isReact.js +0 -23
- package/dist/cjs/utils/isRunnableDevEnvironment.js +0 -9
- package/dist/cjs/utils/isSameErrorMessage.js +0 -9
- package/dist/cjs/utils/isScriptFile.js +0 -67
- package/dist/cjs/utils/isVikeReactApp.js +0 -8
- package/dist/cjs/utils/isVitest.js +0 -6
- package/dist/cjs/utils/joinEnglish.js +0 -14
- package/dist/cjs/utils/normalizeHeaders.js +0 -17
- package/dist/cjs/utils/objectAssign.js +0 -14
- package/dist/cjs/utils/objectAssignSafe.js +0 -7
- package/dist/cjs/utils/objectDefineProperty.js +0 -7
- package/dist/cjs/utils/objectEntries.js +0 -8
- package/dist/cjs/utils/objectEntriesForEach.js +0 -7
- package/dist/cjs/utils/objectFilter.js +0 -10
- package/dist/cjs/utils/objectFromEntries.js +0 -7
- package/dist/cjs/utils/objectKeys.js +0 -9
- package/dist/cjs/utils/objectReplace.js +0 -9
- package/dist/cjs/utils/onPageVisibilityChange.js +0 -18
- package/dist/cjs/utils/pLimit.js +0 -134
- package/dist/cjs/utils/parseNpmPackage.js +0 -106
- package/dist/cjs/utils/parseUrl-extras.js +0 -110
- package/dist/cjs/utils/parseUrl.js +0 -338
- package/dist/cjs/utils/path.js +0 -59
- package/dist/cjs/utils/pick.js +0 -12
- package/dist/cjs/utils/preservePropertyGetters.js +0 -30
- package/dist/cjs/utils/redirectHard.js +0 -6
- package/dist/cjs/utils/removeEmptyLines.js +0 -9
- package/dist/cjs/utils/removeFileExtension.js +0 -6
- package/dist/cjs/utils/requireResolve.js +0 -214
- package/dist/cjs/utils/rollupSourceMap.js +0 -19
- package/dist/cjs/utils/sleep.js +0 -6
- package/dist/cjs/utils/slice.js +0 -35
- package/dist/cjs/utils/sorter.js +0 -117
- package/dist/cjs/utils/stringifyStringArray.js +0 -6
- package/dist/cjs/utils/stripAnsi.js +0 -21
- package/dist/cjs/utils/styleFileRE.js +0 -6
- package/dist/cjs/utils/throttle.js +0 -15
- package/dist/cjs/utils/trackLogs.js +0 -31
- package/dist/cjs/utils/trimWithAnsi.js +0 -40
- package/dist/cjs/utils/truncateString.js +0 -23
- package/dist/cjs/utils/unique.js +0 -6
- package/dist/cjs/utils/updateType.js +0 -9
- package/dist/cjs/utils/urlToFile.js +0 -36
- package/dist/cjs/utils/virtualFileId.js +0 -39
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
- package/dist/esm/client/runtime-server-routing/globalContext.js +0 -5
- package/dist/esm/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -249
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -34
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -39
- package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginBuild.js +0 -19
- package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +0 -85
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +0 -50
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -67
- package/dist/esm/shared/route/debug.d.ts +0 -6
- package/dist/esm/shared/route/debug.js +0 -21
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.d.ts +0 -0
|
@@ -1,136 +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.assertExtensionsConventions = assertExtensionsConventions;
|
|
7
|
-
exports.assertExtensionsRequire = assertExtensionsRequire;
|
|
8
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
-
const utils_js_1 = require("../../utils.js");
|
|
10
|
-
const resolveVikeConfigInternal_js_1 = require("../resolveVikeConfigInternal.js");
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const semver_1 = __importDefault(require("semver"));
|
|
13
|
-
function assertExtensionsConventions(plusFile) {
|
|
14
|
-
assertExtensionName(plusFile);
|
|
15
|
-
assertConfigExportPath(plusFile);
|
|
16
|
-
}
|
|
17
|
-
function assertConfigExportPath(plusFile) {
|
|
18
|
-
const { importPathAbsolute, filePathAbsoluteFilesystem } = plusFile.filePath;
|
|
19
|
-
// Ejected Vike extension
|
|
20
|
-
if (!importPathAbsolute) {
|
|
21
|
-
const p = filePathAbsoluteFilesystem;
|
|
22
|
-
(0, utils_js_1.assert)(!p.includes('node_modules'));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const name = getNameValue(plusFile);
|
|
26
|
-
(0, utils_js_1.assert)(name); // already asserted in assertExtensionName()
|
|
27
|
-
const importPathAbsoluteExpected = `${name}/config`;
|
|
28
|
-
(0, utils_js_1.assertWarning)(importPathAbsolute === importPathAbsoluteExpected, `The Vike configuration of ${picocolors_1.default.bold(name)} is exported at ${picocolors_1.default.bold(importPathAbsolute)}, but it should be exported at ${picocolors_1.default.bold(importPathAbsoluteExpected)} instead.`, { onlyOnce: true });
|
|
29
|
-
}
|
|
30
|
-
function assertExtensionName(plusFile) {
|
|
31
|
-
const filePathToShowToUser = getFilePathToShowToUser(plusFile);
|
|
32
|
-
const name = getNameValue(plusFile);
|
|
33
|
-
(0, utils_js_1.assertUsage)(name, `Vike extension name missing: the config ${filePathToShowToUser} must define the setting ${picocolors_1.default.cyan('name')}`);
|
|
34
|
-
}
|
|
35
|
-
function assertExtensionsRequire(plusFiles) {
|
|
36
|
-
const plusFilesRelevantList = plusFiles;
|
|
37
|
-
// Collect extensions
|
|
38
|
-
const extensions = {};
|
|
39
|
-
plusFilesRelevantList.forEach((plusFile) => {
|
|
40
|
-
const name = getNameValue(plusFile);
|
|
41
|
-
if (name) {
|
|
42
|
-
const version = getExtensionVersion(name, plusFile);
|
|
43
|
-
extensions[name] = version;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
// Enforce `require`
|
|
47
|
-
plusFilesRelevantList.forEach((plusFile) => {
|
|
48
|
-
const require = resolveRequireSetting(plusFile);
|
|
49
|
-
if (!require)
|
|
50
|
-
return;
|
|
51
|
-
const name = getNameValue(plusFile);
|
|
52
|
-
const filePathToShowToUser = getFilePathToShowToUser(plusFile);
|
|
53
|
-
(0, utils_js_1.assertUsage)(name, `Setting ${picocolors_1.default.bold('name')} is required for being able to use setting ${picocolors_1.default.bold('require')} in ${filePathToShowToUser}.`);
|
|
54
|
-
Object.entries(require).forEach(([reqName, req]) => {
|
|
55
|
-
const errBase = `${picocolors_1.default.bold(name)} requires ${picocolors_1.default.bold(reqName)}`;
|
|
56
|
-
if (reqName === 'vike') {
|
|
57
|
-
let errMsg = `${errBase} version ${picocolors_1.default.bold(req.version)}, but ${picocolors_1.default.bold(utils_js_1.PROJECT_VERSION)} is installed.`;
|
|
58
|
-
if (req.optional) {
|
|
59
|
-
errMsg += " Either update it, or remove it (it's an optional peer dependency).";
|
|
60
|
-
}
|
|
61
|
-
(0, utils_js_1.assertUsage)(isVersionRange(utils_js_1.PROJECT_VERSION, req.version), errMsg);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const extensionVersion = extensions[reqName];
|
|
65
|
-
if (!extensionVersion) {
|
|
66
|
-
if (req.optional) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
(0, utils_js_1.assertUsage)(false, `${errBase}.`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
(0, utils_js_1.assertUsage)(isVersionRange(extensionVersion, req.version), `${errBase} version ${picocolors_1.default.bold(req.version)}, but ${picocolors_1.default.bold(extensionVersion)} is installed.`);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function resolveRequireSetting(plusFile) {
|
|
78
|
-
const confVal = (0, resolveVikeConfigInternal_js_1.getConfVal)(plusFile, 'require');
|
|
79
|
-
if (!confVal)
|
|
80
|
-
return null;
|
|
81
|
-
(0, utils_js_1.assert)(confVal.valueIsLoaded);
|
|
82
|
-
const requireValue = confVal.value;
|
|
83
|
-
const { filePathToShowToUserResolved } = plusFile.filePath;
|
|
84
|
-
(0, utils_js_1.assert)(filePathToShowToUserResolved);
|
|
85
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(requireValue), `The setting ${picocolors_1.default.bold('+require')} defined at ${filePathToShowToUserResolved} should be an object`);
|
|
86
|
-
const requireSetting = {};
|
|
87
|
-
Object.entries(requireValue).forEach(([reqName, req]) => {
|
|
88
|
-
if (typeof req === 'string') {
|
|
89
|
-
requireSetting[reqName] = { version: req, optional: false };
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if ((0, utils_js_1.isObject)(req)) {
|
|
93
|
-
requireSetting[reqName] = req;
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
(0, utils_js_1.assertUsage)(false, `Invalid +require[${JSON.stringify(reqName)}] value ${picocolors_1.default.cyan(JSON.stringify(req))}`);
|
|
97
|
-
});
|
|
98
|
-
return requireSetting;
|
|
99
|
-
}
|
|
100
|
-
function getNameValue(plusFile) {
|
|
101
|
-
const confVal = (0, resolveVikeConfigInternal_js_1.getConfVal)(plusFile, 'name');
|
|
102
|
-
if (!confVal)
|
|
103
|
-
return null;
|
|
104
|
-
(0, utils_js_1.assert)(confVal.valueIsLoaded);
|
|
105
|
-
const name = confVal.value;
|
|
106
|
-
const filePathToShowToUser = getFilePathToShowToUser(plusFile);
|
|
107
|
-
(0, utils_js_1.assertUsage)(typeof name === 'string', `The setting ${picocolors_1.default.bold('name')} defined at ${filePathToShowToUser} should be a string.`);
|
|
108
|
-
return name;
|
|
109
|
-
}
|
|
110
|
-
// We use a forever cache: users need to restart the dev server anyways when touching node_modules/**/* (I presume Vite doesn't pick up node_modules/**/* changes).
|
|
111
|
-
const extensionsVersion = {};
|
|
112
|
-
function getExtensionVersion(name, plusFile) {
|
|
113
|
-
if (!extensionsVersion[name]) {
|
|
114
|
-
const extensionConfigFilePath = plusFile.filePath.filePathAbsoluteFilesystem;
|
|
115
|
-
const found = (0, utils_js_1.findPackageJson)(node_path_1.default.posix.dirname(extensionConfigFilePath));
|
|
116
|
-
(0, utils_js_1.assert)(found);
|
|
117
|
-
const { packageJson, packageJsonPath } = found;
|
|
118
|
-
const filePathToShowToUser = getFilePathToShowToUser(plusFile);
|
|
119
|
-
const nameExpected = packageJson.name;
|
|
120
|
-
(0, utils_js_1.assertWarning)(name === nameExpected, `The setting ${picocolors_1.default.bold('name')} defined at ${filePathToShowToUser} is ${picocolors_1.default.bold(JSON.stringify(name))}, but it should be equal to ${picocolors_1.default.bold(JSON.stringify(nameExpected))} (the value of ${packageJsonPath}${picocolors_1.default.dim('#')}${picocolors_1.default.bold('name')})`, { onlyOnce: true });
|
|
121
|
-
const { version } = packageJson;
|
|
122
|
-
(0, utils_js_1.assert)(typeof version === 'string');
|
|
123
|
-
extensionsVersion[name] = version;
|
|
124
|
-
}
|
|
125
|
-
return extensionsVersion[name];
|
|
126
|
-
}
|
|
127
|
-
function getFilePathToShowToUser(plusFile) {
|
|
128
|
-
const { filePathToShowToUserResolved } = plusFile.filePath;
|
|
129
|
-
(0, utils_js_1.assert)(filePathToShowToUserResolved);
|
|
130
|
-
return filePathToShowToUserResolved;
|
|
131
|
-
}
|
|
132
|
-
function isVersionRange(version, range) {
|
|
133
|
-
// Remove pre-release tag
|
|
134
|
-
version = version.split('-')[0];
|
|
135
|
-
return semver_1.default.satisfies(version, range);
|
|
136
|
-
}
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configDefinitionsBuiltIn = void 0;
|
|
4
|
-
const utils_js_1 = require("../../utils.js");
|
|
5
|
-
const getConfigDefinedAt_js_1 = require("../../../../shared/page-configs/getConfigDefinedAt.js");
|
|
6
|
-
const getConfigValueSourcesRelevant_js_1 = require("../../plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js");
|
|
7
|
-
const configDefinitionsBuiltIn = {
|
|
8
|
-
onRenderHtml: {
|
|
9
|
-
env: { server: true },
|
|
10
|
-
},
|
|
11
|
-
onRenderClient: {
|
|
12
|
-
env: { client: true },
|
|
13
|
-
},
|
|
14
|
-
onHydrationEnd: {
|
|
15
|
-
env: { client: true },
|
|
16
|
-
},
|
|
17
|
-
onPageTransitionStart: {
|
|
18
|
-
env: { client: true },
|
|
19
|
-
},
|
|
20
|
-
onPageTransitionEnd: {
|
|
21
|
-
env: { client: true },
|
|
22
|
-
},
|
|
23
|
-
onCreatePageContext: {
|
|
24
|
-
env: { server: true, client: true },
|
|
25
|
-
cumulative: true,
|
|
26
|
-
},
|
|
27
|
-
onCreateGlobalContext: {
|
|
28
|
-
env: { server: true, client: true },
|
|
29
|
-
global: true,
|
|
30
|
-
cumulative: true,
|
|
31
|
-
},
|
|
32
|
-
onBeforeRender: {
|
|
33
|
-
env: { server: true },
|
|
34
|
-
},
|
|
35
|
-
onBeforePrerenderStart: {
|
|
36
|
-
env: { server: true, production: true },
|
|
37
|
-
},
|
|
38
|
-
Page: {
|
|
39
|
-
env: { server: true, client: true },
|
|
40
|
-
},
|
|
41
|
-
passToClient: {
|
|
42
|
-
env: { server: true },
|
|
43
|
-
cumulative: true,
|
|
44
|
-
},
|
|
45
|
-
route: {
|
|
46
|
-
env: {
|
|
47
|
-
server: true,
|
|
48
|
-
client: 'if-client-routing',
|
|
49
|
-
// For vite-plugin-vercel
|
|
50
|
-
config: true,
|
|
51
|
-
},
|
|
52
|
-
eager: true,
|
|
53
|
-
},
|
|
54
|
-
guard: {
|
|
55
|
-
env: { server: true, client: 'if-client-routing' },
|
|
56
|
-
},
|
|
57
|
-
data: {
|
|
58
|
-
env: { server: true },
|
|
59
|
-
},
|
|
60
|
-
onData: {
|
|
61
|
-
env: { server: true, client: true },
|
|
62
|
-
cumulative: true,
|
|
63
|
-
},
|
|
64
|
-
iKnowThePerformanceRisksOfAsyncRouteFunctions: {
|
|
65
|
-
env: { server: true, client: 'if-client-routing' },
|
|
66
|
-
eager: true,
|
|
67
|
-
},
|
|
68
|
-
filesystemRoutingRoot: {
|
|
69
|
-
env: { config: true },
|
|
70
|
-
},
|
|
71
|
-
client: {
|
|
72
|
-
// The value of the client config is merely the file path to the client entry file, which is only needed on the sever-side
|
|
73
|
-
env: { server: true, config: true },
|
|
74
|
-
_valueIsFilePath: true,
|
|
75
|
-
},
|
|
76
|
-
clientRouting: {
|
|
77
|
-
// We could make it { client: false } but we don't yet because of some legacy V0.4 design code
|
|
78
|
-
env: { server: true, client: true, config: true },
|
|
79
|
-
eager: true,
|
|
80
|
-
},
|
|
81
|
-
clientHooks: {
|
|
82
|
-
env: { config: true },
|
|
83
|
-
},
|
|
84
|
-
hydrationCanBeAborted: {
|
|
85
|
-
env: { client: true },
|
|
86
|
-
},
|
|
87
|
-
prefetch: {
|
|
88
|
-
env: { client: true },
|
|
89
|
-
eager: true,
|
|
90
|
-
},
|
|
91
|
-
// TO-DO/next-major-release: remove
|
|
92
|
-
prefetchStaticAssets: {
|
|
93
|
-
env: { client: true },
|
|
94
|
-
},
|
|
95
|
-
extends: {
|
|
96
|
-
env: { config: true },
|
|
97
|
-
},
|
|
98
|
-
meta: {
|
|
99
|
-
env: { config: true },
|
|
100
|
-
},
|
|
101
|
-
serverOnlyHooks: {
|
|
102
|
-
env: { client: true },
|
|
103
|
-
eager: true,
|
|
104
|
-
_computed: (pageConfig) => {
|
|
105
|
-
const sources = ['data', 'onBeforeRender', 'onCreatePageContext']
|
|
106
|
-
.map((hookName) => (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourcesRelevant)(hookName, {
|
|
107
|
-
isForClientSide: false,
|
|
108
|
-
// TO-DO/eventually/remove-server-router: let's eventually remove support for Server Routing
|
|
109
|
-
isClientRouting: true,
|
|
110
|
-
}, pageConfig))
|
|
111
|
-
.flat(1)
|
|
112
|
-
// Server-only
|
|
113
|
-
.filter((source) => !source.configEnv.client)
|
|
114
|
-
// Config value isn't `null`
|
|
115
|
-
.filter((source) => !(0, getConfigValueSourcesRelevant_js_1.isConfigSourceValueNull)(source));
|
|
116
|
-
return sources.length > 0;
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
// Whether the page loads:
|
|
120
|
-
// - Vike's client runtime
|
|
121
|
-
// - User's client hooks
|
|
122
|
-
// In other words, whether the page is "HTML-only" (https://vike.dev/render-modes). HTML-only pages shouldn't load the client runtime nor client hooks.
|
|
123
|
-
isClientRuntimeLoaded: {
|
|
124
|
-
env: { server: true, client: true },
|
|
125
|
-
eager: true,
|
|
126
|
-
_computed: (pageConfig) => {
|
|
127
|
-
{
|
|
128
|
-
const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)('clientHooks', pageConfig);
|
|
129
|
-
if (source) {
|
|
130
|
-
(0, utils_js_1.assert)(source.valueIsLoaded);
|
|
131
|
-
const { value, definedAt } = source;
|
|
132
|
-
const configDefinedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAt)('Config', 'clientHooks', definedAt);
|
|
133
|
-
(0, utils_js_1.assertUsage)(typeof value === 'boolean', `${configDefinedAt} should be a boolean`);
|
|
134
|
-
return value;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return (isConfigSet(pageConfig, 'onRenderClient') &&
|
|
138
|
-
isConfigSet(pageConfig, 'Page') &&
|
|
139
|
-
!!getConfigEnv(pageConfig, 'Page')?.client);
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
// TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
|
|
143
|
-
onBeforeRenderEnv: {
|
|
144
|
-
env: { client: true },
|
|
145
|
-
eager: true,
|
|
146
|
-
_computed: (pageConfig) => {
|
|
147
|
-
return !isConfigSet(pageConfig, 'onBeforeRender') ? null : getConfigEnv(pageConfig, 'onBeforeRender');
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
// TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
|
|
151
|
-
dataEnv: {
|
|
152
|
-
env: { client: true },
|
|
153
|
-
eager: true,
|
|
154
|
-
_computed: (pageConfig) => {
|
|
155
|
-
return !isConfigSet(pageConfig, 'data') ? null : getConfigEnv(pageConfig, 'data');
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
hooksTimeout: {
|
|
159
|
-
env: { server: true, client: true },
|
|
160
|
-
},
|
|
161
|
-
cacheControl: {
|
|
162
|
-
env: { server: true },
|
|
163
|
-
},
|
|
164
|
-
host: {
|
|
165
|
-
env: { config: true },
|
|
166
|
-
global: true,
|
|
167
|
-
},
|
|
168
|
-
port: {
|
|
169
|
-
env: { config: true },
|
|
170
|
-
global: true,
|
|
171
|
-
},
|
|
172
|
-
mode: {
|
|
173
|
-
env: { config: true },
|
|
174
|
-
global: true,
|
|
175
|
-
},
|
|
176
|
-
csp: {
|
|
177
|
-
env: { server: true },
|
|
178
|
-
},
|
|
179
|
-
injectScriptsAt: {
|
|
180
|
-
env: { server: true },
|
|
181
|
-
},
|
|
182
|
-
name: {
|
|
183
|
-
env: { config: true },
|
|
184
|
-
},
|
|
185
|
-
require: {
|
|
186
|
-
env: { config: true },
|
|
187
|
-
},
|
|
188
|
-
keepScrollPosition: {
|
|
189
|
-
env: { client: true },
|
|
190
|
-
},
|
|
191
|
-
middleware: { env: { server: true }, cumulative: true, eager: true, global: true },
|
|
192
|
-
onPrerenderStart: {
|
|
193
|
-
env: { server: true, production: true },
|
|
194
|
-
eager: true,
|
|
195
|
-
global: true,
|
|
196
|
-
},
|
|
197
|
-
onBeforeRoute: {
|
|
198
|
-
env: { server: true, client: 'if-client-routing' },
|
|
199
|
-
eager: true,
|
|
200
|
-
global: true,
|
|
201
|
-
},
|
|
202
|
-
prerender: {
|
|
203
|
-
env: { config: true },
|
|
204
|
-
global: (value, { isGlobalLocation }) => typeof value === 'object' || isGlobalLocation,
|
|
205
|
-
cumulative: true,
|
|
206
|
-
},
|
|
207
|
-
vite: { env: { config: true }, global: true, cumulative: true },
|
|
208
|
-
disableAutoFullBuild: {
|
|
209
|
-
env: { config: true },
|
|
210
|
-
global: true,
|
|
211
|
-
},
|
|
212
|
-
vite6BuilderApp: {
|
|
213
|
-
env: { config: true },
|
|
214
|
-
global: true,
|
|
215
|
-
},
|
|
216
|
-
includeAssetsImportedByServer: {
|
|
217
|
-
env: { config: true },
|
|
218
|
-
global: true,
|
|
219
|
-
},
|
|
220
|
-
baseAssets: {
|
|
221
|
-
env: { config: true, server: true },
|
|
222
|
-
global: true,
|
|
223
|
-
},
|
|
224
|
-
baseServer: {
|
|
225
|
-
env: { config: true, server: true },
|
|
226
|
-
global: true,
|
|
227
|
-
},
|
|
228
|
-
redirects: {
|
|
229
|
-
env: { server: true },
|
|
230
|
-
global: true,
|
|
231
|
-
cumulative: true,
|
|
232
|
-
},
|
|
233
|
-
trailingSlash: {
|
|
234
|
-
env: { server: true },
|
|
235
|
-
global: true,
|
|
236
|
-
},
|
|
237
|
-
disableUrlNormalization: {
|
|
238
|
-
env: { server: true },
|
|
239
|
-
global: true,
|
|
240
|
-
},
|
|
241
|
-
headersResponse: {
|
|
242
|
-
env: { server: true },
|
|
243
|
-
cumulative: true,
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
exports.configDefinitionsBuiltIn = configDefinitionsBuiltIn;
|
|
247
|
-
function getConfigEnv(pageConfig, configName) {
|
|
248
|
-
const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)(configName, pageConfig);
|
|
249
|
-
if (!source)
|
|
250
|
-
return null;
|
|
251
|
-
const { configEnv } = source;
|
|
252
|
-
const env = {};
|
|
253
|
-
if (configEnv.client)
|
|
254
|
-
env.client = true;
|
|
255
|
-
if (configEnv.server)
|
|
256
|
-
env.server = true;
|
|
257
|
-
return env;
|
|
258
|
-
}
|
|
259
|
-
function isConfigSet(pageConfig, configName) {
|
|
260
|
-
const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)(configName, pageConfig);
|
|
261
|
-
return !!source;
|
|
262
|
-
}
|
package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ignorePatternsBuiltIn = void 0;
|
|
4
|
-
exports.ignorePatternsBuiltIn = [
|
|
5
|
-
'**/node_modules/**',
|
|
6
|
-
// Ejected Vike extensions, see https://github.com/snake-py/eject
|
|
7
|
-
'**/ejected/**',
|
|
8
|
-
// Allow:
|
|
9
|
-
// ```bash
|
|
10
|
-
// +Page.js
|
|
11
|
-
// +Page.telefunc.js
|
|
12
|
-
// ```
|
|
13
|
-
'**/*.telefunc.*',
|
|
14
|
-
// https://github.com/vikejs/vike/issues/1589#issuecomment-2031925598
|
|
15
|
-
'**/.history/**',
|
|
16
|
-
// https://github.com/vikejs/vike/discussions/2222
|
|
17
|
-
'**/*.generated.*',
|
|
18
|
-
];
|
|
@@ -1,252 +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.crawlPlusFiles = crawlPlusFiles;
|
|
7
|
-
exports.isPlusFile = isPlusFile;
|
|
8
|
-
exports.getPlusFileValueConfigName = getPlusFileValueConfigName;
|
|
9
|
-
const utils_js_1 = require("../../utils.js");
|
|
10
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
-
const tinyglobby_1 = require("tinyglobby");
|
|
12
|
-
const node_child_process_1 = require("node:child_process");
|
|
13
|
-
const node_util_1 = require("node:util");
|
|
14
|
-
const transpileAndExecuteFile_js_1 = require("./transpileAndExecuteFile.js");
|
|
15
|
-
const getEnvVarObject_js_1 = require("../getEnvVarObject.js");
|
|
16
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
17
|
-
const picomatch_1 = __importDefault(require("picomatch"));
|
|
18
|
-
const ignorePatternsBuiltIn_js_1 = require("./crawlPlusFiles/ignorePatternsBuiltIn.js");
|
|
19
|
-
const execA = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
20
|
-
const debug = (0, utils_js_1.createDebugger)('vike:crawl');
|
|
21
|
-
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
22
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('getVikeConfig/crawlPlusFiles.ts', {
|
|
23
|
-
gitIsNotUsable: false,
|
|
24
|
-
});
|
|
25
|
-
async function crawlPlusFiles(userRootDir) {
|
|
26
|
-
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
27
|
-
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(userRootDir);
|
|
28
|
-
const userSettings = getUserSettings();
|
|
29
|
-
const { ignorePatterns, ignoreMatchers } = getIgnore(userSettings);
|
|
30
|
-
// Crawl
|
|
31
|
-
const filesGit = userSettings.git !== false && (await gitLsFiles(userRootDir, ignorePatterns, ignoreMatchers));
|
|
32
|
-
const filesGitNothingFound = !filesGit || filesGit.length === 0;
|
|
33
|
-
const filesGlob = (filesGitNothingFound || debug.isActivated) && (await tinyglobby(userRootDir, ignorePatterns));
|
|
34
|
-
let files = !filesGitNothingFound
|
|
35
|
-
? filesGit
|
|
36
|
-
: // Fallback to tinyglobby for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
|
|
37
|
-
filesGlob;
|
|
38
|
-
(0, utils_js_1.assert)(files);
|
|
39
|
-
if (debug.isActivated && filesGit && filesGlob) {
|
|
40
|
-
(0, utils_js_1.assertWarning)((0, utils_js_1.deepEqual)(filesGlob.slice().sort(), filesGit.slice().sort()), "Git and glob results aren't matching.", { onlyOnce: false });
|
|
41
|
-
}
|
|
42
|
-
// Filter build files
|
|
43
|
-
files = files.filter((filePath) => !(0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(filePath));
|
|
44
|
-
// Normalize
|
|
45
|
-
const plusFiles = files.map((filePath) => {
|
|
46
|
-
// Both `$ git-ls files` and tinyglobby return posix paths
|
|
47
|
-
(0, utils_js_1.assertPosixPath)(filePath);
|
|
48
|
-
(0, utils_js_1.assert)(!filePath.startsWith(userRootDir));
|
|
49
|
-
const filePathAbsoluteUserRootDir = node_path_1.default.posix.join('/', filePath);
|
|
50
|
-
(0, utils_js_1.assert)(isPlusFile(filePathAbsoluteUserRootDir));
|
|
51
|
-
return { filePathAbsoluteUserRootDir };
|
|
52
|
-
});
|
|
53
|
-
return plusFiles;
|
|
54
|
-
}
|
|
55
|
-
// Same as tinyglobby() but using `$ git ls-files`
|
|
56
|
-
async function gitLsFiles(userRootDir, ignorePatterns, ignoreMatchers) {
|
|
57
|
-
if (globalObject.gitIsNotUsable)
|
|
58
|
-
return null;
|
|
59
|
-
// Preserve UTF-8 file paths.
|
|
60
|
-
// https://github.com/vikejs/vike/issues/1658
|
|
61
|
-
// https://stackoverflow.com/questions/22827239/how-to-make-git-properly-display-utf-8-encoded-pathnames-in-the-console-window/22828826#22828826
|
|
62
|
-
// https://stackoverflow.com/questions/15884180/how-do-i-override-git-configuration-options-by-command-line-parameters/15884261#15884261
|
|
63
|
-
const preserveUTF8 = '-c core.quotepath=off';
|
|
64
|
-
const cmd = [
|
|
65
|
-
'git',
|
|
66
|
-
preserveUTF8,
|
|
67
|
-
'ls-files',
|
|
68
|
-
// Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
69
|
-
...utils_js_1.scriptFileExtensionList.map((ext) => `"**/+*.${ext}" "+*.${ext}"`),
|
|
70
|
-
// Performance gain is non-negligible.
|
|
71
|
-
// - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
72
|
-
// - When node_modules/ is untracked the performance gain could be significant?
|
|
73
|
-
...ignorePatterns.map((pattern) => `--exclude="${pattern}"`),
|
|
74
|
-
// --others --exclude-standard => list untracked files (--others) while using .gitignore (--exclude-standard)
|
|
75
|
-
// --cached => list tracked files
|
|
76
|
-
'--others --exclude-standard --cached',
|
|
77
|
-
].join(' ');
|
|
78
|
-
let filesAll;
|
|
79
|
-
let filesDeleted;
|
|
80
|
-
try {
|
|
81
|
-
;
|
|
82
|
-
[filesAll, filesDeleted] = await Promise.all([
|
|
83
|
-
// Main command
|
|
84
|
-
runCmd1(cmd, userRootDir),
|
|
85
|
-
// Get tracked but deleted files
|
|
86
|
-
runCmd1('git ls-files --deleted', userRootDir),
|
|
87
|
-
]);
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
if (await isGitNotUsable(userRootDir)) {
|
|
91
|
-
globalObject.gitIsNotUsable = true;
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
throw err;
|
|
95
|
-
}
|
|
96
|
-
if (debug.isActivated) {
|
|
97
|
-
debug('[git] userRootDir:', userRootDir);
|
|
98
|
-
debug('[git] cmd:', cmd);
|
|
99
|
-
debug('[git] result:', filesAll);
|
|
100
|
-
debug('[git] filesDeleted:', filesDeleted);
|
|
101
|
-
}
|
|
102
|
-
const files = [];
|
|
103
|
-
for (const filePath of filesAll) {
|
|
104
|
-
// + file?
|
|
105
|
-
if (!node_path_1.default.posix.basename(filePath).startsWith('+'))
|
|
106
|
-
continue;
|
|
107
|
-
// We have to repeat the same exclusion logic here because the option --exclude of `$ git ls-files` only applies to untracked files. (We use --exclude only to speed up the `$ git ls-files` command.)
|
|
108
|
-
if (ignoreMatchers.some((m) => m(filePath)))
|
|
109
|
-
continue;
|
|
110
|
-
// JavaScript file?
|
|
111
|
-
if (!(0, utils_js_1.isScriptFile)(filePath))
|
|
112
|
-
continue;
|
|
113
|
-
// Deleted?
|
|
114
|
-
if (filesDeleted.includes(filePath))
|
|
115
|
-
continue;
|
|
116
|
-
files.push(filePath);
|
|
117
|
-
}
|
|
118
|
-
return files;
|
|
119
|
-
}
|
|
120
|
-
// Same as gitLsFiles() but using tinyglobby
|
|
121
|
-
async function tinyglobby(userRootDir, ignorePatterns) {
|
|
122
|
-
const pattern = `**/+*.${utils_js_1.scriptFileExtensionPattern}`;
|
|
123
|
-
const options = {
|
|
124
|
-
ignore: ignorePatterns,
|
|
125
|
-
cwd: userRootDir,
|
|
126
|
-
dot: false,
|
|
127
|
-
};
|
|
128
|
-
const files = await (0, tinyglobby_1.glob)(pattern, options);
|
|
129
|
-
// Make build deterministic, in order to get a stable generated hash for dist/client/assets/entries/entry-client-routing.${hash}.js
|
|
130
|
-
// https://github.com/vikejs/vike/pull/1750
|
|
131
|
-
files.sort();
|
|
132
|
-
if (debug.isActivated) {
|
|
133
|
-
debug('[glob] pattern:', pattern);
|
|
134
|
-
debug('[glob] options:', options);
|
|
135
|
-
debug('[glob] result:', files);
|
|
136
|
-
}
|
|
137
|
-
return files;
|
|
138
|
-
}
|
|
139
|
-
// Whether Git is installed and whether we can use it
|
|
140
|
-
async function isGitNotUsable(userRootDir) {
|
|
141
|
-
// Check Git version
|
|
142
|
-
{
|
|
143
|
-
const res = await runCmd2('git --version', userRootDir);
|
|
144
|
-
if ('err' in res)
|
|
145
|
-
return true;
|
|
146
|
-
let { stdout, stderr } = res;
|
|
147
|
-
(0, utils_js_1.assert)(stderr === '');
|
|
148
|
-
const prefix = 'git version ';
|
|
149
|
-
(0, utils_js_1.assert)(stdout.startsWith(prefix));
|
|
150
|
-
const gitVersion = stdout.slice(prefix.length);
|
|
151
|
-
// - Works with Git 2.43.1 but also (most certainly) with earlier versions.
|
|
152
|
-
// - We didn't bother test which is the earliest version that works.
|
|
153
|
-
// - Git 2.32.0 doesn't seem to work: https://github.com/vikejs/vike/discussions/1549
|
|
154
|
-
// - Maybe it's because of StackBlitz: looking at the release notes, Git 2.32.0 should be working.
|
|
155
|
-
if (!(0, utils_js_1.isVersionMatch)(gitVersion, ['2.43.1']))
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
// Is userRootDir inside a Git repository?
|
|
159
|
-
{
|
|
160
|
-
const res = await runCmd2('git rev-parse --is-inside-work-tree', userRootDir);
|
|
161
|
-
if ('err' in res)
|
|
162
|
-
return true;
|
|
163
|
-
let { stdout, stderr } = res;
|
|
164
|
-
(0, utils_js_1.assert)(stderr === '');
|
|
165
|
-
(0, utils_js_1.assert)(stdout === 'true');
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
async function runCmd1(cmd, cwd) {
|
|
170
|
-
const { stdout } = await execA(cmd, {
|
|
171
|
-
cwd,
|
|
172
|
-
// https://github.com/vikejs/vike/issues/1982
|
|
173
|
-
maxBuffer: Infinity,
|
|
174
|
-
});
|
|
175
|
-
/* Not always true: https://github.com/vikejs/vike/issues/1440#issuecomment-1892831303
|
|
176
|
-
assert(res.stderr === '')
|
|
177
|
-
*/
|
|
178
|
-
return stdout.toString().split('\n').filter(Boolean);
|
|
179
|
-
}
|
|
180
|
-
async function runCmd2(cmd, cwd) {
|
|
181
|
-
let res;
|
|
182
|
-
try {
|
|
183
|
-
res = await execA(cmd, { cwd });
|
|
184
|
-
}
|
|
185
|
-
catch (err) {
|
|
186
|
-
return { err };
|
|
187
|
-
}
|
|
188
|
-
let { stdout, stderr } = res;
|
|
189
|
-
stdout = stdout.toString().trim();
|
|
190
|
-
stderr = stderr.toString().trim();
|
|
191
|
-
return { stdout, stderr };
|
|
192
|
-
}
|
|
193
|
-
function getUserSettings() {
|
|
194
|
-
const userSettings = (0, getEnvVarObject_js_1.getEnvVarObject)('VIKE_CRAWL') ?? {};
|
|
195
|
-
const wrongUsage = (settingName, settingType) => `Setting ${picocolors_1.default.cyan(settingName)} in VIKE_CRAWL should be a ${picocolors_1.default.cyan(settingType)}`;
|
|
196
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(userSettings, 'git', 'boolean') || (0, utils_js_1.hasProp)(userSettings, 'git', 'undefined'), wrongUsage('git', 'boolean'));
|
|
197
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(userSettings, 'ignore', 'string[]') ||
|
|
198
|
-
(0, utils_js_1.hasProp)(userSettings, 'ignore', 'string') ||
|
|
199
|
-
(0, utils_js_1.hasProp)(userSettings, 'ignore', 'undefined'), wrongUsage('git', 'string or an array of strings'));
|
|
200
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(userSettings, 'ignoreBuiltIn', 'boolean') || (0, utils_js_1.hasProp)(userSettings, 'ignoreBuiltIn', 'undefined'), wrongUsage('ignoreBuiltIn', 'boolean'));
|
|
201
|
-
const settingNames = ['git', 'ignore', 'ignoreBuiltIn'];
|
|
202
|
-
Object.keys(userSettings).forEach((name) => {
|
|
203
|
-
(0, utils_js_1.assertUsage)(settingNames.includes(name), `Unknown setting ${picocolors_1.default.bold(picocolors_1.default.red(name))} in VIKE_CRAWL`);
|
|
204
|
-
});
|
|
205
|
-
return userSettings;
|
|
206
|
-
}
|
|
207
|
-
function isPlusFile(filePath) {
|
|
208
|
-
(0, utils_js_1.assertPosixPath)(filePath);
|
|
209
|
-
if ((0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(filePath))
|
|
210
|
-
return false;
|
|
211
|
-
const fileName = filePath.split('/').pop();
|
|
212
|
-
return fileName.startsWith('+');
|
|
213
|
-
}
|
|
214
|
-
function getPlusFileValueConfigName(filePath) {
|
|
215
|
-
if (!isPlusFile(filePath))
|
|
216
|
-
return null;
|
|
217
|
-
const fileName = node_path_1.default.posix.basename(filePath);
|
|
218
|
-
// assertNoUnexpectedPlusSign(filePath, fileName)
|
|
219
|
-
const basename = fileName.split('.')[0];
|
|
220
|
-
(0, utils_js_1.assert)(basename.startsWith('+'));
|
|
221
|
-
const configName = basename.slice(1);
|
|
222
|
-
(0, utils_js_1.assertUsage)(configName !== '', `${filePath} Invalid filename ${fileName}`);
|
|
223
|
-
return configName;
|
|
224
|
-
}
|
|
225
|
-
/* https://github.com/vikejs/vike/issues/1407
|
|
226
|
-
function assertNoUnexpectedPlusSign(filePath: string, fileName: string) {
|
|
227
|
-
const dirs = path.posix.dirname(filePath).split('/')
|
|
228
|
-
dirs.forEach((dir, i) => {
|
|
229
|
-
const dirPath = dirs.slice(0, i + 1).join('/')
|
|
230
|
-
assertUsage(
|
|
231
|
-
!dir.includes('+'),
|
|
232
|
-
`Character '+' is a reserved character: remove '+' from the directory name ${dirPath}/`
|
|
233
|
-
)
|
|
234
|
-
})
|
|
235
|
-
assertUsage(
|
|
236
|
-
!fileName.slice(1).includes('+'),
|
|
237
|
-
`Character '+' is only allowed at the beginning of filenames: make sure ${filePath} doesn't contain any '+' in its filename other than its first letter`
|
|
238
|
-
)
|
|
239
|
-
}
|
|
240
|
-
*/
|
|
241
|
-
function getIgnore(userSettings) {
|
|
242
|
-
const ignorePatternsSetByUser = [userSettings.ignore].flat().filter(utils_js_1.isNotNullish);
|
|
243
|
-
const { ignoreBuiltIn } = userSettings;
|
|
244
|
-
const ignorePatterns = [...(ignoreBuiltIn === false ? [] : ignorePatternsBuiltIn_js_1.ignorePatternsBuiltIn), ...ignorePatternsSetByUser];
|
|
245
|
-
const ignoreMatchers = ignorePatterns.map((p) => (0, picomatch_1.default)(p, {
|
|
246
|
-
// We must pass the same settings than tinyglobby
|
|
247
|
-
// https://github.com/SuperchupuDev/tinyglobby/blob/fcfb08a36c3b4d48d5488c21000c95a956d9797c/src/index.ts#L191-L194
|
|
248
|
-
dot: false,
|
|
249
|
-
nocase: false,
|
|
250
|
-
}));
|
|
251
|
-
return { ignorePatterns, ignoreMatchers };
|
|
252
|
-
}
|