@kubb/plugin-redoc 4.28.1 → 4.29.1
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/{chunk-jHaXqnEa.js → chunk-DKWOrOAv.js} +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +12 -12
- package/dist/index.d.cts +0 -27
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __name = (target, value) => __defProp(target, "name", {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["__filename","__dirname","path","pkg","fs","pluginOasName","path"],"sources":["../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\ntype BuildDocsOptions = {\n title?: string\n disableGoogleFont?: boolean\n templateOptions?: any\n}\n\nexport async function getPageHTML(api: OasTypes.OASDocument, { title, disableGoogleFont, templateOptions }: BuildDocsOptions = {}) {\n const templateFileName = path.join(__dirname, '../static/redoc.hbs')\n const template = pkg.compile(fs.readFileSync(templateFileName).toString())\n return template({\n title: title || api.info.title || 'ReDoc documentation',\n redocHTML: `\n <script src=\"https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js\"> </script>\n <div id=\"redoc-container\"></div>\n <script>\n const data = ${JSON.stringify(api, null, 2)};\n Redoc.init(data, {\n \"expandResponses\": \"200,400\"\n }, document.getElementById('redoc-container'))\n </script>\n `,\n disableGoogleFont,\n templateOptions,\n })\n}\n","import path from 'node:path'\nimport { definePlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = definePlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n options: {\n output,\n name: trimExtName(output.path),\n },\n pre: [pluginOasName],\n async install() {\n const oas = await this.getOas()\n await oas.dereference().catch((err: unknown) => {\n // Some specs have invalid internal $ref pointers (e.g. `#/definitions/...` in OpenAPI 3.x docs)\n // that cause dereference to fail. Continue with the un-dereferenced spec.\n void err\n })\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(oas.api)\n\n await this.addFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n {\n name: 'docs.html',\n value: pageHTML,\n },\n ],\n imports: [],\n exports: [],\n })\n },\n }\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__filename","__dirname","path","pkg","fs","pluginOasName","path"],"sources":["../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\ntype BuildDocsOptions = {\n title?: string\n disableGoogleFont?: boolean\n templateOptions?: any\n}\n\nexport async function getPageHTML(api: OasTypes.OASDocument, { title, disableGoogleFont, templateOptions }: BuildDocsOptions = {}) {\n const templateFileName = path.join(__dirname, '../static/redoc.hbs')\n const template = pkg.compile(fs.readFileSync(templateFileName).toString())\n return template({\n title: title || api.info.title || 'ReDoc documentation',\n redocHTML: `\n <script src=\"https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js\"> </script>\n <div id=\"redoc-container\"></div>\n <script>\n const data = ${JSON.stringify(api, null, 2)};\n Redoc.init(data, {\n \"expandResponses\": \"200,400\"\n }, document.getElementById('redoc-container'))\n </script>\n `,\n disableGoogleFont,\n templateOptions,\n })\n}\n","import path from 'node:path'\nimport { definePlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = definePlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n options: {\n output,\n name: trimExtName(output.path),\n },\n pre: [pluginOasName],\n async install() {\n const oas = await this.getOas()\n await oas.dereference().catch((err: unknown) => {\n // Some specs have invalid internal $ref pointers (e.g. `#/definitions/...` in OpenAPI 3.x docs)\n // that cause dereference to fail. Continue with the un-dereferenced spec.\n void err\n })\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(oas.api)\n\n await this.addFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n {\n name: 'docs.html',\n value: pageHTML,\n },\n ],\n imports: [],\n exports: [],\n })\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,yFAA2C;AACjD,MAAMC,cAAYC,kBAAK,QAAQF,aAAW;AAQ1C,eAAsB,YAAY,KAA2B,EAAE,OAAO,mBAAmB,oBAAsC,EAAE,EAAE;CACjI,MAAM,mBAAmBE,kBAAK,KAAKD,aAAW,sBAAsB;AAEpE,QADiBE,mBAAI,QAAQC,gBAAG,aAAa,iBAAiB,CAAC,UAAU,CAAC,CAC1D;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;;AC1BJ,SAAS,YAAY,MAAsB;AACzC,QAAO,KAAK,QAAQ,aAAa,GAAG;;AAGtC,MAAa,kBAAkB;AAE/B,MAAa,4CAAyC,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;GAC/B;EACD,KAAK,CAACC,+BAAc;EACpB,MAAM,UAAU;GACd,MAAM,MAAM,MAAM,KAAK,QAAQ;AAC/B,SAAM,IAAI,aAAa,CAAC,OAAO,QAAiB,GAI9C;GAEF,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,WAAW,MAAM,YAAY,IAAI,IAAI;AAE3C,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,kBAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc;IACtD,SAAS,CACP;KACE,MAAM;KACN,OAAO;KACR,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;;EAEL;EACD"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-redoc",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.1",
|
|
4
4
|
"description": "Redoc documentation generator plugin for Kubb, creating beautiful, interactive API documentation from OpenAPI specifications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"redoc",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/kubb-labs/kubb.git",
|
|
20
|
+
"url": "git+https://github.com/kubb-labs/kubb.git",
|
|
21
21
|
"directory": "packages/plugin-redoc"
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
@@ -26,14 +26,12 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
35
|
-
"module": "./dist/index.js",
|
|
36
|
-
"types": "./dist/index.d.cts",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
37
35
|
"typesVersions": {
|
|
38
36
|
"*": {}
|
|
39
37
|
},
|
|
@@ -52,14 +50,14 @@
|
|
|
52
50
|
}
|
|
53
51
|
],
|
|
54
52
|
"dependencies": {
|
|
55
|
-
"@kubb/react-fabric": "0.
|
|
53
|
+
"@kubb/react-fabric": "0.13.1",
|
|
56
54
|
"handlebars": "^4.7.8",
|
|
57
|
-
"@kubb/core": "4.
|
|
58
|
-
"@kubb/oas": "4.
|
|
59
|
-
"@kubb/plugin-oas": "4.
|
|
55
|
+
"@kubb/core": "4.29.1",
|
|
56
|
+
"@kubb/oas": "4.29.1",
|
|
57
|
+
"@kubb/plugin-oas": "4.29.1"
|
|
60
58
|
},
|
|
61
59
|
"peerDependencies": {
|
|
62
|
-
"@kubb/react-fabric": "0.
|
|
60
|
+
"@kubb/react-fabric": "0.13.0"
|
|
63
61
|
},
|
|
64
62
|
"engines": {
|
|
65
63
|
"node": ">=20"
|
|
@@ -68,6 +66,8 @@
|
|
|
68
66
|
"access": "public",
|
|
69
67
|
"registry": "https://registry.npmjs.org/"
|
|
70
68
|
},
|
|
69
|
+
"main": "./dist/index.cjs",
|
|
70
|
+
"module": "./dist/index.js",
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsdown && size-limit",
|
|
73
73
|
"clean": "npx rimraf ./dist",
|
package/dist/index.d.cts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as _kubb_core0 from "@kubb/core";
|
|
2
|
-
import { Output, PluginFactoryOptions } from "@kubb/core";
|
|
3
|
-
import { Oas } from "@kubb/oas";
|
|
4
|
-
|
|
5
|
-
//#region rolldown:runtime
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/types.d.ts
|
|
8
|
-
type Options = {
|
|
9
|
-
output?: {
|
|
10
|
-
/**
|
|
11
|
-
* Output for the generated doc, [https://redocly.com/](https://redocly.com/) is being used for the generation
|
|
12
|
-
* @default 'docs.html'
|
|
13
|
-
*/
|
|
14
|
-
path: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
type ResolveOptions = {
|
|
18
|
-
output: Output<Oas>;
|
|
19
|
-
};
|
|
20
|
-
type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions, never>;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/plugin.d.ts
|
|
23
|
-
declare const pluginRedocName = "plugin-redoc";
|
|
24
|
-
declare const pluginRedoc: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginRedoc>;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { type PluginRedoc, pluginRedoc, pluginRedocName };
|
|
27
|
-
//# sourceMappingURL=index.d.cts.map
|