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 CHANGED
@@ -1,3 +1,13 @@
1
+ 2023.05.07, v3.2.3
2
+
3
+ fix:
4
+ - f0e959e escover: add montag
5
+
6
+ 2023.05.05, v3.2.2
7
+
8
+ feature:
9
+ - 1123033 escover: improve node v20 support
10
+
1
11
  2023.05.05, v3.2.1
2
12
 
3
13
  feature:
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-v16.x/docs/api/esm.html#loaders).
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
@@ -58,7 +58,7 @@ function execute(cmd, exit) {
58
58
  env: {
59
59
  ZENLOAD: 'escover,mock-import',
60
60
  ...process.env,
61
- NODE_OPTIONS: `--no-warnings --loader zenload ${NODE_OPTIONS} `,
61
+ NODE_OPTIONS: `--no-warnings --loader zenload ${NODE_OPTIONS}`,
62
62
  },
63
63
  });
64
64
 
@@ -1,7 +1,6 @@
1
1
  import {readFileSync} from 'fs';
2
2
 
3
3
  const {parse} = JSON;
4
-
5
4
  const packageJson = new URL('../../package.json', import.meta.url);
6
5
 
7
6
  export const version = () => {
package/lib/escover.js CHANGED
@@ -25,11 +25,47 @@ const EXCLUDE = [
25
25
  ];
26
26
 
27
27
  export function globalPreload({port}) {
28
- port.onmessage = createFileEntry;
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 = port.postMessage.bind(port);
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
  `;
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
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",