@basemaps/lambda-tiler 6.16.1 → 6.20.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/LICENSE +2 -2
  3. package/build/__test__/tile.style.json.test.d.ts +2 -0
  4. package/build/__test__/tile.style.json.test.d.ts.map +1 -0
  5. package/build/__test__/tile.style.json.test.js +33 -0
  6. package/build/__test__/xyz.test.js +35 -34
  7. package/build/cli/dump.js +2 -2
  8. package/build/index.d.ts.map +1 -1
  9. package/build/index.js +10 -0
  10. package/build/routes/esri/rest.d.ts +10 -0
  11. package/build/routes/esri/rest.d.ts.map +1 -0
  12. package/build/routes/esri/rest.js +87 -0
  13. package/build/routes/imagery.d.ts +10 -0
  14. package/build/routes/imagery.d.ts.map +1 -0
  15. package/build/routes/imagery.js +50 -0
  16. package/build/routes/response.d.ts +4 -0
  17. package/build/routes/response.d.ts.map +1 -0
  18. package/build/routes/response.js +3 -0
  19. package/build/routes/tile.d.ts +0 -20
  20. package/build/routes/tile.d.ts.map +1 -1
  21. package/build/routes/tile.js +11 -164
  22. package/build/routes/tile.json.d.ts +10 -0
  23. package/build/routes/tile.json.d.ts.map +1 -0
  24. package/build/routes/tile.json.js +31 -0
  25. package/build/routes/tile.style.json.d.ts +10 -0
  26. package/build/routes/tile.style.json.d.ts.map +1 -0
  27. package/build/routes/tile.style.json.js +74 -0
  28. package/build/routes/tile.wmts.d.ts +9 -0
  29. package/build/routes/tile.wmts.d.ts.map +1 -0
  30. package/build/routes/tile.wmts.js +57 -0
  31. package/build/routes/tile.xyz.d.ts +13 -0
  32. package/build/routes/tile.xyz.d.ts.map +1 -0
  33. package/build/routes/tile.xyz.js +28 -0
  34. package/build/tile.set.raster.d.ts +2 -0
  35. package/build/tile.set.raster.d.ts.map +1 -1
  36. package/build/tile.set.raster.js +3 -1
  37. package/build/tile.set.vector.js +1 -1
  38. package/dist/index.js +10580 -9573
  39. package/dist/node_modules/color/README.md +7 -7
  40. package/dist/node_modules/color/index.js +173 -158
  41. package/dist/node_modules/color/package.json +18 -16
  42. package/dist/node_modules/color-convert/conversions.js +281 -310
  43. package/dist/node_modules/color-convert/index.js +27 -24
  44. package/dist/node_modules/color-convert/package.json +16 -14
  45. package/dist/node_modules/color-convert/route.js +22 -22
  46. package/dist/node_modules/color-name/package.json +17 -14
  47. package/dist/node_modules/color-string/index.js +2 -2
  48. package/dist/node_modules/color-string/package.json +10 -10
  49. package/dist/node_modules/decompress-response/index.d.ts +14 -21
  50. package/dist/node_modules/decompress-response/index.js +34 -16
  51. package/dist/node_modules/decompress-response/license +1 -1
  52. package/dist/node_modules/decompress-response/package.json +23 -17
  53. package/dist/node_modules/decompress-response/readme.md +2 -6
  54. package/dist/node_modules/detect-libc/package.json +0 -1
  55. package/dist/node_modules/mimic-response/index.d.ts +2 -2
  56. package/dist/node_modules/mimic-response/index.js +41 -2
  57. package/dist/node_modules/mimic-response/package.json +17 -17
  58. package/dist/node_modules/mimic-response/readme.md +22 -1
  59. package/dist/node_modules/node-abi/.circleci/config.yml +63 -0
  60. package/dist/node_modules/node-abi/.releaserc.json +9 -0
  61. package/dist/node_modules/node-abi/abi_registry.json +39 -4
  62. package/dist/node_modules/node-abi/index.js +5 -2
  63. package/dist/node_modules/node-abi/package.json +17 -16
  64. package/dist/node_modules/node-abi/test/index.js +7 -15
  65. package/dist/node_modules/node-addon-api/README.md +2 -2
  66. package/dist/node_modules/node-addon-api/except.gypi +20 -11
  67. package/dist/node_modules/node-addon-api/napi-inl.h +734 -196
  68. package/dist/node_modules/node-addon-api/napi.h +420 -164
  69. package/dist/node_modules/node-addon-api/noexcept.gypi +21 -11
  70. package/dist/node_modules/node-addon-api/package.json +43 -14
  71. package/dist/node_modules/node-addon-api/tools/clang-format.js +18 -17
  72. package/dist/node_modules/node-addon-api/tools/eslint-format.js +71 -0
  73. package/dist/node_modules/prebuild-install/CHANGELOG.md +24 -7
  74. package/dist/node_modules/prebuild-install/README.md +24 -4
  75. package/dist/node_modules/prebuild-install/asset.js +10 -10
  76. package/dist/node_modules/prebuild-install/bin.js +13 -13
  77. package/dist/node_modules/prebuild-install/download.js +22 -22
  78. package/dist/node_modules/prebuild-install/log.js +4 -4
  79. package/dist/node_modules/prebuild-install/node_modules/detect-libc/LICENSE +201 -0
  80. package/dist/node_modules/prebuild-install/node_modules/detect-libc/README.md +160 -0
  81. package/dist/node_modules/prebuild-install/node_modules/detect-libc/index.d.ts +11 -0
  82. package/dist/node_modules/prebuild-install/node_modules/detect-libc/lib/detect-libc.js +178 -0
  83. package/dist/node_modules/prebuild-install/node_modules/detect-libc/lib/process.js +16 -0
  84. package/dist/node_modules/prebuild-install/node_modules/detect-libc/package.json +71 -0
  85. package/dist/node_modules/prebuild-install/package.json +18 -19
  86. package/dist/node_modules/prebuild-install/proxy.js +10 -10
  87. package/dist/node_modules/prebuild-install/rc.js +12 -12
  88. package/dist/node_modules/prebuild-install/util.js +14 -14
  89. package/dist/node_modules/semver/package.json +1 -0
  90. package/dist/node_modules/sharp/README.md +2 -2
  91. package/dist/node_modules/sharp/binding.gyp +12 -9
  92. package/dist/node_modules/sharp/build/Release/sharp-linux-x64.node +0 -0
  93. package/dist/node_modules/sharp/install/dll-copy.js +6 -6
  94. package/dist/node_modules/sharp/install/libvips.js +4 -8
  95. package/dist/node_modules/sharp/lib/channel.js +11 -7
  96. package/dist/node_modules/sharp/lib/colour.js +42 -1
  97. package/dist/node_modules/sharp/lib/constructor.js +18 -31
  98. package/dist/node_modules/sharp/lib/input.js +45 -3
  99. package/dist/node_modules/sharp/lib/is.js +19 -5
  100. package/dist/node_modules/sharp/lib/libvips.js +4 -19
  101. package/dist/node_modules/sharp/lib/operation.js +28 -5
  102. package/dist/node_modules/sharp/lib/output.js +147 -16
  103. package/dist/node_modules/sharp/lib/sharp.js +31 -0
  104. package/dist/node_modules/sharp/lib/utility.js +3 -2
  105. package/dist/node_modules/sharp/package.json +32 -23
  106. package/dist/node_modules/sharp/src/common.cc +67 -11
  107. package/dist/node_modules/sharp/src/common.h +25 -5
  108. package/dist/node_modules/sharp/src/libvips/cplusplus/VConnection.cpp +0 -26
  109. package/dist/node_modules/sharp/src/libvips/cplusplus/VImage.cpp +54 -16
  110. package/dist/node_modules/sharp/src/libvips/cplusplus/VInterpolate.cpp +0 -13
  111. package/dist/node_modules/sharp/src/libvips/cplusplus/vips-operators.cpp +185 -1
  112. package/dist/node_modules/sharp/src/metadata.cc +14 -0
  113. package/dist/node_modules/sharp/src/metadata.h +1 -0
  114. package/dist/node_modules/sharp/src/operations.cc +29 -3
  115. package/dist/node_modules/sharp/src/operations.h +13 -2
  116. package/dist/node_modules/sharp/src/pipeline.cc +103 -35
  117. package/dist/node_modules/sharp/src/pipeline.h +23 -3
  118. package/dist/node_modules/sharp/src/utilities.cc +1 -1
  119. package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/THIRD-PARTY-NOTICES.md +2 -3
  120. package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/lib/libvips-cpp.so.42 +0 -0
  121. package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/platform.json +0 -0
  122. package/dist/node_modules/sharp/vendor/8.11.3/linux-x64/versions.json +30 -0
  123. package/dist/node_modules/simple-get/.github/dependabot.yml +15 -0
  124. package/dist/node_modules/simple-get/.github/workflows/ci.yml +23 -0
  125. package/dist/node_modules/simple-get/README.md +17 -3
  126. package/dist/node_modules/simple-get/index.js +9 -0
  127. package/dist/node_modules/simple-get/package.json +27 -13
  128. package/dist/package-lock.json +54 -54
  129. package/dist/package.json +11 -11
  130. package/package.json +12 -12
  131. package/src/__test__/tile.style.json.test.ts +40 -0
  132. package/src/__test__/xyz.test.ts +43 -41
  133. package/src/cli/dump.ts +2 -2
  134. package/src/index.ts +10 -0
  135. package/src/routes/esri/rest.ts +90 -0
  136. package/src/routes/imagery.ts +52 -0
  137. package/src/routes/response.ts +4 -0
  138. package/src/routes/tile.json.ts +44 -0
  139. package/src/routes/tile.style.json.ts +77 -0
  140. package/src/routes/tile.ts +11 -186
  141. package/src/routes/tile.wmts.ts +59 -0
  142. package/src/routes/tile.xyz.ts +30 -0
  143. package/src/tile.set.raster.ts +4 -1
  144. package/src/tile.set.vector.ts +1 -1
  145. package/tsconfig.tsbuildinfo +1 -1
  146. package/dist/node_modules/color-name/.eslintrc.json +0 -43
  147. package/dist/node_modules/color-name/test.js +0 -7
  148. package/dist/node_modules/node-abi/.travis.yml +0 -17
  149. package/dist/node_modules/node-abi/node_modules/semver/CHANGELOG.md +0 -39
  150. package/dist/node_modules/node-abi/node_modules/semver/LICENSE +0 -15
  151. package/dist/node_modules/node-abi/node_modules/semver/README.md +0 -412
  152. package/dist/node_modules/node-abi/node_modules/semver/bin/semver +0 -160
  153. package/dist/node_modules/node-abi/node_modules/semver/package.json +0 -60
  154. package/dist/node_modules/node-abi/node_modules/semver/range.bnf +0 -16
  155. package/dist/node_modules/node-abi/node_modules/semver/semver.js +0 -1483
  156. package/dist/node_modules/node-addon-api/CHANGELOG.md +0 -722
  157. package/dist/node_modules/sharp/build/Release/sharp.node +0 -0
  158. package/dist/node_modules/sharp/vendor/8.10.6/versions.json +0 -31
@@ -1,26 +1,26 @@
1
1
  {
2
- "_from": "prebuild-install@^6.1.2",
3
- "_id": "prebuild-install@6.1.4",
2
+ "_from": "prebuild-install@^7.0.0",
3
+ "_id": "prebuild-install@7.0.1",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==",
5
+ "_integrity": "sha512-QBSab31WqkyxpnMWQxubYAHR5S9B2+r81ucocew34Fkl98FhvKIF50jIJnNOBmAZfyNV7vE5T6gd3hTVWgY6tg==",
6
6
  "_location": "/prebuild-install",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "range",
10
10
  "registry": true,
11
- "raw": "prebuild-install@^6.1.2",
11
+ "raw": "prebuild-install@^7.0.0",
12
12
  "name": "prebuild-install",
13
13
  "escapedName": "prebuild-install",
14
- "rawSpec": "^6.1.2",
14
+ "rawSpec": "^7.0.0",
15
15
  "saveSpec": null,
16
- "fetchSpec": "^6.1.2"
16
+ "fetchSpec": "^7.0.0"
17
17
  },
18
18
  "_requiredBy": [
19
19
  "/sharp"
20
20
  ],
21
- "_resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.4.tgz",
22
- "_shasum": "ae3c0142ad611d58570b89af4986088a4937e00f",
23
- "_spec": "prebuild-install@^6.1.2",
21
+ "_resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.0.1.tgz",
22
+ "_shasum": "c10075727c318efe72412f333e0ef625beaf3870",
23
+ "_spec": "prebuild-install@^7.0.0",
24
24
  "_where": "/home/runner/work/basemaps/basemaps/packages/lambda-tiler/dist/node_modules/sharp",
25
25
  "author": {
26
26
  "name": "Mathias Buus",
@@ -71,17 +71,17 @@
71
71
  }
72
72
  ],
73
73
  "dependencies": {
74
- "detect-libc": "^1.0.3",
74
+ "detect-libc": "^2.0.0",
75
75
  "expand-template": "^2.0.3",
76
76
  "github-from-package": "0.0.0",
77
77
  "minimist": "^1.2.3",
78
78
  "mkdirp-classic": "^0.5.3",
79
79
  "napi-build-utils": "^1.0.1",
80
- "node-abi": "^2.21.0",
80
+ "node-abi": "^3.3.0",
81
81
  "npmlog": "^4.0.1",
82
82
  "pump": "^3.0.0",
83
83
  "rc": "^1.2.7",
84
- "simple-get": "^3.0.3",
84
+ "simple-get": "^4.0.0",
85
85
  "tar-fs": "^2.0.0",
86
86
  "tunnel-agent": "^0.6.0"
87
87
  },
@@ -89,15 +89,15 @@
89
89
  "description": "A command line tool to easily install prebuilt binaries for multiple version of node/iojs on a specific platform",
90
90
  "devDependencies": {
91
91
  "a-native-module": "^1.0.0",
92
- "hallmark": "^3.0.0",
92
+ "hallmark": "^4.0.0",
93
93
  "nock": "^10.0.6",
94
94
  "rimraf": "^2.5.2",
95
- "standard": "^13.0.2",
96
- "tape": "^4.5.1",
95
+ "standard": "^16.0.4",
96
+ "tape": "^5.3.1",
97
97
  "tempy": "0.2.1"
98
98
  },
99
99
  "engines": {
100
- "node": ">=6"
100
+ "node": ">=10"
101
101
  },
102
102
  "homepage": "https://github.com/prebuild/prebuild-install",
103
103
  "keywords": [
@@ -120,8 +120,7 @@
120
120
  },
121
121
  "scripts": {
122
122
  "hallmark": "hallmark --fix",
123
- "lint": "standard && hallmark",
124
- "test": "tape test/*-test.js && npm run lint"
123
+ "test": "standard && hallmark && tape test/*-test.js"
125
124
  },
126
- "version": "6.1.4"
125
+ "version": "7.0.1"
127
126
  }
@@ -1,20 +1,20 @@
1
- var url = require('url')
2
- var tunnel = require('tunnel-agent')
3
- var util = require('./util')
1
+ const url = require('url')
2
+ const tunnel = require('tunnel-agent')
3
+ const util = require('./util')
4
4
 
5
5
  function applyProxy (reqOpts, opts) {
6
- var log = opts.log || util.noopLogger
6
+ const log = opts.log || util.noopLogger
7
7
 
8
- var proxy = opts['https-proxy'] || opts.proxy
8
+ const proxy = opts['https-proxy'] || opts.proxy
9
9
 
10
10
  if (proxy) {
11
11
  // eslint-disable-next-line node/no-deprecated-api
12
- var parsedDownloadUrl = url.parse(reqOpts.url)
12
+ const parsedDownloadUrl = url.parse(reqOpts.url)
13
13
  // eslint-disable-next-line node/no-deprecated-api
14
- var parsedProxy = url.parse(proxy)
15
- var uriProtocol = (parsedDownloadUrl.protocol === 'https:' ? 'https' : 'http')
16
- var proxyProtocol = (parsedProxy.protocol === 'https:' ? 'Https' : 'Http')
17
- var tunnelFnName = [uriProtocol, proxyProtocol].join('Over')
14
+ const parsedProxy = url.parse(proxy)
15
+ const uriProtocol = (parsedDownloadUrl.protocol === 'https:' ? 'https' : 'http')
16
+ const proxyProtocol = (parsedProxy.protocol === 'https:' ? 'Https' : 'Http')
17
+ const tunnelFnName = [uriProtocol, proxyProtocol].join('Over')
18
18
  reqOpts.agent = tunnel[tunnelFnName]({
19
19
  proxy: {
20
20
  host: parsedProxy.hostname,
@@ -1,18 +1,18 @@
1
- var path = require('path')
2
- var minimist = require('minimist')
3
- var getAbi = require('node-abi').getAbi
4
- var detectLibc = require('detect-libc')
5
- var napi = require('napi-build-utils')
1
+ const path = require('path')
2
+ const minimist = require('minimist')
3
+ const getAbi = require('node-abi').getAbi
4
+ const detectLibc = require('detect-libc')
5
+ const napi = require('napi-build-utils')
6
6
 
7
- var env = process.env
8
- var libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || ''
7
+ const env = process.env
8
+ const libc = env.LIBC || (detectLibc.isNonGlibcLinuxSync() && detectLibc.familySync()) || ''
9
9
 
10
10
  // Get the configuration
11
11
  module.exports = function (pkg) {
12
- var pkgConf = pkg.config || {}
13
- var buildFromSource = env.npm_config_build_from_source
12
+ const pkgConf = pkg.config || {}
13
+ const buildFromSource = env.npm_config_build_from_source
14
14
 
15
- var rc = require('rc')('prebuild-install', {
15
+ const rc = require('rc')('prebuild-install', {
16
16
  target: pkgConf.target || env.npm_config_target || process.versions.node,
17
17
  runtime: pkgConf.runtime || env.npm_config_runtime || 'node',
18
18
  arch: pkgConf.arch || env.npm_config_arch || process.arch,
@@ -23,8 +23,8 @@ module.exports = function (pkg) {
23
23
  verbose: env.npm_config_verbose === 'true',
24
24
  buildFromSource: buildFromSource === pkg.name || buildFromSource === 'true',
25
25
  path: '.',
26
- proxy: env.npm_config_proxy || env['http_proxy'] || env['HTTP_PROXY'],
27
- 'https-proxy': env.npm_config_https_proxy || env['https_proxy'] || env['HTTPS_PROXY'],
26
+ proxy: env.npm_config_proxy || env.http_proxy || env.HTTP_PROXY,
27
+ 'https-proxy': env.npm_config_https_proxy || env.https_proxy || env.HTTPS_PROXY,
28
28
  'local-address': env.npm_config_local_address,
29
29
  'local-prebuilds': 'prebuilds',
30
30
  'tag-prefix': 'v',
@@ -1,11 +1,11 @@
1
- var path = require('path')
2
- var github = require('github-from-package')
3
- var home = require('os').homedir
4
- var crypto = require('crypto')
5
- var expandTemplate = require('expand-template')()
1
+ const path = require('path')
2
+ const github = require('github-from-package')
3
+ const home = require('os').homedir
4
+ const crypto = require('crypto')
5
+ const expandTemplate = require('expand-template')()
6
6
 
7
7
  function getDownloadUrl (opts) {
8
- var pkgName = opts.pkg.name.replace(/^@[a-zA-Z0-9_\-.~]+\//, '')
8
+ const pkgName = opts.pkg.name.replace(/^@[a-zA-Z0-9_\-.~]+\//, '')
9
9
  return expandTemplate(urlTemplate(opts), {
10
10
  name: pkgName,
11
11
  package_name: pkgName,
@@ -40,8 +40,8 @@ function urlTemplate (opts) {
40
40
  return opts.download
41
41
  }
42
42
 
43
- var packageName = '{name}-v{version}-{runtime}-v{abi}-{platform}{libc}-{arch}.tar.gz'
44
- var hostMirrorUrl = getHostMirrorUrl(opts)
43
+ const packageName = '{name}-v{version}-{runtime}-v{abi}-{platform}{libc}-{arch}.tar.gz'
44
+ const hostMirrorUrl = getHostMirrorUrl(opts)
45
45
 
46
46
  if (hostMirrorUrl) {
47
47
  return hostMirrorUrl + '/{tag_prefix}{version}/' + packageName
@@ -65,7 +65,7 @@ function getEnvPrefix (pkgName) {
65
65
  }
66
66
 
67
67
  function getHostMirrorUrl (opts) {
68
- var propName = getEnvPrefix(opts.pkg.name) + '_binary_host'
68
+ const propName = getEnvPrefix(opts.pkg.name) + '_binary_host'
69
69
  return process.env[propName] || process.env[propName + '_mirror']
70
70
  }
71
71
 
@@ -74,12 +74,12 @@ function trimSlashes (str) {
74
74
  }
75
75
 
76
76
  function cachedPrebuild (url) {
77
- var digest = crypto.createHash('md5').update(url).digest('hex').slice(0, 6)
77
+ const digest = crypto.createHash('md5').update(url).digest('hex').slice(0, 6)
78
78
  return path.join(prebuildCache(), digest + '-' + path.basename(url).replace(/[^a-zA-Z0-9.]+/g, '-'))
79
79
  }
80
80
 
81
81
  function npmCache () {
82
- var env = process.env
82
+ const env = process.env
83
83
  return env.npm_config_cache || (env.APPDATA ? path.join(env.APPDATA, 'npm-cache') : path.join(home(), '.npm'))
84
84
  }
85
85
 
@@ -110,12 +110,12 @@ function packageOrigin (env, pkg) {
110
110
  }
111
111
 
112
112
  function localPrebuild (url, opts) {
113
- var propName = getEnvPrefix(opts.pkg.name) + '_local_prebuilds'
114
- var prefix = process.env[propName] || opts['local-prebuilds'] || 'prebuilds'
113
+ const propName = getEnvPrefix(opts.pkg.name) + '_local_prebuilds'
114
+ const prefix = process.env[propName] || opts['local-prebuilds'] || 'prebuilds'
115
115
  return path.join(prefix, path.basename(url))
116
116
  }
117
117
 
118
- var noopLogger = {
118
+ const noopLogger = {
119
119
  http: function () {},
120
120
  silly: function () {},
121
121
  debug: function () {},
@@ -16,6 +16,7 @@
16
16
  "fetchSpec": "^7.3.5"
17
17
  },
18
18
  "_requiredBy": [
19
+ "/node-abi",
19
20
  "/sharp"
20
21
  ],
21
22
  "_resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
@@ -16,7 +16,7 @@ Lanczos resampling ensures quality is not sacrificed for speed.
16
16
  As well as image resizing, operations such as
17
17
  rotation, extraction, compositing and gamma correction are available.
18
18
 
19
- Most modern macOS, Windows and Linux systems running Node.js v10+
19
+ Most modern macOS, Windows and Linux systems running Node.js >= 12.13.0
20
20
  do not require any additional install or runtime dependencies.
21
21
 
22
22
  ## Documentation
@@ -99,7 +99,7 @@ A [guide for contributors](https://github.com/lovell/sharp/blob/master/.github/C
99
99
  covers reporting bugs, requesting features and submitting code changes.
100
100
 
101
101
  [![Test Coverage](https://coveralls.io/repos/lovell/sharp/badge.svg?branch=master)](https://coveralls.io/r/lovell/sharp?branch=master)
102
- [![N-API v3](https://img.shields.io/badge/N--API-v3-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix)
102
+ [![Node-API v5](https://img.shields.io/badge/Node--API-v5-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix)
103
103
 
104
104
  ## Licensing
105
105
 
@@ -1,7 +1,8 @@
1
1
  {
2
2
  'variables': {
3
3
  'vips_version': '<!(node -p "require(\'./lib/libvips\').minimumLibvipsVersion")',
4
- 'sharp_vendor_dir': '<(module_root_dir)/vendor/<(vips_version)'
4
+ 'platform_and_arch': '<!(node -p "require(\'./lib/platform\')()")',
5
+ 'sharp_vendor_dir': './vendor/<(vips_version)/<(platform_and_arch)'
5
6
  },
6
7
  'targets': [{
7
8
  'target_name': 'libvips-cpp',
@@ -37,6 +38,7 @@
37
38
  'msvs_settings': {
38
39
  'VCCLCompilerTool': {
39
40
  'ExceptionHandling': 1,
41
+ 'Optimization': 1,
40
42
  'WholeProgramOptimization': 'true'
41
43
  },
42
44
  'VCLibrarianTool': {
@@ -65,9 +67,9 @@
65
67
  }]
66
68
  ]
67
69
  }, {
68
- 'target_name': 'sharp',
70
+ 'target_name': 'sharp-<(platform_and_arch)',
69
71
  'defines': [
70
- 'NAPI_VERSION=3'
72
+ 'NAPI_VERSION=5'
71
73
  ],
72
74
  'dependencies': [
73
75
  '<!(node -p "require(\'node-addon-api\').gyp")',
@@ -138,7 +140,7 @@
138
140
  }],
139
141
  ['OS == "mac"', {
140
142
  'link_settings': {
141
- 'library_dirs': ['<(sharp_vendor_dir)/lib'],
143
+ 'library_dirs': ['../<(sharp_vendor_dir)/lib'],
142
144
  'libraries': [
143
145
  'libvips-cpp.42.dylib'
144
146
  ]
@@ -146,7 +148,7 @@
146
148
  'xcode_settings': {
147
149
  'OTHER_LDFLAGS': [
148
150
  # Ensure runtime linking is relative to sharp.node
149
- '-Wl,-rpath,\'@loader_path/../../vendor/<(vips_version)/lib\''
151
+ '-Wl,-rpath,\'@loader_path/../../<(sharp_vendor_dir)/lib\''
150
152
  ]
151
153
  }
152
154
  }],
@@ -155,13 +157,13 @@
155
157
  '_GLIBCXX_USE_CXX11_ABI=1'
156
158
  ],
157
159
  'link_settings': {
158
- 'library_dirs': ['<(sharp_vendor_dir)/lib'],
160
+ 'library_dirs': ['../<(sharp_vendor_dir)/lib'],
159
161
  'libraries': [
160
162
  '-l:libvips-cpp.so.42'
161
163
  ],
162
164
  'ldflags': [
163
165
  # Ensure runtime linking is relative to sharp.node
164
- '-Wl,-s -Wl,--disable-new-dtags -Wl,-rpath=\'$$ORIGIN/../../vendor/<(vips_version)/lib\''
166
+ '-Wl,-s -Wl,--disable-new-dtags -Wl,-rpath=\'$$ORIGIN/../../<(sharp_vendor_dir)/lib\''
165
167
  ]
166
168
  }
167
169
  }]
@@ -172,7 +174,7 @@
172
174
  '-std=c++0x',
173
175
  '-fexceptions',
174
176
  '-Wall',
175
- '-O3'
177
+ '-Os'
176
178
  ],
177
179
  'xcode_settings': {
178
180
  'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
@@ -182,7 +184,7 @@
182
184
  'OTHER_CPLUSPLUSFLAGS': [
183
185
  '-fexceptions',
184
186
  '-Wall',
185
- '-O3'
187
+ '-Oz'
186
188
  ]
187
189
  },
188
190
  'configurations': {
@@ -202,6 +204,7 @@
202
204
  'msvs_settings': {
203
205
  'VCCLCompilerTool': {
204
206
  'ExceptionHandling': 1,
207
+ 'Optimization': 1,
205
208
  'WholeProgramOptimization': 'true'
206
209
  },
207
210
  'VCLibrarianTool': {
@@ -4,19 +4,19 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
 
6
6
  const libvips = require('../lib/libvips');
7
+ const platform = require('../lib/platform');
7
8
 
8
9
  const minimumLibvipsVersion = libvips.minimumLibvipsVersion;
9
10
 
10
- const platform = process.env.npm_config_platform || process.platform;
11
- if (platform === 'win32') {
12
- const buildDir = path.join(__dirname, '..', 'build');
13
- const buildReleaseDir = path.join(buildDir, 'Release');
11
+ const platformAndArch = platform();
12
+
13
+ if (platformAndArch.startsWith('win32')) {
14
+ const buildReleaseDir = path.join(__dirname, '..', 'build', 'Release');
14
15
  libvips.log(`Creating ${buildReleaseDir}`);
15
16
  try {
16
- libvips.mkdirSync(buildDir);
17
17
  libvips.mkdirSync(buildReleaseDir);
18
18
  } catch (err) {}
19
- const vendorLibDir = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion, 'lib');
19
+ const vendorLibDir = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion, platformAndArch, 'lib');
20
20
  libvips.log(`Copying DLLs from ${vendorLibDir} to ${buildReleaseDir}`);
21
21
  try {
22
22
  fs
@@ -24,6 +24,7 @@ const minimumGlibcVersionByArch = {
24
24
 
25
25
  const hasSharpPrebuild = [
26
26
  'darwin-x64',
27
+ 'darwin-arm64',
27
28
  'linux-arm64',
28
29
  'linux-x64',
29
30
  'linuxmusl-x64',
@@ -35,7 +36,6 @@ const hasSharpPrebuild = [
35
36
  const { minimumLibvipsVersion, minimumLibvipsVersionLabelled } = libvips;
36
37
  const distHost = process.env.npm_config_sharp_libvips_binary_host || 'https://github.com/lovell/sharp-libvips/releases/download';
37
38
  const distBaseUrl = process.env.npm_config_sharp_dist_base_url || process.env.SHARP_DIST_BASE_URL || `${distHost}/v${minimumLibvipsVersionLabelled}/`;
38
- const supportsBrotli = ('BrotliDecompress' in zlib);
39
39
  const installationForced = !!(process.env.npm_config_sharp_install_force || process.env.SHARP_INSTALL_FORCE);
40
40
 
41
41
  const fail = function (err) {
@@ -56,9 +56,7 @@ const handleError = function (err) {
56
56
  };
57
57
 
58
58
  const extractTarball = function (tarPath, platformAndArch) {
59
- const vendorPath = path.join(__dirname, '..', 'vendor');
60
- libvips.mkdirSync(vendorPath);
61
- const versionedVendorPath = path.join(vendorPath, minimumLibvipsVersion);
59
+ const versionedVendorPath = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion, platformAndArch);
62
60
  libvips.mkdirSync(versionedVendorPath);
63
61
 
64
62
  const ignoreVendorInclude = hasSharpPrebuild.includes(platformAndArch) && !process.env.npm_config_build_from_source;
@@ -68,7 +66,7 @@ const extractTarball = function (tarPath, platformAndArch) {
68
66
 
69
67
  stream.pipeline(
70
68
  fs.createReadStream(tarPath),
71
- supportsBrotli ? new zlib.BrotliDecompress() : new zlib.Gunzip(),
69
+ new zlib.BrotliDecompress(),
72
70
  tarFs.extract(versionedVendorPath, { ignore }),
73
71
  function (err) {
74
72
  if (err) {
@@ -121,10 +119,8 @@ try {
121
119
  handleError(new Error(`Expected Node.js version ${supportedNodeVersion} but found ${process.versions.node}`));
122
120
  }
123
121
 
124
- const extension = supportsBrotli ? 'br' : 'gz';
125
-
126
122
  // Download to per-process temporary file
127
- const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.' + extension;
123
+ const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.br';
128
124
  const tarPathCache = path.join(libvips.cachePath(), tarFilename);
129
125
  if (fs.existsSync(tarPathCache)) {
130
126
  libvips.log(`Using cached ${tarPathCache}`);
@@ -72,13 +72,17 @@ function ensureAlpha (alpha) {
72
72
  * Extract a single channel from a multi-channel image.
73
73
  *
74
74
  * @example
75
- * sharp(input)
75
+ * // green.jpg is a greyscale image containing the green channel of the input
76
+ * await sharp(input)
76
77
  * .extractChannel('green')
77
- * .toColourspace('b-w')
78
- * .toFile('green.jpg', function(err, info) {
79
- * // info.channels === 1
80
- * // green.jpg is a greyscale image containing the green channel of the input
81
- * });
78
+ * .toFile('green.jpg');
79
+ *
80
+ * @example
81
+ * // red1 is the red value of the first pixel, red2 the second pixel etc.
82
+ * const [red1, red2, ...] = await sharp(input)
83
+ * .extractChannel(0)
84
+ * .raw()
85
+ * .toBuffer();
82
86
  *
83
87
  * @param {number|string} channel - zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`.
84
88
  * @returns {Sharp}
@@ -94,7 +98,7 @@ function extractChannel (channel) {
94
98
  } else {
95
99
  throw is.invalidParameterError('channel', 'integer or one of: red, green, blue, alpha', channel);
96
100
  }
97
- return this;
101
+ return this.toColourspace('b-w');
98
102
  }
99
103
 
100
104
  /**
@@ -54,6 +54,45 @@ function grayscale (grayscale) {
54
54
  return this.greyscale(grayscale);
55
55
  }
56
56
 
57
+ /**
58
+ * Set the pipeline colourspace.
59
+ *
60
+ * The input image will be converted to the provided colourspace at the start of the pipeline.
61
+ * All operations will use this colourspace before converting to the output colourspace, as defined by {@link toColourspace}.
62
+ *
63
+ * This feature is experimental and has not yet been fully-tested with all operations.
64
+ *
65
+ * @since 0.29.0
66
+ *
67
+ * @example
68
+ * // Run pipeline in 16 bits per channel RGB while converting final result to 8 bits per channel sRGB.
69
+ * await sharp(input)
70
+ * .pipelineColourspace('rgb16')
71
+ * .toColourspace('srgb')
72
+ * .toFile('16bpc-pipeline-to-8bpc-output.png')
73
+ *
74
+ * @param {string} [colourspace] - pipeline colourspace e.g. `rgb16`, `scrgb`, `lab`, `grey16` [...](https://github.com/libvips/libvips/blob/41cff4e9d0838498487a00623462204eb10ee5b8/libvips/iofuncs/enumtypes.c#L774)
75
+ * @returns {Sharp}
76
+ * @throws {Error} Invalid parameters
77
+ */
78
+ function pipelineColourspace (colourspace) {
79
+ if (!is.string(colourspace)) {
80
+ throw is.invalidParameterError('colourspace', 'string', colourspace);
81
+ }
82
+ this.options.colourspaceInput = colourspace;
83
+ return this;
84
+ }
85
+
86
+ /**
87
+ * Alternative spelling of `pipelineColourspace`.
88
+ * @param {string} [colorspace] - pipeline colorspace.
89
+ * @returns {Sharp}
90
+ * @throws {Error} Invalid parameters
91
+ */
92
+ function pipelineColorspace (colorspace) {
93
+ return this.pipelineColourspace(colorspace);
94
+ }
95
+
57
96
  /**
58
97
  * Set the output colourspace.
59
98
  * By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
@@ -64,7 +103,7 @@ function grayscale (grayscale) {
64
103
  * .toColourspace('rgb16')
65
104
  * .toFile('16-bpp.png')
66
105
  *
67
- * @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568)
106
+ * @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/3c0bfdf74ce1dc37a6429bed47fa76f16e2cd70a/libvips/iofuncs/enumtypes.c#L777-L794)
68
107
  * @returns {Sharp}
69
108
  * @throws {Error} Invalid parameters
70
109
  */
@@ -119,6 +158,8 @@ module.exports = function (Sharp) {
119
158
  tint,
120
159
  greyscale,
121
160
  grayscale,
161
+ pipelineColourspace,
162
+ pipelineColorspace,
122
163
  toColourspace,
123
164
  toColorspace,
124
165
  // Private
@@ -5,32 +5,7 @@ const stream = require('stream');
5
5
  const is = require('./is');
6
6
 
7
7
  require('./libvips').hasVendoredLibvips();
8
-
9
- /* istanbul ignore next */
10
- try {
11
- require('../build/Release/sharp.node');
12
- } catch (err) {
13
- // Bail early if bindings aren't available
14
- const help = ['', 'Something went wrong installing the "sharp" module', '', err.message, ''];
15
- if (/NODE_MODULE_VERSION/.test(err.message)) {
16
- help.push('- Ensure the version of Node.js used at install time matches that used at runtime');
17
- } else if (/invalid ELF header/.test(err.message)) {
18
- help.push(`- Ensure "${process.platform}" is used at install time as well as runtime`);
19
- } else if (/dylib/.test(err.message) && /Incompatible library version/.test(err.message)) {
20
- help.push('- Run "brew update && brew upgrade vips"');
21
- } else {
22
- help.push(
23
- '- Remove the "node_modules/sharp" directory then run',
24
- ' "npm install --ignore-scripts=false --verbose sharp" and look for errors'
25
- );
26
- }
27
- help.push(
28
- '- Consult the installation documentation at https://sharp.pixelplumbing.com/install',
29
- '- Search for this error at https://github.com/lovell/sharp/issues', ''
30
- );
31
- const error = help.join('\n');
32
- throw new Error(error);
33
- }
8
+ require('./sharp');
34
9
 
35
10
  // Use NODE_DEBUG=sharp to enable libvips warnings
36
11
  const debuglog = util.debuglog('sharp');
@@ -117,8 +92,9 @@ const debuglog = util.debuglog('sharp');
117
92
  * }
118
93
  * }).toFile('noise.png');
119
94
  *
120
- * @param {(Buffer|Uint8Array|Uint8ClampedArray|string)} [input] - if present, can be
121
- * a Buffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data, or
95
+ * @param {(Buffer|Uint8Array|Uint8ClampedArray|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array|Float64Array|string)} [input] - if present, can be
96
+ * a Buffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or
97
+ * a TypedArray containing raw pixel image data, or
122
98
  * a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file.
123
99
  * JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present.
124
100
  * @param {Object} [options] - if present, is an Object with optional attributes.
@@ -204,6 +180,7 @@ const Sharp = function (input, options) {
204
180
  flatten: false,
205
181
  flattenBackground: [0, 0, 0],
206
182
  negate: false,
183
+ negateAlpha: true,
207
184
  medianSize: 0,
208
185
  blurSigma: 0,
209
186
  sharpenSigma: 0,
@@ -222,6 +199,7 @@ const Sharp = function (input, options) {
222
199
  brightness: 1,
223
200
  saturation: 1,
224
201
  hue: 0,
202
+ lightness: 0,
225
203
  booleanBufferIn: null,
226
204
  booleanFileIn: '',
227
205
  joinChannelIn: [],
@@ -229,6 +207,7 @@ const Sharp = function (input, options) {
229
207
  removeAlpha: false,
230
208
  ensureAlpha: -1,
231
209
  colourspace: 'srgb',
210
+ colourspaceInput: 'last',
232
211
  composite: [],
233
212
  // output
234
213
  fileOut: '',
@@ -254,8 +233,13 @@ const Sharp = function (input, options) {
254
233
  pngAdaptiveFiltering: false,
255
234
  pngPalette: false,
256
235
  pngQuality: 100,
257
- pngColours: 256,
236
+ pngBitdepth: 8,
258
237
  pngDither: 1,
238
+ jp2Quality: 80,
239
+ jp2TileHeight: 512,
240
+ jp2TileWidth: 512,
241
+ jp2Lossless: false,
242
+ jp2ChromaSubsampling: '4:4:4',
259
243
  webpQuality: 80,
260
244
  webpAlphaQuality: 100,
261
245
  webpLossless: false,
@@ -276,7 +260,8 @@ const Sharp = function (input, options) {
276
260
  heifLossless: false,
277
261
  heifCompression: 'av1',
278
262
  heifSpeed: 5,
279
- heifChromaSubsampling: '4:2:0',
263
+ heifChromaSubsampling: '4:4:4',
264
+ rawDepth: 'uchar',
280
265
  tileSize: 256,
281
266
  tileOverlap: 0,
282
267
  tileContainer: 'fs',
@@ -288,6 +273,7 @@ const Sharp = function (input, options) {
288
273
  tileBackground: [255, 255, 255, 255],
289
274
  tileCentre: false,
290
275
  tileId: 'https://example.com/iiif',
276
+ timeoutSeconds: 0,
291
277
  linearA: 1,
292
278
  linearB: 0,
293
279
  // Function to notify of libvips warnings
@@ -303,7 +289,8 @@ const Sharp = function (input, options) {
303
289
  this.options.input = this._createInputDescriptor(input, options, { allowStream: true });
304
290
  return this;
305
291
  };
306
- util.inherits(Sharp, stream.Duplex);
292
+ Object.setPrototypeOf(Sharp.prototype, stream.Duplex.prototype);
293
+ Object.setPrototypeOf(Sharp, stream.Duplex);
307
294
 
308
295
  /**
309
296
  * Take a "snapshot" of the Sharp instance, returning a new instance.