@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.
- package/lib/add-node-prefix/index.js +5 -7
- package/lib/cjs-file/index.js +13 -6
- package/lib/convert-buffer-to-buffer-alloc/index.js +4 -5
- package/lib/convert-commonjs-to-esm-commons/index.js +5 -7
- package/lib/convert-commonjs-to-esm-exports/index.js +11 -12
- package/lib/convert-commonjs-to-esm-require/index.js +18 -21
- package/lib/convert-commonjs-to-esm.js +4 -6
- package/lib/convert-dirname-to-url/index.js +4 -5
- package/lib/convert-esm-to-commonjs/index.js +3 -4
- package/lib/convert-exports-to-module-exports/index.js +2 -4
- package/lib/convert-fs-promises/index.js +2 -4
- package/lib/convert-promisify-to-fs-promises/index.js +7 -6
- package/lib/convert-top-level-return/index.js +4 -5
- package/lib/convert-url-to-dirname/index.js +4 -5
- package/lib/declare/index.js +25 -14
- package/lib/declare/modules/child_process.js +9 -0
- package/lib/declare/modules/events.js +12 -0
- package/lib/declare/modules/fs-promises.js +31 -0
- package/lib/declare/modules/fs.js +100 -0
- package/lib/declare/modules/module.js +10 -0
- package/lib/declare/modules/os.js +21 -0
- package/lib/declare/modules/path.js +16 -0
- package/lib/declare/modules/process.js +55 -0
- package/lib/declare/modules/stream.js +14 -0
- package/lib/declare/modules/url.js +7 -0
- package/lib/declare/modules/util.js +14 -0
- package/lib/declare/modules/zlib.js +40 -0
- package/lib/declare-after-require/index.js +4 -5
- package/lib/group-require-by-id/index.js +5 -6
- package/lib/index.js +23 -30
- package/lib/mjs-file/index.js +13 -6
- package/lib/remove-process-exit/index.js +2 -4
- package/lib/remove-useless-promisify/index.js +2 -4
- package/lib/rename-file-cjs-to-js/index.js +12 -3
- package/lib/rename-file-mjs-to-js/index.js +12 -4
- package/lib/strict-mode/add-missing/index.js +8 -8
- package/lib/strict-mode/index.js +4 -6
- package/lib/strict-mode/remove-illegal/index.js +4 -5
- package/lib/strict-mode/remove-useless/index.js +4 -5
- package/package.json +8 -8
- package/lib/declare/modules/child_process.json +0 -9
- package/lib/declare/modules/events.json +0 -12
- package/lib/declare/modules/fs-promises.json +0 -31
- package/lib/declare/modules/fs.json +0 -100
- package/lib/declare/modules/module.json +0 -10
- package/lib/declare/modules/os.json +0 -21
- package/lib/declare/modules/path.json +0 -16
- package/lib/declare/modules/process.json +0 -55
- package/lib/declare/modules/stream.json +0 -14
- package/lib/declare/modules/url.json +0 -7
- package/lib/declare/modules/util.json +0 -14
- package/lib/declare/modules/zlib.json +0 -40
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {isBuiltin} = require('node:module');
|
|
4
|
-
const {types, operator} = require('putout');
|
|
1
|
+
import {isBuiltin} from 'node:module';
|
|
2
|
+
import {types, operator} from 'putout';
|
|
5
3
|
|
|
6
4
|
const {
|
|
7
5
|
setLiteralValue,
|
|
@@ -12,11 +10,11 @@ const {isCallExpression} = types;
|
|
|
12
10
|
|
|
13
11
|
const REQUIRE = 'require("__a")';
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
export const report = ({value}) => {
|
|
16
14
|
return `Use 'node:${value}' instead of '${value}'`;
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
export const fix = ({path, value}) => {
|
|
20
18
|
if (isCallExpression(path)) {
|
|
21
19
|
const arg = path.get('arguments.0');
|
|
22
20
|
setLiteralValue(arg, `node:${value}`);
|
|
@@ -28,7 +26,7 @@ module.exports.fix = ({path, value}) => {
|
|
|
28
26
|
setLiteralValue(source, `node:${value}`);
|
|
29
27
|
};
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
export const traverse = ({push}) => ({
|
|
32
30
|
[REQUIRE](path) {
|
|
33
31
|
const {__a} = getTemplateValues(path, REQUIRE);
|
|
34
32
|
const {value} = __a;
|
package/lib/cjs-file/index.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {operator} = require('putout');
|
|
4
|
-
const plugin = require('../convert-esm-to-commonjs');
|
|
1
|
+
import {operator} from 'putout';
|
|
2
|
+
import * as plugin from '../convert-esm-to-commonjs/index.js';
|
|
5
3
|
|
|
6
4
|
const {matchFiles} = operator;
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const {
|
|
6
|
+
report,
|
|
7
|
+
fix,
|
|
8
|
+
scan,
|
|
9
|
+
} = matchFiles({
|
|
9
10
|
'*.cjs': plugin,
|
|
10
11
|
});
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
report,
|
|
15
|
+
fix,
|
|
16
|
+
scan,
|
|
17
|
+
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {operator} = require('putout');
|
|
4
3
|
const {compute} = operator;
|
|
5
4
|
|
|
6
5
|
const isNumber = (a) => typeof a === 'number';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export const report = () => `Use 'Buffer.alloc()' or 'Buffer.from()' instead of 'Buffer()' and 'new Buffer()'`;
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
export const match = () => ({
|
|
11
10
|
'new Buffer(__a)': (vars, path) => {
|
|
12
11
|
const __aPath = path.get('arguments.0');
|
|
13
12
|
const [is] = compute(__aPath);
|
|
@@ -16,7 +15,7 @@ module.exports.match = () => ({
|
|
|
16
15
|
},
|
|
17
16
|
});
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
export const replace = () => ({
|
|
20
19
|
'new Buffer(__a)': transform,
|
|
21
20
|
'new Buffer(__a, __b)': transform,
|
|
22
21
|
'Buffer(__a)': transform,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {template, operator} = require('putout');
|
|
1
|
+
import {template, operator} from 'putout';
|
|
4
2
|
|
|
5
3
|
const {
|
|
6
4
|
getPathAfterImports,
|
|
@@ -13,9 +11,9 @@ const initCommons = template.ast(`
|
|
|
13
11
|
const require = createRequire(import.meta.url);
|
|
14
12
|
`);
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
export const report = () => '"__filename", "__dirname" and "require" should be declared in ESM';
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
export const fix = ({scope}) => {
|
|
19
17
|
const programScope = scope.getProgramParent();
|
|
20
18
|
const body = programScope.path.get('body');
|
|
21
19
|
const afterImportPath = getPathAfterImports(body);
|
|
@@ -23,13 +21,13 @@ module.exports.fix = ({scope}) => {
|
|
|
23
21
|
insertBefore(afterImportPath, initCommons);
|
|
24
22
|
};
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
export const include = () => [
|
|
27
25
|
'__filename',
|
|
28
26
|
'__dirname',
|
|
29
27
|
'require',
|
|
30
28
|
];
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
export const filter = ({scope}) => {
|
|
33
31
|
const isDirname = scope.hasBinding('__dirname');
|
|
34
32
|
const isFilename = scope.hasBinding('__filename');
|
|
35
33
|
const isRequire = scope.hasBinding('require');
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {types, operator} = require('putout');
|
|
4
|
-
const {replaceWith} = operator;
|
|
1
|
+
import {types, operator} from 'putout';
|
|
5
2
|
|
|
6
3
|
const {
|
|
4
|
+
exportSpecifier,
|
|
7
5
|
isIdentifier,
|
|
8
|
-
ExportNamedDeclaration,
|
|
9
6
|
isImportSpecifier,
|
|
10
|
-
|
|
7
|
+
exportNamedDeclaration,
|
|
11
8
|
} = types;
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
const {replaceWith} = operator;
|
|
11
|
+
|
|
12
|
+
export const report = () => `Use 'ESM' instead of 'CommonJS'`;
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
export const exclude = () => ['__, __'];
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
export const match = () => ({
|
|
18
17
|
'module.exports.__a = __b': ({__a, __b}, path) => {
|
|
19
18
|
const {name} = __a;
|
|
20
19
|
|
|
@@ -36,7 +35,7 @@ module.exports.match = () => ({
|
|
|
36
35
|
},
|
|
37
36
|
});
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
export const replace = () => ({
|
|
40
39
|
'module.exports = __a': 'export default __a',
|
|
41
40
|
'module.exports.__a = __b': ({__a, __b}, path) => {
|
|
42
41
|
const {name} = __a;
|
|
@@ -56,10 +55,10 @@ function addExportToBinding(name, path) {
|
|
|
56
55
|
if (isImportSpecifier(bindingPath)) {
|
|
57
56
|
const {imported} = bindingPath.node;
|
|
58
57
|
|
|
59
|
-
return
|
|
58
|
+
return exportNamedDeclaration(null, [exportSpecifier(imported, imported)]);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
const exportNode =
|
|
61
|
+
const exportNode = exportNamedDeclaration(bindingPath.node);
|
|
63
62
|
|
|
64
63
|
replaceWith(bindingPath, exportNode);
|
|
65
64
|
|
|
@@ -1,45 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const justCamelCase = require('just-camel-case');
|
|
4
|
-
|
|
5
|
-
const {
|
|
1
|
+
import {
|
|
6
2
|
types,
|
|
7
3
|
operator,
|
|
8
4
|
template,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const {replaceWith, insertBefore} = operator;
|
|
5
|
+
} from 'putout';
|
|
6
|
+
import justCamelCase from 'just-camel-case';
|
|
12
7
|
|
|
13
8
|
const {
|
|
9
|
+
awaitExpression,
|
|
10
|
+
identifier,
|
|
11
|
+
importDeclaration,
|
|
14
12
|
isFunction,
|
|
15
13
|
isObjectPattern,
|
|
16
14
|
isArrayPattern,
|
|
17
15
|
isIdentifier,
|
|
18
16
|
isStringLiteral,
|
|
19
|
-
|
|
20
|
-
ImportDeclaration,
|
|
21
|
-
ImportDefaultSpecifier,
|
|
22
|
-
Identifier,
|
|
17
|
+
importDefaultSpecifier,
|
|
23
18
|
} = types;
|
|
24
19
|
|
|
20
|
+
const {replaceWith, insertBefore} = operator;
|
|
21
|
+
|
|
25
22
|
const camelCase = (a) => justCamelCase(a.replace('@', ''));
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
export const report = () => `Use 'ESM' instead of 'CommonJS'`;
|
|
28
25
|
|
|
29
26
|
const __B = 'declarations.0.init.arguments.0';
|
|
30
27
|
|
|
31
28
|
const createImport = ({name, source}) => {
|
|
32
29
|
const specifiers = [
|
|
33
|
-
|
|
30
|
+
importDefaultSpecifier(name),
|
|
34
31
|
];
|
|
35
32
|
|
|
36
|
-
return
|
|
33
|
+
return importDeclaration(specifiers, source);
|
|
37
34
|
};
|
|
38
35
|
|
|
39
36
|
const createFnDeclaration = template('const NAME1 = FN(NAME2)');
|
|
40
37
|
const isPackage = ({value}) => /package(\.json)?$/.test(value);
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
export const match = () => ({
|
|
43
40
|
'const __a = require(__b)': ({__b}, path) => {
|
|
44
41
|
// exclude jsons while not supported
|
|
45
42
|
if (/\.json/.test(__b.value))
|
|
@@ -65,9 +62,9 @@ module.exports.match = () => ({
|
|
|
65
62
|
'const __a = require("__b").__c(__args)': checkCall,
|
|
66
63
|
});
|
|
67
64
|
|
|
68
|
-
|
|
65
|
+
export const replace = () => ({
|
|
69
66
|
'const __a = require(".")': 'import __a from "./index.js"',
|
|
70
|
-
'const __a = require(__b).default': 'import __a from "__b"',
|
|
67
|
+
'const __a = require("__b").default': 'import __a from "__b"',
|
|
71
68
|
'const __a = require(__b).__c': `{
|
|
72
69
|
const {__c} = require(__b);
|
|
73
70
|
const __a = __c;
|
|
@@ -125,14 +122,14 @@ module.exports.replace = () => ({
|
|
|
125
122
|
const name = `_${__a.name}`;
|
|
126
123
|
|
|
127
124
|
const importNode = createImport({
|
|
128
|
-
name:
|
|
125
|
+
name: identifier(name),
|
|
129
126
|
source: __c,
|
|
130
127
|
});
|
|
131
128
|
|
|
132
129
|
const declarationNode = createFnDeclaration({
|
|
133
130
|
NAME1: __a,
|
|
134
131
|
FN: __b,
|
|
135
|
-
NAME2:
|
|
132
|
+
NAME2: identifier(name),
|
|
136
133
|
});
|
|
137
134
|
|
|
138
135
|
insertBefore(path, [importNode]);
|
|
@@ -171,7 +168,7 @@ function applyDynamicImport(path) {
|
|
|
171
168
|
const {node} = initPath;
|
|
172
169
|
|
|
173
170
|
initPath.node.callee.name = 'import';
|
|
174
|
-
replaceWith(initPath,
|
|
171
|
+
replaceWith(initPath, awaitExpression(node));
|
|
175
172
|
|
|
176
173
|
return path;
|
|
177
174
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import * as convertCommonjsToEsmExports from './convert-commonjs-to-esm-exports/index.js';
|
|
2
|
+
import * as convertCommonjsToEsmCommons from './convert-commonjs-to-esm-commons/index.js';
|
|
3
|
+
import * as convertCommonjsToEsmRequire from './convert-commonjs-to-esm-require/index.js';
|
|
2
4
|
|
|
3
|
-
const
|
|
4
|
-
const convertCommonjsToEsmCommons = require('./convert-commonjs-to-esm-commons');
|
|
5
|
-
const convertCommonjsToEsmRequire = require('./convert-commonjs-to-esm-require');
|
|
6
|
-
|
|
7
|
-
module.exports.rules = {
|
|
5
|
+
export const rules = {
|
|
8
6
|
'convert-commonjs-to-esm-exports': convertCommonjsToEsmExports,
|
|
9
7
|
'convert-commonjs-to-esm-common': convertCommonjsToEsmCommons,
|
|
10
8
|
'convert-commonjs-to-esm-require': convertCommonjsToEsmRequire,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {operator} = require('putout');
|
|
4
3
|
const {isESM} = operator;
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
export const report = () => `Use 'import.meta.url' instead of '__dirname'`;
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export const filter = isESM;
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
export const replace = () => ({
|
|
11
10
|
'join(__dirname, __a)': 'new URL(__a, import.meta.url).pathname',
|
|
12
11
|
'path.join(__dirname, __a)': 'new URL(__a, import.meta.url).pathname',
|
|
13
12
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import {types} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {types} = require('putout');
|
|
4
3
|
const {isImportDefaultSpecifier} = types;
|
|
5
4
|
|
|
6
5
|
const BODY = '{__body}';
|
|
@@ -9,9 +8,9 @@ const GEN_FN = `function* __a(__args) ${BODY}`;
|
|
|
9
8
|
const ASYNC_FN = `async function __a(__args) ${BODY}`;
|
|
10
9
|
const CLASS = `class __a ${BODY}`;
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
export const report = () => `Use 'CommonJS' instead of 'ESM'`;
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
export const replace = () => ({
|
|
15
14
|
'export default __a': 'module.exports = __a',
|
|
16
15
|
[`export ${CLASS}`]: `module.exports.__a = ${CLASS}`,
|
|
17
16
|
[`export ${FN}`]: `module.epxorts.__a = ${FN}`,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
'
|
|
1
|
+
export const report = () => `Use 'module.exports' instead of 'exports'`;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.replace = () => ({
|
|
3
|
+
export const replace = () => ({
|
|
6
4
|
'exports.__a': 'module.exports.__a',
|
|
7
5
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
'
|
|
1
|
+
export const report = () => '"fs/promises" should be used instead of "fs.promises"';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.replace = () => ({
|
|
3
|
+
export const replace = () => ({
|
|
6
4
|
'const __a = require("fs").promises': 'const __a = require("fs/promises")',
|
|
7
5
|
});
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
types as t,
|
|
3
|
+
operator,
|
|
4
|
+
} from 'putout';
|
|
4
5
|
|
|
5
6
|
const {replaceWith, remove} = operator;
|
|
6
7
|
|
|
7
8
|
const NOT_COMPUTED = false;
|
|
8
9
|
const SHORTHAND = true;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
export const report = () => `fs.promises should be used instead of fs`;
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
export const fix = ({path, promisified}) => {
|
|
13
14
|
const props = [];
|
|
14
15
|
|
|
15
16
|
for (const path of promisified) {
|
|
@@ -32,7 +33,7 @@ module.exports.fix = ({path, promisified}) => {
|
|
|
32
33
|
replaceWith(path.get('id'), t.ObjectPattern(props));
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
export const find = (ast, {push, traverse}) => {
|
|
36
37
|
const fs = [];
|
|
37
38
|
const promisified = [];
|
|
38
39
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {types} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {types} = require('putout');
|
|
4
3
|
const {isFunction} = types;
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
export const report = () => `"process.exit" should be used instead of top-level return`;
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export const filter = (path) => !path.findParent(isFunction);
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
export const replace = () => ({
|
|
11
10
|
'return __a()': '{__a(); process.exit()}',
|
|
12
11
|
'return __a': 'process.exit()',
|
|
13
12
|
'return': 'process.exit()',
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {operator} = require('putout');
|
|
4
3
|
const {isESM} = operator;
|
|
5
4
|
const not = (fn) => (...a) => !fn(...a);
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
export const report = () => `Use __dirname instead of 'import.meta.url' in CommonJS`;
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
export const filter = not(isESM);
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
export const replace = () => ({
|
|
12
11
|
'new URL(__a, import.meta.url).pathname': 'join(__dirname, __a)',
|
|
13
12
|
});
|
package/lib/declare/index.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import child_process from './modules/child_process.js';
|
|
2
|
+
import util from './modules/util.js';
|
|
3
|
+
import url from './modules/url.js';
|
|
4
|
+
import zlib from './modules/zlib.js';
|
|
5
|
+
import os from './modules/os.js';
|
|
6
|
+
import stream from './modules/stream.js';
|
|
7
|
+
import module from './modules/module.js';
|
|
8
|
+
import process from './modules/process.js';
|
|
9
|
+
import path from './modules/path.js';
|
|
10
|
+
import fsPromises from './modules/fs-promises.js';
|
|
11
|
+
import fs from './modules/fs.js';
|
|
12
|
+
import events from './modules/events.js';
|
|
2
13
|
|
|
3
|
-
|
|
4
|
-
...
|
|
5
|
-
...
|
|
6
|
-
...
|
|
7
|
-
...
|
|
8
|
-
...
|
|
9
|
-
...
|
|
10
|
-
...
|
|
11
|
-
...
|
|
12
|
-
...
|
|
13
|
-
...
|
|
14
|
-
...
|
|
15
|
-
...
|
|
14
|
+
export const declare = () => ({
|
|
15
|
+
...events,
|
|
16
|
+
...fs,
|
|
17
|
+
...fsPromises,
|
|
18
|
+
...path,
|
|
19
|
+
...process,
|
|
20
|
+
...module,
|
|
21
|
+
...stream,
|
|
22
|
+
...os,
|
|
23
|
+
...zlib,
|
|
24
|
+
...url,
|
|
25
|
+
...util,
|
|
26
|
+
...child_process,
|
|
16
27
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
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
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default {
|
|
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
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
appendFile: `import {appendFile} from 'fs'`,
|
|
3
|
+
appendFileSync: `import {appendFileSync} from 'fs'`,
|
|
4
|
+
access: `import {access} from 'fs'`,
|
|
5
|
+
accessSync: `import {accessSync} from 'fs'`,
|
|
6
|
+
chown: `import {chown} from 'fs'`,
|
|
7
|
+
chownSync: `import {chownSync} from 'fs'`,
|
|
8
|
+
chmod: `import {chmod} from 'fs'`,
|
|
9
|
+
chmodSync: `import {chmodSync} from 'fs'`,
|
|
10
|
+
close: `import {close} from 'fs'`,
|
|
11
|
+
closeSync: `import {closeSync} from 'fs'`,
|
|
12
|
+
copyFile: `import {copyFile} from 'fs'`,
|
|
13
|
+
copyFileSync: `import {copyFileSync} from 'fs'`,
|
|
14
|
+
cp: `import {cp} from 'fs'`,
|
|
15
|
+
cpSync: `import {cpSync} from 'fs'`,
|
|
16
|
+
createReadStream: `import {createReadStream} from 'fs'`,
|
|
17
|
+
createWriteStream: `import {createWriteStream} from 'fs'`,
|
|
18
|
+
exists: `import {exists} from 'fs'`,
|
|
19
|
+
existsSync: `import {existsSync} from 'fs'`,
|
|
20
|
+
fchown: `import {fchown} from 'fs'`,
|
|
21
|
+
fchownSync: `import {fchownSync} from 'fs'`,
|
|
22
|
+
fchmod: `import {fchmod} from 'fs'`,
|
|
23
|
+
fchmodSync: `import {fchmodSync} from 'fs'`,
|
|
24
|
+
fdatasync: `import {fdatasync} from 'fs'`,
|
|
25
|
+
fdatasyncSync: `import {fdatasyncSync} from 'fs'`,
|
|
26
|
+
fstat: `import {fstat} from 'fs'`,
|
|
27
|
+
fstatSync: `import {fstatSync} from 'fs'`,
|
|
28
|
+
fsync: `import {fsync} from 'fs'`,
|
|
29
|
+
fsyncSync: `import {fsyncSync} from 'fs'`,
|
|
30
|
+
ftruncate: `import {ftruncate} from 'fs'`,
|
|
31
|
+
ftruncateSync: `import {ftruncateSync} from 'fs'`,
|
|
32
|
+
futimes: `import {futimes} from 'fs'`,
|
|
33
|
+
futimesSync: `import {futimesSync} from 'fs'`,
|
|
34
|
+
lchown: `import {lchown} from 'fs'`,
|
|
35
|
+
lchownSync: `import {lchownSync} from 'fs'`,
|
|
36
|
+
lchmod: `import {lchmod} from 'fs'`,
|
|
37
|
+
lchmodSync: `import {lchmodSync} from 'fs'`,
|
|
38
|
+
link: `import {link} from 'fs'`,
|
|
39
|
+
linkSync: `import {linkSync} from 'fs'`,
|
|
40
|
+
lstat: `import {lstat} from 'fs'`,
|
|
41
|
+
lstatSync: `import {lstatSync} from 'fs'`,
|
|
42
|
+
lutimes: `import {lutimes} from 'fs'`,
|
|
43
|
+
lutimesSync: `import {lutimesSync} from 'fs'`,
|
|
44
|
+
mkdir: `import {mkdir} from 'fs'`,
|
|
45
|
+
mkdirSync: `import {mkdirSync} from 'fs'`,
|
|
46
|
+
mkdtemp: `import {mkdtemp} from 'fs'`,
|
|
47
|
+
mkdtempSync: `import {mkdtempSync} from 'fs'`,
|
|
48
|
+
open: `import {open} from 'fs'`,
|
|
49
|
+
openSync: `import {openSync} from 'fs'`,
|
|
50
|
+
opendir: `import {opendir} from 'fs'`,
|
|
51
|
+
opendirSync: `import {opendirSync} from 'fs'`,
|
|
52
|
+
readdir: `import {readdir} from 'fs'`,
|
|
53
|
+
readdirSync: `import {readdirSync} from 'fs'`,
|
|
54
|
+
read: `import {read} from 'fs'`,
|
|
55
|
+
readSync: `import {readSync} from 'fs'`,
|
|
56
|
+
readv: `import {readv} from 'fs'`,
|
|
57
|
+
readvSync: `import {readvSync} from 'fs'`,
|
|
58
|
+
readFile: `import {readFile} from 'fs'`,
|
|
59
|
+
readFileSync: `import {readFileSync} from 'fs'`,
|
|
60
|
+
readlink: `import {readlink} from 'fs'`,
|
|
61
|
+
readlinkSync: `import {readlinkSync} from 'fs'`,
|
|
62
|
+
realpath: `import {realpath} from 'fs'`,
|
|
63
|
+
realpathSync: `import {realpathSync} from 'fs'`,
|
|
64
|
+
rename: `import {rename} from 'fs'`,
|
|
65
|
+
renameSync: `import {renameSync} from 'fs'`,
|
|
66
|
+
rm: `import {rm} from 'fs'`,
|
|
67
|
+
rmSync: `import {rmSync} from 'fs'`,
|
|
68
|
+
rmdir: `import {rmdir} from 'fs'`,
|
|
69
|
+
rmdirSync: `import {rmdirSync} from 'fs'`,
|
|
70
|
+
stat: `import {stat} from 'fs'`,
|
|
71
|
+
statSync: `import {statSync} from 'fs'`,
|
|
72
|
+
symlink: `import {symlink} from 'fs'`,
|
|
73
|
+
symlinkSync: `import {symlinkSync} from 'fs'`,
|
|
74
|
+
truncate: `import {truncate} from 'fs'`,
|
|
75
|
+
truncateSync: `import {truncateSync} from 'fs'`,
|
|
76
|
+
unwatchFile: `import {unwatchFile} from 'fs'`,
|
|
77
|
+
unlink: `import {unlink} from 'fs'`,
|
|
78
|
+
unlinkSync: `import {unlinkSync} from 'fs'`,
|
|
79
|
+
utimes: `import {utimes} from 'fs'`,
|
|
80
|
+
utimesSync: `import {utimesSync} from 'fs'`,
|
|
81
|
+
watch: `import {watch} from 'fs'`,
|
|
82
|
+
watchFile: `import {watchFile} from 'fs'`,
|
|
83
|
+
writeFile: `import {writeFile} from 'fs'`,
|
|
84
|
+
writeFileSync: `import {writeFileSync} from 'fs'`,
|
|
85
|
+
write: `import {write} from 'fs'`,
|
|
86
|
+
writeSync: `import {writeSync} from 'fs'`,
|
|
87
|
+
writev: `import {writev} from 'fs'`,
|
|
88
|
+
writevSync: `import {writevSync} from 'fs'`,
|
|
89
|
+
Dir: `import {Dir} from 'fs'`,
|
|
90
|
+
Dirent: `import {Dirent} from 'fs'`,
|
|
91
|
+
Stats: `import {Stats} from 'fs'`,
|
|
92
|
+
ReadStream: `import {ReadStream} from 'fs'`,
|
|
93
|
+
WriteStream: `import {WriteStream} from 'fs'`,
|
|
94
|
+
FileReadStream: `import {FileReadStream} from 'fs'`,
|
|
95
|
+
FileWriteStream: `import {FileWriteStream} from 'fs'`,
|
|
96
|
+
F_OK: `import {F_OK} from 'fs'`,
|
|
97
|
+
R_OK: `import {R_OK} from 'fs'`,
|
|
98
|
+
W_OK: `import {W_OK} from 'fs'`,
|
|
99
|
+
X_OK: `import {X_OK} from 'fs'`,
|
|
100
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
builtinModules: `import {builtinModules} from 'module'`,
|
|
3
|
+
globalPaths: `import {globalPaths} from 'module'`,
|
|
4
|
+
createRequire: `import {createRequire} from 'module'`,
|
|
5
|
+
syncBuiltinESMExports: `import {syncBuiltinESMExports} from 'module'`,
|
|
6
|
+
Module: `import {Module} from 'module'`,
|
|
7
|
+
runMain: `import {runMain} from 'module'`,
|
|
8
|
+
findSourceMap: `import {findSourceMap} from 'module'`,
|
|
9
|
+
SourceMap: `import {SourceMap} from 'module'`,
|
|
10
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
arch: `import {arch} from 'os'`,
|
|
3
|
+
cpus: `import {cpus} from 'os'`,
|
|
4
|
+
endianness: `import {endianness} from 'os'`,
|
|
5
|
+
freemem: `import {freemem} from 'os'`,
|
|
6
|
+
getPriority: `import {getPriority} from 'os'`,
|
|
7
|
+
homedir: `import {homedir} from 'os'`,
|
|
8
|
+
hostname: `import {hostname} from 'os'`,
|
|
9
|
+
loadavg: `import {loadavg} from 'os'`,
|
|
10
|
+
networkInterfaces: `import {networkInterfaces} from 'os'`,
|
|
11
|
+
platform: `import {platform} from 'os'`,
|
|
12
|
+
release: `import {release} from 'os'`,
|
|
13
|
+
setPriority: `import {setPriority} from 'os'`,
|
|
14
|
+
tmpdir: `import {tmpdir} from 'os'`,
|
|
15
|
+
totalmem: `import {totalmem} from 'os'`,
|
|
16
|
+
userInfo: `import {userInfo} from 'os'`,
|
|
17
|
+
uptime: `import {uptime} from 'os'`,
|
|
18
|
+
constants: `import {constants} from 'os'`,
|
|
19
|
+
EOL: `import {EOL} from 'os'`,
|
|
20
|
+
devNull: `import {devNull} from 'os'`,
|
|
21
|
+
};
|