diff --git a/.changeset/nasty-suits-study.md b/.changeset/nasty-suits-study.md new file mode 100644 index 000000000..bea857e3a --- /dev/null +++ b/.changeset/nasty-suits-study.md @@ -0,0 +1,6 @@ +--- +"myst-cli": patch +"mystmd": patch +--- + +Suppress punycode deprecation warning diff --git a/packages/myst-cli/src/build/site/logger.ts b/packages/myst-cli/src/build/site/logger.ts index 763ea5629..8d334b367 100644 --- a/packages/myst-cli/src/build/site/logger.ts +++ b/packages/myst-cli/src/build/site/logger.ts @@ -32,6 +32,8 @@ export function createServerLogger(session: ISession, ready: () => void): Logger // This is a spurious Remix warning https://github.com/remix-run/remix/issues/2677 if (line.includes('is not listed in your package.json dependencies')) return; if (line.includes('was not found in your node_modules')) return; + // This is the punycode deprecation warning + if (line.includes('--trace-deprecation') || line.includes('DEP0040')) return; if (line.startsWith('Rebuilding')) { session.log.debug(line); return; diff --git a/packages/mystmd/src/index.ts b/packages/mystmd/src/index.ts index d08353bb8..144f9b5d8 100644 --- a/packages/mystmd/src/index.ts +++ b/packages/mystmd/src/index.ts @@ -1,5 +1,17 @@ #!/usr/bin/env node import 'core-js/actual'; // This adds backwards compatible functionality for various CLIs + +// This suppresses the punycode deprecation warning +// https://github.com/jupyter-book/mystmd/issues/1166 +const { emit: originalEmit } = process; +function suppressor(event: string, error: Error) { + return event === 'warning' && error.name === 'DeprecationWarning' + ? false + : // eslint-disable-next-line prefer-rest-params + originalEmit.apply(process, arguments); +} +(process as any).emit = suppressor; + import { Command } from 'commander'; import version from './version.js'; import { makeBuildCLI } from './build.js';