@graphql-markdown/core 1.17.0 → 1.17.2

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.
Files changed (58) hide show
  1. package/dist/event-handlers.d.ts +6 -3
  2. package/dist/event-handlers.d.ts.map +1 -1
  3. package/dist/event-handlers.js +10 -7
  4. package/dist/event-map.d.ts +3 -0
  5. package/dist/event-map.d.ts.map +1 -1
  6. package/dist/event-map.js +3 -0
  7. package/dist/events/base.d.ts +8 -3
  8. package/dist/events/base.d.ts.map +1 -1
  9. package/dist/events/base.js +6 -5
  10. package/dist/events/diff-check.d.ts +11 -11
  11. package/dist/events/diff-check.d.ts.map +1 -1
  12. package/dist/events/diff-check.js +5 -8
  13. package/dist/events/generate-index-metafile.d.ts +8 -11
  14. package/dist/events/generate-index-metafile.d.ts.map +1 -1
  15. package/dist/events/generate-index-metafile.js +5 -11
  16. package/dist/events/index.d.ts +1 -1
  17. package/dist/events/index.d.ts.map +1 -1
  18. package/dist/events/index.js +2 -2
  19. package/dist/events/print-type-events.d.ts +33 -0
  20. package/dist/events/print-type-events.d.ts.map +1 -0
  21. package/dist/events/print-type-events.js +35 -0
  22. package/dist/events/print-type.d.ts +84 -0
  23. package/dist/events/print-type.d.ts.map +1 -0
  24. package/dist/events/print-type.js +73 -0
  25. package/dist/events/render-homepage.d.ts +6 -7
  26. package/dist/events/render-homepage.d.ts.map +1 -1
  27. package/dist/events/render-homepage.js +5 -5
  28. package/dist/events/render-root-types.d.ts +6 -7
  29. package/dist/events/render-root-types.d.ts.map +1 -1
  30. package/dist/events/render-root-types.js +5 -5
  31. package/dist/events/render-type-entities.d.ts +7 -9
  32. package/dist/events/render-type-entities.d.ts.map +1 -1
  33. package/dist/events/render-type-entities.js +5 -8
  34. package/dist/events/schema-events.d.ts +4 -0
  35. package/dist/events/schema-events.d.ts.map +1 -1
  36. package/dist/events/schema-events.js +4 -0
  37. package/dist/events/schema-load.d.ts +13 -9
  38. package/dist/events/schema-load.d.ts.map +1 -1
  39. package/dist/events/schema-load.js +8 -8
  40. package/dist/generator.d.ts +79 -1
  41. package/dist/generator.d.ts.map +1 -1
  42. package/dist/generator.js +217 -49
  43. package/dist/index.d.ts +7 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +14 -1
  46. package/dist/printer.d.ts +3 -3
  47. package/dist/printer.d.ts.map +1 -1
  48. package/dist/printer.js +3 -3
  49. package/dist/renderer.d.ts +10 -10
  50. package/dist/renderer.d.ts.map +1 -1
  51. package/dist/renderer.js +11 -21
  52. package/package.json +9 -9
  53. package/dist/event-types.d.ts +0 -313
  54. package/dist/event-types.d.ts.map +0 -1
  55. package/dist/event-types.js +0 -309
  56. package/dist/hooks.d.ts +0 -10
  57. package/dist/hooks.d.ts.map +0 -1
  58. package/dist/hooks.js +0 -33
package/dist/printer.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * This module provides the functionality to load and initialize a printer for GraphQL schema documentation.
5
5
  * It dynamically imports a printer module and configures it with the provided schema and options.
6
6
  */
7
- import type { IPrinter, Maybe, PackageName, PrinterConfig, PrinterOptions } from "@graphql-markdown/types";
7
+ import type { Formatter, IPrinter, Maybe, PackageName, PrinterConfig, PrinterOptions } from "@graphql-markdown/types";
8
8
  /**
9
9
  * Loads and initializes a printer module for GraphQL schema documentation.
10
10
  *
@@ -15,7 +15,7 @@ import type { IPrinter, Maybe, PackageName, PrinterConfig, PrinterOptions } from
15
15
  * @param printerModule - The name/path of the printer module to load
16
16
  * @param config - Configuration for the printer including schema, baseURL, and linkRoot
17
17
  * @param options - Additional options for customizing the printer's behavior
18
- * @param mdxModule - Optional MDX module for MDX-specific functionality
18
+ * @param formatter - Optional formatter functions for customizing output format (e.g., MDX)
19
19
  *
20
20
  * @returns A promise that resolves to the initialized Printer instance
21
21
  *
@@ -49,5 +49,5 @@ import type { IPrinter, Maybe, PackageName, PrinterConfig, PrinterOptions } from
49
49
  * const output = printer.printSchema();
50
50
  * ```
51
51
  */
52
- export declare const getPrinter: (printerModule?: Maybe<PackageName>, config?: Maybe<PrinterConfig>, options?: Maybe<PrinterOptions>, mdxModule?: unknown) => Promise<typeof IPrinter>;
52
+ export declare const getPrinter: (printerModule?: Maybe<PackageName>, config?: Maybe<PrinterConfig>, options?: Maybe<PrinterOptions>, formatter?: Partial<Formatter> | undefined, mdxDeclaration?: Maybe<string>) => Promise<typeof IPrinter>;
53
53
  //# sourceMappingURL=printer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,QAAQ,EACR,KAAK,EACL,WAAW,EAEX,aAAa,EACb,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,UAAU,uJA0BtB,CAAC"}
1
+ {"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,KAAK,EACL,WAAW,EAEX,aAAa,EACb,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,UAAU,8MAkCtB,CAAC"}
package/dist/printer.js CHANGED
@@ -44,7 +44,7 @@ exports.getPrinter = void 0;
44
44
  * @param printerModule - The name/path of the printer module to load
45
45
  * @param config - Configuration for the printer including schema, baseURL, and linkRoot
46
46
  * @param options - Additional options for customizing the printer's behavior
47
- * @param mdxModule - Optional MDX module for MDX-specific functionality
47
+ * @param formatter - Optional formatter functions for customizing output format (e.g., MDX)
48
48
  *
49
49
  * @returns A promise that resolves to the initialized Printer instance
50
50
  *
@@ -78,7 +78,7 @@ exports.getPrinter = void 0;
78
78
  * const output = printer.printSchema();
79
79
  * ```
80
80
  */
81
- const getPrinter = async (printerModule, config, options, mdxModule) => {
81
+ const getPrinter = async (printerModule, config, options, formatter, mdxDeclaration) => {
82
82
  if (typeof printerModule !== "string") {
83
83
  throw new TypeError("Invalid printer module name.");
84
84
  }
@@ -88,7 +88,7 @@ const getPrinter = async (printerModule, config, options, mdxModule) => {
88
88
  try {
89
89
  const { Printer } = await Promise.resolve(`${printerModule}`).then(s => __importStar(require(s)));
90
90
  const { schema, baseURL, linkRoot } = config;
91
- await Printer.init(schema, baseURL, linkRoot, { ...options }, mdxModule);
91
+ await Printer.init(schema, baseURL, linkRoot, { ...options }, formatter, mdxDeclaration);
92
92
  return Printer;
93
93
  }
94
94
  catch {
@@ -75,12 +75,12 @@ export interface CategoryMetafileOptions {
75
75
  * @example
76
76
  */
77
77
  export declare class Renderer {
78
- group: Maybe<SchemaEntitiesGroupMap>;
79
- outputDir: string;
80
- baseURL: string;
81
- prettify: boolean;
82
- options: Maybe<RendererDocOptions>;
83
- mdxModule: unknown;
78
+ readonly group: Maybe<SchemaEntitiesGroupMap>;
79
+ readonly outputDir: string;
80
+ readonly baseURL: string;
81
+ readonly prettify: boolean;
82
+ readonly options: Maybe<RendererDocOptions>;
83
+ readonly mdxExtension: string;
84
84
  private readonly printer;
85
85
  private readonly rootLevelPositionManager;
86
86
  private readonly categoryPositionManager;
@@ -93,10 +93,10 @@ export declare class Renderer {
93
93
  * @param group - Optional grouping configuration for schema entities
94
94
  * @param prettify - Whether to format the generated markdown
95
95
  * @param docOptions - Additional documentation options
96
- * @param mdxModule - Optional MDX module for enhanced documentation features
96
+ * @param mdxExtension - Optional MDX file extension to use
97
97
  * @example
98
98
  */
99
- constructor(printer: Printer, outputDir: string, baseURL: string, group: Maybe<SchemaEntitiesGroupMap>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxModule?: unknown);
99
+ constructor(printer: Printer, outputDir: string, baseURL: string, group: Maybe<SchemaEntitiesGroupMap>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxExtension: string);
100
100
  /**
101
101
  * Generates an index metafile for a category directory if MDX support is available.
102
102
  *
@@ -228,7 +228,7 @@ export declare class Renderer {
228
228
  * @param group - Optional grouping configuration
229
229
  * @param prettify - Whether to prettify the output markdown
230
230
  * @param docOptions - Additional documentation options
231
- * @param mdxModule - Optional MDX module for enhanced features
231
+ * @param mdxExtension - Extension to use for MDX files
232
232
  * @returns A configured Renderer instance
233
233
  *
234
234
  * @example
@@ -243,5 +243,5 @@ export declare class Renderer {
243
243
  * );
244
244
  * ```
245
245
  */
246
- export declare const getRenderer: (printer: typeof import("@graphql-markdown/types").IPrinter, outputDir: string, baseURL: string, group: Maybe<Partial<Record<SchemaEntity, Record<string, Maybe<string>>>>>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxModule?: unknown) => Promise<Renderer>;
246
+ export declare const getRenderer: (printer: typeof import("@graphql-markdown/types").IPrinter, outputDir: string, baseURL: string, group: Maybe<Partial<Record<SchemaEntity, Record<string, Maybe<string>>>>>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxExtension: string) => Promise<Renderer>;
247
247
  //# sourceMappingURL=renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,QAAQ,EAER,KAAK,EAEL,OAAO,EACP,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EAGb,MAAM,yBAAyB,CAAC;AA2FjC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,2EAS7B,CAAC;AA6CF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OA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AkB,CACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CA+F1B;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,IAAI,CAwClD;IAED;;;;;;;OAOG;IACG,cAAc,CAAC,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCnE;IAED;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAiClC;;;;;;;OAOG;IACH,OAAO,CAAC,wBAAwB;IAiBhC;;;;;;OAMG;IACH,OAAO,CAAC,8BAA8B;IAiCtC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,wBAAwB;CA+BjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW,mRAmBvB,CAAC"}
package/dist/renderer.js CHANGED
@@ -260,7 +260,7 @@ class Renderer {
260
260
  baseURL;
261
261
  prettify;
262
262
  options;
263
- mdxModule;
263
+ mdxExtension;
264
264
  // mdxModuleIndexFileSupport: boolean;
265
265
  printer;
266
266
  rootLevelPositionManager;
@@ -274,17 +274,17 @@ class Renderer {
274
274
  * @param group - Optional grouping configuration for schema entities
275
275
  * @param prettify - Whether to format the generated markdown
276
276
  * @param docOptions - Additional documentation options
277
- * @param mdxModule - Optional MDX module for enhanced documentation features
277
+ * @param mdxExtension - Optional MDX file extension to use
278
278
  * @example
279
279
  */
280
- constructor(printer, outputDir, baseURL, group, prettify, docOptions, mdxModule) {
280
+ constructor(printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension) {
281
281
  this.printer = printer;
282
282
  this.group = group;
283
283
  this.outputDir = outputDir;
284
284
  this.baseURL = baseURL;
285
285
  this.prettify = prettify;
286
286
  this.options = docOptions;
287
- this.mdxModule = mdxModule;
287
+ this.mdxExtension = mdxExtension;
288
288
  // Initialize position managers for different hierarchy levels
289
289
  // rootLevelPositionManager: for root-level categories (Query, Mutation, Deprecated, etc.)
290
290
  this.rootLevelPositionManager = new CategoryPositionManager(docOptions?.categorySort, 1);
@@ -435,19 +435,8 @@ class Renderer {
435
435
  // NOSONAR - pattern is safe, hyphen in character class doesn't cause backtracking
436
436
  const PageRegex = /(?<category>[a-z0-9-]+)[\\/]+(?<pageId>[a-z0-9-]+)\.mdx?$/i; // NOSONAR
437
437
  const PageRegexFlat = /(?<pageId>[a-z0-9-]+)\.mdx?$/i; // NOSONAR
438
- // allow mdxModule to specify custom extension
439
- let extension = "md";
440
- if (this.mdxModule &&
441
- typeof this.mdxModule === "object" &&
442
- "extension" in this.mdxModule &&
443
- typeof this.mdxModule.extension === "string") {
444
- extension = this.mdxModule.extension;
445
- }
446
- else if (this.mdxModule) {
447
- extension = "mdx";
448
- }
449
438
  const fileName = (0, utils_1.slugify)(name);
450
- const filePath = (0, node_path_1.join)((0, node_path_1.normalize)(dirPath), `${fileName}.${extension}`);
439
+ const filePath = (0, node_path_1.join)((0, node_path_1.normalize)(dirPath), `${fileName}${this.mdxExtension}`);
451
440
  let content;
452
441
  try {
453
442
  const printOptions = {
@@ -467,11 +456,12 @@ class Renderer {
467
456
  };
468
457
  content = this.printer.printType(fileName, type, printOptions);
469
458
  if (typeof content !== "string" || content === "") {
459
+ (0, logger_1.log)(`No content generated for "${name}" - printType returned empty`, logger_1.LogLevel.warn);
470
460
  return undefined;
471
461
  }
472
462
  }
473
- catch {
474
- (0, logger_1.log)(`An error occurred while processing "${type}"`, logger_1.LogLevel.warn);
463
+ catch (error) {
464
+ (0, logger_1.log)(`An error occurred while processing "${name}": ${error instanceof Error ? error.message : String(error)}`, logger_1.LogLevel.warn);
475
465
  return undefined;
476
466
  }
477
467
  await (0, utils_1.saveFile)(filePath, content, this.prettify ? utils_1.prettifyMarkdown : undefined);
@@ -726,7 +716,7 @@ exports.Renderer = Renderer;
726
716
  * @param group - Optional grouping configuration
727
717
  * @param prettify - Whether to prettify the output markdown
728
718
  * @param docOptions - Additional documentation options
729
- * @param mdxModule - Optional MDX module for enhanced features
719
+ * @param mdxExtension - Extension to use for MDX files
730
720
  * @returns A configured Renderer instance
731
721
  *
732
722
  * @example
@@ -741,8 +731,8 @@ exports.Renderer = Renderer;
741
731
  * );
742
732
  * ```
743
733
  */
744
- const getRenderer = async (printer, outputDir, baseURL, group, prettify, docOptions, mdxModule) => {
734
+ const getRenderer = async (printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension) => {
745
735
  await (0, utils_1.ensureDir)(outputDir, { forceEmpty: docOptions?.force });
746
- return new Renderer(printer, outputDir, baseURL, group, prettify, docOptions, mdxModule);
736
+ return new Renderer(printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension);
747
737
  };
748
738
  exports.getRenderer = getRenderer;
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.17.0",
8
+ "version": "1.17.2",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -63,18 +63,18 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@fastify/deepmerge": "^3.2.0",
66
- "@graphql-markdown/graphql": "workspace:^",
67
- "@graphql-markdown/logger": "workspace:^",
68
- "@graphql-markdown/utils": "workspace:^"
66
+ "@graphql-markdown/graphql": "^1.1.9",
67
+ "@graphql-markdown/logger": "^1.0.5",
68
+ "@graphql-markdown/utils": "^1.9.1"
69
69
  },
70
70
  "peerDependencies": {
71
- "@graphql-markdown/diff": "workspace:^",
72
- "@graphql-markdown/helpers": "workspace:^",
73
- "@graphql-markdown/printer-legacy": "workspace:^",
74
- "graphql-config": "catalog:"
71
+ "@graphql-markdown/diff": "^1.1.13",
72
+ "@graphql-markdown/helpers": "^1.0.12",
73
+ "@graphql-markdown/printer-legacy": "^1.12.4",
74
+ "graphql-config": "5.1.5"
75
75
  },
76
76
  "devDependencies": {
77
- "@graphql-markdown/types": "workspace:^"
77
+ "@graphql-markdown/types": "^1.9.0"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "@graphql-markdown/printer-legacy": {
@@ -1,313 +0,0 @@
1
- /**
2
- * Event system types and base classes for GraphQL-Markdown events.
3
- *
4
- * @packageDocumentation
5
- */
6
- /**
7
- * Type for default action function that can be executed by events.
8
- * Returns a Promise to support both sync and async actions.
9
- */
10
- export type DefaultAction = () => Promise<void>;
11
- /**
12
- * Deep freezes an object to make it immutable at runtime.
13
- * Recursively freezes all nested objects and arrays.
14
- *
15
- * @param obj - The object to freeze
16
- * @returns The frozen object (same reference)
17
- *
18
- * @example
19
- * ```typescript
20
- * const data = { user: { name: 'John' } };
21
- * deepFreeze(data);
22
- * data.user.name = 'Jane'; // Throws error in strict mode
23
- * ```
24
- */
25
- export declare const deepFreeze: <T>(obj: T) => T;
26
- /**
27
- * Base class for all cancellable events in GraphQL-Markdown.
28
- *
29
- * Provides common functionality:
30
- * - preventDefault() to cancel default actions
31
- * - stopPropagation() to halt handler chain
32
- * - Configurable cancellability
33
- * - Optional default action function
34
- *
35
- * @category Events
36
- */
37
- export declare abstract class CancellableEvent {
38
- /**
39
- * Whether the default action has been prevented.
40
- * Set to true when preventDefault() is called.
41
- */
42
- private _defaultPrevented;
43
- /**
44
- * Whether propagation to remaining handlers has been stopped.
45
- * Set to true when stopPropagation() is called.
46
- */
47
- private _propagationStopped;
48
- /**
49
- * Whether this event can be cancelled.
50
- * If false, preventDefault() has no effect.
51
- */
52
- private readonly _cancellable;
53
- /**
54
- * Optional function to execute as the default action.
55
- * Only runs if preventDefault() was not called.
56
- */
57
- private readonly _defaultAction?;
58
- /**
59
- * Creates a new CancellableEvent.
60
- *
61
- * @param cancellable - Whether this event can be cancelled (default: true)
62
- * @param defaultAction - Optional function to execute as default action
63
- */
64
- constructor(cancellable?: boolean, defaultAction?: DefaultAction);
65
- /**
66
- * Gets whether the default action has been prevented.
67
- */
68
- get defaultPrevented(): boolean;
69
- /**
70
- * Gets whether propagation has been stopped.
71
- */
72
- get propagationStopped(): boolean;
73
- /**
74
- * Gets the default action function if one was provided.
75
- */
76
- get defaultAction(): DefaultAction | undefined;
77
- /**
78
- * Prevents the default action from executing.
79
- * Only works if the event is cancellable.
80
- *
81
- * @example
82
- * ```typescript
83
- * events.on('beforeLoadSchema', (event) => {
84
- * if (shouldUseCustomLoader) {
85
- * event.preventDefault(); // Stops default schema loading
86
- * // Custom logic here
87
- * }
88
- * });
89
- * ```
90
- */
91
- preventDefault(): void;
92
- /**
93
- * Stops propagation to remaining event handlers.
94
- * Handlers registered after the current one will not execute.
95
- *
96
- * @example
97
- * ```typescript
98
- * events.on('beforeLoadSchema', (event) => {
99
- * if (criticalError) {
100
- * event.stopPropagation(); // No more handlers run
101
- * }
102
- * });
103
- * ```
104
- */
105
- stopPropagation(): void;
106
- }
107
- /**
108
- * Event names for schema loading lifecycle.
109
- */
110
- export declare const SchemaEvents: {
111
- /** Emitted before loading GraphQL schema */
112
- readonly BEFORE_LOAD: "beforeLoadSchema";
113
- /** Emitted after loading GraphQL schema */
114
- readonly AFTER_LOAD: "afterLoadSchema";
115
- };
116
- /**
117
- * Event names for diff checking lifecycle.
118
- */
119
- export declare const DiffEvents: {
120
- /** Emitted before checking schema differences */
121
- readonly BEFORE_CHECK: "beforeCheckDiff";
122
- /** Emitted after checking schema differences */
123
- readonly AFTER_CHECK: "afterCheckDiff";
124
- };
125
- /**
126
- * Event names for category collection lifecycle.
127
- */
128
- export declare const CategoryEvents: {
129
- /** Emitted before pre-collecting categories */
130
- readonly BEFORE_PRE_COLLECT: "beforePreCollectCategories";
131
- /** Emitted after pre-collecting categories */
132
- readonly AFTER_PRE_COLLECT: "afterPreCollectCategories";
133
- };
134
- /**
135
- * Event names for rendering lifecycle.
136
- */
137
- export declare const RenderEvents: {
138
- /** Emitted before rendering root types */
139
- readonly BEFORE_RENDER_ROOT_TYPES: "beforeRenderRootTypes";
140
- /** Emitted after rendering root types */
141
- readonly AFTER_RENDER_ROOT_TYPES: "afterRenderRootTypes";
142
- /** Emitted before rendering homepage */
143
- readonly BEFORE_RENDER_HOMEPAGE: "beforeRenderHomepage";
144
- /** Emitted after rendering homepage */
145
- readonly AFTER_RENDER_HOMEPAGE: "afterRenderHomepage";
146
- /** Emitted before rendering type entities */
147
- readonly BEFORE_RENDER_TYPE_ENTITIES: "beforeRenderTypeEntities";
148
- /** Emitted after rendering type entities */
149
- readonly AFTER_RENDER_TYPE_ENTITIES: "afterRenderTypeEntities";
150
- /** Emitted before generating index metafile */
151
- readonly BEFORE_GENERATE_INDEX_METAFILE: "beforeGenerateIndexMetafile";
152
- /** Emitted after generating index metafile */
153
- readonly AFTER_GENERATE_INDEX_METAFILE: "afterGenerateIndexMetafile";
154
- };
155
- /**
156
- * All event names combined.
157
- */
158
- export declare const EventNames: {
159
- /** Emitted before loading GraphQL schema */
160
- readonly BEFORE_LOAD: "beforeLoadSchema";
161
- /** Emitted after loading GraphQL schema */
162
- readonly AFTER_LOAD: "afterLoadSchema";
163
- /** Emitted before checking schema differences */
164
- readonly BEFORE_CHECK: "beforeCheckDiff";
165
- /** Emitted after checking schema differences */
166
- readonly AFTER_CHECK: "afterCheckDiff";
167
- /** Emitted before pre-collecting categories */
168
- readonly BEFORE_PRE_COLLECT: "beforePreCollectCategories";
169
- /** Emitted after pre-collecting categories */
170
- readonly AFTER_PRE_COLLECT: "afterPreCollectCategories";
171
- /** Emitted before rendering root types */
172
- readonly BEFORE_RENDER_ROOT_TYPES: "beforeRenderRootTypes";
173
- /** Emitted after rendering root types */
174
- readonly AFTER_RENDER_ROOT_TYPES: "afterRenderRootTypes";
175
- /** Emitted before rendering homepage */
176
- readonly BEFORE_RENDER_HOMEPAGE: "beforeRenderHomepage";
177
- /** Emitted after rendering homepage */
178
- readonly AFTER_RENDER_HOMEPAGE: "afterRenderHomepage";
179
- /** Emitted before rendering type entities */
180
- readonly BEFORE_RENDER_TYPE_ENTITIES: "beforeRenderTypeEntities";
181
- /** Emitted after rendering type entities */
182
- readonly AFTER_RENDER_TYPE_ENTITIES: "afterRenderTypeEntities";
183
- /** Emitted before generating index metafile */
184
- readonly BEFORE_GENERATE_INDEX_METAFILE: "beforeGenerateIndexMetafile";
185
- /** Emitted after generating index metafile */
186
- readonly AFTER_GENERATE_INDEX_METAFILE: "afterGenerateIndexMetafile";
187
- };
188
- /**
189
- * Event emitted before/after loading a GraphQL schema.
190
- *
191
- * @category Events
192
- */
193
- export declare class SchemaLoadEvent extends CancellableEvent {
194
- /** Path or pointer to the schema location */
195
- readonly schemaLocation: string;
196
- constructor(data: {
197
- schemaLocation: string;
198
- defaultAction?: DefaultAction;
199
- cancellable?: boolean;
200
- });
201
- }
202
- /**
203
- * Event emitted before/after checking schema differences.
204
- *
205
- * @category Events
206
- */
207
- export declare class DiffCheckEvent extends CancellableEvent {
208
- /** Current schema being checked */
209
- readonly schema: unknown;
210
- /** Path to output directory for diff results */
211
- readonly outputDir: string;
212
- constructor(data: {
213
- schema: unknown;
214
- outputDir: string;
215
- defaultAction?: DefaultAction;
216
- cancellable?: boolean;
217
- });
218
- }
219
-
220
- /**
221
- * Event emitted before/after rendering root types.
222
- *
223
- * @category Events
224
- */
225
- export declare class RenderRootTypesEvent extends CancellableEvent {
226
- /** Root types to render */
227
- readonly rootTypes: unknown;
228
- constructor(data: {
229
- rootTypes: unknown;
230
- defaultAction?: DefaultAction;
231
- cancellable?: boolean;
232
- });
233
- }
234
- /**
235
- * Event emitted before/after rendering homepage.
236
- *
237
- * @category Events
238
- */
239
- export declare class RenderHomepageEvent extends CancellableEvent {
240
- /** Output directory for homepage */
241
- readonly outputDir: string;
242
- constructor(data: {
243
- outputDir: string;
244
- defaultAction?: DefaultAction;
245
- cancellable?: boolean;
246
- });
247
- }
248
- /**
249
- * Event emitted before/after rendering type entities.
250
- *
251
- * @category Events
252
- */
253
- export declare class RenderTypeEntitiesEvent extends CancellableEvent {
254
- /** Name of the type entity */
255
- readonly name: string;
256
- /** File path where entity will be rendered */
257
- readonly filePath: string;
258
- constructor(data: {
259
- name: string;
260
- filePath: string;
261
- defaultAction?: DefaultAction;
262
- cancellable?: boolean;
263
- });
264
- }
265
- /**
266
- * Event emitted before/after generating index metafile.
267
- *
268
- * @category Events
269
- */
270
- export declare class GenerateIndexMetafileEvent extends CancellableEvent {
271
- /** Directory path for the index file */
272
- readonly dirPath: string;
273
- /** Category name */
274
- readonly category: string;
275
- /** Optional configuration options */
276
- readonly options?: Record<string, unknown>;
277
- constructor(data: {
278
- dirPath: string;
279
- category: string;
280
- options?: Record<string, unknown>;
281
- defaultAction?: DefaultAction;
282
- cancellable?: boolean;
283
- });
284
- }
285
- /**
286
- * Hook callback for schema loading events.
287
- */
288
- export type SchemaLoadHook = (event: SchemaLoadEvent) => Promise<void>;
289
- /**
290
- * Hook callback for diff check events.
291
- */
292
- export type DiffCheckHook = (event: DiffCheckEvent) => Promise<void>;
293
- /**
294
- * Hook callback for pre-collect categories events.
295
- */
296
- export type PreCollectCategoriesHook = (event: PreCollectCategoriesEvent) => Promise<void>;
297
- /**
298
- * Hook callback for render root types events.
299
- */
300
- export type RenderRootTypesHook = (event: RenderRootTypesEvent) => Promise<void>;
301
- /**
302
- * Hook callback for render homepage events.
303
- */
304
- export type RenderHomepageHook = (event: RenderHomepageEvent) => Promise<void>;
305
- /**
306
- * Hook callback for render type entities events.
307
- */
308
- export type RenderTypeEntitiesHook = (event: RenderTypeEntitiesEvent) => Promise<void>;
309
- /**
310
- * Hook callback for generate index metafile events.
311
- */
312
- export type GenerateIndexMetafileHook = (event: GenerateIndexMetafileEvent) => Promise<void>;
313
- //# sourceMappingURL=event-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-types.d.ts","sourceRoot":"","sources":["../src/event-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,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