@graphql-markdown/core 1.7.3 → 1.8.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 +7 -2
- package/dist/config.js +29 -7
- package/package.json +7 -7
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CliOptions, ConfigDocOptions, ConfigOptions, ConfigPrintTypeOptions, CustomDirective, DirectiveName, GroupByDirectiveOptions, LoaderOption, Maybe, Options, TypeDiffMethod } from "@graphql-markdown/types";
|
|
1
|
+
import type { CliOptions, ConfigDocOptions, ConfigOptions, ConfigPrintTypeOptions, CustomDirective, DeprecatedCliOptions, DeprecatedConfigDocOptions, DirectiveName, GroupByDirectiveOptions, LoaderOption, Maybe, Options, TypeDiffMethod } from "@graphql-markdown/types";
|
|
2
2
|
export declare enum DiffMethod {
|
|
3
3
|
NONE = "NONE",
|
|
4
4
|
FORCE = "FORCE"
|
|
@@ -26,7 +26,12 @@ export declare const getVisibilityDirectives: (cliOpts: Maybe<CliOptions>, confi
|
|
|
26
26
|
};
|
|
27
27
|
export declare const getCustomDirectives: (customDirectiveOptions: Maybe<CustomDirective>, skipDocDirective?: Maybe<DirectiveName[]>) => Maybe<CustomDirective>;
|
|
28
28
|
export declare const getDiffMethod: (diff: TypeDiffMethod, force?: boolean) => TypeDiffMethod;
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const parseDeprecatedDocOptions: (cliOpts: Maybe<DeprecatedCliOptions>, configOptions: Maybe<DeprecatedConfigDocOptions>) => Partial<{
|
|
30
|
+
pagination_next: null;
|
|
31
|
+
pagination_prev: null;
|
|
32
|
+
hide_table_of_contents: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const getDocOptions: (cliOpts?: Maybe<CliOptions & DeprecatedCliOptions>, configOptions?: Maybe<ConfigDocOptions & DeprecatedConfigDocOptions>) => Required<ConfigDocOptions>;
|
|
30
35
|
export declare const getPrintTypeOptions: (cliOpts: Maybe<CliOptions>, configOptions: Maybe<ConfigPrintTypeOptions>) => Required<ConfigPrintTypeOptions>;
|
|
31
36
|
export declare const parseGroupByOption: (groupOptions: unknown) => Maybe<GroupByDirectiveOptions>;
|
|
32
37
|
export declare const buildConfig: (configFileOpts: Maybe<ConfigOptions>, cliOpts: Maybe<CliOptions>, id?: Maybe<string>) => Promise<Options>;
|
package/dist/config.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildConfig = exports.parseGroupByOption = exports.getPrintTypeOptions = exports.getDocOptions = 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 = void 0;
|
|
3
|
+
exports.buildConfig = exports.parseGroupByOption = exports.getPrintTypeOptions = 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 = 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");
|
|
7
8
|
var DiffMethod;
|
|
8
9
|
(function (DiffMethod) {
|
|
9
10
|
DiffMethod["NONE"] = "NONE";
|
|
@@ -25,8 +26,7 @@ exports.DEFAULT_OPTIONS = {
|
|
|
25
26
|
diffMethod: DiffMethod.NONE,
|
|
26
27
|
docOptions: {
|
|
27
28
|
index: false,
|
|
28
|
-
|
|
29
|
-
toc: true,
|
|
29
|
+
frontMatter: {},
|
|
30
30
|
},
|
|
31
31
|
groupByDirective: undefined,
|
|
32
32
|
homepage: exports.ASSET_HOMEPAGE_LOCATION,
|
|
@@ -117,16 +117,38 @@ const getDiffMethod = (diff, force = false) => {
|
|
|
117
117
|
: diff.toLocaleUpperCase();
|
|
118
118
|
};
|
|
119
119
|
exports.getDiffMethod = getDiffMethod;
|
|
120
|
+
const parseDeprecatedDocOptions = (cliOpts, configOptions) => {
|
|
121
|
+
// deprecated, replaced by frontMatter
|
|
122
|
+
let pagination;
|
|
123
|
+
if ((typeof cliOpts?.noPagination !== "undefined" && cliOpts.noPagination) ||
|
|
124
|
+
(typeof configOptions?.pagination !== "undefined" &&
|
|
125
|
+
!configOptions.pagination)) {
|
|
126
|
+
pagination = { pagination_next: null, pagination_prev: null };
|
|
127
|
+
(0, logger_1.log)("Doc option `pagination` is deprecated. Use `frontMatter: { pagination_next: null, pagination_prev: null }` instead.", "warn");
|
|
128
|
+
}
|
|
129
|
+
// deprecated, replaced by frontMatter
|
|
130
|
+
let toc;
|
|
131
|
+
if (typeof cliOpts?.noToc !== "undefined" ||
|
|
132
|
+
typeof configOptions?.toc !== "undefined") {
|
|
133
|
+
toc = {
|
|
134
|
+
hide_table_of_contents: cliOpts?.noToc === true || configOptions?.toc === false,
|
|
135
|
+
};
|
|
136
|
+
(0, logger_1.log)("Doc option `toc` is deprecated. Use `frontMatter: { hide_table_of_contents: true | false }` instead.", "warn");
|
|
137
|
+
}
|
|
138
|
+
return { ...pagination, ...toc };
|
|
139
|
+
};
|
|
140
|
+
exports.parseDeprecatedDocOptions = parseDeprecatedDocOptions;
|
|
120
141
|
const getDocOptions = (cliOpts, configOptions) => {
|
|
142
|
+
const deprecated = (0, exports.parseDeprecatedDocOptions)(cliOpts, configOptions);
|
|
121
143
|
return {
|
|
122
|
-
pagination: (!cliOpts?.noPagination && configOptions?.pagination) ??
|
|
123
|
-
exports.DEFAULT_OPTIONS.docOptions.pagination,
|
|
124
|
-
toc: (!cliOpts?.noToc && configOptions?.toc) ??
|
|
125
|
-
exports.DEFAULT_OPTIONS.docOptions.toc,
|
|
126
144
|
index:
|
|
127
145
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
128
146
|
(cliOpts?.index || configOptions?.index) ??
|
|
129
147
|
exports.DEFAULT_OPTIONS.docOptions.index,
|
|
148
|
+
frontMatter: {
|
|
149
|
+
...deprecated,
|
|
150
|
+
...configOptions?.frontMatter,
|
|
151
|
+
},
|
|
130
152
|
};
|
|
131
153
|
};
|
|
132
154
|
exports.getDocOptions = getDocOptions;
|
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.
|
|
8
|
+
"version": "1.8.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"clean": "rm -rf ./dist"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@graphql-markdown/graphql": "^1.0.
|
|
66
|
-
"@graphql-markdown/logger": "^1.0.
|
|
67
|
-
"@graphql-markdown/utils": "^1.6.
|
|
65
|
+
"@graphql-markdown/graphql": "^1.0.2",
|
|
66
|
+
"@graphql-markdown/logger": "^1.0.1",
|
|
67
|
+
"@graphql-markdown/utils": "^1.6.2"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@graphql-markdown/diff": "^1.1.
|
|
71
|
-
"@graphql-markdown/helpers": "^1.0.
|
|
72
|
-
"@graphql-markdown/printer-legacy": "^1.
|
|
70
|
+
"@graphql-markdown/diff": "^1.1.2",
|
|
71
|
+
"@graphql-markdown/helpers": "^1.0.2",
|
|
72
|
+
"@graphql-markdown/printer-legacy": "^1.6.0",
|
|
73
73
|
"graphql-config": "^5.0.3"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|