@imqueue/core 3.0.0 → 3.1.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/package.json +6 -11
- package/.oxfmtrc.json +0 -9
- package/.oxlintrc.json +0 -20
- package/debug.d.ts +0 -1
- package/debug_getter.d.ts +0 -1
- package/debug_listener.d.ts +0 -1
- package/scripts/strip-comment-coverage.mjs +0 -397
- package/typedoc.json +0 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imqueue/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Simple JSON-based messaging queue for inter service communication",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"message-queue",
|
|
@@ -18,19 +18,17 @@
|
|
|
18
18
|
"lint": "oxlint",
|
|
19
19
|
"format": "oxfmt \"index.ts\" \"src/**/*.ts\" \"test/**/*.ts\" \"benchmark/**/*.ts\"",
|
|
20
20
|
"format:check": "oxfmt --check \"index.ts\" \"src/**/*.ts\" \"test/**/*.ts\" \"benchmark/**/*.ts\"",
|
|
21
|
-
"test": "npm run build && node --test --test-timeout=15000 $(find test -name '*.spec.js')",
|
|
22
|
-
"test-coverage": "npm run build && node --enable-source-maps --test --experimental-test-coverage --test-timeout=15000 $(find test -name '*.spec.js')",
|
|
23
|
-
"test-lcov": "npm run build && mkdir -p coverage && node --enable-source-maps --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test-timeout=15000 $(find test -name '*.spec.js'); node scripts/strip-comment-coverage.mjs coverage/lcov.info",
|
|
21
|
+
"test": "npm run build && node --experimental-test-module-mocks --test --test-timeout=15000 $(find test -name '*.spec.js')",
|
|
22
|
+
"test-coverage": "npm run build && node --experimental-test-module-mocks --enable-source-maps --test --experimental-test-coverage --test-timeout=15000 $(find test -name '*.spec.js')",
|
|
23
|
+
"test-lcov": "npm run build && mkdir -p coverage && node --experimental-test-module-mocks --enable-source-maps --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test-timeout=15000 $(find test -name '*.spec.js'); node scripts/strip-comment-coverage.mjs coverage/lcov.info",
|
|
24
24
|
"test-coverage-html": "npm run test-lcov; genhtml coverage/lcov.info --output-directory coverage/html --ignore-errors inconsistent,corrupt,format,mismatch && echo \"Coverage report: file://$(pwd)/coverage/html/index.html\"",
|
|
25
25
|
"test-dev": "npm run test && npm run clean-js && npm run clean-typedefs && npm run clean-maps",
|
|
26
26
|
"clean-typedefs": "find . -name '*.d.ts' -not -wholename '*node_modules*' -not -wholename '*generator*' -type f -delete",
|
|
27
27
|
"clean-maps": "find . -name '*.js.map' -not -wholename '*node_modules*' -not -wholename '*generator*' -type f -delete",
|
|
28
28
|
"clean-js": "find . -name '*.js' -not -wholename '*node_modules*' -not -wholename '*generator*' -type f -delete",
|
|
29
29
|
"clean-tests": "rm -rf .nyc_output coverage .agent-out",
|
|
30
|
-
"clean-doc": "rm -rf docs",
|
|
31
30
|
"clean-benchmark": "rm -rf benchmark-result",
|
|
32
|
-
"clean": "npm run clean-tests && npm run clean-typedefs && npm run clean-maps && npm run clean-js && npm run clean-
|
|
33
|
-
"doc": "typedoc && echo \"Docs generated: file://$(pwd)/docs/index.html\""
|
|
31
|
+
"clean": "npm run clean-tests && npm run clean-typedefs && npm run clean-maps && npm run clean-js && npm run clean-benchmark"
|
|
34
32
|
},
|
|
35
33
|
"repository": {
|
|
36
34
|
"type": "git",
|
|
@@ -46,13 +44,10 @@
|
|
|
46
44
|
"ioredis": "^5.11.1"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@types/mock-require": "^3.0.0",
|
|
50
47
|
"@types/node": "^24.9.1",
|
|
51
|
-
"mock-require": "^3.0.3",
|
|
52
48
|
"oxfmt": "0.57.0",
|
|
53
49
|
"oxlint": "1.72.0",
|
|
54
|
-
"
|
|
55
|
-
"typescript": "^6.0.3"
|
|
50
|
+
"typescript": "^7.0.2"
|
|
56
51
|
},
|
|
57
52
|
"main": "index.js",
|
|
58
53
|
"types": "index.d.ts"
|
package/.oxfmtrc.json
DELETED
package/.oxlintrc.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
-
"categories": {
|
|
4
|
-
"correctness": "error"
|
|
5
|
-
},
|
|
6
|
-
"rules": {
|
|
7
|
-
"no-debugger": "error",
|
|
8
|
-
"no-console": ["warn", { "allow": ["warn", "error", "info"] }],
|
|
9
|
-
"no-unused-vars": "warn"
|
|
10
|
-
},
|
|
11
|
-
"ignorePatterns": [
|
|
12
|
-
"**/*.js",
|
|
13
|
-
"**/*.d.ts",
|
|
14
|
-
"docs/",
|
|
15
|
-
"coverage/",
|
|
16
|
-
".nyc_output/",
|
|
17
|
-
".agent-out/",
|
|
18
|
-
"node_modules/"
|
|
19
|
-
]
|
|
20
|
-
}
|
package/debug.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/debug_getter.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/debug_listener.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Coverage post-processor
|
|
3
|
-
*
|
|
4
|
-
* I'm Queue Software Project
|
|
5
|
-
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
6
|
-
*
|
|
7
|
-
* This program is free software: you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU General Public License as published by
|
|
9
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU General Public License
|
|
18
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
-
*
|
|
20
|
-
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
-
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
-
* <support@imqueue.com> to get commercial licensing options.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Node's built-in coverage (`--experimental-test-coverage --enable-source-maps`)
|
|
27
|
-
* reports every non-code line of a `.ts` source as uncovered, because comment
|
|
28
|
-
* and blank lines have no source-map mappings and therefore fall outside every
|
|
29
|
-
* covered V8 byte-range. That paints the license header and each JSDoc block
|
|
30
|
-
* red in the HTML report and pushes per-file line% far below reality.
|
|
31
|
-
*
|
|
32
|
-
* Node's reporter also emits records that the (strict) genhtml LCOV 2.x tool
|
|
33
|
-
* rejects — function entries with `undefined` line numbers or synthetic,
|
|
34
|
-
* duplicated names (`<instance_members_initializer>`, and decorated methods all
|
|
35
|
-
* mis-named `has`/`get`), plus `BRDA:undefined,...` branch records. Left in,
|
|
36
|
-
* they produce a wall of warnings and a fatal "unexpected category" error.
|
|
37
|
-
*
|
|
38
|
-
* This script rewrites an lcov file in place: it drops the `DA`/`BRDA` records
|
|
39
|
-
* for lines that contain no executable code (comments and blank lines), drops
|
|
40
|
-
* all function records and malformed branch records, then recomputes the
|
|
41
|
-
* `LF`/`LH`/`BRF`/`BRH` totals. It uses the TypeScript scanner (already a dev
|
|
42
|
-
* dependency) to locate comments reliably — comment markers inside strings,
|
|
43
|
-
* template literals and regexes are not misdetected. The result renders in
|
|
44
|
-
* genhtml with accurate line + branch coverage and no warnings or errors.
|
|
45
|
-
*/
|
|
46
|
-
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
47
|
-
import ts from 'typescript';
|
|
48
|
-
|
|
49
|
-
const lcovPath = process.argv[2] || 'coverage/lcov.info';
|
|
50
|
-
|
|
51
|
-
if (!existsSync(lcovPath)) {
|
|
52
|
-
console.warn(`strip-comment-coverage: ${lcovPath} not found, skipping`);
|
|
53
|
-
process.exit(0);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns the set of 1-based line numbers in the given source that hold no
|
|
58
|
-
* executable code — i.e. blank lines and lines whose only content is a comment.
|
|
59
|
-
*
|
|
60
|
-
* @param {string} text
|
|
61
|
-
* @returns {Set<number>}
|
|
62
|
-
*/
|
|
63
|
-
function nonCodeLines(text) {
|
|
64
|
-
const commentChars = new Uint8Array(text.length);
|
|
65
|
-
const scanner = ts.createScanner(
|
|
66
|
-
ts.ScriptTarget.Latest,
|
|
67
|
-
/* skipTrivia */ false,
|
|
68
|
-
ts.LanguageVariant.Standard,
|
|
69
|
-
text,
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
let token = scanner.scan();
|
|
73
|
-
|
|
74
|
-
while (token !== ts.SyntaxKind.EndOfFileToken) {
|
|
75
|
-
if (
|
|
76
|
-
token === ts.SyntaxKind.SingleLineCommentTrivia ||
|
|
77
|
-
token === ts.SyntaxKind.MultiLineCommentTrivia
|
|
78
|
-
) {
|
|
79
|
-
const start = scanner.getTokenStart();
|
|
80
|
-
const end = scanner.getTokenEnd();
|
|
81
|
-
|
|
82
|
-
for (let i = start; i < end; i++) {
|
|
83
|
-
commentChars[i] = 1;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
token = scanner.scan();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const lines = text.split('\n');
|
|
91
|
-
const result = new Set();
|
|
92
|
-
let pos = 0;
|
|
93
|
-
|
|
94
|
-
for (let ln = 0; ln < lines.length; ln++) {
|
|
95
|
-
const line = lines[ln];
|
|
96
|
-
let hasCode = false;
|
|
97
|
-
|
|
98
|
-
for (let i = 0; i < line.length; i++) {
|
|
99
|
-
const ch = line[i];
|
|
100
|
-
|
|
101
|
-
if (ch === ' ' || ch === '\t' || ch === '\r') {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (!commentChars[pos + i]) {
|
|
106
|
-
hasCode = true;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!hasCode) {
|
|
112
|
-
result.add(ln + 1);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
pos += line.length + 1; // account for the split '\n'
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Returns the set of 1-based lines occupied by top-level import statements.
|
|
123
|
-
* Imports compile to `require(...)` that runs on module load, so they are
|
|
124
|
-
* always executed, yet Node's source-mapped coverage frequently mis-reports
|
|
125
|
-
* them as uncovered (the mapping lands outside the covered byte-range). Treating
|
|
126
|
-
* them as non-coverable corrects that artifact rather than hiding real logic.
|
|
127
|
-
*
|
|
128
|
-
* @param {string} text
|
|
129
|
-
* @returns {Set<number>}
|
|
130
|
-
*/
|
|
131
|
-
function importLines(text) {
|
|
132
|
-
const sf = ts.createSourceFile(
|
|
133
|
-
'x.ts',
|
|
134
|
-
text,
|
|
135
|
-
ts.ScriptTarget.Latest,
|
|
136
|
-
false,
|
|
137
|
-
);
|
|
138
|
-
const result = new Set();
|
|
139
|
-
|
|
140
|
-
for (const stmt of sf.statements) {
|
|
141
|
-
if (
|
|
142
|
-
ts.isImportDeclaration(stmt) ||
|
|
143
|
-
ts.isImportEqualsDeclaration(stmt)
|
|
144
|
-
) {
|
|
145
|
-
const from = sf.getLineAndCharacterOfPosition(stmt.getStart(sf)).line;
|
|
146
|
-
const to = sf.getLineAndCharacterOfPosition(stmt.getEnd()).line;
|
|
147
|
-
|
|
148
|
-
for (let line = from; line <= to; line++) {
|
|
149
|
-
result.add(line + 1);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return result;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const B64 =
|
|
158
|
-
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
159
|
-
const B64MAP = new Map([...B64].map((c, i) => [c, i]));
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Decodes one base64 VLQ source-map segment into its integer fields.
|
|
163
|
-
*
|
|
164
|
-
* @param {string} seg
|
|
165
|
-
* @returns {number[]}
|
|
166
|
-
*/
|
|
167
|
-
function decodeVLQ(seg) {
|
|
168
|
-
const out = [];
|
|
169
|
-
let shift = 0;
|
|
170
|
-
let value = 0;
|
|
171
|
-
|
|
172
|
-
for (const ch of seg) {
|
|
173
|
-
const digit = B64MAP.get(ch);
|
|
174
|
-
|
|
175
|
-
if (digit === undefined) {
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
value += (digit & 31) << shift;
|
|
180
|
-
|
|
181
|
-
if (digit & 32) {
|
|
182
|
-
shift += 5;
|
|
183
|
-
} else {
|
|
184
|
-
out.push(value & 1 ? -(value >> 1) : value >> 1);
|
|
185
|
-
value = 0;
|
|
186
|
-
shift = 0;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return out;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Returns the set of 1-based source lines that produced generated JavaScript,
|
|
195
|
-
* read from the file's `.js.map`. These are exactly the coverable lines — every
|
|
196
|
-
* other line (comments, blanks, type-only declarations, interfaces) emits no
|
|
197
|
-
* code and can never be executed. Returns null when no source map is present.
|
|
198
|
-
*
|
|
199
|
-
* @param {string} sourceFile - path of the .ts source (e.g. src/RedisQueue.ts)
|
|
200
|
-
* @returns {Set<number> | null}
|
|
201
|
-
*/
|
|
202
|
-
function emittedLines(sourceFile) {
|
|
203
|
-
const mapPath = sourceFile.replace(/\.ts$/, '.js.map');
|
|
204
|
-
|
|
205
|
-
if (!existsSync(mapPath)) {
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
let map;
|
|
210
|
-
|
|
211
|
-
try {
|
|
212
|
-
map = JSON.parse(readFileSync(mapPath, 'utf8'));
|
|
213
|
-
} catch {
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (typeof map.mappings !== 'string') {
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const lines = new Set();
|
|
222
|
-
let srcIndex = 0;
|
|
223
|
-
let srcLine = 0;
|
|
224
|
-
|
|
225
|
-
for (const group of map.mappings.split(';')) {
|
|
226
|
-
for (const seg of group.split(',')) {
|
|
227
|
-
if (!seg) {
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const fields = decodeVLQ(seg);
|
|
232
|
-
|
|
233
|
-
// [genCol, srcIndex, srcLine, srcCol, nameIndex]; <4 fields = no
|
|
234
|
-
// source position for this segment
|
|
235
|
-
if (fields.length >= 4) {
|
|
236
|
-
srcIndex += fields[1];
|
|
237
|
-
srcLine += fields[2];
|
|
238
|
-
|
|
239
|
-
if (srcIndex === 0) {
|
|
240
|
-
lines.add(srcLine + 1); // map lines are 0-based
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return lines;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const coverableCache = new Map();
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Resolves how to filter a source file's line records:
|
|
253
|
-
* - `{ mode: 'keep', set }` — keep only lines in `set` (source-map driven);
|
|
254
|
-
* - `{ mode: 'drop', set }` — drop lines in `set` (comment-scanner fallback).
|
|
255
|
-
*
|
|
256
|
-
* @param {string} sourceFile
|
|
257
|
-
* @returns {{ mode: 'keep' | 'drop', set: Set<number> }}
|
|
258
|
-
*/
|
|
259
|
-
function coverableInfo(sourceFile) {
|
|
260
|
-
if (coverableCache.has(sourceFile)) {
|
|
261
|
-
return coverableCache.get(sourceFile);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const emitted = sourceFile ? emittedLines(sourceFile) : null;
|
|
265
|
-
let info;
|
|
266
|
-
|
|
267
|
-
if (emitted && existsSync(sourceFile)) {
|
|
268
|
-
// A line is coverable only if it emitted JS (has a source-map mapping)
|
|
269
|
-
// AND is not a comment/blank AND is not an import statement. The comment
|
|
270
|
-
// check is required because `removeComments: false` keeps license/JSDoc
|
|
271
|
-
// comments in the output, so they carry mappings too; the mapping check
|
|
272
|
-
// drops type-only lines (interfaces, type aliases) which emit nothing;
|
|
273
|
-
// the import check drops the mis-mapped import artifact.
|
|
274
|
-
const text = readFileSync(sourceFile, 'utf8');
|
|
275
|
-
const nonCode = nonCodeLines(text);
|
|
276
|
-
const imports = importLines(text);
|
|
277
|
-
const keep = new Set(
|
|
278
|
-
[...emitted].filter(
|
|
279
|
-
line => !nonCode.has(line) && !imports.has(line),
|
|
280
|
-
),
|
|
281
|
-
);
|
|
282
|
-
info = { mode: 'keep', set: keep };
|
|
283
|
-
} else if (sourceFile && existsSync(sourceFile)) {
|
|
284
|
-
const text = readFileSync(sourceFile, 'utf8');
|
|
285
|
-
const skip = nonCodeLines(text);
|
|
286
|
-
|
|
287
|
-
for (const line of importLines(text)) {
|
|
288
|
-
skip.add(line);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
info = { mode: 'drop', set: skip };
|
|
292
|
-
} else {
|
|
293
|
-
info = { mode: 'drop', set: new Set() };
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
coverableCache.set(sourceFile, info);
|
|
297
|
-
|
|
298
|
-
return info;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
let strippedLines = 0;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Rewrites a single lcov record so that genhtml accepts it without warnings or
|
|
305
|
-
* errors. It:
|
|
306
|
-
* - drops DA/BRDA entries on non-code (comment/blank) lines;
|
|
307
|
-
* - drops all function records (FN/FNDA/FNF/FNH) — Node's source-mapped
|
|
308
|
-
* function detection is unreliable here (undefined line numbers, mis-named
|
|
309
|
-
* and duplicated entries), which genhtml rejects, so line + branch coverage
|
|
310
|
-
* is kept instead;
|
|
311
|
-
* - drops malformed branch records such as `BRDA:undefined,...`;
|
|
312
|
-
* - recomputes the LF/LH/BRF/BRH totals.
|
|
313
|
-
*
|
|
314
|
-
* @param {string[]} recordLines - record body, excluding the end_of_record line
|
|
315
|
-
* @returns {string}
|
|
316
|
-
*/
|
|
317
|
-
function processRecord(recordLines) {
|
|
318
|
-
const sfLine = recordLines.find(line => line.startsWith('SF:'));
|
|
319
|
-
const sourceFile = sfLine ? sfLine.slice(3).trim() : '';
|
|
320
|
-
const info = coverableInfo(sourceFile);
|
|
321
|
-
|
|
322
|
-
// true when a source line produces no executable code and must be dropped
|
|
323
|
-
const drop = n => (info.mode === 'keep' ? !info.set.has(n) : info.set.has(n));
|
|
324
|
-
|
|
325
|
-
let lf = 0;
|
|
326
|
-
let lh = 0;
|
|
327
|
-
let brf = 0;
|
|
328
|
-
let brh = 0;
|
|
329
|
-
|
|
330
|
-
const kept = recordLines.filter(line => {
|
|
331
|
-
// drop all function records — unreliable under source maps
|
|
332
|
-
if (/^(FN:|FNDA:|FNF:|FNH:)/.test(line)) {
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const da = line.match(/^DA:(\d+),(\d+)/);
|
|
337
|
-
|
|
338
|
-
if (da) {
|
|
339
|
-
if (drop(+da[1])) {
|
|
340
|
-
strippedLines++;
|
|
341
|
-
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
lf++;
|
|
346
|
-
|
|
347
|
-
if (+da[2] > 0) {
|
|
348
|
-
lh++;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return true;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (line.startsWith('BRDA:')) {
|
|
355
|
-
const brda = line.match(/^BRDA:(\d+),\d+,\d+,(\d+|-)$/);
|
|
356
|
-
|
|
357
|
-
// drop malformed (e.g. BRDA:undefined,...) or non-code branches
|
|
358
|
-
if (!brda || drop(+brda[1])) {
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
brf++;
|
|
363
|
-
|
|
364
|
-
if (brda[2] !== '-' && +brda[2] > 0) {
|
|
365
|
-
brh++;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return true;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// drop the old totals — they are recomputed below
|
|
372
|
-
return !/^(LF|LH|BRF|BRH):/.test(line);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
return (
|
|
376
|
-
`${kept.join('\n')}\n` +
|
|
377
|
-
`LF:${lf}\nLH:${lh}\nBRF:${brf}\nBRH:${brh}\nend_of_record\n`
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
const output = [];
|
|
382
|
-
let record = [];
|
|
383
|
-
|
|
384
|
-
for (const line of readFileSync(lcovPath, 'utf8').split('\n')) {
|
|
385
|
-
if (line === 'end_of_record') {
|
|
386
|
-
output.push(processRecord(record));
|
|
387
|
-
record = [];
|
|
388
|
-
} else if (line !== '') {
|
|
389
|
-
record.push(line);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
writeFileSync(lcovPath, output.join(''));
|
|
394
|
-
console.info(
|
|
395
|
-
`strip-comment-coverage: removed ${strippedLines} comment/blank line ` +
|
|
396
|
-
`entries from ${lcovPath}`,
|
|
397
|
-
);
|
package/typedoc.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://typedoc.org/schema.json",
|
|
3
|
-
"name": "@imqueue/core",
|
|
4
|
-
"entryPoints": ["."],
|
|
5
|
-
"entryPointStrategy": "expand",
|
|
6
|
-
"exclude": [
|
|
7
|
-
"**/+(test|node_modules|docs|coverage|benchmark|.nyc_output)/**/*",
|
|
8
|
-
"**/*.d.ts"
|
|
9
|
-
],
|
|
10
|
-
"excludePrivate": true,
|
|
11
|
-
"excludeExternals": true,
|
|
12
|
-
"hideGenerator": true,
|
|
13
|
-
"externalSymbolLinkMappings": {
|
|
14
|
-
"@types/node": {
|
|
15
|
-
"EventEmitter.defaultMaxListeners": "https://nodejs.org/api/events.html#eventsdefaultmaxlisteners"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"out": "docs"
|
|
19
|
-
}
|