escover 1.14.0 → 1.17.1
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/ChangeLog +24 -0
- package/lib/formatters/lines.js +2 -1
- package/lib/instrument/plugin-mark/index.js +28 -16
- package/lib/transform.js +1 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
2022.01.27, v1.17.1
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- escover: transform: mergeLines: & -> &&
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
2022.01.27, v1.17.0
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- escover: improve ternary support: Identifier
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
2022.01.27, v1.16.0
|
|
14
|
+
|
|
15
|
+
feature:
|
|
16
|
+
- escover: add support of ternary
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
2022.01.26, v1.15.0
|
|
20
|
+
|
|
21
|
+
fix:
|
|
22
|
+
- escover: logical: find up
|
|
23
|
+
|
|
24
|
+
|
|
1
25
|
2022.01.21, v1.14.0
|
|
2
26
|
|
|
3
27
|
feature:
|
package/lib/formatters/lines.js
CHANGED
|
@@ -53,7 +53,7 @@ export const fix = (path, {options}) => {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
if (path.
|
|
56
|
+
if (path.isIdentifier()) {
|
|
57
57
|
const {node} = path;
|
|
58
58
|
|
|
59
59
|
replaceWith(path, SequenceExpression([
|
|
@@ -63,18 +63,22 @@ export const fix = (path, {options}) => {
|
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if (path.
|
|
67
|
-
|
|
66
|
+
if (path.isCallExpression() || path.isNewExpression()) {
|
|
67
|
+
const {node} = path;
|
|
68
|
+
|
|
69
|
+
replaceWith(path, SequenceExpression([
|
|
68
70
|
lineNode.expression,
|
|
69
|
-
|
|
70
|
-
]));
|
|
71
|
-
replaceWith(path.get('right'), SequenceExpression([
|
|
72
|
-
getLineNode(c4, path.node.right.loc.start).expression,
|
|
73
|
-
path.node.right,
|
|
71
|
+
node,
|
|
74
72
|
]));
|
|
75
73
|
return;
|
|
76
74
|
}
|
|
77
75
|
|
|
76
|
+
if (path.parentPath.isLogicalExpression())
|
|
77
|
+
return replaceWith(path, SequenceExpression([
|
|
78
|
+
lineNode.expression,
|
|
79
|
+
path.node,
|
|
80
|
+
]));
|
|
81
|
+
|
|
78
82
|
if (path.isAssignmentPattern() || path.isAssignmentExpression()) {
|
|
79
83
|
replaceWith(path.get('right'), SequenceExpression([
|
|
80
84
|
lineNode.expression,
|
|
@@ -110,10 +114,13 @@ const EXCLUDE = [
|
|
|
110
114
|
|
|
111
115
|
const SEQUENCE = `(${LINE}, __z)`;
|
|
112
116
|
const isExclude = (node) => {
|
|
113
|
-
|
|
117
|
+
const templates = [
|
|
114
118
|
...EXCLUDE,
|
|
115
119
|
SEQUENCE,
|
|
116
|
-
]
|
|
120
|
+
];
|
|
121
|
+
return compareAny(node, templates, {
|
|
122
|
+
findUp: false,
|
|
123
|
+
});
|
|
117
124
|
};
|
|
118
125
|
|
|
119
126
|
export const exclude = () => EXCLUDE;
|
|
@@ -153,10 +160,14 @@ export const traverse = ({push}) => ({
|
|
|
153
160
|
push(path);
|
|
154
161
|
},
|
|
155
162
|
LogicalExpression(path) {
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
const leftPath = path.get('left');
|
|
164
|
+
const rightPath = path.get('right');
|
|
158
165
|
|
|
159
|
-
|
|
166
|
+
if (!isExclude(leftPath))
|
|
167
|
+
push(leftPath);
|
|
168
|
+
|
|
169
|
+
if (!isExclude(rightPath))
|
|
170
|
+
push(rightPath);
|
|
160
171
|
},
|
|
161
172
|
BlockStatement(path) {
|
|
162
173
|
if (path.node.body.length)
|
|
@@ -165,8 +176,9 @@ export const traverse = ({push}) => ({
|
|
|
165
176
|
push(path);
|
|
166
177
|
},
|
|
167
178
|
SequenceExpression(path) {
|
|
168
|
-
if (compare(path, `(${LINE}, __z)`))
|
|
179
|
+
if (compare(path, `(${LINE}, __z)`)) {
|
|
169
180
|
return;
|
|
181
|
+
}
|
|
170
182
|
|
|
171
183
|
const expressions = path.get('expressions');
|
|
172
184
|
|
|
@@ -177,7 +189,7 @@ export const traverse = ({push}) => ({
|
|
|
177
189
|
push(expPath);
|
|
178
190
|
}
|
|
179
191
|
},
|
|
180
|
-
IfStatement(path) {
|
|
192
|
+
'IfStatement|ConditionalExpression'(path) {
|
|
181
193
|
const consequentPath = path.get('consequent');
|
|
182
194
|
const alternatePath = path.get('alternate');
|
|
183
195
|
|
|
@@ -187,7 +199,7 @@ export const traverse = ({push}) => ({
|
|
|
187
199
|
if (!alternatePath.node)
|
|
188
200
|
return;
|
|
189
201
|
|
|
190
|
-
if (!alternatePath.isBlockStatement())
|
|
202
|
+
if (!alternatePath.isBlockStatement() && !isExclude(alternatePath))
|
|
191
203
|
push(alternatePath);
|
|
192
204
|
},
|
|
193
205
|
});
|
package/lib/transform.js
CHANGED