fumadocs-typescript 5.0.0 → 5.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/dist/base-Dvhn4vZx.d.ts +115 -0
- package/dist/base-Dvhn4vZx.d.ts.map +1 -0
- package/dist/index.d.ts +32 -30
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +349 -412
- package/dist/index.js.map +1 -0
- package/dist/objectSpread2-BbbttTvx.js +203 -0
- package/dist/objectSpread2-BbbttTvx.js.map +1 -0
- package/dist/ui/index.d.ts +19 -11
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +77 -80
- package/dist/ui/index.js.map +1 -0
- package/package.json +22 -20
- package/dist/base-C72MF-7Q.d.ts +0 -110
- package/dist/chunk-H4DZJVYN.js +0 -142
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ExportedDeclarations, Project, Symbol, Type } from "ts-morph";
|
|
2
|
+
|
|
3
|
+
//#region src/create-project.d.ts
|
|
4
|
+
interface TypescriptConfig {
|
|
5
|
+
files?: string[];
|
|
6
|
+
tsconfigPath?: string;
|
|
7
|
+
/** A root directory to resolve relative path entries in the config file to. e.g. outDir */
|
|
8
|
+
basePath?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function createProject(options?: TypescriptConfig): Project;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/lib/type-table.d.ts
|
|
13
|
+
interface BaseTypeTableProps {
|
|
14
|
+
/**
|
|
15
|
+
* The path to source TypeScript file.
|
|
16
|
+
*/
|
|
17
|
+
path?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Exported type name to generate from.
|
|
20
|
+
*/
|
|
21
|
+
name?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Set the type to generate from.
|
|
24
|
+
*
|
|
25
|
+
* When used with `name`, it generates the type with `name` as export name.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* export const myName = MyType;
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* When `type` contains multiple lines, `export const` is not added.
|
|
32
|
+
* You need to export it manually, and specify the type name with `name`.
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <AutoTypeTable
|
|
36
|
+
* path="./file.ts"
|
|
37
|
+
* type={`import { ReactNode } from "react"
|
|
38
|
+
* export const MyName = ReactNode`}
|
|
39
|
+
* name="MyName"
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
type?: string;
|
|
44
|
+
}
|
|
45
|
+
interface GenerateTypeTableOptions extends GenerateOptions {
|
|
46
|
+
/**
|
|
47
|
+
* base path to resolve `path` prop
|
|
48
|
+
*/
|
|
49
|
+
basePath?: string;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/cache/index.d.ts
|
|
53
|
+
interface Cache {
|
|
54
|
+
read: (key: string) => unknown | undefined | Promise<unknown | undefined>;
|
|
55
|
+
write: (key: string, value: unknown) => void | Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/lib/base.d.ts
|
|
59
|
+
interface GeneratedDoc {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
entries: DocEntry[];
|
|
63
|
+
}
|
|
64
|
+
interface DocEntry {
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
type: string;
|
|
68
|
+
simplifiedType: string;
|
|
69
|
+
tags: RawTag[];
|
|
70
|
+
required: boolean;
|
|
71
|
+
deprecated: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface RawTag {
|
|
74
|
+
name: string;
|
|
75
|
+
text: string;
|
|
76
|
+
}
|
|
77
|
+
interface EntryContext {
|
|
78
|
+
program: Project;
|
|
79
|
+
transform?: Transformer;
|
|
80
|
+
type: Type;
|
|
81
|
+
declaration: ExportedDeclarations;
|
|
82
|
+
}
|
|
83
|
+
type Transformer = (this: EntryContext, entry: DocEntry, propertyType: Type, propertySymbol: Symbol) => void;
|
|
84
|
+
interface GenerateOptions {
|
|
85
|
+
/**
|
|
86
|
+
* Allow fields with `@internal` tag
|
|
87
|
+
*
|
|
88
|
+
* @defaultValue false
|
|
89
|
+
*/
|
|
90
|
+
allowInternal?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Modify output property entry
|
|
93
|
+
*/
|
|
94
|
+
transform?: Transformer;
|
|
95
|
+
}
|
|
96
|
+
type Generator = ReturnType<typeof createGenerator>;
|
|
97
|
+
interface GeneratorOptions extends TypescriptConfig {
|
|
98
|
+
/**
|
|
99
|
+
* cache results, note that some options are not marked as dependency.
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue false
|
|
102
|
+
*/
|
|
103
|
+
cache?: Cache | false;
|
|
104
|
+
project?: Project;
|
|
105
|
+
}
|
|
106
|
+
declare function createGenerator(config?: GeneratorOptions | Project): {
|
|
107
|
+
generateDocumentation(file: {
|
|
108
|
+
path: string;
|
|
109
|
+
content?: string;
|
|
110
|
+
}, name: string | undefined, options?: GenerateOptions): Promise<GeneratedDoc[]>;
|
|
111
|
+
generateTypeTable(props: BaseTypeTableProps, options?: GenerateTypeTableOptions): Promise<GeneratedDoc[]>;
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { GeneratorOptions as a, Cache as c, createProject as d, Generator as i, BaseTypeTableProps as l, GenerateOptions as n, RawTag as o, GeneratedDoc as r, createGenerator as s, DocEntry as t, GenerateTypeTableOptions as u };
|
|
115
|
+
//# sourceMappingURL=base-Dvhn4vZx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-Dvhn4vZx.d.ts","names":[],"sources":["../src/create-project.ts","../src/lib/type-table.ts","../src/cache/index.ts","../src/lib/base.ts"],"sourcesContent":[],"mappings":";;;UAEiB,gBAAA;;EAAA,YAAA,CAAA,EAAA,MAAgB;EAOjB;;;iBAAA,aAAA,WAAuB,mBAAwB;;;UCL9C,kBAAA;;AD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{
|
|
5
|
-
import { Transformer } from 'unified';
|
|
6
|
-
import 'ts-morph';
|
|
1
|
+
import { a as GeneratorOptions, c as Cache, d as createProject, i as Generator, l as BaseTypeTableProps, n as GenerateOptions, o as RawTag, r as GeneratedDoc, s as createGenerator, t as DocEntry, u as GenerateTypeTableOptions } from "./base-Dvhn4vZx.js";
|
|
2
|
+
import { Nodes } from "hast";
|
|
3
|
+
import { Root } from "mdast";
|
|
4
|
+
import { Transformer } from "unified";
|
|
7
5
|
|
|
6
|
+
//#region src/markdown.d.ts
|
|
8
7
|
declare function renderTypeToHast(type: string): Promise<Nodes>;
|
|
9
8
|
declare function renderMarkdownToHast(md: string): Promise<Nodes>;
|
|
10
|
-
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/lib/remark-auto-type-table.d.ts
|
|
11
11
|
interface RemarkAutoTypeTableOptions {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @defaultValue 'auto-type-table'
|
|
14
|
+
*/
|
|
15
|
+
name?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @defaultValue 'TypeTable'
|
|
18
|
+
*/
|
|
19
|
+
outputName?: string;
|
|
20
|
+
renderMarkdown?: typeof renderMarkdownToHast;
|
|
21
|
+
renderType?: typeof renderTypeToHast;
|
|
22
|
+
/**
|
|
23
|
+
* Customise type table generation
|
|
24
|
+
*/
|
|
25
|
+
options?: GenerateTypeTableOptions;
|
|
26
|
+
/**
|
|
27
|
+
* generate required `value` property for `remark-stringify`
|
|
28
|
+
*/
|
|
29
|
+
remarkStringify?: boolean;
|
|
30
|
+
generator?: Generator;
|
|
31
31
|
}
|
|
32
32
|
interface TypeTableProps extends BaseTypeTableProps {
|
|
33
|
-
|
|
33
|
+
cwd?: true;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Compile `auto-type-table` into Fumadocs UI compatible TypeTable
|
|
@@ -38,7 +38,9 @@ interface TypeTableProps extends BaseTypeTableProps {
|
|
|
38
38
|
* MDX is required to use this plugin.
|
|
39
39
|
*/
|
|
40
40
|
declare function remarkAutoTypeTable(config?: RemarkAutoTypeTableOptions): Transformer<Root, Root>;
|
|
41
|
-
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/cache/fs-cache.d.ts
|
|
42
43
|
declare function createFileSystemGeneratorCache(dir: string): Cache;
|
|
43
|
-
|
|
44
|
-
export { Cache, Generator,
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Cache, DocEntry, GenerateOptions, GeneratedDoc, Generator, GeneratorOptions, RawTag, RemarkAutoTypeTableOptions, TypeTableProps, createFileSystemGeneratorCache, createGenerator, createProject, remarkAutoTypeTable, renderMarkdownToHast };
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/markdown.ts","../src/lib/remark-auto-type-table.ts","../src/cache/fs-cache.ts"],"sourcesContent":[],"mappings":";;;;;;iBAuBsB,gBAAA,gBAAgC,QAAQ;iBA8BxC,oBAAA,cAAkC,QAAQ;;;UCiD/C,0BAAA;ED/EK;AA8BtB;;;;ACiDA;;EAYsB,UAAA,CAAA,EAAA,MAAA;EAKV,cAAA,CAAA,EAAA,OANc,oBAMd;EAOE,UAAA,CAAA,EAAA,OAZQ,gBAYR;EAAS;AAGvB;AASA;EACU,OAAA,CAAA,EApBE,wBAoBF;EACK;;;EAAD,eAAA,CAAA,EAAA,OAAA;cAdA;;UAGG,cAAA,SAAuB;EC5HxB,GAAA,CAAA,EAAA,IAAA;;;;;;;iBDqIA,mBAAA,UACN,6BACP,YAAY,MAAM;;;iBCvIL,8BAAA,eAA6C"}
|