src / suppressExperimentalWarnings.ts
// node:sqlite is still marked experimental (as of Node 22-25), so importing it prints
// an ExperimentalWarning to stderr on first use. It's harmless, but LM Studio's plugin
// log viewer labels all stderr output as "Error:", which reads as a failure when it
// isn't one. This suppresses just that specific warning, nothing else.
//
// IMPORTANT: this file must be imported before anything that imports "node:sqlite" —
// see the import order at the top of store.ts. Module evaluation order guarantees this
// patch runs first as long as it stays the first import in that file.
const originalEmitWarning = process.emitWarning.bind(process);
(process as any).emitWarning = (warning: unknown, ...rest: unknown[]) => {
const message = typeof warning === "string" ? warning : (warning as Error)?.message;
if (typeof message === "string" && message.includes("SQLite is an experimental feature")) {
return;
}
return (originalEmitWarning as any)(warning, ...rest);
};
export {};