@atlaspack/transformer-image 3.1.19 → 3.1.20
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.
- package/CHANGELOG.md +11 -0
- package/lib/ImageTransformer.js +4 -1
- package/package.json +4 -4
- package/src/ImageTransformer.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaspack/transformer-image
|
|
2
2
|
|
|
3
|
+
## 3.1.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#702](https://github.com/atlassian-labs/atlaspack/pull/702) [`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa) Thanks [@alshdavid](https://github.com/alshdavid)! - Fixes to Flow types
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
|
|
10
|
+
- @atlaspack/plugin@2.14.20
|
|
11
|
+
- @atlaspack/utils@2.17.2
|
|
12
|
+
- @atlaspack/workers@2.14.20
|
|
13
|
+
|
|
3
14
|
## 3.1.19
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/lib/ImageTransformer.js
CHANGED
|
@@ -60,12 +60,15 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
60
60
|
}
|
|
61
61
|
const width = asset.query.has('width') ? parseInt(asset.query.get('width'), 10) : null;
|
|
62
62
|
const height = asset.query.has('height') ? parseInt(asset.query.get('height'), 10) : null;
|
|
63
|
-
const quality = asset.query.has('quality') ? parseInt(asset.query.get('quality'), 10) :
|
|
63
|
+
const quality = asset.query.has('quality') ? parseInt(asset.query.get('quality'), 10) :
|
|
64
|
+
// $FlowFixMe
|
|
65
|
+
config.quality;
|
|
64
66
|
let targetFormat = (_asset$query$get = asset.query.get('as')) === null || _asset$query$get === void 0 ? void 0 : _asset$query$get.toLowerCase().trim();
|
|
65
67
|
if (targetFormat && !FORMATS.has(targetFormat)) {
|
|
66
68
|
throw new Error(`The image transformer does not support ${targetFormat} images.`);
|
|
67
69
|
}
|
|
68
70
|
const format = (0, _nullthrows().default)(FORMATS.get(targetFormat || originalFormat));
|
|
71
|
+
// $FlowFixMe
|
|
69
72
|
const outputOptions = config[format];
|
|
70
73
|
if (width || height || quality || targetFormat || outputOptions) {
|
|
71
74
|
// Sharp must be required from the main thread as well to prevent errors when workers exit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-image",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.20",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"node": ">= 16.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atlaspack/plugin": "2.14.
|
|
19
|
-
"@atlaspack/utils": "2.17.
|
|
20
|
-
"@atlaspack/workers": "2.14.
|
|
18
|
+
"@atlaspack/plugin": "2.14.20",
|
|
19
|
+
"@atlaspack/utils": "2.17.2",
|
|
20
|
+
"@atlaspack/workers": "2.14.20",
|
|
21
21
|
"nullthrows": "^1.1.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
package/src/ImageTransformer.js
CHANGED
|
@@ -53,7 +53,8 @@ export default (new Transformer({
|
|
|
53
53
|
: null;
|
|
54
54
|
const quality = asset.query.has('quality')
|
|
55
55
|
? parseInt(asset.query.get('quality'), 10)
|
|
56
|
-
:
|
|
56
|
+
: // $FlowFixMe
|
|
57
|
+
config.quality;
|
|
57
58
|
let targetFormat = asset.query.get('as')?.toLowerCase().trim();
|
|
58
59
|
if (targetFormat && !FORMATS.has(targetFormat)) {
|
|
59
60
|
throw new Error(
|
|
@@ -62,6 +63,7 @@ export default (new Transformer({
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
const format = nullthrows(FORMATS.get(targetFormat || originalFormat));
|
|
66
|
+
// $FlowFixMe
|
|
65
67
|
const outputOptions = config[format];
|
|
66
68
|
|
|
67
69
|
if (width || height || quality || targetFormat || outputOptions) {
|
|
@@ -117,4 +119,4 @@ export default (new Transformer({
|
|
|
117
119
|
|
|
118
120
|
return [asset];
|
|
119
121
|
},
|
|
120
|
-
}): Transformer);
|
|
122
|
+
}): Transformer<mixed>);
|