@riebeckite/honox 0.0.45 → 0.0.48

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.
Files changed (45) hide show
  1. package/dist/index.js +2204 -1778
  2. package/dist/runtime.js +30 -0
  3. package/dist/server.js +80 -49
  4. package/dist/src/client_module.d.ts +1 -3
  5. package/dist/src/client_module_part1.d.ts +5 -0
  6. package/dist/src/client_module_part2.d.ts +2 -0
  7. package/dist/src/content_route.d.ts +3 -88
  8. package/dist/src/content_route_part1.d.ts +37 -0
  9. package/dist/src/content_route_part2.d.ts +8 -0
  10. package/dist/src/runtime_modules.d.ts +1 -0
  11. package/dist/src/spa_diagnostics.d.ts +4 -0
  12. package/dist/src/ssg/output_cache.d.ts +5 -37
  13. package/dist/src/ssg/output_cache_decision.d.ts +9 -0
  14. package/dist/src/ssg/output_cache_entries.d.ts +5 -0
  15. package/dist/src/ssg/output_cache_fastpath.d.ts +12 -0
  16. package/dist/src/ssg/output_cache_load.d.ts +8 -0
  17. package/dist/src/ssg/output_cache_paths.d.ts +13 -0
  18. package/dist/src/ssg/output_cache_replace.d.ts +6 -0
  19. package/dist/src/ssg/output_cache_save.d.ts +2 -0
  20. package/dist/src/ssg/output_cache_types.d.ts +33 -0
  21. package/dist/src/ssg/output_cache_validate.d.ts +8 -0
  22. package/dist/src/ssg/standalone.d.ts +1 -0
  23. package/dist/src/ssg_plugin.d.ts +3 -12
  24. package/dist/src/ssg_plugin_cleanup.d.ts +3 -0
  25. package/dist/src/ssg_plugin_close.d.ts +2 -0
  26. package/dist/src/ssg_plugin_generate_finalize.d.ts +3 -0
  27. package/dist/src/ssg_plugin_generate_prepare.d.ts +52 -0
  28. package/dist/src/ssg_plugin_generate_run.d.ts +3 -0
  29. package/dist/src/ssg_plugin_helpers.d.ts +21 -0
  30. package/dist/src/ssg_plugin_setup.d.ts +20 -0
  31. package/dist/src/ssg_plugin_state.d.ts +52 -0
  32. package/dist/src/ui/primitives.d.ts +4 -126
  33. package/dist/src/ui/primitives.js +110 -88
  34. package/dist/src/ui/primitives_article.d.ts +9 -0
  35. package/dist/src/ui/primitives_head.d.ts +8 -0
  36. package/dist/src/ui/primitives_page.d.ts +3 -0
  37. package/dist/src/ui/primitives_theme.d.ts +7 -0
  38. package/dist/src/ui/primitives_types.d.ts +82 -0
  39. package/dist/src/virtual_modules.d.ts +4 -0
  40. package/dist/src/vite_plugin.d.ts +4 -9
  41. package/dist/src/vite_plugin_helpers.d.ts +12 -0
  42. package/dist/src/vite_runner.d.ts +3 -36
  43. package/dist/src/vite_runner_helpers.d.ts +40 -0
  44. package/package.json +11 -11
  45. package/style.css +6 -1
package/dist/runtime.js CHANGED
@@ -5,9 +5,39 @@ import {
5
5
 
6
6
  // src/resolved_config.ts
7
7
  import path from "node:path";
8
+
9
+ // src/spa_diagnostics.ts
10
+ import {
11
+ definePlugin
12
+ } from "@riebeckite/core";
13
+ var SPA_DIAGNOSTICS_PLUGIN_NAME = "riebeckite:spa-diagnostics";
14
+ var MAIN_CONTENT_PATTERN = /<main\b[^>]*\bid=["']main-content["']/iu;
15
+ var REDIRECT_PATTERN = /<meta\b[^>]*\bhttp-equiv=["']refresh["'][^>]*\bcontent=["'][^"']*\burl=/iu;
16
+ function inspectSpaPage(page) {
17
+ if (REDIRECT_PATTERN.test(page.html)) return [];
18
+ if (MAIN_CONTENT_PATTERN.test(page.html)) return [];
19
+ return [
20
+ {
21
+ code: "spa-missing-main-content",
22
+ severity: "error",
23
+ message: 'SPA navigation is enabled but this page has no <main id="main-content">. Add one to the page layout, or disable SPA for the site.',
24
+ filePath: page.path,
25
+ suggestion: 'Render <main id="main-content" tabindex={-1}> around the page body.'
26
+ }
27
+ ];
28
+ }
29
+ function spaDiagnostics() {
30
+ return definePlugin({
31
+ name: SPA_DIAGNOSTICS_PLUGIN_NAME,
32
+ inspectGeneratedHtml: inspectSpaPage
33
+ });
34
+ }
35
+
36
+ // src/resolved_config.ts
8
37
  function resolveHonoxConfig(config, appRoot) {
9
38
  return {
10
39
  ...config,
40
+ plugins: config.spa === void 0 ? config.plugins : [...config.plugins, spaDiagnostics()],
11
41
  buildDirectory: path.join(appRoot, ".riebeckite"),
12
42
  outputDirectory: path.join(appRoot, "dist"),
13
43
  content: {
package/dist/server.js CHANGED
@@ -1,5 +1,45 @@
1
- // src/content_route.ts
2
- import { getEntryLanguage, htmlOutputPath } from "@riebeckite/core";
1
+ // src/content_route_part1.ts
2
+ import {
3
+ getEntryLanguage
4
+ } from "@riebeckite/core";
5
+
6
+ // src/content_route_part2.ts
7
+ import { htmlOutputPath } from "@riebeckite/core";
8
+ function ssgEnumerableHandler(handler) {
9
+ const enumerable = (...args) => Reflect.apply(handler, void 0, args);
10
+ return enumerable;
11
+ }
12
+ function isDynamicRoute(path) {
13
+ return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
14
+ }
15
+ function normalizeRequestPath(pathname) {
16
+ const trailingSlash = pathname.length > 1 && pathname.endsWith("/");
17
+ const segments = pathname.split("/").filter(Boolean).map(encodeSegment);
18
+ const path = `/${segments.join("/")}`;
19
+ return trailingSlash ? `${path}/` : path;
20
+ }
21
+ function redirectSsgPaths(manifest) {
22
+ const paths = [];
23
+ for (const [path, redirect] of manifest.publicRedirects) {
24
+ const permalink = manifest.bySlug.get(redirect.slug)?.permalink;
25
+ if (permalink && htmlOutputPath(permalink) === routeOutputPath(path))
26
+ continue;
27
+ paths.push(path);
28
+ }
29
+ return paths;
30
+ }
31
+ function routeOutputPath(pathname) {
32
+ return htmlOutputPath(pathname);
33
+ }
34
+ function encodeSegment(segment) {
35
+ try {
36
+ return encodeURIComponent(decodeURIComponent(segment));
37
+ } catch {
38
+ return encodeURIComponent(segment);
39
+ }
40
+ }
41
+
42
+ // src/content_route_part1.ts
3
43
  async function resolveRiebeckiteRoute(content, pathname) {
4
44
  const page = await content.resolvePage(pathname);
5
45
  if (page) return { kind: "page", page };
@@ -105,39 +145,6 @@ function contentRouteSsgParams(routePath, params) {
105
145
  return c.notFound();
106
146
  };
107
147
  }
108
- function ssgEnumerableHandler(handler) {
109
- const enumerable = (...args) => Reflect.apply(handler, void 0, args);
110
- return enumerable;
111
- }
112
- function isDynamicRoute(path) {
113
- return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
114
- }
115
- function normalizeRequestPath(pathname) {
116
- const trailingSlash = pathname.length > 1 && pathname.endsWith("/");
117
- const segments = pathname.split("/").filter(Boolean).map(encodeSegment);
118
- const path = `/${segments.join("/")}`;
119
- return trailingSlash ? `${path}/` : path;
120
- }
121
- function redirectSsgPaths(manifest) {
122
- const paths = [];
123
- for (const [path, redirect] of manifest.publicRedirects) {
124
- const permalink = manifest.bySlug.get(redirect.slug)?.permalink;
125
- if (permalink && htmlOutputPath(permalink) === routeOutputPath(path))
126
- continue;
127
- paths.push(path);
128
- }
129
- return paths;
130
- }
131
- function routeOutputPath(pathname) {
132
- return htmlOutputPath(pathname);
133
- }
134
- function encodeSegment(segment) {
135
- try {
136
- return encodeURIComponent(decodeURIComponent(segment));
137
- } catch {
138
- return encodeURIComponent(segment);
139
- }
140
- }
141
148
 
142
149
  // src/endpoints.ts
143
150
  function mountRiebeckiteEndpoints(app, options) {
@@ -307,28 +314,40 @@ import {
307
314
  useSiteContext
308
315
  } from "@riebeckite/ui";
309
316
 
310
- // src/ui/primitives.tsx
311
- import { escapeScriptJson, uniqueStrings } from "@riebeckite/core";
312
- import { ColorModeScript } from "@riebeckite/plugin-color-mode";
317
+ // src/ui/primitives_theme.tsx
318
+ import { uniqueStrings } from "@riebeckite/core";
319
+ import { jsx } from "hono/jsx/jsx-runtime";
320
+ function joinClassNames(...classNames) {
321
+ return classNames.filter(Boolean).join(" ");
322
+ }
323
+
324
+ // src/ui/primitives_page.tsx
313
325
  import { raw } from "hono/html";
314
- import { Link, Script } from "honox/server";
315
- import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime";
316
- import { createElement } from "hono/jsx";
326
+ import { jsx as jsx2 } from "hono/jsx/jsx-runtime";
317
327
  function PageBody(props) {
318
- return /* @__PURE__ */ jsx(
328
+ return /* @__PURE__ */ jsx2(
319
329
  "div",
320
330
  {
321
331
  class: joinClassNames("rb-page-body", props.class, props.className),
332
+ "data-rb-page-layout": props.layout ?? "wide",
322
333
  dangerouslySetInnerHTML: { __html: props.html }
323
334
  }
324
335
  );
325
336
  }
326
- function joinClassNames(...classNames) {
327
- return classNames.filter(Boolean).join(" ");
328
- }
329
337
 
330
338
  // src/routes.tsx
331
- import { jsx as jsx2 } from "hono/jsx/jsx-runtime";
339
+ import { jsx as jsx3 } from "hono/jsx/jsx-runtime";
340
+ async function renderContentBody(sourcePath) {
341
+ try {
342
+ const { renderContent: renderContent2 } = await import("virtual:riebeckite/content-renderers");
343
+ return renderContent2(sourcePath);
344
+ } catch (error) {
345
+ if (error.code === "ERR_UNSUPPORTED_ESM_URL_SCHEME") {
346
+ return void 0;
347
+ }
348
+ throw error;
349
+ }
350
+ }
332
351
  function createContentRoute(options) {
333
352
  const path = options.path ?? "/:slug{.+}";
334
353
  const parameter = options.parameter ?? "slug";
@@ -346,7 +365,9 @@ function createContentRoute(options) {
346
365
  if (resolved.kind === "response") return resolved.response;
347
366
  applySeoContext(c, options.config, resolved);
348
367
  if (resolved.kind === "page")
349
- return c.render(/* @__PURE__ */ jsx2(PageBody, { html: resolved.page.body }));
368
+ return c.render(
369
+ /* @__PURE__ */ jsx3(PageBody, { html: resolved.page.body, layout: resolved.page.layout })
370
+ );
350
371
  return renderContent(c, options, resolved.entry, resolved.post);
351
372
  }
352
373
  );
@@ -357,7 +378,9 @@ function createHomeRoute(options) {
357
378
  if (resolved.kind === "response") return resolved.response;
358
379
  applySeoContext(c, options.config, resolved);
359
380
  if (resolved.kind === "page")
360
- return c.render(/* @__PURE__ */ jsx2(PageBody, { html: resolved.page.body }));
381
+ return c.render(
382
+ /* @__PURE__ */ jsx3(PageBody, { html: resolved.page.body, layout: resolved.page.layout })
383
+ );
361
384
  return renderContent(c, options, resolved.entry, resolved.post);
362
385
  });
363
386
  }
@@ -397,7 +420,15 @@ async function renderContent(c, options, entry, post) {
397
420
  const publicEntry = view.findRoutableBySlug(entry.slug);
398
421
  if (!publicEntry) return c.notFound();
399
422
  return c.render(
400
- /* @__PURE__ */ jsx2(ArticleProvider, { entry: publicEntry, post, children: options.render({ entry, post }) })
423
+ /* @__PURE__ */ jsx3(
424
+ ArticleProvider,
425
+ {
426
+ entry: publicEntry,
427
+ post,
428
+ body: await renderContentBody(post.sourcePath ?? ""),
429
+ children: options.render({ entry, post })
430
+ }
431
+ )
401
432
  );
402
433
  }
403
434
  export {
@@ -1,3 +1 @@
1
- import type { ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
- import type { Plugin } from "vite";
3
- export declare function riebeckiteClientModule(getConfig: () => Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">): Plugin;
1
+ export { riebeckiteClientModule } from "./client_module_part1.js";
@@ -0,0 +1,5 @@
1
+ import type { ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
+ import type { Plugin } from "vite";
3
+ export declare const clientModuleId = "virtual:riebeckite/client";
4
+ export declare const resolvedClientModuleId = "\0virtual:riebeckite/client";
5
+ export declare function riebeckiteClientModule(getConfig: () => Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">): Plugin;
@@ -0,0 +1,2 @@
1
+ import { type ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
+ export declare function createClientModule(config: Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">, development: boolean): string;
@@ -1,88 +1,3 @@
1
- import type { ContentManager, ContentManifest, ContentManifestEntry, PostContent, ResolvedPluginPage } from "@riebeckite/core";
2
- import type { Context, Handler, MiddlewareHandler } from "hono";
3
- export type ResolvedContentRoute = {
4
- kind: "content";
5
- entry: ContentManifestEntry;
6
- } | {
7
- kind: "redirect";
8
- location: string;
9
- status: 301 | 302 | 307 | 308;
10
- } | null;
11
- export type ResolvedRiebeckiteRoute = Exclude<ResolvedContentRoute, null> | {
12
- kind: "page";
13
- page: ResolvedPluginPage;
14
- } | null;
15
- /**
16
- * Resolves plugin pages before manifest-backed content routes. This is the
17
- * single HonoX adapter needed by a catch-all site route; plugins never add
18
- * HonoX routes themselves.
19
- */
20
- export declare function resolveRiebeckiteRoute(content: Pick<ContentManager, "resolvePage" | "getRequestManifest">, pathname: string): Promise<ResolvedRiebeckiteRoute>;
21
- /**
22
- * The resolved route request a Site consumes from a catch-all content route.
23
- *
24
- * `content` carries everything the Site composition needs; `page` and
25
- * `response` are framework mechanics the Site forwards without interpreting.
26
- */
27
- export type ResolvedContentRequest = {
28
- kind: "content";
29
- entry: ContentManifestEntry;
30
- post: PostContent;
31
- } | {
32
- kind: "page";
33
- page: ResolvedPluginPage;
34
- } | {
35
- kind: "response";
36
- response: Response | Promise<Response>;
37
- };
38
- /**
39
- * Assigns the resolved route metadata to the request context.
40
- *
41
- * Plugins and primitives read `htmlLanguage` and `headTags` from the context,
42
- * so the resolver owns their values instead of each route rebuilding them.
43
- */
44
- export declare function applyRiebeckiteRouteContext(c: Context, route: Exclude<ResolvedRiebeckiteRoute, null>): void;
45
- type RouteContent = Pick<ContentManager, "resolvePage" | "getRequestManifest" | "getProcessedContent">;
46
- /**
47
- * Resolves a catch-all content request into what a Site should render.
48
- *
49
- * Owns the route mechanics a Site must not repeat: the wildcard and content
50
- * extension guards, plugin page vs content resolution, redirect and not-found
51
- * responses, context assignment, and loading the processed content.
52
- */
53
- export declare function resolveRiebeckiteContentRequest(c: Context, content: RouteContent, parameter?: string): Promise<ResolvedContentRequest>;
54
- /**
55
- * Resolves the `/` Homepage request into what a Site should render.
56
- *
57
- * Shares every catch-all mechanic with `resolveRiebeckiteContentRequest` but
58
- * has no wildcard parameter to guard. It additionally owns the configured-index
59
- * redirect: when the `index` content is permalinked away from `/`, the root
60
- * forwards there instead of resolving another route.
61
- */
62
- export declare function resolveRiebeckiteHomeRequest(c: Context, content: RouteContent): Promise<ResolvedContentRequest>;
63
- /** Returns catch-all parameters for every plugin page registered for SSG. */
64
- export declare function pluginPageSsgParams(content: Pick<ContentManager, "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
65
- export declare function riebeckiteSsgParams(content: Pick<ContentManager, "getManifest" | "getOutputChangeSet" | "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
66
- export declare function resolveContentRoute(manifest: ContentManifest, pathname: string): ResolvedContentRoute;
67
- type SsgParams = Record<string, string>[];
68
- /**
69
- * SSG parameter middleware for a catch-all content route.
70
- *
71
- * `ssgParams` from `hono/ssg` decides whether to emit params only from the
72
- * request path. When a shallow catch-all (for example `/:slug{.+}`) is
73
- * registered before a deeper one (`/tags/:slug{.+}`), the shallow route
74
- * captures the enumeration request of the deeper route and injects its own
75
- * params. This helper responds only to the enumeration request that belongs to
76
- * `routePath`, so sibling catch-all routes can enumerate their own params.
77
- */
78
- export declare function contentRouteSsgParams(routePath: string, params: SsgParams | ((c: Context) => SsgParams | Promise<SsgParams>)): MiddlewareHandler;
79
- /**
80
- * Make a route handler visible to Hono's SSG route enumeration.
81
- *
82
- * `toSSG` skips any route whose final handler is a middleware, which Hono
83
- * detects with `handler.length > 1`. A catch-all content route sometimes needs
84
- * `next()` to defer to a more specific route, so wrapping the handler in a
85
- * rest-parameter function keeps `length === 0` while preserving `(c, next)`.
86
- */
87
- export declare function ssgEnumerableHandler<H extends Handler<any, any, any>>(handler: H): H;
88
- export {};
1
+ export type { ResolvedContentRequest, ResolvedContentRoute, ResolvedRiebeckiteRoute, } from "./content_route_part1.js";
2
+ export { applyRiebeckiteRouteContext, contentRouteSsgParams, pluginPageSsgParams, resolveContentRoute, resolveRiebeckiteContentRequest, resolveRiebeckiteHomeRequest, resolveRiebeckiteRoute, riebeckiteSsgParams, } from "./content_route_part1.js";
3
+ export { ssgEnumerableHandler } from "./content_route_part2.js";
@@ -0,0 +1,37 @@
1
+ import { type ContentManager, type ContentManifest, type ContentManifestEntry, type PostContent, type ResolvedPluginPage } from "@riebeckite/core";
2
+ import type { Context, MiddlewareHandler } from "hono";
3
+ export type ResolvedContentRoute = {
4
+ kind: "content";
5
+ entry: ContentManifestEntry;
6
+ } | {
7
+ kind: "redirect";
8
+ location: string;
9
+ status: 301 | 302 | 307 | 308;
10
+ } | null;
11
+ export type ResolvedRiebeckiteRoute = Exclude<ResolvedContentRoute, null> | {
12
+ kind: "page";
13
+ page: ResolvedPluginPage;
14
+ } | null;
15
+ export declare function resolveRiebeckiteRoute(content: Pick<ContentManager, "resolvePage" | "getRequestManifest">, pathname: string): Promise<ResolvedRiebeckiteRoute>;
16
+ export type ResolvedContentRequest = {
17
+ kind: "content";
18
+ entry: ContentManifestEntry;
19
+ post: PostContent;
20
+ } | {
21
+ kind: "page";
22
+ page: ResolvedPluginPage;
23
+ } | {
24
+ kind: "response";
25
+ response: Response | Promise<Response>;
26
+ };
27
+ export declare function applyRiebeckiteRouteContext(c: Context, route: Exclude<ResolvedRiebeckiteRoute, null>): void;
28
+ export declare const contentExtensionPattern: RegExp;
29
+ export type RouteContent = Pick<ContentManager, "resolvePage" | "getRequestManifest" | "getProcessedContent">;
30
+ export declare function resolveRouteRequest(c: Context, content: RouteContent): Promise<ResolvedContentRequest>;
31
+ export declare function resolveRiebeckiteContentRequest(c: Context, content: RouteContent, parameter?: string): Promise<ResolvedContentRequest>;
32
+ export declare function resolveRiebeckiteHomeRequest(c: Context, content: RouteContent): Promise<ResolvedContentRequest>;
33
+ export declare function pluginPageSsgParams(content: Pick<ContentManager, "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
34
+ export declare function riebeckiteSsgParams(content: Pick<ContentManager, "getManifest" | "getOutputChangeSet" | "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
35
+ export declare function resolveContentRoute(manifest: ContentManifest, pathname: string): ResolvedContentRoute;
36
+ export type SsgParams = Record<string, string>[];
37
+ export declare function contentRouteSsgParams(routePath: string, params: SsgParams | ((c: Context) => SsgParams | Promise<SsgParams>)): MiddlewareHandler;
@@ -0,0 +1,8 @@
1
+ import { type ContentManifest } from "@riebeckite/core";
2
+ import type { Handler } from "hono";
3
+ export declare function ssgEnumerableHandler<H extends Handler<any, any, any>>(handler: H): H;
4
+ export declare function isDynamicRoute(path: string): boolean;
5
+ export declare function normalizeRequestPath(pathname: string): string;
6
+ export declare function redirectSsgPaths(manifest: ContentManifest): string[];
7
+ export declare function routeOutputPath(pathname: string): string;
8
+ export declare function encodeSegment(segment: string): string;
@@ -2,6 +2,7 @@ import type { Plugin } from "vite";
2
2
  import type { ResolvedHonoxApplication } from "./vite_runner.js";
3
3
  export declare const riebeckiteConfigModuleId = "virtual:riebeckite/config";
4
4
  export declare const riebeckiteContentModuleId = "virtual:riebeckite/content";
5
+ export declare const riebeckiteContentRenderersModuleId = "virtual:riebeckite/content-renderers";
5
6
  /**
6
7
  * Provides the framework-owned bootstrap modules a generated site imports
7
8
  * instead of keeping resolved-config and content-manager ceremony in
@@ -0,0 +1,4 @@
1
+ import { type Diagnostic, type PluginGeneratedHtml, type RiebeckitePlugin } from "@riebeckite/core";
2
+ export declare const SPA_DIAGNOSTICS_PLUGIN_NAME = "riebeckite:spa-diagnostics";
3
+ export declare function inspectSpaPage(page: PluginGeneratedHtml): Diagnostic[];
4
+ export declare function spaDiagnostics(): RiebeckitePlugin;
@@ -1,37 +1,5 @@
1
- import type { NoChangeFastPathOutputMetrics, NoChangeFastPathResult, OutputCacheDecision, OutputCacheRejectionReason } from "./types.js";
2
- type OutputCacheEntry = {
3
- cachePath: string;
4
- checksum: string;
5
- size?: number;
6
- modifiedAtMs?: number;
7
- };
8
- export type OutputCacheState = {
9
- version: 4;
10
- appFingerprint?: string;
11
- bundleFingerprint?: string;
12
- clientManifestFingerprint?: string;
13
- outputs: Record<string, OutputCacheEntry>;
14
- finalOutputInventory?: Record<string, string>;
15
- publicDirectory?: string;
16
- publicFingerprint?: string;
17
- configFile?: string;
18
- };
19
- export declare function decideOutputCacheRejection(decision: OutputCacheDecision): OutputCacheRejectionReason | undefined;
20
- export declare function createNoChangeFastPathOutputMetrics(): NoChangeFastPathOutputMetrics;
21
- export declare function verifyNoChangeFastPath(input: {
22
- readonly root: string;
23
- readonly outputDirectory: string;
24
- readonly expectedOutputPaths: readonly string[];
25
- readonly metrics?: NoChangeFastPathOutputMetrics;
26
- }): Promise<NoChangeFastPathResult>;
27
- export declare function loadOutputCache(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
28
- fileSizeBytes?: number;
29
- }) | undefined>;
30
- export declare function loadOutputCacheMetadata(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
31
- fileSizeBytes?: number;
32
- }) | undefined>;
33
- export declare function validateOutputCache(cache: OutputCacheState, path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<boolean>;
34
- export declare function saveOutputCache(path: string, state: OutputCacheState, outputDirectory: string, timingsMs?: Record<string, number>): Promise<string>;
35
- export declare function decodeOutput(outputCachePath: string, entry: OutputCacheEntry): Promise<Uint8Array>;
36
- export declare function resolveOutputCacheEntryPath(outputCachePath: string, entry: OutputCacheEntry): string;
37
- export {};
1
+ export { createNoChangeFastPathOutputMetrics, decideOutputCacheRejection, verifyNoChangeFastPath, } from "./output_cache_decision.js";
2
+ export { loadOutputCache, loadOutputCacheMetadata, validateOutputCache, } from "./output_cache_load.js";
3
+ export { decodeOutput, resolveOutputCacheEntryPath, } from "./output_cache_paths.js";
4
+ export { saveOutputCache } from "./output_cache_save.js";
5
+ export type { OutputCacheState } from "./output_cache_types.js";
@@ -0,0 +1,9 @@
1
+ import type { NoChangeFastPathOutputMetrics, NoChangeFastPathResult, OutputCacheDecision, OutputCacheRejectionReason } from "./types.js";
2
+ export declare function decideOutputCacheRejection(decision: OutputCacheDecision): OutputCacheRejectionReason | undefined;
3
+ export declare function createNoChangeFastPathOutputMetrics(): NoChangeFastPathOutputMetrics;
4
+ export declare function verifyNoChangeFastPath(input: {
5
+ readonly root: string;
6
+ readonly outputDirectory: string;
7
+ readonly expectedOutputPaths: readonly string[];
8
+ readonly metrics?: NoChangeFastPathOutputMetrics;
9
+ }): Promise<NoChangeFastPathResult>;
@@ -0,0 +1,5 @@
1
+ import { type OutputCacheEntry } from "./output_cache_types.js";
2
+ export declare function saveOutputCacheEntries(directory: string, outputDirectory: string, outputs: Readonly<Record<string, OutputCacheEntry>>, finalOutputInventory: Readonly<Record<string, string>> | undefined, timingsMs: Record<string, number> | undefined): Promise<Record<string, OutputCacheEntry>>;
3
+ export declare function withOutputCacheEntryStat(entry: OutputCacheEntry, path: string): Promise<OutputCacheEntry>;
4
+ export declare function existingOutputCacheEntry(entry: OutputCacheEntry, path: string): Promise<OutputCacheEntry | undefined>;
5
+ export declare function validateOutputCacheEntries(outputCachePath: string, entries: Readonly<Record<string, OutputCacheEntry>>, timingsMs?: Record<string, number>): Promise<boolean>;
@@ -0,0 +1,12 @@
1
+ import type { FastPathCacheState, OutputCacheState, OutputFileStats } from "./output_cache_types.js";
2
+ export declare function fastPathCachePath(outputCachePath: string): string;
3
+ export declare function createFastPathCacheState(state: OutputCacheState, outputCacheChecksum: string, outputDirectory: string): Promise<FastPathCacheState>;
4
+ export declare function matchingOutputChecksums(outputDirectory: string, inventory: Readonly<Record<string, string>>, stats: Readonly<Record<string, OutputFileStats>> | undefined): Promise<ReadonlyMap<string, string>>;
5
+ export declare function collectOutputFileStats(outputDirectory: string, inventory: Readonly<Record<string, string>>): Promise<Record<string, OutputFileStats>>;
6
+ export declare function outputFileStatMatches(info: {
7
+ readonly size: number;
8
+ readonly mtimeMs: number;
9
+ }, expected: OutputFileStats): boolean;
10
+ export declare function outputStatsEqual(left: Readonly<Record<string, OutputFileStats>> | undefined, right: Readonly<Record<string, OutputFileStats>>): boolean;
11
+ export declare function saveFastPathCache(path: string, state: FastPathCacheState, timingsMs?: Record<string, number>): Promise<void>;
12
+ export declare function loadFastPathCache(path: string): Promise<FastPathCacheState | undefined>;
@@ -0,0 +1,8 @@
1
+ import type { OutputCacheState } from "./output_cache_types.js";
2
+ export declare function loadOutputCache(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
3
+ fileSizeBytes?: number;
4
+ }) | undefined>;
5
+ export declare function loadOutputCacheMetadata(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
6
+ fileSizeBytes?: number;
7
+ }) | undefined>;
8
+ export declare function validateOutputCache(cache: OutputCacheState, path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<boolean>;
@@ -0,0 +1,13 @@
1
+ import type { OutputCacheEntry } from "./output_cache_types.js";
2
+ export declare function outputCacheEntriesPath(outputCachePath: string): string;
3
+ export declare function decodeOutput(outputCachePath: string, entry: OutputCacheEntry): Promise<Uint8Array>;
4
+ export declare function resolveOutputCacheEntryPath(outputCachePath: string, entry: OutputCacheEntry): string;
5
+ export declare function resolveOutputCacheFile(directory: string, relativePath: string): string;
6
+ export declare function isSafeLogicalOutputPath(path: unknown): path is string;
7
+ export declare function assertSafeLogicalOutputPath(path: string): void;
8
+ export declare function outputCacheEntryName(outputPath: string): string;
9
+ export declare function ensureOutputCacheEntriesDirectory(directory: string): Promise<void>;
10
+ export declare function isSafeOutputCacheDirectory(directory: string): Promise<boolean>;
11
+ export declare function isSafeCacheFileTarget(path: string): Promise<boolean>;
12
+ export declare function isSafeOutputCacheEntriesDirectory(directory: string): Promise<boolean>;
13
+ export declare function isRegularFile(path: string): Promise<boolean>;
@@ -0,0 +1,6 @@
1
+ import type { OutputCacheEntry } from "./output_cache_types.js";
2
+ export declare function checksumFile(path: string): Promise<string | undefined>;
3
+ export declare function replaceFile(temporaryPath: string, targetPath: string): Promise<void>;
4
+ export declare function isReplacementFailure(error: unknown): boolean;
5
+ export declare function replaceOutputCacheEntry(source: string, destination: string, timingsMs?: Record<string, number>): Promise<void>;
6
+ export declare function collectUnreferencedOutputCacheEntries(directory: string, outputs: Readonly<Record<string, OutputCacheEntry>>, timingsMs?: Record<string, number>): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { OutputCacheState } from "./output_cache_types.js";
2
+ export declare function saveOutputCache(path: string, state: OutputCacheState, outputDirectory: string, timingsMs?: Record<string, number>): Promise<string>;
@@ -0,0 +1,33 @@
1
+ export type OutputCacheEntry = {
2
+ cachePath: string;
3
+ checksum: string;
4
+ size?: number;
5
+ modifiedAtMs?: number;
6
+ };
7
+ export type OutputCacheState = {
8
+ version: 4;
9
+ appFingerprint?: string;
10
+ bundleFingerprint?: string;
11
+ clientManifestFingerprint?: string;
12
+ outputs: Record<string, OutputCacheEntry>;
13
+ finalOutputInventory?: Record<string, string>;
14
+ publicDirectory?: string;
15
+ publicFingerprint?: string;
16
+ configFile?: string;
17
+ };
18
+ export type OutputFileStats = {
19
+ size: number;
20
+ modifiedAtMs: number;
21
+ };
22
+ export type FastPathCacheState = {
23
+ version: 1;
24
+ outputCacheChecksum: string;
25
+ appFingerprint?: string;
26
+ finalOutputInventory: Record<string, string>;
27
+ finalOutputStats?: Record<string, OutputFileStats>;
28
+ publicDirectory?: string;
29
+ publicFingerprint?: string;
30
+ configFile: string;
31
+ outputPaths: readonly string[];
32
+ };
33
+ export declare const outputCacheValidationConcurrency = 12;
@@ -0,0 +1,8 @@
1
+ import type { FastPathCacheState, OutputCacheState, OutputFileStats } from "./output_cache_types.js";
2
+ export declare function isOutputCacheState(value: unknown): value is OutputCacheState;
3
+ export declare function isOutputInventory(value: unknown): value is Record<string, string>;
4
+ export declare function isOutputFileStats(value: unknown): value is Record<string, OutputFileStats>;
5
+ export declare function isOutputCacheEntries(value: unknown): value is OutputCacheState["outputs"];
6
+ export declare function isOptionalNonNegativeNumber(value: unknown): value is number | undefined;
7
+ export declare function isFastPathCacheState(value: unknown): value is FastPathCacheState;
8
+ export declare function isChecksum(value: unknown): value is string;
@@ -11,6 +11,7 @@ export declare function loadStandaloneSsgBundle(input: {
11
11
  readonly clientOutputDirectory?: string;
12
12
  readonly config?: Pick<ResolvedConfig, "define" | "oxc" | "plugins" | "resolve">;
13
13
  }): Promise<StandaloneSsgBundle>;
14
+ export declare function standaloneSsgModuleUrl(outputDirectory: string): string;
14
15
  export declare function createFrameworkResolutionPlugin(): Plugin;
15
16
  export declare function createClientManifestPlugin(root: string, clientOutputDirectory: string): Plugin;
16
17
  export declare function isStandaloneSsgMode(mode: string): boolean;
@@ -1,18 +1,9 @@
1
- import type { toSSG } from "hono/ssg";
2
1
  import type { ConfigEnv, Plugin } from "vite";
2
+ import type { RiebeckiteSsgOptions } from "./ssg_plugin_state.js";
3
3
  export { emptyBuildOutputDirectory } from "./ssg/build_output.js";
4
4
  export { createNoChangeFastPathOutputMetrics, decideOutputCacheRejection, loadOutputCache, saveOutputCache, verifyNoChangeFastPath, } from "./ssg/output_cache.js";
5
5
  export type { NoChangeFastPathOutputMetrics, NoChangeFastPathResult, OutputCacheDecision, OutputCacheRejectionReason, } from "./ssg/types.js";
6
- type ToSsgOptions = NonNullable<Parameters<typeof toSSG>[2]>;
7
- export type RiebeckiteSsgOptions = {
8
- entry?: string;
9
- plugins?: ToSsgOptions["plugins"];
10
- extensionMap?: Record<string, string>;
11
- concurrency?: number;
12
- };
6
+ export { assertRequiredOutputsWereGenerated, findBuildOutputSiteCollisions, } from "./ssg_plugin_helpers.js";
7
+ export type { RiebeckiteSsgOptions } from "./ssg_plugin_state.js";
13
8
  export declare function riebeckiteSsg(options?: RiebeckiteSsgOptions): Plugin;
14
9
  export declare function shouldApplyRiebeckiteSsg(_config: unknown, env: ConfigEnv): boolean;
15
- export declare function findBuildOutputSiteCollisions(buildOutputPaths: Iterable<string>, siteOwnedOutputPaths: ReadonlySet<string>): readonly string[];
16
- export declare function assertRequiredOutputsWereGenerated(comparison: {
17
- readonly missingInDist: readonly string[];
18
- }): void;
@@ -0,0 +1,3 @@
1
+ import type { SsgGeneration } from "./ssg_plugin_generate_prepare.js";
2
+ import type { SsgPluginState } from "./ssg_plugin_state.js";
3
+ export declare function cleanupSsgGeneration(ctx: SsgGeneration, state: SsgPluginState): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { SsgPluginLogger, SsgPluginState } from "./ssg_plugin_state.js";
2
+ export declare function closeSsgBundle(plugin: SsgPluginLogger, state: SsgPluginState): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { SsgGeneration } from "./ssg_plugin_generate_prepare.js";
2
+ import type { SsgPluginLogger, SsgPluginState } from "./ssg_plugin_state.js";
3
+ export declare function finalizeSsgGeneration(plugin: SsgPluginLogger, ctx: SsgGeneration, state: SsgPluginState): Promise<void>;