@graphql-markdown/printer-legacy 1.16.1 → 1.17.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/badge.d.ts.map +1 -1
- package/dist/badge.js +0 -1
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +0 -3
- package/dist/const/options.d.ts.map +1 -1
- package/dist/const/options.js +1 -2
- package/dist/directive.d.ts.map +1 -1
- package/dist/directive.js +0 -2
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +0 -1
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +1 -0
- package/dist/graphql/scalar.d.ts.map +1 -1
- package/dist/graphql/scalar.js +0 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +0 -6
- package/dist/printer.d.ts +22 -3
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +36 -3
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +0 -2
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +17 -5
- package/package.json +6 -6
- 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;AAEH,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
|
@@ -25,7 +25,6 @@ exports.CSS_BADGE_CLASSNAME = {
|
|
|
25
25
|
* @returns Array of Badge objects containing text and optional classnames
|
|
26
26
|
*/
|
|
27
27
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
28
|
-
// fallow-ignore-next-line unused-export
|
|
29
28
|
const getTypeBadges = (type, groups) => {
|
|
30
29
|
if (typeof type !== "object" || type === null) {
|
|
31
30
|
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;AAEH,eAAO,MAAM,uBAAuB,SAC5B,OAAO,YACH,gBAAgB,KACzB,MA4BF,CAAC;AAuBF;;;;;GAKG;AAEH,eAAO,MAAM,YAAY,oBACN;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WACzC,gBAAgB,KACxB,MAUF,CAAC;AAEF;;;;;GAKG;AAEH,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
|
@@ -17,7 +17,6 @@ const directive_1 = require("./directive");
|
|
|
17
17
|
* @returns Formatted directive documentation string
|
|
18
18
|
*/
|
|
19
19
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
20
|
-
// fallow-ignore-next-line unused-export
|
|
21
20
|
const getCustomDirectivesText = (type, options) => {
|
|
22
21
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options?.customDirectives);
|
|
23
22
|
if ((0, utils_1.isEmpty)(constDirectiveMap)) {
|
|
@@ -60,7 +59,6 @@ const formatDescription = (type, replacement = strings_1.NO_DESCRIPTION_TEXT) =>
|
|
|
60
59
|
* @returns Formatted warning message as MDX string
|
|
61
60
|
*/
|
|
62
61
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
63
|
-
// fallow-ignore-next-line unused-export
|
|
64
62
|
const printWarning = ({ text, title }, options) => {
|
|
65
63
|
const formattedText = typeof text !== "string" || text.trim() === ""
|
|
66
64
|
? strings_1.MARKDOWN_EOP
|
|
@@ -75,7 +73,6 @@ exports.printWarning = printWarning;
|
|
|
75
73
|
* @returns Formatted deprecation warning as MDX string, or empty string if not deprecated
|
|
76
74
|
*/
|
|
77
75
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
78
|
-
// fallow-ignore-next-line unused-export
|
|
79
76
|
const printDeprecation = (type, options) => {
|
|
80
77
|
if (typeof type !== "object" || type === null || !(0, graphql_1.isDeprecated)(type)) {
|
|
81
78
|
return "";
|
|
@@ -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;
|
|
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;AAcjC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IAEX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB;;OAEG;IAEH,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;CA8BvC,CAAC"}
|
package/dist/const/options.js
CHANGED
|
@@ -6,7 +6,6 @@ var TypeHierarchy;
|
|
|
6
6
|
(function (TypeHierarchy) {
|
|
7
7
|
TypeHierarchy["API"] = "api";
|
|
8
8
|
// Used only by unit tests for direct whitebox coverage.
|
|
9
|
-
// fallow-ignore-next-line unused-enum-member
|
|
10
9
|
TypeHierarchy["ENTITY"] = "entity";
|
|
11
10
|
TypeHierarchy["FLAT"] = "flat";
|
|
12
11
|
})(TypeHierarchy || (exports.TypeHierarchy = TypeHierarchy = {}));
|
|
@@ -16,7 +15,6 @@ var SectionLevels;
|
|
|
16
15
|
* @deprecated Use `SectionLevels.LEVEL` instead.
|
|
17
16
|
*/
|
|
18
17
|
// Reserved for future usage.
|
|
19
|
-
// fallow-ignore-next-line unused-enum-member
|
|
20
18
|
SectionLevels["NONE"] = "";
|
|
21
19
|
SectionLevels["LEVEL"] = "#";
|
|
22
20
|
})(SectionLevels || (exports.SectionLevels = SectionLevels = {}));
|
|
@@ -58,5 +56,6 @@ exports.DEFAULT_OPTIONS = {
|
|
|
58
56
|
formatMDXFrontmatter: defaults_1.formatMDXFrontmatter,
|
|
59
57
|
formatMDXLink: defaults_1.formatMDXLink,
|
|
60
58
|
formatMDXNameEntity: defaults_1.formatMDXNameEntity,
|
|
59
|
+
formatMDXPermalink: defaults_1.formatMDXPermalink,
|
|
61
60
|
formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
|
|
62
61
|
};
|
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;AAEH,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;AAEH,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
|
@@ -34,7 +34,6 @@ exports.getCustomDirectiveResolver = getCustomDirectiveResolver;
|
|
|
34
34
|
* @returns Formatted Markdown string for the directive or `undefined`
|
|
35
35
|
*/
|
|
36
36
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
37
|
-
// fallow-ignore-next-line unused-export
|
|
38
37
|
const printCustomDirective = (type, constDirectiveOption, options) => {
|
|
39
38
|
const typeNameLink = (0, link_1.printLink)(constDirectiveOption.type, {
|
|
40
39
|
...options,
|
|
@@ -83,7 +82,6 @@ exports.printCustomDirectives = printCustomDirectives;
|
|
|
83
82
|
* @returns Array of badge configurations from directive tags
|
|
84
83
|
*/
|
|
85
84
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
86
|
-
// fallow-ignore-next-line unused-export
|
|
87
85
|
const getCustomTags = (type, options) => {
|
|
88
86
|
const constDirectiveMap = (0, graphql_1.getConstDirectiveMap)(type, options.customDirectives);
|
|
89
87
|
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;AAEH,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
|
@@ -16,7 +16,6 @@ const link_1 = require("./link");
|
|
|
16
16
|
* @returns The directive example configuration if valid, otherwise `undefined`
|
|
17
17
|
*/
|
|
18
18
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
19
|
-
// fallow-ignore-next-line unused-export
|
|
20
19
|
const getDirectiveExampleOption = ({ exampleSection, schema, }) => {
|
|
21
20
|
let directiveName = "example", argName = "value", parserFunc = undefined;
|
|
22
21
|
if (exampleSection && typeof exampleSection === "object") {
|
package/dist/formatter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAczD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,QAAO,SAYzC,CAAC"}
|
package/dist/formatter.js
CHANGED
|
@@ -36,6 +36,7 @@ const createDefaultFormatter = () => {
|
|
|
36
36
|
formatMDXFrontmatter: defaults_1.formatMDXFrontmatter,
|
|
37
37
|
formatMDXLink: defaults_1.formatMDXLink,
|
|
38
38
|
formatMDXNameEntity: defaults_1.formatMDXNameEntity,
|
|
39
|
+
formatMDXPermalink: defaults_1.formatMDXPermalink,
|
|
39
40
|
formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
|
|
40
41
|
};
|
|
41
42
|
};
|
|
@@ -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;AAEH,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
|
@@ -9,7 +9,6 @@ const graphql_1 = require("@graphql-markdown/graphql");
|
|
|
9
9
|
* @returns A specification PageSection, or undefined when no URL exists
|
|
10
10
|
*/
|
|
11
11
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
12
|
-
// fallow-ignore-next-line unused-export
|
|
13
12
|
const printSpecification = (type, options) => {
|
|
14
13
|
if (typeof type !== "object" ||
|
|
15
14
|
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;AAiCjC,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAG5C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,YACH,IAAI,CACZ,gBAAgB,EAChB,YAAY,GAAG,mBAAmB,GAAG,mBAAmB,CACzD,KACA,OAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,KAAK,CAAC,UAAU,CAoBjE,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,oBACK,KAAK,CAAC,UAAU,CAAC,KAClC,KAAK,CAAC,MAAM,CAoBd,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,uBAAuB,YAAa,gBAAgB,KAAG,OAEnE,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,YAAa,gBAAgB,KAAG,OAO/D,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO,WACJ,KAAK,CAAC,oBAAoB,GAAG,OAAO,CAAC,KAC7C,MAMF,CAAC;AAuBF;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,SACX,OAAO,QACP,MAAM,aACD,KAAK,CAAC,UAAU,CAAC,WACnB,gBAAgB,KACxB,QAkFF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,aAChB,KAAK,CAAC,UAAU,CAAC,QACrB,OAAO,WACJ,gBAAgB,KACxB,KAAK,CAAC,QAAQ,CAUhB,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,mBAAmB,SACxB,OAAO,SACP,KAAK,CAAC,MAAM,CAAC,KAClB,MAkBF,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,OACpB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,WACf,gBAAgB,KACxB,MAgCF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,SACpB,OAAO,WACJ,gBAAgB,KACxB,SAAS,GAAG,MAWd,CAAC"}
|
package/dist/link.js
CHANGED
|
@@ -12,7 +12,6 @@ const group_1 = require("./group");
|
|
|
12
12
|
const strings_1 = require("./const/strings");
|
|
13
13
|
const options_1 = require("./const/options");
|
|
14
14
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
15
|
-
// fallow-ignore-next-line unused-export
|
|
16
15
|
exports.API_GROUPS = {
|
|
17
16
|
operations: "operations",
|
|
18
17
|
types: "types",
|
|
@@ -79,7 +78,6 @@ exports.getCategoryLocale = getCategoryLocale;
|
|
|
79
78
|
* @returns The folder name for the link category, or `undefined` if not found
|
|
80
79
|
*/
|
|
81
80
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
82
|
-
// fallow-ignore-next-line unused-export
|
|
83
81
|
const getLinkCategoryFolder = (type, operationLocale) => {
|
|
84
82
|
const categoryLocale = (0, exports.getCategoryLocale)(type);
|
|
85
83
|
if (!categoryLocale) {
|
|
@@ -106,7 +104,6 @@ exports.getLinkCategoryFolder = getLinkCategoryFolder;
|
|
|
106
104
|
* @returns `true` if the options include `withAttributes`, `false` otherwise
|
|
107
105
|
*/
|
|
108
106
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
109
|
-
// fallow-ignore-next-line unused-export
|
|
110
107
|
const hasOptionWithAttributes = (options) => {
|
|
111
108
|
return "withAttributes" in options && options.withAttributes === true;
|
|
112
109
|
};
|
|
@@ -118,7 +115,6 @@ exports.hasOptionWithAttributes = hasOptionWithAttributes;
|
|
|
118
115
|
* @returns `true` if the options include `parentTypePrefix`, `false` otherwise
|
|
119
116
|
*/
|
|
120
117
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
121
|
-
// fallow-ignore-next-line unused-export
|
|
122
118
|
const hasOptionParentType = (options) => {
|
|
123
119
|
return ("parentTypePrefix" in options &&
|
|
124
120
|
options.parentTypePrefix === true &&
|
|
@@ -134,7 +130,6 @@ exports.hasOptionParentType = hasOptionParentType;
|
|
|
134
130
|
* @returns The folder name for the API group
|
|
135
131
|
*/
|
|
136
132
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
137
|
-
// fallow-ignore-next-line unused-export
|
|
138
133
|
const getLinkApiGroupFolder = (type, groups) => {
|
|
139
134
|
let folderNames = exports.API_GROUPS;
|
|
140
135
|
if (groups && typeof groups === "object") {
|
|
@@ -251,7 +246,6 @@ exports.getRelationLink = getRelationLink;
|
|
|
251
246
|
* @returns The text with appended attributes
|
|
252
247
|
*/
|
|
253
248
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
254
|
-
// fallow-ignore-next-line unused-export
|
|
255
249
|
const printLinkAttributes = (type, text = "") => {
|
|
256
250
|
if (typeof type !== "object" || type === null) {
|
|
257
251
|
return text ?? "";
|
package/dist/printer.d.ts
CHANGED
|
@@ -174,15 +174,34 @@ export declare class Printer implements IPrinter {
|
|
|
174
174
|
*/
|
|
175
175
|
static readonly printType: (name: Maybe<string>, type: unknown, options?: Maybe<Partial<PrintTypeOptions>>) => Promise<Maybe<MDXString>>;
|
|
176
176
|
/**
|
|
177
|
-
* Renders a page section
|
|
177
|
+
* Renders a page section into markdown text.
|
|
178
|
+
*
|
|
179
|
+
* Accepts a nullable section-like value and safely normalizes it into a string.
|
|
180
|
+
* If the section has a valid `title`, a markdown heading is prefixed using the
|
|
181
|
+
* provided `level` (defaulting to 3). If no valid title exists, only content is returned.
|
|
182
|
+
*
|
|
183
|
+
* Content can be a string, a nested section object, or an array of nested entries.
|
|
184
|
+
* Nested content is rendered recursively by calling `renderPageSection` for each child.
|
|
185
|
+
* Invalid, unsupported, or effectively empty inputs return an empty string.
|
|
186
|
+
*
|
|
187
|
+
* @param section - A nullable page section value to render. Supports nested structures.
|
|
188
|
+
* @returns The rendered markdown for the section, or an empty string when nothing renderable exists.
|
|
178
189
|
*/
|
|
179
190
|
private static readonly renderPageSection;
|
|
180
191
|
/**
|
|
181
|
-
* Runtime guard for built-in page content section keys.
|
|
192
|
+
* Runtime type guard for built-in type page content section keys.
|
|
193
|
+
*
|
|
194
|
+
* A value qualifies as a valid content section when it is a string key
|
|
195
|
+
* included in `TYPE_PAGE_SECTION_ORDER` (that is, one of the built-in
|
|
196
|
+
* content sections used when rendering type pages).
|
|
182
197
|
*/
|
|
183
198
|
private static readonly isTypePageContentSection;
|
|
184
199
|
/**
|
|
185
|
-
* Runtime guard for header-only page section keys.
|
|
200
|
+
* Runtime type guard for header-only type page section keys.
|
|
201
|
+
*
|
|
202
|
+
* A value is considered a valid header section when it is a string and
|
|
203
|
+
* matches one of the built-in header keys defined in `TYPE_PAGE_HEADER_ORDER`.
|
|
204
|
+
* Returning `true` narrows `section` to `TypePageHeaderSection`.
|
|
186
205
|
*/
|
|
187
206
|
private static readonly isTypePageHeaderSection;
|
|
188
207
|
/**
|
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;AAiDjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"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"}
|
package/dist/printer.js
CHANGED
|
@@ -58,6 +58,20 @@ const DEFAULT_INIT_OPTIONS = {
|
|
|
58
58
|
groups: undefined,
|
|
59
59
|
sectionHeaderId: true,
|
|
60
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Normalizes the configured hierarchy option into the canonical object form.
|
|
63
|
+
*
|
|
64
|
+
* Supported string presets are:
|
|
65
|
+
* - `"entity"`: entity-centric hierarchy grouping.
|
|
66
|
+
* - `"flat"`: no hierarchy grouping (flat output structure).
|
|
67
|
+
* - `"api"`: API-oriented hierarchy grouping.
|
|
68
|
+
*
|
|
69
|
+
* If `hierarchy` is already an object, it is returned as-is. If it is missing
|
|
70
|
+
* or not one of the supported string presets, `undefined` is returned.
|
|
71
|
+
*
|
|
72
|
+
* @param hierarchy - Hierarchy configuration from print type options.
|
|
73
|
+
* @returns The normalized hierarchy object, or `undefined` when not applicable.
|
|
74
|
+
*/
|
|
61
75
|
const normalizeHierarchy = (hierarchy) => {
|
|
62
76
|
if (!hierarchy) {
|
|
63
77
|
return undefined;
|
|
@@ -457,7 +471,18 @@ class Printer {
|
|
|
457
471
|
return output;
|
|
458
472
|
};
|
|
459
473
|
/**
|
|
460
|
-
* Renders a page section
|
|
474
|
+
* Renders a page section into markdown text.
|
|
475
|
+
*
|
|
476
|
+
* Accepts a nullable section-like value and safely normalizes it into a string.
|
|
477
|
+
* If the section has a valid `title`, a markdown heading is prefixed using the
|
|
478
|
+
* provided `level` (defaulting to 3). If no valid title exists, only content is returned.
|
|
479
|
+
*
|
|
480
|
+
* Content can be a string, a nested section object, or an array of nested entries.
|
|
481
|
+
* Nested content is rendered recursively by calling `renderPageSection` for each child.
|
|
482
|
+
* Invalid, unsupported, or effectively empty inputs return an empty string.
|
|
483
|
+
*
|
|
484
|
+
* @param section - A nullable page section value to render. Supports nested structures.
|
|
485
|
+
* @returns The rendered markdown for the section, or an empty string when nothing renderable exists.
|
|
461
486
|
*/
|
|
462
487
|
static renderPageSection = (section) => {
|
|
463
488
|
if (!section ||
|
|
@@ -506,14 +531,22 @@ class Printer {
|
|
|
506
531
|
return `${title}${content}`;
|
|
507
532
|
};
|
|
508
533
|
/**
|
|
509
|
-
* Runtime guard for built-in page content section keys.
|
|
534
|
+
* Runtime type guard for built-in type page content section keys.
|
|
535
|
+
*
|
|
536
|
+
* A value qualifies as a valid content section when it is a string key
|
|
537
|
+
* included in `TYPE_PAGE_SECTION_ORDER` (that is, one of the built-in
|
|
538
|
+
* content sections used when rendering type pages).
|
|
510
539
|
*/
|
|
511
540
|
static isTypePageContentSection = (section) => {
|
|
512
541
|
return (typeof section === "string" &&
|
|
513
542
|
TYPE_PAGE_SECTION_ORDER.includes(section));
|
|
514
543
|
};
|
|
515
544
|
/**
|
|
516
|
-
* Runtime guard for header-only page section keys.
|
|
545
|
+
* Runtime type guard for header-only type page section keys.
|
|
546
|
+
*
|
|
547
|
+
* A value is considered a valid header section when it is a string and
|
|
548
|
+
* matches one of the built-in header keys defined in `TYPE_PAGE_HEADER_ORDER`.
|
|
549
|
+
* Returning `true` narrows `section` to `TypePageHeaderSection`.
|
|
517
550
|
*/
|
|
518
551
|
static isTypePageHeaderSection = (section) => {
|
|
519
552
|
return (typeof section === "string" &&
|
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;AAEH,eAAO,MAAM,2BAA2B,SAChC,MAAM,KACX,KAAK,CAAC,UAAU,CAOlB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AAEH,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
|
@@ -21,7 +21,6 @@ const options_1 = require("./const/options");
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
24
|
-
// fallow-ignore-next-line unused-export
|
|
25
24
|
const getRootTypeLocaleFromString = (text) => {
|
|
26
25
|
for (const [type, props] of Object.entries(strings_1.ROOT_TYPE_LOCALE)) {
|
|
27
26
|
if (Object.values(props).includes(text)) {
|
|
@@ -46,7 +45,6 @@ exports.getRootTypeLocaleFromString = getRootTypeLocaleFromString;
|
|
|
46
45
|
* ```
|
|
47
46
|
*/
|
|
48
47
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
49
|
-
// fallow-ignore-next-line unused-export
|
|
50
48
|
const printRelationOf = (type, section, getRelation, options) => {
|
|
51
49
|
if (!(0, graphql_1.isNamedType)(type) ||
|
|
52
50
|
(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;
|
|
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;AA8CjC;;;;;;;;GAQG;AAEH,eAAO,MAAM,gBAAgB,GAAI,CAAC,QAC1B,CAAC,WACE,gBAAgB,KACxB,SAAS,GAAG,MA6Cd,CAAC;AAEF;;;;;;;;GAQG;AAEH,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
|
@@ -14,6 +14,22 @@ const link_1 = require("./link");
|
|
|
14
14
|
const directive_1 = require("./directive");
|
|
15
15
|
const strings_1 = require("./const/strings");
|
|
16
16
|
const options_1 = require("./const/options");
|
|
17
|
+
/**
|
|
18
|
+
* Prints a permalink for the section header if enabled in the options.
|
|
19
|
+
*
|
|
20
|
+
* The permalink syntax is formatter specific, see `formatMDXPermalink`.
|
|
21
|
+
*
|
|
22
|
+
* @param id - The ID of the section header
|
|
23
|
+
* @param options - Configuration options for printing
|
|
24
|
+
* @returns Formatted permalink string or undefined if not applicable
|
|
25
|
+
*/
|
|
26
|
+
const printPermalink = (id, options) => {
|
|
27
|
+
if (!options.sectionHeaderId || !id) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const format = options.formatMDXPermalink ?? options_1.DEFAULT_OPTIONS.formatMDXPermalink;
|
|
31
|
+
return format(id);
|
|
32
|
+
};
|
|
17
33
|
/**
|
|
18
34
|
* Prints a single section item with its associated metadata.
|
|
19
35
|
*
|
|
@@ -24,7 +40,6 @@ const options_1 = require("./const/options");
|
|
|
24
40
|
* @template T - Type of the GraphQL element being printed
|
|
25
41
|
*/
|
|
26
42
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
27
|
-
// fallow-ignore-next-line unused-export
|
|
28
43
|
const printSectionItem = (type, options) => {
|
|
29
44
|
const level = "level" in options && typeof options.level === "number" ? options.level : 4;
|
|
30
45
|
if (!(0, link_1.hasPrintableDirective)(type, options)) {
|
|
@@ -38,9 +53,7 @@ const printSectionItem = (type, options) => {
|
|
|
38
53
|
const badges = (0, badge_1.printBadges)(type, options);
|
|
39
54
|
const tags = (0, directive_1.printCustomTags)(type, options);
|
|
40
55
|
const parentTypeLink = (0, link_1.printParentLink)(type, options);
|
|
41
|
-
const permalink =
|
|
42
|
-
? String.raw `\{#${link.id}\}`
|
|
43
|
-
: undefined; // use raw string to prevent MDX from interpreting the curly braces as JSX
|
|
56
|
+
const permalink = printPermalink(link.id, options);
|
|
44
57
|
const metadata = [badges, tags, permalink].filter(Boolean).join(" ");
|
|
45
58
|
const title = `${options_1.SectionLevels.LEVEL.repeat(level)} ${typeNameLink}${parentTypeLink} ${metadata} ${strings_1.MARKDOWN_EOL}`;
|
|
46
59
|
const description = (0, common_1.printDescription)(type, options, "")
|
|
@@ -70,7 +83,6 @@ exports.printSectionItem = printSectionItem;
|
|
|
70
83
|
* @template V - Type of the values being printed
|
|
71
84
|
*/
|
|
72
85
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
73
|
-
// fallow-ignore-next-line unused-export
|
|
74
86
|
const printSectionItems = (values, options) => {
|
|
75
87
|
if (!Array.isArray(values) || values.length === 0) {
|
|
76
88
|
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.
|
|
8
|
+
"version": "1.17.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -58,11 +58,11 @@
|
|
|
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
68
|
"@graphql-markdown/formatters": "",
|
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;
|