@kubb/plugin-redoc 3.0.0-alpha.2 → 3.0.0-alpha.21
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/README.md +13 -4
- package/dist/index.cjs +59 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +42 -29
- package/dist/index.js.map +1 -1
- package/package.json +12 -13
- package/src/plugin.ts +5 -9
- package/src/types.ts +3 -6
package/README.md
CHANGED
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
[![Coverage][coverage-src]][coverage-href]
|
|
14
14
|
[![License][license-src]][license-href]
|
|
15
15
|
|
|
16
|
-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
17
|
-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
16
|
<h4>
|
|
21
17
|
<a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
|
|
22
18
|
<span> · </span>
|
|
@@ -28,6 +24,19 @@
|
|
|
28
24
|
</h4>
|
|
29
25
|
</div>
|
|
30
26
|
|
|
27
|
+
## Supporting Kubb
|
|
28
|
+
|
|
29
|
+
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:
|
|
30
|
+
|
|
31
|
+
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<a href="https://github.com/sponsors/stijnvanhulle">
|
|
35
|
+
<img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
|
|
36
|
+
</a>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
|
|
31
40
|
<!-- Badges -->
|
|
32
41
|
|
|
33
42
|
[npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-redoc?flat&colorA=18181B&colorB=f58517
|
package/dist/index.cjs
CHANGED
|
@@ -1,24 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path2 = require('path');
|
|
4
|
+
var core = require('@kubb/core');
|
|
5
|
+
var pluginOas = require('@kubb/plugin-oas');
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var pkg = require('handlebars');
|
|
8
|
+
var server = require('react-dom/server');
|
|
9
|
+
var styledComponents = require('styled-components');
|
|
10
|
+
var redoc = require('redoc');
|
|
11
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
+
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
|
|
15
|
+
var path2__default = /*#__PURE__*/_interopDefault(path2);
|
|
16
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
17
|
+
var pkg__default = /*#__PURE__*/_interopDefault(pkg);
|
|
18
|
+
var redoc__default = /*#__PURE__*/_interopDefault(redoc);
|
|
19
|
+
|
|
20
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
21
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
22
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
23
|
}) : x)(function(x) {
|
|
4
24
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
25
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
26
|
});
|
|
27
|
+
var __esm = (fn, res) => function __init() {
|
|
28
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.9_@types+node@20.16.5__@swc+core@1.7.22_jiti@1.21.6__lhvky7c6s3dd3ja7myrlfh4phy/node_modules/tsup/assets/cjs_shims.js
|
|
32
|
+
var init_cjs_shims = __esm({
|
|
33
|
+
"../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.9_@types+node@20.16.5__@swc+core@1.7.22_jiti@1.21.6__lhvky7c6s3dd3ja7myrlfh4phy/node_modules/tsup/assets/cjs_shims.js"() {
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// src/index.ts
|
|
38
|
+
init_cjs_shims();
|
|
7
39
|
|
|
8
40
|
// src/plugin.ts
|
|
9
|
-
|
|
10
|
-
var _core = require('@kubb/core');
|
|
11
|
-
var _transformers = require('@kubb/core/transformers');
|
|
12
|
-
var _pluginoas = require('@kubb/plugin-oas');
|
|
41
|
+
init_cjs_shims();
|
|
13
42
|
|
|
14
|
-
// src/
|
|
15
|
-
|
|
43
|
+
// ../fs/src/index.ts
|
|
44
|
+
init_cjs_shims();
|
|
45
|
+
function trimExtName(text) {
|
|
46
|
+
return text.replace(/\.[^/.]+$/, "");
|
|
47
|
+
}
|
|
16
48
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _styledcomponents = require('styled-components');
|
|
20
|
-
var _redoc = require('redoc'); var _redoc2 = _interopRequireDefault(_redoc);
|
|
21
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
49
|
+
// src/redoc.tsx
|
|
50
|
+
init_cjs_shims();
|
|
22
51
|
function escapeClosingScriptTag(str) {
|
|
23
52
|
return str.replace(/<\/script>/g, "<\\/script>");
|
|
24
53
|
}
|
|
@@ -30,19 +59,19 @@ function sanitizeJSONString(str) {
|
|
|
30
59
|
}
|
|
31
60
|
async function getPageHTML(api, { title, disableGoogleFont, templateOptions, redocOptions = {} } = {}) {
|
|
32
61
|
const apiUrl = redocOptions.specUrl;
|
|
33
|
-
const { Redoc, createStore } =
|
|
62
|
+
const { Redoc, createStore } = redoc__default.default || __require("redoc");
|
|
34
63
|
const store = await createStore(api, apiUrl, redocOptions);
|
|
35
|
-
const sheet = new
|
|
64
|
+
const sheet = new styledComponents.ServerStyleSheet();
|
|
36
65
|
const error = console.error;
|
|
37
66
|
console.error = (...args) => {
|
|
38
67
|
if (/defaultProps/.test(args[0])) return;
|
|
39
68
|
error(...args);
|
|
40
69
|
};
|
|
41
|
-
const html =
|
|
70
|
+
const html = server.renderToString(sheet.collectStyles(/* @__PURE__ */ jsxRuntime.jsx(Redoc, { store })));
|
|
42
71
|
const state = await store.toJS();
|
|
43
72
|
const css = sheet.getStyleTags();
|
|
44
|
-
const templateFileName =
|
|
45
|
-
const template =
|
|
73
|
+
const templateFileName = path2__default.default.join(__dirname, "../static/redoc.hbs");
|
|
74
|
+
const template = pkg__default.default.compile(fs__default.default.readFileSync(templateFileName).toString());
|
|
46
75
|
return template({
|
|
47
76
|
redocHTML: `
|
|
48
77
|
<div id="redoc">${html || ""}</div>
|
|
@@ -65,34 +94,31 @@ async function getPageHTML(api, { title, disableGoogleFont, templateOptions, red
|
|
|
65
94
|
|
|
66
95
|
// src/plugin.ts
|
|
67
96
|
var pluginRedocName = "plugin-redoc";
|
|
68
|
-
var pluginRedoc =
|
|
97
|
+
var pluginRedoc = core.createPlugin((options) => {
|
|
69
98
|
const { output = { path: "docs.html" } } = options;
|
|
70
99
|
return {
|
|
71
100
|
name: pluginRedocName,
|
|
72
101
|
options: {
|
|
73
|
-
|
|
102
|
+
output: {
|
|
103
|
+
exportType: "barrelNamed",
|
|
104
|
+
...output
|
|
105
|
+
},
|
|
106
|
+
name: trimExtName(output.path),
|
|
74
107
|
baseURL: void 0
|
|
75
108
|
},
|
|
76
|
-
pre: [
|
|
77
|
-
resolvePath(baseName) {
|
|
78
|
-
const root = _path2.default.resolve(this.config.root, this.config.output.path);
|
|
79
|
-
return _path2.default.resolve(root, baseName);
|
|
80
|
-
},
|
|
81
|
-
resolveName(name, type) {
|
|
82
|
-
return _transformers.camelCase.call(void 0, name, { isFile: type === "file" });
|
|
83
|
-
},
|
|
109
|
+
pre: [pluginOas.pluginOasName],
|
|
84
110
|
async buildStart() {
|
|
85
|
-
const [swaggerPlugin] =
|
|
111
|
+
const [swaggerPlugin] = core.PluginManager.getDependedPlugins(this.plugins, [pluginOas.pluginOasName]);
|
|
86
112
|
const oas = await swaggerPlugin.context.getOas();
|
|
87
113
|
await oas.dereference();
|
|
88
|
-
const root =
|
|
114
|
+
const root = path2__default.default.resolve(this.config.root, this.config.output.path);
|
|
89
115
|
const pageHTML = await getPageHTML(oas.api);
|
|
90
|
-
await this.fileManager.write(
|
|
116
|
+
await this.fileManager.write(path2__default.default.resolve(root, output.path || "./docs.html"), pageHTML);
|
|
91
117
|
}
|
|
92
118
|
};
|
|
93
119
|
});
|
|
94
120
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
121
|
+
exports.pluginRedoc = pluginRedoc;
|
|
122
|
+
exports.pluginRedocName = pluginRedocName;
|
|
123
|
+
//# sourceMappingURL=index.cjs.map
|
|
98
124
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.9_@types+node@20.16.5__@swc+core@1.7.22_jiti@1.21.6__lhvky7c6s3dd3ja7myrlfh4phy/node_modules/tsup/assets/cjs_shims.js","../src/index.ts","../src/plugin.ts","../../fs/src/index.ts","../src/redoc.tsx"],"names":["redoc","ServerStyleSheet","renderToString","path","pkg","fs","createPlugin","pluginOasName","PluginManager"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA;AAAA,EAAA,yLAAA,GAAA;AAAA,GAAA;AAAA,CAAA,CAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAIO,SAAS,YAAY,IAAsB,EAAA;AAChD,EAAO,OAAA,IAAA,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AAA,OACL;AAAA,MACA,IAAA,EAAM,WAAY,CAAA,MAAA,CAAO,IAAI,CAAA;AAAA,MAC7B,OAAS,EAAA,KAAA,CAAA;AAAA,KACX;AAAA,IACA,GAAA,EAAK,CAACC,uBAAa,CAAA;AAAA,IACnB,MAAM,UAAa,GAAA;AACjB,MAAM,MAAA,CAAC,aAAa,CAAyB,GAAAC,kBAAA,CAAc,mBAA8B,IAAK,CAAA,OAAA,EAAS,CAACD,uBAAa,CAAC,CAAA,CAAA;AACtH,MAAA,MAAM,GAAM,GAAA,MAAM,aAAc,CAAA,OAAA,CAAQ,MAAO,EAAA,CAAA;AAE/C,MAAA,MAAM,IAAI,WAAY,EAAA,CAAA;AAEtB,MAAM,MAAA,IAAA,GAAOJ,uBAAK,OAAQ,CAAA,IAAA,CAAK,OAAO,IAAM,EAAA,IAAA,CAAK,MAAO,CAAA,MAAA,CAAO,IAAI,CAAA,CAAA;AACnE,MAAA,MAAM,QAAW,GAAA,MAAM,WAAY,CAAA,GAAA,CAAI,GAAG,CAAA,CAAA;AAE1C,MAAM,MAAA,IAAA,CAAK,WAAY,CAAA,KAAA,CAAMA,sBAAK,CAAA,OAAA,CAAQ,MAAM,MAAO,CAAA,IAAA,IAAQ,aAAa,CAAA,EAAG,QAAQ,CAAA,CAAA;AAAA,KACzF;AAAA,GACF,CAAA;AACF,CAAC","file":"index.cjs","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL(`file:${__filename}`).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","export { pluginRedoc, pluginRedocName } from './plugin.ts'\nexport type { PluginRedoc } from './types.ts'\n","import path from 'node:path'\n\nimport { PluginManager, createPlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport { trimExtName } from '@kubb/fs'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = createPlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n options: {\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n name: trimExtName(output.path),\n baseURL: undefined,\n },\n pre: [pluginOasName],\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n const oas = await swaggerPlugin.context.getOas()\n\n await oas.dereference()\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(oas.api)\n\n await this.fileManager.write(path.resolve(root, output.path || './docs.html'), pageHTML)\n },\n }\n})\n","export { clean } from './clean.ts'\nexport { getRelativePath, read, readSync } from './read.ts'\nexport { write } from './write.ts'\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\nimport { renderToString } from 'react-dom/server'\nimport { ServerStyleSheet } from 'styled-components'\nimport redoc from 'redoc'\n\ntype BuildDocsOptions = {\n title?: string\n disableGoogleFont?: boolean\n templateOptions?: any\n redocOptions?: any\n}\n\n// see http://www.thespanner.co.uk/2011/07/25/the-json-specification-is-now-wrong/\nfunction escapeClosingScriptTag(str: string): string {\n return str.replace(/<\\/script>/g, '<\\\\/script>')\n}\n\n// see http://www.thespanner.co.uk/2011/07/25/the-json-specification-is-now-wrong/\nfunction escapeUnicode(str: string): string {\n // biome-ignore lint/style/useTemplate: <explanation>\n return str.replace(/\\u2028|\\u2029/g, (m) => '\\\\u202' + (m === '\\u2028' ? '8' : '9'))\n}\n\nfunction sanitizeJSONString(str: string): string {\n return escapeClosingScriptTag(escapeUnicode(str))\n}\n\nexport async function getPageHTML(api: OasTypes.OASDocument, { title, disableGoogleFont, templateOptions, redocOptions = {} }: BuildDocsOptions = {}) {\n const apiUrl = redocOptions.specUrl\n const { Redoc, createStore } = redoc || require('redoc')\n const store = await createStore(api, apiUrl, redocOptions)\n const sheet = new ServerStyleSheet()\n\n const error = console.error\n console.error = (...args: any) => {\n if (/defaultProps/.test(args[0])) return\n error(...args)\n }\n\n const html = renderToString(sheet.collectStyles(<Redoc store={store} />))\n const state = await store.toJS()\n const css = sheet.getStyleTags()\n\n const templateFileName = path.join(__dirname, '../static/redoc.hbs')\n const template = pkg.compile(fs.readFileSync(templateFileName).toString())\n return template({\n redocHTML: `\n <div id=\"redoc\">${html || ''}</div>\n <script>\n ${`const __redoc_state = ${sanitizeJSONString(JSON.stringify(state))};` || ''}\n\n var container = document.getElementById('redoc');\n Redoc.${'hydrate(__redoc_state, container)'};\n\n </script>`,\n redocHead:\n // biome-ignore lint/style/useTemplate: <explanation>\n `<script src=\"https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js\"></script>` + css,\n title: title || api.info.title || 'ReDoc documentation',\n disableGoogleFont,\n templateOptions,\n })\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _kubb_core from '@kubb/core';
|
|
2
|
-
import { PluginFactoryOptions } from '@kubb/core';
|
|
2
|
+
import { PluginFactoryOptions, Output } from '@kubb/core';
|
|
3
3
|
|
|
4
4
|
type Options = {
|
|
5
5
|
output?: {
|
|
@@ -10,7 +10,9 @@ type Options = {
|
|
|
10
10
|
path: string;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
type ResolveOptions = {
|
|
13
|
+
type ResolveOptions = {
|
|
14
|
+
output: Output;
|
|
15
|
+
};
|
|
14
16
|
type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions, never>;
|
|
15
17
|
|
|
16
18
|
declare const pluginRedocName = "plugin-redoc";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _kubb_core from '@kubb/core';
|
|
2
|
-
import { PluginFactoryOptions } from '@kubb/core';
|
|
2
|
+
import { PluginFactoryOptions, Output } from '@kubb/core';
|
|
3
3
|
|
|
4
4
|
type Options = {
|
|
5
5
|
output?: {
|
|
@@ -10,7 +10,9 @@ type Options = {
|
|
|
10
10
|
path: string;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
type ResolveOptions = {
|
|
13
|
+
type ResolveOptions = {
|
|
14
|
+
output: Output;
|
|
15
|
+
};
|
|
14
16
|
type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions, never>;
|
|
15
17
|
|
|
16
18
|
declare const pluginRedocName = "plugin-redoc";
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,48 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import path3 from 'node:path';
|
|
4
|
+
import { createPlugin, PluginManager } from '@kubb/core';
|
|
5
|
+
import { pluginOasName } from '@kubb/plugin-oas';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import pkg from 'handlebars';
|
|
8
|
+
import { renderToString } from 'react-dom/server';
|
|
9
|
+
import { ServerStyleSheet } from 'styled-components';
|
|
10
|
+
import redoc from 'redoc';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1
14
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
15
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
16
|
}) : x)(function(x) {
|
|
4
17
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
18
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
19
|
});
|
|
20
|
+
var __esm = (fn, res) => function __init() {
|
|
21
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
22
|
+
};
|
|
23
|
+
var getFilename, getDirname, __dirname;
|
|
24
|
+
var init_esm_shims = __esm({
|
|
25
|
+
"../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.9_@types+node@20.16.5__@swc+core@1.7.22_jiti@1.21.6__lhvky7c6s3dd3ja7myrlfh4phy/node_modules/tsup/assets/esm_shims.js"() {
|
|
26
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
27
|
+
getDirname = () => path.dirname(getFilename());
|
|
28
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
7
31
|
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
import path from "path";
|
|
11
|
-
var getFilename = () => fileURLToPath(import.meta.url);
|
|
12
|
-
var getDirname = () => path.dirname(getFilename());
|
|
13
|
-
var __dirname = /* @__PURE__ */ getDirname();
|
|
32
|
+
// src/index.ts
|
|
33
|
+
init_esm_shims();
|
|
14
34
|
|
|
15
35
|
// src/plugin.ts
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
init_esm_shims();
|
|
37
|
+
|
|
38
|
+
// ../fs/src/index.ts
|
|
39
|
+
init_esm_shims();
|
|
40
|
+
function trimExtName(text) {
|
|
41
|
+
return text.replace(/\.[^/.]+$/, "");
|
|
42
|
+
}
|
|
20
43
|
|
|
21
44
|
// src/redoc.tsx
|
|
22
|
-
|
|
23
|
-
import path2 from "path";
|
|
24
|
-
import pkg from "handlebars";
|
|
25
|
-
import { renderToString } from "react-dom/server";
|
|
26
|
-
import { ServerStyleSheet } from "styled-components";
|
|
27
|
-
import redoc from "redoc";
|
|
28
|
-
import { jsx } from "react/jsx-runtime";
|
|
45
|
+
init_esm_shims();
|
|
29
46
|
function escapeClosingScriptTag(str) {
|
|
30
47
|
return str.replace(/<\/script>/g, "<\\/script>");
|
|
31
48
|
}
|
|
@@ -48,7 +65,7 @@ async function getPageHTML(api, { title, disableGoogleFont, templateOptions, red
|
|
|
48
65
|
const html = renderToString(sheet.collectStyles(/* @__PURE__ */ jsx(Redoc, { store })));
|
|
49
66
|
const state = await store.toJS();
|
|
50
67
|
const css = sheet.getStyleTags();
|
|
51
|
-
const templateFileName =
|
|
68
|
+
const templateFileName = path3.join(__dirname, "../static/redoc.hbs");
|
|
52
69
|
const template = pkg.compile(fs.readFileSync(templateFileName).toString());
|
|
53
70
|
return template({
|
|
54
71
|
redocHTML: `
|
|
@@ -77,17 +94,14 @@ var pluginRedoc = createPlugin((options) => {
|
|
|
77
94
|
return {
|
|
78
95
|
name: pluginRedocName,
|
|
79
96
|
options: {
|
|
97
|
+
output: {
|
|
98
|
+
exportType: "barrelNamed",
|
|
99
|
+
...output
|
|
100
|
+
},
|
|
80
101
|
name: trimExtName(output.path),
|
|
81
102
|
baseURL: void 0
|
|
82
103
|
},
|
|
83
104
|
pre: [pluginOasName],
|
|
84
|
-
resolvePath(baseName) {
|
|
85
|
-
const root = path3.resolve(this.config.root, this.config.output.path);
|
|
86
|
-
return path3.resolve(root, baseName);
|
|
87
|
-
},
|
|
88
|
-
resolveName(name, type) {
|
|
89
|
-
return camelCase(name, { isFile: type === "file" });
|
|
90
|
-
},
|
|
91
105
|
async buildStart() {
|
|
92
106
|
const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
|
|
93
107
|
const oas = await swaggerPlugin.context.getOas();
|
|
@@ -98,8 +112,7 @@ var pluginRedoc = createPlugin((options) => {
|
|
|
98
112
|
}
|
|
99
113
|
};
|
|
100
114
|
});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
115
|
+
|
|
116
|
+
export { pluginRedoc, pluginRedocName };
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
105
118
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.9_@types+node@20.16.5__@swc+core@1.7.22_jiti@1.21.6__lhvky7c6s3dd3ja7myrlfh4phy/node_modules/tsup/assets/esm_shims.js","../src/index.ts","../src/plugin.ts","../../fs/src/index.ts","../src/redoc.tsx"],"names":["path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAIM,aACA,UAEO,EAAA,SAAA,CAAA;AAPb,IAAA,cAAA,GAAA,KAAA,CAAA;AAAA,EAAA,yLAAA,GAAA;AAIA,IAAM,WAAc,GAAA,MAAM,aAAc,CAAA,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAA;AACvD,IAAM,UAAa,GAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,aAAa,CAAA,CAAA;AAE5C,IAAM,4BAAuC,UAAA,EAAA,CAAA;AAAA,GAAA;AAAA,CAAA,CAAA,CAAA;;;ACPpD,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAIO,SAAS,YAAY,IAAsB,EAAA;AAChD,EAAO,OAAA,IAAA,CAAK,OAAQ,CAAA,WAAA,EAAa,EAAE,CAAA,CAAA;AACrC,CAAA;;;ACNA,cAAA,EAAA,CAAA;AAgBA,SAAS,uBAAuB,GAAqB,EAAA;AACnD,EAAO,OAAA,GAAA,CAAI,OAAQ,CAAA,aAAA,EAAe,aAAa,CAAA,CAAA;AACjD,CAAA;AAGA,SAAS,cAAc,GAAqB,EAAA;AAE1C,EAAO,OAAA,GAAA,CAAI,QAAQ,gBAAkB,EAAA,CAAC,MAAM,QAAY,IAAA,CAAA,KAAM,QAAW,GAAA,GAAA,GAAM,GAAI,CAAA,CAAA,CAAA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E/C,MAAA,MAAM,IAAI,WAAY,EAAA,CAAA;AAEtB,MAAM,MAAA,IAAA,GAAOA,MAAK,OAAQ,CAAA,IAAA,CAAK,OAAO,IAAM,EAAA,IAAA,CAAK,MAAO,CAAA,MAAA,CAAO,IAAI,CAAA,CAAA;AACnE,MAAA,MAAM,QAAW,GAAA,MAAM,WAAY,CAAA,GAAA,CAAI,GAAG,CAAA,CAAA;AAE1C,MAAM,MAAA,IAAA,CAAK,WAAY,CAAA,KAAA,CAAMA,KAAK,CAAA,OAAA,CAAQ,MAAM,MAAO,CAAA,IAAA,IAAQ,aAAa,CAAA,EAAG,QAAQ,CAAA,CAAA;AAAA,KACzF;AAAA,GACF,CAAA;AACF,CAAC","file":"index.js","sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","export { pluginRedoc, pluginRedocName } from './plugin.ts'\nexport type { PluginRedoc } from './types.ts'\n","import path from 'node:path'\n\nimport { PluginManager, createPlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport { trimExtName } from '@kubb/fs'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = createPlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n options: {\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n name: trimExtName(output.path),\n baseURL: undefined,\n },\n pre: [pluginOasName],\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n const oas = await swaggerPlugin.context.getOas()\n\n await oas.dereference()\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(oas.api)\n\n await this.fileManager.write(path.resolve(root, output.path || './docs.html'), pageHTML)\n },\n }\n})\n","export { clean } from './clean.ts'\nexport { getRelativePath, read, readSync } from './read.ts'\nexport { write } from './write.ts'\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\nimport { renderToString } from 'react-dom/server'\nimport { ServerStyleSheet } from 'styled-components'\nimport redoc from 'redoc'\n\ntype BuildDocsOptions = {\n title?: string\n disableGoogleFont?: boolean\n templateOptions?: any\n redocOptions?: any\n}\n\n// see http://www.thespanner.co.uk/2011/07/25/the-json-specification-is-now-wrong/\nfunction escapeClosingScriptTag(str: string): string {\n return str.replace(/<\\/script>/g, '<\\\\/script>')\n}\n\n// see http://www.thespanner.co.uk/2011/07/25/the-json-specification-is-now-wrong/\nfunction escapeUnicode(str: string): string {\n // biome-ignore lint/style/useTemplate: <explanation>\n return str.replace(/\\u2028|\\u2029/g, (m) => '\\\\u202' + (m === '\\u2028' ? '8' : '9'))\n}\n\nfunction sanitizeJSONString(str: string): string {\n return escapeClosingScriptTag(escapeUnicode(str))\n}\n\nexport async function getPageHTML(api: OasTypes.OASDocument, { title, disableGoogleFont, templateOptions, redocOptions = {} }: BuildDocsOptions = {}) {\n const apiUrl = redocOptions.specUrl\n const { Redoc, createStore } = redoc || require('redoc')\n const store = await createStore(api, apiUrl, redocOptions)\n const sheet = new ServerStyleSheet()\n\n const error = console.error\n console.error = (...args: any) => {\n if (/defaultProps/.test(args[0])) return\n error(...args)\n }\n\n const html = renderToString(sheet.collectStyles(<Redoc store={store} />))\n const state = await store.toJS()\n const css = sheet.getStyleTags()\n\n const templateFileName = path.join(__dirname, '../static/redoc.hbs')\n const template = pkg.compile(fs.readFileSync(templateFileName).toString())\n return template({\n redocHTML: `\n <div id=\"redoc\">${html || ''}</div>\n <script>\n ${`const __redoc_state = ${sanitizeJSONString(JSON.stringify(state))};` || ''}\n\n var container = document.getElementById('redoc');\n Redoc.${'hydrate(__redoc_state, container)'};\n\n </script>`,\n redocHead:\n // biome-ignore lint/style/useTemplate: <explanation>\n `<script src=\"https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js\"></script>` + css,\n title: title || api.info.title || 'ReDoc documentation',\n disableGoogleFont,\n templateOptions,\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-redoc",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.21",
|
|
4
4
|
"description": "Beautiful docs with Redoc",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -42,26 +42,25 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"handlebars": "^4.7.8",
|
|
45
|
-
"mobx": "^6.13.
|
|
45
|
+
"mobx": "^6.13.2",
|
|
46
46
|
"react": "^18.3.1",
|
|
47
47
|
"react-dom": "^18.3.1",
|
|
48
48
|
"redoc": "^2.1.5",
|
|
49
|
-
"styled-components": "^6.1.
|
|
50
|
-
"@kubb/core": "3.0.0-alpha.
|
|
51
|
-
"@kubb/oas": "3.0.0-alpha.
|
|
52
|
-
"@kubb/plugin-oas": "3.0.0-alpha.
|
|
49
|
+
"styled-components": "^6.1.13",
|
|
50
|
+
"@kubb/core": "3.0.0-alpha.21",
|
|
51
|
+
"@kubb/oas": "3.0.0-alpha.21",
|
|
52
|
+
"@kubb/plugin-oas": "3.0.0-alpha.21"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@types/react": "^18.3.
|
|
55
|
+
"@types/react": "^18.3.8",
|
|
56
56
|
"@types/react-dom": "^18.3.0",
|
|
57
|
-
"tsup": "^8.
|
|
58
|
-
"typescript": "^5.
|
|
59
|
-
"@kubb/config-
|
|
60
|
-
"@kubb/config-
|
|
61
|
-
"@kubb/config-tsup": "3.0.0-alpha.2"
|
|
57
|
+
"tsup": "^8.3.0",
|
|
58
|
+
"typescript": "^5.6.2",
|
|
59
|
+
"@kubb/config-ts": "3.0.0-alpha.21",
|
|
60
|
+
"@kubb/config-tsup": "3.0.0-alpha.21"
|
|
62
61
|
},
|
|
63
62
|
"peerDependencies": {
|
|
64
|
-
"@kubb/react": "3.0.0-alpha.
|
|
63
|
+
"@kubb/react": "3.0.0-alpha.21"
|
|
65
64
|
},
|
|
66
65
|
"engines": {
|
|
67
66
|
"node": ">=20"
|
package/src/plugin.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
|
|
3
3
|
import { PluginManager, createPlugin } from '@kubb/core'
|
|
4
|
-
import { camelCase, trimExtName } from '@kubb/core/transformers'
|
|
5
4
|
import { pluginOasName } from '@kubb/plugin-oas'
|
|
6
5
|
|
|
7
6
|
import type { Plugin } from '@kubb/core'
|
|
7
|
+
import { trimExtName } from '@kubb/fs'
|
|
8
8
|
import type { PluginOas } from '@kubb/plugin-oas'
|
|
9
9
|
import { getPageHTML } from './redoc.tsx'
|
|
10
10
|
import type { PluginRedoc } from './types.ts'
|
|
@@ -17,18 +17,14 @@ export const pluginRedoc = createPlugin<PluginRedoc>((options) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: pluginRedocName,
|
|
19
19
|
options: {
|
|
20
|
+
output: {
|
|
21
|
+
exportType: 'barrelNamed',
|
|
22
|
+
...output,
|
|
23
|
+
},
|
|
20
24
|
name: trimExtName(output.path),
|
|
21
25
|
baseURL: undefined,
|
|
22
26
|
},
|
|
23
27
|
pre: [pluginOasName],
|
|
24
|
-
resolvePath(baseName) {
|
|
25
|
-
const root = path.resolve(this.config.root, this.config.output.path)
|
|
26
|
-
|
|
27
|
-
return path.resolve(root, baseName)
|
|
28
|
-
},
|
|
29
|
-
resolveName(name, type) {
|
|
30
|
-
return camelCase(name, { isFile: type === 'file' })
|
|
31
|
-
},
|
|
32
28
|
async buildStart() {
|
|
33
29
|
const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])
|
|
34
30
|
const oas = await swaggerPlugin.context.getOas()
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Output, PluginFactoryOptions } from '@kubb/core'
|
|
2
2
|
|
|
3
3
|
export type Options = {
|
|
4
4
|
output?: {
|
|
@@ -10,11 +10,8 @@ export type Options = {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
type ResolveOptions = {
|
|
14
|
-
|
|
15
|
-
export type FileMeta = {
|
|
16
|
-
pluginKey?: Plugin['key']
|
|
17
|
-
tag?: string
|
|
13
|
+
type ResolveOptions = {
|
|
14
|
+
output: Output
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
export type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions, never>
|