@kubb/plugin-redoc 3.16.2 → 3.16.4

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.js CHANGED
@@ -1,57 +1,72 @@
1
- import path3 from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { createPlugin, PluginManager } from '@kubb/core';
4
- import { pluginOasName } from '@kubb/plugin-oas';
5
- import { trimExtName, write } from '@kubb/core/fs';
6
- import fs from 'fs';
7
- import pkg from 'handlebars';
1
+ import path from "node:path";
2
+ import { PluginManager, createPlugin } from "@kubb/core";
3
+ import { pluginOasName } from "@kubb/plugin-oas";
4
+ import { trimExtName, write } from "@kubb/core/fs";
5
+ import { fileURLToPath } from "node:url";
6
+ import fs from "node:fs";
7
+ import pkg from "handlebars";
8
8
 
9
- // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.10_@types+node@20.19.10__jiti@2.5.1_postcss@8.5.6_typescript@5.9.2_yaml@2.7.1/node_modules/tsup/assets/esm_shims.js
10
- var getFilename = () => fileURLToPath(import.meta.url);
11
- var getDirname = () => path3.dirname(getFilename());
12
- var __dirname = /* @__PURE__ */ getDirname();
9
+ //#region rolldown:runtime
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __esm = (fn, res) => function() {
12
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ };
14
+
15
+ //#endregion
16
+ //#region ../../node_modules/.pnpm/tsdown@0.14.1_typescript@5.9.2/node_modules/tsdown/esm-shims.js
17
+ var getFilename, getDirname, __dirname;
18
+ var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.14.1_typescript@5.9.2/node_modules/tsdown/esm-shims.js": (() => {
19
+ getFilename = () => fileURLToPath(import.meta.url);
20
+ getDirname = () => path.dirname(getFilename());
21
+ __dirname = /* @__PURE__ */ getDirname();
22
+ }) });
23
+
24
+ //#endregion
25
+ //#region src/redoc.tsx
26
+ init_esm_shims();
13
27
  async function getPageHTML(api, { title, disableGoogleFont, templateOptions } = {}) {
14
- const templateFileName = path3.join(__dirname, "../static/redoc.hbs");
15
- const template = pkg.compile(fs.readFileSync(templateFileName).toString());
16
- return template({
17
- title: title || api.info.title || "ReDoc documentation",
18
- redocHTML: `
19
- <script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
28
+ const templateFileName = path.join(__dirname, "../static/redoc.hbs");
29
+ const template = pkg.compile(fs.readFileSync(templateFileName).toString());
30
+ return template({
31
+ title: title || api.info.title || "ReDoc documentation",
32
+ redocHTML: `
33
+ <script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> <\/script>
20
34
  <div id="redoc-container"></div>
21
35
  <script>
22
36
  const data = ${JSON.stringify(api, null, 2)};
23
37
  Redoc.init(data, {
24
38
  "expandResponses": "200,400"
25
39
  }, document.getElementById('redoc-container'))
26
- </script>
40
+ <\/script>
27
41
  `,
28
- disableGoogleFont,
29
- templateOptions
30
- });
42
+ disableGoogleFont,
43
+ templateOptions
44
+ });
31
45
  }
32
46
 
33
- // src/plugin.ts
34
- var pluginRedocName = "plugin-redoc";
35
- var pluginRedoc = createPlugin((options) => {
36
- const { output = { path: "docs.html" } } = options;
37
- return {
38
- name: pluginRedocName,
39
- options: {
40
- output,
41
- name: trimExtName(output.path)
42
- },
43
- pre: [pluginOasName],
44
- async buildStart() {
45
- const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
46
- const oas = await swaggerPlugin.context.getOas();
47
- await oas.dereference();
48
- const root = path3.resolve(this.config.root, this.config.output.path);
49
- const pageHTML = await getPageHTML(oas.api);
50
- await write(path3.resolve(root, output.path || "./docs.html"), pageHTML);
51
- }
52
- };
47
+ //#endregion
48
+ //#region src/plugin.ts
49
+ const pluginRedocName = "plugin-redoc";
50
+ const pluginRedoc = createPlugin((options) => {
51
+ const { output = { path: "docs.html" } } = options;
52
+ return {
53
+ name: pluginRedocName,
54
+ options: {
55
+ output,
56
+ name: trimExtName(output.path)
57
+ },
58
+ pre: [pluginOasName],
59
+ async buildStart() {
60
+ const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
61
+ const oas = await swaggerPlugin.context.getOas();
62
+ await oas.dereference();
63
+ const root = path.resolve(this.config.root, this.config.output.path);
64
+ const pageHTML = await getPageHTML(oas.api);
65
+ await write(path.resolve(root, output.path || "./docs.html"), pageHTML);
66
+ }
67
+ };
53
68
  });
54
69
 
70
+ //#endregion
55
71
  export { pluginRedoc, pluginRedocName };
56
- //# sourceMappingURL=index.js.map
57
72
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.10_@types+node@20.19.10__jiti@2.5.1_postcss@8.5.6_typescript@5.9.2_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,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,EA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ename = () => 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"]}
1
+ {"version":3,"file":"index.js","names":["api: OasTypes.OASDocument"],"sources":["../../../node_modules/.pnpm/tsdown@0.14.1_typescript@5.9.2/node_modules/tsdown/esm-shims.js","../src/redoc.tsx","../src/plugin.ts"],"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"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;CAIM,cAAc,MAAM,cAAc,OAAO,KAAK,IAAI;CAClD,aAAa,MAAM,KAAK,QAAQ,aAAa,CAAC;CAEvC,4BAA4B,YAAY;;;;;;ACIrD,eAAsB,YAAYA,KAA2B,EAAE,OAAO,mBAAmB,iBAAmC,GAAG,CAAE,GAAE;CACjI,MAAM,mBAAmB,KAAK,KAAK,WAAW,sBAAsB;CACpE,MAAM,WAAW,IAAI,QAAQ,GAAG,aAAa,iBAAiB,CAAC,UAAU,CAAC;AAC1E,QAAO,SAAS;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW,CAAC;;;;gBAIA,EAAE,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;IAK3C,CAAC;EACD;EACA;CACD,EAAC;AACH;;;;AClBD,MAAa,kBAAkB;AAE/B,MAAa,cAAc,aAA0B,CAAC,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAa,GAAE,GAAG;AAE3C,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;EAC/B;EACD,KAAK,CAAC,aAAc;EACpB,MAAM,aAAa;GACjB,MAAM,CAAC,cAAmC,GAAG,cAAc,mBAA8B,KAAK,SAAS,CAAC,aAAc,EAAC;GACvH,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAEhD,MAAM,IAAI,aAAa;GAEvB,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,WAAW,MAAM,YAAY,IAAI,IAAI;GAE3C,MAAM,MAAM,KAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc,EAAE,SAAS;EACxE;CACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-redoc",
3
- "version": "3.16.2",
3
+ "version": "3.16.4",
4
4
  "description": "Beautiful docs with Redoc",
5
5
  "keywords": [
6
6
  "typescript",
@@ -21,15 +21,13 @@
21
21
  "exports": {
22
22
  ".": {
23
23
  "import": "./dist/index.js",
24
- "require": "./dist/index.cjs",
25
- "default": "./dist/index.cjs"
24
+ "require": "./dist/index.cjs"
26
25
  },
27
- "./package.json": "./package.json",
28
- "./*": "./*"
26
+ "./package.json": "./package.json"
29
27
  },
30
- "main": "dist/index.cjs",
31
- "module": "dist/index.js",
32
- "types": "./dist/index.d.ts",
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.cts",
33
31
  "typesVersions": {
34
32
  "*": {}
35
33
  },
@@ -42,15 +40,14 @@
42
40
  ],
43
41
  "dependencies": {
44
42
  "handlebars": "^4.7.8",
45
- "@kubb/core": "3.16.2",
46
- "@kubb/oas": "3.16.2",
47
- "@kubb/plugin-oas": "3.16.2"
43
+ "@kubb/core": "3.16.4",
44
+ "@kubb/oas": "3.16.4",
45
+ "@kubb/plugin-oas": "3.16.4"
48
46
  },
49
47
  "devDependencies": {
50
- "tsup": "^8.5.0",
48
+ "tsdown": "^0.14.1",
51
49
  "typescript": "^5.9.2",
52
- "@kubb/config-ts": "3.16.2",
53
- "@kubb/config-tsup": "3.16.2"
50
+ "@kubb/config-ts": "3.16.4"
54
51
  },
55
52
  "peerDependencies": {
56
53
  "@kubb/react": "^3.0.0"
@@ -63,13 +60,13 @@
63
60
  "registry": "https://registry.npmjs.org/"
64
61
  },
65
62
  "scripts": {
66
- "build": "tsup",
63
+ "build": "tsdown",
67
64
  "clean": "npx rimraf ./dist",
68
65
  "lint": "bun biome lint .",
69
- "lint:fix": "bun biome lint--fix --unsafe .",
66
+ "lint:fix": "bun biome lint --fix --unsafe .",
70
67
  "release": "pnpm publish --no-git-check",
71
68
  "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
72
- "start": "tsup --watch",
69
+ "start": "tsdown --watch",
73
70
  "test": "vitest --passWithNoTests",
74
71
  "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
75
72
  }