@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
@@ -1,16 +1,19 @@
1
1
  /**
2
- * Registers MDX module event handlers with the event emitter.
2
+ * Registers MDX module lifecycle event handlers with the event emitter.
3
3
  *
4
- * Automatically detects and registers any event callback functions defined in the mdxModule
4
+ * Automatically detects and registers any lifecycle hook functions defined in the mdxModule
5
5
  * that match the event callback naming convention. Logs registered handlers at debug level.
6
6
  *
7
+ * Note: Format functions (formatMDXBadge, etc.) are NOT registered as events.
8
+ * They are pure transformations handled via the Formatter interface directly.
9
+ *
7
10
  * @param mdxModule - The MDX module that may contain event callback functions
8
11
  *
9
12
  * @example
10
13
  * ```typescript
11
14
  * const mdxModule = {
12
15
  * beforeLoadSchemaHook: async (event) => { console.log('Loading schema...'); },
13
- * afterRenderTypeEntitiesHook: async (event) => { console.log('Rendered:', event.name); }
16
+ * afterRenderTypeEntitiesHook: async (event) => { console.log('Rendered:', event.data.name); }
14
17
  * };
15
18
  * registerMDXEventHandlers(mdxModule);
16
19
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"event-handlers.d.ts","sourceRoot":"","sources":["../src/event-handlers.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,8BA+BpC,CAAC"}
1
+ {"version":3,"file":"event-handlers.d.ts","sourceRoot":"","sources":["../src/event-handlers.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB,8BAgCpC,CAAC"}
@@ -14,18 +14,21 @@ const logger_1 = require("@graphql-markdown/logger");
14
14
  const event_emitter_1 = require("./event-emitter");
15
15
  const event_map_1 = require("./event-map");
16
16
  /**
17
- * Registers MDX module event handlers with the event emitter.
17
+ * Registers MDX module lifecycle event handlers with the event emitter.
18
18
  *
19
- * Automatically detects and registers any event callback functions defined in the mdxModule
19
+ * Automatically detects and registers any lifecycle hook functions defined in the mdxModule
20
20
  * that match the event callback naming convention. Logs registered handlers at debug level.
21
21
  *
22
+ * Note: Format functions (formatMDXBadge, etc.) are NOT registered as events.
23
+ * They are pure transformations handled via the Formatter interface directly.
24
+ *
22
25
  * @param mdxModule - The MDX module that may contain event callback functions
23
26
  *
24
27
  * @example
25
28
  * ```typescript
26
29
  * const mdxModule = {
27
30
  * beforeLoadSchemaHook: async (event) => { console.log('Loading schema...'); },
28
- * afterRenderTypeEntitiesHook: async (event) => { console.log('Rendered:', event.name); }
31
+ * afterRenderTypeEntitiesHook: async (event) => { console.log('Rendered:', event.data.name); }
29
32
  * };
30
33
  * registerMDXEventHandlers(mdxModule);
31
34
  * ```
@@ -37,18 +40,18 @@ const registerMDXEventHandlers = (mdxModule) => {
37
40
  (0, event_emitter_1.resetEvents)(); // reset event to avoid duplicate registrations
38
41
  const events = (0, event_emitter_1.getEvents)();
39
42
  const registeredHandlers = new Set();
40
- // Iterate through event callback mappings
43
+ // Iterate through event callback mappings (lifecycle hooks only)
41
44
  for (const [eventName, callbackName] of Object.entries(event_map_1.EVENT_CALLBACK_MAP)) {
42
45
  // Check if mdxModule has this callback function
43
46
  if (callbackName in mdxModule &&
44
47
  typeof mdxModule[callbackName] === "function") {
45
- const handler = mdxModule[callbackName];
46
- events.on(eventName, handler);
48
+ const mdxFunction = mdxModule[callbackName];
49
+ events.on(eventName, mdxFunction);
47
50
  registeredHandlers.add(callbackName);
48
51
  }
49
52
  }
50
53
  if (registeredHandlers.size > 0) {
51
- (0, logger_1.log)(`Registered MDX event handlers: ${[...registeredHandlers].join(", ")}`, logger_1.LogLevel.debug);
54
+ (0, logger_1.log)(`Registered MDX lifecycle handlers: ${[...registeredHandlers].join(", ")}`, logger_1.LogLevel.debug);
52
55
  }
53
56
  };
54
57
  exports.registerMDXEventHandlers = registerMDXEventHandlers;
@@ -1,6 +1,9 @@
1
1
  /**
2
2
  * Event callback mapping configuration.
3
3
  * Maps event names to their corresponding callback names in mdxModule.
4
+ *
5
+ * Note: Format functions (formatMDXBadge, formatMDXAdmonition, etc.) are NOT included here.
6
+ * They are pure transformations handled via the Formatter interface, not events.
4
7
  */
5
8
  export declare const EVENT_CALLBACK_MAP: {
6
9
  readonly "schema:beforeLoad": "beforeLoadSchemaHook";
@@ -1 +1 @@
1
- {"version":3,"file":"event-map.d.ts","sourceRoot":"","sources":["../src/event-map.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;CAerB,CAAC"}
1
+ {"version":3,"file":"event-map.d.ts","sourceRoot":"","sources":["../src/event-map.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;CAerB,CAAC"}
package/dist/event-map.js CHANGED
@@ -18,6 +18,9 @@ const generate_index_metafile_events_1 = require("./events/generate-index-metafi
18
18
  /**
19
19
  * Event callback mapping configuration.
20
20
  * Maps event names to their corresponding callback names in mdxModule.
21
+ *
22
+ * Note: Format functions (formatMDXBadge, formatMDXAdmonition, etc.) are NOT included here.
23
+ * They are pure transformations handled via the Formatter interface, not events.
21
24
  */
22
25
  exports.EVENT_CALLBACK_MAP = {
23
26
  [schema_events_1.SchemaEvents.BEFORE_LOAD]: "beforeLoadSchemaHook",
@@ -19,6 +19,10 @@ import type { DefaultAction } from "@graphql-markdown/types";
19
19
  * ```
20
20
  */
21
21
  export declare const deepFreeze: <T extends Record<PropertyKey, any>>(obj: T) => T;
22
+ export interface CancellableEventOptions {
23
+ defaultAction?: DefaultAction;
24
+ cancellable?: boolean;
25
+ }
22
26
  /**
23
27
  * Base class for all cancellable events in GraphQL-Markdown.
24
28
  *
@@ -54,10 +58,11 @@ export declare abstract class CancellableEvent {
54
58
  /**
55
59
  * Creates a new CancellableEvent.
56
60
  *
57
- * @param cancellable - Whether this event can be cancelled (default: true)
58
- * @param defaultAction - Optional function to execute as default action
61
+ * @param options - Configuration options for the event
62
+ * @param options.cancellable - Whether this event can be cancelled (default: true)
63
+ * @param options.defaultAction - Optional function to execute as default action
59
64
  */
60
- constructor(cancellable?: boolean, defaultAction?: DefaultAction);
65
+ constructor(options?: CancellableEventOptions);
61
66
  /**
62
67
  * Gets whether the default action has been prevented.
63
68
  */
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/events/base.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,+CAc3B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,8BAAsB,gBAAgB;IACpC;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAS;IAElC;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAAS;IAEpC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAgB;IAEhD;;;;;OAKG;IACH,YAAY,WAAW,UAAO,EAAE,aAAa,CAAC,EAAE,aAAa,EAG5D;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,OAAO,CAEhC;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,aAAa,GAAG,SAAS,CAE7C;IAED;;;;;;;;;;;;;OAaG;IACH,cAAc,IAAI,IAAI,CAIrB;IAED;;;;;;;;;;;;OAYG;IACH,eAAe,IAAI,IAAI,CAEtB;IAED;;;;;;;;;OASG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKtC;CACF"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/events/base.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,+CAc3B,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,8BAAsB,gBAAgB;IACpC;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAS;IAElC;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAAS;IAEpC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAgB;IAEhD;;;;;;OAMG;IACH,YAAY,OAAO,CAAC,EAAE,uBAAuB,EAG5C;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,OAAO,CAEhC;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,aAAa,GAAG,SAAS,CAE7C;IAED;;;;;;;;;;;;;OAaG;IACH,cAAc,IAAI,IAAI,CAIrB;IAED;;;;;;;;;;;;OAYG;IACH,eAAe,IAAI,IAAI,CAEtB;IAED;;;;;;;;;OASG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKtC;CACF"}
@@ -68,12 +68,13 @@ class CancellableEvent {
68
68
  /**
69
69
  * Creates a new CancellableEvent.
70
70
  *
71
- * @param cancellable - Whether this event can be cancelled (default: true)
72
- * @param defaultAction - Optional function to execute as default action
71
+ * @param options - Configuration options for the event
72
+ * @param options.cancellable - Whether this event can be cancelled (default: true)
73
+ * @param options.defaultAction - Optional function to execute as default action
73
74
  */
74
- constructor(cancellable = true, defaultAction) {
75
- this._cancellable = cancellable;
76
- this._defaultAction = defaultAction;
75
+ constructor(options) {
76
+ this._cancellable = options?.cancellable ?? true;
77
+ this._defaultAction = options?.defaultAction;
77
78
  }
78
79
  /**
79
80
  * Gets whether the default action has been prevented.
@@ -3,23 +3,23 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import type { DefaultAction } from "@graphql-markdown/types";
7
- import { CancellableEvent } from "./base";
6
+ import { CancellableEvent, CancellableEventOptions } from "./base";
8
7
  /**
9
8
  * Event emitted before/after checking schema differences.
10
9
  *
11
10
  * @category Events
12
11
  */
13
12
  export declare class DiffCheckEvent extends CancellableEvent {
14
- /** Current schema being checked */
15
- readonly schema: unknown;
16
- /** Path to output directory for diff results */
17
- readonly outputDir: string;
13
+ /** Event data containing schema, output directory, and change status */
14
+ readonly data: {
15
+ schema?: unknown;
16
+ outputDir?: string;
17
+ schemaHasChanges?: boolean;
18
+ };
18
19
  constructor(data: {
19
- schema: unknown;
20
- outputDir: string;
21
- defaultAction?: DefaultAction;
22
- cancellable?: boolean;
23
- });
20
+ schema?: unknown;
21
+ outputDir?: string;
22
+ schemaHasChanges?: boolean;
23
+ }, options?: CancellableEventOptions);
24
24
  }
25
25
  //# sourceMappingURL=diff-check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-check.d.ts","sourceRoot":"","sources":["../../src/events/diff-check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,gBAAgB;IAClD,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,YAAY,IAAI,EAAE;QAChB,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,EAIA;CACF"}
1
+ {"version":3,"file":"diff-check.d.ts","sourceRoot":"","sources":["../../src/events/diff-check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,gBAAgB;IAClD,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE;QACb,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;IAEF,YACE,IAAI,EAAE;QACJ,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,EACD,OAAO,CAAC,EAAE,uBAAuB,EAIlC;CACF"}
@@ -13,14 +13,11 @@ const base_1 = require("./base");
13
13
  * @category Events
14
14
  */
15
15
  class DiffCheckEvent extends base_1.CancellableEvent {
16
- /** Current schema being checked */
17
- schema;
18
- /** Path to output directory for diff results */
19
- outputDir;
20
- constructor(data) {
21
- super(data.cancellable, data.defaultAction);
22
- this.schema = data.schema;
23
- this.outputDir = data.outputDir;
16
+ /** Event data containing schema, output directory, and change status */
17
+ data;
18
+ constructor(data, options) {
19
+ super(options);
20
+ this.data = data;
24
21
  }
25
22
  }
26
23
  exports.DiffCheckEvent = DiffCheckEvent;
@@ -3,26 +3,23 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import type { DefaultAction } from "@graphql-markdown/types";
7
- import { CancellableEvent } from "./base";
6
+ import { CancellableEvent, CancellableEventOptions } from "./base";
8
7
  /**
9
8
  * Event emitted before/after generating index metafile.
10
9
  *
11
10
  * @category Events
12
11
  */
13
12
  export declare class GenerateIndexMetafileEvent extends CancellableEvent {
14
- /** Directory path for the index file */
15
- readonly dirPath: string;
16
- /** Category name */
17
- readonly category: string;
18
- /** Optional configuration options */
19
- readonly options?: Record<string, unknown>;
13
+ /** Event data containing directory path, category, and options */
14
+ readonly data: {
15
+ dirPath: string;
16
+ category: string;
17
+ options?: Record<string, unknown>;
18
+ };
20
19
  constructor(data: {
21
20
  dirPath: string;
22
21
  category: string;
23
22
  options?: Record<string, unknown>;
24
- defaultAction?: DefaultAction;
25
- cancellable?: boolean;
26
- });
23
+ }, options?: CancellableEventOptions);
27
24
  }
28
25
  //# sourceMappingURL=generate-index-metafile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-index-metafile.d.ts","sourceRoot":"","sources":["../../src/events/generate-index-metafile.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,gBAAgB;IAC9D,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE3C,YAAY,IAAI,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,EAKA;CACF"}
1
+ {"version":3,"file":"generate-index-metafile.d.ts","sourceRoot":"","sources":["../../src/events/generate-index-metafile.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,gBAAgB;IAC9D,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;IAEF,YACE,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,EACD,OAAO,CAAC,EAAE,uBAAuB,EAIlC;CACF"}
@@ -13,17 +13,11 @@ const base_1 = require("./base");
13
13
  * @category Events
14
14
  */
15
15
  class GenerateIndexMetafileEvent extends base_1.CancellableEvent {
16
- /** Directory path for the index file */
17
- dirPath;
18
- /** Category name */
19
- category;
20
- /** Optional configuration options */
21
- options;
22
- constructor(data) {
23
- super(data.cancellable, data.defaultAction);
24
- this.dirPath = data.dirPath;
25
- this.category = data.category;
26
- this.options = data.options;
16
+ /** Event data containing directory path, category, and options */
17
+ data;
18
+ constructor(data, options) {
19
+ super(options);
20
+ this.data = data;
27
21
  }
28
22
  }
29
23
  exports.GenerateIndexMetafileEvent = GenerateIndexMetafileEvent;
@@ -10,7 +10,7 @@ export { RenderRootTypesEvents } from "./render-root-types-events";
10
10
  export { RenderHomepageEvents } from "./render-homepage-events";
11
11
  export { RenderTypeEntitiesEvents } from "./render-type-entities-events";
12
12
  export { GenerateIndexMetafileEvents } from "./generate-index-metafile-events";
13
- export { SchemaLoadEvent } from "./schema-load";
13
+ export { SchemaEvent } from "./schema-load";
14
14
  export { DiffCheckEvent } from "./diff-check";
15
15
  export { RenderRootTypesEvent } from "./render-root-types";
16
16
  export { RenderHomepageEvent } from "./render-homepage";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG/E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * @packageDocumentation
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.GenerateIndexMetafileEvent = exports.RenderTypeEntitiesEvent = exports.RenderHomepageEvent = exports.RenderRootTypesEvent = exports.DiffCheckEvent = exports.SchemaLoadEvent = exports.GenerateIndexMetafileEvents = exports.RenderTypeEntitiesEvents = exports.RenderHomepageEvents = exports.RenderRootTypesEvents = exports.DiffEvents = exports.SchemaEvents = exports.deepFreeze = exports.CancellableEvent = void 0;
8
+ exports.GenerateIndexMetafileEvent = exports.RenderTypeEntitiesEvent = exports.RenderHomepageEvent = exports.RenderRootTypesEvent = exports.DiffCheckEvent = exports.SchemaEvent = exports.GenerateIndexMetafileEvents = exports.RenderTypeEntitiesEvents = exports.RenderHomepageEvents = exports.RenderRootTypesEvents = exports.DiffEvents = exports.SchemaEvents = exports.deepFreeze = exports.CancellableEvent = void 0;
9
9
  // Base
10
10
  const base_1 = require("./base");
11
11
  Object.defineProperty(exports, "CancellableEvent", { enumerable: true, get: function () { return base_1.CancellableEvent; } });
@@ -25,7 +25,7 @@ const generate_index_metafile_events_1 = require("./generate-index-metafile-even
25
25
  Object.defineProperty(exports, "GenerateIndexMetafileEvents", { enumerable: true, get: function () { return generate_index_metafile_events_1.GenerateIndexMetafileEvents; } });
26
26
  // Event classes
27
27
  const schema_load_1 = require("./schema-load");
28
- Object.defineProperty(exports, "SchemaLoadEvent", { enumerable: true, get: function () { return schema_load_1.SchemaLoadEvent; } });
28
+ Object.defineProperty(exports, "SchemaEvent", { enumerable: true, get: function () { return schema_load_1.SchemaEvent; } });
29
29
  const diff_check_1 = require("./diff-check");
30
30
  Object.defineProperty(exports, "DiffCheckEvent", { enumerable: true, get: function () { return diff_check_1.DiffCheckEvent; } });
31
31
  const render_root_types_1 = require("./render-root-types");
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Print type event constants.
3
+ *
4
+ * Events emitted during the printing phase of type documentation generation.
5
+ * These events allow interception and modification of the generated code output.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Event names for printing type documentation.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { getEvents, PrintTypeEvents, PrintTypeEvent } from "@graphql-markdown/core";
15
+ *
16
+ * const events = getEvents();
17
+ * events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintTypeEvent) => {
18
+ * // Modify the generated code
19
+ * event.output = event.output.toUpperCase();
20
+ * });
21
+ * ```
22
+ */
23
+ export declare const PrintTypeEvents: {
24
+ /** Emitted before generating the code block for a type */
25
+ readonly BEFORE_PRINT_CODE: "print:beforePrintCode";
26
+ /** Emitted after generating the code block for a type (output can be modified) */
27
+ readonly AFTER_PRINT_CODE: "print:afterPrintCode";
28
+ /** Emitted before generating the full type documentation */
29
+ readonly BEFORE_PRINT_TYPE: "print:beforePrintType";
30
+ /** Emitted after generating the full type documentation (output can be modified) */
31
+ readonly AFTER_PRINT_TYPE: "print:afterPrintType";
32
+ };
33
+ //# sourceMappingURL=print-type-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-type-events.d.ts","sourceRoot":"","sources":["../../src/events/print-type-events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe;IAC1B,0DAA0D;;IAE1D,kFAAkF;;IAElF,4DAA4D;;IAE5D,oFAAoF;;CAE5E,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * Print type event constants.
4
+ *
5
+ * Events emitted during the printing phase of type documentation generation.
6
+ * These events allow interception and modification of the generated code output.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.PrintTypeEvents = void 0;
12
+ /**
13
+ * Event names for printing type documentation.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { getEvents, PrintTypeEvents, PrintTypeEvent } from "@graphql-markdown/core";
18
+ *
19
+ * const events = getEvents();
20
+ * events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintTypeEvent) => {
21
+ * // Modify the generated code
22
+ * event.output = event.output.toUpperCase();
23
+ * });
24
+ * ```
25
+ */
26
+ exports.PrintTypeEvents = {
27
+ /** Emitted before generating the code block for a type */
28
+ BEFORE_PRINT_CODE: "print:beforePrintCode",
29
+ /** Emitted after generating the code block for a type (output can be modified) */
30
+ AFTER_PRINT_CODE: "print:afterPrintCode",
31
+ /** Emitted before generating the full type documentation */
32
+ BEFORE_PRINT_TYPE: "print:beforePrintType",
33
+ /** Emitted after generating the full type documentation (output can be modified) */
34
+ AFTER_PRINT_TYPE: "print:afterPrintType",
35
+ };
@@ -0,0 +1,84 @@
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 { MDXString, Maybe, PrintTypeOptions } from "@graphql-markdown/types";
9
+ import { CancellableEvent, CancellableEventOptions } from "./base";
10
+ /**
11
+ * Data payload for print code events.
12
+ */
13
+ export interface PrintCodeEventData {
14
+ /** The GraphQL type being printed */
15
+ readonly type: unknown;
16
+ /** The name of the type */
17
+ readonly typeName: string;
18
+ /** The print options in effect */
19
+ readonly options: PrintTypeOptions;
20
+ }
21
+ /**
22
+ * Event emitted before/after generating the code block for a GraphQL type.
23
+ *
24
+ * The `output` property is mutable, allowing event handlers to modify
25
+ * the generated code before it's included in the documentation.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
30
+ * // Add a comment to all generated code
31
+ * event.output = `# Auto-generated\n${event.output}`;
32
+ * });
33
+ * ```
34
+ *
35
+ * @category Events
36
+ */
37
+ export declare class PrintCodeEvent extends CancellableEvent {
38
+ /** Read-only event data */
39
+ readonly data: PrintCodeEventData;
40
+ /**
41
+ * The generated code output.
42
+ * Handlers can modify this property to change the final output.
43
+ */
44
+ output: string;
45
+ constructor(data: PrintCodeEventData, initialOutput: string, options?: CancellableEventOptions);
46
+ }
47
+ /**
48
+ * Data payload for print type events.
49
+ */
50
+ export interface PrintTypeEventData {
51
+ /** The GraphQL type being printed */
52
+ readonly type: unknown;
53
+ /** The name identifier for the type */
54
+ readonly name: Maybe<string>;
55
+ /** The print options in effect */
56
+ readonly options: PrintTypeOptions;
57
+ }
58
+ /**
59
+ * Event emitted before/after generating the full documentation for a GraphQL type.
60
+ *
61
+ * The `output` property is mutable, allowing event handlers to modify
62
+ * the complete generated documentation.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
67
+ * // Add a footer to all type documentation
68
+ * event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
69
+ * });
70
+ * ```
71
+ *
72
+ * @category Events
73
+ */
74
+ export declare class PrintTypeEvent extends CancellableEvent {
75
+ /** Read-only event data */
76
+ readonly data: PrintTypeEventData;
77
+ /**
78
+ * The generated documentation output.
79
+ * Handlers can modify this property to change the final output.
80
+ */
81
+ output: Maybe<MDXString>;
82
+ constructor(data: PrintTypeEventData, initialOutput: Maybe<MDXString>, options?: CancellableEventOptions);
83
+ }
84
+ //# sourceMappingURL=print-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-type.d.ts","sourceRoot":"","sources":["../../src/events/print-type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,2BAA2B;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cAAe,SAAQ,gBAAgB;IAClD,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAElC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf,YACE,IAAI,EAAE,kBAAkB,EACxB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,uBAAuB,EAKlC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cAAe,SAAQ,gBAAgB;IAClD,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAElC;;;OAGG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAEzB,YACE,IAAI,EAAE,kBAAkB,EACxB,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,EAC/B,OAAO,CAAC,EAAE,uBAAuB,EAKlC;CACF"}
@@ -0,0 +1,73 @@
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.PrintTypeEvent = exports.PrintCodeEvent = void 0;
11
+ const base_1 = require("./base");
12
+ /**
13
+ * Event emitted before/after generating the code block 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 base_1.CancellableEvent {
29
+ /** Read-only event data */
30
+ data;
31
+ /**
32
+ * The generated code output.
33
+ * Handlers can modify this property to change the final output.
34
+ */
35
+ output;
36
+ constructor(data, initialOutput, options) {
37
+ super(options);
38
+ this.data = data;
39
+ this.output = initialOutput;
40
+ }
41
+ }
42
+ exports.PrintCodeEvent = PrintCodeEvent;
43
+ /**
44
+ * Event emitted before/after generating the full documentation for a GraphQL type.
45
+ *
46
+ * The `output` property is mutable, allowing event handlers to modify
47
+ * the complete generated documentation.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
52
+ * // Add a footer to all type documentation
53
+ * event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
54
+ * });
55
+ * ```
56
+ *
57
+ * @category Events
58
+ */
59
+ class PrintTypeEvent extends base_1.CancellableEvent {
60
+ /** Read-only event data */
61
+ data;
62
+ /**
63
+ * The generated documentation output.
64
+ * Handlers can modify this property to change the final output.
65
+ */
66
+ output;
67
+ constructor(data, initialOutput, options) {
68
+ super(options);
69
+ this.data = data;
70
+ this.output = initialOutput;
71
+ }
72
+ }
73
+ exports.PrintTypeEvent = PrintTypeEvent;
@@ -3,20 +3,19 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import type { DefaultAction } from "@graphql-markdown/types";
7
- import { CancellableEvent } from "./base";
6
+ import { CancellableEvent, CancellableEventOptions } from "./base";
8
7
  /**
9
8
  * Event emitted before/after rendering homepage.
10
9
  *
11
10
  * @category Events
12
11
  */
13
12
  export declare class RenderHomepageEvent extends CancellableEvent {
14
- /** Output directory for homepage */
15
- readonly outputDir: string;
13
+ /** Event data containing output directory */
14
+ readonly data: {
15
+ outputDir: string;
16
+ };
16
17
  constructor(data: {
17
18
  outputDir: string;
18
- defaultAction?: DefaultAction;
19
- cancellable?: boolean;
20
- });
19
+ }, options?: CancellableEventOptions);
21
20
  }
22
21
  //# sourceMappingURL=render-homepage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-homepage.d.ts","sourceRoot":"","sources":["../../src/events/render-homepage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,oCAAoC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,YAAY,IAAI,EAAE;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,EAGA;CACF"}
1
+ {"version":3,"file":"render-homepage.d.ts","sourceRoot":"","sources":["../../src/events/render-homepage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAEF,YACE,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;KACnB,EACD,OAAO,CAAC,EAAE,uBAAuB,EAIlC;CACF"}
@@ -13,11 +13,11 @@ const base_1 = require("./base");
13
13
  * @category Events
14
14
  */
15
15
  class RenderHomepageEvent extends base_1.CancellableEvent {
16
- /** Output directory for homepage */
17
- outputDir;
18
- constructor(data) {
19
- super(data.cancellable, data.defaultAction);
20
- this.outputDir = data.outputDir;
16
+ /** Event data containing output directory */
17
+ data;
18
+ constructor(data, options) {
19
+ super(options);
20
+ this.data = data;
21
21
  }
22
22
  }
23
23
  exports.RenderHomepageEvent = RenderHomepageEvent;
@@ -3,20 +3,19 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import type { DefaultAction } from "@graphql-markdown/types";
7
- import { CancellableEvent } from "./base";
6
+ import { CancellableEvent, CancellableEventOptions } from "./base";
8
7
  /**
9
8
  * Event emitted before/after rendering root types.
10
9
  *
11
10
  * @category Events
12
11
  */
13
12
  export declare class RenderRootTypesEvent extends CancellableEvent {
14
- /** Root types to render */
15
- readonly rootTypes: unknown;
13
+ /** Event data containing root types */
14
+ readonly data: {
15
+ rootTypes: unknown;
16
+ };
16
17
  constructor(data: {
17
18
  rootTypes: unknown;
18
- defaultAction?: DefaultAction;
19
- cancellable?: boolean;
20
- });
19
+ }, options?: CancellableEventOptions);
21
20
  }
22
21
  //# sourceMappingURL=render-root-types.d.ts.map