UNPKG

@elysiajs/swagger

Version:

Plugin for Elysia to auto-generate Swagger page

66 lines (64 loc) 2 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/scalar/index.ts var scalar_exports = {}; __export(scalar_exports, { ScalarRender: () => ScalarRender }); module.exports = __toCommonJS(scalar_exports); var import_themes = require("@scalar/themes"); var ScalarRender = (info, version, config, cdn) => `<!doctype html> <html> <head> <title>${info.title}</title> <meta name="description" content="${info.description}" /> <meta name="og:description" content="${info.description}" /> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style> body { margin: 0; } </style> <style> ${config.customCss ?? import_themes.elysiajsTheme} </style> </head> <body> <script id="api-reference" data-url="${config.spec?.url}" data-configuration='${JSON.stringify(config)}' > </script> <script src="${cdn ? cdn : `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${version}/dist/browser/standalone.min.js`}" crossorigin></script> </body> </html>`; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ScalarRender });