diff options
author | Anatoli Papirovski <apapirovski@mac.com> | 2018-04-20 12:00:35 +0200 |
---|---|---|
committer | Anatoli Papirovski <apapirovski@mac.com> | 2018-04-20 17:21:10 +0200 |
commit | d718d539965246d1822010b622c2810cadfcd622 (patch) | |
tree | fd6b0d5fcdbc9d96ff5ce9e754ae8a2d471c563b /lib | |
parent | fda2b9aca9ae813ba9fdb3f2ed253edc0f264fdd (diff) | |
download | android-node-v8-d718d539965246d1822010b622c2810cadfcd622.tar.gz android-node-v8-d718d539965246d1822010b622c2810cadfcd622.tar.bz2 android-node-v8-d718d539965246d1822010b622c2810cadfcd622.zip |
buffer: fix deprecation warning emit
Due to npm using workers on Windows which inititate processes
for code within node_modules, the current way of testing is a
little too strict to catch all occurrences.
PR-URL: https://github.com/nodejs/node/pull/20163
Fixes: https://github.com/nodejs/node/issues/20160
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/util.js | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/internal/util.js b/lib/internal/util.js index 3cd370258b..ce25317b77 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -332,21 +332,8 @@ function spliceOne(list, index) { const kNodeModulesRE = /^(.*)[\\/]node_modules[\\/]/; let getStructuredStack; -let mainPrefix; function isInsideNodeModules() { - // Match the prefix of the main file, if it is inside a `node_modules` folder, - // up to and including the innermost `/node_modules/` bit, so that - // we can later ignore files which are at the same node_modules level. - // For example, having the main script at `/c/node_modules/d/d.js` - // would match all code coming from `/c/node_modules/`. - if (mainPrefix === undefined) { - const match = process.mainModule && - process.mainModule.filename && - process.mainModule.filename.match(kNodeModulesRE); - mainPrefix = match ? match[0] : ''; - } - if (getStructuredStack === undefined) { // Lazy-load to avoid a circular dependency. const { runInNewContext } = require('vm'); @@ -375,8 +362,7 @@ function isInsideNodeModules() { // it's likely from Node.js core. if (!/^\/|\\/.test(filename)) continue; - const match = filename.match(kNodeModulesRE); - return !!match && match[0] !== mainPrefix; + return kNodeModulesRE.test(filename); } return false; // This should be unreachable. |