@graphql-markdown/printer-legacy 1.16.0 → 1.16.2
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/badge.d.ts.map +1 -1
- package/dist/badge.js +2 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +6 -0
- package/dist/const/options.d.ts +1 -1
- package/dist/const/options.d.ts.map +1 -1
- package/dist/const/options.js +2 -2
- package/dist/directive.d.ts.map +1 -1
- package/dist/directive.js +4 -0
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +2 -0
- package/dist/graphql/scalar.d.ts.map +1 -1
- package/dist/graphql/scalar.js +2 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +12 -0
- package/dist/printer.d.ts +5 -3
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +1 -1
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +4 -0
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +4 -0
- package/package.json +12 -12
- package/dist/format-helpers.d.ts +0 -51
- package/dist/format-helpers.d.ts.map +0 -1
- package/dist/format-helpers.js +0 -83
- package/dist/mdx/index.d.ts +0 -19
- package/dist/mdx/index.d.ts.map +0 -1
- package/dist/mdx/index.js +0 -190
package/dist/badge.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/badge.js
CHANGED
|
@@ -24,6 +24,8 @@ exports.CSS_BADGE_CLASSNAME = {
|
|
|
24
24
|
* @param groups - Optional map of schema entities to their groups
|
|
25
25
|
* @returns Array of Badge objects containing text and optional classnames
|
|
26
26
|
*/
|
|
27
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
28
|
+
// fallow-ignore-next-line unused-export
|
|
27
29
|
const getTypeBadges = (type, groups) => {
|
|
28
30
|
if (typeof type !== "object" || type === null) {
|
|
29
31
|
return [];
|
package/dist/common.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/common.js
CHANGED
|
@@ -16,6 +16,8 @@ const directive_1 = require("./directive");
|
|
|
16
16
|
* @param options - Printer configuration options
|
|
17
17
|
* @returns Formatted directive documentation string
|
|
18
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
|
|
19
21
|
const getCustomDirectivesText = (type, options) => {
|
|
20
22
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options?.customDirectives);
|
|
21
23
|
if ((0, utils_1.isEmpty)(constDirectiveMap)) {
|
|
@@ -57,6 +59,8 @@ const formatDescription = (type, replacement = strings_1.NO_DESCRIPTION_TEXT) =>
|
|
|
57
59
|
* @param options - Configuration options for printing
|
|
58
60
|
* @returns Formatted warning message as MDX string
|
|
59
61
|
*/
|
|
62
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
63
|
+
// fallow-ignore-next-line unused-export
|
|
60
64
|
const printWarning = ({ text, title }, options) => {
|
|
61
65
|
const formattedText = typeof text !== "string" || text.trim() === ""
|
|
62
66
|
? strings_1.MARKDOWN_EOP
|
|
@@ -70,6 +74,8 @@ exports.printWarning = printWarning;
|
|
|
70
74
|
* @param options - Configuration options for printing
|
|
71
75
|
* @returns Formatted deprecation warning as MDX string, or empty string if not deprecated
|
|
72
76
|
*/
|
|
77
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
78
|
+
// fallow-ignore-next-line unused-export
|
|
73
79
|
const printDeprecation = (type, options) => {
|
|
74
80
|
if (typeof type !== "object" || type === null || !(0, graphql_1.isDeprecated)(type)) {
|
|
75
81
|
return "";
|
package/dist/const/options.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ 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, "
|
|
20
|
+
export declare const DEFAULT_OPTIONS: Required<Omit<PrintTypeOptions, "collapsible" | "exampleSection" | "formatCategoryFolderName" | "groups" | "level" | "meta" | "onlyDocDirectives" | "parentType" | "schema" | "skipDocDirectives">> & {
|
|
21
21
|
collapsible: Maybe<CollapsibleOption>;
|
|
22
22
|
exampleSection: PrintTypeOptions["exampleSection"];
|
|
23
23
|
groups: Maybe<SchemaEntitiesGroupMap>;
|
|
@@ -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;
|
|
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"}
|
package/dist/const/options.js
CHANGED
|
@@ -5,8 +5,7 @@ const defaults_1 = require("@graphql-markdown/formatters/defaults");
|
|
|
5
5
|
var TypeHierarchy;
|
|
6
6
|
(function (TypeHierarchy) {
|
|
7
7
|
TypeHierarchy["API"] = "api";
|
|
8
|
-
// Used
|
|
9
|
-
// fallow can't trace cross-workspace callers when dist/ is excluded.
|
|
8
|
+
// Used only by unit tests for direct whitebox coverage.
|
|
10
9
|
// fallow-ignore-next-line unused-enum-member
|
|
11
10
|
TypeHierarchy["ENTITY"] = "entity";
|
|
12
11
|
TypeHierarchy["FLAT"] = "flat";
|
|
@@ -16,6 +15,7 @@ var SectionLevels;
|
|
|
16
15
|
/**
|
|
17
16
|
* @deprecated Use `SectionLevels.LEVEL` instead.
|
|
18
17
|
*/
|
|
18
|
+
// Reserved for future usage.
|
|
19
19
|
// fallow-ignore-next-line unused-enum-member
|
|
20
20
|
SectionLevels["NONE"] = "";
|
|
21
21
|
SectionLevels["LEVEL"] = "#";
|
package/dist/directive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,EACL,WAAW,EACZ,MAAM,yBAAyB,CAAC;AASjC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,aAC3B,uBAAuB,QAC3B,OAAO,wBACS,sBAAsB,aACjC,KAAK,CAAC,MAAM,CAAC,KACvB,KAAK,CAAC,MAAM,CAYd,CAAC;AAEF;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,EACL,WAAW,EACZ,MAAM,yBAAyB,CAAC;AASjC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,aAC3B,uBAAuB,QAC3B,OAAO,wBACS,sBAAsB,aACjC,KAAK,CAAC,MAAM,CAAC,KACvB,KAAK,CAAC,MAAM,CAYd,CAAC;AAEF;;;;;;GAMG;AAGH,eAAO,MAAM,oBAAoB,SACzB,OAAO,wBACS,sBAAsB,WACnC,gBAAgB,KACxB,KAAK,CAAC,MAAM,CAgBd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CA6BnB,CAAC;AAEF;;;;;GAKG;AAGH,eAAO,MAAM,aAAa,SAClB,OAAO,WACJ,gBAAgB,KACxB,KAAK,EAqBP,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAEd,CAAC"}
|
package/dist/directive.js
CHANGED
|
@@ -33,6 +33,8 @@ exports.getCustomDirectiveResolver = getCustomDirectiveResolver;
|
|
|
33
33
|
* @param options - General printing options
|
|
34
34
|
* @returns Formatted Markdown string for the directive or `undefined`
|
|
35
35
|
*/
|
|
36
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
37
|
+
// fallow-ignore-next-line unused-export
|
|
36
38
|
const printCustomDirective = (type, constDirectiveOption, options) => {
|
|
37
39
|
const typeNameLink = (0, link_1.printLink)(constDirectiveOption.type, {
|
|
38
40
|
...options,
|
|
@@ -80,6 +82,8 @@ exports.printCustomDirectives = printCustomDirectives;
|
|
|
80
82
|
* @param options - General printing options
|
|
81
83
|
* @returns Array of badge configurations from directive tags
|
|
82
84
|
*/
|
|
85
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
86
|
+
// fallow-ignore-next-line unused-export
|
|
83
87
|
const getCustomTags = (type, options) => {
|
|
84
88
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options.customDirectives);
|
|
85
89
|
if (typeof constDirectiveMap !== "object" ||
|
package/dist/example.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAIV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAwBjC;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAIV,KAAK,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAwBjC;;;;;GAKG;AAGH,eAAO,MAAM,yBAAyB,gCAGnC,gBAAgB,KAAG,KAAK,CAAC,oBAAoB,CA6B/C,CAAC;AAiKF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,SACjB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,MAAM,CAgBd,CAAC"}
|
package/dist/example.js
CHANGED
|
@@ -15,6 +15,8 @@ const link_1 = require("./link");
|
|
|
15
15
|
* @param options - Configuration options
|
|
16
16
|
* @returns The directive example configuration if valid, otherwise `undefined`
|
|
17
17
|
*/
|
|
18
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
19
|
+
// fallow-ignore-next-line unused-export
|
|
18
20
|
const getDirectiveExampleOption = ({ exampleSection, schema, }) => {
|
|
19
21
|
let directiveName = "example", argName = "value", parserFunc = undefined;
|
|
20
22
|
if (exampleSection && typeof exampleSection === "object") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../src/graphql/scalar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,EACN,MAAM,yBAAyB,CAAC;AAIjC;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../src/graphql/scalar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,EACN,MAAM,yBAAyB,CAAC;AAIjC;;;;;GAKG;AAGH,eAAO,MAAM,kBAAkB,SACvB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAgBnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,SACxB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAEnB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,YACH,gBAAgB,KACzB,MAEF,CAAC"}
|
package/dist/graphql/scalar.js
CHANGED
|
@@ -8,6 +8,8 @@ const graphql_1 = require("@graphql-markdown/graphql");
|
|
|
8
8
|
* @param options - Options for printing type information
|
|
9
9
|
* @returns A specification PageSection, or undefined when no URL exists
|
|
10
10
|
*/
|
|
11
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
12
|
+
// fallow-ignore-next-line unused-export
|
|
11
13
|
const printSpecification = (type, options) => {
|
|
12
14
|
if (typeof type !== "object" ||
|
|
13
15
|
type === null ||
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAKhB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAKhB,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AAkCjC,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,YACH,IAAI,CAC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own/utils");
|
|
|
11
11
|
const group_1 = require("./group");
|
|
12
12
|
const strings_1 = require("./const/strings");
|
|
13
13
|
const options_1 = require("./const/options");
|
|
14
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
15
|
+
// fallow-ignore-next-line unused-export
|
|
14
16
|
exports.API_GROUPS = {
|
|
15
17
|
operations: "operations",
|
|
16
18
|
types: "types",
|
|
@@ -76,6 +78,8 @@ exports.getCategoryLocale = getCategoryLocale;
|
|
|
76
78
|
* @param operationLocale - The locale of the operation
|
|
77
79
|
* @returns The folder name for the link category, or `undefined` if not found
|
|
78
80
|
*/
|
|
81
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
82
|
+
// fallow-ignore-next-line unused-export
|
|
79
83
|
const getLinkCategoryFolder = (type, operationLocale) => {
|
|
80
84
|
const categoryLocale = (0, exports.getCategoryLocale)(type);
|
|
81
85
|
if (!categoryLocale) {
|
|
@@ -101,6 +105,8 @@ exports.getLinkCategoryFolder = getLinkCategoryFolder;
|
|
|
101
105
|
* @param options - The options to check
|
|
102
106
|
* @returns `true` if the options include `withAttributes`, `false` otherwise
|
|
103
107
|
*/
|
|
108
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
109
|
+
// fallow-ignore-next-line unused-export
|
|
104
110
|
const hasOptionWithAttributes = (options) => {
|
|
105
111
|
return "withAttributes" in options && options.withAttributes === true;
|
|
106
112
|
};
|
|
@@ -111,6 +117,8 @@ exports.hasOptionWithAttributes = hasOptionWithAttributes;
|
|
|
111
117
|
* @param options - The options to check
|
|
112
118
|
* @returns `true` if the options include `parentTypePrefix`, `false` otherwise
|
|
113
119
|
*/
|
|
120
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
121
|
+
// fallow-ignore-next-line unused-export
|
|
114
122
|
const hasOptionParentType = (options) => {
|
|
115
123
|
return ("parentTypePrefix" in options &&
|
|
116
124
|
options.parentTypePrefix === true &&
|
|
@@ -125,6 +133,8 @@ exports.hasOptionParentType = hasOptionParentType;
|
|
|
125
133
|
* @param groups - The group options
|
|
126
134
|
* @returns The folder name for the API group
|
|
127
135
|
*/
|
|
136
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
137
|
+
// fallow-ignore-next-line unused-export
|
|
128
138
|
const getLinkApiGroupFolder = (type, groups) => {
|
|
129
139
|
let folderNames = exports.API_GROUPS;
|
|
130
140
|
if (groups && typeof groups === "object") {
|
|
@@ -240,6 +250,8 @@ exports.getRelationLink = getRelationLink;
|
|
|
240
250
|
* @param text - The text to append attributes to
|
|
241
251
|
* @returns The text with appended attributes
|
|
242
252
|
*/
|
|
253
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
254
|
+
// fallow-ignore-next-line unused-export
|
|
243
255
|
const printLinkAttributes = (type, text = "") => {
|
|
244
256
|
if (typeof type !== "object" || type === null) {
|
|
245
257
|
return text ?? "";
|
package/dist/printer.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import type { Formatter, GraphQLSchema, IPrinter, Maybe, MDXString, PageSection, PrinterEventEmitter, PrinterInitOptions, PrintTypeOptions } from "@graphql-markdown/types";
|
|
11
|
+
import { printDescription } from "./common";
|
|
12
|
+
import { printCustomDirectives, printCustomTags } from "./directive";
|
|
11
13
|
/**
|
|
12
14
|
* The Printer class implements the core functionality for generating Markdown documentation
|
|
13
15
|
* from GraphQL schema types.
|
|
@@ -30,15 +32,15 @@ export declare class Printer implements IPrinter {
|
|
|
30
32
|
/**
|
|
31
33
|
* Prints type descriptions
|
|
32
34
|
*/
|
|
33
|
-
static readonly printDescription:
|
|
35
|
+
static readonly printDescription: typeof printDescription;
|
|
34
36
|
/**
|
|
35
37
|
* Prints custom directives
|
|
36
38
|
*/
|
|
37
|
-
static readonly printCustomDirectives:
|
|
39
|
+
static readonly printCustomDirectives: typeof printCustomDirectives;
|
|
38
40
|
/**
|
|
39
41
|
* Prints custom tags
|
|
40
42
|
*/
|
|
41
|
-
static readonly printCustomTags:
|
|
43
|
+
static readonly printCustomTags: typeof printCustomTags;
|
|
42
44
|
private static _eventEmitter;
|
|
43
45
|
private static _options;
|
|
44
46
|
private static _mdxDeclaration;
|
package/dist/printer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,EACL,SAAS,EACT,WAAW,EAEX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,EACL,SAAS,EACT,WAAW,EAEX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AAiDjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA0ErE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IACtC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,gBAAgB,0BAAoB;IAEpD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,qBAAqB,+BAAyB;IAE9D;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,yBAAmB;IAElD,OAAO,CAAC,MAAM,CAAC,aAAa,CAA6B;IAEzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAoC;IAE3D,OAAO,CAAC,MAAM,CAAC,eAAe,CAA0B;IAExD;;OAE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@@ -206,7 +206,7 @@ class Printer {
|
|
|
206
206
|
* @returns Formatted code block string with type definition
|
|
207
207
|
*/
|
|
208
208
|
static printCode = (type, options) => {
|
|
209
|
-
let code
|
|
209
|
+
let code;
|
|
210
210
|
switch (true) {
|
|
211
211
|
case (0, graphql_1.isOperation)(type):
|
|
212
212
|
code = (0, graphql_2.printCodeOperation)(type, options);
|
package/dist/relation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,KAAK,EACL,gBAAgB,EAGhB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAgBjC;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,KAAK,EACL,gBAAgB,EAGhB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAgBjC;;;;;;;;GAQG;AAGH,eAAO,MAAM,2BAA2B,SAChC,MAAM,KACX,KAAK,CAAC,UAAU,CAOlB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AAGH,eAAO,MAAM,eAAe,GAAI,CAAC,QACzB,OAAO,WACJ,OAAO,eACH,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,WAC1B,gBAAgB,KACxB,SAAS,GAAG,MAmDd,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,SACnB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAgBd,CAAC"}
|
package/dist/relation.js
CHANGED
|
@@ -20,6 +20,8 @@ const options_1 = require("./const/options");
|
|
|
20
20
|
* const locale = getRootTypeLocaleFromString('Query');
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
24
|
+
// fallow-ignore-next-line unused-export
|
|
23
25
|
const getRootTypeLocaleFromString = (text) => {
|
|
24
26
|
for (const [type, props] of Object.entries(strings_1.ROOT_TYPE_LOCALE)) {
|
|
25
27
|
if (Object.values(props).includes(text)) {
|
|
@@ -43,6 +45,8 @@ exports.getRootTypeLocaleFromString = getRootTypeLocaleFromString;
|
|
|
43
45
|
* const mdx = printRelationOf(type, "Member Of", getRelationOfField, options);
|
|
44
46
|
* ```
|
|
45
47
|
*/
|
|
48
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
49
|
+
// fallow-ignore-next-line unused-export
|
|
46
50
|
const printRelationOf = (type, section, getRelation, options) => {
|
|
47
51
|
if (!(0, graphql_1.isNamedType)(type) ||
|
|
48
52
|
(0, graphql_1.isOperation)(type) ||
|
package/dist/section.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,KAAK,EACL,SAAS,EACT,WAAW,EACX,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAuBjC;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../src/section.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,KAAK,EACL,SAAS,EACT,WAAW,EACX,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAuBjC;;;;;;;;GAQG;AAGH,eAAO,MAAM,gBAAgB,GAAI,CAAC,QAC1B,CAAC,WACE,gBAAgB,KACxB,SAAS,GAAG,MAgDd,CAAC;AAEF;;;;;;;;GAQG;AAGH,eAAO,MAAM,iBAAiB,GAAI,CAAC,UACzB,CAAC,GAAG,CAAC,EAAE,WACN,gBAAgB,KACxB,SAAS,GAAG,MAiBd,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,UACpB,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,WACjB,MAAM,WACN,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAmCnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,QACjC,CAAC,UACC,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,WACrB,MAAM,WACN,gBAAgB,KACxB,KAAK,CAAC,WAAW,CAqEnB,CAAC"}
|
package/dist/section.js
CHANGED
|
@@ -23,6 +23,8 @@ const options_1 = require("./const/options");
|
|
|
23
23
|
*
|
|
24
24
|
* @template T - Type of the GraphQL element being printed
|
|
25
25
|
*/
|
|
26
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
27
|
+
// fallow-ignore-next-line unused-export
|
|
26
28
|
const printSectionItem = (type, options) => {
|
|
27
29
|
const level = "level" in options && typeof options.level === "number" ? options.level : 4;
|
|
28
30
|
if (!(0, link_1.hasPrintableDirective)(type, options)) {
|
|
@@ -67,6 +69,8 @@ exports.printSectionItem = printSectionItem;
|
|
|
67
69
|
*
|
|
68
70
|
* @template V - Type of the values being printed
|
|
69
71
|
*/
|
|
72
|
+
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
73
|
+
// fallow-ignore-next-line unused-export
|
|
70
74
|
const printSectionItems = (values, options) => {
|
|
71
75
|
if (!Array.isArray(values) || values.length === 0) {
|
|
72
76
|
return "";
|
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.16.
|
|
8
|
+
"version": "1.16.2",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
"prettier": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" --check",
|
|
59
59
|
"prettier:fix": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" --write",
|
|
60
60
|
"ts:check": "tsgo --noEmit",
|
|
61
|
-
"test": "
|
|
62
|
-
"test:unit": "
|
|
63
|
-
"test:integration": "
|
|
64
|
-
"test:ci": "
|
|
65
|
-
"test:watch": "
|
|
61
|
+
"test": "vitest run --passWithNoTests",
|
|
62
|
+
"test:unit": "vitest run --passWithNoTests tests/unit",
|
|
63
|
+
"test:integration": "vitest run --passWithNoTests tests/integration",
|
|
64
|
+
"test:ci": "vitest run --passWithNoTests --silent --sequence.shuffle",
|
|
65
|
+
"test:watch": "vitest --watch"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@graphql-markdown/formatters": "
|
|
69
|
-
"@graphql-markdown/graphql": "
|
|
70
|
-
"@graphql-markdown/types": "
|
|
71
|
-
"@graphql-markdown/utils": "
|
|
68
|
+
"@graphql-markdown/formatters": "",
|
|
69
|
+
"@graphql-markdown/graphql": "",
|
|
70
|
+
"@graphql-markdown/types": "",
|
|
71
|
+
"@graphql-markdown/utils": ""
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@graphql-markdown/tooling-config": "
|
|
74
|
+
"@graphql-markdown/tooling-config": ""
|
|
75
75
|
},
|
|
76
76
|
"resolutions": {
|
|
77
77
|
"micromatch": "4.0.8"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"test": "tests"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
|
-
"node": ">=
|
|
83
|
+
"node": ">=22.12.0"
|
|
84
84
|
},
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
package/dist/format-helpers.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format event helpers for printer-legacy.
|
|
3
|
-
*
|
|
4
|
-
* This module provides helper functions to emit MDX format events and handle
|
|
5
|
-
* fallback to default formatters when no custom handlers are registered.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { AdmonitionType, Badge, CollapsibleOption, FrontMatterOptions, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
|
|
10
|
-
/**
|
|
11
|
-
* Default badge formatter.
|
|
12
|
-
*/
|
|
13
|
-
export declare const formatMDXBadge: (badge: Badge) => MDXString;
|
|
14
|
-
/**
|
|
15
|
-
* Default admonition formatter.
|
|
16
|
-
*/
|
|
17
|
-
export declare const formatMDXAdmonition: ({ text, title, type, icon }: AdmonitionType, _meta: Maybe<MetaInfo>) => MDXString;
|
|
18
|
-
/**
|
|
19
|
-
* Default bullet formatter.
|
|
20
|
-
*/
|
|
21
|
-
export declare const formatMDXBullet: (text?: string) => MDXString;
|
|
22
|
-
/**
|
|
23
|
-
* Default details formatter.
|
|
24
|
-
*
|
|
25
|
-
* The returned string **must** contain a `\r` (carriage return) character as a
|
|
26
|
-
* delimiter between the opening part (ending after `</summary>`) and the
|
|
27
|
-
* closing part (starting before `</details>`). `printSection` calls
|
|
28
|
-
* `result.split('\r')` to obtain `[openSection, closeSection]`; without this
|
|
29
|
-
* delimiter the closing tag is lost and items are rendered outside the
|
|
30
|
-
* collapsible element.
|
|
31
|
-
*
|
|
32
|
-
* Custom implementations of `formatMDXDetails` must follow the same contract.
|
|
33
|
-
*/
|
|
34
|
-
export declare const formatMDXDetails: ({ dataOpen, }: CollapsibleOption) => MDXString;
|
|
35
|
-
/**
|
|
36
|
-
* Default frontmatter formatter.
|
|
37
|
-
*/
|
|
38
|
-
export declare const formatMDXFrontmatter: (_props: Maybe<FrontMatterOptions>, formatted: Maybe<string[]>) => MDXString;
|
|
39
|
-
/**
|
|
40
|
-
* Default link formatter.
|
|
41
|
-
*/
|
|
42
|
-
export declare const formatMDXLink: (link: TypeLink) => TypeLink;
|
|
43
|
-
/**
|
|
44
|
-
* Default name entity formatter.
|
|
45
|
-
*/
|
|
46
|
-
export declare const formatMDXNameEntity: (name: string, parentType?: Maybe<string>) => MDXString;
|
|
47
|
-
/**
|
|
48
|
-
* Default specified-by link formatter.
|
|
49
|
-
*/
|
|
50
|
-
export declare const formatMDXSpecifiedByLink: (url: string) => MDXString;
|
|
51
|
-
//# sourceMappingURL=format-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-helpers.d.ts","sourceRoot":"","sources":["../src/format-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AASjC;;GAEG;AACH,eAAO,MAAM,cAAc,UAAW,KAAK,KAAG,SAE7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,gCACD,cAAc,SACpC,KAAK,CAAC,QAAQ,CAAC,KACrB,SAEF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,qBAAgB,SAE3C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,kBAE1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBAAkB,CAAC,aACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAMF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAE9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAKF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SAEtD,CAAC"}
|
package/dist/format-helpers.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Format event helpers for printer-legacy.
|
|
4
|
-
*
|
|
5
|
-
* This module provides helper functions to emit MDX format events and handle
|
|
6
|
-
* fallback to default formatters when no custom handlers are registered.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXLink = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
|
|
12
|
-
// Import default formatters
|
|
13
|
-
const strings_1 = require("./const/strings");
|
|
14
|
-
/**
|
|
15
|
-
* Default badge formatter.
|
|
16
|
-
*/
|
|
17
|
-
const formatMDXBadge = (badge) => {
|
|
18
|
-
return `<mark class="gqlmd-mdx-badge">${badge.text}</mark>`;
|
|
19
|
-
};
|
|
20
|
-
exports.formatMDXBadge = formatMDXBadge;
|
|
21
|
-
/**
|
|
22
|
-
* Default admonition formatter.
|
|
23
|
-
*/
|
|
24
|
-
const formatMDXAdmonition = ({ text, title, type, icon }, _meta) => {
|
|
25
|
-
return `${strings_1.MARKDOWN_EOP}<fieldset class="gqlmd-mdx-admonition-fieldset">${strings_1.MARKDOWN_EOL}<legend class="gqlmd-mdx-admonition-legend"><span class="gqlmd-mdx-admonition-legend-type gqlmd-mdx-admonition-legend-type-${type.toLocaleLowerCase()}">${icon ?? type.toUpperCase()} ${title}</span></legend>${strings_1.MARKDOWN_EOL}<span>${text}</span>${strings_1.MARKDOWN_EOL}</fieldset>`;
|
|
26
|
-
};
|
|
27
|
-
exports.formatMDXAdmonition = formatMDXAdmonition;
|
|
28
|
-
/**
|
|
29
|
-
* Default bullet formatter.
|
|
30
|
-
*/
|
|
31
|
-
const formatMDXBullet = (text = "") => {
|
|
32
|
-
return `<span class="gqlmd-mdx-bullet"> ● </span>${text}`;
|
|
33
|
-
};
|
|
34
|
-
exports.formatMDXBullet = formatMDXBullet;
|
|
35
|
-
/**
|
|
36
|
-
* Default details formatter.
|
|
37
|
-
*
|
|
38
|
-
* The returned string **must** contain a `\r` (carriage return) character as a
|
|
39
|
-
* delimiter between the opening part (ending after `</summary>`) and the
|
|
40
|
-
* closing part (starting before `</details>`). `printSection` calls
|
|
41
|
-
* `result.split('\r')` to obtain `[openSection, closeSection]`; without this
|
|
42
|
-
* delimiter the closing tag is lost and items are rendered outside the
|
|
43
|
-
* collapsible element.
|
|
44
|
-
*
|
|
45
|
-
* Custom implementations of `formatMDXDetails` must follow the same contract.
|
|
46
|
-
*/
|
|
47
|
-
const formatMDXDetails = ({ dataOpen, }) => {
|
|
48
|
-
return `${strings_1.MARKDOWN_EOP}<details class="gqlmd-mdx-details">${strings_1.MARKDOWN_EOL}<summary class="gqlmd-mdx-details-summary"><span className="gqlmd-mdx-details-summary-open">${dataOpen.toUpperCase()}</span></summary>${strings_1.MARKDOWN_EOL}\r${strings_1.MARKDOWN_EOL}</details>${strings_1.MARKDOWN_EOP}`;
|
|
49
|
-
};
|
|
50
|
-
exports.formatMDXDetails = formatMDXDetails;
|
|
51
|
-
/**
|
|
52
|
-
* Default frontmatter formatter.
|
|
53
|
-
*/
|
|
54
|
-
const formatMDXFrontmatter = (_props, formatted) => {
|
|
55
|
-
return formatted
|
|
56
|
-
? [strings_1.FRONT_MATTER_DELIMITER, ...formatted, strings_1.FRONT_MATTER_DELIMITER].join(strings_1.MARKDOWN_EOL)
|
|
57
|
-
: "";
|
|
58
|
-
};
|
|
59
|
-
exports.formatMDXFrontmatter = formatMDXFrontmatter;
|
|
60
|
-
/**
|
|
61
|
-
* Default link formatter.
|
|
62
|
-
*/
|
|
63
|
-
const formatMDXLink = (link) => {
|
|
64
|
-
return link;
|
|
65
|
-
};
|
|
66
|
-
exports.formatMDXLink = formatMDXLink;
|
|
67
|
-
/**
|
|
68
|
-
* Default name entity formatter.
|
|
69
|
-
*/
|
|
70
|
-
const formatMDXNameEntity = (name, parentType) => {
|
|
71
|
-
const parentName = parentType
|
|
72
|
-
? `<code class="gqlmd-mdx-entity-parent">${parentType}</code>.`
|
|
73
|
-
: "";
|
|
74
|
-
return `<span class="gqlmd-mdx-entity">${parentName}<code class="gqlmd-mdx-entity-name">${name}</code></span>`;
|
|
75
|
-
};
|
|
76
|
-
exports.formatMDXNameEntity = formatMDXNameEntity;
|
|
77
|
-
/**
|
|
78
|
-
* Default specified-by link formatter.
|
|
79
|
-
*/
|
|
80
|
-
const formatMDXSpecifiedByLink = (url) => {
|
|
81
|
-
return `<span class="gqlmd-mdx-specifiedby">Specification<a class="gqlmd-mdx-specifiedby-link" target="_blank" href="${url}" title="Specified by ${url}">⎘</a></span>`;
|
|
82
|
-
};
|
|
83
|
-
exports.formatMDXSpecifiedByLink = formatMDXSpecifiedByLink;
|
package/dist/mdx/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MDX formatting module for GraphQL-Markdown.
|
|
3
|
-
*
|
|
4
|
-
* This module provides a set of utility functions for formatting various MDX components
|
|
5
|
-
* used in the documentation generation process. It handles the formatting of badges,
|
|
6
|
-
* admonitions, bullet points, collapsible sections, and other MDX-specific elements.
|
|
7
|
-
*
|
|
8
|
-
* The module can be used with default formatters or customized with user-provided
|
|
9
|
-
* MDX formatting functions through the mdxModule factory function.
|
|
10
|
-
*
|
|
11
|
-
* @module mdx
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
|
-
import type { MDXSupportType } from "@graphql-markdown/types";
|
|
15
|
-
export declare const mdxDeclaration = "";
|
|
16
|
-
declare const defaultModule: MDXSupportType;
|
|
17
|
-
export declare const mdxModule: (mdxPackage?: Record<string, unknown>) => Promise<Readonly<MDXSupportType>>;
|
|
18
|
-
export default defaultModule;
|
|
19
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/mdx/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdx/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAOV,cAAc,EAGf,MAAM,yBAAyB,CAAC;AA0KjC,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,QAAA,MAAM,aAAa,EASd,cAAc,CAAC;AAEpB,eAAO,MAAM,SAAS,gBACP,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAkBlC,CAAC;eAEa,aAAa"}
|
package/dist/mdx/index.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* MDX formatting module for GraphQL-Markdown.
|
|
4
|
-
*
|
|
5
|
-
* This module provides a set of utility functions for formatting various MDX components
|
|
6
|
-
* used in the documentation generation process. It handles the formatting of badges,
|
|
7
|
-
* admonitions, bullet points, collapsible sections, and other MDX-specific elements.
|
|
8
|
-
*
|
|
9
|
-
* The module can be used with default formatters or customized with user-provided
|
|
10
|
-
* MDX formatting functions through the mdxModule factory function.
|
|
11
|
-
*
|
|
12
|
-
* @module mdx
|
|
13
|
-
* @packageDocumentation
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.mdxModule = exports.mdxDeclaration = void 0;
|
|
17
|
-
const strings_1 = require("../const/strings");
|
|
18
|
-
/**
|
|
19
|
-
* Formats a badge into an MDX string.
|
|
20
|
-
*
|
|
21
|
-
* @param badge - The badge object containing text to display.
|
|
22
|
-
* @returns An MDX string representing the badge.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const badge = { text: "Beta" };
|
|
27
|
-
* formatMDXBadge(badge);
|
|
28
|
-
* // '<mark class="gqlmd-mdx-badge">Beta</mark>'
|
|
29
|
-
* ```
|
|
30
|
-
* @see {@link mdxModule.formatMDXBadge} for the equivalent function in the MDX module.
|
|
31
|
-
* @see {@link printer.formatBadge} for usage in the printer module.
|
|
32
|
-
*/
|
|
33
|
-
const formatMDXBadge = (badge) => {
|
|
34
|
-
return `<mark class="gqlmd-mdx-badge">${badge.text}</mark>`;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Formats an admonition into an MDX string.
|
|
38
|
-
*
|
|
39
|
-
* @param admonition - The admonition object containing text, title, type, and optional icon.
|
|
40
|
-
* @param _meta - Optional metadata for the admonition.
|
|
41
|
-
* @returns An MDX string representing the admonition.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* const admonition = { text: "Be careful!", title: "Warning", type: "warning", icon: "⚠️" };
|
|
46
|
-
* formatMDXAdmonition(admonition, null);
|
|
47
|
-
* // '<fieldset class="gqlmd-mdx-admonition-fieldset">...</fieldset>'
|
|
48
|
-
* ```
|
|
49
|
-
* @see {@link mdxModule.formatMDXAdmonition} for the equivalent function in the MDX module.
|
|
50
|
-
* @see {@link printer.formatAdmonition} for usage in the printer module.
|
|
51
|
-
*/
|
|
52
|
-
const formatMDXAdmonition = ({ text, title, type, icon }, _meta) => {
|
|
53
|
-
return `${strings_1.MARKDOWN_EOP}<fieldset class="gqlmd-mdx-admonition-fieldset">${strings_1.MARKDOWN_EOL}<legend class="gqlmd-mdx-admonition-legend"><span class="gqlmd-mdx-admonition-legend-type gqlmd-mdx-admonition-legend-type-${type.toLocaleLowerCase()}">${icon ?? type.toUpperCase()} ${title}</span></legend>${strings_1.MARKDOWN_EOL}<span>${text}</span>${strings_1.MARKDOWN_EOL}</fieldset>`;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Formats a bullet point into an MDX string.
|
|
57
|
-
*
|
|
58
|
-
* @param text - The text to display next to the bullet. Defaults to an empty string.
|
|
59
|
-
* @returns An MDX string representing the bullet point.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* formatMDXBullet("Item 1");
|
|
64
|
-
* // '<span class="gqlmd-mdx-bullet"> ● </span>Item 1'
|
|
65
|
-
* ```
|
|
66
|
-
* @see {@link mdxModule.formatMDXBullet} for the equivalent function in the MDX module.
|
|
67
|
-
* @see {@link printer.formatBullet} for usage in the printer module.
|
|
68
|
-
*/
|
|
69
|
-
const formatMDXBullet = (text = "") => {
|
|
70
|
-
return `<span class="gqlmd-mdx-bullet"> ● </span>${text}`;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Formats a collapsible details section into an MDX string.
|
|
74
|
-
*
|
|
75
|
-
* @param options - The collapsible options containing the `dataOpen` text.
|
|
76
|
-
* @returns An MDX string representing the collapsible details section.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* const options = { dataOpen: "More Info" };
|
|
81
|
-
* formatMDXDetails(options);
|
|
82
|
-
* // '\n\n<details class="gqlmd-mdx-details">\n<summary class="gqlmd-mdx-details-summary"><span className="gqlmd-mdx-details-summary-open">MORE INFO</span></summary>\n\r\n</details>\n\n'
|
|
83
|
-
* ```
|
|
84
|
-
* @see {@link mdxModule.formatMDXDetails} for the equivalent function in the MDX module.
|
|
85
|
-
* @see {@link printer.formatDetails} for usage in the printer module.
|
|
86
|
-
*/
|
|
87
|
-
const formatMDXDetails = ({ dataOpen }) => {
|
|
88
|
-
return `${strings_1.MARKDOWN_EOP}<details class="gqlmd-mdx-details">${strings_1.MARKDOWN_EOL}<summary class="gqlmd-mdx-details-summary"><span className="gqlmd-mdx-details-summary-open">${dataOpen.toUpperCase()}</span></summary>${strings_1.MARKDOWN_EOL}\r${strings_1.MARKDOWN_EOL}</details>${strings_1.MARKDOWN_EOP}`;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Formats a "Specified By" link into an MDX string.
|
|
92
|
-
*
|
|
93
|
-
* @param url - The URL of the specification.
|
|
94
|
-
* @returns An MDX string representing the "Specified By" link.
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```typescript
|
|
98
|
-
* formatMDXSpecifiedByLink("https://example.com");
|
|
99
|
-
* // '<span class="gqlmd-mdx-specifiedby">Specification<a class="gqlmd-mdx-specifiedby-link" target="_blank" href="https://example.com" title="Specified by https://example.com">⎘</a></span>'
|
|
100
|
-
* ```
|
|
101
|
-
* @see {@link mdxModule.formatMDXSpecifiedByLink} for the equivalent function in the MDX module.
|
|
102
|
-
* @see {@link printer.formatSpecifiedByLink} for usage in the printer module.
|
|
103
|
-
*/
|
|
104
|
-
const formatMDXSpecifiedByLink = (url) => {
|
|
105
|
-
return `<span class="gqlmd-mdx-specifiedby">Specification<a class="gqlmd-mdx-specifiedby-link" target="_blank" href="${url}" title="Specified by ${url}">⎘</a></span>`;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Formats an entity name into an MDX string.
|
|
109
|
-
*
|
|
110
|
-
* @param name - The name of the entity.
|
|
111
|
-
* @param parentType - Optional parent type of the entity.
|
|
112
|
-
* @returns An MDX string representing the entity name.
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```typescript
|
|
116
|
-
* formatMDXNameEntity("User", "Query");
|
|
117
|
-
* // '<span class="gqlmd-mdx-entity"><code class="gqlmd-mdx-entity-parent">Query</code>.<code class="gqlmd-mdx-entity-name">User</code></span>'
|
|
118
|
-
* ```
|
|
119
|
-
* @see {@link mdxModule.formatMDXNameEntity} for the equivalent function in the MDX module.
|
|
120
|
-
* @see {@link printer.formatNameEntity} for usage in the printer module.
|
|
121
|
-
*/
|
|
122
|
-
const formatMDXNameEntity = (name, parentType) => {
|
|
123
|
-
const parentName = parentType
|
|
124
|
-
? `<code class="gqlmd-mdx-entity-parent">${parentType}</code>.`
|
|
125
|
-
: "";
|
|
126
|
-
return `<span class="gqlmd-mdx-entity">${parentName}<code class="gqlmd-mdx-entity-name">${name}</code></span>`;
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Formats a TypeLink object for MDX format.
|
|
130
|
-
*
|
|
131
|
-
* Currently, this function returns the link as is without modification.
|
|
132
|
-
* This may serve as a placeholder for future formatting logic.
|
|
133
|
-
*
|
|
134
|
-
* @param link - The `TypeLink` object to format
|
|
135
|
-
* @returns The formatted `TypeLink` object
|
|
136
|
-
*/
|
|
137
|
-
const formatMDXLink = (link) => {
|
|
138
|
-
return link;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Formats a front matter section into an MDX string.
|
|
142
|
-
*
|
|
143
|
-
* @param _props - The front matter options.
|
|
144
|
-
* @param formatted - The formatted front matter as an array of strings.
|
|
145
|
-
* @returns An MDX string representing the front matter.
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* const formatted = ["title: My Title", "tags: [tag1, tag2]"];
|
|
150
|
-
* formatMDXFrontmatter(null, formatted);
|
|
151
|
-
* // '---\ntitle: My Title\ntags: [tag1, tag2]\n---'
|
|
152
|
-
* ```
|
|
153
|
-
* @see {@link mdxModule.formatMDXFrontmatter} for the equivalent function in the MDX module.
|
|
154
|
-
* @see {@link printer.formatFrontmatter} for usage in the printer module.
|
|
155
|
-
*/
|
|
156
|
-
const formatMDXFrontmatter = (_props, formatted) => {
|
|
157
|
-
return formatted
|
|
158
|
-
? [strings_1.FRONT_MATTER_DELIMITER, ...formatted, strings_1.FRONT_MATTER_DELIMITER].join(strings_1.MARKDOWN_EOL)
|
|
159
|
-
: "";
|
|
160
|
-
};
|
|
161
|
-
exports.mdxDeclaration = "";
|
|
162
|
-
const defaultModule = {
|
|
163
|
-
formatMDXAdmonition,
|
|
164
|
-
formatMDXBadge,
|
|
165
|
-
formatMDXBullet,
|
|
166
|
-
formatMDXDetails,
|
|
167
|
-
formatMDXFrontmatter,
|
|
168
|
-
formatMDXNameEntity,
|
|
169
|
-
formatMDXSpecifiedByLink,
|
|
170
|
-
mdxDeclaration: exports.mdxDeclaration,
|
|
171
|
-
};
|
|
172
|
-
const mdxModule = async (mdxPackage) => {
|
|
173
|
-
if (!mdxPackage) {
|
|
174
|
-
return defaultModule;
|
|
175
|
-
}
|
|
176
|
-
const module = (mdxPackage.default ?? mdxPackage);
|
|
177
|
-
return {
|
|
178
|
-
formatMDXAdmonition: module.formatMDXAdmonition ?? formatMDXAdmonition,
|
|
179
|
-
formatMDXBadge: module.formatMDXBadge ?? formatMDXBadge,
|
|
180
|
-
formatMDXBullet: module.formatMDXBullet ?? formatMDXBullet,
|
|
181
|
-
formatMDXDetails: module.formatMDXDetails ?? formatMDXDetails,
|
|
182
|
-
formatMDXFrontmatter: module.formatMDXFrontmatter ?? formatMDXFrontmatter,
|
|
183
|
-
formatMDXLink: module.formatMDXLink ?? formatMDXLink,
|
|
184
|
-
formatMDXNameEntity: module.formatMDXNameEntity ?? formatMDXNameEntity,
|
|
185
|
-
formatMDXSpecifiedByLink: module.formatMDXSpecifiedByLink ?? formatMDXSpecifiedByLink,
|
|
186
|
-
mdxDeclaration: module.mdxDeclaration ?? exports.mdxDeclaration,
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
exports.mdxModule = mdxModule;
|
|
190
|
-
exports.default = defaultModule;
|