@riebeckite/honox 0.0.3 → 0.0.5

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.
@@ -1,3 +1,4 @@
1
+ import { type ScaffoldPreset, type ScaffoldPresetName } from "./presets.js";
1
2
  export type ScaffoldSiteOptions = {
2
3
  readonly targetDirectory: string;
3
4
  readonly name?: string;
@@ -5,6 +6,7 @@ export type ScaffoldSiteOptions = {
5
6
  readonly description?: string;
6
7
  readonly baseUrl?: string;
7
8
  readonly locale?: string;
9
+ readonly preset?: ScaffoldPresetName | ScaffoldPreset;
8
10
  readonly overwrite?: boolean;
9
11
  };
10
12
  export type ScaffoldSiteResult = {
@@ -1,14 +1,13 @@
1
1
  import type { SiteTemplateFile, SiteTemplateVariables } from "./templates.js";
2
- export declare const SCAFFOLD_LANGUAGES: readonly ["en", "ja", "zh-CN", "es", "de", "fr", "ko"];
3
- export type ScaffoldLanguage = (typeof SCAFFOLD_LANGUAGES)[number];
4
- export declare function defaultLanguageForLocale(locale: string): string;
2
+ import { type ScaffoldPreset } from "./presets.js";
5
3
  /**
6
- * Generates the localized content pages for the scaffold.
4
+ * Generates the content pages for a scaffold preset.
7
5
  *
8
- * Naming follows the l10n plugin convention: the default-language page keeps
9
- * the plain name (`index.md`) while every other language uses the
10
- * `<base>.<lang>.md` suffix. The l10n plugin derives the translation group
11
- * from the path, so `content/index.ja.md` and `content/index.md` share a
12
- * translation while being served under `/` and `/ja/`.
6
+ * Localized pages (`index`, `framework/plugins`, `framework/themes`) follow the
7
+ * l10n plugin convention: the default-language page keeps the plain name
8
+ * (`index.md`) while every other language uses the `<base>.<lang>.md` suffix.
9
+ * Presets without l10n emit the index in the site's default language only.
10
+ * Extra pages (`guide`, `examples`, `reference/*`) are English-only and are
11
+ * suffixed with `.en` when English is not the site's default language.
13
12
  */
14
- export declare function localizedContentFiles(variables: SiteTemplateVariables): readonly SiteTemplateFile[];
13
+ export declare function localizedContentFiles(variables: SiteTemplateVariables, preset: ScaffoldPreset): readonly SiteTemplateFile[];
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Scaffold presets.
3
+ *
4
+ * A preset is the declarative description of one starter template. The
5
+ * scaffolder consumes a preset to decide which files it generates:
6
+ *
7
+ * - which plugins are registered in `riebeckite.config.ts`
8
+ * - which theme is applied
9
+ * - which content pages are emitted (localized, or English-only extras)
10
+ * - which `app/` shell files are written
11
+ *
12
+ * Presets are cumulative in spirit but defined explicitly so each tier is
13
+ * self-contained and can be imported and reused on its own:
14
+ *
15
+ * import { full, starter } from "@riebeckite/honox/scaffold";
16
+ */
17
+ export declare const SCAFFOLD_LANGUAGES: readonly ["en", "ja", "zh-CN", "es", "de", "fr", "ko"];
18
+ export type ScaffoldLanguage = (typeof SCAFFOLD_LANGUAGES)[number];
19
+ export declare function defaultLanguageForLocale(locale: string): string;
20
+ export type ScaffoldPresetName = "empty" | "minimal" | "starter" | "rich" | "full" | "max" | "ultra";
21
+ export declare const SCAFFOLD_PRESET_NAMES: readonly ScaffoldPresetName[];
22
+ export declare function isScaffoldPresetName(value: string): value is ScaffoldPresetName;
23
+ /** How a theme factory is referenced in the generated config file. */
24
+ export type ScaffoldThemeSpec = {
25
+ /** Npm package, for example `@riebeckite/theme-minimal`. */
26
+ readonly package: string;
27
+ /** Factory/import name, for example `minimalTheme`. */
28
+ readonly factory: string;
29
+ /** Optional literal source for the factory call arguments, e.g. `{ colorMode: "light" }`. */
30
+ readonly options?: string;
31
+ };
32
+ /** How a plugin factory is referenced in the generated config file. */
33
+ export type ScaffoldPluginSpec = {
34
+ /** Npm package, for example `@riebeckite/plugin-seo`. */
35
+ readonly package: string;
36
+ /** Factory/import name, for example `seo`. */
37
+ readonly factory: string;
38
+ /** Optional literal source for the factory call arguments. */
39
+ readonly options?: string;
40
+ };
41
+ /** Content pages the scaffold can emit. */
42
+ export type ScaffoldPageKey = "index" | "framework/plugins" | "framework/themes" | "guide" | "examples" | "reference/plugins" | "reference/themes";
43
+ /** `app/` shell files the scaffold can emit. */
44
+ export type ScaffoldAppFileKey = "server" | "client" | "config" | "content" | "paths" | "global" | "style" | "renderer" | "index" | "slug" | "header" | "article";
45
+ /** README verbosity. */
46
+ export type ScaffoldReadmeLevel = "short" | "standard" | "rich";
47
+ export type ScaffoldPreset = {
48
+ readonly name: ScaffoldPresetName;
49
+ /** One-line human description, shown by `--list-presets`. */
50
+ readonly description: string;
51
+ /** Languages the l10n plugin is configured with. A single entry means no l10n. */
52
+ readonly languages: readonly ScaffoldLanguage[];
53
+ readonly theme: ScaffoldThemeSpec | null;
54
+ readonly plugins: readonly ScaffoldPluginSpec[];
55
+ readonly contentPages: readonly ScaffoldPageKey[];
56
+ /**
57
+ * Order-sensitive; the scaffolder writes `app/` files in this order.
58
+ * Structural files (`server`, `client`, `config`, `content`, `paths`,
59
+ * `global`, `style`, `renderer`) are always included.
60
+ */
61
+ readonly appFiles: readonly ScaffoldAppFileKey[];
62
+ readonly readme: ScaffoldReadmeLevel;
63
+ };
64
+ export declare const empty: ScaffoldPreset;
65
+ export declare const minimal: ScaffoldPreset;
66
+ export declare const starter: ScaffoldPreset;
67
+ export declare const rich: ScaffoldPreset;
68
+ export declare const full: ScaffoldPreset;
69
+ export declare const max: ScaffoldPreset;
70
+ export declare const ultra: ScaffoldPreset;
71
+ export declare const scaffoldPresets: Readonly<Record<ScaffoldPresetName, ScaffoldPreset>>;
72
+ export declare const SCAFFOLD_DEFAULT_PRESET: ScaffoldPresetName;
73
+ export declare function resolveScaffoldPreset(value: ScaffoldPresetName | ScaffoldPreset | undefined): ScaffoldPreset;
@@ -0,0 +1,374 @@
1
+ // src/scaffold/presets.ts
2
+ var SCAFFOLD_LANGUAGES = [
3
+ "en",
4
+ "ja",
5
+ "zh-CN",
6
+ "es",
7
+ "de",
8
+ "fr",
9
+ "ko"
10
+ ];
11
+ function defaultLanguageForLocale(locale) {
12
+ const normalized = locale.toLowerCase();
13
+ if (normalized.startsWith("ja")) return "ja";
14
+ if (normalized.startsWith("zh")) return "zh-CN";
15
+ if (normalized.startsWith("es")) return "es";
16
+ if (normalized.startsWith("de")) return "de";
17
+ if (normalized.startsWith("fr")) return "fr";
18
+ if (normalized.startsWith("ko")) return "ko";
19
+ return "en";
20
+ }
21
+ var SCAFFOLD_PRESET_NAMES = [
22
+ "empty",
23
+ "minimal",
24
+ "starter",
25
+ "rich",
26
+ "full",
27
+ "max",
28
+ "ultra"
29
+ ];
30
+ function isScaffoldPresetName(value) {
31
+ return SCAFFOLD_PRESET_NAMES.includes(value);
32
+ }
33
+ var np = (package_, factory, options) => ({
34
+ package: package_,
35
+ factory,
36
+ options
37
+ });
38
+ var obsidianMarkdown = np(
39
+ "@riebeckite/plugin-obsidian-markdown",
40
+ "obsidianMarkdown"
41
+ );
42
+ var colorMode = np("@riebeckite/plugin-color-mode", "colorModePlugin");
43
+ var l10n = np("@riebeckite/plugin-l10n", "l10n");
44
+ var seo = np("@riebeckite/plugin-seo", "seo");
45
+ var toc = np("@riebeckite/plugin-toc", "tocPlugin");
46
+ var properties = np("@riebeckite/plugin-properties", "properties");
47
+ var alias = np("@riebeckite/plugin-alias", "aliasPlugin");
48
+ var codeEnhance = np("@riebeckite/plugin-code-enhance", "codeEnhance");
49
+ var search = np("@riebeckite/plugin-search", "searchPlugin");
50
+ var backlinks = np("@riebeckite/plugin-backlinks", "backlinksPlugin");
51
+ var relatedPosts = np("@riebeckite/plugin-related-posts", "relatedPosts");
52
+ var recentPosts = np("@riebeckite/plugin-recent-posts", "recentPostsPlugin");
53
+ var attachment = np("@riebeckite/plugin-attachment", "attachment");
54
+ var media = np("@riebeckite/plugin-media", "media");
55
+ var responsiveImage = np(
56
+ "@riebeckite/plugin-responsive-image",
57
+ "responsiveImage"
58
+ );
59
+ var lightbox = np("@riebeckite/plugin-lightbox", "lightboxPlugin");
60
+ var highlight = np("@riebeckite/plugin-highlight", "highlight");
61
+ var codeTabs = np("@riebeckite/plugin-code-tabs", "codeTabs");
62
+ var codeAnnotations = np(
63
+ "@riebeckite/plugin-code-annotations",
64
+ "codeAnnotations"
65
+ );
66
+ var shortcodes = np("@riebeckite/plugin-shortcodes", "shortcodes");
67
+ var series = np("@riebeckite/plugin-series", "series");
68
+ var autoCardLink = np(
69
+ "@riebeckite/plugin-autocardlink",
70
+ "autoCardLinkPlugin"
71
+ );
72
+ var richEmbed = np("@riebeckite/plugin-rich-embed", "richEmbed");
73
+ var mermaid = np("@riebeckite/plugin-mermaid", "mermaid");
74
+ var graphviz = np("@riebeckite/plugin-graphviz", "graphviz");
75
+ var d2 = np("@riebeckite/plugin-d2", "d2");
76
+ var plantuml = np("@riebeckite/plugin-plantuml", "plantuml");
77
+ var chartjs = np("@riebeckite/plugin-chartjs", "chartjs");
78
+ var vegaLite = np("@riebeckite/plugin-vega-lite", "vegaLite");
79
+ var wavedrom = np("@riebeckite/plugin-wavedrom", "wavedrom");
80
+ var markmap = np("@riebeckite/plugin-markmap", "markmap");
81
+ var marp = np("@riebeckite/plugin-marp", "marp");
82
+ var qrCode = np("@riebeckite/plugin-qr-code", "qrCode");
83
+ var discordEmbed = np("@riebeckite/plugin-discord-embed", "discordEmbed");
84
+ var excalidraw = np("@riebeckite/plugin-excalidraw", "excalidraw");
85
+ var excaliBrain = np("@riebeckite/plugin-excalibrain", "excaliBrain");
86
+ var canvas = np("@riebeckite/plugin-canvas", "canvas");
87
+ var bases = np("@riebeckite/plugin-bases", "bases");
88
+ var dataview = np("@riebeckite/plugin-dataview", "dataviewPlugin");
89
+ var flashcards = np("@riebeckite/plugin-flashcards", "flashcardsPlugin");
90
+ var kanban = np("@riebeckite/plugin-kanban", "kanban");
91
+ var query = np("@riebeckite/plugin-query", "queryPlugin");
92
+ var localGraph = np("@riebeckite/plugin-local-graph", "localGraphPlugin");
93
+ var hoverPreview = np(
94
+ "@riebeckite/plugin-hover-preview",
95
+ "hoverPreviewPlugin"
96
+ );
97
+ var gardenExplorer = np(
98
+ "@riebeckite/plugin-garden-explorer",
99
+ "gardenExplorerPlugin"
100
+ );
101
+ var ux = np("@riebeckite/plugin-ux", "uxPlugin");
102
+ var dailyNotes = np("@riebeckite/plugin-daily-notes", "dailyNotesPlugin");
103
+ var rename = np("@riebeckite/plugin-rename", "renamePlugin");
104
+ var textFragment = np(
105
+ "@riebeckite/plugin-text-fragment",
106
+ "textFragmentPlugin"
107
+ );
108
+ var quality = np("@riebeckite/plugin-quality", "qualityPlugin");
109
+ var deploy = np("@riebeckite/plugin-deploy", "deployPlugin");
110
+ var diagnostics = np("@riebeckite/plugin-diagnostics", "diagnostics");
111
+ var defaultTheme = {
112
+ package: "@riebeckite/theme-default",
113
+ factory: "defaultTheme"
114
+ };
115
+ var minimalTheme = {
116
+ package: "@riebeckite/theme-minimal",
117
+ factory: "minimalTheme"
118
+ };
119
+ var BASE_APP_FILES = [
120
+ "server",
121
+ "client",
122
+ "config",
123
+ "content",
124
+ "paths",
125
+ "global",
126
+ "style",
127
+ "renderer"
128
+ ];
129
+ var empty = {
130
+ name: "empty",
131
+ description: "A blank application shell: no plugins, no theme, no content, no components.",
132
+ languages: [],
133
+ theme: null,
134
+ plugins: [],
135
+ contentPages: [],
136
+ appFiles: [...BASE_APP_FILES, "index"],
137
+ readme: "short"
138
+ };
139
+ var minimal = {
140
+ name: "minimal",
141
+ description: "The smallest useful site: Obsidian Markdown, the minimal theme, and one page.",
142
+ languages: ["en"],
143
+ theme: minimalTheme,
144
+ plugins: [obsidianMarkdown],
145
+ contentPages: ["index"],
146
+ appFiles: [...BASE_APP_FILES, "index", "slug", "article"],
147
+ readme: "short"
148
+ };
149
+ var starter = {
150
+ name: "starter",
151
+ description: "The default starter: Obsidian Markdown, color mode, seven languages, and a site header.",
152
+ languages: [...SCAFFOLD_LANGUAGES],
153
+ theme: defaultTheme,
154
+ plugins: [obsidianMarkdown, colorMode, l10n],
155
+ contentPages: ["index"],
156
+ appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
157
+ readme: "standard"
158
+ };
159
+ var rich = {
160
+ name: "rich",
161
+ description: "A showcasing starter: publishing and reading plugins plus guided ecosystem tour pages in seven languages.",
162
+ languages: [...SCAFFOLD_LANGUAGES],
163
+ theme: defaultTheme,
164
+ plugins: [
165
+ obsidianMarkdown,
166
+ colorMode,
167
+ l10n,
168
+ seo,
169
+ toc,
170
+ properties,
171
+ alias,
172
+ codeEnhance
173
+ ],
174
+ contentPages: ["index", "framework/plugins", "framework/themes"],
175
+ appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
176
+ readme: "rich"
177
+ };
178
+ var full = {
179
+ name: "full",
180
+ description: "A ready blog: discovery, media, and reading plugins plus a build guide.",
181
+ languages: [...SCAFFOLD_LANGUAGES],
182
+ theme: defaultTheme,
183
+ plugins: [
184
+ obsidianMarkdown,
185
+ colorMode,
186
+ l10n,
187
+ seo,
188
+ toc,
189
+ properties,
190
+ alias,
191
+ codeEnhance,
192
+ search,
193
+ backlinks,
194
+ relatedPosts,
195
+ recentPosts,
196
+ attachment,
197
+ media,
198
+ responsiveImage,
199
+ lightbox,
200
+ highlight,
201
+ codeTabs,
202
+ codeAnnotations,
203
+ shortcodes,
204
+ series,
205
+ autoCardLink,
206
+ richEmbed
207
+ ],
208
+ contentPages: ["index", "framework/plugins", "framework/themes", "guide"],
209
+ appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
210
+ readme: "rich"
211
+ };
212
+ var max = {
213
+ name: "max",
214
+ description: "Diagram and knowledge plugins on top of full, with showcase example pages.",
215
+ languages: [...SCAFFOLD_LANGUAGES],
216
+ theme: defaultTheme,
217
+ plugins: [
218
+ obsidianMarkdown,
219
+ colorMode,
220
+ l10n,
221
+ seo,
222
+ toc,
223
+ properties,
224
+ alias,
225
+ codeEnhance,
226
+ search,
227
+ backlinks,
228
+ relatedPosts,
229
+ recentPosts,
230
+ attachment,
231
+ media,
232
+ responsiveImage,
233
+ lightbox,
234
+ highlight,
235
+ codeTabs,
236
+ codeAnnotations,
237
+ shortcodes,
238
+ series,
239
+ autoCardLink,
240
+ richEmbed,
241
+ mermaid,
242
+ graphviz,
243
+ d2,
244
+ plantuml,
245
+ chartjs,
246
+ vegaLite,
247
+ wavedrom,
248
+ markmap,
249
+ marp,
250
+ qrCode,
251
+ discordEmbed,
252
+ excalidraw,
253
+ excaliBrain,
254
+ canvas,
255
+ bases,
256
+ dataview,
257
+ flashcards,
258
+ kanban,
259
+ query,
260
+ localGraph,
261
+ hoverPreview,
262
+ gardenExplorer,
263
+ ux
264
+ ],
265
+ contentPages: [
266
+ "index",
267
+ "framework/plugins",
268
+ "framework/themes",
269
+ "guide",
270
+ "examples"
271
+ ],
272
+ appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
273
+ readme: "rich"
274
+ };
275
+ var ultra = {
276
+ name: "ultra",
277
+ description: "The full plugin catalog and theme reference pages — everything the ecosystem offers.",
278
+ languages: [...SCAFFOLD_LANGUAGES],
279
+ theme: defaultTheme,
280
+ plugins: [
281
+ obsidianMarkdown,
282
+ colorMode,
283
+ l10n,
284
+ seo,
285
+ toc,
286
+ properties,
287
+ alias,
288
+ codeEnhance,
289
+ search,
290
+ backlinks,
291
+ relatedPosts,
292
+ recentPosts,
293
+ attachment,
294
+ media,
295
+ responsiveImage,
296
+ lightbox,
297
+ highlight,
298
+ codeTabs,
299
+ codeAnnotations,
300
+ shortcodes,
301
+ series,
302
+ autoCardLink,
303
+ richEmbed,
304
+ mermaid,
305
+ graphviz,
306
+ d2,
307
+ plantuml,
308
+ chartjs,
309
+ vegaLite,
310
+ wavedrom,
311
+ markmap,
312
+ marp,
313
+ qrCode,
314
+ discordEmbed,
315
+ excalidraw,
316
+ excaliBrain,
317
+ canvas,
318
+ bases,
319
+ dataview,
320
+ flashcards,
321
+ kanban,
322
+ query,
323
+ localGraph,
324
+ hoverPreview,
325
+ gardenExplorer,
326
+ ux,
327
+ dailyNotes,
328
+ rename,
329
+ textFragment,
330
+ quality,
331
+ deploy,
332
+ diagnostics
333
+ ],
334
+ contentPages: [
335
+ "index",
336
+ "framework/plugins",
337
+ "framework/themes",
338
+ "guide",
339
+ "examples",
340
+ "reference/plugins",
341
+ "reference/themes"
342
+ ],
343
+ appFiles: [...BASE_APP_FILES, "index", "slug", "header", "article"],
344
+ readme: "rich"
345
+ };
346
+ var scaffoldPresets = { empty, minimal, starter, rich, full, max, ultra };
347
+ var SCAFFOLD_DEFAULT_PRESET = "starter";
348
+ function resolveScaffoldPreset(value) {
349
+ if (value === void 0) return scaffoldPresets[SCAFFOLD_DEFAULT_PRESET];
350
+ if (typeof value === "object") return value;
351
+ const preset = scaffoldPresets[value];
352
+ if (!preset) {
353
+ throw new Error(
354
+ `Unknown scaffold preset: ${value}. Available presets: ${SCAFFOLD_PRESET_NAMES.join(", ")}.`
355
+ );
356
+ }
357
+ return preset;
358
+ }
359
+ export {
360
+ SCAFFOLD_DEFAULT_PRESET,
361
+ SCAFFOLD_LANGUAGES,
362
+ SCAFFOLD_PRESET_NAMES,
363
+ defaultLanguageForLocale,
364
+ empty,
365
+ full,
366
+ isScaffoldPresetName,
367
+ max,
368
+ minimal,
369
+ resolveScaffoldPreset,
370
+ rich,
371
+ scaffoldPresets,
372
+ starter,
373
+ ultra
374
+ };
@@ -1,3 +1,4 @@
1
+ import { type ScaffoldPreset } from "./presets.js";
1
2
  export type SiteTemplateVariables = {
2
3
  readonly name: string;
3
4
  readonly title: string;
@@ -9,4 +10,4 @@ export type SiteTemplateFile = {
9
10
  readonly path: string;
10
11
  readonly content: string;
11
12
  };
12
- export declare function siteTemplateFiles(variables: SiteTemplateVariables): readonly SiteTemplateFile[];
13
+ export declare function siteTemplateFiles(preset: ScaffoldPreset, variables: SiteTemplateVariables): readonly SiteTemplateFile[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/honox",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,6 +12,12 @@
12
12
  "source": "./index.ts",
13
13
  "default": "./dist/index.js"
14
14
  },
15
+ "./scaffold": {
16
+ "types": "./dist/src/scaffold/presets.d.ts",
17
+ "import": "./dist/src/scaffold/presets.js",
18
+ "source": "./src/scaffold/presets.ts",
19
+ "default": "./dist/src/scaffold/presets.js"
20
+ },
15
21
  "./server": {
16
22
  "types": "./dist/server.d.ts",
17
23
  "import": "./dist/server.js",
@@ -30,7 +36,7 @@
30
36
  "esbuild": "^0.28.2",
31
37
  "hono": "^4.12.25",
32
38
  "vite": "^8.0.9",
33
- "@riebeckite/core": "0.0.3"
39
+ "@riebeckite/core": "0.0.5"
34
40
  },
35
41
  "publishConfig": {
36
42
  "access": "public"