docusaurus-plugin-openapi-docs 0.0.0-718 → 0.0.0-720
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/lib/index.js +7 -5
- package/lib/options.js +1 -0
- package/lib/types.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.ts +7 -4
- package/src/options.ts +1 -0
- package/src/types.ts +1 -0
package/lib/index.js
CHANGED
|
@@ -77,7 +77,7 @@ function pluginOpenAPIDocs(context, options) {
|
|
|
77
77
|
let docPath = docData ? (docData.path ? docData.path : "docs") : undefined;
|
|
78
78
|
async function generateApiDocs(options, pluginId) {
|
|
79
79
|
var _a, _b, _c, _d;
|
|
80
|
-
let { specPath, outputDir, template, markdownGenerators, downloadUrl, sidebarOptions, } = options;
|
|
80
|
+
let { specPath, outputDir, template, markdownGenerators, downloadUrl, sidebarOptions, disableCompression, } = options;
|
|
81
81
|
// Remove trailing slash before proceeding
|
|
82
82
|
outputDir = outputDir.replace(/\/$/, "");
|
|
83
83
|
// Override docPath if pluginId provided
|
|
@@ -232,9 +232,11 @@ custom_edit_url: null
|
|
|
232
232
|
// const deserialize = (s: any) => {
|
|
233
233
|
// return zlib.inflateSync(Buffer.from(s, "base64")).toString();
|
|
234
234
|
// };
|
|
235
|
-
|
|
236
|
-
.
|
|
237
|
-
.
|
|
235
|
+
disableCompression === true
|
|
236
|
+
? (item.json = JSON.stringify(item.api))
|
|
237
|
+
: (item.json = zlib_1.default
|
|
238
|
+
.deflateSync(JSON.stringify(item.api))
|
|
239
|
+
.toString("base64"));
|
|
238
240
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
239
241
|
if (docRouteBasePath) {
|
|
240
242
|
infoBasePath = `${docRouteBasePath}/${outputDir
|
|
@@ -334,7 +336,7 @@ custom_edit_url: null
|
|
|
334
336
|
cwd: path_1.default.resolve(apiDir, "schemas"),
|
|
335
337
|
deep: 1,
|
|
336
338
|
});
|
|
337
|
-
const sidebarFile = await (0, utils_1.Globby)(["sidebar.js"], {
|
|
339
|
+
const sidebarFile = await (0, utils_1.Globby)(["sidebar.{js,ts}"], {
|
|
338
340
|
cwd: path_1.default.resolve(apiDir),
|
|
339
341
|
deep: 1,
|
|
340
342
|
});
|
package/lib/options.js
CHANGED
|
@@ -36,6 +36,7 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
36
36
|
sidebarOptions: sidebarOptions,
|
|
37
37
|
markdownGenerators: markdownGenerators,
|
|
38
38
|
showSchemas: utils_validation_1.Joi.boolean(),
|
|
39
|
+
disableCompression: utils_validation_1.Joi.boolean(),
|
|
39
40
|
version: utils_validation_1.Joi.string().when("versions", {
|
|
40
41
|
is: utils_validation_1.Joi.exist(),
|
|
41
42
|
then: utils_validation_1.Joi.required(),
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-720",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "1d416d461bde0425166d15b21f200b1aeb7f71b5"
|
|
64
64
|
}
|
package/src/index.ts
CHANGED
|
@@ -119,6 +119,7 @@ export default function pluginOpenAPIDocs(
|
|
|
119
119
|
markdownGenerators,
|
|
120
120
|
downloadUrl,
|
|
121
121
|
sidebarOptions,
|
|
122
|
+
disableCompression,
|
|
122
123
|
} = options;
|
|
123
124
|
|
|
124
125
|
// Remove trailing slash before proceeding
|
|
@@ -319,9 +320,11 @@ custom_edit_url: null
|
|
|
319
320
|
// const deserialize = (s: any) => {
|
|
320
321
|
// return zlib.inflateSync(Buffer.from(s, "base64")).toString();
|
|
321
322
|
// };
|
|
322
|
-
|
|
323
|
-
.
|
|
324
|
-
.
|
|
323
|
+
disableCompression === true
|
|
324
|
+
? (item.json = JSON.stringify(item.api))
|
|
325
|
+
: (item.json = zlib
|
|
326
|
+
.deflateSync(JSON.stringify(item.api))
|
|
327
|
+
.toString("base64"));
|
|
325
328
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
326
329
|
if (docRouteBasePath) {
|
|
327
330
|
infoBasePath = `${docRouteBasePath}/${outputDir
|
|
@@ -474,7 +477,7 @@ custom_edit_url: null
|
|
|
474
477
|
cwd: path.resolve(apiDir, "schemas"),
|
|
475
478
|
deep: 1,
|
|
476
479
|
});
|
|
477
|
-
const sidebarFile = await Globby(["sidebar.js"], {
|
|
480
|
+
const sidebarFile = await Globby(["sidebar.{js,ts}"], {
|
|
478
481
|
cwd: path.resolve(apiDir),
|
|
479
482
|
deep: 1,
|
|
480
483
|
});
|
package/src/options.ts
CHANGED
|
@@ -39,6 +39,7 @@ export const OptionsSchema = Joi.object({
|
|
|
39
39
|
sidebarOptions: sidebarOptions,
|
|
40
40
|
markdownGenerators: markdownGenerators,
|
|
41
41
|
showSchemas: Joi.boolean(),
|
|
42
|
+
disableCompression: Joi.boolean(),
|
|
42
43
|
version: Joi.string().when("versions", {
|
|
43
44
|
is: Joi.exist(),
|
|
44
45
|
then: Joi.required(),
|