docusaurus-plugin-openapi-docs 0.0.0-beta.722 → 0.0.0-beta.727
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 +15 -16
- package/lib/options.js +1 -0
- package/lib/types.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.ts +18 -22
- package/src/options.ts +1 -0
- package/src/types.ts +1 -0
package/lib/index.js
CHANGED
|
@@ -78,7 +78,7 @@ function pluginOpenAPIDocs(context, options) {
|
|
|
78
78
|
let docPath = docData ? (docData.path ? docData.path : "docs") : undefined;
|
|
79
79
|
async function generateApiDocs(options, pluginId) {
|
|
80
80
|
var _a, _b, _c, _d;
|
|
81
|
-
let { specPath, outputDir, template, markdownGenerators, downloadUrl, sidebarOptions, } = options;
|
|
81
|
+
let { specPath, outputDir, template, markdownGenerators, downloadUrl, sidebarOptions, disableCompression, } = options;
|
|
82
82
|
// Remove trailing slash before proceeding
|
|
83
83
|
outputDir = outputDir.replace(/\/$/, "");
|
|
84
84
|
// Override docPath if pluginId provided
|
|
@@ -235,9 +235,11 @@ custom_edit_url: null
|
|
|
235
235
|
// const deserialize = (s: any) => {
|
|
236
236
|
// return zlib.inflateSync(Buffer.from(s, "base64")).toString();
|
|
237
237
|
// };
|
|
238
|
-
|
|
239
|
-
.
|
|
240
|
-
.
|
|
238
|
+
disableCompression === true
|
|
239
|
+
? (item.json = JSON.stringify(item.api))
|
|
240
|
+
: (item.json = zlib_1.default
|
|
241
|
+
.deflateSync(JSON.stringify(item.api))
|
|
242
|
+
.toString("base64"));
|
|
241
243
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
242
244
|
if (docRouteBasePath) {
|
|
243
245
|
infoBasePath = `${docRouteBasePath}/${outputDir
|
|
@@ -333,11 +335,7 @@ custom_edit_url: null
|
|
|
333
335
|
cwd: path_1.default.resolve(apiDir),
|
|
334
336
|
deep: 1,
|
|
335
337
|
});
|
|
336
|
-
const
|
|
337
|
-
cwd: path_1.default.resolve(apiDir, "schemas"),
|
|
338
|
-
deep: 1,
|
|
339
|
-
});
|
|
340
|
-
const sidebarFile = await (0, utils_1.Globby)(["sidebar.js"], {
|
|
338
|
+
const sidebarFile = await (0, utils_1.Globby)(["sidebar.js", "sidebar.ts"], {
|
|
341
339
|
cwd: path_1.default.resolve(apiDir),
|
|
342
340
|
deep: 1,
|
|
343
341
|
});
|
|
@@ -349,14 +347,15 @@ custom_edit_url: null
|
|
|
349
347
|
console.log(chalk_1.default.green(`Cleanup succeeded for "${apiDir}/${mdx}"`));
|
|
350
348
|
}
|
|
351
349
|
}));
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
350
|
+
try {
|
|
351
|
+
fs_1.default.rmSync(`${apiDir}/schemas`, { recursive: true });
|
|
352
|
+
console.log(chalk_1.default.green(`Cleanup succeeded for "${apiDir}/schemas"`));
|
|
353
|
+
}
|
|
354
|
+
catch (err) {
|
|
355
|
+
if (err.code !== "ENOENT") {
|
|
356
|
+
console.error(chalk_1.default.red(`Cleanup failed for "${apiDir}/schemas"`), chalk_1.default.yellow(err));
|
|
358
357
|
}
|
|
359
|
-
}
|
|
358
|
+
}
|
|
360
359
|
sidebarFile.map((sidebar) => fs_1.default.unlink(`${apiDir}/${sidebar}`, (err) => {
|
|
361
360
|
if (err) {
|
|
362
361
|
console.error(chalk_1.default.red(`Cleanup failed for "${apiDir}/${sidebar}"`), chalk_1.default.yellow(err));
|
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-beta.
|
|
4
|
+
"version": "0.0.0-beta.727",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=14"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "3269c28557138d879701d00fe96c054c708155cc"
|
|
66
66
|
}
|
package/src/index.ts
CHANGED
|
@@ -120,6 +120,7 @@ export default function pluginOpenAPIDocs(
|
|
|
120
120
|
markdownGenerators,
|
|
121
121
|
downloadUrl,
|
|
122
122
|
sidebarOptions,
|
|
123
|
+
disableCompression,
|
|
123
124
|
} = options;
|
|
124
125
|
|
|
125
126
|
// Remove trailing slash before proceeding
|
|
@@ -325,9 +326,11 @@ custom_edit_url: null
|
|
|
325
326
|
// const deserialize = (s: any) => {
|
|
326
327
|
// return zlib.inflateSync(Buffer.from(s, "base64")).toString();
|
|
327
328
|
// };
|
|
328
|
-
|
|
329
|
-
.
|
|
330
|
-
.
|
|
329
|
+
disableCompression === true
|
|
330
|
+
? (item.json = JSON.stringify(item.api))
|
|
331
|
+
: (item.json = zlib
|
|
332
|
+
.deflateSync(JSON.stringify(item.api))
|
|
333
|
+
.toString("base64"));
|
|
331
334
|
let infoBasePath = `${outputDir}/${item.infoId}`;
|
|
332
335
|
if (docRouteBasePath) {
|
|
333
336
|
infoBasePath = `${docRouteBasePath}/${outputDir
|
|
@@ -476,11 +479,7 @@ custom_edit_url: null
|
|
|
476
479
|
cwd: path.resolve(apiDir),
|
|
477
480
|
deep: 1,
|
|
478
481
|
});
|
|
479
|
-
const
|
|
480
|
-
cwd: path.resolve(apiDir, "schemas"),
|
|
481
|
-
deep: 1,
|
|
482
|
-
});
|
|
483
|
-
const sidebarFile = await Globby(["sidebar.js"], {
|
|
482
|
+
const sidebarFile = await Globby(["sidebar.js", "sidebar.ts"], {
|
|
484
483
|
cwd: path.resolve(apiDir),
|
|
485
484
|
deep: 1,
|
|
486
485
|
});
|
|
@@ -497,20 +496,17 @@ custom_edit_url: null
|
|
|
497
496
|
})
|
|
498
497
|
);
|
|
499
498
|
|
|
500
|
-
|
|
501
|
-
fs.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
)
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
})
|
|
513
|
-
);
|
|
499
|
+
try {
|
|
500
|
+
fs.rmSync(`${apiDir}/schemas`, { recursive: true });
|
|
501
|
+
console.log(chalk.green(`Cleanup succeeded for "${apiDir}/schemas"`));
|
|
502
|
+
} catch (err: any) {
|
|
503
|
+
if (err.code !== "ENOENT") {
|
|
504
|
+
console.error(
|
|
505
|
+
chalk.red(`Cleanup failed for "${apiDir}/schemas"`),
|
|
506
|
+
chalk.yellow(err)
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
514
510
|
|
|
515
511
|
sidebarFile.map((sidebar) =>
|
|
516
512
|
fs.unlink(`${apiDir}/${sidebar}`, (err) => {
|
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(),
|