@riebeckite/plugin-webmention 0.0.14 → 0.0.16
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 +4 -3
- package/README_ja.md +6 -5
- package/dist/index.js +6 -13
- package/package.json +2 -2
- package/style.css +0 -5
package/README.md
CHANGED
|
@@ -57,8 +57,8 @@ Rejection codes: `invalid_request`, `missing_source_or_target`,
|
|
|
57
57
|
## Rendering
|
|
58
58
|
|
|
59
59
|
At `onManifestCreated` the plugin queries the provider once, groups verified
|
|
60
|
-
mentions by target, and appends a section to each matching entry's HTML
|
|
61
|
-
the
|
|
60
|
+
mentions by target, and appends a section to each matching entry's HTML. Core
|
|
61
|
+
synchronizes that HTML with the content the route renders, using stable hooks:
|
|
62
62
|
|
|
63
63
|
```html
|
|
64
64
|
<section class="rr-webmention" data-webmention data-webmention-count="2">
|
|
@@ -115,5 +115,6 @@ manifest time, mentions whose target is not a published entry are reported as
|
|
|
115
115
|
|
|
116
116
|
## See also
|
|
117
117
|
|
|
118
|
-
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
118
|
+
- [Plugin guide](../../../docs/en/docs/reference/plugin-api.md)
|
|
119
119
|
- [@riebeckite/webmention-cloudflare](../../integrations/webmention-cloudflare/README.md)
|
|
120
|
+
|
package/README_ja.md
CHANGED
|
@@ -13,12 +13,12 @@ Webmention を受信し、送信元ドキュメントが本当にターゲット
|
|
|
13
13
|
capability を公開し、`store(mention)` と `query(query)` を持ちます。認証情報・
|
|
14
14
|
データベースハンドル・実行時バインディングは adapter 内に留まり、プラグインの
|
|
15
15
|
options や生成物へ漏れません。
|
|
16
|
-
- `MemoryWebmentionProvider`
|
|
16
|
+
- `MemoryWebmentionProvider` はテスト・ローカルプレビューで使う provider の例として
|
|
17
17
|
同梱されています。プロセス/isolate をまたいで永続化はしません。
|
|
18
18
|
- プラグインは `endpoints` を宣言します。`POST {endpoint}` が Webmention を受信し、
|
|
19
19
|
`GET {endpoint}` が検証済みメンションのフィードを返します。ルートフレームワークの
|
|
20
20
|
詳細はこのパッケージへ入りません。HonoX 連携(`mountRiebeckiteEndpoints`)が
|
|
21
|
-
|
|
21
|
+
エンドポイントをホストルーターへマウントします。
|
|
22
22
|
- 検証は注入可能な `WebmentionSourceFetcher` を通じて送信元を取得し、ターゲットへの
|
|
23
23
|
発リンクを確認したうえで、軽量な引用メタデータ(title・excerpt・author・公開日・
|
|
24
24
|
`rel` 由来の種別)を記録します。既定の fetcher は loopback とプライベートネット
|
|
@@ -55,8 +55,8 @@ provider を省略するとインメモリ provider が使われます。ロー
|
|
|
55
55
|
## 表示
|
|
56
56
|
|
|
57
57
|
`onManifestCreated` で provider を一度 query し、検証済みメンションをターゲット別に
|
|
58
|
-
グループ化して、対応する entry の HTML
|
|
59
|
-
|
|
58
|
+
グループ化して、対応する entry の HTML へセクションを追記します。Core がその HTML を
|
|
59
|
+
コンテンツルートの描画 HTML と同期します。フックは安定した `rr-webmention` 名です。
|
|
60
60
|
|
|
61
61
|
```html
|
|
62
62
|
<section class="rr-webmention" data-webmention data-webmention-count="2">
|
|
@@ -112,5 +112,6 @@ manifest 生成時、公開 entry に一致しないターゲットのメンシ
|
|
|
112
112
|
|
|
113
113
|
## 関連
|
|
114
114
|
|
|
115
|
-
- [プラグインガイド](../../../docs/ja/reference/plugin-api.md)
|
|
115
|
+
- [プラグインガイド](../../../docs/ja/docs/reference/plugin-api.md)
|
|
116
116
|
- [@riebeckite/webmention-cloudflare](../../integrations/webmention-cloudflare/README_ja.md)
|
|
117
|
+
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// index.ts
|
|
2
|
-
import {
|
|
3
|
-
createStyleAsset,
|
|
4
|
-
definePlugin
|
|
5
|
-
} from "@riebeckite/core";
|
|
2
|
+
import { createStyleAsset, definePlugin } from "@riebeckite/core";
|
|
6
3
|
|
|
7
4
|
// src/provider.ts
|
|
8
5
|
var WEBMENTION_CAPABILITIES = ["store", "query"];
|
|
@@ -1044,17 +1041,17 @@ var webmentionPlugin = webmention;
|
|
|
1044
1041
|
function webmention(options = {}) {
|
|
1045
1042
|
const resolved = resolveWebmentionOptions(options);
|
|
1046
1043
|
const provider = resolved.provider;
|
|
1047
|
-
const processed = /* @__PURE__ */ new Map();
|
|
1048
1044
|
return definePlugin({
|
|
1049
1045
|
name: WEBMENTION_PLUGIN_NAME,
|
|
1046
|
+
processedContentCache: {
|
|
1047
|
+
version: "webmention-v1",
|
|
1048
|
+
dependencyMode: "none"
|
|
1049
|
+
},
|
|
1050
|
+
outputDependencies: [{ type: "unknown" }],
|
|
1050
1051
|
options,
|
|
1051
1052
|
validateOptions: validateWebmentionOptions,
|
|
1052
|
-
onPostProcessed: ({ slug, content }) => {
|
|
1053
|
-
processed.set(slug, content);
|
|
1054
|
-
},
|
|
1055
1053
|
onManifestCreated: async (context) => {
|
|
1056
1054
|
if (!resolved.render || !supportsWebmentionCapability(provider, "query")) {
|
|
1057
|
-
processed.clear();
|
|
1058
1055
|
return;
|
|
1059
1056
|
}
|
|
1060
1057
|
let mentions;
|
|
@@ -1071,7 +1068,6 @@ function webmention(options = {}) {
|
|
|
1071
1068
|
cause: error instanceof Error ? error.message : String(error)
|
|
1072
1069
|
}
|
|
1073
1070
|
});
|
|
1074
|
-
processed.clear();
|
|
1075
1071
|
return;
|
|
1076
1072
|
}
|
|
1077
1073
|
const grouped = groupMentionsBySlug(
|
|
@@ -1088,8 +1084,6 @@ function webmention(options = {}) {
|
|
|
1088
1084
|
);
|
|
1089
1085
|
if (section === "") continue;
|
|
1090
1086
|
entry.html = `${entry.html}${section}`;
|
|
1091
|
-
const content = processed.get(slug);
|
|
1092
|
-
if (content) content.html = entry.html;
|
|
1093
1087
|
}
|
|
1094
1088
|
const unmatched = countUnmatchedMentions(
|
|
1095
1089
|
context.manifest,
|
|
@@ -1104,7 +1098,6 @@ function webmention(options = {}) {
|
|
|
1104
1098
|
message: `${unmatched} verified webmention(s) target a URL that is not a published entry and were not rendered.`
|
|
1105
1099
|
});
|
|
1106
1100
|
}
|
|
1107
|
-
processed.clear();
|
|
1108
1101
|
},
|
|
1109
1102
|
endpoints: createWebmentionEndpoints(resolved),
|
|
1110
1103
|
assets: [createStyleAsset(WEBMENTION_PLUGIN_NAME)],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-webmention",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"./style.css": "./style.css"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@riebeckite/core": "0.0.
|
|
18
|
+
"@riebeckite/core": "0.0.16"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tsx": "^4.22.4"
|