sharp 0.35.0-rc.4 → 0.35.0-rc.5

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/libvips.cjs CHANGED
@@ -5,15 +5,13 @@
5
5
 
6
6
  const { spawnSync } = require('node:child_process');
7
7
  const { createHash } = require('node:crypto');
8
- const semverCoerce = require('semver/functions/coerce');
9
- const semverGreaterThanOrEqualTo = require('semver/functions/gte');
10
- const semverSatisfies = require('semver/functions/satisfies');
8
+ const semver = require('semver');
11
9
  const detectLibc = require('detect-libc');
12
10
  const pkg = require('../package.json');
13
11
 
14
12
  /* node:coverage ignore next */
15
13
  const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || pkg.config.libvips;
16
- const minimumLibvipsVersion = semverCoerce(minimumLibvipsVersionLabelled).version;
14
+ const minimumLibvipsVersion = semver.coerce(minimumLibvipsVersionLabelled).version;
17
15
 
18
16
  const prebuiltPlatforms = [
19
17
  'darwin-arm64', 'darwin-x64',
@@ -82,7 +80,7 @@ const buildSharpLibvipsLibDir = () => {
82
80
 
83
81
  const isUnsupportedNodeRuntime = () => {
84
82
  if (process.release?.name === 'node' && process.versions) {
85
- if (!semverSatisfies(process.versions.node, pkg.engines.node)) {
83
+ if (!semver.satisfies(process.versions.node, pkg.engines.node)) {
86
84
  return { found: process.versions.node, expected: pkg.engines.node };
87
85
  }
88
86
  }
@@ -108,7 +106,7 @@ const sha512 = (s) => createHash('sha512').update(s).digest('hex');
108
106
  const yarnLocator = () => {
109
107
  try {
110
108
  const identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`);
111
- const npmVersion = semverCoerce(pkg.optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`], {
109
+ const npmVersion = semver.coerce(pkg.optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`], {
112
110
  includePrerelease: true
113
111
  }).version;
114
112
  return sha512(`${identHash}npm:${npmVersion}`).slice(0, 10);
@@ -193,7 +191,7 @@ const useGlobalLibvips = (logger) => {
193
191
  }
194
192
  const globalVipsVersion = globalLibvipsVersion();
195
193
  /* node:coverage ignore next */
196
- return !!globalVipsVersion && semverGreaterThanOrEqualTo(globalVipsVersion, minimumLibvipsVersion);
194
+ return !!globalVipsVersion && semver.gte(globalVipsVersion, minimumLibvipsVersion);
197
195
  };
198
196
 
199
197
  module.exports = {
package/dist/libvips.mjs CHANGED
@@ -5,15 +5,13 @@
5
5
 
6
6
  import { spawnSync } from 'node:child_process';
7
7
  import { createHash } from 'node:crypto';
8
- import semverCoerce from 'semver/functions/coerce';
9
- import semverGreaterThanOrEqualTo from 'semver/functions/gte';
10
- import semverSatisfies from 'semver/functions/satisfies';
8
+ import semver from 'semver';
11
9
  import detectLibc from 'detect-libc';
12
10
  import pkg from '../package.json' with { type: 'json' };
13
11
 
14
12
  /* node:coverage ignore next */
15
13
  const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || pkg.config.libvips;
16
- const minimumLibvipsVersion = semverCoerce(minimumLibvipsVersionLabelled).version;
14
+ const minimumLibvipsVersion = semver.coerce(minimumLibvipsVersionLabelled).version;
17
15
 
18
16
  const prebuiltPlatforms = [
19
17
  'darwin-arm64', 'darwin-x64',
@@ -82,7 +80,7 @@ const buildSharpLibvipsLibDir = () => {
82
80
 
83
81
  const isUnsupportedNodeRuntime = () => {
84
82
  if (process.release?.name === 'node' && process.versions) {
85
- if (!semverSatisfies(process.versions.node, pkg.engines.node)) {
83
+ if (!semver.satisfies(process.versions.node, pkg.engines.node)) {
86
84
  return { found: process.versions.node, expected: pkg.engines.node };
87
85
  }
88
86
  }
@@ -108,7 +106,7 @@ const sha512 = (s) => createHash('sha512').update(s).digest('hex');
108
106
  const yarnLocator = () => {
109
107
  try {
110
108
  const identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`);
111
- const npmVersion = semverCoerce(pkg.optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`], {
109
+ const npmVersion = semver.coerce(pkg.optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`], {
112
110
  includePrerelease: true
113
111
  }).version;
114
112
  return sha512(`${identHash}npm:${npmVersion}`).slice(0, 10);
@@ -193,7 +191,7 @@ const useGlobalLibvips = (logger) => {
193
191
  }
194
192
  const globalVipsVersion = globalLibvipsVersion();
195
193
  /* node:coverage ignore next */
196
- return !!globalVipsVersion && semverGreaterThanOrEqualTo(globalVipsVersion, minimumLibvipsVersion);
194
+ return !!globalVipsVersion && semver.gte(globalVipsVersion, minimumLibvipsVersion);
197
195
  };
198
196
 
199
197
  export default {
package/dist/sharp.cjs CHANGED
@@ -7,8 +7,12 @@
7
7
 
8
8
  const { familySync, versionSync } = require("detect-libc");
9
9
 
10
- const { version } = require('../package.json');
11
- const { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = require("./libvips.cjs");
10
+ const libvips = require("./libvips.cjs");
11
+ const pkg = require('../package.json');
12
+
13
+ const { version } = pkg;
14
+
15
+ const { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = libvips;
12
16
  const runtimePlatform = runtimePlatformArch();
13
17
 
14
18
  /* node:coverage disable */
@@ -96,7 +100,7 @@ if (!sharp) {
96
100
 
97
101
  const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
98
102
  errors.forEach((err) => {
99
- if (err.code !== "MODULE_NOT_FOUND") {
103
+ if (!err.code.endsWith("MODULE_NOT_FOUND")) {
100
104
  help.push(`${err.code}: ${err.message}`);
101
105
  }
102
106
  });
package/dist/sharp.mjs CHANGED
@@ -5,10 +5,16 @@
5
5
 
6
6
  // Inspects the runtime environment and exports the relevant sharp.node binary
7
7
 
8
+ import { createRequire } from "node:module"
8
9
  import { familySync, versionSync } from "detect-libc";
9
10
 
10
- import { version } from '../package.json';
11
- import { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } from "./libvips.mjs";
11
+ import libvips from "./libvips.mjs";
12
+ import pkg from '../package.json' with { type: 'json' };
13
+
14
+ const require = createRequire(import.meta.url);
15
+ const { version } = pkg;
16
+
17
+ const { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = libvips;
12
18
  const runtimePlatform = runtimePlatformArch();
13
19
 
14
20
  /* node:coverage disable */
@@ -16,13 +22,13 @@ const runtimePlatform = runtimePlatformArch();
16
22
  let sharp;
17
23
  const errors = [];
18
24
  try {
19
- sharp = await import(`../src/build/Release/sharp-${runtimePlatform}-${version}.node`);
25
+ sharp = require(`../src/build/Release/sharp-${runtimePlatform}-${version}.node`);
20
26
  } catch (err) {
21
27
  errors.push(err);
22
28
  }
23
29
  if (!sharp) {
24
30
  try {
25
- sharp = await import(`../src/build/Release/sharp-wasm32-${version}.node`);
31
+ sharp = require(`../src/build/Release/sharp-wasm32-${version}.node`);
26
32
  } catch (err) {
27
33
  errors.push(err);
28
34
  }
@@ -31,53 +37,53 @@ if (!sharp) {
31
37
  try {
32
38
  switch (runtimePlatform) {
33
39
  case "darwin-arm64":
34
- sharp = await import("@img/sharp-darwin-arm64/sharp.node");
40
+ sharp = require("@img/sharp-darwin-arm64/sharp.node");
35
41
  break;
36
42
  case "darwin-x64":
37
- sharp = await import("@img/sharp-darwin-x64/sharp.node");
43
+ sharp = require("@img/sharp-darwin-x64/sharp.node");
38
44
  break;
39
45
  case "linux-arm":
40
- sharp = await import("@img/sharp-linux-arm/sharp.node");
46
+ sharp = require("@img/sharp-linux-arm/sharp.node");
41
47
  break;
42
48
  case "linux-arm64":
43
- sharp = await import("@img/sharp-linux-arm64/sharp.node");
49
+ sharp = require("@img/sharp-linux-arm64/sharp.node");
44
50
  break;
45
51
  case "linux-ppc64":
46
- sharp = await import("@img/sharp-linux-ppc64/sharp.node");
52
+ sharp = require("@img/sharp-linux-ppc64/sharp.node");
47
53
  break;
48
54
  case "linux-riscv64":
49
- sharp = await import("@img/sharp-linux-riscv64/sharp.node");
55
+ sharp = require("@img/sharp-linux-riscv64/sharp.node");
50
56
  break;
51
57
  case "linux-s390x":
52
- sharp = await import("@img/sharp-linux-s390x/sharp.node");
58
+ sharp = require("@img/sharp-linux-s390x/sharp.node");
53
59
  break;
54
60
  case "linux-x64":
55
- sharp = await import("@img/sharp-linux-x64/sharp.node");
61
+ sharp = require("@img/sharp-linux-x64/sharp.node");
56
62
  break;
57
63
  case "linuxmusl-arm64":
58
- sharp = await import("@img/sharp-linuxmusl-arm64/sharp.node");
64
+ sharp = require("@img/sharp-linuxmusl-arm64/sharp.node");
59
65
  break;
60
66
  case "linuxmusl-x64":
61
- sharp = await import("@img/sharp-linuxmusl-x64/sharp.node");
67
+ sharp = require("@img/sharp-linuxmusl-x64/sharp.node");
62
68
  break;
63
69
  case "win32-arm64":
64
- sharp = await import("@img/sharp-win32-arm64/sharp.node");
70
+ sharp = require("@img/sharp-win32-arm64/sharp.node");
65
71
  break;
66
72
  case "win32-ia32":
67
- sharp = await import("@img/sharp-win32-ia32/sharp.node");
73
+ sharp = require("@img/sharp-win32-ia32/sharp.node");
68
74
  break;
69
75
  case "win32-x64":
70
- sharp = await import("@img/sharp-win32-x64/sharp.node");
76
+ sharp = require("@img/sharp-win32-x64/sharp.node");
71
77
  break;
72
78
  case "freebsd-arm64":
73
79
  case "freebsd-x64":
74
- sharp = await import("@img/sharp-freebsd-wasm32/sharp.node");
80
+ sharp = require("@img/sharp-freebsd-wasm32/sharp.node");
75
81
  break;
76
82
  case "linux-wasm32":
77
- sharp = await import("@img/sharp-webcontainers-wasm32/sharp.node");
83
+ sharp = require("@img/sharp-webcontainers-wasm32/sharp.node");
78
84
  break;
79
85
  default:
80
- sharp = await import("@img/sharp-wasm32/sharp.node");
86
+ sharp = require("@img/sharp-wasm32/sharp.node");
81
87
  break;
82
88
  }
83
89
  if (["linux-x64", "linuxmusl-x64"].includes(runtimePlatform) && !sharp._isUsingX64V2()) {
@@ -96,7 +102,7 @@ if (!sharp) {
96
102
 
97
103
  const help = [`Could not load the "sharp" module using the ${runtimePlatform} runtime`];
98
104
  errors.forEach((err) => {
99
- if (err.code !== "MODULE_NOT_FOUND") {
105
+ if (!err.code.endsWith("MODULE_NOT_FOUND")) {
100
106
  help.push(`${err.code}: ${err.message}`);
101
107
  }
102
108
  });
@@ -127,7 +133,7 @@ if (!sharp) {
127
133
  }
128
134
  if (isLinux && /(symbol not found|CXXABI_)/i.test(messages)) {
129
135
  try {
130
- const { config } = await import(`@img/sharp-libvips-${runtimePlatform}/package`);
136
+ const { config } = require(`@img/sharp-libvips-${runtimePlatform}/package`);
131
137
  const libcFound = `${familySync()} ${versionSync()}`;
132
138
  const libcRequires = `${config.musl ? "musl" : "glibc"} ${config.musl || config.glibc}`;
133
139
  help.push("- Update your OS:", ` Found ${libcFound}`, ` Requires ${libcRequires}`);
package/dist/utility.cjs CHANGED
@@ -4,14 +4,15 @@
4
4
  */
5
5
 
6
6
  const events = require('node:events');
7
+ const { availableParallelism } = require("node:os");
7
8
  const detectLibc = require('detect-libc');
8
9
 
9
10
  const is = require('./is.cjs');
10
- const { runtimePlatformArch } = require('./libvips.cjs');
11
+ const libvips = require('./libvips.cjs');
11
12
  const sharp = require('./sharp.cjs');
12
13
  const pkg = require("../package.json");
13
14
 
14
- const runtimePlatform = runtimePlatformArch();
15
+ const runtimePlatform = libvips.runtimePlatformArch();
15
16
  const libvipsVersion = sharp.libvipsVersion();
16
17
 
17
18
  /**
@@ -157,7 +158,6 @@ if (detectLibc.familySync() === detectLibc.GLIBC && !sharp._isUsingJemalloc()) {
157
158
  sharp.concurrency(1);
158
159
  } else if (detectLibc.familySync() === detectLibc.MUSL && sharp.concurrency() === 1024) {
159
160
  // Reduce default concurrency when musl thread over-subscription detected
160
- const { availableParallelism } = require('node:os')
161
161
  sharp.concurrency(availableParallelism());
162
162
  }
163
163
 
package/dist/utility.mjs CHANGED
@@ -4,14 +4,17 @@
4
4
  */
5
5
 
6
6
  import events from 'node:events';
7
+ import { createRequire } from "node:module";
8
+ import { availableParallelism } from "node:os";
7
9
  import detectLibc from 'detect-libc';
8
10
 
9
11
  import is from './is.mjs';
10
- import { runtimePlatformArch } from './libvips.mjs';
12
+ import libvips from './libvips.mjs';
11
13
  import sharp from './sharp.mjs';
12
14
  import pkg from "../package.json" with { type: "json" };
13
15
 
14
- const runtimePlatform = runtimePlatformArch();
16
+ const require = createRequire(import.meta.url);
17
+ const runtimePlatform = libvips.runtimePlatformArch();
15
18
  const libvipsVersion = sharp.libvipsVersion();
16
19
 
17
20
  /**
@@ -62,15 +65,15 @@ let versions = {
62
65
  if (!libvipsVersion.isGlobal) {
63
66
  if (!libvipsVersion.isWasm) {
64
67
  try {
65
- versions = await import(`@img/sharp-${runtimePlatform}/versions`);
68
+ versions = require(`@img/sharp-${runtimePlatform}/versions`);
66
69
  } catch (_) {
67
70
  try {
68
- versions = await import(`@img/sharp-libvips-${runtimePlatform}/versions`);
71
+ versions = require(`@img/sharp-libvips-${runtimePlatform}/versions`);
69
72
  } catch (_) {}
70
73
  }
71
74
  } else {
72
75
  try {
73
- versions = await import('@img/sharp-wasm32/versions');
76
+ versions = require('@img/sharp-wasm32/versions');
74
77
  } catch (_) {}
75
78
  }
76
79
  }
@@ -157,7 +160,6 @@ if (detectLibc.familySync() === detectLibc.GLIBC && !sharp._isUsingJemalloc()) {
157
160
  sharp.concurrency(1);
158
161
  } else if (detectLibc.familySync() === detectLibc.MUSL && sharp.concurrency() === 1024) {
159
162
  // Reduce default concurrency when musl thread over-subscription detected
160
- const { availableParallelism } = await import('node:os')
161
163
  sharp.concurrency(availableParallelism());
162
164
  }
163
165
 
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.35.0-rc.4",
4
+ "version": "0.35.0-rc.5",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",
7
7
  "contributors": [
@@ -155,9 +155,9 @@
155
155
  "semver": "^7.7.4"
156
156
  },
157
157
  "optionalDependencies": {
158
- "@img/sharp-darwin-arm64": "0.35.0-rc.4",
159
- "@img/sharp-darwin-x64": "0.35.0-rc.4",
160
- "@img/sharp-freebsd-wasm32": "0.35.0-rc.4",
158
+ "@img/sharp-darwin-arm64": "0.35.0-rc.5",
159
+ "@img/sharp-darwin-x64": "0.35.0-rc.5",
160
+ "@img/sharp-freebsd-wasm32": "0.35.0-rc.5",
161
161
  "@img/sharp-libvips-darwin-arm64": "1.3.0-rc.5",
162
162
  "@img/sharp-libvips-darwin-x64": "1.3.0-rc.5",
163
163
  "@img/sharp-libvips-linux-arm": "1.3.0-rc.5",
@@ -168,18 +168,18 @@
168
168
  "@img/sharp-libvips-linux-x64": "1.3.0-rc.5",
169
169
  "@img/sharp-libvips-linuxmusl-arm64": "1.3.0-rc.5",
170
170
  "@img/sharp-libvips-linuxmusl-x64": "1.3.0-rc.5",
171
- "@img/sharp-linux-arm": "0.35.0-rc.4",
172
- "@img/sharp-linux-arm64": "0.35.0-rc.4",
173
- "@img/sharp-linux-ppc64": "0.35.0-rc.4",
174
- "@img/sharp-linux-riscv64": "0.35.0-rc.4",
175
- "@img/sharp-linux-s390x": "0.35.0-rc.4",
176
- "@img/sharp-linux-x64": "0.35.0-rc.4",
177
- "@img/sharp-linuxmusl-arm64": "0.35.0-rc.4",
178
- "@img/sharp-linuxmusl-x64": "0.35.0-rc.4",
179
- "@img/sharp-webcontainers-wasm32": "0.35.0-rc.4",
180
- "@img/sharp-win32-arm64": "0.35.0-rc.4",
181
- "@img/sharp-win32-ia32": "0.35.0-rc.4",
182
- "@img/sharp-win32-x64": "0.35.0-rc.4"
171
+ "@img/sharp-linux-arm": "0.35.0-rc.5",
172
+ "@img/sharp-linux-arm64": "0.35.0-rc.5",
173
+ "@img/sharp-linux-ppc64": "0.35.0-rc.5",
174
+ "@img/sharp-linux-riscv64": "0.35.0-rc.5",
175
+ "@img/sharp-linux-s390x": "0.35.0-rc.5",
176
+ "@img/sharp-linux-x64": "0.35.0-rc.5",
177
+ "@img/sharp-linuxmusl-arm64": "0.35.0-rc.5",
178
+ "@img/sharp-linuxmusl-x64": "0.35.0-rc.5",
179
+ "@img/sharp-webcontainers-wasm32": "0.35.0-rc.5",
180
+ "@img/sharp-win32-arm64": "0.35.0-rc.5",
181
+ "@img/sharp-win32-ia32": "0.35.0-rc.5",
182
+ "@img/sharp-win32-x64": "0.35.0-rc.5"
183
183
  },
184
184
  "devDependencies": {
185
185
  "@biomejs/biome": "^2.4.12",
@@ -196,7 +196,7 @@
196
196
  "extract-zip": "^2.0.1",
197
197
  "icc": "^3.0.0",
198
198
  "node-addon-api": "^8.7.0",
199
- "node-gyp": "^12.2.0",
199
+ "node-gyp": "^12.3.0",
200
200
  "tar-fs": "^3.1.2",
201
201
  "tsd": "^0.33.0"
202
202
  },