fumadocs-typescript 1.0.0 → 1.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.
|
@@ -21,15 +21,22 @@ interface DocEntry {
|
|
|
21
21
|
interface EntryContext {
|
|
22
22
|
program: ts.Program;
|
|
23
23
|
checker: ts.TypeChecker;
|
|
24
|
-
|
|
24
|
+
transform?: Transformer;
|
|
25
25
|
type: ts.Type;
|
|
26
26
|
symbol: ts.Symbol;
|
|
27
27
|
}
|
|
28
|
+
type Transformer = (this: EntryContext, entry: DocEntry, propertyType: ts.Type, propertySymbol: ts.Symbol) => void;
|
|
28
29
|
interface GenerateOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Allow fields with `@internal` tag
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue false
|
|
34
|
+
*/
|
|
35
|
+
allowInternal?: boolean;
|
|
29
36
|
/**
|
|
30
37
|
* Modify output property entry
|
|
31
38
|
*/
|
|
32
|
-
transform?:
|
|
39
|
+
transform?: Transformer;
|
|
33
40
|
}
|
|
34
41
|
interface GenerateDocumentationOptions extends GenerateOptions {
|
|
35
42
|
/**
|
|
@@ -41,6 +48,6 @@ interface GenerateDocumentationOptions extends GenerateOptions {
|
|
|
41
48
|
* Generate documentation for properties in an exported type/interface
|
|
42
49
|
*/
|
|
43
50
|
declare function generateDocumentation(file: string, name: string, options?: GenerateDocumentationOptions): GeneratedDoc | undefined;
|
|
44
|
-
declare function generate(program: ts.Program, symbol: ts.Symbol,
|
|
51
|
+
declare function generate(program: ts.Program, symbol: ts.Symbol, { allowInternal, transform }: GenerateOptions): GeneratedDoc;
|
|
45
52
|
|
|
46
53
|
export { type DocEntry as D, type GenerateOptions as G, type TypescriptConfig as T, type GeneratedDoc as a, type GenerateDocumentationOptions as b, generate as c, generateDocumentation as g };
|
|
@@ -99,12 +99,12 @@ function generateDocumentation(file, name, options = {}) {
|
|
|
99
99
|
return;
|
|
100
100
|
return generate(program, symbol, options);
|
|
101
101
|
}
|
|
102
|
-
function generate(program, symbol,
|
|
102
|
+
function generate(program, symbol, { allowInternal = false, transform }) {
|
|
103
103
|
const checker = program.getTypeChecker();
|
|
104
104
|
const type = checker.getDeclaredTypeOfSymbol(symbol);
|
|
105
105
|
const entryContext = {
|
|
106
106
|
checker,
|
|
107
|
-
|
|
107
|
+
transform,
|
|
108
108
|
program,
|
|
109
109
|
type,
|
|
110
110
|
symbol
|
|
@@ -114,12 +114,12 @@ function generate(program, symbol, options) {
|
|
|
114
114
|
description: ts2.displayPartsToString(
|
|
115
115
|
symbol.getDocumentationComment(checker)
|
|
116
116
|
),
|
|
117
|
-
entries: type.getProperties().map((prop) => getDocEntry(prop, entryContext))
|
|
117
|
+
entries: type.getProperties().map((prop) => getDocEntry(prop, entryContext)).filter((entry) => allowInternal || !("internal" in entry.tags))
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
function getDocEntry(prop, context) {
|
|
121
|
-
var _a, _b
|
|
122
|
-
const { checker,
|
|
121
|
+
var _a, _b;
|
|
122
|
+
const { checker, transform } = context;
|
|
123
123
|
const subType = checker.getTypeOfSymbol(prop);
|
|
124
124
|
const tags = Object.fromEntries(
|
|
125
125
|
prop.getJsDocTags().map((tag) => [tag.name, ts2.displayPartsToString(tag.text)])
|
|
@@ -141,7 +141,7 @@ function getDocEntry(prop, context) {
|
|
|
141
141
|
tags,
|
|
142
142
|
type: typeName
|
|
143
143
|
};
|
|
144
|
-
|
|
144
|
+
transform == null ? void 0 : transform.call(context, entry, subType, prop);
|
|
145
145
|
return entry;
|
|
146
146
|
}
|
|
147
147
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GenerateOptions, T as TypescriptConfig, a as GeneratedDoc, D as DocEntry } from './base-
|
|
2
|
-
export { b as GenerateDocumentationOptions, c as generate, g as generateDocumentation } from './base-
|
|
1
|
+
import { G as GenerateOptions, T as TypescriptConfig, a as GeneratedDoc, D as DocEntry } from './base-EFDclhRL.js';
|
|
2
|
+
export { b as GenerateDocumentationOptions, c as generate, g as generateDocumentation } from './base-EFDclhRL.js';
|
|
3
3
|
import fg from 'fast-glob';
|
|
4
4
|
import 'typescript';
|
|
5
5
|
|
package/dist/index.js
CHANGED
package/dist/ui/index.d.ts
CHANGED
package/dist/ui/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-typescript",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Typescript Integration for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/react": "18.2.0",
|
|
48
48
|
"@types/react-dom": "18.2.1",
|
|
49
49
|
"eslint-config-custom": "0.0.0",
|
|
50
|
-
"fumadocs-ui": "10.0.
|
|
50
|
+
"fumadocs-ui": "10.0.2",
|
|
51
51
|
"tsconfig": "0.0.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|