You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@fastify/swagger-ui

Package Overview
Dependencies
Maintainers
18
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 3.0.0

.tap/processinfo/07d4e603-d36a-479e-99a5-705046db912b.json

33

lib/swagger-initializer.js

@@ -10,2 +10,22 @@ 'use strict'

return `window.onload = function () {
function waitForElement(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
observer.disconnect();
resolve(document.querySelector(selector));
}
});
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
function resolveUrl(url) {

@@ -39,8 +59,9 @@ const anchor = document.createElement('a')

if (logoData && resConfig.layout === 'StandaloneLayout') {
const link = document.querySelector('#swagger-ui > section > div.topbar > div > div > a')
const img = document.createElement('img')
img.height = 40
img.src = logoData
link.innerHTML = ''
link.appendChild(img)
waitForElement('#swagger-ui > section > div.topbar > div > div > a').then((link) => {
const img = document.createElement('img')
img.height = 40
img.src = logoData
link.innerHTML = ''
link.appendChild(img)
})
}

@@ -47,0 +68,0 @@

9

package.json
{
"name": "@fastify/swagger-ui",
"version": "2.1.0",
"version": "3.0.0",
"description": "Serve Swagger-ui for Fastify",

@@ -55,2 +55,3 @@ "main": "index.js",

"@playwright/test": "^1.39.0",
"@tapjs/snapshot": "^1.2.17",
"@types/node": "^20.1.1",

@@ -62,8 +63,8 @@ "ajv": "^8.11.0",

"standard": "^17.0.0",
"swagger-ui-dist": "5.10.5",
"tap": "^16.3.2",
"swagger-ui-dist": "5.11.2",
"tap": "^18.6.1",
"tsd": "^0.30.0"
},
"dependencies": {
"@fastify/static": "^6.0.0",
"@fastify/static": "^7.0.0",
"fastify-plugin": "^4.0.0",

@@ -70,0 +71,0 @@ "openapi-types": "^12.0.2",

@@ -9,4 +9,2 @@ # @fastify/swagger-ui

Supports Fastify versions `4.x`.
![Demo](https://user-images.githubusercontent.com/52195/228162405-c85ad0d1-900d-442a-b712-7108d98d621f.png)

@@ -20,2 +18,9 @@

### Compatibility
| Plugin version | Fastify version | Swagger Plugin Version |
| -------------- | --------------- | ---------------------- |
| `^2.0.0` | `^4.0.0` | `^8.0.0` |
| `^1.0.0` | `^4.0.0` | `^8.0.0` |
<a name="usage"></a>

@@ -22,0 +27,0 @@ ## Usage

@@ -19,12 +19,17 @@ 'use strict'

'swagger-ui-bundle.js',
'swagger-ui-bundle.js.map',
'swagger-ui-standalone-preset.js',
'swagger-ui-standalone-preset.js.map',
'swagger-ui.css',
'swagger-ui.css.map',
'swagger-ui.js',
'swagger-ui.js.map'
'swagger-ui.js'
]
filesToCopy.forEach(filename => {
fse.copySync(`${swaggerUiAssetPath}/${filename}`, resolve(`./static/${filename}`))
fse.ensureFileSync(resolve(`./static/${filename}`))
const readableStream = fs.createReadStream(`${swaggerUiAssetPath}/${filename}`, 'utf8')
const writableStream = fs.createWriteStream(resolve(`./static/${filename}`))
// Matches sourceMappingURL comments in .js and .css files
const sourceMapRegex = new RegExp(String.raw`\/.# sourceMappingURL=${filename}.map(\*\/)?$`)
readableStream.on('data', (chunk) => {
// Copy file while removing sourceMappingURL comments
writableStream.write(chunk.replace(sourceMapRegex, ''))
})
})

@@ -31,0 +36,0 @@

@@ -1,1 +0,1 @@

{"script":["'sha256-4IiDsMH+GkJlxivIDNfi6qk0O5HPtzyvNwVT3Wt8TIw='"],"style":[]}
{"script":[],"style":[]}

@@ -135,3 +135,6 @@ 'use strict'

t.strictSame(fastify.swagger(), JSON.parse(res.body))
const swagger = fastify.swagger()
Object.getOwnPropertySymbols(swagger.definitions.User).forEach((symbol) => delete swagger.definitions.User[symbol])
t.strictSame(swagger, JSON.parse(res.body))
})

@@ -138,0 +141,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc