@yaakdoc/config 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +31 -2
- package/dist/index.d.ts +15 -0
- package/dist/index.js +153 -0
- package/dist/node.d.ts +28 -0
- package/dist/node.js +67 -0
- package/dist/schema-_OwQdVfh.d.ts +179 -0
- package/package.json +61 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 József Sallai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @yaakdoc/config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The configuration schema for [yaakdoc](https://github.com/jozsefsallai/yaakdoc#readme).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
// yaakdoc.config.ts
|
|
7
|
+
import { defineConfig } from "@yaakdoc/config"; // also re-exported from "yaakdoc"
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
branding: {
|
|
11
|
+
title: "Acme API",
|
|
12
|
+
|
|
13
|
+
colors: {
|
|
14
|
+
primary: "#0f766e"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
pages: "per-request",
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Most projects use `yaakdoc.config.json` with `"$schema": "./node_modules/yaakdoc/config.schema.json"` for editor autocomplete. Every field is optional. See the [configuration reference](https://github.com/jozsefsallai/yaakdoc#configuration).
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
- `configSchema`: the Zod schema. `YaakdocConfig` is the input type and `ResolvedConfig` is the type with defaults applied.
|
|
27
|
+
- `parseConfig(input)` validates input and applies defaults. Errors are readable `ConfigError`s.
|
|
28
|
+
- `getConfigJsonSchema()` returns the JSON schema used by `$schema`.
|
|
29
|
+
- `loadConfig({ cwd, configFile, overrides })` from `@yaakdoc/config/node` loads the config:
|
|
30
|
+
- It finds `yaakdoc.config.{json,jsonc,ts,js,...}` with [c12](https://github.com/unjs/c12).
|
|
31
|
+
- It applies overrides such as CLI flags. Arrays are replaced, not merged.
|
|
32
|
+
- It resolves local paths relative to the config file.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as YaakdocConfig, c as headTagSchema, i as ResolvedConfig, l as logoSchema, n as HeadTag, o as brandingSchema, r as Logo, s as configSchema, t as Branding } from "./schema-_OwQdVfh.js";
|
|
2
|
+
//#region src/index.d.ts
|
|
3
|
+
/** Identity helper that provides type checking/autocomplete for `yaakdoc.config.ts`. */
|
|
4
|
+
export declare function defineConfig(config: YaakdocConfig): YaakdocConfig;
|
|
5
|
+
export declare class ConfigError extends Error {
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
/** Validates a user config and applies defaults. */
|
|
9
|
+
export declare function parseConfig(input: unknown, source?: string): ResolvedConfig;
|
|
10
|
+
/** JSON Schema for `yaakdoc.config.json` (editor autocomplete via `$schema`). */
|
|
11
|
+
export declare function getConfigJsonSchema(): Record<string, unknown>;
|
|
12
|
+
/** Deep merge where `override` wins and arrays are replaced rather than concatenated. */
|
|
13
|
+
export declare function mergeConfig<T extends Record<string, unknown>>(base: T, override: Partial<T>): T;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Branding, HeadTag, Logo, ResolvedConfig, YaakdocConfig, brandingSchema, configSchema, headTagSchema, logoSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/schema.ts
|
|
3
|
+
const color = z.string().meta({ description: "Any CSS color, e.g. `#7c3aed`, `oklch(0.6 0.2 290)` or `rebeccapurple`." });
|
|
4
|
+
const modeColors = z.object({
|
|
5
|
+
primary: color.optional(),
|
|
6
|
+
accent: color.optional(),
|
|
7
|
+
background: color.optional(),
|
|
8
|
+
foreground: color.optional()
|
|
9
|
+
}).meta({ description: "Color overrides that apply to a single color mode." });
|
|
10
|
+
const logoSchema = z.union([z.string().meta({ description: "Path or URL of the logo (used in both color modes)." }), z.object({
|
|
11
|
+
light: z.string().optional().meta({ description: "Logo used in light mode." }),
|
|
12
|
+
dark: z.string().optional().meta({ description: "Logo used in dark mode." }),
|
|
13
|
+
alt: z.string().optional(),
|
|
14
|
+
href: z.string().optional().meta({ description: "Where clicking the logo leads. Defaults to the docs home." }),
|
|
15
|
+
width: z.number().optional(),
|
|
16
|
+
height: z.number().optional()
|
|
17
|
+
})]);
|
|
18
|
+
const brandingSchema = z.object({
|
|
19
|
+
title: z.string().optional().meta({ description: "Site title. Defaults to the workspace name." }),
|
|
20
|
+
description: z.string().optional().meta({ description: "Short site description (meta tags, llms.txt). Defaults to the workspace description's first paragraph." }),
|
|
21
|
+
url: z.url().optional().meta({ description: "Public URL of the deployed docs. Enables absolute links, canonical URLs and sitemap.xml." }),
|
|
22
|
+
logo: logoSchema.optional(),
|
|
23
|
+
favicon: z.string().optional().meta({ description: "Path or URL of the favicon." }),
|
|
24
|
+
colors: z.object({
|
|
25
|
+
primary: color.optional(),
|
|
26
|
+
accent: color.optional(),
|
|
27
|
+
light: modeColors.optional(),
|
|
28
|
+
dark: modeColors.optional()
|
|
29
|
+
}).optional(),
|
|
30
|
+
fonts: z.object({
|
|
31
|
+
sans: z.string().optional().meta({ description: "CSS font-family for text, e.g. `\"Inter\", sans-serif`." }),
|
|
32
|
+
mono: z.string().optional().meta({ description: "CSS font-family for code." }),
|
|
33
|
+
stylesheet: z.string().optional().meta({ description: "Stylesheet URL that loads the fonts, e.g. a Google Fonts CSS URL." })
|
|
34
|
+
}).optional(),
|
|
35
|
+
links: z.array(z.object({
|
|
36
|
+
label: z.string(),
|
|
37
|
+
href: z.string(),
|
|
38
|
+
icon: z.string().optional().meta({ description: "Icon hint for themes, e.g. `github`, `discord`, `x`, `website`." })
|
|
39
|
+
})).default([]).meta({ description: "Links shown in the header." }),
|
|
40
|
+
footer: z.string().optional().meta({ description: "Footer text (Markdown)." }),
|
|
41
|
+
defaultColorMode: z.enum([
|
|
42
|
+
"system",
|
|
43
|
+
"light",
|
|
44
|
+
"dark"
|
|
45
|
+
]).default("system"),
|
|
46
|
+
colorModeToggle: z.boolean().default(true).meta({ description: "Show the light/dark mode toggle." }),
|
|
47
|
+
customCss: z.string().optional().meta({ description: "Path to a CSS file loaded after the theme's styles." })
|
|
48
|
+
}).prefault({});
|
|
49
|
+
const headTagSchema = z.object({
|
|
50
|
+
tag: z.enum([
|
|
51
|
+
"script",
|
|
52
|
+
"link",
|
|
53
|
+
"meta",
|
|
54
|
+
"style"
|
|
55
|
+
]),
|
|
56
|
+
attrs: z.record(z.string(), z.union([z.string(), z.boolean()])).default({}),
|
|
57
|
+
content: z.string().optional()
|
|
58
|
+
});
|
|
59
|
+
const configSchema = z.object({
|
|
60
|
+
$schema: z.string().optional(),
|
|
61
|
+
export: z.string().optional().meta({ description: "Path to the Yaak export. Defaults to yaakdoc.json, then yaak.json." }),
|
|
62
|
+
theme: z.string().default("kiseki").meta({ description: "Theme to use: a short name (`kiseki` → @yaakdoc/theme-kiseki or yaakdoc-theme-kiseki), an npm package name, or a local path (e.g. an ejected theme)." }),
|
|
63
|
+
themeOptions: z.record(z.string(), z.unknown()).default({}).meta({ description: "Theme-specific options, validated by the theme." }),
|
|
64
|
+
workspace: z.string().optional().meta({ description: "Workspace id or name to document, when the export contains several." }),
|
|
65
|
+
environment: z.union([z.string(), z.literal(false)]).optional().meta({ description: "Environment (id or name) used to resolve variables in examples. Defaults to the first shared environment; `false` disables sub environments." }),
|
|
66
|
+
environments: z.union([z.literal("public"), z.array(z.string())]).optional().meta({ description: "Environments readers can switch between: `\"public\"` (all shared environments) or a list of ids/names. Adds an environment switcher; `environment` is the default selection." }),
|
|
67
|
+
pages: z.enum(["single", "per-request"]).default("single").meta({ description: "`single`: one page with anchors. `per-request`: a page per request and folder." }),
|
|
68
|
+
base: z.string().default("/").transform((value) => `/${value.replace(/^\/+|\/+$/g, "")}/`.replace(/^\/\/$/, "/")).meta({ description: "Base path the site is served from, e.g. `/docs/`." }),
|
|
69
|
+
outDir: z.string().default("dist").meta({ description: "Output directory for `yaakdoc build`." }),
|
|
70
|
+
server: z.object({
|
|
71
|
+
port: z.number().int().min(0).max(65535).default(4e3),
|
|
72
|
+
host: z.union([z.boolean(), z.string()]).default(false),
|
|
73
|
+
open: z.boolean().default(false)
|
|
74
|
+
}).prefault({}),
|
|
75
|
+
branding: brandingSchema,
|
|
76
|
+
snippets: z.array(z.string()).default([
|
|
77
|
+
"curl",
|
|
78
|
+
"javascript",
|
|
79
|
+
"python",
|
|
80
|
+
"go",
|
|
81
|
+
"grpcurl",
|
|
82
|
+
"wscat"
|
|
83
|
+
]).meta({ description: "Code example generators: built-in ids (curl, javascript, python, go, grpcurl, wscat) or module paths. Each snippet only applies to the request kinds it supports." }),
|
|
84
|
+
llms: z.object({
|
|
85
|
+
enabled: z.boolean().default(true).meta({ description: "Generate llms.txt and Markdown versions of pages." }),
|
|
86
|
+
full: z.boolean().default(true).meta({ description: "Also generate llms-full.txt with the complete docs." }),
|
|
87
|
+
copyButton: z.boolean().default(true).meta({ description: "Show \"Copy page\" actions." }),
|
|
88
|
+
openIn: z.array(z.enum([
|
|
89
|
+
"chatgpt",
|
|
90
|
+
"claude",
|
|
91
|
+
"perplexity"
|
|
92
|
+
])).default(["chatgpt", "claude"]).meta({ description: "\"Open in ...\" assistant links." })
|
|
93
|
+
}).prefault({}),
|
|
94
|
+
variables: z.object({
|
|
95
|
+
resolve: z.boolean().default(true).meta({ description: "Inline variable values in examples." }),
|
|
96
|
+
hide: z.array(z.string()).default([
|
|
97
|
+
"token",
|
|
98
|
+
"secret",
|
|
99
|
+
"password",
|
|
100
|
+
"passwd",
|
|
101
|
+
"apikey",
|
|
102
|
+
"api_key",
|
|
103
|
+
"private",
|
|
104
|
+
"credential",
|
|
105
|
+
"auth"
|
|
106
|
+
]).meta({ description: "Variable name patterns that are never inlined (case- and separator-insensitive substring match)." }),
|
|
107
|
+
show: z.boolean().default(true).meta({ description: "Show the environment variables table." })
|
|
108
|
+
}).prefault({}),
|
|
109
|
+
filter: z.object({
|
|
110
|
+
include: z.array(z.string()).default([]),
|
|
111
|
+
exclude: z.array(z.string()).default([])
|
|
112
|
+
}).prefault({}).meta({ description: "Glob patterns over request/folder slugs (e.g. `internal/**`)." }),
|
|
113
|
+
runInYaak: z.union([z.boolean(), z.object({
|
|
114
|
+
name: z.string().optional().meta({ description: "Name shown in Yaak when importing. Defaults to the site title." }),
|
|
115
|
+
url: z.string().optional().meta({ description: "URL of an export/spec hosted elsewhere. When omitted, yaakdoc publishes a sanitized export at `<base>yaak.json`." })
|
|
116
|
+
})]).default(false).meta({ description: "Show a \"Run in Yaak\" button that imports the API into Yaak. Publishes a sanitized copy of the export (only documented requests, no private environments, secrets blanked)." }),
|
|
117
|
+
head: z.array(headTagSchema).default([]).meta({ description: "Extra tags injected into <head> (analytics, verification meta tags...)." })
|
|
118
|
+
}).meta({ title: "yaakdoc configuration" });
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/index.ts
|
|
121
|
+
/** Identity helper that provides type checking/autocomplete for `yaakdoc.config.ts`. */
|
|
122
|
+
function defineConfig(config) {
|
|
123
|
+
return config;
|
|
124
|
+
}
|
|
125
|
+
var ConfigError = class extends Error {
|
|
126
|
+
name = "ConfigError";
|
|
127
|
+
};
|
|
128
|
+
/** Validates a user config and applies defaults. */
|
|
129
|
+
function parseConfig(input, source = "configuration") {
|
|
130
|
+
const result = configSchema.safeParse(input ?? {});
|
|
131
|
+
if (!result.success) throw new ConfigError(`Invalid ${source}:\n${z.prettifyError(result.error)}`);
|
|
132
|
+
return result.data;
|
|
133
|
+
}
|
|
134
|
+
/** JSON Schema for `yaakdoc.config.json` (editor autocomplete via `$schema`). */
|
|
135
|
+
function getConfigJsonSchema() {
|
|
136
|
+
return z.toJSONSchema(configSchema, {
|
|
137
|
+
io: "input",
|
|
138
|
+
unrepresentable: "any"
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/** Deep merge where `override` wins and arrays are replaced rather than concatenated. */
|
|
142
|
+
function mergeConfig(base, override) {
|
|
143
|
+
const out = { ...base };
|
|
144
|
+
for (const [key, value] of Object.entries(override)) {
|
|
145
|
+
if (value === void 0) continue;
|
|
146
|
+
const current = out[key];
|
|
147
|
+
out[key] = isPlainObject(current) && isPlainObject(value) ? mergeConfig(current, value) : value;
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
152
|
+
//#endregion
|
|
153
|
+
export { ConfigError, brandingSchema, configSchema, defineConfig, getConfigJsonSchema, headTagSchema, logoSchema, mergeConfig, parseConfig };
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { a as YaakdocConfig, i as ResolvedConfig } from "./schema-_OwQdVfh.js";
|
|
2
|
+
//#region src/node.d.ts
|
|
3
|
+
export type LoadConfigOptions = {
|
|
4
|
+
/** Directory to look for `yaakdoc.config.*` in. Defaults to `process.cwd()`. */
|
|
5
|
+
cwd?: string;
|
|
6
|
+
/** Explicit config file path (relative to `cwd`). */
|
|
7
|
+
configFile?: string;
|
|
8
|
+
/** Values that take precedence over the config file (e.g. CLI flags). */
|
|
9
|
+
overrides?: YaakdocConfig;
|
|
10
|
+
};
|
|
11
|
+
export type LoadedConfig = {
|
|
12
|
+
config: ResolvedConfig;
|
|
13
|
+
/** Absolute path of the config file, if one was found. */
|
|
14
|
+
configFile: string | null;
|
|
15
|
+
/** Directory relative paths in the config are resolved against. */
|
|
16
|
+
root: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Loads `yaakdoc.config.{json,jsonc,ts,js,mjs,...}` (optional), applies CLI overrides and defaults,
|
|
20
|
+
* validates it and resolves local paths to absolute paths.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadConfig(options?: LoadConfigOptions): Promise<LoadedConfig>;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves local paths in the config to absolute paths. Paths from the config file are relative to
|
|
25
|
+
* the config file; paths passed as CLI overrides are relative to the current directory.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveConfigPaths(config: ResolvedConfig, root: string, overrides?: YaakdocConfig, cwd?: string): ResolvedConfig;
|
|
28
|
+
//#endregion
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ConfigError, mergeConfig, parseConfig } from "./index.js";
|
|
2
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
|
+
import { isUrl } from "@yaakdoc/core";
|
|
4
|
+
import { loadConfig as loadConfig$1 } from "c12";
|
|
5
|
+
//#region src/node.ts
|
|
6
|
+
/**
|
|
7
|
+
* Loads `yaakdoc.config.{json,jsonc,ts,js,mjs,...}` (optional), applies CLI overrides and defaults,
|
|
8
|
+
* validates it and resolves local paths to absolute paths.
|
|
9
|
+
*/
|
|
10
|
+
async function loadConfig(options = {}) {
|
|
11
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
12
|
+
let loaded;
|
|
13
|
+
try {
|
|
14
|
+
loaded = await loadConfig$1({
|
|
15
|
+
cwd,
|
|
16
|
+
name: "yaakdoc",
|
|
17
|
+
configFile: options.configFile?.replace(/\.(json|jsonc|json5|ts|js|mjs|cjs|mts|cts)$/, ""),
|
|
18
|
+
rcFile: false,
|
|
19
|
+
globalRc: false,
|
|
20
|
+
dotenv: false,
|
|
21
|
+
packageJson: false,
|
|
22
|
+
configFileRequired: Boolean(options.configFile),
|
|
23
|
+
merger: (...configs) => configs.filter(Boolean).reverse().reduce((acc, config) => mergeConfig(acc, config), {})
|
|
24
|
+
});
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw new ConfigError(`Could not load config: ${error.message}`);
|
|
27
|
+
}
|
|
28
|
+
const configFile = loaded._configFile ?? null;
|
|
29
|
+
const merged = mergeConfig(loaded.config ?? {}, options.overrides ?? {});
|
|
30
|
+
const config = parseConfig(merged, configFile ? `config ${configFile}` : "configuration");
|
|
31
|
+
const root = configFile ? dirname(configFile) : cwd;
|
|
32
|
+
return {
|
|
33
|
+
config: resolveConfigPaths(config, root, options.overrides ?? {}, cwd),
|
|
34
|
+
configFile,
|
|
35
|
+
root
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const isLocalPath = (value) => value.startsWith(".") || value.startsWith("/") || isAbsolute(value);
|
|
39
|
+
/**
|
|
40
|
+
* Resolves local paths in the config to absolute paths. Paths from the config file are relative to
|
|
41
|
+
* the config file; paths passed as CLI overrides are relative to the current directory.
|
|
42
|
+
*/
|
|
43
|
+
function resolveConfigPaths(config, root, overrides = {}, cwd = root) {
|
|
44
|
+
const from = (value, overridden) => resolve(overridden ? cwd : root, value);
|
|
45
|
+
const asset = (value) => value && !isUrl(value) ? resolve(root, value) : value;
|
|
46
|
+
const { branding } = config;
|
|
47
|
+
const logo = typeof branding.logo === "string" ? asset(branding.logo) : branding.logo && {
|
|
48
|
+
...branding.logo,
|
|
49
|
+
...branding.logo.light ? { light: asset(branding.logo.light) } : {},
|
|
50
|
+
...branding.logo.dark ? { dark: asset(branding.logo.dark) } : {}
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
...config,
|
|
54
|
+
...config.export ? { export: from(config.export, overrides.export !== void 0) } : {},
|
|
55
|
+
outDir: from(config.outDir, overrides.outDir !== void 0),
|
|
56
|
+
theme: isLocalPath(config.theme) ? from(config.theme, overrides.theme !== void 0) : config.theme,
|
|
57
|
+
snippets: config.snippets.map((snippet) => isLocalPath(snippet) ? resolve(root, snippet) : snippet),
|
|
58
|
+
branding: {
|
|
59
|
+
...branding,
|
|
60
|
+
...logo ? { logo } : {},
|
|
61
|
+
...branding.favicon ? { favicon: asset(branding.favicon) } : {},
|
|
62
|
+
...branding.customCss ? { customCss: resolve(root, branding.customCss) } : {}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { loadConfig, resolveConfigPaths };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/schema.d.ts
|
|
3
|
+
declare const logoSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
4
|
+
light: z.ZodOptional<z.ZodString>;
|
|
5
|
+
dark: z.ZodOptional<z.ZodString>;
|
|
6
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
7
|
+
href: z.ZodOptional<z.ZodString>;
|
|
8
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, z.core.$strip>]>;
|
|
11
|
+
declare const brandingSchema: z.ZodPrefault<z.ZodObject<{
|
|
12
|
+
title: z.ZodOptional<z.ZodString>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
15
|
+
logo: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
16
|
+
light: z.ZodOptional<z.ZodString>;
|
|
17
|
+
dark: z.ZodOptional<z.ZodString>;
|
|
18
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
19
|
+
href: z.ZodOptional<z.ZodString>;
|
|
20
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strip>]>>;
|
|
23
|
+
favicon: z.ZodOptional<z.ZodString>;
|
|
24
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
26
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
27
|
+
light: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
29
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
30
|
+
background: z.ZodOptional<z.ZodString>;
|
|
31
|
+
foreground: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
34
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
35
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
36
|
+
background: z.ZodOptional<z.ZodString>;
|
|
37
|
+
foreground: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
fonts: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
sans: z.ZodOptional<z.ZodString>;
|
|
42
|
+
mono: z.ZodOptional<z.ZodString>;
|
|
43
|
+
stylesheet: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
46
|
+
label: z.ZodString;
|
|
47
|
+
href: z.ZodString;
|
|
48
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
51
|
+
defaultColorMode: z.ZodDefault<z.ZodEnum<{
|
|
52
|
+
dark: "dark";
|
|
53
|
+
light: "light";
|
|
54
|
+
system: "system";
|
|
55
|
+
}>>;
|
|
56
|
+
colorModeToggle: z.ZodDefault<z.ZodBoolean>;
|
|
57
|
+
customCss: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
declare const headTagSchema: z.ZodObject<{
|
|
60
|
+
tag: z.ZodEnum<{
|
|
61
|
+
link: "link";
|
|
62
|
+
meta: "meta";
|
|
63
|
+
script: "script";
|
|
64
|
+
style: "style";
|
|
65
|
+
}>;
|
|
66
|
+
attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
67
|
+
content: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
declare const configSchema: z.ZodObject<{
|
|
70
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
71
|
+
export: z.ZodOptional<z.ZodString>;
|
|
72
|
+
theme: z.ZodDefault<z.ZodString>;
|
|
73
|
+
themeOptions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
74
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
75
|
+
environment: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
76
|
+
environments: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"public">, z.ZodArray<z.ZodString>]>>;
|
|
77
|
+
pages: z.ZodDefault<z.ZodEnum<{
|
|
78
|
+
"per-request": "per-request";
|
|
79
|
+
single: "single";
|
|
80
|
+
}>>;
|
|
81
|
+
base: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>;
|
|
82
|
+
outDir: z.ZodDefault<z.ZodString>;
|
|
83
|
+
server: z.ZodPrefault<z.ZodObject<{
|
|
84
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
85
|
+
host: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
86
|
+
open: z.ZodDefault<z.ZodBoolean>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
branding: z.ZodPrefault<z.ZodObject<{
|
|
89
|
+
title: z.ZodOptional<z.ZodString>;
|
|
90
|
+
description: z.ZodOptional<z.ZodString>;
|
|
91
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
92
|
+
logo: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
93
|
+
light: z.ZodOptional<z.ZodString>;
|
|
94
|
+
dark: z.ZodOptional<z.ZodString>;
|
|
95
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
96
|
+
href: z.ZodOptional<z.ZodString>;
|
|
97
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
}, z.core.$strip>]>>;
|
|
100
|
+
favicon: z.ZodOptional<z.ZodString>;
|
|
101
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
103
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
104
|
+
light: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
106
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
107
|
+
background: z.ZodOptional<z.ZodString>;
|
|
108
|
+
foreground: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, z.core.$strip>>;
|
|
110
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
112
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
113
|
+
background: z.ZodOptional<z.ZodString>;
|
|
114
|
+
foreground: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
fonts: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
sans: z.ZodOptional<z.ZodString>;
|
|
119
|
+
mono: z.ZodOptional<z.ZodString>;
|
|
120
|
+
stylesheet: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
123
|
+
label: z.ZodString;
|
|
124
|
+
href: z.ZodString;
|
|
125
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$strip>>>;
|
|
127
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
128
|
+
defaultColorMode: z.ZodDefault<z.ZodEnum<{
|
|
129
|
+
dark: "dark";
|
|
130
|
+
light: "light";
|
|
131
|
+
system: "system";
|
|
132
|
+
}>>;
|
|
133
|
+
colorModeToggle: z.ZodDefault<z.ZodBoolean>;
|
|
134
|
+
customCss: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
snippets: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
137
|
+
llms: z.ZodPrefault<z.ZodObject<{
|
|
138
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
139
|
+
full: z.ZodDefault<z.ZodBoolean>;
|
|
140
|
+
copyButton: z.ZodDefault<z.ZodBoolean>;
|
|
141
|
+
openIn: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
142
|
+
chatgpt: "chatgpt";
|
|
143
|
+
claude: "claude";
|
|
144
|
+
perplexity: "perplexity";
|
|
145
|
+
}>>>;
|
|
146
|
+
}, z.core.$strip>>;
|
|
147
|
+
variables: z.ZodPrefault<z.ZodObject<{
|
|
148
|
+
resolve: z.ZodDefault<z.ZodBoolean>;
|
|
149
|
+
hide: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
150
|
+
show: z.ZodDefault<z.ZodBoolean>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
filter: z.ZodPrefault<z.ZodObject<{
|
|
153
|
+
include: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
154
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
runInYaak: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
157
|
+
name: z.ZodOptional<z.ZodString>;
|
|
158
|
+
url: z.ZodOptional<z.ZodString>;
|
|
159
|
+
}, z.core.$strip>]>>;
|
|
160
|
+
head: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
161
|
+
tag: z.ZodEnum<{
|
|
162
|
+
link: "link";
|
|
163
|
+
meta: "meta";
|
|
164
|
+
script: "script";
|
|
165
|
+
style: "style";
|
|
166
|
+
}>;
|
|
167
|
+
attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
168
|
+
content: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, z.core.$strip>>>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
/** Configuration as written by users – every field is optional. */
|
|
172
|
+
type YaakdocConfig = z.input<typeof configSchema>;
|
|
173
|
+
/** Configuration with defaults applied. */
|
|
174
|
+
type ResolvedConfig = z.output<typeof configSchema>;
|
|
175
|
+
type Branding = ResolvedConfig["branding"];
|
|
176
|
+
type HeadTag = z.output<typeof headTagSchema>;
|
|
177
|
+
type Logo = z.output<typeof logoSchema>;
|
|
178
|
+
//#endregion
|
|
179
|
+
export { YaakdocConfig as a, headTagSchema as c, ResolvedConfig as i, logoSchema as l, HeadTag as n, brandingSchema as o, Logo as r, configSchema as s, Branding as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaakdoc/config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Configuration schema and loader for yaakdoc.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"@yaakdoc/source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./node": {
|
|
15
|
+
"@yaakdoc/source": "./src/node.ts",
|
|
16
|
+
"types": "./dist/node.d.ts",
|
|
17
|
+
"default": "./dist/node.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"keywords": [
|
|
23
|
+
"yaak",
|
|
24
|
+
"yaakdoc",
|
|
25
|
+
"config",
|
|
26
|
+
"schema"
|
|
27
|
+
],
|
|
28
|
+
"author": "József Sallai @jozsefsallai",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"files": [
|
|
31
|
+
"/dist",
|
|
32
|
+
"/README.md",
|
|
33
|
+
"/LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/jozsefsallai/yaakdoc.git",
|
|
38
|
+
"directory": "packages/config"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/jozsefsallai/yaakdoc/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/jozsefsallai/yaakdoc#readme",
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20.19"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@repo/tsconfig": "0.0.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@yaakdoc/core": "^0.1.0",
|
|
52
|
+
"c12": "^3.3.4",
|
|
53
|
+
"zod": "^4.6.7"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsdown",
|
|
57
|
+
"dev": "tsdown --watch --no-clean",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"check-types": "tsc",
|
|
60
|
+
"lint": "biome lint .",
|
|
61
|
+
"lint:fix": "biome lint . --write",
|
|
62
|
+
"format": "biome format . --write"
|
|
63
|
+
}
|
|
6
64
|
}
|