@riebeckite/honox 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/server.js CHANGED
@@ -54,10 +54,11 @@ async function pluginPageSsgParams(content, parameter = "slug") {
54
54
  return paths.filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
55
55
  }
56
56
  async function riebeckiteSsgParams(content, parameter = "slug") {
57
- const [manifest, changeSet] = await Promise.all([
58
- content.getManifest({ incremental: true }),
59
- content.getOutputChangeSet({ incremental: true })
60
- ]);
57
+ const changeSet = await content.getOutputChangeSet({ incremental: true });
58
+ if (process.env.RIEBECKITE_SSG_SKIP_UNCHANGED === "1" && !changeSet.fullRegenerationRequired && changeSet.affected.length === 0) {
59
+ return [];
60
+ }
61
+ const manifest = await content.getManifest({ incremental: true });
61
62
  if (changeSet.fullRegenerationRequired || process.env.RIEBECKITE_SSG_FULL_REGENERATION === "1") {
62
63
  return [
63
64
  ...manifest.publicEntries.filter((entry) => entry.permalink !== "/").map((entry) => ({ [parameter]: entry.permalink.replace(/^\/+/, "") })),
@@ -68,7 +69,7 @@ async function riebeckiteSsgParams(content, parameter = "slug") {
68
69
  const affected = new Set(
69
70
  changeSet.affected.filter((output) => output.kind !== "generated").map((output) => output.path)
70
71
  );
71
- const contentParams = manifest.publicEntries.filter((entry) => affected.has(routeOutputPath(entry.permalink))).map((entry) => ({ [parameter]: entry.permalink.replace(/^\/+/, "") }));
72
+ const contentParams = manifest.publicEntries.filter((entry) => affected.has(routeOutputPath(entry.permalink))).filter((entry) => entry.permalink !== "/").map((entry) => ({ [parameter]: entry.permalink.replace(/^\/+/, "") }));
72
73
  const redirectParams = [...manifest.publicRedirects.keys()].filter((path) => affected.has(routeOutputPath(path))).filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
73
74
  const pluginPageParams = (await content.getPagePaths()).filter((path) => affected.has(routeOutputPath(path))).filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
74
75
  return [...contentParams, ...redirectParams, ...pluginPageParams];
@@ -0,0 +1 @@
1
+ export declare function siteRiebeckiteExternals(siteRoot: string): string[];
@@ -2,14 +2,30 @@ import { toSSG } from "hono/ssg";
2
2
  import { type ConfigEnv, type Plugin } from "vite";
3
3
  type ToSsgOptions = NonNullable<Parameters<typeof toSSG>[2]>;
4
4
  type OutputCacheEntry = {
5
- source: string;
6
- encoding: "utf8" | "base64";
5
+ cachePath: string;
6
+ checksum: string;
7
7
  };
8
8
  type OutputCacheState = {
9
- version: 1;
9
+ version: 4;
10
10
  appFingerprint?: string;
11
+ clientManifestFingerprint?: string;
11
12
  outputs: Record<string, OutputCacheEntry>;
13
+ finalOutputInventory?: Record<string, string>;
14
+ publicDirectory?: string;
15
+ publicFingerprint?: string;
16
+ configFile?: string;
12
17
  };
18
+ export type NoChangeFastPathResult = {
19
+ readonly used: boolean;
20
+ readonly blockReason?: string;
21
+ };
22
+ export type NoChangeFastPathOutputMetrics = {
23
+ outputInventoryValidationDurationMs: number;
24
+ outputHashValidationDurationMs: number;
25
+ outputFilesHashed: number;
26
+ outputBytesHashed: number;
27
+ };
28
+ export declare function createNoChangeFastPathOutputMetrics(): NoChangeFastPathOutputMetrics;
13
29
  export type RiebeckiteSsgOptions = {
14
30
  entry?: string;
15
31
  plugins?: ToSsgOptions["plugins"];
@@ -18,8 +34,14 @@ export type RiebeckiteSsgOptions = {
18
34
  export declare function riebeckiteSsg(options?: RiebeckiteSsgOptions): Plugin;
19
35
  export declare function shouldApplyRiebeckiteSsg(_config: unknown, env: ConfigEnv): boolean;
20
36
  export declare function findBuildOutputSiteCollisions(buildOutputPaths: Iterable<string>, siteOwnedOutputPaths: ReadonlySet<string>): readonly string[];
37
+ export declare function verifyNoChangeFastPath(input: {
38
+ readonly root: string;
39
+ readonly outputDirectory: string;
40
+ readonly expectedOutputPaths: readonly string[];
41
+ readonly metrics?: NoChangeFastPathOutputMetrics;
42
+ }): Promise<NoChangeFastPathResult>;
21
43
  export declare function loadOutputCache(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
22
44
  fileSizeBytes?: number;
23
45
  }) | undefined>;
24
- export declare function saveOutputCache(path: string, state: OutputCacheState, timingsMs?: Record<string, number>): Promise<void>;
46
+ export declare function saveOutputCache(path: string, state: OutputCacheState, outputDirectory: string, timingsMs?: Record<string, number>): Promise<string>;
25
47
  export {};
@@ -1,4 +1,4 @@
1
- import type { ContentBodySlot, ContentBodySlots, PluginHeadTag, ResolvedRiebeckiteConfig } from "@riebeckite/core";
1
+ import type { PluginHeadTag, ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
2
  export type PrimitiveChildren = unknown;
3
3
  export type PrimitiveProps = {
4
4
  children?: PrimitiveChildren;
@@ -41,24 +41,12 @@ export declare function ArticleContent(props: ArticleContentProps): import("hono
41
41
  export type ArticleBodyProps = PrimitiveClassProps & {
42
42
  html: string;
43
43
  };
44
- export type ContentSlotProps = PrimitiveClassProps & {
45
- slots?: ContentBodySlots;
46
- name: ContentBodySlot;
44
+ export type HtmlFragmentSource = "markdown" | "plugin-page";
45
+ export type HtmlFragmentProps = {
46
+ html: string;
47
+ source: HtmlFragmentSource;
47
48
  };
48
- /**
49
- * Whether a body slot holds renderable content.
50
- *
51
- * A slot is absent when its source map is missing, the value is missing, or
52
- * the value is whitespace-only. This is the same check `ContentSlot` uses.
53
- */
54
- export declare function hasSlot(slots: ContentBodySlots | undefined, name: ContentBodySlot): boolean;
55
- /**
56
- * Renders a Plugin-provided body slot fragment at the position the Site chose.
57
- *
58
- * The Site owns placement; this primitive owns the lookup, empty handling, and
59
- * HTML injection. It renders nothing when the slot is absent or blank.
60
- */
61
- export declare function ContentSlot(props: ContentSlotProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
49
+ export declare function HtmlFragment(props: HtmlFragmentProps): import("hono/utils/html").HtmlEscapedString;
62
50
  /**
63
51
  * Renders Markdown-produced HTML as the canonical article body.
64
52
  *
@@ -1,5 +1,6 @@
1
1
  // src/ui/primitives.tsx
2
2
  import { ColorModeScript } from "@riebeckite/plugin-color-mode";
3
+ import { raw } from "hono/html";
3
4
  import { Link, Script } from "honox/server";
4
5
  import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime";
5
6
  import { createElement } from "hono/jsx";
@@ -58,22 +59,8 @@ function ArticleContent(props) {
58
59
  const dataSlot = props["data-slot"] ?? "article-body";
59
60
  return /* @__PURE__ */ jsx("div", { class: className, "data-slot": dataSlot, children: props.children });
60
61
  }
61
- function hasSlot(slots, name) {
62
- return Boolean(slots?.[name]?.trim());
63
- }
64
- function ContentSlot(props) {
65
- const html = props.slots?.[props.name];
66
- if (!html?.trim()) {
67
- return null;
68
- }
69
- return /* @__PURE__ */ jsx(
70
- "div",
71
- {
72
- "data-slot": props.name,
73
- class: joinClassNames(props.class, props.className) || void 0,
74
- dangerouslySetInnerHTML: { __html: html }
75
- }
76
- );
62
+ function HtmlFragment(props) {
63
+ return raw(props.html);
77
64
  }
78
65
  function ArticleBody(props) {
79
66
  return /* @__PURE__ */ jsx(
@@ -172,12 +159,11 @@ export {
172
159
  ArticleHeader,
173
160
  ArticleLayout,
174
161
  ArticleMeta,
175
- ContentSlot,
162
+ HtmlFragment,
176
163
  PageBody,
177
164
  PluginHeadTags,
178
165
  RiebeckiteHead,
179
166
  Sidebar,
180
167
  ThemeRoot,
181
- hasSlot,
182
168
  themeRootAttributes
183
169
  };
@@ -1,5 +1,6 @@
1
1
  import type { Plugin } from "vite";
2
2
  import type { RiebeckiteSsgOptions } from "./ssg_plugin.js";
3
+ import { type ResolvedHonoxApplication } from "./vite_runner.js";
3
4
  export type RiebeckiteIntegrationOptions = {
4
5
  configRoot?: string;
5
6
  workspaceRoot?: string;
@@ -18,7 +19,7 @@ export type RiebeckiteViteOptions = RiebeckiteIntegrationOptions & {
18
19
  /** SSG overrides. A normal site does not need them. */
19
20
  ssg?: RiebeckiteSsgOptions;
20
21
  };
21
- export declare function riebeckite(options?: RiebeckiteIntegrationOptions): Plugin[];
22
+ export declare function riebeckite(options?: RiebeckiteIntegrationOptions, onApplicationResolved?: (application: ResolvedHonoxApplication) => void): Plugin[];
22
23
  /**
23
24
  * Higher-level helper that registers the complete Riebeckite Vite integration
24
25
  * without exposing internal Vite/HonoX/SSR details. A site only needs to add
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/honox",
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",
@@ -38,12 +38,12 @@
38
38
  "hono": "^4.12.25",
39
39
  "honox": "0.1.56",
40
40
  "vite": "^8.0.9",
41
- "@riebeckite/plugin-color-mode": "0.0.22",
42
- "@riebeckite/core": "0.0.22"
41
+ "@riebeckite/plugin-color-mode": "0.0.23",
42
+ "@riebeckite/core": "0.0.23"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsx": "^4.22.4",
46
- "@riebeckite/test": "0.0.22"
46
+ "@riebeckite/test": "0.0.23"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"