@hanzo/docs-content-collections 1.2.4
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 +21 -0
- package/README.md +3 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/configuration.d.ts +92 -0
- package/dist/configuration.js +12797 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +26 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Fuma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Meta, Context } from '@content-collections/core';
|
|
2
|
+
import { Options } from '@content-collections/mdx';
|
|
3
|
+
import * as Plugins from '@hanzo/docs-core/mdx-plugins';
|
|
4
|
+
import { StructuredData } from '@hanzo/docs-core/mdx-plugins';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { Pluggable } from 'unified';
|
|
7
|
+
|
|
8
|
+
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Default configuration
|
|
12
|
+
*
|
|
13
|
+
* You may copy and modify the code
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface TransformOptions extends Omit<Options, 'remarkPlugins' | 'rehypePlugins'> {
|
|
17
|
+
remarkPlugins?: ResolvePlugins;
|
|
18
|
+
rehypePlugins?: ResolvePlugins;
|
|
19
|
+
/**
|
|
20
|
+
* Generate `structuredData`
|
|
21
|
+
*
|
|
22
|
+
* @defaultValue true
|
|
23
|
+
* @deprecated use `remarkStructureOptions` instead
|
|
24
|
+
*/
|
|
25
|
+
generateStructuredData?: boolean;
|
|
26
|
+
remarkStructureOptions?: Plugins.StructureOptions | boolean;
|
|
27
|
+
remarkHeadingOptions?: Plugins.RemarkHeadingOptions | boolean;
|
|
28
|
+
rehypeCodeOptions?: Plugins.RehypeCodeOptions | boolean;
|
|
29
|
+
remarkImageOptions?: Plugins.RemarkImageOptions | boolean;
|
|
30
|
+
remarkCodeTabOptions?: Plugins.RemarkCodeTabOptions | boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The default TOC types support `ReactNode`, which isn't serializable
|
|
34
|
+
*/
|
|
35
|
+
type SerializableTOC = {
|
|
36
|
+
title: string;
|
|
37
|
+
url: string;
|
|
38
|
+
depth: number;
|
|
39
|
+
}[];
|
|
40
|
+
interface BaseDoc {
|
|
41
|
+
_meta: Meta;
|
|
42
|
+
content: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* We need to convert interface types to object types.
|
|
46
|
+
*
|
|
47
|
+
* Otherwise, `T extends Serializable? true : false` gives us `false`.
|
|
48
|
+
* Because interface types cannot extend a union type like `Serializable`.
|
|
49
|
+
*/
|
|
50
|
+
type InterfaceToObject<T> = T extends object ? {
|
|
51
|
+
[K in keyof T]: InterfaceToObject<T[K]>;
|
|
52
|
+
} : T;
|
|
53
|
+
declare function transformMDX<D extends BaseDoc>(document: D, context: Context, options?: TransformOptions): Promise<D & {
|
|
54
|
+
body: string;
|
|
55
|
+
toc: SerializableTOC;
|
|
56
|
+
/**
|
|
57
|
+
* `StructuredData` for search indexes
|
|
58
|
+
*/
|
|
59
|
+
structuredData: InterfaceToObject<StructuredData>;
|
|
60
|
+
}>;
|
|
61
|
+
declare const metaSchema: z.ZodObject<{
|
|
62
|
+
title: z.ZodOptional<z.ZodString>;
|
|
63
|
+
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
64
|
+
description: z.ZodOptional<z.ZodString>;
|
|
65
|
+
root: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
declare const frontmatterSchema: z.ZodObject<{
|
|
70
|
+
title: z.ZodString;
|
|
71
|
+
description: z.ZodOptional<z.ZodString>;
|
|
72
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
73
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
_openapi: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
declare function createDocSchema(z: typeof z): {
|
|
77
|
+
title: z.ZodString;
|
|
78
|
+
description: z.ZodOptional<z.ZodString>;
|
|
79
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
80
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
_openapi: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
82
|
+
};
|
|
83
|
+
declare function createMetaSchema(z: typeof z): {
|
|
84
|
+
title: z.ZodOptional<z.ZodString>;
|
|
85
|
+
description: z.ZodOptional<z.ZodString>;
|
|
86
|
+
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
88
|
+
root: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export { type SerializableTOC, type TransformOptions, createDocSchema, createMetaSchema, frontmatterSchema, metaSchema, transformMDX };
|