node/test/fixtures/warning_node_modules
Joyee Cheung 2af72a7671
src: implement IsInsideNodeModules() in C++
This previously compiles a script and run it in a new context
to avoid global pollution, which is more complex than necessary
and can be too slow for it to be reused in other cases. The
new implementation just checks the frames in C++ which is safe
from global pollution, faster and simpler.

The previous implementation also had a bug when the call site
is in a ESM, because ESM have URLs as their script names,
which don't start with '/' or '\' and will be skipped. The new
implementation removes the skipping to fix it for ESM.

PR-URL: https://github.com/nodejs/node/pull/55286
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Refs: https://github.com/nodejs/node/issues/52697
2024-11-27 00:45:16 -05:00
..
node_modules
new-buffer-cjs.js
new-buffer-esm.mjs