@pi-r/jimp 0.3.3 → 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.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/index.js +12 -6
  3. package/package.json +3 -3
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 Lisa Mishima
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/index.js CHANGED
@@ -86,7 +86,8 @@ function performCommand(host, instance, localUri, command, outputType, finalAs,
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
  }
@@ -501,10 +503,11 @@ class JimpHandler {
501
503
  }
502
504
  }
503
505
  opacity() {
506
+ var _a;
504
507
  if (this.aborted) {
505
508
  return;
506
509
  }
507
- const value = this.instance.opacityValue ?? NaN;
510
+ const value = (_a = this.instance.opacityValue) !== null && _a !== void 0 ? _a : NaN;
508
511
  if (value >= 0) {
509
512
  this.handler = this.handler.opacity(value);
510
513
  }
@@ -559,7 +562,8 @@ class JimpHandler {
559
562
  return this.instance.aborted;
560
563
  }
561
564
  get rotateCount() {
562
- return this.instance.rotateData?.values.length || 0;
565
+ var _a;
566
+ return ((_a = this.instance.rotateData) === null || _a === void 0 ? void 0 : _a.values.length) || 0;
563
567
  }
564
568
  }
565
569
  class Jimp extends Image {
@@ -634,8 +638,9 @@ class Jimp extends Image {
634
638
  .finally(() => buffer && !options.cache && removeFile(file));
635
639
  }
636
640
  parseRotate(value) {
641
+ var _a;
637
642
  const data = super.parseRotate(value);
638
- if (data && this.settings.jimp?.rotate_clockwise) {
643
+ if (data && ((_a = this.settings.jimp) === null || _a === void 0 ? void 0 : _a.rotate_clockwise)) {
639
644
  const values = data.values;
640
645
  for (let i = 0; i < values.length; ++i) {
641
646
  values[i] *= -1;
@@ -648,6 +653,7 @@ class Jimp extends Image {
648
653
  return Promise.reject((0, types_1.createAbortError)());
649
654
  }
650
655
  return new Promise(async (resolve, reject) => {
656
+ var _a;
651
657
  const { host, file } = data;
652
658
  const localUri = host.getLocalUri(data);
653
659
  const mimeType = host.getMimeType(data);
@@ -661,7 +667,7 @@ class Jimp extends Image {
661
667
  }
662
668
  const [outputType, saveAs, finalAs] = (0, util_1.parseFormat)(command = command.trim(), mimeType, true);
663
669
  if (!outputType) {
664
- reject((0, types_1.errorValue)("Invalid format", /^\w+/.exec(command)?.[0] || "Unknown"));
670
+ reject((0, types_1.errorValue)("Invalid format", ((_a = /^\w+/.exec(command)) === null || _a === void 0 ? void 0 : _a[0]) || "Unknown"));
665
671
  return;
666
672
  }
667
673
  const replace = command.indexOf('@') !== -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/jimp",
3
- "version": "0.3.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.2",
24
- "@e-mc/types": "^0.6.2",
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"