sharp 0.33.0-alpha.6 → 0.33.0-alpha.7
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/lib/sharp.js +4 -0
- package/lib/utility.js +15 -7
- package/package.json +10 -10
- package/src/binding.gyp +5 -0
- package/src/utilities.cc +13 -3
package/lib/sharp.js
CHANGED
|
@@ -53,6 +53,10 @@ try {
|
|
|
53
53
|
if (errPackage.code === 'ERR_DLOPEN_DISABLED') {
|
|
54
54
|
help.push('- Run Node.js without using the --no-addons flag');
|
|
55
55
|
}
|
|
56
|
+
if (process.versions.pnp) {
|
|
57
|
+
help.push('- Use a supported yarn linker, either pnpm or node-modules');
|
|
58
|
+
help.push(' yarn config set nodeLinker node-modules');
|
|
59
|
+
}
|
|
56
60
|
// Link to installation docs
|
|
57
61
|
if (isLinux && /Module did not self-register/.test(errLocal.message + errPackage.message)) {
|
|
58
62
|
help.push('- Using worker threads on Linux? See https://sharp.pixelplumbing.com/install#worker-threads');
|
package/lib/utility.js
CHANGED
|
@@ -10,6 +10,9 @@ const is = require('./is');
|
|
|
10
10
|
const { runtimePlatformArch } = require('./libvips');
|
|
11
11
|
const sharp = require('./sharp');
|
|
12
12
|
|
|
13
|
+
const runtimePlatform = runtimePlatformArch();
|
|
14
|
+
const libvipsVersion = sharp.libvipsVersion();
|
|
15
|
+
|
|
13
16
|
/**
|
|
14
17
|
* An Object containing nested boolean values representing the available input and output formats/methods.
|
|
15
18
|
* @member
|
|
@@ -44,20 +47,25 @@ const interpolators = {
|
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
/**
|
|
47
|
-
* An Object containing the version numbers of sharp, libvips
|
|
50
|
+
* An Object containing the version numbers of sharp, libvips
|
|
51
|
+
* and (when using prebuilt binaries) its dependencies.
|
|
52
|
+
*
|
|
48
53
|
* @member
|
|
49
54
|
* @example
|
|
50
55
|
* console.log(sharp.versions);
|
|
51
56
|
*/
|
|
52
57
|
let versions = {
|
|
53
|
-
vips:
|
|
58
|
+
vips: libvipsVersion.semver
|
|
54
59
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} catch (_) {
|
|
60
|
+
/* istanbul ignore next */
|
|
61
|
+
if (!libvipsVersion.isGlobal) {
|
|
58
62
|
try {
|
|
59
|
-
versions = require(`@sharpen/sharp
|
|
60
|
-
} catch (_) {
|
|
63
|
+
versions = require(`@sharpen/sharp-${runtimePlatform}/versions`);
|
|
64
|
+
} catch (_) {
|
|
65
|
+
try {
|
|
66
|
+
versions = require(`@sharpen/sharp-libvips-${runtimePlatform}/versions`);
|
|
67
|
+
} catch (_) {}
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
versions.sharp = require('../package.json').version;
|
|
63
71
|
|
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-alpha.
|
|
4
|
+
"version": "0.33.0-alpha.7",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://github.com/lovell/sharp",
|
|
7
7
|
"contributors": [
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"semver": "^7.5.4"
|
|
140
140
|
},
|
|
141
141
|
"optionalDependencies": {
|
|
142
|
-
"@sharpen/sharp-darwin-arm64": "0.0.1-alpha.
|
|
143
|
-
"@sharpen/sharp-darwin-x64": "0.0.1-alpha.
|
|
142
|
+
"@sharpen/sharp-darwin-arm64": "0.0.1-alpha.7",
|
|
143
|
+
"@sharpen/sharp-darwin-x64": "0.0.1-alpha.7",
|
|
144
144
|
"@sharpen/sharp-libvips-darwin-arm64": "0.0.1-alpha.2",
|
|
145
145
|
"@sharpen/sharp-libvips-darwin-x64": "0.0.1-alpha.2",
|
|
146
146
|
"@sharpen/sharp-libvips-linux-arm": "0.0.1-alpha.2",
|
|
@@ -148,13 +148,13 @@
|
|
|
148
148
|
"@sharpen/sharp-libvips-linux-x64": "0.0.1-alpha.2",
|
|
149
149
|
"@sharpen/sharp-libvips-linuxmusl-arm64": "0.0.1-alpha.2",
|
|
150
150
|
"@sharpen/sharp-libvips-linuxmusl-x64": "0.0.1-alpha.2",
|
|
151
|
-
"@sharpen/sharp-linux-arm": "0.0.1-alpha.
|
|
152
|
-
"@sharpen/sharp-linux-arm64": "0.0.1-alpha.
|
|
153
|
-
"@sharpen/sharp-linux-x64": "0.0.1-alpha.
|
|
154
|
-
"@sharpen/sharp-linuxmusl-arm64": "0.0.1-alpha.
|
|
155
|
-
"@sharpen/sharp-linuxmusl-x64": "0.0.1-alpha.
|
|
156
|
-
"@sharpen/sharp-win32-ia32": "0.0.1-alpha.
|
|
157
|
-
"@sharpen/sharp-win32-x64": "0.0.1-alpha.
|
|
151
|
+
"@sharpen/sharp-linux-arm": "0.0.1-alpha.7",
|
|
152
|
+
"@sharpen/sharp-linux-arm64": "0.0.1-alpha.7",
|
|
153
|
+
"@sharpen/sharp-linux-x64": "0.0.1-alpha.7",
|
|
154
|
+
"@sharpen/sharp-linuxmusl-arm64": "0.0.1-alpha.7",
|
|
155
|
+
"@sharpen/sharp-linuxmusl-x64": "0.0.1-alpha.7",
|
|
156
|
+
"@sharpen/sharp-win32-ia32": "0.0.1-alpha.7",
|
|
157
|
+
"@sharpen/sharp-win32-x64": "0.0.1-alpha.7"
|
|
158
158
|
},
|
|
159
159
|
"devDependencies": {
|
|
160
160
|
"@sharpen/sharp-libvips-dev": "0.0.1-alpha.2",
|
package/src/binding.gyp
CHANGED
|
@@ -111,6 +111,9 @@
|
|
|
111
111
|
# Use pkg-config for include and lib
|
|
112
112
|
'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g)'],
|
|
113
113
|
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)'],
|
|
114
|
+
'defines': [
|
|
115
|
+
'SHARP_USE_GLOBAL_LIBVIPS'
|
|
116
|
+
],
|
|
114
117
|
'conditions': [
|
|
115
118
|
['OS == "linux"', {
|
|
116
119
|
'defines': [
|
|
@@ -154,6 +157,7 @@
|
|
|
154
157
|
'OTHER_LDFLAGS': [
|
|
155
158
|
# Ensure runtime linking is relative to sharp.node
|
|
156
159
|
'-Wl,-rpath,\'@loader_path/../../sharp-libvips-<(platform_and_arch)/lib\'',
|
|
160
|
+
'-Wl,-rpath,\'@loader_path/../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\'',
|
|
157
161
|
'-Wl,-rpath,\'@loader_path/../../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\''
|
|
158
162
|
]
|
|
159
163
|
}
|
|
@@ -174,6 +178,7 @@
|
|
|
174
178
|
'-Wl,-s',
|
|
175
179
|
'-Wl,--disable-new-dtags',
|
|
176
180
|
'-Wl,-rpath=\'$$ORIGIN/../../sharp-libvips-<(platform_and_arch)/lib\'',
|
|
181
|
+
'-Wl,-rpath=\'$$ORIGIN/../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\'',
|
|
177
182
|
'-Wl,-rpath=\'$$ORIGIN/../../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\''
|
|
178
183
|
]
|
|
179
184
|
}
|
package/src/utilities.cc
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include <cmath>
|
|
5
5
|
#include <string>
|
|
6
|
+
#include <cstdio>
|
|
6
7
|
|
|
7
8
|
#include <napi.h>
|
|
8
9
|
#include <vips/vips8>
|
|
@@ -91,9 +92,18 @@ Napi::Value simd(const Napi::CallbackInfo& info) {
|
|
|
91
92
|
Get libvips version
|
|
92
93
|
*/
|
|
93
94
|
Napi::Value libvipsVersion(const Napi::CallbackInfo& info) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
Napi::Env env = info.Env();
|
|
96
|
+
Napi::Object version = Napi::Object::New(env);
|
|
97
|
+
|
|
98
|
+
char semver[9];
|
|
99
|
+
std::snprintf(semver, sizeof(semver), "%d.%d.%d", vips_version(0), vips_version(1), vips_version(2));
|
|
100
|
+
version.Set("semver", Napi::String::New(env, semver));
|
|
101
|
+
#ifdef SHARP_USE_GLOBAL_LIBVIPS
|
|
102
|
+
version.Set("isGlobal", Napi::Boolean::New(env, true));
|
|
103
|
+
#else
|
|
104
|
+
version.Set("isGlobal", Napi::Boolean::New(env, false));
|
|
105
|
+
#endif
|
|
106
|
+
return version;
|
|
97
107
|
}
|
|
98
108
|
|
|
99
109
|
/*
|