@pi-r/jimp 0.6.6 → 0.6.7

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 +12 -6
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -86,7 +86,8 @@ async function performCommand(host, instance, localUri, command, outputType, fin
86
86
  });
87
87
  }
88
88
  function execOptions(settings) {
89
- const exec = settings.jimp?.exec;
89
+ var _a;
90
+ const exec = (_a = settings.jimp) === null || _a === void 0 ? void 0 : _a.exec;
90
91
  let uid, gid;
91
92
  if ((0, types_1.isPlainObject)(exec)) {
92
93
  let { uid: u, gid: g } = exec;
@@ -119,7 +120,8 @@ async function transformCommand(localFile, handler, command, outputType, outputA
119
120
  return handler.rotate();
120
121
  default:
121
122
  return handler.rotate(localFile, (err, result) => {
122
- if (!err && handler.host?.moduleName === 'filemanager') {
123
+ var _a;
124
+ if (!err && ((_a = handler.host) === null || _a === void 0 ? void 0 : _a.moduleName) === 'filemanager') {
123
125
  try {
124
126
  handler.host.add(result, parent);
125
127
  }
@@ -499,10 +501,11 @@ class JimpHandler {
499
501
  }
500
502
  }
501
503
  opacity() {
504
+ var _a;
502
505
  if (this.aborted) {
503
506
  return;
504
507
  }
505
- const value = this.instance.opacityValue ?? NaN;
508
+ const value = (_a = this.instance.opacityValue) !== null && _a !== void 0 ? _a : NaN;
506
509
  if (value >= 0) {
507
510
  this.handler = this.handler.opacity(value);
508
511
  }
@@ -557,7 +560,8 @@ class JimpHandler {
557
560
  return this.instance.aborted;
558
561
  }
559
562
  get rotateCount() {
560
- return this.instance.rotateData?.values.length || 0;
563
+ var _a;
564
+ return ((_a = this.instance.rotateData) === null || _a === void 0 ? void 0 : _a.values.length) || 0;
561
565
  }
562
566
  }
563
567
  class Jimp extends Image {
@@ -632,8 +636,9 @@ class Jimp extends Image {
632
636
  .finally(() => buffer && !options.cache && removeFile(file));
633
637
  }
634
638
  parseRotate(value) {
639
+ var _a;
635
640
  const data = super.parseRotate(value);
636
- if (data && this.settings.jimp?.rotate_clockwise) {
641
+ if (data && ((_a = this.settings.jimp) === null || _a === void 0 ? void 0 : _a.rotate_clockwise)) {
637
642
  const values = data.values;
638
643
  for (let i = 0; i < values.length; ++i) {
639
644
  values[i] *= -1;
@@ -646,6 +651,7 @@ class Jimp extends Image {
646
651
  return Promise.reject((0, types_1.createAbortError)());
647
652
  }
648
653
  return new Promise(async (resolve, reject) => {
654
+ var _a;
649
655
  const { host, file } = data;
650
656
  const localUri = host.getLocalUri(data);
651
657
  const mimeType = host.getMimeType(data);
@@ -659,7 +665,7 @@ class Jimp extends Image {
659
665
  }
660
666
  const [outputType, saveAs, finalAs] = (0, util_1.parseFormat)(command = command.trim(), mimeType, true);
661
667
  if (!outputType) {
662
- reject((0, types_1.errorValue)("Invalid format", /^\w+/.exec(command)?.[0] || "Unknown"));
668
+ reject((0, types_1.errorValue)("Invalid format", ((_a = /^\w+/.exec(command)) === null || _a === void 0 ? void 0 : _a[0]) || "Unknown"));
663
669
  return;
664
670
  }
665
671
  const replace = command.includes('@');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/jimp",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
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.8.7",
24
- "@e-mc/types": "^0.8.7",
23
+ "@e-mc/image": "^0.8.8",
24
+ "@e-mc/types": "^0.8.8",
25
25
  "bmp-js": "^0.1.0",
26
26
  "gifwrap": "^0.10.1",
27
27
  "jimp": "^0.22.12"