sharp 0.33.0-rc.2 → 0.33.1-rc.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.
@@ -22,6 +22,10 @@ const debuglog = util.debuglog('sharp');
22
22
  *
23
23
  * Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
24
24
  *
25
+ * When loading more than one page/frame of an animated image,
26
+ * these are combined as a vertically-stacked "toilet roll" image
27
+ * where the overall height is the `pageHeight` multiplied by the number of `pages`.
28
+ *
25
29
  * @constructs Sharp
26
30
  *
27
31
  * @emits Sharp#info
package/lib/libvips.js CHANGED
@@ -4,11 +4,12 @@
4
4
  'use strict';
5
5
 
6
6
  const { spawnSync } = require('node:child_process');
7
+ const { createHash } = require('node:crypto');
7
8
  const semverCoerce = require('semver/functions/coerce');
8
9
  const semverGreaterThanOrEqualTo = require('semver/functions/gte');
9
10
  const detectLibc = require('detect-libc');
10
11
 
11
- const { engines } = require('../package.json');
12
+ const { engines, optionalDependencies } = require('../package.json');
12
13
 
13
14
  const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || /* istanbul ignore next */
14
15
  engines.libvips;
@@ -97,6 +98,17 @@ const isRosetta = () => {
97
98
  return false;
98
99
  };
99
100
 
101
+ const sha512 = (s) => createHash('sha512').update(s).digest('hex');
102
+
103
+ const yarnLocator = () => {
104
+ try {
105
+ const identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`);
106
+ const npmVersion = semverCoerce(optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`]).version;
107
+ return sha512(`${identHash}npm:${npmVersion}`).slice(0, 10);
108
+ } catch {}
109
+ return '';
110
+ };
111
+
100
112
  /* istanbul ignore next */
101
113
  const spawnRebuild = () =>
102
114
  spawnSync(`node-gyp rebuild --directory=src ${isEmscripten() ? '--nodedir=emscripten' : ''}`, {
@@ -164,6 +176,7 @@ module.exports = {
164
176
  buildSharpLibvipsLibDir,
165
177
  runtimePlatformArch,
166
178
  log,
179
+ yarnLocator,
167
180
  spawnRebuild,
168
181
  globalLibvipsVersion,
169
182
  pkgConfigPath,
package/lib/sharp.js CHANGED
@@ -46,41 +46,64 @@ if (sharp) {
46
46
  // Common error messages
47
47
  if (prebuiltPlatforms.includes(runtimePlatform)) {
48
48
  const [os, cpu] = runtimePlatform.split('-');
49
- help.push('- Add platform-specific dependencies:');
50
- help.push(` npm install --os=${os} --cpu=${cpu} sharp`);
51
- help.push(' or');
52
- help.push(` npm install --force @img/sharp-${runtimePlatform}`);
49
+ help.push(
50
+ '- Ensure optional dependencies can be installed:',
51
+ ' npm install --include=optional sharp',
52
+ ' or',
53
+ ' yarn add sharp --ignore-engines',
54
+ '- Add platform-specific dependencies:',
55
+ ` npm install --os=${os} --cpu=${cpu} sharp`,
56
+ ' or',
57
+ ` npm install --force @img/sharp-${runtimePlatform}`
58
+ );
53
59
  } else {
54
- help.push(`- Manually install libvips >= ${minimumLibvipsVersion}`);
55
- help.push('- Add experimental WebAssembly-based dependencies:');
56
- help.push(' npm install --cpu=wasm32 sharp');
60
+ help.push(
61
+ `- Manually install libvips >= ${minimumLibvipsVersion}`,
62
+ '- Add experimental WebAssembly-based dependencies:',
63
+ ' npm install --cpu=wasm32 sharp',
64
+ ' or',
65
+ ' npm install --force @img/sharp-wasm32'
66
+ );
57
67
  }
58
68
  if (isLinux && /symbol not found/i.test(messages)) {
59
69
  try {
60
70
  const { engines } = require(`@img/sharp-libvips-${runtimePlatform}/package`);
61
71
  const libcFound = `${familySync()} ${versionSync()}`;
62
72
  const libcRequires = `${engines.musl ? 'musl' : 'glibc'} ${engines.musl || engines.glibc}`;
63
- help.push('- Update your OS:');
64
- help.push(` Found ${libcFound}`);
65
- help.push(` Requires ${libcRequires}`);
73
+ help.push(
74
+ '- Update your OS:',
75
+ ` Found ${libcFound}`,
76
+ ` Requires ${libcRequires}`
77
+ );
66
78
  } catch (errEngines) {}
67
79
  }
80
+ if (isLinux && /\/snap\/core[0-9]{2}/.test(messages)) {
81
+ help.push(
82
+ '- Remove the Node.js Snap, which does not support native modules',
83
+ ' snap remove node'
84
+ );
85
+ }
68
86
  if (isMacOs && /Incompatible library version/.test(messages)) {
69
- help.push('- Update Homebrew:');
70
- help.push(' brew update && brew upgrade vips');
87
+ help.push(
88
+ '- Update Homebrew:',
89
+ ' brew update && brew upgrade vips'
90
+ );
71
91
  }
72
92
  if (errors.some(err => err.code === 'ERR_DLOPEN_DISABLED')) {
73
93
  help.push('- Run Node.js without using the --no-addons flag');
74
94
  }
75
- if (process.versions.pnp) {
76
- help.push('- Use a supported yarn linker, either pnpm or node-modules:');
77
- help.push(' yarn config set nodeLinker node-modules');
78
- }
79
95
  // Link to installation docs
80
96
  if (isWindows && /The specified procedure could not be found/.test(messages)) {
81
- help.push('- Using the canvas package on Windows? See https://sharp.pixelplumbing.com/install#canvas-and-windows');
82
- } else {
83
- help.push('- Consult the installation documentation: https://sharp.pixelplumbing.com/install');
97
+ help.push(
98
+ '- Using the canvas package on Windows?',
99
+ ' See https://sharp.pixelplumbing.com/install#canvas-and-windows',
100
+ '- Check for outdated versions of sharp in the dependency tree:',
101
+ ' npm ls sharp'
102
+ );
84
103
  }
104
+ help.push(
105
+ '- Consult the installation documentation:',
106
+ ' https://sharp.pixelplumbing.com/install'
107
+ );
85
108
  throw new Error(help.join('\n'));
86
109
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.0-rc.2",
4
+ "version": "0.33.1-rc.0",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://github.com/lovell/sharp",
7
7
  "contributors": [
@@ -141,8 +141,8 @@
141
141
  "semver": "^7.5.4"
142
142
  },
143
143
  "optionalDependencies": {
144
- "@img/sharp-darwin-arm64": "0.33.0-rc.2",
145
- "@img/sharp-darwin-x64": "0.33.0-rc.2",
144
+ "@img/sharp-darwin-arm64": "0.33.1-rc.0",
145
+ "@img/sharp-darwin-x64": "0.33.1-rc.0",
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.0-rc.2",
155
- "@img/sharp-linux-arm64": "0.33.0-rc.2",
156
- "@img/sharp-linux-s390x": "0.33.0-rc.2",
157
- "@img/sharp-linux-x64": "0.33.0-rc.2",
158
- "@img/sharp-linuxmusl-arm64": "0.33.0-rc.2",
159
- "@img/sharp-linuxmusl-x64": "0.33.0-rc.2",
160
- "@img/sharp-wasm32": "0.33.0-rc.2",
161
- "@img/sharp-win32-ia32": "0.33.0-rc.2",
162
- "@img/sharp-win32-x64": "0.33.0-rc.2"
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"
163
163
  },
164
164
  "devDependencies": {
165
165
  "@emnapi/runtime": "^0.44.0",
package/src/binding.gyp CHANGED
@@ -6,6 +6,7 @@
6
6
  'vips_version': '<!(node -p "require(\'../lib/libvips\').minimumLibvipsVersion")',
7
7
  'platform_and_arch': '<!(node -p "require(\'../lib/libvips\').buildPlatformArch()")',
8
8
  'sharp_libvips_version': '<!(node -p "require(\'../package.json\').optionalDependencies[\'@img/sharp-libvips-<(platform_and_arch)\']")',
9
+ 'sharp_libvips_yarn_locator': '<!(node -p "require(\'../lib/libvips\').yarnLocator()")',
9
10
  'sharp_libvips_include_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsIncludeDir()")',
10
11
  'sharp_libvips_cplusplus_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsCPlusPlusDir()")',
11
12
  'sharp_libvips_lib_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsLibDir()")'
@@ -157,7 +158,8 @@
157
158
  '-Wl,-rpath,\'@loader_path/../../sharp-libvips-<(platform_and_arch)/lib\'',
158
159
  '-Wl,-rpath,\'@loader_path/../../../sharp-libvips-<(platform_and_arch)/<(sharp_libvips_version)/lib\'',
159
160
  '-Wl,-rpath,\'@loader_path/../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
160
- '-Wl,-rpath,\'@loader_path/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\''
161
+ '-Wl,-rpath,\'@loader_path/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
162
+ '-Wl,-rpath,\'@loader_path/../../../../../@img-sharp-libvips-<(platform_and_arch)-npm-<(sharp_libvips_version)-<(sharp_libvips_yarn_locator)/node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\''
161
163
  ]
162
164
  }
163
165
  }],
@@ -176,7 +178,8 @@
176
178
  '-Wl,-rpath=\'$$ORIGIN/../../sharp-libvips-<(platform_and_arch)/lib\'',
177
179
  '-Wl,-rpath=\'$$ORIGIN/../../../sharp-libvips-<(platform_and_arch)/<(sharp_libvips_version)/lib\'',
178
180
  '-Wl,-rpath=\'$$ORIGIN/../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
179
- '-Wl,-rpath=\'$$ORIGIN/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\''
181
+ '-Wl,-rpath=\'$$ORIGIN/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
182
+ '-Wl,-rpath,\'$$ORIGIN/../../../../../@img-sharp-libvips-<(platform_and_arch)-npm-<(sharp_libvips_version)-<(sharp_libvips_yarn_locator)/node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\''
180
183
  ]
181
184
  }
182
185
  }],