monocart-coverage-reports 2.1.0 → 2.2.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.
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const { fileURLToPath } = require('url');
2
3
  const Util = require('./util.js');
3
4
 
4
5
  const resolveUrl = (input) => {
@@ -38,23 +39,27 @@ const getSourcePath = (url, index = '', type = '') => {
38
39
  url = ['file://anonymous', index ? `-${index}` : '', type ? `.${type}` : ''].join('');
39
40
  }
40
41
 
41
- const u = resolveUrl(url);
42
- if (u) {
43
- const host = [u.hostname, u.port].filter((it) => it).join('-');
42
+ if (url.startsWith('file:')) {
43
+ const relPath = Util.relativePath(fileURLToPath(url));
44
+ return filterPath(relPath);
45
+ }
46
+
47
+ const urlObj = resolveUrl(url);
48
+ if (urlObj) {
49
+ const host = [urlObj.hostname, urlObj.port].filter((it) => it).join('-');
44
50
  // always start with '/'
45
- const pathname = u.pathname;
51
+ const pathname = urlObj.pathname;
46
52
 
47
53
  let p = host + pathname;
48
54
  // webpack://monocart-v8/packages/v8/src/app.vue?5cc4
49
- if (u.search) {
50
- p += `/${u.search}`;
55
+ if (urlObj.search) {
56
+ p += `/${urlObj.search}`;
51
57
  }
52
58
 
53
59
  return filterPath(p);
54
60
  }
55
61
 
56
- const relPath = Util.relativePath(url);
57
- return filterPath(relPath);
62
+ return filterPath(url);
58
63
  };
59
64
 
60
65
  const getSourceType = (sourcePath) => {
package/lib/v8/v8.js CHANGED
@@ -55,7 +55,13 @@ const initV8ListAndSourcemap = async (v8list, options) => {
55
55
  data.source = item.text;
56
56
  }
57
57
 
58
- data.id = Util.calculateSha1(data.url + data.source);
58
+ const idList = [];
59
+ // could be existed
60
+ const distFile = item.distFile;
61
+ if (distFile) {
62
+ data.distFile = distFile;
63
+ idList.push(distFile);
64
+ }
59
65
 
60
66
  let sourcePath = getSourcePath(data.url, i + 1, data.type);
61
67
  if (typeof sourcePathHandler === 'function') {
@@ -67,6 +73,11 @@ const initV8ListAndSourcemap = async (v8list, options) => {
67
73
 
68
74
  data.sourcePath = sourcePath;
69
75
 
76
+ idList.push(sourcePath);
77
+ idList.push(data.source);
78
+
79
+ data.id = Util.calculateSha1(idList.join(''));
80
+
70
81
  return data;
71
82
  });
72
83
 
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "monocart-coverage-reports",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Monocart coverage reports",
5
- "main": "lib/index.js",
5
+ "main": "./lib/index.js",
6
+ "bin": {
7
+ "mcr": "./lib/cli.js"
8
+ },
6
9
  "exports": {
7
10
  ".": {
8
11
  "types": "./lib/index.d.ts",
@@ -17,14 +20,16 @@
17
20
  "build-docs": "node ./scripts/build-docs.js",
18
21
  "build-test": "node ./scripts/build-test.js",
19
22
  "build": "sf lint && sf b -p && npm run build-test",
20
- "test-node": "npm run test-node-env && npm run test-node-api && npm run test-node-ins && npm run test-node-cdp",
23
+ "test-node": "npm run test-node-env && npm run test-node-api && npm run test-node-ins && npm run test-node-cdp && npm run test-node-koa",
21
24
  "test-node-env": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-env node ./test/test-node-env.js && node ./test/generate-node-report.js",
22
25
  "test-node-api": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-api node ./test/test-node-api.js",
23
26
  "test-node-fgc": "node ./test/test-node-fgc.js",
24
27
  "test-node-ins": "node ./test/test-node-ins.js",
25
28
  "test-node-cdp": "node --inspect=9229 ./test/test-node-cdp.js",
29
+ "test-node-koa": "node ./test/test-node-koa.js",
26
30
  "test-browser": "node ./test/test.js",
27
- "test": "npm run test-browser && npm run test-node && npm run build-docs",
31
+ "test-cli": "npx mcr \"node ./test/test-node-env.js\" -o docs/cli -r v8,console-summary --lcov -c test/cli-options.js",
32
+ "test": "npm run test-browser && npm run test-node && npm run test-cli && npm run build-docs",
28
33
  "dev": "sf d v8",
29
34
  "open": "node ./scripts/open.js",
30
35
  "patch": "npm run build && sf publish patch -r"
@@ -50,13 +55,14 @@
50
55
  "lz-utils": "~2.0.2",
51
56
  "monocart-code-viewer": "~1.0.13",
52
57
  "monocart-formatter": "~2.3.0",
53
- "turbogrid": "~3.0.12"
58
+ "turbogrid": "^3.0.13"
54
59
  },
55
60
  "devDependencies": {
61
+ "commander": "^11.1.0",
56
62
  "eslint": "^8.56.0",
57
63
  "eslint-config-plus": "^1.0.6",
58
64
  "eslint-plugin-html": "^7.1.0",
59
- "eslint-plugin-vue": "^9.20.0",
65
+ "eslint-plugin-vue": "^9.20.1",
60
66
  "stylelint": "^15.11.0",
61
67
  "stylelint-config-plus": "^1.0.4"
62
68
  }