@barodoc/core 6.0.0 → 8.0.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/dist/{chunk-TXSRCD3T.js → chunk-AWCA5ON6.js} +11 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/{index-QECXnisE.d.ts → index-BJ7u7rXv.d.ts} +65 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +29 -9
- package/dist/plugins/index.d.ts +2 -2
- package/dist/{types-CfTZyFiT.d.ts → types-C0xL7b0Y.d.ts} +12 -1
- package/package.json +1 -1
|
@@ -81,6 +81,15 @@ var versionConfigSchema = z.object({
|
|
|
81
81
|
path: z.string()
|
|
82
82
|
}).strict();
|
|
83
83
|
var versionsSchema = z.array(versionConfigSchema).optional();
|
|
84
|
+
var tabSchema = z.object({
|
|
85
|
+
label: z.string(),
|
|
86
|
+
href: z.string()
|
|
87
|
+
});
|
|
88
|
+
var sectionSchema = z.object({
|
|
89
|
+
slug: z.string(),
|
|
90
|
+
label: z.string().optional(),
|
|
91
|
+
navigation: z.array(navItemSchema)
|
|
92
|
+
});
|
|
84
93
|
var barodocConfigSchema = z.object({
|
|
85
94
|
name: z.string(),
|
|
86
95
|
logo: z.string().optional(),
|
|
@@ -90,6 +99,8 @@ var barodocConfigSchema = z.object({
|
|
|
90
99
|
theme: themeConfigSchema,
|
|
91
100
|
i18n: i18nConfigSchema,
|
|
92
101
|
navigation: z.array(navItemSchema),
|
|
102
|
+
sections: z.array(sectionSchema).optional(),
|
|
103
|
+
tabs: z.array(tabSchema).optional(),
|
|
93
104
|
topbar: topbarSchema,
|
|
94
105
|
search: searchSchema,
|
|
95
106
|
lineNumbers: lineNumbersSchema,
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BarodocConfigInput, a as BarodocConfigOutput, D as DocsFrontmatter, b as barodocConfigSchema, d as docsFrontmatterSchema, c as getConfigDefaults, l as loadConfig } from '../index-
|
|
1
|
+
export { B as BarodocConfigInput, a as BarodocConfigOutput, D as DocsFrontmatter, b as barodocConfigSchema, d as docsFrontmatterSchema, c as getConfigDefaults, l as loadConfig } from '../index-BJ7u7rXv.js';
|
|
2
2
|
import 'zod';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-C0xL7b0Y.js';
|
|
4
4
|
import 'astro';
|
package/dist/config/index.js
CHANGED
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as BarodocI18nConfig, c as BarodocNavItem } from '../types-
|
|
1
|
+
import { b as BarodocI18nConfig, c as BarodocNavItem } from '../types-C0xL7b0Y.js';
|
|
2
2
|
import 'astro';
|
|
3
3
|
|
|
4
4
|
declare function getLocaleFromPath(path: string, i18n: BarodocI18nConfig): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { R as ResolvedBarodocConfig, a as BarodocConfig } from './types-
|
|
2
|
+
import { R as ResolvedBarodocConfig, a as BarodocConfig } from './types-C0xL7b0Y.js';
|
|
3
3
|
|
|
4
4
|
declare const grayPresets: readonly ["zinc", "slate", "neutral", "stone", "gray"];
|
|
5
5
|
type GrayPreset = (typeof grayPresets)[number];
|
|
@@ -148,6 +148,44 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
148
148
|
group: z.ZodString;
|
|
149
149
|
pages: z.ZodArray<z.ZodString, "many">;
|
|
150
150
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
151
|
+
sections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
152
|
+
slug: z.ZodString;
|
|
153
|
+
label: z.ZodOptional<z.ZodString>;
|
|
154
|
+
navigation: z.ZodArray<z.ZodObject<{
|
|
155
|
+
group: z.ZodString;
|
|
156
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
157
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
158
|
+
group: z.ZodString;
|
|
159
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
160
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
161
|
+
group: z.ZodString;
|
|
162
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
163
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
slug: string;
|
|
166
|
+
navigation: z.objectOutputType<{
|
|
167
|
+
group: z.ZodString;
|
|
168
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
169
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
170
|
+
label?: string | undefined;
|
|
171
|
+
}, {
|
|
172
|
+
slug: string;
|
|
173
|
+
navigation: z.objectInputType<{
|
|
174
|
+
group: z.ZodString;
|
|
175
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
176
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
177
|
+
label?: string | undefined;
|
|
178
|
+
}>, "many">>;
|
|
179
|
+
tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
180
|
+
label: z.ZodString;
|
|
181
|
+
href: z.ZodString;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
label: string;
|
|
184
|
+
href: string;
|
|
185
|
+
}, {
|
|
186
|
+
label: string;
|
|
187
|
+
href: string;
|
|
188
|
+
}>, "many">>;
|
|
151
189
|
topbar: z.ZodOptional<z.ZodObject<{
|
|
152
190
|
github: z.ZodOptional<z.ZodString>;
|
|
153
191
|
discord: z.ZodOptional<z.ZodString>;
|
|
@@ -220,11 +258,11 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
220
258
|
plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>]>, "many">>;
|
|
221
259
|
customCss: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
222
260
|
}, "strip", z.ZodTypeAny, {
|
|
223
|
-
name: string;
|
|
224
261
|
navigation: z.objectOutputType<{
|
|
225
262
|
group: z.ZodString;
|
|
226
263
|
pages: z.ZodArray<z.ZodString, "many">;
|
|
227
264
|
}, z.ZodTypeAny, "passthrough">[];
|
|
265
|
+
name: string;
|
|
228
266
|
lastUpdated?: boolean | undefined;
|
|
229
267
|
logo?: string | undefined;
|
|
230
268
|
favicon?: string | undefined;
|
|
@@ -253,6 +291,18 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
253
291
|
locales: string[];
|
|
254
292
|
labels?: Record<string, string> | undefined;
|
|
255
293
|
} | undefined;
|
|
294
|
+
sections?: {
|
|
295
|
+
slug: string;
|
|
296
|
+
navigation: z.objectOutputType<{
|
|
297
|
+
group: z.ZodString;
|
|
298
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
299
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
300
|
+
label?: string | undefined;
|
|
301
|
+
}[] | undefined;
|
|
302
|
+
tabs?: {
|
|
303
|
+
label: string;
|
|
304
|
+
href: string;
|
|
305
|
+
}[] | undefined;
|
|
256
306
|
topbar?: {
|
|
257
307
|
github?: string | undefined;
|
|
258
308
|
discord?: string | undefined;
|
|
@@ -284,11 +334,11 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
284
334
|
plugins?: (string | [string, Record<string, unknown>])[] | undefined;
|
|
285
335
|
customCss?: string[] | undefined;
|
|
286
336
|
}, {
|
|
287
|
-
name: string;
|
|
288
337
|
navigation: z.objectInputType<{
|
|
289
338
|
group: z.ZodString;
|
|
290
339
|
pages: z.ZodArray<z.ZodString, "many">;
|
|
291
340
|
}, z.ZodTypeAny, "passthrough">[];
|
|
341
|
+
name: string;
|
|
292
342
|
lastUpdated?: boolean | undefined;
|
|
293
343
|
logo?: string | undefined;
|
|
294
344
|
favicon?: string | undefined;
|
|
@@ -317,6 +367,18 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
317
367
|
locales: string[];
|
|
318
368
|
labels?: Record<string, string> | undefined;
|
|
319
369
|
} | undefined;
|
|
370
|
+
sections?: {
|
|
371
|
+
slug: string;
|
|
372
|
+
navigation: z.objectInputType<{
|
|
373
|
+
group: z.ZodString;
|
|
374
|
+
pages: z.ZodArray<z.ZodString, "many">;
|
|
375
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
376
|
+
label?: string | undefined;
|
|
377
|
+
}[] | undefined;
|
|
378
|
+
tabs?: {
|
|
379
|
+
label: string;
|
|
380
|
+
href: string;
|
|
381
|
+
}[] | undefined;
|
|
320
382
|
topbar?: {
|
|
321
383
|
github?: string | undefined;
|
|
322
384
|
discord?: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AstroIntegration } from 'astro';
|
|
2
|
-
import { B as BarodocOptions } from './types-
|
|
3
|
-
export { a as BarodocConfig, b as BarodocI18nConfig, c as BarodocNavItem, d as BarodocPlugin, e as BarodocPluginFactory, f as BarodocPluginHooks, g as
|
|
4
|
-
export { D as DocsFrontmatter, G as GrayPreset, b as barodocConfigSchema, d as docsFrontmatterSchema, g as grayPresets, l as loadConfig } from './index-
|
|
2
|
+
import { B as BarodocOptions } from './types-C0xL7b0Y.js';
|
|
3
|
+
export { a as BarodocConfig, b as BarodocI18nConfig, c as BarodocNavItem, d as BarodocPlugin, e as BarodocPluginFactory, f as BarodocPluginHooks, g as BarodocSection, h as BarodocThemeColors, i as BarodocThemeConfig, j as BuildContext, C as ContentContext, P as PluginConfig, k as PluginContext, R as ResolvedBarodocConfig, l as ResolvedPlugin, T as ThemeExport } from './types-C0xL7b0Y.js';
|
|
4
|
+
export { D as DocsFrontmatter, G as GrayPreset, b as barodocConfigSchema, d as docsFrontmatterSchema, g as grayPresets, l as loadConfig } from './index-BJ7u7rXv.js';
|
|
5
5
|
export { getLocaleFromPath, getLocaleLabel, getLocalizedNavGroup, getLocalizedPath, removeLocaleFromPath } from './i18n/index.js';
|
|
6
6
|
export { definePlugin, getPluginIntegrations, loadPlugins, runConfigHook, runHook } from './plugins/index.js';
|
|
7
7
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
docsFrontmatterSchema,
|
|
4
4
|
grayPresets,
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AWCA5ON6.js";
|
|
7
7
|
import {
|
|
8
8
|
getLocaleFromPath,
|
|
9
9
|
getLocaleLabel,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
// src/integration.ts
|
|
23
23
|
import { existsSync } from "fs";
|
|
24
24
|
import { join } from "path";
|
|
25
|
+
import { fileURLToPath } from "url";
|
|
25
26
|
var VIRTUAL_CONFIG_ID = "virtual:barodoc/config";
|
|
26
27
|
var VIRTUAL_I18N_ID = "virtual:barodoc/i18n";
|
|
27
28
|
function resolveVirtualId(id) {
|
|
@@ -54,6 +55,8 @@ function createVirtualModulesPlugin(config) {
|
|
|
54
55
|
function barodoc(options) {
|
|
55
56
|
const configPath = options.config || "barodoc.config.json";
|
|
56
57
|
let resolvedConfig;
|
|
58
|
+
let resolvedPlugins = [];
|
|
59
|
+
let pluginCtx;
|
|
57
60
|
return {
|
|
58
61
|
name: "@barodoc/core",
|
|
59
62
|
hooks: {
|
|
@@ -68,28 +71,28 @@ function barodoc(options) {
|
|
|
68
71
|
resolvedConfig = await loadConfig(configPath, rootPath);
|
|
69
72
|
logger.info(`Loaded config: ${resolvedConfig.name}`);
|
|
70
73
|
const mode = command === "dev" ? "development" : "production";
|
|
71
|
-
|
|
74
|
+
pluginCtx = {
|
|
72
75
|
config: resolvedConfig,
|
|
73
76
|
root: rootPath,
|
|
74
77
|
mode
|
|
75
78
|
};
|
|
76
79
|
const pluginConfigs = resolvedConfig.plugins ?? [];
|
|
77
|
-
|
|
80
|
+
resolvedPlugins = await loadPlugins(pluginConfigs, pluginCtx);
|
|
78
81
|
resolvedConfig = await runConfigHook(
|
|
79
|
-
|
|
82
|
+
resolvedPlugins,
|
|
80
83
|
resolvedConfig,
|
|
81
|
-
|
|
84
|
+
pluginCtx
|
|
82
85
|
);
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
logger.info(`Loaded ${
|
|
86
|
+
pluginCtx.config = resolvedConfig;
|
|
87
|
+
if (resolvedPlugins.length > 0) {
|
|
88
|
+
logger.info(`Loaded ${resolvedPlugins.length} plugin(s)`);
|
|
86
89
|
}
|
|
87
90
|
const i18nConfig = resolvedConfig.i18n || {
|
|
88
91
|
defaultLocale: "en",
|
|
89
92
|
locales: ["en"]
|
|
90
93
|
};
|
|
91
94
|
const themeIntegration = options.theme.integration(resolvedConfig);
|
|
92
|
-
const pluginIntegrations = getPluginIntegrations(
|
|
95
|
+
const pluginIntegrations = getPluginIntegrations(resolvedPlugins, pluginCtx);
|
|
93
96
|
const overridesDir = join(rootPath, "overrides");
|
|
94
97
|
const overridesAlias = {};
|
|
95
98
|
if (existsSync(join(overridesDir, "components"))) {
|
|
@@ -113,6 +116,23 @@ function barodoc(options) {
|
|
|
113
116
|
},
|
|
114
117
|
"astro:config:done": ({ logger }) => {
|
|
115
118
|
logger.info("Barodoc setup complete");
|
|
119
|
+
},
|
|
120
|
+
"astro:build:start": async ({ logger }) => {
|
|
121
|
+
if (resolvedPlugins.length > 0) {
|
|
122
|
+
await runHook(resolvedPlugins, "build:start", pluginCtx);
|
|
123
|
+
logger.info("Plugin build:start hooks executed");
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"astro:build:done": async ({ dir, pages, logger }) => {
|
|
127
|
+
if (resolvedPlugins.length > 0) {
|
|
128
|
+
const outDir = dir instanceof URL ? fileURLToPath(dir) : String(dir);
|
|
129
|
+
const buildContext = {
|
|
130
|
+
outDir,
|
|
131
|
+
pages: pages.map((p) => p.pathname)
|
|
132
|
+
};
|
|
133
|
+
await runHook(resolvedPlugins, "build:done", buildContext, pluginCtx);
|
|
134
|
+
logger.info("Plugin build:done hooks executed");
|
|
135
|
+
}
|
|
116
136
|
}
|
|
117
137
|
}
|
|
118
138
|
};
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { e as BarodocPluginFactory,
|
|
1
|
+
import { l as ResolvedPlugin, k as PluginContext, P as PluginConfig, R as ResolvedBarodocConfig, f as BarodocPluginHooks, d as BarodocPlugin } from '../types-C0xL7b0Y.js';
|
|
2
|
+
export { e as BarodocPluginFactory, j as BuildContext, C as ContentContext } from '../types-C0xL7b0Y.js';
|
|
3
3
|
import * as astro from 'astro';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -114,6 +114,11 @@ interface BarodocThemeConfig {
|
|
|
114
114
|
};
|
|
115
115
|
radius?: string;
|
|
116
116
|
}
|
|
117
|
+
interface BarodocSection {
|
|
118
|
+
slug: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
navigation: BarodocNavItem[];
|
|
121
|
+
}
|
|
117
122
|
interface BarodocConfig {
|
|
118
123
|
name: string;
|
|
119
124
|
logo?: string;
|
|
@@ -123,6 +128,12 @@ interface BarodocConfig {
|
|
|
123
128
|
theme?: BarodocThemeConfig;
|
|
124
129
|
i18n?: BarodocI18nConfig;
|
|
125
130
|
navigation: BarodocNavItem[];
|
|
131
|
+
/** Additional doc sections beyond the default "docs" (e.g. help, guides). */
|
|
132
|
+
sections?: BarodocSection[];
|
|
133
|
+
tabs?: {
|
|
134
|
+
label: string;
|
|
135
|
+
href: string;
|
|
136
|
+
}[];
|
|
126
137
|
topbar?: {
|
|
127
138
|
github?: string;
|
|
128
139
|
discord?: string;
|
|
@@ -177,4 +188,4 @@ interface ResolvedBarodocConfig extends BarodocConfig {
|
|
|
177
188
|
_configPath: string;
|
|
178
189
|
}
|
|
179
190
|
|
|
180
|
-
export type { BarodocOptions as B, ContentContext as C, PluginConfig as P, ResolvedBarodocConfig as R, ThemeExport as T, BarodocConfig as a, BarodocI18nConfig as b, BarodocNavItem as c, BarodocPlugin as d, BarodocPluginFactory as e, BarodocPluginHooks as f,
|
|
191
|
+
export type { BarodocOptions as B, ContentContext as C, PluginConfig as P, ResolvedBarodocConfig as R, ThemeExport as T, BarodocConfig as a, BarodocI18nConfig as b, BarodocNavItem as c, BarodocPlugin as d, BarodocPluginFactory as e, BarodocPluginHooks as f, BarodocSection as g, BarodocThemeColors as h, BarodocThemeConfig as i, BuildContext as j, PluginContext as k, ResolvedPlugin as l };
|