@riebeckite/plugin-hover-preview 0.0.22 → 0.0.23

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/dist/index.js CHANGED
@@ -89,18 +89,23 @@ function hasInternalLink(html) {
89
89
  // src/runtime.ts
90
90
  function createHoverPreviewRuntime(options) {
91
91
  return {
92
- inject(manifest, output, shouldInclude) {
93
- const entries = shouldInclude ? manifest.entries.filter(shouldInclude) : manifest.entries;
92
+ plan(entries) {
94
93
  const index = buildPreviewIndex(entries, {
95
94
  excerptLength: options.excerptLength,
96
95
  ...options.maxEntries === void 0 ? {} : { maxEntries: options.maxEntries }
97
96
  });
98
- if (Object.keys(index).length === 0) return;
99
- output.emit({
100
- path: HOVER_PREVIEW_INDEX_PATH,
101
- content: JSON.stringify(index),
102
- dependencies: [{ type: "global" }]
103
- });
97
+ if (Object.keys(index).length === 0) return [];
98
+ return [
99
+ {
100
+ path: HOVER_PREVIEW_INDEX_PATH,
101
+ content: JSON.stringify(index),
102
+ dependencies: [{ type: "global" }]
103
+ }
104
+ ];
105
+ },
106
+ inject(manifest, shouldInclude) {
107
+ const entries = shouldInclude ? manifest.entries.filter(shouldInclude) : manifest.entries;
108
+ if (this.plan(entries).length === 0) return;
104
109
  const payload = renderHoverPreviewPayload(
105
110
  options,
106
111
  `/${HOVER_PREVIEW_INDEX_PATH}`
@@ -309,19 +314,27 @@ function hoverPreviewPlugin(options = {}) {
309
314
  version: "hover-preview-v1",
310
315
  dependencyMode: "none"
311
316
  },
312
- outputDependencies: [{ type: "global" }],
317
+ contentOutputDependencies: [{ type: "global" }],
313
318
  options,
314
319
  validateOptions: validateHoverPreviewOptions,
315
320
  onManifestCreated: (context) => {
316
321
  const publicEntries = new Set(context.manifest.publicEntries);
317
- runtime.inject(
318
- context.manifest,
319
- context.output,
320
- (entry) => publicEntries.has(entry)
321
- );
322
+ runtime.inject(context.manifest, (entry) => publicEntries.has(entry));
322
323
  },
323
- assets: [createStyleAsset("hover-preview")],
324
- clientEntries: [createClientEntry("hover-preview", "initHoverPreview")]
324
+ planGeneratedOutputs: ({ manifest }) => runtime.plan(manifest.routableEntries),
325
+ assets: [
326
+ createStyleAsset(
327
+ "hover-preview",
328
+ "@riebeckite/plugin-hover-preview/style.css"
329
+ )
330
+ ],
331
+ clientEntries: [
332
+ createClientEntry(
333
+ "hover-preview",
334
+ "@riebeckite/plugin-hover-preview/client",
335
+ "initHoverPreview"
336
+ )
337
+ ]
325
338
  });
326
339
  }
327
340
  var hoverPreview = hoverPreviewPlugin;
@@ -1,6 +1,7 @@
1
- import type { ContentManifest, ContentManifestEntry, GeneratedOutputSink } from "@riebeckite/core";
1
+ import type { ContentManifest, ContentManifestEntry, PlannedGeneratedOutput } from "@riebeckite/core";
2
2
  import type { ResolvedHoverPreviewOptions } from "./types.js";
3
3
  export type HoverPreviewRuntime = {
4
- inject(manifest: ContentManifest, output: GeneratedOutputSink, shouldInclude?: (entry: ContentManifestEntry) => boolean): void;
4
+ plan(entries: readonly ContentManifestEntry[]): readonly PlannedGeneratedOutput[];
5
+ inject(manifest: ContentManifest, shouldInclude?: (entry: ContentManifestEntry) => boolean): void;
5
6
  };
6
7
  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.22",
3
+ "version": "0.0.23",
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.22"
24
+ "@riebeckite/core": "0.0.23"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"