monocart-code-viewer
Advanced tools
Comparing version 1.1.2 to 1.1.3
{ | ||
"name": "monocart-code-viewer", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Monocart Code Viewer", | ||
"main": "dist/monocart-code-viewer.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist/monocart-code-viewer.d.ts", | ||
"default": "./dist/monocart-code-viewer.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"types": "./dist/monocart-code-viewer.d.ts", | ||
"scripts": { | ||
@@ -24,3 +32,3 @@ "dev": "sf d", | ||
"@codemirror/lang-javascript": "^6.2.2", | ||
"@codemirror/view": "^6.24.1", | ||
"@codemirror/view": "^6.26.1", | ||
"@lezer/common": "^1.2.1", | ||
@@ -30,3 +38,3 @@ "@lezer/css": "^1.1.8", | ||
"@lezer/javascript": "^1.4.13", | ||
"@uiw/codemirror-theme-xcode": "^4.21.24", | ||
"@uiw/codemirror-theme-xcode": "^4.21.25", | ||
"codemirror": "^6.0.1", | ||
@@ -37,5 +45,5 @@ "eslint": "^8.57.0", | ||
"lz-utils": "^2.0.2", | ||
"stylelint": "^16.2.1", | ||
"stylelint": "^16.3.1", | ||
"stylelint-config-plus": "^1.1.0" | ||
} | ||
} |
# monocart-code-viewer | ||
[![](https://img.shields.io/npm/v/monocart-code-viewer)](https://www.npmjs.com/package/monocart-code-viewer) | ||
[![](https://badgen.net/npm/dw/monocart-code-viewer)](https://www.npmjs.com/package/monocart-code-viewer) | ||
![](https://img.shields.io/librariesio/github/cenfun/monocart-code-viewer) | ||
![](https://img.shields.io/github/license/cenfun/monocart-code-viewer) | ||
Code Viewer with Coverage View base on [CodeMirror](https://codemirror.net/) | ||
## Feature | ||
- Base on [CodeMirror](https://codemirror.net/) | ||
- Coverage View | ||
## Install | ||
```sh | ||
npm i monocart-code-viewer | ||
``` | ||
## Usage | ||
```js | ||
@@ -11,8 +23,39 @@ import { createCodeViewer } from 'monocart-code-viewer'; | ||
const report = { | ||
content: "", | ||
content: "your source content", | ||
coverage: { | ||
uncoveredLines: {}, | ||
uncoveredPieces: {}, | ||
executionCounts: {}, | ||
decorations: {} | ||
uncoveredLines: { | ||
'0': 'comment', | ||
'1': 'blank', | ||
'8': 'partial', | ||
'9': 'uncovered' | ||
}, | ||
uncoveredPieces: { | ||
'8': [ | ||
{ | ||
'start': 27, | ||
'end': 34 | ||
} | ||
] | ||
}, | ||
decorations: { | ||
'14': [ | ||
{ | ||
'column': 4, | ||
'value': 'E', | ||
'attrs': { | ||
'title': 'else path uncovered' | ||
} | ||
} | ||
] | ||
}, | ||
executionCounts: { | ||
'20': [ | ||
{ | ||
'column': 22, | ||
'count': 10, | ||
'value': '10', | ||
'end': 916 | ||
} | ||
] | ||
} | ||
} | ||
@@ -25,3 +68,9 @@ }; | ||
codeViewer = createCodeViewer($el, report); | ||
codeViewer.on('cursor', (loc) => { | ||
// console.log('cursor', loc); | ||
}); | ||
// codeViewer.setSelection(start, end, options); | ||
// codeViewer.setCursor(pos, options); | ||
} | ||
``` |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
474507
5
40
75
0