@browsercore/quic 0.2.2 → 0.2.4

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.
Files changed (43) hide show
  1. package/README.md +28 -15
  2. package/dist/connection.d.ts +26 -35
  3. package/dist/connection.d.ts.map +1 -1
  4. package/dist/connection.js +79 -32
  5. package/dist/connection.js.map +1 -1
  6. package/dist/crypto/key-derivation.d.ts +5 -4
  7. package/dist/crypto/key-derivation.d.ts.map +1 -1
  8. package/dist/crypto/key-derivation.js +5 -5
  9. package/dist/crypto/key-derivation.js.map +1 -1
  10. package/dist/errors.d.ts +1 -0
  11. package/dist/errors.d.ts.map +1 -1
  12. package/dist/errors.js +1 -1
  13. package/dist/errors.js.map +1 -1
  14. package/dist/handshake/quic-handshake.d.ts +66 -4
  15. package/dist/handshake/quic-handshake.d.ts.map +1 -1
  16. package/dist/handshake/quic-handshake.js +27 -9
  17. package/dist/handshake/quic-handshake.js.map +1 -1
  18. package/dist/handshake/quic-transport-adapter.d.ts +19 -11
  19. package/dist/handshake/quic-transport-adapter.d.ts.map +1 -1
  20. package/dist/handshake/quic-transport-adapter.js +38 -12
  21. package/dist/handshake/quic-transport-adapter.js.map +1 -1
  22. package/dist/index.d.ts +1 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +0 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/packet/packet-protection.d.ts +6 -6
  27. package/dist/packet/packet-protection.d.ts.map +1 -1
  28. package/dist/packet/packet-protection.js +5 -6
  29. package/dist/packet/packet-protection.js.map +1 -1
  30. package/dist/stream/stream.d.ts +7 -11
  31. package/dist/stream/stream.d.ts.map +1 -1
  32. package/dist/stream/stream.js +6 -22
  33. package/dist/stream/stream.js.map +1 -1
  34. package/dist/transport-params.d.ts +4 -0
  35. package/dist/transport-params.d.ts.map +1 -1
  36. package/dist/transport-params.js +8 -1
  37. package/dist/transport-params.js.map +1 -1
  38. package/dist/types.d.ts +56 -25
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/types.js +0 -19
  41. package/dist/types.js.map +1 -1
  42. package/package.json +8 -10
  43. package/bin/coverage-md.mjs +0 -99
@@ -1,99 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Convert vitest's coverage-summary.json into a markdown coverage table.
4
- *
5
- * Run AFTER `vitest run --coverage` (with the json-summary reporter) so
6
- * coverage-summary.json exists. Writes COVERAGE.md and coverage/badge.json to
7
- * the current working directory (the consumer package root).
8
- *
9
- * Distributed as the `coverage-md` bin of @browsercore/dev, replacing the
10
- * per-repo scripts/coverage-md.mjs copies.
11
- *
12
- * Dependency-free: only node:fs + node:path. Safe in CI with no install step.
13
- */
14
- import { readFileSync, writeFileSync } from "node:fs";
15
- import { join, relative } from "node:path";
16
-
17
- const pkgRoot = process.cwd();
18
- const summaryPath = join(pkgRoot, "coverage", "coverage-summary.json");
19
- const outPath = join(pkgRoot, "COVERAGE.md");
20
- const badgePath = join(pkgRoot, "coverage", "badge.json");
21
-
22
- /** @type {Record<string, { lines:{total:number,covered:number,pct:number}, statements:{total:number,covered:number,pct:number}, functions:{total:number,covered:number,pct:number}, branches:{total:number,covered:number,pct:number} }>} */
23
- let data;
24
- try {
25
- data = JSON.parse(readFileSync(summaryPath, "utf-8"));
26
- } catch {
27
- console.error(
28
- `[coverage-md] Could not read ${summaryPath}. ` +
29
- `Run vitest with the json-summary reporter first.`,
30
- );
31
- process.exit(1);
32
- }
33
-
34
- const total = data.total;
35
- /**
36
- * @typedef {Object} Metric
37
- * @property {string} label
38
- * @property {keyof typeof total} key
39
- */
40
- /** @type {Metric[]} */
41
- const metrics = [
42
- { label: "Statements", key: "statements" },
43
- { label: "Branches", key: "branches" },
44
- { label: "Functions", key: "functions" },
45
- { label: "Lines", key: "lines" },
46
- ];
47
- /** @param {{pct:number,covered:number,total:number}} m */
48
- const render = (m) => `${m.pct}% (${m.covered}/${m.total})`;
49
-
50
- const fileEntries = Object.entries(data)
51
- .filter(([key]) => key !== "total")
52
- .map(([file, m]) => {
53
- // coverage-summary.json keys are absolute paths; show repo-relative.
54
- const rel = relative(pkgRoot, file).split("\\").join("/");
55
- return { file: rel, m };
56
- })
57
- .sort((a, b) => a.file.localeCompare(b.file));
58
-
59
- const lines = [];
60
- lines.push(`# Coverage report`);
61
- lines.push("");
62
- lines.push(`Generated from \`coverage-summary.json\` by \`coverage-md\` (@browsercore/dev).`);
63
- lines.push("");
64
- lines.push(`## Total`);
65
- lines.push("");
66
- lines.push(`| Metric | Coverage |`);
67
- lines.push(`| --- | --- |`);
68
- for (const { label, key } of metrics) {
69
- lines.push(`| ${label} | ${render(total[key])} |`);
70
- }
71
- lines.push("");
72
- lines.push(`## Per-file`);
73
- lines.push("");
74
- const header = `| File | ${metrics.map((m) => m.label).join(" | ")} |`;
75
- const sep = `| --- | ${metrics.map(() => "---").join(" | ")} |`;
76
- lines.push(header);
77
- lines.push(sep);
78
- for (const { file, m } of fileEntries) {
79
- lines.push(`| \`${file}\` | ${metrics.map((met) => render(m[met.key])).join(" | ")} |`);
80
- }
81
- lines.push("");
82
-
83
- writeFileSync(outPath, lines.join("\n"));
84
- console.log(`[coverage-md] wrote ${relative(process.cwd(), outPath)}`);
85
-
86
- // shields.io endpoint badge: a single coverage figure (statements %) for the
87
- // README badge. Color tiers mirror shields.io conventions.
88
- const pct = total.statements.pct;
89
- const badgeColor =
90
- pct >= 90 ? "brightgreen" : pct >= 75 ? "green" : pct >= 50 ? "yellow" : "red";
91
- const badge = {
92
- schemaVersion: 1,
93
- label: "coverage",
94
- message: `${pct}%`,
95
- color: badgeColor,
96
- namedLogo: "vitest",
97
- };
98
- writeFileSync(badgePath, JSON.stringify(badge));
99
- console.log(`[coverage-md] wrote ${relative(process.cwd(), badgePath)}`);