@hanzo/docs-content-collections 1.2.4 → 1.2.7
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/README.md +2 -2
- package/dist/configuration.d.ts +60 -65
- package/dist/configuration.d.ts.map +1 -0
- package/dist/configuration.js +83 -12786
- package/dist/configuration.js.map +1 -0
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -24
- package/dist/index.js.map +1 -0
- package/package.json +30 -27
- package/dist/chunk-MLKGABMK.js +0 -9
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hanzo/docs-content-collections
|
|
2
2
|
|
|
3
|
-
The Content Collections adapter for
|
|
3
|
+
The Content Collections adapter for Hanzo Docs.
|
package/dist/configuration.d.ts
CHANGED
|
@@ -1,45 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Pluggable } from
|
|
1
|
+
import { Options } from "@content-collections/mdx";
|
|
2
|
+
import * as Plugins from "@hanzo/docs-core/mdx-plugins";
|
|
3
|
+
import { StructuredData } from "@hanzo/docs-core/mdx-plugins";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { Context, Meta } from "@content-collections/core";
|
|
6
|
+
import { Pluggable } from "unified";
|
|
7
7
|
|
|
8
|
+
//#region src/resolve-plugins.d.ts
|
|
8
9
|
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Default configuration
|
|
12
|
-
*
|
|
13
|
-
* You may copy and modify the code
|
|
14
|
-
*/
|
|
15
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/configuration.d.ts
|
|
16
12
|
interface TransformOptions extends Omit<Options, 'remarkPlugins' | 'rehypePlugins'> {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
remarkPlugins?: ResolvePlugins;
|
|
14
|
+
rehypePlugins?: ResolvePlugins;
|
|
15
|
+
/**
|
|
16
|
+
* Generate `structuredData`
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue true
|
|
19
|
+
* @deprecated use `remarkStructureOptions` instead
|
|
20
|
+
*/
|
|
21
|
+
generateStructuredData?: boolean;
|
|
22
|
+
remarkStructureOptions?: Plugins.StructureOptions | boolean;
|
|
23
|
+
remarkHeadingOptions?: Plugins.RemarkHeadingOptions | boolean;
|
|
24
|
+
rehypeCodeOptions?: Plugins.RehypeCodeOptions | boolean;
|
|
25
|
+
remarkImageOptions?: Plugins.RemarkImageOptions | boolean;
|
|
26
|
+
remarkCodeTabOptions?: Plugins.RemarkCodeTabOptions | boolean;
|
|
31
27
|
}
|
|
32
28
|
/**
|
|
33
29
|
* The default TOC types support `ReactNode`, which isn't serializable
|
|
34
30
|
*/
|
|
35
31
|
type SerializableTOC = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
title: string;
|
|
33
|
+
url: string;
|
|
34
|
+
depth: number;
|
|
39
35
|
}[];
|
|
40
36
|
interface BaseDoc {
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
_meta: Meta;
|
|
38
|
+
content: string;
|
|
43
39
|
}
|
|
44
40
|
/**
|
|
45
41
|
* We need to convert interface types to object types.
|
|
@@ -47,46 +43,45 @@ interface BaseDoc {
|
|
|
47
43
|
* Otherwise, `T extends Serializable? true : false` gives us `false`.
|
|
48
44
|
* Because interface types cannot extend a union type like `Serializable`.
|
|
49
45
|
*/
|
|
50
|
-
type InterfaceToObject<T> = T extends object ? {
|
|
51
|
-
[K in keyof T]: InterfaceToObject<T[K]>;
|
|
52
|
-
} : T;
|
|
46
|
+
type InterfaceToObject<T> = T extends object ? { [K in keyof T]: InterfaceToObject<T[K]> } : T;
|
|
53
47
|
declare function transformMDX<D extends BaseDoc>(document: D, context: Context, options?: TransformOptions): Promise<D & {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
body: string;
|
|
49
|
+
toc: SerializableTOC;
|
|
50
|
+
/**
|
|
51
|
+
* `StructuredData` for search indexes
|
|
52
|
+
*/
|
|
53
|
+
structuredData: InterfaceToObject<StructuredData>;
|
|
60
54
|
}>;
|
|
61
55
|
declare const metaSchema: z.ZodObject<{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
title: z.ZodOptional<z.ZodString>;
|
|
57
|
+
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
description: z.ZodOptional<z.ZodString>;
|
|
59
|
+
root: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
68
62
|
}, z.core.$strip>;
|
|
69
63
|
declare const frontmatterSchema: z.ZodObject<{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
title: z.ZodString;
|
|
65
|
+
description: z.ZodOptional<z.ZodString>;
|
|
66
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
67
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
_openapi: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
75
69
|
}, z.core.$strip>;
|
|
76
70
|
declare function createDocSchema(z: typeof z): {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
title: z.ZodString;
|
|
72
|
+
description: z.ZodOptional<z.ZodString>;
|
|
73
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
74
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
_openapi: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
82
76
|
};
|
|
83
77
|
declare function createMetaSchema(z: typeof z): {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
title: z.ZodOptional<z.ZodString>;
|
|
79
|
+
description: z.ZodOptional<z.ZodString>;
|
|
80
|
+
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
82
|
+
root: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
90
84
|
};
|
|
91
|
-
|
|
92
|
-
export {
|
|
85
|
+
//#endregion
|
|
86
|
+
export { SerializableTOC, TransformOptions, createDocSchema, createMetaSchema, frontmatterSchema, metaSchema, transformMDX };
|
|
87
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","names":[],"sources":["../src/resolve-plugins.ts","../src/configuration.ts"],"mappings":";;;;;;;;KAEY,cAAA,GAAiB,SAAA,OAAgB,CAAA,EAAG,SAAA,OAAgB,SAAA;;;UCU/C,gBAAA,SAAyB,IAAA,CAAK,OAAA;EAC7C,aAAA,GAAgB,cAAA;EAChB,aAAA,GAAgB,cAAA;EDZuD;;;;;;ECoBvE,sBAAA;EAEA,sBAAA,GAAyB,OAAA,CAAQ,gBAAA;EACjC,oBAAA,GAAuB,OAAA,CAAQ,oBAAA;EAC/B,iBAAA,GAAoB,OAAA,CAAQ,iBAAA;EAC5B,kBAAA,GAAqB,OAAA,CAAQ,kBAAA;EAC7B,oBAAA,GAAuB,OAAA,CAAQ,oBAAA;AAAA;;;;KAMrB,eAAA;EACV,KAAA;EACA,GAAA;EACA,KAAA;AAAA;AAAA,UAGQ,OAAA;EACR,KAAA,EAAO,IAAA;EACP,OAAA;AAAA;;;;;;;KASG,iBAAA,MAAuB,CAAA,gCAEV,CAAA,GAAI,iBAAA,CAAkB,CAAA,CAAE,CAAA,OAEtC,CAAA;AAAA,iBAEkB,YAAA,WAAuB,OAAA,CAAA,CAC3C,QAAA,EAAU,CAAA,EACV,OAAA,EAAS,OAAA,EACT,OAAA,GAAS,gBAAA,GACR,OAAA,CACD,CAAA;EACE,IAAA;EACA,GAAA,EAAK,eAAA;EAvCwB;;;EA2C7B,cAAA,EAAgB,iBAAA,CAAkB,cAAA;AAAA;AAAA,cAmEzB,UAAA,EAAU,CAAA,CAAA,SAAA;;;;;;;;cASV,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;;iBAUd,eAAA,CAAgB,CAAA,SAAU,CAAA;;;;;;;iBAW1B,gBAAA,CAAiB,CAAA,SAAU,CAAA"}
|