@putout/plugin-putout 15.4.0 → 16.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/lib/apply-async-formatter/index.js +1 -2
- package/lib/apply-namaspace-specifier/index.js +1 -2
- package/lib/check-match/index.js +1 -2
- package/lib/check-replace-code/generate-code.js +2 -4
- package/lib/convert-destructuring-to-identifier/index.js +1 -2
- package/lib/convert-traverse-to-include/index.js +1 -2
- package/lib/declare/operator/filesystem.js +12 -0
- package/lib/declare/operator/index.js +35 -0
- package/package.json +2 -2
- package/lib/declare/operator.json +0 -34
|
@@ -62,9 +62,8 @@ const createImportVisitor = ({push, names, pathStore = noop}) => ({
|
|
|
62
62
|
|
|
63
63
|
const {defaults, imports} = parseImportSpecifiers(specifiers);
|
|
64
64
|
|
|
65
|
-
if (defaults.length && imports.length)
|
|
65
|
+
if (defaults.length && imports.length)
|
|
66
66
|
return;
|
|
67
|
-
}
|
|
68
67
|
|
|
69
68
|
for (const name of names) {
|
|
70
69
|
if (value === name || name === 'any') {
|
package/lib/check-match/index.js
CHANGED
|
@@ -67,13 +67,11 @@ module.exports = (rootPath, key) => {
|
|
|
67
67
|
return replaceWith(path, ArrayPattern([]));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
if (name === '__object')
|
|
70
|
+
if (name === '__object')
|
|
71
71
|
return objectify(path);
|
|
72
|
-
}
|
|
73
72
|
|
|
74
|
-
if (name === '__body')
|
|
73
|
+
if (name === '__body')
|
|
75
74
|
replaceWith(path, BlockStatement([]));
|
|
76
|
-
}
|
|
77
75
|
},
|
|
78
76
|
}],
|
|
79
77
|
],
|
|
@@ -23,9 +23,8 @@ module.exports.match = () => ({
|
|
|
23
23
|
return false;
|
|
24
24
|
|
|
25
25
|
for (const propertyPath of __aPath.get('properties')) {
|
|
26
|
-
if (isPush(propertyPath) || isBlock(propertyPath))
|
|
26
|
+
if (isPush(propertyPath) || isBlock(propertyPath))
|
|
27
27
|
return true;
|
|
28
|
-
}
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
return false;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
findFile: 'const {findFile} = operator',
|
|
5
|
+
renameFile: 'const {renameFile} = operator',
|
|
6
|
+
removeFile: 'const {removeFile} = operator',
|
|
7
|
+
moveFile: 'const {moveFile} = operator',
|
|
8
|
+
createDirectory: 'const {createDirectory} = operator',
|
|
9
|
+
getParentDirectory: 'const {getParentDirectory} = operator',
|
|
10
|
+
readFileContent: 'const {readFileContent} = operator',
|
|
11
|
+
writeFileContent: 'const {writeFileContent} = operator',
|
|
12
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const filesystem = require('./filesystem');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
...filesystem,
|
|
7
|
+
operator: `import {operator} from 'putout'`,
|
|
8
|
+
compare: 'const {compare} = operator',
|
|
9
|
+
compareAll: 'const {compareAll} = operator',
|
|
10
|
+
compareAny: 'const {compareAny} = operator',
|
|
11
|
+
compute: 'const {compute} = operator',
|
|
12
|
+
contains: 'const {contains} = operator',
|
|
13
|
+
declare: 'const {declare} = operator',
|
|
14
|
+
rename: 'const {rename} = operator',
|
|
15
|
+
renameProperty: 'const {renameProperty} = operator',
|
|
16
|
+
extract: 'const {extract} = operator',
|
|
17
|
+
getPathAfterImports: 'const {getPathAfterImports} = operator',
|
|
18
|
+
getBinding: 'const {getBinding} = operator',
|
|
19
|
+
getBindingPath: 'const {getBindingPath} = operator',
|
|
20
|
+
traverse: 'const {traverse} = operator',
|
|
21
|
+
isSimpleRegExp: 'const {isSimpleRegExp} = operator',
|
|
22
|
+
getTemplateValues: 'const {getTemplateValues} = operator',
|
|
23
|
+
addArgs: 'const {addArgs} = operator',
|
|
24
|
+
insertBefore: 'const {insertBefore} = operator',
|
|
25
|
+
insertAfter: 'const {insertAfter} = operator',
|
|
26
|
+
replaceWith: 'const {replaceWith} = operator',
|
|
27
|
+
replaceWithMultiple: 'const {replaceWithMultiple} = operator',
|
|
28
|
+
remove: 'const {remove} = operator',
|
|
29
|
+
isESM: 'const {isESM} = operator',
|
|
30
|
+
getProperty: 'const {getProperty} = operator',
|
|
31
|
+
getProperties: 'const {getProperties} = operator',
|
|
32
|
+
traverseProperties: 'const {traverseProperties} = operator',
|
|
33
|
+
isSimple: 'const {isSimple} = operator',
|
|
34
|
+
setLiteralValue: 'const {setLiteralValue} = operator',
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.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": "^3.0.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"putout": ">=
|
|
51
|
+
"putout": ">=33"
|
|
52
52
|
},
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"engines": {
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"operator": "import {operator} from 'putout'",
|
|
3
|
-
"compare": "const {compare} = operator",
|
|
4
|
-
"compareAll": "const {compareAll} = operator",
|
|
5
|
-
"compareAny": "const {compareAny} = operator",
|
|
6
|
-
"compute": "const {compute} = operator",
|
|
7
|
-
"contains": "const {contains} = operator",
|
|
8
|
-
"declare": "const {declare} = operator",
|
|
9
|
-
"rename": "const {rename} = operator",
|
|
10
|
-
"renameProperty": "const {renameProperty} = operator",
|
|
11
|
-
"extract": "const {extract} = operator",
|
|
12
|
-
"getPathAfterImports": "const {getPathAfterImports} = operator",
|
|
13
|
-
"getBinding": "const {getBinding} = operator",
|
|
14
|
-
"getBindingPath": "const {getBindingPath} = operator",
|
|
15
|
-
"traverse": "const {traverse} = operator",
|
|
16
|
-
"isSimpleRegExp": "const {isSimpleRegExp} = operator",
|
|
17
|
-
"getTemplateValues": "const {getTemplateValues} = operator",
|
|
18
|
-
"addArgs": "const {addArgs} = operator",
|
|
19
|
-
"insertBefore": "const {insertBefore} = operator",
|
|
20
|
-
"insertAfter": "const {insertAfter} = operator",
|
|
21
|
-
"replaceWith": "const {replaceWith} = operator",
|
|
22
|
-
"replaceWithMultiple": "const {replaceWithMultiple} = operator",
|
|
23
|
-
"remove": "const {remove} = operator",
|
|
24
|
-
"isESM": "const {isESM} = operator",
|
|
25
|
-
"getProperty": "const {getProperty} = operator",
|
|
26
|
-
"getProperties": "const {getProperties} = operator",
|
|
27
|
-
"traverseProperties": "const {traverseProperties} = operator",
|
|
28
|
-
"isSimple": "const {isSimple} = operator",
|
|
29
|
-
"setLiteralValue": "const {setLiteralValue} = operator",
|
|
30
|
-
"findFile": "const {findFile} = operator",
|
|
31
|
-
"renameFile": "const {renameFile} = operator",
|
|
32
|
-
"removeFile": "const {removeFile} = operator",
|
|
33
|
-
"moveFile": "const {moveFile} = operator"
|
|
34
|
-
}
|