mirror of https://github.com/twbs/bootstrap.git
Bump `image-size` from 1.0.2 to 2.0.2 (#41384)
BrowserStack / browserstack (push) Has been cancelled
Details
Bundlewatch / bundlewatch (push) Has been cancelled
Details
cspell / cspell (push) Has been cancelled
Details
CSS / css (push) Has been cancelled
Details
Docs / docs (push) Has been cancelled
Details
JS Tests / JS Tests (push) Has been cancelled
Details
Lint / lint (push) Has been cancelled
Details
CSS (node-sass) / css (push) Has been cancelled
Details
Release notes / update_release_draft (push) Has been cancelled
Details
CodeQL / Analyze (push) Has been cancelled
Details
BrowserStack / browserstack (push) Has been cancelled
Details
Bundlewatch / bundlewatch (push) Has been cancelled
Details
cspell / cspell (push) Has been cancelled
Details
CSS / css (push) Has been cancelled
Details
Docs / docs (push) Has been cancelled
Details
JS Tests / JS Tests (push) Has been cancelled
Details
Lint / lint (push) Has been cancelled
Details
CSS (node-sass) / css (push) Has been cancelled
Details
Release notes / update_release_draft (push) Has been cancelled
Details
CodeQL / Analyze (push) Has been cancelled
Details
This commit is contained in:
parent
d01e66f5f7
commit
ed36faae9d
|
@ -56,7 +56,7 @@
|
|||
"globby": "^14.1.0",
|
||||
"hammer-simulator": "0.0.1",
|
||||
"htmlparser2": "^10.0.0",
|
||||
"image-size": "^1.0.2",
|
||||
"image-size": "^2.0.2",
|
||||
"ip": "^2.0.1",
|
||||
"jasmine": "^5.6.0",
|
||||
"jquery": "^3.7.1",
|
||||
|
@ -9450,14 +9450,11 @@
|
|||
"license": "ISC"
|
||||
},
|
||||
"node_modules/image-size": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-1.2.0.tgz",
|
||||
"integrity": "sha512-4S8fwbO6w3GeCVN6OPtA9I5IGKkcDMPcKndtUlpJuCwu7JLjtj7JZpwqLuyY2nrmQT3AWsCJLSKPsc2mPBSl3w==",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-2.0.2.tgz",
|
||||
"integrity": "sha512-IRqXKlaXwgSMAMtpNzZa1ZAe8m+Sa1770Dhk8VkSsP9LS+iHD62Zd8FQKs8fbPiagBE7BzoFX23cxFnwshpV6w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"queue": "6.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"image-size": "bin/image-size.js"
|
||||
},
|
||||
|
@ -14949,16 +14946,6 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/queue": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
|
||||
"integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"inherits": "~2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/queue-microtask": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
"globby": "^14.1.0",
|
||||
"hammer-simulator": "0.0.1",
|
||||
"htmlparser2": "^10.0.0",
|
||||
"image-size": "^1.0.2",
|
||||
"image-size": "^2.0.2",
|
||||
"ip": "^2.0.1",
|
||||
"jasmine": "^5.6.0",
|
||||
"jquery": "^3.7.1",
|
||||
|
|
|
@ -14,7 +14,7 @@ interface Props {
|
|||
const { description, layout, thumbnail, title } = Astro.props
|
||||
|
||||
const socialImageUrl = new URL(getVersionedDocsPath(`assets/${thumbnail}`), Astro.site)
|
||||
const socialImageSize = getStaticImageSize(`/docs/[version]/assets/${thumbnail}`)
|
||||
const socialImageSize = await getStaticImageSize(`/docs/[version]/assets/${thumbnail}`)
|
||||
---
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import path from 'node:path'
|
||||
import { promises as fs } from 'node:fs'
|
||||
import sizeOf from 'image-size'
|
||||
import { getDocsStaticFsPath } from './path'
|
||||
|
||||
export function getStaticImageSize(imagePath: string) {
|
||||
const size = sizeOf(path.join(getDocsStaticFsPath(), imagePath))
|
||||
export async function getStaticImageSize(imagePath: string) {
|
||||
const fullPath = path.join(getDocsStaticFsPath(), imagePath)
|
||||
const buffer = await fs.readFile(fullPath)
|
||||
const size = await sizeOf(buffer)
|
||||
|
||||
if (!size.height || !size.width) {
|
||||
if (!size?.height || !size?.width) {
|
||||
throw new Error(`Failed to get size of static image at '${imagePath}'.`)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue