@docusaurus/plugin-ideal-image 0.0.0-5044 → 0.0.0-5049

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,8 +89,8 @@ export default function IdealImage(props) {
89
89
  {...props}
90
90
  alt={alt}
91
91
  className={className}
92
- height={img.src.height || 100}
93
- width={img.src.width || 100}
92
+ height={img.src.height ?? 100}
93
+ width={img.src.width ?? 100}
94
94
  placeholder={{lqip: img.preSrc}}
95
95
  src={img.src.src}
96
96
  srcSet={img.src.images.map((image) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-ideal-image",
3
- "version": "0.0.0-5044",
3
+ "version": "0.0.0-5049",
4
4
  "description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-ideal-image.d.ts",
@@ -20,11 +20,11 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@docusaurus/core": "0.0.0-5044",
24
- "@docusaurus/lqip-loader": "0.0.0-5044",
23
+ "@docusaurus/core": "0.0.0-5049",
24
+ "@docusaurus/lqip-loader": "0.0.0-5049",
25
25
  "@docusaurus/responsive-loader": "^1.7.0",
26
- "@docusaurus/theme-translations": "0.0.0-5044",
27
- "@docusaurus/utils-validation": "0.0.0-5044",
26
+ "@docusaurus/theme-translations": "0.0.0-5049",
27
+ "@docusaurus/utils-validation": "0.0.0-5049",
28
28
  "@endiliey/react-ideal-image": "^0.0.11",
29
29
  "react-waypoint": "^10.1.0",
30
30
  "sharp": "^0.30.4",
@@ -32,8 +32,8 @@
32
32
  "webpack": "^5.72.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@docusaurus/module-type-aliases": "0.0.0-5044",
36
- "@docusaurus/types": "0.0.0-5044",
35
+ "@docusaurus/module-type-aliases": "0.0.0-5049",
36
+ "@docusaurus/types": "0.0.0-5049",
37
37
  "fs-extra": "^10.1.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -49,5 +49,5 @@
49
49
  "engines": {
50
50
  "node": ">=14"
51
51
  },
52
- "gitHead": "9ffd6ca265dc2af7ed5b96daf5ebf32708e899cf"
52
+ "gitHead": "527b2a01c46b67483327a1a6873fccf81bc19e2c"
53
53
  }
package/src/index.ts CHANGED
@@ -80,7 +80,7 @@ export function validateOptions({
80
80
  validate,
81
81
  options,
82
82
  }: OptionValidationContext<PluginOptions, PluginOptions>): PluginOptions {
83
- const pluginOptionsSchema = Joi.object({
83
+ const pluginOptionsSchema = Joi.object<PluginOptions>({
84
84
  disableInDev: Joi.boolean().default(true),
85
85
  }).unknown();
86
86
  return validate(pluginOptionsSchema, options);
@@ -22,9 +22,9 @@ function bytesToSize(bytes: number) {
22
22
  }
23
23
  const scale = Math.floor(Math.log(bytes) / Math.log(1024));
24
24
  if (scale === 0) {
25
- return `${bytes} ${sizes[scale]}`;
25
+ return `${bytes} ${sizes[scale]!}`;
26
26
  }
27
- return `${(bytes / 1024 ** scale).toFixed(1)} ${sizes[scale]}`;
27
+ return `${(bytes / 1024 ** scale).toFixed(1)} ${sizes[scale]!}`;
28
28
  }
29
29
 
30
30
  // Adopted from https://github.com/endiliey/react-ideal-image/blob/master/src/components/IdealImage/index.js#L43-L75
@@ -100,8 +100,8 @@ export default function IdealImage(props: Props): JSX.Element {
100
100
  {...props}
101
101
  alt={alt}
102
102
  className={className}
103
- height={img.src.height || 100}
104
- width={img.src.width || 100}
103
+ height={img.src.height ?? 100}
104
+ width={img.src.width ?? 100}
105
105
  placeholder={{lqip: img.preSrc}}
106
106
  src={img.src.src}
107
107
  srcSet={img.src.images.map((image) => ({