@tryghost/image-transform 1.2.3 → 1.2.4

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.
Files changed (2) hide show
  1. package/lib/transform.js +3 -4
  2. package/package.json +5 -6
package/lib/transform.js CHANGED
@@ -1,4 +1,3 @@
1
- const Promise = require('bluebird');
2
1
  const errors = require('@tryghost/errors');
3
2
  const fs = require('fs-extra');
4
3
  const path = require('path');
@@ -77,7 +76,7 @@ const unsafeResizeFromPath = (options = {}) => {
77
76
  * Resize an image
78
77
  *
79
78
  * @param {Buffer} originalBuffer image to resize
80
- * @param {{width?: number, height?: number, format?: keyof import('sharp').FormatEnum, animated?: boolean, withoutEnlargement?: boolean}} [options]
79
+ * @param {{width?: number, height?: number, format?: keyof import('sharp').FormatEnum, animated?: boolean, withoutEnlargement?: boolean}} [options]
81
80
  * options.animated defaults to true for file formats where animation is supported (will always maintain animation if possible)
82
81
  * @returns {Promise<Buffer>} the resizedBuffer
83
82
  */
@@ -90,7 +89,7 @@ const unsafeResizeFromBuffer = async (originalBuffer, options = {}) => {
90
89
  // It is safe to set animated to true for all formats, because if the input image doesn't contain animation
91
90
  // nothing will change.
92
91
  let animated = options.animated ?? true;
93
-
92
+
94
93
  if (options.format) {
95
94
  // Only set animated to true if the output format supports animation
96
95
  // Else we end up with multiple images stacked on top of each other (from the source image)
@@ -108,7 +107,7 @@ const unsafeResizeFromBuffer = async (originalBuffer, options = {}) => {
108
107
  if (options.format) {
109
108
  s = s.toFormat(options.format);
110
109
  }
111
-
110
+
112
111
  const resizedBuffer = await s.toBuffer();
113
112
  return options.format || resizedBuffer.length < originalBuffer.length ? resizedBuffer : originalBuffer;
114
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/image-transform",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "repository": "https://github.com/TryGhost/SDK/tree/main/packages/image-transform",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -19,18 +19,17 @@
19
19
  "access": "public"
20
20
  },
21
21
  "devDependencies": {
22
- "c8": "7.12.0",
23
- "mocha": "10.1.0",
22
+ "c8": "7.13.0",
23
+ "mocha": "10.2.0",
24
24
  "should": "13.2.3",
25
- "sinon": "15.0.0"
25
+ "sinon": "15.0.1"
26
26
  },
27
27
  "dependencies": {
28
28
  "@tryghost/errors": "^1.2.1",
29
- "bluebird": "^3.7.2",
30
29
  "fs-extra": "^10.0.0"
31
30
  },
32
31
  "optionalDependencies": {
33
32
  "sharp": "^0.30.0"
34
33
  },
35
- "gitHead": "bc7ef4154981d09195c25acd6eda0531b1cffa32"
34
+ "gitHead": "1046738d867fc64428bbd3a80a340d89b7ccbea2"
36
35
  }