@putout/plugin-putout 11.13.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
@@ -406,7 +406,7 @@ module.exports.merge = (processedSource, list) => '';
406
406
  ## convert-method-to-property
407
407
 
408
408
  - property simpler to work with;
409
- - support of `convert-destructuring-to-identifier` which is `Replacer`, while `convert-method-to-property` is `Includer` (searches for `ObjectMethod` node);
409
+ - support of [`convert-destructuring-to-identifier`](#convert-destructuring-to-identifier) which is `Replacer`, while `convert-method-to-property` is `Includer` (searches for `ObjectMethod` node);
410
410
 
411
411
  ### ❌ Example of incorrect code
412
412
 
@@ -443,8 +443,8 @@ This is additional tests, if you forget to test some case (from a big list of ru
443
443
 
444
444
  ## declare
445
445
 
446
- Depend on [@putout/convert-esm-to-commonjs](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-esm-to-commonjs) and
447
- [@putout/declare-undefined-variables](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare-undefined-variables)
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](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',
@@ -33,7 +35,12 @@ module.exports = (rootPath, key) => {
33
35
  } = node;
34
36
 
35
37
  if (path.isStringLiteral() && /^__[a-z]$/.test(value)) {
36
- path.node.value = getVar(value);
38
+ path.node.value = getVar(name);
39
+ return;
40
+ }
41
+
42
+ if (/^__identifier__[a-z]$/.test(name)) {
43
+ path.node.name = getVar(name);
37
44
  return;
38
45
  }
39
46
 
@@ -5,8 +5,9 @@ const tryCatch = require('try-catch');
5
5
 
6
6
  const generateCode = require('./generate-code');
7
7
 
8
- const {operator} = putout;
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 = () => ({
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const {types} = require('putout');
4
-
5
4
  const {isCallExpression} = types;
6
5
 
7
6
  module.exports.report = ({correct, operatorPath}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "11.13.0",
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",
@@ -42,13 +42,13 @@
42
42
  "eslint": "^8.0.1",
43
43
  "eslint-plugin-n": "^15.2.4",
44
44
  "eslint-plugin-putout": "^16.0.0",
45
- "lerna": "^5.0.0",
45
+ "lerna": "^6.0.1",
46
46
  "madrun": "^9.0.0",
47
47
  "montag": "^1.2.1",
48
48
  "nodemon": "^2.0.1"
49
49
  },
50
50
  "peerDependencies": {
51
- "putout": ">=25"
51
+ "putout": ">=29"
52
52
  },
53
53
  "license": "MIT",
54
54
  "engines": {