fix(build): suppress singleton smoke deprecation noise
This commit is contained in:
parent
f3971571fe
commit
9486f6e379
@ -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}`);
|
||||
|
||||
@ -140,6 +140,13 @@ const SKIP_EAGER_WARMUP_PRIMARY_COMMANDS = new Set([
|
||||
]);
|
||||
|
||||
function shouldEagerWarmContextWindowCache(argv: string[] = process.argv): boolean {
|
||||
// Keep this gate tied to the real OpenClaw CLI entrypoints.
|
||||
//
|
||||
// This module can also land inside shared dist chunks that are imported from
|
||||
// plugin-sdk/library surfaces during smoke tests and plugin loading. If we do
|
||||
// eager warmup for those generic Node script imports, merely importing the
|
||||
// built plugin-sdk can call ensureOpenClawModelsJson(), which cascades into
|
||||
// plugin discovery and breaks dist/source singleton assumptions.
|
||||
if (!isLikelyOpenClawCliProcess(argv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user