@graphql-markdown/printer-legacy 1.17.0 → 1.19.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/README.md +37 -0
- package/dist/common.d.ts +0 -8
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +10 -31
- package/dist/const/options.d.ts +3 -1
- package/dist/const/options.d.ts.map +1 -1
- package/dist/const/options.js +2 -1
- package/dist/decorator.d.ts +174 -0
- package/dist/decorator.d.ts.map +1 -0
- package/dist/decorator.js +494 -0
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/frontmatter.js +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +42 -10
- package/dist/printer.d.ts +15 -9
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +32 -25
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +27 -5
- package/package.json +1 -1
- package/dist/directive.d.ts +0 -44
- package/dist/directive.d.ts.map +0 -1
- package/dist/directive.js +0 -110
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Module providing predicate-driven decorators for type pages.
|
|
4
|
+
*
|
|
5
|
+
* A decorator (declared in the top-level `decorators` option) is selected by a
|
|
6
|
+
* predicate over the node being printed — by default, every node — and
|
|
7
|
+
* renders its resolved values through a user callback. There is no built-in
|
|
8
|
+
* notion of "this decorator's own directive": a directive-driven decorator
|
|
9
|
+
* selects its nodes with `predicate: hasDirectiveNamed("name")` and reads
|
|
10
|
+
* that directive's argument values, if any, from `resolve` via
|
|
11
|
+
* `@graphql-markdown/graphql`'s `getDirectiveFromSchema` combined with
|
|
12
|
+
* `getTypeDirectiveValues`/`getTypeDirectiveValuesList` — the same public
|
|
13
|
+
* helpers this module uses internally. A decorator with a title becomes a top-level
|
|
14
|
+
* section of the type page; one without renders bare content, placed relative
|
|
15
|
+
* to the built-in sections, or into a named slot such as the heading's
|
|
16
|
+
* metadata line or a member's description.
|
|
17
|
+
*
|
|
18
|
+
* `customDirective` is the deprecated predecessor of this module. It never
|
|
19
|
+
* reaches this module, or any other part of the printer: `@graphql-markdown/core`
|
|
20
|
+
* converts its schema-resolved directive map into decorator declarations
|
|
21
|
+
* (see {@link buildCustomDirectiveDecorators}) once, before the printer is
|
|
22
|
+
* ever invoked, so both options flow through the exact same resolve/render
|
|
23
|
+
* pipeline below — there is one code path for "select nodes by directive,
|
|
24
|
+
* render descriptor text, a badge, or a section", not two.
|
|
25
|
+
*
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.getDecoratorsOrder = exports.printSlotDecorators = exports.printDecorators = exports.printDecorator = exports.getExampleSectionDefinition = exports.buildCustomDirectiveDecorators = exports.RESERVED_SECTION_NAMES = exports.getSchemaEntity = void 0;
|
|
30
|
+
const graphql_1 = require("@graphql-markdown/graphql");
|
|
31
|
+
Object.defineProperty(exports, "getSchemaEntity", { enumerable: true, get: function () { return graphql_1.getSchemaEntity; } });
|
|
32
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
33
|
+
const badge_1 = require("./badge");
|
|
34
|
+
const example_1 = require("./example");
|
|
35
|
+
const link_1 = require("./link");
|
|
36
|
+
const strings_1 = require("./const/strings");
|
|
37
|
+
const options_1 = require("./const/options");
|
|
38
|
+
/**
|
|
39
|
+
* Section/decorator keys owned by the printer, which a decorator cannot claim.
|
|
40
|
+
*
|
|
41
|
+
* Re-exported from the package root: `@graphql-markdown/core`'s
|
|
42
|
+
* `getDecoratorsOption` validates against this same list (plus `"__proto__"`,
|
|
43
|
+
* reserved only there — see that package's own copy of this comment) so the
|
|
44
|
+
* two entry points, config-file validation and building a decorators map
|
|
45
|
+
* directly against the printer API, can't silently drift apart on which
|
|
46
|
+
* names are reserved.
|
|
47
|
+
*/
|
|
48
|
+
exports.RESERVED_SECTION_NAMES = [
|
|
49
|
+
"header",
|
|
50
|
+
"metatags",
|
|
51
|
+
"mdxDeclaration",
|
|
52
|
+
"tags",
|
|
53
|
+
"description",
|
|
54
|
+
"code",
|
|
55
|
+
"customDirectives",
|
|
56
|
+
"customDirective:description",
|
|
57
|
+
"customDirective:tags",
|
|
58
|
+
"metadata",
|
|
59
|
+
"example",
|
|
60
|
+
"relations",
|
|
61
|
+
];
|
|
62
|
+
/**
|
|
63
|
+
* Ids {@link buildCustomDirectiveDecorators} assigns to its three adapter
|
|
64
|
+
* decorators. Reserved above so a user's own `decorators` config can't claim
|
|
65
|
+
* them, but exempted from `getDeclaredDecorators`'s reserved-id filter so
|
|
66
|
+
* `@graphql-markdown/core` can merge the converter's own output for these
|
|
67
|
+
* ids directly into `options.decorators`.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
const CUSTOM_DIRECTIVE_DECORATOR_IDS = [
|
|
72
|
+
"customDirectives",
|
|
73
|
+
"customDirective:description",
|
|
74
|
+
"customDirective:tags",
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* Resolves a custom directive handler's return value.
|
|
78
|
+
*
|
|
79
|
+
* Internal to {@link buildCustomDirectiveDecorators}'s render closures; not
|
|
80
|
+
* itself user-facing — see `ConfigOptions.customDirective` for the setting.
|
|
81
|
+
*
|
|
82
|
+
* @param resolver - The resolver function name to execute
|
|
83
|
+
* @param type - The GraphQL type to resolve the directive for
|
|
84
|
+
* @param constDirectiveOption - The directive configuration options
|
|
85
|
+
* @param fallback - Optional fallback value if resolution fails
|
|
86
|
+
* @returns The resolved directive value or `fallback`/`undefined`
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
const getCustomDirectiveResolver = (resolver, type, constDirectiveOption, fallback) => {
|
|
91
|
+
if (typeof constDirectiveOption.type !== "object" ||
|
|
92
|
+
typeof constDirectiveOption[resolver] !== "function") {
|
|
93
|
+
return fallback;
|
|
94
|
+
}
|
|
95
|
+
return constDirectiveOption[resolver](constDirectiveOption.type, type);
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Prints a single custom directive entry as a Markdown string, for the
|
|
99
|
+
* built-in "Directives" section.
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
const printCustomDirective = (type, constDirectiveOption, options) => {
|
|
104
|
+
const typeNameLink = (0, link_1.printLink)(constDirectiveOption.type, {
|
|
105
|
+
...options,
|
|
106
|
+
withAttributes: false,
|
|
107
|
+
});
|
|
108
|
+
const description = getCustomDirectiveResolver("descriptor", type, constDirectiveOption);
|
|
109
|
+
if (typeof description !== "string") {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
return `${options_1.SectionLevels.LEVEL.repeat(4)} ${typeNameLink}${strings_1.MARKDOWN_EOL} ${description}${strings_1.MARKDOWN_EOL} `;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Converts the deprecated `customDirective` option's schema-resolved
|
|
116
|
+
* directive map into decorator declarations, so it flows through the exact
|
|
117
|
+
* same resolve/render pipeline as everything declared under `decorators`.
|
|
118
|
+
*
|
|
119
|
+
* Called once by `@graphql-markdown/core`, right after `customDirectives` is
|
|
120
|
+
* schema-resolved, and merged directly into the top-level `decorators`
|
|
121
|
+
* option before it reaches the printer — `customDirective`/`CustomDirectiveMap`
|
|
122
|
+
* never reach this printer package otherwise; only the three decorators
|
|
123
|
+
* built here do, indistinguishable from any other `decorators` entry except
|
|
124
|
+
* for their reserved ids (see {@link CUSTOM_DIRECTIVE_DECORATOR_IDS}).
|
|
125
|
+
*
|
|
126
|
+
* Returns three entries:
|
|
127
|
+
* - `customDirectives`: the built-in "Directives" section, listing every
|
|
128
|
+
* custom directive declared on a type, positioned right after `code`
|
|
129
|
+
* (its fixed position in the pre-decorators built-in section order).
|
|
130
|
+
* - `customDirective:description`: `customDirective`'s `descriptor`
|
|
131
|
+
* handlers, appended as description text (`position: { into: "description" }`).
|
|
132
|
+
* - `customDirective:tags`: `customDirective`'s `tag` handlers, rendered as
|
|
133
|
+
* badges in the metadata line (`position: { into: "tags" }`).
|
|
134
|
+
*
|
|
135
|
+
* All three share one `resolve`, reading every custom directive matched on
|
|
136
|
+
* a node, in schema declaration order. Matching (including wildcard `"*"`
|
|
137
|
+
* precedence — a named handler wins over `"*"`) is already resolved by
|
|
138
|
+
* `getConstDirectiveMap` (fed by `@graphql-markdown/graphql`'s
|
|
139
|
+
* `getCustomDirectives`, which expands a wildcard into concrete
|
|
140
|
+
* per-directive entries upstream), so this reuses that resolution rather
|
|
141
|
+
* than re-implementing it against the generic predicate system.
|
|
142
|
+
*
|
|
143
|
+
* @param customDirectives - the schema-resolved `customDirective` map, or
|
|
144
|
+
* `undefined`/empty when the option is not in use.
|
|
145
|
+
*
|
|
146
|
+
* @returns the three decorators, or `{}` when `customDirectives` is empty.
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
const buildCustomDirectiveDecorators = (customDirectives) => {
|
|
150
|
+
if (typeof customDirectives !== "object" ||
|
|
151
|
+
customDirectives === null ||
|
|
152
|
+
Object.keys(customDirectives).length === 0) {
|
|
153
|
+
return {};
|
|
154
|
+
}
|
|
155
|
+
const resolve = (type) => {
|
|
156
|
+
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, customDirectives);
|
|
157
|
+
return constDirectiveMap
|
|
158
|
+
? Object.values(constDirectiveMap)
|
|
159
|
+
: [];
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
customDirectives: {
|
|
163
|
+
title: "Directives",
|
|
164
|
+
predicate: (0, graphql_1.always)(),
|
|
165
|
+
resolve,
|
|
166
|
+
position: { after: "code" },
|
|
167
|
+
render: (values, options, context) => {
|
|
168
|
+
const directives = values
|
|
169
|
+
.map((item) => {
|
|
170
|
+
return printCustomDirective(context.type, item, options);
|
|
171
|
+
})
|
|
172
|
+
.filter((value) => {
|
|
173
|
+
return value !== undefined;
|
|
174
|
+
});
|
|
175
|
+
return directives.length > 0
|
|
176
|
+
? directives.join(strings_1.MARKDOWN_EOP)
|
|
177
|
+
: undefined;
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
"customDirective:description": {
|
|
181
|
+
predicate: (0, graphql_1.always)(),
|
|
182
|
+
resolve,
|
|
183
|
+
position: { into: "description" },
|
|
184
|
+
render: (values, _options, context) => {
|
|
185
|
+
const parts = values
|
|
186
|
+
.map((item) => {
|
|
187
|
+
return getCustomDirectiveResolver("descriptor", context.type, item, "");
|
|
188
|
+
})
|
|
189
|
+
.filter((text) => {
|
|
190
|
+
return typeof text === "string" && text.length > 0;
|
|
191
|
+
})
|
|
192
|
+
.map((text) => {
|
|
193
|
+
return (0, utils_1.escapeMDX)(text);
|
|
194
|
+
});
|
|
195
|
+
return parts.length > 0 ? parts.join(strings_1.MARKDOWN_EOP) : undefined;
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
"customDirective:tags": {
|
|
199
|
+
predicate: (0, graphql_1.always)(),
|
|
200
|
+
resolve,
|
|
201
|
+
position: { into: "tags" },
|
|
202
|
+
render: (values, options, context) => {
|
|
203
|
+
const badges = values
|
|
204
|
+
.map((item) => {
|
|
205
|
+
return getCustomDirectiveResolver("tag", context.type, item);
|
|
206
|
+
})
|
|
207
|
+
.filter((value) => {
|
|
208
|
+
return value !== undefined;
|
|
209
|
+
});
|
|
210
|
+
return badges.length > 0
|
|
211
|
+
? (0, badge_1.formatBadges)(badges, options)
|
|
212
|
+
: undefined;
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
exports.buildCustomDirectiveDecorators = buildCustomDirectiveDecorators;
|
|
218
|
+
/**
|
|
219
|
+
* Builds the example section as a decorator definition.
|
|
220
|
+
*
|
|
221
|
+
* The example section is a specialized decorator: it is driven by a schema
|
|
222
|
+
* directive, named by [`printTypeOptions.exampleSection`](https://graphql-markdown.dev/docs/settings#printtypeoptions),
|
|
223
|
+
* and rendered as a code block.
|
|
224
|
+
*
|
|
225
|
+
* It resolves its own value rather than gating on a directive by name,
|
|
226
|
+
* because an example is also derived from the fields of a type carrying no
|
|
227
|
+
* example directive itself — the directive lookup (which schema directive
|
|
228
|
+
* name to use, from `printTypeOptions.exampleSection`) belongs to
|
|
229
|
+
* {@link printExample} alone.
|
|
230
|
+
*
|
|
231
|
+
* @param options - the print options in effect.
|
|
232
|
+
*
|
|
233
|
+
* @returns the example decorator definition.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* const section = getExampleSectionDefinition(options);
|
|
238
|
+
* const example = printDecorator(type, section, options);
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
*/
|
|
242
|
+
const getExampleSectionDefinition = () => {
|
|
243
|
+
return {
|
|
244
|
+
id: "example",
|
|
245
|
+
title: "Example",
|
|
246
|
+
resolve: (type, printOptions) => {
|
|
247
|
+
const example = (0, example_1.printExample)(type, printOptions);
|
|
248
|
+
return example ? [{ example }] : [];
|
|
249
|
+
},
|
|
250
|
+
render: (values) => {
|
|
251
|
+
return `${strings_1.MARKDOWN_SOC}${values[0].example}${strings_1.MARKDOWN_EOC}`;
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
exports.getExampleSectionDefinition = getExampleSectionDefinition;
|
|
256
|
+
/**
|
|
257
|
+
* Resolves the values a decorator renders, applying the marker-decorator
|
|
258
|
+
* substitution rule.
|
|
259
|
+
*
|
|
260
|
+
* `undefined` means "skip this decorator": either its resolver returned a
|
|
261
|
+
* non-array, or it resolved no values with nothing asking for the
|
|
262
|
+
* marker-decorator substitution below. A decorator with an explicit
|
|
263
|
+
* `predicate` and no `resolve` renders once, with an empty record, whenever
|
|
264
|
+
* its predicate matches — a pure marker decorator, useful for a directive
|
|
265
|
+
* whose mere presence is the content (see the module doc for how to also
|
|
266
|
+
* gate on, and read, a specific directive). A `resolve` returning `[]` is
|
|
267
|
+
* never ambiguous with that case — it means "nothing to render this time"
|
|
268
|
+
* — so it is not substituted; nor is the no-`predicate`-no-`resolve` case,
|
|
269
|
+
* which is a no-op by construction (`predicate` defaults to matching every
|
|
270
|
+
* node, `resolve` to producing nothing).
|
|
271
|
+
*
|
|
272
|
+
* @internal
|
|
273
|
+
*/
|
|
274
|
+
const resolveDecoratorValues = (type, decorator, options) => {
|
|
275
|
+
const resolved = decorator.resolve ? decorator.resolve(type, options) : [];
|
|
276
|
+
if (!Array.isArray(resolved)) {
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
if (resolved.length === 0) {
|
|
280
|
+
return !decorator.predicate || decorator.resolve ? undefined : [{}];
|
|
281
|
+
}
|
|
282
|
+
return resolved;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* Resolves and renders a single decorator's raw content for a type.
|
|
286
|
+
*
|
|
287
|
+
* The decorator is skipped, returning `undefined`, when its predicate does
|
|
288
|
+
* not match, no value is resolved for it, or the render callback returns no
|
|
289
|
+
* content. Shared by {@link printDecorator}
|
|
290
|
+
* (which wraps this into a titled page section) and {@link printSlotDecorators}
|
|
291
|
+
* (which collects this raw content for a named slot, such as the metadata line).
|
|
292
|
+
*
|
|
293
|
+
* @internal
|
|
294
|
+
*
|
|
295
|
+
* @param type - the GraphQL type being printed.
|
|
296
|
+
* @param decorator - the resolved decorator declaration.
|
|
297
|
+
* @param options - the print options in effect.
|
|
298
|
+
*
|
|
299
|
+
* @returns the decorator's rendered content, or `undefined` when nothing to print.
|
|
300
|
+
*
|
|
301
|
+
*/
|
|
302
|
+
const renderDecoratorContent = (type, decorator, options) => {
|
|
303
|
+
if (typeof decorator.render !== "function") {
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
const predicate = decorator.predicate ?? (0, graphql_1.always)();
|
|
307
|
+
if (!predicate(type, options)) {
|
|
308
|
+
return undefined;
|
|
309
|
+
}
|
|
310
|
+
const values = resolveDecoratorValues(type, decorator, options);
|
|
311
|
+
if (values === undefined || values === null) {
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
const context = {
|
|
315
|
+
id: decorator.id,
|
|
316
|
+
type,
|
|
317
|
+
entity: (0, graphql_1.getSchemaEntity)(type, options),
|
|
318
|
+
};
|
|
319
|
+
const content = decorator.render(values, options, context);
|
|
320
|
+
if (typeof content !== "string" || content.trim().length === 0) {
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
return content;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Prints a single decorator for a type, as a titled page section.
|
|
327
|
+
*
|
|
328
|
+
* Reserved ids are filtered by `getDeclaredDecorators`, not here: the built-in
|
|
329
|
+
* sections are themselves declared with a reserved id.
|
|
330
|
+
*
|
|
331
|
+
* @param type - the GraphQL type being printed.
|
|
332
|
+
* @param decorator - the resolved decorator declaration.
|
|
333
|
+
* @param options - the print options in effect.
|
|
334
|
+
*
|
|
335
|
+
* @returns the rendered page section, or `undefined` when nothing to print.
|
|
336
|
+
*
|
|
337
|
+
*/
|
|
338
|
+
const printDecorator = (type, decorator, options) => {
|
|
339
|
+
const content = renderDecoratorContent(type, decorator, options);
|
|
340
|
+
if (content === undefined) {
|
|
341
|
+
return undefined;
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
title: decorator.title ?? undefined,
|
|
345
|
+
// The render callback owns its Markdown: trimming here would alter content
|
|
346
|
+
// whose leading whitespace is significant, such as an indented code block.
|
|
347
|
+
content: `${content}${strings_1.MARKDOWN_EOP}`,
|
|
348
|
+
level: decorator.level ?? 3,
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
exports.printDecorator = printDecorator;
|
|
352
|
+
/**
|
|
353
|
+
* Returns the decorators to build, in declaration order, from the top-level
|
|
354
|
+
* `decorators` option. `@graphql-markdown/core` merges `customDirective`'s
|
|
355
|
+
* adapter decorators (see {@link buildCustomDirectiveDecorators}) into this
|
|
356
|
+
* same option before it reaches the printer, so this reads a single source,
|
|
357
|
+
* with no separate customDirective-specific path.
|
|
358
|
+
*
|
|
359
|
+
* Every entry is filtered against reserved ids, except the adapter's own —
|
|
360
|
+
* see {@link CUSTOM_DIRECTIVE_DECORATOR_IDS} — since those are assigned by
|
|
361
|
+
* the converter, not user config, and are reserved specifically to keep user
|
|
362
|
+
* config from claiming them. A user-declared decorator claiming any other
|
|
363
|
+
* reserved id is still dropped: the printer is reachable directly through
|
|
364
|
+
* its public API, bypassing configuration validation, and such a decorator
|
|
365
|
+
* would otherwise overwrite a built-in section.
|
|
366
|
+
*
|
|
367
|
+
* @internal
|
|
368
|
+
*
|
|
369
|
+
* @param options - the print options in effect.
|
|
370
|
+
*
|
|
371
|
+
* @returns the decorators to build.
|
|
372
|
+
*
|
|
373
|
+
*/
|
|
374
|
+
const getDeclaredDecorators = (options) => {
|
|
375
|
+
const decorators = typeof options.decorators === "object" && options.decorators !== null
|
|
376
|
+
? options.decorators
|
|
377
|
+
: undefined;
|
|
378
|
+
return decorators
|
|
379
|
+
? Object.entries(decorators)
|
|
380
|
+
.filter(([id]) => {
|
|
381
|
+
return (!exports.RESERVED_SECTION_NAMES.includes(id) ||
|
|
382
|
+
CUSTOM_DIRECTIVE_DECORATOR_IDS.includes(id));
|
|
383
|
+
})
|
|
384
|
+
.map(([id, decorator]) => {
|
|
385
|
+
return { ...decorator, id };
|
|
386
|
+
})
|
|
387
|
+
: [];
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Checks whether a decorator targets a named slot (`position: { into }`)
|
|
391
|
+
* rather than the page's section order.
|
|
392
|
+
*
|
|
393
|
+
* @internal
|
|
394
|
+
*/
|
|
395
|
+
const targetsSlot = (decorator) => {
|
|
396
|
+
const position = decorator.position;
|
|
397
|
+
return !!position && typeof position === "object" && "into" in position;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Prints every decorator declared in the print options, excluding those
|
|
401
|
+
* targeting a named slot (`position: { into }`) — those are not part of the
|
|
402
|
+
* page's section order and are printed separately, into their slot.
|
|
403
|
+
*
|
|
404
|
+
* Every declared decorator yields an entry, so that composition hooks can
|
|
405
|
+
* restore one which rendered no content. Decorators with a reserved or
|
|
406
|
+
* repeated id are dropped.
|
|
407
|
+
*
|
|
408
|
+
* @param type - the GraphQL type being printed.
|
|
409
|
+
* @param options - the print options in effect.
|
|
410
|
+
*
|
|
411
|
+
* @returns a map of decorator id to rendered section, empty when none is declared.
|
|
412
|
+
*
|
|
413
|
+
*/
|
|
414
|
+
const printDecorators = (type, options) => {
|
|
415
|
+
// Null-prototype map: a decorator named `__proto__` would otherwise reach the
|
|
416
|
+
// prototype setter of an object literal and never become an own property.
|
|
417
|
+
// An object literal cannot declare that key, but the printer is also reachable
|
|
418
|
+
// directly, with a declaration built any other way.
|
|
419
|
+
const sections = Object.create(null);
|
|
420
|
+
getDeclaredDecorators(options)
|
|
421
|
+
.filter((decorator) => {
|
|
422
|
+
return !targetsSlot(decorator);
|
|
423
|
+
})
|
|
424
|
+
.forEach((decorator) => {
|
|
425
|
+
sections[decorator.id] = (0, exports.printDecorator)(type, decorator, options);
|
|
426
|
+
});
|
|
427
|
+
return sections;
|
|
428
|
+
};
|
|
429
|
+
exports.printDecorators = printDecorators;
|
|
430
|
+
/**
|
|
431
|
+
* Prints every decorator declared for a named slot (`position: { into: slot }`),
|
|
432
|
+
* as raw content rather than a page section — used to splice decorator output
|
|
433
|
+
* into a slot outside the page's section order, such as the metadata line of a
|
|
434
|
+
* type or field heading, or a member's description.
|
|
435
|
+
*
|
|
436
|
+
* @param slot - the slot name (matches a decorator's `position.into`).
|
|
437
|
+
* @param type - the GraphQL type being printed.
|
|
438
|
+
* @param options - the print options in effect.
|
|
439
|
+
*
|
|
440
|
+
* @returns the rendered content for every decorator targeting `slot`, in
|
|
441
|
+
* declaration order; empty when none target it or render no content.
|
|
442
|
+
*
|
|
443
|
+
*/
|
|
444
|
+
const printSlotDecorators = (slot, type, options) => {
|
|
445
|
+
return getDeclaredDecorators(options)
|
|
446
|
+
.filter((decorator) => {
|
|
447
|
+
return (targetsSlot(decorator) &&
|
|
448
|
+
decorator.position.into === slot);
|
|
449
|
+
})
|
|
450
|
+
.map((decorator) => {
|
|
451
|
+
return renderDecoratorContent(type, decorator, options);
|
|
452
|
+
})
|
|
453
|
+
.filter((content) => {
|
|
454
|
+
return typeof content === "string";
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
exports.printSlotDecorators = printSlotDecorators;
|
|
458
|
+
/**
|
|
459
|
+
* Splices the decorators into the built-in section order.
|
|
460
|
+
*
|
|
461
|
+
* A decorator is placed after or before the section named by its `position`,
|
|
462
|
+
* and appended last when `position` is absent or names an unknown section.
|
|
463
|
+
* A decorator using `into` (a named slot outside the page section order — see
|
|
464
|
+
* {@link DecoratorPosition}) is excluded entirely: it is not part of the page
|
|
465
|
+
* section order and is printed separately, into its slot. Decorators are
|
|
466
|
+
* placed in declaration order, so a decorator may target a previously placed
|
|
467
|
+
* one.
|
|
468
|
+
*
|
|
469
|
+
* @param sectionOrder - the built-in section order.
|
|
470
|
+
* @param options - the print options in effect.
|
|
471
|
+
*
|
|
472
|
+
* @returns the section order including the decorators.
|
|
473
|
+
*
|
|
474
|
+
*/
|
|
475
|
+
const getDecoratorsOrder = (sectionOrder, options) => {
|
|
476
|
+
return getDeclaredDecorators(options)
|
|
477
|
+
.filter((decorator) => {
|
|
478
|
+
return !targetsSlot(decorator);
|
|
479
|
+
})
|
|
480
|
+
.reduce((order, decorator) => {
|
|
481
|
+
const position = decorator.position;
|
|
482
|
+
const anchor = position
|
|
483
|
+
? (position.after ?? position.before)
|
|
484
|
+
: undefined;
|
|
485
|
+
const index = anchor ? order.indexOf(anchor) : -1;
|
|
486
|
+
if (index === -1) {
|
|
487
|
+
order.push(decorator.id);
|
|
488
|
+
return order;
|
|
489
|
+
}
|
|
490
|
+
order.splice(position?.after ? index + 1 : index, 0, decorator.id);
|
|
491
|
+
return order;
|
|
492
|
+
}, [...sectionOrder]);
|
|
493
|
+
};
|
|
494
|
+
exports.getDecoratorsOrder = getDecoratorsOrder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,UACpB,MAAM,SACN,KAAK,CAAC,kBAAkB,CAAC,WACvB,gBAAgB,KACxB,
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,UACpB,MAAM,SACN,KAAK,CAAC,kBAAkB,CAAC,WACvB,gBAAgB,KACxB,MAUF,CAAC"}
|
package/dist/frontmatter.js
CHANGED
|
@@ -15,6 +15,8 @@ const printFrontMatter = (title, props, options) => {
|
|
|
15
15
|
if (!options.formatMDXFrontmatter) {
|
|
16
16
|
return "";
|
|
17
17
|
}
|
|
18
|
-
return options.formatMDXFrontmatter(props, frontMatter
|
|
18
|
+
return options.formatMDXFrontmatter(props, frontMatter, {
|
|
19
|
+
entity: options.entity,
|
|
20
|
+
});
|
|
19
21
|
};
|
|
20
22
|
exports.printFrontMatter = printFrontMatter;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Printer } from "./printer";
|
|
2
|
+
export { buildCustomDirectiveDecorators, RESERVED_SECTION_NAMES, } from "./decorator";
|
|
2
3
|
export { PrintCodeEvent, PrintTypeEvent, BeforeComposePageTypeEvent, } from "./events";
|
|
3
4
|
export type { PageSection, PageSections, PrintCodeEventData, PrintTypeEventData, ComposePageTypeEventData, } from "./events";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,GAC3B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,GAC3B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BeforeComposePageTypeEvent = exports.PrintTypeEvent = exports.PrintCodeEvent = exports.Printer = void 0;
|
|
3
|
+
exports.BeforeComposePageTypeEvent = exports.PrintTypeEvent = exports.PrintCodeEvent = exports.RESERVED_SECTION_NAMES = exports.buildCustomDirectiveDecorators = exports.Printer = void 0;
|
|
4
4
|
var printer_1 = require("./printer");
|
|
5
5
|
Object.defineProperty(exports, "Printer", { enumerable: true, get: function () { return printer_1.Printer; } });
|
|
6
|
+
var decorator_1 = require("./decorator");
|
|
7
|
+
Object.defineProperty(exports, "buildCustomDirectiveDecorators", { enumerable: true, get: function () { return decorator_1.buildCustomDirectiveDecorators; } });
|
|
8
|
+
Object.defineProperty(exports, "RESERVED_SECTION_NAMES", { enumerable: true, get: function () { return decorator_1.RESERVED_SECTION_NAMES; } });
|
|
6
9
|
var events_1 = require("./events");
|
|
7
10
|
Object.defineProperty(exports, "PrintCodeEvent", { enumerable: true, get: function () { return events_1.PrintCodeEvent; } });
|
|
8
11
|
Object.defineProperty(exports, "PrintTypeEvent", { enumerable: true, get: function () { return events_1.PrintTypeEvent; } });
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAKhB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AAiCjC,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,YACH,IAAI,CACZ,gBAAgB,EAChB,YAAY,GAAG,mBAAmB,GAAG,mBAAmB,CACzD,KACA,OAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,KAAK,CAAC,UAAU,CAoBjE,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,oBACK,KAAK,CAAC,UAAU,CAAC,KAClC,KAAK,CAAC,MAAM,CAoBd,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,uBAAuB,YAAa,gBAAgB,KAAG,OAEnE,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,YAAa,gBAAgB,KAAG,OAO/D,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,WACJ,KAAK,CAAC,oBAAoB,GAAG,OAAO,CAAC,KAC7C,MAMF,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAKhB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AAiCjC,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,YACH,IAAI,CACZ,gBAAgB,EAChB,YAAY,GAAG,mBAAmB,GAAG,mBAAmB,CACzD,KACA,OAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,KAAK,CAAC,UAAU,CAoBjE,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,oBACK,KAAK,CAAC,UAAU,CAAC,KAClC,KAAK,CAAC,MAAM,CAoBd,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,uBAAuB,YAAa,gBAAgB,KAAG,OAEnE,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,YAAa,gBAAgB,KAAG,OAO/D,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,WACJ,KAAK,CAAC,oBAAoB,GAAG,OAAO,CAAC,KAC7C,MAMF,CAAC;AA2DF;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,SACX,OAAO,QACP,MAAM,aACD,KAAK,CAAC,UAAU,CAAC,WACnB,gBAAgB,KACxB,QAkGF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,aAChB,KAAK,CAAC,UAAU,CAAC,QACrB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,QAAQ,CAUhB,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,mBAAmB,SACxB,OAAO,SACP,KAAK,CAAC,MAAM,CAAC,KAClB,MAkBF,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,OACpB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,WACf,gBAAgB,KACxB,MAgCF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAWd,CAAC"}
|
package/dist/link.js
CHANGED
|
@@ -151,6 +151,32 @@ const getLinkDeprecatedFolder = (type, option) => {
|
|
|
151
151
|
const isHierarchy = (options, hierarchy) => {
|
|
152
152
|
return options?.hierarchy?.[hierarchy] !== undefined;
|
|
153
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* Resolves the namespace folder segments and final filename slug for an
|
|
156
|
+
* operation link, matching the two layouts `renderer.ts` can write: nested
|
|
157
|
+
* category/namespace folders normally, or — under flat hierarchy, where
|
|
158
|
+
* `renderTypeEntities` writes one file per operation using the full dotted
|
|
159
|
+
* name (e.g. `queries-analytics-aggregate-tournaments.mdx`) — a single
|
|
160
|
+
* flattened filename with no namespace subfolders.
|
|
161
|
+
*
|
|
162
|
+
* @param isFlat - Whether the flat hierarchy option is active
|
|
163
|
+
* @param category - The resolved category, used as a folder (non-flat) or filename prefix (flat)
|
|
164
|
+
* @param name - The full, possibly dotted, operation name
|
|
165
|
+
* @param operationNameParts - `name` split on "." for namespaced operations, empty otherwise
|
|
166
|
+
* @param operationLeafName - The last part of `operationNameParts`, or the type's display name
|
|
167
|
+
* @returns The namespace folder segments (empty under flat hierarchy) and the final leaf slug
|
|
168
|
+
*/
|
|
169
|
+
const getOperationPathSegments = (isFlat, category, name, operationNameParts, operationLeafName) => {
|
|
170
|
+
const flatCategoryPrefix = isFlat && category ? `${(0, utils_1.slugify)(category)}-` : "";
|
|
171
|
+
return {
|
|
172
|
+
namespaceFolders: isFlat
|
|
173
|
+
? []
|
|
174
|
+
: operationNameParts.slice(0, -1).map((folder) => {
|
|
175
|
+
return (0, utils_1.slugify)(folder);
|
|
176
|
+
}),
|
|
177
|
+
leafSegment: `${flatCategoryPrefix}${(0, utils_1.slugify)(isFlat && operationNameParts.length > 0 ? name : operationLeafName)}`,
|
|
178
|
+
};
|
|
179
|
+
};
|
|
154
180
|
/**
|
|
155
181
|
* Converts a GraphQL type to a link object.
|
|
156
182
|
*
|
|
@@ -175,15 +201,23 @@ const toLink = (type, name, operation, options) => {
|
|
|
175
201
|
// GraphQL overload resolution can include a void branch in this monorepo; runtime value is a named type here.
|
|
176
202
|
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
177
203
|
const graphQLNamedType = (0, graphql_1.getNamedType)(type);
|
|
178
|
-
|
|
204
|
+
const isFlat = isHierarchy(options, options_1.TypeHierarchy.FLAT);
|
|
205
|
+
// Under flat hierarchy there are no folders to keep same-named entities of
|
|
206
|
+
// different kinds apart (a `type User` and a `Query.user` field both
|
|
207
|
+
// slugify to "user") — `renderer.ts`'s `renderTypeEntities` prefixes the
|
|
208
|
+
// actual filename with the entity kind (e.g. `objects-user.mdx`) to stay
|
|
209
|
+
// unique, so the link generated here has to build the exact same prefix
|
|
210
|
+
// or it would point at a file that doesn't exist.
|
|
211
|
+
let category = (0, exports.getLinkCategoryFolder)(graphQLNamedType, operation);
|
|
179
212
|
let deprecatedFolder = "";
|
|
180
213
|
let groupFolder = "";
|
|
181
214
|
let apiGroupFolder = "";
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
215
|
+
// Arguments, fields and other entities without a category have no page of
|
|
216
|
+
// their own in either layout, so they keep the in-page fallback link.
|
|
217
|
+
if (!category) {
|
|
218
|
+
return fallback;
|
|
219
|
+
}
|
|
220
|
+
if (!isFlat) {
|
|
187
221
|
deprecatedFolder = options.deprecated
|
|
188
222
|
? getLinkDeprecatedFolder(type, options.deprecated)
|
|
189
223
|
: "";
|
|
@@ -205,11 +239,9 @@ const toLink = (type, name, operation, options) => {
|
|
|
205
239
|
const operationNameParts = (0, graphql_1.isOperation)(type) && name.includes(".")
|
|
206
240
|
? name.split(".").filter(Boolean)
|
|
207
241
|
: [];
|
|
208
|
-
const operationNamespaceFolders = operationNameParts.slice(0, -1);
|
|
209
242
|
const operationLeafName = operationNameParts.at(-1) ?? text;
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
}), `${(0, utils_1.slugify)(operationLeafName)}`);
|
|
243
|
+
const { namespaceFolders, leafSegment } = getOperationPathSegments(isFlat, category, name, operationNameParts, operationLeafName);
|
|
244
|
+
const url = utils_1.pathUrl.join(options.basePath, formatFolder(deprecatedFolder), formatFolder(groupFolder), formatFolder(apiGroupFolder), isFlat ? "" : formatFolder(category), ...namespaceFolders, leafSegment);
|
|
213
245
|
const link = {
|
|
214
246
|
text,
|
|
215
247
|
url,
|
package/dist/printer.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* @module printer
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
import type { Formatter, GraphQLSchema, IPrinter, Maybe, MDXString, PageSection, PrinterEventEmitter, PrinterInitOptions, PrintTypeOptions } from "@graphql-markdown/types";
|
|
10
|
+
import type { Badge, Formatter, GraphQLSchema, IPrinter, Maybe, MDXString, PageSection, PrinterEventEmitter, PrinterInitOptions, PrintTypeOptions } from "@graphql-markdown/types";
|
|
11
11
|
import { printDescription } from "./common";
|
|
12
|
-
import {
|
|
12
|
+
import { printDecorators } from "./decorator";
|
|
13
13
|
/**
|
|
14
14
|
* The Printer class implements the core functionality for generating Markdown documentation
|
|
15
15
|
* from GraphQL schema types.
|
|
@@ -34,13 +34,9 @@ export declare class Printer implements IPrinter {
|
|
|
34
34
|
*/
|
|
35
35
|
static readonly printDescription: typeof printDescription;
|
|
36
36
|
/**
|
|
37
|
-
* Prints
|
|
37
|
+
* Prints predicate-driven decorators
|
|
38
38
|
*/
|
|
39
|
-
static readonly
|
|
40
|
-
/**
|
|
41
|
-
* Prints custom tags
|
|
42
|
-
*/
|
|
43
|
-
static readonly printCustomTags: typeof printCustomTags;
|
|
39
|
+
static readonly printDecorators: typeof printDecorators;
|
|
44
40
|
private static _eventEmitter;
|
|
45
41
|
private static _options;
|
|
46
42
|
private static _mdxDeclaration;
|
|
@@ -72,7 +68,7 @@ export declare class Printer implements IPrinter {
|
|
|
72
68
|
* @param mdxDeclaration - Optional MDX import declaration
|
|
73
69
|
* @param eventEmitter - Optional event emitter for print events interception
|
|
74
70
|
*/
|
|
75
|
-
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, {
|
|
71
|
+
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { decorators, deprecated, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, sectionHeaderId, }?: PrinterInitOptions, formatter?: Partial<Formatter>, mdxDeclaration?: Maybe<string>, eventEmitter?: Maybe<PrinterEventEmitter>): Promise<void>;
|
|
76
72
|
/**
|
|
77
73
|
* Prints the header section of a type documentation
|
|
78
74
|
*
|
|
@@ -90,6 +86,16 @@ export declare class Printer implements IPrinter {
|
|
|
90
86
|
* @returns Formatted code block string with type definition
|
|
91
87
|
*/
|
|
92
88
|
static readonly printCode: (type: unknown, options: PrintTypeOptions) => string;
|
|
89
|
+
/**
|
|
90
|
+
* Formats a single badge into MDX string format
|
|
91
|
+
*
|
|
92
|
+
* @param badge - Badge object containing text and optional classname
|
|
93
|
+
* @param options - Printer configuration options
|
|
94
|
+
* @returns Formatted MDX string, using the configured formatter's
|
|
95
|
+
* `formatMDXBadge` when set and falling back to the default formatter
|
|
96
|
+
* otherwise
|
|
97
|
+
*/
|
|
98
|
+
static readonly printBadge: (badge: Badge, options: PrintTypeOptions) => MDXString;
|
|
93
99
|
/**
|
|
94
100
|
* Prints the GraphQL type definition as code block with event emission support.
|
|
95
101
|
*
|