@containerbase/istanbul-reports-html 1.0.4 → 1.1.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/package.json +5 -8
- package/vendor/hljs.js +106 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@containerbase/istanbul-reports-html",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"coverage",
|
|
6
6
|
"highlight",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@containerbase/eslint-plugin": "1.1.6",
|
|
33
|
+
"@containerbase/semantic-release-pnpm": "1.1.0",
|
|
33
34
|
"@eslint/js": "9.35.0",
|
|
34
|
-
"@semantic-release/exec": "7.1.0",
|
|
35
35
|
"@tsconfig/node20": "20.1.6",
|
|
36
36
|
"@tsconfig/strictest": "2.0.5",
|
|
37
37
|
"@types/eslint-config-prettier": "6.11.3",
|
|
38
38
|
"@types/istanbul-lib-report": "3.0.3",
|
|
39
|
-
"@types/node": "22.18.
|
|
40
|
-
"@vitest/eslint-plugin": "1.3.
|
|
39
|
+
"@types/node": "22.18.4",
|
|
40
|
+
"@vitest/eslint-plugin": "1.3.10",
|
|
41
41
|
"conventional-changelog-conventionalcommits": "9.1.0",
|
|
42
42
|
"esbuild": "0.25.9",
|
|
43
43
|
"eslint": "9.35.0",
|
|
@@ -56,15 +56,12 @@
|
|
|
56
56
|
"prettier-plugin-packagejson": "2.5.19",
|
|
57
57
|
"semantic-release": "24.2.8",
|
|
58
58
|
"typescript": "5.9.2",
|
|
59
|
-
"typescript-eslint": "8.
|
|
59
|
+
"typescript-eslint": "8.44.0"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": "^20.9.0 || ^22.11.0",
|
|
63
63
|
"pnpm": "^10.0.0"
|
|
64
64
|
},
|
|
65
|
-
"publishConfig": {
|
|
66
|
-
"access": "public"
|
|
67
|
-
},
|
|
68
65
|
"scripts": {
|
|
69
66
|
"eslint": "eslint --cache .",
|
|
70
67
|
"eslint-fix": "eslint --cache --fix .",
|
package/vendor/hljs.js
CHANGED
|
@@ -2383,8 +2383,113 @@
|
|
|
2383
2383
|
return tsLanguage;
|
|
2384
2384
|
}
|
|
2385
2385
|
|
|
2386
|
+
// src/vendor/mergeHTMLPlugin.js
|
|
2387
|
+
var mergeHTMLPlugin = (function() {
|
|
2388
|
+
"use strict";
|
|
2389
|
+
var originalStream;
|
|
2390
|
+
function escapeHTML(value) {
|
|
2391
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2392
|
+
}
|
|
2393
|
+
const mergeHTMLPlugin2 = {
|
|
2394
|
+
// preserve the original HTML token stream
|
|
2395
|
+
"before:highlightElement": ({ el }) => {
|
|
2396
|
+
originalStream = nodeStream(el);
|
|
2397
|
+
},
|
|
2398
|
+
// merge it afterwards with the highlighted token stream
|
|
2399
|
+
"after:highlightElement": ({ el, result, text }) => {
|
|
2400
|
+
if (!originalStream.length) {
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
2403
|
+
const resultNode = document.createElement("div");
|
|
2404
|
+
resultNode.innerHTML = result.value;
|
|
2405
|
+
result.value = mergeStreams(originalStream, nodeStream(resultNode), text);
|
|
2406
|
+
el.innerHTML = result.value;
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
function tag(node) {
|
|
2410
|
+
return node.nodeName.toLowerCase();
|
|
2411
|
+
}
|
|
2412
|
+
function nodeStream(node) {
|
|
2413
|
+
const result = [];
|
|
2414
|
+
(function _nodeStream(node2, offset) {
|
|
2415
|
+
for (let child = node2.firstChild; child; child = child.nextSibling) {
|
|
2416
|
+
if (child.nodeType === 3) {
|
|
2417
|
+
offset += child.nodeValue.length;
|
|
2418
|
+
} else if (child.nodeType === 1) {
|
|
2419
|
+
result.push({
|
|
2420
|
+
event: "start",
|
|
2421
|
+
offset,
|
|
2422
|
+
node: child
|
|
2423
|
+
});
|
|
2424
|
+
offset = _nodeStream(child, offset);
|
|
2425
|
+
if (!/br|hr|img|input/.exec(tag(child))) {
|
|
2426
|
+
result.push({
|
|
2427
|
+
event: "stop",
|
|
2428
|
+
offset,
|
|
2429
|
+
node: child
|
|
2430
|
+
});
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
return offset;
|
|
2435
|
+
})(node, 0);
|
|
2436
|
+
return result;
|
|
2437
|
+
}
|
|
2438
|
+
function mergeStreams(original, highlighted, value) {
|
|
2439
|
+
let processed = 0;
|
|
2440
|
+
let result = "";
|
|
2441
|
+
const nodeStack = [];
|
|
2442
|
+
function selectStream() {
|
|
2443
|
+
if (!original.length || !highlighted.length) {
|
|
2444
|
+
return original.length ? original : highlighted;
|
|
2445
|
+
}
|
|
2446
|
+
if (original[0].offset !== highlighted[0].offset) {
|
|
2447
|
+
return original[0].offset < highlighted[0].offset ? original : highlighted;
|
|
2448
|
+
}
|
|
2449
|
+
return highlighted[0].event === "start" ? original : highlighted;
|
|
2450
|
+
}
|
|
2451
|
+
function open(node) {
|
|
2452
|
+
function attributeString(attr) {
|
|
2453
|
+
return " " + attr.nodeName + '="' + escapeHTML(attr.value) + '"';
|
|
2454
|
+
}
|
|
2455
|
+
result += "<" + tag(node) + // @ts-expect-error -- Node doesn't have attributes?
|
|
2456
|
+
[].map.call(node.attributes, attributeString).join("") + ">";
|
|
2457
|
+
}
|
|
2458
|
+
function close(node) {
|
|
2459
|
+
result += "</" + tag(node) + ">";
|
|
2460
|
+
}
|
|
2461
|
+
function render(event) {
|
|
2462
|
+
(event.event === "start" ? open : close)(event.node);
|
|
2463
|
+
}
|
|
2464
|
+
while (original.length || highlighted.length) {
|
|
2465
|
+
let stream = selectStream();
|
|
2466
|
+
result += escapeHTML(value.substring(processed, stream[0].offset));
|
|
2467
|
+
processed = stream[0].offset;
|
|
2468
|
+
if (stream === original) {
|
|
2469
|
+
nodeStack.reverse().forEach(close);
|
|
2470
|
+
do {
|
|
2471
|
+
render(stream.splice(0, 1)[0]);
|
|
2472
|
+
stream = selectStream();
|
|
2473
|
+
} while (stream === original && stream.length && stream[0].offset === processed);
|
|
2474
|
+
nodeStack.reverse().forEach(open);
|
|
2475
|
+
} else {
|
|
2476
|
+
if (stream[0].event === "start") {
|
|
2477
|
+
nodeStack.push(stream[0].node);
|
|
2478
|
+
} else {
|
|
2479
|
+
nodeStack.pop();
|
|
2480
|
+
}
|
|
2481
|
+
render(stream.splice(0, 1)[0]);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
return result + escapeHTML(value.substr(processed));
|
|
2485
|
+
}
|
|
2486
|
+
return mergeHTMLPlugin2;
|
|
2487
|
+
})();
|
|
2488
|
+
var mergeHTMLPlugin_default = mergeHTMLPlugin;
|
|
2489
|
+
|
|
2386
2490
|
// src/vendor/hljs.ts
|
|
2387
|
-
core_default.
|
|
2491
|
+
core_default.addPlugin(mergeHTMLPlugin_default);
|
|
2492
|
+
core_default.configure({ cssSelector: "pre.prettyprint", ignoreUnescapedHTML: true });
|
|
2388
2493
|
core_default.registerLanguage("typescript", typescript);
|
|
2389
2494
|
Object.assign(window, {
|
|
2390
2495
|
prettyPrint: () => {
|