@docusaurus/plugin-ideal-image 3.8.0 → 3.8.1

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.
@@ -119,7 +119,7 @@ export default class IdealImage extends Component {
119
119
 
120
120
  /*
121
121
  static propTypes = {
122
- /!** how much to wait in ms until concider download to slow *!/
122
+ /!** how much to wait in ms until consider download to slow *!/
123
123
  threshold: PropTypes.number,
124
124
  /!** function to generate src based on width and format *!/
125
125
  getUrl: PropTypes.func,
@@ -9,7 +9,7 @@
9
9
  * and return as `style` property.
10
10
  *
11
11
  * Usage:
12
- * Asume you have `theme` object, which can be css-module
12
+ * Assume you have `theme` object, which can be css-module
13
13
  * or object or other css-in-js compatible with css-module
14
14
  *
15
15
  * <a {...compose(theme.link, theme.active, {color: "#000"})}>link</a>
@@ -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}) => {
@@ -6,7 +6,7 @@ export class UnfetchAbortController {
6
6
  }
7
7
 
8
8
  // modified version of https://github.com/developit/unfetch
9
- // - ponyfill intead of polyfill
9
+ // - ponyfill instead of polyfill
10
10
  // - add support for AbortController
11
11
  export const unfetch = (url, options) => {
12
12
  options = options || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-ideal-image",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
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.8.0",
24
- "@docusaurus/lqip-loader": "3.8.0",
23
+ "@docusaurus/core": "3.8.1",
24
+ "@docusaurus/lqip-loader": "3.8.1",
25
25
  "@docusaurus/responsive-loader": "^1.7.0",
26
- "@docusaurus/theme-translations": "3.8.0",
27
- "@docusaurus/types": "3.8.0",
28
- "@docusaurus/utils-validation": "3.8.0",
26
+ "@docusaurus/theme-translations": "3.8.1",
27
+ "@docusaurus/types": "3.8.1",
28
+ "@docusaurus/utils-validation": "3.8.1",
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.8.0",
34
+ "@docusaurus/module-type-aliases": "3.8.1",
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": "948d63c42fad0ba24b7b531a9deb6167e64dc845"
50
+ "gitHead": "fa8ae13e668fcbc0481ce10c0a734e2a5b397293"
51
51
  }
@@ -119,7 +119,7 @@ export default class IdealImage extends Component {
119
119
 
120
120
  /*
121
121
  static propTypes = {
122
- /!** how much to wait in ms until concider download to slow *!/
122
+ /!** how much to wait in ms until consider download to slow *!/
123
123
  threshold: PropTypes.number,
124
124
  /!** function to generate src based on width and format *!/
125
125
  getUrl: PropTypes.func,
@@ -9,7 +9,7 @@
9
9
  * and return as `style` property.
10
10
  *
11
11
  * Usage:
12
- * Asume you have `theme` object, which can be css-module
12
+ * Assume you have `theme` object, which can be css-module
13
13
  * or object or other css-in-js compatible with css-module
14
14
  *
15
15
  * <a {...compose(theme.link, theme.active, {color: "#000"})}>link</a>
@@ -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}) => {
@@ -6,7 +6,7 @@ export class UnfetchAbortController {
6
6
  }
7
7
 
8
8
  // modified version of https://github.com/developit/unfetch
9
- // - ponyfill intead of polyfill
9
+ // - ponyfill instead of polyfill
10
10
  // - add support for AbortController
11
11
  export const unfetch = (url, options) => {
12
12
  options = options || {};