@atlaspack/transformer-image 3.1.5-canary.14 → 3.1.5-canary.140

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,151 @@
1
1
  # @atlaspack/transformer-image
2
2
 
3
+ ## 3.1.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/workers@2.14.21
9
+ - @atlaspack/utils@2.17.3
10
+ - @atlaspack/plugin@2.14.21
11
+
12
+ ## 3.1.20
13
+
14
+ ### Patch Changes
15
+
16
+ - [#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
17
+
18
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
19
+ - @atlaspack/plugin@2.14.20
20
+ - @atlaspack/utils@2.17.2
21
+ - @atlaspack/workers@2.14.20
22
+
23
+ ## 3.1.19
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies []:
28
+ - @atlaspack/utils@2.17.1
29
+ - @atlaspack/workers@2.14.19
30
+ - @atlaspack/plugin@2.14.19
31
+
32
+ ## 3.1.18
33
+
34
+ ### Patch Changes
35
+
36
+ - 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)]:
37
+ - @atlaspack/utils@2.17.0
38
+ - @atlaspack/workers@2.14.18
39
+ - @atlaspack/plugin@2.14.18
40
+
41
+ ## 3.1.17
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies []:
46
+ - @atlaspack/utils@2.16.1
47
+ - @atlaspack/workers@2.14.17
48
+ - @atlaspack/plugin@2.14.17
49
+
50
+ ## 3.1.16
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
55
+ - @atlaspack/utils@2.16.0
56
+ - @atlaspack/workers@2.14.16
57
+ - @atlaspack/plugin@2.14.16
58
+
59
+ ## 3.1.15
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies []:
64
+ - @atlaspack/utils@2.15.3
65
+ - @atlaspack/workers@2.14.15
66
+ - @atlaspack/plugin@2.14.15
67
+
68
+ ## 3.1.14
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies []:
73
+ - @atlaspack/utils@2.15.2
74
+ - @atlaspack/workers@2.14.14
75
+ - @atlaspack/plugin@2.14.14
76
+
77
+ ## 3.1.13
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb)]:
82
+ - @atlaspack/workers@2.14.13
83
+ - @atlaspack/utils@2.15.1
84
+ - @atlaspack/plugin@2.14.13
85
+
86
+ ## 3.1.12
87
+
88
+ ### Patch Changes
89
+
90
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
91
+ - @atlaspack/utils@2.15.0
92
+ - @atlaspack/workers@2.14.12
93
+ - @atlaspack/plugin@2.14.12
94
+
95
+ ## 3.1.11
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies []:
100
+ - @atlaspack/utils@2.14.11
101
+ - @atlaspack/workers@2.14.11
102
+ - @atlaspack/plugin@2.14.11
103
+
104
+ ## 3.1.10
105
+
106
+ ### Patch Changes
107
+
108
+ - Updated dependencies []:
109
+ - @atlaspack/workers@2.14.10
110
+ - @atlaspack/plugin@2.14.10
111
+ - @atlaspack/utils@2.14.10
112
+
113
+ ## 3.1.9
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies []:
118
+ - @atlaspack/utils@2.14.9
119
+ - @atlaspack/workers@2.14.9
120
+ - @atlaspack/plugin@2.14.9
121
+
122
+ ## 3.1.8
123
+
124
+ ### Patch Changes
125
+
126
+ - Updated dependencies []:
127
+ - @atlaspack/utils@2.14.8
128
+ - @atlaspack/workers@2.14.8
129
+ - @atlaspack/plugin@2.14.8
130
+
131
+ ## 3.1.7
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies []:
136
+ - @atlaspack/utils@2.14.7
137
+ - @atlaspack/workers@2.14.7
138
+ - @atlaspack/plugin@2.14.7
139
+
140
+ ## 3.1.6
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies []:
145
+ - @atlaspack/utils@2.14.6
146
+ - @atlaspack/workers@2.14.6
147
+ - @atlaspack/plugin@2.14.6
148
+
3
149
  ## 3.1.5
4
150
 
5
151
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ import { Transformer } from '@atlaspack/plugin';
2
+ declare const _default: Transformer<unknown>;
3
+ export default _default;
@@ -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 @@
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.14+267b0d591",
3
+ "version": "3.1.5-canary.140+43fdd2238",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,15 +9,16 @@
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/ImageTransformer.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/plugin": "2.14.5-canary.14+267b0d591",
19
- "@atlaspack/utils": "2.14.5-canary.14+267b0d591",
20
- "@atlaspack/workers": "2.14.5-canary.14+267b0d591",
19
+ "@atlaspack/plugin": "2.14.5-canary.140+43fdd2238",
20
+ "@atlaspack/utils": "2.14.5-canary.140+43fdd2238",
21
+ "@atlaspack/workers": "2.14.5-canary.140+43fdd2238",
21
22
  "nullthrows": "^1.1.1"
22
23
  },
23
24
  "devDependencies": {
@@ -27,5 +28,8 @@
27
28
  "@atlaspack/core": "^2.13.1"
28
29
  },
29
30
  "type": "commonjs",
30
- "gitHead": "267b0d59131c00e4cd1526bbf87aa84b9c8fd411"
31
- }
31
+ "scripts": {
32
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
33
+ },
34
+ "gitHead": "43fdd223860fbc97af17d68c65419b97412cb888"
35
+ }
@@ -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
+ }