@veda-hq/pariksha 0.5.1 → 0.5.3

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.
@@ -0,0 +1,11 @@
1
+ // Answers, on fd 3, with the coverage exclusions of one vitest config, for
2
+ // coverage-exemptions. Runs in its own Node process, under the product's loader
3
+ // (`--import tsx`), because a config imports the product's TypeScript as the
4
+ // product compiles it. It exits once answered: a config's open timer or handle
5
+ // must not hold the run.
6
+ import { writeSync } from 'node:fs';
7
+ import { readExclude } from "./coverage-exemptions.js";
8
+ const exclude = await readExclude(process.argv[2] ?? '');
9
+ // A function or symbol stringifies to undefined; it is no list either way.
10
+ writeSync(3, JSON.stringify(exclude ?? null) ?? 'null');
11
+ process.exit(0);
@@ -0,0 +1,26 @@
1
+ // The TypeScript compiler API, for the checks that read code or tsconfig files.
2
+ // An optional peer dependency: only those checks load it.
3
+ import { createRequire } from 'node:module';
4
+ import { join } from 'node:path';
5
+ /** Where typescript is looked for: the product's own install at `root` first, then beside pariksha (npx installs no optional peer). */
6
+ export const typescriptLoaders = (root) => [createRequire(join(root, 'package.json')), createRequire(import.meta.url)];
7
+ /** TypeScript from the first loader that has it; a message naming why when it cannot be used. */
8
+ export const loadTypescript = (loaders = typescriptLoaders(process.cwd())) => {
9
+ let mod;
10
+ for (const load of loaders) {
11
+ try {
12
+ mod = load('typescript');
13
+ break;
14
+ }
15
+ catch {
16
+ // not installed there; try the next
17
+ }
18
+ }
19
+ if (mod === undefined)
20
+ return 'needs the typescript package (>=5.4 <6) in the repository or beside pariksha';
21
+ const ts = mod;
22
+ if (typeof ts.createSourceFile !== 'function') {
23
+ return `needs the TypeScript compiler API, which typescript ${String(ts.version)} does not export; install typescript >=5.4 <6`;
24
+ }
25
+ return ts;
26
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veda-hq/pariksha",
3
- "version": "0.5.1",
4
- "description": "Repository checks: doc drift, rule enforcement, test-quality ratchets. Checks: authority-citations, boundary, coverage-by-type, doc-budgets, export-deletions.",
3
+ "version": "0.5.3",
4
+ "description": "Repository checks: doc drift, rule enforcement, test-quality ratchets. Checks: authority-citations, boundary, coverage-by-type, coverage-exemptions, doc-budgets, env-gate-switches, export-deletions.",
5
5
  "keywords": [
6
6
  "repository checks",
7
7
  "lint",