@atlaspack/transformer-image 3.1.5-canary.17 → 3.1.5-canary.170

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,204 @@
1
1
  # @atlaspack/transformer-image
2
2
 
3
+ ## 4.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/core@2.23.3
9
+ - @atlaspack/utils@2.18.4
10
+ - @atlaspack/plugin@2.14.27
11
+ - @atlaspack/workers@2.14.27
12
+
13
+ ## 4.0.2
14
+
15
+ ### Patch Changes
16
+
17
+ - [#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
18
+
19
+ - 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)]:
20
+ - @atlaspack/workers@2.14.26
21
+ - @atlaspack/plugin@2.14.26
22
+ - @atlaspack/utils@2.18.3
23
+ - @atlaspack/core@2.23.2
24
+
25
+ ## 4.0.1
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies []:
30
+ - @atlaspack/core@2.23.1
31
+ - @atlaspack/utils@2.18.2
32
+ - @atlaspack/plugin@2.14.25
33
+ - @atlaspack/workers@2.14.25
34
+
35
+ ## 4.0.0
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [[`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45)]:
40
+ - @atlaspack/core@2.23.0
41
+ - @atlaspack/utils@2.18.1
42
+ - @atlaspack/plugin@2.14.24
43
+ - @atlaspack/workers@2.14.24
44
+
45
+ ## 3.1.23
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
50
+ - @atlaspack/utils@2.18.0
51
+ - @atlaspack/workers@2.14.23
52
+ - @atlaspack/plugin@2.14.23
53
+
54
+ ## 3.1.22
55
+
56
+ ### Patch Changes
57
+
58
+ - [#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
59
+
60
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
61
+ - @atlaspack/workers@2.14.22
62
+ - @atlaspack/plugin@2.14.22
63
+ - @atlaspack/utils@2.17.4
64
+
65
+ ## 3.1.21
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies []:
70
+ - @atlaspack/workers@2.14.21
71
+ - @atlaspack/utils@2.17.3
72
+ - @atlaspack/plugin@2.14.21
73
+
74
+ ## 3.1.20
75
+
76
+ ### Patch Changes
77
+
78
+ - [#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
79
+
80
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
81
+ - @atlaspack/plugin@2.14.20
82
+ - @atlaspack/utils@2.17.2
83
+ - @atlaspack/workers@2.14.20
84
+
85
+ ## 3.1.19
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies []:
90
+ - @atlaspack/utils@2.17.1
91
+ - @atlaspack/workers@2.14.19
92
+ - @atlaspack/plugin@2.14.19
93
+
94
+ ## 3.1.18
95
+
96
+ ### Patch Changes
97
+
98
+ - 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)]:
99
+ - @atlaspack/utils@2.17.0
100
+ - @atlaspack/workers@2.14.18
101
+ - @atlaspack/plugin@2.14.18
102
+
103
+ ## 3.1.17
104
+
105
+ ### Patch Changes
106
+
107
+ - Updated dependencies []:
108
+ - @atlaspack/utils@2.16.1
109
+ - @atlaspack/workers@2.14.17
110
+ - @atlaspack/plugin@2.14.17
111
+
112
+ ## 3.1.16
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
117
+ - @atlaspack/utils@2.16.0
118
+ - @atlaspack/workers@2.14.16
119
+ - @atlaspack/plugin@2.14.16
120
+
121
+ ## 3.1.15
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies []:
126
+ - @atlaspack/utils@2.15.3
127
+ - @atlaspack/workers@2.14.15
128
+ - @atlaspack/plugin@2.14.15
129
+
130
+ ## 3.1.14
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies []:
135
+ - @atlaspack/utils@2.15.2
136
+ - @atlaspack/workers@2.14.14
137
+ - @atlaspack/plugin@2.14.14
138
+
139
+ ## 3.1.13
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb)]:
144
+ - @atlaspack/workers@2.14.13
145
+ - @atlaspack/utils@2.15.1
146
+ - @atlaspack/plugin@2.14.13
147
+
148
+ ## 3.1.12
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
153
+ - @atlaspack/utils@2.15.0
154
+ - @atlaspack/workers@2.14.12
155
+ - @atlaspack/plugin@2.14.12
156
+
157
+ ## 3.1.11
158
+
159
+ ### Patch Changes
160
+
161
+ - Updated dependencies []:
162
+ - @atlaspack/utils@2.14.11
163
+ - @atlaspack/workers@2.14.11
164
+ - @atlaspack/plugin@2.14.11
165
+
166
+ ## 3.1.10
167
+
168
+ ### Patch Changes
169
+
170
+ - Updated dependencies []:
171
+ - @atlaspack/workers@2.14.10
172
+ - @atlaspack/plugin@2.14.10
173
+ - @atlaspack/utils@2.14.10
174
+
175
+ ## 3.1.9
176
+
177
+ ### Patch Changes
178
+
179
+ - Updated dependencies []:
180
+ - @atlaspack/utils@2.14.9
181
+ - @atlaspack/workers@2.14.9
182
+ - @atlaspack/plugin@2.14.9
183
+
184
+ ## 3.1.8
185
+
186
+ ### Patch Changes
187
+
188
+ - Updated dependencies []:
189
+ - @atlaspack/utils@2.14.8
190
+ - @atlaspack/workers@2.14.8
191
+ - @atlaspack/plugin@2.14.8
192
+
193
+ ## 3.1.7
194
+
195
+ ### Patch Changes
196
+
197
+ - Updated dependencies []:
198
+ - @atlaspack/utils@2.14.7
199
+ - @atlaspack/workers@2.14.7
200
+ - @atlaspack/plugin@2.14.7
201
+
3
202
  ## 3.1.6
4
203
 
5
204
  ### 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.17+a1773d2a6",
3
+ "version": "3.1.5-canary.170+c940954d2",
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.17+a1773d2a6",
19
- "@atlaspack/utils": "2.14.5-canary.17+a1773d2a6",
20
- "@atlaspack/workers": "2.14.5-canary.17+a1773d2a6",
19
+ "@atlaspack/plugin": "2.14.5-canary.170+c940954d2",
20
+ "@atlaspack/utils": "2.14.5-canary.170+c940954d2",
21
+ "@atlaspack/workers": "2.14.5-canary.170+c940954d2",
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.23.3"
28
29
  },
29
30
  "type": "commonjs",
30
- "gitHead": "a1773d2a62d0ef7805ac7524621dcabcc1afe929"
31
+ "scripts": {
32
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src",
33
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
34
+ },
35
+ "gitHead": "c940954d27d657c3c93cd328dfb394778da46eab"
31
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
+ }