@callidescope/nx 0.0.63 → 0.0.65
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/CHANGELOG.md +16 -0
- package/README.md +134 -160
- package/dist/{address.utilities-CsqyHZaJ.js → address.utilities-DjzmfI-l.js} +2 -2
- package/dist/{plugin-context.utilities-Bl7Iny6b.js → plugin-context.utilities-BstelNQl.js} +167 -131
- package/dist/{plugin.utilities-BYLiorWH.js → plugin.utilities-C8eEw5MU.js} +1 -1
- package/dist/src/executors/breadth/executor.js +2 -2
- package/dist/src/executors/depth/executor.js +2 -2
- package/dist/src/executors/gate/batch-executor.d.ts +54 -0
- package/dist/src/executors/gate/batch-executor.js +64 -0
- package/dist/src/executors/gate/executor.js +2 -2
- package/dist/src/executors/trace/executor.js +2 -2
- package/dist/src/index.d.ts +136 -48
- package/dist/src/index.js +1 -1
- package/executors.json +2 -0
- package/package.json +6 -6
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { c as e, n as t, r as n } from "../../../plugin-context.utilities-BstelNQl.js";
|
|
2
|
+
import { t as r } from "../../../plugin.utilities-C8eEw5MU.js";
|
|
3
|
+
// src/executors/gate/batch-executor.ts
|
|
4
|
+
async function gateBatchExecutor(...[e, t, r, i]) {
|
|
5
|
+
let a = await Promise.all(Object.entries(e.tasks).map(async ([e, n]) => await resolveTask({
|
|
6
|
+
context: i,
|
|
7
|
+
options: t[e] ?? r,
|
|
8
|
+
projectName: n.target.project,
|
|
9
|
+
taskId: e
|
|
10
|
+
}))), o = {}, s = /* @__PURE__ */ new Map();
|
|
11
|
+
for (let e of a) "failure" in e ? o[e.taskId] = e.failure : s.set(e.configurationPath, [...s.get(e.configurationPath) ?? [], e.task]);
|
|
12
|
+
let c = await n();
|
|
13
|
+
for (let [e, t] of s) {
|
|
14
|
+
let n = await c.runGateBatch({
|
|
15
|
+
configurationPath: e,
|
|
16
|
+
tasks: t,
|
|
17
|
+
workspaceRoot: i.root
|
|
18
|
+
});
|
|
19
|
+
for (let [e, t] of Object.entries(n)) o[e] = {
|
|
20
|
+
success: t.ok,
|
|
21
|
+
terminalOutput: t.report
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return printFailures(o), o;
|
|
25
|
+
}
|
|
26
|
+
function printFailures(e) {
|
|
27
|
+
for (let [t, n] of Object.entries(e)) n.success || process.stdout.write(`\n> ${t}\n${n.terminalOutput}\n`);
|
|
28
|
+
}
|
|
29
|
+
async function resolveTask(n) {
|
|
30
|
+
try {
|
|
31
|
+
let i = await t(), a = await r({
|
|
32
|
+
context: {
|
|
33
|
+
...n.context,
|
|
34
|
+
projectName: n.projectName
|
|
35
|
+
},
|
|
36
|
+
label: "gate",
|
|
37
|
+
options: n.options
|
|
38
|
+
});
|
|
39
|
+
return a.directories.length === 0 ? {
|
|
40
|
+
failure: {
|
|
41
|
+
success: !1,
|
|
42
|
+
terminalOutput: e
|
|
43
|
+
},
|
|
44
|
+
taskId: n.taskId
|
|
45
|
+
} : {
|
|
46
|
+
configurationPath: i.readConfiguration(n.options.configuration),
|
|
47
|
+
task: {
|
|
48
|
+
directories: a.directories,
|
|
49
|
+
id: n.taskId,
|
|
50
|
+
judgedProjectNames: a.selectedDirectories
|
|
51
|
+
},
|
|
52
|
+
taskId: n.taskId
|
|
53
|
+
};
|
|
54
|
+
} catch (e) {
|
|
55
|
+
return {
|
|
56
|
+
failure: {
|
|
57
|
+
success: !1,
|
|
58
|
+
terminalOutput: e instanceof Error ? e.message : String(e)
|
|
59
|
+
},
|
|
60
|
+
taskId: n.taskId
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export { gateBatchExecutor as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as e, n as t, r as n } from "../../../plugin-context.utilities-
|
|
2
|
-
import { t as r } from "../../../plugin.utilities-
|
|
1
|
+
import { c as e, n as t, r as n } from "../../../plugin-context.utilities-BstelNQl.js";
|
|
2
|
+
import { t as r } from "../../../plugin.utilities-C8eEw5MU.js";
|
|
3
3
|
// src/executors/gate/executor.ts
|
|
4
4
|
async function gateExecutor(i, a) {
|
|
5
5
|
let o = await r({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e, r as t } from "../../../plugin-context.utilities-
|
|
2
|
-
import { t as n } from "../../../plugin.utilities-
|
|
1
|
+
import { n as e, r as t } from "../../../plugin-context.utilities-BstelNQl.js";
|
|
2
|
+
import { t as n } from "../../../plugin.utilities-C8eEw5MU.js";
|
|
3
3
|
// src/executors/trace/executor.ts
|
|
4
4
|
async function traceExecutor(r, i) {
|
|
5
5
|
let a = await n({
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,13 +2,16 @@ import { AddressDepthService } from '@callidescope/graph';
|
|
|
2
2
|
import { AddressLookupService } from '@callidescope/cli';
|
|
3
3
|
import { AddressReportService } from '@callidescope/output';
|
|
4
4
|
import { BreadthService } from '@callidescope/graph';
|
|
5
|
+
import { CallGraphResult } from '@callidescope/core';
|
|
5
6
|
import { CallidescopeOutputFormat } from '@callidescope/configuration';
|
|
6
7
|
import { CallidescopeService } from '@callidescope/cli';
|
|
7
8
|
import { ConfigurationService } from '@callidescope/configuration';
|
|
8
9
|
import { CreateNodes } from '@nx/devkit';
|
|
9
10
|
import { FileFilterService } from '@callidescope/graph';
|
|
10
11
|
import { MarkdownReportService } from '@callidescope/output';
|
|
12
|
+
import { OwnedFindings } from '@callidescope/output';
|
|
11
13
|
import { ProjectGraph } from '@nx/devkit';
|
|
14
|
+
import { ProjectLimitsLookup } from '@callidescope/configuration';
|
|
12
15
|
import { ProjectReportsService } from '@callidescope/output';
|
|
13
16
|
import { ResolvedCallidescopeConfiguration } from '@callidescope/configuration';
|
|
14
17
|
|
|
@@ -277,10 +280,10 @@ export declare class PluginService {
|
|
|
277
280
|
private readonly fileFilterService;
|
|
278
281
|
private readonly markdownReportService;
|
|
279
282
|
private readonly optionsService;
|
|
280
|
-
private readonly projectReportsService;
|
|
281
283
|
private readonly projectsService;
|
|
282
284
|
private readonly runConfigurationService;
|
|
283
|
-
|
|
285
|
+
private readonly verdictService;
|
|
286
|
+
constructor(callidescopeService: CallidescopeService, configurationService: ConfigurationService, fileFilterService: FileFilterService, markdownReportService: MarkdownReportService, optionsService: OptionsService, projectsService: ProjectsService, runConfigurationService: RunConfigurationService, verdictService: VerdictService);
|
|
284
287
|
/**
|
|
285
288
|
* Builds the predicate deciding which projects the workspace configuration
|
|
286
289
|
* keeps out of every trace.
|
|
@@ -312,15 +315,6 @@ export declare class PluginService {
|
|
|
312
315
|
* failing on that would hand it a permanently red target.
|
|
313
316
|
*/
|
|
314
317
|
private buildInferredTargets;
|
|
315
|
-
/**
|
|
316
|
-
* The block a verdict owes the reader when its findings cannot explain it.
|
|
317
|
-
*
|
|
318
|
-
* Both targets print this and only one fails on it — see `judge` — because
|
|
319
|
-
* an unread project is a fact about the run either way. The unread projects
|
|
320
|
-
* come first when both apply: they name what went missing, where the
|
|
321
|
-
* whole-run reason can only say that something did.
|
|
322
|
-
*/
|
|
323
|
-
private explainVerdict;
|
|
324
318
|
/** Whether a project's directory holds a TypeScript program to trace. */
|
|
325
319
|
private holdsProgram;
|
|
326
320
|
/**
|
|
@@ -337,45 +331,14 @@ export declare class PluginService {
|
|
|
337
331
|
*/
|
|
338
332
|
private isExcludedProject;
|
|
339
333
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
* One predicate rather than the same expression beside each caller, so a
|
|
343
|
-
* rule added here cannot reach one verdict and miss the other.
|
|
344
|
-
*
|
|
345
|
-
* **Only the projects the run was scoped to are judged.** A trace reaches
|
|
346
|
-
* into the dependencies of what it was pointed at, so judging the whole
|
|
347
|
-
* run's findings would fail `alpha`'s task for a breach in `beta`. The same
|
|
348
|
-
* line the publishing side already draws, one step further along:
|
|
349
|
-
* measurement reaches into dependencies, publishing does not, and judging
|
|
350
|
-
* does not either. A dependency's breach is its own gate's business, and
|
|
351
|
-
* `nx affected` selects it too when it changes, so nothing escapes a verdict.
|
|
352
|
-
*
|
|
353
|
-
* **A judged project none of whose own files were read is named back**, the
|
|
354
|
-
* case `callidescope`'s own `reportEmptyTrace` fails for the same reason: a
|
|
355
|
-
* gate that passes because it never looked reports the project as clean.
|
|
356
|
-
* Asked of each judged project rather than of the whole run, because
|
|
357
|
-
* narrowing made those two different questions — a project with dependencies
|
|
358
|
-
* has a non-empty run whatever became of its own sources, so its own
|
|
359
|
-
* `exclude` over-matching would otherwise leave it owning no finding and
|
|
360
|
-
* passing green. The whole run is asked too, for a run judging no project at
|
|
361
|
-
* all.
|
|
334
|
+
* Turns one traced outcome into the gate's result for the projects it judges.
|
|
362
335
|
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* project
|
|
367
|
-
* is denied a gate while keeping its trace, so failing the trace too would
|
|
368
|
-
* make that project's target permanently red for being configured exactly as
|
|
369
|
-
* it was asked to be. Finding the projects stays here either way, so the
|
|
370
|
-
* rule cannot be applied to one verdict and forgotten by the other.
|
|
371
|
-
*
|
|
372
|
-
* **Depth is judged always, breadth wherever a limit exists** — not two
|
|
373
|
-
* modes to be selected between. `maximumDepth` has a default and
|
|
374
|
-
* `maximumBreadth` has none at any level, so a project declaring no breadth
|
|
375
|
-
* limit can produce no breadth finding to fail on. Reading the findings
|
|
376
|
-
* rather than naming a check is what keeps that true without a decision.
|
|
336
|
+
* What to print comes from the verdict: the findings it judged, or, for a
|
|
337
|
+
* run that read nothing and so has none to show, the reason it failed. The
|
|
338
|
+
* one thing added to that verdict is the exit code for an unread judged
|
|
339
|
+
* project, which is the gate's alone — see `VerdictService.judge`.
|
|
377
340
|
*/
|
|
378
|
-
private
|
|
341
|
+
private renderGateVerdict;
|
|
379
342
|
/**
|
|
380
343
|
* States what a selection asked for that the workspace does not have.
|
|
381
344
|
*
|
|
@@ -422,6 +385,17 @@ export declare class PluginService {
|
|
|
422
385
|
* judged project, which is the gate's alone — see `judge`.
|
|
423
386
|
*/
|
|
424
387
|
runGate(args: RunGateArguments): Promise<RunTraceResult>;
|
|
388
|
+
/**
|
|
389
|
+
* Gates every task of a batch from one trace of their combined scope.
|
|
390
|
+
*
|
|
391
|
+
* Each gate used to trace the whole workspace on its own, so a run of ~60
|
|
392
|
+
* projects traced it ~60 times. The trace reads the union of the tasks'
|
|
393
|
+
* directories once, then every task is judged by `judge` on the projects it
|
|
394
|
+
* alone answers for, exactly as `runGate` judges one — a breach the shared
|
|
395
|
+
* trace found fails only the task whose project owns it, which is what keeps
|
|
396
|
+
* a batch's verdicts the same as the separate runs' would have been.
|
|
397
|
+
*/
|
|
398
|
+
runGateBatch(args: RunGateBatchArguments): Promise<Record<string, RunTraceResult>>;
|
|
425
399
|
/**
|
|
426
400
|
* Traces the resolved directories and renders the report.
|
|
427
401
|
*
|
|
@@ -667,6 +641,24 @@ declare class RunConfigurationService {
|
|
|
667
641
|
*/
|
|
668
642
|
declare type RunGateArguments = Omit<RunTraceArguments, "format">;
|
|
669
643
|
|
|
644
|
+
/** Arguments for gating several tasks from one trace. */
|
|
645
|
+
declare interface RunGateBatchArguments {
|
|
646
|
+
/** The workspace configuration file, as this plugin's registration names it. */
|
|
647
|
+
readonly configurationPath: string;
|
|
648
|
+
readonly tasks: readonly RunGateBatchTask[];
|
|
649
|
+
readonly workspaceRoot: string;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/** One task of a gate batch: the projects it reads and the ones it answers for. */
|
|
653
|
+
declare interface RunGateBatchTask {
|
|
654
|
+
/** Workspace-relative directories the task's trace reads. */
|
|
655
|
+
readonly directories: readonly string[];
|
|
656
|
+
/** Nx's id for the task, which the result is keyed by. */
|
|
657
|
+
readonly id: string;
|
|
658
|
+
/** What the task judges, a subset of its `directories`. */
|
|
659
|
+
readonly judgedProjectNames: readonly string[];
|
|
660
|
+
}
|
|
661
|
+
|
|
670
662
|
/** Arguments for tracing one resolved selection. */
|
|
671
663
|
declare interface RunTraceArguments {
|
|
672
664
|
/** The workspace configuration file, as this plugin's registration names it. */
|
|
@@ -696,4 +688,100 @@ export declare interface RunTraceResult {
|
|
|
696
688
|
readonly report: string;
|
|
697
689
|
}
|
|
698
690
|
|
|
691
|
+
/**
|
|
692
|
+
* What one predicate decided about a traced result.
|
|
693
|
+
*
|
|
694
|
+
* The findings come back with the verdict so the rendering shows what was
|
|
695
|
+
* judged rather than what was measured — the two differ for every scoped run.
|
|
696
|
+
*
|
|
697
|
+
* `reason` carries the rendering a verdict owes the reader when the findings
|
|
698
|
+
* cannot explain it themselves — a run that read nothing has no finding to
|
|
699
|
+
* show, and a bare red task there is the guessing game this rule exists to
|
|
700
|
+
* end.
|
|
701
|
+
*/
|
|
702
|
+
declare interface RunVerdict {
|
|
703
|
+
readonly findings: OwnedFindings;
|
|
704
|
+
/** Whether every rule both targets share was cleared. */
|
|
705
|
+
readonly ok: boolean;
|
|
706
|
+
readonly reason: string | undefined;
|
|
707
|
+
/**
|
|
708
|
+
* Judged projects none of whose own files were read.
|
|
709
|
+
*
|
|
710
|
+
* Reported beside `ok` rather than folded into it, because this is the one
|
|
711
|
+
* rule the two targets act on differently: a `gate` fails on it, a `trace`
|
|
712
|
+
* prints it and passes. Every project the workspace configuration excludes
|
|
713
|
+
* reads nothing of its own and keeps its trace while losing its gate, so a
|
|
714
|
+
* trace failing here would be permanently red for being configured as asked.
|
|
715
|
+
* The rule itself still lives in one place — `PluginService.judge` — and only
|
|
716
|
+
* the consequence is the caller's.
|
|
717
|
+
*/
|
|
718
|
+
readonly unreadProjectNames: readonly string[];
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Decides whether a traced result passes, for every target that reads one.
|
|
723
|
+
*
|
|
724
|
+
* Its own service so one trace can be judged once per project: a batch of
|
|
725
|
+
* gates traces the workspace a single time and asks this the same question of
|
|
726
|
+
* each project, which is why a verdict takes the result and the projects to
|
|
727
|
+
* judge rather than a trace to run.
|
|
728
|
+
*/
|
|
729
|
+
declare class VerdictService {
|
|
730
|
+
private readonly projectReportsService;
|
|
731
|
+
constructor(projectReportsService: ProjectReportsService);
|
|
732
|
+
/**
|
|
733
|
+
* The block a verdict owes the reader when its findings cannot explain it.
|
|
734
|
+
*
|
|
735
|
+
* Both targets print this and only one fails on it — see `judge` — because
|
|
736
|
+
* an unread project is a fact about the run either way. The unread projects
|
|
737
|
+
* come first when both apply: they name what went missing, where the
|
|
738
|
+
* whole-run reason can only say that something did.
|
|
739
|
+
*/
|
|
740
|
+
explain(verdict: RunVerdict): string | undefined;
|
|
741
|
+
/**
|
|
742
|
+
* Decides whether a traced result passes, for every target that reads one.
|
|
743
|
+
*
|
|
744
|
+
* One predicate rather than the same expression beside each caller, so a
|
|
745
|
+
* rule added here cannot reach one verdict and miss the other.
|
|
746
|
+
*
|
|
747
|
+
* **Only the projects the run was scoped to are judged.** A trace reaches
|
|
748
|
+
* into the dependencies of what it was pointed at, so judging the whole
|
|
749
|
+
* run's findings would fail `alpha`'s task for a breach in `beta`. The same
|
|
750
|
+
* line the publishing side already draws, one step further along:
|
|
751
|
+
* measurement reaches into dependencies, publishing does not, and judging
|
|
752
|
+
* does not either. A dependency's breach is its own gate's business, and
|
|
753
|
+
* `nx affected` selects it too when it changes, so nothing escapes a verdict.
|
|
754
|
+
*
|
|
755
|
+
* **A judged project none of whose own files were read is named back**, the
|
|
756
|
+
* case `callidescope`'s own `reportEmptyTrace` fails for the same reason: a
|
|
757
|
+
* gate that passes because it never looked reports the project as clean.
|
|
758
|
+
* Asked of each judged project rather than of the whole run, because
|
|
759
|
+
* narrowing made those two different questions — a project with dependencies
|
|
760
|
+
* has a non-empty run whatever became of its own sources, so its own
|
|
761
|
+
* `exclude` over-matching would otherwise leave it owning no finding and
|
|
762
|
+
* passing green. The whole run is asked too, for a run judging no project at
|
|
763
|
+
* all.
|
|
764
|
+
*
|
|
765
|
+
* It is the one rule whose **consequence** is the caller's rather than this
|
|
766
|
+
* predicate's, and so the one thing `unreadProjectNames` is returned beside
|
|
767
|
+
* `ok` for: a `gate` fails on it and a `trace` prints it and passes. Every
|
|
768
|
+
* project the workspace configuration excludes reads nothing of its own and
|
|
769
|
+
* is denied a gate while keeping its trace, so failing the trace too would
|
|
770
|
+
* make that project's target permanently red for being configured exactly as
|
|
771
|
+
* it was asked to be. Finding the projects stays here either way, so the
|
|
772
|
+
* rule cannot be applied to one verdict and forgotten by the other.
|
|
773
|
+
*
|
|
774
|
+
* **Depth is judged always, breadth wherever a limit exists** — not two
|
|
775
|
+
* modes to be selected between. `maximumDepth` has a default and
|
|
776
|
+
* `maximumBreadth` has none at any level, so a project declaring no breadth
|
|
777
|
+
* limit can produce no breadth finding to fail on. Reading the findings
|
|
778
|
+
* rather than naming a check is what keeps that true without a decision.
|
|
779
|
+
*/
|
|
780
|
+
judge(args: {
|
|
781
|
+
judgedProjectNames: readonly string[];
|
|
782
|
+
projectLimits: ProjectLimitsLookup;
|
|
783
|
+
result: CallGraphResult;
|
|
784
|
+
}): RunVerdict;
|
|
785
|
+
}
|
|
786
|
+
|
|
699
787
|
export { }
|
package/dist/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, a as t, b as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "../plugin-context.utilities-
|
|
1
|
+
import { _ as e, a as t, b as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "../plugin-context.utilities-BstelNQl.js";
|
|
2
2
|
import y from "node:path";
|
|
3
3
|
// src/index.ts
|
|
4
4
|
var b = {
|
package/executors.json
CHANGED
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
"schema": "./src/executors/depth/schema.json"
|
|
13
13
|
},
|
|
14
14
|
"gate": {
|
|
15
|
+
"batchImplementation": "@callidescope/nx/src/executors/gate/batch-executor",
|
|
15
16
|
"description": "Fail a project whose call stacks broke the depth or breadth limits it is held to, resolved against the project and its Nx dependencies.",
|
|
16
17
|
"implementation": "@callidescope/nx/src/executors/gate/executor",
|
|
18
|
+
"preferBatch": true,
|
|
17
19
|
"schema": "./src/executors/gate/schema.json"
|
|
18
20
|
},
|
|
19
21
|
"trace": {
|
package/package.json
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"url": "https://github.com/organizzolini/codebase/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@callidescope/cli": "0.0.
|
|
8
|
-
"@callidescope/configuration": "0.0.
|
|
9
|
-
"@callidescope/core": "0.0.
|
|
10
|
-
"@callidescope/graph": "0.0.
|
|
11
|
-
"@callidescope/output": "0.0.
|
|
7
|
+
"@callidescope/cli": "0.0.64",
|
|
8
|
+
"@callidescope/configuration": "0.0.64",
|
|
9
|
+
"@callidescope/core": "0.0.63",
|
|
10
|
+
"@callidescope/graph": "0.0.63",
|
|
11
|
+
"@callidescope/output": "0.0.63",
|
|
12
12
|
"@nestjs/common": "^11.1.21 || ^12.0.1",
|
|
13
13
|
"@nestjs/core": "^11.1.21 || ^12.0.1",
|
|
14
14
|
"@nx/devkit": "^24.0.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"strict": true
|
|
80
80
|
},
|
|
81
81
|
"types": "./dist/src/index.d.ts",
|
|
82
|
-
"version": "0.0.
|
|
82
|
+
"version": "0.0.65"
|
|
83
83
|
}
|