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
- options: GenerateOptions;
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?: (this: EntryContext, entry: DocEntry, propertyType: ts.Type, propertySymbol: ts.Symbol) => void;
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, options: GenerateOptions): GeneratedDoc;
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, options) {
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
- options,
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, _c;
122
- const { checker, options } = context;
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
- (_c = options.transform) == null ? void 0 : _c.call(context, entry, subType, prop);
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-tTG4_ClF.js';
2
- export { b as GenerateDocumentationOptions, c as generate, g as generateDocumentation } from './base-tTG4_ClF.js';
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
@@ -6,7 +6,7 @@ import {
6
6
  generateDocumentation,
7
7
  getFileSymbol,
8
8
  getProgram
9
- } from "./chunk-HQHQFSUJ.js";
9
+ } from "./chunk-J5BKKGOH.js";
10
10
 
11
11
  // src/generate/mdx.ts
12
12
  import * as path from "path";
@@ -1,4 +1,4 @@
1
- import { G as GenerateOptions } from '../base-tTG4_ClF.js';
1
+ import { G as GenerateOptions } from '../base-EFDclhRL.js';
2
2
  import 'typescript';
3
3
 
4
4
  /**
package/dist/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  generateDocumentation
3
- } from "../chunk-HQHQFSUJ.js";
3
+ } from "../chunk-J5BKKGOH.js";
4
4
 
5
5
  // src/ui/auto-type-table.tsx
6
6
  import { TypeTable } from "fumadocs-ui/components/type-table";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-typescript",
3
- "version": "1.0.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.0",
50
+ "fumadocs-ui": "10.0.2",
51
51
  "tsconfig": "0.0.0"
52
52
  },
53
53
  "peerDependencies": {