@docusaurus/plugin-ideal-image 3.7.0-canary-6319 → 3.7.0-canary-6320

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.
@@ -86,7 +86,7 @@ export const bytesToSize = (bytes) => {
86
86
  const detectWebpSupport = () => {
87
87
  if (ssr) return false;
88
88
  const elem = document.createElement('canvas');
89
- if (elem.getContext && elem.getContext('2d')) {
89
+ if (elem.getContext?.('2d')) {
90
90
  // was able or not to get WebP representation
91
91
  return elem.toDataURL('image/webp').indexOf('data:image/webp') === 0;
92
92
  } else {
@@ -97,8 +97,7 @@ const detectWebpSupport = () => {
97
97
 
98
98
  export const supportsWebp = detectWebpSupport();
99
99
 
100
- const isWebp = (x) =>
101
- x.format === 'webp' || (x.src && x.src.match(/\.webp($|\?.*)/i));
100
+ const isWebp = (x) => x.format === 'webp' || x.src?.match(/\.webp($|\?.*)/i);
102
101
 
103
102
  // eslint-disable-next-line no-shadow
104
103
  export const selectSrc = ({srcSet, maxImageWidth, supportsWebp}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-ideal-image",
3
- "version": "3.7.0-canary-6319",
3
+ "version": "3.7.0-canary-6320",
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,18 +20,18 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@docusaurus/core": "3.7.0-canary-6319",
24
- "@docusaurus/lqip-loader": "3.7.0-canary-6319",
23
+ "@docusaurus/core": "3.7.0-canary-6320",
24
+ "@docusaurus/lqip-loader": "3.7.0-canary-6320",
25
25
  "@docusaurus/responsive-loader": "^1.7.0",
26
- "@docusaurus/theme-translations": "3.7.0-canary-6319",
27
- "@docusaurus/types": "3.7.0-canary-6319",
28
- "@docusaurus/utils-validation": "3.7.0-canary-6319",
26
+ "@docusaurus/theme-translations": "3.7.0-canary-6320",
27
+ "@docusaurus/types": "3.7.0-canary-6320",
28
+ "@docusaurus/utils-validation": "3.7.0-canary-6320",
29
29
  "sharp": "^0.32.3",
30
30
  "tslib": "^2.6.0",
31
31
  "webpack": "^5.88.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@docusaurus/module-type-aliases": "3.7.0-canary-6319",
34
+ "@docusaurus/module-type-aliases": "3.7.0-canary-6320",
35
35
  "fs-extra": "^11.1.0"
36
36
  },
37
37
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "engines": {
48
48
  "node": ">=18.0"
49
49
  },
50
- "gitHead": "9722ff10706018e5c5d95c7860fce53f9cd1a235"
50
+ "gitHead": "bc5c442d335b70448f1ab9af980dafd687d2c098"
51
51
  }
@@ -86,7 +86,7 @@ export const bytesToSize = (bytes) => {
86
86
  const detectWebpSupport = () => {
87
87
  if (ssr) return false;
88
88
  const elem = document.createElement('canvas');
89
- if (elem.getContext && elem.getContext('2d')) {
89
+ if (elem.getContext?.('2d')) {
90
90
  // was able or not to get WebP representation
91
91
  return elem.toDataURL('image/webp').indexOf('data:image/webp') === 0;
92
92
  } else {
@@ -97,8 +97,7 @@ const detectWebpSupport = () => {
97
97
 
98
98
  export const supportsWebp = detectWebpSupport();
99
99
 
100
- const isWebp = (x) =>
101
- x.format === 'webp' || (x.src && x.src.match(/\.webp($|\?.*)/i));
100
+ const isWebp = (x) => x.format === 'webp' || x.src?.match(/\.webp($|\?.*)/i);
102
101
 
103
102
  // eslint-disable-next-line no-shadow
104
103
  export const selectSrc = ({srcSet, maxImageWidth, supportsWebp}) => {