@graphql-markdown/printer-legacy 1.12.5 → 1.13.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 CHANGED
@@ -20,7 +20,7 @@ export declare const getTypeBadges: (type: unknown, groups?: Maybe<Partial<Recor
20
20
  /**
21
21
  * Formats a single badge into MDX string format.
22
22
  * @param badge - The badge object containing text and optional classname
23
- * @param options - Options for printing/formatting the badge
23
+ * @param options - Options containing the formatter for badges
24
24
  * @returns Formatted MDX string representation of the badge
25
25
  */
26
26
  export declare const printBadge: ({ text, classname }: Badge, options: PrintTypeOptions) => MDXString;
@@ -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,EAEhB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAejC,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,0GA6CzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,sEAUtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kEAuBvB,CAAC"}
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,EAEhB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAgBjC,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,0GA6CzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,sEActB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kEAsBvB,CAAC"}
package/dist/badge.js CHANGED
@@ -11,6 +11,7 @@ const utils_1 = require("@graphql-markdown/utils");
11
11
  const graphql_1 = require("@graphql-markdown/graphql");
12
12
  const link_1 = require("./link");
13
13
  const group_1 = require("./group");
14
+ const formatter_1 = require("./formatter");
14
15
  const strings_1 = require("./const/strings");
15
16
  exports.CSS_BADGE_CLASSNAME = {
16
17
  DEPRECATED: "DEPRECATED",
@@ -61,16 +62,18 @@ exports.getTypeBadges = getTypeBadges;
61
62
  /**
62
63
  * Formats a single badge into MDX string format.
63
64
  * @param badge - The badge object containing text and optional classname
64
- * @param options - Options for printing/formatting the badge
65
+ * @param options - Options containing the formatter for badges
65
66
  * @returns Formatted MDX string representation of the badge
66
67
  */
67
68
  const printBadge = ({ text, classname }, options) => {
68
- const textString = typeof text === "object" ? text.singular : text;
69
- const formattedText = (0, utils_1.escapeMDX)(textString);
70
- return options.formatMDXBadge({
71
- text: formattedText,
72
- classname,
73
- });
69
+ const textString = (0, utils_1.escapeMDX)(typeof text === "object" ? text.singular : text);
70
+ const badge = { text: textString, classname };
71
+ // Use the formatter from options (either custom or default)
72
+ if (options.formatMDXBadge) {
73
+ return options.formatMDXBadge(badge);
74
+ }
75
+ // Fallback to default formatter (should not happen if Printer.init was called)
76
+ return (0, formatter_1.createDefaultFormatter)().formatMDXBadge(badge);
74
77
  };
75
78
  exports.printBadge = printBadge;
76
79
  /**
@@ -89,10 +92,9 @@ const printBadges = (type, options) => {
89
92
  if (badges.length === 0) {
90
93
  return "";
91
94
  }
92
- return badges
93
- .map((badge) => {
95
+ const formattedBadges = badges.map((badge) => {
94
96
  return (0, exports.printBadge)(badge, options);
95
- })
96
- .join(" ");
97
+ });
98
+ return formattedBadges.join(" ");
97
99
  };
98
100
  exports.printBadges = printBadges;
@@ -9,7 +9,7 @@ export declare enum SectionLevels {
9
9
  LEVEL = "#"
10
10
  }
11
11
  export declare const PRINT_TYPE_DEFAULT_OPTIONS: Required<PrinterConfigPrintTypeOptions>;
12
- export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
12
+ export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives" | "beforeSchemaLoadHook" | "afterSchemaLoadHook" | "beforeDiffCheckHook" | "afterDiffCheckHook" | "beforeRenderRootTypesHook" | "afterRenderRootTypesHook" | "beforeRenderHomepageHook" | "afterRenderHomepageHook" | "beforeRenderTypeEntitiesHook" | "afterRenderTypeEntitiesHook" | "beforeGenerateIndexMetafileHook" | "afterGenerateIndexMetafileHook">> & {
13
13
  collapsible: Maybe<CollapsibleOption>;
14
14
  groups: Maybe<SchemaEntitiesGroupMap>;
15
15
  level: Maybe<SectionLevelValue>;
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAIjC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB,IAAI,KAAK;IACT,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,6BAA6B,CAU5E,CAAC;AAEJ,eAAO,MAAM,eAAe,EAAE,QAAQ,CACpC,IAAI,CACF,gBAAgB,EACd,aAAa,GACb,0BAA0B,GAC1B,QAAQ,GACR,OAAO,GACP,MAAM,GACN,mBAAmB,GACnB,YAAY,GACZ,QAAQ,GACR,mBAAmB,CACtB,CACF,GAAG;IACF,WAAW,EAAE,KAAK,CAAC,iBAAiB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K,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;CAgBvC,CAAC"}
@@ -1,14 +1,10 @@
1
1
  import type { RootTypeLocale } from "@graphql-markdown/types";
2
+ export { FRONT_MATTER_DELIMITER, MARKDOWN_CODE_INDENTATION, MARKDOWN_CODE_SNIPPET, MARKDOWN_EOL, MARKDOWN_EOP, } from "@graphql-markdown/utils";
2
3
  export declare const ROOT_TYPE_LOCALE: RootTypeLocale;
3
4
  export declare const DEPRECATED: "deprecated";
4
5
  export declare const NON_NULL: "non-null";
5
6
  export declare const GRAPHQL: "graphql";
6
7
  export declare const NO_DESCRIPTION_TEXT: "No description";
7
- export declare const MARKDOWN_CODE_SNIPPET: "```";
8
- export declare const FRONT_MATTER_DELIMITER: "---";
9
- export declare const MARKDOWN_CODE_INDENTATION: " ";
10
- export declare const MARKDOWN_EOL: "\n";
11
- export declare const MARKDOWN_EOP: string;
12
8
  export declare const MARKDOWN_EOC: "\n```\n";
13
9
  export declare const MARKDOWN_SOC: "\n```graphql\n";
14
10
  //# sourceMappingURL=strings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,eAAO,MAAM,UAAU,cAAwB,CAAC;AAChD,eAAO,MAAM,QAAQ,YAAsB,CAAC;AAC5C,eAAO,MAAM,OAAO,WAAqB,CAAC;AAC1C,eAAO,MAAM,mBAAmB,kBAA4B,CAAC;AAC7D,eAAO,MAAM,qBAAqB,OAAiB,CAAC;AACpD,eAAO,MAAM,sBAAsB,OAAiB,CAAC;AAErD,eAAO,MAAM,yBAAyB,MAAgB,CAAC;AACvD,eAAO,MAAM,YAAY,MAAgB,CAAC;AAC1C,eAAO,MAAM,YAAY,QAAuC,CAAC;AACjE,eAAO,MAAM,YAAY,WAC0C,CAAC;AACpE,eAAO,MAAM,YAAY,kBACoD,CAAC"}
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/const/strings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,gBAAgB,EAAE,cAYrB,CAAC;AAEX,eAAO,MAAM,UAAU,cAAwB,CAAC;AAChD,eAAO,MAAM,QAAQ,YAAsB,CAAC;AAC5C,eAAO,MAAM,OAAO,WAAqB,CAAC;AAC1C,eAAO,MAAM,mBAAmB,kBAA4B,CAAC;AAE7D,eAAO,MAAM,YAAY,WAC0C,CAAC;AACpE,eAAO,MAAM,YAAY,kBACoD,CAAC"}
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MARKDOWN_SOC = exports.MARKDOWN_EOC = exports.MARKDOWN_EOP = exports.MARKDOWN_EOL = exports.MARKDOWN_CODE_INDENTATION = exports.FRONT_MATTER_DELIMITER = exports.MARKDOWN_CODE_SNIPPET = exports.NO_DESCRIPTION_TEXT = exports.GRAPHQL = exports.NON_NULL = exports.DEPRECATED = exports.ROOT_TYPE_LOCALE = void 0;
3
+ exports.MARKDOWN_SOC = exports.MARKDOWN_EOC = exports.NO_DESCRIPTION_TEXT = exports.GRAPHQL = exports.NON_NULL = exports.DEPRECATED = exports.ROOT_TYPE_LOCALE = exports.MARKDOWN_EOP = exports.MARKDOWN_EOL = exports.MARKDOWN_CODE_SNIPPET = exports.MARKDOWN_CODE_INDENTATION = exports.FRONT_MATTER_DELIMITER = void 0;
4
+ const utils_1 = require("@graphql-markdown/utils");
5
+ const utils_2 = require("@graphql-markdown/utils");
6
+ Object.defineProperty(exports, "FRONT_MATTER_DELIMITER", { enumerable: true, get: function () { return utils_2.FRONT_MATTER_DELIMITER; } });
7
+ 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
+ Object.defineProperty(exports, "MARKDOWN_EOL", { enumerable: true, get: function () { return utils_2.MARKDOWN_EOL; } });
10
+ Object.defineProperty(exports, "MARKDOWN_EOP", { enumerable: true, get: function () { return utils_2.MARKDOWN_EOP; } });
4
11
  exports.ROOT_TYPE_LOCALE = {
5
12
  DIRECTIVE: { singular: "directive", plural: "directives" },
6
13
  ENUM: { singular: "enum", plural: "enums" },
@@ -18,10 +25,5 @@ exports.DEPRECATED = "deprecated";
18
25
  exports.NON_NULL = "non-null";
19
26
  exports.GRAPHQL = "graphql";
20
27
  exports.NO_DESCRIPTION_TEXT = "No description";
21
- exports.MARKDOWN_CODE_SNIPPET = "```";
22
- exports.FRONT_MATTER_DELIMITER = "---";
23
- exports.MARKDOWN_CODE_INDENTATION = " ";
24
- exports.MARKDOWN_EOL = "\n";
25
- exports.MARKDOWN_EOP = `${exports.MARKDOWN_EOL.repeat(2)}`;
26
- exports.MARKDOWN_EOC = `${exports.MARKDOWN_EOL}${exports.MARKDOWN_CODE_SNIPPET}${exports.MARKDOWN_EOL}`;
27
- exports.MARKDOWN_SOC = `${exports.MARKDOWN_EOL}${exports.MARKDOWN_CODE_SNIPPET}${exports.GRAPHQL}${exports.MARKDOWN_EOL}`;
28
+ exports.MARKDOWN_EOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${utils_1.MARKDOWN_EOL}`;
29
+ exports.MARKDOWN_SOC = `${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_CODE_SNIPPET}${exports.GRAPHQL}${utils_1.MARKDOWN_EOL}`;
@@ -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,EACN,MAAM,yBAAyB,CAAC;AASjC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,6IAiBtC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,2GAoBhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sDA4BjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,uDAwBzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,kEAe3B,CAAC"}
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,EACN,MAAM,yBAAyB,CAAC;AASjC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,6IAiBtC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,2GAoBhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sDA4BjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,uDAwBzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,kEAc3B,CAAC"}
package/dist/directive.js CHANGED
@@ -103,10 +103,9 @@ const printCustomTags = (type, options) => {
103
103
  if (badges.length === 0) {
104
104
  return "";
105
105
  }
106
- return badges
107
- .map((badge) => {
106
+ const formattedBadges = badges.map((badge) => {
108
107
  return (0, badge_1.printBadge)(badge, options);
109
- })
110
- .join(" ");
108
+ });
109
+ return formattedBadges.join(" ");
111
110
  };
112
111
  exports.printCustomTags = printCustomTags;
@@ -1 +1 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/graphql/operation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAK3E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,kEAa9B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,kEAYlC,CAAC;AAEF;;;GAGG;AACH,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/graphql/operation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAI3E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,kEAa9B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,kEAYlC,CAAC;AAEF;;;GAGG;AACH,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
package/dist/printer.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * @module printer
8
8
  * @packageDocumentation
9
9
  */
10
- import type { CustomDirectiveMap, GraphQLDirective, GraphQLSchema, IPrinter, MDXString, MDXSupportType, Maybe, MetaOptions, PrintTypeOptions, PrinterConfigPrintTypeOptions, SchemaEntitiesGroupMap, TypeDeprecatedOption } from "@graphql-markdown/types";
10
+ import type { CustomDirectiveMap, Formatter, GraphQLDirective, GraphQLSchema, IPrinter, MDXString, Maybe, MetaInfo, PrinterEventEmitter, PrintTypeOptions, PrinterConfigPrintTypeOptions, SchemaEntitiesGroupMap, TypeDeprecatedOption } from "@graphql-markdown/types";
11
11
  /**
12
12
  * The Printer class implements the core functionality for generating Markdown documentation
13
13
  * from GraphQL schema types.
@@ -31,6 +31,12 @@ export declare class Printer implements IPrinter {
31
31
  * Global printer configuration options
32
32
  */
33
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>;
34
40
  /**
35
41
  * Prints type descriptions
36
42
  */
@@ -44,9 +50,9 @@ export declare class Printer implements IPrinter {
44
50
  */
45
51
  static readonly printCustomTags: (type: unknown, options: PrintTypeOptions) => string | MDXString;
46
52
  /**
47
- * MDX module configuration
53
+ * Prints mdx modules import declaration
48
54
  */
49
- static printMDXModule: Readonly<MDXSupportType>;
55
+ static mdxDeclaration: Readonly<Maybe<string>>;
50
56
  /**
51
57
  * Initializes the printer with the given schema and configuration.
52
58
  *
@@ -54,18 +60,20 @@ export declare class Printer implements IPrinter {
54
60
  * @param baseURL - Base URL path for documentation, e.g. '/docs'
55
61
  * @param linkRoot - Root path for generating links between types
56
62
  * @param options - Configuration options for the printer
57
- * @param mdxParser - Optional MDX parser module for MDX output support
63
+ * @param formatter - Optional formatter functions for customizing output format
64
+ * @param mdxDeclaration - Optional MDX import declaration
65
+ * @param eventEmitter - Optional event emitter for print events interception
58
66
  */
59
67
  static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives }?: {
60
68
  customDirectives?: CustomDirectiveMap;
61
69
  deprecated?: TypeDeprecatedOption;
62
70
  groups?: SchemaEntitiesGroupMap;
63
- meta?: Maybe<MetaOptions>;
71
+ meta?: Maybe<MetaInfo>;
64
72
  metatags?: Record<string, string>[];
65
73
  onlyDocDirectives?: GraphQLDirective[];
66
74
  printTypeOptions?: PrinterConfigPrintTypeOptions;
67
75
  skipDocDirectives?: GraphQLDirective[];
68
- }, mdxParser?: Record<string, unknown>): Promise<void>;
76
+ }, formatter?: Partial<Formatter>, mdxDeclaration?: Maybe<string>, eventEmitter?: Maybe<PrinterEventEmitter>): Promise<void>;
69
77
  /**
70
78
  * Prints the header section of a type documentation
71
79
  *
@@ -83,6 +91,25 @@ export declare class Printer implements IPrinter {
83
91
  * @returns Formatted code block string with type definition
84
92
  */
85
93
  static readonly printCode: (type: unknown, options: PrintTypeOptions) => string;
94
+ /**
95
+ * Prints the GraphQL type definition as code block with event emission support.
96
+ *
97
+ * @param type - GraphQL type to print
98
+ * @param typeName - Name of the type being printed
99
+ * @param options - Printer configuration options
100
+ * @returns Promise resolving to formatted code block string with type definition
101
+ *
102
+ * @remarks
103
+ * This async version emits events before and after code generation:
104
+ * - `print:beforePrintCode` - Emitted before generating code (can modify inputs or prevent default)
105
+ * - `print:afterPrintCode` - Emitted after generating code (can modify output)
106
+ *
107
+ * Event handlers can:
108
+ * - Modify `event.data.options` in BEFORE to affect code generation
109
+ * - Call `event.preventDefault()` in BEFORE to skip default generation and provide custom output
110
+ * - Modify `event.output` in AFTER to change the final result
111
+ */
112
+ static readonly printCodeAsync: (type: unknown, typeName: string, options: PrintTypeOptions) => Promise<string>;
86
113
  /**
87
114
  * Prints example usage of the type if available
88
115
  *
@@ -126,7 +153,7 @@ export declare class Printer implements IPrinter {
126
153
  *
127
154
  * @example
128
155
  * ```typescript
129
- * const doc = Printer.printType('User', UserType, {
156
+ * const doc = await Printer.printType('User', UserType, {
130
157
  * frontMatter: true,
131
158
  * codeSection: true
132
159
  * });
@@ -142,7 +169,11 @@ export declare class Printer implements IPrinter {
142
169
  * - Type metadata
143
170
  * - Example usage
144
171
  * - Related types
172
+ *
173
+ * When an event emitter is configured, emits events:
174
+ * - `print:beforePrintType` - Before generating documentation
175
+ * - `print:afterPrintType` - After generating documentation (output can be modified)
145
176
  */
146
- static readonly printType: (name: Maybe<string>, type: unknown, options?: Maybe<Partial<PrintTypeOptions>>) => Maybe<MDXString>;
177
+ static readonly printType: (name: Maybe<string>, type: unknown, options?: Maybe<Partial<PrintTypeOptions>>) => Promise<Maybe<MDXString>>;
147
178
  }
148
179
  //# sourceMappingURL=printer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAEhB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AA8DjC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IACtC;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAElD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,gBAAgB,gGAAoB;IAEpD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,qBAAqB,uDAAyB;IAE9D;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,mEAAmB;IAElD;;OAEG;IACH,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEhD;;;;;;;;OAQG;IACH,OAAa,IAAI,CACf,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,EAC5B,OAAO,GAAE,KAAK,CAAC,MAAM,CAAY,EACjC,QAAQ,GAAE,KAAK,CAAC,MAAM,CAAO,EAC7B,EACE,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,GAAE;QACD,gBAAgB,CAAC,EAAE,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C,EAC9B,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,GACxC,OAAO,CAAC,IAAI,CAAC,CAyCf;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,mEAYzB;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,uDAwCvB;IAEF;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,kFA8C5B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,uDAmB1B;IAEF;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,mEA2B/B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,mEAQ5B;IAEF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,yEAiB3B;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,gHA4GvB;CACH"}
package/dist/printer.js CHANGED
@@ -10,6 +10,17 @@
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Printer = void 0;
13
+ /**
14
+ * Print type event constants.
15
+ * Duplicated here to avoid circular dependency with \@graphql-markdown/core.
16
+ * These must match the values in core/src/events/print-type-events.ts
17
+ */
18
+ const PrintTypeEvents = {
19
+ BEFORE_PRINT_CODE: "print:beforePrintCode",
20
+ AFTER_PRINT_CODE: "print:afterPrintCode",
21
+ BEFORE_PRINT_TYPE: "print:beforePrintType",
22
+ AFTER_PRINT_TYPE: "print:afterPrintType",
23
+ };
13
24
  const graphql_1 = require("@graphql-markdown/graphql");
14
25
  const utils_1 = require("@graphql-markdown/utils");
15
26
  const relation_1 = require("./relation");
@@ -19,7 +30,7 @@ const frontmatter_1 = require("./frontmatter");
19
30
  const graphql_2 = require("./graphql");
20
31
  const link_1 = require("./link");
21
32
  const strings_1 = require("./const/strings");
22
- const mdx_1 = require("./mdx");
33
+ const formatter_1 = require("./formatter");
23
34
  const options_1 = require("./const/options");
24
35
  const example_1 = require("./example");
25
36
  /**
@@ -53,6 +64,12 @@ class Printer {
53
64
  * Global printer configuration options
54
65
  */
55
66
  static options;
67
+ /**
68
+ * Optional event emitter for print events.
69
+ * When set, the printer will emit events before/after printCode and printType,
70
+ * allowing external code to intercept and modify the output.
71
+ */
72
+ static eventEmitter;
56
73
  /**
57
74
  * Prints type descriptions
58
75
  */
@@ -66,9 +83,9 @@ class Printer {
66
83
  */
67
84
  static printCustomTags = directive_1.printCustomTags;
68
85
  /**
69
- * MDX module configuration
86
+ * Prints mdx modules import declaration
70
87
  */
71
- static printMDXModule;
88
+ static mdxDeclaration;
72
89
  /**
73
90
  * Initializes the printer with the given schema and configuration.
74
91
  *
@@ -76,9 +93,13 @@ class Printer {
76
93
  * @param baseURL - Base URL path for documentation, e.g. '/docs'
77
94
  * @param linkRoot - Root path for generating links between types
78
95
  * @param options - Configuration options for the printer
79
- * @param mdxParser - Optional MDX parser module for MDX output support
96
+ * @param formatter - Optional formatter functions for customizing output format
97
+ * @param mdxDeclaration - Optional MDX import declaration
98
+ * @param eventEmitter - Optional event emitter for print events interception
80
99
  */
81
- static async init(schema, baseURL = "schema", linkRoot = "/", { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, } = DEFAULT_INIT_OPTIONS, mdxParser) {
100
+ static async init(schema, baseURL = "schema", linkRoot = "/", { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, } = DEFAULT_INIT_OPTIONS, formatter, mdxDeclaration, eventEmitter) {
101
+ // Always update eventEmitter regardless of initialization state
102
+ Printer.eventEmitter = eventEmitter ?? null;
82
103
  if (Printer.options !== undefined) {
83
104
  return;
84
105
  }
@@ -102,8 +123,11 @@ class Printer {
102
123
  metatags: metatags ?? [],
103
124
  hierarchy: printTypeOptions?.hierarchy ?? options_1.PRINT_TYPE_DEFAULT_OPTIONS.hierarchy,
104
125
  meta: meta,
126
+ // Merge formatter functions: default formatter with any overrides
127
+ ...(0, formatter_1.createDefaultFormatter)(),
128
+ ...formatter,
105
129
  };
106
- Printer.printMDXModule = await (0, mdx_1.mdxModule)(mdxParser);
130
+ Printer.mdxDeclaration = mdxDeclaration ?? "";
107
131
  }
108
132
  /**
109
133
  * Prints the header section of a type documentation
@@ -162,6 +186,55 @@ class Printer {
162
186
  }
163
187
  return strings_1.MARKDOWN_SOC + code.trim() + strings_1.MARKDOWN_EOC;
164
188
  };
189
+ /**
190
+ * Prints the GraphQL type definition as code block with event emission support.
191
+ *
192
+ * @param type - GraphQL type to print
193
+ * @param typeName - Name of the type being printed
194
+ * @param options - Printer configuration options
195
+ * @returns Promise resolving to formatted code block string with type definition
196
+ *
197
+ * @remarks
198
+ * This async version emits events before and after code generation:
199
+ * - `print:beforePrintCode` - Emitted before generating code (can modify inputs or prevent default)
200
+ * - `print:afterPrintCode` - Emitted after generating code (can modify output)
201
+ *
202
+ * Event handlers can:
203
+ * - Modify `event.data.options` in BEFORE to affect code generation
204
+ * - Call `event.preventDefault()` in BEFORE to skip default generation and provide custom output
205
+ * - Modify `event.output` in AFTER to change the final result
206
+ */
207
+ static printCodeAsync = async (type, typeName, options) => {
208
+ // If no event emitter, just run sync method
209
+ if (!Printer.eventEmitter) {
210
+ return Printer.printCode(type, options);
211
+ }
212
+ // Create mutable event data - handlers can modify options
213
+ const eventData = { type, typeName, options: { ...options } };
214
+ // Emit BEFORE event - handlers can modify inputs or prevent default
215
+ const beforeEvent = {
216
+ data: eventData,
217
+ output: "",
218
+ defaultPrevented: false,
219
+ preventDefault() {
220
+ this.defaultPrevented = true;
221
+ },
222
+ };
223
+ await Printer.eventEmitter.emitAsync(PrintTypeEvents.BEFORE_PRINT_CODE, beforeEvent);
224
+ // If prevented, handlers should have set the output they want
225
+ if (beforeEvent.defaultPrevented) {
226
+ return beforeEvent.output;
227
+ }
228
+ // Generate code using the (potentially modified) options from event data
229
+ const output = Printer.printCode(type, eventData.options);
230
+ // Emit AFTER event - handlers can modify the output
231
+ const afterEvent = {
232
+ data: eventData,
233
+ output,
234
+ };
235
+ await Printer.eventEmitter.emitAsync(PrintTypeEvents.AFTER_PRINT_CODE, afterEvent);
236
+ return afterEvent.output;
237
+ };
165
238
  /**
166
239
  * Prints example usage of the type if available
167
240
  *
@@ -253,7 +326,7 @@ class Printer {
253
326
  *
254
327
  * @example
255
328
  * ```typescript
256
- * const doc = Printer.printType('User', UserType, {
329
+ * const doc = await Printer.printType('User', UserType, {
257
330
  * frontMatter: true,
258
331
  * codeSection: true
259
332
  * });
@@ -269,30 +342,61 @@ class Printer {
269
342
  * - Type metadata
270
343
  * - Example usage
271
344
  * - Related types
345
+ *
346
+ * When an event emitter is configured, emits events:
347
+ * - `print:beforePrintType` - Before generating documentation
348
+ * - `print:afterPrintType` - After generating documentation (output can be modified)
272
349
  */
273
- static printType = (name, type, options) => {
350
+ static printType = async (name, type, options) => {
274
351
  const printTypeOptions = {
275
352
  ...options_1.DEFAULT_OPTIONS,
276
353
  ...Printer.options,
277
354
  ...options,
278
- ...Printer.printMDXModule,
279
355
  };
280
356
  if (!name || !(0, link_1.hasPrintableDirective)(type, printTypeOptions)) {
281
357
  return undefined;
282
358
  }
359
+ // Create event data for potential before event
360
+ const eventData = { type, name, options: printTypeOptions };
361
+ // Emit BEFORE_PRINT_TYPE event if emitter is configured
362
+ if (Printer.eventEmitter) {
363
+ const beforeEvent = {
364
+ data: eventData,
365
+ output: undefined,
366
+ defaultPrevented: false,
367
+ propagationStopped: false,
368
+ preventDefault() {
369
+ this.defaultPrevented = true;
370
+ },
371
+ stopPropagation() {
372
+ this.propagationStopped = true;
373
+ },
374
+ async runDefaultAction() {
375
+ return void 0;
376
+ },
377
+ };
378
+ await Printer.eventEmitter.emitAsync(PrintTypeEvents.BEFORE_PRINT_TYPE, beforeEvent);
379
+ // If prevented, return the output set by handlers (or undefined)
380
+ if (beforeEvent.defaultPrevented) {
381
+ return beforeEvent.output;
382
+ }
383
+ }
283
384
  const header = Printer.printHeader(name, (0, graphql_1.getTypeName)(type), printTypeOptions);
284
385
  const metatags = Printer.printMetaTags(type, printTypeOptions);
285
386
  const description = Printer.printDescription(type, printTypeOptions);
286
- const code = Printer.printCode(type, printTypeOptions);
387
+ // Use async code printing when event emitter is configured
388
+ const code = Printer.eventEmitter
389
+ ? await Printer.printCodeAsync(type, name, printTypeOptions)
390
+ : Printer.printCode(type, printTypeOptions);
287
391
  const customDirectives = Printer.printCustomDirectives(type, printTypeOptions);
288
392
  const tags = Printer.printCustomTags(type, printTypeOptions);
289
393
  const metadata = Printer.printTypeMetadata(type, printTypeOptions);
290
394
  const relations = Printer.printRelations(type, printTypeOptions);
291
395
  const example = Printer.printExample(type, printTypeOptions);
292
- return [
396
+ let output = [
293
397
  header,
294
398
  metatags,
295
- Printer.printMDXModule.mdxDeclaration,
399
+ Printer.mdxDeclaration,
296
400
  tags,
297
401
  description,
298
402
  code,
@@ -303,6 +407,27 @@ class Printer {
303
407
  ]
304
408
  .join(strings_1.MARKDOWN_EOP)
305
409
  .trim();
410
+ // Emit AFTER_PRINT_TYPE event if emitter is configured
411
+ if (Printer.eventEmitter) {
412
+ const afterEvent = {
413
+ data: eventData,
414
+ output,
415
+ defaultPrevented: false,
416
+ propagationStopped: false,
417
+ preventDefault() {
418
+ this.defaultPrevented = true;
419
+ },
420
+ stopPropagation() {
421
+ this.propagationStopped = true;
422
+ },
423
+ async runDefaultAction() {
424
+ return void 0;
425
+ },
426
+ };
427
+ await Printer.eventEmitter.emitAsync(PrintTypeEvents.AFTER_PRINT_TYPE, afterEvent);
428
+ output = afterEvent.output;
429
+ }
430
+ return output;
306
431
  };
307
432
  }
308
433
  exports.Printer = Printer;
package/dist/relation.js CHANGED
@@ -101,10 +101,9 @@ const printRelations = (type, options) => {
101
101
  getRelation: graphql_1.getRelationOfImplementation,
102
102
  },
103
103
  };
104
- let data = "";
105
- for (const { section, getRelation } of Object.values(relations)) {
106
- data += (0, exports.printRelationOf)(type, section, getRelation, options);
107
- }
108
- return data;
104
+ const relationResults = Object.values(relations).map(({ section, getRelation }) => {
105
+ return (0, exports.printRelationOf)(type, section, getRelation, options);
106
+ });
107
+ return relationResults.join("");
109
108
  };
110
109
  exports.printRelations = printRelations;
@@ -1 +1 @@
1
- {"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAYjC;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,2DAuCjC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,mEAuBlC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,+FAqC7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,4GAsDxC,CAAC"}
1
+ {"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAYjC;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,2DAuCjC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,mEAwBlC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,+FAqC7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,4GAsDxC,CAAC"}
package/dist/section.js CHANGED
@@ -66,15 +66,17 @@ const printSectionItems = (values, options) => {
66
66
  return "";
67
67
  }
68
68
  const level = ("level" in options && typeof options.level === "number" ? options.level : 4);
69
- return values
70
- .map((v) => {
71
- return (v &&
72
- (0, exports.printSectionItem)(v, {
73
- ...options,
74
- level,
75
- }));
69
+ const items = values
70
+ .filter((v) => {
71
+ return v;
76
72
  })
77
- .join(strings_1.MARKDOWN_EOP);
73
+ .map((v) => {
74
+ return (0, exports.printSectionItem)(v, {
75
+ ...options,
76
+ level,
77
+ });
78
+ });
79
+ return items.join(strings_1.MARKDOWN_EOP);
78
80
  };
79
81
  exports.printSectionItems = printSectionItems;
80
82
  /**
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "bugs": {
6
6
  "url": "https://github.com/graphql-markdown/graphql-markdown/issues"
7
7
  },
8
- "version": "1.12.5",
8
+ "version": "1.13.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -55,11 +55,11 @@
55
55
  "build": "tsgo --build"
56
56
  },
57
57
  "dependencies": {
58
- "@graphql-markdown/graphql": "^1.1.9",
59
- "@graphql-markdown/utils": "^1.9.1"
58
+ "@graphql-markdown/graphql": "workspace:^",
59
+ "@graphql-markdown/utils": "workspace:^"
60
60
  },
61
61
  "devDependencies": {
62
- "@graphql-markdown/types": "^1.9.0"
62
+ "@graphql-markdown/types": "workspace:^"
63
63
  },
64
64
  "resolutions": {
65
65
  "micromatch": "4.0.8"