@putout/plugin-nodejs 14.0.1 → 14.1.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.
|
@@ -13,6 +13,7 @@ const {replaceWith, insertBefore} = operator;
|
|
|
13
13
|
const {
|
|
14
14
|
isFunction,
|
|
15
15
|
isObjectPattern,
|
|
16
|
+
isArrayPattern,
|
|
16
17
|
isIdentifier,
|
|
17
18
|
isStringLiteral,
|
|
18
19
|
AwaitExpression,
|
|
@@ -103,6 +104,21 @@ module.exports.replace = () => ({
|
|
|
103
104
|
return `import {${importsStr}} from "${value}" ${assertion}`;
|
|
104
105
|
}
|
|
105
106
|
|
|
107
|
+
if (isArrayPattern(__a)) {
|
|
108
|
+
const imports = [];
|
|
109
|
+
|
|
110
|
+
for (const [index, value] of __a.elements.entries()) {
|
|
111
|
+
if (!value)
|
|
112
|
+
continue;
|
|
113
|
+
|
|
114
|
+
imports.push(`'${index}' as ${value.name}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const importsStr = imports.join(',');
|
|
118
|
+
|
|
119
|
+
return `import {${importsStr}} from "${value}" ${assertion}`;
|
|
120
|
+
}
|
|
121
|
+
|
|
106
122
|
return `import __a from "${value}" ${assertion}`;
|
|
107
123
|
},
|
|
108
124
|
'const __a = __b(require(__c))': ({__a, __b, __c}, path) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "14.0
|
|
3
|
+
"version": "14.1.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",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"eslint": "^9.0.0",
|
|
51
51
|
"eslint-plugin-n": "^17.0.0",
|
|
52
52
|
"eslint-plugin-putout": "^24.0.0",
|
|
53
|
-
"lerna": "^6.0.1",
|
|
54
53
|
"madrun": "^10.0.0",
|
|
55
54
|
"montag": "^1.2.1",
|
|
56
55
|
"nodemon": "^3.0.1"
|