@putout/plugin-nodejs 9.1.3 β 9.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.
- package/README.md +12 -7
- package/lib/cjs-file/index.js +10 -0
- package/lib/index.js +5 -0
- package/lib/mjs-file/index.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,8 @@ npm i putout @putout/plugin-nodejs -D
|
|
|
32
32
|
"nodejs/convert-top-level-return": "on",
|
|
33
33
|
"nodejs/declare": "on",
|
|
34
34
|
"nodejs/declare-after-require": "on",
|
|
35
|
-
"nodejs/remove-process-exit": "on"
|
|
35
|
+
"nodejs/remove-process-exit": "on",
|
|
36
|
+
"nodejs/cjs-file": "off"
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
```
|
|
@@ -275,8 +276,6 @@ const name = 'hello.txt';
|
|
|
275
276
|
|
|
276
277
|
Convert **CommonJS** **EcmaScript Modules**.
|
|
277
278
|
|
|
278
|
-
> **CommonJS** is a module system supported in Node, it provides a `require` function, which can be used to access the `exports` object exposed by another file.
|
|
279
|
-
>
|
|
280
279
|
> **EcmaScript module** syntax is the standard way to import and export values between files in **JavaScript**. The `import` statement can be used to reference a value exposed by the `export` statement in another file.
|
|
281
280
|
>
|
|
282
281
|
> (c) [parceljs](https://parceljs.org/languages/javascript/)
|
|
@@ -340,8 +339,6 @@ await readFile(__filename);
|
|
|
340
339
|
|
|
341
340
|
### convert-esm-to-commonjs
|
|
342
341
|
|
|
343
|
-
> **EcmaScript module** syntax is the standard way to import and export values between files in **JavaScript**. The `import` statement can be used to reference a value exposed by the `export` statement in another file.
|
|
344
|
-
>
|
|
345
342
|
> **CommonJS** is a module system supported in Node, it provides a `require` function, which can be used to access the `exports` object exposed by another file.
|
|
346
343
|
>
|
|
347
344
|
> (c) [parceljs](https://parceljs.org/languages/javascript/)
|
|
@@ -360,9 +357,17 @@ import hello from 'world';
|
|
|
360
357
|
const hello = require('world');
|
|
361
358
|
```
|
|
362
359
|
|
|
363
|
-
|
|
360
|
+
### cjs-file
|
|
364
361
|
|
|
365
|
-
|
|
362
|
+
Run [convert-esm-to-commonjs](#convert-esm-to-commonjs) for all `*.cjs` files with help of [redlint](https://github.com/putoutjs/redlint).
|
|
363
|
+
|
|
364
|
+
Check out in π[Putout Editor](https://putout.cloudcmd.io/#/gist/779e7fb720af59afc2d3da082088fd4c/d0b85b07c6aaf2b902a1c7eb7ae121dbcd181033).
|
|
365
|
+
|
|
366
|
+
### mjs-file
|
|
367
|
+
|
|
368
|
+
Run [convert-commonjs-to-esm](#convert-commonjs-to-esm) for all `*.cjs` files with help of [redlint](https://github.com/putoutjs/redlint).
|
|
369
|
+
|
|
370
|
+
Check out in π[Putout Editor](https://putout.cloudcmd.io/#/gist/779e7fb720af59afc2d3da082088fd4c/d0b85b07c6aaf2b902a1c7eb7ae121dbcd181033).
|
|
366
371
|
|
|
367
372
|
## License
|
|
368
373
|
|
package/lib/index.js
CHANGED
|
@@ -18,6 +18,9 @@ const convertCommonjsToEsmExports = require('./convert-commonjs-to-esm-exports')
|
|
|
18
18
|
const convertCommonjsToEsmCommons = require('./convert-commonjs-to-esm-commons');
|
|
19
19
|
const convertCommonjsToEsmRequire = require('./convert-commonjs-to-esm-require');
|
|
20
20
|
|
|
21
|
+
const cjsFile = require('./cjs-file');
|
|
22
|
+
const mjsFile = require('./mjs-file');
|
|
23
|
+
|
|
21
24
|
module.exports.rules = {
|
|
22
25
|
'convert-buffer-to-buffer-alloc': convertBufferToBufferAlloc,
|
|
23
26
|
'convert-fs-promises': convertFsPromises,
|
|
@@ -35,4 +38,6 @@ module.exports.rules = {
|
|
|
35
38
|
'convert-commonjs-to-esm-exports': ['off', convertCommonjsToEsmExports],
|
|
36
39
|
'convert-commonjs-to-esm-common': ['off', convertCommonjsToEsmCommons],
|
|
37
40
|
'convert-commonjs-to-esm-require': ['off', convertCommonjsToEsmRequire],
|
|
41
|
+
'cjs-file': ['off', cjsFile],
|
|
42
|
+
'mjs-file': ['off', mjsFile],
|
|
38
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.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",
|