@pi-r/jimp 0.2.9 → 0.2.11
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/LICENSE +1 -1
- package/README.md +1 -1
- package/index.js +11 -6
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -92,7 +92,8 @@ async function transformCommand(localFile, handler, command, outputType, outputA
|
|
|
92
92
|
return handler.rotate();
|
|
93
93
|
default:
|
|
94
94
|
return handler.rotate(localFile, (err, result) => {
|
|
95
|
-
|
|
95
|
+
var _a;
|
|
96
|
+
if (!err && ((_a = handler.host) === null || _a === void 0 ? void 0 : _a.moduleName) === 'filemanager') {
|
|
96
97
|
try {
|
|
97
98
|
handler.host.add(result, parent);
|
|
98
99
|
}
|
|
@@ -472,10 +473,11 @@ class JimpHandler {
|
|
|
472
473
|
}
|
|
473
474
|
}
|
|
474
475
|
opacity() {
|
|
476
|
+
var _a;
|
|
475
477
|
if (this.aborted) {
|
|
476
478
|
return;
|
|
477
479
|
}
|
|
478
|
-
const value = this.instance.opacityValue
|
|
480
|
+
const value = (_a = this.instance.opacityValue) !== null && _a !== void 0 ? _a : NaN;
|
|
479
481
|
if (value >= 0) {
|
|
480
482
|
this.handler = this.handler.opacity(value);
|
|
481
483
|
}
|
|
@@ -530,7 +532,8 @@ class JimpHandler {
|
|
|
530
532
|
return this.instance.aborted;
|
|
531
533
|
}
|
|
532
534
|
get rotateCount() {
|
|
533
|
-
|
|
535
|
+
var _a;
|
|
536
|
+
return ((_a = this.instance.rotateData) === null || _a === void 0 ? void 0 : _a.values.length) || 0;
|
|
534
537
|
}
|
|
535
538
|
}
|
|
536
539
|
class Jimp extends Image {
|
|
@@ -605,8 +608,9 @@ class Jimp extends Image {
|
|
|
605
608
|
return empty();
|
|
606
609
|
}
|
|
607
610
|
parseRotate(value) {
|
|
611
|
+
var _a;
|
|
608
612
|
const data = super.parseRotate(value);
|
|
609
|
-
if (data && this.settings.jimp
|
|
613
|
+
if (data && ((_a = this.settings.jimp) === null || _a === void 0 ? void 0 : _a.rotate_clockwise)) {
|
|
610
614
|
const values = data.values;
|
|
611
615
|
for (let i = 0; i < values.length; ++i) {
|
|
612
616
|
values[i] *= -1;
|
|
@@ -620,6 +624,7 @@ class Jimp extends Image {
|
|
|
620
624
|
}
|
|
621
625
|
return new Promise(async (resolve, reject) => {
|
|
622
626
|
var _a;
|
|
627
|
+
var _b;
|
|
623
628
|
const { host, file } = data;
|
|
624
629
|
const localUri = host.getLocalUri(data);
|
|
625
630
|
const mimeType = host.getMimeType(data);
|
|
@@ -633,7 +638,7 @@ class Jimp extends Image {
|
|
|
633
638
|
}
|
|
634
639
|
const [outputType, saveAs, finalAs] = (0, util_1.parseFormat)(command = command.trim(), mimeType, true);
|
|
635
640
|
if (!outputType) {
|
|
636
|
-
reject((0, types_1.errorValue)("Invalid format", /^\w+/.exec(command)
|
|
641
|
+
reject((0, types_1.errorValue)("Invalid format", ((_a = /^\w+/.exec(command)) === null || _a === void 0 ? void 0 : _a[0]) || "Unknown"));
|
|
637
642
|
return;
|
|
638
643
|
}
|
|
639
644
|
const replace = command.indexOf('@') !== -1;
|
|
@@ -939,7 +944,7 @@ class Jimp extends Image {
|
|
|
939
944
|
}
|
|
940
945
|
return false;
|
|
941
946
|
};
|
|
942
|
-
const { path: webp_path } = (
|
|
947
|
+
const { path: webp_path } = (_b = this.settings).webp || (_b.webp = {});
|
|
943
948
|
const bmpFile = getTempPath.call(this, 'bmp');
|
|
944
949
|
try {
|
|
945
950
|
child_process.execFile((0, util_1.getWebP_bin)('dwebp', webp_path), [(0, util_1.normalizePath)(localUri), '-bmp', '-o', (0, util_1.normalizePath)(bmpFile)], { shell: true, signal: this.signal }, err => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/jimp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Jimp image constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/image": "^0.5.
|
|
24
|
-
"@e-mc/types": "^0.5.
|
|
23
|
+
"@e-mc/image": "^0.5.6",
|
|
24
|
+
"@e-mc/types": "^0.5.6",
|
|
25
25
|
"bmp-js": "^0.1.0",
|
|
26
26
|
"gifwrap": "^0.9.4",
|
|
27
27
|
"jimp": "^0.22.12"
|