@graphql-markdown/core 1.21.2 → 1.23.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/README.md CHANGED
@@ -5,3 +5,50 @@
5
5
  [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=graphql-markdown_core&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=graphql-markdown_core)
6
6
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=graphql-markdown_core&metric=coverage)](https://sonarcloud.io/summary/new_code?id=graphql-markdown_core)
7
7
  [![Mutation Score](https://img.shields.io/endpoint?label=mutation%20score&style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fgraphql-markdown%2Fgraphql-markdown%2Fmain%3Fmodule%3Dcore)](https://dashboard.stryker-mutator.io/reports/github.com/graphql-markdown/graphql-markdown/main?module=core)
8
+
9
+ Core engine for generating **Markdown documentation** from a **GraphQL schema**. It orchestrates schema loading, diffing, rendering, and the event lifecycle used by [`@graphql-markdown/cli`](https://www.npmjs.com/package/@graphql-markdown/cli) and [`@graphql-markdown/docusaurus`](https://www.npmjs.com/package/@graphql-markdown/docusaurus). Most users should install one of those packages instead of depending on `core` directly.
10
+
11
+ ## Installation
12
+
13
+ ```shell
14
+ npm install @graphql-markdown/core
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { buildConfig, generateDocFromSchema } from "@graphql-markdown/core";
21
+
22
+ const config = await buildConfig({
23
+ schema: "./schema.graphql",
24
+ rootPath: "./docs",
25
+ baseURL: "api",
26
+ });
27
+
28
+ await generateDocFromSchema(config);
29
+ ```
30
+
31
+ ### Event system
32
+
33
+ `core` exposes a cancellable event emitter so that formatters, printers, and custom scripts can hook into schema loading, diff checks, and rendering:
34
+
35
+ ```ts
36
+ import { getEvents, SchemaEvents } from "@graphql-markdown/core";
37
+
38
+ getEvents().on(SchemaEvents.SCHEMA_LOAD, (event) => {
39
+ console.log("Schema loaded", event);
40
+ });
41
+ ```
42
+
43
+ See the [event handlers documentation](https://graphql-markdown.dev/docs/advanced/lifecycle-events) for the full list of lifecycle events and their payloads.
44
+
45
+ ## Documentation
46
+
47
+ - [Configuration Options](https://graphql-markdown.dev/docs/settings)
48
+ - [Lifecycle Events](https://graphql-markdown.dev/docs/advanced/lifecycle-events)
49
+
50
+ ## License
51
+
52
+ GraphQL-Markdown packages are 100% free and open-source, under the [MIT license](https://github.com/graphql-markdown/graphql-markdown/blob/main/LICENSE).
53
+
54
+ This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/graphql-markdown/graphql-markdown) to thank us for our work. By contributing to the Treeware forest, you'll be creating employment for local families and restoring wildlife habitats.
package/dist/config.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * @packageDocumentation
17
17
  */
18
- import type { CliOptions, ConfigDocOptions, ConfigOptions, ConfigPrintTypeOptions, CustomDirective, DirectiveName, GroupByDirectiveOptions, Maybe, Options, TypeDiffMethod, TypeHierarchyObjectType, TypeHierarchyType, TypeHierarchyValueType } from "@graphql-markdown/types";
18
+ import type { CliOptions, ConfigDocOptions, ConfigOptions, ConfigPrintTypeOptions, CustomDirective, Decorators, DirectiveName, GroupByDirectiveOptions, Maybe, Options, TypeDiffMethod, TypeHierarchyObjectType, TypeHierarchyType, TypeHierarchyValueType } from "@graphql-markdown/types";
19
19
  /**
20
20
  * Type hierarchy options for organizing schema documentation.
21
21
  *
@@ -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" | "decorators" | "groupByDirective" | "loaders" | "outputAdapter"> & Required<Omit<ConfigOptions, "customDirective" | "decorators" | "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>>;
@@ -236,26 +236,6 @@ export declare const getCustomDirectives: (customDirectiveOptions: Maybe<CustomD
236
236
  export declare const getForcedDiffMethod: () => TypeDiffMethod;
237
237
  export declare const getDiffMethod: (diff: TypeDiffMethod) => TypeDiffMethod;
238
238
  export declare const parseDeprecatedDocOptions: (_cliOpts?: Maybe<CliOptions>, _configOptions?: Maybe<ConfigDocOptions>) => Record<string, never>;
239
- /**
240
- * Builds the document options by merging CLI options, config file options, and defaults.
241
- * Handles index generation flag and front matter configuration.
242
- *
243
- * @param cliOpts - CLI options for document generation
244
- * @param configOptions - Config file options for document generation
245
- * @returns The resolved document options with all required fields
246
- * @example
247
- * ```typescript
248
- * const cliOptions = { index: true };
249
- * const configOptions = { frontMatter: { sidebar_label: 'API' } };
250
- *
251
- * const docOptions = getDocOptions(cliOptions, configOptions);
252
- * console.log(docOptions);
253
- * // {
254
- * // index: true,
255
- * // frontMatter: { sidebar_label: 'API' }
256
- * // }
257
- * ```
258
- */
259
239
  export declare const getDocOptions: (cliOpts?: Maybe<CliOptions>, configOptions?: Maybe<ConfigDocOptions>) => Required<ConfigDocOptions>;
260
240
  /**
261
241
  * Resolves the type hierarchy configuration by merging CLI and config file options.
@@ -284,6 +264,34 @@ export declare const getDocOptions: (cliOpts?: Maybe<CliOptions>, configOptions?
284
264
  export declare const getTypeHierarchyOption: (cliOption?: Maybe<TypeHierarchyValueType>, configOption?: Maybe<TypeHierarchyType>) => Maybe<TypeHierarchyObjectType>;
285
265
  export declare const parseDeprecatedFormatterOption: (cliOpts?: Maybe<CliOptions>, configOptions?: Maybe<ConfigOptions>) => Maybe<string>;
286
266
  export declare const parseDeprecatedPrintTypeOptions: (_cliOpts?: Maybe<CliOptions>, _configOptions?: Maybe<ConfigPrintTypeOptions>) => Record<string, never>;
267
+ /**
268
+ * Validates the top-level `decorators` option.
269
+ *
270
+ * The option is keyed by a free-form id — it is not required to name a
271
+ * schema directive — and every entry must declare a `render` callback. An
272
+ * invalid entry is a configuration error rather than something to silently
273
+ * drop, as it would otherwise produce a page missing a section without any
274
+ * indication why.
275
+ *
276
+ * @param decorators - the `decorators` option declared in the config file.
277
+ *
278
+ * @returns the validated decorators, or `undefined` when none is declared.
279
+ *
280
+ * @throws Error if an entry is malformed or claims a built-in section name.
281
+ *
282
+ * @example
283
+ * ```js
284
+ * getDecoratorsOption({
285
+ * responses: {
286
+ * predicate: hasDirectiveNamed("httpResponse"),
287
+ * title: "Responses",
288
+ * position: { after: "metadata" },
289
+ * render: (values) => values.map((v) => `- \`${v.code}\` ${v.description}`).join("\n"),
290
+ * },
291
+ * });
292
+ * ```
293
+ */
294
+ export declare const getDecoratorsOption: (decorators: Maybe<Decorators>) => Maybe<Decorators>;
287
295
  /**
288
296
  * Parses and validates the groupByDirective option string format.
289
297
  * The format should be \@directive(field|=fallback) where:
@@ -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;AAC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eAAO,MAAM,+BAA+B,cAC/B,KAAK,CAAC,UAAU,CAAC,mBACX,KAAK,CAAC,sBAAsB,CAAC,KAC7C,MAAM,CAAC,MAAM,EAAE,KAAK,CAEtB,CAAC;AAwIF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,mBAAmB,eAClB,KAAK,CAAC,UAAU,CAAC,KAC5B,KAAK,CAAC,UAAU,CAqBlB,CAAC;AAgCF;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAoGjB,CAAC"}
package/dist/config.js CHANGED
@@ -17,11 +17,12 @@
17
17
  * @packageDocumentation
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.buildConfig = exports.parseHomepageOption = exports.parseGroupByOption = exports.parseDeprecatedPrintTypeOptions = exports.parseDeprecatedFormatterOption = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = exports.getForcedDiffMethod = exports.getCustomDirectives = exports.getVisibilityDirectives = exports.getSkipDocDirectives = exports.getOnlyDocDirectives = exports.getDocDirective = exports.DEFAULT_OPTIONS = exports.DEFAULT_HIERARCHY = exports.ASSET_HOMEPAGE_LOCATION = exports.PACKAGE_NAME = exports.DOCS_URL = exports.DeprecatedOption = exports.DiffMethod = exports.TypeHierarchy = void 0;
20
+ exports.buildConfig = exports.parseHomepageOption = exports.parseGroupByOption = exports.getDecoratorsOption = exports.parseDeprecatedPrintTypeOptions = exports.parseDeprecatedFormatterOption = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = exports.getForcedDiffMethod = exports.getCustomDirectives = exports.getVisibilityDirectives = exports.getSkipDocDirectives = exports.getOnlyDocDirectives = exports.getDocDirective = exports.DEFAULT_OPTIONS = exports.DEFAULT_HIERARCHY = exports.ASSET_HOMEPAGE_LOCATION = exports.PACKAGE_NAME = exports.DOCS_URL = exports.DeprecatedOption = exports.DiffMethod = exports.TypeHierarchy = void 0;
21
21
  const node_path_1 = require("node:path");
22
22
  const node_os_1 = require("node:os");
23
23
  const deepmerge_1 = require("@fastify/deepmerge");
24
24
  const logger_1 = require("@graphql-markdown/logger");
25
+ const printer_legacy_1 = require("@graphql-markdown/printer-legacy");
25
26
  const graphql_config_1 = require("./graphql-config");
26
27
  const patterns_1 = require("./const/patterns");
27
28
  const validation_1 = require("./directives/validation");
@@ -101,6 +102,8 @@ exports.ASSET_HOMEPAGE_LOCATION = (0, node_path_1.join)(__dirname, "..", "assets
101
102
  * @public
102
103
  */
103
104
  exports.DEFAULT_HIERARCHY = { [TypeHierarchy.API]: {} };
105
+ /** Memoised OS temp path, resolved on the first read of `DEFAULT_OPTIONS.tmpDir`. */
106
+ let defaultTmpDir;
104
107
  /**
105
108
  * Default configuration options used when no user options are provided.
106
109
  * These values serve as fallbacks for any missing configuration.
@@ -112,6 +115,7 @@ exports.DEFAULT_OPTIONS = {
112
115
  id: "default",
113
116
  baseURL: "schema",
114
117
  customDirective: undefined,
118
+ decorators: undefined,
115
119
  diffMethod: DiffMethod.NONE,
116
120
  docOptions: {
117
121
  categorySort: undefined,
@@ -134,7 +138,14 @@ exports.DEFAULT_OPTIONS = {
134
138
  },
135
139
  rootPath: "./docs",
136
140
  schema: "./schema.graphql",
137
- tmpDir: (0, node_path_1.join)((0, node_os_1.tmpdir)(), exports.PACKAGE_NAME),
141
+ // Lazy: as a plain property this ran `tmpdir()` at module load, so merely
142
+ // importing the config module touched the OS temp path even for runs that
143
+ // never diff. The getter defers it to the point a default is actually needed,
144
+ // and memoises it since a single build reads it more than once.
145
+ get tmpDir() {
146
+ defaultTmpDir ??= (0, node_path_1.join)((0, node_os_1.tmpdir)(), exports.PACKAGE_NAME);
147
+ return defaultTmpDir;
148
+ },
138
149
  skipDocDirective: [],
139
150
  onlyDocDirective: [],
140
151
  };
@@ -155,7 +166,6 @@ exports.DEFAULT_OPTIONS = {
155
166
  * ```
156
167
  */
157
168
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
158
- // fallow-ignore-next-line unused-export
159
169
  const getDocDirective = (name) => {
160
170
  if (typeof name !== "string" || !patterns_1.PATTERNS.DIRECTIVE_NAME.test(name)) {
161
171
  throw new Error(`Invalid "${name}"`);
@@ -291,12 +301,12 @@ exports.getVisibilityDirectives = getVisibilityDirectives;
291
301
  * @see {@link DOCS_URL}/advanced/custom-directive for custom directive format documentation
292
302
  */
293
303
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
294
- // fallow-ignore-next-line unused-export
295
304
  const getCustomDirectives = (customDirectiveOptions, skipDocDirective) => {
296
305
  if (!customDirectiveOptions ||
297
306
  Object.keys(customDirectiveOptions).length === 0) {
298
307
  return undefined;
299
308
  }
309
+ (0, logger_1.log)(`Setting "customDirective" is deprecated and will be removed in a future version. Use "decorators" instead.`, logger_1.LogLevel.warn);
300
310
  for (const [name, option] of Object.entries(customDirectiveOptions)) {
301
311
  if (Array.isArray(skipDocDirective) &&
302
312
  skipDocDirective.includes(name)) {
@@ -326,7 +336,6 @@ exports.getCustomDirectives = getCustomDirectives;
326
336
  * @see {@link DiffMethod} for available diff methods
327
337
  */
328
338
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
329
- // fallow-ignore-next-line unused-export
330
339
  const getForcedDiffMethod = () => {
331
340
  return DiffMethod.FORCE;
332
341
  };
@@ -335,13 +344,11 @@ const getNormalizedDiffMethod = (diff) => {
335
344
  return diff.toLocaleUpperCase();
336
345
  };
337
346
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
338
- // fallow-ignore-next-line unused-export
339
347
  const getDiffMethod = (diff) => {
340
348
  return getNormalizedDiffMethod(diff);
341
349
  };
342
350
  exports.getDiffMethod = getDiffMethod;
343
351
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
344
- // fallow-ignore-next-line unused-export
345
352
  const parseDeprecatedDocOptions = (_cliOpts, _configOptions) => {
346
353
  return {};
347
354
  };
@@ -366,23 +373,39 @@ exports.parseDeprecatedDocOptions = parseDeprecatedDocOptions;
366
373
  * // }
367
374
  * ```
368
375
  */
376
+ /**
377
+ * Resolves a boolean option that defaults to `true` and can only be turned off,
378
+ * either via a CLI negation flag (e.g. `--noParentType`) or an explicit `false`
379
+ * in the config file.
380
+ *
381
+ * @param cliNegated - the CLI negation flag value (e.g. `cliOpts.noParentType`)
382
+ * @param configValue - the corresponding config file option value
383
+ * @param defaultValue - the value used when neither source turns the option off
384
+ * @returns the resolved boolean value
385
+ */
386
+ const resolveNegatableOption = (cliNegated, configValue, defaultValue) => {
387
+ if (cliNegated === true) {
388
+ return false;
389
+ }
390
+ return typeof configValue === "boolean" ? configValue : defaultValue;
391
+ };
369
392
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
370
- // fallow-ignore-next-line unused-export
371
393
  const getDocOptions = (cliOpts, configOptions) => {
372
394
  const deprecated = (0, exports.parseDeprecatedDocOptions)(cliOpts, configOptions);
373
395
  const cliIndex = typeof cliOpts?.index === "boolean" ? cliOpts.index : undefined;
374
396
  const configIndex = typeof configOptions?.index === "boolean" ? configOptions.index : undefined;
375
397
  const index = cliIndex ?? configIndex ?? exports.DEFAULT_OPTIONS.docOptions.index;
376
- const configSectionHeaderId = typeof configOptions?.sectionHeaderId === "boolean"
377
- ? configOptions.sectionHeaderId
378
- : exports.DEFAULT_OPTIONS.docOptions.sectionHeaderId;
379
- const sectionHeaderId = cliOpts?.noSectionId === true ? false : configSectionHeaderId;
398
+ const sectionHeaderId = resolveNegatableOption(cliOpts?.noSectionId, configOptions?.sectionHeaderId, exports.DEFAULT_OPTIONS.docOptions.sectionHeaderId);
380
399
  return {
381
400
  categorySort: configOptions?.categorySort,
382
401
  frontMatter: {
383
402
  ...deprecated,
384
403
  ...configOptions?.frontMatter,
385
404
  },
405
+ // the framework name and version are set by the framework plugin, and are
406
+ // needed by the formatters to adjust their output to the target version
407
+ generatorFrameworkName: configOptions?.generatorFrameworkName,
408
+ generatorFrameworkVersion: configOptions?.generatorFrameworkVersion,
386
409
  index,
387
410
  sectionHeaderId,
388
411
  };
@@ -413,7 +436,6 @@ exports.getDocOptions = getDocOptions;
413
436
  * @see {@link TypeHierarchy} for available hierarchy types
414
437
  */
415
438
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
416
- // fallow-ignore-next-line unused-export
417
439
  const getTypeHierarchyOption = (cliOption, configOption) => {
418
440
  const parseValue = (config) => {
419
441
  if (typeof config === "string") {
@@ -446,7 +468,6 @@ const getTypeHierarchyOption = (cliOption, configOption) => {
446
468
  };
447
469
  exports.getTypeHierarchyOption = getTypeHierarchyOption;
448
470
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
449
- // fallow-ignore-next-line unused-export
450
471
  const parseDeprecatedFormatterOption = (cliOpts, configOptions) => {
451
472
  const legacyCli = cliOpts?.mdxParser ?? null; // NOSONAR typescript:S1874
452
473
  const legacyConfig = configOptions?.mdxParser; // NOSONAR typescript:S1874
@@ -458,7 +479,6 @@ const parseDeprecatedFormatterOption = (cliOpts, configOptions) => {
458
479
  };
459
480
  exports.parseDeprecatedFormatterOption = parseDeprecatedFormatterOption;
460
481
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
461
- // fallow-ignore-next-line unused-export
462
482
  const parseDeprecatedPrintTypeOptions = (_cliOpts, _configOptions) => {
463
483
  return {};
464
484
  };
@@ -491,6 +511,129 @@ exports.parseDeprecatedPrintTypeOptions = parseDeprecatedPrintTypeOptions;
491
511
  * @see {@link DeprecatedOption} for deprecated handling options
492
512
  * @see {@link getTypeHierarchyOption} for hierarchy resolution
493
513
  */
514
+ /**
515
+ * Section keys owned by the printer, which a custom section/decorator cannot
516
+ * claim. Shares `@graphql-markdown/printer-legacy`'s `RESERVED_SECTION_NAMES`
517
+ * — the single source of truth for the built-in names — plus `"__proto__"`,
518
+ * reserved only here: a config file declaring it is almost certainly a
519
+ * mistake, whereas the printer deliberately supports it as a section id when
520
+ * built directly (not via a config file), guarded by `Object.create(null)`.
521
+ *
522
+ * @internal
523
+ */
524
+ const RESERVED_SECTION_NAMES = [
525
+ ...printer_legacy_1.RESERVED_SECTION_NAMES,
526
+ "__proto__",
527
+ ];
528
+ /**
529
+ * Validates an optional callback-typed decorator field (`predicate`, `resolve`).
530
+ *
531
+ * @internal
532
+ *
533
+ * @throws TypeError if the field is set and is not a function.
534
+ */
535
+ const validateDecoratorCallback = (id, field, value) => {
536
+ if (value !== undefined && typeof value !== "function") {
537
+ throw new TypeError(`Decorator '${id}' option '${field}' must be a function.`);
538
+ }
539
+ };
540
+ /**
541
+ * Validates a decorator's optional `position`.
542
+ *
543
+ * An invalid `position` fails silently downstream — a typo'd slot name never
544
+ * matches in `printSlotDecorators`, and an unknown anchor is absorbed by
545
+ * `getDecoratorsOrder`'s "append when not found" fallback — so it is checked
546
+ * here instead, where a mistake can be reported.
547
+ *
548
+ * @internal
549
+ *
550
+ * @throws TypeError if `position` is set and is not exactly one of
551
+ * `after`/`before`/`into`, as a non-empty string.
552
+ */
553
+ const validateDecoratorPosition = (id, position) => {
554
+ if (position === undefined || position === null) {
555
+ return;
556
+ }
557
+ const anchors = ["after", "before", "into"].filter((key) => {
558
+ return position[key] !== undefined;
559
+ });
560
+ const value = anchors.length === 1 ? position[anchors[0]] : undefined;
561
+ if (typeof value !== "string" || value.length === 0) {
562
+ throw new TypeError(`Decorator '${id}' option 'position' must set exactly one of 'after', 'before', or 'into' to a non-empty string.`);
563
+ }
564
+ };
565
+ /**
566
+ * Validates a single decorator declaration.
567
+ *
568
+ * A config file is untrusted runtime JavaScript, so every malformed field is
569
+ * a configuration error to report, not a value to silently ignore or coerce.
570
+ *
571
+ * @internal
572
+ *
573
+ * @throws Error or TypeError if the decorator id or any of its fields is malformed.
574
+ */
575
+ const validateDecoratorEntry = (id, decorator) => {
576
+ if (id.length === 0) {
577
+ throw new TypeError("Option 'decorators' requires a non-empty id for each decorator.");
578
+ }
579
+ if (RESERVED_SECTION_NAMES.includes(id)) {
580
+ throw new Error(`Decorator id '${id}' is reserved, please use another id.`);
581
+ }
582
+ // The `!decorator` half narrows `decorator` from `Maybe<DecoratorDefinition>`
583
+ // for every check below, and also catches a non-object entry (`null`, or
584
+ // `undefined` from a conditional spread).
585
+ if (!decorator || typeof decorator.render !== "function") {
586
+ throw new TypeError(`Decorator '${id}' requires a 'render' function.`);
587
+ }
588
+ validateDecoratorCallback(id, "predicate", decorator.predicate);
589
+ validateDecoratorCallback(id, "resolve", decorator.resolve);
590
+ validateDecoratorPosition(id, decorator.position);
591
+ };
592
+ /**
593
+ * Validates the top-level `decorators` option.
594
+ *
595
+ * The option is keyed by a free-form id — it is not required to name a
596
+ * schema directive — and every entry must declare a `render` callback. An
597
+ * invalid entry is a configuration error rather than something to silently
598
+ * drop, as it would otherwise produce a page missing a section without any
599
+ * indication why.
600
+ *
601
+ * @param decorators - the `decorators` option declared in the config file.
602
+ *
603
+ * @returns the validated decorators, or `undefined` when none is declared.
604
+ *
605
+ * @throws Error if an entry is malformed or claims a built-in section name.
606
+ *
607
+ * @example
608
+ * ```js
609
+ * getDecoratorsOption({
610
+ * responses: {
611
+ * predicate: hasDirectiveNamed("httpResponse"),
612
+ * title: "Responses",
613
+ * position: { after: "metadata" },
614
+ * render: (values) => values.map((v) => `- \`${v.code}\` ${v.description}`).join("\n"),
615
+ * },
616
+ * });
617
+ * ```
618
+ */
619
+ const getDecoratorsOption = (decorators) => {
620
+ // Only an absent option selects the default: a configuration file is runtime
621
+ // JavaScript, so a falsy non-object such as `false` or `""` is a mistake worth
622
+ // reporting rather than a silent way to disable the decorators.
623
+ if (decorators === null || decorators === undefined) {
624
+ return exports.DEFAULT_OPTIONS.decorators;
625
+ }
626
+ if (typeof decorators !== "object" || Array.isArray(decorators)) {
627
+ throw new TypeError("Option 'decorators' must be a map of decorator ids.");
628
+ }
629
+ // `Object.entries` skips the `__proto__` key of an object literal, which never
630
+ // becomes an own property, so a decorator cannot claim it here either.
631
+ Object.entries(decorators).forEach(([id, decorator]) => {
632
+ validateDecoratorEntry(id, decorator);
633
+ });
634
+ return decorators;
635
+ };
636
+ exports.getDecoratorsOption = getDecoratorsOption;
494
637
  const getPrintTypeOptions = (cliOpts, configOptions) => {
495
638
  return {
496
639
  deprecated: (cliOpts?.deprecated ??
@@ -498,10 +641,8 @@ const getPrintTypeOptions = (cliOpts, configOptions) => {
498
641
  exports.DEFAULT_OPTIONS.printTypeOptions.deprecated).toLocaleLowerCase(),
499
642
  exampleSection: configOptions?.exampleSection ??
500
643
  exports.DEFAULT_OPTIONS.printTypeOptions.exampleSection,
501
- parentTypePrefix: (!cliOpts?.noParentType && configOptions?.parentTypePrefix) ??
502
- exports.DEFAULT_OPTIONS.printTypeOptions.parentTypePrefix,
503
- typeBadges: (!cliOpts?.noTypeBadges && configOptions?.typeBadges) ??
504
- exports.DEFAULT_OPTIONS.printTypeOptions.typeBadges,
644
+ parentTypePrefix: resolveNegatableOption(cliOpts?.noParentType, configOptions?.parentTypePrefix, exports.DEFAULT_OPTIONS.printTypeOptions.parentTypePrefix),
645
+ typeBadges: resolveNegatableOption(cliOpts?.noTypeBadges, configOptions?.typeBadges, exports.DEFAULT_OPTIONS.printTypeOptions.typeBadges),
505
646
  hierarchy: (0, exports.getTypeHierarchyOption)(cliOpts?.hierarchy, configOptions?.hierarchy),
506
647
  };
507
648
  };
@@ -533,7 +674,6 @@ const getPrintTypeOptions = (cliOpts, configOptions) => {
533
674
  * ```
534
675
  */
535
676
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
536
- // fallow-ignore-next-line unused-export
537
677
  const parseGroupByOption = (groupOptions) => {
538
678
  if (typeof groupOptions !== "string") {
539
679
  return undefined;
@@ -550,7 +690,6 @@ const parseGroupByOption = (groupOptions) => {
550
690
  };
551
691
  exports.parseGroupByOption = parseGroupByOption;
552
692
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
553
- // fallow-ignore-next-line unused-export
554
693
  const parseHomepageOption = (cliHomepage, configHomepage) => {
555
694
  if (typeof cliHomepage === "string") {
556
695
  return cliHomepage;
@@ -572,6 +711,15 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default") => {
572
711
  ...configFileOpts?.printTypeOptions,
573
712
  });
574
713
  const config = (0, deepmerge_1.deepmerge)()({ ...exports.DEFAULT_OPTIONS, ...graphqlConfig }, configFileOpts ?? {});
714
+ // deepmerge rebuilds objects as prototype-less plain copies, which strips the
715
+ // methods off a class-based adapter. Take it from the raw sources instead, so
716
+ // `new MyAdapter()` keeps working as well as an object literal.
717
+ // `??` would let a config file that sets `outputAdapter: null` to disable an
718
+ // adapter inherited from GraphQL Config fall back to that adapter instead, so
719
+ // precedence is decided on the property being present, not on its value.
720
+ const outputAdapter = configFileOpts && "outputAdapter" in configFileOpts
721
+ ? configFileOpts.outputAdapter
722
+ : graphqlConfig?.outputAdapter;
575
723
  const { onlyDocDirective, skipDocDirective } = (0, exports.getVisibilityDirectives)(cliOpts, config);
576
724
  // Build options using consistent precedence: CLI > Config > Default
577
725
  // The precedence is enforced by the OptionBuilder's setIfProvided method
@@ -599,9 +747,11 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default") => {
599
747
  .addFromConfig(config.tmpDir, "tmpDir")
600
748
  .addFromCli(cliOpts.tmp, "tmpDir")
601
749
  .build();
750
+ const printTypeOptions = getPrintTypeOptions(cliOpts, config.printTypeOptions);
602
751
  return {
603
752
  baseURL,
604
753
  customDirective: (0, exports.getCustomDirectives)(config.customDirective, skipDocDirective),
754
+ decorators: (0, exports.getDecoratorsOption)(config.decorators),
605
755
  diffMethod: force
606
756
  ? (0, exports.getForcedDiffMethod)()
607
757
  : (0, exports.getDiffMethod)(cliOpts.diff ?? config.diffMethod),
@@ -615,9 +765,10 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default") => {
615
765
  formatter: (0, exports.parseDeprecatedFormatterOption)(cliOpts, config),
616
766
  metatags: config.metatags ?? exports.DEFAULT_OPTIONS.metatags,
617
767
  onlyDocDirective,
768
+ outputAdapter,
618
769
  outputDir: (0, node_path_1.join)(rootPath, baseURL),
619
770
  prettify,
620
- printTypeOptions: getPrintTypeOptions(cliOpts, config.printTypeOptions),
771
+ printTypeOptions,
621
772
  schemaLocation,
622
773
  skipDocDirective,
623
774
  tmpDir,
@@ -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,I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AAI,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,OAAO,YACL,YAAY,GAAG,KAAK,KAC7B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAMlC,CAAC"}
@@ -36,7 +36,6 @@ const isTypeObject = (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 &&
@@ -28,7 +28,7 @@ export interface EmitResult {
28
28
  *
29
29
  * @category Events
30
30
  */
31
- declare class CancellableEventEmitter extends EventEmitter {
31
+ export declare class CancellableEventEmitter extends EventEmitter {
32
32
  private static toError;
33
33
  private static isDefaultPrevented;
34
34
  /**
@@ -110,5 +110,4 @@ export declare const getEvents: () => CancellableEventEmitter;
110
110
  * @category Events
111
111
  */
112
112
  export declare const resetEvents: () => void;
113
- export {};
114
113
  //# sourceMappingURL=event-emitter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../src/event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,K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BAAiB,GACvB,OAAO,CAAC,UAAU,CAAC,CAgBrB;YAEa,cAAc;YAOd,eAAe;YAsBf,gBAAgB;CAgB/B;AAQD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS,QAAO,uBAG5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,QAAO,IAK9B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resetEvents = exports.getEvents = void 0;
3
+ exports.resetEvents = exports.getEvents = exports.CancellableEventEmitter = void 0;
4
4
  const node_events_1 = require("node:events");
5
5
  /**
6
6
  * Custom EventEmitter that supports cancellable events with sequential handler execution.
@@ -96,6 +96,7 @@ class CancellableEventEmitter extends node_events_1.EventEmitter {
96
96
  }
97
97
  }
98
98
  }
99
+ exports.CancellableEventEmitter = CancellableEventEmitter;
99
100
  /**
100
101
  * Singleton instance of the CancellableEventEmitter.
101
102
  * Shared across the entire application.
@@ -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;KAC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