@riebeckite/honox 0.0.13 → 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/dist/server.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type { ResolvedContentRoute, ResolvedRiebeckiteRoute, } from "./src/content_route.js";
2
- export { contentRouteSsgParams, pluginPageSsgParams, resolveContentRoute, resolveRiebeckiteRoute, ssgEnumerableHandler, } from "./src/content_route.js";
2
+ export { contentRouteSsgParams, pluginPageSsgParams, resolveContentRoute, resolveRiebeckiteRoute, riebeckiteSsgParams, ssgEnumerableHandler, } from "./src/content_route.js";
3
3
  export { mountRiebeckiteEndpoints } from "./src/endpoints.js";
package/dist/server.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/content_route.ts
2
+ import { htmlOutputPath } from "@riebeckite/core";
2
3
  async function resolveRiebeckiteRoute(content, pathname) {
3
4
  const page = await content.resolvePage(pathname);
4
5
  if (page) return { kind: "page", page };
@@ -8,9 +9,27 @@ async function pluginPageSsgParams(content, parameter = "slug") {
8
9
  const paths = await content.getPagePaths();
9
10
  return paths.filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
10
11
  }
12
+ async function riebeckiteSsgParams(content, parameter = "slug") {
13
+ const [manifest, changeSet] = await Promise.all([
14
+ content.getManifest({ incremental: true }),
15
+ content.getOutputChangeSet({ incremental: true })
16
+ ]);
17
+ if (changeSet.fullRegenerationRequired || process.env.RIEBECKITE_SSG_FULL_REGENERATION === "1") {
18
+ return [
19
+ ...manifest.publicEntries.filter((entry) => entry.permalink !== "/").map((entry) => ({ [parameter]: entry.permalink.replace(/^\/+/, "") })),
20
+ ...await pluginPageSsgParams(content, parameter)
21
+ ];
22
+ }
23
+ const affected = new Set(
24
+ changeSet.affected.filter((output) => output.kind !== "generated").map((output) => output.path)
25
+ );
26
+ const contentParams = manifest.publicEntries.filter((entry) => affected.has(routeOutputPath(entry.permalink))).map((entry) => ({ [parameter]: entry.permalink.replace(/^\/+/, "") }));
27
+ const pluginPageParams = (await content.getPagePaths()).filter((path) => affected.has(routeOutputPath(path))).filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
28
+ return [...contentParams, ...pluginPageParams];
29
+ }
11
30
  function resolveContentRoute(manifest, pathname) {
12
31
  const path = normalizeRequestPath(pathname);
13
- const entry = manifest.byPermalink.get(path);
32
+ const entry = manifest.byRoutablePermalink.get(path);
14
33
  if (entry) return { kind: "content", entry };
15
34
  const redirect = manifest.redirects.get(path);
16
35
  if (!redirect) return null;
@@ -45,6 +64,9 @@ function normalizeRequestPath(pathname) {
45
64
  const path = `/${segments.join("/")}`;
46
65
  return trailingSlash ? `${path}/` : path;
47
66
  }
67
+ function routeOutputPath(pathname) {
68
+ return htmlOutputPath(normalizeRequestPath(pathname));
69
+ }
48
70
  function decodeSegment(segment) {
49
71
  try {
50
72
  return decodeURIComponent(segment);
@@ -171,5 +193,6 @@ export {
171
193
  pluginPageSsgParams,
172
194
  resolveContentRoute,
173
195
  resolveRiebeckiteRoute,
196
+ riebeckiteSsgParams,
174
197
  ssgEnumerableHandler
175
198
  };
@@ -0,0 +1,19 @@
1
+ import type { Plugin } from "vite";
2
+ export type RiebeckiteContentAssetsOptions = {
3
+ appRoot: () => string;
4
+ contentRoot: () => string;
5
+ };
6
+ type ContentAssetEntry = {
7
+ assets?: ReadonlyArray<{
8
+ path: string;
9
+ }>;
10
+ };
11
+ type PublicContentManifest = {
12
+ publicEntries?: ReadonlyArray<ContentAssetEntry>;
13
+ };
14
+ export declare function riebeckiteContentAssets(options: RiebeckiteContentAssetsOptions): Plugin;
15
+ export declare function collectPublicImagePaths(manifest: PublicContentManifest): Set<string>;
16
+ export declare function collectSiteOwnedOutputPaths(publicDir: string | false | undefined): Promise<Set<string>>;
17
+ export declare function toContentPath(url: string | undefined, base: string): string | undefined;
18
+ export declare function imageContentType(logicalPath: string): string | undefined;
19
+ export {};
@@ -20,6 +20,7 @@ export type ResolvedRiebeckiteRoute = Exclude<ResolvedContentRoute, null> | {
20
20
  export declare function resolveRiebeckiteRoute(content: Pick<ContentManager, "resolvePage" | "getManifest">, pathname: string): Promise<ResolvedRiebeckiteRoute>;
21
21
  /** Returns catch-all parameters for every plugin page registered for SSG. */
22
22
  export declare function pluginPageSsgParams(content: Pick<ContentManager, "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
23
+ export declare function riebeckiteSsgParams(content: Pick<ContentManager, "getManifest" | "getOutputChangeSet" | "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
23
24
  export declare function resolveContentRoute(manifest: ContentManifest, pathname: string): ResolvedContentRoute;
24
25
  type SsgParams = Record<string, string>[];
25
26
  /**
@@ -0,0 +1,11 @@
1
+ import type { Plugin, ViteDevServer } from "vite";
2
+ export type RiebeckiteContentWatchOptions = {
3
+ appRoot: () => string;
4
+ contentRoot: () => string;
5
+ exclude: () => readonly string[];
6
+ };
7
+ export declare function riebeckiteContentWatch(options: RiebeckiteContentWatchOptions): Plugin;
8
+ export declare function isSiteAssetPath(logicalPath: string): boolean;
9
+ export declare function isPathInsideDirectory(directory: string, file: string): boolean;
10
+ export declare function toLogicalPath(directory: string, file: string): string;
11
+ export declare function invalidateApplicationRuntime(server: Pick<ViteDevServer, "environments">, appRoot: string): number;
@@ -12,4 +12,4 @@ export declare function renderer(preset: ScaffoldPreset): string;
12
12
  export declare function bareRenderer(): string;
13
13
  export declare function indexRoute(preset: ScaffoldPreset): string;
14
14
  export declare function staticIndexRoute(): string;
15
- export declare function slugRoute(): string;
15
+ export declare function slugRoute(preset: ScaffoldPreset): string;
@@ -1 +1,7 @@
1
- export declare function formatScaffoldNextSteps(relativeDirectory: string): string;
1
+ export type ScaffoldNextStepsOptions = {
2
+ /** First Markdown file to edit, when the scaffold wrote one. */
3
+ readonly editFile?: string;
4
+ /** The site keeps its content in a separate repository. */
5
+ readonly externalContent?: boolean;
6
+ };
7
+ export declare function formatScaffoldNextSteps(relativeDirectory: string, options?: ScaffoldNextStepsOptions): string;
@@ -1 +1 @@
1
- export declare const RIEBECKITE_VERSION = "^0.0.13";
1
+ export declare const RIEBECKITE_VERSION = "^0.0.15";
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Single source of truth for Wrangler configuration defaults.
3
+ *
4
+ * This module is imported by:
5
+ * - scaffold generator (deployment.ts)
6
+ * - contract tests (to verify generated output)
7
+ * - templates/cloudflare/wrangler.jsonc is the human-readable canonical form
8
+ *
9
+ * When updating these values, update all three places:
10
+ * 1. This file (the programmatic source of truth)
11
+ * 2. templates/cloudflare/wrangler.jsonc (the human-readable template)
12
+ * 3. Contract tests will verify consistency automatically
13
+ */
14
+ export declare const WRANGLER_DEFAULTS: {
15
+ /** JSON schema for IDE support and validation */
16
+ readonly $schema: "node_modules/wrangler/config-schema.json";
17
+ /** Worker name - becomes <name>.<account>.workers.dev */
18
+ readonly name: "riebeckite-site";
19
+ /** Compatibility date - update when Workers runtime changes require it */
20
+ readonly compatibility_date: "2026-06-09";
21
+ /** Required for Node.js APIs used by Riebeckite */
22
+ readonly compatibility_flags: readonly ["nodejs_compat"];
23
+ /** Static assets directory - Riebeckite builds to ./dist */
24
+ readonly assets: {
25
+ readonly directory: "./dist";
26
+ };
27
+ };
28
+ /** Type for the wrangler config object */
29
+ export type WranglerDefaults = typeof WRANGLER_DEFAULTS;
30
+ /** Expected secret names in GitHub Actions workflow */
31
+ export declare const GITHUB_ACTIONS_SECRETS: {
32
+ /** Cloudflare API token with Workers Scripts: Edit permission */
33
+ readonly CLOUDFLARE_API_TOKEN: "CLOUDFLARE_API_TOKEN";
34
+ /** Cloudflare Account ID (found in Workers & Pages dashboard URL) */
35
+ readonly CLOUDFLARE_ACCOUNT_ID: "CLOUDFLARE_ACCOUNT_ID";
36
+ /** Optional: Token for content repo to dispatch to site repo */
37
+ readonly SITE_DISPATCH_TOKEN: "SITE_DISPATCH_TOKEN";
38
+ /** Optional: Token for site repo to read content repo */
39
+ readonly RIEBECKITE_CONTENT_READ_TOKEN: "RIEBECKITE_CONTENT_READ_TOKEN";
40
+ };
41
+ /** Package manager used by generated sites and workflows */
42
+ export declare const PACKAGE_MANAGER: "npm";
43
+ /** Lockfile name that must be committed */
44
+ export declare const LOCKFILE_NAME: "package-lock.json";
45
+ /** Files/directories that must be in .gitignore */
46
+ export declare const GITIGNORE_REQUIRED: readonly ["node_modules/", "dist/", ".riebeckite/", "app/.riebeckite/"];
47
+ /** Files that must NOT be in .gitignore */
48
+ export declare const GITIGNORE_FORBIDDEN: readonly ["package-lock.json"];
49
+ /** Default preset name used by create-riebeckite */
50
+ export declare const DEFAULT_PRESET: "starter";
51
+ /** Starter preset content pages (base names without language suffixes) */
52
+ export declare const STARTER_CONTENT_PAGES: readonly ["index", "guide", "examples", "notes/planning", "notes/writing"];
53
+ /** Starter preset languages */
54
+ export declare const STARTER_LANGUAGES: readonly ["en", "ja", "zh-CN", "es", "de", "fr", "ko"];
@@ -1,10 +1,25 @@
1
1
  import { toSSG } from "hono/ssg";
2
- import { type Plugin } from "vite";
2
+ import { type ConfigEnv, type Plugin } from "vite";
3
3
  type ToSsgOptions = NonNullable<Parameters<typeof toSSG>[2]>;
4
+ type OutputCacheEntry = {
5
+ source: string;
6
+ encoding: "utf8" | "base64";
7
+ };
8
+ type OutputCacheState = {
9
+ version: 1;
10
+ appFingerprint?: string;
11
+ outputs: Record<string, OutputCacheEntry>;
12
+ };
4
13
  export type RiebeckiteSsgOptions = {
5
14
  entry?: string;
6
15
  plugins?: ToSsgOptions["plugins"];
7
16
  extensionMap?: Record<string, string>;
8
17
  };
9
18
  export declare function riebeckiteSsg(options?: RiebeckiteSsgOptions): Plugin;
19
+ export declare function shouldApplyRiebeckiteSsg(_config: unknown, env: ConfigEnv): boolean;
20
+ export declare function findBuildOutputSiteCollisions(buildOutputPaths: Iterable<string>, siteOwnedOutputPaths: ReadonlySet<string>): readonly string[];
21
+ export declare function loadOutputCache(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
22
+ fileSizeBytes?: number;
23
+ }) | undefined>;
24
+ export declare function saveOutputCache(path: string, state: OutputCacheState, timingsMs?: Record<string, number>): Promise<void>;
10
25
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/honox",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "esbuild": "^0.28.2",
37
37
  "hono": "^4.12.25",
38
38
  "vite": "^8.0.9",
39
- "@riebeckite/core": "0.0.13"
39
+ "@riebeckite/core": "0.0.15"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"