@graphql-markdown/printer-legacy 1.14.0 → 1.16.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/badge.d.ts +10 -3
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +19 -9
- package/dist/code.d.ts +1 -1
- package/dist/code.d.ts.map +1 -1
- package/dist/common.d.ts +5 -13
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +5 -6
- package/dist/const/options.d.ts +11 -2
- package/dist/const/options.d.ts.map +1 -1
- package/dist/const/options.js +27 -10
- package/dist/const/strings.d.ts +1 -3
- package/dist/const/strings.d.ts.map +1 -1
- package/dist/const/strings.js +4 -6
- package/dist/directive.d.ts +4 -4
- package/dist/directive.d.ts.map +1 -1
- package/dist/directive.js +9 -12
- 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.d.ts.map +1 -1
- package/dist/formatter.js +9 -30
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/graphql/directive.d.ts +4 -4
- package/dist/graphql/directive.d.ts.map +1 -1
- package/dist/graphql/directive.js +3 -3
- package/dist/graphql/enum.d.ts +4 -4
- package/dist/graphql/enum.d.ts.map +1 -1
- package/dist/graphql/enum.js +2 -2
- package/dist/graphql/input.d.ts.map +1 -1
- package/dist/graphql/input.js +1 -1
- package/dist/graphql/interface.d.ts.map +1 -1
- package/dist/graphql/interface.js +1 -1
- 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 +4 -12
- package/dist/graphql/operation.d.ts.map +1 -1
- package/dist/graphql/operation.js +43 -11
- package/dist/graphql/scalar.d.ts +6 -6
- package/dist/graphql/scalar.d.ts.map +1 -1
- package/dist/graphql/scalar.js +7 -7
- package/dist/graphql/union.d.ts +4 -4
- package/dist/graphql/union.d.ts.map +1 -1
- package/dist/graphql/union.js +2 -2
- package/dist/group.d.ts +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 +6 -2
- package/dist/link.d.ts +6 -14
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +9 -9
- package/dist/mdx/index.d.ts +1 -1
- package/dist/mdx/index.d.ts.map +1 -1
- package/dist/mdx/index.js +2 -2
- package/dist/printer.d.ts +51 -34
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +234 -118
- package/dist/relation.d.ts +2 -2
- package/dist/relation.d.ts.map +1 -1
- package/dist/section.d.ts +5 -5
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +26 -11
- package/package.json +18 -6
package/dist/badge.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* and their properties like deprecation status, nullability, and relationships.
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import type { Badge, MDXString, Maybe, PrintTypeOptions,
|
|
7
|
+
import type { Badge, MDXString, Maybe, PrintTypeOptions, SchemaEntitiesGroupMap } from "@graphql-markdown/types";
|
|
8
8
|
export declare const CSS_BADGE_CLASSNAME: {
|
|
9
9
|
DEPRECATED: string;
|
|
10
10
|
RELATION: string;
|
|
@@ -16,7 +16,7 @@ export declare const CSS_BADGE_CLASSNAME: {
|
|
|
16
16
|
* @param groups - Optional map of schema entities to their groups
|
|
17
17
|
* @returns Array of Badge objects containing text and optional classnames
|
|
18
18
|
*/
|
|
19
|
-
export declare const getTypeBadges: (type: unknown, groups?: Maybe<
|
|
19
|
+
export declare const getTypeBadges: (type: unknown, groups?: Maybe<SchemaEntitiesGroupMap>) => Badge[];
|
|
20
20
|
/**
|
|
21
21
|
* Formats a single badge into MDX string format.
|
|
22
22
|
* @param badge - The badge object containing text and optional classname
|
|
@@ -24,11 +24,18 @@ export declare const getTypeBadges: (type: unknown, groups?: Maybe<Partial<Recor
|
|
|
24
24
|
* @returns Formatted MDX string representation of the badge
|
|
25
25
|
*/
|
|
26
26
|
export declare const printBadge: ({ text, classname }: Badge, options: PrintTypeOptions) => MDXString;
|
|
27
|
+
/**
|
|
28
|
+
* Formats an array of badges into a space-joined MDX string.
|
|
29
|
+
* @param badges - Array of badge objects to format
|
|
30
|
+
* @param options - Options containing the formatter for badges
|
|
31
|
+
* @returns Space-joined MDX string of all badges, or empty string if none
|
|
32
|
+
*/
|
|
33
|
+
export declare const formatBadges: (badges: Badge[], options: PrintTypeOptions) => MDXString | string;
|
|
27
34
|
/**
|
|
28
35
|
* Generates and formats all applicable badges for a GraphQL type.
|
|
29
36
|
* @param type - The GraphQL type to generate badges for
|
|
30
37
|
* @param options - Options for printing/formatting the badges
|
|
31
38
|
* @returns Formatted MDX string containing all badges, or empty string if no badges or badges disabled
|
|
32
39
|
*/
|
|
33
|
-
export declare const printBadges: (type: unknown, options: PrintTypeOptions) =>
|
|
40
|
+
export declare const printBadges: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
34
41
|
//# sourceMappingURL=badge.d.ts.map
|
package/dist/badge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EAEL,SAAS,EACT,KAAK,EACL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EAEL,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAgBjC,eAAO,MAAM,mBAAmB;IAC9B,UAAU;IACV,QAAQ;IACR,QAAQ;CACT,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAClB,OAAO,WACJ,KAAK,CAAC,sBAAsB,CAAC,KACrC,KAAK,EA0CP,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,wBACA,KAAK,WACjB,gBAAgB,KACxB,SAWF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WACf,KAAK,EAAE,WACN,gBAAgB,KACxB,SAAS,GAAG,MASd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,SAChB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAUd,CAAC"}
|
package/dist/badge.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.printBadges = exports.printBadge = exports.getTypeBadges = exports.CSS_BADGE_CLASSNAME = void 0;
|
|
9
|
+
exports.printBadges = exports.formatBadges = exports.printBadge = exports.getTypeBadges = exports.CSS_BADGE_CLASSNAME = void 0;
|
|
10
10
|
const utils_1 = require("@graphql-markdown/utils");
|
|
11
11
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
12
12
|
const link_1 = require("./link");
|
|
@@ -76,6 +76,23 @@ const printBadge = ({ text, classname }, options) => {
|
|
|
76
76
|
return (0, formatter_1.createDefaultFormatter)().formatMDXBadge(badge);
|
|
77
77
|
};
|
|
78
78
|
exports.printBadge = printBadge;
|
|
79
|
+
/**
|
|
80
|
+
* Formats an array of badges into a space-joined MDX string.
|
|
81
|
+
* @param badges - Array of badge objects to format
|
|
82
|
+
* @param options - Options containing the formatter for badges
|
|
83
|
+
* @returns Space-joined MDX string of all badges, or empty string if none
|
|
84
|
+
*/
|
|
85
|
+
const formatBadges = (badges, options) => {
|
|
86
|
+
if (badges.length === 0) {
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
return badges
|
|
90
|
+
.map((badge) => {
|
|
91
|
+
return (0, exports.printBadge)(badge, options);
|
|
92
|
+
})
|
|
93
|
+
.join(" ");
|
|
94
|
+
};
|
|
95
|
+
exports.formatBadges = formatBadges;
|
|
79
96
|
/**
|
|
80
97
|
* Generates and formats all applicable badges for a GraphQL type.
|
|
81
98
|
* @param type - The GraphQL type to generate badges for
|
|
@@ -88,13 +105,6 @@ const printBadges = (type, options) => {
|
|
|
88
105
|
!options.typeBadges) {
|
|
89
106
|
return "";
|
|
90
107
|
}
|
|
91
|
-
|
|
92
|
-
if (badges.length === 0) {
|
|
93
|
-
return "";
|
|
94
|
-
}
|
|
95
|
-
const formattedBadges = badges.map((badge) => {
|
|
96
|
-
return (0, exports.printBadge)(badge, options);
|
|
97
|
-
});
|
|
98
|
-
return formattedBadges.join(" ");
|
|
108
|
+
return (0, exports.formatBadges)((0, exports.getTypeBadges)(type, options.groups), options);
|
|
99
109
|
};
|
|
100
110
|
exports.printBadges = printBadges;
|
package/dist/code.d.ts
CHANGED
|
@@ -38,5 +38,5 @@ export declare const printCodeArguments: (type: unknown, indentationLevel?: numb
|
|
|
38
38
|
* // ): User!
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
export declare const printCodeField: (type: unknown, options?: PrintTypeOptions
|
|
41
|
+
export declare const printCodeField: (type: unknown, options?: PrintTypeOptions, indentationLevel?: number) => MDXString | string;
|
|
42
42
|
//# sourceMappingURL=code.d.ts.map
|
package/dist/code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAiB3E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAiB3E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,SACvB,OAAO,qBACK,MAAM,KACvB,MAyBF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,SACnB,OAAO,YACH,gBAAgB,qBACR,MAAM,KACvB,SAAS,GAAG,MAoBd,CAAC"}
|
package/dist/common.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Common printer utility functions for handling descriptions, directives, and warnings.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { MDXString, PrintTypeOptions } from "@graphql-markdown/types";
|
|
6
6
|
/**
|
|
7
7
|
* Prints documentation for custom directives applied to a type.
|
|
8
8
|
*
|
|
@@ -10,15 +10,7 @@ import type { Maybe, MDXString, PrintTypeOptions } from "@graphql-markdown/types
|
|
|
10
10
|
* @param options - Printer configuration options
|
|
11
11
|
* @returns Formatted directive documentation string
|
|
12
12
|
*/
|
|
13
|
-
export declare const
|
|
14
|
-
/**
|
|
15
|
-
* Formats a GraphQL type description or falls back to a default message.
|
|
16
|
-
*
|
|
17
|
-
* @param type - GraphQL type to get description from
|
|
18
|
-
* @param replacement - Optional fallback text if no description exists
|
|
19
|
-
* @returns Formatted description string or MDX content
|
|
20
|
-
*/
|
|
21
|
-
export declare const formatDescription: (type: unknown, replacement?: Maybe<string>) => string | MDXString;
|
|
13
|
+
export declare const getCustomDirectivesText: (type: unknown, options?: PrintTypeOptions) => string;
|
|
22
14
|
/**
|
|
23
15
|
* Generates a warning message block in MDX format.
|
|
24
16
|
* @param warningConfig - Warning configuration object with `text` and optional `title` properties
|
|
@@ -26,8 +18,8 @@ export declare const formatDescription: (type: unknown, replacement?: Maybe<stri
|
|
|
26
18
|
* @returns Formatted warning message as MDX string
|
|
27
19
|
*/
|
|
28
20
|
export declare const printWarning: ({ text, title }: {
|
|
29
|
-
text?: string
|
|
30
|
-
title?: string
|
|
21
|
+
text?: string;
|
|
22
|
+
title?: string;
|
|
31
23
|
}, options: PrintTypeOptions) => string;
|
|
32
24
|
/**
|
|
33
25
|
* Prints deprecation information for a GraphQL type if it is deprecated.
|
|
@@ -43,5 +35,5 @@ export declare const printDeprecation: (type: unknown, options: PrintTypeOptions
|
|
|
43
35
|
* @param noText - Optional text to display when no description exists
|
|
44
36
|
* @returns Combined description, deprecation notices, and custom directives as MDX content
|
|
45
37
|
*/
|
|
46
|
-
export declare const printDescription: (type: unknown, options: PrintTypeOptions, noText?: string
|
|
38
|
+
export declare const printDescription: (type: unknown, options: PrintTypeOptions, noText?: string) => MDXString | string;
|
|
47
39
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAIV,SAAS,EACT,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAcjC;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,SAC5B,OAAO,YACH,gBAAgB,KACzB,MA4BF,CAAC;AAuBF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,oBACN;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WACzC,gBAAgB,KACxB,MAUF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,KACxB,MAcF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,WAChB,MAAM,KACd,SAAS,GAAG,MAKd,CAAC"}
|
package/dist/common.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.printDescription = exports.printDeprecation = exports.printWarning = exports.
|
|
7
|
+
exports.printDescription = exports.printDeprecation = exports.printWarning = exports.getCustomDirectivesText = void 0;
|
|
8
8
|
const utils_1 = require("@graphql-markdown/utils");
|
|
9
9
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
10
10
|
const strings_1 = require("./const/strings");
|
|
@@ -16,7 +16,7 @@ const directive_1 = require("./directive");
|
|
|
16
16
|
* @param options - Printer configuration options
|
|
17
17
|
* @returns Formatted directive documentation string
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const getCustomDirectivesText = (type, options) => {
|
|
20
20
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options?.customDirectives);
|
|
21
21
|
if ((0, utils_1.isEmpty)(constDirectiveMap)) {
|
|
22
22
|
return "";
|
|
@@ -34,7 +34,7 @@ const printCustomDirectives = (type, options) => {
|
|
|
34
34
|
.join(strings_1.MARKDOWN_EOP);
|
|
35
35
|
return `${strings_1.MARKDOWN_EOP}${content}`;
|
|
36
36
|
};
|
|
37
|
-
exports.
|
|
37
|
+
exports.getCustomDirectivesText = getCustomDirectivesText;
|
|
38
38
|
/**
|
|
39
39
|
* Formats a GraphQL type description or falls back to a default message.
|
|
40
40
|
*
|
|
@@ -51,7 +51,6 @@ const formatDescription = (type, replacement = strings_1.NO_DESCRIPTION_TEXT) =>
|
|
|
51
51
|
: replacement;
|
|
52
52
|
return `${strings_1.MARKDOWN_EOP}${(0, utils_1.escapeMDX)(description)}`;
|
|
53
53
|
};
|
|
54
|
-
exports.formatDescription = formatDescription;
|
|
55
54
|
/**
|
|
56
55
|
* Generates a warning message block in MDX format.
|
|
57
56
|
* @param warningConfig - Warning configuration object with `text` and optional `title` properties
|
|
@@ -89,8 +88,8 @@ exports.printDeprecation = printDeprecation;
|
|
|
89
88
|
* @returns Combined description, deprecation notices, and custom directives as MDX content
|
|
90
89
|
*/
|
|
91
90
|
const printDescription = (type, options, noText) => {
|
|
92
|
-
const description =
|
|
93
|
-
const customDirectives = (0, exports.
|
|
91
|
+
const description = formatDescription(type, noText);
|
|
92
|
+
const customDirectives = (0, exports.getCustomDirectivesText)(type, options);
|
|
94
93
|
const deprecation = (0, exports.printDeprecation)(type, options);
|
|
95
94
|
return `${deprecation}${description}${customDirectives}`;
|
|
96
95
|
};
|
package/dist/const/options.d.ts
CHANGED
|
@@ -5,12 +5,21 @@ export declare enum TypeHierarchy {
|
|
|
5
5
|
FLAT = "flat"
|
|
6
6
|
}
|
|
7
7
|
export declare enum SectionLevels {
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use `SectionLevels.LEVEL` instead.
|
|
10
|
+
*/
|
|
8
11
|
NONE = "",
|
|
9
12
|
LEVEL = "#"
|
|
10
13
|
}
|
|
11
|
-
export declare const PRINT_TYPE_DEFAULT_OPTIONS: Required<PrinterConfigPrintTypeOptions
|
|
12
|
-
|
|
14
|
+
export declare const PRINT_TYPE_DEFAULT_OPTIONS: Required<Omit<PrinterConfigPrintTypeOptions, "exampleSection">> & {
|
|
15
|
+
exampleSection: PrintTypeOptions["exampleSection"];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Clean runtime options passed through the printer.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "afterDiffCheckHook" | "afterGenerateIndexMetafileHook" | "afterRenderHomepageHook" | "afterRenderRootTypesHook" | "afterRenderTypeEntitiesHook" | "afterSchemaLoadHook" | "beforeDiffCheckHook" | "beforeGenerateIndexMetafileHook" | "beforeRenderHomepageHook" | "beforeRenderRootTypesHook" | "beforeRenderTypeEntitiesHook" | "beforeSchemaLoadHook" | "collapsible" | "exampleSection" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
|
|
13
21
|
collapsible: Maybe<CollapsibleOption>;
|
|
22
|
+
exampleSection: PrintTypeOptions["exampleSection"];
|
|
14
23
|
groups: Maybe<SchemaEntitiesGroupMap>;
|
|
15
24
|
level: Maybe<SectionLevelValue>;
|
|
16
25
|
onlyDocDirectives: GraphQLDirective[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAajC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IAIX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB;;OAEG;IAEH,IAAI,KAAK;IACT,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAC/C,IAAI,CAAC,6BAA6B,EAAE,gBAAgB,CAAC,CACtD,GAAG;IACF,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAQpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CACpC,IAAI,CACF,gBAAgB,EACd,oBAAoB,GACpB,gCAAgC,GAChC,yBAAyB,GACzB,0BAA0B,GAC1B,6BAA6B,GAC7B,qBAAqB,GACrB,qBAAqB,GACrB,iCAAiC,GACjC,0BAA0B,GAC1B,2BAA2B,GAC3B,8BAA8B,GAC9B,sBAAsB,GACtB,aAAa,GACb,gBAAgB,GAChB,0BAA0B,GAC1B,QAAQ,GACR,OAAO,GACP,MAAM,GACN,mBAAmB,GACnB,YAAY,GACZ,QAAQ,GACR,mBAAmB,CACtB,CACF,GAAG;IACF,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACtC,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAChC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CA6BvC,CAAC"}
|
package/dist/const/options.js
CHANGED
|
@@ -1,45 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.DEFAULT_OPTIONS = exports.PRINT_TYPE_DEFAULT_OPTIONS = exports.SectionLevels = exports.TypeHierarchy = void 0;
|
|
7
|
-
const
|
|
4
|
+
const defaults_1 = require("@graphql-markdown/formatters/defaults");
|
|
8
5
|
var TypeHierarchy;
|
|
9
6
|
(function (TypeHierarchy) {
|
|
10
7
|
TypeHierarchy["API"] = "api";
|
|
8
|
+
// Used cross-package in packages/core/src/renderer.ts and config.ts;
|
|
9
|
+
// fallow can't trace cross-workspace callers when dist/ is excluded.
|
|
10
|
+
// fallow-ignore-next-line unused-enum-member
|
|
11
11
|
TypeHierarchy["ENTITY"] = "entity";
|
|
12
12
|
TypeHierarchy["FLAT"] = "flat";
|
|
13
13
|
})(TypeHierarchy || (exports.TypeHierarchy = TypeHierarchy = {}));
|
|
14
14
|
var SectionLevels;
|
|
15
15
|
(function (SectionLevels) {
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use `SectionLevels.LEVEL` instead.
|
|
18
|
+
*/
|
|
19
|
+
// fallow-ignore-next-line unused-enum-member
|
|
16
20
|
SectionLevels["NONE"] = "";
|
|
17
21
|
SectionLevels["LEVEL"] = "#";
|
|
18
22
|
})(SectionLevels || (exports.SectionLevels = SectionLevels = {}));
|
|
19
23
|
exports.PRINT_TYPE_DEFAULT_OPTIONS = {
|
|
20
|
-
codeSection: true,
|
|
21
24
|
deprecated: "default",
|
|
22
|
-
exampleSection:
|
|
25
|
+
exampleSection: undefined,
|
|
23
26
|
metatags: [],
|
|
24
27
|
parentTypePrefix: true,
|
|
25
|
-
relatedTypeSection: true,
|
|
26
28
|
typeBadges: true,
|
|
27
29
|
hierarchy: { [TypeHierarchy.API]: {} },
|
|
28
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Clean runtime options passed through the printer.
|
|
33
|
+
*/
|
|
29
34
|
exports.DEFAULT_OPTIONS = {
|
|
30
|
-
|
|
35
|
+
deprecated: exports.PRINT_TYPE_DEFAULT_OPTIONS.deprecated,
|
|
31
36
|
basePath: "/",
|
|
32
37
|
collapsible: undefined,
|
|
33
38
|
customDirectives: {},
|
|
39
|
+
exampleSection: undefined,
|
|
34
40
|
groups: undefined,
|
|
35
41
|
frontMatter: {},
|
|
36
42
|
level: undefined,
|
|
37
|
-
metatags:
|
|
43
|
+
metatags: exports.PRINT_TYPE_DEFAULT_OPTIONS.metatags,
|
|
38
44
|
onlyDocDirectives: [],
|
|
45
|
+
operationNamespaceParts: null,
|
|
39
46
|
parentType: undefined,
|
|
47
|
+
parentTypePrefix: exports.PRINT_TYPE_DEFAULT_OPTIONS.parentTypePrefix,
|
|
40
48
|
schema: undefined,
|
|
41
49
|
skipDocDirectives: [],
|
|
50
|
+
typeBadges: exports.PRINT_TYPE_DEFAULT_OPTIONS.typeBadges,
|
|
42
51
|
withAttributes: false,
|
|
43
52
|
sectionHeaderId: true,
|
|
44
|
-
|
|
53
|
+
hierarchy: exports.PRINT_TYPE_DEFAULT_OPTIONS.hierarchy,
|
|
54
|
+
formatMDXAdmonition: defaults_1.formatMDXAdmonition,
|
|
55
|
+
formatMDXBadge: defaults_1.formatMDXBadge,
|
|
56
|
+
formatMDXBullet: defaults_1.formatMDXBullet,
|
|
57
|
+
formatMDXDetails: defaults_1.formatMDXDetails,
|
|
58
|
+
formatMDXFrontmatter: defaults_1.formatMDXFrontmatter,
|
|
59
|
+
formatMDXLink: defaults_1.formatMDXLink,
|
|
60
|
+
formatMDXNameEntity: defaults_1.formatMDXNameEntity,
|
|
61
|
+
formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
|
|
45
62
|
};
|
package/dist/const/strings.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
7
|
import type { RootTypeLocale } from "@graphql-markdown/types";
|
|
8
|
-
export {
|
|
8
|
+
export { MARKDOWN_CODE_INDENTATION, MARKDOWN_EOL, MARKDOWN_EOP, } from "@graphql-markdown/utils";
|
|
9
9
|
/**
|
|
10
10
|
* Human-readable labels for each GraphQL root type used when rendering copy or badges.
|
|
11
11
|
*/
|
|
@@ -14,8 +14,6 @@ export declare const ROOT_TYPE_LOCALE: RootTypeLocale;
|
|
|
14
14
|
export declare const DEPRECATED: "deprecated";
|
|
15
15
|
/** Copy fragment describing a non-null GraphQL modifier. */
|
|
16
16
|
export declare const NON_NULL: "non-null";
|
|
17
|
-
/** Short identifier for the GraphQL language tag used in fenced blocks. */
|
|
18
|
-
export declare const GRAPHQL: "graphql";
|
|
19
17
|
/** Default placeholder when no schema description is provided. */
|
|
20
18
|
export declare const NO_DESCRIPTION_TEXT: "No description";
|
|
21
19
|
/** Helper for inserting the code-block end delimiter in generated Markdown. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAAG,YAAqB,CAAC;AAEhD,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,EAAG,UAAmB,CAAC;AAK5C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAC;AAE7D,+EAA+E;AAC/E,eAAO,MAAM,YAAY,WAC0C,CAAC;AAEpE,oFAAoF;AACpF,eAAO,MAAM,YAAY,kBACoD,CAAC"}
|
package/dist/const/strings.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MARKDOWN_SOC = exports.MARKDOWN_EOC = exports.NO_DESCRIPTION_TEXT = exports.
|
|
3
|
+
exports.MARKDOWN_SOC = exports.MARKDOWN_EOC = exports.NO_DESCRIPTION_TEXT = exports.NON_NULL = exports.DEPRECATED = exports.ROOT_TYPE_LOCALE = exports.MARKDOWN_EOP = exports.MARKDOWN_EOL = exports.MARKDOWN_CODE_INDENTATION = void 0;
|
|
4
4
|
const utils_1 = require("@graphql-markdown/utils");
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(exports, "FRONT_MATTER_DELIMITER", { enumerable: true, get: function () { return utils_2.FRONT_MATTER_DELIMITER; } });
|
|
5
|
+
var utils_2 = require("@graphql-markdown/utils");
|
|
7
6
|
Object.defineProperty(exports, "MARKDOWN_CODE_INDENTATION", { enumerable: true, get: function () { return utils_2.MARKDOWN_CODE_INDENTATION; } });
|
|
8
|
-
Object.defineProperty(exports, "MARKDOWN_CODE_SNIPPET", { enumerable: true, get: function () { return utils_2.MARKDOWN_CODE_SNIPPET; } });
|
|
9
7
|
Object.defineProperty(exports, "MARKDOWN_EOL", { enumerable: true, get: function () { return utils_2.MARKDOWN_EOL; } });
|
|
10
8
|
Object.defineProperty(exports, "MARKDOWN_EOP", { enumerable: true, get: function () { return utils_2.MARKDOWN_EOP; } });
|
|
11
9
|
/**
|
|
@@ -29,10 +27,10 @@ exports.DEPRECATED = "deprecated";
|
|
|
29
27
|
/** Copy fragment describing a non-null GraphQL modifier. */
|
|
30
28
|
exports.NON_NULL = "non-null";
|
|
31
29
|
/** Short identifier for the GraphQL language tag used in fenced blocks. */
|
|
32
|
-
|
|
30
|
+
const GRAPHQL = "graphql";
|
|
33
31
|
/** Default placeholder when no schema description is provided. */
|
|
34
32
|
exports.NO_DESCRIPTION_TEXT = "No description";
|
|
35
33
|
/** Helper for inserting the code-block end delimiter in generated Markdown. */
|
|
36
34
|
exports.MARKDOWN_EOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${utils_1.MARKDOWN_EOL}`;
|
|
37
35
|
/** Helper for inserting the code-block start delimiter targeting GraphQL syntax. */
|
|
38
|
-
exports.MARKDOWN_SOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${
|
|
36
|
+
exports.MARKDOWN_SOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${GRAPHQL}${utils_1.MARKDOWN_EOL}`;
|
package/dist/directive.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Provides utilities for handling and printing GraphQL directives in Markdown format
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type { Badge, PrintTypeOptions, MDXString, CustomDirectiveMapItem, CustomDirectiveResolver, Maybe } from "@graphql-markdown/types";
|
|
5
|
+
import type { Badge, PrintTypeOptions, MDXString, CustomDirectiveMapItem, CustomDirectiveResolver, Maybe, PageSection } from "@graphql-markdown/types";
|
|
6
6
|
/**
|
|
7
7
|
* Resolves a custom directive using the provided resolver function
|
|
8
8
|
* @param resolver - The resolver function name to execute
|
|
@@ -24,9 +24,9 @@ export declare const printCustomDirective: (type: unknown, constDirectiveOption:
|
|
|
24
24
|
* Prints all custom directives for a type as a Markdown section
|
|
25
25
|
* @param type - The GraphQL type to print directives for
|
|
26
26
|
* @param options - General printing options
|
|
27
|
-
* @returns
|
|
27
|
+
* @returns A "Directives" PageSection, or undefined when no directives are printable
|
|
28
28
|
*/
|
|
29
|
-
export declare const printCustomDirectives: (type: unknown, options: PrintTypeOptions) =>
|
|
29
|
+
export declare const printCustomDirectives: (type: unknown, options: PrintTypeOptions) => Maybe<PageSection>;
|
|
30
30
|
/**
|
|
31
31
|
* Extracts custom tags from directives for a given type
|
|
32
32
|
* @param type - The GraphQL type to get tags for
|
|
@@ -40,5 +40,5 @@ export declare const getCustomTags: (type: unknown, options: PrintTypeOptions) =
|
|
|
40
40
|
* @param options - General printing options
|
|
41
41
|
* @returns Formatted Markdown string of badges or empty string
|
|
42
42
|
*/
|
|
43
|
-
export declare const printCustomTags: (type: unknown, options: PrintTypeOptions) =>
|
|
43
|
+
export declare const printCustomTags: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
44
44
|
//# sourceMappingURL=directive.d.ts.map
|
package/dist/directive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,
|
|
1
|
+
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,EACL,WAAW,EACZ,MAAM,yBAAyB,CAAC;AASjC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,aAC3B,uBAAuB,QAC3B,OAAO,wBACS,sBAAsB,aACjC,KAAK,CAAC,MAAM,CAAC,KACvB,KAAK,CAAC,MAAM,CAYd,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,SACzB,OAAO,wBACS,sBAAsB,WACnC,gBAAgB,KACxB,KAAK,CAAC,MAAM,CAgBd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CA6BnB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAClB,OAAO,WACJ,gBAAgB,KACxB,KAAK,EAqBP,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAEd,CAAC"}
|
package/dist/directive.js
CHANGED
|
@@ -49,12 +49,12 @@ exports.printCustomDirective = printCustomDirective;
|
|
|
49
49
|
* Prints all custom directives for a type as a Markdown section
|
|
50
50
|
* @param type - The GraphQL type to print directives for
|
|
51
51
|
* @param options - General printing options
|
|
52
|
-
* @returns
|
|
52
|
+
* @returns A "Directives" PageSection, or undefined when no directives are printable
|
|
53
53
|
*/
|
|
54
54
|
const printCustomDirectives = (type, options) => {
|
|
55
55
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options.customDirectives);
|
|
56
56
|
if (!constDirectiveMap || Object.keys(constDirectiveMap).length === 0) {
|
|
57
|
-
return
|
|
57
|
+
return undefined;
|
|
58
58
|
}
|
|
59
59
|
const directives = Object.values(constDirectiveMap)
|
|
60
60
|
.map((constDirectiveOption) => {
|
|
@@ -64,10 +64,14 @@ const printCustomDirectives = (type, options) => {
|
|
|
64
64
|
return value !== undefined;
|
|
65
65
|
});
|
|
66
66
|
if (directives.length === 0) {
|
|
67
|
-
return
|
|
67
|
+
return undefined;
|
|
68
68
|
}
|
|
69
69
|
const content = directives.join(strings_1.MARKDOWN_EOP);
|
|
70
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
title: "Directives",
|
|
72
|
+
content: `${content}${strings_1.MARKDOWN_EOP}`,
|
|
73
|
+
level: 3,
|
|
74
|
+
};
|
|
71
75
|
};
|
|
72
76
|
exports.printCustomDirectives = printCustomDirectives;
|
|
73
77
|
/**
|
|
@@ -99,13 +103,6 @@ exports.getCustomTags = getCustomTags;
|
|
|
99
103
|
* @returns Formatted Markdown string of badges or empty string
|
|
100
104
|
*/
|
|
101
105
|
const printCustomTags = (type, options) => {
|
|
102
|
-
|
|
103
|
-
if (badges.length === 0) {
|
|
104
|
-
return "";
|
|
105
|
-
}
|
|
106
|
-
const formattedBadges = badges.map((badge) => {
|
|
107
|
-
return (0, badge_1.printBadge)(badge, options);
|
|
108
|
-
});
|
|
109
|
-
return formattedBadges.join(" ");
|
|
106
|
+
return (0, badge_1.formatBadges)((0, exports.getCustomTags)(type, options), options);
|
|
110
107
|
};
|
|
111
108
|
exports.printCustomTags = printCustomTags;
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Print type event classes.
|
|
3
|
+
*
|
|
4
|
+
* Event classes for print operations that allow handlers to modify the generated output.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { IPrintCodeEvent, IPrintTypeEvent, MDXString, Maybe, ComposePageTypeEventData, PageSections, PrintCodeEventData, PrintTypeEventData } from "@graphql-markdown/types";
|
|
9
|
+
export type { ComposePageTypeEventData, PageSection, PageSections, PrintCodeEventData, PrintTypeEventData, } from "@graphql-markdown/types";
|
|
10
|
+
import type { CancellableEventOptions } from "@graphql-markdown/utils";
|
|
11
|
+
import { DataOutputEvent } from "@graphql-markdown/utils";
|
|
12
|
+
/**
|
|
13
|
+
* Event emitted around code block generation for a GraphQL type.
|
|
14
|
+
*
|
|
15
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
16
|
+
* the generated code before it's included in the documentation.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
|
|
21
|
+
* // Add a comment to all generated code
|
|
22
|
+
* event.output = `# Auto-generated\n${event.output}`;
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @category Events
|
|
27
|
+
*/
|
|
28
|
+
export declare class PrintCodeEvent extends DataOutputEvent<PrintCodeEventData, string> implements IPrintCodeEvent {
|
|
29
|
+
constructor(data: PrintCodeEventData, initialOutput: string, options?: CancellableEventOptions);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Event emitted around full documentation generation for a GraphQL type.
|
|
33
|
+
*
|
|
34
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
35
|
+
* the complete generated documentation.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
|
|
40
|
+
* // Add a footer to all type documentation
|
|
41
|
+
* event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @category Events
|
|
46
|
+
*/
|
|
47
|
+
export declare class PrintTypeEvent extends DataOutputEvent<PrintTypeEventData, Maybe<MDXString>> implements IPrintTypeEvent {
|
|
48
|
+
constructor(data: PrintTypeEventData, initialOutput: Maybe<MDXString>, options?: CancellableEventOptions);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Event emitted before composing page sections for a GraphQL type.
|
|
52
|
+
*
|
|
53
|
+
* This event fires after section content is generated and before sections are joined into final output.
|
|
54
|
+
* The `output` property contains an array of content section keys that will be included in the final page,
|
|
55
|
+
* in addition to fixed header sections (`header`, `metatags`, `mdxDeclaration`) which are managed separately
|
|
56
|
+
* by the printer and always prepended. Handlers can reorder, filter, or append to this array to control the
|
|
57
|
+
* structure of the content portion of the page.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* events.on(PrintTypeEvents.BEFORE_COMPOSE_PAGE_TYPE, (event: BeforeComposePageTypeEvent) => {
|
|
62
|
+
* // Move relations section before metadata
|
|
63
|
+
* const idx = event.output.indexOf('relations');
|
|
64
|
+
* if (idx > -1) {
|
|
65
|
+
* event.output.splice(idx, 1);
|
|
66
|
+
* const metaidx = event.output.indexOf('metadata');
|
|
67
|
+
* event.output.splice(metaidx, 0, 'relations');
|
|
68
|
+
* }
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @category Events
|
|
73
|
+
*/
|
|
74
|
+
export declare class BeforeComposePageTypeEvent extends DataOutputEvent<ComposePageTypeEventData, (keyof PageSections)[]> {
|
|
75
|
+
constructor(data: ComposePageTypeEventData, initialOutput: (keyof PageSections)[], options?: CancellableEventOptions);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,SAAS,EACT,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,wBAAwB,EACxB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cACX,SAAQ,eAAe,CAAC,kBAAkB,EAAE,MAAM,CAClD,YAAW,eAAe;IAE1B,YACE,IAAI,EAAE,kBAAkB,EACxB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cACX,SAAQ,eAAe,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,CAC5D,YAAW,eAAe;IAE1B,YACE,IAAI,EAAE,kBAAkB,EACxB,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,EAC/B,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,0BAA2B,SAAQ,eAAe,CAC7D,wBAAwB,EACxB,CAAC,MAAM,YAAY,CAAC,EAAE,CACvB;IACC,YACE,IAAI,EAAE,wBAAwB,EAC9B,aAAa,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,EACrC,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Print type event classes.
|
|
4
|
+
*
|
|
5
|
+
* Event classes for print operations that allow handlers to modify the generated output.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BeforeComposePageTypeEvent = exports.PrintTypeEvent = exports.PrintCodeEvent = void 0;
|
|
11
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
12
|
+
/**
|
|
13
|
+
* Event emitted around code block generation for a GraphQL type.
|
|
14
|
+
*
|
|
15
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
16
|
+
* the generated code before it's included in the documentation.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
|
|
21
|
+
* // Add a comment to all generated code
|
|
22
|
+
* event.output = `# Auto-generated\n${event.output}`;
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @category Events
|
|
27
|
+
*/
|
|
28
|
+
class PrintCodeEvent extends utils_1.DataOutputEvent {
|
|
29
|
+
constructor(data, initialOutput, options) {
|
|
30
|
+
super(data, initialOutput, options);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.PrintCodeEvent = PrintCodeEvent;
|
|
34
|
+
/**
|
|
35
|
+
* Event emitted around full documentation generation for a GraphQL type.
|
|
36
|
+
*
|
|
37
|
+
* The `output` property is mutable, allowing event handlers to modify
|
|
38
|
+
* the complete generated documentation.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
|
|
43
|
+
* // Add a footer to all type documentation
|
|
44
|
+
* event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @category Events
|
|
49
|
+
*/
|
|
50
|
+
class PrintTypeEvent extends utils_1.DataOutputEvent {
|
|
51
|
+
constructor(data, initialOutput, options) {
|
|
52
|
+
super(data, initialOutput, options);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.PrintTypeEvent = PrintTypeEvent;
|
|
56
|
+
/**
|
|
57
|
+
* Event emitted before composing page sections for a GraphQL type.
|
|
58
|
+
*
|
|
59
|
+
* This event fires after section content is generated and before sections are joined into final output.
|
|
60
|
+
* The `output` property contains an array of content section keys that will be included in the final page,
|
|
61
|
+
* in addition to fixed header sections (`header`, `metatags`, `mdxDeclaration`) which are managed separately
|
|
62
|
+
* by the printer and always prepended. Handlers can reorder, filter, or append to this array to control the
|
|
63
|
+
* structure of the content portion of the page.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* events.on(PrintTypeEvents.BEFORE_COMPOSE_PAGE_TYPE, (event: BeforeComposePageTypeEvent) => {
|
|
68
|
+
* // Move relations section before metadata
|
|
69
|
+
* const idx = event.output.indexOf('relations');
|
|
70
|
+
* if (idx > -1) {
|
|
71
|
+
* event.output.splice(idx, 1);
|
|
72
|
+
* const metaidx = event.output.indexOf('metadata');
|
|
73
|
+
* event.output.splice(metaidx, 0, 'relations');
|
|
74
|
+
* }
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @category Events
|
|
79
|
+
*/
|
|
80
|
+
class BeforeComposePageTypeEvent extends utils_1.DataOutputEvent {
|
|
81
|
+
constructor(data, initialOutput, options) {
|
|
82
|
+
super(data, initialOutput, options);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.BeforeComposePageTypeEvent = BeforeComposePageTypeEvent;
|
package/dist/example.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAIV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAwBjC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAIV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAwBjC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,gCAGnC,gBAAgB,KAAG,KAAK,CAAC,oBAAoB,CA6B/C,CAAC;AAiKF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,SACjB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,MAAM,CAgBd,CAAC"}
|