@barodoc/core 2.0.0 → 3.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.
@@ -48,6 +48,16 @@ var feedbackSchema = z.object({
48
48
  enabled: z.boolean(),
49
49
  endpoint: z.string().optional()
50
50
  }).optional();
51
+ var docsFrontmatterSchema = z.object({
52
+ title: z.string().optional(),
53
+ description: z.string().optional(),
54
+ tags: z.array(z.string()).optional(),
55
+ related: z.array(z.string()).optional(),
56
+ category: z.string().optional(),
57
+ api_reference: z.boolean().optional(),
58
+ difficulty: z.enum(["beginner", "intermediate", "advanced"]).optional(),
59
+ lastUpdated: z.date().optional()
60
+ });
51
61
  var pluginConfigSchema = z.union([
52
62
  z.string(),
53
63
  z.tuple([z.string(), z.record(z.unknown())])
@@ -122,6 +132,7 @@ function getConfigDefaults() {
122
132
  }
123
133
 
124
134
  export {
135
+ docsFrontmatterSchema,
125
136
  barodocConfigSchema,
126
137
  loadConfig,
127
138
  getConfigDefaults
@@ -2,6 +2,36 @@ import { z } from 'zod';
2
2
  import { R as ResolvedBarodocConfig, a as BarodocConfig } from '../types-EzD7o05V.js';
3
3
  import 'astro';
4
4
 
5
+ /** Frontmatter schema for MDX/MD content files. Reusable across custom and quick mode. */
6
+ declare const docsFrontmatterSchema: z.ZodObject<{
7
+ title: z.ZodOptional<z.ZodString>;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
+ related: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ category: z.ZodOptional<z.ZodString>;
12
+ api_reference: z.ZodOptional<z.ZodBoolean>;
13
+ difficulty: z.ZodOptional<z.ZodEnum<["beginner", "intermediate", "advanced"]>>;
14
+ lastUpdated: z.ZodOptional<z.ZodDate>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ title?: string | undefined;
17
+ description?: string | undefined;
18
+ tags?: string[] | undefined;
19
+ related?: string[] | undefined;
20
+ category?: string | undefined;
21
+ api_reference?: boolean | undefined;
22
+ difficulty?: "beginner" | "intermediate" | "advanced" | undefined;
23
+ lastUpdated?: Date | undefined;
24
+ }, {
25
+ title?: string | undefined;
26
+ description?: string | undefined;
27
+ tags?: string[] | undefined;
28
+ related?: string[] | undefined;
29
+ category?: string | undefined;
30
+ api_reference?: boolean | undefined;
31
+ difficulty?: "beginner" | "intermediate" | "advanced" | undefined;
32
+ lastUpdated?: Date | undefined;
33
+ }>;
34
+ type DocsFrontmatter = z.infer<typeof docsFrontmatterSchema>;
5
35
  declare const barodocConfigSchema: z.ZodObject<{
6
36
  name: z.ZodString;
7
37
  logo: z.ZodOptional<z.ZodString>;
@@ -164,6 +194,7 @@ declare const barodocConfigSchema: z.ZodObject<{
164
194
  group: z.ZodString;
165
195
  pages: z.ZodArray<z.ZodString, "many">;
166
196
  }, z.ZodTypeAny, "passthrough">[];
197
+ lastUpdated?: boolean | undefined;
167
198
  logo?: string | undefined;
168
199
  favicon?: string | undefined;
169
200
  site?: string | undefined;
@@ -202,7 +233,6 @@ declare const barodocConfigSchema: z.ZodObject<{
202
233
  editLink?: {
203
234
  baseUrl: string;
204
235
  } | undefined;
205
- lastUpdated?: boolean | undefined;
206
236
  announcement?: {
207
237
  text: string;
208
238
  link?: string | undefined;
@@ -220,6 +250,7 @@ declare const barodocConfigSchema: z.ZodObject<{
220
250
  group: z.ZodString;
221
251
  pages: z.ZodArray<z.ZodString, "many">;
222
252
  }, z.ZodTypeAny, "passthrough">[];
253
+ lastUpdated?: boolean | undefined;
223
254
  logo?: string | undefined;
224
255
  favicon?: string | undefined;
225
256
  site?: string | undefined;
@@ -258,7 +289,6 @@ declare const barodocConfigSchema: z.ZodObject<{
258
289
  editLink?: {
259
290
  baseUrl: string;
260
291
  } | undefined;
261
- lastUpdated?: boolean | undefined;
262
292
  announcement?: {
263
293
  text: string;
264
294
  link?: string | undefined;
@@ -277,4 +307,4 @@ type BarodocConfigOutput = z.output<typeof barodocConfigSchema>;
277
307
  declare function loadConfig(configPath: string, root: string): Promise<ResolvedBarodocConfig>;
278
308
  declare function getConfigDefaults(): Partial<BarodocConfig>;
279
309
 
280
- export { type BarodocConfigInput, type BarodocConfigOutput, barodocConfigSchema, getConfigDefaults, loadConfig };
310
+ export { type BarodocConfigInput, type BarodocConfigOutput, type DocsFrontmatter, barodocConfigSchema, docsFrontmatterSchema, getConfigDefaults, loadConfig };
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  barodocConfigSchema,
3
+ docsFrontmatterSchema,
3
4
  getConfigDefaults,
4
5
  loadConfig
5
- } from "../chunk-TOOKPXGT.js";
6
+ } from "../chunk-633IEUDI.js";
6
7
  export {
7
8
  barodocConfigSchema,
9
+ docsFrontmatterSchema,
8
10
  getConfigDefaults,
9
11
  loadConfig
10
12
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AstroIntegration } from 'astro';
2
2
  import { B as BarodocOptions } from './types-EzD7o05V.js';
3
3
  export { a as BarodocConfig, b as BarodocI18nConfig, c as BarodocNavItem, d as BarodocPlugin, e as BarodocPluginFactory, f as BarodocPluginHooks, g as BarodocThemeColors, h as BarodocThemeConfig, i as BuildContext, C as ContentContext, P as PluginConfig, j as PluginContext, R as ResolvedBarodocConfig, k as ResolvedPlugin, T as ThemeExport } from './types-EzD7o05V.js';
4
- export { barodocConfigSchema, loadConfig } from './config/index.js';
4
+ export { DocsFrontmatter, barodocConfigSchema, docsFrontmatterSchema, loadConfig } from './config/index.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,7 +1,8 @@
1
1
  import {
2
2
  barodocConfigSchema,
3
+ docsFrontmatterSchema,
3
4
  loadConfig
4
- } from "./chunk-TOOKPXGT.js";
5
+ } from "./chunk-633IEUDI.js";
5
6
  import {
6
7
  getLocaleFromPath,
7
8
  getLocaleLabel,
@@ -18,6 +19,8 @@ import {
18
19
  } from "./chunk-UICDSNBG.js";
19
20
 
20
21
  // src/integration.ts
22
+ import { existsSync } from "fs";
23
+ import { join } from "path";
21
24
  var VIRTUAL_CONFIG_ID = "virtual:barodoc/config";
22
25
  var VIRTUAL_I18N_ID = "virtual:barodoc/i18n";
23
26
  function resolveVirtualId(id) {
@@ -86,9 +89,20 @@ function barodoc(options) {
86
89
  };
87
90
  const themeIntegration = options.theme.integration(resolvedConfig);
88
91
  const pluginIntegrations = getPluginIntegrations(plugins, pluginContext);
92
+ const overridesDir = join(rootPath, "overrides");
93
+ const overridesAlias = {};
94
+ if (existsSync(join(overridesDir, "components"))) {
95
+ overridesAlias["@overrides/components"] = join(overridesDir, "components");
96
+ logger.info("Overrides: components/ detected");
97
+ }
98
+ if (existsSync(join(overridesDir, "layouts"))) {
99
+ overridesAlias["@overrides/layouts"] = join(overridesDir, "layouts");
100
+ logger.info("Overrides: layouts/ detected");
101
+ }
89
102
  updateConfig({
90
103
  vite: {
91
- plugins: [createVirtualModulesPlugin(resolvedConfig)]
104
+ plugins: [createVirtualModulesPlugin(resolvedConfig)],
105
+ resolve: Object.keys(overridesAlias).length > 0 ? { alias: overridesAlias } : void 0
92
106
  },
93
107
  integrations: [themeIntegration, ...pluginIntegrations]
94
108
  });
@@ -106,6 +120,7 @@ export {
106
120
  barodocConfigSchema,
107
121
  barodoc as default,
108
122
  definePlugin,
123
+ docsFrontmatterSchema,
109
124
  getLocaleFromPath,
110
125
  getLocaleLabel,
111
126
  getLocalizedNavGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barodoc/core",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Core integration for Barodoc documentation framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",