@putout/plugin-putout 11.14.0 → 12.0.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.
package/README.md
CHANGED
|
@@ -444,7 +444,7 @@ This is additional tests, if you forget to test some case (from a big list of ru
|
|
|
444
444
|
## declare
|
|
445
445
|
|
|
446
446
|
Depends on [@putout/convert-esm-to-commonjs](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-esm-to-commonjs#readme) and
|
|
447
|
-
[@putout/declare
|
|
447
|
+
[@putout/declare](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare#readme).
|
|
448
448
|
|
|
449
449
|
### ❌ Example of incorrect code
|
|
450
450
|
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
const putout = require('putout');
|
|
4
4
|
const tryCatch = require('try-catch');
|
|
5
5
|
|
|
6
|
+
const noop = () => {};
|
|
7
|
+
|
|
6
8
|
const {types, operator} = putout;
|
|
7
9
|
const {replaceWith} = operator;
|
|
8
10
|
const {
|
|
@@ -19,7 +21,7 @@ module.exports = (rootPath, key) => {
|
|
|
19
21
|
isTS: true,
|
|
20
22
|
plugins: [
|
|
21
23
|
['generate', {
|
|
22
|
-
report:
|
|
24
|
+
report: noop,
|
|
23
25
|
include: () => [
|
|
24
26
|
'Identifier',
|
|
25
27
|
'StringLiteral',
|
|
@@ -5,8 +5,9 @@ const tryCatch = require('try-catch');
|
|
|
5
5
|
|
|
6
6
|
const generateCode = require('./generate-code');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const noop = () => {};
|
|
9
9
|
|
|
10
|
+
const {operator} = putout;
|
|
10
11
|
const {
|
|
11
12
|
compare,
|
|
12
13
|
extract,
|
|
@@ -80,7 +81,7 @@ module.exports.traverse = ({push}) => ({
|
|
|
80
81
|
isTS: true,
|
|
81
82
|
plugins: [
|
|
82
83
|
['evaluate', {
|
|
83
|
-
report:
|
|
84
|
+
report: noop,
|
|
84
85
|
replace: () => ({
|
|
85
86
|
[key]: template,
|
|
86
87
|
}),
|
|
@@ -22,13 +22,14 @@ const {
|
|
|
22
22
|
Identifier,
|
|
23
23
|
isIdentifier,
|
|
24
24
|
isObjectExpression,
|
|
25
|
+
isMemberExpression,
|
|
25
26
|
} = types;
|
|
26
27
|
|
|
27
28
|
module.exports.report = () => 'Move require on top level';
|
|
28
29
|
|
|
29
30
|
module.exports.match = () => ({
|
|
30
31
|
[TEST]: ({__b}) => !isIdentifier(__b),
|
|
31
|
-
[TRANSFORM]: ({__b}) => !isIdentifier(__b) && !isObjectExpression(__b),
|
|
32
|
+
[TRANSFORM]: ({__b}) => !isIdentifier(__b) && !isObjectExpression(__b) && !isMemberExpression(__b),
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
module.exports.replace = () => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps with plugins development",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"nodemon": "^2.0.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"putout": ">=
|
|
51
|
+
"putout": ">=29"
|
|
52
52
|
},
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"engines": {
|