- never emit the punycode warning

This commit is contained in:
denihs
2024-10-31 13:26:38 -04:00
parent 58f5d31dc1
commit 70d689db07
4 changed files with 23 additions and 25 deletions

8
meteor
View File

@@ -123,7 +123,7 @@ fi
DEV_BUNDLE="$SCRIPT_DIR/dev_bundle"
METEOR="$SCRIPT_DIR/tools/index.js"
PROCESS_REQUIRES="$SCRIPT_DIR/tools/node-process-requires.js"
PROCESS_REQUIRES="$SCRIPT_DIR/tools/node-process-warnings.js"
# Set the nofile ulimit as high as permitted by the hard-limit/kernel
if [ "$(ulimit -Sn)" != "unlimited" ]; then
@@ -138,11 +138,6 @@ if [ "$(ulimit -Sn)" != "unlimited" ]; then
fi
fi
# By default, we disable all the Node warnings
# Then we re-enable the warning on tools/node-process-warning
# The advantage of this is that we have full control of which warning we want to suppress
export NODE_OPTIONS="--no-warnings $NODE_OPTIONS"
# We used to set $NODE_PATH here to include the node_modules from the dev
# bundle, but now we just get them from the symlink at tools/node_modules. This
# is better because node_modules directories found via the ancestor walk from
@@ -154,5 +149,6 @@ export NODE_OPTIONS="--no-warnings $NODE_OPTIONS"
exec "$DEV_BUNDLE/bin/node" \
--max-old-space-size=4096 \
--no-wasm-code-gc \
--require="$PROCESS_REQUIRES"\
${TOOL_NODE_FLAGS} \
"$METEOR" "$@"

View File

@@ -48,6 +48,7 @@ SET BABEL_CACHE_DIR=%~dp0\.babel-cache
"%~dp0\dev_bundle\bin\node.exe" ^
--no-wasm-code-gc ^
--require="%~dp0\tools\node-process-warnings.js" ^
%TOOL_NODE_FLAGS% ^
"%~dp0\tools\index.js" %*

View File

@@ -1,4 +1,3 @@
require("./node-process-warnings");
const { getChildProcess } = require("./cli/dev-bundle-bin-commands");
getChildProcess({ isFirstTry: true }).then(

View File

@@ -1,20 +1,22 @@
process.on("warning", (warn) => {
if (warn.message.includes("punycode")) {
/*
* A warning was introduced in Node 22:
*
* "The `punycode` module is deprecated. Please use a userland alternative instead."
*
* The problem is that punycode is deeply integrated in the Node system. It's not a
* simple direct dependency.
*
* Check these issues for more details:
* https://github.com/mathiasbynens/punycode.js/issues/137
* https://stackoverflow.com/questions/68774489/punycode-is-deprecated-in-npm-what-should-i-replace-it-with/78946745
*
* This warning was, besides being annoying, breaking our tests.
*/
const originalEmitWarning = process.emitWarning;
process.emitWarning = function (message) {
/*
* A warning was introduced in Node 22:
*
* "The `punycode` module is deprecated. Please use a userland alternative instead."
*
* The problem is that punycode is deeply integrated in the Node system. It's not a
* simple direct dependency.
*
* Check these issues for more details:
* https://github.com/mathiasbynens/punycode.js/issues/137
* https://stackoverflow.com/questions/68774489/punycode-is-deprecated-in-npm-what-should-i-replace-it-with/78946745
*
* This warning was, besides being annoying, breaking our tests.
*/
if (message.includes("punycode")) {
return;
}
console.warn(warn);
});
return originalEmitWarning(message);
};