@kubb/plugin-redoc 3.15.1 → 3.16.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/index.cjs CHANGED
@@ -51,7 +51,7 @@ var pluginRedoc = core.createPlugin((options) => {
51
51
  await oas.dereference();
52
52
  const root = path2__default.default.resolve(this.config.root, this.config.output.path);
53
53
  const pageHTML = await getPageHTML(oas.api);
54
- await this.fileManager.write(path2__default.default.resolve(root, output.path || "./docs.html"), pageHTML);
54
+ await fs.write(path2__default.default.resolve(root, output.path || "./docs.html"), pageHTML);
55
55
  }
56
56
  };
57
57
  });
@@ -1 +1 @@
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,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,GAAcC,iBAA0B,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,EAAMC,cAAY,CAAA,MAAA,CAAO,IAAI;AAAA,KAC/B;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;AACtH,MAAA,MAAM,GAAM,GAAA,MAAM,aAAc,CAAA,OAAA,CAAQ,MAAO,EAAA;AAE/C,MAAA,MAAM,IAAI,WAAY,EAAA;AAEtB,MAAM,MAAA,IAAA,GAAOL,uBAAK,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,sBAAK,CAAA,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"]}
1
+ {"version":3,"sources":["../src/redoc.tsx","../src/plugin.ts"],"names":["path","pkg","fs","createPlugin","trimExtName","pluginOasName","PluginManager","write"],"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,mBAA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,uBAAK,OAAQ,CAAA,IAAA,EAAM,OAAO,IAAQ,IAAA,aAAa,GAAG,QAAQ,CAAA;AAAA;AACxE,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, write } 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 write(path.resolve(root, output.path || './docs.html'), pageHTML)\n },\n }\n})\n"]}
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import path3 from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  import { createPlugin, PluginManager } from '@kubb/core';
4
4
  import { pluginOasName } from '@kubb/plugin-oas';
5
- import { trimExtName } from '@kubb/core/fs';
5
+ import { trimExtName, write } from '@kubb/core/fs';
6
6
  import fs from 'fs';
7
7
  import pkg from 'handlebars';
8
8
 
9
- // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.8_@types+node@20.19.6__jiti@2.4.2_postcss@8.5.6_typescript@5.8.3_yaml@2.7.1/node_modules/tsup/assets/esm_shims.js
9
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.8_@types+node@20.19.8__jiti@2.4.2_postcss@8.5.6_typescript@5.8.3_yaml@2.7.1/node_modules/tsup/assets/esm_shims.js
10
10
  var getFilename = () => fileURLToPath(import.meta.url);
11
11
  var getDirname = () => path3.dirname(getFilename());
12
12
  var __dirname = /* @__PURE__ */ getDirname();
@@ -47,7 +47,7 @@ var pluginRedoc = createPlugin((options) => {
47
47
  await oas.dereference();
48
48
  const root = path3.resolve(this.config.root, this.config.output.path);
49
49
  const pageHTML = await getPageHTML(oas.api);
50
- await this.fileManager.write(path3.resolve(root, output.path || "./docs.html"), pageHTML);
50
+ await write(path3.resolve(root, output.path || "./docs.html"), pageHTML);
51
51
  }
52
52
  };
53
53
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.8_@types+node@20.19.6__jiti@2.4.2_postcss@8.5.6_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,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Aa,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 path from 'node:path'\nimport { fileURLToPath } from 'node:url'\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"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.8_@types+node@20.19.8__jiti@2.4.2_postcss@8.5.6_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,MAAMA,KAAK,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,MA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1C,MAAM,MAAA,KAAA,CAAMA,MAAK,OAAQ,CAAA,IAAA,EAAM,OAAO,IAAQ,IAAA,aAAa,GAAG,QAAQ,CAAA;AAAA;AACxE,GACF;AACF,CAAC","file":"index.js","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\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, write } 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 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.15.1",
3
+ "version": "3.16.1",
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.15.1",
46
- "@kubb/oas": "3.15.1",
47
- "@kubb/plugin-oas": "3.15.1"
45
+ "@kubb/core": "3.16.1",
46
+ "@kubb/oas": "3.16.1",
47
+ "@kubb/plugin-oas": "3.16.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "tsup": "^8.5.0",
51
51
  "typescript": "^5.8.3",
52
- "@kubb/config-ts": "3.15.1",
53
- "@kubb/config-tsup": "3.15.1"
52
+ "@kubb/config-ts": "3.16.1",
53
+ "@kubb/config-tsup": "3.16.1"
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/core/fs'
7
+ import { trimExtName, write } 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'
@@ -30,7 +30,7 @@ export const pluginRedoc = createPlugin<PluginRedoc>((options) => {
30
30
  const root = path.resolve(this.config.root, this.config.output.path)
31
31
  const pageHTML = await getPageHTML(oas.api)
32
32
 
33
- await this.fileManager.write(path.resolve(root, output.path || './docs.html'), pageHTML)
33
+ await write(path.resolve(root, output.path || './docs.html'), pageHTML)
34
34
  },
35
35
  }
36
36
  })