@pi-r/jimp 0.5.2 → 0.5.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.
Files changed (4) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/index.js +13 -12
  4. package/package.json +3 -3
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 Wit Studio
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
@@ -1,6 +1,6 @@
1
1
  # @pi-r/jimp
2
2
 
3
- PEP 402 - Forever Vivy
3
+ PEP 402 - Forever
4
4
 
5
5
  ## LICENSE
6
6
 
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
- const exec = settings.jimp?.exec;
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
- if (!err && handler.host?.moduleName === 'filemanager') {
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
  }
@@ -500,10 +501,11 @@ class JimpHandler {
500
501
  }
501
502
  }
502
503
  opacity() {
504
+ var _a;
503
505
  if (this.aborted) {
504
506
  return;
505
507
  }
506
- const value = this.instance.opacityValue ?? NaN;
508
+ const value = (_a = this.instance.opacityValue) !== null && _a !== void 0 ? _a : NaN;
507
509
  if (value >= 0) {
508
510
  this.handler = this.handler.opacity(value);
509
511
  }
@@ -558,7 +560,8 @@ class JimpHandler {
558
560
  return this.instance.aborted;
559
561
  }
560
562
  get rotateCount() {
561
- 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;
562
565
  }
563
566
  }
564
567
  class Jimp extends Image {
@@ -633,8 +636,9 @@ class Jimp extends Image {
633
636
  .finally(() => buffer && !options.cache && removeFile(file));
634
637
  }
635
638
  parseRotate(value) {
639
+ var _a;
636
640
  const data = super.parseRotate(value);
637
- if (data && this.settings.jimp?.rotate_clockwise) {
641
+ if (data && ((_a = this.settings.jimp) === null || _a === void 0 ? void 0 : _a.rotate_clockwise)) {
638
642
  const values = data.values;
639
643
  for (let i = 0; i < values.length; ++i) {
640
644
  values[i] *= -1;
@@ -647,6 +651,7 @@ class Jimp extends Image {
647
651
  return Promise.reject((0, types_1.createAbortError)());
648
652
  }
649
653
  return new Promise(async (resolve, reject) => {
654
+ var _a;
650
655
  const { host, file } = data;
651
656
  const localUri = host.getLocalUri(data);
652
657
  const mimeType = host.getMimeType(data);
@@ -660,7 +665,7 @@ class Jimp extends Image {
660
665
  }
661
666
  const [outputType, saveAs, finalAs] = (0, util_1.parseFormat)(command = command.trim(), mimeType, true);
662
667
  if (!outputType) {
663
- 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"));
664
669
  return;
665
670
  }
666
671
  const replace = command.indexOf('@') !== -1;
@@ -1003,9 +1008,5 @@ class Jimp extends Image {
1003
1008
  return (_a = this.module).settings || (_a.settings = {});
1004
1009
  }
1005
1010
  }
1006
- exports.default = Jimp;
1007
1011
 
1008
- if (exports.default) {
1009
- module.exports = exports.default;
1010
- module.exports.default = exports.default;
1011
- }
1012
+ module.exports = Jimp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/jimp",
3
- "version": "0.5.2",
3
+ "version": "0.5.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.7.2",
24
- "@e-mc/types": "^0.7.2",
23
+ "@e-mc/image": "^0.7.5",
24
+ "@e-mc/types": "^0.7.5",
25
25
  "bmp-js": "^0.1.0",
26
26
  "gifwrap": "^0.10.1",
27
27
  "jimp": "^0.22.12"