sharp 0.32.6 → 0.33.4

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/src/pipeline.h CHANGED
@@ -69,8 +69,7 @@ struct PipelineBaton {
69
69
  bool premultiplied;
70
70
  bool tileCentre;
71
71
  bool fastShrinkOnLoad;
72
- double tintA;
73
- double tintB;
72
+ std::vector<double> tint;
74
73
  bool flatten;
75
74
  std::vector<double> flattenBackground;
76
75
  bool unflatten;
@@ -92,6 +91,7 @@ struct PipelineBaton {
92
91
  bool thresholdGrayscale;
93
92
  std::vector<double> trimBackground;
94
93
  double trimThreshold;
94
+ bool trimLineArt;
95
95
  int trimOffsetLeft;
96
96
  int trimOffsetTop;
97
97
  std::vector<double> linearA;
@@ -169,6 +169,7 @@ struct PipelineBaton {
169
169
  VipsForeignTiffPredictor tiffPredictor;
170
170
  bool tiffPyramid;
171
171
  int tiffBitdepth;
172
+ bool tiffMiniswhite;
172
173
  bool tiffTile;
173
174
  int tiffTileHeight;
174
175
  int tiffTileWidth;
@@ -180,17 +181,19 @@ struct PipelineBaton {
180
181
  int heifEffort;
181
182
  std::string heifChromaSubsampling;
182
183
  bool heifLossless;
184
+ int heifBitdepth;
183
185
  double jxlDistance;
184
186
  int jxlDecodingTier;
185
187
  int jxlEffort;
186
188
  bool jxlLossless;
187
189
  VipsBandFormat rawDepth;
188
190
  std::string err;
189
- bool withMetadata;
191
+ int keepMetadata;
190
192
  int withMetadataOrientation;
191
193
  double withMetadataDensity;
192
- std::string withMetadataIcc;
193
- std::unordered_map<std::string, std::string> withMetadataStrs;
194
+ std::string withIccProfile;
195
+ std::unordered_map<std::string, std::string> withExif;
196
+ bool withExifMerge;
194
197
  int timeoutSeconds;
195
198
  std::unique_ptr<double[]> convKernel;
196
199
  int convKernelWidth;
@@ -203,7 +206,7 @@ struct PipelineBaton {
203
206
  int extractChannel;
204
207
  bool removeAlpha;
205
208
  double ensureAlpha;
206
- VipsInterpretation colourspaceInput;
209
+ VipsInterpretation colourspacePipeline;
207
210
  VipsInterpretation colourspace;
208
211
  std::vector<int> delay;
209
212
  int loop;
@@ -237,8 +240,7 @@ struct PipelineBaton {
237
240
  attentionX(0),
238
241
  attentionY(0),
239
242
  premultiplied(false),
240
- tintA(128.0),
241
- tintB(128.0),
243
+ tint{ -1.0, 0.0, 0.0, 0.0 },
242
244
  flatten(false),
243
245
  flattenBackground{ 0.0, 0.0, 0.0 },
244
246
  unflatten(false),
@@ -259,7 +261,8 @@ struct PipelineBaton {
259
261
  threshold(0),
260
262
  thresholdGrayscale(true),
261
263
  trimBackground{},
262
- trimThreshold(0.0),
264
+ trimThreshold(-1.0),
265
+ trimLineArt(false),
263
266
  trimOffsetLeft(0),
264
267
  trimOffsetTop(0),
265
268
  linearA{},
@@ -335,6 +338,7 @@ struct PipelineBaton {
335
338
  tiffPredictor(VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL),
336
339
  tiffPyramid(false),
337
340
  tiffBitdepth(8),
341
+ tiffMiniswhite(false),
338
342
  tiffTile(false),
339
343
  tiffTileHeight(256),
340
344
  tiffTileWidth(256),
@@ -346,14 +350,16 @@ struct PipelineBaton {
346
350
  heifEffort(4),
347
351
  heifChromaSubsampling("4:4:4"),
348
352
  heifLossless(false),
353
+ heifBitdepth(8),
349
354
  jxlDistance(1.0),
350
355
  jxlDecodingTier(0),
351
356
  jxlEffort(7),
352
357
  jxlLossless(false),
353
358
  rawDepth(VIPS_FORMAT_UCHAR),
354
- withMetadata(false),
359
+ keepMetadata(0),
355
360
  withMetadataOrientation(-1),
356
361
  withMetadataDensity(0.0),
362
+ withExifMerge(true),
357
363
  timeoutSeconds(0),
358
364
  convKernelWidth(0),
359
365
  convKernelHeight(0),
@@ -365,7 +371,7 @@ struct PipelineBaton {
365
371
  extractChannel(-1),
366
372
  removeAlpha(false),
367
373
  ensureAlpha(-1.0),
368
- colourspaceInput(VIPS_INTERPRETATION_LAST),
374
+ colourspacePipeline(VIPS_INTERPRETATION_LAST),
369
375
  colourspace(VIPS_INTERPRETATION_LAST),
370
376
  loop(-1),
371
377
  tileSize(256),
package/src/sharp.cc CHANGED
@@ -1,6 +1,8 @@
1
1
  // Copyright 2013 Lovell Fuller and others.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ #include <mutex> // NOLINT(build/c++11)
5
+
4
6
  #include <napi.h>
5
7
  #include <vips/vips8>
6
8
 
@@ -10,14 +12,11 @@
10
12
  #include "utilities.h"
11
13
  #include "stats.h"
12
14
 
13
- static void* sharp_vips_init(void*) {
14
- vips_init("sharp");
15
- return nullptr;
16
- }
17
-
18
15
  Napi::Object init(Napi::Env env, Napi::Object exports) {
19
- static GOnce sharp_vips_init_once = G_ONCE_INIT;
20
- g_once(&sharp_vips_init_once, static_cast<GThreadFunc>(sharp_vips_init), nullptr);
16
+ static std::once_flag sharp_vips_init_once;
17
+ std::call_once(sharp_vips_init_once, []() {
18
+ vips_init("sharp");
19
+ });
21
20
 
22
21
  g_log_set_handler("VIPS", static_cast<GLogLevelFlags>(G_LOG_LEVEL_WARNING),
23
22
  static_cast<GLogFunc>(sharp::VipsWarningCallback), nullptr);
package/src/stats.cc CHANGED
@@ -30,7 +30,7 @@ class StatsWorker : public Napi::AsyncWorker {
30
30
 
31
31
  void Execute() {
32
32
  // Decrement queued task counter
33
- g_atomic_int_dec_and_test(&sharp::counterQueue);
33
+ sharp::counterQueue--;
34
34
 
35
35
  vips::VImage image;
36
36
  sharp::ImageType imageType = sharp::ImageType::UNKNOWN;
@@ -106,7 +106,7 @@ class StatsWorker : public Napi::AsyncWorker {
106
106
  // Handle warnings
107
107
  std::string warning = sharp::VipsWarningPop();
108
108
  while (!warning.empty()) {
109
- debuglog.MakeCallback(Receiver().Value(), { Napi::String::New(env, warning) });
109
+ debuglog.Call(Receiver().Value(), { Napi::String::New(env, warning) });
110
110
  warning = sharp::VipsWarningPop();
111
111
  }
112
112
 
@@ -141,9 +141,9 @@ class StatsWorker : public Napi::AsyncWorker {
141
141
  dominant.Set("g", baton->dominantGreen);
142
142
  dominant.Set("b", baton->dominantBlue);
143
143
  info.Set("dominant", dominant);
144
- Callback().MakeCallback(Receiver().Value(), { env.Null(), info });
144
+ Callback().Call(Receiver().Value(), { env.Null(), info });
145
145
  } else {
146
- Callback().MakeCallback(Receiver().Value(), { Napi::Error::New(env, sharp::TrimEnd(baton->err)).Value() });
146
+ Callback().Call(Receiver().Value(), { Napi::Error::New(env, sharp::TrimEnd(baton->err)).Value() });
147
147
  }
148
148
 
149
149
  delete baton->input;
@@ -177,7 +177,7 @@ Napi::Value stats(const Napi::CallbackInfo& info) {
177
177
  worker->Queue();
178
178
 
179
179
  // Increment queued task counter
180
- g_atomic_int_inc(&sharp::counterQueue);
180
+ sharp::counterQueue++;
181
181
 
182
182
  return info.Env().Undefined();
183
183
  }
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>
@@ -70,8 +71,8 @@ Napi::Value concurrency(const Napi::CallbackInfo& info) {
70
71
  */
71
72
  Napi::Value counters(const Napi::CallbackInfo& info) {
72
73
  Napi::Object counters = Napi::Object::New(info.Env());
73
- counters.Set("queue", sharp::counterQueue);
74
- counters.Set("process", sharp::counterProcess);
74
+ counters.Set("queue", static_cast<int>(sharp::counterQueue));
75
+ counters.Set("process", static_cast<int>(sharp::counterProcess));
75
76
  return counters;
76
77
  }
77
78
 
@@ -91,9 +92,23 @@ Napi::Value simd(const Napi::CallbackInfo& info) {
91
92
  Get libvips version
92
93
  */
93
94
  Napi::Value libvipsVersion(const Napi::CallbackInfo& info) {
94
- char version[9];
95
- g_snprintf(version, sizeof(version), "%d.%d.%d", vips_version(0), vips_version(1), vips_version(2));
96
- return Napi::String::New(info.Env(), version);
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
+ #ifdef __EMSCRIPTEN__
107
+ version.Set("isWasm", Napi::Boolean::New(env, true));
108
+ #else
109
+ version.Set("isWasm", Napi::Boolean::New(env, false));
110
+ #endif
111
+ return version;
97
112
  }
98
113
 
99
114
  /*
@@ -1,14 +0,0 @@
1
- // Copyright 2013 Lovell Fuller and others.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- 'use strict';
5
-
6
- const libvips = require('../lib/libvips');
7
-
8
- try {
9
- if (!(libvips.useGlobalLibvips() || libvips.hasVendoredLibvips())) {
10
- process.exitCode = 1;
11
- }
12
- } catch (err) {
13
- process.exitCode = 1;
14
- }
@@ -1,40 +0,0 @@
1
- // Copyright 2013 Lovell Fuller and others.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- 'use strict';
5
-
6
- const fs = require('fs');
7
- const path = require('path');
8
-
9
- const libvips = require('../lib/libvips');
10
- const platform = require('../lib/platform');
11
-
12
- const minimumLibvipsVersion = libvips.minimumLibvipsVersion;
13
-
14
- const platformAndArch = platform();
15
-
16
- if (platformAndArch.startsWith('win32')) {
17
- const buildReleaseDir = path.join(__dirname, '..', 'build', 'Release');
18
- libvips.log(`Creating ${buildReleaseDir}`);
19
- try {
20
- libvips.mkdirSync(buildReleaseDir);
21
- } catch (err) {}
22
- const vendorLibDir = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion, platformAndArch, 'lib');
23
- libvips.log(`Copying DLLs from ${vendorLibDir} to ${buildReleaseDir}`);
24
- try {
25
- fs
26
- .readdirSync(vendorLibDir)
27
- .filter(function (filename) {
28
- return /\.dll$/.test(filename);
29
- })
30
- .forEach(function (filename) {
31
- fs.copyFileSync(
32
- path.join(vendorLibDir, filename),
33
- path.join(buildReleaseDir, filename)
34
- );
35
- });
36
- } catch (err) {
37
- libvips.log(err);
38
- process.exit(1);
39
- }
40
- }
@@ -1,222 +0,0 @@
1
- // Copyright 2013 Lovell Fuller and others.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- 'use strict';
5
-
6
- const fs = require('fs');
7
- const os = require('os');
8
- const path = require('path');
9
- const stream = require('stream');
10
- const zlib = require('zlib');
11
- const { createHash } = require('crypto');
12
-
13
- const detectLibc = require('detect-libc');
14
- const semverCoerce = require('semver/functions/coerce');
15
- const semverLessThan = require('semver/functions/lt');
16
- const semverSatisfies = require('semver/functions/satisfies');
17
- const simpleGet = require('simple-get');
18
- const tarFs = require('tar-fs');
19
-
20
- const agent = require('../lib/agent');
21
- const libvips = require('../lib/libvips');
22
- const platform = require('../lib/platform');
23
-
24
- const minimumGlibcVersionByArch = {
25
- arm: '2.28',
26
- arm64: '2.17',
27
- x64: '2.17'
28
- };
29
-
30
- const hasSharpPrebuild = [
31
- 'darwin-x64',
32
- 'darwin-arm64',
33
- 'linux-arm64',
34
- 'linux-x64',
35
- 'linuxmusl-x64',
36
- 'linuxmusl-arm64',
37
- 'win32-ia32',
38
- 'win32-x64'
39
- ];
40
-
41
- const { minimumLibvipsVersion, minimumLibvipsVersionLabelled } = libvips;
42
- const localLibvipsDir = process.env.npm_config_sharp_libvips_local_prebuilds || '';
43
- const distHost = process.env.npm_config_sharp_libvips_binary_host || 'https://github.com/lovell/sharp-libvips/releases/download';
44
- const distBaseUrl = process.env.npm_config_sharp_dist_base_url || process.env.SHARP_DIST_BASE_URL || `${distHost}/v${minimumLibvipsVersionLabelled}/`;
45
- const installationForced = !!(process.env.npm_config_sharp_install_force || process.env.SHARP_INSTALL_FORCE);
46
-
47
- const fail = function (err) {
48
- libvips.log(err);
49
- if (err.code === 'EACCES') {
50
- libvips.log('Are you trying to install as a root or sudo user?');
51
- libvips.log('- For npm <= v6, try again with the "--unsafe-perm" flag');
52
- libvips.log('- For npm >= v8, the user must own the directory "npm install" is run in');
53
- }
54
- libvips.log('Please see https://sharp.pixelplumbing.com/install for required dependencies');
55
- process.exit(1);
56
- };
57
-
58
- const handleError = function (err) {
59
- if (installationForced) {
60
- libvips.log(`Installation warning: ${err.message}`);
61
- } else {
62
- throw err;
63
- }
64
- };
65
-
66
- const verifyIntegrity = function (platformAndArch) {
67
- const expected = libvips.integrity(platformAndArch);
68
- if (installationForced || !expected) {
69
- libvips.log(`Integrity check skipped for ${platformAndArch}`);
70
- return new stream.PassThrough();
71
- }
72
- const hash = createHash('sha512');
73
- return new stream.Transform({
74
- transform: function (chunk, _encoding, done) {
75
- hash.update(chunk);
76
- done(null, chunk);
77
- },
78
- flush: function (done) {
79
- const digest = `sha512-${hash.digest('base64')}`;
80
- if (expected !== digest) {
81
- try {
82
- libvips.removeVendoredLibvips();
83
- } catch (err) {
84
- libvips.log(err.message);
85
- }
86
- libvips.log(`Integrity expected: ${expected}`);
87
- libvips.log(`Integrity received: ${digest}`);
88
- done(new Error(`Integrity check failed for ${platformAndArch}`));
89
- } else {
90
- libvips.log(`Integrity check passed for ${platformAndArch}`);
91
- done();
92
- }
93
- }
94
- });
95
- };
96
-
97
- const extractTarball = function (tarPath, platformAndArch) {
98
- const versionedVendorPath = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion, platformAndArch);
99
- libvips.mkdirSync(versionedVendorPath);
100
-
101
- const ignoreVendorInclude = hasSharpPrebuild.includes(platformAndArch) && !process.env.npm_config_build_from_source;
102
- const ignore = function (name) {
103
- return ignoreVendorInclude && name.includes('include/');
104
- };
105
-
106
- stream.pipeline(
107
- fs.createReadStream(tarPath),
108
- verifyIntegrity(platformAndArch),
109
- new zlib.BrotliDecompress(),
110
- tarFs.extract(versionedVendorPath, { ignore }),
111
- function (err) {
112
- if (err) {
113
- if (/unexpected end of file/.test(err.message)) {
114
- fail(new Error(`Please delete ${tarPath} as it is not a valid tarball`));
115
- }
116
- fail(err);
117
- }
118
- }
119
- );
120
- };
121
-
122
- try {
123
- const useGlobalLibvips = libvips.useGlobalLibvips();
124
-
125
- if (useGlobalLibvips) {
126
- const globalLibvipsVersion = libvips.globalLibvipsVersion();
127
- libvips.log(`Detected globally-installed libvips v${globalLibvipsVersion}`);
128
- libvips.log('Building from source via node-gyp');
129
- process.exit(1);
130
- } else if (libvips.hasVendoredLibvips()) {
131
- libvips.log(`Using existing vendored libvips v${minimumLibvipsVersion}`);
132
- } else {
133
- // Is this arch/platform supported?
134
- const arch = process.env.npm_config_arch || process.arch;
135
- const platformAndArch = platform();
136
- if (arch === 'ia32' && !platformAndArch.startsWith('win32')) {
137
- throw new Error(`Intel Architecture 32-bit systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
138
- }
139
- if (platformAndArch === 'freebsd-x64' || platformAndArch === 'openbsd-x64' || platformAndArch === 'sunos-x64') {
140
- throw new Error(`BSD/SunOS systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
141
- }
142
- // Linux libc version check
143
- const libcVersionRaw = detectLibc.versionSync();
144
- if (libcVersionRaw) {
145
- const libcFamily = detectLibc.familySync();
146
- const libcVersion = semverCoerce(libcVersionRaw).version;
147
- if (libcFamily === detectLibc.GLIBC && minimumGlibcVersionByArch[arch]) {
148
- if (semverLessThan(libcVersion, semverCoerce(minimumGlibcVersionByArch[arch]).version)) {
149
- handleError(new Error(`Use with glibc ${libcVersionRaw} requires manual installation of libvips >= ${minimumLibvipsVersion}`));
150
- }
151
- }
152
- if (libcFamily === detectLibc.MUSL) {
153
- if (semverLessThan(libcVersion, '1.1.24')) {
154
- handleError(new Error(`Use with musl ${libcVersionRaw} requires manual installation of libvips >= ${minimumLibvipsVersion}`));
155
- }
156
- }
157
- }
158
- // Node.js minimum version check
159
- const supportedNodeVersion = process.env.npm_package_engines_node || require('../package.json').engines.node;
160
- if (!semverSatisfies(process.versions.node, supportedNodeVersion)) {
161
- handleError(new Error(`Expected Node.js version ${supportedNodeVersion} but found ${process.versions.node}`));
162
- }
163
- // Download to per-process temporary file
164
- const tarFilename = ['libvips', minimumLibvipsVersionLabelled, platformAndArch].join('-') + '.tar.br';
165
- const tarPathCache = path.join(libvips.cachePath(), tarFilename);
166
- if (fs.existsSync(tarPathCache)) {
167
- libvips.log(`Using cached ${tarPathCache}`);
168
- extractTarball(tarPathCache, platformAndArch);
169
- } else if (localLibvipsDir) {
170
- // If localLibvipsDir is given try to use binaries from local directory
171
- const tarPathLocal = path.join(path.resolve(localLibvipsDir), `v${minimumLibvipsVersionLabelled}`, tarFilename);
172
- libvips.log(`Using local libvips from ${tarPathLocal}`);
173
- extractTarball(tarPathLocal, platformAndArch);
174
- } else {
175
- const url = distBaseUrl + tarFilename;
176
- libvips.log(`Downloading ${url}`);
177
- simpleGet({ url: url, agent: agent(libvips.log) }, function (err, response) {
178
- if (err) {
179
- fail(err);
180
- } else if (response.statusCode === 404) {
181
- fail(new Error(`Prebuilt libvips ${minimumLibvipsVersion} binaries are not yet available for ${platformAndArch}`));
182
- } else if (response.statusCode !== 200) {
183
- fail(new Error(`Status ${response.statusCode} ${response.statusMessage}`));
184
- } else {
185
- const tarPathTemp = path.join(os.tmpdir(), `${process.pid}-${tarFilename}`);
186
- const tmpFileStream = fs.createWriteStream(tarPathTemp);
187
- response
188
- .on('error', function (err) {
189
- tmpFileStream.destroy(err);
190
- })
191
- .on('close', function () {
192
- if (!response.complete) {
193
- tmpFileStream.destroy(new Error('Download incomplete (connection was terminated)'));
194
- }
195
- })
196
- .pipe(tmpFileStream);
197
- tmpFileStream
198
- .on('error', function (err) {
199
- // Clean up temporary file
200
- try {
201
- fs.unlinkSync(tarPathTemp);
202
- } catch (e) {}
203
- fail(err);
204
- })
205
- .on('close', function () {
206
- try {
207
- // Attempt to rename
208
- fs.renameSync(tarPathTemp, tarPathCache);
209
- } catch (err) {
210
- // Fall back to copy and unlink
211
- fs.copyFileSync(tarPathTemp, tarPathCache);
212
- fs.unlinkSync(tarPathTemp);
213
- }
214
- extractTarball(tarPathCache, platformAndArch);
215
- });
216
- }
217
- });
218
- }
219
- }
220
- } catch (err) {
221
- fail(err);
222
- }
package/lib/agent.js DELETED
@@ -1,44 +0,0 @@
1
- // Copyright 2013 Lovell Fuller and others.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- 'use strict';
5
-
6
- const url = require('url');
7
- const tunnelAgent = require('tunnel-agent');
8
-
9
- const is = require('./is');
10
-
11
- const proxies = [
12
- 'HTTPS_PROXY',
13
- 'https_proxy',
14
- 'HTTP_PROXY',
15
- 'http_proxy',
16
- 'npm_config_https_proxy',
17
- 'npm_config_proxy'
18
- ];
19
-
20
- function env (key) {
21
- return process.env[key];
22
- }
23
-
24
- module.exports = function (log) {
25
- try {
26
- const proxy = new url.URL(proxies.map(env).find(is.string));
27
- const tunnel = proxy.protocol === 'https:'
28
- ? tunnelAgent.httpsOverHttps
29
- : tunnelAgent.httpsOverHttp;
30
- const proxyAuth = proxy.username && proxy.password
31
- ? `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`
32
- : null;
33
- log(`Via proxy ${proxy.protocol}//${proxy.hostname}:${proxy.port} ${proxyAuth ? 'with' : 'no'} credentials`);
34
- return tunnel({
35
- proxy: {
36
- port: Number(proxy.port),
37
- host: proxy.hostname,
38
- proxyAuth
39
- }
40
- });
41
- } catch (err) {
42
- return null;
43
- }
44
- };
package/lib/platform.js DELETED
@@ -1,30 +0,0 @@
1
- // Copyright 2013 Lovell Fuller and others.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- 'use strict';
5
-
6
- const detectLibc = require('detect-libc');
7
-
8
- const env = process.env;
9
-
10
- module.exports = function () {
11
- const arch = env.npm_config_arch || process.arch;
12
- const platform = env.npm_config_platform || process.platform;
13
- const libc = process.env.npm_config_libc ||
14
- /* istanbul ignore next */
15
- (detectLibc.isNonGlibcLinuxSync() ? detectLibc.familySync() : '');
16
- const libcId = platform !== 'linux' || libc === detectLibc.GLIBC ? '' : libc;
17
-
18
- const platformId = [`${platform}${libcId}`];
19
-
20
- if (arch === 'arm') {
21
- const fallback = process.versions.electron ? '7' : '6';
22
- platformId.push(`armv${env.npm_config_arm_version || process.config.variables.arm_version || fallback}`);
23
- } else if (arch === 'arm64') {
24
- platformId.push(`arm64v${env.npm_config_arm_version || '8'}`);
25
- } else {
26
- platformId.push(arch);
27
- }
28
-
29
- return platformId.join('-');
30
- };