@riebeckite/plugin-diagnostics 0.0.31 → 0.0.33

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
@@ -149,7 +149,7 @@ assertNoErrors(report);
149
149
 
150
150
  ## Exports
151
151
 
152
- - `diagnostics(options?)` / `diagnosticsPlugin` — plugin factory
152
+ - `diagnostics(options?)` / `diagnostics` — plugin factory
153
153
  - `runDiagnostics(target, options?)` — run the analysis directly
154
154
  - `analyzeContent(config, options?)` — raw analysis returning `Diagnostic[]`
155
155
  - `hasEnabledAnalyticsPlugin(config?)` — whether the resolved config enables the analytics plugin
package/README_ja.md CHANGED
@@ -6,9 +6,9 @@
6
6
 
7
7
  [English](./README.md)
8
8
 
9
- ## まずはビルドに診断を加える
9
+ ## ビルドに診断を組み込む
10
10
 
11
- 通常は `diagnostics()` を設定に登録します。診断結果は manifest に入り、`failOnError` を有効にするとエラーがあったビルドを失敗させられます。
11
+ 通常は `diagnostics()` を設定に登録します。診断結果はマニフェストに入り、`failOnError` を有効にするとエラーがあったビルドを失敗させられます。
12
12
 
13
13
  ```ts
14
14
  import { defineConfig } from "@riebeckite/core";
@@ -26,7 +26,7 @@ export default defineConfig({
26
26
  });
27
27
  ```
28
28
 
29
- `failOnError: true` を指定すると、`buildEnd` で error レベルの Diagnostics が残っている場合に `DiagnosticsFailure` を送出します。
29
+ `failOnError: true` を指定すると、`buildEnd` で error レベルの診断が残っている場合に `DiagnosticsFailure` を送出します。
30
30
 
31
31
  ## 検出する問題
32
32
 
@@ -34,7 +34,7 @@ export default defineConfig({
34
34
  | --- | --- | --- |
35
35
  | `broken-wikilink` | error | Wiki リンクの参照先またはフラグメントを解決できない |
36
36
  | `broken-image` | error | 埋め込み画像または画像リンクの参照先がない |
37
- | `broken-link` | error | Markdown リンクが存在しない、または除外されたノートを指す |
37
+ | `broken-link` | error | Markdown リンクが存在しない、または除外されたノートやファイルを指す |
38
38
  | `unused-asset` | warning | どのノートからも参照されない画像 |
39
39
  | `orphan-note` | info | 公開ノートのうち、他のノートからリンクされていないもの |
40
40
  | `missing-frontmatter` | warning | 必須フィールドが欠けている |
@@ -45,9 +45,9 @@ export default defineConfig({
45
45
  | `invalid-content-id` | error | `id` の frontmatter が安定コンテンツ ID の要件を満たしていない |
46
46
  | `excluded-public` | warning | 除外されたノートに `publish: true` が指定されている |
47
47
  | `publish-boundary` | warning | 公開コンテンツから非公開コンテンツへリンク・埋め込みしている |
48
- | `analytics-untracked` | info | 安定 `id` のない公開ノートは analytics プラグインで計測されない(`reportAnalyticsCoverage` で有効化。設定で analytics プラグインが有効な場合は自動で有効化) |
48
+ | `analytics-untracked` | info | 安定した `id` を持たない公開ノートは analytics プラグインで計測されない(`reportAnalyticsCoverage` で有効化。設定で analytics プラグインが有効な場合は自動的に有効) |
49
49
  | `content-integrity:broken-link` | warning | 公開ページが、公開または登録されていないサイト内経路へリンクしている |
50
- | `content-integrity:unresolved-wikilink` | warning | 公開ページ内の Wiki リンクを、設定済みの解決規則で解決できない |
50
+ | `content-integrity:unresolved-wikilink` | warning | 公開ページ内の Wiki リンクを、設定済みの WikiLink / コンテンツインデックスの解決規則で解決できない |
51
51
  | `content-integrity:broken-asset` | warning | 公開ページが、解決済みアセット・プラグインアセット・生成出力・公開経路のいずれにもないローカルアセットを参照している |
52
52
  | `content-integrity:duplicate-public-location` | error | 複数の公開コンテンツまたは生成経路が、同じ最終公開パスを所有している |
53
53
  | `content-integrity:redirect-target-missing` | warning | 公開リダイレクトの転送先コンテンツが公開されない |
@@ -59,11 +59,11 @@ export default defineConfig({
59
59
 
60
60
  ## サイト全体の参照整合性
61
61
 
62
- Riebeckite のプラグインとして使う場合、リンク関係の検査はコンテンツを再走査せず、解決済み manifest から行います。`publicEntries`、解決済み `ContentLink`、`ContentPublicLocation`、`publicRedirects`、プラグインページのパス、プラグインアセット、生成出力を参照します。これにより permalink、alias、rename によるリダイレクト、l10n、公開・除外設定、Page System の扱いがビルド処理と揃います。
62
+ Riebeckite のプラグインとして使う場合、リンク関係の検査はコンテンツを再走査せず、解決済みマニフェストから行います。`publicEntries`、解決済み `ContentLink`、`ContentPublicLocation`、`publicRedirects`、プラグインページのパス、プラグインアセット、生成出力を参照します。これにより、パーマリンク、エイリアス、リネームによるリダイレクト、l10n、公開・除外設定、Page System の扱いがビルド処理と一致します。
63
63
 
64
64
  外部 URL の疎通確認、SEO、スペルチェック、Lighthouse、自動修復は行いません。`http:`、`https:`、`mailto:`、`tel:`、`data:`、プロトコル相対 URL、ページ内フラグメントだけのリンクは対象外です。経路の存在確認では、クエリ文字列とフラグメントを除いて判定します。生成ページや生成アセットを提供するプラグインは、Page Type、生成出力、アセット登録の既存の仕組みを使ってください。登録されていれば、整合性検査でも有効な公開先として扱われます。
65
65
 
66
- `runDiagnostics()` と単体 CLI は、完全な manifest を持たないため、従来の content source 解析を使います。そのため `orphan-note` と `unused-asset` は `runDiagnostics()` と単体 CLI でのみ報告されます。ビルド時はリンク関係を manifest から解決するため、これらは出力しません。
66
+ `runDiagnostics()` と単体 CLI は、完全なマニフェストを持たないため、従来のコンテンツソース解析を使います。そのため `orphan-note` と `unused-asset` は `runDiagnostics()` と単体 CLI でのみ報告されます。ビルド時はリンク関係をマニフェストから解決するので、これらは出力しません。
67
67
 
68
68
  ## 設定項目
69
69
 
@@ -78,7 +78,7 @@ Riebeckite のプラグインとして使う場合、リンク関係の検査は
78
78
  | `exclude` | `[]` | 解析対象から追加で除外する glob |
79
79
  | `publishStrategy` | 設定ファイルの値 | 公開ノートの判定方法 |
80
80
 
81
- ## CI や編集時には CLI を使う
81
+ ## CI や編集時は CLI を使う
82
82
 
83
83
  設定を読み込んで実行する場合は、次のようにします。
84
84
 
@@ -87,7 +87,7 @@ riebeckite-diagnostics --config riebeckite.config.ts
87
87
  riebeckite-diagnostics --content ./content --report-orphans
88
88
  ```
89
89
 
90
- `--format json` は機械処理用、`--exit-on warning` は警告以上を CI の失敗条件にしたい場合に使います。終了コードは、問題なしが `0`、指定したしきい値以上の診断があれば `1`、引数の誤りは `2` です。`--config` 使用時は設定内のオプションを既定値にし、CLI で明示した値を優先します。
90
+ `--format json` は機械処理用、`--exit-on warning` は警告以上を CI の失敗条件にしたい場合に使います。終了コードは、問題なしが `0`、指定したしきい値以上の診断があれば `1`、引数の誤りは `2` です。`--config` 使用時は設定内のオプションを既定値にし、CLI で明示した値を優先します。`exclude` の一覧は統合されます。
91
91
 
92
92
  | オプション | 内容 |
93
93
  | --- | --- |
@@ -121,11 +121,11 @@ console.log(formatDiagnostics(report));
121
121
  assertNoErrors(report);
122
122
  ```
123
123
 
124
- `DiagnosticsReport` には診断の一覧に加え、エラー・警告・情報の件数、コード別の集計、`hasErrors` と `hasWarnings` が入ります。
124
+ `DiagnosticsReport` には診断の一覧に加え、エラー・警告・情報の件数、集計(`summary`)、コード別の集計(`byCode`)、`hasErrors`、`hasWarnings` が入ります。
125
125
 
126
126
  ## 主なエクスポート
127
127
 
128
- - `diagnostics(options?)` / `diagnosticsPlugin`: プラグインを作成する
128
+ - `diagnostics(options?)` / `diagnostics`: プラグインを作成する
129
129
  - `runDiagnostics(target, options?)`: 診断と集計を実行する
130
130
  - `analyzeContent(config, options?)`: 生の `Diagnostic[]` を取得する
131
131
  - `hasEnabledAnalyticsPlugin(config?)`: 解決済み設定で analytics プラグインが有効かを判定する
package/dist/bin.js CHANGED
@@ -3,7 +3,8 @@ import { fileURLToPath, pathToFileURL } from "node:url";
3
3
  import { resolveConfigModule } from "@riebeckite/core";
4
4
 
5
5
  // index.ts
6
- import { definePlugin, FileSystemContentSource as FileSystemContentSource2 } from "@riebeckite/core";
6
+ import { definePlugin } from "@riebeckite/core";
7
+ import { FileSystemContentSource as FileSystemContentSource2 } from "@riebeckite/node";
7
8
 
8
9
  // src/frontmatter.ts
9
10
  function parseFrontmatter(markdown) {
@@ -227,12 +228,12 @@ function checkExcludedPublic(source, options, diagnostics) {
227
228
 
228
229
  // src/vault.ts
229
230
  import {
230
- FileSystemContentSource,
231
231
  IMAGE_EXTENSIONS,
232
232
  isAttachmentPath,
233
233
  isExcluded,
234
234
  isPublishable
235
235
  } from "@riebeckite/core";
236
+ import { FileSystemContentSource } from "@riebeckite/node";
236
237
  var NOTE_EXTENSION = "md";
237
238
  var WIKILINK_TARGET_PATTERN = /(!)?\[\[([^\]|#^]+)(?:#(\^?[^\]|]+))?(?:\|[^\]]+)?\]\]/g;
238
239
  async function scanVault(config) {
package/dist/index.d.ts CHANGED
@@ -5,7 +5,6 @@ export { assertNoErrors, buildReport, DiagnosticsFailure, formatDiagnostics, gro
5
5
  export type { AnalyzerContentConfig, DiagnosticsOptions, DiagnosticsReport, DiagnosticsSummary, } from "./src/types.js";
6
6
  export declare function runDiagnostics(target: ResolvedRiebeckiteConfig | string, options?: DiagnosticsOptions): Promise<DiagnosticsReport>;
7
7
  export declare function diagnostics(options?: DiagnosticsOptions): import("@riebeckite/core").RiebeckitePlugin<DiagnosticsOptions>;
8
- export declare const diagnosticsPlugin: typeof diagnostics;
9
8
  /**
10
9
  * Reports whether the resolved configuration enables the analytics plugin, so
11
10
  * the analytics coverage check turns itself on without coupling to the plugin.
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // index.ts
2
- import { definePlugin, FileSystemContentSource as FileSystemContentSource2 } from "@riebeckite/core";
2
+ import { definePlugin } from "@riebeckite/core";
3
+ import { FileSystemContentSource as FileSystemContentSource2 } from "@riebeckite/node";
3
4
 
4
5
  // src/frontmatter.ts
5
6
  function parseFrontmatter(markdown) {
@@ -223,12 +224,12 @@ function checkExcludedPublic(source, options, diagnostics2) {
223
224
 
224
225
  // src/vault.ts
225
226
  import {
226
- FileSystemContentSource,
227
227
  IMAGE_EXTENSIONS,
228
228
  isAttachmentPath,
229
229
  isExcluded,
230
230
  isPublishable
231
231
  } from "@riebeckite/core";
232
+ import { FileSystemContentSource } from "@riebeckite/node";
232
233
  var NOTE_EXTENSION = "md";
233
234
  var WIKILINK_TARGET_PATTERN = /(!)?\[\[([^\]|#^]+)(?:#(\^?[^\]|]+))?(?:\|[^\]]+)?\]\]/g;
234
235
  async function scanVault(config) {
@@ -1435,7 +1436,6 @@ function diagnostics(options = {}) {
1435
1436
  }
1436
1437
  });
1437
1438
  }
1438
- var diagnosticsPlugin = diagnostics;
1439
1439
  var ANALYTICS_PLUGIN_NAME = "analytics";
1440
1440
  var L10N_PLUGIN_NAME = "l10n";
1441
1441
  function hasEnabledAnalyticsPlugin(config) {
@@ -1492,7 +1492,6 @@ export {
1492
1492
  assertNoErrors,
1493
1493
  buildReport,
1494
1494
  diagnostics,
1495
- diagnosticsPlugin,
1496
1495
  formatDiagnostics,
1497
1496
  groupByCode,
1498
1497
  hasEnabledAnalyticsPlugin,
@@ -1,4 +1,4 @@
1
- export type SourcePosition = {
1
+ type SourcePosition = {
2
2
  line: number;
3
3
  column: number;
4
4
  };
@@ -7,3 +7,4 @@ export declare class LineMapper {
7
7
  constructor(text: string);
8
8
  positionAt(index: number): SourcePosition;
9
9
  }
10
+ export {};
@@ -1,7 +1,8 @@
1
- export type MarkdownReference = {
1
+ type MarkdownReference = {
2
2
  kind: "link" | "image";
3
3
  url: string;
4
4
  line: number;
5
5
  column: number;
6
6
  };
7
7
  export declare function extractMarkdownReferences(markdown: string): MarkdownReference[];
8
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { ContentManifest, Diagnostic, DiagnosticCode, DiagnosticSeverity } from "@riebeckite/core";
2
- export type SiteIntegrityOptions = {
2
+ type SiteIntegrityOptions = {
3
3
  readonly severity?: Partial<Record<DiagnosticCode, DiagnosticSeverity>>;
4
4
  };
5
5
  export declare function checkSiteIntegrity(manifest: ContentManifest, options?: SiteIntegrityOptions): Diagnostic[];
6
+ export {};
@@ -11,7 +11,7 @@ export type ScannedNote = {
11
11
  excluded: boolean;
12
12
  published: boolean;
13
13
  };
14
- export type ScannedAsset = {
14
+ type ScannedAsset = {
15
15
  relativePath: string;
16
16
  extension: string;
17
17
  };
@@ -25,12 +25,12 @@ export type ScanResult = {
25
25
  filePaths: Set<string>;
26
26
  targetIndex: Map<string, ResolvedTarget>;
27
27
  };
28
- export type TargetKind = "note" | "image" | "attachment";
29
- export type ResolvedTarget = {
28
+ type TargetKind = "note" | "image" | "attachment";
29
+ type ResolvedTarget = {
30
30
  kind: TargetKind;
31
31
  value: string;
32
32
  };
33
- export type WikilinkMatch = {
33
+ type WikilinkMatch = {
34
34
  embed: boolean;
35
35
  target: string;
36
36
  fragment: string | null;
@@ -43,7 +43,6 @@ export declare function isImageTarget(target: string): boolean;
43
43
  export declare function isAssetTarget(target: string): boolean;
44
44
  export declare function resolveLocalReference(noteSlug: string, url: string): string | null;
45
45
  export declare function resolveVaultRelative(value: string): string | null;
46
- export declare function extractHeadings(markdown: string): Set<string>;
47
- export declare function extractBlockIds(markdown: string): Set<string>;
48
46
  export declare function fragmentExists(note: ScannedNote, fragment: string): boolean;
49
47
  export declare function getExtension(filePath: string): string;
48
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-diagnostics",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,10 +17,11 @@
17
17
  "riebeckite-diagnostics": "./dist/bin.js"
18
18
  },
19
19
  "dependencies": {
20
+ "@riebeckite/core": "0.0.33",
21
+ "@riebeckite/node": "0.0.33",
20
22
  "remark-parse": "^11.0.0",
21
23
  "unified": "^11.0.5",
22
- "unist-util-visit": "^5.1.0",
23
- "@riebeckite/core": "0.0.31"
24
+ "unist-util-visit": "^5.1.0"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@types/mdast": "^4.0.4",