@putout/plugin-nodejs 15.0.1 → 15.2.0
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.
|
@@ -71,10 +71,7 @@ export const replace = () => ({
|
|
|
71
71
|
}`,
|
|
72
72
|
'require("__a")': 'import("__a")',
|
|
73
73
|
'const __a = require(__b)': ({__a}, path) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (value.includes('./') && !/\.m?js(on)?$/.test(value) && !value.endsWith('..'))
|
|
77
|
-
value += '.js';
|
|
74
|
+
const {value} = path.get(__B).evaluate();
|
|
78
75
|
|
|
79
76
|
const fnPath = path.findParent(isFunction);
|
|
80
77
|
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import {operator} from 'putout';
|
|
2
|
+
|
|
3
|
+
const {getBindingPath} = operator;
|
|
4
|
+
|
|
1
5
|
export const report = () => `Use 'module.exports' instead of 'exports'`;
|
|
2
6
|
|
|
7
|
+
export const match = () => ({
|
|
8
|
+
'exports.__a': (vars, path) => {
|
|
9
|
+
const bindingPath = getBindingPath(path, 'exports');
|
|
10
|
+
|
|
11
|
+
return !bindingPath;
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
3
15
|
export const replace = () => ({
|
|
4
16
|
'exports.__a': 'module.exports.__a',
|
|
5
17
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "15.0
|
|
3
|
+
"version": "15.2.0",
|
|
4
4
|
"type": "module",
|
|
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",
|