]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Bump `image-size` from 1.0.2 to 2.0.2 (#41384)
authorJulien Déramond <juderamond@gmail.com>
Tue, 15 Apr 2025 19:18:13 +0000 (21:18 +0200)
committerGitHub <noreply@github.com>
Tue, 15 Apr 2025 19:18:13 +0000 (21:18 +0200)
package-lock.json
package.json
site/src/components/head/Social.astro
site/src/libs/image.ts

index b4d2ec27a12b96612ccaaf727b1504f02d3f5127..61a68c6891e80168c2ff27bae67e6f8593710fc5 100644 (file)
@@ -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",
       "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"
       },
         "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",
index 215d0e8e751841c86054d7f362e8888c379e600c..ed9a31ab02515e4664210d7786bb73ef4106e9cc 100644 (file)
     "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",
index 2e423c7bb317c124058aecc261a4dca316a4ac1c..8f02f86fb430afc5ae22cbe116d0a40bd9f5a1ca 100644 (file)
@@ -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" />
index 7de95db501f6681f86381eea4aeddf7f0da99977..79352227034ee6ca77badc72e75ae38e01048f74 100644 (file)
@@ -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}'.`)
   }