escover 3.2.1 โ 3.2.3
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/README.md +1 -1
- package/lib/cli/cli.js +1 -1
- package/lib/cli/version.js +0 -1
- package/lib/escover.js +39 -3
- package/lib/instrument/index.js +4 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[CoverageURL]: https://coveralls.io/github/coderaiser/escover?branch=master
|
|
10
10
|
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/escover/badge.svg?branch=master&service=github
|
|
11
11
|
|
|
12
|
-
Coverage for EcmaScript Modules based on ๐[**Putout**](https://github.com/coderaiser/putout) and [loaders](https://nodejs.org/dist/latest-
|
|
12
|
+
Coverage for EcmaScript Modules based on ๐[**Putout**](https://github.com/coderaiser/putout) and [loaders](https://nodejs.org/dist/latest-v20.x/docs/api/esm.html#loaders).
|
|
13
13
|
|
|
14
14
|
## Why another coverage tool?
|
|
15
15
|
|
package/lib/cli/cli.js
CHANGED
package/lib/cli/version.js
CHANGED
package/lib/escover.js
CHANGED
|
@@ -25,11 +25,47 @@ const EXCLUDE = [
|
|
|
25
25
|
];
|
|
26
26
|
|
|
27
27
|
export function globalPreload({port}) {
|
|
28
|
-
port.onmessage =
|
|
28
|
+
port.onmessage = ({data}) => {
|
|
29
|
+
const {
|
|
30
|
+
type,
|
|
31
|
+
url,
|
|
32
|
+
line,
|
|
33
|
+
column,
|
|
34
|
+
} = data;
|
|
35
|
+
|
|
36
|
+
const c4 = createFileEntry(url);
|
|
37
|
+
|
|
38
|
+
if (type === 'set')
|
|
39
|
+
return c4['๐งจ'](line, column);
|
|
40
|
+
|
|
41
|
+
if (type === 'init')
|
|
42
|
+
return c4.init(line, column);
|
|
43
|
+
};
|
|
44
|
+
|
|
29
45
|
return montag`
|
|
30
|
-
global.__createC4 =
|
|
46
|
+
global.__createC4 = (url) => {
|
|
47
|
+
return {
|
|
48
|
+
'๐งจ': (line, column) => {
|
|
49
|
+
port.postMessage({
|
|
50
|
+
type: 'set',
|
|
51
|
+
url,
|
|
52
|
+
line,
|
|
53
|
+
column,
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
'init': (line, column) => {
|
|
57
|
+
port.postMessage({
|
|
58
|
+
type: 'init',
|
|
59
|
+
url,
|
|
60
|
+
line,
|
|
61
|
+
column,
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
};
|
|
31
66
|
`;
|
|
32
67
|
}
|
|
68
|
+
|
|
33
69
|
export async function load(url, context, defaultLoad) {
|
|
34
70
|
const {
|
|
35
71
|
format,
|
|
@@ -59,7 +95,7 @@ export async function load(url, context, defaultLoad) {
|
|
|
59
95
|
source: rawSource,
|
|
60
96
|
};
|
|
61
97
|
|
|
62
|
-
const source = `
|
|
98
|
+
const source = montag`
|
|
63
99
|
const __c4 = global.__createC4('${url}');
|
|
64
100
|
${instrument(url, String(rawSource))}
|
|
65
101
|
`;
|
package/lib/instrument/index.js
CHANGED
|
@@ -2,9 +2,13 @@ import putout from 'putout';
|
|
|
2
2
|
import * as mark from './plugin-mark/index.js';
|
|
3
3
|
import convertOptionalToLogical from '@putout/plugin-convert-optional-to-logical';
|
|
4
4
|
|
|
5
|
+
const cut = (a) => a.replace('#!/usr/bin/env node', '');
|
|
6
|
+
|
|
5
7
|
export const instrument = (url, source) => {
|
|
6
8
|
const c4 = global.__createC4(url);
|
|
7
9
|
|
|
10
|
+
source = cut(source);
|
|
11
|
+
|
|
8
12
|
const {code} = putout(source, {
|
|
9
13
|
printer: 'putout',
|
|
10
14
|
fixCount: 1,
|