@zpress/core 0.5.0 → 0.6.1
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 +113 -701
- package/dist/index.mjs +26146 -462
- 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,87 +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
|
-
* All valid color modes — used for validation.
|
|
74
|
-
*/
|
|
75
|
-
export declare const COLOR_MODES: readonly ColorMode[];
|
|
60
|
+
export { COLOR_MODES }
|
|
76
61
|
|
|
77
|
-
|
|
78
|
-
* How dark/light mode is controlled.
|
|
79
|
-
*/
|
|
80
|
-
export declare type ColorMode = 'dark' | 'light' | 'toggle';
|
|
62
|
+
export { ColorMode }
|
|
81
63
|
|
|
82
|
-
|
|
83
|
-
* Error produced during config validation in `defineConfig`.
|
|
84
|
-
*/
|
|
85
|
-
export declare interface ConfigError {
|
|
86
|
-
readonly _tag: 'ConfigError';
|
|
87
|
-
readonly type: 'empty_sections' | 'missing_field' | 'duplicate_prefix' | 'invalid_icon' | 'invalid_entry' | 'invalid_theme';
|
|
88
|
-
readonly message: string;
|
|
89
|
-
}
|
|
64
|
+
export { ConfigError }
|
|
90
65
|
|
|
91
|
-
|
|
92
|
-
* Create a `ConfigError` value.
|
|
93
|
-
*
|
|
94
|
-
* @param type - Error classification
|
|
95
|
-
* @param message - Human-readable description
|
|
96
|
-
* @returns A frozen `ConfigError` object
|
|
97
|
-
*/
|
|
98
|
-
export declare function configError(type: ConfigError['type'], message: string): ConfigError;
|
|
66
|
+
export { configError }
|
|
99
67
|
|
|
100
|
-
|
|
101
|
-
* Convenience alias for config validation results.
|
|
102
|
-
*/
|
|
103
|
-
export declare type ConfigResult<T> = readonly [ConfigError, null] | readonly [null, T];
|
|
68
|
+
export { ConfigResult }
|
|
104
69
|
|
|
105
70
|
/**
|
|
106
71
|
* Create all derived project paths from a resolved directory.
|
|
@@ -120,229 +85,15 @@ export declare function createPaths(dir: string): Paths;
|
|
|
120
85
|
*/
|
|
121
86
|
export declare function defineConfig(config: ZpressConfig): ZpressConfig;
|
|
122
87
|
|
|
123
|
-
|
|
124
|
-
* A single node in the information architecture.
|
|
125
|
-
*
|
|
126
|
-
* What you provide determines what it is:
|
|
127
|
-
*
|
|
128
|
-
* **Page — explicit file**
|
|
129
|
-
* ```ts
|
|
130
|
-
* { text: 'Architecture', link: '/architecture', from: 'docs/architecture.md' }
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* **Page — inline/generated content**
|
|
134
|
-
* ```ts
|
|
135
|
-
* { text: 'Overview', link: '/api/overview', content: '# API Overview\n...' }
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* **Section — explicit children**
|
|
139
|
-
* ```ts
|
|
140
|
-
* { text: 'Guides', items: [ ... ] }
|
|
141
|
-
* ```
|
|
142
|
-
*
|
|
143
|
-
* **Section — auto-discovered from glob**
|
|
144
|
-
* ```ts
|
|
145
|
-
* { text: 'Guides', prefix: '/guides', from: 'docs/guides/*.md' }
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* **Section — mix of explicit + auto-discovered**
|
|
149
|
-
* ```ts
|
|
150
|
-
* {
|
|
151
|
-
* text: 'Guides',
|
|
152
|
-
* prefix: '/guides',
|
|
153
|
-
* from: 'docs/guides/*.md',
|
|
154
|
-
* items: [
|
|
155
|
-
* { text: 'Getting Started', link: '/guides/start', from: 'docs/intro.md' },
|
|
156
|
-
* ],
|
|
157
|
-
* }
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
export declare interface Entry {
|
|
161
|
-
/**
|
|
162
|
-
* Display text in sidebar and nav.
|
|
163
|
-
*/
|
|
164
|
-
readonly text: string;
|
|
165
|
-
/**
|
|
166
|
-
* Output URL path.
|
|
167
|
-
* - Pages: exact URL (e.g. `"/guides/add-api-route"`)
|
|
168
|
-
* - Sections: optional — makes the section header clickable
|
|
169
|
-
*/
|
|
170
|
-
readonly link?: UrlPath;
|
|
171
|
-
/**
|
|
172
|
-
* Content source — file path or glob, relative to repo root.
|
|
173
|
-
*
|
|
174
|
-
* - **No wildcards** → single file (e.g. `"docs/architecture.md"`)
|
|
175
|
-
* - **With wildcards** → auto-discover children (e.g. `"docs/guides/*.md"`)
|
|
176
|
-
*/
|
|
177
|
-
readonly from?: FilePath | GlobPattern;
|
|
178
|
-
/**
|
|
179
|
-
* URL prefix for auto-discovered children.
|
|
180
|
-
* Used with glob `from` — each discovered file gets `prefix + "/" + slug`.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* `prefix: "/guides"` + file `add-api-route.md` → `/guides/add-api-route`
|
|
184
|
-
*/
|
|
185
|
-
readonly prefix?: UrlPath;
|
|
186
|
-
/**
|
|
187
|
-
* Inline markdown or async content generator.
|
|
188
|
-
* For virtual pages that have no source `.md` file.
|
|
189
|
-
* Mutually exclusive with `from`.
|
|
190
|
-
*/
|
|
191
|
-
readonly content?: string | (() => string | Promise<string>);
|
|
192
|
-
/**
|
|
193
|
-
* Child entries — pages and/or sub-sections.
|
|
194
|
-
*/
|
|
195
|
-
readonly items?: readonly Entry[];
|
|
196
|
-
/**
|
|
197
|
-
* Make this section collapsible in the sidebar.
|
|
198
|
-
* Sections at depth > 1 are collapsible by default.
|
|
199
|
-
* Set to `false` to keep a deep section always-open.
|
|
200
|
-
*/
|
|
201
|
-
readonly collapsible?: boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Exclude globs, scoped to this entry's `from` glob.
|
|
204
|
-
*/
|
|
205
|
-
readonly exclude?: readonly GlobPattern[];
|
|
206
|
-
/**
|
|
207
|
-
* Hide from sidebar. Page is still built and routable.
|
|
208
|
-
* Useful for pages that should exist but not clutter navigation.
|
|
209
|
-
*/
|
|
210
|
-
readonly hidden?: boolean;
|
|
211
|
-
/**
|
|
212
|
-
* Frontmatter injected at build time.
|
|
213
|
-
* - On a page: applied to that page.
|
|
214
|
-
* - On a section: applied to all pages within.
|
|
215
|
-
*/
|
|
216
|
-
readonly frontmatter?: Frontmatter;
|
|
217
|
-
/**
|
|
218
|
-
* How to derive `text` for auto-discovered children.
|
|
219
|
-
* - `"filename"` — kebab-to-title from filename (default)
|
|
220
|
-
* - `"heading"` — first `# heading` in the file
|
|
221
|
-
* - `"frontmatter"` — `title` field from YAML frontmatter, falls back to heading
|
|
222
|
-
*/
|
|
223
|
-
readonly textFrom?: 'filename' | 'heading' | 'frontmatter';
|
|
224
|
-
/**
|
|
225
|
-
* Transform function applied to auto-derived text (from `textFrom`).
|
|
226
|
-
* Called after text derivation for glob-discovered and recursive children.
|
|
227
|
-
* Does NOT apply to entries with explicit `text` (those are already user-controlled).
|
|
228
|
-
*
|
|
229
|
-
* @param text - The derived text (from heading or filename)
|
|
230
|
-
* @param slug - The filename slug (without extension)
|
|
231
|
-
* @returns Transformed text for sidebar display
|
|
232
|
-
*/
|
|
233
|
-
readonly textTransform?: (text: string, slug: string) => string;
|
|
234
|
-
/**
|
|
235
|
-
* Sort order for auto-discovered children.
|
|
236
|
-
* - `"alpha"` — alphabetical by derived text (default)
|
|
237
|
-
* - `"filename"` — alphabetical by filename
|
|
238
|
-
* - Custom comparator function
|
|
239
|
-
*/
|
|
240
|
-
readonly sort?: 'alpha' | 'filename' | ((a: ResolvedPage, b: ResolvedPage) => number);
|
|
241
|
-
/**
|
|
242
|
-
* Enable recursive directory-based nesting for glob patterns.
|
|
243
|
-
* When true, directory structure under the glob base drives sidebar nesting:
|
|
244
|
-
* - The `indexFile` (default `"overview"`) in a directory becomes the section header page
|
|
245
|
-
* - Other `.md` files become children
|
|
246
|
-
* - Sub-directories become nested collapsible sections
|
|
247
|
-
*
|
|
248
|
-
* Requires `from` with a recursive glob (e.g. `"docs/**\/*.md"`) and `prefix`.
|
|
249
|
-
* @default false
|
|
250
|
-
*/
|
|
251
|
-
readonly recursive?: boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Filename (without extension) used as the section header page in each directory.
|
|
254
|
-
* Only meaningful when `recursive` is true.
|
|
255
|
-
* @default "overview"
|
|
256
|
-
*/
|
|
257
|
-
readonly indexFile?: string;
|
|
258
|
-
/**
|
|
259
|
-
* Iconify icon identifier (e.g. `"pixelarticons:speed-fast"`).
|
|
260
|
-
* Used on home page feature cards when auto-generated from sections.
|
|
261
|
-
*/
|
|
262
|
-
readonly icon?: string;
|
|
263
|
-
/**
|
|
264
|
-
* Card display metadata for the parent section's auto-generated landing page.
|
|
265
|
-
*
|
|
266
|
-
* When present on child entries, the parent's landing page uses
|
|
267
|
-
* workspace-style cards instead of the default simple cards.
|
|
268
|
-
*/
|
|
269
|
-
readonly card?: CardConfig;
|
|
270
|
-
/**
|
|
271
|
-
* Isolate this section into its own Rspress sidebar namespace.
|
|
272
|
-
*
|
|
273
|
-
* When `true`, the section's children appear under a dedicated sidebar
|
|
274
|
-
* keyed by `link` (e.g. `"/apps/"`) instead of the root `"/"` sidebar.
|
|
275
|
-
* This mirrors how the OpenAPI reference already works.
|
|
276
|
-
*
|
|
277
|
-
* Requires `link` to be set.
|
|
278
|
-
* @default false
|
|
279
|
-
*/
|
|
280
|
-
readonly isolated?: boolean;
|
|
281
|
-
}
|
|
88
|
+
export { Discovery }
|
|
282
89
|
|
|
283
|
-
|
|
284
|
-
* Explicit feature card for the home page.
|
|
285
|
-
*
|
|
286
|
-
* When `features` is provided on the config, these replace the
|
|
287
|
-
* auto-generated feature cards that are normally derived from
|
|
288
|
-
* top-level sections.
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* ```ts
|
|
292
|
-
* {
|
|
293
|
-
* text: 'Getting Started',
|
|
294
|
-
* description: 'Everything you need to set up and start building.',
|
|
295
|
-
* link: '/getting-started',
|
|
296
|
-
* icon: 'pixelarticons:speed-fast',
|
|
297
|
-
* }
|
|
298
|
-
* ```
|
|
299
|
-
*/
|
|
300
|
-
export declare interface Feature {
|
|
301
|
-
/**
|
|
302
|
-
* Display title for the feature card.
|
|
303
|
-
*/
|
|
304
|
-
readonly text: string;
|
|
305
|
-
/**
|
|
306
|
-
* Short description shown below the title.
|
|
307
|
-
*/
|
|
308
|
-
readonly description: string;
|
|
309
|
-
/**
|
|
310
|
-
* Link target when the card is clicked.
|
|
311
|
-
*/
|
|
312
|
-
readonly link?: string;
|
|
313
|
-
/**
|
|
314
|
-
* Iconify icon identifier (e.g. `"pixelarticons:speed-fast"`).
|
|
315
|
-
*/
|
|
316
|
-
readonly icon?: string;
|
|
317
|
-
}
|
|
90
|
+
export { Entry }
|
|
318
91
|
|
|
319
|
-
|
|
320
|
-
* Relative file path from repo root (e.g. `"docs/guides/add-api-route.md"`)
|
|
321
|
-
*/
|
|
322
|
-
declare type FilePath = string;
|
|
92
|
+
export { Feature }
|
|
323
93
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
export declare interface Frontmatter {
|
|
328
|
-
readonly title?: string;
|
|
329
|
-
readonly titleTemplate?: string | boolean;
|
|
330
|
-
readonly description?: string;
|
|
331
|
-
readonly layout?: 'doc' | 'page' | 'home' | (string & {});
|
|
332
|
-
readonly sidebar?: boolean;
|
|
333
|
-
readonly aside?: boolean | 'left';
|
|
334
|
-
readonly outline?: false | number | [number, number] | 'deep';
|
|
335
|
-
readonly navbar?: boolean;
|
|
336
|
-
readonly editLink?: boolean;
|
|
337
|
-
readonly lastUpdated?: boolean;
|
|
338
|
-
readonly footer?: boolean;
|
|
339
|
-
readonly pageClass?: string;
|
|
340
|
-
readonly head?: readonly [string, Record<string, string>][];
|
|
341
|
-
/**
|
|
342
|
-
* Arbitrary extra fields merged into frontmatter.
|
|
343
|
-
*/
|
|
344
|
-
readonly [key: string]: unknown;
|
|
345
|
-
}
|
|
94
|
+
export { FlatDiscoveryConfig }
|
|
95
|
+
|
|
96
|
+
export { Frontmatter }
|
|
346
97
|
|
|
347
98
|
/**
|
|
348
99
|
* Generate banner, logo, and icon SVGs, writing them to the public directory.
|
|
@@ -393,27 +144,33 @@ export declare function generateIconSvg(config: AssetConfig): AssetResult<Genera
|
|
|
393
144
|
*/
|
|
394
145
|
export declare function generateLogoSvg(config: AssetConfig): AssetResult<GeneratedAsset>;
|
|
395
146
|
|
|
396
|
-
/**
|
|
397
|
-
* Glob pattern (e.g. `"docs/guides/*.md"`)
|
|
398
|
-
*/
|
|
399
|
-
declare type GlobPattern = string;
|
|
400
|
-
|
|
401
147
|
/**
|
|
402
148
|
* Returns true if the string contains glob metacharacters.
|
|
403
149
|
*/
|
|
404
150
|
export declare function hasGlobChars(s: string): boolean;
|
|
405
151
|
|
|
152
|
+
export { HeroConfig }
|
|
153
|
+
|
|
406
154
|
/**
|
|
407
|
-
*
|
|
155
|
+
* Rotating color palette applied to auto-generated icons.
|
|
156
|
+
* Each section gets the next color in the cycle.
|
|
408
157
|
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
* `defineConfig`) so every consumer gets structured error feedback.
|
|
412
|
-
*
|
|
413
|
-
* @param dir - Repository root directory to search for `zpress.config.*`
|
|
414
|
-
* @returns A `ConfigResult` tuple — `[null, config]` on success or `[ConfigError, null]` on failure
|
|
158
|
+
* This array defines the order in which colors are assigned to
|
|
159
|
+
* auto-generated section cards and feature icons.
|
|
415
160
|
*/
|
|
416
|
-
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 }
|
|
417
174
|
|
|
418
175
|
/**
|
|
419
176
|
* Load the previous sync manifest from disk.
|
|
@@ -463,31 +220,9 @@ export declare interface ManifestEntry {
|
|
|
463
220
|
readonly outputPath: string;
|
|
464
221
|
}
|
|
465
222
|
|
|
466
|
-
export
|
|
467
|
-
readonly text: string;
|
|
468
|
-
readonly link?: UrlPath;
|
|
469
|
-
readonly items?: readonly NavItem[];
|
|
470
|
-
readonly activeMatch?: string;
|
|
471
|
-
}
|
|
223
|
+
export { NavItem }
|
|
472
224
|
|
|
473
|
-
|
|
474
|
-
* Configuration for OpenAPI spec integration.
|
|
475
|
-
*/
|
|
476
|
-
export declare interface OpenAPIConfig {
|
|
477
|
-
/**
|
|
478
|
-
* Path to openapi.json relative to repo root.
|
|
479
|
-
*/
|
|
480
|
-
spec: FilePath;
|
|
481
|
-
/**
|
|
482
|
-
* URL prefix for API operation pages (e.g., '/api').
|
|
483
|
-
*/
|
|
484
|
-
prefix: UrlPath;
|
|
485
|
-
/**
|
|
486
|
-
* Sidebar group title.
|
|
487
|
-
* @default 'API Reference'
|
|
488
|
-
*/
|
|
489
|
-
title?: string;
|
|
490
|
-
}
|
|
225
|
+
export { OpenAPIConfig }
|
|
491
226
|
|
|
492
227
|
/**
|
|
493
228
|
* Data for a single page to be written to the output directory.
|
|
@@ -523,19 +258,15 @@ export declare interface Paths {
|
|
|
523
258
|
readonly cacheDir: string;
|
|
524
259
|
}
|
|
525
260
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
* @param theme - Built-in theme identifier
|
|
530
|
-
* @returns The theme's natural color mode
|
|
531
|
-
*/
|
|
532
|
-
export declare function resolveDefaultColorMode(theme: ThemeName): ColorMode;
|
|
261
|
+
export { RecursiveDiscoveryConfig }
|
|
262
|
+
|
|
263
|
+
export { resolveDefaultColorMode }
|
|
533
264
|
|
|
534
265
|
/**
|
|
535
266
|
* Internal resolved node — produced by the resolver, consumed by copy + sidebar/nav generators.
|
|
536
267
|
*/
|
|
537
268
|
export declare interface ResolvedEntry {
|
|
538
|
-
readonly
|
|
269
|
+
readonly title: string;
|
|
539
270
|
readonly link?: string;
|
|
540
271
|
readonly collapsible?: boolean;
|
|
541
272
|
readonly hidden?: boolean;
|
|
@@ -561,102 +292,58 @@ export declare interface ResolvedEntry {
|
|
|
561
292
|
}
|
|
562
293
|
|
|
563
294
|
/**
|
|
564
|
-
*
|
|
295
|
+
* Normalized icon output — always has both `id` and `color`.
|
|
565
296
|
*/
|
|
566
|
-
export declare interface
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
*/
|
|
570
|
-
readonly text: string;
|
|
571
|
-
/**
|
|
572
|
-
* Output URL path.
|
|
573
|
-
*/
|
|
574
|
-
readonly link: UrlPath;
|
|
575
|
-
/**
|
|
576
|
-
* Source file path (undefined for virtual pages).
|
|
577
|
-
*/
|
|
578
|
-
readonly source?: FilePath;
|
|
579
|
-
/**
|
|
580
|
-
* Merged frontmatter.
|
|
581
|
-
*/
|
|
582
|
-
readonly frontmatter: Frontmatter;
|
|
297
|
+
export declare interface ResolvedIcon {
|
|
298
|
+
readonly id: string;
|
|
299
|
+
readonly color: IconColor;
|
|
583
300
|
}
|
|
584
301
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
export declare interface ResolvedSection {
|
|
589
|
-
readonly text: string;
|
|
590
|
-
readonly link?: UrlPath;
|
|
591
|
-
readonly collapsible?: boolean;
|
|
592
|
-
readonly items: readonly (ResolvedPage | ResolvedSection)[];
|
|
593
|
-
}
|
|
302
|
+
export { ResolvedPage }
|
|
303
|
+
|
|
304
|
+
export { ResolvedSection }
|
|
594
305
|
|
|
595
306
|
/**
|
|
596
|
-
* Walk the
|
|
307
|
+
* Walk the Section tree and produce a ResolvedEntry tree.
|
|
597
308
|
*
|
|
598
309
|
* Resolves globs, derives text, merges frontmatter, deduplicates.
|
|
599
310
|
* Returns a `SyncOutcome` tuple — the caller is responsible for
|
|
600
311
|
* surfacing errors and exiting.
|
|
601
312
|
*
|
|
602
|
-
* @param
|
|
313
|
+
* @param sections - Config section tree to resolve
|
|
603
314
|
* @param ctx - Sync context (provides repo root, config, quiet flag)
|
|
604
|
-
* @param inheritedFrontmatter - Frontmatter inherited from parent
|
|
315
|
+
* @param inheritedFrontmatter - Frontmatter inherited from parent sections
|
|
605
316
|
* @param depth - Current nesting depth (0 = top-level)
|
|
606
317
|
* @returns Result tuple containing resolved entry tree or the first sync error
|
|
607
318
|
*/
|
|
608
|
-
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[]]>;
|
|
609
320
|
|
|
610
321
|
/**
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
* The IA tree IS the config. Each node defines what it is, where its
|
|
614
|
-
* content comes from, and where it sits in the sidebar — all in one place.
|
|
615
|
-
* Source `.md` files are never edited.
|
|
322
|
+
* Normalize an `IconConfig` value into a `ResolvedIcon`.
|
|
616
323
|
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
* import { defineConfig } from '@zpress/core'
|
|
324
|
+
* - String → `{ id: string, color: "purple" }` (default color)
|
|
325
|
+
* - Object → pass-through `{ id, color }`
|
|
620
326
|
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
* sections: [
|
|
624
|
-
* {
|
|
625
|
-
* text: 'Introduction',
|
|
626
|
-
* items: [
|
|
627
|
-
* { text: 'Architecture', link: '/architecture', from: 'docs/architecture.md' },
|
|
628
|
-
* { text: 'Structure', link: '/structure', from: 'docs/structure.md' },
|
|
629
|
-
* ],
|
|
630
|
-
* },
|
|
631
|
-
* {
|
|
632
|
-
* text: 'Guides',
|
|
633
|
-
* prefix: '/guides',
|
|
634
|
-
* from: 'docs/guides/*.md',
|
|
635
|
-
* },
|
|
636
|
-
* {
|
|
637
|
-
* text: 'API Reference',
|
|
638
|
-
* items: [
|
|
639
|
-
* { text: 'Overview', link: '/api/overview', content: '# API\n...' },
|
|
640
|
-
* { text: 'Routes', link: '/api/routes', from: 'apps/api/docs/routes.md' },
|
|
641
|
-
* ],
|
|
642
|
-
* },
|
|
643
|
-
* ],
|
|
644
|
-
* })
|
|
645
|
-
* ```
|
|
327
|
+
* @param icon - Icon config value (string or object)
|
|
328
|
+
* @returns Normalized `{ id, color }` pair
|
|
646
329
|
*/
|
|
330
|
+
export declare function resolveIcon(icon: IconConfig): ResolvedIcon;
|
|
331
|
+
|
|
647
332
|
/**
|
|
648
|
-
*
|
|
333
|
+
* Normalize an optional `IconConfig` value into a `ResolvedIcon | undefined`.
|
|
649
334
|
*
|
|
650
|
-
*
|
|
651
|
-
* Failure: `[error, null]`
|
|
335
|
+
* Returns `undefined` when `icon` is `undefined`.
|
|
652
336
|
*
|
|
653
|
-
* @
|
|
654
|
-
*
|
|
655
|
-
* const [error, value] = loadConfig(path)
|
|
656
|
-
* if (error) return [error, null]
|
|
657
|
-
* ```
|
|
337
|
+
* @param icon - Optional icon config value
|
|
338
|
+
* @returns Normalized `{ id, color }` pair, or `undefined`
|
|
658
339
|
*/
|
|
659
|
-
export declare
|
|
340
|
+
export declare function resolveOptionalIcon(icon: IconConfig | undefined): ResolvedIcon | undefined;
|
|
341
|
+
|
|
342
|
+
export { Result }
|
|
343
|
+
|
|
344
|
+
export { Section }
|
|
345
|
+
|
|
346
|
+
export { SeoConfig }
|
|
660
347
|
|
|
661
348
|
/**
|
|
662
349
|
* Rspress sidebar item shape.
|
|
@@ -718,12 +405,6 @@ export declare interface SyncContext {
|
|
|
718
405
|
readonly sourceMap?: SourceMap;
|
|
719
406
|
}
|
|
720
407
|
|
|
721
|
-
/**
|
|
722
|
-
* Domain-specific error types for the sync engine.
|
|
723
|
-
*
|
|
724
|
-
* All sync operations return `Result<T, SyncError>` instead of throwing.
|
|
725
|
-
* Config validation returns `Result<T, ConfigError>`.
|
|
726
|
-
*/
|
|
727
408
|
/**
|
|
728
409
|
* Error produced by the sync engine during entry resolution, page copy, or sidebar generation.
|
|
729
410
|
*/
|
|
@@ -768,77 +449,15 @@ export declare interface SyncResult {
|
|
|
768
449
|
readonly elapsed: number;
|
|
769
450
|
}
|
|
770
451
|
|
|
771
|
-
|
|
772
|
-
* All valid theme names — used for validation.
|
|
773
|
-
*/
|
|
774
|
-
export declare const THEME_NAMES: readonly ThemeName[];
|
|
452
|
+
export { THEME_NAMES }
|
|
775
453
|
|
|
776
|
-
|
|
777
|
-
* Optional color overrides keyed to CSS custom properties.
|
|
778
|
-
*
|
|
779
|
-
* Each key maps to one or more `--zp-c-*` / `--rp-c-*` variables.
|
|
780
|
-
* Values must be valid CSS color strings (hex or rgba).
|
|
781
|
-
*/
|
|
782
|
-
export declare interface ThemeColors {
|
|
783
|
-
readonly brand?: string;
|
|
784
|
-
readonly brandLight?: string;
|
|
785
|
-
readonly brandDark?: string;
|
|
786
|
-
readonly brandSoft?: string;
|
|
787
|
-
readonly bg?: string;
|
|
788
|
-
readonly bgAlt?: string;
|
|
789
|
-
readonly bgElv?: string;
|
|
790
|
-
readonly bgSoft?: string;
|
|
791
|
-
readonly text1?: string;
|
|
792
|
-
readonly text2?: string;
|
|
793
|
-
readonly text3?: string;
|
|
794
|
-
readonly divider?: string;
|
|
795
|
-
readonly border?: string;
|
|
796
|
-
readonly homeBg?: string;
|
|
797
|
-
}
|
|
454
|
+
export { ThemeColors }
|
|
798
455
|
|
|
799
|
-
|
|
800
|
-
* Top-level theme configuration for `zpress.config.ts`.
|
|
801
|
-
*/
|
|
802
|
-
export declare interface ThemeConfig {
|
|
803
|
-
/**
|
|
804
|
-
* Built-in theme to use.
|
|
805
|
-
* @default 'base'
|
|
806
|
-
*/
|
|
807
|
-
readonly name?: ThemeName;
|
|
808
|
-
/**
|
|
809
|
-
* Color mode behavior. Defaults to the theme's natural mode.
|
|
810
|
-
*/
|
|
811
|
-
readonly colorMode?: ColorMode;
|
|
812
|
-
/**
|
|
813
|
-
* Show the theme switcher dropdown in the nav bar.
|
|
814
|
-
* @default false
|
|
815
|
-
*/
|
|
816
|
-
readonly switcher?: boolean;
|
|
817
|
-
/**
|
|
818
|
-
* Partial color overrides applied in light mode (or base mode).
|
|
819
|
-
*/
|
|
820
|
-
readonly colors?: ThemeColors;
|
|
821
|
-
/**
|
|
822
|
-
* Partial color overrides applied only in dark mode.
|
|
823
|
-
*/
|
|
824
|
-
readonly darkColors?: ThemeColors;
|
|
825
|
-
}
|
|
456
|
+
export { ThemeConfig }
|
|
826
457
|
|
|
827
|
-
|
|
828
|
-
* Theme types and default resolution.
|
|
829
|
-
*
|
|
830
|
-
* Defines the built-in theme palette system: theme names, color modes,
|
|
831
|
-
* per-theme color overrides, and the top-level ThemeConfig shape.
|
|
832
|
-
*/
|
|
833
|
-
/**
|
|
834
|
-
* Built-in theme identifiers.
|
|
835
|
-
*/
|
|
836
|
-
export declare type ThemeName = 'base' | 'midnight' | 'arcade';
|
|
458
|
+
export { ThemeName }
|
|
837
459
|
|
|
838
|
-
|
|
839
|
-
* URL path (e.g. `"/guides/add-api-route"`)
|
|
840
|
-
*/
|
|
841
|
-
declare type UrlPath = string;
|
|
460
|
+
export { TitleConfig }
|
|
842
461
|
|
|
843
462
|
/**
|
|
844
463
|
* Validate the entire config, returning the first error found.
|
|
@@ -848,221 +467,14 @@ declare type UrlPath = string;
|
|
|
848
467
|
*/
|
|
849
468
|
export declare function validateConfig(config: ZpressConfig): ConfigResult<ZpressConfig>;
|
|
850
469
|
|
|
851
|
-
|
|
852
|
-
* A named group of workspace items for custom workspace categories.
|
|
853
|
-
*
|
|
854
|
-
* Lets users define arbitrary groups beyond the built-in `apps` and `packages`
|
|
855
|
-
* (e.g. "Services", "Tools", "Integrations") that receive the same
|
|
856
|
-
* card/landing-page treatment.
|
|
857
|
-
*
|
|
858
|
-
* @example
|
|
859
|
-
* ```ts
|
|
860
|
-
* {
|
|
861
|
-
* name: 'Integrations',
|
|
862
|
-
* description: 'Third-party service connectors',
|
|
863
|
-
* icon: 'pixelarticons:integration',
|
|
864
|
-
* items: [
|
|
865
|
-
* { text: 'Stripe', description: 'Payment processing', docsPrefix: '/integrations/stripe' },
|
|
866
|
-
* ],
|
|
867
|
-
* }
|
|
868
|
-
* ```
|
|
869
|
-
*/
|
|
870
|
-
export declare interface WorkspaceGroup {
|
|
871
|
-
readonly name: string;
|
|
872
|
-
readonly description: string;
|
|
873
|
-
readonly icon: string;
|
|
874
|
-
readonly items: readonly WorkspaceItem[];
|
|
875
|
-
/**
|
|
876
|
-
* URL prefix override for the group's landing page.
|
|
877
|
-
* Defaults to `/${slugify(name)}` when omitted.
|
|
878
|
-
*/
|
|
879
|
-
readonly link?: string;
|
|
880
|
-
}
|
|
470
|
+
export { Workspace }
|
|
881
471
|
|
|
882
|
-
|
|
883
|
-
* A workspace item representing an app or package in the monorepo.
|
|
884
|
-
*
|
|
885
|
-
* Used as the single source of truth for workspace metadata — home page cards,
|
|
886
|
-
* landing page cards, and introduction bullets all derive from these arrays.
|
|
887
|
-
*
|
|
888
|
-
* @example
|
|
889
|
-
* ```ts
|
|
890
|
-
* {
|
|
891
|
-
* text: 'API',
|
|
892
|
-
* icon: 'devicon:hono',
|
|
893
|
-
* iconColor: 'api',
|
|
894
|
-
* description: 'Hono REST API serving all client applications with RPC-typed routes',
|
|
895
|
-
* tags: ['hono', 'react', 'vercel'],
|
|
896
|
-
* badge: { src: '/logos/vercel.svg', alt: 'Vercel' },
|
|
897
|
-
* docsPrefix: '/apps/api',
|
|
898
|
-
* }
|
|
899
|
-
* ```
|
|
900
|
-
*/
|
|
901
|
-
export declare interface WorkspaceItem {
|
|
902
|
-
/**
|
|
903
|
-
* Display name (e.g. "API", "Console", "AI").
|
|
904
|
-
*/
|
|
905
|
-
readonly text: string;
|
|
906
|
-
/**
|
|
907
|
-
* Main icon — Iconify identifier (e.g. "devicon:hono").
|
|
908
|
-
* Falls back to a default app or package icon when omitted.
|
|
909
|
-
*/
|
|
910
|
-
readonly icon?: string;
|
|
911
|
-
/**
|
|
912
|
-
* CSS class suffix for icon color (maps to `.workspace-icon--{color}`).
|
|
913
|
-
*/
|
|
914
|
-
readonly iconColor?: string;
|
|
915
|
-
/**
|
|
916
|
-
* Short description for cards and bullet lists.
|
|
917
|
-
*/
|
|
918
|
-
readonly description: string;
|
|
919
|
-
/**
|
|
920
|
-
* Technology tags — kebab-case keys resolved by the UI TechTag component.
|
|
921
|
-
* Each tag maps to an Iconify icon and display label.
|
|
922
|
-
*/
|
|
923
|
-
readonly tags?: readonly string[];
|
|
924
|
-
/**
|
|
925
|
-
* Deploy badge image for the card header.
|
|
926
|
-
*/
|
|
927
|
-
readonly badge?: {
|
|
928
|
-
readonly src: string;
|
|
929
|
-
readonly alt: string;
|
|
930
|
-
};
|
|
931
|
-
/**
|
|
932
|
-
* Docs path prefix (e.g. "/apps/api"). Matches section entries and derives card links.
|
|
933
|
-
* Also used as the URL prefix for glob-discovered children.
|
|
934
|
-
*/
|
|
935
|
-
readonly docsPrefix: string;
|
|
936
|
-
/**
|
|
937
|
-
* Content source — file path or glob, **relative to the workspace item's
|
|
938
|
-
* base path** (derived from `docsPrefix`).
|
|
939
|
-
*
|
|
940
|
-
* - `docsPrefix: "/apps/api"` + `from: "docs/*.md"` → resolves to `apps/api/docs/*.md`
|
|
941
|
-
* - **No wildcards** → single file (e.g. `"docs/overview.md"`)
|
|
942
|
-
* - **With wildcards** → auto-discover children (e.g. `"docs/*.md"`)
|
|
943
|
-
*
|
|
944
|
-
* @default "docs/*.md"
|
|
945
|
-
*/
|
|
946
|
-
readonly from?: string;
|
|
947
|
-
/**
|
|
948
|
-
* Explicit child entries for this workspace item.
|
|
949
|
-
* Can be combined with `from` — explicit children override glob-discovered pages.
|
|
950
|
-
*/
|
|
951
|
-
readonly items?: readonly Entry[];
|
|
952
|
-
/**
|
|
953
|
-
* Sort order for auto-discovered children.
|
|
954
|
-
* - `"alpha"` — alphabetical by derived text (default)
|
|
955
|
-
* - `"filename"` — alphabetical by filename
|
|
956
|
-
* - Custom comparator function
|
|
957
|
-
*/
|
|
958
|
-
readonly sort?: Entry['sort'];
|
|
959
|
-
/**
|
|
960
|
-
* How to derive `text` for auto-discovered children.
|
|
961
|
-
* - `"filename"` — kebab-to-title from filename (default)
|
|
962
|
-
* - `"heading"` — first `# heading` in the file
|
|
963
|
-
* - `"frontmatter"` — `title` field from YAML frontmatter, falls back to heading
|
|
964
|
-
*/
|
|
965
|
-
readonly textFrom?: Entry['textFrom'];
|
|
966
|
-
/**
|
|
967
|
-
* Transform function applied to auto-derived text (from `textFrom`).
|
|
968
|
-
*/
|
|
969
|
-
readonly textTransform?: Entry['textTransform'];
|
|
970
|
-
/**
|
|
971
|
-
* Enable recursive directory-based nesting for glob patterns.
|
|
972
|
-
* Requires `from` with a recursive glob (e.g. `"apps/api/docs/**\/*.md"`).
|
|
973
|
-
* @default false
|
|
974
|
-
*/
|
|
975
|
-
readonly recursive?: boolean;
|
|
976
|
-
/**
|
|
977
|
-
* Filename (without extension) used as the section header page in each directory.
|
|
978
|
-
* Only meaningful when `recursive` is true.
|
|
979
|
-
* @default "overview"
|
|
980
|
-
*/
|
|
981
|
-
readonly indexFile?: string;
|
|
982
|
-
/**
|
|
983
|
-
* Exclude globs, scoped to this item's `from` glob.
|
|
984
|
-
*/
|
|
985
|
-
readonly exclude?: readonly string[];
|
|
986
|
-
/**
|
|
987
|
-
* Make this item's section collapsible in the sidebar.
|
|
988
|
-
*/
|
|
989
|
-
readonly collapsible?: boolean;
|
|
990
|
-
/**
|
|
991
|
-
* Frontmatter injected at build time for all pages under this workspace item.
|
|
992
|
-
*/
|
|
993
|
-
readonly frontmatter?: Frontmatter;
|
|
994
|
-
}
|
|
472
|
+
export { WorkspaceCategory }
|
|
995
473
|
|
|
996
|
-
export
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Site meta description. Used as the hero headline on the home page.
|
|
1003
|
-
*/
|
|
1004
|
-
readonly description?: string;
|
|
1005
|
-
/**
|
|
1006
|
-
* Theme configuration.
|
|
1007
|
-
* Controls the visual theme, color mode, and optional color overrides.
|
|
1008
|
-
*/
|
|
1009
|
-
readonly theme?: ThemeConfig;
|
|
1010
|
-
/**
|
|
1011
|
-
* Path to a custom favicon file served from `.zpress/public/`.
|
|
1012
|
-
* When omitted, defaults to the auto-generated `/icon.svg`.
|
|
1013
|
-
*/
|
|
1014
|
-
readonly icon?: string;
|
|
1015
|
-
/**
|
|
1016
|
-
* Hero tagline displayed below the headline on the home page.
|
|
1017
|
-
* When omitted, the tagline is not rendered.
|
|
1018
|
-
*/
|
|
1019
|
-
readonly tagline?: string;
|
|
1020
|
-
/**
|
|
1021
|
-
* Workspace apps — deployable services that make up the platform.
|
|
1022
|
-
* Single source of truth for app metadata used on the home page,
|
|
1023
|
-
* landing pages, and introduction page.
|
|
1024
|
-
*/
|
|
1025
|
-
readonly apps?: readonly WorkspaceItem[];
|
|
1026
|
-
/**
|
|
1027
|
-
* Workspace packages — shared libraries consumed by apps.
|
|
1028
|
-
* Single source of truth for package metadata used on the home page,
|
|
1029
|
-
* landing pages, and introduction page.
|
|
1030
|
-
*/
|
|
1031
|
-
readonly packages?: readonly WorkspaceItem[];
|
|
1032
|
-
/**
|
|
1033
|
-
* Custom workspace groups — arbitrary named groups of workspace items.
|
|
1034
|
-
* Each group receives the same card/landing-page treatment as apps and packages.
|
|
1035
|
-
* Rendered after apps and packages, in array order.
|
|
1036
|
-
*/
|
|
1037
|
-
readonly workspaces?: readonly WorkspaceGroup[];
|
|
1038
|
-
/**
|
|
1039
|
-
* Explicit feature cards for the home page.
|
|
1040
|
-
*
|
|
1041
|
-
* When provided, these replace the auto-generated feature cards
|
|
1042
|
-
* that are normally derived from top-level sections.
|
|
1043
|
-
* When omitted, features are auto-generated from sections with icons.
|
|
1044
|
-
*/
|
|
1045
|
-
readonly features?: readonly Feature[];
|
|
1046
|
-
/**
|
|
1047
|
-
* The information architecture.
|
|
1048
|
-
* Defines content sources, sidebar structure, and routing in a single tree.
|
|
1049
|
-
*/
|
|
1050
|
-
readonly sections: readonly Entry[];
|
|
1051
|
-
/**
|
|
1052
|
-
* Top navigation bar.
|
|
1053
|
-
* - `"auto"` — one nav item per top-level section
|
|
1054
|
-
* - Array — explicit nav items
|
|
1055
|
-
* @default "auto"
|
|
1056
|
-
*/
|
|
1057
|
-
readonly nav?: 'auto' | readonly NavItem[];
|
|
1058
|
-
/**
|
|
1059
|
-
* Globs to exclude globally across all sources.
|
|
1060
|
-
*/
|
|
1061
|
-
readonly exclude?: readonly GlobPattern[];
|
|
1062
|
-
/**
|
|
1063
|
-
* OpenAPI spec integration for interactive API docs.
|
|
1064
|
-
*/
|
|
1065
|
-
readonly openapi?: OpenAPIConfig;
|
|
1066
|
-
}
|
|
474
|
+
export { WorkspaceGroup }
|
|
475
|
+
|
|
476
|
+
export { WorkspaceItem }
|
|
477
|
+
|
|
478
|
+
export { ZpressConfig }
|
|
1067
479
|
|
|
1068
480
|
export { }
|