-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/canyon-project/canyon
- Loading branch information
Showing
15 changed files
with
233 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from './coverage'; | ||
// export * from './coverage'; | ||
export * from './summary'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "canyon-data2", | ||
"version": "1.0.0", | ||
"description": "", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "rslib build", | ||
"preinstall": "rslib build" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@rslib/core": "^0.0.18", | ||
"@types/istanbul-lib-coverage": "^2.0.6", | ||
"@types/istanbul-lib-source-maps": "^4.0.4" | ||
}, | ||
"dependencies": { | ||
"istanbul-lib-coverage": "^3.2.2", | ||
"istanbul-lib-source-maps": "^5.0.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
lib: [ | ||
{ | ||
format: 'esm', | ||
syntax: 'es2021', | ||
dts: true, | ||
}, | ||
{ | ||
format: 'cjs', | ||
syntax: 'es2021', | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import libCoverage from "istanbul-lib-coverage"; | ||
import libSourceMaps from "istanbul-lib-source-maps"; | ||
// 覆盖率回溯,在覆盖率存储之前转换 | ||
export async function remapCoverage(obj: any) { | ||
const res = await libSourceMaps | ||
.createSourceMapStore() | ||
.transformCoverage(libCoverage.createCoverageMap(obj)); | ||
const { data: data_1 } = res; | ||
const obj_1: any = {}; | ||
for (const dataKey in data_1) { | ||
// @ts-ignore | ||
const x = data_1[dataKey]["data"]; | ||
obj_1[x.path] = x; | ||
} | ||
return obj_1; | ||
} | ||
|
||
export const reorganizeCompleteCoverageObjects = ( | ||
map: { | ||
[key: string]: object; | ||
}, | ||
hit: { | ||
[key: string]: object; | ||
}, | ||
) => { | ||
// istanbul数据结构 | ||
const obj = {}; | ||
for (const objKey in hit) { | ||
const item = hit[objKey]; | ||
const mapItem = map[objKey]; | ||
// @ts-ignore | ||
obj[objKey] = { | ||
...mapItem, | ||
// 一定要在下面!!! | ||
...item, | ||
path: objKey, | ||
}; | ||
} | ||
return obj; | ||
// return {}; | ||
}; | ||
|
||
// 回溯未经过reMapCoverage的数据,但是必须得传入插装路径,因为这里的noReMap是没有插装路径的 | ||
export const remapCoverageWithInstrumentCwd = async (noReMap:any, inser:string) => { | ||
// 如果来自的插桩路径不同,要预处理!!! | ||
const obj = {}; | ||
for (const key in noReMap) { | ||
const newKey = inser + "/" + key; | ||
const item = noReMap[key]; | ||
// @ts-ignore | ||
obj[newKey] = { | ||
...item, | ||
path: newKey, | ||
}; | ||
} | ||
|
||
const reMapedCov = await remapCoverage(obj); | ||
|
||
const obj222: any = {}; | ||
for (const coverageKey in reMapedCov) { | ||
const newKey = coverageKey.replace(inser + "/", ""); | ||
obj222[newKey] = { | ||
...reMapedCov[coverageKey], | ||
path: newKey, | ||
}; | ||
} | ||
|
||
// 再把inser去掉 | ||
return obj222; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './coverage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["ES2021"], | ||
"module": "ESNext", | ||
"noEmit": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"isolatedModules": true, | ||
"resolveJsonModule": true, | ||
"moduleResolution": "bundler", | ||
"useDefineForClassFields": true, | ||
"allowImportingTsExtensions": true | ||
}, | ||
"include": ["src"] | ||
} |
Oops, something went wrong.