@kubb/plugin-redoc 3.10.5 → 3.10.7
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/index.cjs +4 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -27
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/plugin.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,40 +3,17 @@
|
|
|
3
3
|
var path2 = require('path');
|
|
4
4
|
var core = require('@kubb/core');
|
|
5
5
|
var pluginOas = require('@kubb/plugin-oas');
|
|
6
|
-
var fs = require('fs');
|
|
6
|
+
var fs = require('@kubb/core/fs');
|
|
7
|
+
var fs$1 = require('fs');
|
|
7
8
|
var pkg = require('handlebars');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
|
|
11
12
|
var path2__default = /*#__PURE__*/_interopDefault(path2);
|
|
12
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
13
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs$1);
|
|
13
14
|
var pkg__default = /*#__PURE__*/_interopDefault(pkg);
|
|
14
15
|
|
|
15
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
-
var __esm = (fn, res) => function __init() {
|
|
17
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// ../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.5_@types+node@20.17.32__jiti@2.4.2_postcss@8.5.3_typescript@5.8.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
|
|
21
|
-
var init_cjs_shims = __esm({
|
|
22
|
-
"../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.5_@types+node@20.17.32__jiti@2.4.2_postcss@8.5.3_typescript@5.8.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// src/index.ts
|
|
27
|
-
init_cjs_shims();
|
|
28
|
-
|
|
29
16
|
// src/plugin.ts
|
|
30
|
-
init_cjs_shims();
|
|
31
|
-
|
|
32
|
-
// ../fs/src/index.ts
|
|
33
|
-
init_cjs_shims();
|
|
34
|
-
function trimExtName(text) {
|
|
35
|
-
return text.replace(/\.[^/.]+$/, "");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/redoc.tsx
|
|
39
|
-
init_cjs_shims();
|
|
40
17
|
async function getPageHTML(api, { title, disableGoogleFont, templateOptions } = {}) {
|
|
41
18
|
const templateFileName = path2__default.default.join(__dirname, "../static/redoc.hbs");
|
|
42
19
|
const template = pkg__default.default.compile(fs__default.default.readFileSync(templateFileName).toString());
|
|
@@ -65,7 +42,7 @@ var pluginRedoc = core.createPlugin((options) => {
|
|
|
65
42
|
name: pluginRedocName,
|
|
66
43
|
options: {
|
|
67
44
|
output,
|
|
68
|
-
name: trimExtName(output.path)
|
|
45
|
+
name: fs.trimExtName(output.path)
|
|
69
46
|
},
|
|
70
47
|
pre: [pluginOas.pluginOasName],
|
|
71
48
|
async buildStart() {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/redoc.tsx","../src/plugin.ts"],"names":["path","pkg","fs","createPlugin","trimExtName","pluginOasName","PluginManager"],"mappings":";;;;;;;;;;;;;;;;AAWA,eAAsB,WAAA,CAAY,KAA2B,EAAE,KAAA,EAAO,mBAAmB,eAAgB,EAAA,GAAsB,EAAI,EAAA;AACjI,EAAA,MAAM,gBAAmB,GAAAA,sBAAA,CAAK,IAAK,CAAA,SAAA,EAAW,qBAAqB,CAAA;AACnE,EAAM,MAAA,QAAA,GAAWC,qBAAI,OAAQ,CAAAC,mBAAA,CAAG,aAAa,gBAAgB,CAAA,CAAE,U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,OAAA,CAAQ,MAAM,MAAO,CAAA,IAAA,IAAQ,aAAa,CAAA,EAAG,QAAQ,CAAA;AAAA;AACzF,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\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'\n\nimport { PluginManager, createPlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport { trimExtName } from '@kubb/core/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 name: trimExtName(output.path),\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"]}
|
package/dist/index.js
CHANGED
|
@@ -3,36 +3,14 @@ import path from 'path';
|
|
|
3
3
|
import path3 from 'node:path';
|
|
4
4
|
import { createPlugin, PluginManager } from '@kubb/core';
|
|
5
5
|
import { pluginOasName } from '@kubb/plugin-oas';
|
|
6
|
+
import { trimExtName } from '@kubb/core/fs';
|
|
6
7
|
import fs from 'node:fs';
|
|
7
8
|
import pkg from 'handlebars';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var getFilename, getDirname, __dirname;
|
|
14
|
-
var init_esm_shims = __esm({
|
|
15
|
-
"../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.5_@types+node@20.17.32__jiti@2.4.2_postcss@8.5.3_typescript@5.8.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
|
|
16
|
-
getFilename = () => fileURLToPath(import.meta.url);
|
|
17
|
-
getDirname = () => path.dirname(getFilename());
|
|
18
|
-
__dirname = /* @__PURE__ */ getDirname();
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// src/index.ts
|
|
23
|
-
init_esm_shims();
|
|
24
|
-
|
|
25
|
-
// src/plugin.ts
|
|
26
|
-
init_esm_shims();
|
|
27
|
-
|
|
28
|
-
// ../fs/src/index.ts
|
|
29
|
-
init_esm_shims();
|
|
30
|
-
function trimExtName(text) {
|
|
31
|
-
return text.replace(/\.[^/.]+$/, "");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// src/redoc.tsx
|
|
35
|
-
init_esm_shims();
|
|
10
|
+
// ../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.7_@types+node@20.17.43__jiti@2.4.2_postcss@8.5.3_typescript@5.8.3_yaml@2.7.1/node_modules/tsup/assets/esm_shims.js
|
|
11
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
12
|
+
var getDirname = () => path.dirname(getFilename());
|
|
13
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
36
14
|
async function getPageHTML(api, { title, disableGoogleFont, templateOptions } = {}) {
|
|
37
15
|
const templateFileName = path3.join(__dirname, "../static/redoc.hbs");
|
|
38
16
|
const template = pkg.compile(fs.readFileSync(templateFileName).toString());
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.7_@types+node@20.17.43__jiti@2.4.2_postcss@8.5.3_typescript@5.8.3_yaml@2.7.1/node_modules/tsup/assets/esm_shims.js","../src/redoc.tsx","../src/plugin.ts"],"names":["path"],"mappings":";;;;;;;;;;AAIA,IAAM,WAAc,GAAA,MAAM,aAAc,CAAA,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AACvD,IAAM,UAAa,GAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,aAAa,CAAA;AAE5C,IAAM,4BAAuC,UAAA,EAAA;ACIpD,eAAsB,WAAA,CAAY,KAA2B,EAAE,KAAA,EAAO,mBAAmB,eAAgB,EAAA,GAAsB,EAAI,EAAA;AACjI,EAAA,MAAM,gBAAmBA,GAAAA,KAAAA,CAAK,IAAK,CAAA,SAAA,EAAW,qBAAqB,CAAA;AACnE,EAAM,MAAA,QAAA,GAAW,IAAI,OAAQ,CAAA,EAAA,CAAG,aAAa,gBAAgB,CAAA,CAAE,UAAU,CAAA;AACzE,EAAA,OAAO,QAAS,CAAA;AAAA,IACd,KAAO,EAAA,KAAA,IAAS,GAAI,CAAA,IAAA,CAAK,KAAS,IAAA,qBAAA;AAAA,IAClC,SAAW,EAAA;AAAA;AAAA;AAAA;AAAA,gBAAA,EAIG,IAAK,CAAA,SAAA,CAAU,GAAK,EAAA,IAAA,EAAM,CAAC,CAAC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,IAM1C,iBAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH;;;AClBO,IAAM,eAAkB,GAAA;AAElB,IAAA,WAAA,GAAc,YAA0B,CAAA,CAAC,OAAY,KAAA;AAChE,EAAA,MAAM,EAAE,MAAS,GAAA,EAAE,IAAM,EAAA,WAAA,IAAkB,GAAA,OAAA;AAE3C,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,eAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,MAAA;AAAA,MACA,IAAA,EAAM,WAAY,CAAA,MAAA,CAAO,IAAI;AAAA,KAC/B;AAAA,IACA,GAAA,EAAK,CAAC,aAAa,CAAA;AAAA,IACnB,MAAM,UAAa,GAAA;AACjB,MAAM,MAAA,CAAC,aAAa,CAAyB,GAAA,aAAA,CAAc,mBAA8B,IAAK,CAAA,OAAA,EAAS,CAAC,aAAa,CAAC,CAAA;AACtH,MAAA,MAAM,GAAM,GAAA,MAAM,aAAc,CAAA,OAAA,CAAQ,MAAO,EAAA;AAE/C,MAAA,MAAM,IAAI,WAAY,EAAA;AAEtB,MAAM,MAAA,IAAA,GAAOA,MAAK,OAAQ,CAAA,IAAA,CAAK,OAAO,IAAM,EAAA,IAAA,CAAK,MAAO,CAAA,MAAA,CAAO,IAAI,CAAA;AACnE,MAAA,MAAM,QAAW,GAAA,MAAM,WAAY,CAAA,GAAA,CAAI,GAAG,CAAA;AAE1C,MAAM,MAAA,IAAA,CAAK,WAAY,CAAA,KAAA,CAAMA,KAAK,CAAA,OAAA,CAAQ,MAAM,MAAO,CAAA,IAAA,IAAQ,aAAa,CAAA,EAAG,QAAQ,CAAA;AAAA;AACzF,GACF;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","import fs from 'node:fs'\nimport path from 'node:path'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\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'\n\nimport { PluginManager, createPlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport { trimExtName } from '@kubb/core/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 name: trimExtName(output.path),\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-redoc",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.7",
|
|
4
4
|
"description": "Beautiful docs with Redoc",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"handlebars": "^4.7.8",
|
|
45
|
-
"@kubb/core": "3.10.
|
|
46
|
-
"@kubb/oas": "3.10.
|
|
47
|
-
"@kubb/plugin-oas": "3.10.
|
|
45
|
+
"@kubb/core": "3.10.7",
|
|
46
|
+
"@kubb/oas": "3.10.7",
|
|
47
|
+
"@kubb/plugin-oas": "3.10.7"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup": "^8.4.0",
|
|
51
51
|
"typescript": "^5.8.3",
|
|
52
|
-
"@kubb/config-ts": "3.10.
|
|
53
|
-
"@kubb/config-tsup": "3.10.
|
|
52
|
+
"@kubb/config-ts": "3.10.7",
|
|
53
|
+
"@kubb/config-tsup": "3.10.7"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@kubb/react": "^3.0.0"
|
package/src/plugin.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PluginManager, createPlugin } from '@kubb/core'
|
|
|
4
4
|
import { pluginOasName } from '@kubb/plugin-oas'
|
|
5
5
|
|
|
6
6
|
import type { Plugin } from '@kubb/core'
|
|
7
|
-
import { trimExtName } from '@kubb/fs'
|
|
7
|
+
import { trimExtName } from '@kubb/core/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'
|