@graphql-markdown/core 1.27.0 → 1.28.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
@@ -41,12 +41,12 @@ getEvents().on(SchemaEvents.AFTER_LOAD, (event) => {
41
41
  });
42
42
  ```
43
43
 
44
- See the [hooks recipes](https://graphql-markdown.dev/docs/advanced/hook-recipes) for the full list of lifecycle events and their payloads.
44
+ See the [hooks recipes](https://graphql-markdown.dev/docs/customize/hooks) for the full list of lifecycle events and their payloads.
45
45
 
46
46
  ## Documentation
47
47
 
48
- - [Configuration Options](https://graphql-markdown.dev/docs/settings)
49
- - [Hooks Recipes](https://graphql-markdown.dev/docs/advanced/hook-recipes)
48
+ - [Configuration Options](https://graphql-markdown.dev/docs/reference/settings)
49
+ - [Hooks Recipes](https://graphql-markdown.dev/docs/customize/hooks)
50
50
 
51
51
  ## License
52
52
 
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, Decorators, DirectiveName, GroupByDirectiveOptions, Maybe, Options, TypeDiffMethod, TypeHierarchyObjectType, TypeHierarchyType, TypeHierarchyValueType } from "@graphql-markdown/types";
18
+ import type { CliOptions, ConfigDocOptions, ConfigOptions, ConfigPrintTypeOptions, Decorators, DirectiveName, GroupByDirectiveOptions, Maybe, Options, TypeDiffMethod, TypeHierarchyObjectType, TypeHierarchyType, TypeHierarchyValueType } from "@graphql-markdown/types";
19
19
  import type { BuildConfigContext } from "./telemetry.ts";
20
20
  /**
21
21
  * Type hierarchy options for organizing schema documentation.
@@ -74,6 +74,26 @@ export declare enum DeprecatedOption {
74
74
  * @public
75
75
  */
76
76
  export declare const DOCS_URL: "https://graphql-markdown.dev/docs";
77
+ /**
78
+ * Throws when a configuration contains a top-level key that is not a supported setting.
79
+ *
80
+ * @param config - the merged configuration object to check.
81
+ * @throws Error naming every unsupported setting, with a suggestion for likely typos, and the docs page listing supported ones.
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * assertSupportedOptions({ mdxParser: "./parser.js" });
86
+ * // Error: Unsupported setting "mdxParser". See ...
87
+ *
88
+ * assertSupportedOptions({ foo: 1, mdxParser: "./parser.js" });
89
+ * // Error: Unsupported settings "foo", "mdxParser". See ...
90
+ *
91
+ * assertSupportedOptions({ fromatter: "nuxt" });
92
+ * // Error: Unsupported setting "fromatter" (did you mean "formatter"?). See ...
93
+ * ```
94
+ * @public
95
+ */
96
+ export declare const assertSupportedOptions: (config: unknown) => void;
77
97
  /**
78
98
  * Default package name used for temporary directory creation and identification.
79
99
  * @public
@@ -99,7 +119,7 @@ export declare const DEFAULT_HIERARCHY: {
99
119
  * @public
100
120
  * @see {@link Options} for the complete configuration interface
101
121
  */
102
- export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "customDirective" | "decorators" | "groupByDirective" | "loaders" | "outputAdapter"> & Required<Omit<ConfigOptions, "customDirective" | "decorators" | "formatter" | "groupByDirective" | "homepage" | "loaders" | "mdxParser" | "outputAdapter" | "printTypeOptions" | "telemetry">>> & {
122
+ export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "decorators" | "groupByDirective" | "loaders" | "outputAdapter"> & Required<Omit<ConfigOptions, "decorators" | "formatter" | "groupByDirective" | "homepage" | "loaders" | "outputAdapter" | "printTypeOptions" | "telemetry">>> & {
103
123
  homepage: typeof ASSET_HOMEPAGE_LOCATION;
104
124
  printTypeOptions: Required<Omit<ConfigPrintTypeOptions, "exampleSection" | "hierarchy">> & {
105
125
  exampleSection: ConfigPrintTypeOptions["exampleSection"];
@@ -193,37 +213,6 @@ export declare const getVisibilityDirectives: (cliOpts: Maybe<CliOptions>, confi
193
213
  onlyDocDirective: DirectiveName[];
194
214
  skipDocDirective: DirectiveName[];
195
215
  };
196
- /**
197
- * Processes custom directives, filtering out any that should be skipped.
198
- * Validates that each custom directive has the correct format with required functions.
199
- *
200
- * @param customDirectiveOptions - The custom directive configuration object
201
- * @param skipDocDirective - Array of directive names that should be skipped
202
- * @returns The filtered custom directives object, or `undefined` if empty/invalid
203
- * @throws Error if a custom directive has an invalid format
204
- * @example
205
- * ```typescript
206
- * // Valid custom directive with descriptor function
207
- * const customDirectives = {
208
- * example: {
209
- * tag: (value) => `Example: ${value}`
210
- * },
211
- * note: {
212
- * descriptor: () => "Note items"
213
- * }
214
- * };
215
- *
216
- * // Filter out the "example" directive, keeping "note"
217
- * const filteredDirectives = getCustomDirectives(customDirectives, ["example"]);
218
- * console.log(filteredDirectives); // { note: { descriptor: [Function] } }
219
- *
220
- * // Invalid format - will throw an error
221
- * getCustomDirectives({ example: { invalid: true } }, []);
222
- * // Error: Wrong format for plugin custom directive "example"...
223
- * ```
224
- * @see {@link DOCS_URL}/advanced/custom-directive for custom directive format documentation
225
- */
226
- export declare const getCustomDirectives: (customDirectiveOptions: Maybe<CustomDirective>, skipDocDirective?: Maybe<DirectiveName[]>) => Maybe<CustomDirective>;
227
216
  /**
228
217
  * Returns FORCE as the diff method.
229
218
  * This function is used when documentation should be forcefully regenerated.
@@ -265,7 +254,6 @@ export declare const getDocOptions: (cliOpts?: Maybe<CliOptions>, configOptions?
265
254
  * @see {@link TypeHierarchy} for available hierarchy types
266
255
  */
267
256
  export declare const getTypeHierarchyOption: (cliOption?: Maybe<TypeHierarchyValueType>, configOption?: Maybe<TypeHierarchyType>) => Maybe<TypeHierarchyObjectType>;
268
- export declare const parseDeprecatedFormatterOption: (cliOpts?: Maybe<CliOptions>, configOptions?: Maybe<ConfigOptions>) => Maybe<string>;
269
257
  export declare const parseDeprecatedPrintTypeOptions: (_cliOpts?: Maybe<CliOptions>, _configOptions?: Maybe<ConfigPrintTypeOptions>) => Record<string, never>;
270
258
  /**
271
259
  * Validates the top-level `decorators` option.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],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KAAK,CAAC,MAAM,GAAG,OAAO,uBAAuB,CAc/C,CAAC;AAoDF,eAAO,MAAM,WAAW,mBACN,KAAK,CAAC,aAAa,CAAC,YAC1B,KAAK,CAAC,UAAU,CAAC,OACvB,KAAK,CAAC,MAAM,CAAC,YACP,kBAAkB,KAC3B,OAAO,CAAC,OAAO,CA6GjB,CAAC"}
package/dist/config.js CHANGED
@@ -17,16 +17,14 @@
17
17
  * @packageDocumentation
18
18
  */
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
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;
20
+ exports.buildConfig = exports.parseHomepageOption = exports.parseGroupByOption = exports.getDecoratorsOption = exports.parseDeprecatedPrintTypeOptions = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = exports.getForcedDiffMethod = exports.getVisibilityDirectives = exports.getSkipDocDirectives = exports.getOnlyDocDirectives = exports.getDocDirective = exports.DEFAULT_OPTIONS = exports.DEFAULT_HIERARCHY = exports.ASSET_HOMEPAGE_LOCATION = exports.PACKAGE_NAME = exports.assertSupportedOptions = 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
- const logger_1 = require("@graphql-markdown/logger");
25
24
  const printer_legacy_1 = require("@graphql-markdown/printer-legacy");
26
25
  const graphql_config_ts_1 = require("./graphql-config.js");
27
26
  const telemetry_ts_1 = require("./telemetry.js");
28
27
  const patterns_ts_1 = require("./const/patterns.js");
29
- const validation_ts_1 = require("./directives/validation.js");
30
28
  const builder_ts_1 = require("./options/builder.js");
31
29
  /**
32
30
  * Type hierarchy options for organizing schema documentation.
@@ -88,6 +86,125 @@ var DeprecatedOption;
88
86
  * @public
89
87
  */
90
88
  exports.DOCS_URL = "https://graphql-markdown.dev/docs";
89
+ /**
90
+ * Every supported top-level configuration key. Typed against `ConfigOptions`
91
+ * so the compiler flags a key added to or removed from the interface.
92
+ * @internal
93
+ */
94
+ const CONFIG_OPTION_KEYS = {
95
+ baseURL: true,
96
+ decorators: true,
97
+ diffMethod: true,
98
+ docOptions: true,
99
+ force: true,
100
+ formatter: true,
101
+ groupByDirective: true,
102
+ homepage: true,
103
+ id: true,
104
+ linkRoot: true,
105
+ loaders: true,
106
+ metatags: true,
107
+ onlyDocDirective: true,
108
+ outputAdapter: true,
109
+ pretty: true,
110
+ printTypeOptions: true,
111
+ rootPath: true,
112
+ schema: true,
113
+ skipDocDirective: true,
114
+ telemetry: true,
115
+ tmpDir: true,
116
+ };
117
+ /**
118
+ * Keys that `graphql-config` adds to every project extension object, on top of
119
+ * the supported options.
120
+ * @internal
121
+ */
122
+ const GRAPHQL_CONFIG_PROJECT_KEYS = [
123
+ "schema",
124
+ "documents",
125
+ "include",
126
+ "exclude",
127
+ ];
128
+ /**
129
+ * Levenshtein distance between two strings, compared case-insensitively.
130
+ * @internal
131
+ */
132
+ const editDistance = (a, b) => {
133
+ const left = a.toLowerCase();
134
+ const right = b.toLowerCase();
135
+ let previous = Array.from({ length: right.length + 1 }, (_, index) => {
136
+ return index;
137
+ });
138
+ for (let i = 1; i <= left.length; i++) {
139
+ const current = [i];
140
+ for (let j = 1; j <= right.length; j++) {
141
+ const cost = left[i - 1] === right[j - 1] ? 0 : 1;
142
+ current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + cost);
143
+ }
144
+ previous = current;
145
+ }
146
+ return previous[right.length];
147
+ };
148
+ /**
149
+ * Returns the supported setting closest to `key` when it looks like a typo,
150
+ * i.e. within one edit for short names and two for longer ones.
151
+ * @internal
152
+ */
153
+ const suggestSetting = (key, supported) => {
154
+ const maxDistance = key.length > 4 ? 2 : 1;
155
+ let best;
156
+ let bestDistance = maxDistance + 1;
157
+ for (const candidate of supported) {
158
+ const distance = editDistance(key, candidate);
159
+ if (distance < bestDistance) {
160
+ best = candidate;
161
+ bestDistance = distance;
162
+ }
163
+ }
164
+ return best;
165
+ };
166
+ /**
167
+ * Throws when a configuration contains a top-level key that is not a supported setting.
168
+ *
169
+ * @param config - the merged configuration object to check.
170
+ * @throws Error naming every unsupported setting, with a suggestion for likely typos, and the docs page listing supported ones.
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * assertSupportedOptions({ mdxParser: "./parser.js" });
175
+ * // Error: Unsupported setting "mdxParser". See ...
176
+ *
177
+ * assertSupportedOptions({ foo: 1, mdxParser: "./parser.js" });
178
+ * // Error: Unsupported settings "foo", "mdxParser". See ...
179
+ *
180
+ * assertSupportedOptions({ fromatter: "nuxt" });
181
+ * // Error: Unsupported setting "fromatter" (did you mean "formatter"?). See ...
182
+ * ```
183
+ * @public
184
+ */
185
+ const assertSupportedOptions = (config) => {
186
+ const supported = new Set([
187
+ ...Object.keys(CONFIG_OPTION_KEYS),
188
+ ...GRAPHQL_CONFIG_PROJECT_KEYS,
189
+ ]);
190
+ const unsupported = Object.keys((config ?? {})).filter((key) => {
191
+ return !supported.has(key);
192
+ });
193
+ if (unsupported.length === 0) {
194
+ return;
195
+ }
196
+ const label = unsupported.length === 1 ? "setting" : "settings";
197
+ const names = unsupported
198
+ .map((key) => {
199
+ const suggestion = suggestSetting(key, supported);
200
+ return suggestion === undefined
201
+ ? `"${key}"`
202
+ : `"${key}" (did you mean "${suggestion}"?)`;
203
+ })
204
+ .join(", ");
205
+ throw new Error(`Unsupported ${label} ${names}. See ${exports.DOCS_URL}/reference/settings for the list of supported settings.`);
206
+ };
207
+ exports.assertSupportedOptions = assertSupportedOptions;
91
208
  /**
92
209
  * Default package name used for temporary directory creation and identification.
93
210
  * @public
@@ -118,7 +235,6 @@ let defaultTmpDir;
118
235
  exports.DEFAULT_OPTIONS = {
119
236
  id: "default",
120
237
  baseURL: "schema",
121
- customDirective: undefined,
122
238
  decorators: undefined,
123
239
  diffMethod: DiffMethod.NONE,
124
240
  docOptions: {
@@ -274,59 +390,6 @@ const getVisibilityDirectives = (cliOpts, configFileOpts) => {
274
390
  return { onlyDocDirective, skipDocDirective };
275
391
  };
276
392
  exports.getVisibilityDirectives = getVisibilityDirectives;
277
- /**
278
- * Processes custom directives, filtering out any that should be skipped.
279
- * Validates that each custom directive has the correct format with required functions.
280
- *
281
- * @param customDirectiveOptions - The custom directive configuration object
282
- * @param skipDocDirective - Array of directive names that should be skipped
283
- * @returns The filtered custom directives object, or `undefined` if empty/invalid
284
- * @throws Error if a custom directive has an invalid format
285
- * @example
286
- * ```typescript
287
- * // Valid custom directive with descriptor function
288
- * const customDirectives = {
289
- * example: {
290
- * tag: (value) => `Example: ${value}`
291
- * },
292
- * note: {
293
- * descriptor: () => "Note items"
294
- * }
295
- * };
296
- *
297
- * // Filter out the "example" directive, keeping "note"
298
- * const filteredDirectives = getCustomDirectives(customDirectives, ["example"]);
299
- * console.log(filteredDirectives); // { note: { descriptor: [Function] } }
300
- *
301
- * // Invalid format - will throw an error
302
- * getCustomDirectives({ example: { invalid: true } }, []);
303
- * // Error: Wrong format for plugin custom directive "example"...
304
- * ```
305
- * @see {@link DOCS_URL}/advanced/custom-directive for custom directive format documentation
306
- */
307
- // Used only by unit tests for direct whitebox coverage; not part of the production public API.
308
- const getCustomDirectives = (customDirectiveOptions, skipDocDirective) => {
309
- if (!customDirectiveOptions ||
310
- Object.keys(customDirectiveOptions).length === 0) {
311
- return undefined;
312
- }
313
- (0, logger_1.log)(`Setting "customDirective" is deprecated and will be removed in a future version. Use "decorators" instead.`, logger_1.LogLevel.warn);
314
- for (const [name, option] of Object.entries(customDirectiveOptions)) {
315
- if (Array.isArray(skipDocDirective) &&
316
- skipDocDirective.includes(name)) {
317
- delete customDirectiveOptions[name];
318
- }
319
- else if ((0, validation_ts_1.isInvalidFunctionProperty)(option, "descriptor") ||
320
- (0, validation_ts_1.isInvalidFunctionProperty)(option, "tag") ||
321
- !("tag" in option || "descriptor" in option)) {
322
- throw new Error(`Wrong format for plugin custom directive "${name}".\nPlease refer to ${exports.DOCS_URL}/advanced/custom-directive`);
323
- }
324
- }
325
- return Object.keys(customDirectiveOptions).length > 0
326
- ? customDirectiveOptions
327
- : undefined;
328
- };
329
- exports.getCustomDirectives = getCustomDirectives;
330
393
  /**
331
394
  * Returns FORCE as the diff method.
332
395
  * This function is used when documentation should be forcefully regenerated.
@@ -472,17 +535,6 @@ const getTypeHierarchyOption = (cliOption, configOption) => {
472
535
  };
473
536
  exports.getTypeHierarchyOption = getTypeHierarchyOption;
474
537
  // Used only by unit tests for direct whitebox coverage; not part of the production public API.
475
- const parseDeprecatedFormatterOption = (cliOpts, configOptions) => {
476
- const legacyCli = cliOpts?.mdxParser ?? null; // NOSONAR typescript:S1874
477
- const legacyConfig = configOptions?.mdxParser; // NOSONAR typescript:S1874
478
- if (legacyCli !== null ||
479
- (legacyConfig !== undefined && legacyConfig !== null)) {
480
- (0, logger_1.log)(`Setting "mdxParser" is deprecated and will be removed in a future version. Use "formatter" instead.`, logger_1.LogLevel.warn);
481
- }
482
- return (cliOpts?.formatter ?? legacyCli ?? configOptions?.formatter ?? legacyConfig);
483
- };
484
- exports.parseDeprecatedFormatterOption = parseDeprecatedFormatterOption;
485
- // Used only by unit tests for direct whitebox coverage; not part of the production public API.
486
538
  const parseDeprecatedPrintTypeOptions = (_cliOpts, _configOptions) => {
487
539
  return {};
488
540
  };
@@ -718,6 +770,7 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default", context) =>
718
770
  ...configFileOpts?.printTypeOptions,
719
771
  });
720
772
  const config = (0, deepmerge_1.deepmerge)()({ ...exports.DEFAULT_OPTIONS, ...graphqlConfig }, configFileOpts ?? {});
773
+ (0, exports.assertSupportedOptions)(config);
721
774
  // deepmerge rebuilds objects as prototype-less plain copies, which strips the
722
775
  // methods off a class-based adapter. Take it from the raw sources instead, so
723
776
  // `new MyAdapter()` keeps working as well as an object literal.
@@ -766,7 +819,6 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default", context) =>
766
819
  void (0, telemetry_ts_1.reportTelemetry)(telemetryReport);
767
820
  return {
768
821
  baseURL,
769
- customDirective: (0, exports.getCustomDirectives)(config.customDirective, skipDocDirective),
770
822
  decorators: (0, exports.getDecoratorsOption)(config.decorators),
771
823
  diffMethod: force
772
824
  ? (0, exports.getForcedDiffMethod)()
@@ -778,7 +830,7 @@ const buildConfig = async (configFileOpts, cliOpts, id = "default", context) =>
778
830
  id: id ?? exports.DEFAULT_OPTIONS.id,
779
831
  linkRoot,
780
832
  loaders: config.loaders,
781
- formatter: (0, exports.parseDeprecatedFormatterOption)(cliOpts, config),
833
+ formatter: cliOpts.formatter ?? config.formatter,
782
834
  metatags: config.metatags ?? exports.DEFAULT_OPTIONS.metatags,
783
835
  onlyDocDirective,
784
836
  outputAdapter,
@@ -11,14 +11,14 @@ import type { DirectiveName, Formatter, GeneratorOptions, GraphQLDirective, Grap
11
11
  /**
12
12
  * Asynchronously loads an MDX module dynamically.
13
13
  *
14
- * @param mdxParser - The MDX parser package name or path to import. Can be null or undefined.
14
+ * @param formatter - The formatter package name or path to import. Can be null or undefined.
15
15
  * @returns A promise that resolves to the imported module, or undefined if:
16
- * - The mdxParser parameter is null or undefined
16
+ * - The formatter parameter is null or undefined
17
17
  * - An error occurs during import (logs a warning and returns undefined)
18
18
  *
19
19
  * @internal
20
20
  */
21
- export declare const loadMDXModule: (mdxParser: Maybe<PackageName | string>) => Promise<unknown>;
21
+ export declare const loadMDXModule: (formatter: Maybe<PackageName | string>) => Promise<unknown>;
22
22
  /**
23
23
  * Gets a property from an MDX module, checking both the module directly and `module.default`.
24
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAEV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,WAAW,EAEX,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAkEjC;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,cACb,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,KACrC,OAAO,CAAC,OAAO,CAgBjB,CAAC;AAkBF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,aACzB,OAAO,gBACJ,MAAM,KACnB,CAAC,GAAG,SAmBN,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,cACzB,OAAO,SACX,QAAQ,KACd,OAAO,CAAC,SAAS,CAAC,GAAG,SA+CvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,mBACZ,MAAM,eACT,KAAK,CAAC,YAAY,CAAC,KAC/B,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAY9B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,sBAAsB,WACzB,aAAa,kBACL,MAAM,cACV,KAAK,CAAC,cAAc,CAAC,UACzB,MAAM,KACb,OAAO,CAAC,OAAO,CAWjB,CAAC;AAEF;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,4BAA4B,qBACrB,KAAK,CAAC,aAAa,GAAG,aAAa,EAAE,CAAC,oBACtC,KAAK,CAAC,aAAa,GAAG,aAAa,EAAE,CAAC,UAChD,aAAa,KACpB,gBAAgB,EAAE,E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AAC;AAuQF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,YACvB,gBAAgB,KACxB,OAAO,CAAC,IAAI,CAsBd,CAAC"}
package/dist/generator.js CHANGED
@@ -44,7 +44,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.generateDocFromSchema = exports.resolveSkipAndOnlyDirectives = exports.checkSchemaDifferences = exports.loadGraphqlSchema = exports.getFormatterFromMDXModule = exports.getMDXModuleProperty = exports.loadMDXModule = void 0;
45
45
  const logger_1 = __importStar(require("@graphql-markdown/logger"));
46
46
  const graphql_1 = require("@graphql-markdown/graphql");
47
- const printer_legacy_1 = require("@graphql-markdown/printer-legacy");
48
47
  const utils_1 = require("@graphql-markdown/utils");
49
48
  const node_path_1 = require("node:path");
50
49
  const config_ts_1 = require("./config.js");
@@ -82,24 +81,24 @@ const SEC_DECIMALS = 3;
82
81
  /**
83
82
  * Asynchronously loads an MDX module dynamically.
84
83
  *
85
- * @param mdxParser - The MDX parser package name or path to import. Can be null or undefined.
84
+ * @param formatter - The formatter package name or path to import. Can be null or undefined.
86
85
  * @returns A promise that resolves to the imported module, or undefined if:
87
- * - The mdxParser parameter is null or undefined
86
+ * - The formatter parameter is null or undefined
88
87
  * - An error occurs during import (logs a warning and returns undefined)
89
88
  *
90
89
  * @internal
91
90
  */
92
- const loadMDXModule = async (mdxParser) => {
93
- if (mdxParser === undefined || mdxParser === null) {
91
+ const loadMDXModule = async (formatter) => {
92
+ if (formatter === undefined || formatter === null) {
94
93
  return undefined;
95
94
  }
96
95
  // Specifier is only known at runtime (user-configured formatter package).
97
96
  // Resolved into a variable first: tsgo's CJS emit of `import(fn(x))` with
98
97
  // rewriteRelativeImportExtensions leaves `fn` unqualified (ReferenceError).
99
- const specifier = (0, utils_1.runtimeModuleSpecifier)(mdxParser);
98
+ const specifier = (0, utils_1.runtimeModuleSpecifier)(formatter);
100
99
  return import(__rewriteRelativeImportExtension(specifier)).catch((error) => {
101
100
  const errorMessage = error instanceof Error ? error.message : String(error);
102
- (0, logger_1.log)(`An error occurred while loading MDX formatter "${mdxParser}": ${errorMessage}`, logger_1.LogLevel.warn);
101
+ (0, logger_1.log)(`An error occurred while loading formatter "${formatter}": ${errorMessage}`, logger_1.LogLevel.warn);
103
102
  return undefined;
104
103
  });
105
104
  };
@@ -165,35 +164,35 @@ const getFormatterFromMDXModule = (mdxModule, meta) => {
165
164
  return undefined;
166
165
  }
167
166
  const module = mdxModule;
168
- // Check for createMDXFormatter on the module directly (internal/advanced usage)
169
- if ("createMDXFormatter" in module &&
170
- typeof module.createMDXFormatter === "function") {
171
- return module.createMDXFormatter(meta);
172
- }
173
- // Check for createMDXFormatter on module.default (ESM default export)
174
167
  const defaultExport = module.default;
175
- if (defaultExport &&
176
- "createMDXFormatter" in defaultExport &&
177
- typeof defaultExport.createMDXFormatter === "function") {
178
- return defaultExport.createMDXFormatter(meta);
179
- }
180
- // Check for individual formatter functions
181
- const formatter = {};
168
+ // Collect individual formatter functions (module takes precedence over module.default)
169
+ const ownFunctions = {};
182
170
  let hasFormatter = false;
183
171
  for (const funcName of FORMATTER_FUNCTION_NAMES) {
184
172
  if (funcName in module && typeof module[funcName] === "function") {
185
- formatter[funcName] = module[funcName];
173
+ ownFunctions[funcName] = module[funcName];
186
174
  hasFormatter = true;
187
175
  }
188
176
  else if (defaultExport &&
189
177
  funcName in defaultExport &&
190
178
  typeof defaultExport[funcName] === "function") {
191
- formatter[funcName] =
179
+ ownFunctions[funcName] =
192
180
  defaultExport[funcName];
193
181
  hasFormatter = true;
194
182
  }
195
183
  }
196
- return hasFormatter ? formatter : undefined;
184
+ // Check for createMDXFormatter on the module, then on module.default (ESM)
185
+ const factory = [module, defaultExport].find((source) => {
186
+ return (source &&
187
+ "createMDXFormatter" in source &&
188
+ typeof source.createMDXFormatter === "function");
189
+ })?.createMDXFormatter;
190
+ if (factory) {
191
+ // Own exported functions override the ones built by the factory, so that
192
+ // `{ ...preset, formatMDXBadge }` works despite spreading `createMDXFormatter`.
193
+ return hasFormatter ? { ...factory(meta), ...ownFunctions } : factory(meta);
194
+ }
195
+ return hasFormatter ? ownFunctions : undefined;
197
196
  };
198
197
  exports.getFormatterFromMDXModule = getFormatterFromMDXModule;
199
198
  /**
@@ -292,7 +291,7 @@ const runGeneration = async (options, start, outcome) => {
292
291
  // Emitted before destructuring `options` below, so a hook that mutates
293
292
  // `event.data.config` (same object reference as `options`) is picked up.
294
293
  await events.emitAsync(index_ts_1.ConfigBuildEvents.AFTER_BUILD, new index_ts_1.ConfigBuildEvent({ config: options }));
295
- const { baseURL, customDirective, decorators, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, metatags, onlyDocDirective, outputAdapter, outputDir, prettify, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, } = options;
294
+ const { baseURL, decorators, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, metatags, onlyDocDirective, outputAdapter, outputDir, prettify, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, } = options;
296
295
  await events.emitAsync(index_ts_1.SchemaEvents.BEFORE_LOAD, new index_ts_1.SchemaEvent({
297
296
  schemaLocation: schemaLocation,
298
297
  }));
@@ -316,14 +315,6 @@ const runGeneration = async (options, start, outcome) => {
316
315
  events.emit(index_ts_1.SchemaEvents.BEFORE_MAP, new index_ts_1.SchemaEvent({ schema }));
317
316
  const rootTypes = (0, graphql_1.getSchemaMap)(schema);
318
317
  events.emit(index_ts_1.SchemaEvents.AFTER_MAP, new index_ts_1.SchemaEvent({ schema, rootTypes }));
319
- // `customDirective` is schema-resolved here, then immediately converted
320
- // into decorators and merged into `decorators` itself: the printer never
321
- // sees `customDirective` or the resolved `CustomDirectiveMap` it produces,
322
- // only the merged decorators (see `buildCustomDirectiveDecorators`).
323
- const decoratorsWithCustomDirective = {
324
- ...(0, printer_legacy_1.buildCustomDirectiveDecorators)((0, graphql_1.getCustomDirectives)(rootTypes, customDirective)),
325
- ...decorators,
326
- };
327
318
  const groups = (0, graphql_1.getGroups)(rootTypes, groupByDirective);
328
319
  // Extract formatter from the MDX module (for direct function calls)
329
320
  const mdxFormatter = (0, exports.getFormatterFromMDXModule)(mdxModule, docOptions);
@@ -338,7 +329,7 @@ const runGeneration = async (options, start, outcome) => {
338
329
  },
339
330
  // options
340
331
  {
341
- decorators: decoratorsWithCustomDirective,
332
+ decorators,
342
333
  groups,
343
334
  meta: {
344
335
  generatorFrameworkName: docOptions?.generatorFrameworkName,
@@ -4,6 +4,6 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.OPTIONAL_DEPENDENCY_RANGES = void 0;
6
6
  exports.OPTIONAL_DEPENDENCY_RANGES = {
7
- "@graphql-markdown/diff": "^1.1.25",
7
+ "@graphql-markdown/diff": "^1.1.26",
8
8
  "graphql-config": "^6.0.0",
9
9
  };
@@ -1,42 +1,5 @@
1
- import type { ApiGroupOverrideType, Category, Maybe, IPrinter, OutputAdapter, RendererDocOptions, SchemaEntitiesGroupMap, SchemaEntity } from "@graphql-markdown/types";
2
- /**
3
- * Default group names for API types and non-API types.
4
- * This constant provides the base folder structure for organizing GraphQL schema entities.
5
- * Can be overridden via ApiGroupOverrideType in configuration.
6
- *
7
- * @property operations Folder name for GraphQL operations (queries, mutations, subscriptions)
8
- * @property types Folder name for GraphQL type definitions
9
- *
10
- * @example
11
- * ```typescript
12
- * // Default structure
13
- * const defaultGroups = API_GROUPS;
14
- * // { operations: "operations", types: "types" }
15
- *
16
- * // With custom override
17
- * const customGroups = { ...API_GROUPS, operations: "queries-and-mutations" };
18
- * ```
19
- *
20
- * @see {@link getApiGroupFolder} For usage with type categorization
21
- */
22
- export declare const API_GROUPS: Required<ApiGroupOverrideType>;
23
- /**
24
- * Determines the appropriate folder for a GraphQL schema entity based on its type.
25
- *
26
- * @param type - The GraphQL schema entity to categorize
27
- * @param groups - Optional custom group naming configuration
28
- * @returns The folder name where the entity should be placed
29
- *
30
- * @example
31
- * ```typescript
32
- * // With default groups
33
- * const folder = getApiGroupFolder(queryType); // Returns "operations"
34
- *
35
- * // With custom groups
36
- * const folder = getApiGroupFolder(objectType, { operations: "queries" }); // Returns appropriate folder
37
- * ```
38
- */
39
- export declare const getApiGroupFolder: (type: unknown, groups?: Maybe<ApiGroupOverrideType | boolean>) => string;
1
+ import type { Category, Maybe, IPrinter, OutputAdapter, RendererDocOptions, SchemaEntitiesGroupMap, SchemaEntity } from "@graphql-markdown/types";
2
+ export { DEPRECATED, CATEGORY_STYLE_CLASS, SidebarPosition, API_GROUPS, getApiGroupFolder, stripNumericPrefix, isHierarchy, } from "./rendererHelpers.ts";
40
3
  /**
41
4
  * Configuration options for category metafiles in the documentation.
42
5
  * These options control the appearance and behavior of category sections in the sidebar.
@@ -210,6 +173,11 @@ export declare class Renderer {
210
173
  * @example
211
174
  */
212
175
  renderHomepage(homepageLocation: Maybe<string | symbol>): Promise<void>;
176
+ /**
177
+ * Handles rendering of a single root type entry.
178
+ * Extracted from `renderRootTypes` for clarity.
179
+ */
180
+ private renderRootTypeItem;
213
181
  /**
214
182
  * Registers custom group names from the current group configuration.
215
183
  * Custom groups are always registered at the ROOT level.
@@ -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,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EAGb,MAAM,yBAAyB,CAAC;AA6FjC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,SACtB,OAAO,WACJ,KAAK,CAAC,oBAAoB,GAAG,OAAO,CAAC,KAC7C,MAMF,CAAC;AA6CF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,uBAAu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