From eb97535a35c2785df31d1bfdacf9c621755bbb07 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Mar 2026 00:29:33 +0000 Subject: [PATCH] build: suppress protobufjs eval warning in tsdown --- tsdown.config.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tsdown.config.ts b/tsdown.config.ts index b1aa8749307..6ed9ccb930b 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -13,14 +13,30 @@ function buildInputOptions(options: { onLog?: unknown; [key: string]: unknown }) const previousOnLog = typeof options.onLog === "function" ? options.onLog : undefined; + function isSuppressedLog(log: { + code?: string; + message?: string; + id?: string; + importer?: string; + }) { + if (log.code === "PLUGIN_TIMINGS") { + return true; + } + if (log.code !== "EVAL") { + return false; + } + const haystack = [log.message, log.id, log.importer].filter(Boolean).join("\n"); + return haystack.includes("@protobufjs/inquire/index.js"); + } + return { ...options, onLog( level: string, - log: { code?: string }, + log: { code?: string; message?: string; id?: string; importer?: string }, defaultHandler: (level: string, log: { code?: string }) => void, ) { - if (log.code === "PLUGIN_TIMINGS") { + if (isSuppressedLog(log)) { return; } if (typeof previousOnLog === "function") {