@atlaspack/transformer-image 3.1.1-dev.55 → 3.1.1-dev.82
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/lib/ImageTransformer.js +0 -17
- package/package.json +5 -5
- package/src/ImageTransformer.js +0 -16
package/lib/ImageTransformer.js
CHANGED
|
@@ -19,13 +19,6 @@ function _nullthrows() {
|
|
|
19
19
|
};
|
|
20
20
|
return data;
|
|
21
21
|
}
|
|
22
|
-
function _workers() {
|
|
23
|
-
const data = _interopRequireDefault(require("@atlaspack/workers"));
|
|
24
|
-
_workers = function () {
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
22
|
var _loadSharp = _interopRequireDefault(require("./loadSharp"));
|
|
30
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
24
|
// from https://github.com/lovell/sharp/blob/df7b8ba73808fc494be413e88cfb621b6279218c/lib/output.js#L6-L17
|
|
@@ -68,16 +61,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
68
61
|
const format = (0, _nullthrows().default)(FORMATS.get(targetFormat || originalFormat));
|
|
69
62
|
const outputOptions = config[format];
|
|
70
63
|
if (width || height || quality || targetFormat || outputOptions) {
|
|
71
|
-
// Sharp must be required from the main thread as well to prevent errors when workers exit
|
|
72
|
-
// See https://sharp.pixelplumbing.com/install#worker-threads and https://github.com/lovell/sharp/issues/2263
|
|
73
|
-
if (_workers().default.isWorker() && !isSharpLoadedOnMainThread) {
|
|
74
|
-
let api = _workers().default.getWorkerApi();
|
|
75
|
-
await api.callMaster({
|
|
76
|
-
location: __dirname + '/loadSharp.js',
|
|
77
|
-
args: [options.packageManager, asset.filePath, options.shouldAutoInstall]
|
|
78
|
-
});
|
|
79
|
-
isSharpLoadedOnMainThread = true;
|
|
80
|
-
}
|
|
81
64
|
let inputBuffer = await asset.getBuffer();
|
|
82
65
|
let sharp = await (0, _loadSharp.default)(options.packageManager, asset.filePath, options.shouldAutoInstall, true);
|
|
83
66
|
let imagePipeline = sharp(inputBuffer, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-image",
|
|
3
|
-
"version": "3.1.1-dev.
|
|
3
|
+
"version": "3.1.1-dev.82+5e3ca3e0c",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"node": ">= 16.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atlaspack/plugin": "2.14.1-dev.
|
|
19
|
-
"@atlaspack/utils": "2.14.1-dev.
|
|
20
|
-
"@atlaspack/workers": "2.14.1-dev.
|
|
18
|
+
"@atlaspack/plugin": "2.14.1-dev.82+5e3ca3e0c",
|
|
19
|
+
"@atlaspack/utils": "2.14.1-dev.82+5e3ca3e0c",
|
|
20
|
+
"@atlaspack/workers": "2.14.1-dev.82+5e3ca3e0c",
|
|
21
21
|
"nullthrows": "^1.1.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"@atlaspack/core": "^2.13.1"
|
|
28
28
|
},
|
|
29
29
|
"type": "commonjs",
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "5e3ca3e0cbbd49f4e67ac8d9b8aeebba1c3e76ef"
|
|
31
31
|
}
|
package/src/ImageTransformer.js
CHANGED
|
@@ -65,22 +65,6 @@ export default (new Transformer({
|
|
|
65
65
|
const outputOptions = config[format];
|
|
66
66
|
|
|
67
67
|
if (width || height || quality || targetFormat || outputOptions) {
|
|
68
|
-
// Sharp must be required from the main thread as well to prevent errors when workers exit
|
|
69
|
-
// See https://sharp.pixelplumbing.com/install#worker-threads and https://github.com/lovell/sharp/issues/2263
|
|
70
|
-
if (WorkerFarm.isWorker() && !isSharpLoadedOnMainThread) {
|
|
71
|
-
let api = WorkerFarm.getWorkerApi();
|
|
72
|
-
await api.callMaster({
|
|
73
|
-
location: __dirname + '/loadSharp.js',
|
|
74
|
-
args: [
|
|
75
|
-
options.packageManager,
|
|
76
|
-
asset.filePath,
|
|
77
|
-
options.shouldAutoInstall,
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
isSharpLoadedOnMainThread = true;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
68
|
let inputBuffer = await asset.getBuffer();
|
|
85
69
|
let sharp = await loadSharp(
|
|
86
70
|
options.packageManager,
|