@pi-r/jimp 0.3.2 → 0.3.4
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 +13 -12
- 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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
const path = require("path");
|
|
4
3
|
const fs = require("fs");
|
|
5
4
|
const child_process = require("child_process");
|
|
@@ -87,7 +86,8 @@ function performCommand(host, instance, localUri, command, outputType, finalAs,
|
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
88
|
function execOptions(settings) {
|
|
90
|
-
|
|
89
|
+
var _a;
|
|
90
|
+
const exec = (_a = settings.jimp) === null || _a === void 0 ? void 0 : _a.exec;
|
|
91
91
|
let uid, gid;
|
|
92
92
|
if ((0, types_1.isPlainObject)(exec)) {
|
|
93
93
|
let { uid: u, gid: g } = exec;
|
|
@@ -120,7 +120,8 @@ async function transformCommand(localFile, handler, command, outputType, outputA
|
|
|
120
120
|
return handler.rotate();
|
|
121
121
|
default:
|
|
122
122
|
return handler.rotate(localFile, (err, result) => {
|
|
123
|
-
|
|
123
|
+
var _a;
|
|
124
|
+
if (!err && ((_a = handler.host) === null || _a === void 0 ? void 0 : _a.moduleName) === 'filemanager') {
|
|
124
125
|
try {
|
|
125
126
|
handler.host.add(result, parent);
|
|
126
127
|
}
|
|
@@ -502,10 +503,11 @@ class JimpHandler {
|
|
|
502
503
|
}
|
|
503
504
|
}
|
|
504
505
|
opacity() {
|
|
506
|
+
var _a;
|
|
505
507
|
if (this.aborted) {
|
|
506
508
|
return;
|
|
507
509
|
}
|
|
508
|
-
const value = this.instance.opacityValue
|
|
510
|
+
const value = (_a = this.instance.opacityValue) !== null && _a !== void 0 ? _a : NaN;
|
|
509
511
|
if (value >= 0) {
|
|
510
512
|
this.handler = this.handler.opacity(value);
|
|
511
513
|
}
|
|
@@ -560,7 +562,8 @@ class JimpHandler {
|
|
|
560
562
|
return this.instance.aborted;
|
|
561
563
|
}
|
|
562
564
|
get rotateCount() {
|
|
563
|
-
|
|
565
|
+
var _a;
|
|
566
|
+
return ((_a = this.instance.rotateData) === null || _a === void 0 ? void 0 : _a.values.length) || 0;
|
|
564
567
|
}
|
|
565
568
|
}
|
|
566
569
|
class Jimp extends Image {
|
|
@@ -635,8 +638,9 @@ class Jimp extends Image {
|
|
|
635
638
|
.finally(() => buffer && !options.cache && removeFile(file));
|
|
636
639
|
}
|
|
637
640
|
parseRotate(value) {
|
|
641
|
+
var _a;
|
|
638
642
|
const data = super.parseRotate(value);
|
|
639
|
-
if (data && this.settings.jimp
|
|
643
|
+
if (data && ((_a = this.settings.jimp) === null || _a === void 0 ? void 0 : _a.rotate_clockwise)) {
|
|
640
644
|
const values = data.values;
|
|
641
645
|
for (let i = 0; i < values.length; ++i) {
|
|
642
646
|
values[i] *= -1;
|
|
@@ -649,6 +653,7 @@ class Jimp extends Image {
|
|
|
649
653
|
return Promise.reject((0, types_1.createAbortError)());
|
|
650
654
|
}
|
|
651
655
|
return new Promise(async (resolve, reject) => {
|
|
656
|
+
var _a;
|
|
652
657
|
const { host, file } = data;
|
|
653
658
|
const localUri = host.getLocalUri(data);
|
|
654
659
|
const mimeType = host.getMimeType(data);
|
|
@@ -662,7 +667,7 @@ class Jimp extends Image {
|
|
|
662
667
|
}
|
|
663
668
|
const [outputType, saveAs, finalAs] = (0, util_1.parseFormat)(command = command.trim(), mimeType, true);
|
|
664
669
|
if (!outputType) {
|
|
665
|
-
reject((0, types_1.errorValue)("Invalid format", /^\w+/.exec(command)
|
|
670
|
+
reject((0, types_1.errorValue)("Invalid format", ((_a = /^\w+/.exec(command)) === null || _a === void 0 ? void 0 : _a[0]) || "Unknown"));
|
|
666
671
|
return;
|
|
667
672
|
}
|
|
668
673
|
const replace = command.indexOf('@') !== -1;
|
|
@@ -1005,9 +1010,5 @@ class Jimp extends Image {
|
|
|
1005
1010
|
return (_a = this.module).settings || (_a.settings = {});
|
|
1006
1011
|
}
|
|
1007
1012
|
}
|
|
1008
|
-
exports.default = Jimp;
|
|
1009
1013
|
|
|
1010
|
-
|
|
1011
|
-
module.exports = exports.default;
|
|
1012
|
-
module.exports.default = exports.default;
|
|
1013
|
-
}
|
|
1014
|
+
module.exports = Jimp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/jimp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
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.6.
|
|
24
|
-
"@e-mc/types": "^0.6.
|
|
23
|
+
"@e-mc/image": "^0.6.3",
|
|
24
|
+
"@e-mc/types": "^0.6.3",
|
|
25
25
|
"bmp-js": "^0.1.0",
|
|
26
26
|
"gifwrap": "^0.10.1",
|
|
27
27
|
"jimp": "^0.22.12"
|