@putout/plugin-nodejs 14.1.0 → 15.0.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.
Files changed (52) hide show
  1. package/lib/add-node-prefix/index.js +5 -7
  2. package/lib/cjs-file/index.js +13 -6
  3. package/lib/convert-buffer-to-buffer-alloc/index.js +4 -5
  4. package/lib/convert-commonjs-to-esm-commons/index.js +5 -7
  5. package/lib/convert-commonjs-to-esm-exports/index.js +11 -12
  6. package/lib/convert-commonjs-to-esm-require/index.js +18 -21
  7. package/lib/convert-commonjs-to-esm.js +4 -6
  8. package/lib/convert-dirname-to-url/index.js +4 -5
  9. package/lib/convert-esm-to-commonjs/index.js +3 -4
  10. package/lib/convert-exports-to-module-exports/index.js +2 -4
  11. package/lib/convert-fs-promises/index.js +2 -4
  12. package/lib/convert-promisify-to-fs-promises/index.js +7 -6
  13. package/lib/convert-top-level-return/index.js +4 -5
  14. package/lib/convert-url-to-dirname/index.js +4 -5
  15. package/lib/declare/index.js +25 -14
  16. package/lib/declare/modules/child_process.js +9 -0
  17. package/lib/declare/modules/events.js +12 -0
  18. package/lib/declare/modules/fs-promises.js +31 -0
  19. package/lib/declare/modules/fs.js +100 -0
  20. package/lib/declare/modules/module.js +10 -0
  21. package/lib/declare/modules/os.js +21 -0
  22. package/lib/declare/modules/path.js +16 -0
  23. package/lib/declare/modules/process.js +55 -0
  24. package/lib/declare/modules/stream.js +14 -0
  25. package/lib/declare/modules/url.js +7 -0
  26. package/lib/declare/modules/util.js +14 -0
  27. package/lib/declare/modules/zlib.js +40 -0
  28. package/lib/declare-after-require/index.js +4 -5
  29. package/lib/group-require-by-id/index.js +5 -6
  30. package/lib/index.js +23 -30
  31. package/lib/mjs-file/index.js +13 -6
  32. package/lib/remove-process-exit/index.js +2 -4
  33. package/lib/remove-useless-promisify/index.js +2 -4
  34. package/lib/rename-file-cjs-to-js/index.js +12 -3
  35. package/lib/rename-file-mjs-to-js/index.js +12 -4
  36. package/lib/strict-mode/add-missing/index.js +8 -8
  37. package/lib/strict-mode/index.js +4 -6
  38. package/lib/strict-mode/remove-illegal/index.js +4 -5
  39. package/lib/strict-mode/remove-useless/index.js +4 -5
  40. package/package.json +8 -8
  41. package/lib/declare/modules/child_process.json +0 -9
  42. package/lib/declare/modules/events.json +0 -12
  43. package/lib/declare/modules/fs-promises.json +0 -31
  44. package/lib/declare/modules/fs.json +0 -100
  45. package/lib/declare/modules/module.json +0 -10
  46. package/lib/declare/modules/os.json +0 -21
  47. package/lib/declare/modules/path.json +0 -16
  48. package/lib/declare/modules/process.json +0 -55
  49. package/lib/declare/modules/stream.json +0 -14
  50. package/lib/declare/modules/url.json +0 -7
  51. package/lib/declare/modules/util.json +0 -14
  52. package/lib/declare/modules/zlib.json +0 -40
@@ -0,0 +1,16 @@
1
+ export default {
2
+ resolve: `import {resolve} from 'path'`,
3
+ normalize: `import {normalize} from 'path'`,
4
+ isAbsolute: `import {isAbsolute} from 'path'`,
5
+ join: `import {join} from 'path'`,
6
+ relative: `import {relative} from 'path'`,
7
+ toNamespacedPath: `import {toNamespacedPath} from 'path'`,
8
+ dirname: `import {dirname} from 'path'`,
9
+ basename: `import {basename} from 'path'`,
10
+ extname: `import {extname} from 'path'`,
11
+ format: `import {format} from 'path'`,
12
+ sep: `import {sep} from 'path'`,
13
+ delimiter: `import {delimiter} from 'path'`,
14
+ win32: `import {win32} from 'path'`,
15
+ posix: `import {posix} from 'path'`,
16
+ };
@@ -0,0 +1,55 @@
1
+ export default {
2
+ process: `import process from 'process'`,
3
+ arch: `import {arch} from 'process'`,
4
+ platform: `import {platform} from 'process'`,
5
+ release: `import {release} from 'process'`,
6
+ moduleLoadList: `import {moduleLoadList} from 'process'`,
7
+ binding: `import {binding} from 'process'`,
8
+ domain: `import {domain} from 'process'`,
9
+ config: `import {config} from 'process'`,
10
+ dlopen: `import {dlopen} from 'process'`,
11
+ uptime: `import {uptime} from 'process'`,
12
+ reallyExit: `import {reallyExit} from 'process'`,
13
+ cpuUsage: `import {cpuUsage} from 'process'`,
14
+ resourceUsage: `import {resourceUsage} from 'process'`,
15
+ memoryUsage: `import {memoryUsage} from 'process'`,
16
+ kill: `import {kill} from 'process'`,
17
+ exit: `import {exit} from 'process'`,
18
+ openStdin: `import {openStdin} from 'process'`,
19
+ getuid: `import {getuid} from 'process'`,
20
+ geteuid: `import {geteuid} from 'process'`,
21
+ getgid: `import {getgid} from 'process'`,
22
+ getegid: `import {getegid} from 'process'`,
23
+ getgroups: `import {getgroups} from 'process'`,
24
+ allowedNodeEnvironmentFlags: `import {allowedNodeEnvironmentFlags} from 'process'`,
25
+ assert: `import {assert} from 'process'`,
26
+ features: `import {features} from 'process'`,
27
+ setUncaughtExceptionCaptureCallback: `import {setUncaughtExceptionCaptureCallback} from 'process'`,
28
+ hasUncaughtExceptionCaptureCallback: `import {hasUncaughtExceptionCaptureCallback} from 'process'`,
29
+ emitWarning: `import {emitWarning} from 'process'`,
30
+ nextTick: `import {nextTick} from 'process'`,
31
+ stdout: `import {stdout} from 'process'`,
32
+ stdin: `import {stdin} from 'process'`,
33
+ stderr: `import {stderr} from 'process'`,
34
+ abort: `import {abort} from 'process'`,
35
+ umask: `import {umask} from 'process'`,
36
+ chdir: `import {chdir} from 'process'`,
37
+ cwd: `import {cwd} from 'process'`,
38
+ initgroups: `import {initgroups} from 'process'`,
39
+ setgroups: `import {setgroups} from 'process'`,
40
+ setegid: `import {setegid} from 'process'`,
41
+ seteuid: `import {seteuid} from 'process'`,
42
+ setgid: `import {setgid} from 'process'`,
43
+ setuid: `import {setuid} from 'process'`,
44
+ argv: `import {argv} from 'process'`,
45
+ execArgv: `import {execArgv} from 'process'`,
46
+ pid: `import {pid} from 'process'`,
47
+ ppid: `import {ppid} from 'process'`,
48
+ execPath: `import {execPath} from 'process'`,
49
+ debugPort: `import {debugPort} from 'process'`,
50
+ hrtime: `import {hrtime} from 'process'`,
51
+ argv0: `import {argv0} from 'process'`,
52
+ throwDeprecation: `import {throwDeprecation} from 'process'`,
53
+ setSourceMapsEnabled: `import {setSourceMapsEnabled} from 'process'`,
54
+ mainModule: `import {mainModule} from 'process'`,
55
+ };
@@ -0,0 +1,14 @@
1
+ export default {
2
+ isDisturbed: `import {isDisturbed} from 'stream'`,
3
+ Readable: `import {Readable} from 'stream'`,
4
+ Writable: `import {Writable} from 'stream'`,
5
+ Duplex: `import {Duplex} from 'stream'`,
6
+ Transform: `import {Transform} from 'stream'`,
7
+ PassThrough: `import {PassThrough} from 'stream'`,
8
+ pipeline: `import {pipeline} from 'stream'`,
9
+ addAbortSignal: `import {addAbortSignal} from 'stream'`,
10
+ finished: `import {finished} from 'stream'`,
11
+ destroy: `import {destroy} from 'stream'`,
12
+ compose: `import {compose} from 'stream'`,
13
+ Stream: `import {Stream} from 'stream'`,
14
+ };
@@ -0,0 +1,7 @@
1
+ export default {
2
+ domainToASCII: `import {domainToASCII} from 'url'`,
3
+ domainToUnicode: `import {domainToUnicode} from 'url'`,
4
+ pathToFileURL: `import {pathToFileURL} from 'url'`,
5
+ fileURLToPath: `import {fileURLToPath} from 'url'`,
6
+ urlToHttpOptions: `import {urlToHttpOptions} from 'url'`,
7
+ };
@@ -0,0 +1,14 @@
1
+ export default {
2
+ callbackify: `import {callbackify} from 'util'`,
3
+ formatWithOptions: `import {formatWithOptions} from 'util'`,
4
+ getSystemErrorMap: `import {getSystemErrorMap} from 'util'`,
5
+ getSystemErrorName: `import {getSystemErrorName} from 'util'`,
6
+ inherits: `import {inherits} from 'util'`,
7
+ inspect: `import {inspect} from 'util'`,
8
+ isDeepStrictEqual: `import {isDeepStrictEqual} from 'util'`,
9
+ promisify: `import {promisify} from 'util'`,
10
+ stripVTControlCharacters: `import {stripVTControlCharacters} from 'util'`,
11
+ toUSVString: `import {toUSVString} from 'util'`,
12
+ TextDecoder: `import {TextDecoder} from 'util'`,
13
+ TextEncoder: `import {TextEncoder} from 'util'`,
14
+ };
@@ -0,0 +1,40 @@
1
+ export default {
2
+ Deflate: `import {Deflate} from 'zlib'`,
3
+ Inflate: `import {Inflate} from 'zlib'`,
4
+ Gzip: `import {Gzip} from 'zlib'`,
5
+ Gunzip: `import {Gunzip} from 'zlib'`,
6
+ DeflateRaw: `import {DeflateRaw} from 'zlib'`,
7
+ InflateRaw: `import {InflateRaw} from 'zlib'`,
8
+ Unzip: `import {Unzip} from 'zlib'`,
9
+ BrotliCompress: `import {BrotliCompress} from 'zlib'`,
10
+ BrotliDecompress: `import {BrotliDecompress} from 'zlib'`,
11
+ deflate: `import {deflate} from 'zlib'`,
12
+ deflateSync: `import {deflateSync} from 'zlib'`,
13
+ gzip: `import {gzip} from 'zlib'`,
14
+ gzipSync: `import {gzipSync} from 'zlib'`,
15
+ deflateRaw: `import {deflateRaw} from 'zlib'`,
16
+ deflateRawSync: `import {deflateRawSync} from 'zlib'`,
17
+ unzip: `import {unzip} from 'zlib'`,
18
+ unzipSync: `import {unzipSync} from 'zlib'`,
19
+ inflate: `import {inflate} from 'zlib'`,
20
+ inflateSync: `import {inflateSync} from 'zlib'`,
21
+ gunzip: `import {gunzip} from 'zlib'`,
22
+ gunzipSync: `import {gunzipSync} from 'zlib'`,
23
+ inflateRaw: `import {inflateRaw} from 'zlib'`,
24
+ inflateRawSync: `import {inflateRawSync} from 'zlib'`,
25
+ brotliCompress: `import {brotliCompress} from 'zlib'`,
26
+ brotliCompressSync: `import {brotliCompressSync} from 'zlib'`,
27
+ brotliDecompress: `import {brotliDecompress} from 'zlib'`,
28
+ brotliDecompressSync: `import {brotliDecompressSync} from 'zlib'`,
29
+ createDeflate: `import {createDeflate} from 'zlib'`,
30
+ createInflate: `import {createInflate} from 'zlib'`,
31
+ createDeflateRaw: `import {createDeflateRaw} from 'zlib'`,
32
+ createInflateRaw: `import {createInflateRaw} from 'zlib'`,
33
+ createGzip: `import {createGzip} from 'zlib'`,
34
+ createGunzip: `import {createGunzip} from 'zlib'`,
35
+ createUnzip: `import {createUnzip} from 'zlib'`,
36
+ createBrotliCompress: `import {createBrotliCompress} from 'zlib'`,
37
+ createBrotliDecompress: `import {createBrotliDecompress} from 'zlib'`,
38
+ constants: `import {constants} from 'zlib'`,
39
+ codes: `import {codes} from 'zlib'`,
40
+ };
@@ -1,6 +1,5 @@
1
- 'use strict';
1
+ import {operator} from 'putout';
2
2
 
3
- const {operator} = require('putout');
4
3
  const {
5
4
  remove,
6
5
  compareAny,
@@ -13,14 +12,14 @@ const REQUIRE_LIST = [
13
12
  'const __a = require(__b).__c',
14
13
  ];
15
14
 
16
- module.exports.report = ({path}) => {
15
+ export const report = ({path}) => {
17
16
  const idPath = path.get('declarations.0.id');
18
17
  const id = String(idPath).replace(/\s+/g, '');
19
18
 
20
19
  return `Declare '${id}' after last 'require()'`;
21
20
  };
22
21
 
23
- module.exports.fix = ({path, lastRequire}) => {
22
+ export const fix = ({path, lastRequire}) => {
24
23
  const {node} = path;
25
24
 
26
25
  delete node.loc;
@@ -30,7 +29,7 @@ module.exports.fix = ({path, lastRequire}) => {
30
29
  insertAfter(lastRequire, node);
31
30
  };
32
31
 
33
- module.exports.traverse = ({push, pathStore}) => ({
32
+ export const traverse = ({push, pathStore}) => ({
34
33
  'const __a = __b': (path) => {
35
34
  if (!path.parentPath.isProgram())
36
35
  return;
@@ -1,15 +1,14 @@
1
- 'use strict';
1
+ import {isDeepStrictEqual} from 'node:util';
2
+ import {operator} from 'putout';
2
3
 
3
- const {isDeepStrictEqual} = require('node:util');
4
- const {operator} = require('putout');
5
4
  const {
6
5
  replaceWithMultiple,
7
6
  remove,
8
7
  } = operator;
9
8
 
10
- module.exports.report = () => 'Group require by id';
9
+ export const report = () => 'Group require by id';
11
10
 
12
- module.exports.fix = ({grouped}) => {
11
+ export const fix = ({grouped}) => {
13
12
  const [first, ...others] = grouped;
14
13
  const nodes = [first.node];
15
14
 
@@ -25,7 +24,7 @@ module.exports.fix = ({grouped}) => {
25
24
  replaceWithMultiple(first, nodes);
26
25
  };
27
26
 
28
- module.exports.traverse = ({pathStore, push}) => ({
27
+ export const traverse = ({pathStore, push}) => ({
29
28
  'const __ = require(__)': (path) => {
30
29
  if (!path.parentPath.isProgram())
31
30
  return;
package/lib/index.js CHANGED
@@ -1,34 +1,27 @@
1
- 'use strict';
1
+ import * as convertBufferToBufferAlloc from './convert-buffer-to-buffer-alloc/index.js';
2
+ import * as convertFsPromises from './convert-fs-promises/index.js';
3
+ import * as convertPromisifyToFsPromises from './convert-promisify-to-fs-promises/index.js';
4
+ import * as convertDirnameToUrl from './convert-dirname-to-url/index.js';
5
+ import * as convertUrlToDirname from './convert-url-to-dirname/index.js';
6
+ import * as convertTopLevelReturn from './convert-top-level-return/index.js';
7
+ import * as declare from './declare/index.js';
8
+ import * as declareAfterRequire from './declare-after-require/index.js';
9
+ import * as removeProcessExit from './remove-process-exit/index.js';
10
+ import * as addNodePrefix from './add-node-prefix/index.js';
11
+ import * as convertExportsToModuleExports from './convert-exports-to-module-exports/index.js';
12
+ import * as convertEsmToCommonjs from './convert-esm-to-commonjs/index.js';
13
+ import * as convertCommonjsToEsmExports from './convert-commonjs-to-esm-exports/index.js';
14
+ import * as convertCommonjsToEsmCommons from './convert-commonjs-to-esm-commons/index.js';
15
+ import * as convertCommonjsToEsmRequire from './convert-commonjs-to-esm-require/index.js';
16
+ import * as cjsFile from './cjs-file/index.js';
17
+ import * as mjsFile from './mjs-file/index.js';
18
+ import * as renameFileCjsToJs from './rename-file-cjs-to-js/index.js';
19
+ import * as renameFileMjsToJs from './rename-file-mjs-to-js/index.js';
20
+ import * as strictMode from './strict-mode/index.js';
21
+ import * as removeUselessPromisify from './remove-useless-promisify/index.js';
22
+ import * as groupRequireById from './group-require-by-id/index.js';
2
23
 
3
- const convertBufferToBufferAlloc = require('./convert-buffer-to-buffer-alloc');
4
- const convertFsPromises = require('./convert-fs-promises');
5
- const convertPromisifyToFsPromises = require('./convert-promisify-to-fs-promises');
6
- const convertDirnameToUrl = require('./convert-dirname-to-url');
7
- const convertUrlToDirname = require('./convert-url-to-dirname');
8
- const convertTopLevelReturn = require('./convert-top-level-return');
9
- const declare = require('./declare');
10
- const declareAfterRequire = require('./declare-after-require');
11
- const removeProcessExit = require('./remove-process-exit');
12
- const addNodePrefix = require('./add-node-prefix');
13
- const convertExportsToModuleExports = require('./convert-exports-to-module-exports');
14
-
15
- const convertEsmToCommonjs = require('./convert-esm-to-commonjs');
16
-
17
- const convertCommonjsToEsmExports = require('./convert-commonjs-to-esm-exports');
18
- const convertCommonjsToEsmCommons = require('./convert-commonjs-to-esm-commons');
19
- const convertCommonjsToEsmRequire = require('./convert-commonjs-to-esm-require');
20
-
21
- const cjsFile = require('./cjs-file');
22
- const mjsFile = require('./mjs-file');
23
-
24
- const renameFileCjsToJs = require('./rename-file-cjs-to-js');
25
- const renameFileMjsToJs = require('./rename-file-mjs-to-js');
26
-
27
- const strictMode = require('./strict-mode');
28
- const removeUselessPromisify = require('./remove-useless-promisify');
29
- const groupRequireById = require('./group-require-by-id');
30
-
31
- module.exports.rules = {
24
+ export const rules = {
32
25
  'convert-buffer-to-buffer-alloc': convertBufferToBufferAlloc,
33
26
  'convert-fs-promises': convertFsPromises,
34
27
  'convert-promisify-to-fs-promises': convertPromisifyToFsPromises,
@@ -1,10 +1,17 @@
1
- 'use strict';
2
-
3
- const {operator} = require('putout');
4
- const plugin = require('../convert-commonjs-to-esm');
1
+ import {operator} from 'putout';
2
+ import * as plugin from '../convert-commonjs-to-esm.js';
5
3
 
6
4
  const {matchFiles} = operator;
7
-
8
- module.exports = matchFiles({
5
+ const {
6
+ report,
7
+ fix,
8
+ scan,
9
+ } = matchFiles({
9
10
  '*.mjs': plugin,
10
11
  });
12
+
13
+ export {
14
+ report,
15
+ fix,
16
+ scan,
17
+ };
@@ -1,8 +1,6 @@
1
- 'use strict';
1
+ export const report = () => '"process.exit" should not be used';
2
2
 
3
- module.exports.report = () => '"process.exit" should not be used';
4
-
5
- module.exports.replace = () => ({
3
+ export const replace = () => ({
6
4
  'process.exit()': '',
7
5
  'process["exit"]()': '',
8
6
  });
@@ -1,7 +1,5 @@
1
- 'use strict';
1
+ export const report = () => `Calling 'promisify' on a function that returns a Promise is likely a mistake`;
2
2
 
3
- module.exports.report = () => `Calling 'promisify' on a function that returns a Promise is likely a mistake`;
4
-
5
- module.exports.replace = () => ({
3
+ export const replace = () => ({
6
4
  'promisify(async (__args) => __body)': 'async (__args) => __body',
7
5
  });
@@ -1,12 +1,21 @@
1
- 'use strict';
1
+ import {operator} from 'putout';
2
2
 
3
- const {operator} = require('putout');
4
3
  const {renameFiles} = operator;
5
4
 
6
- module.exports = renameFiles({
5
+ const {
6
+ report,
7
+ fix,
8
+ scan,
9
+ } = renameFiles({
7
10
  type: 'commonjs',
8
11
  mask: '*.cjs',
9
12
  rename(name) {
10
13
  return name.replace(/cjs$/, 'js');
11
14
  },
12
15
  });
16
+
17
+ export {
18
+ report,
19
+ fix,
20
+ scan,
21
+ };
@@ -1,12 +1,20 @@
1
- 'use strict';
1
+ import {operator} from 'putout';
2
2
 
3
- const {operator} = require('putout');
4
3
  const {renameFiles} = operator;
5
-
6
- module.exports = renameFiles({
4
+ const {
5
+ report,
6
+ fix,
7
+ scan,
8
+ } = renameFiles({
7
9
  type: 'module',
8
10
  mask: '*.mjs',
9
11
  rename(name) {
10
12
  return name.replace(/mjs$/, 'js');
11
13
  },
12
14
  });
15
+
16
+ export {
17
+ report,
18
+ fix,
19
+ scan,
20
+ };
@@ -1,18 +1,18 @@
1
- 'use strict';
1
+ import {types} from 'putout';
2
2
 
3
3
  const {
4
4
  isExpressionStatement,
5
- StringLiteral,
6
- ExpressionStatement,
7
- } = require('putout').types;
5
+ stringLiteral,
6
+ expressionStatement,
7
+ } = types;
8
8
 
9
- module.exports.report = () => `Add missing 'use strict' directive on top of CommonJS`;
9
+ export const report = () => `Add missing 'use strict' directive on top of CommonJS`;
10
10
 
11
- module.exports.fix = ({node}) => {
12
- node.body.unshift(ExpressionStatement(StringLiteral('use strict')));
11
+ export const fix = ({node}) => {
12
+ node.body.unshift(expressionStatement(stringLiteral('use strict')));
13
13
  };
14
14
 
15
- module.exports.traverse = ({push, store}) => ({
15
+ export const traverse = ({push, store}) => ({
16
16
  'ImportDeclaration|ExportNamedDeclaration|ExportDefaultDeclaration|ExportAllDeclaration|TypeAlias'() {
17
17
  store('is-module', true);
18
18
  },
@@ -1,10 +1,8 @@
1
- 'use strict';
1
+ import * as addMissing from './add-missing/index.js';
2
+ import * as removeUseless from './remove-useless/index.js';
3
+ import * as removeIllegal from './remove-illegal/index.js';
2
4
 
3
- const addMissing = require('./add-missing');
4
- const removeUseless = require('./remove-useless');
5
- const removeIllegal = require('./remove-illegal');
6
-
7
- module.exports.rules = {
5
+ export const rules = {
8
6
  'add-missing': addMissing,
9
7
  'remove-useless': removeUseless,
10
8
  'remove-illegal': removeIllegal,
@@ -1,6 +1,5 @@
1
- 'use strict';
1
+ import {operator, types} from 'putout';
2
2
 
3
- const {operator, types} = require('putout');
4
3
  const {
5
4
  isArrayPattern,
6
5
  isObjectPattern,
@@ -11,12 +10,12 @@ const {
11
10
 
12
11
  const {remove} = operator;
13
12
 
14
- module.exports.report = () => `Avoid illegal 'use strict'`;
13
+ export const report = () => `Avoid illegal 'use strict'`;
15
14
 
16
- module.exports.fix = (path) => {
15
+ export const fix = (path) => {
17
16
  remove(path);
18
17
  };
19
- module.exports.traverse = ({push}) => ({
18
+ export const traverse = ({push}) => ({
20
19
  DirectiveLiteral(path) {
21
20
  const fnPath = path.parentPath.parentPath.parentPath;
22
21
 
@@ -1,16 +1,15 @@
1
- 'use strict';
1
+ import {types, operator} from 'putout';
2
2
 
3
- const {types, operator} = require('putout');
4
3
  const {remove} = operator;
5
4
  const {isProgram} = types;
6
5
 
7
6
  const isStrictMode = (a) => a.node.value.value === 'use strict';
8
7
 
9
- module.exports.report = () => `Avoid 'use strict' in ESM`;
8
+ export const report = () => `Avoid 'use strict' in ESM`;
10
9
 
11
- module.exports.fix = (path) => remove(path);
10
+ export const fix = (path) => remove(path);
12
11
 
13
- module.exports.traverse = ({push, store}) => ({
12
+ export const traverse = ({push, store}) => ({
14
13
  'await __a(__args)'({scope}) {
15
14
  if (isProgram(scope.block))
16
15
  store('is-module', true);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@putout/plugin-nodejs",
3
- "version": "14.1.0",
4
- "type": "commonjs",
3
+ "version": "15.0.1",
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",
7
7
  "homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-nodejs#readme",
@@ -39,27 +39,27 @@
39
39
  "nodejs"
40
40
  ],
41
41
  "devDependencies": {
42
- "@putout/eslint-flat": "^2.0.0",
42
+ "@putout/eslint-flat": "^3.0.0",
43
43
  "@putout/plugin-declare": "*",
44
44
  "@putout/plugin-declare-before-reference": "*",
45
45
  "@putout/plugin-putout": "*",
46
46
  "@putout/plugin-reuse-duplicate-init": "*",
47
47
  "@putout/plugin-typescript": "*",
48
- "@putout/test": "^11.0.0",
48
+ "@putout/test": "^13.0.0",
49
49
  "c8": "^10.0.0",
50
50
  "eslint": "^9.0.0",
51
51
  "eslint-plugin-n": "^17.0.0",
52
- "eslint-plugin-putout": "^24.0.0",
53
- "madrun": "^10.0.0",
52
+ "eslint-plugin-putout": "^26.0.0",
53
+ "madrun": "^11.0.0",
54
54
  "montag": "^1.2.1",
55
55
  "nodemon": "^3.0.1"
56
56
  },
57
57
  "peerDependencies": {
58
- "putout": ">=38"
58
+ "putout": ">=39"
59
59
  },
60
60
  "license": "MIT",
61
61
  "engines": {
62
- "node": ">=18.6"
62
+ "node": ">=20"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"
@@ -1,9 +0,0 @@
1
- {
2
- "exec": "import {exec} from 'child_process'",
3
- "execFile": "import {execFile} from 'child_process'",
4
- "execFileSync": "import {execFileSync} from 'child_process'",
5
- "execSync": "import {execSync} from 'child_process'",
6
- "fork": "import {fork} from 'child_process'",
7
- "spawn": "import {spawn} from 'child_process'",
8
- "spawnSync": "import {spawnSync} from 'child_process'"
9
- }
@@ -1,12 +0,0 @@
1
- {
2
- "once": "import {once} from 'events'",
3
- "on": "import {on} from 'events'",
4
- "getEventListeners": "import {getEventListeners} from 'events'",
5
- "EventEmitter": "import {EventEmitter} from 'events'",
6
- "captureRejectionSymbol": "import {captureRejectionSymbol} from 'events'",
7
- "captureRejections": "import {captureRejections} from 'events'",
8
- "EventEmitterAsyncResource": "import {EventEmitterAsyncResource} from 'events'",
9
- "defaultMaxListeners": "import {defaultMaxListeners} from 'events'",
10
- "setMaxListeners": "import {setMaxListeners} from 'events'",
11
- "listenerCount": "import {listenerCount} from 'events'"
12
- }
@@ -1,31 +0,0 @@
1
- {
2
- "access": "import {access} from 'fs/promises'",
3
- "copyFile": "import {copyFile} from 'fs/promises'",
4
- "cp": "import {cp} from 'fs/promises'",
5
- "open": "import {open} from 'fs/promises'",
6
- "opendir": "import {opendir} from 'fs/promises'",
7
- "rename": "import {rename} from 'fs/promises'",
8
- "truncate": "import {truncate} from 'fs/promises'",
9
- "rm": "import {rm} from 'fs/promises'",
10
- "rmdir": "import {rmdir} from 'fs/promises'",
11
- "mkdir": "import {mkdir} from 'fs/promises'",
12
- "readdir": "import {readdir} from 'fs/promises'",
13
- "readlink": "import {readlink} from 'fs/promises'",
14
- "symlink": "import {symlink} from 'fs/promises'",
15
- "lstat": "import {lstat} from 'fs/promises'",
16
- "stat": "import {stat} from 'fs/promises'",
17
- "link": "import {link} from 'fs/promises'",
18
- "unlink": "import {unlink} from 'fs/promises'",
19
- "chmod": "import {chmod} from 'fs/promises'",
20
- "lchmod": "import {lchmod} from 'fs/promises'",
21
- "lchown": "import {lchown} from 'fs/promises'",
22
- "chown": "import {chown} from 'fs/promises'",
23
- "utimes": "import {utimes} from 'fs/promises'",
24
- "lutimes": "import {lutimes} from 'fs/promises'",
25
- "realpath": "import {realpath} from 'fs/promises'",
26
- "mkdtemp": "import {mkdtemp} from 'fs/promises'",
27
- "writeFile": "import {writeFile} from 'fs/promises'",
28
- "appendFile": "import {appendFile} from 'fs/promises'",
29
- "readFile": "import {readFile} from 'fs/promises'",
30
- "watch": "import {watch} from 'fs/promises'"
31
- }