escover 3.0.0 → 3.1.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 +10 -0
- package/lib/escover.js +1 -1
- package/lib/instrument/index.js +7 -10
- package/lib/instrument/plugin-mark/index.js +5 -2
- package/package.json +3 -1
package/ChangeLog
CHANGED
package/lib/escover.js
CHANGED
package/lib/instrument/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {parse} from '@babel/parser';
|
|
3
|
-
import {print} from '@putout/printer';
|
|
1
|
+
import putout from 'putout';
|
|
4
2
|
import * as mark from './plugin-mark/index.js';
|
|
3
|
+
import convertOptionalToLogical from '@putout/plugin-convert-optional-to-logical';
|
|
5
4
|
|
|
6
5
|
export const instrument = (url, source) => {
|
|
7
6
|
const c4 = global.__createC4(url);
|
|
8
7
|
|
|
9
|
-
const
|
|
8
|
+
const {code} = putout(source, {
|
|
9
|
+
printer: 'putout',
|
|
10
10
|
fixCount: 1,
|
|
11
11
|
rules: {
|
|
12
12
|
mark: ['on', {
|
|
@@ -15,13 +15,10 @@ export const instrument = (url, source) => {
|
|
|
15
15
|
},
|
|
16
16
|
plugins: [
|
|
17
17
|
['mark', mark],
|
|
18
|
+
['convert-optional-to-logical', convertOptionalToLogical],
|
|
18
19
|
],
|
|
19
|
-
};
|
|
20
|
+
});
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
transform(ast, source, options);
|
|
24
|
-
|
|
25
|
-
return print(ast);
|
|
22
|
+
return code;
|
|
26
23
|
};
|
|
27
24
|
|
|
@@ -28,7 +28,6 @@ const buildLineNode = template(LINE, {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
function getLineNode(c4, {line, column}) {
|
|
31
|
-
debugger;
|
|
32
31
|
c4.init(line, column);
|
|
33
32
|
|
|
34
33
|
return buildLineNode({
|
|
@@ -39,9 +38,13 @@ function getLineNode(c4, {line, column}) {
|
|
|
39
38
|
|
|
40
39
|
export const report = () => 'Mark line';
|
|
41
40
|
|
|
41
|
+
const isLoc = (path) => path.node.loc;
|
|
42
|
+
|
|
43
|
+
const findLoc = (path) => path.find(isLoc).node.loc;
|
|
44
|
+
|
|
42
45
|
export const fix = (path, {options}) => {
|
|
43
46
|
const {node} = path;
|
|
44
|
-
const {start} = path
|
|
47
|
+
const {start} = findLoc(path);
|
|
45
48
|
|
|
46
49
|
const {
|
|
47
50
|
c4 = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "Coverage for EcmaScript Modules",
|
|
6
6
|
"main": "lib/escover.js",
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/parser": "^7.21.8",
|
|
43
|
+
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
44
|
+
"@putout/plugin-convert-optional-to-logical": "^1.0.0",
|
|
43
45
|
"@putout/printer": "^1.80.3",
|
|
44
46
|
"chalk": "^5.0.0",
|
|
45
47
|
"find-cache-dir": "^4.0.0",
|