@atlaspack/transformer-image 3.1.5-canary.20 → 3.1.5-canary.200

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 CHANGED
@@ -1,5 +1,237 @@
1
1
  # @atlaspack/transformer-image
2
2
 
3
+ ## 5.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
8
+
9
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922), [`686a398`](https://github.com/atlassian-labs/atlaspack/commit/686a398faa1f9e19cbf9274add2c46e246bafba8)]:
10
+ - @atlaspack/core@2.24.1
11
+ - @atlaspack/plugin@2.14.31
12
+ - @atlaspack/utils@2.19.3
13
+ - @atlaspack/workers@2.14.31
14
+
15
+ ## 5.0.0
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1), [`5a0363f`](https://github.com/atlassian-labs/atlaspack/commit/5a0363f1086e81068959b87e92064bed5a11a9b4), [`038e87a`](https://github.com/atlassian-labs/atlaspack/commit/038e87a7858d39556d59d3a2d17db534d45f62c6), [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572), [`8604d2a`](https://github.com/atlassian-labs/atlaspack/commit/8604d2a49ace5e9194ec4f76e71f06b93610f6b4)]:
20
+ - @atlaspack/core@2.24.0
21
+ - @atlaspack/utils@2.19.2
22
+ - @atlaspack/plugin@2.14.30
23
+ - @atlaspack/workers@2.14.30
24
+
25
+ ## 4.0.5
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies []:
30
+ - @atlaspack/core@2.23.5
31
+ - @atlaspack/utils@2.19.1
32
+ - @atlaspack/plugin@2.14.29
33
+ - @atlaspack/workers@2.14.29
34
+
35
+ ## 4.0.4
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
40
+ - @atlaspack/utils@2.19.0
41
+ - @atlaspack/core@2.23.4
42
+ - @atlaspack/workers@2.14.28
43
+ - @atlaspack/plugin@2.14.28
44
+
45
+ ## 4.0.3
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies []:
50
+ - @atlaspack/core@2.23.3
51
+ - @atlaspack/utils@2.18.4
52
+ - @atlaspack/plugin@2.14.27
53
+ - @atlaspack/workers@2.14.27
54
+
55
+ ## 4.0.2
56
+
57
+ ### Patch Changes
58
+
59
+ - [#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
60
+
61
+ - 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)]:
62
+ - @atlaspack/workers@2.14.26
63
+ - @atlaspack/plugin@2.14.26
64
+ - @atlaspack/utils@2.18.3
65
+ - @atlaspack/core@2.23.2
66
+
67
+ ## 4.0.1
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies []:
72
+ - @atlaspack/core@2.23.1
73
+ - @atlaspack/utils@2.18.2
74
+ - @atlaspack/plugin@2.14.25
75
+ - @atlaspack/workers@2.14.25
76
+
77
+ ## 4.0.0
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies [[`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45)]:
82
+ - @atlaspack/core@2.23.0
83
+ - @atlaspack/utils@2.18.1
84
+ - @atlaspack/plugin@2.14.24
85
+ - @atlaspack/workers@2.14.24
86
+
87
+ ## 3.1.23
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
92
+ - @atlaspack/utils@2.18.0
93
+ - @atlaspack/workers@2.14.23
94
+ - @atlaspack/plugin@2.14.23
95
+
96
+ ## 3.1.22
97
+
98
+ ### Patch Changes
99
+
100
+ - [#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
101
+
102
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
103
+ - @atlaspack/workers@2.14.22
104
+ - @atlaspack/plugin@2.14.22
105
+ - @atlaspack/utils@2.17.4
106
+
107
+ ## 3.1.21
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies []:
112
+ - @atlaspack/workers@2.14.21
113
+ - @atlaspack/utils@2.17.3
114
+ - @atlaspack/plugin@2.14.21
115
+
116
+ ## 3.1.20
117
+
118
+ ### Patch Changes
119
+
120
+ - [#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
121
+
122
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
123
+ - @atlaspack/plugin@2.14.20
124
+ - @atlaspack/utils@2.17.2
125
+ - @atlaspack/workers@2.14.20
126
+
127
+ ## 3.1.19
128
+
129
+ ### Patch Changes
130
+
131
+ - Updated dependencies []:
132
+ - @atlaspack/utils@2.17.1
133
+ - @atlaspack/workers@2.14.19
134
+ - @atlaspack/plugin@2.14.19
135
+
136
+ ## 3.1.18
137
+
138
+ ### Patch Changes
139
+
140
+ - 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)]:
141
+ - @atlaspack/utils@2.17.0
142
+ - @atlaspack/workers@2.14.18
143
+ - @atlaspack/plugin@2.14.18
144
+
145
+ ## 3.1.17
146
+
147
+ ### Patch Changes
148
+
149
+ - Updated dependencies []:
150
+ - @atlaspack/utils@2.16.1
151
+ - @atlaspack/workers@2.14.17
152
+ - @atlaspack/plugin@2.14.17
153
+
154
+ ## 3.1.16
155
+
156
+ ### Patch Changes
157
+
158
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
159
+ - @atlaspack/utils@2.16.0
160
+ - @atlaspack/workers@2.14.16
161
+ - @atlaspack/plugin@2.14.16
162
+
163
+ ## 3.1.15
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies []:
168
+ - @atlaspack/utils@2.15.3
169
+ - @atlaspack/workers@2.14.15
170
+ - @atlaspack/plugin@2.14.15
171
+
172
+ ## 3.1.14
173
+
174
+ ### Patch Changes
175
+
176
+ - Updated dependencies []:
177
+ - @atlaspack/utils@2.15.2
178
+ - @atlaspack/workers@2.14.14
179
+ - @atlaspack/plugin@2.14.14
180
+
181
+ ## 3.1.13
182
+
183
+ ### Patch Changes
184
+
185
+ - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb)]:
186
+ - @atlaspack/workers@2.14.13
187
+ - @atlaspack/utils@2.15.1
188
+ - @atlaspack/plugin@2.14.13
189
+
190
+ ## 3.1.12
191
+
192
+ ### Patch Changes
193
+
194
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
195
+ - @atlaspack/utils@2.15.0
196
+ - @atlaspack/workers@2.14.12
197
+ - @atlaspack/plugin@2.14.12
198
+
199
+ ## 3.1.11
200
+
201
+ ### Patch Changes
202
+
203
+ - Updated dependencies []:
204
+ - @atlaspack/utils@2.14.11
205
+ - @atlaspack/workers@2.14.11
206
+ - @atlaspack/plugin@2.14.11
207
+
208
+ ## 3.1.10
209
+
210
+ ### Patch Changes
211
+
212
+ - Updated dependencies []:
213
+ - @atlaspack/workers@2.14.10
214
+ - @atlaspack/plugin@2.14.10
215
+ - @atlaspack/utils@2.14.10
216
+
217
+ ## 3.1.9
218
+
219
+ ### Patch Changes
220
+
221
+ - Updated dependencies []:
222
+ - @atlaspack/utils@2.14.9
223
+ - @atlaspack/workers@2.14.9
224
+ - @atlaspack/plugin@2.14.9
225
+
226
+ ## 3.1.8
227
+
228
+ ### Patch Changes
229
+
230
+ - Updated dependencies []:
231
+ - @atlaspack/utils@2.14.8
232
+ - @atlaspack/workers@2.14.8
233
+ - @atlaspack/plugin@2.14.8
234
+
3
235
  ## 3.1.7
4
236
 
5
237
  ### Patch Changes
@@ -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') ? parseInt(asset.query.get('width'), 10) : null;
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) : config.quality;
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,3 @@
1
+ import { Transformer } from '@atlaspack/plugin';
2
+ declare const _default: Transformer<unknown>;
3
+ export default _default;
@@ -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.20+30f60175b",
3
+ "version": "3.1.5-canary.200+10ee3fa5b",
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.js",
12
+ "main": "./lib/ImageTransformer.js",
13
+ "source": "./src/ImageTransformer.ts",
14
+ "types": "./lib/types/ImageTransformer.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/plugin": "2.14.5-canary.20+30f60175b",
19
- "@atlaspack/utils": "2.14.5-canary.20+30f60175b",
20
- "@atlaspack/workers": "2.14.5-canary.20+30f60175b",
19
+ "@atlaspack/plugin": "2.14.5-canary.200+10ee3fa5b",
20
+ "@atlaspack/utils": "2.14.5-canary.200+10ee3fa5b",
21
+ "@atlaspack/workers": "2.14.5-canary.200+10ee3fa5b",
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": "^2.13.1"
28
+ "@atlaspack/core": "2.24.1"
28
29
  },
29
30
  "type": "commonjs",
30
- "gitHead": "30f60175ba4d272c5fc193973c63bc298584775b"
31
- }
31
+ "scripts": {
32
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src",
33
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
34
+ },
35
+ "gitHead": "10ee3fa5b75a92acde8973673d9b3c5b6f3958e5"
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 (new Transformer({
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
- ? parseInt(asset.query.get('width'), 10)
49
+ ? // @ts-expect-error TS2345
50
+ parseInt(asset.query.get('width'), 10)
50
51
  : null;
51
52
  const height = asset.query.has('height')
52
- ? parseInt(asset.query.get('height'), 10)
53
+ ? // @ts-expect-error TS2345
54
+ parseInt(asset.query.get('height'), 10)
53
55
  : null;
54
56
  const quality = asset.query.has('quality')
55
- ? parseInt(asset.query.get('quality'), 10)
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
- }): Transformer);
123
+ }) as Transformer<unknown>;
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import type {PackageManager} from '@atlaspack/package-manager';
3
2
  import type {FilePath} from '@atlaspack/types';
4
3
 
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import type {SchemaEntity} from '@atlaspack/utils';
3
2
  import {validateSchema} from '@atlaspack/utils';
4
3
 
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }