@riebeckite/honox 0.0.52 → 0.2.0

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/runtime.js CHANGED
@@ -7,9 +7,6 @@ import {
7
7
  import path from "node:path";
8
8
 
9
9
  // src/spa_diagnostics.ts
10
- import {
11
- definePlugin
12
- } from "@riebeckite/core";
13
10
  var SPA_DIAGNOSTICS_PLUGIN_NAME = "riebeckite:spa-diagnostics";
14
11
  var MAIN_CONTENT_PATTERN = /<main\b[^>]*\bid=["']main-content["']/iu;
15
12
  var REDIRECT_PATTERN = /<meta\b[^>]*\bhttp-equiv=["']refresh["'][^>]*\bcontent=["'][^"']*\burl=/iu;
@@ -27,10 +24,10 @@ function inspectSpaPage(page) {
27
24
  ];
28
25
  }
29
26
  function spaDiagnostics() {
30
- return definePlugin({
27
+ return {
31
28
  name: SPA_DIAGNOSTICS_PLUGIN_NAME,
32
29
  inspectGeneratedHtml: inspectSpaPage
33
- });
30
+ };
34
31
  }
35
32
 
36
33
  // src/resolved_config.ts
package/dist/server.js CHANGED
@@ -1,45 +1,8 @@
1
- // src/content_route_part1.ts
1
+ // src/content_route.ts
2
2
  import {
3
- getEntryLanguage
3
+ getEntryLanguage,
4
+ htmlOutputPath
4
5
  } 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
43
6
  async function resolveRiebeckiteRoute(content, pathname) {
44
7
  const page = await content.resolvePage(pathname);
45
8
  if (page) return { kind: "page", page };
@@ -145,6 +108,39 @@ function contentRouteSsgParams(routePath, params) {
145
108
  return c.notFound();
146
109
  };
147
110
  }
111
+ function ssgEnumerableHandler(handler) {
112
+ const enumerable = (...args) => Reflect.apply(handler, void 0, args);
113
+ return enumerable;
114
+ }
115
+ function isDynamicRoute(path) {
116
+ return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
117
+ }
118
+ function normalizeRequestPath(pathname) {
119
+ const trailingSlash = pathname.length > 1 && pathname.endsWith("/");
120
+ const segments = pathname.split("/").filter(Boolean).map(encodeSegment);
121
+ const path = `/${segments.join("/")}`;
122
+ return trailingSlash ? `${path}/` : path;
123
+ }
124
+ function redirectSsgPaths(manifest) {
125
+ const paths = [];
126
+ for (const [path, redirect] of manifest.publicRedirects) {
127
+ const permalink = manifest.bySlug.get(redirect.slug)?.permalink;
128
+ if (permalink && htmlOutputPath(permalink) === routeOutputPath(path))
129
+ continue;
130
+ paths.push(path);
131
+ }
132
+ return paths;
133
+ }
134
+ function routeOutputPath(pathname) {
135
+ return htmlOutputPath(pathname);
136
+ }
137
+ function encodeSegment(segment) {
138
+ try {
139
+ return encodeURIComponent(decodeURIComponent(segment));
140
+ } catch {
141
+ return encodeURIComponent(segment);
142
+ }
143
+ }
148
144
 
149
145
  // src/endpoints.ts
150
146
  function mountRiebeckiteEndpoints(app, options) {
@@ -1,8 +1,8 @@
1
- import { type ResolvedRiebeckiteConfig } from "@riebeckite/core";
1
+ import type { ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
2
  type GeneratedAssetPaths = {
3
3
  frameworkStyles: string;
4
4
  pluginStyles: string;
5
5
  themeStyles: string;
6
6
  };
7
- export declare function writeRiebeckiteAssetEntries(config: ResolvedRiebeckiteConfig, paths: GeneratedAssetPaths): void;
7
+ export declare function writeRiebeckiteAssetEntries(config: ResolvedRiebeckiteConfig, paths: GeneratedAssetPaths): Promise<void>;
8
8
  export {};
@@ -1 +1,3 @@
1
- export { riebeckiteClientModule } from "./client_module_part1.js";
1
+ import type { ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
+ import type { Plugin } from "vite";
3
+ export declare function riebeckiteClientModule(getConfig: () => Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">, ensure?: () => Promise<unknown>): Plugin;
@@ -1,7 +1,7 @@
1
1
  import type { Plugin } from "vite";
2
2
  type RiebeckiteContentAssetsOptions = {
3
- appRoot: () => string;
4
- contentRoot: () => string;
3
+ appRoot: () => Promise<string>;
4
+ contentRoot: () => Promise<string>;
5
5
  };
6
6
  type ContentAssetEntry = {
7
7
  assets?: ReadonlyArray<{
@@ -21,10 +21,10 @@ export type PublicContentManifest = {
21
21
  generatedOutputs?: ReadonlyArray<GeneratedOutputEntry>;
22
22
  };
23
23
  export declare function riebeckiteContentAssets(options: RiebeckiteContentAssetsOptions): Plugin;
24
- export declare function collectPublicImagePaths(manifest: PublicContentManifest): Set<string>;
25
- export declare function collectGeneratedImageContents(manifest: PublicContentManifest): Map<string, Uint8Array | string>;
26
- export declare function collectDeferredGeneratedImages(manifest: PublicContentManifest): Map<string, DeferredGeneratedImage>;
24
+ export declare function collectPublicImagePaths(manifest: PublicContentManifest): Promise<Set<string>>;
25
+ export declare function collectGeneratedImageContents(manifest: PublicContentManifest): Promise<Map<string, Uint8Array | string>>;
26
+ export declare function collectDeferredGeneratedImages(manifest: PublicContentManifest): Promise<Map<string, DeferredGeneratedImage>>;
27
27
  export declare function collectSiteOwnedOutputPaths(publicDir: string | false | undefined): Promise<Set<string>>;
28
- export declare function toContentPath(url: string | undefined, base: string): string | undefined;
28
+ export declare function toContentPath(url: string | undefined, base: string): Promise<string | undefined>;
29
29
  export declare function imageContentType(logicalPath: string): string | undefined;
30
30
  export {};
@@ -1,3 +1,37 @@
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";
1
+ import { type ContentManager, type ContentManifest, type ContentManifestEntry, type PostContent, type 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
+ 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
+ type RouteContent = Pick<ContentManager, "resolvePage" | "getRequestManifest" | "getProcessedContent">;
29
+ export declare function resolveRiebeckiteContentRequest(c: Context, content: RouteContent, parameter?: string): Promise<ResolvedContentRequest>;
30
+ export declare function resolveRiebeckiteHomeRequest(c: Context, content: RouteContent): Promise<ResolvedContentRequest>;
31
+ export declare function pluginPageSsgParams(content: Pick<ContentManager, "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
32
+ export declare function riebeckiteSsgParams(content: Pick<ContentManager, "getManifest" | "getOutputChangeSet" | "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
33
+ export declare function resolveContentRoute(manifest: ContentManifest, pathname: string): ResolvedContentRoute;
34
+ type SsgParams = Record<string, string>[];
35
+ export declare function contentRouteSsgParams(routePath: string, params: SsgParams | ((c: Context) => SsgParams | Promise<SsgParams>)): MiddlewareHandler;
36
+ export declare function ssgEnumerableHandler<H extends Handler<any, any, any>>(handler: H): H;
37
+ export {};
@@ -1,11 +1,11 @@
1
1
  import type { Plugin, ViteDevServer } from "vite";
2
2
  type RiebeckiteContentWatchOptions = {
3
- appRoot: () => string;
4
- contentRoot: () => string;
3
+ appRoot: () => Promise<string>;
4
+ contentRoot: () => Promise<string>;
5
5
  exclude: () => readonly string[];
6
6
  onInvalidate?: (server: ViteDevServer) => void;
7
7
  };
8
8
  export declare function riebeckiteContentWatch(options: RiebeckiteContentWatchOptions): Plugin;
9
- export declare function isSiteAssetPath(logicalPath: string): boolean;
10
- export declare function invalidateApplicationRuntime(server: Pick<ViteDevServer, "environments">, appRoot: string): number;
9
+ export declare function isSiteAssetPath(logicalPath: string): Promise<boolean>;
10
+ export declare function invalidateApplicationRuntime(server: Pick<ViteDevServer, "environments">, appRoot: string): Promise<number>;
11
11
  export {};
@@ -7,4 +7,4 @@ import type { Plugin, PluginOption } from "vite";
7
7
  * imports an island.
8
8
  */
9
9
  export declare function replaceHonoxIslandDependencyPlugin(plugins: PluginOption[]): PluginOption[];
10
- export declare function injectRiebeckiteClientBundle(getConfig: () => Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">): Plugin;
10
+ export declare function injectRiebeckiteClientBundle(getConfig: () => Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">, ensure?: () => Promise<unknown>): Plugin;
@@ -8,5 +8,5 @@ export declare const riebeckiteContentRenderersModuleId = "virtual:riebeckite/co
8
8
  * instead of keeping resolved-config and content-manager ceremony in
9
9
  * `app/config.ts` and `app/content.ts`.
10
10
  */
11
- export declare function riebeckiteRuntimeModules(getApplication: () => ResolvedHonoxApplication): Plugin;
11
+ export declare function riebeckiteRuntimeModules(getApplication: () => ResolvedHonoxApplication, ensure?: () => Promise<unknown>): Plugin;
12
12
  export declare function isRiebeckiteRuntimeModuleId(id: string | null | undefined): boolean;
@@ -1,4 +1,4 @@
1
- import { type Diagnostic, type PluginGeneratedHtml, type RiebeckitePlugin } from "@riebeckite/core";
1
+ import type { Diagnostic, PluginGeneratedHtml, RiebeckitePlugin } from "@riebeckite/core";
2
2
  export declare const SPA_DIAGNOSTICS_PLUGIN_NAME = "riebeckite:spa-diagnostics";
3
3
  export declare function inspectSpaPage(page: PluginGeneratedHtml): Diagnostic[];
4
4
  export declare function spaDiagnostics(): RiebeckitePlugin;
@@ -15,7 +15,7 @@ export type RiebeckiteViteOptions = RiebeckiteIntegrationOptions & {
15
15
  ssg?: RiebeckiteSsgOptions;
16
16
  };
17
17
  export declare function riebeckite(options?: RiebeckiteViteOptions, onApplicationResolved?: (application: ResolvedHonoxApplication) => void): Plugin[];
18
- export declare function riebeckiteContentWarmup(enabled: boolean, getApplication: () => ResolvedHonoxApplication): Plugin;
18
+ export declare function riebeckiteContentWarmup(enabled: boolean, getApplication: () => Promise<ResolvedHonoxApplication>): Plugin;
19
19
  /**
20
20
  * Higher-level helper that registers the complete Riebeckite Vite integration
21
21
  * without exposing internal Vite/HonoX/SSR details. A site only needs to add
@@ -1,8 +1,9 @@
1
- export declare function createWorkspacePackageAliases(workspaceRoot: string): {
1
+ export declare function createWorkspacePackageAliases(workspaceRoot: string): Promise<{
2
2
  find: RegExp;
3
3
  replacement: string;
4
- }[];
5
- export declare function workspacePackageResolver(workspaceRoot: string): {
4
+ }[]>;
5
+ export declare function workspacePackageJsonPaths(workspaceRoot: string): string[];
6
+ export declare function workspacePackageResolver(workspaceRoot: string): Promise<{
6
7
  name: string;
7
8
  setup(buildApi: {
8
9
  onResolve: (options: {
@@ -13,4 +14,4 @@ export declare function workspacePackageResolver(workspaceRoot: string): {
13
14
  path: string;
14
15
  } | null) => void;
15
16
  }): void;
16
- };
17
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/honox",
3
- "version": "0.0.52",
3
+ "version": "0.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,16 +44,17 @@
44
44
  "hono": "^4.13.18",
45
45
  "honox": "0.1.62",
46
46
  "vite": "^8.3.7",
47
- "@riebeckite/og-image": "0.0.52",
48
- "@riebeckite/runtime": "0.0.52",
49
- "@riebeckite/plugin-color-mode": "0.0.52",
50
- "@riebeckite/dev-inspector": "0.0.52",
51
- "@riebeckite/node": "0.0.52",
52
- "@riebeckite/ui": "0.0.52",
53
- "@riebeckite/spa": "0.0.52"
47
+ "@riebeckite/dev-inspector": "0.2.0",
48
+ "@riebeckite/ai": "0.2.0",
49
+ "@riebeckite/node": "0.2.0",
50
+ "@riebeckite/og-image": "0.2.0",
51
+ "@riebeckite/plugin-color-mode": "0.2.0",
52
+ "@riebeckite/runtime": "0.2.0",
53
+ "@riebeckite/spa": "0.2.0",
54
+ "@riebeckite/ui": "0.2.0"
54
55
  },
55
56
  "peerDependencies": {
56
- "@riebeckite/core": "^0.0.52"
57
+ "@riebeckite/core": "^0.2.0"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@d2lang/d2": "^0.1.34",
@@ -61,9 +62,9 @@
61
62
  "@hono/vite-build": "^1.11.1",
62
63
  "@marp-team/marp-core": "^4.4.0",
63
64
  "tsx": "^4.22.4",
64
- "@riebeckite/test": "0.0.52",
65
- "@riebeckite/plugin-bases": "0.0.52",
66
- "@riebeckite/core": "0.0.52"
65
+ "@riebeckite/core": "0.2.0",
66
+ "@riebeckite/plugin-bases": "0.2.0",
67
+ "@riebeckite/test": "0.2.0"
67
68
  },
68
69
  "publishConfig": {
69
70
  "access": "public"
@@ -1,5 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- import { type ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
- export declare function createClientModule(config: Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">, development: boolean): string;
@@ -1,37 +0,0 @@
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;
@@ -1,8 +0,0 @@
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;