@kubb/plugin-redoc 5.0.0-alpha.9 → 5.0.0-beta.3
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/LICENSE +17 -10
- package/README.md +1 -3
- package/dist/index.cjs +49 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -8
- package/dist/index.js +44 -24
- package/dist/index.js.map +1 -1
- package/package.json +40 -43
- package/src/index.ts +1 -1
- package/src/plugin.ts +50 -31
- package/src/redoc.tsx +2 -2
- package/src/types.ts +17 -5
- package/static/redoc.hbs +17 -18
package/LICENSE
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2026 Kubb Labs
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
— see licenses/LICENSE-AGPL-3.0 for the full license text:
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
5
|
</a>
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
[![npm version][npm-version-src]][npm-version-href]
|
|
9
8
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
10
9
|
[![Coverage][coverage-src]][coverage-href]
|
|
11
10
|
[![License][license-src]][license-href]
|
|
12
11
|
[![Sponsors][sponsors-src]][sponsors-href]
|
|
12
|
+
|
|
13
13
|
<h4>
|
|
14
14
|
<a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
|
|
15
15
|
<span> · </span>
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
Create beautiful docs with Redoc.
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
## Supporting Kubb
|
|
28
27
|
|
|
29
28
|
Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
@@ -36,7 +35,6 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
|
|
|
36
35
|
</a>
|
|
37
36
|
</p>
|
|
38
37
|
|
|
39
|
-
|
|
40
38
|
<!-- Badges -->
|
|
41
39
|
|
|
42
40
|
[npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-redoc?flat&colorA=18181B&colorB=f58517
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
//#region \0rolldown/runtime.js
|
|
3
6
|
var __create = Object.create;
|
|
4
7
|
var __defProp = Object.defineProperty;
|
|
@@ -22,14 +25,35 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
25
|
}) : target, mod));
|
|
23
26
|
//#endregion
|
|
24
27
|
let node_path = require("node:path");
|
|
28
|
+
let node_path$1 = __toESM(node_path, 1);
|
|
25
29
|
node_path = __toESM(node_path);
|
|
30
|
+
let _kubb_adapter_oas = require("@kubb/adapter-oas");
|
|
26
31
|
let _kubb_core = require("@kubb/core");
|
|
27
|
-
let _kubb_plugin_oas = require("@kubb/plugin-oas");
|
|
28
32
|
let node_fs = require("node:fs");
|
|
29
33
|
node_fs = __toESM(node_fs);
|
|
30
34
|
let node_url = require("node:url");
|
|
31
35
|
let handlebars = require("handlebars");
|
|
32
36
|
handlebars = __toESM(handlebars);
|
|
37
|
+
//#region ../../internals/utils/src/string.ts
|
|
38
|
+
/**
|
|
39
|
+
* Strips the file extension from a path or file name.
|
|
40
|
+
* Only removes the last `.ext` segment when the dot is not part of a directory name.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* trimExtName('petStore.ts') // 'petStore'
|
|
44
|
+
* trimExtName('/src/models/pet.ts') // '/src/models/pet'
|
|
45
|
+
* trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'
|
|
46
|
+
* trimExtName('noExtension') // 'noExtension'
|
|
47
|
+
*/
|
|
48
|
+
function trimExtName(text) {
|
|
49
|
+
const dotIndex = text.lastIndexOf(".");
|
|
50
|
+
if (dotIndex > 0 && !text.includes("/", dotIndex)) return text.slice(0, dotIndex);
|
|
51
|
+
return text;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region package.json
|
|
55
|
+
var version = "5.0.0-beta.3";
|
|
56
|
+
//#endregion
|
|
33
57
|
//#region src/redoc.tsx
|
|
34
58
|
const __filename$1 = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
|
|
35
59
|
const __dirname$1 = node_path.default.dirname(__filename$1);
|
|
@@ -53,38 +77,39 @@ async function getPageHTML(api, { title, disableGoogleFont, templateOptions } =
|
|
|
53
77
|
}
|
|
54
78
|
//#endregion
|
|
55
79
|
//#region src/plugin.ts
|
|
56
|
-
function trimExtName(text) {
|
|
57
|
-
return text.replace(/\.[^/.]+$/, "");
|
|
58
|
-
}
|
|
59
80
|
const pluginRedocName = "plugin-redoc";
|
|
60
|
-
const pluginRedoc = (0, _kubb_core.
|
|
81
|
+
const pluginRedoc = (0, _kubb_core.definePlugin)((options) => {
|
|
61
82
|
const { output = { path: "docs.html" } } = options;
|
|
62
83
|
return {
|
|
63
84
|
name: pluginRedocName,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
85
|
+
version,
|
|
86
|
+
options,
|
|
87
|
+
hooks: { async "kubb:plugin:setup"(ctx) {
|
|
88
|
+
ctx.setOptions({
|
|
89
|
+
output,
|
|
90
|
+
name: trimExtName(output.path),
|
|
91
|
+
exclude: [],
|
|
92
|
+
override: []
|
|
93
|
+
});
|
|
94
|
+
const adapter = ctx.config.adapter;
|
|
95
|
+
if (adapter?.name !== _kubb_adapter_oas.adapterOasName) throw new Error(`[${pluginRedocName}] plugin-redoc requires the OpenAPI adapter. Make sure you are using adapterOas (e.g. \`adapter: adapterOas()\`) in your Kubb config.`);
|
|
96
|
+
const document = adapter.document;
|
|
97
|
+
if (!document) throw new Error(`[${pluginRedocName}] No OpenAPI document found. The adapterOas did not produce a document — ensure the adapter has run before this plugin.`);
|
|
98
|
+
const root = node_path$1.default.resolve(ctx.config.root, ctx.config.output.path);
|
|
99
|
+
const pageHTML = await getPageHTML(document);
|
|
100
|
+
ctx.injectFile({
|
|
75
101
|
baseName: "docs.html",
|
|
76
|
-
path: node_path.default.resolve(root, output.path || "./docs.html"),
|
|
77
|
-
sources: [{
|
|
102
|
+
path: node_path$1.default.resolve(root, output.path || "./docs.html"),
|
|
103
|
+
sources: [_kubb_core.ast.createSource({
|
|
78
104
|
name: "docs.html",
|
|
79
|
-
|
|
80
|
-
}]
|
|
81
|
-
imports: [],
|
|
82
|
-
exports: []
|
|
105
|
+
nodes: [_kubb_core.ast.createText(pageHTML)]
|
|
106
|
+
})]
|
|
83
107
|
});
|
|
84
|
-
}
|
|
108
|
+
} }
|
|
85
109
|
};
|
|
86
110
|
});
|
|
87
111
|
//#endregion
|
|
112
|
+
exports.default = pluginRedoc;
|
|
88
113
|
exports.pluginRedoc = pluginRedoc;
|
|
89
114
|
exports.pluginRedocName = pluginRedocName;
|
|
90
115
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["__filename","__dirname","path","pkg","fs","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__filename","__dirname","path","pkg","fs","adapterOasName","path","ast"],"sources":["../../../internals/utils/src/string.ts","../package.json","../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","","import fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { AdapterOas } from '@kubb/adapter-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: AdapterOas['document'], { 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 { trimExtName } from '@internals/utils'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { adapterOasName } from '@kubb/adapter-oas'\n\nimport { type Adapter, ast, definePlugin } from '@kubb/core'\nimport { version } from '../package.json'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\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 version,\n options,\n hooks: {\n async 'kubb:plugin:setup'(ctx) {\n ctx.setOptions({\n output,\n name: trimExtName(output.path),\n exclude: [],\n override: [],\n })\n\n const adapter = ctx.config.adapter\n\n if (adapter?.name !== adapterOasName) {\n throw new Error(\n `[${pluginRedocName}] plugin-redoc requires the OpenAPI adapter. Make sure you are using adapterOas (e.g. \\`adapter: adapterOas()\\`) in your Kubb config.`,\n )\n }\n\n const document = (adapter as Adapter<AdapterOas>).document\n\n if (!document) {\n throw new Error(\n `[${pluginRedocName}] No OpenAPI document found. The adapterOas did not produce a document — ensure the adapter has run before this plugin.`,\n )\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const pageHTML = await getPageHTML(document)\n\n ctx.injectFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n ast.createSource({\n name: 'docs.html',\n nodes: [ast.createText(pageHTML)],\n }),\n ],\n })\n },\n },\n }\n})\n\nexport default pluginRedoc\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,YAAY,MAAsB;CAChD,MAAM,WAAW,KAAK,YAAY,IAAI;AACtC,KAAI,WAAW,KAAK,CAAC,KAAK,SAAS,KAAK,SAAS,CAC/C,QAAO,KAAK,MAAM,GAAG,SAAS;AAEhC,QAAO;;;;;;;AE5DT,MAAMA,gBAAAA,GAAAA,SAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAA2C;AACjD,MAAMC,cAAYC,UAAAA,QAAK,QAAQF,aAAW;AAQ1C,eAAsB,YAAY,KAA6B,EAAE,OAAO,mBAAmB,oBAAsC,EAAE,EAAE;CACnI,MAAM,mBAAmBE,UAAAA,QAAK,KAAKD,aAAW,sBAAsB;AAEpE,QADiBE,WAAAA,QAAI,QAAQC,QAAAA,QAAG,aAAa,iBAAiB,CAAC,UAAU,CAC1D,CAAC;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;ACtBJ,MAAa,kBAAkB;AAE/B,MAAa,eAAA,GAAA,WAAA,eAAyC,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN;EACA;EACA,OAAO,EACL,MAAM,oBAAoB,KAAK;AAC7B,OAAI,WAAW;IACb;IACA,MAAM,YAAY,OAAO,KAAK;IAC9B,SAAS,EAAE;IACX,UAAU,EAAE;IACb,CAAC;GAEF,MAAM,UAAU,IAAI,OAAO;AAE3B,OAAI,SAAS,SAASC,kBAAAA,eACpB,OAAM,IAAI,MACR,IAAI,gBAAgB,uIACrB;GAGH,MAAM,WAAY,QAAgC;AAElD,OAAI,CAAC,SACH,OAAM,IAAI,MACR,IAAI,gBAAgB,yHACrB;GAGH,MAAM,OAAOC,YAAAA,QAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,KAAK;GAClE,MAAM,WAAW,MAAM,YAAY,SAAS;AAE5C,OAAI,WAAW;IACb,UAAU;IACV,MAAMA,YAAAA,QAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc;IACtD,SAAS,CACPC,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAW,SAAS,CAAC;KAClC,CAAC,CACH;IACF,CAAC;KAEL;EACF;EACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import * as _kubb_core0 from "@kubb/core";
|
|
3
|
-
import { Output, PluginFactoryOptions } from "@kubb/core";
|
|
4
|
-
import { Oas } from "@kubb/oas";
|
|
2
|
+
import * as _$_kubb_core0 from "@kubb/core";
|
|
3
|
+
import { Exclude, Include, Output, Override, PluginFactoryOptions } from "@kubb/core";
|
|
5
4
|
|
|
6
5
|
//#region src/types.d.ts
|
|
7
6
|
type Options = {
|
|
8
7
|
output?: {
|
|
9
8
|
/**
|
|
10
|
-
* Output for the generated
|
|
9
|
+
* Output path for the generated HTML documentation.
|
|
10
|
+
*
|
|
11
11
|
* @default 'docs.html'
|
|
12
12
|
*/
|
|
13
13
|
path: string;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
type ResolveOptions = {
|
|
17
|
-
output: Output<
|
|
17
|
+
output: Output<never>;
|
|
18
|
+
name: string;
|
|
19
|
+
exclude: Array<Exclude>;
|
|
20
|
+
include?: Array<Include>;
|
|
21
|
+
override: Array<Override<ResolveOptions>>;
|
|
18
22
|
};
|
|
19
|
-
type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions
|
|
23
|
+
type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions>;
|
|
24
|
+
declare global {
|
|
25
|
+
namespace Kubb {
|
|
26
|
+
interface PluginRegistry {
|
|
27
|
+
'plugin-redoc': PluginRedoc;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
20
31
|
//#endregion
|
|
21
32
|
//#region src/plugin.d.ts
|
|
22
33
|
declare const pluginRedocName = "plugin-redoc";
|
|
23
|
-
declare const pluginRedoc: (options?: Options | undefined) => _kubb_core0.
|
|
34
|
+
declare const pluginRedoc: (options?: Options | undefined) => _$_kubb_core0.Plugin<PluginRedoc>;
|
|
24
35
|
//#endregion
|
|
25
|
-
export { type PluginRedoc, pluginRedoc, pluginRedocName };
|
|
36
|
+
export { type PluginRedoc, pluginRedoc as default, pluginRedoc, pluginRedocName };
|
|
26
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { adapterOasName } from "@kubb/adapter-oas";
|
|
4
|
+
import { ast, definePlugin } from "@kubb/core";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import pkg from "handlebars";
|
|
8
|
+
//#region ../../internals/utils/src/string.ts
|
|
9
|
+
/**
|
|
10
|
+
* Strips the file extension from a path or file name.
|
|
11
|
+
* Only removes the last `.ext` segment when the dot is not part of a directory name.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* trimExtName('petStore.ts') // 'petStore'
|
|
15
|
+
* trimExtName('/src/models/pet.ts') // '/src/models/pet'
|
|
16
|
+
* trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'
|
|
17
|
+
* trimExtName('noExtension') // 'noExtension'
|
|
18
|
+
*/
|
|
19
|
+
function trimExtName(text) {
|
|
20
|
+
const dotIndex = text.lastIndexOf(".");
|
|
21
|
+
if (dotIndex > 0 && !text.includes("/", dotIndex)) return text.slice(0, dotIndex);
|
|
22
|
+
return text;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region package.json
|
|
26
|
+
var version = "5.0.0-beta.3";
|
|
27
|
+
//#endregion
|
|
8
28
|
//#region src/redoc.tsx
|
|
9
29
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
30
|
const __dirname = path.dirname(__filename);
|
|
@@ -28,38 +48,38 @@ async function getPageHTML(api, { title, disableGoogleFont, templateOptions } =
|
|
|
28
48
|
}
|
|
29
49
|
//#endregion
|
|
30
50
|
//#region src/plugin.ts
|
|
31
|
-
function trimExtName(text) {
|
|
32
|
-
return text.replace(/\.[^/.]+$/, "");
|
|
33
|
-
}
|
|
34
51
|
const pluginRedocName = "plugin-redoc";
|
|
35
|
-
const pluginRedoc =
|
|
52
|
+
const pluginRedoc = definePlugin((options) => {
|
|
36
53
|
const { output = { path: "docs.html" } } = options;
|
|
37
54
|
return {
|
|
38
55
|
name: pluginRedocName,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
56
|
+
version,
|
|
57
|
+
options,
|
|
58
|
+
hooks: { async "kubb:plugin:setup"(ctx) {
|
|
59
|
+
ctx.setOptions({
|
|
60
|
+
output,
|
|
61
|
+
name: trimExtName(output.path),
|
|
62
|
+
exclude: [],
|
|
63
|
+
override: []
|
|
64
|
+
});
|
|
65
|
+
const adapter = ctx.config.adapter;
|
|
66
|
+
if (adapter?.name !== adapterOasName) throw new Error(`[${pluginRedocName}] plugin-redoc requires the OpenAPI adapter. Make sure you are using adapterOas (e.g. \`adapter: adapterOas()\`) in your Kubb config.`);
|
|
67
|
+
const document = adapter.document;
|
|
68
|
+
if (!document) throw new Error(`[${pluginRedocName}] No OpenAPI document found. The adapterOas did not produce a document — ensure the adapter has run before this plugin.`);
|
|
69
|
+
const root = path.resolve(ctx.config.root, ctx.config.output.path);
|
|
70
|
+
const pageHTML = await getPageHTML(document);
|
|
71
|
+
ctx.injectFile({
|
|
50
72
|
baseName: "docs.html",
|
|
51
73
|
path: path.resolve(root, output.path || "./docs.html"),
|
|
52
|
-
sources: [{
|
|
74
|
+
sources: [ast.createSource({
|
|
53
75
|
name: "docs.html",
|
|
54
|
-
|
|
55
|
-
}]
|
|
56
|
-
imports: [],
|
|
57
|
-
exports: []
|
|
76
|
+
nodes: [ast.createText(pageHTML)]
|
|
77
|
+
})]
|
|
58
78
|
});
|
|
59
|
-
}
|
|
79
|
+
} }
|
|
60
80
|
};
|
|
61
81
|
});
|
|
62
82
|
//#endregion
|
|
63
|
-
export { pluginRedoc, pluginRedocName };
|
|
83
|
+
export { pluginRedoc as default, pluginRedoc, pluginRedocName };
|
|
64
84
|
|
|
65
85
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"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 {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/string.ts","../package.json","../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","","import fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { AdapterOas } from '@kubb/adapter-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: AdapterOas['document'], { 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 { trimExtName } from '@internals/utils'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { adapterOasName } from '@kubb/adapter-oas'\n\nimport { type Adapter, ast, definePlugin } from '@kubb/core'\nimport { version } from '../package.json'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\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 version,\n options,\n hooks: {\n async 'kubb:plugin:setup'(ctx) {\n ctx.setOptions({\n output,\n name: trimExtName(output.path),\n exclude: [],\n override: [],\n })\n\n const adapter = ctx.config.adapter\n\n if (adapter?.name !== adapterOasName) {\n throw new Error(\n `[${pluginRedocName}] plugin-redoc requires the OpenAPI adapter. Make sure you are using adapterOas (e.g. \\`adapter: adapterOas()\\`) in your Kubb config.`,\n )\n }\n\n const document = (adapter as Adapter<AdapterOas>).document\n\n if (!document) {\n throw new Error(\n `[${pluginRedocName}] No OpenAPI document found. The adapterOas did not produce a document — ensure the adapter has run before this plugin.`,\n )\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const pageHTML = await getPageHTML(document)\n\n ctx.injectFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n ast.createSource({\n name: 'docs.html',\n nodes: [ast.createText(pageHTML)],\n }),\n ],\n })\n },\n },\n }\n})\n\nexport default pluginRedoc\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6DA,SAAgB,YAAY,MAAsB;CAChD,MAAM,WAAW,KAAK,YAAY,IAAI;AACtC,KAAI,WAAW,KAAK,CAAC,KAAK,SAAS,KAAK,SAAS,CAC/C,QAAO,KAAK,MAAM,GAAG,SAAS;AAEhC,QAAO;;;;;;;AE5DT,MAAM,aAAa,cAAc,OAAO,KAAK,IAAI;AACjD,MAAM,YAAY,KAAK,QAAQ,WAAW;AAQ1C,eAAsB,YAAY,KAA6B,EAAE,OAAO,mBAAmB,oBAAsC,EAAE,EAAE;CACnI,MAAM,mBAAmB,KAAK,KAAK,WAAW,sBAAsB;AAEpE,QADiB,IAAI,QAAQ,GAAG,aAAa,iBAAiB,CAAC,UAAU,CAC1D,CAAC;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;ACtBJ,MAAa,kBAAkB;AAE/B,MAAa,cAAc,cAA2B,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN;EACA;EACA,OAAO,EACL,MAAM,oBAAoB,KAAK;AAC7B,OAAI,WAAW;IACb;IACA,MAAM,YAAY,OAAO,KAAK;IAC9B,SAAS,EAAE;IACX,UAAU,EAAE;IACb,CAAC;GAEF,MAAM,UAAU,IAAI,OAAO;AAE3B,OAAI,SAAS,SAAS,eACpB,OAAM,IAAI,MACR,IAAI,gBAAgB,uIACrB;GAGH,MAAM,WAAY,QAAgC;AAElD,OAAI,CAAC,SACH,OAAM,IAAI,MACR,IAAI,gBAAgB,yHACrB;GAGH,MAAM,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,KAAK;GAClE,MAAM,WAAW,MAAM,YAAY,SAAS;AAE5C,OAAI,WAAW;IACb,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc;IACtD,SAAS,CACP,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAW,SAAS,CAAC;KAClC,CAAC,CACH;IACF,CAAC;KAEL;EACF;EACD"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-redoc",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-beta.3",
|
|
4
4
|
"description": "Redoc documentation generator plugin for Kubb, creating beautiful, interactive API documentation from OpenAPI specifications.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"redoc",
|
|
7
|
-
"documentation",
|
|
8
6
|
"api-docs",
|
|
9
|
-
"openapi",
|
|
10
|
-
"swagger",
|
|
11
|
-
"interactive-docs",
|
|
12
|
-
"typescript",
|
|
13
7
|
"code-generator",
|
|
14
8
|
"codegen",
|
|
9
|
+
"documentation",
|
|
10
|
+
"interactive-docs",
|
|
11
|
+
"kubb",
|
|
12
|
+
"openapi",
|
|
15
13
|
"plugins",
|
|
16
|
-
"
|
|
14
|
+
"redoc",
|
|
15
|
+
"swagger",
|
|
16
|
+
"typescript"
|
|
17
17
|
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "stijnvanhulle",
|
|
18
20
|
"repository": {
|
|
19
21
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/kubb-labs/
|
|
22
|
+
"url": "git+https://github.com/kubb-labs/plugins.git",
|
|
21
23
|
"directory": "packages/plugin-redoc"
|
|
22
24
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"dist",
|
|
28
|
+
"static",
|
|
29
|
+
"plugin.json",
|
|
30
|
+
"!/**/**.test.**",
|
|
31
|
+
"!/**/__tests__/**",
|
|
32
|
+
"!/**/__snapshots__/**"
|
|
33
|
+
],
|
|
26
34
|
"type": "module",
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"main": "./dist/index.cjs",
|
|
37
|
+
"module": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"typesVersions": {
|
|
40
|
+
"*": {}
|
|
41
|
+
},
|
|
27
42
|
"exports": {
|
|
28
43
|
".": {
|
|
29
44
|
"import": "./dist/index.js",
|
|
@@ -31,18 +46,18 @@
|
|
|
31
46
|
},
|
|
32
47
|
"./package.json": "./package.json"
|
|
33
48
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
"
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"registry": "https://registry.npmjs.org/"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@kubb/adapter-oas": "5.0.0-beta.3",
|
|
55
|
+
"@kubb/core": "5.0.0-beta.3",
|
|
56
|
+
"handlebars": "^4.7.9"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@internals/utils": "0.0.0"
|
|
37
60
|
},
|
|
38
|
-
"files": [
|
|
39
|
-
"src",
|
|
40
|
-
"dist",
|
|
41
|
-
"static",
|
|
42
|
-
"!/**/**.test.**",
|
|
43
|
-
"!/**/__tests__/**",
|
|
44
|
-
"!/**/__snapshots__/**"
|
|
45
|
-
],
|
|
46
61
|
"size-limit": [
|
|
47
62
|
{
|
|
48
63
|
"path": "./dist/*.js",
|
|
@@ -50,32 +65,14 @@
|
|
|
50
65
|
"gzip": true
|
|
51
66
|
}
|
|
52
67
|
],
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"@kubb/fabric-core": "0.14.0",
|
|
55
|
-
"@kubb/react-fabric": "0.14.0",
|
|
56
|
-
"handlebars": "^4.7.8",
|
|
57
|
-
"@kubb/core": "5.0.0-alpha.9",
|
|
58
|
-
"@kubb/oas": "5.0.0-alpha.9",
|
|
59
|
-
"@kubb/plugin-oas": "5.0.0-alpha.9"
|
|
60
|
-
},
|
|
61
|
-
"peerDependencies": {
|
|
62
|
-
"@kubb/fabric-core": "0.14.0",
|
|
63
|
-
"@kubb/react-fabric": "0.14.0"
|
|
64
|
-
},
|
|
65
68
|
"engines": {
|
|
66
69
|
"node": ">=22"
|
|
67
70
|
},
|
|
68
|
-
"publishConfig": {
|
|
69
|
-
"access": "public",
|
|
70
|
-
"registry": "https://registry.npmjs.org/"
|
|
71
|
-
},
|
|
72
|
-
"main": "./dist/index.cjs",
|
|
73
|
-
"module": "./dist/index.js",
|
|
74
71
|
"scripts": {
|
|
75
72
|
"build": "tsdown && size-limit",
|
|
76
73
|
"clean": "npx rimraf ./dist",
|
|
77
|
-
"lint": "
|
|
78
|
-
"lint:fix": "
|
|
74
|
+
"lint": "oxlint .",
|
|
75
|
+
"lint:fix": "oxlint --fix .",
|
|
79
76
|
"release": "pnpm publish --no-git-check",
|
|
80
77
|
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
81
78
|
"start": "tsdown --watch",
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { pluginRedoc, pluginRedocName } from './plugin.ts'
|
|
1
|
+
export { default, pluginRedoc, pluginRedocName } from './plugin.ts'
|
|
2
2
|
export type { PluginRedoc } from './types.ts'
|
package/src/plugin.ts
CHANGED
|
@@ -1,44 +1,63 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { trimExtName } from '@internals/utils'
|
|
3
|
+
import type { AdapterOas } from '@kubb/adapter-oas'
|
|
4
|
+
import { adapterOasName } from '@kubb/adapter-oas'
|
|
5
|
+
|
|
6
|
+
import { type Adapter, ast, definePlugin } from '@kubb/core'
|
|
7
|
+
import { version } from '../package.json'
|
|
4
8
|
import { getPageHTML } from './redoc.tsx'
|
|
5
9
|
import type { PluginRedoc } from './types.ts'
|
|
6
10
|
|
|
7
|
-
function trimExtName(text: string): string {
|
|
8
|
-
return text.replace(/\.[^/.]+$/, '')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
11
|
export const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']
|
|
12
12
|
|
|
13
|
-
export const pluginRedoc =
|
|
13
|
+
export const pluginRedoc = definePlugin<PluginRedoc>((options) => {
|
|
14
14
|
const { output = { path: 'docs.html' } } = options
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
name: pluginRedocName,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
version,
|
|
19
|
+
options,
|
|
20
|
+
hooks: {
|
|
21
|
+
async 'kubb:plugin:setup'(ctx) {
|
|
22
|
+
ctx.setOptions({
|
|
23
|
+
output,
|
|
24
|
+
name: trimExtName(output.path),
|
|
25
|
+
exclude: [],
|
|
26
|
+
override: [],
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const adapter = ctx.config.adapter
|
|
30
|
+
|
|
31
|
+
if (adapter?.name !== adapterOasName) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`[${pluginRedocName}] plugin-redoc requires the OpenAPI adapter. Make sure you are using adapterOas (e.g. \`adapter: adapterOas()\`) in your Kubb config.`,
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const document = (adapter as Adapter<AdapterOas>).document
|
|
38
|
+
|
|
39
|
+
if (!document) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`[${pluginRedocName}] No OpenAPI document found. The adapterOas did not produce a document — ensure the adapter has run before this plugin.`,
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const root = path.resolve(ctx.config.root, ctx.config.output.path)
|
|
46
|
+
const pageHTML = await getPageHTML(document)
|
|
47
|
+
|
|
48
|
+
ctx.injectFile({
|
|
49
|
+
baseName: 'docs.html',
|
|
50
|
+
path: path.resolve(root, output.path || './docs.html'),
|
|
51
|
+
sources: [
|
|
52
|
+
ast.createSource({
|
|
53
|
+
name: 'docs.html',
|
|
54
|
+
nodes: [ast.createText(pageHTML)],
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
})
|
|
58
|
+
},
|
|
42
59
|
},
|
|
43
60
|
}
|
|
44
61
|
})
|
|
62
|
+
|
|
63
|
+
export default pluginRedoc
|
package/src/redoc.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import type {
|
|
4
|
+
import type { AdapterOas } from '@kubb/adapter-oas'
|
|
5
5
|
import pkg from 'handlebars'
|
|
6
6
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url)
|
|
@@ -13,7 +13,7 @@ type BuildDocsOptions = {
|
|
|
13
13
|
templateOptions?: any
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export async function getPageHTML(api:
|
|
16
|
+
export async function getPageHTML(api: AdapterOas['document'], { title, disableGoogleFont, templateOptions }: BuildDocsOptions = {}) {
|
|
17
17
|
const templateFileName = path.join(__dirname, '../static/redoc.hbs')
|
|
18
18
|
const template = pkg.compile(fs.readFileSync(templateFileName).toString())
|
|
19
19
|
return template({
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Output, PluginFactoryOptions } from '@kubb/core'
|
|
2
|
-
import type { Oas } from '@kubb/oas'
|
|
1
|
+
import type { Exclude, Include, Output, Override, PluginFactoryOptions } from '@kubb/core'
|
|
3
2
|
|
|
4
3
|
export type Options = {
|
|
5
4
|
output?: {
|
|
6
5
|
/**
|
|
7
|
-
* Output for the generated
|
|
6
|
+
* Output path for the generated HTML documentation.
|
|
7
|
+
*
|
|
8
8
|
* @default 'docs.html'
|
|
9
9
|
*/
|
|
10
10
|
path: string
|
|
@@ -12,7 +12,19 @@ export type Options = {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type ResolveOptions = {
|
|
15
|
-
output: Output<
|
|
15
|
+
output: Output<never>
|
|
16
|
+
name: string
|
|
17
|
+
exclude: Array<Exclude>
|
|
18
|
+
include?: Array<Include>
|
|
19
|
+
override: Array<Override<ResolveOptions>>
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
export type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions
|
|
22
|
+
export type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions>
|
|
23
|
+
|
|
24
|
+
declare global {
|
|
25
|
+
namespace Kubb {
|
|
26
|
+
interface PluginRegistry {
|
|
27
|
+
'plugin-redoc': PluginRedoc
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/static/redoc.hbs
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
1
|
<html>
|
|
3
2
|
|
|
4
|
-
<head>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</head>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset='utf8' />
|
|
5
|
+
<title>{{title}}</title>
|
|
6
|
+
<!-- needed for adaptive design -->
|
|
7
|
+
<meta name='viewport' content='width=device-width, initial-scale=1' />
|
|
8
|
+
<style>
|
|
9
|
+
body {
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
{{#unless disableGoogleFont}}<link href='https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700' rel='stylesheet' />{{/unless}}
|
|
15
|
+
</head>
|
|
17
16
|
|
|
18
|
-
<body>
|
|
19
|
-
|
|
20
|
-
</body>
|
|
17
|
+
<body>
|
|
18
|
+
{{{redocHTML}}}
|
|
19
|
+
</body>
|
|
21
20
|
|
|
22
|
-
</html>
|
|
21
|
+
</html>
|