@nestjs/swagger
Advanced tools
Comparing version 6.1.3 to 6.1.4
@@ -7,5 +7,5 @@ import { SwaggerUiOptions } from './swagger-ui-options.interface'; | ||
customCss?: string; | ||
customCssUrl?: string; | ||
customJs?: string; | ||
customJsStr?: string; | ||
customCssUrl?: string | string[]; | ||
customJs?: string | string[]; | ||
customJsStr?: string | string[]; | ||
customfavIcon?: string; | ||
@@ -12,0 +12,0 @@ swaggerUrl?: string; |
@@ -25,6 +25,26 @@ "use strict"; | ||
exports.getSwaggerAssetsAbsoluteFSPath = getSwaggerAssetsAbsoluteFSPath; | ||
function toExternalScriptTag(url) { | ||
return `<script src='${url}'></script>`; | ||
} | ||
function toInlineScriptTag(jsCode) { | ||
return `<script>${jsCode}</script>`; | ||
} | ||
function toExternalStylesheetTag(url) { | ||
return `<link href='${url}' rel='stylesheet'>`; | ||
} | ||
function toTags(customCode, toScript) { | ||
if (!customCode) { | ||
return ''; | ||
} | ||
if (typeof customCode === 'string') { | ||
return toScript(customCode); | ||
} | ||
else { | ||
return customCode.map(toScript).join('\n'); | ||
} | ||
} | ||
function buildSwaggerHTML(baseUrl, swaggerDoc, customOptions = {}) { | ||
const { customCss = '', customJs = '', customJsStr = '', customfavIcon = false, customSiteTitle = 'Swagger UI', customCssUrl = '', explorer = false } = customOptions; | ||
const favIconString = customfavIcon | ||
? `<link rel="icon" href="${customfavIcon}" />` | ||
? `<link rel='icon' href='${customfavIcon}' />` | ||
: constants_1.favIconHtml; | ||
@@ -39,7 +59,7 @@ const explorerCss = explorer | ||
.replace(/<% baseUrl %>/g, baseUrl) | ||
.replace('<% customJs %>', customJs ? `<script src="${customJs}"></script>` : '') | ||
.replace('<% customJsStr %>', customJsStr ? `<script> ${customJsStr} </script>` : '') | ||
.replace('<% customCssUrl %>', customCssUrl ? `<link href="${customCssUrl}" rel="stylesheet">` : '') | ||
.replace('<% customJs %>', toTags(customJs, toExternalScriptTag)) | ||
.replace('<% customJsStr %>', toTags(customJsStr, toInlineScriptTag)) | ||
.replace('<% customCssUrl %>', toTags(customCssUrl, toExternalStylesheetTag)) | ||
.replace('<% title %>', customSiteTitle); | ||
} | ||
exports.buildSwaggerHTML = buildSwaggerHTML; |
{ | ||
"name": "@nestjs/swagger", | ||
"version": "6.1.3", | ||
"version": "6.1.4", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@swagger)", | ||
@@ -31,35 +31,35 @@ "author": "Kamil Mysliwiec", | ||
"path-to-regexp": "3.2.0", | ||
"swagger-ui-dist": "4.15.1" | ||
"swagger-ui-dist": "4.15.5" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "17.1.2", | ||
"@commitlint/config-angular": "17.1.0", | ||
"@fastify/static": "6.5.0", | ||
"@nestjs/common": "9.1.6", | ||
"@nestjs/core": "9.1.6", | ||
"@nestjs/platform-express": "9.1.6", | ||
"@nestjs/platform-fastify": "9.1.6", | ||
"@types/jest": "29.2.0", | ||
"@commitlint/cli": "17.3.0", | ||
"@commitlint/config-angular": "17.3.0", | ||
"@fastify/static": "6.6.0", | ||
"@nestjs/common": "9.2.1", | ||
"@nestjs/core": "9.2.1", | ||
"@nestjs/platform-express": "9.2.1", | ||
"@nestjs/platform-fastify": "9.2.1", | ||
"@types/jest": "29.2.4", | ||
"@types/js-yaml": "4.0.5", | ||
"@types/lodash": "4.14.186", | ||
"@types/node": "18.11.5", | ||
"@typescript-eslint/eslint-plugin": "5.41.0", | ||
"@typescript-eslint/parser": "5.41.0", | ||
"@types/lodash": "4.14.191", | ||
"@types/node": "18.11.11", | ||
"@typescript-eslint/eslint-plugin": "5.45.1", | ||
"@typescript-eslint/parser": "5.45.1", | ||
"class-transformer": "0.5.1", | ||
"class-validator": "0.13.2", | ||
"eslint": "8.26.0", | ||
"eslint": "8.29.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"express": "4.18.2", | ||
"husky": "8.0.1", | ||
"jest": "29.2.2", | ||
"lint-staged": "13.0.3", | ||
"husky": "8.0.2", | ||
"jest": "29.3.1", | ||
"lint-staged": "13.1.0", | ||
"openapi-types": "12.0.2", | ||
"prettier": "2.7.1", | ||
"prettier": "2.8.0", | ||
"reflect-metadata": "0.1.13", | ||
"release-it": "15.5.0", | ||
"supertest": "6.3.1", | ||
"release-it": "15.5.1", | ||
"supertest": "6.3.2", | ||
"swagger-parser": "10.0.3", | ||
"ts-jest": "29.0.3", | ||
"typescript": "4.8.4" | ||
"typescript": "4.9.3" | ||
}, | ||
@@ -70,2 +70,4 @@ "peerDependencies": { | ||
"@nestjs/core": "^9.0.0", | ||
"class-transformer": "*", | ||
"class-validator": "*", | ||
"reflect-metadata": "^0.1.12" | ||
@@ -76,2 +78,8 @@ }, | ||
"optional": true | ||
}, | ||
"class-transformer": { | ||
"optional": true | ||
}, | ||
"class-validator": { | ||
"optional": true | ||
} | ||
@@ -78,0 +86,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
279354
5631
11
+ Added@types/validator@13.12.2(transitive)
+ Addedclass-transformer@0.5.1(transitive)
+ Addedclass-validator@0.14.1(transitive)
+ Addedlibphonenumber-js@1.11.11(transitive)
+ Addedswagger-ui-dist@4.15.5(transitive)
+ Addedvalidator@13.12.0(transitive)
- Removedswagger-ui-dist@4.15.1(transitive)
Updatedswagger-ui-dist@4.15.5