@barodoc/core 0.0.1 → 1.0.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Barocss
3
+ Copyright (c) 2026 Barocss
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -35,6 +35,11 @@ var topbarSchema = z.object({
35
35
  var searchSchema = z.object({
36
36
  enabled: z.boolean().optional()
37
37
  }).optional();
38
+ var lineNumbersSchema = z.boolean().optional();
39
+ var pluginConfigSchema = z.union([
40
+ z.string(),
41
+ z.tuple([z.string(), z.record(z.unknown())])
42
+ ]);
38
43
  var barodocConfigSchema = z.object({
39
44
  name: z.string(),
40
45
  logo: z.string().optional(),
@@ -44,6 +49,8 @@ var barodocConfigSchema = z.object({
44
49
  navigation: z.array(navItemSchema),
45
50
  topbar: topbarSchema,
46
51
  search: searchSchema,
52
+ lineNumbers: lineNumbersSchema,
53
+ plugins: z.array(pluginConfigSchema).optional(),
47
54
  customCss: z.array(z.string()).optional()
48
55
  });
49
56
 
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { R as ResolvedBarodocConfig, a as BarodocConfig } from '../types-DaMSwPOk.js';
2
+ import { R as ResolvedBarodocConfig, a as BarodocConfig } from '../types-Be4n5fTN.js';
3
3
  import 'astro';
4
4
 
5
5
  declare const barodocConfigSchema: z.ZodObject<{
@@ -122,6 +122,8 @@ declare const barodocConfigSchema: z.ZodObject<{
122
122
  }, {
123
123
  enabled?: boolean | undefined;
124
124
  }>>;
125
+ lineNumbers: z.ZodOptional<z.ZodBoolean>;
126
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>]>, "many">>;
125
127
  customCss: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
126
128
  }, "strip", z.ZodTypeAny, {
127
129
  name: string;
@@ -161,6 +163,8 @@ declare const barodocConfigSchema: z.ZodObject<{
161
163
  search?: {
162
164
  enabled?: boolean | undefined;
163
165
  } | undefined;
166
+ lineNumbers?: boolean | undefined;
167
+ plugins?: (string | [string, Record<string, unknown>])[] | undefined;
164
168
  customCss?: string[] | undefined;
165
169
  }, {
166
170
  name: string;
@@ -200,6 +204,8 @@ declare const barodocConfigSchema: z.ZodObject<{
200
204
  search?: {
201
205
  enabled?: boolean | undefined;
202
206
  } | undefined;
207
+ lineNumbers?: boolean | undefined;
208
+ plugins?: (string | [string, Record<string, unknown>])[] | undefined;
203
209
  customCss?: string[] | undefined;
204
210
  }>;
205
211
  type BarodocConfigInput = z.input<typeof barodocConfigSchema>;
@@ -2,7 +2,7 @@ import {
2
2
  barodocConfigSchema,
3
3
  getConfigDefaults,
4
4
  loadConfig
5
- } from "../chunk-JQRBNHRZ.js";
5
+ } from "../chunk-SX42YS3W.js";
6
6
  export {
7
7
  barodocConfigSchema,
8
8
  getConfigDefaults,
@@ -1,4 +1,4 @@
1
- import { b as BarodocI18nConfig, c as BarodocNavItem } from '../types-DaMSwPOk.js';
1
+ import { b as BarodocI18nConfig, c as BarodocNavItem } from '../types-Be4n5fTN.js';
2
2
  import 'astro';
3
3
 
4
4
  declare function getLocaleFromPath(path: string, i18n: BarodocI18nConfig): string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AstroIntegration } from 'astro';
2
- import { B as BarodocOptions } from './types-DaMSwPOk.js';
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-DaMSwPOk.js';
2
+ import { B as BarodocOptions } from './types-Be4n5fTN.js';
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-Be4n5fTN.js';
4
4
  export { barodocConfigSchema, 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';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  barodocConfigSchema,
3
3
  loadConfig
4
- } from "./chunk-JQRBNHRZ.js";
4
+ } from "./chunk-SX42YS3W.js";
5
5
  import {
6
6
  getLocaleFromPath,
7
7
  getLocaleLabel,
@@ -56,22 +56,41 @@ function barodoc(options) {
56
56
  "astro:config:setup": async ({
57
57
  config,
58
58
  updateConfig,
59
- logger
59
+ logger,
60
+ command
60
61
  }) => {
61
62
  logger.info("Loading Barodoc configuration...");
62
63
  const rootPath = config.root instanceof URL ? config.root.pathname : String(config.root);
63
64
  resolvedConfig = await loadConfig(configPath, rootPath);
64
65
  logger.info(`Loaded config: ${resolvedConfig.name}`);
66
+ const mode = command === "dev" ? "development" : "production";
67
+ const pluginContext = {
68
+ config: resolvedConfig,
69
+ root: rootPath,
70
+ mode
71
+ };
72
+ const pluginConfigs = resolvedConfig.plugins ?? [];
73
+ const plugins = await loadPlugins(pluginConfigs, pluginContext);
74
+ resolvedConfig = await runConfigHook(
75
+ plugins,
76
+ resolvedConfig,
77
+ pluginContext
78
+ );
79
+ pluginContext.config = resolvedConfig;
80
+ if (plugins.length > 0) {
81
+ logger.info(`Loaded ${plugins.length} plugin(s)`);
82
+ }
65
83
  const i18nConfig = resolvedConfig.i18n || {
66
84
  defaultLocale: "en",
67
85
  locales: ["en"]
68
86
  };
69
- const themeIntegration = options.theme.integration();
87
+ const themeIntegration = options.theme.integration(resolvedConfig);
88
+ const pluginIntegrations = getPluginIntegrations(plugins, pluginContext);
70
89
  updateConfig({
71
90
  vite: {
72
91
  plugins: [createVirtualModulesPlugin(resolvedConfig)]
73
92
  },
74
- integrations: [themeIntegration]
93
+ integrations: [themeIntegration, ...pluginIntegrations]
75
94
  });
76
95
  logger.info(
77
96
  `i18n configured: ${i18nConfig.locales.length} locale(s)`
@@ -1,5 +1,5 @@
1
- import { k as ResolvedPlugin, j as PluginContext, P as PluginConfig, R as ResolvedBarodocConfig, f as BarodocPluginHooks, d as BarodocPlugin } from '../types-DaMSwPOk.js';
2
- export { e as BarodocPluginFactory, i as BuildContext, C as ContentContext } from '../types-DaMSwPOk.js';
1
+ import { k as ResolvedPlugin, j as PluginContext, P as PluginConfig, R as ResolvedBarodocConfig, f as BarodocPluginHooks, d as BarodocPlugin } from '../types-Be4n5fTN.js';
2
+ export { e as BarodocPluginFactory, i as BuildContext, C as ContentContext } from '../types-Be4n5fTN.js';
3
3
  import * as astro from 'astro';
4
4
 
5
5
  /**
@@ -128,12 +128,14 @@ interface BarodocConfig {
128
128
  search?: {
129
129
  enabled?: boolean;
130
130
  };
131
+ /** When true, code blocks render with line numbers. */
132
+ lineNumbers?: boolean;
131
133
  plugins?: PluginConfig[];
132
134
  customCss?: string[];
133
135
  }
134
136
  interface ThemeExport {
135
137
  name: string;
136
- integration: () => AstroIntegration;
138
+ integration: (config: ResolvedBarodocConfig) => AstroIntegration;
137
139
  pages?: Record<string, () => Promise<unknown>>;
138
140
  layouts?: Record<string, () => Promise<unknown>>;
139
141
  components?: Record<string, () => Promise<unknown>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barodoc/core",
3
- "version": "0.0.1",
3
+ "version": "1.0.1",
4
4
  "description": "Core integration for Barodoc documentation framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",