@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 +2 -1
- package/README_ja.md +2 -1
- package/dist/index.js +6 -11
- package/dist/src/runtime.d.ts +1 -2
- package/package.json +2 -2
package/README.md
CHANGED
package/README_ja.md
CHANGED
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
|
-
|
|
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(
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { ContentManifest, ContentManifestEntry
|
|
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.
|
|
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.
|
|
24
|
+
"@riebeckite/core": "0.0.15"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|