@putout/plugin-nodejs 4.0.1 → 4.3.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.
package/README.md
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-nodejs.svg?style=flat&longCache=true
|
|
4
4
|
[NPMURL]: https://npmjs.org/package/@putout/plugin-nodejs "npm"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
> **Node.js** is an open-source, cross-platform, **JavaScript** runtime environment.
|
|
7
|
+
>
|
|
8
|
+
> (c) [nodejs.org](https://nodejs.org/en/)
|
|
9
|
+
|
|
10
|
+
🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to transform to new **Node.js** API and apply best practices.
|
|
7
11
|
|
|
8
12
|
## Install
|
|
9
13
|
|
|
@@ -30,7 +34,7 @@ npm i putout @putout/plugin-nodejs -D
|
|
|
30
34
|
|
|
31
35
|
### convert-fs-promises
|
|
32
36
|
|
|
33
|
-
Convert [fs.promises](https://nodejs.org/dist/latest-v15.x/docs/api/fs.html#fs_fs_promises_api) into form that will be simpler to use and convert from
|
|
37
|
+
Convert [fs.promises](https://nodejs.org/dist/latest-v15.x/docs/api/fs.html#fs_fs_promises_api) into form that will be simpler to use and convert to and from **ESM**.
|
|
34
38
|
|
|
35
39
|
#### ❌ Example of incorrect code
|
|
36
40
|
|
|
@@ -61,7 +65,7 @@ const {readFile} = require('fs/promises');
|
|
|
61
65
|
|
|
62
66
|
### convert-dirname-to-url
|
|
63
67
|
|
|
64
|
-
Only for
|
|
68
|
+
Only for **ESM**.
|
|
65
69
|
|
|
66
70
|
#### ❌ Example of incorrect code
|
|
67
71
|
|
|
@@ -81,9 +85,9 @@ const file1 = new URL('../../package.json', import.meta.url);
|
|
|
81
85
|
const file2 = new URL('../../package.json', import.meta.url);
|
|
82
86
|
```
|
|
83
87
|
|
|
84
|
-
### convert-
|
|
88
|
+
### convert-url-to-dirname
|
|
85
89
|
|
|
86
|
-
Only for
|
|
90
|
+
Only for **CommonJS**.
|
|
87
91
|
|
|
88
92
|
#### ❌ Example of incorrect code
|
|
89
93
|
|
|
@@ -5,7 +5,10 @@ const {
|
|
|
5
5
|
operator,
|
|
6
6
|
} = require('putout');
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
replaceWith,
|
|
10
|
+
remove,
|
|
11
|
+
} = operator;
|
|
9
12
|
|
|
10
13
|
const NOT_COMPUTED = false;
|
|
11
14
|
const SHORTHAND = true;
|
|
@@ -20,7 +23,7 @@ module.exports.fix = ({path, promisified}) => {
|
|
|
20
23
|
const {name} = declarator.id;
|
|
21
24
|
|
|
22
25
|
props.push(t.ObjectProperty(t.Identifier(name), t.Identifier(name), NOT_COMPUTED, SHORTHAND));
|
|
23
|
-
|
|
26
|
+
remove(path);
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const {init} = path.node;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"setPriority": "import {setPriority} from 'os'",
|
|
14
14
|
"tmpdir": "import {tmpdir} from 'os'",
|
|
15
15
|
"totalmem": "import {totalmem} from 'os'",
|
|
16
|
-
"type": "import {type} from 'os'",
|
|
17
16
|
"userInfo": "import {userInfo} from 'os'",
|
|
18
17
|
"uptime": "import {uptime} from 'os'",
|
|
19
18
|
"constants": "import {constants} from 'os'",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"seteuid": "import {seteuid} from 'process'",
|
|
41
41
|
"setgid": "import {setgid} from 'process'",
|
|
42
42
|
"setuid": "import {setuid} from 'process'",
|
|
43
|
-
"title": "import {title} from 'process'",
|
|
44
43
|
"argv": "import {argv} from 'process'",
|
|
45
44
|
"execArgv": "import {execArgv} from 'process'",
|
|
46
45
|
"pid": "import {pid} from 'process'",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.3.0",
|
|
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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"c8": "^7.5.0",
|
|
36
36
|
"eslint": "^8.0.1",
|
|
37
37
|
"eslint-plugin-node": "^11.0.0",
|
|
38
|
-
"eslint-plugin-putout": "^
|
|
38
|
+
"eslint-plugin-putout": "^14.0.0",
|
|
39
39
|
"lerna": "^4.0.0",
|
|
40
40
|
"madrun": "^9.0.0",
|
|
41
41
|
"montag": "^1.2.1",
|