@graphql-markdown/core 1.12.1 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -16,6 +16,9 @@ export declare enum DeprecatedOption {
16
16
  export declare const DOCS_URL: "https://graphql-markdown.dev/docs";
17
17
  export declare const PACKAGE_NAME: "@graphql-markdown/docusaurus";
18
18
  export declare const ASSET_HOMEPAGE_LOCATION: string;
19
+ export declare const DEFAULT_HIERARCHY: {
20
+ api: {};
21
+ };
19
22
  export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "customDirective" | "groupByDirective" | "loaders"> & Required<Omit<ConfigOptions, "customDirective" | "groupByDirective" | "loaders" | "printTypeOptions">>> & {
20
23
  printTypeOptions: Required<Omit<ConfigPrintTypeOptions, "hierarchy">> & {
21
24
  hierarchy: Required<Pick<TypeHierarchyObjectType, TypeHierarchy.API>>;
@@ -30,16 +33,10 @@ export declare const getVisibilityDirectives: (cliOpts: Maybe<CliOptions>, confi
30
33
  };
31
34
  export declare const getCustomDirectives: (customDirectiveOptions: Maybe<CustomDirective>, skipDocDirective?: Maybe<DirectiveName[]>) => Maybe<CustomDirective>;
32
35
  export declare const getDiffMethod: (diff: TypeDiffMethod, force?: boolean) => TypeDiffMethod;
33
- export declare const parseDeprecatedDocOptions: (cliOpts: Maybe<DeprecatedCliOptions>, configOptions: Maybe<DeprecatedConfigDocOptions>) => Partial<{
34
- pagination_next: null;
35
- pagination_prev: null;
36
- hide_table_of_contents: boolean;
37
- }>;
38
- export declare const getDocOptions: (cliOpts?: Maybe<CliOptions & DeprecatedCliOptions>, configOptions?: Maybe<ConfigDocOptions & DeprecatedConfigDocOptions>) => Required<ConfigDocOptions>;
36
+ export declare const parseDeprecatedDocOptions: (_cliOpts: Maybe<Omit<DeprecatedCliOptions, "never">>, _configOptions: Maybe<Omit<DeprecatedConfigDocOptions, "never">>) => Record<string, never>;
37
+ export declare const getDocOptions: (cliOpts?: Maybe<CliOptions & Omit<DeprecatedCliOptions, "never">>, configOptions?: Maybe<ConfigDocOptions & Omit<DeprecatedConfigDocOptions, "never">>) => Required<ConfigDocOptions>;
39
38
  export declare const getTypeHierarchyOption: (cliOption?: Maybe<TypeHierarchyValueType>, configOption?: Maybe<TypeHierarchyType>) => Maybe<TypeHierarchyObjectType>;
40
- export declare const parseDeprecatedPrintTypeOptions: (cliOpts: Maybe<DeprecatedCliOptions>, configOptions: Maybe<DeprecatedConfigPrintTypeOptions>) => Partial<{
41
- hierarchy: TypeHierarchyType;
42
- }>;
43
- export declare const getPrintTypeOptions: (cliOpts: Maybe<CliOptions & DeprecatedCliOptions>, configOptions: Maybe<ConfigPrintTypeOptions & DeprecatedConfigPrintTypeOptions>) => Required<ConfigPrintTypeOptions>;
39
+ export declare const parseDeprecatedPrintTypeOptions: (_cliOpts: Maybe<Omit<DeprecatedCliOptions, "never">>, _configOptions: Maybe<Omit<DeprecatedConfigPrintTypeOptions, "never">>) => Record<string, never>;
40
+ export declare const getPrintTypeOptions: (cliOpts: Maybe<CliOptions & Omit<DeprecatedCliOptions, "never">>, configOptions: Maybe<ConfigPrintTypeOptions & Omit<DeprecatedConfigPrintTypeOptions, "never">>) => Required<ConfigPrintTypeOptions>;
44
41
  export declare const parseGroupByOption: (groupOptions: unknown) => Maybe<GroupByDirectiveOptions>;
45
42
  export declare const buildConfig: (configFileOpts: Maybe<ConfigOptions>, cliOpts?: Maybe<CliOptions>, id?: Maybe<string>) => Promise<Options>;
package/dist/config.js CHANGED
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildConfig = exports.parseGroupByOption = exports.getPrintTypeOptions = exports.parseDeprecatedPrintTypeOptions = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = exports.getCustomDirectives = exports.getVisibilityDirectives = exports.getSkipDocDirectives = exports.getOnlyDocDirectives = exports.getDocDirective = exports.DEFAULT_OPTIONS = exports.ASSET_HOMEPAGE_LOCATION = exports.PACKAGE_NAME = exports.DOCS_URL = exports.DeprecatedOption = exports.DiffMethod = exports.TypeHierarchy = void 0;
3
+ exports.buildConfig = exports.parseGroupByOption = exports.getPrintTypeOptions = exports.parseDeprecatedPrintTypeOptions = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = 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;
4
4
  const node_path_1 = require("node:path");
5
5
  const node_os_1 = require("node:os");
6
6
  const graphql_config_1 = require("./graphql-config");
7
- const logger_1 = require("@graphql-markdown/logger");
8
7
  var TypeHierarchy;
9
8
  (function (TypeHierarchy) {
10
9
  TypeHierarchy["API"] = "api";
@@ -25,6 +24,7 @@ var DeprecatedOption;
25
24
  exports.DOCS_URL = "https://graphql-markdown.dev/docs";
26
25
  exports.PACKAGE_NAME = "@graphql-markdown/docusaurus";
27
26
  exports.ASSET_HOMEPAGE_LOCATION = (0, node_path_1.join)(__dirname, "..", "assets", "generated.md");
27
+ exports.DEFAULT_HIERARCHY = { [TypeHierarchy.API]: {} };
28
28
  exports.DEFAULT_OPTIONS = {
29
29
  id: "default",
30
30
  baseURL: "schema",
@@ -49,7 +49,6 @@ exports.DEFAULT_OPTIONS = {
49
49
  parentTypePrefix: true,
50
50
  relatedTypeSection: true,
51
51
  typeBadges: true,
52
- hierarchy: { [TypeHierarchy.API]: {} },
53
52
  },
54
53
  rootPath: "./docs",
55
54
  schema: "./schema.graphql",
@@ -126,38 +125,23 @@ const getDiffMethod = (diff, force = false) => {
126
125
  : diff.toLocaleUpperCase();
127
126
  };
128
127
  exports.getDiffMethod = getDiffMethod;
129
- const parseDeprecatedDocOptions = (cliOpts, configOptions) => {
130
- // deprecated, replaced by frontMatter
131
- let pagination;
132
- if ((typeof cliOpts?.noPagination !== "undefined" && cliOpts.noPagination) ||
133
- (typeof configOptions?.pagination !== "undefined" &&
134
- !configOptions.pagination)) {
135
- pagination = { pagination_next: null, pagination_prev: null };
136
- (0, logger_1.log)("Doc option `pagination` is deprecated. Use `frontMatter: { pagination_next: null, pagination_prev: null }` instead.", "warn");
137
- }
138
- // deprecated, replaced by frontMatter
139
- let toc;
140
- if (typeof cliOpts?.noToc !== "undefined" ||
141
- typeof configOptions?.toc !== "undefined") {
142
- toc = {
143
- hide_table_of_contents: cliOpts?.noToc === true || configOptions?.toc === false,
144
- };
145
- (0, logger_1.log)("Doc option `toc` is deprecated. Use `frontMatter: { hide_table_of_contents: true | false }` instead.", "warn");
146
- }
147
- return { ...pagination, ...toc };
128
+ const parseDeprecatedDocOptions = (_cliOpts, _configOptions) => {
129
+ return {};
148
130
  };
149
131
  exports.parseDeprecatedDocOptions = parseDeprecatedDocOptions;
150
132
  const getDocOptions = (cliOpts, configOptions) => {
151
133
  const deprecated = (0, exports.parseDeprecatedDocOptions)(cliOpts, configOptions);
134
+ const index = typeof cliOpts?.index === "boolean"
135
+ ? cliOpts.index
136
+ : typeof configOptions?.index === "boolean"
137
+ ? configOptions.index
138
+ : exports.DEFAULT_OPTIONS.docOptions.index;
152
139
  return {
153
140
  frontMatter: {
154
141
  ...deprecated,
155
142
  ...configOptions?.frontMatter,
156
143
  },
157
- index:
158
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
159
- (cliOpts?.index || configOptions?.index) ??
160
- exports.DEFAULT_OPTIONS.docOptions.index,
144
+ index,
161
145
  };
162
146
  };
163
147
  exports.getDocOptions = getDocOptions;
@@ -189,32 +173,11 @@ const getTypeHierarchyOption = (cliOption, configOption) => {
189
173
  throw new Error(`Hierarchy option mismatch in CLI flag '${strCliHierarchy}' and config '${strConfigHierarchy}'`);
190
174
  }
191
175
  }
192
- return (cliHierarchy ??
193
- configHierarchy ??
194
- exports.DEFAULT_OPTIONS.printTypeOptions.hierarchy);
176
+ return cliHierarchy ?? configHierarchy ?? exports.DEFAULT_HIERARCHY;
195
177
  };
196
178
  exports.getTypeHierarchyOption = getTypeHierarchyOption;
197
- const parseDeprecatedPrintTypeOptions = (cliOpts, configOptions) => {
198
- // deprecated, replaced by hierarchy
199
- let option;
200
- if (typeof cliOpts?.noApiGroup !== "undefined" && cliOpts.noApiGroup) {
201
- option = { hierarchy: TypeHierarchy.ENTITY };
202
- (0, logger_1.log)("Type option `noApiGroup` is deprecated. Use `hierarchy: 'entity'` instead.", "warn");
203
- }
204
- else if (typeof configOptions?.useApiGroup !== "undefined") {
205
- if (typeof configOptions.useApiGroup === "object") {
206
- option = {
207
- hierarchy: { [TypeHierarchy.API]: { ...configOptions.useApiGroup } },
208
- };
209
- }
210
- else {
211
- option = configOptions.useApiGroup
212
- ? { hierarchy: TypeHierarchy.API }
213
- : { hierarchy: TypeHierarchy.ENTITY };
214
- }
215
- (0, logger_1.log)("Type option `useApiGroup` is deprecated. Use `hierarchy: 'api'` instead.", "warn");
216
- }
217
- return { ...option };
179
+ const parseDeprecatedPrintTypeOptions = (_cliOpts, _configOptions) => {
180
+ return {};
218
181
  };
219
182
  exports.parseDeprecatedPrintTypeOptions = parseDeprecatedPrintTypeOptions;
220
183
  const getPrintTypeOptions = (cliOpts, configOptions) => {
package/dist/diff.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.hasChanges = void 0;
27
37
  const logger_1 = require("@graphql-markdown/logger");
package/dist/generator.js CHANGED
@@ -15,17 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.generateDocFromSchema = void 0;
27
37
  const logger_1 = __importStar(require("@graphql-markdown/logger"));
28
38
  const graphql_1 = require("@graphql-markdown/graphql");
39
+ const utils_1 = require("@graphql-markdown/utils");
29
40
  const config_1 = require("./config");
30
41
  const diff_1 = require("./diff");
31
42
  const printer_1 = require("./printer");
@@ -44,7 +55,7 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
44
55
  if (diffMethod !== config_1.DiffMethod.NONE) {
45
56
  const changed = await (0, diff_1.hasChanges)(schema, tmpDir, diffMethod);
46
57
  if (!changed) {
47
- (0, logger_1.log)(`No changes detected in schema "${String(schemaLocation)}".`);
58
+ (0, logger_1.log)(`No changes detected in schema "${(0, utils_1.toString)(schemaLocation)}".`);
48
59
  }
49
60
  }
50
61
  const [onlyDocDirectives, skipDocDirectives] = [
@@ -75,10 +86,14 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
75
86
  {
76
87
  customDirectives,
77
88
  groups,
89
+ meta: {
90
+ generatorFrameworkName: docOptions?.generatorFrameworkName,
91
+ generatorFrameworkVersion: docOptions?.generatorFrameworkVersion,
92
+ },
93
+ metatags,
78
94
  onlyDocDirectives,
79
95
  printTypeOptions,
80
96
  skipDocDirectives,
81
- metatags,
82
97
  });
83
98
  const renderer = await (0, renderer_1.getRenderer)(printer, outputDir, baseURL, groups, prettify, {
84
99
  ...docOptions,
@@ -93,6 +108,6 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
93
108
  await renderer.renderHomepage(homepageLocation);
94
109
  const duration = (Number(process.hrtime.bigint() - start) / NS_PER_SEC).toFixed(SEC_DECIMALS);
95
110
  (0, logger_1.log)(`Documentation successfully generated in "${outputDir}" with base URL "${baseURL}".`, "success");
96
- (0, logger_1.log)(`${pages.flat().length} pages generated in ${duration}s from schema "${String(schemaLocation)}".`);
111
+ (0, logger_1.log)(`${pages.flat().length} pages generated in ${duration}s from schema "${(0, utils_1.toString)(schemaLocation)}".`);
97
112
  };
98
113
  exports.generateDocFromSchema = generateDocFromSchema;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.loadConfiguration = exports.setLoaderOptions = exports.graphQLConfigExtension = exports.EXTENSION_NAME = void 0;
27
37
  const logger_1 = require("@graphql-markdown/logger");
package/dist/printer.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.getPrinter = void 0;
27
37
  const getPrinter = async (printerModule, config, options) => {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "bugs": {
6
6
  "url": "https://github.com/graphql-markdown/graphql-markdown/issues"
7
7
  },
8
- "version": "1.12.1",
8
+ "version": "1.13.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -63,18 +63,18 @@
63
63
  "docs": "typedoc"
64
64
  },
65
65
  "dependencies": {
66
- "@graphql-markdown/graphql": "^1.1.4",
66
+ "@graphql-markdown/graphql": "^1.1.5",
67
67
  "@graphql-markdown/logger": "^1.0.5",
68
- "@graphql-markdown/utils": "^1.7.0"
68
+ "@graphql-markdown/utils": "^1.7.1"
69
69
  },
70
70
  "peerDependencies": {
71
- "@graphql-markdown/diff": "^1.1.8",
72
- "@graphql-markdown/helpers": "^1.0.7",
73
- "@graphql-markdown/printer-legacy": "^1.9.0",
71
+ "@graphql-markdown/diff": "^1.1.9",
72
+ "@graphql-markdown/helpers": "^1.0.8",
73
+ "@graphql-markdown/printer-legacy": "^1.10.0",
74
74
  "graphql-config": "^5.1.0"
75
75
  },
76
76
  "devDependencies": {
77
- "@graphql-markdown/types": "^1.4.0"
77
+ "@graphql-markdown/types": "^1.5.0"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "@graphql-markdown/printer-legacy": {