escover 2.5.3 → 3.1.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/ChangeLog +11 -0
- package/lib/cli/cli.js +1 -1
- package/lib/instrument/index.js +6 -7
- package/lib/instrument/plugin-mark/index.js +5 -1
- package/lib/transform.js +1 -0
- package/package.json +5 -1
package/ChangeLog
CHANGED
package/lib/cli/cli.js
CHANGED
package/lib/instrument/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
transform,
|
|
5
|
-
} from 'putout';
|
|
1
|
+
import {transform} from 'putout';
|
|
2
|
+
import {parse} from '@babel/parser';
|
|
3
|
+
import {print} from '@putout/printer';
|
|
6
4
|
import * as mark from './plugin-mark/index.js';
|
|
5
|
+
import convertOptionalToLogical from '@putout/plugin-convert-optional-to-logical';
|
|
7
6
|
|
|
8
7
|
export const instrument = (url, source) => {
|
|
9
8
|
const c4 = global.__createC4(url);
|
|
@@ -17,14 +16,14 @@ export const instrument = (url, source) => {
|
|
|
17
16
|
},
|
|
18
17
|
plugins: [
|
|
19
18
|
['mark', mark],
|
|
19
|
+
['convert-optional-to-logical', convertOptionalToLogical],
|
|
20
20
|
],
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const ast = parse(source);
|
|
24
24
|
|
|
25
25
|
transform(ast, source, options);
|
|
26
|
-
const {code} = generate(ast);
|
|
27
26
|
|
|
28
|
-
return
|
|
27
|
+
return print(ast);
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -38,9 +38,13 @@ function getLineNode(c4, {line, column}) {
|
|
|
38
38
|
|
|
39
39
|
export const report = () => 'Mark line';
|
|
40
40
|
|
|
41
|
+
const isLoc = (path) => path.node.loc;
|
|
42
|
+
|
|
43
|
+
const findLoc = (path) => path.find(isLoc).node.loc;
|
|
44
|
+
|
|
41
45
|
export const fix = (path, {options}) => {
|
|
42
46
|
const {node} = path;
|
|
43
|
-
const {start} = path
|
|
47
|
+
const {start} = findLoc(path);
|
|
44
48
|
|
|
45
49
|
const {
|
|
46
50
|
c4 = {
|
package/lib/transform.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
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",
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
"prewisdom": "madrun prewisdom"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
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",
|
|
45
|
+
"@putout/printer": "^1.80.3",
|
|
42
46
|
"chalk": "^5.0.0",
|
|
43
47
|
"find-cache-dir": "^4.0.0",
|
|
44
48
|
"find-up": "^6.2.0",
|