@graphql-markdown/printer-legacy 1.16.2 → 1.18.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,40 @@
5
5
  [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=graphql-markdown_printer-legacy&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=graphql-markdown_printer-legacy)
6
6
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=graphql-markdown_printer-legacy&metric=coverage)](https://sonarcloud.io/summary/new_code?id=graphql-markdown_printer-legacy)
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%3Dprinter-legacy)](https://dashboard.stryker-mutator.io/reports/github.com/graphql-markdown/graphql-markdown/main?module=printer-legacy)
8
+
9
+ Legacy Docusaurus-flavored MDX printer for GraphQL-Markdown. Converts GraphQL schema types into MDX pages, and is the printer used by default when no `formatter` is configured. New setups should prefer a formatter preset from [`@graphql-markdown/formatters`](https://www.npmjs.com/package/@graphql-markdown/formatters); this package is kept for backward compatibility with existing Docusaurus configurations and for `customDirective`-based decorators.
10
+
11
+ ## Installation
12
+
13
+ ```shell
14
+ npm install @graphql-markdown/printer-legacy
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ `printer-legacy` is typically consumed indirectly through [`@graphql-markdown/core`](https://www.npmjs.com/package/@graphql-markdown/core), which builds a `Printer` instance from the resolved configuration. It can also be used directly:
20
+
21
+ ```ts
22
+ import { Printer } from "@graphql-markdown/printer-legacy";
23
+
24
+ await Printer.init(schema, baseURL, options);
25
+ const page = await Printer.printType("query", queryType, options);
26
+ ```
27
+
28
+ ### Custom directive decorators
29
+
30
+ ```ts
31
+ import { buildCustomDirectiveDecorators } from "@graphql-markdown/printer-legacy";
32
+ ```
33
+
34
+ ## Documentation
35
+
36
+ - [Configuration Options](https://graphql-markdown.dev/docs/settings)
37
+ - [Custom Directives](https://graphql-markdown.dev/docs/advanced/custom-directive)
38
+ - [Integration with Frameworks](https://graphql-markdown.dev/docs/advanced/integration-with-frameworks)
39
+
40
+ ## License
41
+
42
+ GraphQL-Markdown packages are 100% free and open-source, under the [MIT license](https://github.com/graphql-markdown/graphql-markdown/blob/main/LICENSE).
43
+
44
+ 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.
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EAEL,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAgBjC,eAAO,MAAM,mBAAmB;IAC9B,UAAU;IACV,QAAQ;IACR,QAAQ;CACT,CAAC;AAEF;;;;;GAKG;AAGH,eAAO,MAAM,aAAa,SAClB,OAAO,WACJ,KAAK,CAAC,sBAAsB,CAAC,KACrC,KAAK,EA0CP,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,wBACA,KAAK,WACjB,gBAAgB,KACxB,SAWF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WACf,KAAK,EAAE,WACN,gBAAgB,KACxB,SAAS,GAAG,MASd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,SAChB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAUd,CAAC"}
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EAEL,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAgBjC,eAAO,MAAM,mBAAmB;IAC9B,UAAU;IACV,QAAQ;IACR,QAAQ;CACT,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,aAAa,SAClB,OAAO,WACJ,KAAK,CAAC,sBAAsB,CAAC,KACrC,KAAK,EA0CP,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,wBACA,KAAK,WACjB,gBAAgB,KACxB,SAWF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WACf,KAAK,EAAE,WACN,gBAAgB,KACxB,SAAS,GAAG,MASd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,SAChB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAUd,CAAC"}
package/dist/badge.js CHANGED
@@ -25,7 +25,6 @@ exports.CSS_BADGE_CLASSNAME = {
25
25
  * @returns Array of Badge objects containing text and optional classnames
26
26
  */
27
27
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
28
- // fallow-ignore-next-line unused-export
29
28
  const getTypeBadges = (type, groups) => {
30
29
  if (typeof type !== "object" || type === null) {
31
30
  return [];
package/dist/common.d.ts CHANGED
@@ -3,14 +3,6 @@
3
3
  * @module
4
4
  */
5
5
  import type { MDXString, PrintTypeOptions } from "@graphql-markdown/types";
6
- /**
7
- * Prints documentation for custom directives applied to a type.
8
- *
9
- * @param type - GraphQL type to get directives from
10
- * @param options - Printer configuration options
11
- * @returns Formatted directive documentation string
12
- */
13
- export declare const getCustomDirectivesText: (type: unknown, options?: PrintTypeOptions) => string;
14
6
  /**
15
7
  * Generates a warning message block in MDX format.
16
8
  * @param warningConfig - Warning configuration object with `text` and optional `title` properties
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAIV,SAAS,EACT,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAcjC;;;;;;GAMG;AAGH,eAAO,MAAM,uBAAuB,SAC5B,OAAO,YACH,gBAAgB,KACzB,MA4BF,CAAC;AAuBF;;;;;GAKG;AAGH,eAAO,MAAM,YAAY,oBACN;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WACzC,gBAAgB,KACxB,MAUF,CAAC;AAEF;;;;;GAKG;AAGH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,KACxB,MAcF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,WAChB,MAAM,KACd,SAAS,GAAG,MAKd,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAkCjC;;;;;GAKG;AAEH,eAAO,MAAM,YAAY,oBACN;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WACzC,gBAAgB,KACxB,MAUF,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,KACxB,MAcF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,WACJ,gBAAgB,WAChB,MAAM,KACd,SAAS,GAAG,MAYd,CAAC"}
package/dist/common.js CHANGED
@@ -4,39 +4,11 @@
4
4
  * @module
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.printDescription = exports.printDeprecation = exports.printWarning = exports.getCustomDirectivesText = void 0;
7
+ exports.printDescription = exports.printDeprecation = exports.printWarning = void 0;
8
8
  const utils_1 = require("@graphql-markdown/utils");
9
9
  const graphql_1 = require("@graphql-markdown/graphql");
10
10
  const strings_1 = require("./const/strings");
11
- const directive_1 = require("./directive");
12
- /**
13
- * Prints documentation for custom directives applied to a type.
14
- *
15
- * @param type - GraphQL type to get directives from
16
- * @param options - Printer configuration options
17
- * @returns Formatted directive documentation string
18
- */
19
- // Used only by unit tests for direct whitebox coverage; not part of the production public API.
20
- // fallow-ignore-next-line unused-export
21
- const getCustomDirectivesText = (type, options) => {
22
- const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options?.customDirectives);
23
- if ((0, utils_1.isEmpty)(constDirectiveMap)) {
24
- return "";
25
- }
26
- const content = Object.values(constDirectiveMap)
27
- .map((constDirectiveOption) => {
28
- return (0, directive_1.getCustomDirectiveResolver)("descriptor", type, constDirectiveOption, "");
29
- })
30
- .filter((text) => {
31
- return typeof text === "string" && text.length > 0;
32
- })
33
- .map((text) => {
34
- return (0, utils_1.escapeMDX)(text);
35
- })
36
- .join(strings_1.MARKDOWN_EOP);
37
- return `${strings_1.MARKDOWN_EOP}${content}`;
38
- };
39
- exports.getCustomDirectivesText = getCustomDirectivesText;
11
+ const decorator_1 = require("./decorator");
40
12
  /**
41
13
  * Formats a GraphQL type description or falls back to a default message.
42
14
  *
@@ -60,7 +32,6 @@ const formatDescription = (type, replacement = strings_1.NO_DESCRIPTION_TEXT) =>
60
32
  * @returns Formatted warning message as MDX string
61
33
  */
62
34
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
63
- // fallow-ignore-next-line unused-export
64
35
  const printWarning = ({ text, title }, options) => {
65
36
  const formattedText = typeof text !== "string" || text.trim() === ""
66
37
  ? strings_1.MARKDOWN_EOP
@@ -75,7 +46,6 @@ exports.printWarning = printWarning;
75
46
  * @returns Formatted deprecation warning as MDX string, or empty string if not deprecated
76
47
  */
77
48
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
78
- // fallow-ignore-next-line unused-export
79
49
  const printDeprecation = (type, options) => {
80
50
  if (typeof type !== "object" || type === null || !(0, graphql_1.isDeprecated)(type)) {
81
51
  return "";
@@ -95,8 +65,14 @@ exports.printDeprecation = printDeprecation;
95
65
  */
96
66
  const printDescription = (type, options, noText) => {
97
67
  const description = formatDescription(type, noText);
98
- const customDirectives = (0, exports.getCustomDirectivesText)(type, options);
99
68
  const deprecation = (0, exports.printDeprecation)(type, options);
100
- return `${deprecation}${description}${customDirectives}`;
69
+ // `customDirective`'s `descriptor` handlers reach this line via the
70
+ // decorators pipeline (`printSlotDecorators`), not a dedicated call — see
71
+ // `buildCustomDirectiveDecorators` in `./decorator`.
72
+ const decoratorContent = (0, decorator_1.printSlotDecorators)("description", type, options);
73
+ const decorators = decoratorContent.length > 0
74
+ ? `${strings_1.MARKDOWN_EOP}${decoratorContent.join(strings_1.MARKDOWN_EOP)}`
75
+ : "";
76
+ return `${deprecation}${description}${decorators}`;
101
77
  };
102
78
  exports.printDescription = printDescription;
@@ -17,8 +17,10 @@ export declare const PRINT_TYPE_DEFAULT_OPTIONS: Required<Omit<PrinterConfigPrin
17
17
  /**
18
18
  * Clean runtime options passed through the printer.
19
19
  */
20
- export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "exampleSection" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
20
+ export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "decorators" | "entity" | "exampleSection" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
21
21
  collapsible: Maybe<CollapsibleOption>;
22
+ decorators: PrintTypeOptions["decorators"];
23
+ entity: PrintTypeOptions["entity"];
22
24
  exampleSection: PrintTypeOptions["exampleSection"];
23
25
  groups: Maybe<SchemaEntitiesGroupMap>;
24
26
  level: Maybe<SectionLevelValue>;
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAajC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IAGX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB;;OAEG;IAGH,IAAI,KAAK;IACT,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAC/C,IAAI,CAAC,6BAA6B,EAAE,gBAAgB,CAAC,CACtD,GAAG;IACF,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAQpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CACpC,IAAI,CACF,gBAAgB,EACd,aAAa,GACb,gBAAgB,GAChB,0BAA0B,GAC1B,QAAQ,GACR,OAAO,GACP,MAAM,GACN,mBAAmB,GACnB,YAAY,GACZ,QAAQ,GACR,mBAAmB,CACtB,CACF,GAAG;IACF,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACtC,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAChC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CA6BvC,CAAC"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/const/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAcjC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IAEX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB;;OAEG;IAEH,IAAI,KAAK;IACT,KAAK,MAAM;CACZ;AAED,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAC/C,IAAI,CAAC,6BAA6B,EAAE,gBAAgB,CAAC,CACtD,GAAG;IACF,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAQpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CACpC,IAAI,CACF,gBAAgB,EACd,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,gBAAgB,GAChB,0BAA0B,GAC1B,QAAQ,GACR,OAAO,GACP,MAAM,GACN,mBAAmB,GACnB,YAAY,GACZ,QAAQ,GACR,mBAAmB,CACtB,CACF,GAAG;IACF,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACtC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACnC,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAChC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CA+BvC,CAAC"}
@@ -6,7 +6,6 @@ var TypeHierarchy;
6
6
  (function (TypeHierarchy) {
7
7
  TypeHierarchy["API"] = "api";
8
8
  // Used only by unit tests for direct whitebox coverage.
9
- // fallow-ignore-next-line unused-enum-member
10
9
  TypeHierarchy["ENTITY"] = "entity";
11
10
  TypeHierarchy["FLAT"] = "flat";
12
11
  })(TypeHierarchy || (exports.TypeHierarchy = TypeHierarchy = {}));
@@ -16,7 +15,6 @@ var SectionLevels;
16
15
  * @deprecated Use `SectionLevels.LEVEL` instead.
17
16
  */
18
17
  // Reserved for future usage.
19
- // fallow-ignore-next-line unused-enum-member
20
18
  SectionLevels["NONE"] = "";
21
19
  SectionLevels["LEVEL"] = "#";
22
20
  })(SectionLevels || (exports.SectionLevels = SectionLevels = {}));
@@ -35,7 +33,8 @@ exports.DEFAULT_OPTIONS = {
35
33
  deprecated: exports.PRINT_TYPE_DEFAULT_OPTIONS.deprecated,
36
34
  basePath: "/",
37
35
  collapsible: undefined,
38
- customDirectives: {},
36
+ decorators: undefined,
37
+ entity: undefined,
39
38
  exampleSection: undefined,
40
39
  groups: undefined,
41
40
  frontMatter: {},
@@ -58,5 +57,6 @@ exports.DEFAULT_OPTIONS = {
58
57
  formatMDXFrontmatter: defaults_1.formatMDXFrontmatter,
59
58
  formatMDXLink: defaults_1.formatMDXLink,
60
59
  formatMDXNameEntity: defaults_1.formatMDXNameEntity,
60
+ formatMDXPermalink: defaults_1.formatMDXPermalink,
61
61
  formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
62
62
  };
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Module providing predicate-driven decorators for type pages.
3
+ *
4
+ * A decorator (declared in the top-level `decorators` option) is selected by a
5
+ * predicate over the node being printed — by default, every node — and
6
+ * renders its resolved values through a user callback. There is no built-in
7
+ * notion of "this decorator's own directive": a directive-driven decorator
8
+ * selects its nodes with `predicate: hasDirectiveNamed("name")` and reads
9
+ * that directive's argument values, if any, from `resolve` via
10
+ * `@graphql-markdown/graphql`'s `getDirectiveFromSchema` combined with
11
+ * `getTypeDirectiveValues`/`getTypeDirectiveValuesList` — the same public
12
+ * helpers this module uses internally. A decorator with a title becomes a top-level
13
+ * section of the type page; one without renders bare content, placed relative
14
+ * to the built-in sections, or into a named slot such as the heading's
15
+ * metadata line or a member's description.
16
+ *
17
+ * `customDirective` is the deprecated predecessor of this module. It never
18
+ * reaches this module, or any other part of the printer: `@graphql-markdown/core`
19
+ * converts its schema-resolved directive map into decorator declarations
20
+ * (see {@link buildCustomDirectiveDecorators}) once, before the printer is
21
+ * ever invoked, so both options flow through the exact same resolve/render
22
+ * pipeline below — there is one code path for "select nodes by directive,
23
+ * render descriptor text, a badge, or a section", not two.
24
+ *
25
+ * @packageDocumentation
26
+ */
27
+ import type { CustomDirectiveMap, DecoratorDefinition, Decorators, Maybe, PageSection, PageSections, PrintTypeOptions } from "@graphql-markdown/types";
28
+ import { getSchemaEntity } from "@graphql-markdown/graphql";
29
+ export { getSchemaEntity };
30
+ /**
31
+ * A decorator, resolved from its declaration under `decorators`.
32
+ *
33
+ * @internal
34
+ */
35
+ export type ResolvedDecorator = DecoratorDefinition & {
36
+ /** The decorator id — the key under which it was declared. */
37
+ id: string;
38
+ };
39
+ /**
40
+ * Section/decorator keys owned by the printer, which a decorator cannot claim.
41
+ *
42
+ * Re-exported from the package root: `@graphql-markdown/core`'s
43
+ * `getDecoratorsOption` validates against this same list (plus `"__proto__"`,
44
+ * reserved only there — see that package's own copy of this comment) so the
45
+ * two entry points, config-file validation and building a decorators map
46
+ * directly against the printer API, can't silently drift apart on which
47
+ * names are reserved.
48
+ */
49
+ export declare const RESERVED_SECTION_NAMES: readonly string[];
50
+ /**
51
+ * Converts the deprecated `customDirective` option's schema-resolved
52
+ * directive map into decorator declarations, so it flows through the exact
53
+ * same resolve/render pipeline as everything declared under `decorators`.
54
+ *
55
+ * Called once by `@graphql-markdown/core`, right after `customDirectives` is
56
+ * schema-resolved, and merged directly into the top-level `decorators`
57
+ * option before it reaches the printer — `customDirective`/`CustomDirectiveMap`
58
+ * never reach this printer package otherwise; only the three decorators
59
+ * built here do, indistinguishable from any other `decorators` entry except
60
+ * for their reserved ids (see {@link CUSTOM_DIRECTIVE_DECORATOR_IDS}).
61
+ *
62
+ * Returns three entries:
63
+ * - `customDirectives`: the built-in "Directives" section, listing every
64
+ * custom directive declared on a type, positioned right after `code`
65
+ * (its fixed position in the pre-decorators built-in section order).
66
+ * - `customDirective:description`: `customDirective`'s `descriptor`
67
+ * handlers, appended as description text (`position: { into: "description" }`).
68
+ * - `customDirective:tags`: `customDirective`'s `tag` handlers, rendered as
69
+ * badges in the metadata line (`position: { into: "tags" }`).
70
+ *
71
+ * All three share one `resolve`, reading every custom directive matched on
72
+ * a node, in schema declaration order. Matching (including wildcard `"*"`
73
+ * precedence — a named handler wins over `"*"`) is already resolved by
74
+ * `getConstDirectiveMap` (fed by `@graphql-markdown/graphql`'s
75
+ * `getCustomDirectives`, which expands a wildcard into concrete
76
+ * per-directive entries upstream), so this reuses that resolution rather
77
+ * than re-implementing it against the generic predicate system.
78
+ *
79
+ * @param customDirectives - the schema-resolved `customDirective` map, or
80
+ * `undefined`/empty when the option is not in use.
81
+ *
82
+ * @returns the three decorators, or `{}` when `customDirectives` is empty.
83
+ *
84
+ */
85
+ export declare const buildCustomDirectiveDecorators: (customDirectives: Maybe<CustomDirectiveMap>) => Decorators;
86
+ /**
87
+ * Builds the example section as a decorator definition.
88
+ *
89
+ * The example section is a specialized decorator: it is driven by a schema
90
+ * directive, named by [`printTypeOptions.exampleSection`](https://graphql-markdown.dev/docs/settings#printtypeoptions),
91
+ * and rendered as a code block.
92
+ *
93
+ * It resolves its own value rather than gating on a directive by name,
94
+ * because an example is also derived from the fields of a type carrying no
95
+ * example directive itself — the directive lookup (which schema directive
96
+ * name to use, from `printTypeOptions.exampleSection`) belongs to
97
+ * {@link printExample} alone.
98
+ *
99
+ * @param options - the print options in effect.
100
+ *
101
+ * @returns the example decorator definition.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const section = getExampleSectionDefinition(options);
106
+ * const example = printDecorator(type, section, options);
107
+ * ```
108
+ *
109
+ */
110
+ export declare const getExampleSectionDefinition: () => ResolvedDecorator;
111
+ /**
112
+ * Prints a single decorator for a type, as a titled page section.
113
+ *
114
+ * Reserved ids are filtered by `getDeclaredDecorators`, not here: the built-in
115
+ * sections are themselves declared with a reserved id.
116
+ *
117
+ * @param type - the GraphQL type being printed.
118
+ * @param decorator - the resolved decorator declaration.
119
+ * @param options - the print options in effect.
120
+ *
121
+ * @returns the rendered page section, or `undefined` when nothing to print.
122
+ *
123
+ */
124
+ export declare const printDecorator: (type: unknown, decorator: ResolvedDecorator, options: PrintTypeOptions) => Maybe<PageSection>;
125
+ /**
126
+ * Prints every decorator declared in the print options, excluding those
127
+ * targeting a named slot (`position: { into }`) — those are not part of the
128
+ * page's section order and are printed separately, into their slot.
129
+ *
130
+ * Every declared decorator yields an entry, so that composition hooks can
131
+ * restore one which rendered no content. Decorators with a reserved or
132
+ * repeated id are dropped.
133
+ *
134
+ * @param type - the GraphQL type being printed.
135
+ * @param options - the print options in effect.
136
+ *
137
+ * @returns a map of decorator id to rendered section, empty when none is declared.
138
+ *
139
+ */
140
+ export declare const printDecorators: (type: unknown, options: PrintTypeOptions) => PageSections;
141
+ /**
142
+ * Prints every decorator declared for a named slot (`position: { into: slot }`),
143
+ * as raw content rather than a page section — used to splice decorator output
144
+ * into a slot outside the page's section order, such as the metadata line of a
145
+ * type or field heading, or a member's description.
146
+ *
147
+ * @param slot - the slot name (matches a decorator's `position.into`).
148
+ * @param type - the GraphQL type being printed.
149
+ * @param options - the print options in effect.
150
+ *
151
+ * @returns the rendered content for every decorator targeting `slot`, in
152
+ * declaration order; empty when none target it or render no content.
153
+ *
154
+ */
155
+ export declare const printSlotDecorators: (slot: string, type: unknown, options: PrintTypeOptions) => string[];
156
+ /**
157
+ * Splices the decorators into the built-in section order.
158
+ *
159
+ * A decorator is placed after or before the section named by its `position`,
160
+ * and appended last when `position` is absent or names an unknown section.
161
+ * A decorator using `into` (a named slot outside the page section order — see
162
+ * {@link DecoratorPosition}) is excluded entirely: it is not part of the page
163
+ * section order and is printed separately, into its slot. Decorators are
164
+ * placed in declaration order, so a decorator may target a previously placed
165
+ * one.
166
+ *
167
+ * @param sectionOrder - the built-in section order.
168
+ * @param options - the print options in effect.
169
+ *
170
+ * @returns the section order including the decorators.
171
+ *
172
+ */
173
+ export declare const getDecoratorsOrder: (sectionOrder: readonly string[], options: PrintTypeOptions) => string[];
174
+ //# sourceMappingURL=decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../src/decorator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAEV,kBAAkB,EAIlB,mBAAmB,EACnB,UAAU,EAEV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAGL,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAgBnC,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG;IACpD,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAa1C,CAAC;AA8EX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,8BAA8B,qBACvB,KAAK,CAAC,kBAAkB,CAAC,KAC1C,UAqFF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,2BAA2B,QAAO,iBAe9C,CAAC;AA4FF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,SACnB,OAAO,aACF,iBAAiB,WACnB,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAcnB,CAAC;AAyDF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,WACJ,gBAAgB,KACxB,YAgBF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,QACN,OAAO,WACJ,gBAAgB,KACxB,MAAM,EAcR,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,iBACf,SAAS,MAAM,EAAE,WACtB,gBAAgB,KACxB,MAAM,EAuBR,CAAC"}