@atlaspack/transformer-image 3.1.5-canary.16 → 3.1.5-canary.160

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