mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-04 20:02:54 +02:00
chore: upgrade image-size deps to v2 (#11065)
* upgrade image-size to v2 * fix resizeImage script * fix tests
This commit is contained in:
parent
31b279fea6
commit
b7ba0b54fb
7 changed files with 14 additions and 24 deletions
|
@ -27,7 +27,7 @@
|
|||
"estree-util-value-to-estree": "^3.0.1",
|
||||
"file-loader": "^6.2.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
"image-size": "^1.0.2",
|
||||
"image-size": "^2.0.2",
|
||||
"mdast-util-mdx": "^3.0.0",
|
||||
"mdast-util-to-string": "^4.0.0",
|
||||
"rehype-raw": "^7.0.0",
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import path from 'path';
|
||||
import url from 'url';
|
||||
import fs from 'fs-extra';
|
||||
import {promisify} from 'util';
|
||||
import {
|
||||
toMessageRelativeFilePath,
|
||||
posixPath,
|
||||
|
@ -17,7 +16,7 @@ import {
|
|||
getFileLoaderUtils,
|
||||
} from '@docusaurus/utils';
|
||||
import escapeHtml from 'escape-html';
|
||||
import sizeOf from 'image-size';
|
||||
import {imageSizeFromFile} from 'image-size/fromFile';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {assetRequireAttributeValue, transformNode} from '../utils';
|
||||
import type {Plugin, Transformer} from 'unified';
|
||||
|
@ -80,7 +79,7 @@ async function toImageRequireNode(
|
|||
}
|
||||
|
||||
try {
|
||||
const size = (await promisify(sizeOf)(imagePath))!;
|
||||
const size = (await imageSizeFromFile(imagePath))!;
|
||||
if (size.width) {
|
||||
attributes.push({
|
||||
type: 'mdxJsxAttribute',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue