@graphql-markdown/docusaurus 1.36.0 → 1.37.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/index.d.ts.map +1 -1
- package/dist/index.js +14 -5
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AA4CzE;;;;;;;;GAQG;AACH,wBAA8B,yBAAyB,CACrD,CAAC,EAAE,WAAW,EACd,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,GAC1D,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,16 @@ const logger_1 = __importDefault(require("@graphql-markdown/logger"));
|
|
|
11
11
|
const NAME = "docusaurus-graphql-doc-generator";
|
|
12
12
|
const LOGGER_MODULE = "@docusaurus/logger";
|
|
13
13
|
const MDX_PACKAGE = "@graphql-markdown/docusaurus/mdx";
|
|
14
|
+
const isCommanderCompatibleCommand = (value) => {
|
|
15
|
+
return (typeof value === "object" &&
|
|
16
|
+
value !== null &&
|
|
17
|
+
typeof value.name === "function");
|
|
18
|
+
};
|
|
19
|
+
const assertCommanderCompatibleCommand = (value) => {
|
|
20
|
+
if (!isCommanderCompatibleCommand(value)) {
|
|
21
|
+
throw new TypeError("GraphQL-Markdown CLI command is not compatible with Docusaurus commander interface.");
|
|
22
|
+
}
|
|
23
|
+
};
|
|
14
24
|
/**
|
|
15
25
|
* Docusaurus plugin wrapper that wires GraphQL-Markdown into the build,
|
|
16
26
|
* optionally running the CLI during `docusaurus build` and registering
|
|
@@ -33,17 +43,16 @@ async function pluginGraphQLDocGenerator(_, options) {
|
|
|
33
43
|
* @returns void
|
|
34
44
|
*/
|
|
35
45
|
extendCli(cli) {
|
|
36
|
-
|
|
37
|
-
// with commander v5's Command. The two are structurally compatible at runtime
|
|
38
|
-
// but TypeScript sees them as different types due to dual-version resolution.
|
|
39
|
-
cli.addCommand((0, cli_1.getGraphQLMarkdownCli)({
|
|
46
|
+
const command = (0, cli_1.getGraphQLMarkdownCli)({
|
|
40
47
|
...options,
|
|
41
48
|
docOptions: {
|
|
42
49
|
generatorFrameworkName: "docusaurus",
|
|
43
50
|
generatorFrameworkVersion: utils_1.DOCUSAURUS_VERSION,
|
|
44
51
|
...options.docOptions,
|
|
45
52
|
},
|
|
46
|
-
}, LOGGER_MODULE, options.formatter ??
|
|
53
|
+
}, LOGGER_MODULE, options.formatter ?? MDX_PACKAGE);
|
|
54
|
+
assertCommanderCompatibleCommand(command);
|
|
55
|
+
cli.addCommand(command);
|
|
47
56
|
},
|
|
48
57
|
};
|
|
49
58
|
}
|