escover 3.3.2 → 3.5.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 CHANGED
@@ -1,3 +1,20 @@
1
+ 2023.07.31, v3.5.0
2
+
3
+ fix:
4
+ - 2411d57 escover
5
+ - 830082d escover: exit
6
+
7
+ feature:
8
+ - b6b1301 package: @putout/test v7.0.1
9
+ - e9502cc package: c8 v8.0.1
10
+ - 882431a package: eslint-plugin-putout v18.2.0
11
+ - eb15154 package: putout v30.7.0
12
+
13
+ 2023.06.08, v3.4.0
14
+
15
+ feature:
16
+ - 2a602d2 escover: expression
17
+
1
18
  2023.06.08, v3.3.2
2
19
 
3
20
  fix:
package/lib/cli/cli.js CHANGED
@@ -11,12 +11,8 @@ export const ESCOVER_NODE_OPTIONS = '--no-warnings --loader zenload';
11
11
 
12
12
  export const cli = ({argv, exit, readCoverage}) => {
13
13
  const args = yargsParser(argv.slice(2), {
14
- string: [
15
- 'format',
16
- ],
17
- boolean: [
18
- 'version',
19
- ],
14
+ string: ['format'],
15
+ boolean: ['version'],
20
16
  alias: {
21
17
  v: 'version',
22
18
  f: 'format',
@@ -9,4 +9,3 @@ export const version = () => {
9
9
 
10
10
  return version;
11
11
  };
12
-
package/lib/config.js CHANGED
@@ -42,4 +42,3 @@ export const readConfig = () => {
42
42
  ...parse(data),
43
43
  };
44
44
  };
45
-
@@ -38,4 +38,3 @@ export const readCoverage = () => {
38
38
 
39
39
  return parseLcov(data);
40
40
  };
41
-
@@ -51,4 +51,3 @@ export const parseLcov = (lcov) => {
51
51
 
52
52
  return files;
53
53
  };
54
-
package/lib/escover.js CHANGED
@@ -8,12 +8,12 @@ import {
8
8
  isExclude,
9
9
  } from './config.js';
10
10
 
11
- !global.__createC4 && process.once('exit', exit);
11
+ process.once('exit', exit);
12
12
 
13
13
  global.__createC4 = createFileEntry;
14
14
 
15
+ const port = {};
15
16
  const CWD = process.cwd();
16
-
17
17
  const {exclude} = readConfig();
18
18
 
19
19
  const EXCLUDE = [
@@ -38,6 +38,9 @@ export function globalPreload({port}) {
38
38
  if (loader !== 'escover')
39
39
  return;
40
40
 
41
+ if (type === 'exit')
42
+ return exit();
43
+
41
44
  const c4 = createFileEntry(url);
42
45
 
43
46
  if (type === 'set')
@@ -53,6 +56,13 @@ export function globalPreload({port}) {
53
56
  function escover() {
54
57
  const loader = 'escover';
55
58
 
59
+ process.on('exit', () => {
60
+ port.postMessage({
61
+ type: 'exit',
62
+ loader: 'escover',
63
+ });
64
+ });
65
+
56
66
  global.__createC4 = (url) => ({
57
67
  '🧨': (line, column) => {
58
68
  port.postMessage({
@@ -76,10 +86,7 @@ function escover() {
76
86
  }
77
87
 
78
88
  export async function load(url, context, defaultLoad) {
79
- const {
80
- format,
81
- source: rawSource,
82
- } = await defaultLoad(url, context, defaultLoad);
89
+ const {format, source: rawSource} = await defaultLoad(url, context, defaultLoad);
83
90
 
84
91
  if (/commonjs|builtin/.test(format))
85
92
  return {
package/lib/exclude.js CHANGED
@@ -6,4 +6,3 @@ export const exclude = (url, names) => {
6
6
 
7
7
  return false;
8
8
  };
9
-
package/lib/exit.js CHANGED
@@ -4,4 +4,3 @@ import {writeCoverage} from './coverage-file/coverage-file.js';
4
4
  export const exit = once(() => {
5
5
  writeCoverage();
6
6
  });
7
-
@@ -6,10 +6,7 @@ import chalk from 'chalk';
6
6
 
7
7
  const CWD = process.cwd();
8
8
 
9
- const {
10
- entries,
11
- keys,
12
- } = Object;
9
+ const {entries, keys} = Object;
13
10
 
14
11
  export default (coverageFile) => {
15
12
  const files = parseCoverageFile(coverageFile);
@@ -25,4 +25,3 @@ export const instrument = (url, source) => {
25
25
 
26
26
  return code;
27
27
  };
28
-
@@ -4,16 +4,14 @@ const {SequenceExpression} = types;
4
4
 
5
5
  export const addMarkToArgument = (path, lineNode) => {
6
6
  const {node} = path;
7
- const {expression} = lineNode;
8
7
 
9
8
  if (!node.argument) {
10
- node.argument = expression;
9
+ node.argument = lineNode;
11
10
  return;
12
11
  }
13
12
 
14
13
  node.argument = SequenceExpression([
15
- expression,
14
+ lineNode,
16
15
  node.argument,
17
16
  ]);
18
17
  };
19
-
@@ -4,11 +4,9 @@ const {SequenceExpression} = types;
4
4
 
5
5
  export const addMarkToArrowFunction = (path, lineNode) => {
6
6
  const {node} = path;
7
- const {expression} = lineNode;
8
7
 
9
8
  node.body = SequenceExpression([
10
- expression,
9
+ lineNode,
11
10
  node.body,
12
11
  ]);
13
12
  };
14
-
@@ -78,23 +78,20 @@ export const fix = (path, {options}) => {
78
78
  if (path.isCallExpression() || path.isNewExpression()) {
79
79
  const {node} = path;
80
80
 
81
- replaceWith(path, SequenceExpression([
82
- lineNode.expression,
83
- node,
84
- ]));
81
+ replaceWith(path, SequenceExpression([lineNode, node]));
85
82
 
86
83
  return;
87
84
  }
88
85
 
89
86
  if (path.parentPath.isLogicalExpression())
90
87
  return replaceWith(path, SequenceExpression([
91
- lineNode.expression,
88
+ lineNode,
92
89
  path.node,
93
90
  ]));
94
91
 
95
92
  if (path.isAssignmentPattern() || path.isAssignmentExpression()) {
96
93
  replaceWith(path.get('right'), SequenceExpression([
97
- lineNode.expression,
94
+ lineNode,
98
95
  node.right,
99
96
  ]));
100
97
  return;
@@ -116,10 +113,7 @@ export const fix = (path, {options}) => {
116
113
  if (path.isExpression()) {
117
114
  const {node} = path;
118
115
 
119
- replaceWith(path, SequenceExpression([
120
- lineNode.expression,
121
- node,
122
- ]));
116
+ replaceWith(path, SequenceExpression([lineNode, node]));
123
117
 
124
118
  return;
125
119
  }
@@ -237,4 +231,3 @@ export const traverse = ({push}) => ({
237
231
  }
238
232
  },
239
233
  });
240
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "3.3.2",
3
+ "version": "3.5.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",
@@ -40,7 +40,6 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@putout/plugin-convert-optional-to-logical": "^1.0.0",
43
- "@putout/printer": "^1.80.3",
44
43
  "chalk": "^5.0.0",
45
44
  "find-cache-dir": "^4.0.0",
46
45
  "find-up": "^6.2.0",
@@ -48,7 +47,7 @@
48
47
  "montag": "^1.2.1",
49
48
  "once": "^1.4.0",
50
49
  "picomatch": "^2.3.1",
51
- "putout": "^29.0.0",
50
+ "putout": "^30.7.0",
52
51
  "strip-ansi": "^7.0.1",
53
52
  "table": "^6.8.0",
54
53
  "try-catch": "^3.0.0",
@@ -60,12 +59,12 @@
60
59
  },
61
60
  "license": "MIT",
62
61
  "devDependencies": {
63
- "@putout/test": "^6.4.0",
64
- "c8": "^7.8.0",
62
+ "@putout/test": "^7.0.1",
63
+ "c8": "^8.0.1",
65
64
  "escover": "^3.2.0",
66
65
  "eslint": "^8.3.0",
67
66
  "eslint-plugin-n": "^16.0.0",
68
- "eslint-plugin-putout": "^17.5.1",
67
+ "eslint-plugin-putout": "^18.2.0",
69
68
  "madrun": "^9.0.0",
70
69
  "supertape": "^8.0.1"
71
70
  }