@barodoc/core 7.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-RPBSSV23.js → chunk-AWCA5ON6.js} +6 -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-C7DDzFCv.d.ts → index-BJ7u7rXv.d.ts} +47 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +34 -14
- package/dist/plugins/index.d.ts +2 -2
- package/dist/{types-C59QVIss.d.ts → types-C0xL7b0Y.d.ts} +8 -1
- package/package.json +1 -1
|
@@ -85,6 +85,11 @@ var tabSchema = z.object({
|
|
|
85
85
|
label: z.string(),
|
|
86
86
|
href: z.string()
|
|
87
87
|
});
|
|
88
|
+
var sectionSchema = z.object({
|
|
89
|
+
slug: z.string(),
|
|
90
|
+
label: z.string().optional(),
|
|
91
|
+
navigation: z.array(navItemSchema)
|
|
92
|
+
});
|
|
88
93
|
var barodocConfigSchema = z.object({
|
|
89
94
|
name: z.string(),
|
|
90
95
|
logo: z.string().optional(),
|
|
@@ -94,6 +99,7 @@ var barodocConfigSchema = z.object({
|
|
|
94
99
|
theme: themeConfigSchema,
|
|
95
100
|
i18n: i18nConfigSchema,
|
|
96
101
|
navigation: z.array(navItemSchema),
|
|
102
|
+
sections: z.array(sectionSchema).optional(),
|
|
97
103
|
tabs: z.array(tabSchema).optional(),
|
|
98
104
|
topbar: topbarSchema,
|
|
99
105
|
search: searchSchema,
|
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,34 @@ 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">>;
|
|
151
179
|
tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
152
180
|
label: z.ZodString;
|
|
153
181
|
href: z.ZodString;
|
|
@@ -230,11 +258,11 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
230
258
|
plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>]>, "many">>;
|
|
231
259
|
customCss: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
232
260
|
}, "strip", z.ZodTypeAny, {
|
|
233
|
-
name: string;
|
|
234
261
|
navigation: z.objectOutputType<{
|
|
235
262
|
group: z.ZodString;
|
|
236
263
|
pages: z.ZodArray<z.ZodString, "many">;
|
|
237
264
|
}, z.ZodTypeAny, "passthrough">[];
|
|
265
|
+
name: string;
|
|
238
266
|
lastUpdated?: boolean | undefined;
|
|
239
267
|
logo?: string | undefined;
|
|
240
268
|
favicon?: string | undefined;
|
|
@@ -263,6 +291,14 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
263
291
|
locales: string[];
|
|
264
292
|
labels?: Record<string, string> | undefined;
|
|
265
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;
|
|
266
302
|
tabs?: {
|
|
267
303
|
label: string;
|
|
268
304
|
href: string;
|
|
@@ -298,11 +334,11 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
298
334
|
plugins?: (string | [string, Record<string, unknown>])[] | undefined;
|
|
299
335
|
customCss?: string[] | undefined;
|
|
300
336
|
}, {
|
|
301
|
-
name: string;
|
|
302
337
|
navigation: z.objectInputType<{
|
|
303
338
|
group: z.ZodString;
|
|
304
339
|
pages: z.ZodArray<z.ZodString, "many">;
|
|
305
340
|
}, z.ZodTypeAny, "passthrough">[];
|
|
341
|
+
name: string;
|
|
306
342
|
lastUpdated?: boolean | undefined;
|
|
307
343
|
logo?: string | undefined;
|
|
308
344
|
favicon?: string | undefined;
|
|
@@ -331,6 +367,14 @@ declare const barodocConfigSchema: z.ZodObject<{
|
|
|
331
367
|
locales: string[];
|
|
332
368
|
labels?: Record<string, string> | undefined;
|
|
333
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;
|
|
334
378
|
tabs?: {
|
|
335
379
|
label: string;
|
|
336
380
|
href: string;
|
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
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
barodocConfigSchema,
|
|
3
|
+
docsFrontmatterSchema,
|
|
4
|
+
grayPresets,
|
|
5
|
+
loadConfig
|
|
6
|
+
} from "./chunk-AWCA5ON6.js";
|
|
1
7
|
import {
|
|
2
8
|
getLocaleFromPath,
|
|
3
9
|
getLocaleLabel,
|
|
@@ -12,16 +18,11 @@ import {
|
|
|
12
18
|
runConfigHook,
|
|
13
19
|
runHook
|
|
14
20
|
} from "./chunk-UICDSNBG.js";
|
|
15
|
-
import {
|
|
16
|
-
barodocConfigSchema,
|
|
17
|
-
docsFrontmatterSchema,
|
|
18
|
-
grayPresets,
|
|
19
|
-
loadConfig
|
|
20
|
-
} from "./chunk-RPBSSV23.js";
|
|
21
21
|
|
|
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,8 @@ 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[];
|
|
126
133
|
tabs?: {
|
|
127
134
|
label: string;
|
|
128
135
|
href: string;
|
|
@@ -181,4 +188,4 @@ interface ResolvedBarodocConfig extends BarodocConfig {
|
|
|
181
188
|
_configPath: string;
|
|
182
189
|
}
|
|
183
190
|
|
|
184
|
-
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 };
|