@riebeckite/diagnostics 0.0.31 → 0.0.32

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/README.md CHANGED
@@ -5,3 +5,5 @@ Shared, serializable development diagnostics for Riebeckite tooling.
5
5
  [日本語](./README_ja.md)
6
6
 
7
7
  `collectDevelopmentDiagnostics` reuses Core inspection and output planning to produce a deterministic report for the CLI Doctor and development Inspector. It is read-only and does not trigger a build.
8
+
9
+ Pass `includeOutput: false` to collect diagnostics without the output plan, and use `diagnoseOutputPlan` to turn an output plan into output diagnostics. The development Inspector uses both to serve diagnostics before the heavier output report.
package/README_ja.md CHANGED
@@ -5,3 +5,5 @@ Riebeckite のツールで共有する、シリアライズ可能な開発診断
5
5
  [English](./README.md)
6
6
 
7
7
  `collectDevelopmentDiagnostics` は Core の inspection と output planning を再利用し、CLI Doctor と開発用 Inspector のために決定的なレポートを作成します。読み取り専用で、診断のために Build は実行しません。
8
+
9
+ `includeOutput: false` を渡すと Output Plan を含めずに診断を収集でき、`diagnoseOutputPlan` で Output Plan を Output 診断に変換できます。開発用 Inspector はこの2つを使い、重い Output レポートより先に診断を返します。
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type { DevelopmentDiagnosticsInput } from "./src/collect.js";
2
- export { collectDevelopmentDiagnostics, createDiagnosticFromError, sortDevelopmentDiagnostics, } from "./src/collect.js";
2
+ export { collectDevelopmentDiagnostics, createDiagnosticFromError, diagnoseOutputPlan, sortDevelopmentDiagnostics, } from "./src/collect.js";
3
3
  export type { DevelopmentDiagnostic, DevelopmentDiagnosticCategory, DevelopmentDiagnosticFix, DevelopmentDiagnosticLocation, DevelopmentDiagnosticReport, DevelopmentDiagnosticSeverity, DevelopmentDiagnosticStatus, DevelopmentDiagnosticSubject, DevelopmentDiagnosticSummary, } from "./src/model.js";
package/dist/index.js CHANGED
@@ -12,11 +12,13 @@ async function collectDevelopmentDiagnostics(input) {
12
12
  ];
13
13
  if (input.content) {
14
14
  await collectContentDiagnostics(input.content, diagnostics);
15
- await collectOutputDiagnostics(
16
- input.content,
17
- input.actualOutputPaths,
18
- diagnostics
19
- );
15
+ if (input.includeOutput !== false) {
16
+ await collectOutputDiagnostics(
17
+ input.content,
18
+ input.actualOutputPaths,
19
+ diagnostics
20
+ );
21
+ }
20
22
  } else {
21
23
  diagnostics.push(
22
24
  skipped(
@@ -25,13 +27,15 @@ async function collectDevelopmentDiagnostics(input) {
25
27
  "Content inspection is unavailable."
26
28
  )
27
29
  );
28
- diagnostics.push(
29
- skipped(
30
- "output",
31
- "OUTPUT_UNAVAILABLE",
32
- "Output inspection is unavailable."
33
- )
34
- );
30
+ if (input.includeOutput !== false) {
31
+ diagnostics.push(
32
+ skipped(
33
+ "output",
34
+ "OUTPUT_UNAVAILABLE",
35
+ "Output inspection is unavailable."
36
+ )
37
+ );
38
+ }
35
39
  }
36
40
  const ordered = sortDevelopmentDiagnostics(diagnostics);
37
41
  return {
@@ -69,7 +73,7 @@ async function collectOutputDiagnostics(content, actualOutputPaths, diagnostics)
69
73
  affectedPaths: new Set(changes.affected.map((output) => output.path)),
70
74
  cacheAvailable: changes.unchanged.length > 0
71
75
  });
72
- diagnostics.push(...outputDiagnostics(plan, actualOutputPaths));
76
+ diagnostics.push(...diagnoseOutputPlan(plan, actualOutputPaths));
73
77
  } catch (error) {
74
78
  diagnostics.push(
75
79
  createDiagnosticFromError(
@@ -172,7 +176,7 @@ function themeDiagnostics(config) {
172
176
  }
173
177
  ];
174
178
  }
175
- function outputDiagnostics(plan, actualOutputPaths) {
179
+ function diagnoseOutputPlan(plan, actualOutputPaths) {
176
180
  const diagnostics = plan.conflicts.map(
177
181
  (conflict) => ({
178
182
  code: "OUTPUT_OWNER_CONFLICT",
@@ -247,5 +251,6 @@ function subjectKindFor(category) {
247
251
  export {
248
252
  collectDevelopmentDiagnostics,
249
253
  createDiagnosticFromError,
254
+ diagnoseOutputPlan,
250
255
  sortDevelopmentDiagnostics
251
256
  };
@@ -1,4 +1,4 @@
1
- import { type ContentManager, type ResolvedRiebeckiteConfig } from "@riebeckite/core";
1
+ import { buildOutputPlan, type ContentManager, type ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
2
  import type { DevelopmentDiagnostic, DevelopmentDiagnosticCategory, DevelopmentDiagnosticReport } from "./model.js";
3
3
  type InspectableContent = Pick<ContentManager, "inspect" | "getOutputChangeSet">;
4
4
  export type DevelopmentDiagnosticsInput = {
@@ -6,8 +6,10 @@ export type DevelopmentDiagnosticsInput = {
6
6
  readonly content?: InspectableContent;
7
7
  readonly actualOutputPaths?: Iterable<string>;
8
8
  readonly revision?: number;
9
+ readonly includeOutput?: boolean;
9
10
  };
10
11
  export declare function collectDevelopmentDiagnostics(input: DevelopmentDiagnosticsInput): Promise<DevelopmentDiagnosticReport>;
11
12
  export declare function createDiagnosticFromError(category: DevelopmentDiagnosticCategory, code: string, message: string, _error: unknown): DevelopmentDiagnostic;
12
13
  export declare function sortDevelopmentDiagnostics(diagnostics: readonly DevelopmentDiagnostic[]): readonly DevelopmentDiagnostic[];
14
+ export declare function diagnoseOutputPlan(plan: ReturnType<typeof buildOutputPlan>, actualOutputPaths?: Iterable<string>): readonly DevelopmentDiagnostic[];
13
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/diagnostics",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,11 +20,11 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@riebeckite/core": "0.0.31"
23
+ "@riebeckite/core": "0.0.32"
24
24
  },
25
25
  "devDependencies": {
26
26
  "tsx": "^4.22.4",
27
- "@riebeckite/test": "0.0.31"
27
+ "@riebeckite/test": "0.0.32"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"