Core: Update image-size to v2

This commit is contained in:
Fuma Nama
2025-02-26 20:59:11 +08:00
parent b3e194e7d8
commit 37dc0a6ec2
17 changed files with 421 additions and 687 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-core': patch
---
Update `image-size` to v2
+7 -7
View File
@@ -31,12 +31,12 @@
"fumadocs-typescript": "workspace:^",
"fumadocs-ui": "workspace:*",
"geist": "^1.3.1",
"hast-util-to-jsx-runtime": "^2.3.3",
"hast-util-to-jsx-runtime": "^2.3.5",
"katex": "^0.16.21",
"lucide-react": "^0.475.0",
"lucide-react": "^0.476.0",
"next": "15.1.7",
"octokit": "^4.1.2",
"oxc-transform": "^0.51.0",
"oxc-transform": "^0.53.0",
"phenomenon": "^1.6.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
@@ -49,7 +49,7 @@
"remark-stringify": "^11.0.0",
"scroll-into-view-if-needed": "^3.1.0",
"shiki": "^3.0.0",
"tailwind-merge": "^3.0.1",
"tailwind-merge": "^3.0.2",
"zod": "^3.24.2"
},
"devDependencies": {
@@ -57,10 +57,10 @@
"@next/bundle-analyzer": "15.1.7",
"@next/env": "15.1.7",
"@next/eslint-plugin-next": "15.1.7",
"@tailwindcss/postcss": "^4.0.7",
"@tailwindcss/postcss": "^4.0.9",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"eslint-config-custom": "workspace:*",
@@ -68,7 +68,7 @@
"gray-matter": "^4.0.3",
"next-validate-link": "^1.4.1",
"postcss": "^8.5.3",
"tailwindcss": "^4.0.7",
"tailwindcss": "^4.0.9",
"tailwindcss-animate": "^1.0.7",
"ts-morph": "^25.0.1",
"tsconfig": "workspace:*",
+2 -2
View File
@@ -22,13 +22,13 @@
"zod": "^3.24.2"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.7",
"@tailwindcss/postcss": "^4.0.9",
"@types/mdx": "^2.0.13",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"postcss": "^8.5.3",
"rimraf": "^6.0.1",
"tailwindcss": "^4.0.7",
"tailwindcss": "^4.0.9",
"typescript": "^5.7.3"
}
}
+4 -4
View File
@@ -25,13 +25,13 @@
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-tailwindcss": "^3.18.0",
"prettier": "^3.5.1",
"prettier": "^3.5.2",
"rimraf": "^6.0.1",
"tsup": "8.3.6",
"turbo": "2.4.2",
"tsup": "8.4.0",
"turbo": "2.4.4",
"typescript": "^5.7.3",
"typescript-eslint": "^8.24.1",
"vitest": "^3.0.6"
"vitest": "^3.0.7"
},
"packageManager": "[email protected]",
"engines": {
+1 -1
View File
@@ -43,7 +43,7 @@
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/react": "^19.0.10",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.3",
+1 -1
View File
@@ -37,7 +37,7 @@
"devDependencies": {
"@content-collections/core": "^0.8.0",
"@content-collections/mdx": "^0.2.0",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"tsconfig": "workspace:*",
+3 -3
View File
@@ -102,8 +102,8 @@
"@shikijs/transformers": "^3.0.0",
"github-slugger": "^2.0.0",
"hast-util-to-estree": "^3.1.2",
"hast-util-to-jsx-runtime": "^2.3.3",
"image-size": "^1.2.0",
"hast-util-to-jsx-runtime": "^2.3.5",
"image-size": "^2.0.0",
"negotiator": "^1.0.0",
"react-remove-scroll": "^2.6.3",
"remark": "^15.0.0",
@@ -121,7 +121,7 @@
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/negotiator": "^0.6.3",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"algoliasearch": "4.24.0",
@@ -2,10 +2,11 @@ import * as path from 'node:path';
import type { Root } from 'mdast';
import type { Transformer } from 'unified';
import { visit } from 'unist-util-visit';
import sizeOf from 'image-size';
import { type ISizeCalculationResult } from 'image-size/dist/types/interface';
import { imageSize } from 'image-size';
import type { MdxjsEsm } from 'mdast-util-mdxjs-esm';
import { resolvePath, slash } from '@/utils/path';
import type { ISizeCalculationResult } from 'image-size/types/interface';
import { imageSizeFromFile } from 'image-size/fromFile';
const VALID_BLUR_EXT = ['.jpeg', '.png', '.webp', '.avif', '.jpg'];
const EXTERNAL_URL_REGEX = /^https?:\/\//;
@@ -211,10 +212,10 @@ async function getImageSize(
base.pathname = resolvePath(base.pathname, src);
url = base.toString();
} else {
return sizeOf(isRelative ? path.join(dir, src) : src);
return imageSizeFromFile(isRelative ? path.join(dir, src) : src);
}
const buffer = await fetch(url).then((res) => res.arrayBuffer());
return sizeOf(new Uint8Array(buffer));
return imageSize(new Uint8Array(buffer));
}
+3 -3
View File
@@ -8,16 +8,16 @@
"@content-collections/core": "^0.8.0",
"@content-collections/mdx": "^0.2.0",
"@content-collections/next": "^0.2.4",
"@tailwindcss/postcss": "^4.0.7",
"@tailwindcss/postcss": "^4.0.9",
"@types/mdx": "^2.0.13",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"next": "15.1.7",
"postcss": "^8.5.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwindcss": "^4.0.7",
"tailwindcss": "^4.0.9",
"typescript": "^5.7.3"
}
}
+1 -1
View File
@@ -33,7 +33,7 @@
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.3",
"tsconfig": "workspace:*"
+2 -2
View File
@@ -32,7 +32,7 @@
"fumadocs-typescript": "workspace:^",
"hast-util-to-estree": "^3.1.2",
"npm-to-yarn": "^3.0.1",
"oxc-transform": "^0.51.0",
"oxc-transform": "^0.53.0",
"unist-util-visit": "^5.0.0",
"zod": "^3.24.2"
},
@@ -41,7 +41,7 @@
"@types/estree": "^1.0.6",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"eslint-config-custom": "workspace:*",
"remark": "^15.0.0",
"tsconfig": "workspace:*",
+1 -1
View File
@@ -38,7 +38,7 @@
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/react": "^19.0.10",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.3",
+5 -5
View File
@@ -61,9 +61,9 @@
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"github-slugger": "^2.0.0",
"hast-util-to-jsx-runtime": "^2.3.3",
"hast-util-to-jsx-runtime": "^2.3.5",
"js-yaml": "^4.1.0",
"lucide-react": "^0.475.0",
"lucide-react": "^0.476.0",
"next-themes": "^0.4.4",
"openapi-sampler": "^1.6.1",
"react-hook-form": "^7.54.2",
@@ -75,14 +75,14 @@
"devDependencies": {
"@scalar/api-client-react": "^1.1.31",
"@types/js-yaml": "^4.0.9",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/openapi-sampler": "^1.0.3",
"@types/react": "^19.0.10",
"eslint-config-custom": "workspace:*",
"next": "15.1.7",
"openapi-types": "^12.1.3",
"tailwindcss": "^4.0.7",
"tsc-alias": "^1.8.10",
"tailwindcss": "^4.0.9",
"tsc-alias": "^1.8.11",
"tsconfig": "workspace:*"
},
"peerDependencies": {
+2 -2
View File
@@ -41,12 +41,12 @@
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-gfm": "^3.1.0",
"mdast-util-to-hast": "^13.2.0",
"tailwind-merge": "^3.0.1"
"tailwind-merge": "^3.0.2"
},
"devDependencies": {
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/react": "^19.0.10",
"eslint-config-custom": "workspace:*",
"fumadocs-ui": "workspace:*",
+2 -2
View File
@@ -36,7 +36,7 @@
},
"dependencies": {
"fast-glob": "^3.3.3",
"hast-util-to-jsx-runtime": "^2.3.3",
"hast-util-to-jsx-runtime": "^2.3.5",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-gfm": "^3.1.0",
"mdast-util-to-hast": "^13.2.0",
@@ -47,7 +47,7 @@
"@types/estree": "^1.0.6",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/node": "22.13.4",
"@types/node": "22.13.5",
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4",
"eslint-config-custom": "workspace:*",
+5 -5
View File
@@ -75,24 +75,24 @@
"@radix-ui/react-tabs": "^1.1.3",
"class-variance-authority": "^0.7.1",
"lodash.merge": "^4.6.2",
"lucide-react": "^0.475.0",
"lucide-react": "^0.476.0",
"next-themes": "^0.4.4",
"postcss-selector-parser": "^7.1.0",
"react-medium-image-zoom": "^5.2.14",
"tailwind-merge": "^3.0.1"
"tailwind-merge": "^3.0.2"
},
"devDependencies": {
"@fumadocs/cli": "workspace:*",
"@next/eslint-plugin-next": "^15.1.7",
"@tailwindcss/cli": "^4.0.7",
"@tailwindcss/cli": "^4.0.9",
"@types/lodash.merge": "^4.6.9",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"next": "15.1.7",
"tailwindcss": "^4.0.7",
"tsc-alias": "^1.8.10",
"tailwindcss": "^4.0.9",
"tsc-alias": "^1.8.11",
"tsconfig": "workspace:*"
},
"peerDependencies": {
+372 -644
View File
File diff suppressed because it is too large Load Diff