@zpress/core 0.4.0 → 0.6.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/README.md +4 -2
- package/dist/index.d.ts +120 -618
- package/dist/index.mjs +26192 -443
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
import { CardConfig } from '@zpress/config';
|
|
2
|
+
import { COLOR_MODES } from '@zpress/config';
|
|
3
|
+
import { ColorMode } from '@zpress/config';
|
|
4
|
+
import { ConfigError } from '@zpress/config';
|
|
5
|
+
import { configError } from '@zpress/config';
|
|
6
|
+
import { ConfigResult } from '@zpress/config';
|
|
7
|
+
import { Discovery } from '@zpress/config';
|
|
8
|
+
import { Entry } from '@zpress/config';
|
|
9
|
+
import { Feature } from '@zpress/config';
|
|
10
|
+
import { FlatDiscoveryConfig } from '@zpress/config';
|
|
11
|
+
import { Frontmatter } from '@zpress/config';
|
|
12
|
+
import { HeroConfig } from '@zpress/config';
|
|
13
|
+
import { IconColor } from '@zpress/config';
|
|
14
|
+
import { IconConfig } from '@zpress/config';
|
|
15
|
+
import { loadConfig } from '@zpress/config';
|
|
16
|
+
import { NavItem } from '@zpress/config';
|
|
17
|
+
import { OpenAPIConfig } from '@zpress/config';
|
|
18
|
+
import { RecursiveDiscoveryConfig } from '@zpress/config';
|
|
19
|
+
import { resolveDefaultColorMode } from '@zpress/config';
|
|
20
|
+
import { ResolvedPage } from '@zpress/config';
|
|
21
|
+
import { ResolvedSection } from '@zpress/config';
|
|
22
|
+
import { Result } from '@zpress/config';
|
|
23
|
+
import { Section } from '@zpress/config';
|
|
24
|
+
import { SeoConfig } from '@zpress/config';
|
|
25
|
+
import { THEME_NAMES } from '@zpress/config';
|
|
26
|
+
import { ThemeColors } from '@zpress/config';
|
|
27
|
+
import { ThemeConfig } from '@zpress/config';
|
|
28
|
+
import { ThemeName } from '@zpress/config';
|
|
29
|
+
import { TitleConfig } from '@zpress/config';
|
|
30
|
+
import { Workspace } from '@zpress/config';
|
|
31
|
+
import { WorkspaceCategory } from '@zpress/config';
|
|
32
|
+
import { WorkspaceGroup } from '@zpress/config';
|
|
33
|
+
import { WorkspaceItem } from '@zpress/config';
|
|
34
|
+
import { ZpressConfig } from '@zpress/config';
|
|
35
|
+
|
|
1
36
|
/**
|
|
2
37
|
* Input configuration for asset generation, extracted from ZpressConfig.
|
|
3
38
|
*/
|
|
@@ -20,77 +55,17 @@ export declare interface AssetError {
|
|
|
20
55
|
*/
|
|
21
56
|
export declare type AssetResult<T> = Result<T, AssetError>;
|
|
22
57
|
|
|
23
|
-
|
|
24
|
-
* Controls how an entry appears as a card on its parent section's
|
|
25
|
-
* auto-generated landing page.
|
|
26
|
-
*
|
|
27
|
-
* When present, the landing page uses workspace-style cards
|
|
28
|
-
* (icon + scope + name + description + tags + optional badge).
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* card: {
|
|
33
|
-
* icon: 'devicon:hono',
|
|
34
|
-
* iconColor: 'api',
|
|
35
|
-
* scope: 'apps/',
|
|
36
|
-
* description: 'Hono REST API with RPC-typed routes',
|
|
37
|
-
* tags: ['Hono', 'REST', 'Serverless'],
|
|
38
|
-
* badge: { src: '/logos/vercel.svg', alt: 'Vercel' },
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare interface CardConfig {
|
|
43
|
-
/**
|
|
44
|
-
* Iconify identifier for the card icon (e.g. 'devicon:hono').
|
|
45
|
-
*/
|
|
46
|
-
icon?: string;
|
|
47
|
-
/**
|
|
48
|
-
* CSS class suffix for the icon color (maps to `.workspace-icon--{color}`).
|
|
49
|
-
*/
|
|
50
|
-
iconColor?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Scope label shown above the name (e.g. `"apps/"`).
|
|
53
|
-
*/
|
|
54
|
-
scope?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Short description shown on the card. Overrides auto-extracted description.
|
|
57
|
-
*/
|
|
58
|
-
description?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Technology tags shown at the bottom of the card.
|
|
61
|
-
*/
|
|
62
|
-
tags?: string[];
|
|
63
|
-
/**
|
|
64
|
-
* Deploy badge image shown in the card header.
|
|
65
|
-
*/
|
|
66
|
-
badge?: {
|
|
67
|
-
src: string;
|
|
68
|
-
alt: string;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
58
|
+
export { CardConfig }
|
|
71
59
|
|
|
72
|
-
|
|
73
|
-
* Error produced during config validation in `defineConfig`.
|
|
74
|
-
*/
|
|
75
|
-
export declare interface ConfigError {
|
|
76
|
-
readonly _tag: 'ConfigError';
|
|
77
|
-
readonly type: 'empty_sections' | 'missing_field' | 'duplicate_prefix' | 'invalid_icon' | 'invalid_entry';
|
|
78
|
-
readonly message: string;
|
|
79
|
-
}
|
|
60
|
+
export { COLOR_MODES }
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
* Create a `ConfigError` value.
|
|
83
|
-
*
|
|
84
|
-
* @param type - Error classification
|
|
85
|
-
* @param message - Human-readable description
|
|
86
|
-
* @returns A frozen `ConfigError` object
|
|
87
|
-
*/
|
|
88
|
-
export declare function configError(type: ConfigError['type'], message: string): ConfigError;
|
|
62
|
+
export { ColorMode }
|
|
89
63
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
64
|
+
export { ConfigError }
|
|
65
|
+
|
|
66
|
+
export { configError }
|
|
67
|
+
|
|
68
|
+
export { ConfigResult }
|
|
94
69
|
|
|
95
70
|
/**
|
|
96
71
|
* Create all derived project paths from a resolved directory.
|
|
@@ -110,229 +85,15 @@ export declare function createPaths(dir: string): Paths;
|
|
|
110
85
|
*/
|
|
111
86
|
export declare function defineConfig(config: ZpressConfig): ZpressConfig;
|
|
112
87
|
|
|
113
|
-
|
|
114
|
-
* A single node in the information architecture.
|
|
115
|
-
*
|
|
116
|
-
* What you provide determines what it is:
|
|
117
|
-
*
|
|
118
|
-
* **Page — explicit file**
|
|
119
|
-
* ```ts
|
|
120
|
-
* { text: 'Architecture', link: '/architecture', from: 'docs/architecture.md' }
|
|
121
|
-
* ```
|
|
122
|
-
*
|
|
123
|
-
* **Page — inline/generated content**
|
|
124
|
-
* ```ts
|
|
125
|
-
* { text: 'Overview', link: '/api/overview', content: '# API Overview\n...' }
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* **Section — explicit children**
|
|
129
|
-
* ```ts
|
|
130
|
-
* { text: 'Guides', items: [ ... ] }
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* **Section — auto-discovered from glob**
|
|
134
|
-
* ```ts
|
|
135
|
-
* { text: 'Guides', prefix: '/guides', from: 'docs/guides/*.md' }
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* **Section — mix of explicit + auto-discovered**
|
|
139
|
-
* ```ts
|
|
140
|
-
* {
|
|
141
|
-
* text: 'Guides',
|
|
142
|
-
* prefix: '/guides',
|
|
143
|
-
* from: 'docs/guides/*.md',
|
|
144
|
-
* items: [
|
|
145
|
-
* { text: 'Getting Started', link: '/guides/start', from: 'docs/intro.md' },
|
|
146
|
-
* ],
|
|
147
|
-
* }
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
export declare interface Entry {
|
|
151
|
-
/**
|
|
152
|
-
* Display text in sidebar and nav.
|
|
153
|
-
*/
|
|
154
|
-
readonly text: string;
|
|
155
|
-
/**
|
|
156
|
-
* Output URL path.
|
|
157
|
-
* - Pages: exact URL (e.g. `"/guides/add-api-route"`)
|
|
158
|
-
* - Sections: optional — makes the section header clickable
|
|
159
|
-
*/
|
|
160
|
-
readonly link?: UrlPath;
|
|
161
|
-
/**
|
|
162
|
-
* Content source — file path or glob, relative to repo root.
|
|
163
|
-
*
|
|
164
|
-
* - **No wildcards** → single file (e.g. `"docs/architecture.md"`)
|
|
165
|
-
* - **With wildcards** → auto-discover children (e.g. `"docs/guides/*.md"`)
|
|
166
|
-
*/
|
|
167
|
-
readonly from?: FilePath | GlobPattern;
|
|
168
|
-
/**
|
|
169
|
-
* URL prefix for auto-discovered children.
|
|
170
|
-
* Used with glob `from` — each discovered file gets `prefix + "/" + slug`.
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* `prefix: "/guides"` + file `add-api-route.md` → `/guides/add-api-route`
|
|
174
|
-
*/
|
|
175
|
-
readonly prefix?: UrlPath;
|
|
176
|
-
/**
|
|
177
|
-
* Inline markdown or async content generator.
|
|
178
|
-
* For virtual pages that have no source `.md` file.
|
|
179
|
-
* Mutually exclusive with `from`.
|
|
180
|
-
*/
|
|
181
|
-
readonly content?: string | (() => string | Promise<string>);
|
|
182
|
-
/**
|
|
183
|
-
* Child entries — pages and/or sub-sections.
|
|
184
|
-
*/
|
|
185
|
-
readonly items?: readonly Entry[];
|
|
186
|
-
/**
|
|
187
|
-
* Make this section collapsible in the sidebar.
|
|
188
|
-
* Sections at depth > 1 are collapsible by default.
|
|
189
|
-
* Set to `false` to keep a deep section always-open.
|
|
190
|
-
*/
|
|
191
|
-
readonly collapsible?: boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Exclude globs, scoped to this entry's `from` glob.
|
|
194
|
-
*/
|
|
195
|
-
readonly exclude?: readonly GlobPattern[];
|
|
196
|
-
/**
|
|
197
|
-
* Hide from sidebar. Page is still built and routable.
|
|
198
|
-
* Useful for pages that should exist but not clutter navigation.
|
|
199
|
-
*/
|
|
200
|
-
readonly hidden?: boolean;
|
|
201
|
-
/**
|
|
202
|
-
* Frontmatter injected at build time.
|
|
203
|
-
* - On a page: applied to that page.
|
|
204
|
-
* - On a section: applied to all pages within.
|
|
205
|
-
*/
|
|
206
|
-
readonly frontmatter?: Frontmatter;
|
|
207
|
-
/**
|
|
208
|
-
* How to derive `text` for auto-discovered children.
|
|
209
|
-
* - `"filename"` — kebab-to-title from filename (default)
|
|
210
|
-
* - `"heading"` — first `# heading` in the file
|
|
211
|
-
* - `"frontmatter"` — `title` field from YAML frontmatter, falls back to heading
|
|
212
|
-
*/
|
|
213
|
-
readonly textFrom?: 'filename' | 'heading' | 'frontmatter';
|
|
214
|
-
/**
|
|
215
|
-
* Transform function applied to auto-derived text (from `textFrom`).
|
|
216
|
-
* Called after text derivation for glob-discovered and recursive children.
|
|
217
|
-
* Does NOT apply to entries with explicit `text` (those are already user-controlled).
|
|
218
|
-
*
|
|
219
|
-
* @param text - The derived text (from heading or filename)
|
|
220
|
-
* @param slug - The filename slug (without extension)
|
|
221
|
-
* @returns Transformed text for sidebar display
|
|
222
|
-
*/
|
|
223
|
-
readonly textTransform?: (text: string, slug: string) => string;
|
|
224
|
-
/**
|
|
225
|
-
* Sort order for auto-discovered children.
|
|
226
|
-
* - `"alpha"` — alphabetical by derived text (default)
|
|
227
|
-
* - `"filename"` — alphabetical by filename
|
|
228
|
-
* - Custom comparator function
|
|
229
|
-
*/
|
|
230
|
-
readonly sort?: 'alpha' | 'filename' | ((a: ResolvedPage, b: ResolvedPage) => number);
|
|
231
|
-
/**
|
|
232
|
-
* Enable recursive directory-based nesting for glob patterns.
|
|
233
|
-
* When true, directory structure under the glob base drives sidebar nesting:
|
|
234
|
-
* - The `indexFile` (default `"overview"`) in a directory becomes the section header page
|
|
235
|
-
* - Other `.md` files become children
|
|
236
|
-
* - Sub-directories become nested collapsible sections
|
|
237
|
-
*
|
|
238
|
-
* Requires `from` with a recursive glob (e.g. `"docs/**\/*.md"`) and `prefix`.
|
|
239
|
-
* @default false
|
|
240
|
-
*/
|
|
241
|
-
readonly recursive?: boolean;
|
|
242
|
-
/**
|
|
243
|
-
* Filename (without extension) used as the section header page in each directory.
|
|
244
|
-
* Only meaningful when `recursive` is true.
|
|
245
|
-
* @default "overview"
|
|
246
|
-
*/
|
|
247
|
-
readonly indexFile?: string;
|
|
248
|
-
/**
|
|
249
|
-
* Iconify icon identifier (e.g. `"pixelarticons:speed-fast"`).
|
|
250
|
-
* Used on home page feature cards when auto-generated from sections.
|
|
251
|
-
*/
|
|
252
|
-
readonly icon?: string;
|
|
253
|
-
/**
|
|
254
|
-
* Card display metadata for the parent section's auto-generated landing page.
|
|
255
|
-
*
|
|
256
|
-
* When present on child entries, the parent's landing page uses
|
|
257
|
-
* workspace-style cards instead of the default simple cards.
|
|
258
|
-
*/
|
|
259
|
-
readonly card?: CardConfig;
|
|
260
|
-
/**
|
|
261
|
-
* Isolate this section into its own Rspress sidebar namespace.
|
|
262
|
-
*
|
|
263
|
-
* When `true`, the section's children appear under a dedicated sidebar
|
|
264
|
-
* keyed by `link` (e.g. `"/apps/"`) instead of the root `"/"` sidebar.
|
|
265
|
-
* This mirrors how the OpenAPI reference already works.
|
|
266
|
-
*
|
|
267
|
-
* Requires `link` to be set.
|
|
268
|
-
* @default false
|
|
269
|
-
*/
|
|
270
|
-
readonly isolated?: boolean;
|
|
271
|
-
}
|
|
88
|
+
export { Discovery }
|
|
272
89
|
|
|
273
|
-
|
|
274
|
-
* Explicit feature card for the home page.
|
|
275
|
-
*
|
|
276
|
-
* When `features` is provided on the config, these replace the
|
|
277
|
-
* auto-generated feature cards that are normally derived from
|
|
278
|
-
* top-level sections.
|
|
279
|
-
*
|
|
280
|
-
* @example
|
|
281
|
-
* ```ts
|
|
282
|
-
* {
|
|
283
|
-
* text: 'Getting Started',
|
|
284
|
-
* description: 'Everything you need to set up and start building.',
|
|
285
|
-
* link: '/getting-started',
|
|
286
|
-
* icon: 'pixelarticons:speed-fast',
|
|
287
|
-
* }
|
|
288
|
-
* ```
|
|
289
|
-
*/
|
|
290
|
-
export declare interface Feature {
|
|
291
|
-
/**
|
|
292
|
-
* Display title for the feature card.
|
|
293
|
-
*/
|
|
294
|
-
readonly text: string;
|
|
295
|
-
/**
|
|
296
|
-
* Short description shown below the title.
|
|
297
|
-
*/
|
|
298
|
-
readonly description: string;
|
|
299
|
-
/**
|
|
300
|
-
* Link target when the card is clicked.
|
|
301
|
-
*/
|
|
302
|
-
readonly link?: string;
|
|
303
|
-
/**
|
|
304
|
-
* Iconify icon identifier (e.g. `"pixelarticons:speed-fast"`).
|
|
305
|
-
*/
|
|
306
|
-
readonly icon?: string;
|
|
307
|
-
}
|
|
90
|
+
export { Entry }
|
|
308
91
|
|
|
309
|
-
|
|
310
|
-
* Relative file path from repo root (e.g. `"docs/guides/add-api-route.md"`)
|
|
311
|
-
*/
|
|
312
|
-
declare type FilePath = string;
|
|
92
|
+
export { Feature }
|
|
313
93
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
export declare interface Frontmatter {
|
|
318
|
-
readonly title?: string;
|
|
319
|
-
readonly titleTemplate?: string | boolean;
|
|
320
|
-
readonly description?: string;
|
|
321
|
-
readonly layout?: 'doc' | 'page' | 'home' | (string & {});
|
|
322
|
-
readonly sidebar?: boolean;
|
|
323
|
-
readonly aside?: boolean | 'left';
|
|
324
|
-
readonly outline?: false | number | [number, number] | 'deep';
|
|
325
|
-
readonly navbar?: boolean;
|
|
326
|
-
readonly editLink?: boolean;
|
|
327
|
-
readonly lastUpdated?: boolean;
|
|
328
|
-
readonly footer?: boolean;
|
|
329
|
-
readonly pageClass?: string;
|
|
330
|
-
readonly head?: readonly [string, Record<string, string>][];
|
|
331
|
-
/**
|
|
332
|
-
* Arbitrary extra fields merged into frontmatter.
|
|
333
|
-
*/
|
|
334
|
-
readonly [key: string]: unknown;
|
|
335
|
-
}
|
|
94
|
+
export { FlatDiscoveryConfig }
|
|
95
|
+
|
|
96
|
+
export { Frontmatter }
|
|
336
97
|
|
|
337
98
|
/**
|
|
338
99
|
* Generate banner, logo, and icon SVGs, writing them to the public directory.
|
|
@@ -383,27 +144,33 @@ export declare function generateIconSvg(config: AssetConfig): AssetResult<Genera
|
|
|
383
144
|
*/
|
|
384
145
|
export declare function generateLogoSvg(config: AssetConfig): AssetResult<GeneratedAsset>;
|
|
385
146
|
|
|
386
|
-
/**
|
|
387
|
-
* Glob pattern (e.g. `"docs/guides/*.md"`)
|
|
388
|
-
*/
|
|
389
|
-
declare type GlobPattern = string;
|
|
390
|
-
|
|
391
147
|
/**
|
|
392
148
|
* Returns true if the string contains glob metacharacters.
|
|
393
149
|
*/
|
|
394
150
|
export declare function hasGlobChars(s: string): boolean;
|
|
395
151
|
|
|
152
|
+
export { HeroConfig }
|
|
153
|
+
|
|
396
154
|
/**
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* Returns a `ConfigResult` tuple — the CLI boundary is responsible for
|
|
400
|
-
* surfacing any error and exiting. Validation runs here (not in
|
|
401
|
-
* `defineConfig`) so every consumer gets structured error feedback.
|
|
155
|
+
* Rotating color palette applied to auto-generated icons.
|
|
156
|
+
* Each section gets the next color in the cycle.
|
|
402
157
|
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
158
|
+
* This array defines the order in which colors are assigned to
|
|
159
|
+
* auto-generated section cards and feature icons.
|
|
405
160
|
*/
|
|
406
|
-
export declare
|
|
161
|
+
export declare const ICON_COLORS: readonly IconColor[];
|
|
162
|
+
|
|
163
|
+
export declare const ICON_PREFIXES: readonly IconPrefix[];
|
|
164
|
+
|
|
165
|
+
export { IconColor }
|
|
166
|
+
|
|
167
|
+
export { IconConfig }
|
|
168
|
+
|
|
169
|
+
export declare type IconId = `${IconPrefix}:${string}`;
|
|
170
|
+
|
|
171
|
+
export declare type IconPrefix = 'catppuccin' | 'devicon' | 'logos' | 'material-icon-theme' | 'mdi' | 'pixelarticons' | 'simple-icons' | 'skill-icons' | 'vscode-icons';
|
|
172
|
+
|
|
173
|
+
export { loadConfig }
|
|
407
174
|
|
|
408
175
|
/**
|
|
409
176
|
* Load the previous sync manifest from disk.
|
|
@@ -453,31 +220,9 @@ export declare interface ManifestEntry {
|
|
|
453
220
|
readonly outputPath: string;
|
|
454
221
|
}
|
|
455
222
|
|
|
456
|
-
export
|
|
457
|
-
readonly text: string;
|
|
458
|
-
readonly link?: UrlPath;
|
|
459
|
-
readonly items?: readonly NavItem[];
|
|
460
|
-
readonly activeMatch?: string;
|
|
461
|
-
}
|
|
223
|
+
export { NavItem }
|
|
462
224
|
|
|
463
|
-
|
|
464
|
-
* Configuration for OpenAPI spec integration.
|
|
465
|
-
*/
|
|
466
|
-
export declare interface OpenAPIConfig {
|
|
467
|
-
/**
|
|
468
|
-
* Path to openapi.json relative to repo root.
|
|
469
|
-
*/
|
|
470
|
-
spec: FilePath;
|
|
471
|
-
/**
|
|
472
|
-
* URL prefix for API operation pages (e.g., '/api').
|
|
473
|
-
*/
|
|
474
|
-
prefix: UrlPath;
|
|
475
|
-
/**
|
|
476
|
-
* Sidebar group title.
|
|
477
|
-
* @default 'API Reference'
|
|
478
|
-
*/
|
|
479
|
-
title?: string;
|
|
480
|
-
}
|
|
225
|
+
export { OpenAPIConfig }
|
|
481
226
|
|
|
482
227
|
/**
|
|
483
228
|
* Data for a single page to be written to the output directory.
|
|
@@ -513,11 +258,15 @@ export declare interface Paths {
|
|
|
513
258
|
readonly cacheDir: string;
|
|
514
259
|
}
|
|
515
260
|
|
|
261
|
+
export { RecursiveDiscoveryConfig }
|
|
262
|
+
|
|
263
|
+
export { resolveDefaultColorMode }
|
|
264
|
+
|
|
516
265
|
/**
|
|
517
266
|
* Internal resolved node — produced by the resolver, consumed by copy + sidebar/nav generators.
|
|
518
267
|
*/
|
|
519
268
|
export declare interface ResolvedEntry {
|
|
520
|
-
readonly
|
|
269
|
+
readonly title: string;
|
|
521
270
|
readonly link?: string;
|
|
522
271
|
readonly collapsible?: boolean;
|
|
523
272
|
readonly hidden?: boolean;
|
|
@@ -543,102 +292,58 @@ export declare interface ResolvedEntry {
|
|
|
543
292
|
}
|
|
544
293
|
|
|
545
294
|
/**
|
|
546
|
-
*
|
|
295
|
+
* Normalized icon output — always has both `id` and `color`.
|
|
547
296
|
*/
|
|
548
|
-
export declare interface
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
*/
|
|
552
|
-
readonly text: string;
|
|
553
|
-
/**
|
|
554
|
-
* Output URL path.
|
|
555
|
-
*/
|
|
556
|
-
readonly link: UrlPath;
|
|
557
|
-
/**
|
|
558
|
-
* Source file path (undefined for virtual pages).
|
|
559
|
-
*/
|
|
560
|
-
readonly source?: FilePath;
|
|
561
|
-
/**
|
|
562
|
-
* Merged frontmatter.
|
|
563
|
-
*/
|
|
564
|
-
readonly frontmatter: Frontmatter;
|
|
297
|
+
export declare interface ResolvedIcon {
|
|
298
|
+
readonly id: string;
|
|
299
|
+
readonly color: IconColor;
|
|
565
300
|
}
|
|
566
301
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
export declare interface ResolvedSection {
|
|
571
|
-
readonly text: string;
|
|
572
|
-
readonly link?: UrlPath;
|
|
573
|
-
readonly collapsible?: boolean;
|
|
574
|
-
readonly items: readonly (ResolvedPage | ResolvedSection)[];
|
|
575
|
-
}
|
|
302
|
+
export { ResolvedPage }
|
|
303
|
+
|
|
304
|
+
export { ResolvedSection }
|
|
576
305
|
|
|
577
306
|
/**
|
|
578
|
-
* Walk the
|
|
307
|
+
* Walk the Section tree and produce a ResolvedEntry tree.
|
|
579
308
|
*
|
|
580
309
|
* Resolves globs, derives text, merges frontmatter, deduplicates.
|
|
581
310
|
* Returns a `SyncOutcome` tuple — the caller is responsible for
|
|
582
311
|
* surfacing errors and exiting.
|
|
583
312
|
*
|
|
584
|
-
* @param
|
|
313
|
+
* @param sections - Config section tree to resolve
|
|
585
314
|
* @param ctx - Sync context (provides repo root, config, quiet flag)
|
|
586
|
-
* @param inheritedFrontmatter - Frontmatter inherited from parent
|
|
315
|
+
* @param inheritedFrontmatter - Frontmatter inherited from parent sections
|
|
587
316
|
* @param depth - Current nesting depth (0 = top-level)
|
|
588
317
|
* @returns Result tuple containing resolved entry tree or the first sync error
|
|
589
318
|
*/
|
|
590
|
-
export declare function resolveEntries(
|
|
319
|
+
export declare function resolveEntries(sections: readonly Section[], ctx: SyncContext, inheritedFrontmatter?: Frontmatter, depth?: number): Promise<readonly [SyncError, null] | readonly [null, ResolvedEntry[]]>;
|
|
591
320
|
|
|
592
321
|
/**
|
|
593
|
-
*
|
|
322
|
+
* Normalize an `IconConfig` value into a `ResolvedIcon`.
|
|
594
323
|
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
* Source `.md` files are never edited.
|
|
324
|
+
* - String → `{ id: string, color: "purple" }` (default color)
|
|
325
|
+
* - Object → pass-through `{ id, color }`
|
|
598
326
|
*
|
|
599
|
-
* @
|
|
600
|
-
*
|
|
601
|
-
* import { defineConfig } from '@zpress/core'
|
|
602
|
-
*
|
|
603
|
-
* export default defineConfig({
|
|
604
|
-
* title: 'My Docs',
|
|
605
|
-
* sections: [
|
|
606
|
-
* {
|
|
607
|
-
* text: 'Introduction',
|
|
608
|
-
* items: [
|
|
609
|
-
* { text: 'Architecture', link: '/architecture', from: 'docs/architecture.md' },
|
|
610
|
-
* { text: 'Structure', link: '/structure', from: 'docs/structure.md' },
|
|
611
|
-
* ],
|
|
612
|
-
* },
|
|
613
|
-
* {
|
|
614
|
-
* text: 'Guides',
|
|
615
|
-
* prefix: '/guides',
|
|
616
|
-
* from: 'docs/guides/*.md',
|
|
617
|
-
* },
|
|
618
|
-
* {
|
|
619
|
-
* text: 'API Reference',
|
|
620
|
-
* items: [
|
|
621
|
-
* { text: 'Overview', link: '/api/overview', content: '# API\n...' },
|
|
622
|
-
* { text: 'Routes', link: '/api/routes', from: 'apps/api/docs/routes.md' },
|
|
623
|
-
* ],
|
|
624
|
-
* },
|
|
625
|
-
* ],
|
|
626
|
-
* })
|
|
627
|
-
* ```
|
|
327
|
+
* @param icon - Icon config value (string or object)
|
|
328
|
+
* @returns Normalized `{ id, color }` pair
|
|
628
329
|
*/
|
|
330
|
+
export declare function resolveIcon(icon: IconConfig): ResolvedIcon;
|
|
331
|
+
|
|
629
332
|
/**
|
|
630
|
-
*
|
|
333
|
+
* Normalize an optional `IconConfig` value into a `ResolvedIcon | undefined`.
|
|
631
334
|
*
|
|
632
|
-
*
|
|
633
|
-
* Failure: `[error, null]`
|
|
335
|
+
* Returns `undefined` when `icon` is `undefined`.
|
|
634
336
|
*
|
|
635
|
-
* @
|
|
636
|
-
*
|
|
637
|
-
* const [error, value] = loadConfig(path)
|
|
638
|
-
* if (error) return [error, null]
|
|
639
|
-
* ```
|
|
337
|
+
* @param icon - Optional icon config value
|
|
338
|
+
* @returns Normalized `{ id, color }` pair, or `undefined`
|
|
640
339
|
*/
|
|
641
|
-
export declare
|
|
340
|
+
export declare function resolveOptionalIcon(icon: IconConfig | undefined): ResolvedIcon | undefined;
|
|
341
|
+
|
|
342
|
+
export { Result }
|
|
343
|
+
|
|
344
|
+
export { Section }
|
|
345
|
+
|
|
346
|
+
export { SeoConfig }
|
|
642
347
|
|
|
643
348
|
/**
|
|
644
349
|
* Rspress sidebar item shape.
|
|
@@ -700,12 +405,6 @@ export declare interface SyncContext {
|
|
|
700
405
|
readonly sourceMap?: SourceMap;
|
|
701
406
|
}
|
|
702
407
|
|
|
703
|
-
/**
|
|
704
|
-
* Domain-specific error types for the sync engine.
|
|
705
|
-
*
|
|
706
|
-
* All sync operations return `Result<T, SyncError>` instead of throwing.
|
|
707
|
-
* Config validation returns `Result<T, ConfigError>`.
|
|
708
|
-
*/
|
|
709
408
|
/**
|
|
710
409
|
* Error produced by the sync engine during entry resolution, page copy, or sidebar generation.
|
|
711
410
|
*/
|
|
@@ -750,10 +449,15 @@ export declare interface SyncResult {
|
|
|
750
449
|
readonly elapsed: number;
|
|
751
450
|
}
|
|
752
451
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
452
|
+
export { THEME_NAMES }
|
|
453
|
+
|
|
454
|
+
export { ThemeColors }
|
|
455
|
+
|
|
456
|
+
export { ThemeConfig }
|
|
457
|
+
|
|
458
|
+
export { ThemeName }
|
|
459
|
+
|
|
460
|
+
export { TitleConfig }
|
|
757
461
|
|
|
758
462
|
/**
|
|
759
463
|
* Validate the entire config, returning the first error found.
|
|
@@ -763,216 +467,14 @@ declare type UrlPath = string;
|
|
|
763
467
|
*/
|
|
764
468
|
export declare function validateConfig(config: ZpressConfig): ConfigResult<ZpressConfig>;
|
|
765
469
|
|
|
766
|
-
|
|
767
|
-
* A named group of workspace items for custom workspace categories.
|
|
768
|
-
*
|
|
769
|
-
* Lets users define arbitrary groups beyond the built-in `apps` and `packages`
|
|
770
|
-
* (e.g. "Services", "Tools", "Integrations") that receive the same
|
|
771
|
-
* card/landing-page treatment.
|
|
772
|
-
*
|
|
773
|
-
* @example
|
|
774
|
-
* ```ts
|
|
775
|
-
* {
|
|
776
|
-
* name: 'Integrations',
|
|
777
|
-
* description: 'Third-party service connectors',
|
|
778
|
-
* icon: 'pixelarticons:integration',
|
|
779
|
-
* items: [
|
|
780
|
-
* { text: 'Stripe', description: 'Payment processing', docsPrefix: '/integrations/stripe' },
|
|
781
|
-
* ],
|
|
782
|
-
* }
|
|
783
|
-
* ```
|
|
784
|
-
*/
|
|
785
|
-
export declare interface WorkspaceGroup {
|
|
786
|
-
readonly name: string;
|
|
787
|
-
readonly description: string;
|
|
788
|
-
readonly icon: string;
|
|
789
|
-
readonly items: readonly WorkspaceItem[];
|
|
790
|
-
/**
|
|
791
|
-
* URL prefix override for the group's landing page.
|
|
792
|
-
* Defaults to `/${slugify(name)}` when omitted.
|
|
793
|
-
*/
|
|
794
|
-
readonly link?: string;
|
|
795
|
-
}
|
|
470
|
+
export { Workspace }
|
|
796
471
|
|
|
797
|
-
|
|
798
|
-
* A workspace item representing an app or package in the monorepo.
|
|
799
|
-
*
|
|
800
|
-
* Used as the single source of truth for workspace metadata — home page cards,
|
|
801
|
-
* landing page cards, and introduction bullets all derive from these arrays.
|
|
802
|
-
*
|
|
803
|
-
* @example
|
|
804
|
-
* ```ts
|
|
805
|
-
* {
|
|
806
|
-
* text: 'API',
|
|
807
|
-
* icon: 'devicon:hono',
|
|
808
|
-
* iconColor: 'api',
|
|
809
|
-
* description: 'Hono REST API serving all client applications with RPC-typed routes',
|
|
810
|
-
* tags: ['hono', 'react', 'vercel'],
|
|
811
|
-
* badge: { src: '/logos/vercel.svg', alt: 'Vercel' },
|
|
812
|
-
* docsPrefix: '/apps/api',
|
|
813
|
-
* }
|
|
814
|
-
* ```
|
|
815
|
-
*/
|
|
816
|
-
export declare interface WorkspaceItem {
|
|
817
|
-
/**
|
|
818
|
-
* Display name (e.g. "API", "Console", "AI").
|
|
819
|
-
*/
|
|
820
|
-
readonly text: string;
|
|
821
|
-
/**
|
|
822
|
-
* Main icon — Iconify identifier (e.g. "devicon:hono").
|
|
823
|
-
* Falls back to a default app or package icon when omitted.
|
|
824
|
-
*/
|
|
825
|
-
readonly icon?: string;
|
|
826
|
-
/**
|
|
827
|
-
* CSS class suffix for icon color (maps to `.workspace-icon--{color}`).
|
|
828
|
-
*/
|
|
829
|
-
readonly iconColor?: string;
|
|
830
|
-
/**
|
|
831
|
-
* Short description for cards and bullet lists.
|
|
832
|
-
*/
|
|
833
|
-
readonly description: string;
|
|
834
|
-
/**
|
|
835
|
-
* Technology tags — kebab-case keys resolved by the UI TechTag component.
|
|
836
|
-
* Each tag maps to an Iconify icon and display label.
|
|
837
|
-
*/
|
|
838
|
-
readonly tags?: readonly string[];
|
|
839
|
-
/**
|
|
840
|
-
* Deploy badge image for the card header.
|
|
841
|
-
*/
|
|
842
|
-
readonly badge?: {
|
|
843
|
-
readonly src: string;
|
|
844
|
-
readonly alt: string;
|
|
845
|
-
};
|
|
846
|
-
/**
|
|
847
|
-
* Docs path prefix (e.g. "/apps/api"). Matches section entries and derives card links.
|
|
848
|
-
* Also used as the URL prefix for glob-discovered children.
|
|
849
|
-
*/
|
|
850
|
-
readonly docsPrefix: string;
|
|
851
|
-
/**
|
|
852
|
-
* Content source — file path or glob, **relative to the workspace item's
|
|
853
|
-
* base path** (derived from `docsPrefix`).
|
|
854
|
-
*
|
|
855
|
-
* - `docsPrefix: "/apps/api"` + `from: "docs/*.md"` → resolves to `apps/api/docs/*.md`
|
|
856
|
-
* - **No wildcards** → single file (e.g. `"docs/overview.md"`)
|
|
857
|
-
* - **With wildcards** → auto-discover children (e.g. `"docs/*.md"`)
|
|
858
|
-
*
|
|
859
|
-
* @default "docs/*.md"
|
|
860
|
-
*/
|
|
861
|
-
readonly from?: string;
|
|
862
|
-
/**
|
|
863
|
-
* Explicit child entries for this workspace item.
|
|
864
|
-
* Can be combined with `from` — explicit children override glob-discovered pages.
|
|
865
|
-
*/
|
|
866
|
-
readonly items?: readonly Entry[];
|
|
867
|
-
/**
|
|
868
|
-
* Sort order for auto-discovered children.
|
|
869
|
-
* - `"alpha"` — alphabetical by derived text (default)
|
|
870
|
-
* - `"filename"` — alphabetical by filename
|
|
871
|
-
* - Custom comparator function
|
|
872
|
-
*/
|
|
873
|
-
readonly sort?: Entry['sort'];
|
|
874
|
-
/**
|
|
875
|
-
* How to derive `text` for auto-discovered children.
|
|
876
|
-
* - `"filename"` — kebab-to-title from filename (default)
|
|
877
|
-
* - `"heading"` — first `# heading` in the file
|
|
878
|
-
* - `"frontmatter"` — `title` field from YAML frontmatter, falls back to heading
|
|
879
|
-
*/
|
|
880
|
-
readonly textFrom?: Entry['textFrom'];
|
|
881
|
-
/**
|
|
882
|
-
* Transform function applied to auto-derived text (from `textFrom`).
|
|
883
|
-
*/
|
|
884
|
-
readonly textTransform?: Entry['textTransform'];
|
|
885
|
-
/**
|
|
886
|
-
* Enable recursive directory-based nesting for glob patterns.
|
|
887
|
-
* Requires `from` with a recursive glob (e.g. `"apps/api/docs/**\/*.md"`).
|
|
888
|
-
* @default false
|
|
889
|
-
*/
|
|
890
|
-
readonly recursive?: boolean;
|
|
891
|
-
/**
|
|
892
|
-
* Filename (without extension) used as the section header page in each directory.
|
|
893
|
-
* Only meaningful when `recursive` is true.
|
|
894
|
-
* @default "overview"
|
|
895
|
-
*/
|
|
896
|
-
readonly indexFile?: string;
|
|
897
|
-
/**
|
|
898
|
-
* Exclude globs, scoped to this item's `from` glob.
|
|
899
|
-
*/
|
|
900
|
-
readonly exclude?: readonly string[];
|
|
901
|
-
/**
|
|
902
|
-
* Make this item's section collapsible in the sidebar.
|
|
903
|
-
*/
|
|
904
|
-
readonly collapsible?: boolean;
|
|
905
|
-
/**
|
|
906
|
-
* Frontmatter injected at build time for all pages under this workspace item.
|
|
907
|
-
*/
|
|
908
|
-
readonly frontmatter?: Frontmatter;
|
|
909
|
-
}
|
|
472
|
+
export { WorkspaceCategory }
|
|
910
473
|
|
|
911
|
-
export
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Site meta description. Used as the hero headline on the home page.
|
|
918
|
-
*/
|
|
919
|
-
readonly description?: string;
|
|
920
|
-
/**
|
|
921
|
-
* Path to a custom favicon file served from `.zpress/public/`.
|
|
922
|
-
* When omitted, defaults to the auto-generated `/icon.svg`.
|
|
923
|
-
*/
|
|
924
|
-
readonly icon?: string;
|
|
925
|
-
/**
|
|
926
|
-
* Hero tagline displayed below the headline on the home page.
|
|
927
|
-
* When omitted, the tagline is not rendered.
|
|
928
|
-
*/
|
|
929
|
-
readonly tagline?: string;
|
|
930
|
-
/**
|
|
931
|
-
* Workspace apps — deployable services that make up the platform.
|
|
932
|
-
* Single source of truth for app metadata used on the home page,
|
|
933
|
-
* landing pages, and introduction page.
|
|
934
|
-
*/
|
|
935
|
-
readonly apps?: readonly WorkspaceItem[];
|
|
936
|
-
/**
|
|
937
|
-
* Workspace packages — shared libraries consumed by apps.
|
|
938
|
-
* Single source of truth for package metadata used on the home page,
|
|
939
|
-
* landing pages, and introduction page.
|
|
940
|
-
*/
|
|
941
|
-
readonly packages?: readonly WorkspaceItem[];
|
|
942
|
-
/**
|
|
943
|
-
* Custom workspace groups — arbitrary named groups of workspace items.
|
|
944
|
-
* Each group receives the same card/landing-page treatment as apps and packages.
|
|
945
|
-
* Rendered after apps and packages, in array order.
|
|
946
|
-
*/
|
|
947
|
-
readonly workspaces?: readonly WorkspaceGroup[];
|
|
948
|
-
/**
|
|
949
|
-
* Explicit feature cards for the home page.
|
|
950
|
-
*
|
|
951
|
-
* When provided, these replace the auto-generated feature cards
|
|
952
|
-
* that are normally derived from top-level sections.
|
|
953
|
-
* When omitted, features are auto-generated from sections with icons.
|
|
954
|
-
*/
|
|
955
|
-
readonly features?: readonly Feature[];
|
|
956
|
-
/**
|
|
957
|
-
* The information architecture.
|
|
958
|
-
* Defines content sources, sidebar structure, and routing in a single tree.
|
|
959
|
-
*/
|
|
960
|
-
readonly sections: readonly Entry[];
|
|
961
|
-
/**
|
|
962
|
-
* Top navigation bar.
|
|
963
|
-
* - `"auto"` — one nav item per top-level section
|
|
964
|
-
* - Array — explicit nav items
|
|
965
|
-
* @default "auto"
|
|
966
|
-
*/
|
|
967
|
-
readonly nav?: 'auto' | readonly NavItem[];
|
|
968
|
-
/**
|
|
969
|
-
* Globs to exclude globally across all sources.
|
|
970
|
-
*/
|
|
971
|
-
readonly exclude?: readonly GlobPattern[];
|
|
972
|
-
/**
|
|
973
|
-
* OpenAPI spec integration for interactive API docs.
|
|
974
|
-
*/
|
|
975
|
-
readonly openapi?: OpenAPIConfig;
|
|
976
|
-
}
|
|
474
|
+
export { WorkspaceGroup }
|
|
475
|
+
|
|
476
|
+
export { WorkspaceItem }
|
|
477
|
+
|
|
478
|
+
export { ZpressConfig }
|
|
977
479
|
|
|
978
480
|
export { }
|