@graphql-markdown/core 1.12.0 → 1.12.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/config.d.ts +3 -0
- package/dist/config.js +3 -5
- package/dist/diff.js +17 -7
- package/dist/generator.js +38 -4
- package/dist/graphql-config.js +17 -7
- package/dist/printer.js +17 -7
- package/package.json +8 -8
package/dist/config.d.ts
CHANGED
|
@@ -16,6 +16,9 @@ export declare enum DeprecatedOption {
|
|
|
16
16
|
export declare const DOCS_URL: "https://graphql-markdown.dev/docs";
|
|
17
17
|
export declare const PACKAGE_NAME: "@graphql-markdown/docusaurus";
|
|
18
18
|
export declare const ASSET_HOMEPAGE_LOCATION: string;
|
|
19
|
+
export declare const DEFAULT_HIERARCHY: {
|
|
20
|
+
api: {};
|
|
21
|
+
};
|
|
19
22
|
export declare const DEFAULT_OPTIONS: Readonly<Pick<ConfigOptions, "customDirective" | "groupByDirective" | "loaders"> & Required<Omit<ConfigOptions, "customDirective" | "groupByDirective" | "loaders" | "printTypeOptions">>> & {
|
|
20
23
|
printTypeOptions: Required<Omit<ConfigPrintTypeOptions, "hierarchy">> & {
|
|
21
24
|
hierarchy: Required<Pick<TypeHierarchyObjectType, TypeHierarchy.API>>;
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildConfig = exports.parseGroupByOption = exports.getPrintTypeOptions = exports.parseDeprecatedPrintTypeOptions = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = exports.getCustomDirectives = exports.getVisibilityDirectives = exports.getSkipDocDirectives = exports.getOnlyDocDirectives = exports.getDocDirective = exports.DEFAULT_OPTIONS = exports.ASSET_HOMEPAGE_LOCATION = exports.PACKAGE_NAME = exports.DOCS_URL = exports.DeprecatedOption = exports.DiffMethod = exports.TypeHierarchy = void 0;
|
|
3
|
+
exports.buildConfig = exports.parseGroupByOption = exports.getPrintTypeOptions = exports.parseDeprecatedPrintTypeOptions = exports.getTypeHierarchyOption = exports.getDocOptions = exports.parseDeprecatedDocOptions = exports.getDiffMethod = exports.getCustomDirectives = exports.getVisibilityDirectives = exports.getSkipDocDirectives = exports.getOnlyDocDirectives = exports.getDocDirective = exports.DEFAULT_OPTIONS = exports.DEFAULT_HIERARCHY = exports.ASSET_HOMEPAGE_LOCATION = exports.PACKAGE_NAME = exports.DOCS_URL = exports.DeprecatedOption = exports.DiffMethod = exports.TypeHierarchy = void 0;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
const node_os_1 = require("node:os");
|
|
6
6
|
const graphql_config_1 = require("./graphql-config");
|
|
@@ -25,6 +25,7 @@ var DeprecatedOption;
|
|
|
25
25
|
exports.DOCS_URL = "https://graphql-markdown.dev/docs";
|
|
26
26
|
exports.PACKAGE_NAME = "@graphql-markdown/docusaurus";
|
|
27
27
|
exports.ASSET_HOMEPAGE_LOCATION = (0, node_path_1.join)(__dirname, "..", "assets", "generated.md");
|
|
28
|
+
exports.DEFAULT_HIERARCHY = { [TypeHierarchy.API]: {} };
|
|
28
29
|
exports.DEFAULT_OPTIONS = {
|
|
29
30
|
id: "default",
|
|
30
31
|
baseURL: "schema",
|
|
@@ -49,7 +50,6 @@ exports.DEFAULT_OPTIONS = {
|
|
|
49
50
|
parentTypePrefix: true,
|
|
50
51
|
relatedTypeSection: true,
|
|
51
52
|
typeBadges: true,
|
|
52
|
-
hierarchy: { [TypeHierarchy.API]: {} },
|
|
53
53
|
},
|
|
54
54
|
rootPath: "./docs",
|
|
55
55
|
schema: "./schema.graphql",
|
|
@@ -189,9 +189,7 @@ const getTypeHierarchyOption = (cliOption, configOption) => {
|
|
|
189
189
|
throw new Error(`Hierarchy option mismatch in CLI flag '${strCliHierarchy}' and config '${strConfigHierarchy}'`);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
return
|
|
193
|
-
configHierarchy ??
|
|
194
|
-
exports.DEFAULT_OPTIONS.printTypeOptions.hierarchy);
|
|
192
|
+
return cliHierarchy ?? configHierarchy ?? exports.DEFAULT_HIERARCHY;
|
|
195
193
|
};
|
|
196
194
|
exports.getTypeHierarchyOption = getTypeHierarchyOption;
|
|
197
195
|
const parseDeprecatedPrintTypeOptions = (cliOpts, configOptions) => {
|
package/dist/diff.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.hasChanges = void 0;
|
|
27
37
|
const logger_1 = require("@graphql-markdown/logger");
|
package/dist/generator.js
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.generateDocFromSchema = void 0;
|
|
4
|
-
const logger_1 = require("@graphql-markdown/logger");
|
|
37
|
+
const logger_1 = __importStar(require("@graphql-markdown/logger"));
|
|
5
38
|
const graphql_1 = require("@graphql-markdown/graphql");
|
|
39
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
6
40
|
const config_1 = require("./config");
|
|
7
41
|
const diff_1 = require("./diff");
|
|
8
42
|
const printer_1 = require("./printer");
|
|
@@ -11,7 +45,7 @@ const NS_PER_SEC = 1e9;
|
|
|
11
45
|
const SEC_DECIMALS = 3;
|
|
12
46
|
const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, loggerModule, metatags, onlyDocDirective, outputDir, prettify, printer: printerModule, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, }) => {
|
|
13
47
|
const start = process.hrtime.bigint();
|
|
14
|
-
(0, logger_1.
|
|
48
|
+
await (0, logger_1.default)(loggerModule);
|
|
15
49
|
const loaders = await (0, graphql_1.getDocumentLoaders)(loadersList);
|
|
16
50
|
if (!loaders) {
|
|
17
51
|
(0, logger_1.log)(`An error occurred while loading GraphQL loader.\nCheck your dependencies and configuration.`, "error");
|
|
@@ -21,7 +55,7 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
|
|
|
21
55
|
if (diffMethod !== config_1.DiffMethod.NONE) {
|
|
22
56
|
const changed = await (0, diff_1.hasChanges)(schema, tmpDir, diffMethod);
|
|
23
57
|
if (!changed) {
|
|
24
|
-
(0, logger_1.log)(`No changes detected in schema "${
|
|
58
|
+
(0, logger_1.log)(`No changes detected in schema "${(0, utils_1.toString)(schemaLocation)}".`);
|
|
25
59
|
}
|
|
26
60
|
}
|
|
27
61
|
const [onlyDocDirectives, skipDocDirectives] = [
|
|
@@ -70,6 +104,6 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
|
|
|
70
104
|
await renderer.renderHomepage(homepageLocation);
|
|
71
105
|
const duration = (Number(process.hrtime.bigint() - start) / NS_PER_SEC).toFixed(SEC_DECIMALS);
|
|
72
106
|
(0, logger_1.log)(`Documentation successfully generated in "${outputDir}" with base URL "${baseURL}".`, "success");
|
|
73
|
-
(0, logger_1.log)(`${pages.flat().length} pages generated in ${duration}s from schema "${
|
|
107
|
+
(0, logger_1.log)(`${pages.flat().length} pages generated in ${duration}s from schema "${(0, utils_1.toString)(schemaLocation)}".`);
|
|
74
108
|
};
|
|
75
109
|
exports.generateDocFromSchema = generateDocFromSchema;
|
package/dist/graphql-config.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.loadConfiguration = exports.setLoaderOptions = exports.graphQLConfigExtension = exports.EXTENSION_NAME = void 0;
|
|
27
37
|
const logger_1 = require("@graphql-markdown/logger");
|
package/dist/printer.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.getPrinter = void 0;
|
|
27
37
|
const getPrinter = async (printerModule, config, options) => {
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/graphql-markdown/graphql-markdown/issues"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.12.
|
|
8
|
+
"version": "1.12.2",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
"docs": "typedoc"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@graphql-markdown/graphql": "^1.1.
|
|
67
|
-
"@graphql-markdown/logger": "^1.0.
|
|
68
|
-
"@graphql-markdown/utils": "^1.7.
|
|
66
|
+
"@graphql-markdown/graphql": "^1.1.5",
|
|
67
|
+
"@graphql-markdown/logger": "^1.0.5",
|
|
68
|
+
"@graphql-markdown/utils": "^1.7.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@graphql-markdown/diff": "^1.1.
|
|
72
|
-
"@graphql-markdown/helpers": "^1.0.
|
|
73
|
-
"@graphql-markdown/printer-legacy": "^1.9.
|
|
71
|
+
"@graphql-markdown/diff": "^1.1.9",
|
|
72
|
+
"@graphql-markdown/helpers": "^1.0.8",
|
|
73
|
+
"@graphql-markdown/printer-legacy": "^1.9.1",
|
|
74
74
|
"graphql-config": "^5.1.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@graphql-markdown/types": "^1.4.
|
|
77
|
+
"@graphql-markdown/types": "^1.4.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"@graphql-markdown/printer-legacy": {
|