@napi-rs/image 1.9.0 → 1.9.1

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 (2) hide show
  1. package/index.js +32 -17
  2. package/package.json +15 -15
package/index.js CHANGED
@@ -88,7 +88,7 @@ switch (platform) {
88
88
  }
89
89
  break
90
90
  default:
91
- throw new Error(`Unsupported architecture on Android ${arch}`)
91
+ loadError = new Error(`Unsupported architecture on Android ${arch}`)
92
92
  }
93
93
  break
94
94
  case 'win32':
@@ -136,7 +136,7 @@ switch (platform) {
136
136
  }
137
137
  break
138
138
  default:
139
- throw new Error(`Unsupported architecture on Windows: ${arch}`)
139
+ loadError = new Error(`Unsupported architecture on Windows: ${arch}`)
140
140
  }
141
141
  break
142
142
  case 'darwin':
@@ -177,22 +177,37 @@ switch (platform) {
177
177
  }
178
178
  break
179
179
  default:
180
- throw new Error(`Unsupported architecture on macOS: ${arch}`)
180
+ loadError = new Error(`Unsupported architecture on macOS: ${arch}`)
181
181
  }
182
182
  break
183
183
  case 'freebsd':
184
- if (arch !== 'x64') {
185
- throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
186
- }
187
- localFileExisted = existsSync(join(__dirname, 'image.freebsd-x64.node'))
188
- try {
189
- if (localFileExisted) {
190
- nativeBinding = require('./image.freebsd-x64.node')
191
- } else {
192
- nativeBinding = require('@napi-rs/image-freebsd-x64')
193
- }
194
- } catch (e) {
195
- loadError = e
184
+ switch (arch) {
185
+ case 'x64':
186
+ localFileExisted = existsSync(join(__dirname, 'image.freebsd-x64.node'))
187
+ try {
188
+ if (localFileExisted) {
189
+ nativeBinding = require('./image.freebsd-x64.node')
190
+ } else {
191
+ nativeBinding = require('@napi-rs/image-freebsd-x64')
192
+ }
193
+ } catch (e) {
194
+ loadError = e
195
+ }
196
+ break
197
+ case 'arm64':
198
+ localFileExisted = existsSync(join(__dirname, 'image.freebsd-arm64.node'))
199
+ try {
200
+ if (localFileExisted) {
201
+ nativeBinding = require('./image.freebsd-arm64.node')
202
+ } else {
203
+ nativeBinding = require('@napi-rs/image-freebsd-arm64')
204
+ }
205
+ } catch (e) {
206
+ loadError = e
207
+ }
208
+ break
209
+ default:
210
+ loadError = new Error(`Unsupported architecture on FreeBSD: ${arch}`)
196
211
  }
197
212
  break
198
213
  case 'linux':
@@ -313,11 +328,11 @@ switch (platform) {
313
328
  }
314
329
  break
315
330
  default:
316
- throw new Error(`Unsupported architecture on Linux: ${arch}`)
331
+ loadError = new Error(`Unsupported architecture on Linux: ${arch}`)
317
332
  }
318
333
  break
319
334
  default:
320
- throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
335
+ loadError = new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
321
336
  }
322
337
 
323
338
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/image",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "main": "index.js",
5
5
  "browser": "browser.js",
6
6
  "types": "index.d.ts",
@@ -64,22 +64,22 @@
64
64
  },
65
65
  "repository": "git@github.com:Brooooooklyn/Image.git",
66
66
  "devDependencies": {
67
- "@napi-rs/cli": "^3.0.0-alpha.40",
67
+ "@napi-rs/cli": "^3.0.0-alpha.41",
68
68
  "@napi-rs/wasm-runtime": "^0.1.1"
69
69
  },
70
- "gitHead": "caeb47b4e0b58de9280f5bdd2dab4d16c643d6b7",
70
+ "gitHead": "6ae9c06a58067b966adc1357f99d3debf332210c",
71
71
  "optionalDependencies": {
72
- "@napi-rs/image-darwin-x64": "1.9.0",
73
- "@napi-rs/image-win32-x64-msvc": "1.9.0",
74
- "@napi-rs/image-linux-x64-gnu": "1.9.0",
75
- "@napi-rs/image-darwin-arm64": "1.9.0",
76
- "@napi-rs/image-android-arm64": "1.9.0",
77
- "@napi-rs/image-linux-arm64-gnu": "1.9.0",
78
- "@napi-rs/image-linux-arm64-musl": "1.9.0",
79
- "@napi-rs/image-linux-arm-gnueabihf": "1.9.0",
80
- "@napi-rs/image-linux-x64-musl": "1.9.0",
81
- "@napi-rs/image-freebsd-x64": "1.9.0",
82
- "@napi-rs/image-win32-ia32-msvc": "1.9.0",
83
- "@napi-rs/image-wasm32-wasi": "1.9.0"
72
+ "@napi-rs/image-darwin-x64": "1.9.1",
73
+ "@napi-rs/image-win32-x64-msvc": "1.9.1",
74
+ "@napi-rs/image-linux-x64-gnu": "1.9.1",
75
+ "@napi-rs/image-darwin-arm64": "1.9.1",
76
+ "@napi-rs/image-android-arm64": "1.9.1",
77
+ "@napi-rs/image-linux-arm64-gnu": "1.9.1",
78
+ "@napi-rs/image-linux-arm64-musl": "1.9.1",
79
+ "@napi-rs/image-linux-arm-gnueabihf": "1.9.1",
80
+ "@napi-rs/image-linux-x64-musl": "1.9.1",
81
+ "@napi-rs/image-freebsd-x64": "1.9.1",
82
+ "@napi-rs/image-win32-ia32-msvc": "1.9.1",
83
+ "@napi-rs/image-wasm32-wasi": "1.9.1"
84
84
  }
85
85
  }