@putout/plugin-nodejs 13.0.0 β 13.1.1
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 +33 -32
- package/lib/group-require-by-id/index.js +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -303,7 +303,7 @@ When you want to skip some declaration use `dismiss`:
|
|
|
303
303
|
>
|
|
304
304
|
> (c) [Nodejs.org](https://nodejs.org/en/knowledge/getting-started/what-is-require/)
|
|
305
305
|
|
|
306
|
-
|
|
306
|
+
Check out in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/https://putout.cloudcmd.io/#/gist/ddf5731ae829beec4d3018d4d9ac2150/342738b63337bfa9b4fc08c5b301483ea2b5ba9c).For **ESM** use [`esm/declare-imports-first`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#declare-imports-first).
|
|
307
307
|
|
|
308
308
|
### β Example of incorrect code
|
|
309
309
|
|
|
@@ -350,37 +350,6 @@ const args = minimist({
|
|
|
350
350
|
});
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
-
## group-require-by-id
|
|
354
|
-
|
|
355
|
-
Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/ff39c5d912d836a25b96772d8045dacb/fa8d8e1ebf8ac5f19a536247536f4bccf4fdac3d).
|
|
356
|
-
|
|
357
|
-
### β Example of incorrect code
|
|
358
|
-
|
|
359
|
-
```js
|
|
360
|
-
const ss = require('../../bb/ss');
|
|
361
|
-
const d = require('../hello');
|
|
362
|
-
const react = require('react');
|
|
363
|
-
const {lodash} = require('lodash');
|
|
364
|
-
const fs = require('node:fs');
|
|
365
|
-
const b = require('./ss');
|
|
366
|
-
const m = require(x);
|
|
367
|
-
const c = 5;
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
### β
Example of correct code
|
|
371
|
-
|
|
372
|
-
```js
|
|
373
|
-
const fs = require('node:fs');
|
|
374
|
-
const react = require('react');
|
|
375
|
-
const {lodash} = require('lodash');
|
|
376
|
-
const ss = require('../../bb/ss');
|
|
377
|
-
const d = require('../hello');
|
|
378
|
-
|
|
379
|
-
const b = require('./ss');
|
|
380
|
-
const m = require(x);
|
|
381
|
-
const c = 5;
|
|
382
|
-
```
|
|
383
|
-
|
|
384
353
|
### exports
|
|
385
354
|
|
|
386
355
|
### β Example of incorrect code
|
|
@@ -415,6 +384,38 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
415
384
|
await readFile(__filename);
|
|
416
385
|
```
|
|
417
386
|
|
|
387
|
+
## group-require-by-id
|
|
388
|
+
|
|
389
|
+
Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/ff39c5d912d836a25b96772d8045dacb/fa8d8e1ebf8ac5f19a536247536f4bccf4fdac3d). For **ESM** use [`esm/group-imports-by-sources`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#group-imports-by-source).
|
|
390
|
+
|
|
391
|
+
### β Example of incorrect code
|
|
392
|
+
|
|
393
|
+
```js
|
|
394
|
+
const ss = require('../../bb/ss');
|
|
395
|
+
const d = require('../hello');
|
|
396
|
+
const react = require('react');
|
|
397
|
+
const {lodash} = require('lodash');
|
|
398
|
+
const fs = require('node:fs');
|
|
399
|
+
const b = require('./ss');
|
|
400
|
+
const m = require(x);
|
|
401
|
+
const c = 5;
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### β
Example of correct code
|
|
405
|
+
|
|
406
|
+
```js
|
|
407
|
+
const fs = require('node:fs');
|
|
408
|
+
const react = require('react');
|
|
409
|
+
const {lodash} = require('lodash');
|
|
410
|
+
const ss = require('../../bb/ss');
|
|
411
|
+
const d = require('../hello');
|
|
412
|
+
|
|
413
|
+
const b = require('./ss');
|
|
414
|
+
const m = require(x);
|
|
415
|
+
const c = 5;
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
|
|
418
419
|
## convert-esm-to-commonjs
|
|
419
420
|
|
|
420
421
|
> **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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.1",
|
|
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",
|
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@putout/eslint-flat": "^2.0.0",
|
|
43
43
|
"@putout/plugin-declare": "*",
|
|
44
|
+
"@putout/plugin-declare-before-reference": "*",
|
|
44
45
|
"@putout/plugin-putout": "*",
|
|
46
|
+
"@putout/plugin-reuse-duplicate-init": "*",
|
|
45
47
|
"@putout/plugin-typescript": "*",
|
|
46
48
|
"@putout/test": "^11.0.0",
|
|
47
49
|
"c8": "^10.0.0",
|