sharp 0.33.1-rc.0 → 0.33.1-rc.3

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/install/check.js CHANGED
@@ -3,34 +3,39 @@
3
3
 
4
4
  'use strict';
5
5
 
6
- const { useGlobalLibvips, globalLibvipsVersion, log, spawnRebuild } = require('../lib/libvips');
6
+ try {
7
+ const { useGlobalLibvips, globalLibvipsVersion, log, spawnRebuild } = require('../lib/libvips');
7
8
 
8
- const buildFromSource = (msg) => {
9
- log(msg);
10
- log('Attempting to build from source via node-gyp');
11
- try {
12
- require('node-addon-api');
13
- log('Found node-addon-api');
14
- } catch (err) {
15
- log('Please add node-addon-api to your dependencies');
16
- return;
17
- }
18
- try {
19
- const gyp = require('node-gyp');
20
- log(`Found node-gyp version ${gyp().version}`);
21
- } catch (err) {
22
- log('Please add node-gyp to your dependencies');
23
- return;
24
- }
25
- log('See https://sharp.pixelplumbing.com/install#building-from-source');
26
- const status = spawnRebuild();
27
- if (status !== 0) {
28
- process.exit(status);
29
- }
30
- };
9
+ const buildFromSource = (msg) => {
10
+ log(msg);
11
+ log('Attempting to build from source via node-gyp');
12
+ try {
13
+ require('node-addon-api');
14
+ log('Found node-addon-api');
15
+ } catch (err) {
16
+ log('Please add node-addon-api to your dependencies');
17
+ return;
18
+ }
19
+ try {
20
+ const gyp = require('node-gyp');
21
+ log(`Found node-gyp version ${gyp().version}`);
22
+ } catch (err) {
23
+ log('Please add node-gyp to your dependencies');
24
+ return;
25
+ }
26
+ log('See https://sharp.pixelplumbing.com/install#building-from-source');
27
+ const status = spawnRebuild();
28
+ if (status !== 0) {
29
+ process.exit(status);
30
+ }
31
+ };
31
32
 
32
- if (useGlobalLibvips()) {
33
- buildFromSource(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
34
- } else if (process.env.npm_config_build_from_source) {
35
- buildFromSource('Detected --build-from-source flag');
33
+ if (useGlobalLibvips()) {
34
+ buildFromSource(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
35
+ } else if (process.env.npm_config_build_from_source) {
36
+ buildFromSource('Detected --build-from-source flag');
37
+ }
38
+ } catch (err) {
39
+ const summary = err.message.split(/\n/).slice(0, 1);
40
+ console.log(`sharp: skipping install check: ${summary}`);
36
41
  }
package/lib/index.d.ts CHANGED
@@ -126,7 +126,7 @@ declare namespace sharp {
126
126
  function counters(): SharpCounters;
127
127
 
128
128
  /**
129
- * Get and set use of SIMD vector unit instructions. Requires libvips to have been compiled with liborc support.
129
+ * Get and set use of SIMD vector unit instructions. Requires libvips to have been compiled with highway support.
130
130
  * Improves the performance of resize, blur and sharpen operations by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
131
131
  * @param enable enable or disable use of SIMD vector unit instructions
132
132
  * @returns true if usage of SIMD vector unit instructions is enabled
package/lib/sharp.js CHANGED
@@ -49,11 +49,11 @@ if (sharp) {
49
49
  help.push(
50
50
  '- Ensure optional dependencies can be installed:',
51
51
  ' npm install --include=optional sharp',
52
- ' or',
53
52
  ' yarn add sharp --ignore-engines',
53
+ '- Ensure your package manager supports multi-platform installation:',
54
+ ' See https://sharp.pixelplumbing.com/install#cross-platform',
54
55
  '- Add platform-specific dependencies:',
55
56
  ` npm install --os=${os} --cpu=${cpu} sharp`,
56
- ' or',
57
57
  ` npm install --force @img/sharp-${runtimePlatform}`
58
58
  );
59
59
  } else {
@@ -61,11 +61,10 @@ if (sharp) {
61
61
  `- Manually install libvips >= ${minimumLibvipsVersion}`,
62
62
  '- Add experimental WebAssembly-based dependencies:',
63
63
  ' npm install --cpu=wasm32 sharp',
64
- ' or',
65
64
  ' npm install --force @img/sharp-wasm32'
66
65
  );
67
66
  }
68
- if (isLinux && /symbol not found/i.test(messages)) {
67
+ if (isLinux && /(symbol not found|CXXABI_)/i.test(messages)) {
69
68
  try {
70
69
  const { engines } = require(`@img/sharp-libvips-${runtimePlatform}/package`);
71
70
  const libcFound = `${familySync()} ${versionSync()}`;
@@ -103,7 +102,7 @@ if (sharp) {
103
102
  }
104
103
  help.push(
105
104
  '- Consult the installation documentation:',
106
- ' https://sharp.pixelplumbing.com/install'
105
+ ' See https://sharp.pixelplumbing.com/install'
107
106
  );
108
107
  throw new Error(help.join('\n'));
109
108
  }
package/lib/utility.js CHANGED
@@ -183,17 +183,17 @@ function counters () {
183
183
 
184
184
  /**
185
185
  * Get and set use of SIMD vector unit instructions.
186
- * Requires libvips to have been compiled with liborc support.
186
+ * Requires libvips to have been compiled with highway support.
187
187
  *
188
188
  * Improves the performance of `resize`, `blur` and `sharpen` operations
189
189
  * by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
190
190
  *
191
191
  * @example
192
192
  * const simd = sharp.simd();
193
- * // simd is `true` if the runtime use of liborc is currently enabled
193
+ * // simd is `true` if the runtime use of highway is currently enabled
194
194
  * @example
195
195
  * const simd = sharp.simd(false);
196
- * // prevent libvips from using liborc at runtime
196
+ * // prevent libvips from using highway at runtime
197
197
  *
198
198
  * @param {boolean} [simd=true]
199
199
  * @returns {boolean}
@@ -201,7 +201,6 @@ function counters () {
201
201
  function simd (simd) {
202
202
  return sharp.simd(is.bool(simd) ? simd : null);
203
203
  }
204
- simd(true);
205
204
 
206
205
  /**
207
206
  * Block libvips operations at runtime.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "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.33.1-rc.0",
4
+ "version": "0.33.1-rc.3",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
- "homepage": "https://github.com/lovell/sharp",
6
+ "homepage": "https://sharp.pixelplumbing.com",
7
7
  "contributors": [
8
8
  "Pierre Inglebert <pierre.inglebert@gmail.com>",
9
9
  "Jonathan Ong <jonathanrichardong@gmail.com>",
@@ -141,8 +141,8 @@
141
141
  "semver": "^7.5.4"
142
142
  },
143
143
  "optionalDependencies": {
144
- "@img/sharp-darwin-arm64": "0.33.1-rc.0",
145
- "@img/sharp-darwin-x64": "0.33.1-rc.0",
144
+ "@img/sharp-darwin-arm64": "0.33.1-rc.3",
145
+ "@img/sharp-darwin-x64": "0.33.1-rc.3",
146
146
  "@img/sharp-libvips-darwin-arm64": "1.0.0",
147
147
  "@img/sharp-libvips-darwin-x64": "1.0.0",
148
148
  "@img/sharp-libvips-linux-arm": "1.0.0",
@@ -151,15 +151,15 @@
151
151
  "@img/sharp-libvips-linux-x64": "1.0.0",
152
152
  "@img/sharp-libvips-linuxmusl-arm64": "1.0.0",
153
153
  "@img/sharp-libvips-linuxmusl-x64": "1.0.0",
154
- "@img/sharp-linux-arm": "0.33.1-rc.0",
155
- "@img/sharp-linux-arm64": "0.33.1-rc.0",
156
- "@img/sharp-linux-s390x": "0.33.1-rc.0",
157
- "@img/sharp-linux-x64": "0.33.1-rc.0",
158
- "@img/sharp-linuxmusl-arm64": "0.33.1-rc.0",
159
- "@img/sharp-linuxmusl-x64": "0.33.1-rc.0",
160
- "@img/sharp-wasm32": "0.33.1-rc.0",
161
- "@img/sharp-win32-ia32": "0.33.1-rc.0",
162
- "@img/sharp-win32-x64": "0.33.1-rc.0"
154
+ "@img/sharp-linux-arm": "0.33.1-rc.3",
155
+ "@img/sharp-linux-arm64": "0.33.1-rc.3",
156
+ "@img/sharp-linux-s390x": "0.33.1-rc.3",
157
+ "@img/sharp-linux-x64": "0.33.1-rc.3",
158
+ "@img/sharp-linuxmusl-arm64": "0.33.1-rc.3",
159
+ "@img/sharp-linuxmusl-x64": "0.33.1-rc.3",
160
+ "@img/sharp-wasm32": "0.33.1-rc.3",
161
+ "@img/sharp-win32-ia32": "0.33.1-rc.3",
162
+ "@img/sharp-win32-x64": "0.33.1-rc.3"
163
163
  },
164
164
  "devDependencies": {
165
165
  "@emnapi/runtime": "^0.44.0",
package/src/pipeline.cc CHANGED
@@ -794,11 +794,15 @@ class PipelineWorker : public Napi::AsyncWorker {
794
794
 
795
795
  // Apply output ICC profile
796
796
  if (!baton->withIccProfile.empty()) {
797
- image = image.icc_transform(const_cast<char*>(baton->withIccProfile.data()), VImage::option()
798
- ->set("input_profile", processingProfile)
799
- ->set("embedded", TRUE)
800
- ->set("depth", sharp::Is16Bit(image.interpretation()) ? 16 : 8)
801
- ->set("intent", VIPS_INTENT_PERCEPTUAL));
797
+ try {
798
+ image = image.icc_transform(const_cast<char*>(baton->withIccProfile.data()), VImage::option()
799
+ ->set("input_profile", processingProfile)
800
+ ->set("embedded", TRUE)
801
+ ->set("depth", sharp::Is16Bit(image.interpretation()) ? 16 : 8)
802
+ ->set("intent", VIPS_INTENT_PERCEPTUAL));
803
+ } catch(...) {
804
+ sharp::VipsWarningCallback(nullptr, G_LOG_LEVEL_WARNING, "Invalid profile", nullptr);
805
+ }
802
806
  } else if (baton->keepMetadata & VIPS_FOREIGN_KEEP_ICC) {
803
807
  image = sharp::SetProfile(image, inputProfile);
804
808
  }