mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
fix(build): suppress singleton smoke deprecation noise
This commit is contained in:
@@ -5,6 +5,41 @@ import path from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { stageBundledPluginRuntime } from "./stage-bundled-plugin-runtime.mjs";
|
||||
|
||||
const warningFilterKey = Symbol.for("openclaw.warning-filter");
|
||||
|
||||
function installProcessWarningFilter() {
|
||||
if (globalThis[warningFilterKey]?.installed) {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalEmitWarning = process.emitWarning.bind(process);
|
||||
process.emitWarning = (...args) => {
|
||||
const [warningArg, secondArg, thirdArg] = args;
|
||||
const warning =
|
||||
warningArg instanceof Error
|
||||
? {
|
||||
name: warningArg.name,
|
||||
message: warningArg.message,
|
||||
code: warningArg.code,
|
||||
}
|
||||
: {
|
||||
name: typeof secondArg === "string" ? secondArg : secondArg?.type,
|
||||
message: typeof warningArg === "string" ? warningArg : undefined,
|
||||
code: typeof thirdArg === "string" ? thirdArg : secondArg?.code,
|
||||
};
|
||||
|
||||
if (warning.code === "DEP0040" && warning.message?.includes("punycode")) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Reflect.apply(originalEmitWarning, process, args);
|
||||
};
|
||||
|
||||
globalThis[warningFilterKey] = { installed: true };
|
||||
}
|
||||
|
||||
installProcessWarningFilter();
|
||||
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const smokeEntryPath = path.join(repoRoot, "dist", "plugins", "build-smoke-entry.js");
|
||||
assert.ok(fs.existsSync(smokeEntryPath), `missing build output: ${smokeEntryPath}`);
|
||||
|
||||
Reference in New Issue
Block a user