fumadocs-typescript 4.0.14 → 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.
@@ -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;;ADFjB;AAOA;;;;ACLA;EAmCiB,IAAA,CAAA,EAAA,MAAA;;;;ACvCjB;;;;ACkBA;AAMA;AAWA;AAGC;;;;;;AAMkC;;;;;EAOT,IAAA,CAAA,EAAA,MAAA;AAG1B;AAcY,UF7BK,wBAAA,SAAiC,eE6BhB,CAAA;EAEjB;;;EAAyB,QAAA,CAAA,EAAA,MAAA;;;;UDtEzB,KAAA;+CAC8B;iDACE;AFAjD;;;AAOgB,UGSC,YAAA,CHTY;;;WGYlB;AFjBX;AAmCiB,UEfA,QAAA,CFeA;;;;ECvCA,cAAK,EAAA,MACyB;QC6BvC;;;AAZR;AAMiB,UAWA,MAAA,CAXQ;EAWR,IAAA,EAAA,MAAM;EAKb,IAAA,EAAA,MAAA;;UAAA,YAAA,CAEI;EACN,OAAA,EAFG,OAEH;EACO,SAAA,CAAA,EAFD,WAEC;EAAoB,IAAA,EAD3B,IAC2B;EAG9B,WAAA,EAHU,oBAGC;;KAAX,WAAA,GAEI,CAAA,IAAA,EADD,YACC,EAAA,KAAA,EAAA,QAAA,EAAA,YAAA,EACO,IADP,EAAA,cAAA,EAES,MAFT,EAAA,GAAA,IAAA;AACO,UAIC,eAAA,CAJD;EACE;;AAGlB;AAcA;AAEA;EAMU,aAAA,CAAA,EAAA,OAAA;EAEE;;;EAGI,SAAA,CAAA,EAhBF,WAgBiB;;AAA6B,KAbhD,SAAA,GAAY,UAaoC,CAAA,OAblB,eAakB,CAAA;AAsB5C,UAjCC,gBAAA,SAAyB,gBAiC1B,CAAA;EAAe;;;;;EAyBoD,KAAA,CAAA,EApDzE,KAoDyE,GAAA,KAAA;EAAA,OAAA,CAAA,EAlDvE,OAkDuE;;iBA/CnE,eAAA,UAAyB,mBAAmB;;;;yCAsB5C,kBAAe,QAAA;2BAyBF,8BAA8B,2BAAwB,QAAA"}
package/dist/index.d.ts CHANGED
@@ -1,62 +1,36 @@
1
- import { G as GenerateOptions, a as GeneratedDoc, D as DocEntry, b as Generator, c as GenerateTypeTableOptions } from './base-Q18nCvFH.js';
2
- export { e as GeneratorOptions, R as RawTag, f as createGenerator, d as createProject, g as generateDocumentation } from './base-Q18nCvFH.js';
3
- import { GlobOptions } from 'tinyglobby';
4
- import { Nodes } from 'hast';
5
- import { Root } from 'mdast';
6
- import { Transformer } from 'unified';
7
- import 'ts-morph';
8
-
9
- interface Templates {
10
- block: (doc: GeneratedDoc, children: string) => string;
11
- property: (entry: DocEntry) => string;
12
- }
13
- interface GenerateMDXOptions extends GenerateOptions {
14
- /**
15
- * a root directory to resolve relative file paths
16
- */
17
- basePath?: string;
18
- templates?: Partial<Templates>;
19
- }
20
- declare function generateMDX(generator: Generator, source: string, { basePath, templates: overrides, ...rest }?: GenerateMDXOptions): string;
21
-
22
- interface GenerateFilesOptions {
23
- input: string | string[];
24
- /**
25
- * Output directory, or a function that returns the output path
26
- */
27
- output: string | ((inputPath: string) => string);
28
- globOptions?: GlobOptions;
29
- options?: GenerateMDXOptions;
30
- /**
31
- * @returns New content
32
- */
33
- transformOutput?: (path: string, content: string) => string;
34
- }
35
- declare function generateFiles(generator: Generator, options: GenerateFilesOptions): Promise<void>;
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";
36
5
 
6
+ //#region src/markdown.d.ts
37
7
  declare function renderTypeToHast(type: string): Promise<Nodes>;
38
8
  declare function renderMarkdownToHast(md: string): Promise<Nodes>;
39
-
9
+ //#endregion
10
+ //#region src/lib/remark-auto-type-table.d.ts
40
11
  interface RemarkAutoTypeTableOptions {
41
- /**
42
- * @defaultValue 'auto-type-table'
43
- */
44
- name?: string;
45
- /**
46
- * @defaultValue 'TypeTable'
47
- */
48
- outputName?: string;
49
- renderMarkdown?: typeof renderMarkdownToHast;
50
- renderType?: typeof renderTypeToHast;
51
- /**
52
- * Customise type table generation
53
- */
54
- options?: GenerateTypeTableOptions;
55
- /**
56
- * generate required `value` property for `remark-stringify`
57
- */
58
- remarkStringify?: boolean;
59
- generator?: Generator;
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
+ }
32
+ interface TypeTableProps extends BaseTypeTableProps {
33
+ cwd?: true;
60
34
  }
61
35
  /**
62
36
  * Compile `auto-type-table` into Fumadocs UI compatible TypeTable
@@ -64,5 +38,9 @@ interface RemarkAutoTypeTableOptions {
64
38
  * MDX is required to use this plugin.
65
39
  */
66
40
  declare function remarkAutoTypeTable(config?: RemarkAutoTypeTableOptions): Transformer<Root, Root>;
67
-
68
- export { DocEntry, type GenerateFilesOptions, type GenerateMDXOptions, GenerateOptions, GeneratedDoc, Generator, type RemarkAutoTypeTableOptions, generateFiles, generateMDX, remarkAutoTypeTable, renderMarkdownToHast };
41
+ //#endregion
42
+ //#region src/cache/fs-cache.d.ts
43
+ declare function createFileSystemGeneratorCache(dir: string): Cache;
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"}