@riebeckite/plugin-diff 0.0.19 → 0.0.21
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 +1 -1
- package/README_ja.md +16 -3
- package/package.json +3 -3
package/README.md
CHANGED
package/README_ja.md
CHANGED
|
@@ -21,16 +21,29 @@ const history = await api.getHistory("notes/hello.md");
|
|
|
21
21
|
const current = await api.getCurrentDiff("notes/hello.md");
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
`diff(options?)` は API と同じ `GitHistoryReaderOptions` を受け取ります。プラグイン一覧には `diff` として登録されますが、履歴を取得する中心的な入口はプログラムから呼ぶ API です。リビジョンパネルは最初の比較だけをビルド時に描画し、選択した比較はブラウザで計算します。各リビジョンを一度だけ埋め込むため、全組み合わせの差分を出力しません。
|
|
25
|
+
|
|
24
26
|
| API | 返す内容 |
|
|
25
27
|
| --- | --- |
|
|
26
28
|
| `getHistory(filePath)` | 新しい順の `DiffRevision[]` |
|
|
27
29
|
| `getRevisionMarkdown(filePath, hash)` | その時点の Markdown。なければ `null` |
|
|
28
30
|
| `getCurrentDiff(filePath)` | 最新と一つ前のリビジョンの差分 |
|
|
29
|
-
| `compareRevisions(
|
|
31
|
+
| `compareRevisions({ filePath, fromHash, toHash })` | 指定した二つのリビジョンの差分。`fromHash: null` なら空の本文との差分 |
|
|
30
32
|
|
|
31
33
|
`cwd` は Git リポジトリを探すためのコンテンツルートで、既定値はビルド内の `config.content.directory`、それ以外では `process.cwd()` です。相対パスは `process.cwd()` 基準で解決されます。Git リポジトリ外を指定しても例外は投げず、空の結果を返します。
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
## オプションと型
|
|
36
|
+
|
|
37
|
+
| オプション | 型 | 既定値 | 内容 |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| `cwd` | `string` | `config.content.directory`、なければ `process.cwd()` | Git ワークツリーを探すコンテンツルート |
|
|
40
|
+
|
|
41
|
+
- `DiffRevision`: `hash`、`shortHash`、`date`、`message`、`author` を持つコミット情報
|
|
42
|
+
- `MarkdownRevision`: `DiffRevision` とその時点の Markdown 本文
|
|
43
|
+
- `PostDiff`: `from`、`to`、`lines` を持つ差分
|
|
44
|
+
- `DiffLine`: `{ type, content }` 形式の 1 行
|
|
45
|
+
- `DiffLineType`: `"context" | "added" | "removed"`
|
|
46
|
+
- `RevisionComparisonInput`: `{ filePath, fromHash: string | null, toHash }`
|
|
34
47
|
|
|
35
48
|
## 公開 API
|
|
36
49
|
|
|
@@ -40,4 +53,4 @@ const current = await api.getCurrentDiff("notes/hello.md");
|
|
|
40
53
|
|
|
41
54
|
## 関連資料
|
|
42
55
|
|
|
43
|
-
- [プラグインシステム](../../../docs/docs/reference/plugin-api.md)
|
|
56
|
+
- [プラグインシステム](../../../docs/docs/reference/plugin-api.ja.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-diff",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"./style.css": "./style.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@riebeckite/core": "0.0.
|
|
24
|
+
"@riebeckite/core": "0.0.21"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^24.5.2",
|
|
28
28
|
"tsx": "^4.22.4",
|
|
29
|
-
"@riebeckite/test": "0.0.
|
|
29
|
+
"@riebeckite/test": "0.0.21"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|