@putout/plugin-nodejs 4.6.1 → 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,7 +81,7 @@ module.exports.traverse = ({push, listStore}) => ({
81
81
  const {loc} = path.node;
82
82
  const line = !loc ? 0 : loc.start.line;
83
83
 
84
- if (line < lastRequireLine && lastRequireLine < getReferenceLine(path)) {
84
+ if (line < lastRequireLine && lastRequireLine < getReferenceLine(path, constPaths)) {
85
85
  push({
86
86
  path,
87
87
  firstRequire,
@@ -105,7 +105,7 @@ function getName(path) {
105
105
  return null;
106
106
  }
107
107
 
108
- function getReferenceLine(path) {
108
+ function getReferenceLine(path, constPaths) {
109
109
  const name = getName(path);
110
110
  const binding = path.scope.bindings[name];
111
111
 
@@ -117,6 +117,9 @@ function getReferenceLine(path) {
117
117
  if (!referencePaths.length)
118
118
  return Infinity;
119
119
 
120
+ if (compareAny(referencePaths[0], constPaths))
121
+ return Infinity;
122
+
120
123
  return referencePaths[0].node.loc.start.line;
121
124
  }
122
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-nodejs",
3
- "version": "4.6.1",
3
+ "version": "4.6.2",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin adds ability to transform code to new API of Node.js",