@basemaps/lambda-tiler 6.19.0 → 6.20.0

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 (157) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +2 -2
  3. package/build/__test__/tile.style.json.test.d.ts +2 -0
  4. package/build/__test__/tile.style.json.test.d.ts.map +1 -0
  5. package/build/__test__/tile.style.json.test.js +33 -0
  6. package/build/__test__/xyz.test.js +24 -23
  7. package/build/cli/dump.js +2 -2
  8. package/build/index.d.ts.map +1 -1
  9. package/build/index.js +2 -0
  10. package/build/routes/esri/rest.d.ts +10 -0
  11. package/build/routes/esri/rest.d.ts.map +1 -0
  12. package/build/routes/esri/rest.js +87 -0
  13. package/build/routes/imagery.d.ts +2 -0
  14. package/build/routes/imagery.d.ts.map +1 -1
  15. package/build/routes/imagery.js +3 -1
  16. package/build/routes/response.d.ts +4 -0
  17. package/build/routes/response.d.ts.map +1 -0
  18. package/build/routes/response.js +3 -0
  19. package/build/routes/tile.d.ts +0 -20
  20. package/build/routes/tile.d.ts.map +1 -1
  21. package/build/routes/tile.js +11 -161
  22. package/build/routes/tile.json.d.ts +10 -0
  23. package/build/routes/tile.json.d.ts.map +1 -0
  24. package/build/routes/tile.json.js +31 -0
  25. package/build/routes/tile.style.json.d.ts +10 -0
  26. package/build/routes/tile.style.json.d.ts.map +1 -0
  27. package/build/routes/tile.style.json.js +74 -0
  28. package/build/routes/tile.wmts.d.ts +9 -0
  29. package/build/routes/tile.wmts.d.ts.map +1 -0
  30. package/build/routes/tile.wmts.js +57 -0
  31. package/build/routes/tile.xyz.d.ts +13 -0
  32. package/build/routes/tile.xyz.d.ts.map +1 -0
  33. package/build/routes/tile.xyz.js +28 -0
  34. package/build/tile.set.raster.d.ts +2 -0
  35. package/build/tile.set.raster.d.ts.map +1 -1
  36. package/build/tile.set.raster.js +3 -1
  37. package/build/tile.set.vector.js +1 -1
  38. package/dist/index.js +10545 -9583
  39. package/dist/node_modules/color/README.md +7 -7
  40. package/dist/node_modules/color/index.js +173 -158
  41. package/dist/node_modules/color/package.json +18 -16
  42. package/dist/node_modules/color-convert/conversions.js +281 -310
  43. package/dist/node_modules/color-convert/index.js +27 -24
  44. package/dist/node_modules/color-convert/package.json +16 -14
  45. package/dist/node_modules/color-convert/route.js +22 -22
  46. package/dist/node_modules/color-name/package.json +17 -14
  47. package/dist/node_modules/color-string/package.json +5 -5
  48. package/dist/node_modules/decompress-response/index.d.ts +14 -21
  49. package/dist/node_modules/decompress-response/index.js +34 -16
  50. package/dist/node_modules/decompress-response/license +1 -1
  51. package/dist/node_modules/decompress-response/package.json +23 -17
  52. package/dist/node_modules/decompress-response/readme.md +2 -6
  53. package/dist/node_modules/detect-libc/package.json +0 -1
  54. package/dist/node_modules/mimic-response/index.d.ts +2 -2
  55. package/dist/node_modules/mimic-response/index.js +41 -2
  56. package/dist/node_modules/mimic-response/package.json +17 -17
  57. package/dist/node_modules/mimic-response/readme.md +22 -1
  58. package/dist/node_modules/node-abi/.circleci/config.yml +63 -0
  59. package/dist/node_modules/node-abi/.releaserc.json +9 -0
  60. package/dist/node_modules/node-abi/abi_registry.json +39 -4
  61. package/dist/node_modules/node-abi/index.js +5 -2
  62. package/dist/node_modules/node-abi/package.json +17 -16
  63. package/dist/node_modules/node-abi/test/index.js +7 -15
  64. package/dist/node_modules/node-addon-api/README.md +2 -2
  65. package/dist/node_modules/node-addon-api/except.gypi +20 -11
  66. package/dist/node_modules/node-addon-api/napi-inl.h +734 -196
  67. package/dist/node_modules/node-addon-api/napi.h +420 -164
  68. package/dist/node_modules/node-addon-api/noexcept.gypi +21 -11
  69. package/dist/node_modules/node-addon-api/package.json +43 -14
  70. package/dist/node_modules/node-addon-api/tools/clang-format.js +18 -17
  71. package/dist/node_modules/node-addon-api/tools/eslint-format.js +71 -0
  72. package/dist/node_modules/prebuild-install/CHANGELOG.md +24 -7
  73. package/dist/node_modules/prebuild-install/README.md +24 -4
  74. package/dist/node_modules/prebuild-install/asset.js +10 -10
  75. package/dist/node_modules/prebuild-install/bin.js +13 -13
  76. package/dist/node_modules/prebuild-install/download.js +22 -22
  77. package/dist/node_modules/prebuild-install/log.js +4 -4
  78. package/dist/node_modules/prebuild-install/node_modules/detect-libc/LICENSE +201 -0
  79. package/dist/node_modules/prebuild-install/node_modules/detect-libc/README.md +160 -0
  80. package/dist/node_modules/prebuild-install/node_modules/detect-libc/index.d.ts +11 -0
  81. package/dist/node_modules/prebuild-install/node_modules/detect-libc/lib/detect-libc.js +178 -0
  82. package/dist/node_modules/prebuild-install/node_modules/detect-libc/lib/process.js +16 -0
  83. package/dist/node_modules/prebuild-install/node_modules/detect-libc/package.json +71 -0
  84. package/dist/node_modules/prebuild-install/package.json +18 -19
  85. package/dist/node_modules/prebuild-install/proxy.js +10 -10
  86. package/dist/node_modules/prebuild-install/rc.js +12 -12
  87. package/dist/node_modules/prebuild-install/util.js +14 -14
  88. package/dist/node_modules/semver/package.json +1 -0
  89. package/dist/node_modules/sharp/README.md +2 -2
  90. package/dist/node_modules/sharp/binding.gyp +12 -9
  91. package/dist/node_modules/sharp/build/Release/sharp-linux-x64.node +0 -0
  92. package/dist/node_modules/sharp/install/dll-copy.js +6 -6
  93. package/dist/node_modules/sharp/install/libvips.js +4 -8
  94. package/dist/node_modules/sharp/lib/channel.js +11 -7
  95. package/dist/node_modules/sharp/lib/colour.js +42 -1
  96. package/dist/node_modules/sharp/lib/constructor.js +18 -31
  97. package/dist/node_modules/sharp/lib/input.js +45 -3
  98. package/dist/node_modules/sharp/lib/is.js +19 -5
  99. package/dist/node_modules/sharp/lib/libvips.js +4 -19
  100. package/dist/node_modules/sharp/lib/operation.js +28 -5
  101. package/dist/node_modules/sharp/lib/output.js +147 -16
  102. package/dist/node_modules/sharp/lib/sharp.js +31 -0
  103. package/dist/node_modules/sharp/lib/utility.js +3 -2
  104. package/dist/node_modules/sharp/package.json +32 -23
  105. package/dist/node_modules/sharp/src/common.cc +67 -11
  106. package/dist/node_modules/sharp/src/common.h +25 -5
  107. package/dist/node_modules/sharp/src/libvips/cplusplus/VConnection.cpp +0 -26
  108. package/dist/node_modules/sharp/src/libvips/cplusplus/VImage.cpp +54 -16
  109. package/dist/node_modules/sharp/src/libvips/cplusplus/VInterpolate.cpp +0 -13
  110. package/dist/node_modules/sharp/src/libvips/cplusplus/vips-operators.cpp +185 -1
  111. package/dist/node_modules/sharp/src/metadata.cc +14 -0
  112. package/dist/node_modules/sharp/src/metadata.h +1 -0
  113. package/dist/node_modules/sharp/src/operations.cc +29 -3
  114. package/dist/node_modules/sharp/src/operations.h +13 -2
  115. package/dist/node_modules/sharp/src/pipeline.cc +103 -35
  116. package/dist/node_modules/sharp/src/pipeline.h +23 -3
  117. package/dist/node_modules/sharp/src/utilities.cc +1 -1
  118. package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/THIRD-PARTY-NOTICES.md +2 -3
  119. package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/lib/libvips-cpp.so.42 +0 -0
  120. package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/platform.json +0 -0
  121. package/dist/node_modules/sharp/vendor/8.11.3/linux-x64/versions.json +30 -0
  122. package/dist/node_modules/simple-get/.github/dependabot.yml +15 -0
  123. package/dist/node_modules/simple-get/.github/workflows/ci.yml +23 -0
  124. package/dist/node_modules/simple-get/README.md +17 -3
  125. package/dist/node_modules/simple-get/index.js +9 -0
  126. package/dist/node_modules/simple-get/package.json +27 -13
  127. package/dist/package-lock.json +51 -51
  128. package/dist/package.json +9 -9
  129. package/package.json +10 -10
  130. package/src/__test__/tile.style.json.test.ts +40 -0
  131. package/src/__test__/xyz.test.ts +32 -30
  132. package/src/cli/dump.ts +2 -2
  133. package/src/index.ts +2 -0
  134. package/src/routes/esri/rest.ts +90 -0
  135. package/src/routes/imagery.ts +3 -1
  136. package/src/routes/response.ts +4 -0
  137. package/src/routes/tile.json.ts +44 -0
  138. package/src/routes/tile.style.json.ts +77 -0
  139. package/src/routes/tile.ts +11 -183
  140. package/src/routes/tile.wmts.ts +59 -0
  141. package/src/routes/tile.xyz.ts +30 -0
  142. package/src/tile.set.raster.ts +4 -1
  143. package/src/tile.set.vector.ts +1 -1
  144. package/tsconfig.tsbuildinfo +1 -1
  145. package/dist/node_modules/color-name/.eslintrc.json +0 -43
  146. package/dist/node_modules/color-name/test.js +0 -7
  147. package/dist/node_modules/node-abi/.travis.yml +0 -17
  148. package/dist/node_modules/node-abi/node_modules/semver/CHANGELOG.md +0 -39
  149. package/dist/node_modules/node-abi/node_modules/semver/LICENSE +0 -15
  150. package/dist/node_modules/node-abi/node_modules/semver/README.md +0 -412
  151. package/dist/node_modules/node-abi/node_modules/semver/bin/semver +0 -160
  152. package/dist/node_modules/node-abi/node_modules/semver/package.json +0 -60
  153. package/dist/node_modules/node-abi/node_modules/semver/range.bnf +0 -16
  154. package/dist/node_modules/node-abi/node_modules/semver/semver.js +0 -1483
  155. package/dist/node_modules/node-addon-api/CHANGELOG.md +0 -722
  156. package/dist/node_modules/sharp/build/Release/sharp.node +0 -0
  157. package/dist/node_modules/sharp/vendor/8.10.6/versions.json +0 -31
@@ -67,6 +67,7 @@ class PipelineWorker : public Napi::AsyncWorker {
67
67
  vips::VImage image;
68
68
  sharp::ImageType inputImageType;
69
69
  std::tie(image, inputImageType) = sharp::OpenInput(baton->input);
70
+ image = sharp::EnsureColourspace(image, baton->colourspaceInput);
70
71
 
71
72
  // Calculate angle of rotation
72
73
  VipsAngle rotation;
@@ -89,7 +90,7 @@ class PipelineWorker : public Napi::AsyncWorker {
89
90
  }
90
91
  if (baton->rotationAngle != 0.0) {
91
92
  std::vector<double> background;
92
- std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground);
93
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, FALSE);
93
94
  image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background));
94
95
  }
95
96
  }
@@ -214,7 +215,7 @@ class PipelineWorker : public Napi::AsyncWorker {
214
215
  double yresidual = static_cast<double>(yshrink) / yfactor;
215
216
 
216
217
  // If integral x and y shrink are equal, try to use shrink-on-load for JPEG and WebP,
217
- // but not when applying gamma correction, pre-resize extract or trim
218
+ // but not when applying gamma correction, pre-resize extract, trim or input colourspace
218
219
  int shrink_on_load = 1;
219
220
 
220
221
  int shrink_on_load_factor = 1;
@@ -227,6 +228,7 @@ class PipelineWorker : public Napi::AsyncWorker {
227
228
  xshrink == yshrink && xshrink >= 2 * shrink_on_load_factor &&
228
229
  (inputImageType == sharp::ImageType::JPEG || inputImageType == sharp::ImageType::WEBP) &&
229
230
  baton->gamma == 0 && baton->topOffsetPre == -1 && baton->trimThreshold == 0.0 &&
231
+ baton->colourspaceInput == VIPS_INTERPRETATION_LAST &&
230
232
  image.width() > 3 && image.height() > 3 && baton->input->pages == 1
231
233
  ) {
232
234
  if (xshrink >= 8 * shrink_on_load_factor) {
@@ -287,16 +289,21 @@ class PipelineWorker : public Napi::AsyncWorker {
287
289
  yfactor = static_cast<double>(shrunkOnLoadHeight) / static_cast<double>(targetResizeHeight);
288
290
  }
289
291
  }
292
+ // Remove animation properties from single page images
293
+ if (baton->input->pages == 1) {
294
+ image = sharp::RemoveAnimationProperties(image);
295
+ }
290
296
 
291
297
  // Ensure we're using a device-independent colour space
298
+ char const *processingProfile = image.interpretation() == VIPS_INTERPRETATION_RGB16 ? "p3" : "srgb";
292
299
  if (
293
300
  sharp::HasProfile(image) &&
294
301
  image.interpretation() != VIPS_INTERPRETATION_LABS &&
295
302
  image.interpretation() != VIPS_INTERPRETATION_GREY16
296
303
  ) {
297
- // Convert to sRGB using embedded profile
304
+ // Convert to sRGB/P3 using embedded profile
298
305
  try {
299
- image = image.icc_transform("srgb", VImage::option()
306
+ image = image.icc_transform(processingProfile, VImage::option()
300
307
  ->set("embedded", TRUE)
301
308
  ->set("depth", image.interpretation() == VIPS_INTERPRETATION_RGB16 ? 16 : 8)
302
309
  ->set("intent", VIPS_INTENT_PERCEPTUAL));
@@ -304,7 +311,7 @@ class PipelineWorker : public Napi::AsyncWorker {
304
311
  // Ignore failure of embedded profile
305
312
  }
306
313
  } else if (image.interpretation() == VIPS_INTERPRETATION_CMYK) {
307
- image = image.icc_transform("srgb", VImage::option()
314
+ image = image.icc_transform(processingProfile, VImage::option()
308
315
  ->set("input_profile", "cmyk")
309
316
  ->set("intent", VIPS_INTENT_PERCEPTUAL));
310
317
  }
@@ -325,7 +332,7 @@ class PipelineWorker : public Napi::AsyncWorker {
325
332
 
326
333
  // Negate the colours in the image
327
334
  if (baton->negate) {
328
- image = image.invert();
335
+ image = sharp::Negate(image, baton->negateAlpha);
329
336
  }
330
337
 
331
338
  // Gamma encoding (darken)
@@ -344,7 +351,8 @@ class PipelineWorker : public Napi::AsyncWorker {
344
351
  bool const shouldSharpen = baton->sharpenSigma != 0.0;
345
352
  bool const shouldApplyMedian = baton->medianSize > 0;
346
353
  bool const shouldComposite = !baton->composite.empty();
347
- bool const shouldModulate = baton->brightness != 1.0 || baton->saturation != 1.0 || baton->hue != 0.0;
354
+ bool const shouldModulate = baton->brightness != 1.0 || baton->saturation != 1.0 ||
355
+ baton->hue != 0.0 || baton->lightness != 0.0;
348
356
  bool const shouldApplyClahe = baton->claheWidth != 0 && baton->claheHeight != 0;
349
357
 
350
358
  if (shouldComposite && !sharp::HasAlpha(image)) {
@@ -374,11 +382,15 @@ class PipelineWorker : public Napi::AsyncWorker {
374
382
  // Ensure shortest edge is at least 1 pixel
375
383
  if (image.width() / xfactor < 0.5) {
376
384
  xfactor = 2 * image.width();
377
- baton->width = 1;
385
+ if (baton->canvas != Canvas::EMBED) {
386
+ baton->width = 1;
387
+ }
378
388
  }
379
389
  if (image.height() / yfactor < 0.5) {
380
390
  yfactor = 2 * image.height();
381
- baton->height = 1;
391
+ if (baton->canvas != Canvas::EMBED) {
392
+ baton->height = 1;
393
+ }
382
394
  }
383
395
  image = image.resize(1.0 / xfactor, VImage::option()
384
396
  ->set("vscale", 1.0 / yfactor)
@@ -411,6 +423,7 @@ class PipelineWorker : public Napi::AsyncWorker {
411
423
 
412
424
  for (unsigned int i = 0; i < baton->joinChannelIn.size(); i++) {
413
425
  std::tie(joinImage, joinImageType) = sharp::OpenInput(baton->joinChannelIn[i]);
426
+ joinImage = sharp::EnsureColourspace(joinImage, baton->colourspaceInput);
414
427
  image = image.bandjoin(joinImage);
415
428
  }
416
429
  image = image.copy(VImage::option()->set("interpretation", baton->colourspace));
@@ -420,7 +433,7 @@ class PipelineWorker : public Napi::AsyncWorker {
420
433
  if (image.width() != baton->width || image.height() != baton->height) {
421
434
  if (baton->canvas == Canvas::EMBED) {
422
435
  std::vector<double> background;
423
- std::tie(image, background) = sharp::ApplyAlpha(image, baton->resizeBackground);
436
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->resizeBackground, shouldPremultiplyAlpha);
424
437
 
425
438
  // Embed
426
439
 
@@ -477,7 +490,7 @@ class PipelineWorker : public Napi::AsyncWorker {
477
490
  // Rotate post-extract non-90 angle
478
491
  if (!baton->rotateBeforePreExtract && baton->rotationAngle != 0.0) {
479
492
  std::vector<double> background;
480
- std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground);
493
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, shouldPremultiplyAlpha);
481
494
  image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background));
482
495
  }
483
496
 
@@ -490,7 +503,7 @@ class PipelineWorker : public Napi::AsyncWorker {
490
503
  // Affine transform
491
504
  if (baton->affineMatrix.size() > 0) {
492
505
  std::vector<double> background;
493
- std::tie(image, background) = sharp::ApplyAlpha(image, baton->affineBackground);
506
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->affineBackground, shouldPremultiplyAlpha);
494
507
  image = image.affine(baton->affineMatrix, VImage::option()->set("background", background)
495
508
  ->set("idx", baton->affineIdx)
496
509
  ->set("idy", baton->affineIdy)
@@ -502,7 +515,7 @@ class PipelineWorker : public Napi::AsyncWorker {
502
515
  // Extend edges
503
516
  if (baton->extendTop > 0 || baton->extendBottom > 0 || baton->extendLeft > 0 || baton->extendRight > 0) {
504
517
  std::vector<double> background;
505
- std::tie(image, background) = sharp::ApplyAlpha(image, baton->extendBackground);
518
+ std::tie(image, background) = sharp::ApplyAlpha(image, baton->extendBackground, shouldPremultiplyAlpha);
506
519
 
507
520
  // Embed
508
521
  baton->width = image.width() + baton->extendLeft + baton->extendRight;
@@ -539,7 +552,7 @@ class PipelineWorker : public Napi::AsyncWorker {
539
552
  }
540
553
 
541
554
  if (shouldModulate) {
542
- image = sharp::Modulate(image, baton->brightness, baton->saturation, baton->hue);
555
+ image = sharp::Modulate(image, baton->brightness, baton->saturation, baton->hue, baton->lightness);
543
556
  }
544
557
 
545
558
  // Sharpen
@@ -552,7 +565,8 @@ class PipelineWorker : public Napi::AsyncWorker {
552
565
  for (Composite *composite : baton->composite) {
553
566
  VImage compositeImage;
554
567
  sharp::ImageType compositeImageType = sharp::ImageType::UNKNOWN;
555
- std::tie(compositeImage, compositeImageType) = OpenInput(composite->input);
568
+ std::tie(compositeImage, compositeImageType) = sharp::OpenInput(composite->input);
569
+ compositeImage = sharp::EnsureColourspace(compositeImage, baton->colourspaceInput);
556
570
  // Verify within current dimensions
557
571
  if (compositeImage.width() > image.width() || compositeImage.height() > image.height()) {
558
572
  throw vips::VError("Image to composite must have same dimensions or smaller");
@@ -661,6 +675,7 @@ class PipelineWorker : public Napi::AsyncWorker {
661
675
  VImage booleanImage;
662
676
  sharp::ImageType booleanImageType = sharp::ImageType::UNKNOWN;
663
677
  std::tie(booleanImage, booleanImageType) = sharp::OpenInput(baton->boolean);
678
+ booleanImage = sharp::EnsureColourspace(booleanImage, baton->colourspaceInput);
664
679
  image = sharp::Boolean(image, booleanImage, baton->booleanOp);
665
680
  }
666
681
 
@@ -710,9 +725,10 @@ class PipelineWorker : public Napi::AsyncWorker {
710
725
  // Convert colourspace, pass the current known interpretation so libvips doesn't have to guess
711
726
  image = image.colourspace(baton->colourspace, VImage::option()->set("source_space", image.interpretation()));
712
727
  // Transform colours from embedded profile to output profile
713
- if (baton->withMetadata && sharp::HasProfile(image)) {
714
- image = image.icc_transform(vips_enum_nick(VIPS_TYPE_INTERPRETATION, baton->colourspace),
715
- VImage::option()->set("embedded", TRUE));
728
+ if (baton->withMetadata && sharp::HasProfile(image) && baton->withMetadataIcc.empty()) {
729
+ image = image.icc_transform("srgb", VImage::option()
730
+ ->set("embedded", TRUE)
731
+ ->set("intent", VIPS_INTENT_PERCEPTUAL));
716
732
  }
717
733
  }
718
734
 
@@ -721,7 +737,8 @@ class PipelineWorker : public Napi::AsyncWorker {
721
737
  image = image.icc_transform(
722
738
  const_cast<char*>(baton->withMetadataIcc.data()),
723
739
  VImage::option()
724
- ->set("input_profile", "srgb")
740
+ ->set("input_profile", processingProfile)
741
+ ->set("embedded", TRUE)
725
742
  ->set("intent", VIPS_INTENT_PERCEPTUAL));
726
743
  }
727
744
  // Override EXIF Orientation tag
@@ -755,6 +772,7 @@ class PipelineWorker : public Napi::AsyncWorker {
755
772
  baton->loop);
756
773
 
757
774
  // Output
775
+ sharp::SetTimeout(image, baton->timeoutSeconds);
758
776
  if (baton->fileOut.empty()) {
759
777
  // Buffer output
760
778
  if (baton->formatOut == "jpeg" || (baton->formatOut == "input" && inputImageType == sharp::ImageType::JPEG)) {
@@ -765,8 +783,8 @@ class PipelineWorker : public Napi::AsyncWorker {
765
783
  ->set("Q", baton->jpegQuality)
766
784
  ->set("interlace", baton->jpegProgressive)
767
785
  ->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
768
- ? VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
769
- : VIPS_FOREIGN_JPEG_SUBSAMPLE_ON)
786
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF
787
+ : VIPS_FOREIGN_SUBSAMPLE_ON)
770
788
  ->set("trellis_quant", baton->jpegTrellisQuantisation)
771
789
  ->set("quant_table", baton->jpegQuantisationTable)
772
790
  ->set("overshoot_deringing", baton->jpegOvershootDeringing)
@@ -782,6 +800,22 @@ class PipelineWorker : public Napi::AsyncWorker {
782
800
  } else {
783
801
  baton->channels = std::min(baton->channels, 3);
784
802
  }
803
+ } else if (baton->formatOut == "jp2" || (baton->formatOut == "input"
804
+ && inputImageType == sharp::ImageType::JP2)) {
805
+ // Write JP2 to Buffer
806
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JP2);
807
+ VipsArea *area = reinterpret_cast<VipsArea*>(image.jp2ksave_buffer(VImage::option()
808
+ ->set("Q", baton->jp2Quality)
809
+ ->set("lossless", baton->jp2Lossless)
810
+ ->set("subsample_mode", baton->jp2ChromaSubsampling == "4:4:4"
811
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
812
+ ->set("tile_height", baton->jp2TileHeight)
813
+ ->set("tile_width", baton->jp2TileWidth)));
814
+ baton->bufferOut = static_cast<char*>(area->data);
815
+ baton->bufferOutLength = area->length;
816
+ area->free_fn = nullptr;
817
+ vips_area_unref(area);
818
+ baton->formatOut = "jp2";
785
819
  } else if (baton->formatOut == "png" || (baton->formatOut == "input" &&
786
820
  (inputImageType == sharp::ImageType::PNG || (inputImageType == sharp::ImageType::GIF && !supportsGifOutput) ||
787
821
  inputImageType == sharp::ImageType::SVG))) {
@@ -794,7 +828,7 @@ class PipelineWorker : public Napi::AsyncWorker {
794
828
  ->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE)
795
829
  ->set("palette", baton->pngPalette)
796
830
  ->set("Q", baton->pngQuality)
797
- ->set("colours", baton->pngColours)
831
+ ->set("bitdepth", baton->pngBitdepth)
798
832
  ->set("dither", baton->pngDither)));
799
833
  baton->bufferOut = static_cast<char*>(area->data);
800
834
  baton->bufferOutLength = area->length;
@@ -863,15 +897,14 @@ class PipelineWorker : public Napi::AsyncWorker {
863
897
  } else if (baton->formatOut == "heif" ||
864
898
  (baton->formatOut == "input" && inputImageType == sharp::ImageType::HEIF)) {
865
899
  // Write HEIF to buffer
900
+ image = sharp::RemoveAnimationProperties(image);
866
901
  VipsArea *area = reinterpret_cast<VipsArea*>(image.heifsave_buffer(VImage::option()
867
902
  ->set("strip", !baton->withMetadata)
868
- ->set("compression", baton->heifCompression)
869
903
  ->set("Q", baton->heifQuality)
904
+ ->set("compression", baton->heifCompression)
870
905
  ->set("speed", baton->heifSpeed)
871
- #if defined(VIPS_TYPE_FOREIGN_SUBSAMPLE)
872
906
  ->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
873
907
  ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
874
- #endif
875
908
  ->set("lossless", baton->heifLossless)));
876
909
  baton->bufferOut = static_cast<char*>(area->data);
877
910
  baton->bufferOutLength = area->length;
@@ -886,9 +919,9 @@ class PipelineWorker : public Napi::AsyncWorker {
886
919
  image = image[0];
887
920
  baton->channels = 1;
888
921
  }
889
- if (image.format() != VIPS_FORMAT_UCHAR) {
890
- // Cast pixels to uint8 (unsigned char)
891
- image = image.cast(VIPS_FORMAT_UCHAR);
922
+ if (image.format() != baton->rawDepth) {
923
+ // Cast pixels to requested format
924
+ image = image.cast(baton->rawDepth);
892
925
  }
893
926
  // Get raw image data
894
927
  baton->bufferOut = static_cast<char*>(image.write_to_memory(&baton->bufferOutLength));
@@ -914,13 +947,14 @@ class PipelineWorker : public Napi::AsyncWorker {
914
947
  bool const isWebp = sharp::IsWebp(baton->fileOut);
915
948
  bool const isGif = sharp::IsGif(baton->fileOut);
916
949
  bool const isTiff = sharp::IsTiff(baton->fileOut);
950
+ bool const isJp2 = sharp::IsJp2(baton->fileOut);
917
951
  bool const isHeif = sharp::IsHeif(baton->fileOut);
918
952
  bool const isDz = sharp::IsDz(baton->fileOut);
919
953
  bool const isDzZip = sharp::IsDzZip(baton->fileOut);
920
954
  bool const isV = sharp::IsV(baton->fileOut);
921
955
  bool const mightMatchInput = baton->formatOut == "input";
922
956
  bool const willMatchInput = mightMatchInput &&
923
- !(isJpeg || isPng || isWebp || isGif || isTiff || isHeif || isDz || isDzZip || isV);
957
+ !(isJpeg || isPng || isWebp || isGif || isTiff || isJp2 || isHeif || isDz || isDzZip || isV);
924
958
 
925
959
  if (baton->formatOut == "jpeg" || (mightMatchInput && isJpeg) ||
926
960
  (willMatchInput && inputImageType == sharp::ImageType::JPEG)) {
@@ -931,8 +965,8 @@ class PipelineWorker : public Napi::AsyncWorker {
931
965
  ->set("Q", baton->jpegQuality)
932
966
  ->set("interlace", baton->jpegProgressive)
933
967
  ->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
934
- ? VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
935
- : VIPS_FOREIGN_JPEG_SUBSAMPLE_ON)
968
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF
969
+ : VIPS_FOREIGN_SUBSAMPLE_ON)
936
970
  ->set("trellis_quant", baton->jpegTrellisQuantisation)
937
971
  ->set("quant_table", baton->jpegQuantisationTable)
938
972
  ->set("overshoot_deringing", baton->jpegOvershootDeringing)
@@ -940,6 +974,18 @@ class PipelineWorker : public Napi::AsyncWorker {
940
974
  ->set("optimize_coding", baton->jpegOptimiseCoding));
941
975
  baton->formatOut = "jpeg";
942
976
  baton->channels = std::min(baton->channels, 3);
977
+ } else if (baton->formatOut == "jp2" || (mightMatchInput && isJp2) ||
978
+ (willMatchInput && (inputImageType == sharp::ImageType::JP2))) {
979
+ // Write JP2 to file
980
+ sharp::AssertImageTypeDimensions(image, sharp::ImageType::JP2);
981
+ image.jp2ksave(const_cast<char*>(baton->fileOut.data()), VImage::option()
982
+ ->set("Q", baton->jp2Quality)
983
+ ->set("lossless", baton->jp2Lossless)
984
+ ->set("subsample_mode", baton->jp2ChromaSubsampling == "4:4:4"
985
+ ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
986
+ ->set("tile_height", baton->jp2TileHeight)
987
+ ->set("tile_width", baton->jp2TileWidth));
988
+ baton->formatOut = "jp2";
943
989
  } else if (baton->formatOut == "png" || (mightMatchInput && isPng) || (willMatchInput &&
944
990
  (inputImageType == sharp::ImageType::PNG || (inputImageType == sharp::ImageType::GIF && !supportsGifOutput) ||
945
991
  inputImageType == sharp::ImageType::SVG))) {
@@ -952,7 +998,7 @@ class PipelineWorker : public Napi::AsyncWorker {
952
998
  ->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE)
953
999
  ->set("palette", baton->pngPalette)
954
1000
  ->set("Q", baton->pngQuality)
955
- ->set("colours", baton->pngColours)
1001
+ ->set("bitdepth", baton->pngBitdepth)
956
1002
  ->set("dither", baton->pngDither));
957
1003
  baton->formatOut = "png";
958
1004
  } else if (baton->formatOut == "webp" || (mightMatchInput && isWebp) ||
@@ -1005,15 +1051,14 @@ class PipelineWorker : public Napi::AsyncWorker {
1005
1051
  } else if (baton->formatOut == "heif" || (mightMatchInput && isHeif) ||
1006
1052
  (willMatchInput && inputImageType == sharp::ImageType::HEIF)) {
1007
1053
  // Write HEIF to file
1054
+ image = sharp::RemoveAnimationProperties(image);
1008
1055
  image.heifsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
1009
1056
  ->set("strip", !baton->withMetadata)
1010
1057
  ->set("Q", baton->heifQuality)
1011
1058
  ->set("compression", baton->heifCompression)
1012
1059
  ->set("speed", baton->heifSpeed)
1013
- #if defined(VIPS_TYPE_FOREIGN_SUBSAMPLE)
1014
1060
  ->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
1015
1061
  ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
1016
- #endif
1017
1062
  ->set("lossless", baton->heifLossless));
1018
1063
  baton->formatOut = "heif";
1019
1064
  } else if (baton->formatOut == "dz" || isDz || isDzZip) {
@@ -1130,6 +1175,9 @@ class PipelineWorker : public Napi::AsyncWorker {
1130
1175
  info.Set("width", static_cast<uint32_t>(width));
1131
1176
  info.Set("height", static_cast<uint32_t>(height));
1132
1177
  info.Set("channels", static_cast<uint32_t>(baton->channels));
1178
+ if (baton->formatOut == "raw") {
1179
+ info.Set("depth", vips_enum_nick(VIPS_TYPE_BAND_FORMAT, baton->rawDepth));
1180
+ }
1133
1181
  info.Set("premultiplied", baton->premultiplied);
1134
1182
  if (baton->hasCropOffset) {
1135
1183
  info.Set("cropOffsetLeft", static_cast<int32_t>(baton->cropOffsetLeft));
@@ -1319,10 +1367,12 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1319
1367
  baton->flatten = sharp::AttrAsBool(options, "flatten");
1320
1368
  baton->flattenBackground = sharp::AttrAsVectorOfDouble(options, "flattenBackground");
1321
1369
  baton->negate = sharp::AttrAsBool(options, "negate");
1370
+ baton->negateAlpha = sharp::AttrAsBool(options, "negateAlpha");
1322
1371
  baton->blurSigma = sharp::AttrAsDouble(options, "blurSigma");
1323
1372
  baton->brightness = sharp::AttrAsDouble(options, "brightness");
1324
1373
  baton->saturation = sharp::AttrAsDouble(options, "saturation");
1325
1374
  baton->hue = sharp::AttrAsInt32(options, "hue");
1375
+ baton->lightness = sharp::AttrAsDouble(options, "lightness");
1326
1376
  baton->medianSize = sharp::AttrAsUint32(options, "medianSize");
1327
1377
  baton->sharpenSigma = sharp::AttrAsDouble(options, "sharpenSigma");
1328
1378
  baton->sharpenFlat = sharp::AttrAsDouble(options, "sharpenFlat");
@@ -1389,6 +1439,10 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1389
1439
  baton->recombMatrix[i] = sharp::AttrAsDouble(recombMatrix, i);
1390
1440
  }
1391
1441
  }
1442
+ baton->colourspaceInput = sharp::GetInterpretation(sharp::AttrAsStr(options, "colourspaceInput"));
1443
+ if (baton->colourspaceInput == VIPS_INTERPRETATION_ERROR) {
1444
+ baton->colourspaceInput = VIPS_INTERPRETATION_LAST;
1445
+ }
1392
1446
  baton->colourspace = sharp::GetInterpretation(sharp::AttrAsStr(options, "colourspace"));
1393
1447
  if (baton->colourspace == VIPS_INTERPRETATION_ERROR) {
1394
1448
  baton->colourspace = VIPS_INTERPRETATION_sRGB;
@@ -1406,6 +1460,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1406
1460
  std::string k = sharp::AttrAsStr(mdStrKeys, i);
1407
1461
  baton->withMetadataStrs.insert(std::make_pair(k, sharp::AttrAsStr(mdStrs, k)));
1408
1462
  }
1463
+ baton->timeoutSeconds = sharp::AttrAsUint32(options, "timeoutSeconds");
1409
1464
  // Format-specific
1410
1465
  baton->jpegQuality = sharp::AttrAsUint32(options, "jpegQuality");
1411
1466
  baton->jpegProgressive = sharp::AttrAsBool(options, "jpegProgressive");
@@ -1420,8 +1475,13 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1420
1475
  baton->pngAdaptiveFiltering = sharp::AttrAsBool(options, "pngAdaptiveFiltering");
1421
1476
  baton->pngPalette = sharp::AttrAsBool(options, "pngPalette");
1422
1477
  baton->pngQuality = sharp::AttrAsUint32(options, "pngQuality");
1423
- baton->pngColours = sharp::AttrAsUint32(options, "pngColours");
1478
+ baton->pngBitdepth = sharp::AttrAsUint32(options, "pngBitdepth");
1424
1479
  baton->pngDither = sharp::AttrAsDouble(options, "pngDither");
1480
+ baton->jp2Quality = sharp::AttrAsUint32(options, "jp2Quality");
1481
+ baton->jp2Lossless = sharp::AttrAsBool(options, "jp2Lossless");
1482
+ baton->jp2TileHeight = sharp::AttrAsUint32(options, "jp2TileHeight");
1483
+ baton->jp2TileWidth = sharp::AttrAsUint32(options, "jp2TileWidth");
1484
+ baton->jp2ChromaSubsampling = sharp::AttrAsStr(options, "jp2ChromaSubsampling");
1425
1485
  baton->webpQuality = sharp::AttrAsUint32(options, "webpQuality");
1426
1486
  baton->webpAlphaQuality = sharp::AttrAsUint32(options, "webpAlphaQuality");
1427
1487
  baton->webpLossless = sharp::AttrAsBool(options, "webpLossless");
@@ -1436,6 +1496,9 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1436
1496
  baton->tiffTileHeight = sharp::AttrAsUint32(options, "tiffTileHeight");
1437
1497
  baton->tiffXres = sharp::AttrAsDouble(options, "tiffXres");
1438
1498
  baton->tiffYres = sharp::AttrAsDouble(options, "tiffYres");
1499
+ if (baton->tiffXres == 1.0 && baton->tiffYres == 1.0 && baton->withMetadataDensity > 0) {
1500
+ baton->tiffXres = baton->tiffYres = baton->withMetadataDensity / 25.4;
1501
+ }
1439
1502
  // tiff compression options
1440
1503
  baton->tiffCompression = static_cast<VipsForeignTiffCompression>(
1441
1504
  vips_enum_from_nick(nullptr, VIPS_TYPE_FOREIGN_TIFF_COMPRESSION,
@@ -1451,6 +1514,11 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1451
1514
  baton->heifSpeed = sharp::AttrAsUint32(options, "heifSpeed");
1452
1515
  baton->heifChromaSubsampling = sharp::AttrAsStr(options, "heifChromaSubsampling");
1453
1516
 
1517
+ // Raw output
1518
+ baton->rawDepth = static_cast<VipsBandFormat>(
1519
+ vips_enum_from_nick(nullptr, VIPS_TYPE_BAND_FORMAT,
1520
+ sharp::AttrAsStr(options, "rawDepth").data()));
1521
+
1454
1522
  // Animated output
1455
1523
  if (sharp::HasAttr(options, "pageHeight")) {
1456
1524
  baton->pageHeight = sharp::AttrAsUint32(options, "pageHeight");
@@ -90,10 +90,12 @@ struct PipelineBaton {
90
90
  bool flatten;
91
91
  std::vector<double> flattenBackground;
92
92
  bool negate;
93
+ bool negateAlpha;
93
94
  double blurSigma;
94
95
  double brightness;
95
96
  double saturation;
96
97
  int hue;
98
+ double lightness;
97
99
  int medianSize;
98
100
  double sharpenSigma;
99
101
  double sharpenFlat;
@@ -145,8 +147,13 @@ struct PipelineBaton {
145
147
  bool pngAdaptiveFiltering;
146
148
  bool pngPalette;
147
149
  int pngQuality;
148
- int pngColours;
150
+ int pngBitdepth;
149
151
  double pngDither;
152
+ int jp2Quality;
153
+ bool jp2Lossless;
154
+ int jp2TileHeight;
155
+ int jp2TileWidth;
156
+ std::string jp2ChromaSubsampling;
150
157
  int webpQuality;
151
158
  int webpAlphaQuality;
152
159
  bool webpNearLossless;
@@ -168,12 +175,14 @@ struct PipelineBaton {
168
175
  int heifSpeed;
169
176
  std::string heifChromaSubsampling;
170
177
  bool heifLossless;
178
+ VipsBandFormat rawDepth;
171
179
  std::string err;
172
180
  bool withMetadata;
173
181
  int withMetadataOrientation;
174
182
  double withMetadataDensity;
175
183
  std::string withMetadataIcc;
176
184
  std::unordered_map<std::string, std::string> withMetadataStrs;
185
+ int timeoutSeconds;
177
186
  std::unique_ptr<double[]> convKernel;
178
187
  int convKernelWidth;
179
188
  int convKernelHeight;
@@ -185,6 +194,7 @@ struct PipelineBaton {
185
194
  int extractChannel;
186
195
  bool removeAlpha;
187
196
  double ensureAlpha;
197
+ VipsInterpretation colourspaceInput;
188
198
  VipsInterpretation colourspace;
189
199
  int pageHeight;
190
200
  std::vector<int> delay;
@@ -219,10 +229,12 @@ struct PipelineBaton {
219
229
  flatten(false),
220
230
  flattenBackground{ 0.0, 0.0, 0.0 },
221
231
  negate(false),
232
+ negateAlpha(true),
222
233
  blurSigma(0.0),
223
234
  brightness(1.0),
224
235
  saturation(1.0),
225
236
  hue(0),
237
+ lightness(0),
226
238
  medianSize(0),
227
239
  sharpenSigma(0.0),
228
240
  sharpenFlat(1.0),
@@ -272,8 +284,13 @@ struct PipelineBaton {
272
284
  pngAdaptiveFiltering(false),
273
285
  pngPalette(false),
274
286
  pngQuality(100),
275
- pngColours(256),
287
+ pngBitdepth(8),
276
288
  pngDither(1.0),
289
+ jp2Quality(80),
290
+ jp2Lossless(false),
291
+ jp2TileHeight(512),
292
+ jp2TileWidth(512),
293
+ jp2ChromaSubsampling("4:4:4"),
277
294
  webpQuality(80),
278
295
  webpAlphaQuality(100),
279
296
  webpNearLossless(false),
@@ -293,11 +310,13 @@ struct PipelineBaton {
293
310
  heifQuality(50),
294
311
  heifCompression(VIPS_FOREIGN_HEIF_COMPRESSION_AV1),
295
312
  heifSpeed(5),
296
- heifChromaSubsampling("4:2:0"),
313
+ heifChromaSubsampling("4:4:4"),
297
314
  heifLossless(false),
315
+ rawDepth(VIPS_FORMAT_UCHAR),
298
316
  withMetadata(false),
299
317
  withMetadataOrientation(-1),
300
318
  withMetadataDensity(0.0),
319
+ timeoutSeconds(0),
301
320
  convKernelWidth(0),
302
321
  convKernelHeight(0),
303
322
  convKernelScale(0.0),
@@ -308,6 +327,7 @@ struct PipelineBaton {
308
327
  extractChannel(-1),
309
328
  removeAlpha(false),
310
329
  ensureAlpha(-1.0),
330
+ colourspaceInput(VIPS_INTERPRETATION_LAST),
311
331
  colourspace(VIPS_INTERPRETATION_LAST),
312
332
  pageHeight(0),
313
333
  delay{-1},
@@ -115,7 +115,7 @@ Napi::Value format(const Napi::CallbackInfo& info) {
115
115
  Napi::Object format = Napi::Object::New(env);
116
116
  for (std::string const f : {
117
117
  "jpeg", "png", "webp", "tiff", "magick", "openslide", "dz",
118
- "ppm", "fits", "gif", "svg", "heif", "pdf", "vips"
118
+ "ppm", "fits", "gif", "svg", "heif", "pdf", "vips", "jp2k"
119
119
  }) {
120
120
  // Input
121
121
  Napi::Boolean hasInputFile =
@@ -8,12 +8,10 @@ used under the terms of the following licences:
8
8
  | aom | BSD 2-Clause + [Alliance for Open Media Patent License 1.0](https://aomedia.org/license/patent-license/) |
9
9
  | cairo | Mozilla Public License 2.0 |
10
10
  | expat | MIT Licence |
11
- | fontconfig | [fontconfig Licence](https://gitlab.freedesktop.org/fontconfig/fontconfig/blob/master/COPYING) (BSD-like) |
11
+ | fontconfig | [fontconfig Licence](https://gitlab.freedesktop.org/fontconfig/fontconfig/blob/main/COPYING) (BSD-like) |
12
12
  | freetype | [freetype Licence](https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) |
13
13
  | fribidi | LGPLv3 |
14
14
  | gdk-pixbuf | LGPLv3 |
15
- | gettext | LGPLv3 |
16
- | giflib | MIT Licence |
17
15
  | glib | LGPLv3 |
18
16
  | harfbuzz | MIT Licence |
19
17
  | lcms | MIT Licence |
@@ -33,6 +31,7 @@ used under the terms of the following licences:
33
31
  | orc | [orc License](https://gitlab.freedesktop.org/gstreamer/orc/blob/master/COPYING) (BSD-like) |
34
32
  | pango | LGPLv3 |
35
33
  | pixman | MIT Licence |
34
+ | proxy-libintl | LGPLv3 |
36
35
  | zlib-ng | [zlib Licence](https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md) |
37
36
 
38
37
  Use of libraries under the terms of the LGPLv3 is via the
@@ -0,0 +1,30 @@
1
+ {
2
+ "aom": "3.1.2",
3
+ "cairo": "1.17.4",
4
+ "exif": "0.6.22",
5
+ "expat": "2.4.1",
6
+ "ffi": "3.4.2",
7
+ "fontconfig": "2.13.93",
8
+ "freetype": "2.10.4",
9
+ "fribidi": "1.0.10",
10
+ "gdkpixbuf": "2.42.6",
11
+ "glib": "2.69.1",
12
+ "gsf": "1.14.47",
13
+ "harfbuzz": "2.8.2",
14
+ "heif": "1.12.0",
15
+ "imagequant": "2.4.1",
16
+ "lcms": "2.12",
17
+ "mozjpeg": "4.0.3",
18
+ "orc": "0.4.32",
19
+ "pango": "1.48.8",
20
+ "pixman": "0.40.0",
21
+ "png": "1.6.37",
22
+ "proxy-libintl": "ef9fe6d",
23
+ "svg": "2.51.4",
24
+ "spng": "0.6.3",
25
+ "tiff": "4.3.0",
26
+ "vips": "8.11.3",
27
+ "webp": "1.2.1",
28
+ "xml": "2.9.12",
29
+ "zlib-ng": "2.0.5"
30
+ }
@@ -0,0 +1,15 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: /
5
+ schedule:
6
+ interval: daily
7
+ labels:
8
+ - dependency
9
+ versioning-strategy: increase-if-necessary
10
+ - package-ecosystem: github-actions
11
+ directory: /
12
+ schedule:
13
+ interval: daily
14
+ labels:
15
+ - dependency
@@ -0,0 +1,23 @@
1
+ name: ci
2
+ 'on':
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ test:
7
+ name: Node ${{ matrix.node }} / ${{ matrix.os }}
8
+ runs-on: ${{ matrix.os }}
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ os:
13
+ - ubuntu-latest
14
+ node:
15
+ - '14'
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: actions/setup-node@v2
19
+ with:
20
+ node-version: ${{ matrix.node }}
21
+ - run: npm install
22
+ - run: npm run build --if-present
23
+ - run: npm test
@@ -1,7 +1,7 @@
1
- # simple-get [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
1
+ # simple-get [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
2
2
 
3
- [travis-image]: https://img.shields.io/travis/feross/simple-get/master.svg
4
- [travis-url]: https://travis-ci.org/feross/simple-get
3
+ [ci-image]: https://img.shields.io/github/workflow/status/feross/simple-get/ci/master
4
+ [ci-url]: https://github.com/feross/simple-get/actions
5
5
  [npm-image]: https://img.shields.io/npm/v/simple-get.svg
6
6
  [npm-url]: https://npmjs.org/package/simple-get
7
7
  [downloads-image]: https://img.shields.io/npm/dm/simple-get.svg
@@ -254,6 +254,20 @@ const opts = {
254
254
  get(opts, function (err, res) {})
255
255
  ```
256
256
 
257
+ ### Basic Auth
258
+
259
+ ```js
260
+ const user = 'someuser'
261
+ const pass = 'pa$$word'
262
+ const encodedAuth = Buffer.from(`${user}:${pass}`).toString('base64')
263
+
264
+ get('http://example.com', {
265
+ headers: {
266
+ authorization: `Basic ${encodedAuth}`
267
+ }
268
+ })
269
+ ```
270
+
257
271
  ### OAuth
258
272
 
259
273
  You can use the [`oauth-1.0a`](https://github.com/ddo/oauth-1.0a) module to create