@riebeckite/plugin-hover-preview 0.0.14 → 0.0.15

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
@@ -76,4 +76,5 @@ hoverPreviewPlugin({
76
76
 
77
77
  ## See also
78
78
 
79
- - [Plugin guide](../../../docs/en/reference/plugin-api.md)
79
+ - [Plugin guide](../../../docs/en/docs/reference/plugin-api.md)
80
+
package/README_ja.md CHANGED
@@ -59,4 +59,5 @@ hoverPreviewPlugin({
59
59
 
60
60
  ## 関連資料
61
61
 
62
- - [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
62
+ - [プラグインシステム](../../../docs/ja/docs/reference/plugin-api.md)
63
+
package/dist/index.js CHANGED
@@ -87,11 +87,7 @@ function hasInternalLink(html) {
87
87
 
88
88
  // src/runtime.ts
89
89
  function createHoverPreviewRuntime(options) {
90
- const tracked = /* @__PURE__ */ new Map();
91
90
  return {
92
- track(slug, content) {
93
- tracked.set(slug, content);
94
- },
95
91
  inject(manifest, shouldInclude) {
96
92
  const entries = shouldInclude ? manifest.entries.filter(shouldInclude) : manifest.entries;
97
93
  const index = buildPreviewIndex(entries, {
@@ -103,10 +99,7 @@ function createHoverPreviewRuntime(options) {
103
99
  for (const entry of entries) {
104
100
  if (!hasInternalLink(entry.html)) continue;
105
101
  if (entry.html.includes(HOVER_PREVIEW_ATTRIBUTE)) continue;
106
- const html = `${entry.html}${payload}`;
107
- entry.html = html;
108
- const content = tracked.get(entry.slug);
109
- if (content) content.html = html;
102
+ entry.html = `${entry.html}${payload}`;
110
103
  }
111
104
  }
112
105
  };
@@ -289,11 +282,13 @@ function hoverPreviewPlugin(options = {}) {
289
282
  const runtime = createHoverPreviewRuntime(resolved);
290
283
  return definePlugin({
291
284
  name: "hover-preview",
285
+ processedContentCache: {
286
+ version: "hover-preview-v1",
287
+ dependencyMode: "none"
288
+ },
289
+ outputDependencies: [{ type: "global" }],
292
290
  options,
293
291
  validateOptions: validateHoverPreviewOptions,
294
- onPostProcessed: (context) => {
295
- runtime.track(context.slug, context.content);
296
- },
297
292
  onManifestCreated: (context) => {
298
293
  const strategy = context.config?.content.filters.publishStrategy ?? "explicit";
299
294
  runtime.inject(
@@ -1,7 +1,6 @@
1
- import type { ContentManifest, ContentManifestEntry, PostContent } from "@riebeckite/core";
1
+ import type { ContentManifest, ContentManifestEntry } from "@riebeckite/core";
2
2
  import type { ResolvedHoverPreviewOptions } from "./types.js";
3
3
  export type HoverPreviewRuntime = {
4
- track(slug: string, content: PostContent): void;
5
4
  inject(manifest: ContentManifest, shouldInclude?: (entry: ContentManifestEntry) => boolean): void;
6
5
  };
7
6
  export declare function createHoverPreviewRuntime(options: ResolvedHoverPreviewOptions): HoverPreviewRuntime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-hover-preview",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "./style.css": "./style.css"
22
22
  },
23
23
  "dependencies": {
24
- "@riebeckite/core": "0.0.14"
24
+ "@riebeckite/core": "0.0.15"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"