@putout/plugin-putout 29.17.0 → 29.19.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.
|
@@ -2,7 +2,7 @@ import {operator} from 'putout';
|
|
|
2
2
|
import regexpEscapePolifyll from 'regexp.escape';
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
|
-
escape
|
|
5
|
+
escape = regexpEscapePolifyll,
|
|
6
6
|
} = RegExp;
|
|
7
7
|
|
|
8
8
|
const {
|
|
@@ -89,7 +89,7 @@ const check = ({__a}, path) => {
|
|
|
89
89
|
if (name.includes(')'))
|
|
90
90
|
return false;
|
|
91
91
|
|
|
92
|
-
const safeName =
|
|
92
|
+
const safeName = escape(name);
|
|
93
93
|
|
|
94
94
|
const regEnd = RegExp(`: ${safeName}$`);
|
|
95
95
|
const regMiddle = RegExp(`: ${safeName}: .*`);
|
|
@@ -68,7 +68,10 @@ export const replace = () => ({
|
|
|
68
68
|
const name = toKebabCase(value.name);
|
|
69
69
|
|
|
70
70
|
path.node.arguments[1] = arrayExpression([
|
|
71
|
-
arrayExpression([
|
|
71
|
+
arrayExpression([
|
|
72
|
+
stringLiteral(name),
|
|
73
|
+
value,
|
|
74
|
+
]),
|
|
72
75
|
]);
|
|
73
76
|
|
|
74
77
|
return path;
|
|
@@ -75,7 +75,9 @@ export const fix = (path, {options}) => {
|
|
|
75
75
|
if (path.parentPath.parentPath.isTSModuleBlock()) {
|
|
76
76
|
const key = identifier(getVar());
|
|
77
77
|
|
|
78
|
-
replaceWith(path, variableDeclaration('var', [
|
|
78
|
+
replaceWith(path, variableDeclaration('var', [
|
|
79
|
+
variableDeclarator(key),
|
|
80
|
+
]));
|
|
79
81
|
|
|
80
82
|
return;
|
|
81
83
|
}
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
compute,
|
|
15
15
|
__json,
|
|
16
16
|
__yaml,
|
|
17
|
+
__toml,
|
|
17
18
|
} = operator;
|
|
18
19
|
|
|
19
20
|
const name = '__putout_plugin_check_replace_code';
|
|
@@ -160,6 +161,9 @@ function parseKey(propertyPath) {
|
|
|
160
161
|
if (keyPath.isIdentifier({name: '__yaml'}))
|
|
161
162
|
return [null, __yaml];
|
|
162
163
|
|
|
164
|
+
if (keyPath.isIdentifier({name: '__toml'}))
|
|
165
|
+
return [null, __toml];
|
|
166
|
+
|
|
163
167
|
const [isComputed, key] = compute(keyPath);
|
|
164
168
|
|
|
165
169
|
if (!isComputed)
|
package/package.json
CHANGED