mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-11 05:48:02 +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
|
@ -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