@graphql-markdown/printer-legacy 1.13.1 → 1.15.0
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/const/options.d.ts +15 -2
- package/dist/const/options.d.ts.map +1 -1
- package/dist/const/options.js +20 -6
- package/dist/const/strings.d.ts +15 -0
- package/dist/const/strings.d.ts.map +1 -1
- package/dist/const/strings.js +9 -0
- package/dist/directive.d.ts +3 -3
- package/dist/directive.d.ts.map +1 -1
- package/dist/directive.js +8 -4
- package/dist/events.d.ts +77 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +85 -0
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +12 -7
- package/dist/format-helpers.d.ts +9 -0
- package/dist/format-helpers.d.ts.map +1 -1
- package/dist/format-helpers.js +10 -1
- package/dist/formatter.js +1 -1
- package/dist/graphql/directive.d.ts +3 -3
- package/dist/graphql/directive.d.ts.map +1 -1
- package/dist/graphql/directive.js +3 -3
- package/dist/graphql/enum.d.ts +3 -3
- package/dist/graphql/enum.d.ts.map +1 -1
- package/dist/graphql/enum.js +2 -2
- package/dist/graphql/input.d.ts +13 -0
- package/dist/graphql/input.d.ts.map +1 -1
- package/dist/graphql/input.js +8 -0
- package/dist/graphql/object.d.ts +3 -3
- package/dist/graphql/object.d.ts.map +1 -1
- package/dist/graphql/object.js +4 -4
- package/dist/graphql/operation.d.ts +6 -7
- package/dist/graphql/operation.d.ts.map +1 -1
- package/dist/graphql/operation.js +41 -8
- package/dist/graphql/scalar.d.ts +5 -5
- package/dist/graphql/scalar.d.ts.map +1 -1
- package/dist/graphql/scalar.js +7 -7
- package/dist/graphql/union.d.ts +3 -3
- package/dist/graphql/union.d.ts.map +1 -1
- package/dist/graphql/union.js +2 -2
- package/dist/group.d.ts.map +1 -1
- package/dist/group.js +7 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/link.d.ts +2 -2
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +54 -13
- package/dist/mdx/index.js +2 -2
- package/dist/printer.d.ts +67 -22
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +270 -117
- package/dist/section.d.ts +3 -3
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +34 -13
- package/package.json +19 -10
package/dist/printer.d.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
* @module printer
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
import type { CustomDirectiveMap, Formatter, GraphQLDirective, GraphQLSchema, IPrinter,
|
|
10
|
+
import type { CustomDirectiveMap, DeprecatedPrintTypeOptions, Formatter, GraphQLDirective, GraphQLSchema, IPrinter, Maybe, MDXString, MetaInfo, PageSection, PrinterConfigPrintTypeOptions, PrinterEventEmitter, PrintTypeOptions, SchemaEntitiesGroupMap, TypeDeprecatedOption } from "@graphql-markdown/types";
|
|
11
|
+
type InitPrintTypeOptions = DeprecatedPrintTypeOptions & Omit<PrinterConfigPrintTypeOptions, "exampleSection"> & {
|
|
12
|
+
exampleSection?: DeprecatedPrintTypeOptions["exampleSection"] | PrinterConfigPrintTypeOptions["exampleSection"];
|
|
13
|
+
};
|
|
11
14
|
/**
|
|
12
15
|
* The Printer class implements the core functionality for generating Markdown documentation
|
|
13
16
|
* from GraphQL schema types.
|
|
@@ -27,16 +30,6 @@ import type { CustomDirectiveMap, Formatter, GraphQLDirective, GraphQLSchema, IP
|
|
|
27
30
|
* ```
|
|
28
31
|
*/
|
|
29
32
|
export declare class Printer implements IPrinter {
|
|
30
|
-
/**
|
|
31
|
-
* Global printer configuration options
|
|
32
|
-
*/
|
|
33
|
-
static options: Readonly<Maybe<PrintTypeOptions>>;
|
|
34
|
-
/**
|
|
35
|
-
* Optional event emitter for print events.
|
|
36
|
-
* When set, the printer will emit events before/after printCode and printType,
|
|
37
|
-
* allowing external code to intercept and modify the output.
|
|
38
|
-
*/
|
|
39
|
-
static eventEmitter: Maybe<PrinterEventEmitter>;
|
|
40
33
|
/**
|
|
41
34
|
* Prints type descriptions
|
|
42
35
|
*/
|
|
@@ -44,15 +37,38 @@ export declare class Printer implements IPrinter {
|
|
|
44
37
|
/**
|
|
45
38
|
* Prints custom directives
|
|
46
39
|
*/
|
|
47
|
-
static readonly printCustomDirectives: (type: unknown, options: PrintTypeOptions) =>
|
|
40
|
+
static readonly printCustomDirectives: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection>;
|
|
48
41
|
/**
|
|
49
42
|
* Prints custom tags
|
|
50
43
|
*/
|
|
51
44
|
static readonly printCustomTags: (type: unknown, options: PrintTypeOptions) => string | MDXString;
|
|
45
|
+
private static _eventEmitter;
|
|
46
|
+
private static _options;
|
|
47
|
+
private static _deprecatedOptions;
|
|
48
|
+
private static _mdxDeclaration;
|
|
49
|
+
/**
|
|
50
|
+
* Global printer configuration options
|
|
51
|
+
*/
|
|
52
|
+
static get options(): Readonly<Maybe<PrintTypeOptions>>;
|
|
53
|
+
/**
|
|
54
|
+
* Backward-compat section toggles extracted from legacy config options.
|
|
55
|
+
*
|
|
56
|
+
* These flags are applied only during section order composition.
|
|
57
|
+
*/
|
|
58
|
+
static get deprecatedOptions(): Readonly<Maybe<DeprecatedPrintTypeOptions>>;
|
|
59
|
+
/**
|
|
60
|
+
* Optional event emitter for print events.
|
|
61
|
+
* When set, the printer will emit events before/after printCode and printType,
|
|
62
|
+
* allowing external code to intercept and modify the output.
|
|
63
|
+
*/
|
|
64
|
+
static get eventEmitter(): Maybe<PrinterEventEmitter>;
|
|
52
65
|
/**
|
|
53
66
|
* Prints mdx modules import declaration
|
|
54
67
|
*/
|
|
55
|
-
static mdxDeclaration: Readonly<Maybe<string>>;
|
|
68
|
+
static get mdxDeclaration(): Readonly<Maybe<string>>;
|
|
69
|
+
static set options(options: Readonly<Maybe<PrintTypeOptions>>);
|
|
70
|
+
static set eventEmitter(eventEmitter: Maybe<PrinterEventEmitter>);
|
|
71
|
+
static set mdxDeclaration(mdxDeclaration: Readonly<Maybe<string>>);
|
|
56
72
|
/**
|
|
57
73
|
* Initializes the printer with the given schema and configuration.
|
|
58
74
|
*
|
|
@@ -64,15 +80,16 @@ export declare class Printer implements IPrinter {
|
|
|
64
80
|
* @param mdxDeclaration - Optional MDX import declaration
|
|
65
81
|
* @param eventEmitter - Optional event emitter for print events interception
|
|
66
82
|
*/
|
|
67
|
-
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives }?: {
|
|
83
|
+
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, sectionHeaderId }?: {
|
|
68
84
|
customDirectives?: CustomDirectiveMap;
|
|
69
85
|
deprecated?: TypeDeprecatedOption;
|
|
70
86
|
groups?: SchemaEntitiesGroupMap;
|
|
71
87
|
meta?: Maybe<MetaInfo>;
|
|
72
88
|
metatags?: Record<string, string>[];
|
|
73
89
|
onlyDocDirectives?: GraphQLDirective[];
|
|
74
|
-
printTypeOptions?:
|
|
90
|
+
printTypeOptions?: InitPrintTypeOptions;
|
|
75
91
|
skipDocDirectives?: GraphQLDirective[];
|
|
92
|
+
sectionHeaderId?: boolean;
|
|
76
93
|
}, formatter?: Partial<Formatter>, mdxDeclaration?: Maybe<string>, eventEmitter?: Maybe<PrinterEventEmitter>): Promise<void>;
|
|
77
94
|
/**
|
|
78
95
|
* Prints the header section of a type documentation
|
|
@@ -115,18 +132,17 @@ export declare class Printer implements IPrinter {
|
|
|
115
132
|
*
|
|
116
133
|
* @param type - GraphQL type to generate example for
|
|
117
134
|
* @param options - Printer configuration options
|
|
118
|
-
* @returns
|
|
135
|
+
* @returns Example page section or undefined when no example is available
|
|
119
136
|
*/
|
|
120
|
-
static readonly printExample: (type: unknown, options: PrintTypeOptions) =>
|
|
137
|
+
static readonly printExample: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection>;
|
|
121
138
|
/**
|
|
122
139
|
* Prints metadata information for a GraphQL type
|
|
123
140
|
*
|
|
124
141
|
* @param type - GraphQL type to print metadata for
|
|
125
142
|
* @param options - Printer configuration options
|
|
126
|
-
* @returns
|
|
127
|
-
* @throws When type is not supported
|
|
143
|
+
* @returns Metadata section (or section list) for supported types, otherwise undefined
|
|
128
144
|
*/
|
|
129
|
-
static readonly printTypeMetadata: (type: unknown, options: PrintTypeOptions) =>
|
|
145
|
+
static readonly printTypeMetadata: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection[] | PageSection>;
|
|
130
146
|
/**
|
|
131
147
|
* Prints related type information
|
|
132
148
|
*
|
|
@@ -154,8 +170,7 @@ export declare class Printer implements IPrinter {
|
|
|
154
170
|
* @example
|
|
155
171
|
* ```typescript
|
|
156
172
|
* const doc = await Printer.printType('User', UserType, {
|
|
157
|
-
* frontMatter: true
|
|
158
|
-
* codeSection: true
|
|
173
|
+
* frontMatter: true
|
|
159
174
|
* });
|
|
160
175
|
* ```
|
|
161
176
|
*
|
|
@@ -172,8 +187,38 @@ export declare class Printer implements IPrinter {
|
|
|
172
187
|
*
|
|
173
188
|
* When an event emitter is configured, emits events:
|
|
174
189
|
* - `print:beforePrintType` - Before generating documentation
|
|
190
|
+
* - `print:beforeComposePageType` - Before composing section order and final page output
|
|
175
191
|
* - `print:afterPrintType` - After generating documentation (output can be modified)
|
|
176
192
|
*/
|
|
177
193
|
static readonly printType: (name: Maybe<string>, type: unknown, options?: Maybe<Partial<PrintTypeOptions>>) => Promise<Maybe<MDXString>>;
|
|
194
|
+
/**
|
|
195
|
+
* Renders a page section, optionally prefixing a heading when a title is present.
|
|
196
|
+
*/
|
|
197
|
+
private static readonly renderPageSection;
|
|
198
|
+
/**
|
|
199
|
+
* Returns the default content section order for type pages.
|
|
200
|
+
*
|
|
201
|
+
* Applies backward-compatibility toggles from deprecated section flags.
|
|
202
|
+
*/
|
|
203
|
+
private static readonly getDeprecatedTypePageSectionOrder;
|
|
204
|
+
/**
|
|
205
|
+
* Runtime guard for built-in page content section keys.
|
|
206
|
+
*/
|
|
207
|
+
private static readonly isTypePageContentSection;
|
|
208
|
+
/**
|
|
209
|
+
* Runtime guard for header-only page section keys.
|
|
210
|
+
*/
|
|
211
|
+
private static readonly isTypePageHeaderSection;
|
|
212
|
+
/**
|
|
213
|
+
* Normalizes event-driven section order, allowing built-in section keys and
|
|
214
|
+
* any custom keys that were added to the sections map by an event handler.
|
|
215
|
+
* Keys that are neither built-in nor present in the sections map are dropped.
|
|
216
|
+
*/
|
|
217
|
+
private static readonly sanitizeTypePageSectionOrder;
|
|
218
|
+
/**
|
|
219
|
+
* Normalizes mixed section value shapes to the internal PageSection format.
|
|
220
|
+
*/
|
|
221
|
+
private static readonly normalizePageSection;
|
|
178
222
|
}
|
|
223
|
+
export {};
|
|
179
224
|
//# sourceMappingURL=printer.d.ts.map
|
package/dist/printer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAEhB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,SAAS,EACT,gBAAgB,EAEhB,aAAa,EACb,QAAQ,EACR,KAAK,EACL,SAAS,EACT,QAAQ,EAER,WAAW,EAEX,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAsGjC,KAAK,oBAAoB,GAAG,0BAA0B,GACpD,IAAI,CAAC,6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