@xyd-js/plugin-docs 0.1.0-xyd.4 → 0.1.0-xyd.44

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.
@@ -0,0 +1,42 @@
1
+ import { Plugin as Plugin$1 } from 'vite';
2
+ import { RouteConfigEntry } from '@react-router/dev/routes';
3
+ import { Settings } from '@xyd-js/core';
4
+
5
+ interface PluginOutput {
6
+ vitePlugins: Plugin$1[];
7
+ settings: Settings;
8
+ routes: RouteConfigEntry[];
9
+ basePath: string;
10
+ pagePathMapping: {
11
+ [page: string]: string;
12
+ };
13
+ }
14
+ type Plugin = () => Promise<PluginOutput | null>;
15
+
16
+ /**
17
+ * Reads `xyd` settings from the current working directory.
18
+ *
19
+ * This function searches for a file named 'xyd' with one of the supported extensions
20
+ * (tsx, jsx, js, ts, json) in the current working directory. If found, it loads the
21
+ * settings from that file.
22
+ *
23
+ * For React-based settings files (tsx, jsx, js, ts), it uses Vite's SSR module loading
24
+ * to evaluate the file and extract the default export. For JSON files, it simply
25
+ * parses the JSON content.
26
+ *
27
+ * @returns A Promise that resolves to:
28
+ * - The Settings object if a valid settings file was found and loaded
29
+ * - A string if the settings file contains a string value
30
+ * - null if no settings file was found or an error occurred
31
+ *
32
+ * @throws May throw errors if file reading or parsing fails
33
+ */
34
+ declare function readSettings(): Promise<Settings | null>;
35
+
36
+ interface PluginDocsOptions {
37
+ disableAPIGeneration?: boolean;
38
+ disableFSWrite?: boolean;
39
+ }
40
+ declare function pluginDocs(options?: PluginDocsOptions): Promise<PluginOutput | null>;
41
+
42
+ export { type Plugin, type PluginDocsOptions, type PluginOutput, pluginDocs, readSettings };