@graphql-markdown/core 1.21.2 → 1.22.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/config.d.ts CHANGED
@@ -97,7 +97,7 @@ export declare const DEFAULT_HIERARCHY: {
97
97
  * @public
98
98
  * @see {@link Options} for the complete configuration interface
99
99
  */
100
- export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "customDirective" | "groupByDirective" | "loaders"> & Required<Omit<ConfigOptions, "customDirective" | "formatter" | "groupByDirective" | "loaders" | "mdxParser" | "printTypeOptions">>> & {
100
+ export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "customDirective" | "groupByDirective" | "loaders" | "outputAdapter"> & Required<Omit<ConfigOptions, "customDirective" | "formatter" | "groupByDirective" | "loaders" | "mdxParser" | "outputAdapter" | "printTypeOptions">>> & {
101
101
  printTypeOptions: Required<Omit<ConfigPrintTypeOptions, "exampleSection" | "hierarchy">> & {
102
102
  exampleSection: ConfigPrintTypeOptions["exampleSection"];
103
103
  hierarchy: Required<Pick<TypeHierarchyObjectType, TypeHierarchy.API>>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,KAAK,EACL,OAAO,EAGP,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AASjC;;;;;;;;;;;;GAYG;AACH,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED;;;;;;;;;;;GAWG;AACH,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED;;;;;;;;;;;;GAY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AC,KAC7C,MAAM,CAAC,MAAM,EAAE,KAAK,CAEtB,CAAC;AAwDF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,kBAAkB,iBACf,OAAO,KACpB,KAAK,CAAC,uBAAuB,CAgB/B,CAAC;AAGF,eAAO,MAAM,mBAAmB,gBACjB,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,kBAClB,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,KACpC,KAAK,CAAC,MAAM,CAcd,CAAC;AAmDF,eAAO,MAAM,WAAW,mBACN,KAAK,CAAC,aAAa,CAAC,YAC1B,KAAK,CAAC,UAAU,CAAC,OACvB,KAAK,CAAC,MAAM,CAAC,KAChB,OAAO,CAAC,OAAO,CA8FjB,CAAC"}
package/dist/config.js CHANGED
@@ -101,6 +101,8 @@ exports.ASSET_HOMEPAGE_LOCATION = (0, node_path_1.join)(__dirname, "..", "assets
101
101
  * @public
102
102
  */
103
103
  exports.DEFAULT_HIERARCHY = { [TypeHierarchy.API]: {} };
104
+ /** Memoised OS temp path, resolved on the first read of `DEFAULT_OPTIONS.tmpDir`. */
105
+ let defaultTmpDir;
104
106
  /**
105
107
  * Default configuration options used when no user options are provided.
106
108
  * These values serve as fallbacks for any missing configuration.
@@ -134,7 +136,14 @@ exports.DEFAULT_OPTIONS = {
134
136
  },
135
137
  rootPath: "./docs",
136
138
  schema: "./schema.graphql",
137
- tmpDir: (0, node_path_1.join)((0, node_os_1.tmpdir)(), exports.PACKAGE_NAME),
139
+ // Lazy: as a plain property this ran `tmpdir()` at module load, so merely
140
+ // importing the config module touched the OS temp path even for runs that
141
+ // never diff. The getter defers it to the point a default is actually needed,
142
+ // and memoises it since a single build reads it more than once.
143
+ get tmpDir() {
144
+ defaultTmpDir ??= (0, node_path_1.join)((0, node_os_1.tmpdir)(), exports.PACKAGE_NAME);
145
+ return defaultTmpDir;
146
+ },
138
147
  skipDocDirective: [],
139
148
  onlyDocDirective: [],
140
149
  };
@@ -155,7 +164,6 @@ exports.DEFAULT_OPTIONS = {
155
164
  * ```
156
165
  */
157
166
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
158
- // fallow-ignore-next-line unused-export
159
167
  const getDocDirective = (name) => {
160
168
  if (typeof name !== "string" || !patterns_1.PATTERNS.DIRECTIVE_NAME.test(name)) {
161
169
  throw new Error(`Invalid "${name}"`);
@@ -291,7 +299,6 @@ exports.getVisibilityDirectives = getVisibilityDirectives;
291
299
  * @see {@link DOCS_URL}/advanced/custom-directive for custom directive format documentation
292
300
  */
293
301
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
294
- // fallow-ignore-next-line unused-export
295
302
  const getCustomDirectives = (customDirectiveOptions, skipDocDirective) => {
296
303
  if (!customDirectiveOptions ||
297
304
  Object.keys(customDirectiveOptions).length === 0) {
@@ -326,7 +333,6 @@ exports.getCustomDirectives = getCustomDirectives;
326
333
  * @see {@link DiffMethod} for available diff methods
327
334
  */
328
335
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
329
- // fallow-ignore-next-line unused-export
330
336
  const getForcedDiffMethod = () => {
331
337
  return DiffMethod.FORCE;
332
338
  };
@@ -335,13 +341,11 @@ const getNormalizedDiffMethod = (diff) => {
335
341
  return diff.toLocaleUpperCase();
336
342
  };
337
343
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
338
- // fallow-ignore-next-line unused-export
339
344
  const getDiffMethod = (diff) => {
340
345
  return getNormalizedDiffMethod(diff);
341
346
  };
342
347
  exports.getDiffMethod = getDiffMethod;
343
348
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
344
- // fallow-ignore-next-line unused-export
345
349
  const parseDeprecatedDocOptions = (_cliOpts, _configOptions) => {
346
350
  return {};
347
351
  };
@@ -367,7 +371,6 @@ exports.parseDeprecatedDocOptions = parseDeprecatedDocOptions;
367
371
  * ```
368
372
  */
369
373
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
370
- // fallow-ignore-next-line unused-export
371
374
  const getDocOptions = (cliOpts, configOptions) => {
372
375
  const deprecated = (0, exports.parseDeprecatedDocOptions)(cliOpts, configOptions);
373
376
  const cliIndex = typeof cliOpts?.index === "boolean" ? cliOpts.index : undefined;
@@ -383,6 +386,10 @@ const getDocOptions = (cliOpts, configOptions) => {
383
386
  ...deprecated,
384
387
  ...configOptions?.frontMatter,
385
388
  },
389
+ // the framework name and version are set by the framework plugin, and are
390
+ // needed by the formatters to adjust their output to the target version
391
+ generatorFrameworkName: configOptions?.generatorFrameworkName,
392
+ generatorFrameworkVersion: configOptions?.generatorFrameworkVersion,
386
393
  index,
387
394
  sectionHeaderId,
388
395
  };
@@ -413,7 +420,6 @@ exports.getDocOptions = getDocOptions;
413
420
  * @see {@link TypeHierarchy} for available hierarchy types
414
421
  */
415
422
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
416
- // fallow-ignore-next-line unused-export
417
423
  const getTypeHierarchyOption = (cliOption, configOption) => {
418
424
  const parseValue = (config) => {
419
425
  if (typeof config === "string") {
@@ -446,7 +452,6 @@ const getTypeHierarchyOption = (cliOption, configOption) => {
446
452
  };
447
453
  exports.getTypeHierarchyOption = getTypeHierarchyOption;
448
454
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
449
- // fallow-ignore-next-line unused-export
450
455
  const parseDeprecatedFormatterOption = (cliOpts, configOptions) => {
451
456
  const legacyCli = cliOpts?.mdxParser ?? null; // NOSONAR typescript:S1874
452
457
  const legacyConfig = configOptions?.mdxParser; // NOSONAR typescript:S1874
@@ -458,7 +463,6 @@ const parseDeprecatedFormatterOption = (cliOpts, configOptions) => {
458
463
  };
459
464
  exports.parseDeprecatedFormatterOption = parseDeprecatedFormatterOption;
460
465
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
461
- // fallow-ignore-next-line unused-export
462
466
  const parseDeprecatedPrintTypeOptions = (_cliOpts, _configOptions) => {
463
467
  return {};
464
468
  };
@@ -533,7 +537,6 @@ const getPrintTypeOptions = (cliOpts, configOptions) => {
533
537
  * ```
534
538
  */
535
539
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
536
- // fallow-ignore-next-line unused-export
537
540
  const parseGroupByOption = (groupOptions) => {
538
541
  if (typeof groupOptions !== "string") {
539
542
  return undefined;
@@ -550,7 +553,6 @@ const parseGroupByOption = (groupOptions) => {
550
553
  };
551
554
  exports.parseGroupByOption = parseGroupByOption;
552
555
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
553
- // fallow-ignore-next-line unused-export
554
556
  const parseHomepageOption = (cliHomepage, configHomepage) => {
555
557
  if (typeof cliHomepage === "string") {
556
558
  return cliHomepage;
@@ -572,6 +574,15 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default") => {
572
574
  ...configFileOpts?.printTypeOptions,
573
575
  });
574
576
  const config = (0, deepmerge_1.deepmerge)()({ ...exports.DEFAULT_OPTIONS, ...graphqlConfig }, configFileOpts ?? {});
577
+ // deepmerge rebuilds objects as prototype-less plain copies, which strips the
578
+ // methods off a class-based adapter. Take it from the raw sources instead, so
579
+ // `new MyAdapter()` keeps working as well as an object literal.
580
+ // `??` would let a config file that sets `outputAdapter: null` to disable an
581
+ // adapter inherited from GraphQL Config fall back to that adapter instead, so
582
+ // precedence is decided on the property being present, not on its value.
583
+ const outputAdapter = configFileOpts && "outputAdapter" in configFileOpts
584
+ ? configFileOpts.outputAdapter
585
+ : graphqlConfig?.outputAdapter;
575
586
  const { onlyDocDirective, skipDocDirective } = (0, exports.getVisibilityDirectives)(cliOpts, config);
576
587
  // Build options using consistent precedence: CLI > Config > Default
577
588
  // The precedence is enforced by the OptionBuilder's setIfProvided method
@@ -615,6 +626,7 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default") => {
615
626
  formatter: (0, exports.parseDeprecatedFormatterOption)(cliOpts, config),
616
627
  metatags: config.metatags ?? exports.DEFAULT_OPTIONS.metatags,
617
628
  onlyDocDirective,
629
+ outputAdapter,
618
630
  outputDir: (0, node_path_1.join)(rootPath, baseURL),
619
631
  prettify,
620
632
  printTypeOptions: getPrintTypeOptions(cliOpts, config.printTypeOptions),
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The built-in homepage template, inlined.
3
+ *
4
+ * The same content ships as `assets/generated.md` so anyone can point
5
+ * `homepage` at it, copy it, or diff against it. Inlining it here means the
6
+ * default path never touches the filesystem: rendering the homepage was the
7
+ * last filesystem *read* on the render path, and a write-only output adapter
8
+ * has no way to satisfy one.
9
+ *
10
+ * `assets/generated.md` remains the canonical artifact. A unit test asserts the
11
+ * two are identical, so they cannot drift.
12
+ *
13
+ * @internal
14
+ */
15
+ export declare const DEFAULT_HOMEPAGE_TEMPLATE = "---\nid: schema\nslug: ##baseURL##\ntitle: Schema Documentation\nsidebar_position: 1\nhide_table_of_contents: true\npagination_next: null\npagination_prev: null\nsidebar_class_name: navbar__toggle\n---\n\nThis documentation has been automatically generated from the GraphQL schema with [GraphQL-Markdown](https://graphql-markdown.dev/).\n";
16
+ //# sourceMappingURL=homepage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homepage.d.ts","sourceRoot":"","sources":["../../src/const/homepage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,uVAYrC,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_HOMEPAGE_TEMPLATE = void 0;
4
+ /**
5
+ * The built-in homepage template, inlined.
6
+ *
7
+ * The same content ships as `assets/generated.md` so anyone can point
8
+ * `homepage` at it, copy it, or diff against it. Inlining it here means the
9
+ * default path never touches the filesystem: rendering the homepage was the
10
+ * last filesystem *read* on the render path, and a write-only output adapter
11
+ * has no way to satisfy one.
12
+ *
13
+ * `assets/generated.md` remains the canonical artifact. A unit test asserts the
14
+ * two are identical, so they cannot drift.
15
+ *
16
+ * @internal
17
+ */
18
+ exports.DEFAULT_HOMEPAGE_TEMPLATE = `---
19
+ id: schema
20
+ slug: ##baseURL##
21
+ title: Schema Documentation
22
+ sidebar_position: 1
23
+ hide_table_of_contents: true
24
+ pagination_next: null
25
+ pagination_prev: null
26
+ sidebar_class_name: navbar__toggle
27
+ ---
28
+
29
+ This documentation has been automatically generated from the GraphQL schema with [GraphQL-Markdown](https://graphql-markdown.dev/).
30
+ `;
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/directives/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,aAAa,WAChB,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAMhE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,MAAM,WACT,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAMzD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WAAY,OAAO,KAAG,MAAM,IAAI,MAE1D,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WACjB,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAElC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,SAAU,OAAO,KAAG,IAAI,IAAI,MAE9C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WACjB,OAAO,KACd,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAEjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,WAAY,OAAO,KAAG,MAAM,IAAI,MAE1D,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yBAAyB,WAC5B,OAA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= (value) => {
36
36
  * ```
37
37
  */
38
38
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
39
- // fallow-ignore-next-line unused-export
40
39
  const hasDescriptor = (config) => {
41
40
  return (isTypeObject(config) &&
42
41
  "descriptor" in config &&
@@ -60,7 +59,6 @@ exports.hasDescriptor = hasDescriptor;
60
59
  * ```
61
60
  */
62
61
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
63
- // fallow-ignore-next-line unused-export
64
62
  const hasTag = (config) => {
65
63
  return (isTypeObject(config) &&
66
64
  "tag" in config &&
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
+ import type { OutputAdapter } from "@graphql-markdown/types";
6
7
  import type { CancellableEventOptions } from "@graphql-markdown/utils";
7
8
  import { DataEvent } from "@graphql-markdown/utils";
8
9
  /**
@@ -13,11 +14,14 @@ import { DataEvent } from "@graphql-markdown/utils";
13
14
  export declare class GenerateIndexMetafileEvent extends DataEvent<{
14
15
  dirPath: string;
15
16
  category: string;
17
+ /** Destination the metafile must be written to. */
18
+ outputAdapter?: OutputAdapter;
16
19
  options?: Record<string, unknown>;
17
20
  }> {
18
21
  constructor(data: {
19
22
  dirPath: string;
20
23
  category: string;
24
+ outputAdapter?: OutputAdapter;
21
25
  options?: Record<string, unknown>;
22
26
  }, options?: CancellableEventOptions);
23
27
  }
@@ -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,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,SAAS,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;IACA,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,EAGlC;CACF"}
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,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,SAAS,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;IACA,YACE,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CA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CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -22,7 +22,6 @@ Object.defineProperty(exports, "RenderTypeEntitiesEvents", { enumerable: true, g
22
22
  var generate_index_metafile_events_1 = require("./generate-index-metafile-events");
23
23
  Object.defineProperty(exports, "GenerateIndexMetafileEvents", { enumerable: true, get: function () { return generate_index_metafile_events_1.GenerateIndexMetafileEvents; } });
24
24
  // Re-export used only by unit tests via the events barrel.
25
- // fallow-ignore-next-line unused-export
26
25
  var print_type_events_1 = require("./print-type-events");
27
26
  Object.defineProperty(exports, "PrintTypeEvents", { enumerable: true, get: function () { return print_type_events_1.PrintTypeEvents; } });
28
27
  // Event classes
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
+ import type { OutputAdapter } from "@graphql-markdown/types";
6
7
  import type { CancellableEventOptions } from "@graphql-markdown/utils";
7
8
  import { DataEvent } from "@graphql-markdown/utils";
8
9
  /**
@@ -15,12 +16,15 @@ export declare class RenderFilesEvent extends DataEvent<{
15
16
  outputDir: string;
16
17
  rootDir: string;
17
18
  pages: unknown;
19
+ /** Destination the pages were written to; use it for any summary file. */
20
+ outputAdapter?: OutputAdapter;
18
21
  }> {
19
22
  constructor(data: {
20
23
  baseURL: string;
21
24
  outputDir: string;
22
25
  rootDir: string;
23
26
  pages: unknown;
27
+ outputAdapter?: OutputAdapter;
24
28
  }, options?: CancellableEventOptions);
25
29
  }
26
30
  //# sourceMappingURL=render-files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-files.d.ts","sourceRoot":"","sources":["../../src/events/render-files.ts"],"names":[],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GlC;CACF"}
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
+ import type { OutputAdapter } from "@graphql-markdown/types";
6
7
  import type { CancellableEventOptions } from "@graphql-markdown/utils";
7
8
  import { DataEvent } from "@graphql-markdown/utils";
8
9
  /**
@@ -15,12 +16,15 @@ export declare class RenderTypeEntitiesEvent extends DataEvent<{
15
16
  name: string;
16
17
  filePath: string;
17
18
  outputDir: string;
19
+ /** Destination the page was written to; use it to read the page back. */
20
+ outputAdapter?: OutputAdapter;
18
21
  }> {
19
22
  constructor(data: {
20
23
  baseURL: string;
21
24
  name: string;
22
25
  filePath: string;
23
26
  outputDir: string;
27
+ outputAdapter?: OutputAdapter;
24
28
  }, options?: CancellableEventOptions);
25
29
  }
26
30
  //# sourceMappingURL=render-type-entities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-type-entities.d.ts","sourceRoot":"","sources":["../../src/events/render-type-entities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,SAAS,CAAC;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;IACA,YACE,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACnB,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
1
+ {"version":3,"file":"render-type-entities.d.ts","sourceRoot":"","sources":["../../src/events/render-type-entities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,SAAS,CAAC;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;IACA,YACE,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
@@ -100,5 +100,5 @@ export declare const resolveSkipAndOnlyDirectives: (onlyDocDirective: Maybe<Dire
100
100
  * @param options - Complete configuration for the documentation generation
101
101
  * @returns Promise that resolves when documentation is fully generated
102
102
  */
103
- export declare const generateDocFromSchema: ({ baseURL, customDirective, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, loggerModule, formatter, metatags, onlyDocDirective, outputDir, prettify, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, }: GeneratorOptions) => Promise<void>;
103
+ export declare const generateDocFromSchema: ({ baseURL, customDirective, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, loggerModule, formatter, metatags, onlyDocDirective, outputAdapter, outputDir, prettify, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, }: GeneratorOptions) => Promise<void>;
104
104
  //# sourceMappingURL=generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"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
  "formatMDXFrontmatter",
101
101
  "formatMDXLink",
102
102
  "formatMDXNameEntity",
103
+ "formatMDXPermalink",
103
104
  "formatMDXSpecifiedByLink",
104
105
  ];
105
106
  /**
@@ -215,7 +216,6 @@ exports.loadGraphqlSchema = loadGraphqlSchema;
215
216
  * When no changes are detected, a log message is generated indicating that the schema is unchanged.
216
217
  */
217
218
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
218
- // fallow-ignore-next-line unused-export
219
219
  const checkSchemaDifferences = async (schema, schemaLocation, diffMethod, tmpDir) => {
220
220
  let changed = true;
221
221
  if (diffMethod !== config_1.DiffMethod.NONE) {
@@ -241,7 +241,6 @@ exports.checkSchemaDifferences = checkSchemaDifferences;
241
241
  * the second with resolved "skip" directives. Only defined directives are included.
242
242
  */
243
243
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
244
- // fallow-ignore-next-line unused-export
245
244
  const resolveSkipAndOnlyDirectives = (onlyDocDirective, skipDocDirective, schema) => {
246
245
  return [onlyDocDirective, skipDocDirective].map((directive) => {
247
246
  // Normalize to array and filter out null/undefined
@@ -278,7 +277,7 @@ exports.resolveSkipAndOnlyDirectives = resolveSkipAndOnlyDirectives;
278
277
  * @param options - Complete configuration for the documentation generation
279
278
  * @returns Promise that resolves when documentation is fully generated
280
279
  */
281
- const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, loggerModule, formatter, metatags, onlyDocDirective, outputDir, prettify, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, }) => {
280
+ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, loggerModule, formatter, metatags, onlyDocDirective, outputAdapter, outputDir, prettify, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, }) => {
282
281
  const start = process.hrtime.bigint();
283
282
  await (0, logger_1.default)(loggerModule);
284
283
  const mdxModule = await (0, exports.loadMDXModule)(formatter);
@@ -355,7 +354,7 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
355
354
  deprecated: printTypeOptions?.deprecated,
356
355
  force,
357
356
  hierarchy: printTypeOptions?.hierarchy,
358
- }, mdxExtension);
357
+ }, mdxExtension, outputAdapter);
359
358
  // Pre-collect all categories before rendering to ensure consistent positions
360
359
  renderer.preCollectCategories(Object.keys(rootTypes));
361
360
  const beforeRenderRootTypesEvent = new events_1.RenderRootTypesEvent({
@@ -379,14 +378,26 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
379
378
  outputDir,
380
379
  });
381
380
  await events.emitAsync(events_1.RenderHomepageEvents.AFTER_RENDER, afterRenderHomepageEvent);
382
- await events.emitAsync(events_1.RenderFilesEvents.AFTER_RENDER, new events_1.RenderFilesEvent({
381
+ const { errors: renderFilesErrors } = await events.emitAsync(events_1.RenderFilesEvents.AFTER_RENDER, new events_1.RenderFilesEvent({
383
382
  baseURL,
384
383
  outputDir,
385
384
  rootDir: (0, node_path_1.dirname)(outputDir),
386
385
  pages,
386
+ // the resolved adapter, so a hook never has to fall back for itself
387
+ outputAdapter: renderer.outputAdapter,
387
388
  }));
389
+ // without this a failure to write mdBook's SUMMARY.md is dropped, and the
390
+ // success line below claims the documentation is complete
391
+ (0, renderer_1.logHandlerErrors)(events_1.RenderFilesEvents.AFTER_RENDER, renderFilesErrors);
388
392
  const duration = (Number(process.hrtime.bigint() - start) / NS_PER_SEC).toFixed(SEC_DECIMALS);
389
- (0, logger_1.log)(`Documentation successfully generated in "${outputDir}" with base URL "${baseURL}".`, "success");
393
+ // a formatter that could not finish its output must not be reported as a
394
+ // success: mdBook cannot build without the SUMMARY.md written by that hook
395
+ if (renderFilesErrors.length > 0) {
396
+ (0, logger_1.log)(`Documentation generated in "${outputDir}" with base URL "${baseURL}", but ${renderFilesErrors.length} post-processing error(s) occurred: the output is incomplete.`, logger_1.LogLevel.error);
397
+ }
398
+ else {
399
+ (0, logger_1.log)(`Documentation successfully generated in "${outputDir}" with base URL "${baseURL}".`, "success");
400
+ }
390
401
  (0, logger_1.log)(`${pages.flat().length} pages generated in ${duration}s from schema "${(0, utils_1.toString)(schemaLocation)}".`);
391
402
  };
392
403
  exports.generateDocFromSchema = generateDocFromSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-config.d.ts","sourceRoot":"","sources":["../src/graphql-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAEV,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,EACZ,KAAK,EAEL,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAgBjC;;;;;;;;;;;;GAYG;AAGH,eAAO,MAAM,sBAAsB,EAAE,2BAEpC,CAAC;AAEF;;;;;;GAMG;AACH,UAAU,YAAY;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAWD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,eAAO,MAAM,gBAAgB,YAClB,YAAY,WACZ,oBAAoB,KAC5B,YAeF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,iBAAiB,OACxB,KAAK,CAAC,MAAM,CAAC,YACP,KAAK,CAAC,oBAAoB,CAAC,qCACH,YAAY,KAC7C,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAkDjD,CAAC"}
1
+ {"version":3,"file":"graphql-config.d.ts","sourceRoot":"","sources":["../src/graphql-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAEV,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,EACZ,KAAK,EAEL,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAgBjC;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,sBAAsB,EAAE,2BAEpC,CAAC;AAEF;;;;;;GAMG;AACH,UAAU,YAAY;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAWD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,eAAO,MAAM,gBAAgB,YAClB,YAAY,WACZ,oBAAoB,KAC5B,YAeF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,iBAAiB,OACxB,KAAK,CAAC,MAAM,CAAC,YACP,KAAK,CAAC,oBAAoB,CAAC,qCACH,YAAY,KAC7C,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAkDjD,CAAC"}
@@ -22,7 +22,6 @@ const EXTENSION_NAME = "graphql-markdown";
22
22
  * ```
23
23
  */
24
24
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
25
- // fallow-ignore-next-line unused-export
26
25
  const graphQLConfigExtension = () => {
27
26
  return { name: EXTENSION_NAME };
28
27
  };
@@ -59,7 +58,6 @@ const DEFAULT_THROW_OPTIONS = {
59
58
  * ```
60
59
  */
61
60
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
62
- // fallow-ignore-next-line unused-export
63
61
  const setLoaderOptions = (loaders, options) => {
64
62
  for (const loader in loaders) {
65
63
  if ((0, validation_1.isLoaderString)(loaders[loader])) {
@@ -1,4 +1,4 @@
1
- import type { ApiGroupOverrideType, Category, Maybe, IPrinter, RendererDocOptions, SchemaEntitiesGroupMap, SchemaEntity } from "@graphql-markdown/types";
1
+ import type { ApiGroupOverrideType, Category, Maybe, IPrinter, OutputAdapter, RendererDocOptions, SchemaEntitiesGroupMap, SchemaEntity } from "@graphql-markdown/types";
2
2
  /**
3
3
  * Default group names for API types and non-API types.
4
4
  * This constant provides the base folder structure for organizing GraphQL schema entities.
@@ -63,6 +63,16 @@ export interface CategoryMetafileOptions {
63
63
  sidebarPosition?: number;
64
64
  styleClass?: string;
65
65
  }
66
+ /**
67
+ * Reports errors thrown by event handlers.
68
+ *
69
+ * Handler errors are collected rather than thrown, so without this they are
70
+ * dropped and the formatter's post-processing silently does nothing.
71
+ *
72
+ * @param eventName - Name of the emitted event
73
+ * @param errors - Errors collected from the handlers
74
+ */
75
+ export declare const logHandlerErrors: (eventName: string, errors: Error[]) => void;
66
76
  /**
67
77
  * Core renderer class responsible for generating documentation files from GraphQL schema entities.
68
78
  * Handles the conversion of schema types to markdown/MDX documentation with proper organization.
@@ -81,6 +91,7 @@ export declare class Renderer {
81
91
  readonly prettify: boolean;
82
92
  readonly options: Maybe<RendererDocOptions>;
83
93
  readonly mdxExtension: string;
94
+ readonly outputAdapter: OutputAdapter;
84
95
  private readonly printer;
85
96
  private readonly rootLevelPositionManager;
86
97
  private readonly categoryPositionManager;
@@ -94,9 +105,10 @@ export declare class Renderer {
94
105
  * @param prettify - Whether to format the generated markdown
95
106
  * @param docOptions - Additional documentation options
96
107
  * @param mdxExtension - Optional MDX file extension to use
108
+ * @param outputAdapter - Destination for generated pages; defaults to the local filesystem
97
109
  * @example
98
110
  */
99
- constructor(printer: typeof IPrinter, outputDir: string, baseURL: string, group: Maybe<SchemaEntitiesGroupMap>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxExtension: string);
111
+ constructor(printer: typeof IPrinter, outputDir: string, baseURL: string, group: Maybe<SchemaEntitiesGroupMap>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxExtension: string, outputAdapter?: Maybe<OutputAdapter>);
100
112
  /**
101
113
  * Generates an index metafile for a category directory if MDX support is available.
102
114
  *
@@ -217,6 +229,17 @@ export declare class Renderer {
217
229
  * @private
218
230
  */
219
231
  private formatCategoryFolderName;
232
+ /**
233
+ * Sends a generated page to the configured output destination.
234
+ *
235
+ * Prettifying happens here rather than in the destination so every adapter
236
+ * receives identical content, and a custom adapter cannot accidentally skip
237
+ * the `pretty` option.
238
+ *
239
+ * @param filePath - Absolute path of the page, rooted at `outputDir`
240
+ * @param content - Rendered page content
241
+ */
242
+ private writeOutput;
220
243
  }
221
244
  /**
222
245
  * Factory function to create and initialize a Renderer instance.
@@ -243,5 +266,5 @@ export declare class Renderer {
243
266
  * );
244
267
  * ```
245
268
  */
246
- export declare const getRenderer: (printer: typeof IPrinter, outputDir: string, baseURL: string, group: Maybe<SchemaEntitiesGroupMap>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxExtension: string) => Promise<InstanceType<typeof Renderer>>;
269
+ export declare const getRenderer: (printer: typeof IPrinter, outputDir: string, baseURL: string, group: Maybe<SchemaEntitiesGroupMap>, prettify: boolean, docOptions: Maybe<RendererDocOptions>, mdxExtension: string, outputAdapter?: Maybe<OutputAdapter>) => Promise<InstanceType<typeof Renderer>>;
247
270
  //# 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,QAAQ,EACR,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EAGb,MAAM,yBAAyB,CAAC;AA2FjC;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,iBAAiB,SACtB,OAAO,WACJ,KAAK,CAAC,oBAAoB,GAAG,OAAO,CAAC,KAC7C,MAMF,CAAC;AA6CF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAoGD;;;;;;;;;;GAUG;AAIH,qBAAa,QAAQ;IACnB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC9C,QAAQ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ClC,OAAO,CAAC,YAAY,CAAC,OAAO,QAAQ,CAAC,CAevC,CAAC"}
package/dist/renderer.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRenderer = exports.Renderer = exports.getApiGroupFolder = exports.API_GROUPS = void 0;
3
+ exports.getRenderer = exports.Renderer = exports.logHandlerErrors = exports.getApiGroupFolder = exports.API_GROUPS = void 0;
4
4
  const node_path_1 = require("node:path");
5
5
  const graphql_1 = require("@graphql-markdown/graphql");
6
6
  const utils_1 = require("@graphql-markdown/utils");
7
7
  const logger_1 = require("@graphql-markdown/logger");
8
8
  const config_1 = require("./config");
9
+ const homepage_1 = require("./const/homepage");
9
10
  const validation_1 = require("./directives/validation");
10
11
  const event_emitter_1 = require("./event-emitter");
11
12
  const events_1 = require("./events");
@@ -90,7 +91,6 @@ var SidebarPosition;
90
91
  * @see {@link getApiGroupFolder} For usage with type categorization
91
92
  */
92
93
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
93
- // fallow-ignore-next-line unused-export
94
94
  exports.API_GROUPS = {
95
95
  operations: "operations",
96
96
  types: "types",
@@ -112,7 +112,6 @@ exports.API_GROUPS = {
112
112
  * ```
113
113
  */
114
114
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
115
- // fallow-ignore-next-line unused-export
116
115
  const getApiGroupFolder = (type, groups) => {
117
116
  let folderNames = exports.API_GROUPS;
118
117
  if ((0, validation_1.isGroupsObject)(groups)) {
@@ -247,6 +246,21 @@ class CategoryPositionManager {
247
246
  return this.categories.has(category);
248
247
  }
249
248
  }
249
+ /**
250
+ * Reports errors thrown by event handlers.
251
+ *
252
+ * Handler errors are collected rather than thrown, so without this they are
253
+ * dropped and the formatter's post-processing silently does nothing.
254
+ *
255
+ * @param eventName - Name of the emitted event
256
+ * @param errors - Errors collected from the handlers
257
+ */
258
+ const logHandlerErrors = (eventName, errors) => {
259
+ errors.forEach((error) => {
260
+ (0, logger_1.log)(`Error handler for ${eventName}: ${error.message}`, logger_1.LogLevel.error);
261
+ });
262
+ };
263
+ exports.logHandlerErrors = logHandlerErrors;
250
264
  /**
251
265
  * Core renderer class responsible for generating documentation files from GraphQL schema entities.
252
266
  * Handles the conversion of schema types to markdown/MDX documentation with proper organization.
@@ -260,7 +274,6 @@ class CategoryPositionManager {
260
274
  */
261
275
  // Value export used only by unit tests for direct whitebox coverage; the type is used
262
276
  // elsewhere via getRenderer()'s return type.
263
- // fallow-ignore-next-line unused-export
264
277
  class Renderer {
265
278
  group;
266
279
  outputDir;
@@ -268,6 +281,7 @@ class Renderer {
268
281
  prettify;
269
282
  options;
270
283
  mdxExtension;
284
+ outputAdapter;
271
285
  // mdxModuleIndexFileSupport: boolean;
272
286
  printer;
273
287
  rootLevelPositionManager;
@@ -282,9 +296,10 @@ class Renderer {
282
296
  * @param prettify - Whether to format the generated markdown
283
297
  * @param docOptions - Additional documentation options
284
298
  * @param mdxExtension - Optional MDX file extension to use
299
+ * @param outputAdapter - Destination for generated pages; defaults to the local filesystem
285
300
  * @example
286
301
  */
287
- constructor(printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension) {
302
+ constructor(printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension, outputAdapter = undefined) {
288
303
  this.printer = printer;
289
304
  this.group = group;
290
305
  this.outputDir = outputDir;
@@ -292,6 +307,7 @@ class Renderer {
292
307
  this.prettify = prettify;
293
308
  this.options = docOptions;
294
309
  this.mdxExtension = mdxExtension;
310
+ this.outputAdapter = outputAdapter ?? utils_1.fsOutputAdapter;
295
311
  // Initialize position managers for different hierarchy levels
296
312
  // rootLevelPositionManager: for root-level categories (Query, Mutation, Deprecated, etc.)
297
313
  this.rootLevelPositionManager = new CategoryPositionManager(docOptions?.categorySort, 1);
@@ -326,19 +342,23 @@ class Renderer {
326
342
  const event = new events_1.GenerateIndexMetafileEvent({
327
343
  dirPath,
328
344
  category,
345
+ outputAdapter: this.outputAdapter,
329
346
  options: {
330
347
  ...finalOptions,
331
348
  sidebarPosition,
332
349
  index: this.options?.index,
333
350
  },
334
351
  });
335
- const handlerErrors = await events.emitAsync(events_1.GenerateIndexMetafileEvents.BEFORE_GENERATE, event);
336
- if (Array.isArray(handlerErrors) && handlerErrors.length > 0) {
337
- handlerErrors.forEach((error) => {
338
- (0, logger_1.log)(`Error handler for ${events_1.GenerateIndexMetafileEvents.BEFORE_GENERATE}: ${error.message}`, logger_1.LogLevel.error);
339
- });
340
- }
341
- await events.emitAsync(events_1.GenerateIndexMetafileEvents.AFTER_GENERATE, new events_1.GenerateIndexMetafileEvent({ dirPath, category }));
352
+ // emitAsync resolves to an EmitResult, never an array: the previous
353
+ // Array.isArray() guard was always false, so handler errors went unreported
354
+ const { errors } = await events.emitAsync(events_1.GenerateIndexMetafileEvents.BEFORE_GENERATE, event);
355
+ (0, exports.logHandlerErrors)(events_1.GenerateIndexMetafileEvents.BEFORE_GENERATE, errors);
356
+ const { errors: afterErrors } = await events.emitAsync(events_1.GenerateIndexMetafileEvents.AFTER_GENERATE, new events_1.GenerateIndexMetafileEvent({
357
+ dirPath,
358
+ category,
359
+ outputAdapter: this.outputAdapter,
360
+ }));
361
+ (0, exports.logHandlerErrors)(events_1.GenerateIndexMetafileEvents.AFTER_GENERATE, afterErrors);
342
362
  }
343
363
  /**
344
364
  * Generates the directory path and metafiles for a specific schema entity type.
@@ -505,7 +525,7 @@ class Renderer {
505
525
  (0, logger_1.log)(`An error occurred while processing "${name}": ${error instanceof Error ? error.message : String(error)}`, logger_1.LogLevel.warn);
506
526
  return undefined;
507
527
  }
508
- await (0, utils_1.saveFile)(filePath, content, this.prettify ? utils_1.prettifyMarkdown : undefined);
528
+ await this.writeOutput(filePath, content);
509
529
  const pagePath = (0, node_path_1.relative)(this.outputDir, filePath);
510
530
  const isFlat = isHierarchy(this.options, config_1.TypeHierarchy.FLAT);
511
531
  const page = isFlat
@@ -526,8 +546,10 @@ class Renderer {
526
546
  name,
527
547
  filePath,
528
548
  outputDir: this.outputDir,
549
+ outputAdapter: this.outputAdapter,
529
550
  });
530
- await events.emitAsync(events_1.RenderTypeEntitiesEvents.AFTER_RENDER, event);
551
+ const { errors } = await events.emitAsync(events_1.RenderTypeEntitiesEvents.AFTER_RENDER, event);
552
+ (0, exports.logHandlerErrors)(events_1.RenderTypeEntitiesEvents.AFTER_RENDER, errors);
531
553
  return {
532
554
  category,
533
555
  filePath,
@@ -598,13 +620,21 @@ class Renderer {
598
620
  const destLocation = (0, node_path_1.join)(this.outputDir, homePage);
599
621
  const slug = utils_1.pathUrl.resolve("/", this.baseURL);
600
622
  try {
601
- await (0, utils_1.copyFile)(homepageLocation, destLocation);
602
- const template = await (0, utils_1.readFile)(destLocation);
623
+ // Read the template from its source location rather than copying it into
624
+ // the output directory and reading it back: the round-trip wrote a file
625
+ // only to overwrite it a moment later, and it forced the destination to
626
+ // be readable, which a write-only output adapter is not.
627
+ //
628
+ // The built-in template is inlined, so the default path performs no
629
+ // filesystem read at all. Only a caller-supplied `homepage` path does.
630
+ const template = homepageLocation === config_1.ASSET_HOMEPAGE_LOCATION
631
+ ? homepage_1.DEFAULT_HOMEPAGE_TEMPLATE
632
+ : await (0, utils_1.readFile)(homepageLocation);
603
633
  const data = template
604
634
  .toString()
605
635
  .replaceAll("##baseURL##", slug)
606
636
  .replaceAll("##generated-date-time##", new Date().toLocaleString());
607
- await (0, utils_1.saveFile)(destLocation, data, this.prettify ? utils_1.prettifyMarkdown : undefined);
637
+ await this.writeOutput(destLocation, data);
608
638
  }
609
639
  catch (error) {
610
640
  (0, logger_1.log)(`An error occurred while processing the homepage ${homepageLocation}: ${error}`, logger_1.LogLevel.warn);
@@ -745,6 +775,22 @@ class Renderer {
745
775
  return (0, utils_1.slugify)(categoryName);
746
776
  }
747
777
  }
778
+ /**
779
+ * Sends a generated page to the configured output destination.
780
+ *
781
+ * Prettifying happens here rather than in the destination so every adapter
782
+ * receives identical content, and a custom adapter cannot accidentally skip
783
+ * the `pretty` option.
784
+ *
785
+ * @param filePath - Absolute path of the page, rooted at `outputDir`
786
+ * @param content - Rendered page content
787
+ */
788
+ async writeOutput(filePath, content) {
789
+ const output = this.prettify
790
+ ? ((await (0, utils_1.prettifyMarkdown)(content)) ?? content)
791
+ : content;
792
+ await this.outputAdapter.writeFile(filePath, output);
793
+ }
748
794
  }
749
795
  exports.Renderer = Renderer;
750
796
  /**
@@ -772,8 +818,11 @@ exports.Renderer = Renderer;
772
818
  * );
773
819
  * ```
774
820
  */
775
- const getRenderer = async (printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension) => {
776
- await (0, utils_1.ensureDir)(outputDir, { forceEmpty: docOptions?.force });
777
- return new Renderer(printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension);
821
+ const getRenderer = async (printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension, outputAdapter = undefined) => {
822
+ const adapter = outputAdapter ?? utils_1.fsOutputAdapter;
823
+ // Optional on the interface: a destination with no directory concept (an
824
+ // object store, a CMS collection) has nothing to prepare.
825
+ await adapter.ensureDir?.(outputDir, { forceEmpty: docOptions?.force });
826
+ return new Renderer(printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension, adapter);
778
827
  };
779
828
  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.21.2",
8
+ "version": "1.22.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",