diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bef9a30b97..0f154723ece 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Suppressed the 'punycode' deprecation warning during `firebase deploy` on Node 22. (#10385) - Fixed an issue where hosting deploy allowed publishing to a site in a different project. (#10376) - Added 'firebase_deploy' and 'firebase_deploy_status' MCP tools. - Added SSE mode support to `firebase mcp`. To use it, run `firebase mcp --mode=sse --port=3000`, and connect your client on `http://localhost:3000`. diff --git a/src/bin/firebase.ts b/src/bin/firebase.ts index 9e80b9748ac..5350a6d51a1 100755 --- a/src/bin/firebase.ts +++ b/src/bin/firebase.ts @@ -3,6 +3,24 @@ // Check for older versions of Node no longer supported by the CLI. import * as semver from "semver"; const pkg = require("../../package.json"); + +interface NodeWarning extends Error { + code?: string; +} + +// List of warning codes to silence +const IGNORED_WARNINGS = [ + "DEP0040", // Punycode module is deprecated. Ignored because transitive dependencies (e.g. tr46) still use it via require('punycode/') or directly. +]; + +process.on("warning", (warning) => { + const nodeWarning = warning as NodeWarning; + if (nodeWarning.code && IGNORED_WARNINGS.includes(nodeWarning.code)) { + return; + } + console.warn(nodeWarning.stack || nodeWarning.message); +}); + const nodeVersion = process.version; if (!semver.satisfies(nodeVersion, pkg.engines.node)) { console.error(