@graphql-markdown/printer-legacy 1.9.1 → 1.10.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/common.d.ts +3 -3
- package/dist/common.js +13 -12
- package/dist/const/options.d.ts +1 -1
- package/dist/printer.d.ts +4 -3
- package/dist/printer.js +2 -1
- package/package.json +2 -3
package/dist/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Maybe, MDXString, PrintTypeOptions } from "@graphql-markdown/types";
|
|
2
2
|
export declare const printCustomDirectives: (type: unknown, options?: PrintTypeOptions) => string;
|
|
3
3
|
export declare const formatDescription: (type: unknown, replacement?: Maybe<string>) => MDXString | string;
|
|
4
|
-
export declare const printWarning: (text?: string, title?: string) => string;
|
|
5
|
-
export declare const printDeprecation: (type: unknown) => string;
|
|
4
|
+
export declare const printWarning: (text?: string, title?: string, options?: PrintTypeOptions) => string;
|
|
5
|
+
export declare const printDeprecation: (type: unknown, options?: PrintTypeOptions) => string;
|
|
6
6
|
export declare const printDescription: (type: unknown, options?: PrintTypeOptions, noText?: string) => MDXString | string;
|
package/dist/common.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printDescription = exports.printDeprecation = exports.printWarning = exports.formatDescription = exports.printCustomDirectives = void 0;
|
|
4
|
-
const utils_1 = require("@
|
|
5
|
-
const utils_2 = require("@graphql-markdown/utils");
|
|
4
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
6
5
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
7
6
|
const directive_1 = require("./directive");
|
|
8
7
|
const strings_1 = require("./const/strings");
|
|
9
8
|
const printCustomDirectives = (type, options) => {
|
|
10
9
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options?.customDirectives);
|
|
11
|
-
if ((0,
|
|
10
|
+
if ((0, utils_1.isEmpty)(constDirectiveMap)) {
|
|
12
11
|
return "";
|
|
13
12
|
}
|
|
14
13
|
const content = Object.values(constDirectiveMap)
|
|
@@ -19,7 +18,7 @@ const printCustomDirectives = (type, options) => {
|
|
|
19
18
|
return typeof text === "string" && text.length > 0;
|
|
20
19
|
})
|
|
21
20
|
.map((text) => {
|
|
22
|
-
return (0,
|
|
21
|
+
return (0, utils_1.escapeMDX)(text);
|
|
23
22
|
})
|
|
24
23
|
.join(strings_1.MARKDOWN_EOP);
|
|
25
24
|
return `${strings_1.MARKDOWN_EOP}${content}`;
|
|
@@ -27,38 +26,40 @@ const printCustomDirectives = (type, options) => {
|
|
|
27
26
|
exports.printCustomDirectives = printCustomDirectives;
|
|
28
27
|
const formatDescription = (type, replacement = strings_1.NO_DESCRIPTION_TEXT) => {
|
|
29
28
|
if (typeof type !== "object" || type === null) {
|
|
30
|
-
return `${strings_1.MARKDOWN_EOP}${(0,
|
|
29
|
+
return `${strings_1.MARKDOWN_EOP}${(0, utils_1.escapeMDX)(replacement)}`;
|
|
31
30
|
}
|
|
32
31
|
const description = "description" in type && typeof type.description === "string"
|
|
33
32
|
? type.description
|
|
34
33
|
: replacement;
|
|
35
|
-
return `${strings_1.MARKDOWN_EOP}${(0,
|
|
34
|
+
return `${strings_1.MARKDOWN_EOP}${(0, utils_1.escapeMDX)(description)}`;
|
|
36
35
|
};
|
|
37
36
|
exports.formatDescription = formatDescription;
|
|
38
|
-
const printWarning = (text, title) => {
|
|
37
|
+
const printWarning = (text, title, options) => {
|
|
39
38
|
const formattedText = typeof text !== "string" || text.trim() === ""
|
|
40
39
|
? strings_1.MARKDOWN_EOP
|
|
41
40
|
: `${strings_1.MARKDOWN_EOP}${text}${strings_1.MARKDOWN_EOP}`;
|
|
42
|
-
|
|
41
|
+
const isDocusaurus = options?.meta?.generatorFrameworkName === "docusaurus";
|
|
42
|
+
if (isDocusaurus &&
|
|
43
|
+
options.meta?.generatorFrameworkVersion?.startsWith("2")) {
|
|
43
44
|
return `${strings_1.MARKDOWN_EOP}:::caution ${title}${formattedText}:::`;
|
|
44
45
|
}
|
|
45
46
|
return `${strings_1.MARKDOWN_EOP}:::warning[${title}]${formattedText}:::`;
|
|
46
47
|
};
|
|
47
48
|
exports.printWarning = printWarning;
|
|
48
|
-
const printDeprecation = (type) => {
|
|
49
|
+
const printDeprecation = (type, options) => {
|
|
49
50
|
if (typeof type !== "object" || type === null || !(0, graphql_1.isDeprecated)(type)) {
|
|
50
51
|
return "";
|
|
51
52
|
}
|
|
52
53
|
const reason = "deprecationReason" in type && typeof type.deprecationReason === "string"
|
|
53
|
-
? (0,
|
|
54
|
+
? (0, utils_1.escapeMDX)(type.deprecationReason)
|
|
54
55
|
: "";
|
|
55
|
-
return (0, exports.printWarning)(reason, strings_1.DEPRECATED.toUpperCase());
|
|
56
|
+
return (0, exports.printWarning)(reason, strings_1.DEPRECATED.toUpperCase(), options);
|
|
56
57
|
};
|
|
57
58
|
exports.printDeprecation = printDeprecation;
|
|
58
59
|
const printDescription = (type, options, noText) => {
|
|
59
60
|
const description = (0, exports.formatDescription)(type, noText);
|
|
60
61
|
const customDirectives = (0, exports.printCustomDirectives)(type, options);
|
|
61
|
-
const deprecation = (0, exports.printDeprecation)(type);
|
|
62
|
+
const deprecation = (0, exports.printDeprecation)(type, options);
|
|
62
63
|
return `${deprecation}${description}${customDirectives}`;
|
|
63
64
|
};
|
|
64
65
|
exports.printDescription = printDescription;
|
package/dist/const/options.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare enum SectionLevels {
|
|
|
11
11
|
LEVEL_5 = "#####"
|
|
12
12
|
}
|
|
13
13
|
export declare const PRINT_TYPE_DEFAULT_OPTIONS: Required<PrinterConfigPrintTypeOptions>;
|
|
14
|
-
export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "groups" | "level" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
|
|
14
|
+
export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
|
|
15
15
|
collapsible: Maybe<CollapsibleOption>;
|
|
16
16
|
groups: Maybe<SchemaEntitiesGroupMap>;
|
|
17
17
|
level: Maybe<SectionLevelValue>;
|
package/dist/printer.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import type { CustomDirectiveMap, GraphQLDirective, GraphQLSchema, IPrinter, MDXString, Maybe, PrintTypeOptions, PrinterConfigPrintTypeOptions, SchemaEntitiesGroupMap, TypeDeprecatedOption } from "@graphql-markdown/types";
|
|
1
|
+
import type { CustomDirectiveMap, GraphQLDirective, GraphQLSchema, IPrinter, MDXString, Maybe, MetaOptions, PrintTypeOptions, PrinterConfigPrintTypeOptions, SchemaEntitiesGroupMap, TypeDeprecatedOption } from "@graphql-markdown/types";
|
|
2
2
|
export declare class Printer implements IPrinter {
|
|
3
3
|
static options: Readonly<Maybe<PrintTypeOptions>>;
|
|
4
4
|
static readonly printDescription: (type: unknown, options?: PrintTypeOptions, noText?: string) => MDXString | string;
|
|
5
5
|
static readonly printCustomDirectives: (type: unknown, options: PrintTypeOptions) => string;
|
|
6
6
|
static readonly printCustomTags: (type: unknown, options: PrintTypeOptions) => MDXString | string;
|
|
7
|
-
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, onlyDocDirectives, printTypeOptions, skipDocDirectives,
|
|
7
|
+
static init(schema: Maybe<GraphQLSchema>, baseURL?: Maybe<string>, linkRoot?: Maybe<string>, { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, }?: {
|
|
8
8
|
customDirectives?: CustomDirectiveMap;
|
|
9
9
|
deprecated?: TypeDeprecatedOption;
|
|
10
10
|
groups?: SchemaEntitiesGroupMap;
|
|
11
|
+
meta?: Maybe<MetaOptions>;
|
|
12
|
+
metatags?: Record<string, string>[];
|
|
11
13
|
onlyDocDirectives?: GraphQLDirective[];
|
|
12
14
|
printTypeOptions?: PrinterConfigPrintTypeOptions;
|
|
13
15
|
skipDocDirectives?: GraphQLDirective[];
|
|
14
|
-
metatags?: Record<string, string>[];
|
|
15
16
|
}): void;
|
|
16
17
|
static readonly printHeader: (id: string, title: string, options: PrintTypeOptions) => string;
|
|
17
18
|
static readonly printCode: (type: unknown, options: PrintTypeOptions) => string;
|
package/dist/printer.js
CHANGED
|
@@ -18,7 +18,7 @@ class Printer {
|
|
|
18
18
|
static printDescription = common_1.printDescription;
|
|
19
19
|
static printCustomDirectives = directive_1.printCustomDirectives;
|
|
20
20
|
static printCustomTags = directive_1.printCustomTags;
|
|
21
|
-
static init(schema, baseURL = "schema", linkRoot = "/", { customDirectives, groups, onlyDocDirectives, printTypeOptions, skipDocDirectives,
|
|
21
|
+
static init(schema, baseURL = "schema", linkRoot = "/", { customDirectives, groups, meta, metatags, onlyDocDirectives, printTypeOptions, skipDocDirectives, } = {
|
|
22
22
|
customDirectives: undefined,
|
|
23
23
|
groups: undefined,
|
|
24
24
|
}) {
|
|
@@ -44,6 +44,7 @@ class Printer {
|
|
|
44
44
|
typeBadges: printTypeOptions?.typeBadges ?? options_1.PRINT_TYPE_DEFAULT_OPTIONS.typeBadges,
|
|
45
45
|
metatags: metatags ?? [],
|
|
46
46
|
hierarchy: printTypeOptions?.hierarchy ?? options_1.PRINT_TYPE_DEFAULT_OPTIONS.hierarchy,
|
|
47
|
+
meta: meta,
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
static printHeader = (id, title, 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.
|
|
8
|
+
"version": "1.10.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -56,12 +56,11 @@
|
|
|
56
56
|
"docs": "typedoc"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@docusaurus/utils": ">=3.2.0",
|
|
60
59
|
"@graphql-markdown/graphql": "^1.1.5",
|
|
61
60
|
"@graphql-markdown/utils": "^1.7.1"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
|
-
"@graphql-markdown/types": "^1.
|
|
63
|
+
"@graphql-markdown/types": "^1.5.0"
|
|
65
64
|
},
|
|
66
65
|
"resolutions": {
|
|
67
66
|
"micromatch": "4.0.8"
|