@putout/plugin-nodejs 10.1.0 → 10.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.
|
@@ -6,11 +6,16 @@ const {isImportDefaultSpecifier} = types;
|
|
|
6
6
|
module.exports.report = () => `Use 'CommonJS' instead of 'ESM'`;
|
|
7
7
|
|
|
8
8
|
module.exports.replace = () => ({
|
|
9
|
+
'export default __a': 'module.exports = __a',
|
|
10
|
+
'export class __a {}': 'module.exports.__a = class __a {}',
|
|
11
|
+
'export function __a(__args) {}': replaceFn,
|
|
12
|
+
'export async function __a(__args) {}': replaceFn,
|
|
13
|
+
'export const __a = __b': 'module.exports.__a = __b',
|
|
9
14
|
'export {__exports}': ({__exports}) => {
|
|
10
15
|
let result = 'module.exports = {\n';
|
|
11
16
|
|
|
12
17
|
for (const {local} of __exports) {
|
|
13
|
-
result += local.name
|
|
18
|
+
result += `${local.name},`;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
result += '};';
|
|
@@ -18,11 +23,6 @@ module.exports.replace = () => ({
|
|
|
18
23
|
return result;
|
|
19
24
|
},
|
|
20
25
|
|
|
21
|
-
'export default __a': 'module.exports = __a',
|
|
22
|
-
'export class __a {}': 'module.exports.__a = class __a {}',
|
|
23
|
-
'export function __a(__args) {}': replaceFn,
|
|
24
|
-
'export async function __a(__args) {}': replaceFn,
|
|
25
|
-
'export const __a = __b': 'module.exports.__a = __b',
|
|
26
26
|
'import "__a"': 'require("__a")',
|
|
27
27
|
'import * as __a from "__b"': 'const __a = require("__b")',
|
|
28
28
|
'import __imports from "__a"': ({__imports, __a}) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.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",
|