@riebeckite/plugin-analytics 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 +2 -1
- package/README_ja.md +3 -3
- package/dist/index.js +2 -10
- package/package.json +2 -2
package/README.md
CHANGED
package/README_ja.md
CHANGED
|
@@ -30,7 +30,7 @@ export default {
|
|
|
30
30
|
|
|
31
31
|
## ブラウザでの動作
|
|
32
32
|
|
|
33
|
-
Core の安定コンテンツ ID
|
|
33
|
+
Core の安定コンテンツ ID(frontmatter の `id`、互換用の `uid`)がある公開コンテンツにだけ識別子マーカーを出力します。汎用 `publicConfig` 経由で登録された `initAnalytics` は、ブラウザでドキュメントごとに一度だけ次のようなイベントを送ります。
|
|
34
34
|
|
|
35
35
|
```json
|
|
36
36
|
{
|
|
@@ -58,6 +58,6 @@ Core の安定コンテンツ ID(フロントマターの `id`、互換用の
|
|
|
58
58
|
- イベント、クエリ/結果、プロバイダ/機能、公開設定の型
|
|
59
59
|
- `UnsupportedAnalyticsQueryError` と機能確認ヘルパー
|
|
60
60
|
|
|
61
|
-
##
|
|
61
|
+
## 関連リンク
|
|
62
62
|
|
|
63
|
-
- [
|
|
63
|
+
- [プラグイン API](../../../docs/ja/docs/reference/plugin-api.md)
|
package/dist/index.js
CHANGED
|
@@ -137,7 +137,6 @@ function isInTimeRange(occurredAt, timeRange) {
|
|
|
137
137
|
|
|
138
138
|
// index.ts
|
|
139
139
|
function analytics(options) {
|
|
140
|
-
const tracked = /* @__PURE__ */ new Map();
|
|
141
140
|
return definePlugin({
|
|
142
141
|
name: "analytics",
|
|
143
142
|
options,
|
|
@@ -145,26 +144,19 @@ function analytics(options) {
|
|
|
145
144
|
clientEntries: [
|
|
146
145
|
createClientEntry("analytics", "initAnalytics", options.publicConfig)
|
|
147
146
|
],
|
|
148
|
-
onPostProcessed: ({ slug, content }) => {
|
|
149
|
-
tracked.set(slug, content);
|
|
150
|
-
},
|
|
151
147
|
onManifestCreated: ({ manifest }) => {
|
|
152
148
|
for (const entry of manifest.entries) {
|
|
153
|
-
appendContentIdentity(entry
|
|
149
|
+
appendContentIdentity(entry);
|
|
154
150
|
}
|
|
155
151
|
}
|
|
156
152
|
});
|
|
157
153
|
}
|
|
158
154
|
var analyticsPlugin = analytics;
|
|
159
|
-
function appendContentIdentity(entry
|
|
155
|
+
function appendContentIdentity(entry) {
|
|
160
156
|
if (!entry.contentId) return;
|
|
161
157
|
const marker = `<span hidden ${ANALYTICS_CONTENT_ID_ATTRIBUTE}="${escapeHtmlAttribute(entry.contentId)}"></span>`;
|
|
162
158
|
if (!entry.html.includes(ANALYTICS_CONTENT_ID_ATTRIBUTE)) {
|
|
163
159
|
entry.html = `${entry.html}
|
|
164
|
-
${marker}`;
|
|
165
|
-
}
|
|
166
|
-
if (content && !content.html.includes(ANALYTICS_CONTENT_ID_ATTRIBUTE)) {
|
|
167
|
-
content.html = `${content.html}
|
|
168
160
|
${marker}`;
|
|
169
161
|
}
|
|
170
162
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-analytics",
|
|
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",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@riebeckite/core": "0.0.
|
|
23
|
+
"@riebeckite/core": "0.0.16"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"tsx": "^4.22.4"
|