@kubb/plugin-redoc 5.0.0-alpha.29 → 5.0.0-alpha.30

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
@@ -30,6 +30,9 @@ node_fs = __toESM(node_fs);
30
30
  let node_url = require("node:url");
31
31
  let handlebars = require("handlebars");
32
32
  handlebars = __toESM(handlebars);
33
+ //#region package.json
34
+ var version = "5.0.0-alpha.30";
35
+ //#endregion
33
36
  //#region src/redoc.tsx
34
37
  const __filename$1 = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
35
38
  const __dirname$1 = node_path.default.dirname(__filename$1);
@@ -61,16 +64,19 @@ const pluginRedoc = (0, _kubb_core.createPlugin)((options) => {
61
64
  const { output = { path: "docs.html" } } = options;
62
65
  return {
63
66
  name: pluginRedocName,
67
+ version,
64
68
  options: {
65
69
  output,
66
- name: trimExtName(output.path)
70
+ name: trimExtName(output.path),
71
+ exclude: [],
72
+ override: []
67
73
  },
68
- async install() {
74
+ async buildStart() {
69
75
  const adapter = this.adapter;
70
76
  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.`);
71
77
  const document = adapter.document;
72
78
  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.`);
73
- const root = node_path.default.resolve(this.config.root, this.config.output.path);
79
+ const root = this.root;
74
80
  const pageHTML = await getPageHTML(document);
75
81
  await this.addFile({
76
82
  baseName: "docs.html",
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["__filename","__dirname","path","pkg","fs","adapterOasName","path"],"sources":["../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { 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 type { AdapterOas } from '@kubb/adapter-oas'\nimport { adapterOasName } from '@kubb/adapter-oas'\nimport { type Adapter, createPlugin } from '@kubb/core'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = 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 async install() {\n const adapter = this.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(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(document)\n\n await this.addFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n {\n name: 'docs.html',\n value: pageHTML,\n },\n ],\n imports: [],\n exports: [],\n })\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,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,CAAC,CAC1D;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;ACzBJ,SAAS,YAAY,MAAsB;AACzC,QAAO,KAAK,QAAQ,aAAa,GAAG;;AAGtC,MAAa,kBAAkB;AAE/B,MAAa,eAAA,GAAA,WAAA,eAAyC,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;GAC/B;EACD,MAAM,UAAU;GACd,MAAM,UAAU,KAAK;AAErB,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,UAAAA,QAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,WAAW,MAAM,YAAY,SAAS;AAE5C,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,UAAAA,QAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc;IACtD,SAAS,CACP;KACE,MAAM;KACN,OAAO;KACR,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;;EAEL;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["__filename","__dirname","path","pkg","fs","adapterOasName","path"],"sources":["../package.json","../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["","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 type { AdapterOas } from '@kubb/adapter-oas'\nimport { adapterOasName } from '@kubb/adapter-oas'\nimport { type Adapter, createPlugin } from '@kubb/core'\nimport { version } from '../package.json'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = createPlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n version,\n options: {\n output,\n name: trimExtName(output.path),\n exclude: [],\n override: [],\n },\n async buildStart() {\n const adapter = this.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 = this.root\n const pageHTML = await getPageHTML(document)\n\n await this.addFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n {\n name: 'docs.html',\n value: pageHTML,\n },\n ],\n imports: [],\n exports: [],\n })\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,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,CAAC,CAC1D;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;ACxBJ,SAAS,YAAY,MAAsB;AACzC,QAAO,KAAK,QAAQ,aAAa,GAAG;;AAGtC,MAAa,kBAAkB;AAE/B,MAAa,eAAA,GAAA,WAAA,eAAyC,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN;EACA,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;GAC9B,SAAS,EAAE;GACX,UAAU,EAAE;GACb;EACD,MAAM,aAAa;GACjB,MAAM,UAAU,KAAK;AAErB,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,OAAO,KAAK;GAClB,MAAM,WAAW,MAAM,YAAY,SAAS;AAE5C,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMC,UAAAA,QAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc;IACtD,SAAS,CACP;KACE,MAAM;KACN,OAAO;KACR,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;;EAEL;EACD"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
2
  import * as _$_kubb_core0 from "@kubb/core";
3
- import { Output, PluginFactoryOptions } from "@kubb/core";
3
+ import { Exclude, Include, Output, Override, PluginFactoryOptions } from "@kubb/core";
4
4
 
5
5
  //#region src/types.d.ts
6
6
  type Options = {
@@ -15,8 +15,18 @@ type Options = {
15
15
  type ResolveOptions = {
16
16
  output: Output<never>;
17
17
  name: string;
18
+ exclude: Array<Exclude>;
19
+ include?: Array<Include>;
20
+ override: Array<Override<ResolveOptions>>;
18
21
  };
19
22
  type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions, never>;
23
+ declare global {
24
+ namespace Kubb {
25
+ interface PluginRegistry {
26
+ 'plugin-redoc': PluginRedoc;
27
+ }
28
+ }
29
+ }
20
30
  //#endregion
21
31
  //#region src/plugin.d.ts
22
32
  declare const pluginRedocName = "plugin-redoc";
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ import { createPlugin } 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 package.json
9
+ var version = "5.0.0-alpha.30";
10
+ //#endregion
8
11
  //#region src/redoc.tsx
9
12
  const __filename = fileURLToPath(import.meta.url);
10
13
  const __dirname = path.dirname(__filename);
@@ -36,16 +39,19 @@ const pluginRedoc = createPlugin((options) => {
36
39
  const { output = { path: "docs.html" } } = options;
37
40
  return {
38
41
  name: pluginRedocName,
42
+ version,
39
43
  options: {
40
44
  output,
41
- name: trimExtName(output.path)
45
+ name: trimExtName(output.path),
46
+ exclude: [],
47
+ override: []
42
48
  },
43
- async install() {
49
+ async buildStart() {
44
50
  const adapter = this.adapter;
45
51
  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.`);
46
52
  const document = adapter.document;
47
53
  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.`);
48
- const root = path.resolve(this.config.root, this.config.output.path);
54
+ const root = this.root;
49
55
  const pageHTML = await getPageHTML(document);
50
56
  await this.addFile({
51
57
  baseName: "docs.html",
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 { 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 type { AdapterOas } from '@kubb/adapter-oas'\nimport { adapterOasName } from '@kubb/adapter-oas'\nimport { type Adapter, createPlugin } from '@kubb/core'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = 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 async install() {\n const adapter = this.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(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(document)\n\n await this.addFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n {\n name: 'docs.html',\n value: pageHTML,\n },\n ],\n imports: [],\n exports: [],\n })\n },\n }\n})\n"],"mappings":";;;;;;;;AAMA,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,CAAC,CAC1D;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;ACzBJ,SAAS,YAAY,MAAsB;AACzC,QAAO,KAAK,QAAQ,aAAa,GAAG;;AAGtC,MAAa,kBAAkB;AAE/B,MAAa,cAAc,cAA2B,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;GAC/B;EACD,MAAM,UAAU;GACd,MAAM,UAAU,KAAK;AAErB,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,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,WAAW,MAAM,YAAY,SAAS;AAE5C,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc;IACtD,SAAS,CACP;KACE,MAAM;KACN,OAAO;KACR,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;;EAEL;EACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../package.json","../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["","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 type { AdapterOas } from '@kubb/adapter-oas'\nimport { adapterOasName } from '@kubb/adapter-oas'\nimport { type Adapter, createPlugin } from '@kubb/core'\nimport { version } from '../package.json'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = createPlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n version,\n options: {\n output,\n name: trimExtName(output.path),\n exclude: [],\n override: [],\n },\n async buildStart() {\n const adapter = this.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 = this.root\n const pageHTML = await getPageHTML(document)\n\n await this.addFile({\n baseName: 'docs.html',\n path: path.resolve(root, output.path || './docs.html'),\n sources: [\n {\n name: 'docs.html',\n value: pageHTML,\n },\n ],\n imports: [],\n exports: [],\n })\n },\n }\n})\n"],"mappings":";;;;;;;;;;;ACMA,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,CAAC,CAC1D;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;ACxBJ,SAAS,YAAY,MAAsB;AACzC,QAAO,KAAK,QAAQ,aAAa,GAAG;;AAGtC,MAAa,kBAAkB;AAE/B,MAAa,cAAc,cAA2B,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN;EACA,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;GAC9B,SAAS,EAAE;GACX,UAAU,EAAE;GACb;EACD,MAAM,aAAa;GACjB,MAAM,UAAU,KAAK;AAErB,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;GAClB,MAAM,WAAW,MAAM,YAAY,SAAS;AAE5C,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc;IACtD,SAAS,CACP;KACE,MAAM;KACN,OAAO;KACR,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;;EAEL;EACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-redoc",
3
- "version": "5.0.0-alpha.29",
3
+ "version": "5.0.0-alpha.30",
4
4
  "description": "Redoc documentation generator plugin for Kubb, creating beautiful, interactive API documentation from OpenAPI specifications.",
5
5
  "keywords": [
6
6
  "redoc",
@@ -54,8 +54,8 @@
54
54
  "@kubb/fabric-core": "0.15.1",
55
55
  "@kubb/react-fabric": "0.15.1",
56
56
  "handlebars": "^4.7.9",
57
- "@kubb/adapter-oas": "5.0.0-alpha.29",
58
- "@kubb/core": "5.0.0-alpha.29"
57
+ "@kubb/adapter-oas": "5.0.0-alpha.30",
58
+ "@kubb/core": "5.0.0-alpha.30"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@kubb/fabric-core": "0.15.1",
package/src/plugin.ts CHANGED
@@ -2,6 +2,7 @@ import path from 'node:path'
2
2
  import type { AdapterOas } from '@kubb/adapter-oas'
3
3
  import { adapterOasName } from '@kubb/adapter-oas'
4
4
  import { type Adapter, createPlugin } from '@kubb/core'
5
+ import { version } from '../package.json'
5
6
  import { getPageHTML } from './redoc.tsx'
6
7
  import type { PluginRedoc } from './types.ts'
7
8
 
@@ -16,11 +17,14 @@ export const pluginRedoc = createPlugin<PluginRedoc>((options) => {
16
17
 
17
18
  return {
18
19
  name: pluginRedocName,
20
+ version,
19
21
  options: {
20
22
  output,
21
23
  name: trimExtName(output.path),
24
+ exclude: [],
25
+ override: [],
22
26
  },
23
- async install() {
27
+ async buildStart() {
24
28
  const adapter = this.adapter
25
29
 
26
30
  if (adapter?.name !== adapterOasName) {
@@ -37,7 +41,7 @@ export const pluginRedoc = createPlugin<PluginRedoc>((options) => {
37
41
  )
38
42
  }
39
43
 
40
- const root = path.resolve(this.config.root, this.config.output.path)
44
+ const root = this.root
41
45
  const pageHTML = await getPageHTML(document)
42
46
 
43
47
  await this.addFile({
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Output, PluginFactoryOptions } from '@kubb/core'
1
+ import type { Exclude, Include, Output, Override, PluginFactoryOptions } from '@kubb/core'
2
2
 
3
3
  export type Options = {
4
4
  output?: {
@@ -13,6 +13,17 @@ export type Options = {
13
13
  type ResolveOptions = {
14
14
  output: Output<never>
15
15
  name: string
16
+ exclude: Array<Exclude>
17
+ include?: Array<Include>
18
+ override: Array<Override<ResolveOptions>>
16
19
  }
17
20
 
18
21
  export type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions, never>
22
+
23
+ declare global {
24
+ namespace Kubb {
25
+ interface PluginRegistry {
26
+ 'plugin-redoc': PluginRedoc
27
+ }
28
+ }
29
+ }