@revizly/sharp 0.35.0-revizly51 → 0.35.0-revizly52

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/dist/channel.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/channel.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/colour.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/colour.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/input.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/input.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/is.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/is.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/libvips.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/libvips.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/output.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/output.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/resize.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/resize.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/sharp.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/sharp.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/utility.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/dist/utility.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/install/build.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revizly/sharp",
3
3
  "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
4
- "version": "0.35.0-revizly51",
4
+ "version": "0.35.0-revizly52",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",
7
7
  "contributors": [
@@ -163,10 +163,10 @@
163
163
  "semver": "^7.8.5"
164
164
  },
165
165
  "optionalDependencies": {
166
- "@revizly/sharp-libvips-linux-arm64": "1.0.52",
167
- "@revizly/sharp-libvips-linux-x64": "1.0.52",
168
- "@revizly/sharp-linux-arm64": "0.35.0-revizly51",
169
- "@revizly/sharp-linux-x64": "0.35.0-revizly51"
166
+ "@revizly/sharp-libvips-linux-arm64": "1.0.53",
167
+ "@revizly/sharp-libvips-linux-x64": "1.0.53",
168
+ "@revizly/sharp-linux-arm64": "0.35.0-revizly52",
169
+ "@revizly/sharp-linux-x64": "0.35.0-revizly52"
170
170
  },
171
171
  "peerDependenciesMeta": {
172
172
  "@types/node": {
@@ -177,7 +177,7 @@
177
177
  "@biomejs/biome": "^2.5.14",
178
178
  "@cpplint/cli": "^0.1.0",
179
179
  "@emnapi/runtime": "^1.11.3",
180
- "@revizly/sharp-libvips-dev": "1.0.52",
180
+ "@revizly/sharp-libvips-dev": "1.0.53",
181
181
  "@types/node": "*",
182
182
  "emnapi": "^1.11.3",
183
183
  "exif-reader": "^2.0.3",
package/src/binding.gyp CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2013 Lovell Fuller and others.
1
+ # SPDX-FileCopyrightText: 2013 Lovell Fuller and others
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  { # noqa: B018
package/src/common.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -635,7 +635,7 @@ namespace sharp {
635
635
  if (HasProfile(image)) {
636
636
  size_t length;
637
637
  const void *data = image.get_blob(VIPS_META_ICC_NAME, &length);
638
- icc.first = static_cast<char*>(vips_malloc(reinterpret_cast<VipsObject*>(image.get_image()), length));
638
+ icc.first = static_cast<char*>(g_malloc(length));
639
639
  icc.second = length;
640
640
  memcpy(icc.first, data, length);
641
641
  }
@@ -648,7 +648,7 @@ namespace sharp {
648
648
  VImage SetProfile(VImage image, std::pair<char*, size_t> icc) {
649
649
  if (icc.first != nullptr) {
650
650
  image = image.copy();
651
- image.set(VIPS_META_ICC_NAME, nullptr, icc.first, icc.second);
651
+ image.set(VIPS_META_ICC_NAME, reinterpret_cast<VipsCallbackFn>(vips_area_free_cb), icc.first, icc.second);
652
652
  }
653
653
  return image;
654
654
  }
@@ -720,7 +720,7 @@ namespace sharp {
720
720
  if (hasDelay) {
721
721
  if (delay.size() == 1) {
722
722
  // We have just one delay, repeat that value for all frames.
723
- delay.insert(delay.end(), nPages - 1, delay[0]);
723
+ delay.insert(delay.end(), std::max(0, nPages - 1), delay[0]);
724
724
  }
725
725
  copy.set("delay", delay);
726
726
  }
package/src/common.h CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/metadata.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/metadata.h CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/operations.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/operations.h CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/pipeline.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
@@ -638,15 +638,17 @@ class PipelineWorker : public Napi::AsyncWorker {
638
638
  std::tie(image, background) = sharp::ApplyAlpha(image, baton->extendBackground, shouldPremultiplyAlpha);
639
639
  }
640
640
  image = sharp::StaySequential(image, nPages > 1 || baton->extendWith != VIPS_EXTEND_BACKGROUND);
641
- auto options = VImage::option()->set("extend", baton->extendWith);
642
- if (baton->extendWith == VIPS_EXTEND_BACKGROUND) {
643
- options->set("background", background);
641
+ if (nPages > 1) {
642
+ image = sharp::EmbedMultiPage(image,
643
+ baton->extendLeft, baton->extendTop, baton->width, baton->height,
644
+ baton->extendWith, background, nPages, &targetPageHeight);
645
+ } else {
646
+ auto options = VImage::option()->set("extend", baton->extendWith);
647
+ if (baton->extendWith == VIPS_EXTEND_BACKGROUND) {
648
+ options->set("background", background);
649
+ }
650
+ image = image.embed(baton->extendLeft, baton->extendTop, baton->width, baton->height, options);
644
651
  }
645
- image = nPages > 1
646
- ? sharp::EmbedMultiPage(image,
647
- baton->extendLeft, baton->extendTop, baton->width, baton->height,
648
- baton->extendWith, background, nPages, &targetPageHeight)
649
- : image.embed(baton->extendLeft, baton->extendTop, baton->width, baton->height, options);
650
652
  if (baton->keepGainMap) {
651
653
  gainMap = gainMap.embed(baton->extendLeft / gainMapScaleFactor, baton->extendTop / gainMapScaleFactor,
652
654
  baton->width / gainMapScaleFactor, baton->height / gainMapScaleFactor, VImage::option()
@@ -888,7 +890,11 @@ class PipelineWorker : public Napi::AsyncWorker {
888
890
  image = image.colourspace(baton->colourspace, VImage::option()->set("source_space", image.interpretation()));
889
891
  if (inputProfile.first != nullptr && baton->withIccProfile.empty()) {
890
892
  image = sharp::SetProfile(image, inputProfile);
893
+ } else {
894
+ g_free(inputProfile.first);
891
895
  }
896
+ } else {
897
+ g_free(inputProfile.first);
892
898
  }
893
899
 
894
900
  // Extract channel
@@ -1383,8 +1389,7 @@ class PipelineWorker : public Napi::AsyncWorker {
1383
1389
  baton->formatOut = "v";
1384
1390
  } else {
1385
1391
  // Unsupported output format
1386
- (baton->err).append("Unsupported output format " + baton->fileOut);
1387
- return Error();
1392
+ throw std::runtime_error("Unsupported output format " + baton->fileOut);
1388
1393
  }
1389
1394
  }
1390
1395
  } catch (std::runtime_error const &err) {
@@ -1467,7 +1472,7 @@ class PipelineWorker : public Napi::AsyncWorker {
1467
1472
  // ECMAScript ArrayBuffer with Uint8Array view
1468
1473
  Napi::TypedArrayOf<uint8_t> data = Napi::Buffer<char>::Copy(env,
1469
1474
  static_cast<char*>(baton->bufferOut), baton->bufferOutLength);
1470
- sharp::FreeCallback(static_cast<char*>(baton->bufferOut), nullptr);
1475
+ sharp::FreeCallback(nullptr, static_cast<char*>(baton->bufferOut));
1471
1476
  Callback().SHARP_CALLBACK_FN_NAME(Receiver().Value(), { env.Null(), data, info });
1472
1477
  } else {
1473
1478
  // Node.js Buffer
@@ -1659,6 +1664,8 @@ class PipelineWorker : public Napi::AsyncWorker {
1659
1664
  image = image.copy();
1660
1665
  image.set("gainmap-data", reinterpret_cast<VipsCallbackFn>(vips_area_free_cb),
1661
1666
  gainMapJpeg->data, gainMapJpeg->length);
1667
+ gainMapJpeg->free_fn = nullptr;
1668
+ vips_area_unref(gainMapJpeg);
1662
1669
  return image;
1663
1670
  }
1664
1671
 
package/src/pipeline.h CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/sharp.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/stats.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/stats.h CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/utilities.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
package/src/utilities.h CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Copyright 2013 Lovell Fuller and others.
2
+ SPDX-FileCopyrightText: 2013 Lovell Fuller and others
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5