escover 3.8.1 → 4.0.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 CHANGED
@@ -1,3 +1,16 @@
1
+ 2023.12.10, v4.0.1
2
+
3
+ feature:
4
+ - 98fd927 escover: mock-import v4.0.0
5
+
6
+ 2023.12.10, v4.0.0
7
+
8
+ feature:
9
+ - c365383 convert to node v18 loaders
10
+ - cc25857 escover: drop support of node < 18
11
+ - 7cc297d escover: madrun v10.0.0
12
+ - 3513811 escover: putout v34.0.0
13
+
1
14
  2023.11.09, v3.8.1
2
15
 
3
16
  feature:
package/lib/cli/cli.js CHANGED
@@ -10,7 +10,7 @@ const noop = () => {};
10
10
 
11
11
  const {ESCOVER_FORMAT} = process.env;
12
12
 
13
- export const ESCOVER_NODE_OPTIONS = '--no-warnings --loader zenload';
13
+ export const ESCOVER_NODE_OPTIONS = '--no-warnings --import escover/register --import mock-import/register';
14
14
 
15
15
  export const cli = ({argv, exit, readCoverage}) => {
16
16
  const args = yargsParser(argv.slice(2), {
@@ -51,14 +51,6 @@ export const cli = ({argv, exit, readCoverage}) => {
51
51
  export const isSuccess = (error) => !error || error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
52
52
 
53
53
  export function createZenload() {
54
- /*
55
- if (!process.version.startsWith('v21'))
56
- return {
57
- ZENLOAD: 'escover/fresh,mock-import',
58
- }
59
-
60
- console.log('zzzzz');
61
- */
62
54
  return {
63
55
  ZENLOAD: 'escover,mock-import',
64
56
  }
package/lib/escover.js CHANGED
@@ -24,9 +24,6 @@ const EXCLUDE = [
24
24
  ];
25
25
 
26
26
  export function initialize({port}) {
27
- globalPreload({port});
28
- }
29
- export function globalPreload({port}) {
30
27
  port.onmessage = ({data}) => {
31
28
  const {
32
29
  type,
@@ -49,33 +46,6 @@ export function globalPreload({port}) {
49
46
 
50
47
  writeCoverage();
51
48
  };
52
-
53
- return `(${escover})();`;
54
- }
55
-
56
- function escover() {
57
- const loader = 'escover';
58
-
59
- global.__createC4 = (url) => ({
60
- '🧨': (line, column) => {
61
- port.postMessage({
62
- type: 'set',
63
- url,
64
- line,
65
- column,
66
- loader,
67
- });
68
- },
69
- 'init': (line, column) => {
70
- port.postMessage({
71
- type: 'init',
72
- url,
73
- line,
74
- column,
75
- loader,
76
- });
77
- },
78
- });
79
49
  }
80
50
 
81
51
  export async function load(url, context, defaultLoad) {
@@ -0,0 +1,40 @@
1
+ import {pathToFileURL} from 'node:url';
2
+ import { register } from 'node:module';
3
+ import { MessageChannel } from 'node:worker_threads';
4
+
5
+ const { port1, port2 } = new MessageChannel();
6
+
7
+ initialize({
8
+ port: port1
9
+ });
10
+
11
+ register('./escover.js', import.meta.url, {
12
+ parentURL: import.meta.url,
13
+ data: { port: port2 },
14
+ transferList: [port2],
15
+ });
16
+
17
+ function initialize({port}) {
18
+ const loader = 'escover';
19
+
20
+ global.__createC4 = (url) => ({
21
+ '🧨': (line, column) => {
22
+ port.postMessage({
23
+ type: 'set',
24
+ url,
25
+ line,
26
+ column,
27
+ loader,
28
+ });
29
+ },
30
+ 'init': (line, column) => {
31
+ port.postMessage({
32
+ type: 'init',
33
+ url,
34
+ line,
35
+ column,
36
+ loader,
37
+ });
38
+ },
39
+ });
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "3.8.1",
3
+ "version": "4.0.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",
@@ -17,6 +17,7 @@
17
17
  "import": "./lib/escover.js"
18
18
  },
19
19
  "./fresh": "./lib/fresh.js",
20
+ "./register": "./lib/register.js",
20
21
  "./plugin": "./lib/instrument/plugin-mark/index.js",
21
22
  "./instrument": "./lib/instrument/index.js"
22
23
  },
@@ -44,11 +45,11 @@
44
45
  "chalk": "^5.0.0",
45
46
  "find-cache-dir": "^5.0.0",
46
47
  "find-up": "^6.2.0",
47
- "mock-import": "^3.0.1",
48
+ "mock-import": "^4.0.0",
48
49
  "montag": "^1.2.1",
49
50
  "once": "^1.4.0",
50
51
  "picomatch": "^2.3.1",
51
- "putout": "^33.0.0",
52
+ "putout": "^34.0.0",
52
53
  "strip-ansi": "^7.0.1",
53
54
  "table": "^6.8.0",
54
55
  "try-catch": "^3.0.0",
@@ -56,7 +57,7 @@
56
57
  "zenload": "^2.0.0"
57
58
  },
58
59
  "engines": {
59
- "node": ">=16"
60
+ "node": ">=18"
60
61
  },
61
62
  "license": "MIT",
62
63
  "devDependencies": {
@@ -66,7 +67,7 @@
66
67
  "eslint": "^8.3.0",
67
68
  "eslint-plugin-n": "^16.0.0",
68
69
  "eslint-plugin-putout": "^21.0.2",
69
- "madrun": "^9.0.0",
70
+ "madrun": "^10.0.0",
70
71
  "supertape": "^8.0.1"
71
72
  }
72
73
  }