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,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errVueJavascript = void 0;
|
|
4
|
-
exports.errVueJavascript = {
|
|
5
|
-
code: 'BABEL_PARSER_SYNTAX_ERROR',
|
|
6
|
-
reasonCode: 'MissingSemicolon',
|
|
7
|
-
loc: { line: 2, column: 7, index: 8 },
|
|
8
|
-
pos: 8,
|
|
9
|
-
plugin: 'vite:vue',
|
|
10
|
-
id: '/home/rom/code/vike/examples/vue-full/pages/index/+Page.vue',
|
|
11
|
-
pluginCode: "<template>\n <h1>Welcome to Vike</h1>\n This page is:\n <ul>\n <li>Rendered to HTML.</li>\n <li>Interactive. <Counter /></li>\n </ul>\n <p>\n <button @click=\"randomNavigation\">Random Page</button>\n </p>\n</template>\n\n<script lang=\"ts\" setup>\nimeport Counter from '../../components/Counter.vue'\nimport { navigate } from 'vike/client/router'\n\nconst randomNavigation = () => {\n const randomIndex = Math.floor(Math.random() * 3)\n navigate(['/markdown', '/star-wars', '/hello/alice.js'][randomIndex])\n}\n</script>\n",
|
|
12
|
-
frame: '1 | <template>\n | ^\n2 | <h1>Welcome to Vike</h1>\n3 | This page is:',
|
|
13
|
-
message: "[@vue/compiler-sfc] Missing semicolon. (2:7)\n\n/home/rom/code/vike/examples/vue-full/pages/index/+Page.vue\n12 | \n13 | <script lang=\"ts\" setup>\n14 | imeport Counter from '../../components/Counter.vue'\n | ^\n15 | import { navigate } from 'vike/client/router.js'\n16 | ",
|
|
14
|
-
stack: "SyntaxError: [@vue/compiler-sfc] Missing semicolon. (2:7)\n\n/home/rom/code/vike/examples/vue-full/pages/index/+Page.vue\n12 | \n13 | <script lang=\"ts\" setup>\n14 | imeport Counter from '../../components/Counter.vue'\n | ^\n15 | import { navigate } from 'vike/client/router.js'\n16 | \n at instantiate (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parse-error/credentials.ts:62:21)\n at toParseError (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parse-error.ts:60:12)\n at TypeScriptParserMixin.raise (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/tokenizer/index.ts:1490:19)\n at TypeScriptParserMixin.semicolon (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/util.ts:138:10)\n at TypeScriptParserMixin.parseExpressionStatement (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:1279:10)\n at TypeScriptParserMixin.parseExpressionStatement (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/plugins/typescript/index.ts:3044:28)\n at TypeScriptParserMixin.parseStatementContent (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:643:19)\n at TypeScriptParserMixin.parseStatementContent (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/plugins/typescript/index.ts:2887:20)\n at TypeScriptParserMixin.parseStatementLike (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:417:17)\n at TypeScriptParserMixin.parseModuleItem (/home/rom/code/vike/node_modules/.pnpm/@babel+parser@7.21.8/node_modules/@babel/parser/src/parser/statement.ts:354:17)",
|
|
15
|
-
};
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Prettify transpilation errors
|
|
3
|
-
// - Doesn't work for optimize errors: https://gist.github.com/brillout/9b7bb78ae866558b292ea1b516a986ec
|
|
4
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
-
};
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.getPrettyErrorWithCodeSnippet = getPrettyErrorWithCodeSnippet;
|
|
9
|
-
exports.isErrorWithCodeSnippet = isErrorWithCodeSnippet;
|
|
10
|
-
exports.isEquivalentErrorWithCodeSnippet = isEquivalentErrorWithCodeSnippet;
|
|
11
|
-
exports.getPrettyErrMessage = getPrettyErrMessage;
|
|
12
|
-
// Copied & adapted from https://github.com/vitejs/vite/blob/9c114c5c72a6af87e3330d5573362554b4511265/packages/vite/src/node/server/middlewares/error.ts
|
|
13
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
14
|
-
const utils_js_1 = require("../../utils.js");
|
|
15
|
-
const getFilePath_js_1 = require("../getFilePath.js");
|
|
16
|
-
function isErrorWithCodeSnippet(err) {
|
|
17
|
-
if (!(0, utils_js_1.isObject)(err)) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
const { id, frame, message } = err;
|
|
21
|
-
if (typeof id !== 'string' || !id.trim()) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (typeof frame === 'string' && frame.trim()) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
if (typeof message === 'string' && containsCodeSnippet(message)) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
function getPrettyErrorWithCodeSnippet(err, userRootDir) {
|
|
33
|
-
/* Uncomment to inspect and/or create fixture for ./errorWithCodeSnippet.spec.ts
|
|
34
|
-
console.log('userRootDir', userRootDir)
|
|
35
|
-
console.log('err.message', err.message)
|
|
36
|
-
console.log('err.stack', (err as any).stack)
|
|
37
|
-
console.log('err.pluginCode', (err as any).pluginCode)
|
|
38
|
-
console.log('Object.keys(err)', Object.keys(err))
|
|
39
|
-
console.log('err', err)
|
|
40
|
-
// For copy-pasting errors while preserving terminal ANSI colors
|
|
41
|
-
console.log(
|
|
42
|
-
'JSON.stringify(err)',
|
|
43
|
-
JSON.stringify({
|
|
44
|
-
...err,
|
|
45
|
-
message: err.message,
|
|
46
|
-
stack: (err as any).stack
|
|
47
|
-
})
|
|
48
|
-
)
|
|
49
|
-
//*/
|
|
50
|
-
(0, utils_js_1.assert)(isErrorWithCodeSnippet(err));
|
|
51
|
-
let { id, frame } = err;
|
|
52
|
-
const msgFirstLine = [
|
|
53
|
-
picocolors_1.default.red('Failed to transpile'),
|
|
54
|
-
picocolors_1.default.bold(picocolors_1.default.red((0, getFilePath_js_1.getFilePathToShowToUserFromUnknown)(id, userRootDir))),
|
|
55
|
-
picocolors_1.default.red('because:'),
|
|
56
|
-
].join(' ');
|
|
57
|
-
const errMsg = getPrettyErrMessage(err);
|
|
58
|
-
if (errMsg && containsCodeSnippet(errMsg)) {
|
|
59
|
-
// Conditionally swallowing frame is a risky move but worth it thanks to logErrorDebugNote()
|
|
60
|
-
// We swallow frame because many tools set 'error.frame' to something rubbish, for example:
|
|
61
|
-
// - @vitejs/plugin-vue
|
|
62
|
-
// - @vitejs/plugin-react-swc
|
|
63
|
-
// - @mdx-js/rollup
|
|
64
|
-
frame = undefined;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
(0, utils_js_1.assert)(frame);
|
|
68
|
-
frame = frame.trim();
|
|
69
|
-
(0, utils_js_1.assert)(frame);
|
|
70
|
-
frame = picocolors_1.default.yellow(frame);
|
|
71
|
-
}
|
|
72
|
-
let msg = [msgFirstLine, errMsg, frame].filter(Boolean).join('\n');
|
|
73
|
-
msg = (0, utils_js_1.removeEmptyLines)(msg);
|
|
74
|
-
/* Vite already does a fairly good job at showing a concise error in the layover
|
|
75
|
-
server.ws.send({
|
|
76
|
-
type: 'error',
|
|
77
|
-
err: msg
|
|
78
|
-
})
|
|
79
|
-
*/
|
|
80
|
-
return msg;
|
|
81
|
-
}
|
|
82
|
-
function getPrettyErrMessage(err) {
|
|
83
|
-
const { id, frame } = err;
|
|
84
|
-
let errMsg = err.message;
|
|
85
|
-
if (!errMsg || !errMsg.trim())
|
|
86
|
-
return null;
|
|
87
|
-
const trail = /(?:\:|)(?:\s|$)/;
|
|
88
|
-
// Remove "Transform failed with 1 error:" (redundant since we already print an intro message)
|
|
89
|
-
errMsg = errMsg.split(reg([/Transform failed with \d* error(?:s|)/, trail], 'gi')).join('');
|
|
90
|
-
// Remove "/home/rom/code/vike/examples/react-full/components/Counter.tsx:1:8:" (redundant since we already print the filename)
|
|
91
|
-
const pos = /(?:\:\d+|)/;
|
|
92
|
-
errMsg = errMsg.split(reg([id, pos, pos, trail], 'gi')).join('');
|
|
93
|
-
errMsg = errMsg.split(reg([(0, getFilePath_js_1.cleanFilePathUnknown)(id), pos, pos, trail], 'gi')).join('');
|
|
94
|
-
// Remove "ERROR:" (useless)
|
|
95
|
-
errMsg = errMsg.split(reg(['ERROR:', trail])).join('');
|
|
96
|
-
// Remove "Internal server error:" (useless)
|
|
97
|
-
errMsg = errMsg.split(reg(['Internal server error', trail])).join('');
|
|
98
|
-
if (containsCodeSnippet(errMsg)) {
|
|
99
|
-
errMsg = removeStandaloneCodePosition(errMsg);
|
|
100
|
-
}
|
|
101
|
-
errMsg = errMsg.trim();
|
|
102
|
-
if (frame && frame.includes(errMsg))
|
|
103
|
-
errMsg = '';
|
|
104
|
-
return errMsg;
|
|
105
|
-
}
|
|
106
|
-
function containsCodeSnippet(str) {
|
|
107
|
-
str = (0, utils_js_1.stripAnsi)(str);
|
|
108
|
-
let codeBlockSize = 0;
|
|
109
|
-
for (const line of str.split('\n')) {
|
|
110
|
-
if (!isCodeSnippetLine(line)) {
|
|
111
|
-
codeBlockSize = 0;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
codeBlockSize++;
|
|
115
|
-
}
|
|
116
|
-
if (codeBlockSize >= 3) {
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
function isCodeSnippetLine(line) {
|
|
123
|
-
// Babel
|
|
124
|
-
if (/[\s\d>]*\|/.test(line))
|
|
125
|
-
return true;
|
|
126
|
-
// SWC
|
|
127
|
-
if (/[\s\d>]*(╭─|│|·)/.test(line))
|
|
128
|
-
return true;
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
function reg(parts, flags = '') {
|
|
132
|
-
return new RegExp(parts.map((part) => (typeof part === 'string' ? (0, utils_js_1.escapeRegex)(part) : part.source)).join(''), flags);
|
|
133
|
-
}
|
|
134
|
-
function removeStandaloneCodePosition(errMsg) {
|
|
135
|
-
// Remove weird standalone code position " (2:7) "
|
|
136
|
-
errMsg = errMsg
|
|
137
|
-
.split('\n')
|
|
138
|
-
.map((line) => {
|
|
139
|
-
const posRE = /(\s|^)\(\d+:\d+\)(\s|$)/;
|
|
140
|
-
(0, utils_js_1.assert)(posRE.test(' (1:2)'));
|
|
141
|
-
(0, utils_js_1.assert)(posRE.test('(13:42) '));
|
|
142
|
-
if (!isCodeSnippetLine(line)) {
|
|
143
|
-
line = line.split(posRE).join('');
|
|
144
|
-
}
|
|
145
|
-
return line;
|
|
146
|
-
})
|
|
147
|
-
.join('\n');
|
|
148
|
-
return errMsg;
|
|
149
|
-
}
|
|
150
|
-
function isEquivalentErrorWithCodeSnippet(err1, err2) {
|
|
151
|
-
if (!(0, utils_js_1.isObject)(err1) || !(0, utils_js_1.isObject)(err2))
|
|
152
|
-
return false;
|
|
153
|
-
if (isDefinedAndSame(err1.message, err2.message) &&
|
|
154
|
-
isDefinedAndSame(err1.frame, err2.frame) &&
|
|
155
|
-
isDefinedAndSame(err1.id, err2.id)) {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
function isDefinedAndSame(val1, val2) {
|
|
161
|
-
return val1 && val1 === val2;
|
|
162
|
-
}
|
|
@@ -1,102 +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.logWithViteTag = logWithViteTag;
|
|
7
|
-
exports.logWithVikeTag = logWithVikeTag;
|
|
8
|
-
exports.logDirectly = logDirectly;
|
|
9
|
-
exports.applyViteSourceMapToStackTrace = applyViteSourceMapToStackTrace;
|
|
10
|
-
const utils_js_1 = require("../../utils.js");
|
|
11
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
12
|
-
const isErrorDebug_js_1 = require("../../../shared/isErrorDebug.js");
|
|
13
|
-
const globalContext_js_1 = require("../../../runtime/globalContext.js");
|
|
14
|
-
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
15
|
-
function logWithVikeTag(msg, logType, category, showVikeVersion = false) {
|
|
16
|
-
const projectTag = getProjectTag(showVikeVersion);
|
|
17
|
-
msg = prependTags(msg, projectTag, category, logType);
|
|
18
|
-
logDirectly(msg, logType);
|
|
19
|
-
}
|
|
20
|
-
function getProjectTag(showVikeVersion) {
|
|
21
|
-
let projectTag;
|
|
22
|
-
if (showVikeVersion) {
|
|
23
|
-
projectTag = `[vike@${utils_js_1.PROJECT_VERSION}]`;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
projectTag = `[vike]`;
|
|
27
|
-
}
|
|
28
|
-
return projectTag;
|
|
29
|
-
}
|
|
30
|
-
function logWithViteTag(msg, logType, category) {
|
|
31
|
-
msg = prependTags(msg, '[vite]', category, logType);
|
|
32
|
-
logDirectly(msg, logType);
|
|
33
|
-
}
|
|
34
|
-
// Not production => every log is triggered by logDirectly()
|
|
35
|
-
// - Even all Vite logs also go through logDirectly() (see interceptors of loggerVite.ts)
|
|
36
|
-
// - Production => logs aren't managed by loggerNotProd.ts => logDirectly() is never called (not even loaded as asserted by assertIsVitePluginCode())
|
|
37
|
-
function logDirectly(thing, logType) {
|
|
38
|
-
applyViteSourceMapToStackTrace(thing);
|
|
39
|
-
if (logType === 'info') {
|
|
40
|
-
console.log(thing);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (logType === 'warn') {
|
|
44
|
-
console.warn(thing);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (logType === 'error') {
|
|
48
|
-
console.error(thing);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (logType === 'error-recover') {
|
|
52
|
-
// stderr because user will most likely want to know about error recovering
|
|
53
|
-
console.error(thing);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
(0, utils_js_1.assert)(false);
|
|
57
|
-
}
|
|
58
|
-
function applyViteSourceMapToStackTrace(thing) {
|
|
59
|
-
if ((0, isErrorDebug_js_1.isErrorDebug)())
|
|
60
|
-
return;
|
|
61
|
-
if (!(0, utils_js_1.hasProp)(thing, 'stack'))
|
|
62
|
-
return;
|
|
63
|
-
const viteDevServer = (0, globalContext_js_1.getViteDevServer)();
|
|
64
|
-
if (!viteDevServer)
|
|
65
|
-
return;
|
|
66
|
-
// Apply Vite's source maps
|
|
67
|
-
viteDevServer.ssrFixStacktrace(thing);
|
|
68
|
-
}
|
|
69
|
-
function prependTags(msg, projectTag, category, logType) {
|
|
70
|
-
const color = (s) => {
|
|
71
|
-
if (logType === 'error' && !hasRed(msg))
|
|
72
|
-
return picocolors_1.default.bold(picocolors_1.default.red(s));
|
|
73
|
-
if (logType === 'error-recover' && !hasGreen(msg))
|
|
74
|
-
return picocolors_1.default.bold(picocolors_1.default.green(s));
|
|
75
|
-
if (logType === 'warn' && !hasYellow(msg))
|
|
76
|
-
return picocolors_1.default.yellow(s);
|
|
77
|
-
if (projectTag === '[vite]')
|
|
78
|
-
return picocolors_1.default.bold(picocolors_1.default.cyan(s));
|
|
79
|
-
if (projectTag.startsWith(`[vike`))
|
|
80
|
-
return picocolors_1.default.bold(picocolors_1.default.cyan(s));
|
|
81
|
-
(0, utils_js_1.assert)(false);
|
|
82
|
-
};
|
|
83
|
-
let tag = color(`${projectTag}`);
|
|
84
|
-
if (category) {
|
|
85
|
-
tag = tag + picocolors_1.default.dim(`[${category}]`);
|
|
86
|
-
}
|
|
87
|
-
const timestamp = picocolors_1.default.dim(new Date().toLocaleTimeString());
|
|
88
|
-
const whitespace = /\s|\[/.test((0, utils_js_1.stripAnsi)(msg)[0]) ? '' : ' ';
|
|
89
|
-
return `${timestamp} ${tag}${whitespace}${msg}`;
|
|
90
|
-
}
|
|
91
|
-
function hasRed(str) {
|
|
92
|
-
// https://github.com/brillout/picocolors/blob/e291f2a3e3251a7f218ab6369ae94434d85d0eb0/picocolors.js#L57
|
|
93
|
-
return str.includes('\x1b[31m');
|
|
94
|
-
}
|
|
95
|
-
function hasGreen(str) {
|
|
96
|
-
// https://github.com/brillout/picocolors/blob/e291f2a3e3251a7f218ab6369ae94434d85d0eb0/picocolors.js#L58
|
|
97
|
-
return str.includes('\x1b[32m');
|
|
98
|
-
}
|
|
99
|
-
function hasYellow(str) {
|
|
100
|
-
// https://github.com/brillout/picocolors/blob/e291f2a3e3251a7f218ab6369ae94434d85d0eb0/picocolors.js#L59
|
|
101
|
-
return str.includes('\x1b[33m');
|
|
102
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// TO-DO/eventually:
|
|
3
|
-
// - New hook onLog(): https://github.com/vikejs/vike/issues/1438
|
|
4
|
-
// - Exact same logs between prod and dev, only difference is that some log objects have:
|
|
5
|
-
// - `isDevLog: true`
|
|
6
|
-
// - `willBeLogged: false` in production
|
|
7
|
-
// - `showTimestamp: true`
|
|
8
|
-
// - Never clear screen (it's complex with little benefit)
|
|
9
|
-
// - Add shortcut to clear screen
|
|
10
|
-
// - Maybe rotate colors upon no requests within 30s?
|
|
11
|
-
// - Only show a one-liner init log (instead of Vite's multi-line log)
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.logViteAny = logViteAny;
|
|
17
|
-
exports.logViteError = logViteError;
|
|
18
|
-
exports.logConfigInfo = logConfigInfo;
|
|
19
|
-
exports.logConfigError = logConfigError;
|
|
20
|
-
exports.logConfigErrorRecover = logConfigErrorRecover;
|
|
21
|
-
exports.logErrorDebugNote = logErrorDebugNote;
|
|
22
|
-
const abort_js_1 = require("../../../shared/route/abort.js");
|
|
23
|
-
const globalContext_js_1 = require("../../runtime/globalContext.js");
|
|
24
|
-
const loggerRuntime_js_1 = require("../../runtime/loggerRuntime.js");
|
|
25
|
-
const utils_js_1 = require("../utils.js");
|
|
26
|
-
const getHttpRequestAsyncStore_js_1 = require("./getHttpRequestAsyncStore.js");
|
|
27
|
-
const isErrorDebug_js_1 = require("../../shared/isErrorDebug.js");
|
|
28
|
-
const errorWithCodeSnippet_js_1 = require("./loggerNotProd/errorWithCodeSnippet.js");
|
|
29
|
-
const transpileAndExecuteFile_js_1 = require("./resolveVikeConfigInternal/transpileAndExecuteFile.js");
|
|
30
|
-
const log_js_1 = require("./loggerNotProd/log.js");
|
|
31
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
32
|
-
const isNewError_js_1 = require("../../runtime/renderPage/isNewError.js");
|
|
33
|
-
const loggerProd_js_1 = require("../../runtime/renderPage/loggerProd.js");
|
|
34
|
-
const execHook_js_1 = require("../../../shared/hooks/execHook.js");
|
|
35
|
-
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
36
|
-
(0, loggerRuntime_js_1.overwriteRuntimeProductionLogger)(logRuntimeError, logRuntimeInfo);
|
|
37
|
-
(0, utils_js_1.overwriteAssertProductionLogger)(assertLogger);
|
|
38
|
-
function logRuntimeInfo(msg, httpRequestId, logType) {
|
|
39
|
-
const category = getCategory(httpRequestId);
|
|
40
|
-
(0, log_js_1.logWithVikeTag)(msg, logType, category);
|
|
41
|
-
}
|
|
42
|
-
function logViteAny(msg, logType, httpRequestId, prependViteTag) {
|
|
43
|
-
if (prependViteTag) {
|
|
44
|
-
const category = getCategory(httpRequestId);
|
|
45
|
-
(0, log_js_1.logWithViteTag)(msg, logType, category);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
(0, log_js_1.logDirectly)(msg, logType);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function logConfigInfo(msg, logType) {
|
|
52
|
-
const category = getConfigCategory();
|
|
53
|
-
(0, log_js_1.logWithVikeTag)(msg, logType, category);
|
|
54
|
-
}
|
|
55
|
-
function logConfigErrorRecover() {
|
|
56
|
-
const category = getConfigCategory();
|
|
57
|
-
(0, log_js_1.logWithVikeTag)(globalContext_js_1.vikeConfigErrorRecoverMsg, 'error-recover', category);
|
|
58
|
-
}
|
|
59
|
-
function logRuntimeError(err,
|
|
60
|
-
// httpRequestId is `null` when pre-rendering
|
|
61
|
-
httpRequestId) {
|
|
62
|
-
logErr(err, httpRequestId, false);
|
|
63
|
-
}
|
|
64
|
-
function logViteError(err,
|
|
65
|
-
// httpRequestId is `undefined` if development environment doesn't support async stores
|
|
66
|
-
httpRequestId) {
|
|
67
|
-
logErr(err, httpRequestId, true);
|
|
68
|
-
}
|
|
69
|
-
function logErr(err, httpRequestId = null, errorComesFromVite) {
|
|
70
|
-
(0, utils_js_1.warnIfErrorIsNotObject)(err);
|
|
71
|
-
if ((0, abort_js_1.isAbortError)(err) && !(0, isErrorDebug_js_1.isErrorDebug)()) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const store = (0, getHttpRequestAsyncStore_js_1.getHttpRequestAsyncStore)();
|
|
75
|
-
(0, isNewError_js_1.setAlreadyLogged)(err);
|
|
76
|
-
if ((0, getHttpRequestAsyncStore_js_1.getHttpRequestAsyncStore)()?.shouldErrorBeSwallowed(err)) {
|
|
77
|
-
if (!(0, isErrorDebug_js_1.isErrorDebug)())
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
store?.markErrorAsLogged(err);
|
|
82
|
-
}
|
|
83
|
-
const category = getCategory(httpRequestId);
|
|
84
|
-
if (!(0, isErrorDebug_js_1.isErrorDebug)()) {
|
|
85
|
-
if ((0, errorWithCodeSnippet_js_1.isErrorWithCodeSnippet)(err)) {
|
|
86
|
-
// We handle transpile errors globally because wrapping viteDevServer.ssrLoadModule() wouldn't be enough: transpile errors can be thrown not only when calling viteDevServer.ssrLoadModule() but also later when loading user code with import() (since Vite lazy-transpiles import() calls)
|
|
87
|
-
const viteConfig = (0, globalContext_js_1.getViteConfig)();
|
|
88
|
-
(0, utils_js_1.assert)(viteConfig);
|
|
89
|
-
const prettyErr = (0, errorWithCodeSnippet_js_1.getPrettyErrorWithCodeSnippet)(err, viteConfig.root);
|
|
90
|
-
(0, utils_js_1.assert)((0, utils_js_1.stripAnsi)(prettyErr).startsWith('Failed to transpile'));
|
|
91
|
-
(0, log_js_1.logWithViteTag)(prettyErr, 'error', category);
|
|
92
|
-
logErrorDebugNote();
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
{
|
|
96
|
-
const logged = handleAssertMsg(err, category);
|
|
97
|
-
if (logged)
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// Needs to be after assertion messages handling, because user hooks may throw an assertion error
|
|
102
|
-
const hook = (0, execHook_js_1.isUserHookError)(err);
|
|
103
|
-
if (hook) {
|
|
104
|
-
const { hookName, hookFilePath } = hook;
|
|
105
|
-
(0, log_js_1.logWithVikeTag)(picocolors_1.default.red(`Following error was thrown by the ${hookName}() hook defined at ${hookFilePath}`), 'error', category);
|
|
106
|
-
}
|
|
107
|
-
else if (category) {
|
|
108
|
-
logFallbackErrIntro(category, errorComesFromVite);
|
|
109
|
-
}
|
|
110
|
-
(0, log_js_1.logDirectly)(err, 'error');
|
|
111
|
-
// Needs to be called after logging the error.
|
|
112
|
-
(0, loggerProd_js_1.onRuntimeError)(err);
|
|
113
|
-
}
|
|
114
|
-
function logConfigError(err) {
|
|
115
|
-
(0, utils_js_1.warnIfErrorIsNotObject)(err);
|
|
116
|
-
const category = getConfigCategory();
|
|
117
|
-
{
|
|
118
|
-
const errIntroMsg = (0, transpileAndExecuteFile_js_1.getConfigExecutionErrorIntroMsg)(err);
|
|
119
|
-
if (errIntroMsg) {
|
|
120
|
-
(0, utils_js_1.assert)((0, utils_js_1.stripAnsi)(errIntroMsg).startsWith('Failed to execute'));
|
|
121
|
-
(0, log_js_1.logWithVikeTag)(errIntroMsg, 'error', category);
|
|
122
|
-
(0, log_js_1.logDirectly)(err, 'error');
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
{
|
|
127
|
-
const errMsgFormatted = (0, transpileAndExecuteFile_js_1.getConfigBuildErrorFormatted)(err);
|
|
128
|
-
if (errMsgFormatted) {
|
|
129
|
-
(0, utils_js_1.assert)((0, utils_js_1.stripAnsi)(errMsgFormatted).startsWith('Failed to transpile'));
|
|
130
|
-
if (!(0, isErrorDebug_js_1.isErrorDebug)()) {
|
|
131
|
-
(0, log_js_1.logWithVikeTag)(errMsgFormatted, 'error', category);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
(0, log_js_1.logDirectly)(err, 'error');
|
|
135
|
-
}
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
{
|
|
140
|
-
const logged = handleAssertMsg(err, category);
|
|
141
|
-
if (logged)
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (category)
|
|
145
|
-
logFallbackErrIntro(category, false);
|
|
146
|
-
(0, log_js_1.logDirectly)(err, 'error');
|
|
147
|
-
}
|
|
148
|
-
function logFallbackErrIntro(category, errorComesFromVite) {
|
|
149
|
-
const msg = errorComesFromVite ? 'Transpilation error' : 'An error was thrown';
|
|
150
|
-
(0, log_js_1.logWithVikeTag)(picocolors_1.default.bold(picocolors_1.default.red(`[Error] ${msg}:`)), 'error', category);
|
|
151
|
-
}
|
|
152
|
-
function getConfigCategory() {
|
|
153
|
-
const category = getCategory() ?? 'config';
|
|
154
|
-
return category;
|
|
155
|
-
}
|
|
156
|
-
function handleAssertMsg(err, category) {
|
|
157
|
-
const res = (0, utils_js_1.getAssertErrMsg)(err);
|
|
158
|
-
if (!res)
|
|
159
|
-
return false;
|
|
160
|
-
const { assertMsg, showVikeVersion } = res;
|
|
161
|
-
(0, log_js_1.logWithVikeTag)(assertMsg, 'error', category, showVikeVersion);
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
function assertLogger(thing, logType) {
|
|
165
|
-
// vite.ssrFixStacktrace() is needed for `assertWarning(..., { showStackTrace: true })`
|
|
166
|
-
(0, log_js_1.applyViteSourceMapToStackTrace)(thing);
|
|
167
|
-
const category = getCategory();
|
|
168
|
-
const res = (0, utils_js_1.getAssertErrMsg)(thing);
|
|
169
|
-
/* Risk of infinite loop
|
|
170
|
-
assert(res)
|
|
171
|
-
*/
|
|
172
|
-
if (!res)
|
|
173
|
-
throw new Error('Internal Vike error, reach out to a maintainer');
|
|
174
|
-
const { assertMsg, showVikeVersion } = res;
|
|
175
|
-
(0, log_js_1.logWithVikeTag)(assertMsg, logType, category, showVikeVersion);
|
|
176
|
-
}
|
|
177
|
-
/** Note shown to user when vike does something risky:
|
|
178
|
-
* - When vike dedupes (i.e. swallows) an error with getHttpRequestAsyncStore().shouldErrorBeSwallowed(err)
|
|
179
|
-
* - When vike modifies the error with getPrettyErrorWithCodeSnippet(err)
|
|
180
|
-
*/
|
|
181
|
-
function logErrorDebugNote() {
|
|
182
|
-
if ((0, isErrorDebug_js_1.isErrorDebug)())
|
|
183
|
-
return;
|
|
184
|
-
const store = (0, getHttpRequestAsyncStore_js_1.getHttpRequestAsyncStore)();
|
|
185
|
-
if (store) {
|
|
186
|
-
if (store.errorDebugNoteAlreadyShown)
|
|
187
|
-
return;
|
|
188
|
-
store.errorDebugNoteAlreadyShown = true;
|
|
189
|
-
}
|
|
190
|
-
const msg = picocolors_1.default.dim((0, utils_js_1.formatHintLog)("Error isn't helpful? See https://vike.dev/debug#verbose-errors"));
|
|
191
|
-
(0, log_js_1.logDirectly)(msg, 'error');
|
|
192
|
-
}
|
|
193
|
-
function getCategory(httpRequestId = null) {
|
|
194
|
-
const store = (0, getHttpRequestAsyncStore_js_1.getHttpRequestAsyncStore)();
|
|
195
|
-
if (store?.httpRequestId !== undefined) {
|
|
196
|
-
if (httpRequestId === null) {
|
|
197
|
-
httpRequestId = store.httpRequestId;
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
(0, utils_js_1.assert)(httpRequestId === store.httpRequestId);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (httpRequestId === null)
|
|
204
|
-
return null;
|
|
205
|
-
// const category = httpRequestId % 2 === 1 ? (`request-${httpRequestId}` as const) : (`request(${httpRequestId})` as const)
|
|
206
|
-
const category = `request(${httpRequestId})`;
|
|
207
|
-
return category;
|
|
208
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeSuperfluousViteLog = removeSuperfluousViteLog;
|
|
4
|
-
exports.removeSuperfluousViteLog_enable = removeSuperfluousViteLog_enable;
|
|
5
|
-
exports.removeSuperfluousViteLog_disable = removeSuperfluousViteLog_disable;
|
|
6
|
-
const utils_js_1 = require("../../utils.js");
|
|
7
|
-
const globalObject = (0, utils_js_1.getGlobalObject)('removeSuperfluousViteLog.ts', {
|
|
8
|
-
enabled: false,
|
|
9
|
-
});
|
|
10
|
-
const superfluousLog = 'Forced re-optimization of dependencies';
|
|
11
|
-
function removeSuperfluousViteLog(msg) {
|
|
12
|
-
if (!globalObject.enabled) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (msg.toLowerCase().includes('forced') && msg.toLowerCase().includes('optimization')) {
|
|
16
|
-
(0, utils_js_1.assert)(msg === superfluousLog, msg); // assertion fails => Vite changed its message => update this function
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
function removeSuperfluousViteLog_enable() {
|
|
22
|
-
globalObject.enabled = true;
|
|
23
|
-
}
|
|
24
|
-
function removeSuperfluousViteLog_disable() {
|
|
25
|
-
globalObject.enabled = false;
|
|
26
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.improveViteLogs = improveViteLogs;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
const loggerNotProd_js_1 = require("./loggerNotProd.js");
|
|
6
|
-
const getHttpRequestAsyncStore_js_1 = require("./getHttpRequestAsyncStore.js");
|
|
7
|
-
const removeSuperfluousViteLog_js_1 = require("./loggerVite/removeSuperfluousViteLog.js");
|
|
8
|
-
const isErrorDebug_js_1 = require("../../shared/isErrorDebug.js");
|
|
9
|
-
function improveViteLogs(config) {
|
|
10
|
-
intercept('info', config);
|
|
11
|
-
intercept('warn', config);
|
|
12
|
-
intercept('error', config);
|
|
13
|
-
}
|
|
14
|
-
function intercept(logType, config) {
|
|
15
|
-
config.logger[logType] = (msg, options = {}) => {
|
|
16
|
-
(0, utils_js_1.assert)(!(0, isErrorDebug_js_1.isErrorDebug)());
|
|
17
|
-
if ((0, removeSuperfluousViteLog_js_1.removeSuperfluousViteLog)(msg))
|
|
18
|
-
return;
|
|
19
|
-
if (!!options.timestamp) {
|
|
20
|
-
msg = (0, utils_js_1.trimWithAnsi)(msg);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
// No timestamp => no "[vite]" tag prepended => we don't trim the beginning of the message
|
|
24
|
-
msg = (0, utils_js_1.trimWithAnsiTrailOnly)(msg);
|
|
25
|
-
}
|
|
26
|
-
msg = cleanFirstViteLog(msg);
|
|
27
|
-
const store = (0, getHttpRequestAsyncStore_js_1.getHttpRequestAsyncStore)();
|
|
28
|
-
if (options.error) {
|
|
29
|
-
// Vite does a poor job of handling errors.
|
|
30
|
-
// - It doesn't format error code snippets.
|
|
31
|
-
// - It only shows error.message which means that crucial information such as error.id isn't shown to the user.
|
|
32
|
-
(0, loggerNotProd_js_1.logViteError)(options.error, store?.httpRequestId);
|
|
33
|
-
// We swallow Vite's message: we didn't see it add any value so far.
|
|
34
|
-
// - It can even be confusing, such as the following:
|
|
35
|
-
// ```
|
|
36
|
-
// Error when evaluating SSR module virtual:vike:page-entry:server:/pages/abort: failed to import "/pages/abort/+Page.mdx"
|
|
37
|
-
// ```
|
|
38
|
-
(0, utils_js_1.assert)(!(0, isErrorDebug_js_1.isErrorDebug)());
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
// Vite's default logger preprends the "[vite]" tag if and only if options.timestamp is true
|
|
42
|
-
const prependViteTag = options.timestamp || !!store?.httpRequestId;
|
|
43
|
-
(0, loggerNotProd_js_1.logViteAny)(msg, logType, store?.httpRequestId ?? null, prependViteTag);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function cleanFirstViteLog(msg) {
|
|
47
|
-
const isFirstVitLog = msg.includes('VITE') && msg.includes('ready');
|
|
48
|
-
if (isFirstVitLog) {
|
|
49
|
-
return (0, utils_js_1.removeEmptyLines)(msg);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return msg;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeId = normalizeId;
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
// In principle Vite/Rollup should always normalize the `id` in `transform(code, id)` but it seems to not always do it.
|
|
6
|
-
// https://github.com/vikejs/vike/issues/1935
|
|
7
|
-
function normalizeId(id) {
|
|
8
|
-
return (0, utils_js_1.toPosixPath)(id);
|
|
9
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExportNames = getExportNames;
|
|
4
|
-
exports.getImportStatements = getImportStatements;
|
|
5
|
-
const es_module_lexer_1 = require("es-module-lexer");
|
|
6
|
-
const utils_js_1 = require("../utils.js");
|
|
7
|
-
async function getExportNames(src) {
|
|
8
|
-
const parseResult = await parseEsModule(src);
|
|
9
|
-
const [imports, exports] = parseResult;
|
|
10
|
-
const exportNames = exports.map((e) => e.n);
|
|
11
|
-
// This seems to be the only way to detect re-exports
|
|
12
|
-
// - https://github.com/brillout/es-module-lexer_tests
|
|
13
|
-
// - https://github.com/vitejs/vite/blob/8469bf0a5e38cbf08ec28e598ab155d339edc442/packages/vite/src/node/optimizer/index.ts#L978-L981
|
|
14
|
-
const wildcardReExports = [];
|
|
15
|
-
imports.forEach(({ n, ss, se }) => {
|
|
16
|
-
const exp = src.slice(ss, se);
|
|
17
|
-
if (/export\s+\*\s+from/.test(exp)) {
|
|
18
|
-
// `n` is `undefined` for dynamic imports with variable, e.g. `import(moduleName)`
|
|
19
|
-
(0, utils_js_1.assert)(n);
|
|
20
|
-
wildcardReExports.push(n);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return { wildcardReExports, exportNames };
|
|
24
|
-
}
|
|
25
|
-
async function getImportStatements(src) {
|
|
26
|
-
const parseResult = await parseEsModule(src);
|
|
27
|
-
const imports = parseResult[0].slice();
|
|
28
|
-
return imports;
|
|
29
|
-
}
|
|
30
|
-
async function parseEsModule(src) {
|
|
31
|
-
await es_module_lexer_1.init;
|
|
32
|
-
return (0, es_module_lexer_1.parse)(src);
|
|
33
|
-
}
|