@pi-r/jimp 0.2.10 → 0.2.12

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.
Files changed (2) hide show
  1. package/index.js +11 -6
  2. package/package.json +3 -3
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
- if (!err && handler.host?.moduleName === 'filemanager') {
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 ?? NaN;
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
- return this.instance.rotateData?.values.length || 0;
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?.rotate_clockwise) {
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)?.[0] || "Unknown"));
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 } = (_a = this.settings).webp || (_a.webp = {});
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.10",
3
+ "version": "0.2.12",
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.6",
24
- "@e-mc/types": "^0.5.6",
23
+ "@e-mc/image": "^0.5.10",
24
+ "@e-mc/types": "^0.5.10",
25
25
  "bmp-js": "^0.1.0",
26
26
  "gifwrap": "^0.9.4",
27
27
  "jimp": "^0.22.12"