@atlaspack/transformer-image 3.1.5-canary.19 → 3.1.5-canary.190
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 +210 -0
- package/lib/ImageTransformer.js +11 -3
- package/lib/types/ImageTransformer.d.ts +3 -0
- package/lib/types/loadSharp.d.ts +1 -0
- package/lib/types/validateConfig.d.ts +1 -0
- package/package.json +14 -9
- package/src/{ImageTransformer.js → ImageTransformer.ts} +9 -6
- package/src/{loadSharp.js → loadSharp.ts} +0 -1
- package/src/{validateConfig.js → validateConfig.ts} +0 -1
- package/tsconfig.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,215 @@
|
|
|
1
1
|
# @atlaspack/transformer-image
|
|
2
2
|
|
|
3
|
+
## 4.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @atlaspack/core@2.23.5
|
|
9
|
+
- @atlaspack/utils@2.19.1
|
|
10
|
+
- @atlaspack/plugin@2.14.29
|
|
11
|
+
- @atlaspack/workers@2.14.29
|
|
12
|
+
|
|
13
|
+
## 4.0.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
|
|
18
|
+
- @atlaspack/utils@2.19.0
|
|
19
|
+
- @atlaspack/core@2.23.4
|
|
20
|
+
- @atlaspack/workers@2.14.28
|
|
21
|
+
- @atlaspack/plugin@2.14.28
|
|
22
|
+
|
|
23
|
+
## 4.0.3
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies []:
|
|
28
|
+
- @atlaspack/core@2.23.3
|
|
29
|
+
- @atlaspack/utils@2.18.4
|
|
30
|
+
- @atlaspack/plugin@2.14.27
|
|
31
|
+
- @atlaspack/workers@2.14.27
|
|
32
|
+
|
|
33
|
+
## 4.0.2
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2), [`b6e72b6`](https://github.com/atlassian-labs/atlaspack/commit/b6e72b6dd2b517cbb0e700fa69e63332d3eacb1e)]:
|
|
40
|
+
- @atlaspack/workers@2.14.26
|
|
41
|
+
- @atlaspack/plugin@2.14.26
|
|
42
|
+
- @atlaspack/utils@2.18.3
|
|
43
|
+
- @atlaspack/core@2.23.2
|
|
44
|
+
|
|
45
|
+
## 4.0.1
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies []:
|
|
50
|
+
- @atlaspack/core@2.23.1
|
|
51
|
+
- @atlaspack/utils@2.18.2
|
|
52
|
+
- @atlaspack/plugin@2.14.25
|
|
53
|
+
- @atlaspack/workers@2.14.25
|
|
54
|
+
|
|
55
|
+
## 4.0.0
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [[`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45)]:
|
|
60
|
+
- @atlaspack/core@2.23.0
|
|
61
|
+
- @atlaspack/utils@2.18.1
|
|
62
|
+
- @atlaspack/plugin@2.14.24
|
|
63
|
+
- @atlaspack/workers@2.14.24
|
|
64
|
+
|
|
65
|
+
## 3.1.23
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
|
|
70
|
+
- @atlaspack/utils@2.18.0
|
|
71
|
+
- @atlaspack/workers@2.14.23
|
|
72
|
+
- @atlaspack/plugin@2.14.23
|
|
73
|
+
|
|
74
|
+
## 3.1.22
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
|
|
79
|
+
|
|
80
|
+
- Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
|
|
81
|
+
- @atlaspack/workers@2.14.22
|
|
82
|
+
- @atlaspack/plugin@2.14.22
|
|
83
|
+
- @atlaspack/utils@2.17.4
|
|
84
|
+
|
|
85
|
+
## 3.1.21
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- Updated dependencies []:
|
|
90
|
+
- @atlaspack/workers@2.14.21
|
|
91
|
+
- @atlaspack/utils@2.17.3
|
|
92
|
+
- @atlaspack/plugin@2.14.21
|
|
93
|
+
|
|
94
|
+
## 3.1.20
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- [#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
|
|
99
|
+
|
|
100
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
|
|
101
|
+
- @atlaspack/plugin@2.14.20
|
|
102
|
+
- @atlaspack/utils@2.17.2
|
|
103
|
+
- @atlaspack/workers@2.14.20
|
|
104
|
+
|
|
105
|
+
## 3.1.19
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Updated dependencies []:
|
|
110
|
+
- @atlaspack/utils@2.17.1
|
|
111
|
+
- @atlaspack/workers@2.14.19
|
|
112
|
+
- @atlaspack/plugin@2.14.19
|
|
113
|
+
|
|
114
|
+
## 3.1.18
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
|
|
119
|
+
- @atlaspack/utils@2.17.0
|
|
120
|
+
- @atlaspack/workers@2.14.18
|
|
121
|
+
- @atlaspack/plugin@2.14.18
|
|
122
|
+
|
|
123
|
+
## 3.1.17
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Updated dependencies []:
|
|
128
|
+
- @atlaspack/utils@2.16.1
|
|
129
|
+
- @atlaspack/workers@2.14.17
|
|
130
|
+
- @atlaspack/plugin@2.14.17
|
|
131
|
+
|
|
132
|
+
## 3.1.16
|
|
133
|
+
|
|
134
|
+
### Patch Changes
|
|
135
|
+
|
|
136
|
+
- Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
|
|
137
|
+
- @atlaspack/utils@2.16.0
|
|
138
|
+
- @atlaspack/workers@2.14.16
|
|
139
|
+
- @atlaspack/plugin@2.14.16
|
|
140
|
+
|
|
141
|
+
## 3.1.15
|
|
142
|
+
|
|
143
|
+
### Patch Changes
|
|
144
|
+
|
|
145
|
+
- Updated dependencies []:
|
|
146
|
+
- @atlaspack/utils@2.15.3
|
|
147
|
+
- @atlaspack/workers@2.14.15
|
|
148
|
+
- @atlaspack/plugin@2.14.15
|
|
149
|
+
|
|
150
|
+
## 3.1.14
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- Updated dependencies []:
|
|
155
|
+
- @atlaspack/utils@2.15.2
|
|
156
|
+
- @atlaspack/workers@2.14.14
|
|
157
|
+
- @atlaspack/plugin@2.14.14
|
|
158
|
+
|
|
159
|
+
## 3.1.13
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb)]:
|
|
164
|
+
- @atlaspack/workers@2.14.13
|
|
165
|
+
- @atlaspack/utils@2.15.1
|
|
166
|
+
- @atlaspack/plugin@2.14.13
|
|
167
|
+
|
|
168
|
+
## 3.1.12
|
|
169
|
+
|
|
170
|
+
### Patch Changes
|
|
171
|
+
|
|
172
|
+
- Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
|
|
173
|
+
- @atlaspack/utils@2.15.0
|
|
174
|
+
- @atlaspack/workers@2.14.12
|
|
175
|
+
- @atlaspack/plugin@2.14.12
|
|
176
|
+
|
|
177
|
+
## 3.1.11
|
|
178
|
+
|
|
179
|
+
### Patch Changes
|
|
180
|
+
|
|
181
|
+
- Updated dependencies []:
|
|
182
|
+
- @atlaspack/utils@2.14.11
|
|
183
|
+
- @atlaspack/workers@2.14.11
|
|
184
|
+
- @atlaspack/plugin@2.14.11
|
|
185
|
+
|
|
186
|
+
## 3.1.10
|
|
187
|
+
|
|
188
|
+
### Patch Changes
|
|
189
|
+
|
|
190
|
+
- Updated dependencies []:
|
|
191
|
+
- @atlaspack/workers@2.14.10
|
|
192
|
+
- @atlaspack/plugin@2.14.10
|
|
193
|
+
- @atlaspack/utils@2.14.10
|
|
194
|
+
|
|
195
|
+
## 3.1.9
|
|
196
|
+
|
|
197
|
+
### Patch Changes
|
|
198
|
+
|
|
199
|
+
- Updated dependencies []:
|
|
200
|
+
- @atlaspack/utils@2.14.9
|
|
201
|
+
- @atlaspack/workers@2.14.9
|
|
202
|
+
- @atlaspack/plugin@2.14.9
|
|
203
|
+
|
|
204
|
+
## 3.1.8
|
|
205
|
+
|
|
206
|
+
### Patch Changes
|
|
207
|
+
|
|
208
|
+
- Updated dependencies []:
|
|
209
|
+
- @atlaspack/utils@2.14.8
|
|
210
|
+
- @atlaspack/workers@2.14.8
|
|
211
|
+
- @atlaspack/plugin@2.14.8
|
|
212
|
+
|
|
3
213
|
## 3.1.7
|
|
4
214
|
|
|
5
215
|
### Patch Changes
|
package/lib/ImageTransformer.js
CHANGED
|
@@ -28,6 +28,8 @@ function _workers() {
|
|
|
28
28
|
}
|
|
29
29
|
var _loadSharp = _interopRequireDefault(require("./loadSharp"));
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
// @ts-expect-error TS1192
|
|
32
|
+
|
|
31
33
|
// from https://github.com/lovell/sharp/blob/df7b8ba73808fc494be413e88cfb621b6279218c/lib/output.js#L6-L17
|
|
32
34
|
const FORMATS = new Map([['jpeg', 'jpeg'], ['jpg', 'jpeg'], ['png', 'png'], ['webp', 'webp'], ['gif', 'gif'], ['tiff', 'tiff'], ['avif', 'avif'], ['heic', 'heif'], ['heif', 'heif']]);
|
|
33
35
|
let isSharpLoadedOnMainThread = false;
|
|
@@ -58,9 +60,15 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
58
60
|
if (!originalFormat) {
|
|
59
61
|
throw new Error(`The image transformer does not support ${asset.type} images.`);
|
|
60
62
|
}
|
|
61
|
-
const width = asset.query.has('width') ?
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
const width = asset.query.has('width') ?
|
|
64
|
+
// @ts-expect-error TS2345
|
|
65
|
+
parseInt(asset.query.get('width'), 10) : null;
|
|
66
|
+
const height = asset.query.has('height') ?
|
|
67
|
+
// @ts-expect-error TS2345
|
|
68
|
+
parseInt(asset.query.get('height'), 10) : null;
|
|
69
|
+
const quality = asset.query.has('quality') ?
|
|
70
|
+
// @ts-expect-error TS2345
|
|
71
|
+
parseInt(asset.query.get('quality'), 10) : config.quality;
|
|
64
72
|
let targetFormat = (_asset$query$get = asset.query.get('as')) === null || _asset$query$get === void 0 ? void 0 : _asset$query$get.toLowerCase().trim();
|
|
65
73
|
if (targetFormat && !FORMATS.has(targetFormat)) {
|
|
66
74
|
throw new Error(`The image transformer does not support ${targetFormat} images.`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateConfig(data: any, filePath: string): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-image",
|
|
3
|
-
"version": "3.1.5-canary.
|
|
3
|
+
"version": "3.1.5-canary.190+7a52bab62",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,23 +9,28 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/ImageTransformer.js",
|
|
13
|
-
"source": "src/ImageTransformer.
|
|
12
|
+
"main": "./lib/ImageTransformer.js",
|
|
13
|
+
"source": "./src/ImageTransformer.ts",
|
|
14
|
+
"types": "./lib/ImageTransformer.d.ts",
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">= 16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
19
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
20
|
-
"@atlaspack/workers": "2.14.5-canary.
|
|
19
|
+
"@atlaspack/plugin": "2.14.5-canary.190+7a52bab62",
|
|
20
|
+
"@atlaspack/utils": "2.14.5-canary.190+7a52bab62",
|
|
21
|
+
"@atlaspack/workers": "2.14.5-canary.190+7a52bab62",
|
|
21
22
|
"nullthrows": "^1.1.1"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"sharp": "^0.31.1"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
|
-
"@atlaspack/core": "
|
|
28
|
+
"@atlaspack/core": "2.23.5"
|
|
28
29
|
},
|
|
29
30
|
"type": "commonjs",
|
|
30
|
-
"
|
|
31
|
-
|
|
31
|
+
"scripts": {
|
|
32
|
+
"check-ts": "tsc --emitDeclarationOnly --rootDir src",
|
|
33
|
+
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
34
|
+
},
|
|
35
|
+
"gitHead": "7a52bab6281e8edbfa66af248eb6f872c6b4b7bd"
|
|
36
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import {validateConfig} from './validateConfig';
|
|
3
2
|
import {Transformer} from '@atlaspack/plugin';
|
|
4
3
|
import nullthrows from 'nullthrows';
|
|
5
4
|
import WorkerFarm from '@atlaspack/workers';
|
|
5
|
+
// @ts-expect-error TS1192
|
|
6
6
|
import loadSharp from './loadSharp';
|
|
7
7
|
|
|
8
8
|
// from https://github.com/lovell/sharp/blob/df7b8ba73808fc494be413e88cfb621b6279218c/lib/output.js#L6-L17
|
|
@@ -20,7 +20,7 @@ const FORMATS = new Map([
|
|
|
20
20
|
|
|
21
21
|
let isSharpLoadedOnMainThread = false;
|
|
22
22
|
|
|
23
|
-
export default
|
|
23
|
+
export default new Transformer({
|
|
24
24
|
async loadConfig({config}) {
|
|
25
25
|
let configFile: any = await config.getConfig(
|
|
26
26
|
['sharp.config.json'], // '.sharprc', '.sharprc.json'
|
|
@@ -46,13 +46,16 @@ export default (new Transformer({
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const width = asset.query.has('width')
|
|
49
|
-
?
|
|
49
|
+
? // @ts-expect-error TS2345
|
|
50
|
+
parseInt(asset.query.get('width'), 10)
|
|
50
51
|
: null;
|
|
51
52
|
const height = asset.query.has('height')
|
|
52
|
-
?
|
|
53
|
+
? // @ts-expect-error TS2345
|
|
54
|
+
parseInt(asset.query.get('height'), 10)
|
|
53
55
|
: null;
|
|
54
56
|
const quality = asset.query.has('quality')
|
|
55
|
-
?
|
|
57
|
+
? // @ts-expect-error TS2345
|
|
58
|
+
parseInt(asset.query.get('quality'), 10)
|
|
56
59
|
: config.quality;
|
|
57
60
|
let targetFormat = asset.query.get('as')?.toLowerCase().trim();
|
|
58
61
|
if (targetFormat && !FORMATS.has(targetFormat)) {
|
|
@@ -117,4 +120,4 @@ export default (new Transformer({
|
|
|
117
120
|
|
|
118
121
|
return [asset];
|
|
119
122
|
},
|
|
120
|
-
})
|
|
123
|
+
}) as Transformer<unknown>;
|
package/tsconfig.json
ADDED