@riebeckite/honox 0.0.12 → 0.0.13

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
@@ -1,4 +1,13 @@
1
1
  // src/content_route.ts
2
+ async function resolveRiebeckiteRoute(content, pathname) {
3
+ const page = await content.resolvePage(pathname);
4
+ if (page) return { kind: "page", page };
5
+ return resolveContentRoute(await content.getManifest(), pathname);
6
+ }
7
+ async function pluginPageSsgParams(content, parameter = "slug") {
8
+ const paths = await content.getPagePaths();
9
+ return paths.filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
10
+ }
2
11
  function resolveContentRoute(manifest, pathname) {
3
12
  const path = normalizeRequestPath(pathname);
4
13
  const entry = manifest.byPermalink.get(path);
@@ -127,7 +136,11 @@ async function toPluginEndpointRequest(context, method) {
127
136
  function toHonoResponse(context, response) {
128
137
  const status = response.status ?? 200;
129
138
  if ("json" in response) {
130
- return context.json(response.json, status, response.headers);
139
+ return context.json(
140
+ response.json,
141
+ status,
142
+ withJsonContentType(response.headers)
143
+ );
131
144
  }
132
145
  if (response.body === void 0) {
133
146
  return context.body("", status, response.headers);
@@ -138,6 +151,13 @@ function toHonoResponse(context, response) {
138
151
  }
139
152
  return context.body(response.body, status, response.headers);
140
153
  }
154
+ function withJsonContentType(headers) {
155
+ if (findHeader(headers, "content-type")) return headers ?? {};
156
+ return {
157
+ ...headers,
158
+ "Content-Type": "application/json; charset=utf-8"
159
+ };
160
+ }
141
161
  function findHeader(headers, name) {
142
162
  if (!headers) return void 0;
143
163
  const key = Object.keys(headers).find(
@@ -148,6 +168,8 @@ function findHeader(headers, name) {
148
168
  export {
149
169
  contentRouteSsgParams,
150
170
  mountRiebeckiteEndpoints,
171
+ pluginPageSsgParams,
151
172
  resolveContentRoute,
173
+ resolveRiebeckiteRoute,
152
174
  ssgEnumerableHandler
153
175
  };
@@ -1,4 +1,4 @@
1
- import type { ContentManifest, ContentManifestEntry } from "@riebeckite/core";
1
+ import type { ContentManager, ContentManifest, ContentManifestEntry, ResolvedPluginPage } from "@riebeckite/core";
2
2
  import type { Context, Handler, MiddlewareHandler } from "hono";
3
3
  export type ResolvedContentRoute = {
4
4
  kind: "content";
@@ -8,6 +8,18 @@ export type ResolvedContentRoute = {
8
8
  location: string;
9
9
  status: 301 | 302 | 307 | 308;
10
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" | "getManifest">, pathname: string): Promise<ResolvedRiebeckiteRoute>;
21
+ /** Returns catch-all parameters for every plugin page registered for SSG. */
22
+ export declare function pluginPageSsgParams(content: Pick<ContentManager, "getPagePaths">, parameter?: string): Promise<Record<string, string>[]>;
11
23
  export declare function resolveContentRoute(manifest: ContentManifest, pathname: string): ResolvedContentRoute;
12
24
  type SsgParams = Record<string, string>[];
13
25
  /**
@@ -2,7 +2,6 @@ import type { SiteTemplateFile } from "./templates.js";
2
2
  export type ScaffoldDeploymentOptions = {
3
3
  readonly contentRepository?: string;
4
4
  readonly siteRepository?: string;
5
- readonly notifyOnContentPush?: boolean;
6
5
  };
7
6
  export declare function assertGitHubRepository(value: string, option: string): void;
8
7
  export declare function deploymentTemplateFiles(options: ScaffoldDeploymentOptions): readonly SiteTemplateFile[];
@@ -14,8 +14,6 @@ export type ScaffoldSiteOptions = {
14
14
  readonly contentRepository?: string;
15
15
  /** Site repository to notify from the generated content workflow. */
16
16
  readonly siteRepository?: string;
17
- /** Generate a content-repository workflow that dispatches after a push. */
18
- readonly notifyOnContentPush?: boolean;
19
17
  };
20
18
  export type ScaffoldSiteResult = {
21
19
  readonly targetDirectory: string;
@@ -12,12 +12,12 @@
12
12
  * Presets are cumulative in spirit but defined explicitly so each tier is
13
13
  * self-contained and can be imported and reused on its own:
14
14
  *
15
- * import { full, starter } from "@riebeckite/honox/scaffold";
15
+ * import { showcase, starter } from "@riebeckite/honox/scaffold";
16
16
  */
17
17
  export declare const SCAFFOLD_LANGUAGES: readonly ["en", "ja", "zh-CN", "es", "de", "fr", "ko"];
18
18
  export type ScaffoldLanguage = (typeof SCAFFOLD_LANGUAGES)[number];
19
19
  export declare function defaultLanguageForLocale(locale: string): string;
20
- export type ScaffoldPresetName = "empty" | "minimal" | "starter" | "rich" | "full" | "max" | "ultra";
20
+ export type ScaffoldPresetName = "starter" | "minimal" | "showcase" | "empty";
21
21
  export declare const SCAFFOLD_PRESET_NAMES: readonly ScaffoldPresetName[];
22
22
  export declare function isScaffoldPresetName(value: string): value is ScaffoldPresetName;
23
23
  /** How a theme factory is referenced in the generated config file. */
@@ -41,8 +41,9 @@ export type ScaffoldPluginSpec = {
41
41
  /**
42
42
  * Context passed to option sources. `variables` are the user-supplied site
43
43
  * values (`title`, `baseUrl`, ...), `languages` the preset's configured
44
- * languages, and `depth` the preset tier: 1 = rich essentials,
45
- * 2 = full/max standard set, 3 = ultra full coverage.
44
+ * languages, and configuration detail depth. `showcase` uses depth 3 so its
45
+ * generated config is a complete options reference; the other presets keep
46
+ * their configuration intentionally small.
46
47
  */
47
48
  export type ScaffoldOptionContext = {
48
49
  readonly variables: {
@@ -96,10 +97,7 @@ export type ScaffoldPreset = {
96
97
  export declare const empty: ScaffoldPreset;
97
98
  export declare const minimal: ScaffoldPreset;
98
99
  export declare const starter: ScaffoldPreset;
99
- export declare const rich: ScaffoldPreset;
100
- export declare const full: ScaffoldPreset;
101
- export declare const max: ScaffoldPreset;
102
- export declare const ultra: ScaffoldPreset;
100
+ export declare const showcase: ScaffoldPreset;
103
101
  export declare const scaffoldPresets: Readonly<Record<ScaffoldPresetName, ScaffoldPreset>>;
104
102
  export declare const SCAFFOLD_DEFAULT_PRESET: ScaffoldPresetName;
105
103
  export declare function resolveScaffoldPreset(value: ScaffoldPresetName | ScaffoldPreset | undefined): ScaffoldPreset;
@@ -19,13 +19,10 @@ function defaultLanguageForLocale(locale) {
19
19
  return "en";
20
20
  }
21
21
  var SCAFFOLD_PRESET_NAMES = [
22
- "empty",
23
- "minimal",
24
22
  "starter",
25
- "rich",
26
- "full",
27
- "max",
28
- "ultra"
23
+ "minimal",
24
+ "showcase",
25
+ "empty"
29
26
  ];
30
27
  function isScaffoldPresetName(value) {
31
28
  return SCAFFOLD_PRESET_NAMES.includes(value);
@@ -410,78 +407,9 @@ var minimal = {
410
407
  };
411
408
  var starter = {
412
409
  name: "starter",
413
- description: "The default starter: Obsidian Markdown, color mode, seven languages, and a site header.",
410
+ description: "Recommended for most sites: a practical Markdown garden with search, discovery, and reading essentials.",
414
411
  languages: [...SCAFFOLD_LANGUAGES],
415
412
  theme: defaultTheme,
416
- plugins: [obsidianMarkdown, colorMode, l10n],
417
- contentPages: ["index"],
418
- appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
419
- readme: "standard"
420
- };
421
- var rich = {
422
- name: "rich",
423
- description: "A showcasing starter: publishing and reading plugins plus guided ecosystem tour pages in seven languages.",
424
- languages: [...SCAFFOLD_LANGUAGES],
425
- theme: showCaseTheme,
426
- plugins: [
427
- obsidianMarkdown,
428
- colorMode,
429
- l10n,
430
- seo,
431
- toc,
432
- properties,
433
- alias,
434
- codeEnhance
435
- ],
436
- contentPages: ["index", "framework/plugins", "framework/themes"],
437
- appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
438
- readme: "rich"
439
- };
440
- var full = {
441
- name: "full",
442
- description: "A ready blog: discovery, media, and reading plugins plus a build guide.",
443
- languages: [...SCAFFOLD_LANGUAGES],
444
- theme: showCaseTheme,
445
- plugins: [
446
- obsidianMarkdown,
447
- colorMode,
448
- l10n,
449
- seo,
450
- toc,
451
- properties,
452
- alias,
453
- codeEnhance,
454
- search,
455
- backlinks,
456
- relatedPosts,
457
- share,
458
- changelog,
459
- webmention,
460
- recentPosts,
461
- attachment,
462
- pdf,
463
- media,
464
- responsiveImage,
465
- lightbox,
466
- highlight,
467
- codeTabs,
468
- codeAnnotations,
469
- shortcodes,
470
- series,
471
- taxonomy,
472
- autoCardLink,
473
- richEmbed,
474
- gallery
475
- ],
476
- contentPages: ["index", "framework/plugins", "framework/themes", "guide"],
477
- appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
478
- readme: "rich"
479
- };
480
- var max = {
481
- name: "max",
482
- description: "Diagram and knowledge plugins on top of full, with showcase example pages.",
483
- languages: [...SCAFFOLD_LANGUAGES],
484
- theme: showCaseTheme,
485
413
  plugins: [
486
414
  obsidianMarkdown,
487
415
  colorMode,
@@ -494,62 +422,19 @@ var max = {
494
422
  search,
495
423
  backlinks,
496
424
  relatedPosts,
497
- share,
498
- changelog,
499
- webmention,
500
425
  recentPosts,
501
- attachment,
502
- pdf,
503
- media,
504
426
  responsiveImage,
505
427
  lightbox,
506
- highlight,
507
- codeTabs,
508
- codeAnnotations,
509
- shortcodes,
510
428
  series,
511
- taxonomy,
512
- autoCardLink,
513
- richEmbed,
514
- gallery,
515
- mermaid,
516
- graphviz,
517
- d2,
518
- plantuml,
519
- chartjs,
520
- vegaLite,
521
- wavedrom,
522
- markmap,
523
- map,
524
- marp,
525
- qrCode,
526
- discordEmbed,
527
- excalidraw,
528
- excaliBrain,
529
- canvas,
530
- bases,
531
- dataview,
532
- flashcards,
533
- kanban,
534
- query,
535
- localGraph,
536
- hoverPreview,
537
- gardenExplorer,
538
- ux
539
- ],
540
- contentPages: [
541
- "index",
542
- "framework/plugins",
543
- "framework/themes",
544
- "guide",
545
- "examples"
429
+ taxonomy
546
430
  ],
431
+ contentPages: ["index", "guide", "examples"],
547
432
  appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
548
- readme: "rich"
433
+ readme: "standard"
549
434
  };
550
- var ultra = {
551
- name: "ultra",
552
- description: "The full plugin catalog and theme reference pages — everything the ecosystem offers.",
435
+ var showcase = {
436
+ name: "showcase",
437
+ description: "Explore the complete Riebeckite ecosystem with rendered examples, reference pages, and local fixtures.",
553
438
  languages: [...SCAFFOLD_LANGUAGES],
554
439
  theme: showCaseTheme,
555
440
  plugins: [
@@ -625,7 +510,7 @@ var ultra = {
625
510
  appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
626
511
  readme: "rich"
627
512
  };
628
- var scaffoldPresets = { empty, minimal, starter, rich, full, max, ultra };
513
+ var scaffoldPresets = { starter, minimal, showcase, empty };
629
514
  var SCAFFOLD_DEFAULT_PRESET = "starter";
630
515
  function resolveScaffoldPreset(value) {
631
516
  if (value === void 0) return scaffoldPresets[SCAFFOLD_DEFAULT_PRESET];
@@ -644,13 +529,10 @@ export {
644
529
  SCAFFOLD_PRESET_NAMES,
645
530
  defaultLanguageForLocale,
646
531
  empty,
647
- full,
648
532
  isScaffoldPresetName,
649
- max,
650
533
  minimal,
651
534
  resolveScaffoldPreset,
652
- rich,
653
535
  scaffoldPresets,
654
- starter,
655
- ultra
536
+ showcase,
537
+ starter
656
538
  };
@@ -8,7 +8,7 @@ export type SiteTemplateVariables = {
8
8
  };
9
9
  export type SiteTemplateFile = {
10
10
  readonly path: string;
11
- readonly content: string;
11
+ readonly content: string | Uint8Array;
12
12
  };
13
13
  export declare function siteTemplateFiles(preset: ScaffoldPreset, variables: SiteTemplateVariables): readonly SiteTemplateFile[];
14
14
  /**
@@ -1 +1 @@
1
- export declare const RIEBECKITE_VERSION = "^0.0.12";
1
+ export declare const RIEBECKITE_VERSION = "^0.0.13";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/honox",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
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.12"
39
+ "@riebeckite/core": "0.0.13"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -45,6 +45,7 @@
45
45
  "LICENSE",
46
46
  "README.md",
47
47
  "README_ja.md",
48
+ "assets",
48
49
  "dist"
49
50
  ],
50
51
  "repository": {